@sanity/client 2.22.6-next.121 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "2.22.6-next.121+f4b307b30b",
3
+ "version": "2.23.0",
4
4
  "description": "Client for retrieving data from Sanity",
5
5
  "main": "lib/sanityClient.js",
6
6
  "umd": "umd/sanityClient.min.js",
@@ -22,11 +22,11 @@
22
22
  "./lib/http/nodeMiddleware.js": "./lib/http/browserMiddleware.js"
23
23
  },
24
24
  "dependencies": {
25
- "@sanity/eventsource": "2.22.6-next.121+f4b307b30b",
26
- "@sanity/generate-help-url": "2.22.6-next.121+f4b307b30b",
25
+ "@sanity/eventsource": "2.23.0",
26
+ "@sanity/generate-help-url": "2.18.0",
27
27
  "@sanity/observable": "2.0.9",
28
28
  "deep-assign": "^2.0.0",
29
- "get-it": "^5.0.3",
29
+ "get-it": "^5.1.0",
30
30
  "make-error": "^1.3.0",
31
31
  "object-assign": "^4.1.1"
32
32
  },
@@ -83,5 +83,5 @@
83
83
  ],
84
84
  "sourceMap": false
85
85
  },
86
- "gitHead": "f4b307b30bf94dd5a5eed9defe30f281b61f326b"
86
+ "gitHead": "f24c67594507a023c8d2b2e6086bf3fbd192881f"
87
87
  }
@@ -6,246 +6,252 @@
6
6
  },{}],2:[function(require,module,exports){
7
7
  "use strict";var _require=require("rxjs/internal/Observable"),Observable=_require.Observable,assign=require("object-assign"),_require2=require("../operators/map"),map=_require2.map,_require3=require("../operators/filter"),filter=_require3.filter,_require4=require("../operators/reduce"),reduce=_require4.reduce;function SanityObservableMinimal(){Observable.apply(this,arguments)}function createDeprecatedMemberOp(e,r){var a=!1;return function(){return a||(a=!0,console.warn(new Error("Calling observable.".concat(e,"(...) is deprecated. Please use observable.pipe(").concat(e,"(...)) instead")))),this.pipe(r.apply(this,arguments))}}SanityObservableMinimal.prototype=Object.create(assign(Object.create(null),Observable.prototype)),Object.defineProperty(SanityObservableMinimal.prototype,"constructor",{value:SanityObservableMinimal,enumerable:!1,writable:!0,configurable:!0}),SanityObservableMinimal.prototype.lift=function(e){var r=new SanityObservableMinimal;return r.source=this,r.operator=e,r},SanityObservableMinimal.prototype.map=createDeprecatedMemberOp("map",map),SanityObservableMinimal.prototype.filter=createDeprecatedMemberOp("filter",filter),SanityObservableMinimal.prototype.reduce=createDeprecatedMemberOp("filter",reduce),module.exports=SanityObservableMinimal;
8
8
 
9
- },{"../operators/filter":4,"../operators/map":5,"../operators/reduce":6,"object-assign":26,"rxjs/internal/Observable":30}],3:[function(require,module,exports){
9
+ },{"../operators/filter":4,"../operators/map":5,"../operators/reduce":6,"object-assign":10,"rxjs/internal/Observable":11}],3:[function(require,module,exports){
10
10
  module.exports=require("./lib/SanityObservableMinimal");
11
11
 
12
12
  },{"./lib/SanityObservableMinimal":2}],4:[function(require,module,exports){
13
13
  exports.filter=require("rxjs/internal/operators/filter").filter;
14
14
 
15
- },{"rxjs/internal/operators/filter":37}],5:[function(require,module,exports){
15
+ },{"rxjs/internal/operators/filter":18}],5:[function(require,module,exports){
16
16
  exports.map=require("rxjs/internal/operators/map").map;
17
17
 
18
- },{"rxjs/internal/operators/map":38}],6:[function(require,module,exports){
18
+ },{"rxjs/internal/operators/map":19}],6:[function(require,module,exports){
19
19
  exports.reduce=require("rxjs/internal/operators/reduce").reduce;
20
20
 
21
- },{"rxjs/internal/operators/reduce":39}],7:[function(require,module,exports){
21
+ },{"rxjs/internal/operators/reduce":20}],7:[function(require,module,exports){
22
22
  "use strict";var isObj=require("is-obj"),hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(r){if(null==r)throw new TypeError("Sources cannot be null or undefined");return Object(r)}function assignKey(r,e,n){var t=e[n];if(null!=t){if(hasOwnProperty.call(r,n)&&(void 0===r[n]||null===r[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");hasOwnProperty.call(r,n)&&isObj(t)?r[n]=assign(Object(r[n]),e[n]):r[n]=t}}function assign(r,e){if(r===e)return r;for(var n in e=Object(e))hasOwnProperty.call(e,n)&&assignKey(r,e,n);if(Object.getOwnPropertySymbols)for(var t=Object.getOwnPropertySymbols(e),o=0;o<t.length;o++)propIsEnumerable.call(e,t[o])&&assignKey(r,e,t[o]);return r}module.exports=function(r){r=toObject(r);for(var e=1;e<arguments.length;e++)assign(r,arguments[e]);return r};
23
23
 
24
24
  },{"is-obj":8}],8:[function(require,module,exports){
25
25
  "use strict";module.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)};
26
26
 
27
27
  },{}],9:[function(require,module,exports){
28
- module.exports=require("./lib-node");
29
-
30
- },{"./lib-node":10}],10:[function(require,module,exports){
31
- "use strict";var pubsub=require("nano-pubsub"),middlewareReducer=require("./util/middlewareReducer"),processOptions=require("./middleware/defaultOptionsProcessor"),validateOptions=require("./middleware/defaultOptionsValidator"),httpRequest=require("./request"),channelNames=["request","response","progress","error","abort"],middlehooks=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];module.exports=function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],n=middlehooks.reduce(function(e,r){return e[r]=e[r]||[],e},{processOptions:[processOptions],validateOptions:[validateOptions]});function o(e){var r=channelNames.reduce(function(e,r){return e[r]=pubsub(),e},{}),t=middlewareReducer(n),o=t("processOptions",e);t("validateOptions",o);var s={options:o,channels:r,applyMiddleware:t},i=null,u=r.request.subscribe(function(e){i=httpRequest(e,function(n,o){return function(e,n,o){var s=e,i=n;if(!s)try{i=t("onResponse",n,o)}catch(e){i=null,s=e}(s=s&&t("onError",s,o))?r.error.publish(s):i&&r.response.publish(i)}(n,o,e)})});r.abort.subscribe(function(){u(),i&&i.abort()});var a=t("onReturn",r,s);return a===r&&r.request.publish(s),a}return o.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&&n.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 middlehooks.forEach(function(r){e[r]&&n[r].push(e[r])}),t.push(e),o},o.clone=function(){return e(t)},r.forEach(o.use),o};
32
-
33
- },{"./middleware/defaultOptionsProcessor":11,"./middleware/defaultOptionsValidator":12,"./request":19,"./util/middlewareReducer":21,"nano-pubsub":22}],11:[function(require,module,exports){
34
- "use strict";var objectAssign=require("object-assign"),urlParse=require("url-parse"),isReactNative="undefined"!=typeof navigator&&"ReactNative"===navigator.product,has=Object.prototype.hasOwnProperty,defaultOptions={timeout:isReactNative?6e4:12e4};function stringifyQueryString(e){var t=[];for(var r in e)has.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 normalizeTimeout(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?normalizeTimeout(defaultOptions.timeout):{connect:t,socket:t}}function removeUndefined(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}module.exports=function(e){var t="string"==typeof e?objectAssign({url:e},defaultOptions):objectAssign({},defaultOptions,e),r=urlParse(t.url,{},!0);return t.timeout=normalizeTimeout(t.timeout),t.query&&(r.query=objectAssign({},r.query,removeUndefined(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(stringifyQueryString),t};
35
-
36
- },{"object-assign":26,"url-parse":56}],12:[function(require,module,exports){
37
- "use strict";var validUrl=/^https?:\/\//i;module.exports=function(r){if(!validUrl.test(r.url))throw new Error('"'+r.url+'" is not a valid URL')};
38
-
39
- },{}],13:[function(require,module,exports){
40
- "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},objectAssign=require("object-assign"),isPlainObject=require("is-plain-object"),serializeTypes=["boolean","string","number"],isBuffer=function(o){return!!o.constructor&&"function"==typeof o.constructor.isBuffer&&o.constructor.isBuffer(o)};module.exports=function(){return{processOptions:function(o){var e=o.body;return e&&!("function"==typeof e.pipe)&&!isBuffer(e)&&(-1!==serializeTypes.indexOf(void 0===e?"undefined":_typeof(e))||Array.isArray(e)||isPlainObject(e))?objectAssign({},o,{body:JSON.stringify(o.body),headers:objectAssign({},o.headers,{"Content-Type":"application/json"})}):o}}};
41
-
42
- },{"is-plain-object":23,"object-assign":26}],14:[function(require,module,exports){
43
- "use strict";var objectAssign=require("object-assign");function tryParse(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: "+e.message,e}}module.exports=function(e){return{onResponse:function(s){var t=s.headers["content-type"]||"",n=e&&e.force||-1!==t.indexOf("application/json");return s.body&&t&&n?objectAssign({},s,{body:tryParse(s.body)}):s},processOptions:function(e){return objectAssign({},e,{headers:objectAssign({Accept:"application/json"},e.headers)})}}};
44
-
45
- },{"object-assign":26}],15:[function(require,module,exports){
46
- "use strict";var global=require("../util/global"),objectAssign=require("object-assign");module.exports=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||global.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(r,n){return new e(function(e){return r.error.subscribe(function(r){return e.error(r)}),r.progress.subscribe(function(r){return e.next(objectAssign({type:"progress"},r))}),r.response.subscribe(function(r){e.next(objectAssign({type:"response"},r)),e.complete()}),r.request.publish(n),function(){return r.abort.publish()}})}}};
47
-
48
- },{"../util/global":20,"object-assign":26}],16:[function(require,module,exports){
49
- "use strict";module.exports=function(){return{onRequest:function(o){if("xhr"===o.adapter){var e=o.request,t=o.context;"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=n("upload")),"onprogress"in e&&(e.onprogress=n("download"))}function n(o){return function(e){var n=e.lengthComputable?e.loaded/e.total*100:-1;t.channels.progress.publish({stage:o,percent:n,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}}}};
50
-
51
- },{}],17:[function(require,module,exports){
52
- "use strict";module.exports=require("./node-progress");
53
-
54
- },{"./node-progress":16}],18:[function(require,module,exports){
55
- "use strict";var sameOrigin=require("same-origin"),parseHeaders=require("parse-headers"),noop=function(){},win=window,XmlHttpRequest=win.XMLHttpRequest||noop,hasXhr2="withCredentials"in new XmlHttpRequest,XDomainRequest=hasXhr2?XmlHttpRequest:win.XDomainRequest,adapter="xhr";module.exports=function(e,t){var r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},s=win&&win.location&&!sameOrigin(win.location.href,n.url),a=e.applyMiddleware("interceptRequest",void 0,{adapter:adapter,context:e});if(a){var i=setTimeout(t,0,null,a);return{abort:function(){return clearTimeout(i)}}}var u=s?new XDomainRequest:new XmlHttpRequest,c=win.XDomainRequest&&u instanceof win.XDomainRequest,d=n.headers,l=!1,p=!1,f=!1;if(u.onerror=R,u.ontimeout=R,u.onabort=function(){l=!0},u.onprogress=function(){},u[c?"onload":"onreadystatechange"]=function(){!function(){if(!m)return;q(),o.socket=setTimeout(function(){return h("ESOCKETTIMEDOUT")},m.socket)}(),l||4!==u.readyState&&!c||0!==u.status&&function(){if(l||p||f)return;if(0===u.status)return void R(new Error("Unknown XHR error"));q(),p=!0,t(null,function(){var e=u.status,t=u.statusText;if(c&&void 0===e)e=200;else{if(e>12e3&&e<12156)return R();e=1223===u.status?204:u.status,t=1223===u.status?"No Content":t}return{body:u.response||u.responseText,url:n.url,method:n.method,headers:c?{}:parseHeaders(u.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},u.open(n.method,n.url,!0),u.withCredentials=!!n.withCredentials,d&&u.setRequestHeader)for(var w in d)d.hasOwnProperty(w)&&u.setRequestHeader(w,d[w]);else if(d&&c)throw new Error("Headers cannot be set on an XDomainRequest object");n.rawBody&&(u.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:adapter,request:u,context:e}),u.send(n.body||null);var m=n.timeout;return m&&(o.connect=setTimeout(function(){return h("ETIMEDOUT")},m.connect)),{abort:function(){l=!0,u&&u.abort()}};function h(t){f=!0,u.abort();var r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to "+n.url:"Connection timed out on request to "+n.url);r.code=t,e.channels.error.publish(r)}function q(){(l||u.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function R(){if(!p){q(),p=!0,u=null;var e=new Error("Network error while attempting to reach "+n.url);e.isNetworkError=!0,e.request=n,t(e)}}};
56
-
57
- },{"parse-headers":27,"same-origin":54}],19:[function(require,module,exports){
58
- "use strict";module.exports=require("./node-request");
59
-
60
- },{"./node-request":18}],20:[function(require,module,exports){
61
- (function (global){(function (){
62
- "use strict";"undefined"!=typeof window?module.exports=window:"undefined"!=typeof global?module.exports=global:"undefined"!=typeof self?module.exports=self:module.exports={};
63
-
64
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65
- },{}],21:[function(require,module,exports){
66
- "use strict";module.exports=function(r){return function(n,o){for(var t=arguments.length,e=Array(t>2?t-2:0),u=2;u<t;u++)e[u-2]=arguments[u];for(var a="onError"===n,c=o,f=0;f<r[n].length&&(c=r[n][f].apply(void 0,[c].concat(e)),!a||c);f++);return c}};
67
-
68
- },{}],22:[function(require,module,exports){
69
- module.exports=function(){var n=[];return{subscribe:function(u){return n.push(u),function(){var r=n.indexOf(u);r>-1&&n.splice(r,1)}},publish:function(){for(var u=0;u<n.length;u++)n[u].apply(null,arguments)}}};
70
-
71
- },{}],23:[function(require,module,exports){
72
- "use strict";var isObject=require("isobject");function isObjectObject(t){return!0===isObject(t)&&"[object Object]"===Object.prototype.toString.call(t)}module.exports=function(t){var e,c;return!1!==isObjectObject(t)&&("function"==typeof(e=t.constructor)&&(!1!==isObjectObject(c=e.prototype)&&!1!==c.hasOwnProperty("isPrototypeOf")))};
73
-
74
- },{"isobject":24}],24:[function(require,module,exports){
75
- "use strict";module.exports=function(r){return null!=r&&"object"==typeof r&&!1===Array.isArray(r)};
76
-
77
- },{}],25:[function(require,module,exports){
78
28
  "use strict";var construct="undefined"!=typeof Reflect?Reflect.construct:void 0,defineProperty=Object.defineProperty,captureStackTrace=Error.captureStackTrace;function BaseError(r){void 0!==r&&defineProperty(this,"message",{configurable:!0,value:r,writable:!0});var e=this.constructor.name;void 0!==e&&e!==this.name&&defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),captureStackTrace(this,this.constructor)}void 0===captureStackTrace&&(captureStackTrace=function(r){var e=new Error;defineProperty(r,"stack",{configurable:!0,get:function(){var r=e.stack;return defineProperty(this,"stack",{configurable:!0,value:r,writable:!0}),r},set:function(e){defineProperty(r,"stack",{configurable:!0,value:e,writable:!0})}})}),BaseError.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:BaseError,writable:!0}});var setFunctionName=function(){function r(r,e){return defineProperty(r,"name",{configurable:!0,value:e})}try{var e=function(){};if(r(e,"foo"),"foo"===e.name)return r}catch(r){}}();function makeError(r,e){if(null==e||e===Error)e=BaseError;else if("function"!=typeof e)throw new TypeError("super_ should be a function");var t;if("string"==typeof r)t=r,r=void 0!==construct?function(){return construct(e,arguments,this.constructor)}:function(){e.apply(this,arguments)},void 0!==setFunctionName&&(setFunctionName(r,t),t=void 0);else if("function"!=typeof r)throw new TypeError("constructor should be either a string or a function");r.super_=r.super=e;var o={constructor:{configurable:!0,value:r,writable:!0}};return void 0!==t&&(o.name={configurable:!0,value:t,writable:!0}),r.prototype=Object.create(e.prototype,o),r}exports=module.exports=makeError,exports.BaseError=BaseError;
79
29
 
80
- },{}],26:[function(require,module,exports){
30
+ },{}],10:[function(require,module,exports){
81
31
  "use strict";var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map(function(e){return r[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){for(var s in t=Object(arguments[a]))hasOwnProperty.call(t,s)&&(o[s]=t[s]);if(getOwnPropertySymbols){n=getOwnPropertySymbols(t);for(var c=0;c<n.length;c++)propIsEnumerable.call(t,n[c])&&(o[n[c]]=t[n[c]])}}return o};
82
32
 
83
- },{}],27:[function(require,module,exports){
84
- var trim=function(r){return r.replace(/^\s+|\s+$/g,"")},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(r){if(!r)return{};for(var t={},e=trim(r).split("\n"),i=0;i<e.length;i++){var n=e[i],o=n.indexOf(":"),s=trim(n.slice(0,o)).toLowerCase(),a=trim(n.slice(o+1));void 0===t[s]?t[s]=a:isArray(t[s])?t[s].push(a):t[s]=[t[s],a]}return t};
85
-
86
- },{}],28:[function(require,module,exports){
87
- "use strict";var undef,has=Object.prototype.hasOwnProperty;function decode(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function encode(e){try{return encodeURIComponent(e)}catch(e){return null}}function querystring(e){for(var n,r=/([^=?#&]+)=?([^&]*)/g,t={};n=r.exec(e);){var o=decode(n[1]),u=decode(n[2]);null===o||null===u||o in t||(t[o]=u)}return t}function querystringify(e,n){n=n||"";var r,t,o=[];for(t in"string"!=typeof n&&(n="?"),e)if(has.call(e,t)){if((r=e[t])||null!==r&&r!==undef&&!isNaN(r)||(r=""),t=encode(t),r=encode(r),null===t||null===r)continue;o.push(t+"="+r)}return o.length?n+o.join("&"):""}exports.stringify=querystringify,exports.parse=querystring;
88
-
89
- },{}],29:[function(require,module,exports){
90
- "use strict";module.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};
91
-
92
- },{}],30:[function(require,module,exports){
33
+ },{}],11:[function(require,module,exports){
93
34
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var canReportError_1=require("./util/canReportError"),toSubscriber_1=require("./util/toSubscriber"),observable_1=require("./symbol/observable"),pipe_1=require("./util/pipe"),config_1=require("./config"),Observable=function(){function r(r){this._isScalar=!1,r&&(this._subscribe=r)}return r.prototype.lift=function(e){var o=new r;return o.source=this,o.operator=e,o},r.prototype.subscribe=function(r,e,o){var t=this.operator,n=toSubscriber_1.toSubscriber(r,e,o);if(t?n.add(t.call(n,this.source)):n.add(this.source||config_1.config.useDeprecatedSynchronousErrorHandling&&!n.syncErrorThrowable?this._subscribe(n):this._trySubscribe(n)),config_1.config.useDeprecatedSynchronousErrorHandling&&n.syncErrorThrowable&&(n.syncErrorThrowable=!1,n.syncErrorThrown))throw n.syncErrorValue;return n},r.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(e){config_1.config.useDeprecatedSynchronousErrorHandling&&(r.syncErrorThrown=!0,r.syncErrorValue=e),canReportError_1.canReportError(r)?r.error(e):console.warn(e)}},r.prototype.forEach=function(r,e){var o=this;return new(e=getPromiseCtor(e))(function(e,t){var n;n=o.subscribe(function(e){try{r(e)}catch(r){t(r),n&&n.unsubscribe()}},t,e)})},r.prototype._subscribe=function(r){var e=this.source;return e&&e.subscribe(r)},r.prototype[observable_1.observable]=function(){return this},r.prototype.pipe=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return 0===r.length?this:pipe_1.pipeFromArray(r)(this)},r.prototype.toPromise=function(r){var e=this;return new(r=getPromiseCtor(r))(function(r,o){var t;e.subscribe(function(r){return t=r},function(r){return o(r)},function(){return r(t)})})},r.create=function(e){return new r(e)},r}();function getPromiseCtor(r){if(r||(r=config_1.config.Promise||Promise),!r)throw new Error("no Promise impl found");return r}exports.Observable=Observable;
94
35
 
95
- },{"./config":34,"./symbol/observable":42,"./util/canReportError":46,"./util/pipe":52,"./util/toSubscriber":53}],31:[function(require,module,exports){
36
+ },{"./config":15,"./symbol/observable":23,"./util/canReportError":27,"./util/pipe":33,"./util/toSubscriber":34}],12:[function(require,module,exports){
96
37
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var config_1=require("./config"),hostReportError_1=require("./util/hostReportError");exports.empty={closed:!0,next:function(r){},error:function(r){if(config_1.config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError_1.hostReportError(r)},complete:function(){}};
97
38
 
98
- },{"./config":34,"./util/hostReportError":47}],32:[function(require,module,exports){
39
+ },{"./config":15,"./util/hostReportError":28}],13:[function(require,module,exports){
99
40
  "use strict";var __extends=this&&this.__extends||function(){var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)t.hasOwnProperty(e)&&(r[e]=t[e])})(t,e)};return function(t,e){function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0});var isFunction_1=require("./util/isFunction"),Observer_1=require("./Observer"),Subscription_1=require("./Subscription"),rxSubscriber_1=require("../internal/symbol/rxSubscriber"),config_1=require("./config"),hostReportError_1=require("./util/hostReportError"),Subscriber=function(r){function t(e,o,n){var s=r.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=Observer_1.empty;break;case 1:if(!e){s.destination=Observer_1.empty;break}if("object"==typeof e){e instanceof t?(s.syncErrorThrowable=e.syncErrorThrowable,s.destination=e,e.add(s)):(s.syncErrorThrowable=!0,s.destination=new SafeSubscriber(s,e));break}default:s.syncErrorThrowable=!0,s.destination=new SafeSubscriber(s,e,o,n)}return s}return __extends(t,r),t.prototype[rxSubscriber_1.rxSubscriber]=function(){return this},t.create=function(r,e,o){var n=new t(r,e,o);return n.syncErrorThrowable=!1,n},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this))},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){this.destination.error(r),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var r=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=r,this},t}(Subscription_1.Subscription);exports.Subscriber=Subscriber;var SafeSubscriber=function(r){function t(t,e,o,n){var s,i=r.call(this)||this;i._parentSubscriber=t;var c=i;return isFunction_1.isFunction(e)?s=e:e&&(s=e.next,o=e.error,n=e.complete,e!==Observer_1.empty&&(c=Object.create(e),isFunction_1.isFunction(c.unsubscribe)&&i.add(c.unsubscribe.bind(c)),c.unsubscribe=i.unsubscribe.bind(i))),i._context=c,i._next=s,i._error=o,i._complete=n,i}return __extends(t,r),t.prototype.next=function(r){if(!this.isStopped&&this._next){var t=this._parentSubscriber;config_1.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,r)&&this.unsubscribe():this.__tryOrUnsub(this._next,r)}},t.prototype.error=function(r){if(!this.isStopped){var t=this._parentSubscriber,e=config_1.config.useDeprecatedSynchronousErrorHandling;if(this._error)e&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,r),this.unsubscribe()):(this.__tryOrUnsub(this._error,r),this.unsubscribe());else if(t.syncErrorThrowable)e?(t.syncErrorValue=r,t.syncErrorThrown=!0):hostReportError_1.hostReportError(r),this.unsubscribe();else{if(this.unsubscribe(),e)throw r;hostReportError_1.hostReportError(r)}}},t.prototype.complete=function(){var r=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var e=function(){return r._complete.call(r._context)};config_1.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,e),this.unsubscribe()):(this.__tryOrUnsub(e),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(r,t){try{r.call(this._context,t)}catch(r){if(this.unsubscribe(),config_1.config.useDeprecatedSynchronousErrorHandling)throw r;hostReportError_1.hostReportError(r)}},t.prototype.__tryOrSetError=function(r,t,e){if(!config_1.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,e)}catch(t){return config_1.config.useDeprecatedSynchronousErrorHandling?(r.syncErrorValue=t,r.syncErrorThrown=!0,!0):(hostReportError_1.hostReportError(t),!0)}return!1},t.prototype._unsubscribe=function(){var r=this._parentSubscriber;this._context=null,this._parentSubscriber=null,r.unsubscribe()},t}(Subscriber);exports.SafeSubscriber=SafeSubscriber;
100
41
 
101
- },{"../internal/symbol/rxSubscriber":43,"./Observer":31,"./Subscription":33,"./config":34,"./util/hostReportError":47,"./util/isFunction":50}],33:[function(require,module,exports){
42
+ },{"../internal/symbol/rxSubscriber":24,"./Observer":12,"./Subscription":14,"./config":15,"./util/hostReportError":28,"./util/isFunction":31}],14:[function(require,module,exports){
102
43
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var isArray_1=require("./util/isArray"),isObject_1=require("./util/isObject"),isFunction_1=require("./util/isFunction"),UnsubscriptionError_1=require("./util/UnsubscriptionError"),Subscription=function(){function r(r){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,r&&(this._ctorUnsubscribe=!0,this._unsubscribe=r)}var i;return r.prototype.unsubscribe=function(){var i;if(!this.closed){var s=this._parentOrParents,t=this._ctorUnsubscribe,n=this._unsubscribe,e=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,s instanceof r)s.remove(this);else if(null!==s)for(var o=0;o<s.length;++o){s[o].remove(this)}if(isFunction_1.isFunction(n)){t&&(this._unsubscribe=void 0);try{n.call(this)}catch(r){i=r instanceof UnsubscriptionError_1.UnsubscriptionError?flattenUnsubscriptionErrors(r.errors):[r]}}if(isArray_1.isArray(e)){o=-1;for(var u=e.length;++o<u;){var c=e[o];if(isObject_1.isObject(c))try{c.unsubscribe()}catch(r){i=i||[],r instanceof UnsubscriptionError_1.UnsubscriptionError?i=i.concat(flattenUnsubscriptionErrors(r.errors)):i.push(r)}}}if(i)throw new UnsubscriptionError_1.UnsubscriptionError(i)}},r.prototype.add=function(i){var s=i;if(!i)return r.EMPTY;switch(typeof i){case"function":s=new r(i);case"object":if(s===this||s.closed||"function"!=typeof s.unsubscribe)return s;if(this.closed)return s.unsubscribe(),s;if(!(s instanceof r)){var t=s;(s=new r)._subscriptions=[t]}break;default:throw new Error("unrecognized teardown "+i+" added to Subscription.")}var n=s._parentOrParents;if(null===n)s._parentOrParents=this;else if(n instanceof r){if(n===this)return s;s._parentOrParents=[n,this]}else{if(-1!==n.indexOf(this))return s;n.push(this)}var e=this._subscriptions;return null===e?this._subscriptions=[s]:e.push(s),s},r.prototype.remove=function(r){var i=this._subscriptions;if(i){var s=i.indexOf(r);-1!==s&&i.splice(s,1)}},r.EMPTY=((i=new r).closed=!0,i),r}();function flattenUnsubscriptionErrors(r){return r.reduce(function(r,i){return r.concat(i instanceof UnsubscriptionError_1.UnsubscriptionError?i.errors:i)},[])}exports.Subscription=Subscription;
103
44
 
104
- },{"./util/UnsubscriptionError":45,"./util/isArray":49,"./util/isFunction":50,"./util/isObject":51}],34:[function(require,module,exports){
45
+ },{"./util/UnsubscriptionError":26,"./util/isArray":30,"./util/isFunction":31,"./util/isObject":32}],15:[function(require,module,exports){
105
46
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _enable_super_gross_mode_that_will_cause_bad_things=!1;exports.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){if(e){var r=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+r.stack)}else _enable_super_gross_mode_that_will_cause_bad_things&&console.log("RxJS: Back to a better error behavior. Thank you. <3");_enable_super_gross_mode_that_will_cause_bad_things=e},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};
106
47
 
107
- },{}],35:[function(require,module,exports){
48
+ },{}],16:[function(require,module,exports){
108
49
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Observable_1=require("../Observable");function empty(e){return e?emptyScheduled(e):exports.EMPTY}function emptyScheduled(e){return new Observable_1.Observable(function(r){return e.schedule(function(){return r.complete()})})}exports.EMPTY=new Observable_1.Observable(function(e){return e.complete()}),exports.empty=empty;
109
50
 
110
- },{"../Observable":30}],36:[function(require,module,exports){
51
+ },{"../Observable":11}],17:[function(require,module,exports){
111
52
  "use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");function defaultIfEmpty(t){return void 0===t&&(t=null),function(e){return e.lift(new DefaultIfEmptyOperator(t))}}exports.defaultIfEmpty=defaultIfEmpty;var DefaultIfEmptyOperator=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new DefaultIfEmptySubscriber(t,this.defaultValue))},t}(),DefaultIfEmptySubscriber=function(t){function e(e,r){var n=t.call(this,e)||this;return n.defaultValue=r,n.isEmpty=!0,n}return __extends(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(Subscriber_1.Subscriber);
112
53
 
113
- },{"../Subscriber":32}],37:[function(require,module,exports){
54
+ },{"../Subscriber":13}],18:[function(require,module,exports){
114
55
  "use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function i(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");function filter(t,r){return function(e){return e.lift(new FilterOperator(t,r))}}exports.filter=filter;var FilterOperator=function(){function t(t,r){this.predicate=t,this.thisArg=r}return t.prototype.call=function(t,r){return r.subscribe(new FilterSubscriber(t,this.predicate,this.thisArg))},t}(),FilterSubscriber=function(t){function r(r,e,i){var n=t.call(this,r)||this;return n.predicate=e,n.thisArg=i,n.count=0,n}return __extends(r,t),r.prototype._next=function(t){var r;try{r=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}r&&this.destination.next(t)},r}(Subscriber_1.Subscriber);
115
56
 
116
- },{"../Subscriber":32}],38:[function(require,module,exports){
57
+ },{"../Subscriber":13}],19:[function(require,module,exports){
117
58
  "use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");function map(t,r){return function(e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return e.lift(new MapOperator(t,r))}}exports.map=map;var MapOperator=function(){function t(t,r){this.project=t,this.thisArg=r}return t.prototype.call=function(t,r){return r.subscribe(new MapSubscriber(t,this.project,this.thisArg))},t}();exports.MapOperator=MapOperator;var MapSubscriber=function(t){function r(r,e,n){var o=t.call(this,r)||this;return o.project=e,o.count=0,o.thisArg=n||o,o}return __extends(r,t),r.prototype._next=function(t){var r;try{r=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(r)},r}(Subscriber_1.Subscriber);
118
59
 
119
- },{"../Subscriber":32}],39:[function(require,module,exports){
60
+ },{"../Subscriber":13}],20:[function(require,module,exports){
120
61
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var scan_1=require("./scan"),takeLast_1=require("./takeLast"),defaultIfEmpty_1=require("./defaultIfEmpty"),pipe_1=require("../util/pipe");function reduce(e,t){return arguments.length>=2?function(r){return pipe_1.pipe(scan_1.scan(e,t),takeLast_1.takeLast(1),defaultIfEmpty_1.defaultIfEmpty(t))(r)}:function(t){return pipe_1.pipe(scan_1.scan(function(t,r,a){return e(t,r,a+1)}),takeLast_1.takeLast(1))(t)}}exports.reduce=reduce;
121
62
 
122
- },{"../util/pipe":52,"./defaultIfEmpty":36,"./scan":40,"./takeLast":41}],40:[function(require,module,exports){
63
+ },{"../util/pipe":33,"./defaultIfEmpty":17,"./scan":21,"./takeLast":22}],21:[function(require,module,exports){
123
64
  "use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");function scan(t,e){var r=!1;return arguments.length>=2&&(r=!0),function(n){return n.lift(new ScanOperator(t,e,r))}}exports.scan=scan;var ScanOperator=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new ScanSubscriber(t,this.accumulator,this.seed,this.hasSeed))},t}(),ScanSubscriber=function(t){function e(e,r,n,i){var s=t.call(this,e)||this;return s.accumulator=r,s._seed=n,s.hasSeed=i,s.index=0,s}return __extends(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.accumulator(this.seed,t,r)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(Subscriber_1.Subscriber);
124
65
 
125
- },{"../Subscriber":32}],41:[function(require,module,exports){
66
+ },{"../Subscriber":13}],22:[function(require,module,exports){
126
67
  "use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),ArgumentOutOfRangeError_1=require("../util/ArgumentOutOfRangeError"),empty_1=require("../observable/empty");function takeLast(t){return function(r){return 0===t?empty_1.empty():r.lift(new TakeLastOperator(t))}}exports.takeLast=takeLast;var TakeLastOperator=function(){function t(t){if(this.total=t,this.total<0)throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError}return t.prototype.call=function(t,r){return r.subscribe(new TakeLastSubscriber(t,this.total))},t}(),TakeLastSubscriber=function(t){function r(r,e){var n=t.call(this,r)||this;return n.total=e,n.ring=new Array,n.count=0,n}return __extends(r,t),r.prototype._next=function(t){var r=this.ring,e=this.total,n=this.count++;r.length<e?r.push(t):r[n%e]=t},r.prototype._complete=function(){var t=this.destination,r=this.count;if(r>0)for(var e=this.count>=this.total?this.total:this.count,n=this.ring,o=0;o<e;o++){var i=r++%e;t.next(n[i])}t.complete()},r}(Subscriber_1.Subscriber);
127
68
 
128
- },{"../Subscriber":32,"../observable/empty":35,"../util/ArgumentOutOfRangeError":44}],42:[function(require,module,exports){
69
+ },{"../Subscriber":13,"../observable/empty":16,"../util/ArgumentOutOfRangeError":25}],23:[function(require,module,exports){
129
70
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.observable="function"==typeof Symbol&&Symbol.observable||"@@observable";
130
71
 
131
- },{}],43:[function(require,module,exports){
72
+ },{}],24:[function(require,module,exports){
132
73
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),exports.$$rxSubscriber=exports.rxSubscriber;
133
74
 
134
- },{}],44:[function(require,module,exports){
75
+ },{}],25:[function(require,module,exports){
135
76
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ArgumentOutOfRangeErrorImpl=function(){function r(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return r.prototype=Object.create(Error.prototype),r}();exports.ArgumentOutOfRangeError=ArgumentOutOfRangeErrorImpl;
136
77
 
137
- },{}],45:[function(require,module,exports){
78
+ },{}],26:[function(require,module,exports){
138
79
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var UnsubscriptionErrorImpl=function(){function r(r){return Error.call(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map(function(r,t){return t+1+") "+r.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=r,this}return r.prototype=Object.create(Error.prototype),r}();exports.UnsubscriptionError=UnsubscriptionErrorImpl;
139
80
 
140
- },{}],46:[function(require,module,exports){
81
+ },{}],27:[function(require,module,exports){
141
82
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber");function canReportError(r){for(;r;){var e=r,o=e.closed,t=e.destination,i=e.isStopped;if(o||i)return!1;r=t&&t instanceof Subscriber_1.Subscriber?t:null}return!0}exports.canReportError=canReportError;
142
83
 
143
- },{"../Subscriber":32}],47:[function(require,module,exports){
84
+ },{"../Subscriber":13}],28:[function(require,module,exports){
144
85
  "use strict";function hostReportError(r){setTimeout(function(){throw r},0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.hostReportError=hostReportError;
145
86
 
146
- },{}],48:[function(require,module,exports){
87
+ },{}],29:[function(require,module,exports){
147
88
  "use strict";function identity(e){return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.identity=identity;
148
89
 
149
- },{}],49:[function(require,module,exports){
90
+ },{}],30:[function(require,module,exports){
150
91
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isArray=Array.isArray||function(e){return e&&"number"==typeof e.length};
151
92
 
152
- },{}],50:[function(require,module,exports){
93
+ },{}],31:[function(require,module,exports){
153
94
  "use strict";function isFunction(t){return"function"==typeof t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isFunction=isFunction;
154
95
 
155
- },{}],51:[function(require,module,exports){
96
+ },{}],32:[function(require,module,exports){
156
97
  "use strict";function isObject(e){return null!==e&&"object"==typeof e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isObject=isObject;
157
98
 
158
- },{}],52:[function(require,module,exports){
99
+ },{}],33:[function(require,module,exports){
159
100
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var identity_1=require("./identity");function pipe(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return pipeFromArray(e)}function pipeFromArray(e){return 0===e.length?identity_1.identity:1===e.length?e[0]:function(r){return e.reduce(function(e,r){return r(e)},r)}}exports.pipe=pipe,exports.pipeFromArray=pipeFromArray;
160
101
 
161
- },{"./identity":48}],53:[function(require,module,exports){
102
+ },{"./identity":29}],34:[function(require,module,exports){
162
103
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Subscriber_1=require("../Subscriber"),rxSubscriber_1=require("../symbol/rxSubscriber"),Observer_1=require("../Observer");function toSubscriber(r,e,b){if(r){if(r instanceof Subscriber_1.Subscriber)return r;if(r[rxSubscriber_1.rxSubscriber])return r[rxSubscriber_1.rxSubscriber]()}return r||e||b?new Subscriber_1.Subscriber(r,e,b):new Subscriber_1.Subscriber(Observer_1.empty)}exports.toSubscriber=toSubscriber;
163
104
 
164
- },{"../Observer":31,"../Subscriber":32,"../symbol/rxSubscriber":43}],54:[function(require,module,exports){
165
- "use strict";var url=require("url");module.exports=function(o,r,t){if(o===r)return!0;var p=url.parse(o,!1,!0),e=url.parse(r,!1,!0),s=0|p.port||("https"===p.protocol?443:80),u=0|e.port||("https"===e.protocol?443:80),l={proto:p.protocol===e.protocol,hostname:p.hostname===e.hostname,port:s===u};return l.proto&&l.hostname&&(l.port||t)};
166
-
167
- },{"url":55}],55:[function(require,module,exports){
168
- "use strict";var regex=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;module.exports={regex:regex,parse:function(e){var o=regex.exec(e);return o?{protocol:(o[1]||"").toLowerCase()||void 0,hostname:(o[5]||"").toLowerCase()||void 0,port:o[6]||void 0}:{}}};
169
-
170
- },{}],56:[function(require,module,exports){
171
- (function (global){(function (){
172
- "use strict";var required=require("requires-port"),qs=require("querystringify"),slashes=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,protocolre=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,windowsDriveLetter=/^[a-zA-Z]:/,whitespace="[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]",left=new RegExp("^"+whitespace+"+");function trimLeft(e){return(e||"").toString().replace(left,"")}var rules=[["#","hash"],["?","query"],function(e,t){return isSpecial(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]],ignore={hash:1,query:1};function lolcation(e){var t,o=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).location||{},r={},s=typeof(e=e||o);if("blob:"===e.protocol)r=new Url(unescape(e.pathname),{});else if("string"===s)for(t in r=new Url(e,{}),ignore)delete r[t];else if("object"===s){for(t in e)t in ignore||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=slashes.test(e.href))}return r}function isSpecial(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function extractProtocol(e,t){e=trimLeft(e),t=t||{};var o,r=protocolre.exec(e),s=r[1]?r[1].toLowerCase():"",a=!!r[2],l=!!r[3],i=0;return a?l?(o=r[2]+r[3]+r[4],i=r[2].length+r[3].length):(o=r[2]+r[4],i=r[2].length):l?(o=r[3]+r[4],i=r[3].length):o=r[4],"file:"===s?i>=2&&(o=o.slice(2)):isSpecial(s)?o=r[4]:s?a&&(o=o.slice(2)):i>=2&&isSpecial(t.protocol)&&(o=r[4]),{protocol:s,slashes:a||isSpecial(s),slashesCount:i,rest:o}}function resolve(e,t){if(""===e)return t;for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=o.length,s=o[r-1],a=!1,l=0;r--;)"."===o[r]?o.splice(r,1):".."===o[r]?(o.splice(r,1),l++):l&&(0===r&&(a=!0),o.splice(r,1),l--);return a&&o.unshift(""),"."!==s&&".."!==s||o.push(""),o.join("/")}function Url(e,t,o){if(e=trimLeft(e),!(this instanceof Url))return new Url(e,t,o);var r,s,a,l,i,n,c=rules.slice(),p=typeof t,h=this,u=0;for("object"!==p&&"string"!==p&&(o=t,t=null),o&&"function"!=typeof o&&(o=qs.parse),r=!(s=extractProtocol(e||"",t=lolcation(t))).protocol&&!s.slashes,h.slashes=s.slashes||r&&t.slashes,h.protocol=s.protocol||t.protocol||"",e=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||windowsDriveLetter.test(e))||!s.slashes&&(s.protocol||s.slashesCount<2||!isSpecial(h.protocol)))&&(c[3]=[/(.*)/,"pathname"]);u<c.length;u++)"function"!=typeof(l=c[u])?(a=l[0],n=l[1],a!=a?h[n]=e:"string"==typeof a?~(i=e.indexOf(a))&&("number"==typeof l[2]?(h[n]=e.slice(0,i),e=e.slice(i+l[2])):(h[n]=e.slice(i),e=e.slice(0,i))):(i=a.exec(e))&&(h[n]=i[1],e=e.slice(0,i.index)),h[n]=h[n]||r&&l[3]&&t[n]||"",l[4]&&(h[n]=h[n].toLowerCase())):e=l(e,h);o&&(h.query=o(h.query)),r&&t.slashes&&"/"!==h.pathname.charAt(0)&&(""!==h.pathname||""!==t.pathname)&&(h.pathname=resolve(h.pathname,t.pathname)),"/"!==h.pathname.charAt(0)&&isSpecial(h.protocol)&&(h.pathname="/"+h.pathname),required(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(l=h.auth.split(":"),h.username=l[0]||"",h.password=l[1]||""),h.origin="file:"!==h.protocol&&isSpecial(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function set(e,t,o){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||qs.parse)(t)),r[e]=t;break;case"port":r[e]=t,required(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!o;break;case"pathname":case"hash":if(t){var s="pathname"===e?"/":"#";r[e]=t.charAt(0)!==s?s+t:t}else r[e]=t;break;default:r[e]=t}for(var a=0;a<rules.length;a++){var l=rules[a];l[4]&&(r[l[1]]=r[l[1]].toLowerCase())}return r.origin="file:"!==r.protocol&&isSpecial(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}function toString(e){e&&"function"==typeof e||(e=qs.stringify);var t,o=this,r=o.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var s=r+(o.slashes||isSpecial(o.protocol)?"//":"");return o.username&&(s+=o.username,o.password&&(s+=":"+o.password),s+="@"),s+=o.host+o.pathname,(t="object"==typeof o.query?e(o.query):o.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),o.hash&&(s+=o.hash),s}Url.prototype={set:set,toString:toString},Url.extractProtocol=extractProtocol,Url.location=lolcation,Url.trimLeft=trimLeft,Url.qs=qs,module.exports=Url;
173
-
174
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
175
- },{"querystringify":28,"requires-port":29}],57:[function(require,module,exports){
105
+ },{"../Observer":12,"../Subscriber":13,"../symbol/rxSubscriber":24}],35:[function(require,module,exports){
176
106
  "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(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)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(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 _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var assign=require("object-assign"),_require=require("@sanity/observable/operators/map"),map=_require.map,_require2=require("@sanity/observable/operators/filter"),filter=_require2.filter,queryString=require("../http/queryString"),validators=require("../validators");function AssetsClient(e){this.client=e}function toDocument(e){var t=e.document;return Object.defineProperty(t,"document",{enumerable:!1,get:function(){return console.warn("The promise returned from client.asset.upload(...) now resolves with the asset document"),t}}),t}function optionsFromFile(e,t){return"undefined"!=typeof window&&t instanceof window.File?assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}assign(AssetsClient.prototype,{upload:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};validators.validateAssetType(e);var n=r.extract||void 0;n&&!n.length&&(n=["none"]);var i=validators.hasDataset(this.client.clientConfig),a="image"===e?"images":"files",o=optionsFromFile(r,t),s=o.tag,l=o.label,c=o.title,u=o.description,d=o.creditLine,f=o.filename,y=o.source,p={label:l,title:c,description:u,filename:f,meta:n,creditLine:d};y&&(p.sourceId=y.id,p.sourceName=y.name,p.sourceUrl=y.url);var m=this.client._requestObservable({tag:s,method:"POST",timeout:o.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:o.contentType?{"Content-Type":o.contentType}:{},query:p,body:t});return this.client.isPromiseAPI()?m.pipe(filter(function(e){return"response"===e.type}),map(function(e){return toDocument(e.body)})).toPromise():m},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),validators.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=_slicedToArray(r.split("-"),4),i=n[1],a=n[2],o=n[3];validators.hasDataset(this.client.clientConfig);var s=this.client.clientConfig,l=s.projectId,c=s.dataset,u=t?queryString(t):"";return"https://cdn.sanity.io/images/".concat(l,"/").concat(c,"/").concat(i,"-").concat(a,".").concat(o).concat(u)}}),module.exports=AssetsClient;
177
107
 
178
- },{"../http/queryString":68,"../validators":78,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":26}],58:[function(require,module,exports){
108
+ },{"../http/queryString":46,"../validators":56,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":10}],36:[function(require,module,exports){
179
109
  "use strict";var assign=require("object-assign");function AuthClient(t){this.client=t}assign(AuthClient.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout",method:"POST"})}}),module.exports=AuthClient;
180
110
 
181
- },{"object-assign":26}],59:[function(require,module,exports){
111
+ },{"object-assign":10}],37:[function(require,module,exports){
182
112
  "use strict";var generateHelpUrl=require("@sanity/generate-help-url"),assign=require("object-assign"),validate=require("./validators"),warnings=require("./warnings"),defaultCdnHost="apicdn.sanity.io",defaultConfig={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,gradientMode:!1,isPromiseAPI:!0},LOCALHOSTS=["localhost","127.0.0.1","0.0.0.0"],isLocal=function(e){return-1!==LOCALHOSTS.indexOf(e)};exports.defaultConfig=defaultConfig,exports.initConfig=function(e,n){var i=assign({},n,e);i.apiVersion||warnings.printNoApiVersionSpecifiedWarning();var t=assign({},defaultConfig,i),a=t.gradientMode,o=!a&&t.useProjectHostname;if("undefined"==typeof Promise){var r=generateHelpUrl("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(r))}if(a&&!t.namespace)throw new Error("Configuration must contain `namespace` when running in gradient mode");if(o&&!t.projectId)throw new Error("Configuration must contain `projectId`");var s="undefined"!=typeof window&&window.location&&window.location.hostname,d=s&&isLocal(window.location.hostname);if(s&&d&&t.token&&!0!==t.ignoreBrowserTokenWarning?warnings.printBrowserTokenWarning():(!s||d)&&t.useCdn&&t.token?warnings.printCdnTokenWarning():void 0===t.useCdn&&warnings.printCdnWarning(),o&&validate.projectId(t.projectId),!a&&t.dataset&&validate.dataset(t.dataset,t.gradientMode),"requestTagPrefix"in t&&(t.requestTagPrefix=t.requestTagPrefix?validate.requestTag(t.requestTagPrefix).replace(/\.+$/,""):void 0),t.apiVersion="".concat(t.apiVersion).replace(/^v/,""),t.isDefaultApi=t.apiHost===defaultConfig.apiHost,t.useCdn=Boolean(t.useCdn)&&!t.token&&!t.withCredentials,exports.validateApiVersion(t.apiVersion),t.gradientMode)t.url=t.apiHost,t.cdnUrl=t.apiHost;else{var c=t.apiHost.split("://",2),p=c[0],l=c[1],u=t.isDefaultApi?defaultCdnHost:l;t.useProjectHostname?(t.url="".concat(p,"://").concat(t.projectId,".").concat(l,"/v").concat(t.apiVersion),t.cdnUrl="".concat(p,"://").concat(t.projectId,".").concat(u,"/v").concat(t.apiVersion)):(t.url="".concat(t.apiHost,"/v").concat(t.apiVersion),t.cdnUrl=t.url)}return t},exports.validateApiVersion=function(e){if("1"!==e&&"X"!==e){var n=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&n instanceof Date&&n.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}};
183
113
 
184
- },{"./validators":78,"./warnings":79,"@sanity/generate-help-url":81,"object-assign":26}],60:[function(require,module,exports){
114
+ },{"./validators":56,"./warnings":57,"@sanity/generate-help-url":83,"object-assign":10}],38:[function(require,module,exports){
185
115
  "use strict";function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var assign=require("object-assign"),_require=require("@sanity/observable/operators/filter"),filter=_require.filter,_require2=require("@sanity/observable/operators/map"),map=_require2.map,validators=require("../validators"),getSelection=require("../util/getSelection"),encodeQueryString=require("./encodeQueryString"),Transaction=require("./transaction"),Patch=require("./patch"),listen=require("./listen"),excludeFalsey=function(e,t){return!1===e?void 0:void 0===e?t:e},getMutationQuery=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:excludeFalsey(e.returnDocuments,!0),visibility:e.visibility||"sync"}},isResponse=function(e){return"response"===e.type},getBody=function(e){return e.body},indexBy=function(e,t){return e.reduce(function(e,r){return e[t(r)]=r,e},Object.create(null))},toPromise=function(e){return e.toPromise()},getQuerySizeLimit=11264;module.exports={listen:listen,getDataUrl:function(e,t){var r=this.clientConfig,n=r.gradientMode?r.namespace:validators.hasDataset(r),i="/".concat(e,"/").concat(n),a=t?"".concat(i,"/").concat(t):i;return(this.clientConfig.gradientMode?a:"/data".concat(a)).replace(/\/($|\?)/,"$1")},fetch:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(e){return e}:function(e){return e.result},i=this._dataRequest("query",{query:e,params:t},r).pipe(map(n));return this.isPromiseAPI()?toPromise(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},n=this._requestObservable(r).pipe(filter(isResponse),map(function(e){return e.body.documents&&e.body.documents[0]}));return this.isPromiseAPI()?toPromise(n):n},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},n=this._requestObservable(r).pipe(filter(isResponse),map(function(t){var r=indexBy(t.body.documents||[],function(e){return e._id});return e.map(function(e){return r[e]||null})}));return this.isPromiseAPI()?toPromise(n):n},create:function(e,t){return this._create(e,"create",t)},createIfNotExists:function(e,t){return validators.requireDocumentId("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace:function(e,t){return validators.requireDocumentId("createOrReplace",e),this._create(e,"createOrReplace",t)},patch:function(e,t){return new Patch(e,t,this)},delete:function(e,t){return this.dataRequest("mutate",{mutations:[{delete:getSelection(e)}]},t)},mutate:function(e,t){var r=e instanceof Patch||e instanceof Transaction?e.serialize():e,n=Array.isArray(r)?r:[r],i=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:i},t)},transaction:function(e){return new Transaction(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()?toPromise(n):n},_dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="mutate"===e,i="query"===e,a=!n&&encodeQueryString(t),u=!n&&a.length<getQuerySizeLimit,o=u?a:"",s=r.returnFirst,c=r.timeout,d=r.token,l=r.tag,f={method:u?"GET":"POST",uri:this.getDataUrl(e,o),json:!0,body:u?void 0:t,query:n&&getMutationQuery(r),timeout:c,token:d,tag:l,canUseCdn:i};return this._requestObservable(f).pipe(filter(isResponse),map(getBody),map(function(e){if(!n)return e;var t=e.results||[];if(r.returnDocuments)return s?t[0]&&t[0].document:t.map(function(e){return e.document});var i=s?"documentId":"documentIds",a=s?t[0]&&t[0].id:t.map(function(e){return e.id});return _defineProperty({transactionId:e.transactionId,results:t},i,a)}))},_create:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=_defineProperty({},t,e),i=assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},i)}};
186
116
 
187
- },{"../util/getSelection":75,"../validators":78,"./encodeQueryString":61,"./listen":62,"./patch":63,"./transaction":64,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":26}],61:[function(require,module,exports){
117
+ },{"../util/getSelection":53,"../validators":56,"./encodeQueryString":39,"./listen":40,"./patch":41,"./transaction":42,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":10}],39:[function(require,module,exports){
188
118
  "use strict";var _excluded=["tag"];function _objectWithoutProperties(e,t){if(null==e)return{};var c,o,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)c=r[o],t.indexOf(c)>=0||Object.prototype.propertyIsEnumerable.call(e,c)&&(n[c]=e[c])}return n}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var c,o,n={},r=Object.keys(e);for(o=0;o<r.length;o++)c=r[o],t.indexOf(c)>=0||(n[c]=e[c]);return n}var enc=encodeURIComponent;module.exports=function(e){var t=e.query,c=e.params,o=void 0===c?{}:c,n=e.options,r=void 0===n?{}:n,u=r.tag,a=_objectWithoutProperties(r,_excluded),i="query=".concat(enc(t)),s=u?"?tag=".concat(enc(u),"&").concat(i):"?".concat(i),l=Object.keys(o).reduce(function(e,t){return"".concat(e,"&").concat(enc("$".concat(t)),"=").concat(enc(JSON.stringify(o[t])))},s);return Object.keys(a).reduce(function(e,t){return r[t]?"".concat(e,"&").concat(enc(t),"=").concat(enc(r[t])):e},l)};
189
119
 
190
- },{}],62:[function(require,module,exports){
120
+ },{}],40:[function(require,module,exports){
191
121
  "use strict";function ownKeys(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach(function(r){_defineProperty(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _defineProperty(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var assign=require("object-assign"),Observable=require("@sanity/observable/minimal"),polyfilledEventSource=require("@sanity/eventsource"),generateHelpUrl=require("@sanity/generate-help-url"),pick=require("../util/pick"),once=require("../util/once"),defaults=require("../util/defaults"),encodeQueryString=require("./encodeQueryString"),MAX_URL_LENGTH=14800,tokenWarning=["Using token with listeners is not supported in browsers. ","For more info, see ".concat(generateHelpUrl("js-client-listener-tokens-browser"),".")],printTokenWarning=once(function(){return console.warn(tokenWarning.join(" "))}),isWindowEventSource=Boolean("undefined"!=typeof window&&window.EventSource),EventSource=isWindowEventSource?window.EventSource:polyfilledEventSource,possibleOptions=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],defaultOptions={includeResult:!0};function parseEvent(e){try{var r=e.data&&JSON.parse(e.data)||{};return assign({type:e.type},r)}catch(e){return e}}function cooerceError(e){if(e instanceof Error)return e;var r=parseEvent(e);return r instanceof Error?r:new Error(extractErrorMessage(r))}function extractErrorMessage(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"}module.exports=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=this.clientConfig,o=t.url,i=t.token,c=t.withCredentials,s=t.requestTagPrefix,a=n.tag&&s?[s,n.tag].join("."):n.tag,u=_objectSpread(_objectSpread({},defaults(n,defaultOptions)),{},{tag:a}),l=pick(u,possibleOptions),f=encodeQueryString({query:e,params:r,options:l,tag:a}),p="".concat(o).concat(this.getDataUrl("listen",f));if(p.length>MAX_URL_LENGTH)return new Observable(function(e){return e.error(new Error("Query too large for listener"))});var d=u.events?u.events:["mutation"],v=-1!==d.indexOf("reconnect");i&&isWindowEventSource&&printTokenWarning();var g={};return(i||c)&&(g.withCredentials=!0),i&&(g.headers={Authorization:"Bearer ".concat(i)}),new Observable(function(e){var r,n=u(),t=!1;function o(){t||(v&&e.next({type:"reconnect"}),t||n.readyState===EventSource.CLOSED&&(a(),clearTimeout(r),r=setTimeout(l,100)))}function i(r){e.error(cooerceError(r))}function c(r){var n=parseEvent(r);return n instanceof Error?e.error(n):e.next(n)}function s(r){t=!0,a(),e.complete()}function a(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",i,!1),n.removeEventListener("disconnect",s,!1),d.forEach(function(e){return n.removeEventListener(e,c,!1)}),n.close()}function u(){var e=new EventSource(p,g);return e.addEventListener("error",o,!1),e.addEventListener("channelError",i,!1),e.addEventListener("disconnect",s,!1),d.forEach(function(r){return e.addEventListener(r,c,!1)}),e}function l(){n=u()}return function(){t=!0,a()}})};
192
122
 
193
- },{"../util/defaults":74,"../util/once":76,"../util/pick":77,"./encodeQueryString":61,"@sanity/eventsource":80,"@sanity/generate-help-url":81,"@sanity/observable/minimal":3,"object-assign":26}],63:[function(require,module,exports){
123
+ },{"../util/defaults":52,"../util/once":54,"../util/pick":55,"./encodeQueryString":39,"@sanity/eventsource":82,"@sanity/generate-help-url":83,"@sanity/observable/minimal":3,"object-assign":10}],41:[function(require,module,exports){
194
124
  "use strict";function _defineProperty(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var deepAssign=require("deep-assign"),assign=require("object-assign"),getSelection=require("../util/getSelection"),validate=require("../validators"),validateObject=validate.validateObject,validateInsert=validate.validateInsert;function Patch(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=assign({},e),this.client=i}assign(Patch.prototype,{clone:function(){return new Patch(this.selection,assign({},this.operations),this.client)},merge:function(t){validateObject("merge",t);var e=(new Error).stack.toString().split("\n").filter(function(t){return t.trim()}).slice(2);return console.warn('The "merge" patch has been deprecated and will be removed in the future\n'.concat(e.join("\n"))),this._assign("merge",deepAssign(this.operations.merge||{},t))},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return validateObject("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=assign({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return validateObject("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,i){var n;return validateInsert(t,e,i),this._assign("insert",(_defineProperty(n={},t,e),_defineProperty(n,"items",i),n))},append:function(t,e){return this.insert("after","".concat(t,"[-1]"),e)},prepend:function(t,e){return this.insert("before","".concat(t,"[0]"),e)},splice:function(t,e,i,n){var r=e<0?e-1:e,s=void 0===i||-1===i?-1:Math.max(0,e+i),a=r<0&&s>=0?"":s,o="".concat(t,"[").concat(r,":").concat(a,"]");return this.insert("replace",o,n||[])},ifRevisionId:function(t){return this.operations.ifRevisionID=t,this},serialize:function(){return assign(getSelection(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=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 e="string"==typeof this.selection,i=assign({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},i)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return validateObject(t,e),this.operations=assign({},this.operations,_defineProperty({},t,assign({},i&&this.operations[t]||{},e))),this}}),module.exports=Patch;
195
125
 
196
- },{"../util/getSelection":75,"../validators":78,"deep-assign":7,"object-assign":26}],64:[function(require,module,exports){
126
+ },{"../util/getSelection":53,"../validators":56,"deep-assign":7,"object-assign":10}],42:[function(require,module,exports){
197
127
  "use strict";function _defineProperty(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var assign=require("object-assign"),validators=require("../validators"),Patch=require("./patch"),defaultMutateOptions={returnDocuments:!1};function Transaction(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;this.trxId=i,this.operations=t,this.client=e}assign(Transaction.prototype,{clone:function(){return new Transaction(this.operations.slice(0),this.client,this.trxId)},create:function(t){return validators.validateObject("create",t),this._add({create:t})},createIfNotExists:function(t){var e="createIfNotExists";return validators.validateObject(e,t),validators.requireDocumentId(e,t),this._add(_defineProperty({},e,t))},createOrReplace:function(t){var e="createOrReplace";return validators.validateObject(e,t),validators.requireDocumentId(e,t),this._add(_defineProperty({},e,t))},delete:function(t){return validators.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function(t,e){var i="function"==typeof e;if(t instanceof Patch)return this._add({patch:t.serialize()});if(i){var r=e(new Patch(t,{},this.client));if(!(r instanceof Patch))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:assign({id:t},e)})},transactionId:function(t){return t?(this.trxId=t,this):this.trxId},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(t){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(),assign({transactionId:this.trxId},defaultMutateOptions,t||{}))},reset:function(){return this.operations=[],this},_add:function(t){return this.operations.push(t),this}}),module.exports=Transaction;
198
128
 
199
- },{"../validators":78,"./patch":63,"object-assign":26}],65:[function(require,module,exports){
129
+ },{"../validators":56,"./patch":41,"object-assign":10}],43:[function(require,module,exports){
200
130
  "use strict";var assign=require("object-assign"),validate=require("../validators");function DatasetsClient(t){this.request=t.request.bind(t)}assign(DatasetsClient.prototype,{create:function(t,e){return this._modify("PUT",t,e)},edit:function(t,e){return this._modify("PATCH",t,e)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e,i){return validate.dataset(e),this.request({method:t,uri:"/datasets/".concat(e),body:i})}}),module.exports=DatasetsClient;
201
131
 
202
- },{"../validators":78,"object-assign":26}],66:[function(require,module,exports){
132
+ },{"../validators":56,"object-assign":10}],44:[function(require,module,exports){
203
133
  "use strict";module.exports=[];
204
134
 
205
- },{}],67:[function(require,module,exports){
135
+ },{}],45:[function(require,module,exports){
206
136
  "use strict";var makeError=require("make-error"),assign=require("object-assign");function ClientError(r){var e=extractErrorProps(r);ClientError.super.call(this,e.message),assign(this,e)}function ServerError(r){var e=extractErrorProps(r);ServerError.super.call(this,e.message),assign(this,e)}function extractErrorProps(r){var e=r.body,s={response:r,statusCode:r.statusCode,responseBody:stringifyBody(e,r)};return e.error&&e.message?(s.message="".concat(e.error," - ").concat(e.message),s):e.error&&e.error.description?(s.message=e.error.description,s.details=e.error,s):(s.message=e.error||e.message||httpErrorMessage(r),s)}function httpErrorMessage(r){var e=r.statusMessage?" ".concat(r.statusMessage):"";return"".concat(r.method,"-request to ").concat(r.url," resulted in HTTP ").concat(r.statusCode).concat(e)}function stringifyBody(r,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(r,null,2):r}makeError(ClientError),makeError(ServerError),exports.ClientError=ClientError,exports.ServerError=ServerError;
207
137
 
208
- },{"make-error":25,"object-assign":26}],68:[function(require,module,exports){
138
+ },{"make-error":9,"object-assign":10}],46:[function(require,module,exports){
209
139
  "use strict";module.exports=function(n){var o=[];for(var e in n)n.hasOwnProperty(e)&&o.push("".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(n[e])));return o.length>0?"?".concat(o.join("&")):""};
210
140
 
211
- },{}],69:[function(require,module,exports){
141
+ },{}],47:[function(require,module,exports){
212
142
  "use strict";var getIt=require("get-it"),assign=require("object-assign"),observable=require("get-it/lib/middleware/observable"),jsonRequest=require("get-it/lib/middleware/jsonRequest"),jsonResponse=require("get-it/lib/middleware/jsonResponse"),progress=require("get-it/lib/middleware/progress"),Observable=require("@sanity/observable/minimal"),_require=require("./errors"),ClientError=_require.ClientError,ServerError=_require.ServerError,httpError={onResponse:function(e){if(e.statusCode>=500)throw new ServerError(e);if(e.statusCode>=400)throw new ClientError(e);return e}},printWarnings={onResponse:function(e){var r=e.headers["x-sanity-warning"];return(Array.isArray(r)?r:[r]).filter(Boolean).forEach(function(e){return console.warn(e)}),e}},envSpecific=require("./nodeMiddleware"),middleware=envSpecific.concat([printWarnings,jsonRequest(),jsonResponse(),progress(),httpError,observable({implementation:Observable})]),request=getIt(middleware);function httpRequest(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:request)(assign({maxRedirects:0},e))}httpRequest.defaultRequester=request,httpRequest.ClientError=ClientError,httpRequest.ServerError=ServerError,module.exports=httpRequest;
213
143
 
214
- },{"./errors":67,"./nodeMiddleware":66,"@sanity/observable/minimal":3,"get-it":9,"get-it/lib/middleware/jsonRequest":13,"get-it/lib/middleware/jsonResponse":14,"get-it/lib/middleware/observable":15,"get-it/lib/middleware/progress":17,"object-assign":26}],70:[function(require,module,exports){
144
+ },{"./errors":45,"./nodeMiddleware":44,"@sanity/observable/minimal":3,"get-it":58,"get-it/lib/middleware/jsonRequest":62,"get-it/lib/middleware/jsonResponse":63,"get-it/lib/middleware/observable":64,"get-it/lib/middleware/progress":66,"object-assign":10}],48:[function(require,module,exports){
215
145
  "use strict";var assign=require("object-assign"),projectHeader="X-Sanity-Project-ID";module.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o={},r=t.token||e.token;r&&(o.Authorization="Bearer ".concat(r)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(o[projectHeader]=e.projectId);var i=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),a=void 0===t.timeout?e.timeout:t.timeout;return assign({},t,{headers:assign({},o,t.headers||{}),timeout:void 0===a?3e5:a,proxy:t.proxy||e.proxy,json:!0,withCredentials:i})};
216
146
 
217
- },{"object-assign":26}],71:[function(require,module,exports){
147
+ },{"object-assign":10}],49:[function(require,module,exports){
218
148
  "use strict";var assign=require("object-assign");function ProjectsClient(t){this.client=t}assign(ProjectsClient.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/".concat(t)})}}),module.exports=ProjectsClient;
219
149
 
220
- },{"object-assign":26}],72:[function(require,module,exports){
150
+ },{"object-assign":10}],50:[function(require,module,exports){
221
151
  "use strict";function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach(function(t){_defineProperty(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var assign=require("object-assign"),_require=require("@sanity/observable/operators/filter"),filter=_require.filter,_require2=require("@sanity/observable/operators/map"),map=_require2.map,Patch=require("./data/patch"),Transaction=require("./data/transaction"),dataMethods=require("./data/dataMethods"),DatasetsClient=require("./datasets/datasetsClient"),ProjectsClient=require("./projects/projectsClient"),AssetsClient=require("./assets/assetsClient"),UsersClient=require("./users/usersClient"),AuthClient=require("./auth/authClient"),httpRequest=require("./http/request"),getRequestOptions=require("./http/requestOptions"),_require3=require("./config"),defaultConfig=_require3.defaultConfig,initConfig=_require3.initConfig,validate=require("./validators"),toPromise=function(e){return e.toPromise()};function SanityClient(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:defaultConfig;if(!(this instanceof SanityClient))return new SanityClient(e);if(this.config(e),this.assets=new AssetsClient(this),this.datasets=new DatasetsClient(this),this.projects=new ProjectsClient(this),this.users=new UsersClient(this),this.auth=new AuthClient(this),this.clientConfig.isPromiseAPI){var t=assign({},this.clientConfig,{isPromiseAPI:!1});this.observable=new SanityClient(t)}}assign(SanityClient.prototype,dataMethods),assign(SanityClient.prototype,{clone:function(){return new SanityClient(this.config())},config:function(e){if(void 0===e)return assign({},this.clientConfig);if(this.observable){var t=assign({},e,{isPromiseAPI:!1});this.observable.config(t)}return this.clientConfig=initConfig(e,this.clientConfig||{}),this},withConfig:function(e){return this.clone().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=e.url||e.uri,i=void 0===e.canUseCdn?["GET","HEAD"].indexOf(e.method||"GET")>=0&&0===t.indexOf("/data/"):e.canUseCdn,r=this.clientConfig.useCdn&&i,n=e.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,e.tag].join("."):e.tag||this.clientConfig.requestTagPrefix;n&&(e.query=_objectSpread({tag:validate.requestTag(n)},e.query));var s=getRequestOptions(this.clientConfig,assign({},e,{url:this.getUrl(t,r)}));return httpRequest(s,this.clientConfig.requester)},request:function(e){var t=this._requestObservable(e).pipe(filter(function(e){return"response"===e.type}),map(function(e){return e.body}));return this.isPromiseAPI()?toPromise(t):t}}),SanityClient.Patch=Patch,SanityClient.Transaction=Transaction,SanityClient.ClientError=httpRequest.ClientError,SanityClient.ServerError=httpRequest.ServerError,SanityClient.requester=httpRequest.defaultRequester,module.exports=SanityClient;
222
152
 
223
- },{"./assets/assetsClient":57,"./auth/authClient":58,"./config":59,"./data/dataMethods":60,"./data/patch":63,"./data/transaction":64,"./datasets/datasetsClient":65,"./http/request":69,"./http/requestOptions":70,"./projects/projectsClient":71,"./users/usersClient":73,"./validators":78,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":26}],73:[function(require,module,exports){
153
+ },{"./assets/assetsClient":35,"./auth/authClient":36,"./config":37,"./data/dataMethods":38,"./data/patch":41,"./data/transaction":42,"./datasets/datasetsClient":43,"./http/request":47,"./http/requestOptions":48,"./projects/projectsClient":49,"./users/usersClient":51,"./validators":56,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":10}],51:[function(require,module,exports){
224
154
  "use strict";var assign=require("object-assign");function UsersClient(e){this.client=e}assign(UsersClient.prototype,{getById:function(e){return this.client.request({uri:"/users/".concat(e)})}}),module.exports=UsersClient;
225
155
 
226
- },{"object-assign":26}],74:[function(require,module,exports){
156
+ },{"object-assign":10}],52:[function(require,module,exports){
227
157
  "use strict";module.exports=function(e,t){return Object.keys(t).concat(Object.keys(e)).reduce(function(c,n){return c[n]=void 0===e[n]?t[n]:e[n],c},{})};
228
158
 
229
- },{}],75:[function(require,module,exports){
159
+ },{}],53:[function(require,module,exports){
230
160
  "use strict";module.exports=function(r){if("string"==typeof r||Array.isArray(r))return{id:r};if(r&&r.query)return"params"in r?{query:r.query,params:r.params}:{query:r.query};var n=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(n))};
231
161
 
232
- },{}],76:[function(require,module,exports){
162
+ },{}],54:[function(require,module,exports){
233
163
  "use strict";module.exports=function(r){var t,n=!1;return function(){return n?t:(t=r.apply(void 0,arguments),n=!0,t)}};
234
164
 
235
- },{}],77:[function(require,module,exports){
165
+ },{}],55:[function(require,module,exports){
236
166
  "use strict";module.exports=function(e,r){return r.reduce(function(r,t){return void 0===e[t]?r:(r[t]=e[t],r)},{})};
237
167
 
238
- },{}],78:[function(require,module,exports){
168
+ },{}],56:[function(require,module,exports){
239
169
  "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var VALID_ASSET_TYPES=["image","file"],VALID_INSERT_LOCATIONS=["before","after","replace"];exports.dataset=function(t){if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},exports.projectId=function(t){if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},exports.validateAssetType=function(t){if(-1===VALID_ASSET_TYPES.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(VALID_ASSET_TYPES.join(", ")))},exports.validateObject=function(t,e){if(null===e||"object"!==_typeof(e)||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},exports.requireDocumentId=function(t,e){if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));exports.validateDocumentId(t,e._id)},exports.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},exports.validateInsert=function(t,e,r){var o="insert(at, selector, items)";if(-1===VALID_INSERT_LOCATIONS.indexOf(t)){var n=VALID_INSERT_LOCATIONS.map(function(t){return'"'.concat(t,'"')}).join(", ");throw new Error("".concat(o,' takes an "at"-argument which is one of: ').concat(n))}if("string"!=typeof e)throw new Error("".concat(o,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(o,' takes an "items"-argument which must be an array'))},exports.hasDataset=function(t){if(!t.gradientMode&&!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},exports.requestTag=function(t){if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t};
240
170
 
241
- },{}],79:[function(require,module,exports){
171
+ },{}],57:[function(require,module,exports){
242
172
  "use strict";var generateHelpUrl=require("@sanity/generate-help-url"),once=require("./util/once"),createWarningPrinter=function(e){return once(function(){for(var n,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return(n=console).warn.apply(n,[e.join(" ")].concat(r))})};exports.printCdnWarning=createWarningPrinter(["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(generateHelpUrl("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),exports.printBrowserTokenWarning=createWarningPrinter(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(generateHelpUrl("js-client-browser-token")," for more information and how to hide this warning.")]),exports.printCdnTokenWarning=createWarningPrinter(["You have set `useCdn` to `true` while also specifying a token. This is usually not what you","want. The CDN cannot be used with an authorization token, since private data cannot be cached.","See ".concat(generateHelpUrl("js-client-usecdn-token")," for more information.")]),exports.printNoApiVersionSpecifiedWarning=createWarningPrinter(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(generateHelpUrl("js-client-api-version"))]);
243
173
 
244
- },{"./util/once":76,"@sanity/generate-help-url":81}],80:[function(require,module,exports){
174
+ },{"./util/once":54,"@sanity/generate-help-url":83}],58:[function(require,module,exports){
175
+ module.exports=require("./lib-node");
176
+
177
+ },{"./lib-node":59}],59:[function(require,module,exports){
178
+ "use strict";var pubsub=require("nano-pubsub"),middlewareReducer=require("./util/middlewareReducer"),processOptions=require("./middleware/defaultOptionsProcessor"),validateOptions=require("./middleware/defaultOptionsValidator"),httpRequester=require("./request"),channelNames=["request","response","progress","error","abort"],middlehooks=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];module.exports=function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:httpRequester,n=[],o=middlehooks.reduce(function(e,r){return e[r]=e[r]||[],e},{processOptions:[processOptions],validateOptions:[validateOptions]});function s(e){var r=channelNames.reduce(function(e,r){return e[r]=pubsub(),e},{}),n=middlewareReducer(o),s=n("processOptions",e);n("validateOptions",s);var i={options:s,channels:r,applyMiddleware:n},u=null,a=r.request.subscribe(function(e){u=t(e,function(t,o){return function(e,t,o){var s=e,i=t;if(!s)try{i=n("onResponse",t,o)}catch(e){i=null,s=e}(s=s&&n("onError",s,o))?r.error.publish(s):i&&r.response.publish(i)}(t,o,e)})});r.abort.subscribe(function(){a(),u&&u.abort()});var d=n("onReturn",r,i);return d===r&&r.request.publish(i),d}return s.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return middlehooks.forEach(function(r){e[r]&&o[r].push(e[r])}),n.push(e),s},s.clone=function(){return e(n)},r.forEach(s.use),s};
179
+
180
+ },{"./middleware/defaultOptionsProcessor":60,"./middleware/defaultOptionsValidator":61,"./request":69,"./util/middlewareReducer":71,"nano-pubsub":74}],60:[function(require,module,exports){
181
+ "use strict";var objectAssign=require("object-assign"),urlParse=require("url-parse"),isReactNative="undefined"!=typeof navigator&&"ReactNative"===navigator.product,has=Object.prototype.hasOwnProperty,defaultOptions={timeout:isReactNative?6e4:12e4};function stringifyQueryString(e){var t=[];for(var r in e)has.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 normalizeTimeout(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?normalizeTimeout(defaultOptions.timeout):{connect:t,socket:t}}function removeUndefined(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}module.exports=function(e){var t="string"==typeof e?objectAssign({url:e},defaultOptions):objectAssign({},defaultOptions,e),r=urlParse(t.url,{},!0);return t.timeout=normalizeTimeout(t.timeout),t.query&&(r.query=objectAssign({},r.query,removeUndefined(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(stringifyQueryString),t};
182
+
183
+ },{"object-assign":75,"url-parse":81}],61:[function(require,module,exports){
184
+ "use strict";var validUrl=/^https?:\/\//i;module.exports=function(r){if(!validUrl.test(r.url))throw new Error('"'+r.url+'" is not a valid URL')};
185
+
186
+ },{}],62:[function(require,module,exports){
187
+ "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},objectAssign=require("object-assign"),isPlainObject=require("is-plain-object"),serializeTypes=["boolean","string","number"],isBuffer=function(o){return!!o.constructor&&"function"==typeof o.constructor.isBuffer&&o.constructor.isBuffer(o)};module.exports=function(){return{processOptions:function(o){var e=o.body;return e&&!("function"==typeof e.pipe)&&!isBuffer(e)&&(-1!==serializeTypes.indexOf(void 0===e?"undefined":_typeof(e))||Array.isArray(e)||isPlainObject(e))?objectAssign({},o,{body:JSON.stringify(o.body),headers:objectAssign({},o.headers,{"Content-Type":"application/json"})}):o}}};
188
+
189
+ },{"is-plain-object":72,"object-assign":75}],63:[function(require,module,exports){
190
+ "use strict";var objectAssign=require("object-assign");function tryParse(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: "+e.message,e}}module.exports=function(e){return{onResponse:function(s){var t=s.headers["content-type"]||"",n=e&&e.force||-1!==t.indexOf("application/json");return s.body&&t&&n?objectAssign({},s,{body:tryParse(s.body)}):s},processOptions:function(e){return objectAssign({},e,{headers:objectAssign({Accept:"application/json"},e.headers)})}}};
191
+
192
+ },{"object-assign":75}],64:[function(require,module,exports){
193
+ "use strict";var global=require("../util/global"),objectAssign=require("object-assign");module.exports=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||global.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(r,n){return new e(function(e){return r.error.subscribe(function(r){return e.error(r)}),r.progress.subscribe(function(r){return e.next(objectAssign({type:"progress"},r))}),r.response.subscribe(function(r){e.next(objectAssign({type:"response"},r)),e.complete()}),r.request.publish(n),function(){return r.abort.publish()}})}}};
194
+
195
+ },{"../util/global":70,"object-assign":75}],65:[function(require,module,exports){
196
+ "use strict";module.exports=function(){return{onRequest:function(o){if("xhr"===o.adapter){var e=o.request,t=o.context;"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=n("upload")),"onprogress"in e&&(e.onprogress=n("download"))}function n(o){return function(e){var n=e.lengthComputable?e.loaded/e.total*100:-1;t.channels.progress.publish({stage:o,percent:n,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}}}};
197
+
198
+ },{}],66:[function(require,module,exports){
199
+ "use strict";module.exports=require("./node-progress");
200
+
201
+ },{"./node-progress":65}],67:[function(require,module,exports){
202
+ "use strict";var sameOrigin=require("same-origin"),parseHeaders=require("parse-headers"),FetchXhr=require("./browser/fetchXhr"),noop=function(){},win="undefined"==typeof window?void 0:window,adapter=win?"xhr":"fetch",XmlHttpRequest="function"==typeof XMLHttpRequest?XMLHttpRequest:noop,hasXhr2="withCredentials"in new XmlHttpRequest,XDR="undefined"==typeof XDomainRequest?void 0:XDomainRequest,CrossDomainRequest=hasXhr2?XmlHttpRequest:XDR;win||(XmlHttpRequest=FetchXhr,CrossDomainRequest=FetchXhr),module.exports=function(e,t){var r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},s=win&&win.location&&!sameOrigin(win.location.href,n.url),i=e.applyMiddleware("interceptRequest",void 0,{adapter:adapter,context:e});if(i){var a=setTimeout(t,0,null,i);return{abort:function(){return clearTimeout(a)}}}var u=s?new CrossDomainRequest:new XmlHttpRequest,c=win&&win.XDomainRequest&&u instanceof win.XDomainRequest,d=n.headers,l=n.timeout,p=!1,f=!1,w=!1;if(u.onerror=R,u.ontimeout=R,u.onabort=function(){p=!0},u.onprogress=function(){},u[c?"onload":"onreadystatechange"]=function(){!function(){if(!l)return;q(),o.socket=setTimeout(function(){return m("ESOCKETTIMEDOUT")},l.socket)}(),p||4!==u.readyState&&!c||0!==u.status&&function(){if(p||f||w)return;if(0===u.status)return void R(new Error("Unknown XHR error"));q(),f=!0,t(null,function(){var e=u.status,t=u.statusText;if(c&&void 0===e)e=200;else{if(e>12e3&&e<12156)return R();e=1223===u.status?204:u.status,t=1223===u.status?"No Content":t}return{body:u.response||u.responseText,url:n.url,method:n.method,headers:c?{}:parseHeaders(u.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},u.open(n.method,n.url,!0),u.withCredentials=!!n.withCredentials,d&&u.setRequestHeader)for(var h in d)d.hasOwnProperty(h)&&u.setRequestHeader(h,d[h]);else if(d&&c)throw new Error("Headers cannot be set on an XDomainRequest object");return n.rawBody&&(u.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:adapter,request:u,context:e}),u.send(n.body||null),l&&(o.connect=setTimeout(function(){return m("ETIMEDOUT")},l.connect)),{abort:function(){p=!0,u&&u.abort()}};function m(t){w=!0,u.abort();var r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to "+n.url:"Connection timed out on request to "+n.url);r.code=t,e.channels.error.publish(r)}function q(){(p||u.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function R(e){if(!f){q(),f=!0,u=null;var r=e||new Error("Network error while attempting to reach "+n.url);r.isNetworkError=!0,r.request=n,t(r)}}};
203
+
204
+ },{"./browser/fetchXhr":68,"parse-headers":76,"same-origin":79}],68:[function(require,module,exports){
205
+ "use strict";function FetchXhr(){this.readyState=0}FetchXhr.prototype.open=function(t,e){this._method=t,this._url=e,this._resHeaders="",this.readyState=1,this.onreadystatechange()},FetchXhr.prototype.abort=function(){this._controller&&this._controller.abort()},FetchXhr.prototype.getAllResponseHeaders=function(){return this._resHeaders},FetchXhr.prototype.setRequestHeader=function(t,e){this._headers=this._headers||{},this._headers[t]=e},FetchXhr.prototype.send=function(t){var e=this,r=this._controller="function"==typeof AbortController&&new AbortController,s="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal,body:t};"undefined"!=typeof window&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then(function(t){return t.headers.forEach(function(t,r){e._resHeaders+=r+": "+t+"\r\n"}),e.status=t.status,e.statusText=t.statusText,e.readyState=3,s?t.text():t.arrayBuffer()}).then(function(t){s?e.responseText=t:e.response=t,e.readyState=4,e.onreadystatechange()}).catch(function(t){"AbortError"!==t.name?e.onerror(t):e.onabort()})},module.exports=FetchXhr;
206
+
207
+ },{}],69:[function(require,module,exports){
208
+ "use strict";module.exports=require("./node-request");
209
+
210
+ },{"./node-request":67}],70:[function(require,module,exports){
211
+ (function (global){(function (){
212
+ "use strict";"undefined"!=typeof window?module.exports=window:"undefined"!=typeof global?module.exports=global:"undefined"!=typeof self?module.exports=self:module.exports={};
213
+
214
+ }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
215
+ },{}],71:[function(require,module,exports){
216
+ "use strict";module.exports=function(r){return function(n,o){for(var t=arguments.length,e=Array(t>2?t-2:0),u=2;u<t;u++)e[u-2]=arguments[u];for(var a="onError"===n,c=o,f=0;f<r[n].length&&(c=r[n][f].apply(void 0,[c].concat(e)),!a||c);f++);return c}};
217
+
218
+ },{}],72:[function(require,module,exports){
219
+ "use strict";var isObject=require("isobject");function isObjectObject(t){return!0===isObject(t)&&"[object Object]"===Object.prototype.toString.call(t)}module.exports=function(t){var e,c;return!1!==isObjectObject(t)&&("function"==typeof(e=t.constructor)&&(!1!==isObjectObject(c=e.prototype)&&!1!==c.hasOwnProperty("isPrototypeOf")))};
220
+
221
+ },{"isobject":73}],73:[function(require,module,exports){
222
+ "use strict";module.exports=function(r){return null!=r&&"object"==typeof r&&!1===Array.isArray(r)};
223
+
224
+ },{}],74:[function(require,module,exports){
225
+ module.exports=function(){var n=[];return{subscribe:function(u){return n.push(u),function(){var r=n.indexOf(u);r>-1&&n.splice(r,1)}},publish:function(){for(var u=0;u<n.length;u++)n[u].apply(null,arguments)}}};
226
+
227
+ },{}],75:[function(require,module,exports){
228
+ "use strict";var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map(function(e){return r[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){for(var s in t=Object(arguments[a]))hasOwnProperty.call(t,s)&&(o[s]=t[s]);if(getOwnPropertySymbols){n=getOwnPropertySymbols(t);for(var c=0;c<n.length;c++)propIsEnumerable.call(t,n[c])&&(o[n[c]]=t[n[c]])}}return o};
229
+
230
+ },{}],76:[function(require,module,exports){
231
+ var trim=function(r){return r.replace(/^\s+|\s+$/g,"")},isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(r){if(!r)return{};for(var t={},e=trim(r).split("\n"),i=0;i<e.length;i++){var n=e[i],o=n.indexOf(":"),s=trim(n.slice(0,o)).toLowerCase(),a=trim(n.slice(o+1));void 0===t[s]?t[s]=a:isArray(t[s])?t[s].push(a):t[s]=[t[s],a]}return t};
232
+
233
+ },{}],77:[function(require,module,exports){
234
+ "use strict";var undef,has=Object.prototype.hasOwnProperty;function decode(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function encode(e){try{return encodeURIComponent(e)}catch(e){return null}}function querystring(e){for(var n,r=/([^=?#&]+)=?([^&]*)/g,t={};n=r.exec(e);){var o=decode(n[1]),u=decode(n[2]);null===o||null===u||o in t||(t[o]=u)}return t}function querystringify(e,n){n=n||"";var r,t,o=[];for(t in"string"!=typeof n&&(n="?"),e)if(has.call(e,t)){if((r=e[t])||null!==r&&r!==undef&&!isNaN(r)||(r=""),t=encode(t),r=encode(r),null===t||null===r)continue;o.push(t+"="+r)}return o.length?n+o.join("&"):""}exports.stringify=querystringify,exports.parse=querystring;
235
+
236
+ },{}],78:[function(require,module,exports){
237
+ "use strict";module.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};
238
+
239
+ },{}],79:[function(require,module,exports){
240
+ "use strict";var url=require("url");module.exports=function(o,r,t){if(o===r)return!0;var p=url.parse(o,!1,!0),e=url.parse(r,!1,!0),s=0|p.port||("https"===p.protocol?443:80),u=0|e.port||("https"===e.protocol?443:80),l={proto:p.protocol===e.protocol,hostname:p.hostname===e.hostname,port:s===u};return l.proto&&l.hostname&&(l.port||t)};
241
+
242
+ },{"url":80}],80:[function(require,module,exports){
243
+ "use strict";var regex=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;module.exports={regex:regex,parse:function(e){var o=regex.exec(e);return o?{protocol:(o[1]||"").toLowerCase()||void 0,hostname:(o[5]||"").toLowerCase()||void 0,port:o[6]||void 0}:{}}};
244
+
245
+ },{}],81:[function(require,module,exports){
246
+ (function (global){(function (){
247
+ "use strict";var required=require("requires-port"),qs=require("querystringify"),slashes=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,protocolre=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,windowsDriveLetter=/^[a-zA-Z]:/,whitespace="[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]",left=new RegExp("^"+whitespace+"+");function trimLeft(e){return(e||"").toString().replace(left,"")}var rules=[["#","hash"],["?","query"],function(e,t){return isSpecial(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]],ignore={hash:1,query:1};function lolcation(e){var t,o=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).location||{},r={},s=typeof(e=e||o);if("blob:"===e.protocol)r=new Url(unescape(e.pathname),{});else if("string"===s)for(t in r=new Url(e,{}),ignore)delete r[t];else if("object"===s){for(t in e)t in ignore||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=slashes.test(e.href))}return r}function isSpecial(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function extractProtocol(e,t){e=trimLeft(e),t=t||{};var o,r=protocolre.exec(e),s=r[1]?r[1].toLowerCase():"",a=!!r[2],l=!!r[3],i=0;return a?l?(o=r[2]+r[3]+r[4],i=r[2].length+r[3].length):(o=r[2]+r[4],i=r[2].length):l?(o=r[3]+r[4],i=r[3].length):o=r[4],"file:"===s?i>=2&&(o=o.slice(2)):isSpecial(s)?o=r[4]:s?a&&(o=o.slice(2)):i>=2&&isSpecial(t.protocol)&&(o=r[4]),{protocol:s,slashes:a||isSpecial(s),slashesCount:i,rest:o}}function resolve(e,t){if(""===e)return t;for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=o.length,s=o[r-1],a=!1,l=0;r--;)"."===o[r]?o.splice(r,1):".."===o[r]?(o.splice(r,1),l++):l&&(0===r&&(a=!0),o.splice(r,1),l--);return a&&o.unshift(""),"."!==s&&".."!==s||o.push(""),o.join("/")}function Url(e,t,o){if(e=trimLeft(e),!(this instanceof Url))return new Url(e,t,o);var r,s,a,l,i,n,c=rules.slice(),p=typeof t,h=this,u=0;for("object"!==p&&"string"!==p&&(o=t,t=null),o&&"function"!=typeof o&&(o=qs.parse),r=!(s=extractProtocol(e||"",t=lolcation(t))).protocol&&!s.slashes,h.slashes=s.slashes||r&&t.slashes,h.protocol=s.protocol||t.protocol||"",e=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||windowsDriveLetter.test(e))||!s.slashes&&(s.protocol||s.slashesCount<2||!isSpecial(h.protocol)))&&(c[3]=[/(.*)/,"pathname"]);u<c.length;u++)"function"!=typeof(l=c[u])?(a=l[0],n=l[1],a!=a?h[n]=e:"string"==typeof a?~(i=e.indexOf(a))&&("number"==typeof l[2]?(h[n]=e.slice(0,i),e=e.slice(i+l[2])):(h[n]=e.slice(i),e=e.slice(0,i))):(i=a.exec(e))&&(h[n]=i[1],e=e.slice(0,i.index)),h[n]=h[n]||r&&l[3]&&t[n]||"",l[4]&&(h[n]=h[n].toLowerCase())):e=l(e,h);o&&(h.query=o(h.query)),r&&t.slashes&&"/"!==h.pathname.charAt(0)&&(""!==h.pathname||""!==t.pathname)&&(h.pathname=resolve(h.pathname,t.pathname)),"/"!==h.pathname.charAt(0)&&isSpecial(h.protocol)&&(h.pathname="/"+h.pathname),required(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(l=h.auth.split(":"),h.username=l[0]||"",h.password=l[1]||""),h.origin="file:"!==h.protocol&&isSpecial(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function set(e,t,o){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||qs.parse)(t)),r[e]=t;break;case"port":r[e]=t,required(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!o;break;case"pathname":case"hash":if(t){var s="pathname"===e?"/":"#";r[e]=t.charAt(0)!==s?s+t:t}else r[e]=t;break;default:r[e]=t}for(var a=0;a<rules.length;a++){var l=rules[a];l[4]&&(r[l[1]]=r[l[1]].toLowerCase())}return r.origin="file:"!==r.protocol&&isSpecial(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}function toString(e){e&&"function"==typeof e||(e=qs.stringify);var t,o=this,r=o.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var s=r+(o.slashes||isSpecial(o.protocol)?"//":"");return o.username&&(s+=o.username,o.password&&(s+=":"+o.password),s+="@"),s+=o.host+o.pathname,(t="object"==typeof o.query?e(o.query):o.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),o.hash&&(s+=o.hash),s}Url.prototype={set:set,toString:toString},Url.extractProtocol=extractProtocol,Url.location=lolcation,Url.trimLeft=trimLeft,Url.qs=qs,module.exports=Url;
248
+
249
+ }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
250
+ },{"querystringify":77,"requires-port":78}],82:[function(require,module,exports){
245
251
  var evs=require("@rexxars/eventsource-polyfill");module.exports="undefined"!=typeof window&&window.EventSource?window.EventSource:evs.EventSource;
246
252
 
247
- },{"@rexxars/eventsource-polyfill":1}],81:[function(require,module,exports){
253
+ },{"@rexxars/eventsource-polyfill":1}],83:[function(require,module,exports){
248
254
  var baseUrl="https://docs.sanity.io/help/";module.exports=function(e){return baseUrl+e};
249
255
 
250
- },{}]},{},[72])(72)
256
+ },{}]},{},[50])(50)
251
257
  });
@@ -1 +1 @@
1
- !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SanityClient=t()}}((function(){return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[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:{}};e[s][0].call(l.exports,(function(t){return o(e[s][1][t]||t)}),l,l.exports,t,e,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(t,e,r){(function(t){(function(){!function(r,n){if("object"==typeof e&&e.exports)e.exports=n();else{if(t.EventSource&&!t._eventSourceImportPrefix)return;r[(r._eventSourceImportPrefix||"")+"EventSource"]=n()}}("undefined"==typeof self?this:self,(function(){var t=function(t,e){if(!t||"string"!=typeof t)throw new SyntaxError("Not enough arguments");this.URL=t,this.setOptions(e);var r=this;setTimeout((function(){r.poll()}),0)};if(t.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,r=this.defaultOptions;for(e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);for(e in t)e in r&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&void 0!==console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout((function(){e.poll()}),t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout((function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()}),this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},_onxhrdata:function(){var t=this._xhr;if(t.isReady()&&!t.hasError()){this.resetNoActivityTimer(),this.readyState==this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent("open",{type:"open"}));var e=t.getBuffer();e.length>this.bufferSizeLimit&&(this.log("buffer.length > this.bufferSizeLimit"),this.pollAgain()),0==this.cursor&&e.length>0&&"\ufeff"==e.substring(0,1)&&(this.cursor=1);var r=this.lastMessageIndex(e);if(r[0]>=this.cursor){var n=r[1],o=e.substring(this.cursor,n);this.parseStream(o),this.cursor=n}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){var e,n,o,i,s,a,u=(t=this.cache+this.normalizeToLF(t)).split("\n\n");for(e=0;e<u.length-1;e++){o="message",i=[];var c=u[e].split("\n");for(n=0;n<c.length;n++)0==(s=this.trimWhiteSpace(c[n])).indexOf("event")?o=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(a=parseInt(s.replace(/retry:?\s*/,""),10),isNaN(a)||(this.interval=a)):0==s.indexOf("data")?i.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(i.length&&this.readyState!=this.CLOSED){var l=new r(o,i.join("\n"),"undefined"!=typeof window&&void 0!==window.location?window.location.origin:null,this.lastEventId);this.dispatchEvent(o,l)}}this.cache=u[u.length-1]},dispatchEvent:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=0;n<r.length;n++)r[n].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=r.length-1;n>=0;--n)if(r[n]===e){r.splice(n,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var r=[];if(e){var n,o,i=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(o=i(n)+"="+i(e[n]),r.push(o))}return r.length>0?-1==t.indexOf("?")?t+"?"+r.join("&"):t+"&"+r.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),r=t.lastIndexOf("\r\r"),n=t.lastIndexOf("\r\n\r\n");return n>Math.max(e,r)?[n,n+4]:[Math.max(e,r),Math.max(e,r)+2]},trimWhiteSpace:function(t){return t.replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},Boolean("undefined"!=typeof window&&window.XDomainRequest&&window.XMLHttpRequest&&void 0===(new XMLHttpRequest).responseType)){t.isPolyfill="IE_8-9";var e=t.prototype.defaultOptions;e.xhrHeaders=null,e.getArgs.evs_preamble=2056,t.prototype.XHR=function(t){var e=new XDomainRequest;this._request=e,e.onprogress=function(){e._ready=!0,t._onxhrdata()},e.onload=function(){this._loaded=!0,t._onxhrdata()},e.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},e.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var r={};if(t.getArgs){var n=t.getArgs;for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);t.lastEventId&&(r.evs_last_event_id=t.lastEventId)}e.open("GET",t.urlWithParams(t.URL,r)),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!0,_request:null,_ready:!1,_loaded:!1,_failed:!1,isReady:function(){return this._request._ready},isDone:function(){return this._request._loaded},hasError:function(){return this._request._failed},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}}}else t.isPolyfill="XHR",t.prototype.XHR=function(t){var e=new XMLHttpRequest;this._request=e,t._xhr=this,e.onreadystatechange=function(){e.readyState>1&&t.readyState!=t.CLOSED&&(200==e.status||e.status>=300&&e.status<400?t._onxhrdata():(e._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+e.status}),t.close()))},e.onprogress=function(){},e.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var r=t.xhrHeaders;for(var n in r)r.hasOwnProperty(n)&&e.setRequestHeader(n,r[n]);t.lastEventId&&e.setRequestHeader("Last-Event-Id",t.lastEventId),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!1,_request:null,_failed:!1,isReady:function(){return this._request.readyState>=2},isDone:function(){return 4==this._request.readyState},hasError:function(){return this._failed||this._request.status>=400},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}};function r(t,e,r,n){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.data=e||null,this.origin=r||"",this.lastEventId=n||"",this.type=t||"message"}return t}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,r){"use strict";var n=t("rxjs/internal/Observable").Observable,o=t("object-assign"),i=t("../operators/map").map,s=t("../operators/filter").filter,a=t("../operators/reduce").reduce;function u(){n.apply(this,arguments)}function c(t,e){var r=!1;return function(){return r||(r=!0,console.warn(new Error("Calling observable.".concat(t,"(...) is deprecated. Please use observable.pipe(").concat(t,"(...)) instead")))),this.pipe(e.apply(this,arguments))}}u.prototype=Object.create(o(Object.create(null),n.prototype)),Object.defineProperty(u.prototype,"constructor",{value:u,enumerable:!1,writable:!0,configurable:!0}),u.prototype.lift=function(t){var e=new u;return e.source=this,e.operator=t,e},u.prototype.map=c("map",i),u.prototype.filter=c("filter",s),u.prototype.reduce=c("filter",a),e.exports=u},{"../operators/filter":4,"../operators/map":5,"../operators/reduce":6,"object-assign":26,"rxjs/internal/Observable":30}],3:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":2}],4:[function(t,e,r){r.filter=t("rxjs/internal/operators/filter").filter},{"rxjs/internal/operators/filter":37}],5:[function(t,e,r){r.map=t("rxjs/internal/operators/map").map},{"rxjs/internal/operators/map":38}],6:[function(t,e,r){r.reduce=t("rxjs/internal/operators/reduce").reduce},{"rxjs/internal/operators/reduce":39}],7:[function(t,e,r){"use strict";var n=t("is-obj"),o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function a(t,e,r){var i=e[r];if(null!=i){if(o.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");o.call(t,r)&&n(i)?t[r]=u(Object(t[r]),e[r]):t[r]=i}}function u(t,e){if(t===e)return t;for(var r in e=Object(e))o.call(e,r)&&a(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),s=0;s<n.length;s++)i.call(e,n[s])&&a(t,e,n[s]);return t}e.exports=function(t){t=s(t);for(var e=1;e<arguments.length;e++)u(t,arguments[e]);return t}},{"is-obj":8}],8:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],9:[function(t,e,r){e.exports=t("./lib-node")},{"./lib-node":10}],10:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./middleware/defaultOptionsValidator"),a=t("./request"),u=["request","response","progress","error","abort"],c=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=[],l=c.reduce((function(t,e){return t[e]=t[e]||[],t}),{processOptions:[i],validateOptions:[s]});function f(t){var e=u.reduce((function(t,e){return t[e]=n(),t}),{}),r=o(l),i=r("processOptions",t);r("validateOptions",i);var s={options:i,channels:e,applyMiddleware:r},c=null,f=e.request.subscribe((function(t){c=a(t,(function(n,o){return function(t,n,o){var i=t,s=n;if(!i)try{s=r("onResponse",n,o)}catch(t){s=null,i=t}(i=i&&r("onError",i,o))?e.error.publish(i):s&&e.response.publish(s)}(n,o,t)}))}));e.abort.subscribe((function(){f(),c&&c.abort()}));var p=r("onReturn",e,s);return p===e&&e.request.publish(s),p}return f.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&l.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 c.forEach((function(e){t[e]&&l[e].push(t[e])})),r.push(t),f},f.clone=function(){return t(r)},e.forEach(f.use),f}},{"./middleware/defaultOptionsProcessor":11,"./middleware/defaultOptionsValidator":12,"./request":19,"./util/middlewareReducer":21,"nano-pubsub":22}],11:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("url-parse"),i="undefined"!=typeof navigator&&"ReactNative"===navigator.product,s=Object.prototype.hasOwnProperty,a={timeout:i?6e4:12e4};function u(t){var e=[];for(var r in t)s.call(t,r)&&n(r,t[r]);return e.length?e.join("&"):"";function n(t,r){Array.isArray(r)?r.forEach((function(e){return n(t,e)})):e.push([t,r].map(encodeURIComponent).join("="))}}function c(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?c(a.timeout):{connect:e,socket:e}}e.exports=function(t){var e="string"==typeof t?n({url:t},a):n({},a,t),r=o(e.url,{},!0);return e.timeout=c(e.timeout),e.query&&(r.query=n({},r.query,function(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(u),e}},{"object-assign":26,"url-parse":56}],12:[function(t,e,r){"use strict";var n=/^https?:\/\//i;e.exports=function(t){if(!n.test(t.url))throw new Error('"'+t.url+'" is not a valid URL')}},{}],13:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"];e.exports=function(){return{processOptions:function(t){var e=t.body;return e&&"function"!=typeof e.pipe&&!function(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}(e)&&(-1!==s.indexOf(void 0===e?"undefined":n(e))||Array.isArray(e)||i(e))?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":23,"object-assign":26}],14:[function(t,e,r){"use strict";var n=t("object-assign");function o(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: "+t.message,t}}e.exports=function(t){return{onResponse:function(e){var r=e.headers["content-type"]||"",i=t&&t.force||-1!==r.indexOf("application/json");return e.body&&r&&i?n({},e,{body:o(e.body)}):e},processOptions:function(t){return n({},t,{headers:n({Accept:"application/json"},t.headers)})}}}},{"object-assign":26}],15:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||n.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(e,r){return new t((function(t){return e.error.subscribe((function(e){return t.error(e)})),e.progress.subscribe((function(e){return t.next(o({type:"progress"},e))})),e.response.subscribe((function(e){t.next(o({type:"response"},e)),t.complete()})),e.request.publish(r),function(){return e.abort.publish()}}))}}}},{"../util/global":20,"object-assign":26}],16:[function(t,e,r){"use strict";e.exports=function(){return{onRequest:function(t){if("xhr"===t.adapter){var e=t.request,r=t.context;"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=n("upload")),"onprogress"in e&&(e.onprogress=n("download"))}function n(t){return function(e){var n=e.lengthComputable?e.loaded/e.total*100:-1;r.channels.progress.publish({stage:t,percent:n,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}}}}},{}],17:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":16}],18:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=window,s=i.XMLHttpRequest||function(){},a="withCredentials"in new s?s:i.XDomainRequest;e.exports=function(t,e){var r=t.options,u=t.applyMiddleware("finalizeOptions",r),c={},l=i&&i.location&&!n(i.location.href,u.url),f=t.applyMiddleware("interceptRequest",void 0,{adapter:"xhr",context:t});if(f){var p=setTimeout(e,0,null,f);return{abort:function(){return clearTimeout(p)}}}var h=l?new a:new s,d=i.XDomainRequest&&h instanceof i.XDomainRequest,b=u.headers,y=!1,v=!1,g=!1;if(h.onerror=j,h.ontimeout=j,h.onabort=function(){y=!0},h.onprogress=function(){},h[d?"onload":"onreadystatechange"]=function(){w&&(O(),c.socket=setTimeout((function(){return _("ESOCKETTIMEDOUT")}),w.socket)),y||4!==h.readyState&&!d||0!==h.status&&(y||v||g||(0!==h.status?(O(),v=!0,e(null,function(){var t=h.status,e=h.statusText;if(d&&void 0===t)t=200;else{if(t>12e3&&t<12156)return j();t=1223===h.status?204:h.status,e=1223===h.status?"No Content":e}return{body:h.response||h.responseText,url:u.url,method:u.method,headers:d?{}:o(h.getAllResponseHeaders()),statusCode:t,statusMessage:e}}())):j(new Error("Unknown XHR error"))))},h.open(u.method,u.url,!0),h.withCredentials=!!u.withCredentials,b&&h.setRequestHeader)for(var m in b)b.hasOwnProperty(m)&&h.setRequestHeader(m,b[m]);else if(b&&d)throw new Error("Headers cannot be set on an XDomainRequest object");u.rawBody&&(h.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:u,adapter:"xhr",request:h,context:t}),h.send(u.body||null);var w=u.timeout;return w&&(c.connect=setTimeout((function(){return _("ETIMEDOUT")}),w.connect)),{abort:function(){y=!0,h&&h.abort()}};function _(e){g=!0,h.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+u.url:"Connection timed out on request to "+u.url);r.code=e,t.channels.error.publish(r)}function O(){(y||h.readyState>=2&&c.connect)&&clearTimeout(c.connect),c.socket&&clearTimeout(c.socket)}function j(){if(!v){O(),v=!0,h=null;var t=new Error("Network error while attempting to reach "+u.url);t.isNetworkError=!0,t.request=u,e(t)}}}},{"parse-headers":27,"same-origin":54}],19:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":18}],20:[function(t,e,r){(function(t){(function(){"use strict";"undefined"!=typeof window?e.exports=window:void 0!==t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(t,e,r){"use strict";e.exports=function(t){return function(e,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];for(var s="onError"===e,a=r,u=0;u<t[e].length&&(a=t[e][u].apply(void 0,[a].concat(o)),!s||a);u++);return a}}},{}],22:[function(t,e,r){e.exports=function(){var t=[];return{subscribe:function(e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}},publish:function(){for(var e=0;e<t.length;e++)t[e].apply(null,arguments)}}}},{}],23:[function(t,e,r){"use strict";var n=t("isobject");function o(t){return!0===n(t)&&"[object Object]"===Object.prototype.toString.call(t)}e.exports=function(t){var e,r;return!1!==o(t)&&"function"==typeof(e=t.constructor)&&!1!==o(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")}},{isobject:24}],24:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},{}],25:[function(t,e,r){"use strict";var n="undefined"!=typeof Reflect?Reflect.construct:void 0,o=Object.defineProperty,i=Error.captureStackTrace;function s(t){void 0!==t&&o(this,"message",{configurable:!0,value:t,writable:!0});var e=this.constructor.name;void 0!==e&&e!==this.name&&o(this,"name",{configurable:!0,value:e,writable:!0}),i(this,this.constructor)}void 0===i&&(i=function(t){var e=new Error;o(t,"stack",{configurable:!0,get:function(){var t=e.stack;return o(this,"stack",{configurable:!0,value:t,writable:!0}),t},set:function(e){o(t,"stack",{configurable:!0,value:e,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var a=function(){function t(t,e){return o(t,"name",{configurable:!0,value:e})}try{var e=function(){};if(t(e,"foo"),"foo"===e.name)return t}catch(t){}}();r=e.exports=function(t,e){if(null==e||e===Error)e=s;else if("function"!=typeof e)throw new TypeError("super_ should be a function");var r;if("string"==typeof t)r=t,t=void 0!==n?function(){return n(e,arguments,this.constructor)}:function(){e.apply(this,arguments)},void 0!==a&&(a(t,r),r=void 0);else if("function"!=typeof t)throw new TypeError("constructor should be either a string or a function");t.super_=t.super=e;var o={constructor:{configurable:!0,value:t,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),t.prototype=Object.create(e.prototype,o),t},r.BaseError=s},{}],26:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=s(t),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))o.call(r,l)&&(u[l]=r[l]);if(n){a=n(r);for(var f=0;f<a.length;f++)i.call(r,a[f])&&(u[a[f]]=r[a[f]])}}return u}},{}],27:[function(t,e,r){var n=function(t){return t.replace(/^\s+|\s+$/g,"")},o=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};for(var e={},r=n(t).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===e[u]?e[u]=c:o(e[u])?e[u].push(c):e[u]=[e[u],c]}return e}},{}],28:[function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function i(t){try{return encodeURIComponent(t)}catch(t){return null}}r.stringify=function(t,e){e=e||"";var r,o,s=[];for(o in"string"!=typeof e&&(e="?"),t)if(n.call(t,o)){if((r=t[o])||null!=r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;s.push(o+"="+r)}return s.length?e+s.join("&"):""},r.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,n={};e=r.exec(t);){var i=o(e[1]),s=o(e[2]);null===i||null===s||i in n||(n[i]=s)}return n}},{}],29:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/canReportError"),o=t("./util/toSubscriber"),i=t("./symbol/observable"),s=t("./util/pipe"),a=t("./config"),u=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,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},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),n.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=c(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[i.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:s.pipeFromArray(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=c(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function c(t){if(t||(t=a.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}r.Observable=u},{"./config":34,"./symbol/observable":42,"./util/canReportError":46,"./util/pipe":52,"./util/toSubscriber":53}],31:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./config"),o=t("./util/hostReportError");r.empty={closed:!0,next:function(t){},error:function(t){if(n.config.useDeprecatedSynchronousErrorHandling)throw t;o.hostReportError(t)},complete:function(){}}},{"./config":34,"./util/hostReportError":47}],32:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("./util/isFunction"),s=t("./Observer"),a=t("./Subscription"),u=t("../internal/symbol/rxSubscriber"),c=t("./config"),l=t("./util/hostReportError"),f=function(t){function e(r,n,o){var i=t.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 e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new p(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new p(i,r,n,o)}return i}return o(e,t),e.prototype[u.rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(a.Subscription);r.Subscriber=f;var p=function(t){function e(e,r,n,o){var a,u=t.call(this)||this;u._parentSubscriber=e;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(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=c.config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):l.hostReportError(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;l.hostReportError(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};c.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.config.useDeprecatedSynchronousErrorHandling)throw t;l.hostReportError(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!c.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return c.config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(l.hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(f);r.SafeSubscriber=p},{"../internal/symbol/rxSubscriber":43,"./Observer":31,"./Subscription":33,"./config":34,"./util/hostReportError":47,"./util/isFunction":50}],33:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/isArray"),o=t("./util/isObject"),i=t("./util/isFunction"),s=t("./util/UnsubscriptionError"),a=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;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 t)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(t){e=t instanceof s.UnsubscriptionError?u(t.errors):[t]}}if(n.isArray(l)){f=-1;for(var p=l.length;++f<p;){var h=l[f];if(o.isObject(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof s.UnsubscriptionError?e=e.concat(u(t.errors)):e.push(t)}}}if(e)throw new s.UnsubscriptionError(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){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},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function u(t){return t.reduce((function(t,e){return t.concat(e instanceof s.UnsubscriptionError?e.errors:e)}),[])}r.Subscription=a},{"./util/UnsubscriptionError":45,"./util/isArray":49,"./util/isFunction":50,"./util/isObject":51}],34:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1;r.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else n&&console.log("RxJS: Back to a better error behavior. Thank you. <3");n=t},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],35:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Observable");r.EMPTY=new n.Observable((function(t){return t.complete()})),r.empty=function(t){return t?function(t){return new n.Observable((function(e){return t.schedule((function(){return e.complete()}))}))}(t):r.EMPTY}},{"../Observable":30}],36:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.defaultIfEmpty=function(t){return void 0===t&&(t=null),function(e){return e.lift(new s(t))}};var s=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.defaultValue))},t}(),a=function(t){function e(e,r){var n=t.call(this,e)||this;return n.defaultValue=r,n.isEmpty=!0,n}return o(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(i.Subscriber)},{"../Subscriber":32}],37:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.filter=function(t,e){return function(r){return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":32}],38:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.map=function(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}();r.MapOperator=s;var a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":32}],39:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./scan"),o=t("./takeLast"),i=t("./defaultIfEmpty"),s=t("../util/pipe");r.reduce=function(t,e){return arguments.length>=2?function(r){return s.pipe(n.scan(t,e),o.takeLast(1),i.defaultIfEmpty(e))(r)}:function(e){return s.pipe(n.scan((function(e,r,n){return t(e,r,n+1)})),o.takeLast(1))(e)}}},{"../util/pipe":52,"./defaultIfEmpty":36,"./scan":40,"./takeLast":41}],40:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.scan=function(t,e){var r=!1;return arguments.length>=2&&(r=!0),function(n){return n.lift(new s(t,e,r))}};var s=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.accumulator,this.seed,this.hasSeed))},t}(),a=function(t){function e(e,r,n,o){var i=t.call(this,e)||this;return i.accumulator=r,i._seed=n,i.hasSeed=o,i.index=0,i}return o(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.accumulator(this.seed,t,r)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":32}],41:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber"),s=t("../util/ArgumentOutOfRangeError"),a=t("../observable/empty");r.takeLast=function(t){return function(e){return 0===t?a.empty():e.lift(new u(t))}};var u=function(){function t(t){if(this.total=t,this.total<0)throw new s.ArgumentOutOfRangeError}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.total))},t}(),c=function(t){function e(e,r){var n=t.call(this,e)||this;return n.total=r,n.ring=new Array,n.count=0,n}return o(e,t),e.prototype._next=function(t){var e=this.ring,r=this.total,n=this.count++;e.length<r?e.push(t):e[n%r]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var r=this.count>=this.total?this.total:this.count,n=this.ring,o=0;o<r;o++){var i=e++%r;t.next(n[i])}t.complete()},e}(i.Subscriber)},{"../Subscriber":32,"../observable/empty":35,"../util/ArgumentOutOfRangeError":44}],42:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],43:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),r.$$rxSubscriber=r.rxSubscriber},{}],44:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}();r.ArgumentOutOfRangeError=n},{}],45:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}();r.UnsubscriptionError=n},{}],46:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber");r.canReportError=function(t){for(;t;){var e=t,r=e.closed,o=e.destination,i=e.isStopped;if(r||i)return!1;t=o&&o instanceof n.Subscriber?o:null}return!0}},{"../Subscriber":32}],47:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hostReportError=function(t){setTimeout((function(){throw t}),0)}},{}],48:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(t){return t}},{}],49:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],50:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFunction=function(t){return"function"==typeof t}},{}],51:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isObject=function(t){return null!==t&&"object"==typeof t}},{}],52:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./identity");function o(t){return 0===t.length?n.identity:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}r.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)},r.pipeFromArray=o},{"./identity":48}],53:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber"),o=t("../symbol/rxSubscriber"),i=t("../Observer");r.toSubscriber=function(t,e,r){if(t){if(t instanceof n.Subscriber)return t;if(t[o.rxSubscriber])return t[o.rxSubscriber]()}return t||e||r?new n.Subscriber(t,e,r):new n.Subscriber(i.empty)}},{"../Observer":31,"../Subscriber":32,"../symbol/rxSubscriber":43}],54:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!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:55}],55:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],56:[function(t,e,r){(function(r){(function(){"use strict";var n=t("requires-port"),o=t("querystringify"),i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,a=/^[a-zA-Z]:/,u=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function c(t){return(t||"").toString().replace(u,"")}var l=[["#","hash"],["?","query"],function(t,e){return h(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function p(t){var e,n=("undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(t=t||n);if("blob:"===t.protocol)o=new b(unescape(t.pathname),{});else if("string"===s)for(e in o=new b(t,{}),f)delete o[e];else if("object"===s){for(e in t)e in f||(o[e]=t[e]);void 0===o.slashes&&(o.slashes=i.test(t.href))}return o}function h(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function d(t,e){t=c(t),e=e||{};var r,n=s.exec(t),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)):h(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&h(e.protocol)&&(r=n[4]),{protocol:o,slashes:i||h(o),slashesCount:u,rest:r}}function b(t,e,r){if(t=c(t),!(this instanceof b))return new b(t,e,r);var i,s,u,f,y,v,g=l.slice(),m=typeof e,w=this,_=0;for("object"!==m&&"string"!==m&&(r=e,e=null),r&&"function"!=typeof r&&(r=o.parse),i=!(s=d(t||"",e=p(e))).protocol&&!s.slashes,w.slashes=s.slashes||i&&e.slashes,w.protocol=s.protocol||e.protocol||"",t=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||a.test(t))||!s.slashes&&(s.protocol||s.slashesCount<2||!h(w.protocol)))&&(g[3]=[/(.*)/,"pathname"]);_<g.length;_++)"function"!=typeof(f=g[_])?(u=f[0],v=f[1],u!=u?w[v]=t:"string"==typeof u?~(y=t.indexOf(u))&&("number"==typeof f[2]?(w[v]=t.slice(0,y),t=t.slice(y+f[2])):(w[v]=t.slice(y),t=t.slice(0,y))):(y=u.exec(t))&&(w[v]=y[1],t=t.slice(0,y.index)),w[v]=w[v]||i&&f[3]&&e[v]||"",f[4]&&(w[v]=w[v].toLowerCase())):t=f(t,w);r&&(w.query=r(w.query)),i&&e.slashes&&"/"!==w.pathname.charAt(0)&&(""!==w.pathname||""!==e.pathname)&&(w.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.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("/")}(w.pathname,e.pathname)),"/"!==w.pathname.charAt(0)&&h(w.protocol)&&(w.pathname="/"+w.pathname),n(w.port,w.protocol)||(w.host=w.hostname,w.port=""),w.username=w.password="",w.auth&&(f=w.auth.split(":"),w.username=f[0]||"",w.password=f[1]||""),w.origin="file:"!==w.protocol&&h(w.protocol)&&w.host?w.protocol+"//"+w.host:"null",w.href=w.toString()}b.prototype={set:function(t,e,r){var i=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||o.parse)(e)),i[t]=e;break;case"port":i[t]=e,n(e,i.protocol)?e&&(i.host=i.hostname+":"+e):(i.host=i.hostname,i[t]="");break;case"hostname":i[t]=e,i.port&&(e+=":"+i.port),i.host=e;break;case"host":i[t]=e,/:\d+$/.test(e)?(e=e.split(":"),i.port=e.pop(),i.hostname=e.join(":")):(i.hostname=e,i.port="");break;case"protocol":i.protocol=e.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(e){var s="pathname"===t?"/":"#";i[t]=e.charAt(0)!==s?s+e:e}else i[t]=e;break;default:i[t]=e}for(var a=0;a<l.length;a++){var u=l[a];u[4]&&(i[u[1]]=i[u[1]].toLowerCase())}return i.origin="file:"!==i.protocol&&h(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(t){t&&"function"==typeof t||(t=o.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var i=n+(r.slashes||h(r.protocol)?"//":"");return r.username&&(i+=r.username,r.password&&(i+=":"+r.password),i+="@"),i+=r.host+r.pathname,(e="object"==typeof r.query?t(r.query):r.query)&&(i+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(i+=r.hash),i}},b.extractProtocol=d,b.location=p,b.trimLeft=c,b.qs=o,e.exports=b}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:28,"requires-port":29}],57:[function(t,e,r){"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){a=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||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 o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i=t("object-assign"),s=t("@sanity/observable/operators/map").map,a=t("@sanity/observable/operators/filter").filter,u=t("../http/queryString"),c=t("../validators");function l(t){this.client=t}function f(t){var e=t.document;return Object.defineProperty(e,"document",{enumerable:!1,get:function(){return console.warn("The promise returned from client.asset.upload(...) now resolves with the asset document"),e}}),e}function p(t,e){return"undefined"!=typeof window&&e instanceof window.File?i({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t):t}i(l.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};c.validateAssetType(t);var n=r.extract||void 0;n&&!n.length&&(n=["none"]);var o=c.hasDataset(this.client.clientConfig),i="image"===t?"images":"files",u=p(r,e),l=u.tag,h=u.label,d=u.title,b=u.description,y=u.creditLine,v=u.filename,g=u.source,m={label:h,title:d,description:b,filename:v,meta:n,creditLine:y};g&&(m.sourceId=g.id,m.sourceName=g.name,m.sourceUrl=g.url);var w=this.client._requestObservable({tag:l,method:"POST",timeout:u.timeout||0,uri:"/assets/".concat(i,"/").concat(o),headers:u.contentType?{"Content-Type":u.contentType}:{},query:m,body:e});return this.client.isPromiseAPI()?w.pipe(a((function(t){return"response"===t.type})),s((function(t){return f(t.body)}))).toPromise():w},delete:function(t,e){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");var r=e||"";return/^(image|file)-/.test(r)?t._id&&(r=t._id):r="".concat(t,"-").concat(r),c.hasDataset(this.client.clientConfig),this.client.delete(r)},getImageUrl:function(t,e){var r=t._ref||t;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 o=n(r.split("-"),4),i=o[1],s=o[2],a=o[3];c.hasDataset(this.client.clientConfig);var l=this.client.clientConfig,f=l.projectId,p=l.dataset,h=e?u(e):"";return"https://cdn.sanity.io/images/".concat(f,"/").concat(p,"/").concat(i,"-").concat(s,".").concat(a).concat(h)}}),e.exports=l},{"../http/queryString":68,"../validators":78,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":26}],58:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout",method:"POST"})}}),e.exports=n},{"object-assign":26}],59:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("object-assign"),i=t("./validators"),s=t("./warnings"),a={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,gradientMode:!1,isPromiseAPI:!0},u=["localhost","127.0.0.1","0.0.0.0"];r.defaultConfig=a,r.initConfig=function(t,e){var c=o({},e,t);c.apiVersion||s.printNoApiVersionSpecifiedWarning();var l=o({},a,c),f=l.gradientMode,p=!f&&l.useProjectHostname;if("undefined"==typeof Promise){var h=n("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(h))}if(f&&!l.namespace)throw new Error("Configuration must contain `namespace` when running in gradient mode");if(p&&!l.projectId)throw new Error("Configuration must contain `projectId`");var d="undefined"!=typeof window&&window.location&&window.location.hostname,b=d&&function(t){return-1!==u.indexOf(t)}(window.location.hostname);if(d&&b&&l.token&&!0!==l.ignoreBrowserTokenWarning?s.printBrowserTokenWarning():(!d||b)&&l.useCdn&&l.token?s.printCdnTokenWarning():void 0===l.useCdn&&s.printCdnWarning(),p&&i.projectId(l.projectId),!f&&l.dataset&&i.dataset(l.dataset,l.gradientMode),"requestTagPrefix"in l&&(l.requestTagPrefix=l.requestTagPrefix?i.requestTag(l.requestTagPrefix).replace(/\.+$/,""):void 0),l.apiVersion="".concat(l.apiVersion).replace(/^v/,""),l.isDefaultApi=l.apiHost===a.apiHost,l.useCdn=Boolean(l.useCdn)&&!l.token&&!l.withCredentials,r.validateApiVersion(l.apiVersion),l.gradientMode)l.url=l.apiHost,l.cdnUrl=l.apiHost;else{var y=l.apiHost.split("://",2),v=y[0],g=y[1],m=l.isDefaultApi?"apicdn.sanity.io":g;l.useProjectHostname?(l.url="".concat(v,"://").concat(l.projectId,".").concat(g,"/v").concat(l.apiVersion),l.cdnUrl="".concat(v,"://").concat(l.projectId,".").concat(m,"/v").concat(l.apiVersion)):(l.url="".concat(l.apiHost,"/v").concat(l.apiVersion),l.cdnUrl=l.url)}return l},r.validateApiVersion=function(t){if("1"!==t&&"X"!==t){var e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}}},{"./validators":78,"./warnings":79,"@sanity/generate-help-url":81,"object-assign":26}],60:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("@sanity/observable/operators/filter").filter,s=t("@sanity/observable/operators/map").map,a=t("../validators"),u=t("../util/getSelection"),c=t("./encodeQueryString"),l=t("./transaction"),f=t("./patch"),p=t("./listen"),h=function(t,e){return!1===t?void 0:void 0===t?e:t},d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:h(t.returnDocuments,!0),visibility:t.visibility||"sync"}},b=function(t){return"response"===t.type},y=function(t){return t.body},v=function(t,e){return t.reduce((function(t,r){return t[e(r)]=r,t}),Object.create(null))},g=function(t){return t.toPromise()};e.exports={listen:p,getDataUrl:function(t,e){var r=this.clientConfig,n=r.gradientMode?r.namespace:a.hasDataset(r),o="/".concat(t,"/").concat(n),i=e?"".concat(o,"/").concat(e):o;return(this.clientConfig.gradientMode?i:"/data".concat(i)).replace(/\/($|\?)/,"$1")},fetch:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(t){return t}:function(t){return t.result},o=this._dataRequest("query",{query:t,params:e},r).pipe(s(n));return this.isPromiseAPI()?g(o):o},getDocument:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(i(b),s((function(t){return t.body.documents&&t.body.documents[0]})));return this.isPromiseAPI()?g(n):n},getDocuments:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t.join(",")),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(i(b),s((function(e){var r=v(e.body.documents||[],(function(t){return t._id}));return t.map((function(t){return r[t]||null}))})));return this.isPromiseAPI()?g(n):n},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return a.requireDocumentId("createIfNotExists",t),this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return a.requireDocumentId("createOrReplace",t),this._create(t,"createOrReplace",e)},patch:function(t,e){return new f(t,e,this)},delete:function(t,e){return this.dataRequest("mutate",{mutations:[{delete:u(t)}]},e)},mutate:function(t,e){var r=t instanceof f||t instanceof l?t.serialize():t,n=Array.isArray(r)?r:[r],o=e&&e.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},e)},transaction:function(t){return new l(t,this)},dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(t,e,r);return this.isPromiseAPI()?g(n):n},_dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="mutate"===t,a="query"===t,u=!o&&c(e),l=!o&&u.length<11264,f=l?u:"",p=r.returnFirst,h=r.timeout,v=r.token,g=r.tag,m={method:l?"GET":"POST",uri:this.getDataUrl(t,f),json:!0,body:l?void 0:e,query:o&&d(r),timeout:h,token:v,tag:g,canUseCdn:a};return this._requestObservable(m).pipe(i(b),s(y),s((function(t){if(!o)return t;var e=t.results||[];if(r.returnDocuments)return p?e[0]&&e[0].document:e.map((function(t){return t.document}));var i=p?"documentId":"documentIds",s=p?e[0]&&e[0].id:e.map((function(t){return t.id}));return n({transactionId:t.transactionId,results:e},i,s)})))},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n({},e,t),s=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[i]},s)}}},{"../util/getSelection":75,"../validators":78,"./encodeQueryString":61,"./listen":62,"./patch":63,"./transaction":64,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":26}],61:[function(t,e,r){"use strict";var n=["tag"];function o(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var i=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,s=void 0===r?{}:r,a=t.options,u=void 0===a?{}:a,c=u.tag,l=o(u,n),f="query=".concat(i(e)),p=c?"?tag=".concat(i(c),"&").concat(f):"?".concat(f),h=Object.keys(s).reduce((function(t,e){return"".concat(t,"&").concat(i("$".concat(e)),"=").concat(i(JSON.stringify(s[e])))}),p);return Object.keys(l).reduce((function(t,e){return u[e]?"".concat(t,"&").concat(i(e),"=").concat(i(u[e])):t}),h)}},{}],62:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=t("object-assign"),a=t("@sanity/observable/minimal"),u=t("@sanity/eventsource"),c=t("@sanity/generate-help-url"),l=t("../util/pick"),f=t("../util/once"),p=t("../util/defaults"),h=t("./encodeQueryString"),d=["Using token with listeners is not supported in browsers. ","For more info, see ".concat(c("js-client-listener-tokens-browser"),".")],b=f((function(){return console.warn(d.join(" "))})),y=Boolean("undefined"!=typeof window&&window.EventSource),v=y?window.EventSource:u,g=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],m={includeResult:!0};function w(t){try{var e=t.data&&JSON.parse(t.data)||{};return s({type:t.type},e)}catch(t){return t}}function _(t){if(t instanceof Error)return t;var e=w(t);return e instanceof Error?e:new Error(function(t){return t.error?t.error.description?t.error.description:"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2):t.message||"Unknown listener error"}(e))}e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.clientConfig,i=n.url,s=n.token,u=n.withCredentials,c=n.requestTagPrefix,f=r.tag&&c?[c,r.tag].join("."):r.tag,d=o(o({},p(r,m)),{},{tag:f}),O=l(d,g),j=h({query:t,params:e,options:O,tag:f}),E="".concat(i).concat(this.getDataUrl("listen",j));if(E.length>14800)return new a((function(t){return t.error(new Error("Query too large for listener"))}));var x=d.events?d.events:["mutation"],S=-1!==x.indexOf("reconnect");s&&y&&b();var P={};return(s||u)&&(P.withCredentials=!0),s&&(P.headers={Authorization:"Bearer ".concat(s)}),new a((function(t){var e,r=c(),n=!1;function o(){n||(S&&t.next({type:"reconnect"}),n||r.readyState===v.CLOSED&&(u(),clearTimeout(e),e=setTimeout(l,100)))}function i(e){t.error(_(e))}function s(e){var r=w(e);return r instanceof Error?t.error(r):t.next(r)}function a(e){n=!0,u(),t.complete()}function u(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",i,!1),r.removeEventListener("disconnect",a,!1),x.forEach((function(t){return r.removeEventListener(t,s,!1)})),r.close()}function c(){var t=new v(E,P);return t.addEventListener("error",o,!1),t.addEventListener("channelError",i,!1),t.addEventListener("disconnect",a,!1),x.forEach((function(e){return t.addEventListener(e,s,!1)})),t}function l(){r=c()}return function(){n=!0,u()}}))}},{"../util/defaults":74,"../util/once":76,"../util/pick":77,"./encodeQueryString":61,"@sanity/eventsource":80,"@sanity/generate-help-url":81,"@sanity/observable/minimal":3,"object-assign":26}],63:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("deep-assign"),i=t("object-assign"),s=t("../util/getSelection"),a=t("../validators"),u=a.validateObject,c=a.validateInsert;function l(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=i({},e),this.client=r}i(l.prototype,{clone:function(){return new l(this.selection,i({},this.operations),this.client)},merge:function(t){u("merge",t);var e=(new Error).stack.toString().split("\n").filter((function(t){return t.trim()})).slice(2);return console.warn('The "merge" patch has been deprecated and will be removed in the future\n'.concat(e.join("\n"))),this._assign("merge",o(this.operations.merge||{},t))},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return u("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=i({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return u("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,r){var o;return c(t,e,r),this._assign("insert",(n(o={},t,e),n(o,"items",r),o))},append:function(t,e){return this.insert("after","".concat(t,"[-1]"),e)},prepend:function(t,e){return this.insert("before","".concat(t,"[0]"),e)},splice:function(t,e,r,n){var o=e<0?e-1:e,i=void 0===r||-1===r?-1:Math.max(0,e+r),s=o<0&&i>=0?"":i,a="".concat(t,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,n||[])},ifRevisionId:function(t){return this.operations.ifRevisionID=t,this},serialize:function(){return i(s(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=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 e="string"==typeof this.selection,r=i({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},r)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return u(t,e),this.operations=i({},this.operations,n({},t,i({},r&&this.operations[t]||{},e))),this}}),e.exports=l},{"../util/getSelection":75,"../validators":78,"deep-assign":7,"object-assign":26}],64:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../validators"),s=t("./patch"),a={returnDocuments:!1};function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.trxId=r,this.operations=t,this.client=e}o(u.prototype,{clone:function(){return new u(this.operations.slice(0),this.client,this.trxId)},create:function(t){return i.validateObject("create",t),this._add({create:t})},createIfNotExists:function(t){var e="createIfNotExists";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},createOrReplace:function(t){var e="createOrReplace";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},delete:function(t){return i.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function(t,e){var r="function"==typeof e;if(t instanceof s)return this._add({patch:t.serialize()});if(r){var n=e(new s(t,{},this.client));if(!(n instanceof s))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:o({id:t},e)})},transactionId:function(t){return t?(this.trxId=t,this):this.trxId},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(t){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(),o({transactionId:this.trxId},a,t||{}))},reset:function(){return this.operations=[],this},_add:function(t){return this.operations.push(t),this}}),e.exports=u},{"../validators":78,"./patch":63,"object-assign":26}],65:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("../validators");function i(t){this.request=t.request.bind(t)}n(i.prototype,{create:function(t,e){return this._modify("PUT",t,e)},edit:function(t,e){return this._modify("PATCH",t,e)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e,r){return o.dataset(e),this.request({method:t,uri:"/datasets/".concat(e),body:r})}}),e.exports=i},{"../validators":78,"object-assign":26}],66:[function(t,e,r){"use strict";e.exports=[]},{}],67:[function(t,e,r){"use strict";var n=t("make-error"),o=t("object-assign");function i(t){var e=a(t);i.super.call(this,e.message),o(this,e)}function s(t){var e=a(t);s.super.call(this,e.message),o(this,e)}function a(t){var e=t.body,r={response:t,statusCode:t.statusCode,responseBody:u(e,t)};return e.error&&e.message?(r.message="".concat(e.error," - ").concat(e.message),r):e.error&&e.error.description?(r.message=e.error.description,r.details=e.error,r):(r.message=e.error||e.message||function(t){var e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),r)}function u(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}n(i),n(s),r.ClientError=i,r.ServerError=s},{"make-error":25,"object-assign":26}],68:[function(t,e,r){"use strict";e.exports=function(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(t[r])));return e.length>0?"?".concat(e.join("&")):""}},{}],69:[function(t,e,r){"use strict";var n=t("get-it"),o=t("object-assign"),i=t("get-it/lib/middleware/observable"),s=t("get-it/lib/middleware/jsonRequest"),a=t("get-it/lib/middleware/jsonResponse"),u=t("get-it/lib/middleware/progress"),c=t("@sanity/observable/minimal"),l=t("./errors"),f=l.ClientError,p=l.ServerError,h={onResponse:function(t){if(t.statusCode>=500)throw new p(t);if(t.statusCode>=400)throw new f(t);return t}},d={onResponse:function(t){var e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((function(t){return console.warn(t)})),t}},b=n(t("./nodeMiddleware").concat([d,s(),a(),u(),h,i({implementation:c})]));function y(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:b)(o({maxRedirects:0},t))}y.defaultRequester=b,y.ClientError=f,y.ServerError=p,e.exports=y},{"./errors":67,"./nodeMiddleware":66,"@sanity/observable/minimal":3,"get-it":9,"get-it/lib/middleware/jsonRequest":13,"get-it/lib/middleware/jsonResponse":14,"get-it/lib/middleware/observable":15,"get-it/lib/middleware/progress":17,"object-assign":26}],70:[function(t,e,r){"use strict";var n=t("object-assign"),o="X-Sanity-Project-ID";e.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=e.token||t.token;i&&(r.Authorization="Bearer ".concat(i)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(r[o]=t.projectId);var s=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),a=void 0===e.timeout?t.timeout:e.timeout;return n({},e,{headers:n({},r,e.headers||{}),timeout:void 0===a?3e5:a,proxy:e.proxy||t.proxy,json:!0,withCredentials:s})}},{"object-assign":26}],71:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/".concat(t)})}}),e.exports=n},{"object-assign":26}],72:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=t("object-assign"),s=t("@sanity/observable/operators/filter").filter,a=t("@sanity/observable/operators/map").map,u=t("./data/patch"),c=t("./data/transaction"),l=t("./data/dataMethods"),f=t("./datasets/datasetsClient"),p=t("./projects/projectsClient"),h=t("./assets/assetsClient"),d=t("./users/usersClient"),b=t("./auth/authClient"),y=t("./http/request"),v=t("./http/requestOptions"),g=t("./config"),m=g.defaultConfig,w=g.initConfig,_=t("./validators");function O(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;if(!(this instanceof O))return new O(t);if(this.config(t),this.assets=new h(this),this.datasets=new f(this),this.projects=new p(this),this.users=new d(this),this.auth=new b(this),this.clientConfig.isPromiseAPI){var e=i({},this.clientConfig,{isPromiseAPI:!1});this.observable=new O(e)}}i(O.prototype,l),i(O.prototype,{clone:function(){return new O(this.config())},config:function(t){if(void 0===t)return i({},this.clientConfig);if(this.observable){var e=i({},t,{isPromiseAPI:!1});this.observable.config(e)}return this.clientConfig=w(t,this.clientConfig||{}),this},withConfig:function(t){return this.clone().config(t)},getUrl:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.clientConfig.cdnUrl:this.clientConfig.url;return"".concat(e,"/").concat(t.replace(/^\//,""))},isPromiseAPI:function(){return this.clientConfig.isPromiseAPI},_requestObservable:function(t){var e=t.url||t.uri,r=void 0===t.canUseCdn?["GET","HEAD"].indexOf(t.method||"GET")>=0&&0===e.indexOf("/data/"):t.canUseCdn,s=this.clientConfig.useCdn&&r,a=t.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,t.tag].join("."):t.tag||this.clientConfig.requestTagPrefix;a&&(t.query=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({tag:_.requestTag(a)},t.query));var u=v(this.clientConfig,i({},t,{url:this.getUrl(e,s)}));return y(u,this.clientConfig.requester)},request:function(t){var e=this._requestObservable(t).pipe(s((function(t){return"response"===t.type})),a((function(t){return t.body})));return this.isPromiseAPI()?function(t){return t.toPromise()}(e):e}}),O.Patch=u,O.Transaction=c,O.ClientError=y.ClientError,O.ServerError=y.ServerError,O.requester=y.defaultRequester,e.exports=O},{"./assets/assetsClient":57,"./auth/authClient":58,"./config":59,"./data/dataMethods":60,"./data/patch":63,"./data/transaction":64,"./datasets/datasetsClient":65,"./http/request":69,"./http/requestOptions":70,"./projects/projectsClient":71,"./users/usersClient":73,"./validators":78,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":26}],73:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getById:function(t){return this.client.request({uri:"/users/".concat(t)})}}),e.exports=n},{"object-assign":26}],74:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce((function(r,n){return r[n]=void 0===t[n]?e[n]:t[n],r}),{})}},{}],75:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return"params"in t?{query:t.query,params:t.params}:{query:t.query};var e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}},{}],76:[function(t,e,r){"use strict";e.exports=function(t){var e,r=!1;return function(){return r||(e=t.apply(void 0,arguments),r=!0),e}}},{}],77:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce((function(e,r){return void 0===t[r]||(e[r]=t[r]),e}),{})}},{}],78:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=["image","file"],i=["before","after","replace"];r.dataset=function(t){if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))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(t){if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},r.validateAssetType=function(t){if(-1===o.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(o.join(", ")))},r.validateObject=function(t,e){if(null===e||"object"!==n(e)||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},r.requireDocumentId=function(t,e){if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));r.validateDocumentId(t,e._id)},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(-1===i.indexOf(t)){var o=i.map((function(t){return'"'.concat(t,'"')})).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(o))}if("string"!=typeof e)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(t){if(!t.gradientMode&&!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},r.requestTag=function(t){if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t}},{}],79:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("./util/once"),i=function(t){return o((function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=console).warn.apply(e,[t.join(" ")].concat(n))}))};r.printCdnWarning=i(["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(n("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),r.printBrowserTokenWarning=i(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(n("js-client-browser-token")," for more information and how to hide this warning.")]),r.printCdnTokenWarning=i(["You have set `useCdn` to `true` while also specifying a token. This is usually not what you","want. The CDN cannot be used with an authorization token, since private data cannot be cached.","See ".concat(n("js-client-usecdn-token")," for more information.")]),r.printNoApiVersionSpecifiedWarning=i(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(n("js-client-api-version"))])},{"./util/once":76,"@sanity/generate-help-url":81}],80:[function(t,e,r){var n=t("@rexxars/eventsource-polyfill");e.exports="undefined"!=typeof window&&window.EventSource?window.EventSource:n.EventSource},{"@rexxars/eventsource-polyfill":1}],81:[function(t,e,r){e.exports=function(t){return"https://docs.sanity.io/help/"+t}},{}]},{},[72])(72)}));
1
+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SanityClient=t()}}((function(){return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[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:{}};e[s][0].call(l.exports,(function(t){return o(e[s][1][t]||t)}),l,l.exports,t,e,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(t,e,r){(function(t){(function(){!function(r,n){if("object"==typeof e&&e.exports)e.exports=n();else{if(t.EventSource&&!t._eventSourceImportPrefix)return;r[(r._eventSourceImportPrefix||"")+"EventSource"]=n()}}("undefined"==typeof self?this:self,(function(){var t=function(t,e){if(!t||"string"!=typeof t)throw new SyntaxError("Not enough arguments");this.URL=t,this.setOptions(e);var r=this;setTimeout((function(){r.poll()}),0)};if(t.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,r=this.defaultOptions;for(e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);for(e in t)e in r&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&void 0!==console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout((function(){e.poll()}),t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout((function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()}),this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},_onxhrdata:function(){var t=this._xhr;if(t.isReady()&&!t.hasError()){this.resetNoActivityTimer(),this.readyState==this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent("open",{type:"open"}));var e=t.getBuffer();e.length>this.bufferSizeLimit&&(this.log("buffer.length > this.bufferSizeLimit"),this.pollAgain()),0==this.cursor&&e.length>0&&"\ufeff"==e.substring(0,1)&&(this.cursor=1);var r=this.lastMessageIndex(e);if(r[0]>=this.cursor){var n=r[1],o=e.substring(this.cursor,n);this.parseStream(o),this.cursor=n}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){var e,n,o,i,s,a,u=(t=this.cache+this.normalizeToLF(t)).split("\n\n");for(e=0;e<u.length-1;e++){o="message",i=[];var c=u[e].split("\n");for(n=0;n<c.length;n++)0==(s=this.trimWhiteSpace(c[n])).indexOf("event")?o=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(a=parseInt(s.replace(/retry:?\s*/,""),10),isNaN(a)||(this.interval=a)):0==s.indexOf("data")?i.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(i.length&&this.readyState!=this.CLOSED){var l=new r(o,i.join("\n"),"undefined"!=typeof window&&void 0!==window.location?window.location.origin:null,this.lastEventId);this.dispatchEvent(o,l)}}this.cache=u[u.length-1]},dispatchEvent:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=0;n<r.length;n++)r[n].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=r.length-1;n>=0;--n)if(r[n]===e){r.splice(n,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var r=[];if(e){var n,o,i=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(o=i(n)+"="+i(e[n]),r.push(o))}return r.length>0?-1==t.indexOf("?")?t+"?"+r.join("&"):t+"&"+r.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),r=t.lastIndexOf("\r\r"),n=t.lastIndexOf("\r\n\r\n");return n>Math.max(e,r)?[n,n+4]:[Math.max(e,r),Math.max(e,r)+2]},trimWhiteSpace:function(t){return t.replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},Boolean("undefined"!=typeof window&&window.XDomainRequest&&window.XMLHttpRequest&&void 0===(new XMLHttpRequest).responseType)){t.isPolyfill="IE_8-9";var e=t.prototype.defaultOptions;e.xhrHeaders=null,e.getArgs.evs_preamble=2056,t.prototype.XHR=function(t){var e=new XDomainRequest;this._request=e,e.onprogress=function(){e._ready=!0,t._onxhrdata()},e.onload=function(){this._loaded=!0,t._onxhrdata()},e.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},e.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var r={};if(t.getArgs){var n=t.getArgs;for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);t.lastEventId&&(r.evs_last_event_id=t.lastEventId)}e.open("GET",t.urlWithParams(t.URL,r)),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!0,_request:null,_ready:!1,_loaded:!1,_failed:!1,isReady:function(){return this._request._ready},isDone:function(){return this._request._loaded},hasError:function(){return this._request._failed},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}}}else t.isPolyfill="XHR",t.prototype.XHR=function(t){var e=new XMLHttpRequest;this._request=e,t._xhr=this,e.onreadystatechange=function(){e.readyState>1&&t.readyState!=t.CLOSED&&(200==e.status||e.status>=300&&e.status<400?t._onxhrdata():(e._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+e.status}),t.close()))},e.onprogress=function(){},e.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var r=t.xhrHeaders;for(var n in r)r.hasOwnProperty(n)&&e.setRequestHeader(n,r[n]);t.lastEventId&&e.setRequestHeader("Last-Event-Id",t.lastEventId),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!1,_request:null,_failed:!1,isReady:function(){return this._request.readyState>=2},isDone:function(){return 4==this._request.readyState},hasError:function(){return this._failed||this._request.status>=400},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}};function r(t,e,r,n){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.data=e||null,this.origin=r||"",this.lastEventId=n||"",this.type=t||"message"}return t}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,r){"use strict";var n=t("rxjs/internal/Observable").Observable,o=t("object-assign"),i=t("../operators/map").map,s=t("../operators/filter").filter,a=t("../operators/reduce").reduce;function u(){n.apply(this,arguments)}function c(t,e){var r=!1;return function(){return r||(r=!0,console.warn(new Error("Calling observable.".concat(t,"(...) is deprecated. Please use observable.pipe(").concat(t,"(...)) instead")))),this.pipe(e.apply(this,arguments))}}u.prototype=Object.create(o(Object.create(null),n.prototype)),Object.defineProperty(u.prototype,"constructor",{value:u,enumerable:!1,writable:!0,configurable:!0}),u.prototype.lift=function(t){var e=new u;return e.source=this,e.operator=t,e},u.prototype.map=c("map",i),u.prototype.filter=c("filter",s),u.prototype.reduce=c("filter",a),e.exports=u},{"../operators/filter":4,"../operators/map":5,"../operators/reduce":6,"object-assign":10,"rxjs/internal/Observable":11}],3:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":2}],4:[function(t,e,r){r.filter=t("rxjs/internal/operators/filter").filter},{"rxjs/internal/operators/filter":18}],5:[function(t,e,r){r.map=t("rxjs/internal/operators/map").map},{"rxjs/internal/operators/map":19}],6:[function(t,e,r){r.reduce=t("rxjs/internal/operators/reduce").reduce},{"rxjs/internal/operators/reduce":20}],7:[function(t,e,r){"use strict";var n=t("is-obj"),o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function a(t,e,r){var i=e[r];if(null!=i){if(o.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");o.call(t,r)&&n(i)?t[r]=u(Object(t[r]),e[r]):t[r]=i}}function u(t,e){if(t===e)return t;for(var r in e=Object(e))o.call(e,r)&&a(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),s=0;s<n.length;s++)i.call(e,n[s])&&a(t,e,n[s]);return t}e.exports=function(t){t=s(t);for(var e=1;e<arguments.length;e++)u(t,arguments[e]);return t}},{"is-obj":8}],8:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],9:[function(t,e,r){"use strict";var n="undefined"!=typeof Reflect?Reflect.construct:void 0,o=Object.defineProperty,i=Error.captureStackTrace;function s(t){void 0!==t&&o(this,"message",{configurable:!0,value:t,writable:!0});var e=this.constructor.name;void 0!==e&&e!==this.name&&o(this,"name",{configurable:!0,value:e,writable:!0}),i(this,this.constructor)}void 0===i&&(i=function(t){var e=new Error;o(t,"stack",{configurable:!0,get:function(){var t=e.stack;return o(this,"stack",{configurable:!0,value:t,writable:!0}),t},set:function(e){o(t,"stack",{configurable:!0,value:e,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var a=function(){function t(t,e){return o(t,"name",{configurable:!0,value:e})}try{var e=function(){};if(t(e,"foo"),"foo"===e.name)return t}catch(t){}}();r=e.exports=function(t,e){if(null==e||e===Error)e=s;else if("function"!=typeof e)throw new TypeError("super_ should be a function");var r;if("string"==typeof t)r=t,t=void 0!==n?function(){return n(e,arguments,this.constructor)}:function(){e.apply(this,arguments)},void 0!==a&&(a(t,r),r=void 0);else if("function"!=typeof t)throw new TypeError("constructor should be either a string or a function");t.super_=t.super=e;var o={constructor:{configurable:!0,value:t,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),t.prototype=Object.create(e.prototype,o),t},r.BaseError=s},{}],10:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=s(t),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))o.call(r,l)&&(u[l]=r[l]);if(n){a=n(r);for(var f=0;f<a.length;f++)i.call(r,a[f])&&(u[a[f]]=r[a[f]])}}return u}},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/canReportError"),o=t("./util/toSubscriber"),i=t("./symbol/observable"),s=t("./util/pipe"),a=t("./config"),u=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,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},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),n.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=c(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[i.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:s.pipeFromArray(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=c(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function c(t){if(t||(t=a.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}r.Observable=u},{"./config":15,"./symbol/observable":23,"./util/canReportError":27,"./util/pipe":33,"./util/toSubscriber":34}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./config"),o=t("./util/hostReportError");r.empty={closed:!0,next:function(t){},error:function(t){if(n.config.useDeprecatedSynchronousErrorHandling)throw t;o.hostReportError(t)},complete:function(){}}},{"./config":15,"./util/hostReportError":28}],13:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("./util/isFunction"),s=t("./Observer"),a=t("./Subscription"),u=t("../internal/symbol/rxSubscriber"),c=t("./config"),l=t("./util/hostReportError"),f=function(t){function e(r,n,o){var i=t.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 e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new p(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new p(i,r,n,o)}return i}return o(e,t),e.prototype[u.rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(a.Subscription);r.Subscriber=f;var p=function(t){function e(e,r,n,o){var a,u=t.call(this)||this;u._parentSubscriber=e;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(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;c.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=c.config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):l.hostReportError(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;l.hostReportError(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};c.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),c.config.useDeprecatedSynchronousErrorHandling)throw t;l.hostReportError(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!c.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return c.config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(l.hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(f);r.SafeSubscriber=p},{"../internal/symbol/rxSubscriber":24,"./Observer":12,"./Subscription":14,"./config":15,"./util/hostReportError":28,"./util/isFunction":31}],14:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/isArray"),o=t("./util/isObject"),i=t("./util/isFunction"),s=t("./util/UnsubscriptionError"),a=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;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 t)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(t){e=t instanceof s.UnsubscriptionError?u(t.errors):[t]}}if(n.isArray(l)){f=-1;for(var p=l.length;++f<p;){var h=l[f];if(o.isObject(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof s.UnsubscriptionError?e=e.concat(u(t.errors)):e.push(t)}}}if(e)throw new s.UnsubscriptionError(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){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},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function u(t){return t.reduce((function(t,e){return t.concat(e instanceof s.UnsubscriptionError?e.errors:e)}),[])}r.Subscription=a},{"./util/UnsubscriptionError":26,"./util/isArray":30,"./util/isFunction":31,"./util/isObject":32}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1;r.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else n&&console.log("RxJS: Back to a better error behavior. Thank you. <3");n=t},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Observable");r.EMPTY=new n.Observable((function(t){return t.complete()})),r.empty=function(t){return t?function(t){return new n.Observable((function(e){return t.schedule((function(){return e.complete()}))}))}(t):r.EMPTY}},{"../Observable":11}],17:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.defaultIfEmpty=function(t){return void 0===t&&(t=null),function(e){return e.lift(new s(t))}};var s=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.defaultValue))},t}(),a=function(t){function e(e,r){var n=t.call(this,e)||this;return n.defaultValue=r,n.isEmpty=!0,n}return o(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(i.Subscriber)},{"../Subscriber":13}],18:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.filter=function(t,e){return function(r){return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":13}],19:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.map=function(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}();r.MapOperator=s;var a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":13}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./scan"),o=t("./takeLast"),i=t("./defaultIfEmpty"),s=t("../util/pipe");r.reduce=function(t,e){return arguments.length>=2?function(r){return s.pipe(n.scan(t,e),o.takeLast(1),i.defaultIfEmpty(e))(r)}:function(e){return s.pipe(n.scan((function(e,r,n){return t(e,r,n+1)})),o.takeLast(1))(e)}}},{"../util/pipe":33,"./defaultIfEmpty":17,"./scan":21,"./takeLast":22}],21:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.scan=function(t,e){var r=!1;return arguments.length>=2&&(r=!0),function(n){return n.lift(new s(t,e,r))}};var s=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.accumulator,this.seed,this.hasSeed))},t}(),a=function(t){function e(e,r,n,o){var i=t.call(this,e)||this;return i.accumulator=r,i._seed=n,i.hasSeed=o,i.index=0,i}return o(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,r=this.index++;try{e=this.accumulator(this.seed,t,r)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":13}],22:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber"),s=t("../util/ArgumentOutOfRangeError"),a=t("../observable/empty");r.takeLast=function(t){return function(e){return 0===t?a.empty():e.lift(new u(t))}};var u=function(){function t(t){if(this.total=t,this.total<0)throw new s.ArgumentOutOfRangeError}return t.prototype.call=function(t,e){return e.subscribe(new c(t,this.total))},t}(),c=function(t){function e(e,r){var n=t.call(this,e)||this;return n.total=r,n.ring=new Array,n.count=0,n}return o(e,t),e.prototype._next=function(t){var e=this.ring,r=this.total,n=this.count++;e.length<r?e.push(t):e[n%r]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var r=this.count>=this.total?this.total:this.count,n=this.ring,o=0;o<r;o++){var i=e++%r;t.next(n[i])}t.complete()},e}(i.Subscriber)},{"../Subscriber":13,"../observable/empty":16,"../util/ArgumentOutOfRangeError":25}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),r.$$rxSubscriber=r.rxSubscriber},{}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return t.prototype=Object.create(Error.prototype),t}();r.ArgumentOutOfRangeError=n},{}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}();r.UnsubscriptionError=n},{}],27:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber");r.canReportError=function(t){for(;t;){var e=t,r=e.closed,o=e.destination,i=e.isStopped;if(r||i)return!1;t=o&&o instanceof n.Subscriber?o:null}return!0}},{"../Subscriber":13}],28:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hostReportError=function(t){setTimeout((function(){throw t}),0)}},{}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(t){return t}},{}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],31:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFunction=function(t){return"function"==typeof t}},{}],32:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isObject=function(t){return null!==t&&"object"==typeof t}},{}],33:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./identity");function o(t){return 0===t.length?n.identity:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}r.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)},r.pipeFromArray=o},{"./identity":29}],34:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber"),o=t("../symbol/rxSubscriber"),i=t("../Observer");r.toSubscriber=function(t,e,r){if(t){if(t instanceof n.Subscriber)return t;if(t[o.rxSubscriber])return t[o.rxSubscriber]()}return t||e||r?new n.Subscriber(t,e,r):new n.Subscriber(i.empty)}},{"../Observer":12,"../Subscriber":13,"../symbol/rxSubscriber":24}],35:[function(t,e,r){"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){a=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||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 o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i=t("object-assign"),s=t("@sanity/observable/operators/map").map,a=t("@sanity/observable/operators/filter").filter,u=t("../http/queryString"),c=t("../validators");function l(t){this.client=t}function f(t){var e=t.document;return Object.defineProperty(e,"document",{enumerable:!1,get:function(){return console.warn("The promise returned from client.asset.upload(...) now resolves with the asset document"),e}}),e}function p(t,e){return"undefined"!=typeof window&&e instanceof window.File?i({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t):t}i(l.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};c.validateAssetType(t);var n=r.extract||void 0;n&&!n.length&&(n=["none"]);var o=c.hasDataset(this.client.clientConfig),i="image"===t?"images":"files",u=p(r,e),l=u.tag,h=u.label,d=u.title,b=u.description,y=u.creditLine,v=u.filename,g=u.source,m={label:h,title:d,description:b,filename:v,meta:n,creditLine:y};g&&(m.sourceId=g.id,m.sourceName=g.name,m.sourceUrl=g.url);var w=this.client._requestObservable({tag:l,method:"POST",timeout:u.timeout||0,uri:"/assets/".concat(i,"/").concat(o),headers:u.contentType?{"Content-Type":u.contentType}:{},query:m,body:e});return this.client.isPromiseAPI()?w.pipe(a((function(t){return"response"===t.type})),s((function(t){return f(t.body)}))).toPromise():w},delete:function(t,e){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");var r=e||"";return/^(image|file)-/.test(r)?t._id&&(r=t._id):r="".concat(t,"-").concat(r),c.hasDataset(this.client.clientConfig),this.client.delete(r)},getImageUrl:function(t,e){var r=t._ref||t;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 o=n(r.split("-"),4),i=o[1],s=o[2],a=o[3];c.hasDataset(this.client.clientConfig);var l=this.client.clientConfig,f=l.projectId,p=l.dataset,h=e?u(e):"";return"https://cdn.sanity.io/images/".concat(f,"/").concat(p,"/").concat(i,"-").concat(s,".").concat(a).concat(h)}}),e.exports=l},{"../http/queryString":46,"../validators":56,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":10}],36:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout",method:"POST"})}}),e.exports=n},{"object-assign":10}],37:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("object-assign"),i=t("./validators"),s=t("./warnings"),a={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,gradientMode:!1,isPromiseAPI:!0},u=["localhost","127.0.0.1","0.0.0.0"];r.defaultConfig=a,r.initConfig=function(t,e){var c=o({},e,t);c.apiVersion||s.printNoApiVersionSpecifiedWarning();var l=o({},a,c),f=l.gradientMode,p=!f&&l.useProjectHostname;if("undefined"==typeof Promise){var h=n("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(h))}if(f&&!l.namespace)throw new Error("Configuration must contain `namespace` when running in gradient mode");if(p&&!l.projectId)throw new Error("Configuration must contain `projectId`");var d="undefined"!=typeof window&&window.location&&window.location.hostname,b=d&&function(t){return-1!==u.indexOf(t)}(window.location.hostname);if(d&&b&&l.token&&!0!==l.ignoreBrowserTokenWarning?s.printBrowserTokenWarning():(!d||b)&&l.useCdn&&l.token?s.printCdnTokenWarning():void 0===l.useCdn&&s.printCdnWarning(),p&&i.projectId(l.projectId),!f&&l.dataset&&i.dataset(l.dataset,l.gradientMode),"requestTagPrefix"in l&&(l.requestTagPrefix=l.requestTagPrefix?i.requestTag(l.requestTagPrefix).replace(/\.+$/,""):void 0),l.apiVersion="".concat(l.apiVersion).replace(/^v/,""),l.isDefaultApi=l.apiHost===a.apiHost,l.useCdn=Boolean(l.useCdn)&&!l.token&&!l.withCredentials,r.validateApiVersion(l.apiVersion),l.gradientMode)l.url=l.apiHost,l.cdnUrl=l.apiHost;else{var y=l.apiHost.split("://",2),v=y[0],g=y[1],m=l.isDefaultApi?"apicdn.sanity.io":g;l.useProjectHostname?(l.url="".concat(v,"://").concat(l.projectId,".").concat(g,"/v").concat(l.apiVersion),l.cdnUrl="".concat(v,"://").concat(l.projectId,".").concat(m,"/v").concat(l.apiVersion)):(l.url="".concat(l.apiHost,"/v").concat(l.apiVersion),l.cdnUrl=l.url)}return l},r.validateApiVersion=function(t){if("1"!==t&&"X"!==t){var e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}}},{"./validators":56,"./warnings":57,"@sanity/generate-help-url":83,"object-assign":10}],38:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("@sanity/observable/operators/filter").filter,s=t("@sanity/observable/operators/map").map,a=t("../validators"),u=t("../util/getSelection"),c=t("./encodeQueryString"),l=t("./transaction"),f=t("./patch"),p=t("./listen"),h=function(t,e){return!1===t?void 0:void 0===t?e:t},d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:h(t.returnDocuments,!0),visibility:t.visibility||"sync"}},b=function(t){return"response"===t.type},y=function(t){return t.body},v=function(t,e){return t.reduce((function(t,r){return t[e(r)]=r,t}),Object.create(null))},g=function(t){return t.toPromise()};e.exports={listen:p,getDataUrl:function(t,e){var r=this.clientConfig,n=r.gradientMode?r.namespace:a.hasDataset(r),o="/".concat(t,"/").concat(n),i=e?"".concat(o,"/").concat(e):o;return(this.clientConfig.gradientMode?i:"/data".concat(i)).replace(/\/($|\?)/,"$1")},fetch:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(t){return t}:function(t){return t.result},o=this._dataRequest("query",{query:t,params:e},r).pipe(s(n));return this.isPromiseAPI()?g(o):o},getDocument:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(i(b),s((function(t){return t.body.documents&&t.body.documents[0]})));return this.isPromiseAPI()?g(n):n},getDocuments:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t.join(",")),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(i(b),s((function(e){var r=v(e.body.documents||[],(function(t){return t._id}));return t.map((function(t){return r[t]||null}))})));return this.isPromiseAPI()?g(n):n},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return a.requireDocumentId("createIfNotExists",t),this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return a.requireDocumentId("createOrReplace",t),this._create(t,"createOrReplace",e)},patch:function(t,e){return new f(t,e,this)},delete:function(t,e){return this.dataRequest("mutate",{mutations:[{delete:u(t)}]},e)},mutate:function(t,e){var r=t instanceof f||t instanceof l?t.serialize():t,n=Array.isArray(r)?r:[r],o=e&&e.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},e)},transaction:function(t){return new l(t,this)},dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(t,e,r);return this.isPromiseAPI()?g(n):n},_dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="mutate"===t,a="query"===t,u=!o&&c(e),l=!o&&u.length<11264,f=l?u:"",p=r.returnFirst,h=r.timeout,v=r.token,g=r.tag,m={method:l?"GET":"POST",uri:this.getDataUrl(t,f),json:!0,body:l?void 0:e,query:o&&d(r),timeout:h,token:v,tag:g,canUseCdn:a};return this._requestObservable(m).pipe(i(b),s(y),s((function(t){if(!o)return t;var e=t.results||[];if(r.returnDocuments)return p?e[0]&&e[0].document:e.map((function(t){return t.document}));var i=p?"documentId":"documentIds",s=p?e[0]&&e[0].id:e.map((function(t){return t.id}));return n({transactionId:t.transactionId,results:e},i,s)})))},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n({},e,t),s=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[i]},s)}}},{"../util/getSelection":53,"../validators":56,"./encodeQueryString":39,"./listen":40,"./patch":41,"./transaction":42,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":10}],39:[function(t,e,r){"use strict";var n=["tag"];function o(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var i=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,s=void 0===r?{}:r,a=t.options,u=void 0===a?{}:a,c=u.tag,l=o(u,n),f="query=".concat(i(e)),p=c?"?tag=".concat(i(c),"&").concat(f):"?".concat(f),h=Object.keys(s).reduce((function(t,e){return"".concat(t,"&").concat(i("$".concat(e)),"=").concat(i(JSON.stringify(s[e])))}),p);return Object.keys(l).reduce((function(t,e){return u[e]?"".concat(t,"&").concat(i(e),"=").concat(i(u[e])):t}),h)}},{}],40:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=t("object-assign"),a=t("@sanity/observable/minimal"),u=t("@sanity/eventsource"),c=t("@sanity/generate-help-url"),l=t("../util/pick"),f=t("../util/once"),p=t("../util/defaults"),h=t("./encodeQueryString"),d=["Using token with listeners is not supported in browsers. ","For more info, see ".concat(c("js-client-listener-tokens-browser"),".")],b=f((function(){return console.warn(d.join(" "))})),y=Boolean("undefined"!=typeof window&&window.EventSource),v=y?window.EventSource:u,g=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],m={includeResult:!0};function w(t){try{var e=t.data&&JSON.parse(t.data)||{};return s({type:t.type},e)}catch(t){return t}}function _(t){if(t instanceof Error)return t;var e=w(t);return e instanceof Error?e:new Error(function(t){return t.error?t.error.description?t.error.description:"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2):t.message||"Unknown listener error"}(e))}e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.clientConfig,i=n.url,s=n.token,u=n.withCredentials,c=n.requestTagPrefix,f=r.tag&&c?[c,r.tag].join("."):r.tag,d=o(o({},p(r,m)),{},{tag:f}),O=l(d,g),j=h({query:t,params:e,options:O,tag:f}),E="".concat(i).concat(this.getDataUrl("listen",j));if(E.length>14800)return new a((function(t){return t.error(new Error("Query too large for listener"))}));var x=d.events?d.events:["mutation"],S=-1!==x.indexOf("reconnect");s&&y&&b();var P={};return(s||u)&&(P.withCredentials=!0),s&&(P.headers={Authorization:"Bearer ".concat(s)}),new a((function(t){var e,r=c(),n=!1;function o(){n||(S&&t.next({type:"reconnect"}),n||r.readyState===v.CLOSED&&(u(),clearTimeout(e),e=setTimeout(l,100)))}function i(e){t.error(_(e))}function s(e){var r=w(e);return r instanceof Error?t.error(r):t.next(r)}function a(e){n=!0,u(),t.complete()}function u(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",i,!1),r.removeEventListener("disconnect",a,!1),x.forEach((function(t){return r.removeEventListener(t,s,!1)})),r.close()}function c(){var t=new v(E,P);return t.addEventListener("error",o,!1),t.addEventListener("channelError",i,!1),t.addEventListener("disconnect",a,!1),x.forEach((function(e){return t.addEventListener(e,s,!1)})),t}function l(){r=c()}return function(){n=!0,u()}}))}},{"../util/defaults":52,"../util/once":54,"../util/pick":55,"./encodeQueryString":39,"@sanity/eventsource":82,"@sanity/generate-help-url":83,"@sanity/observable/minimal":3,"object-assign":10}],41:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("deep-assign"),i=t("object-assign"),s=t("../util/getSelection"),a=t("../validators"),u=a.validateObject,c=a.validateInsert;function l(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=i({},e),this.client=r}i(l.prototype,{clone:function(){return new l(this.selection,i({},this.operations),this.client)},merge:function(t){u("merge",t);var e=(new Error).stack.toString().split("\n").filter((function(t){return t.trim()})).slice(2);return console.warn('The "merge" patch has been deprecated and will be removed in the future\n'.concat(e.join("\n"))),this._assign("merge",o(this.operations.merge||{},t))},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return u("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=i({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return u("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,r){var o;return c(t,e,r),this._assign("insert",(n(o={},t,e),n(o,"items",r),o))},append:function(t,e){return this.insert("after","".concat(t,"[-1]"),e)},prepend:function(t,e){return this.insert("before","".concat(t,"[0]"),e)},splice:function(t,e,r,n){var o=e<0?e-1:e,i=void 0===r||-1===r?-1:Math.max(0,e+r),s=o<0&&i>=0?"":i,a="".concat(t,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,n||[])},ifRevisionId:function(t){return this.operations.ifRevisionID=t,this},serialize:function(){return i(s(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=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 e="string"==typeof this.selection,r=i({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},r)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return u(t,e),this.operations=i({},this.operations,n({},t,i({},r&&this.operations[t]||{},e))),this}}),e.exports=l},{"../util/getSelection":53,"../validators":56,"deep-assign":7,"object-assign":10}],42:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../validators"),s=t("./patch"),a={returnDocuments:!1};function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.trxId=r,this.operations=t,this.client=e}o(u.prototype,{clone:function(){return new u(this.operations.slice(0),this.client,this.trxId)},create:function(t){return i.validateObject("create",t),this._add({create:t})},createIfNotExists:function(t){var e="createIfNotExists";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},createOrReplace:function(t){var e="createOrReplace";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},delete:function(t){return i.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function(t,e){var r="function"==typeof e;if(t instanceof s)return this._add({patch:t.serialize()});if(r){var n=e(new s(t,{},this.client));if(!(n instanceof s))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:o({id:t},e)})},transactionId:function(t){return t?(this.trxId=t,this):this.trxId},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(t){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(),o({transactionId:this.trxId},a,t||{}))},reset:function(){return this.operations=[],this},_add:function(t){return this.operations.push(t),this}}),e.exports=u},{"../validators":56,"./patch":41,"object-assign":10}],43:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("../validators");function i(t){this.request=t.request.bind(t)}n(i.prototype,{create:function(t,e){return this._modify("PUT",t,e)},edit:function(t,e){return this._modify("PATCH",t,e)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e,r){return o.dataset(e),this.request({method:t,uri:"/datasets/".concat(e),body:r})}}),e.exports=i},{"../validators":56,"object-assign":10}],44:[function(t,e,r){"use strict";e.exports=[]},{}],45:[function(t,e,r){"use strict";var n=t("make-error"),o=t("object-assign");function i(t){var e=a(t);i.super.call(this,e.message),o(this,e)}function s(t){var e=a(t);s.super.call(this,e.message),o(this,e)}function a(t){var e=t.body,r={response:t,statusCode:t.statusCode,responseBody:u(e,t)};return e.error&&e.message?(r.message="".concat(e.error," - ").concat(e.message),r):e.error&&e.error.description?(r.message=e.error.description,r.details=e.error,r):(r.message=e.error||e.message||function(t){var e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),r)}function u(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}n(i),n(s),r.ClientError=i,r.ServerError=s},{"make-error":9,"object-assign":10}],46:[function(t,e,r){"use strict";e.exports=function(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(t[r])));return e.length>0?"?".concat(e.join("&")):""}},{}],47:[function(t,e,r){"use strict";var n=t("get-it"),o=t("object-assign"),i=t("get-it/lib/middleware/observable"),s=t("get-it/lib/middleware/jsonRequest"),a=t("get-it/lib/middleware/jsonResponse"),u=t("get-it/lib/middleware/progress"),c=t("@sanity/observable/minimal"),l=t("./errors"),f=l.ClientError,p=l.ServerError,h={onResponse:function(t){if(t.statusCode>=500)throw new p(t);if(t.statusCode>=400)throw new f(t);return t}},d={onResponse:function(t){var e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((function(t){return console.warn(t)})),t}},b=n(t("./nodeMiddleware").concat([d,s(),a(),u(),h,i({implementation:c})]));function y(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:b)(o({maxRedirects:0},t))}y.defaultRequester=b,y.ClientError=f,y.ServerError=p,e.exports=y},{"./errors":45,"./nodeMiddleware":44,"@sanity/observable/minimal":3,"get-it":58,"get-it/lib/middleware/jsonRequest":62,"get-it/lib/middleware/jsonResponse":63,"get-it/lib/middleware/observable":64,"get-it/lib/middleware/progress":66,"object-assign":10}],48:[function(t,e,r){"use strict";var n=t("object-assign"),o="X-Sanity-Project-ID";e.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=e.token||t.token;i&&(r.Authorization="Bearer ".concat(i)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(r[o]=t.projectId);var s=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),a=void 0===e.timeout?t.timeout:e.timeout;return n({},e,{headers:n({},r,e.headers||{}),timeout:void 0===a?3e5:a,proxy:e.proxy||t.proxy,json:!0,withCredentials:s})}},{"object-assign":10}],49:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/".concat(t)})}}),e.exports=n},{"object-assign":10}],50:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=t("object-assign"),s=t("@sanity/observable/operators/filter").filter,a=t("@sanity/observable/operators/map").map,u=t("./data/patch"),c=t("./data/transaction"),l=t("./data/dataMethods"),f=t("./datasets/datasetsClient"),p=t("./projects/projectsClient"),h=t("./assets/assetsClient"),d=t("./users/usersClient"),b=t("./auth/authClient"),y=t("./http/request"),v=t("./http/requestOptions"),g=t("./config"),m=g.defaultConfig,w=g.initConfig,_=t("./validators");function O(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;if(!(this instanceof O))return new O(t);if(this.config(t),this.assets=new h(this),this.datasets=new f(this),this.projects=new p(this),this.users=new d(this),this.auth=new b(this),this.clientConfig.isPromiseAPI){var e=i({},this.clientConfig,{isPromiseAPI:!1});this.observable=new O(e)}}i(O.prototype,l),i(O.prototype,{clone:function(){return new O(this.config())},config:function(t){if(void 0===t)return i({},this.clientConfig);if(this.observable){var e=i({},t,{isPromiseAPI:!1});this.observable.config(e)}return this.clientConfig=w(t,this.clientConfig||{}),this},withConfig:function(t){return this.clone().config(t)},getUrl:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.clientConfig.cdnUrl:this.clientConfig.url;return"".concat(e,"/").concat(t.replace(/^\//,""))},isPromiseAPI:function(){return this.clientConfig.isPromiseAPI},_requestObservable:function(t){var e=t.url||t.uri,r=void 0===t.canUseCdn?["GET","HEAD"].indexOf(t.method||"GET")>=0&&0===e.indexOf("/data/"):t.canUseCdn,s=this.clientConfig.useCdn&&r,a=t.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,t.tag].join("."):t.tag||this.clientConfig.requestTagPrefix;a&&(t.query=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({tag:_.requestTag(a)},t.query));var u=v(this.clientConfig,i({},t,{url:this.getUrl(e,s)}));return y(u,this.clientConfig.requester)},request:function(t){var e=this._requestObservable(t).pipe(s((function(t){return"response"===t.type})),a((function(t){return t.body})));return this.isPromiseAPI()?function(t){return t.toPromise()}(e):e}}),O.Patch=u,O.Transaction=c,O.ClientError=y.ClientError,O.ServerError=y.ServerError,O.requester=y.defaultRequester,e.exports=O},{"./assets/assetsClient":35,"./auth/authClient":36,"./config":37,"./data/dataMethods":38,"./data/patch":41,"./data/transaction":42,"./datasets/datasetsClient":43,"./http/request":47,"./http/requestOptions":48,"./projects/projectsClient":49,"./users/usersClient":51,"./validators":56,"@sanity/observable/operators/filter":4,"@sanity/observable/operators/map":5,"object-assign":10}],51:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getById:function(t){return this.client.request({uri:"/users/".concat(t)})}}),e.exports=n},{"object-assign":10}],52:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce((function(r,n){return r[n]=void 0===t[n]?e[n]:t[n],r}),{})}},{}],53:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return"params"in t?{query:t.query,params:t.params}:{query:t.query};var e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}},{}],54:[function(t,e,r){"use strict";e.exports=function(t){var e,r=!1;return function(){return r||(e=t.apply(void 0,arguments),r=!0),e}}},{}],55:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce((function(e,r){return void 0===t[r]||(e[r]=t[r]),e}),{})}},{}],56:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=["image","file"],i=["before","after","replace"];r.dataset=function(t){if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))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(t){if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},r.validateAssetType=function(t){if(-1===o.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(o.join(", ")))},r.validateObject=function(t,e){if(null===e||"object"!==n(e)||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},r.requireDocumentId=function(t,e){if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));r.validateDocumentId(t,e._id)},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(-1===i.indexOf(t)){var o=i.map((function(t){return'"'.concat(t,'"')})).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(o))}if("string"!=typeof e)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(t){if(!t.gradientMode&&!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},r.requestTag=function(t){if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t}},{}],57:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("./util/once"),i=function(t){return o((function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=console).warn.apply(e,[t.join(" ")].concat(n))}))};r.printCdnWarning=i(["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(n("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),r.printBrowserTokenWarning=i(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(n("js-client-browser-token")," for more information and how to hide this warning.")]),r.printCdnTokenWarning=i(["You have set `useCdn` to `true` while also specifying a token. This is usually not what you","want. The CDN cannot be used with an authorization token, since private data cannot be cached.","See ".concat(n("js-client-usecdn-token")," for more information.")]),r.printNoApiVersionSpecifiedWarning=i(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(n("js-client-api-version"))])},{"./util/once":54,"@sanity/generate-help-url":83}],58:[function(t,e,r){e.exports=t("./lib-node")},{"./lib-node":59}],59:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./middleware/defaultOptionsValidator"),a=t("./request"),u=["request","response","progress","error","abort"],c=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,l=[],f=c.reduce((function(t,e){return t[e]=t[e]||[],t}),{processOptions:[i],validateOptions:[s]});function p(t){var e=u.reduce((function(t,e){return t[e]=n(),t}),{}),i=o(f),s=i("processOptions",t);i("validateOptions",s);var a={options:s,channels:e,applyMiddleware:i},c=null,l=e.request.subscribe((function(t){c=r(t,(function(r,n){return function(t,r,n){var o=t,s=r;if(!o)try{s=i("onResponse",r,n)}catch(t){s=null,o=t}(o=o&&i("onError",o,n))?e.error.publish(o):s&&e.response.publish(s)}(r,n,t)}))}));e.abort.subscribe((function(){l(),c&&c.abort()}));var p=i("onReturn",e,a);return p===e&&e.request.publish(a),p}return p.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&f.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 c.forEach((function(e){t[e]&&f[e].push(t[e])})),l.push(t),p},p.clone=function(){return t(l)},e.forEach(p.use),p}},{"./middleware/defaultOptionsProcessor":60,"./middleware/defaultOptionsValidator":61,"./request":69,"./util/middlewareReducer":71,"nano-pubsub":74}],60:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("url-parse"),i="undefined"!=typeof navigator&&"ReactNative"===navigator.product,s=Object.prototype.hasOwnProperty,a={timeout:i?6e4:12e4};function u(t){var e=[];for(var r in t)s.call(t,r)&&n(r,t[r]);return e.length?e.join("&"):"";function n(t,r){Array.isArray(r)?r.forEach((function(e){return n(t,e)})):e.push([t,r].map(encodeURIComponent).join("="))}}function c(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?c(a.timeout):{connect:e,socket:e}}e.exports=function(t){var e="string"==typeof t?n({url:t},a):n({},a,t),r=o(e.url,{},!0);return e.timeout=c(e.timeout),e.query&&(r.query=n({},r.query,function(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(u),e}},{"object-assign":75,"url-parse":81}],61:[function(t,e,r){"use strict";var n=/^https?:\/\//i;e.exports=function(t){if(!n.test(t.url))throw new Error('"'+t.url+'" is not a valid URL')}},{}],62:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"];e.exports=function(){return{processOptions:function(t){var e=t.body;return e&&"function"!=typeof e.pipe&&!function(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}(e)&&(-1!==s.indexOf(void 0===e?"undefined":n(e))||Array.isArray(e)||i(e))?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":72,"object-assign":75}],63:[function(t,e,r){"use strict";var n=t("object-assign");function o(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: "+t.message,t}}e.exports=function(t){return{onResponse:function(e){var r=e.headers["content-type"]||"",i=t&&t.force||-1!==r.indexOf("application/json");return e.body&&r&&i?n({},e,{body:o(e.body)}):e},processOptions:function(t){return n({},t,{headers:n({Accept:"application/json"},t.headers)})}}}},{"object-assign":75}],64:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||n.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(e,r){return new t((function(t){return e.error.subscribe((function(e){return t.error(e)})),e.progress.subscribe((function(e){return t.next(o({type:"progress"},e))})),e.response.subscribe((function(e){t.next(o({type:"response"},e)),t.complete()})),e.request.publish(r),function(){return e.abort.publish()}}))}}}},{"../util/global":70,"object-assign":75}],65:[function(t,e,r){"use strict";e.exports=function(){return{onRequest:function(t){if("xhr"===t.adapter){var e=t.request,r=t.context;"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=n("upload")),"onprogress"in e&&(e.onprogress=n("download"))}function n(t){return function(e){var n=e.lengthComputable?e.loaded/e.total*100:-1;r.channels.progress.publish({stage:t,percent:n,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}}}}},{}],66:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":65}],67:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=t("./browser/fetchXhr"),s="undefined"==typeof window?void 0:window,a=s?"xhr":"fetch",u="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},c="withCredentials"in new u,l="undefined"==typeof XDomainRequest?void 0:XDomainRequest,f=c?u:l;s||(u=i,f=i),e.exports=function(t,e){var r=t.options,i=t.applyMiddleware("finalizeOptions",r),c={},l=s&&s.location&&!n(s.location.href,i.url),p=t.applyMiddleware("interceptRequest",void 0,{adapter:a,context:t});if(p){var h=setTimeout(e,0,null,p);return{abort:function(){return clearTimeout(h)}}}var d=l?new f:new u,b=s&&s.XDomainRequest&&d instanceof s.XDomainRequest,y=i.headers,v=i.timeout,g=!1,m=!1,w=!1;if(d.onerror=E,d.ontimeout=E,d.onabort=function(){g=!0},d.onprogress=function(){},d[b?"onload":"onreadystatechange"]=function(){v&&(j(),c.socket=setTimeout((function(){return O("ESOCKETTIMEDOUT")}),v.socket)),g||4!==d.readyState&&!b||0!==d.status&&(g||m||w||(0!==d.status?(j(),m=!0,e(null,function(){var t=d.status,e=d.statusText;if(b&&void 0===t)t=200;else{if(t>12e3&&t<12156)return E();t=1223===d.status?204:d.status,e=1223===d.status?"No Content":e}return{body:d.response||d.responseText,url:i.url,method:i.method,headers:b?{}:o(d.getAllResponseHeaders()),statusCode:t,statusMessage:e}}())):E(new Error("Unknown XHR error"))))},d.open(i.method,i.url,!0),d.withCredentials=!!i.withCredentials,y&&d.setRequestHeader)for(var _ in y)y.hasOwnProperty(_)&&d.setRequestHeader(_,y[_]);else if(y&&b)throw new Error("Headers cannot be set on an XDomainRequest object");return i.rawBody&&(d.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:i,adapter:a,request:d,context:t}),d.send(i.body||null),v&&(c.connect=setTimeout((function(){return O("ETIMEDOUT")}),v.connect)),{abort:function(){g=!0,d&&d.abort()}};function O(e){w=!0,d.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+i.url:"Connection timed out on request to "+i.url);r.code=e,t.channels.error.publish(r)}function j(){(g||d.readyState>=2&&c.connect)&&clearTimeout(c.connect),c.socket&&clearTimeout(c.socket)}function E(t){if(!m){j(),m=!0,d=null;var r=t||new Error("Network error while attempting to reach "+i.url);r.isNetworkError=!0,r.request=i,e(r)}}}},{"./browser/fetchXhr":68,"parse-headers":76,"same-origin":79}],68:[function(t,e,r){"use strict";function n(){this.readyState=0}n.prototype.open=function(t,e){this._method=t,this._url=e,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(t,e){this._headers=this._headers||{},this._headers[t]=e},n.prototype.send=function(t){var e=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal,body:t};"undefined"!=typeof window&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(t){return t.headers.forEach((function(t,r){e._resHeaders+=r+": "+t+"\r\n"})),e.status=t.status,e.statusText=t.statusText,e.readyState=3,n?t.text():t.arrayBuffer()})).then((function(t){n?e.responseText=t:e.response=t,e.readyState=4,e.onreadystatechange()})).catch((function(t){"AbortError"!==t.name?e.onerror(t):e.onabort()}))},e.exports=n},{}],69:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":67}],70:[function(t,e,r){(function(t){(function(){"use strict";"undefined"!=typeof window?e.exports=window:void 0!==t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],71:[function(t,e,r){"use strict";e.exports=function(t){return function(e,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];for(var s="onError"===e,a=r,u=0;u<t[e].length&&(a=t[e][u].apply(void 0,[a].concat(o)),!s||a);u++);return a}}},{}],72:[function(t,e,r){"use strict";var n=t("isobject");function o(t){return!0===n(t)&&"[object Object]"===Object.prototype.toString.call(t)}e.exports=function(t){var e,r;return!1!==o(t)&&"function"==typeof(e=t.constructor)&&!1!==o(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")}},{isobject:73}],73:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},{}],74:[function(t,e,r){e.exports=function(){var t=[];return{subscribe:function(e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}},publish:function(){for(var e=0;e<t.length;e++)t[e].apply(null,arguments)}}}},{}],75:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=s(t),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))o.call(r,l)&&(u[l]=r[l]);if(n){a=n(r);for(var f=0;f<a.length;f++)i.call(r,a[f])&&(u[a[f]]=r[a[f]])}}return u}},{}],76:[function(t,e,r){var n=function(t){return t.replace(/^\s+|\s+$/g,"")},o=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};for(var e={},r=n(t).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===e[u]?e[u]=c:o(e[u])?e[u].push(c):e[u]=[e[u],c]}return e}},{}],77:[function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function i(t){try{return encodeURIComponent(t)}catch(t){return null}}r.stringify=function(t,e){e=e||"";var r,o,s=[];for(o in"string"!=typeof e&&(e="?"),t)if(n.call(t,o)){if((r=t[o])||null!=r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;s.push(o+"="+r)}return s.length?e+s.join("&"):""},r.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,n={};e=r.exec(t);){var i=o(e[1]),s=o(e[2]);null===i||null===s||i in n||(n[i]=s)}return n}},{}],78:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],79:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!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:80}],80:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],81:[function(t,e,r){(function(r){(function(){"use strict";var n=t("requires-port"),o=t("querystringify"),i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,a=/^[a-zA-Z]:/,u=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function c(t){return(t||"").toString().replace(u,"")}var l=[["#","hash"],["?","query"],function(t,e){return h(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function p(t){var e,n=("undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(t=t||n);if("blob:"===t.protocol)o=new b(unescape(t.pathname),{});else if("string"===s)for(e in o=new b(t,{}),f)delete o[e];else if("object"===s){for(e in t)e in f||(o[e]=t[e]);void 0===o.slashes&&(o.slashes=i.test(t.href))}return o}function h(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function d(t,e){t=c(t),e=e||{};var r,n=s.exec(t),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)):h(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&h(e.protocol)&&(r=n[4]),{protocol:o,slashes:i||h(o),slashesCount:u,rest:r}}function b(t,e,r){if(t=c(t),!(this instanceof b))return new b(t,e,r);var i,s,u,f,y,v,g=l.slice(),m=typeof e,w=this,_=0;for("object"!==m&&"string"!==m&&(r=e,e=null),r&&"function"!=typeof r&&(r=o.parse),i=!(s=d(t||"",e=p(e))).protocol&&!s.slashes,w.slashes=s.slashes||i&&e.slashes,w.protocol=s.protocol||e.protocol||"",t=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||a.test(t))||!s.slashes&&(s.protocol||s.slashesCount<2||!h(w.protocol)))&&(g[3]=[/(.*)/,"pathname"]);_<g.length;_++)"function"!=typeof(f=g[_])?(u=f[0],v=f[1],u!=u?w[v]=t:"string"==typeof u?~(y=t.indexOf(u))&&("number"==typeof f[2]?(w[v]=t.slice(0,y),t=t.slice(y+f[2])):(w[v]=t.slice(y),t=t.slice(0,y))):(y=u.exec(t))&&(w[v]=y[1],t=t.slice(0,y.index)),w[v]=w[v]||i&&f[3]&&e[v]||"",f[4]&&(w[v]=w[v].toLowerCase())):t=f(t,w);r&&(w.query=r(w.query)),i&&e.slashes&&"/"!==w.pathname.charAt(0)&&(""!==w.pathname||""!==e.pathname)&&(w.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.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("/")}(w.pathname,e.pathname)),"/"!==w.pathname.charAt(0)&&h(w.protocol)&&(w.pathname="/"+w.pathname),n(w.port,w.protocol)||(w.host=w.hostname,w.port=""),w.username=w.password="",w.auth&&(f=w.auth.split(":"),w.username=f[0]||"",w.password=f[1]||""),w.origin="file:"!==w.protocol&&h(w.protocol)&&w.host?w.protocol+"//"+w.host:"null",w.href=w.toString()}b.prototype={set:function(t,e,r){var i=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||o.parse)(e)),i[t]=e;break;case"port":i[t]=e,n(e,i.protocol)?e&&(i.host=i.hostname+":"+e):(i.host=i.hostname,i[t]="");break;case"hostname":i[t]=e,i.port&&(e+=":"+i.port),i.host=e;break;case"host":i[t]=e,/:\d+$/.test(e)?(e=e.split(":"),i.port=e.pop(),i.hostname=e.join(":")):(i.hostname=e,i.port="");break;case"protocol":i.protocol=e.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(e){var s="pathname"===t?"/":"#";i[t]=e.charAt(0)!==s?s+e:e}else i[t]=e;break;default:i[t]=e}for(var a=0;a<l.length;a++){var u=l[a];u[4]&&(i[u[1]]=i[u[1]].toLowerCase())}return i.origin="file:"!==i.protocol&&h(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(t){t&&"function"==typeof t||(t=o.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var i=n+(r.slashes||h(r.protocol)?"//":"");return r.username&&(i+=r.username,r.password&&(i+=":"+r.password),i+="@"),i+=r.host+r.pathname,(e="object"==typeof r.query?t(r.query):r.query)&&(i+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(i+=r.hash),i}},b.extractProtocol=d,b.location=p,b.trimLeft=c,b.qs=o,e.exports=b}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:77,"requires-port":78}],82:[function(t,e,r){var n=t("@rexxars/eventsource-polyfill");e.exports="undefined"!=typeof window&&window.EventSource?window.EventSource:n.EventSource},{"@rexxars/eventsource-polyfill":1}],83:[function(t,e,r){e.exports=function(t){return"https://docs.sanity.io/help/"+t}},{}]},{},[50])(50)}));