Socket
Socket
Sign inDemoInstall

@sanity/client

Package Overview
Dependencies
Maintainers
6
Versions
977
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/client - npm Package Compare versions

Comparing version 0.3.16 to 0.3.17

test/gradientMode.test.js

21

lib/config.js

@@ -8,3 +8,4 @@ 'use strict';

apiHost: 'https://api.sanity.io',
useProjectHostname: true
useProjectHostname: true,
gradientMode: false
};

@@ -33,10 +34,14 @@

var hostParts = newConfig.apiHost.split('://', 2);
var protocol = hostParts[0];
var host = hostParts[1];
if (newConfig.gradientMode) {
newConfig.url = newConfig.apiHost;
} else {
var hostParts = newConfig.apiHost.split('://', 2);
var protocol = hostParts[0];
var host = hostParts[1];
if (newConfig.useProjectHostname) {
newConfig.url = protocol + '://' + newConfig.projectId + '.' + host + '/v1';
} else {
newConfig.url = newConfig.apiHost + '/v1';
if (newConfig.useProjectHostname) {
newConfig.url = protocol + '://' + newConfig.projectId + '.' + host + '/v1';
} else {
newConfig.url = newConfig.apiHost + '/v1';
}
}

@@ -43,0 +48,0 @@

@@ -32,2 +32,6 @@ 'use strict';

getDataUrl: function getDataUrl(endpoint, uri) {
var projectId = this.clientConfig.projectId;
return this.clientConfig.gradientMode ? '/' + endpoint + '/' + projectId + '/' + uri : '/data/' + endpoint + '/' + uri;
},
fetch: function fetch(query, params) {

@@ -40,3 +44,3 @@ return this.dataRequest('query', { query: query, params: params }).then(function (res) {

return this.request({
uri: '/data/doc/' + id,
uri: this.getDataUrl('doc', id),
json: true

@@ -89,3 +93,3 @@ }).then(function (res) {

method: useGet ? 'GET' : 'POST',
uri: '/data/' + endpoint + '/' + dataset + stringQuery,
uri: _this.getDataUrl(endpoint, '' + dataset + stringQuery),
json: true,

@@ -92,0 +96,0 @@ body: useGet ? undefined : body,

@@ -9,3 +9,5 @@ 'use strict';

if (config.token) {
if (config.token && config.gradientMode) {
headers.Authorization = 'Bearer ' + config.token;
} else if (config.token) {
headers[tokenHeader] = config.token;

@@ -20,3 +22,3 @@ }

headers: headers,
timeout: 'timeout' in config ? config.timeout : 15000,
timeout: 'timeout' in config ? config.timeout : 30000,
withCredentials: true,

@@ -23,0 +25,0 @@ json: true

{
"name": "@sanity/client",
"version": "0.3.16",
"version": "0.3.17",
"description": "Client for retrieving data from Sanity",

@@ -32,4 +32,4 @@ "main": "lib/sanityClient.js",

"babel-cli": "^6.14.0",
"babel-eslint": "^6.1.2",
"babel-plugin-istanbul": "^2.0.3",
"babel-eslint": "^7.1.1",
"babel-plugin-istanbul": "^3.0.0",
"babel-preset-es2015": "^6.14.0",

@@ -40,8 +40,8 @@ "babel-register": "^6.14.0",

"chalk": "^1.1.3",
"envify": "^3.4.1",
"envify": "^4.0.0",
"eslint": "^3.9.0",
"eslint-config-sanity": "^1.1.3",
"eslint-config-sanity": "^2.0.1",
"gzip-size": "^3.0.0",
"nock": "^9.0.0",
"nyc": "^8.4.0",
"nyc": "^10.0.0",
"pretty-bytes": "^4.0.2",

@@ -48,0 +48,0 @@ "rimraf": "^2.5.4",

@@ -0,4 +1,6 @@

/* eslint-disable strict */
// (Node 4 compat)
'use strict' // eslint-disable-line strict
'use strict'
const test = require('tape')

@@ -5,0 +7,0 @@ const nock = require('nock')

@@ -8,5 +8,5 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SanityClient = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

},{"xtend/mutable":51}],3:[function(require,module,exports){
"use strict";var assign=require("xtend/mutable"),validate=require("./validators"),defaultConfig=exports.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0};exports.initConfig=function(t,e){var o=assign({},defaultConfig,e,t),a=o.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(a&&!o.projectId)throw new Error("Configuration must contain `projectId`");a&&validate.projectId(o.projectId),o.dataset&&validate.dataset(o.dataset);var i=o.apiHost.split("://",2),r=i[0],n=i[1];return o.useProjectHostname?o.url=r+"://"+o.projectId+"."+n+"/v1":o.url=o.apiHost+"/v1",o};
"use strict";var assign=require("xtend/mutable"),validate=require("./validators"),defaultConfig=exports.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};exports.initConfig=function(e,t){var o=assign({},defaultConfig,t,e),i=o.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(i&&!o.projectId)throw new Error("Configuration must contain `projectId`");if(i&&validate.projectId(o.projectId),o.dataset&&validate.dataset(o.dataset),o.gradientMode)o.url=o.apiHost;else{var a=o.apiHost.split("://",2),r=a[0],n=a[1];o.useProjectHostname?o.url=r+"://"+o.projectId+"."+n+"/v1":o.url=o.apiHost+"/v1"}return o};
},{"./validators":18,"xtend/mutable":51}],4:[function(require,module,exports){
"use strict";function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var assign=require("xtend/mutable"),validators=require("../validators"),encodeQueryString=require("./encodeQueryString"),Transaction=require("./transaction"),Patch=require("./patch"),listen=require("./listen"),excludeFalsey=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},getMutationQuery=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:excludeFalsey(t.returnDocuments,!0),visibility:t.visibility||"sync"}},getQuerySizeLimit=1948;module.exports={listen:listen,fetch:function(t,e){return this.dataRequest("query",{query:t,params:e}).then(function(t){return t.result||[]})},getDocument:function(t){return this.request({uri:"/data/doc/"+t,json:!0}).then(function(t){return t.documents&&t.documents[0]})},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return this._create(t,"createOrReplace",e)},patch:function(t,e){return new Patch(t,e,this)},delete:function(t,e){return validators.validateDocumentId("delete",t),this.dataRequest("mutate",{mutations:[{delete:{id:t}}]},e)},mutate:function(t,e){var r=t instanceof Patch?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new Transaction(t,this)},dataRequest:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="mutate"===t,u=!i&&encodeQueryString(e),a=!i&&u.length<getQuerySizeLimit,s=a?u:"",o=n.returnFirst;return validators.promise.hasDataset(this.clientConfig).then(function(u){return r.request({method:a?"GET":"POST",uri:"/data/"+t+"/"+u+s,json:!0,body:a?void 0:e,query:i&&getMutationQuery(n)})}).then(function(t){if(!i)return t;var e=t.results||[];if(n.returnDocuments)return o?e[0]&&e[0].document:e.map(function(t){return t.document});var r=o?"documentId":"documentIds",u=o?e[0]&&e[0].id:e.map(function(t){return t.id});return _defineProperty({transactionId:t.transactionId},r,u)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=validators.hasDataset(this.clientConfig),i=_defineProperty({},e,assign({},t,{_id:t._id||n+"/"})),u=assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[i]},u)}};
"use strict";function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var assign=require("xtend/mutable"),validators=require("../validators"),encodeQueryString=require("./encodeQueryString"),Transaction=require("./transaction"),Patch=require("./patch"),listen=require("./listen"),excludeFalsey=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},getMutationQuery=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:excludeFalsey(t.returnDocuments,!0),visibility:t.visibility||"sync"}},getQuerySizeLimit=1948;module.exports={listen:listen,getDataUrl:function(t,e){var r=this.clientConfig.projectId;return this.clientConfig.gradientMode?"/"+t+"/"+r+"/"+e:"/data/"+t+"/"+e},fetch:function(t,e){return this.dataRequest("query",{query:t,params:e}).then(function(t){return t.result||[]})},getDocument:function(t){return this.request({uri:this.getDataUrl("doc",t),json:!0}).then(function(t){return t.documents&&t.documents[0]})},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return this._create(t,"createOrReplace",e)},patch:function(t,e){return new Patch(t,e,this)},delete:function(t,e){return validators.validateDocumentId("delete",t),this.dataRequest("mutate",{mutations:[{delete:{id:t}}]},e)},mutate:function(t,e){var r=t instanceof Patch?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new Transaction(t,this)},dataRequest:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="mutate"===t,u=!i&&encodeQueryString(e),a=!i&&u.length<getQuerySizeLimit,s=a?u:"",o=n.returnFirst;return validators.promise.hasDataset(this.clientConfig).then(function(u){return r.request({method:a?"GET":"POST",uri:r.getDataUrl(t,""+u+s),json:!0,body:a?void 0:e,query:i&&getMutationQuery(n)})}).then(function(t){if(!i)return t;var e=t.results||[];if(n.returnDocuments)return o?e[0]&&e[0].document:e.map(function(t){return t.document});var r=o?"documentId":"documentIds",u=o?e[0]&&e[0].id:e.map(function(t){return t.id});return _defineProperty({transactionId:t.transactionId},r,u)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=validators.hasDataset(this.clientConfig),i=_defineProperty({},e,assign({},t,{_id:t._id||n+"/"})),u=assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[i]},u)}};

@@ -35,3 +35,3 @@ },{"../validators":18,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"xtend/mutable":51}],5:[function(require,module,exports){

},{"./queryString":10,"@sanity/observable/minimal":22,"@sanity/request":23,"xtend/mutable":51}],12:[function(require,module,exports){
"use strict";var tokenHeader="Sanity-Token",projectHeader="Sanity-Project-ID";module.exports=function(e){var t={};return e.token&&(t[tokenHeader]=e.token),!e.useProjectHostname&&e.projectId&&(t[projectHeader]=e.projectId),{headers:t,timeout:"timeout"in e?e.timeout:15e3,withCredentials:!0,json:!0}};
"use strict";var tokenHeader="Sanity-Token",projectHeader="Sanity-Project-ID";module.exports=function(e){var t={};return e.token&&e.gradientMode?t.Authorization="Bearer "+e.token:e.token&&(t[tokenHeader]=e.token),!e.useProjectHostname&&e.projectId&&(t[projectHeader]=e.projectId),{headers:t,timeout:"timeout"in e?e.timeout:3e4,withCredentials:!0,json:!0}};

@@ -65,5 +65,5 @@ },{}],13:[function(require,module,exports){

"use strict";function toObject(r){if(null===r||void 0===r)throw new TypeError("Sources cannot be null or undefined");return Object(r)}function assignKey(r,e,n){var t=e[n];if(void 0!==t&&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;e=Object(e);for(var n in 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}var isObj=require("is-obj"),hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=function(r){r=toObject(r);for(var e=1;e<arguments.length;e++)assign(r,arguments[e]);return r};
},{"is-obj":29}],25:[function(require,module,exports){
!function(t){function e(t,e,i,r){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.data=e||null,this.origin=i||"",this.lastEventId=r||"",this.type=t||"message"}function i(){return!(!window.XDomainRequest||!window.XMLHttpRequest||void 0!==(new XMLHttpRequest).responseType)}if(!t.EventSource||t._eventSourceImportPrefix){var r=(t._eventSourceImportPrefix||"")+"EventSource",s=function(t,e){if(!t||"string"!=typeof t)throw new SyntaxError("Not enough arguments");this.URL=t,this.setOptions(e);var i=this;setTimeout(function(){i.poll()},0)};if(s.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,i=this.defaultOptions;for(e in i)i.hasOwnProperty(e)&&(this[e]=i[e]);for(e in t)e in i&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&"undefined"!=typeof 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()},ondata: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 i=this.lastMessageIndex(e);if(i[0]>=this.cursor){var r=i[1],s=e.substring(this.cursor,r);this.parseStream(s),this.cursor=r}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){t=this.cache+this.normalizeToLF(t);var i,r,s,n,a,o,h=t.split("\n\n");for(i=0;i<h.length-1;i++){for(s="message",n=[],parts=h[i].split("\n"),r=0;r<parts.length;r++)a=this.trimWhiteSpace(parts[r]),0==a.indexOf("event")?s=a.replace(/event:?\s*/,""):0==a.indexOf("retry")?(o=parseInt(a.replace(/retry:?\s*/,"")),isNaN(o)||(this.interval=o)):0==a.indexOf("data")?n.push(a.replace(/data:?\s*/,"")):0==a.indexOf("id:")?this.lastEventId=a.replace(/id:?\s*/,""):0==a.indexOf("id")&&(this.lastEventId=null);if(n.length){var u=new e(s,n.join("\n"),window.location.origin,this.lastEventId);this.dispatchEvent(s,u)}}this.cache=h[h.length-1]},dispatchEvent:function(t,e){var i=this["_"+t+"Handlers"];if(i)for(var r=0;r<i.length;r++)i[r].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 i=this["_"+t+"Handlers"];if(i)for(var r=i.length-1;r>=0;--r)if(i[r]===e){i.splice(r,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 i=[];if(e){var r,s,n=encodeURIComponent;for(r in e)e.hasOwnProperty(r)&&(s=n(r)+"="+n(e[r]),i.push(s))}return i.length>0?t.indexOf("?")==-1?t+"?"+i.join("&"):t+"&"+i.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),i=t.lastIndexOf("\r\r"),r=t.lastIndexOf("\r\n\r\n");return r>Math.max(e,i)?[r,r+4]:[Math.max(e,i),Math.max(e,i)+2]},trimWhiteSpace:function(t){var e=/^(\s|\u00A0)+|(\s|\u00A0)+$/g;return t.replace(e,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},i()){s.isPolyfill="IE_8-9";var n=s.prototype.defaultOptions;n.xhrHeaders=null,n.getArgs.evs_preamble=2056,s.prototype.XHR=function(t){request=new XDomainRequest,this._request=request,request.onprogress=function(){request._ready=!0,t.ondata()},request.onload=function(){this._loaded=!0,t.ondata()},request.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},request.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var e={};if(t.getArgs){var i=t.getArgs;for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r]);t.lastEventId&&(e.evs_last_event_id=t.lastEventId)}request.open("GET",t.urlWithParams(t.URL,e)),request.send()},s.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 s.isPolyfill="XHR",s.prototype.XHR=function(t){request=new XMLHttpRequest,this._request=request,t._xhr=this,request.onreadystatechange=function(){request.readyState>1&&t.readyState!=t.CLOSED&&(200==request.status||request.status>=300&&request.status<400?t.ondata():(request._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+request.status}),t.close()))},request.onprogress=function(){},request.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var e=t.xhrHeaders;for(var i in e)e.hasOwnProperty(i)&&request.setRequestHeader(i,e[i]);t.lastEventId&&request.setRequestHeader("Last-Event-Id",t.lastEventId),request.send()},s.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()}};t[r]=s}}(this);
},{}],26:[function(require,module,exports){

@@ -96,5 +96,5 @@ function forEach(r,t,o){if(!isFunction(t))throw new TypeError("iterator must be a function");arguments.length<3&&(o=this),"[object Array]"===toString.call(r)?forEachArray(r,t,o):"string"==typeof r?forEachString(r,t,o):forEachObject(r,t,o)}function forEachArray(r,t,o){for(var n=0,a=r.length;n<a;n++)hasOwnProperty.call(r,n)&&t.call(o,r[n],n,r)}function forEachString(r,t,o){for(var n=0,a=r.length;n<a;n++)t.call(o,r.charAt(n),n,r)}function forEachObject(r,t,o){for(var n in r)hasOwnProperty.call(r,n)&&t.call(o,r[n],n,r)}var isFunction=require("is-function");module.exports=forEach;var toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty;

"use strict";function filter(t,r){return this.lift(new FilterOperator(t,r))}var __extends=this&&this.__extends||function(t,r){function i(){this.constructor=t}for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)},Subscriber_1=require("../Subscriber");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,i,e){t.call(this,r),this.predicate=i,this.thisArg=e,this.count=0,this.predicate=i}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);
},{"../Subscriber":33}],36:[function(require,module,exports){
"use strict";function map(t,r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new MapOperator(t,r))}var __extends=this&&this.__extends||function(t,r){function e(){this.constructor=t}for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i]);t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)},Subscriber_1=require("../Subscriber");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,i){t.call(this,r),this.project=e,this.count=0,this.thisArg=i||this}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);
},{"../Subscriber":33}],37:[function(require,module,exports){

@@ -111,3 +111,2 @@ "use strict";function reduce(e,t){var r=!1;return arguments.length>=2&&(r=!0),this.lift(new ReduceOperator(e,t,r))}var __extends=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},Subscriber_1=require("../Subscriber");exports.reduce=reduce;var ReduceOperator=function(){function e(e,t,r){void 0===r&&(r=!1),this.accumulator=e,this.seed=t,this.hasSeed=r}return e.prototype.call=function(e,t){return t._subscribe(new ReduceSubscriber(e,this.accumulator,this.seed,this.hasSeed))},e}();exports.ReduceOperator=ReduceOperator;var ReduceSubscriber=function(e){function t(t,r,s,c){e.call(this,t),this.accumulator=r,this.hasSeed=c,this.hasValue=!1,this.acc=s}return __extends(t,e),t.prototype._next=function(e){this.hasValue||(this.hasValue=this.hasSeed)?this._tryReduce(e):(this.acc=e,this.hasValue=!0)},t.prototype._tryReduce=function(e){var t;try{t=this.accumulator(this.acc,e)}catch(e){return void this.destination.error(e)}this.acc=t},t.prototype._complete=function(){(this.hasValue||this.hasSeed)&&this.destination.next(this.acc),this.destination.complete()},t}(Subscriber_1.Subscriber);exports.ReduceSubscriber=ReduceSubscriber;

"use strict";var root_1=require("../util/root"),Symbol=root_1.root.Symbol;exports.$$rxSubscriber="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("rxSubscriber"):"@@rxSubscriber";
},{"../util/root":46}],41:[function(require,module,exports){

@@ -121,3 +120,2 @@ "use strict";var __extends=this&&this.__extends||function(r,t){function n(){this.constructor=r}for(var s in t)t.hasOwnProperty(s)&&(r[s]=t[s]);r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},UnsubscriptionError=function(r){function t(t){r.call(this),this.errors=t;var n=Error.call(this,t?t.length+" errors occurred during unsubscription:\n "+t.map(function(r,t){return t+1+") "+r.toString()}).join("\n "):"");this.name=n.name="UnsubscriptionError",this.stack=n.stack,this.message=n.message}return __extends(t,r),t}(Error);exports.UnsubscriptionError=UnsubscriptionError;

"use strict";exports.isArray=Array.isArray||function(r){return r&&"number"==typeof r.length};
},{}],44:[function(require,module,exports){

@@ -139,4 +137,6 @@ "use strict";function isFunction(n){return"function"==typeof n}exports.isFunction=isFunction;

"use strict";function tryCatcher(){try{return tryCatchTarget.apply(this,arguments)}catch(r){return errorObject_1.errorObject.e=r,errorObject_1.errorObject}}function tryCatch(r){return tryCatchTarget=r,tryCatcher}var errorObject_1=require("./errorObject"),tryCatchTarget;exports.tryCatch=tryCatch;
},{"./errorObject":42}],49:[function(require,module,exports){
function trim(r){return r.replace(/^\s*|\s*$/g,"")}exports=module.exports=trim,exports.left=function(r){return r.replace(/^\s*/,"")},exports.right=function(r){return r.replace(/\s*$/,"")};
},{}],50:[function(require,module,exports){

@@ -143,0 +143,0 @@ function extend(){for(var r={},e=0;e<arguments.length;e++){var t=arguments[e];for(var n in t)hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;

@@ -1,2 +0,2 @@

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.SanityClient=t()}}(function(){return function t(e,r,n){function i(s,u){if(!r[s]){if(!e[s]){var a="function"==typeof require&&require;if(!u&&a)return a(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};e[s][0].call(f.exports,function(t){var r=e[s][1][t];return i(r?r:t)},f,f.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable"),o=t("../validators"),s={image:"images",file:"files"};i(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};o.validateAssetType(t);var n=o.hasDataset(this.client.clientConfig),u="contentType"in r?{"Content-Type":r.contentType}:{},a=s[t],c=r.label?"?label="+encodeURIComponent(r.label):"",f="/assets/"+a+"/"+n+c;return this.client.requestObservable({method:"POST",headers:i({Accept:"application/json"},u),uri:f,body:e,json:!1,timeout:0}).map(function(t){return"response"!==t.type?t:i({},t,{body:JSON.parse(t.body)})})}}),e.exports=n},{"../validators":18,"xtend/mutable":51}],2:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable");i(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"xtend/mutable":51}],3:[function(t,e,r){"use strict";var n=t("xtend/mutable"),i=t("./validators"),o=r.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0};r.initConfig=function(t,e){var r=n({},o,e,t),s=r.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(s&&!r.projectId)throw new Error("Configuration must contain `projectId`");s&&i.projectId(r.projectId),r.dataset&&i.dataset(r.dataset);var u=r.apiHost.split("://",2),a=u[0],c=u[1];return r.useProjectHostname?r.url=a+"://"+r.projectId+"."+c+"/v1":r.url=r.apiHost+"/v1",r}},{"./validators":18,"xtend/mutable":51}],4:[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 i=t("xtend/mutable"),o=t("../validators"),s=t("./encodeQueryString"),u=t("./transaction"),a=t("./patch"),c=t("./listen"),f=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:f(t.returnDocuments,!0),visibility:t.visibility||"sync"}},h=1948;e.exports={listen:c,fetch:function(t,e){return this.dataRequest("query",{query:t,params:e}).then(function(t){return t.result||[]})},getDocument:function(t){return this.request({uri:"/data/doc/"+t,json:!0}).then(function(t){return t.documents&&t.documents[0]})},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return this._create(t,"createOrReplace",e)},patch:function(t,e){return new a(t,e,this)},delete:function(t,e){return o.validateDocumentId("delete",t),this.dataRequest("mutate",{mutations:[{delete:{id:t}}]},e)},mutate:function(t,e){var r=t instanceof a?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new u(t,this)},dataRequest:function(t,e){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u="mutate"===t,a=!u&&s(e),c=!u&&a.length<h,f=c?a:"",p=i.returnFirst;return o.promise.hasDataset(this.clientConfig).then(function(n){return r.request({method:c?"GET":"POST",uri:"/data/"+t+"/"+n+f,json:!0,body:c?void 0:e,query:u&&l(i)})}).then(function(t){if(!u)return t;var e=t.results||[];if(i.returnDocuments)return p?e[0]&&e[0].document:e.map(function(t){return t.document});var r=p?"documentId":"documentIds",o=p?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId},r,o)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=o.hasDataset(this.clientConfig),u=n({},e,i({},t,{_id:t._id||s+"/"})),a=i({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[u]},a)}}},{"../validators":18,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"xtend/mutable":51}],5:[function(t,e,r){"use strict";var n=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,i=void 0===r?{}:r,o=t.options,s=void 0===o?{}:o,u=Object.keys(i).reduce(function(t,e){return t+"&"+n("$"+e)+"="+n(JSON.stringify(i[e]))},"?query="+n(e));return Object.keys(s).reduce(function(t,e){return s[e]?t+"&"+n(e)+"="+n(s[e]):t},u)}},{}],6:[function(t,e,r){"use strict";function n(t){try{var e=t.data&&JSON.parse(t.data)||{};return o({type:t.type},e)}catch(t){return t}}function i(t){if(t instanceof Error)return t;var e=n(t);return e instanceof Error?e:new Error(e.error||e.message||"Unknown listener error")}var o=t("xtend/mutable"),s=t("@sanity/observable/minimal"),u=t("./encodeQueryString"),a=t("../validators"),c=t("../util/pick"),f=t("../util/defaults"),l="undefined"!=typeof window&&window.EventSource?window.EventSource:t("@sanity/eventsource"),h=function(t,e,r){t.removeEventListener?t.removeEventListener(e,r,!1):t.removeListener(e,r)},p=["includePreviousRevision","includeResult"],d={includeResult:!0};e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},b=f(r,d),y=c(b,p),v=u({query:t,params:e,options:y}),m=a.hasDataset(this.clientConfig),g=this.getUrl("/data/listen/"+m+v),w=this.clientConfig.token,_=b.events?b.events:["mutation"],x=_.indexOf("reconnect")!==-1,E=new l(g,o({withCredentials:!0},w?{headers:{"Sanity-Token":w}}:{}));return new s(function(t){function e(){E.readyState===l.CLOSED?t.complete():E.readyState===l.CONNECTING&&a()}function r(e){t.error(i(e))}function o(e){var r=n(e);return r instanceof Error?t.error(r):t.next(r)}function s(e){t.complete(),u()}function u(){_.forEach(function(t){return h(E,t,o)}),h(E,"error",e),h(E,"channelError",r),h(E,"disconnect",s),E.close()}function a(){x&&t.next({type:"reconnect"})}return E.addEventListener("error",e,!1),E.addEventListener("channelError",r,!1),E.addEventListener("disconnect",s,!1),_.forEach(function(t){return E.addEventListener(t,o,!1)}),u})}},{"../util/defaults":16,"../util/pick":17,"../validators":18,"./encodeQueryString":5,"@sanity/eventsource":20,"@sanity/observable/minimal":22,"xtend/mutable":51}],7:[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}function i(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=u({},e),this.client=r}function o(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return{query:t.query};var e=["* Dataset-prefixed document ID (<dataset/docId>)","* Array of dataset-prefixed document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection for patch - must be one of:\n\n"+e)}var s=t("deep-assign"),u=t("xtend/mutable"),a=t("../validators"),c=a.validateObject,f=a.validateInsert;u(i.prototype,{clone:function(){return new i(this.selection,u({},this.operations),this.client)},merge:function(t){return c("merge",t),this._assign("merge",s(this.operations.merge||{},t))},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return c("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=u({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return c("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 i;return f(t,e,r),this._assign("insert",(i={},n(i,t,e),n(i,"items",r),i))},append:function(t,e){return this.insert("after",t+"[-1]",e)},prepend:function(t,e){return this.insert("before",t+"[0]",e)},splice:function(t,e,r,n){var i="undefined"==typeof r||r===-1,o=e<0?e-1:e,s=i?-1:Math.max(0,e+r),u=o<0&&s>=0?"":s,a=t+"["+o+":"+u+"]";return this.insert("replace",a,n||[])},serialize:function(){return u(o(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=u({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 c(t,e),this.operations=u({},this.operations,n({},t,u({},r&&this.operations[t]||{},e))),this}}),e.exports=i},{"../validators":18,"deep-assign":24,"xtend/mutable":51}],8:[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}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];this.operations=t,this.client=e}var o=t("xtend/mutable"),s=t("../validators"),u=t("./patch"),a={returnDocuments:!1};o(i.prototype,{clone:function(){return new i(this.operations.slice(0),this.client)},create:function(t){return this._create(t,"create")},createIfNotExists:function(t){return this._create(t,"createIfNotExists")},createOrReplace:function(t){return this._create(t,"createOrReplace")},delete:function(t){return s.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function t(e,r){var n="function"==typeof r,i=e instanceof u;if(i)return this._add({patch:e.serialize()});if(n){var t=r(new u(e,{},this.client));if(!(t instanceof u))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:t.serialize()})}return this._add({patch:o({id:e},r)})},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(),t||a)},reset:function(){return this.operations=[],this},_create:function(t,e){if(!t._id&&!this.client)throw new Error('Document needs an _id property when transaction is create outside a client scope. Pass `{_id: "<datasetName>:"}` to have Sanity generate an ID for you.');s.validateObject(e,t);var r=s.hasDataset(this.client.clientConfig),i=n({},e,o({},t,{_id:t._id||r+"/"}));return this._add(i)},_add:function(t){return this.operations.push(t),this}}),e.exports=i},{"../validators":18,"./patch":7,"xtend/mutable":51}],9:[function(t,e,r){"use strict";function n(t){this.request=t.request.bind(t)}var i=t("xtend/mutable"),o=t("../validators");i(n.prototype,{create:function(t){return this._modify("PUT",t)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e){return o.dataset(e),this.request({method:t,uri:"/datasets/"+e})}}),e.exports=n},{"../validators":18,"xtend/mutable":51}],10:[function(t,e,r){"use strict";function n(t){var e=function(e,r){return"undefined"==typeof t[r]?e:e.concat(i(r)+"="+i(t[r]))};return Object.keys(t).reduce(e,[]).join("&")}var i=function(t){return encodeURIComponent(t)};r.stringify=n},{}],11:[function(t,e,r){"use strict";function n(t,e){if(t.error&&t.message)return new Error(t.error+" - "+t.message);if(t.error&&t.error.description){var r=new Error(t.error.description);return r.details=t.error,r}return new Error(t.error||t.message||o(e))}function i(t,e,r){t.responseBody=s(e,r),t.statusCode=r.statusCode}function o(t){var e=t.statusMessage?" "+t.statusMessage:"";return"Server responded with HTTP "+t.statusCode+e+", no description"}function s(t,e){var r=(e.headers["content-type"]||"").toLowerCase(),n=r.indexOf("application/json")!==-1;return n?JSON.stringify(t,null,2):t}var u=t("@sanity/request"),a=t("./queryString"),c=t("@sanity/observable/minimal"),f=t("xtend/mutable"),l="".indexOf("sanity")!==-1,h=function(){};e.exports=function(t){t.query&&(t.uri+="?"+a.stringify(t.query)),l&&(h("HTTP %s %s",t.method||"GET",t.uri),"POST"===t.method&&t.body&&h("Request body: %s",JSON.stringify(t.body,null,2)));var e=new c(function(e){function r(t){return function(r){var n=r.lengthComputable?r.loaded/r.total*100:-1;e.next({type:"progress",stage:t,percent:n})}}var a=f({},t,{beforeSend:function(n){t.beforeSend&&t.beforeSend(n),"upload"in n&&"onprogress"in n.upload&&(n.upload.onprogress=r("upload")),"onprogress"in n&&(n.onprogress=r("download")),n.onabort=function(){e.next({type:"abort"}),e.complete()}}}),c=u(a,function(t,r,u){if(t)return void e.error(t);h("Response code: %s",r.statusCode),l&&u&&h("Response body: %s",s(u,r));var a=r.statusCode>=400;if(a&&u){var c=n(u,r);return i(c,u,r),void e.error(c)}if(a){var f=new Error(o(r));return f.statusCode=r.statusCode,void e.error(f)}e.next({type:"response",body:u}),e.complete()});return function(){return c.abort()}});return e.toPromise=function(){var t=void 0;return e.forEach(function(e){t=e}).then(function(){return t.body})},e}},{"./queryString":10,"@sanity/observable/minimal":22,"@sanity/request":23,"xtend/mutable":51}],12:[function(t,e,r){"use strict";var n="Sanity-Token",i="Sanity-Project-ID";e.exports=function(t){var e={};return t.token&&(e[n]=t.token),!t.useProjectHostname&&t.projectId&&(e[i]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:15e3,withCredentials:!0,json:!0}}},{}],13:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable");i(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"xtend/mutable":51}],14:[function(t,e,r){"use strict";function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;this.config(t),this.assets=new h(this),this.datasets=new f(this),this.projects=new l(this),this.users=new p(this),this.auth=new d(this)}function i(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=e.reduce(function(t,e){return t||e.headers?s(t||{},e.headers||{}):null},null);return s.apply(void 0,e.concat([n?{headers:n}:{}]))}function o(t){return new n(t)}var s=t("xtend/mutable"),u=t("./data/patch"),a=t("./data/transaction"),c=t("./data/dataMethods"),f=t("./datasets/datasetsClient"),l=t("./projects/projectsClient"),h=t("./assets/assetsClient"),p=t("./users/usersClient"),d=t("./auth/authClient"),b=t("./http/request"),y=t("./http/requestOptions"),v=t("./config"),m=v.defaultConfig,g=v.initConfig;s(n.prototype,c),s(n.prototype,{config:function(t){return"undefined"==typeof t?s({},this.clientConfig):(this.clientConfig=g(t,this.clientConfig||{}),this)},getUrl:function(t){return this.clientConfig.url+"/"+t.replace(/^\//,"")},request:function(t){return this.requestObservable(t).toPromise()},requestObservable:function(t){return b(i(y(this.clientConfig),t,{uri:this.getUrl(t.uri)}))}}),o.Patch=u,o.Transaction=a,e.exports=o},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":11,"./http/requestOptions":12,"./projects/projectsClient":13,"./users/usersClient":15,"xtend/mutable":51}],15:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable");i(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"xtend/mutable":51}],16:[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]="undefined"==typeof t[n]?e[n]:t[n],r},{})}},{}],17:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce(function(e,r){return"undefined"==typeof t[r]?e:(e[r]=t[r],e)},{})}},{}],18:[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},i=["image","file"],o=["before","after","replace"];r.dataset=function(t){if(!/^[-\w]{1,128}$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes")},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(i.indexOf(t)===-1)throw new Error("Invalid asset type: "+t+". Must be one of "+i.join(", "))},r.validateObject=function(t,e){if(null===e||"object"!==("undefined"==typeof e?"undefined":n(e))||Array.isArray(e))throw new Error(t+"() takes an object of properties")},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[-_a-z0-9]{1,128}\/[-_a-z0-9\/]+$/i.test(e))throw new Error(t+"() takes a document ID in format dataset/docId")},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(o.indexOf(t)===-1){var i=o.map(function(t){return'"'+t+'"'}).join(", ");throw new Error(n+' takes an "at"-argument which is one of: '+i)}if("string"!=typeof e)throw new Error(n+' takes a "selector"-argument which must be a string');if(!Array.isArray(r))throw new Error(n+' takes an "items"-argument which must be an array')},r.hasDataset=function(t){if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset},r.promise={hasDataset:function(t){return new Promise(function(e){return e(r.hasDataset(t))})}}},{}],19:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<t.length;r++)e(t[r])}function i(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function o(t,e,r){var n=t;return l(e)?(r=e,"string"==typeof t&&(n={uri:t})):n=p(e,{uri:t}),n.callback=r,n}function s(t,e,r){return e=o(t,e,r),u(e)}function u(t){function e(){4===l.readyState&&o()}function r(){var t=void 0;if(t=l.response?l.response:l.responseText||a(l),_)try{t=JSON.parse(t)}catch(t){}return t}function n(t){return clearTimeout(b),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,c(t,f)}function o(){if(!d){var e;clearTimeout(b),e=t.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var n=f,i=null;return 0!==e?(n={body:r(),statusCode:e,method:v,headers:{},url:y,rawRequest:l},l.getAllResponseHeaders&&(n.headers=h(l.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),c(i,n,n.body)}}if("undefined"==typeof t.callback)throw new Error("callback argument missing");var u=!1,c=function(e,r,n){u||(u=!0,t.callback(e,r,n))},f={body:void 0,headers:{},statusCode:0,method:v,url:y,rawRequest:l},l=t.xhr||null;l||(l=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var p,d,b,y=l.url=t.uri||t.url,v=l.method=t.method||"GET",m=t.body||t.data||null,g=l.headers=t.headers||{},w=!!t.sync,_=!1;if(t.json===!0&&(_=!0,g.accept||g.Accept||(g.Accept="application/json"),"GET"!==v&&"HEAD"!==v&&(g["content-type"]||g["Content-Type"]||(g["Content-Type"]="application/json"),m=JSON.stringify(t.body))),l.onreadystatechange=e,l.onload=o,l.onerror=n,l.onprogress=function(){},l.ontimeout=n,l.open(v,y,!w,t.username,t.password),w||(l.withCredentials=!!t.withCredentials),!w&&t.timeout>0&&(b=setTimeout(function(){d=!0,l.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",n(t)},t.timeout)),l.setRequestHeader)for(p in g)g.hasOwnProperty(p)&&l.setRequestHeader(p,g[p]);else if(t.headers&&!i(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(l.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(l),l.send(m),l}function a(t){if("document"===t.responseType)return t.responseXML;var e=204===t.status&&t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}function c(){}var f=t("global/window"),l=t("is-function"),h=t("parse-headers"),p=t("xtend");e.exports=s,s.XMLHttpRequest=f.XMLHttpRequest||c,s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:f.XDomainRequest,n(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,r,n){return r=o(e,r,n),r.method=t.toUpperCase(),u(r)}})},{"global/window":27,"is-function":28,"parse-headers":30,xtend:50}],20:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":25}],21:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("rxjs/Observable"),o=i.Observable,s=t("rxjs/operator/map"),u=s.map,a=t("rxjs/operator/filter"),c=a.filter,f=t("rxjs/operator/reduce"),l=f.reduce,h=t("rxjs/operator/toPromise"),p=h.toPromise;n.prototype=Object.create(o.prototype),Object.defineProperty(n.prototype,"constructor",{value:n,enumerable:!1,writable:!0,configurable:!0}),n.prototype.lift=function(t){var e=new n;return e.source=this,e.operator=t,e},n.prototype.map=u,n.prototype.filter=c,n.prototype.reduce=l,n.prototype.toPromise=p,e.exports=n},{"rxjs/Observable":31,"rxjs/operator/filter":35,"rxjs/operator/map":36,"rxjs/operator/reduce":37,"rxjs/operator/toPromise":38}],22:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":21}],23:[function(t,e,r){e.exports=t("@bjoerge/xhr")},{"@bjoerge/xhr":19}],24:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function i(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(u.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");u.call(t,r)&&s(n)?t[r]=o(Object(t[r]),e[r]):t[r]=n}}function o(t,e){if(t===e)return t;e=Object(e);for(var r in e)u.call(e,r)&&i(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)a.call(e,n[o])&&i(t,e,n[o]);return t}var s=t("is-obj"),u=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)o(t,arguments[e]);return t}},{"is-obj":29}],25:[function(t,e,r){!function(t){function e(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"}function r(){return!(!window.XDomainRequest||!window.XMLHttpRequest||void 0!==(new XMLHttpRequest).responseType)}if(!t.EventSource||t._eventSourceImportPrefix){var n=(t._eventSourceImportPrefix||"")+"EventSource",i=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(i.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&&"undefined"!=typeof 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()},ondata: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],i=e.substring(this.cursor,n);this.parseStream(i),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){t=this.cache+this.normalizeToLF(t);var r,n,i,o,s,u,a=t.split("\n\n");for(r=0;r<a.length-1;r++){for(i="message",o=[],parts=a[r].split("\n"),n=0;n<parts.length;n++)s=this.trimWhiteSpace(parts[n]),0==s.indexOf("event")?i=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(u=parseInt(s.replace(/retry:?\s*/,"")),isNaN(u)||(this.interval=u)):0==s.indexOf("data")?o.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(o.length){var c=new e(i,o.join("\n"),window.location.origin,this.lastEventId);this.dispatchEvent(i,c)}}this.cache=a[a.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,i,o=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(i=o(n)+"="+o(e[n]),r.push(i))}return r.length>0?t.indexOf("?")==-1?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){var e=/^(\s|\u00A0)+|(\s|\u00A0)+$/g;return t.replace(e,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},r()){i.isPolyfill="IE_8-9";var o=i.prototype.defaultOptions;o.xhrHeaders=null,o.getArgs.evs_preamble=2056,i.prototype.XHR=function(t){request=new XDomainRequest,this._request=request,request.onprogress=function(){request._ready=!0,t.ondata()},request.onload=function(){this._loaded=!0,t.ondata()},request.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},request.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var e={};if(t.getArgs){var r=t.getArgs;for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n]);t.lastEventId&&(e.evs_last_event_id=t.lastEventId)}request.open("GET",t.urlWithParams(t.URL,e)),request.send()},i.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 i.isPolyfill="XHR",i.prototype.XHR=function(t){request=new XMLHttpRequest,this._request=request,t._xhr=this,request.onreadystatechange=function(){request.readyState>1&&t.readyState!=t.CLOSED&&(200==request.status||request.status>=300&&request.status<400?t.ondata():(request._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+request.status}),t.close()))},request.onprogress=function(){},request.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var e=t.xhrHeaders;for(var r in e)e.hasOwnProperty(r)&&request.setRequestHeader(r,e[r]);t.lastEventId&&request.setRequestHeader("Last-Event-Id",t.lastEventId),request.send()},i.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()}};t[n]=i}}(this)},{}],26:[function(t,e,r){function n(t,e,r){if(!u(e))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===a.call(t)?i(t,e,r):"string"==typeof t?o(t,e,r):s(t,e,r)}function i(t,e,r){for(var n=0,i=t.length;n<i;n++)c.call(t,n)&&e.call(r,t[n],n,t)}function o(t,e,r){for(var n=0,i=t.length;n<i;n++)e.call(r,t.charAt(n),n,t)}function s(t,e,r){for(var n in t)c.call(t,n)&&e.call(r,t[n],n,t)}var u=t("is-function");e.exports=n;var a=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":28}],27:[function(t,e,r){(function(t){"undefined"!=typeof window?e.exports=window:"undefined"!=typeof t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(t,e,r){function n(t){var e=i.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}e.exports=n;var i=Object.prototype.toString},{}],29:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],30:[function(t,e,r){var n=t("trim"),i=t("for-each"),o=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};var e={};return i(n(t).split("\n"),function(t){var r=t.indexOf(":"),i=n(t.slice(0,r)).toLowerCase(),s=n(t.slice(r+1));"undefined"==typeof e[i]?e[i]=s:o(e[i])?e[i].push(s):e[i]=[e[i],s]}),e}},{"for-each":26,trim:49}],31:[function(t,e,r){"use strict";var n=t("./util/root"),i=t("./util/toSubscriber"),o=t("./symbol/observable"),s=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,o=i.toSubscriber(t,e,r);if(n?n.call(o,this):o.add(this._subscribe(o)),
o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var i=r.subscribe(function(e){if(i)try{t(e)}catch(t){n(t),i.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[o.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":39,"./util/root":46,"./util/toSubscriber":47}],32:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],33:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./util/isFunction"),o=t("./Subscription"),s=t("./Observer"),u=t("./symbol/rxSubscriber"),a=function(t){function e(r,n,i){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=s.empty;break;case 1:if(!r){this.destination=s.empty;break}if("object"==typeof r){r instanceof e?(this.destination=r,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new c(this,r));break}default:this.syncErrorThrowable=!0,this.destination=new c(this,r,n,i)}}return n(e,t),e.prototype[u.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var i=new e(t,r,n);return i.syncErrorThrowable=!1,i},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}(o.Subscription);r.Subscriber=a;var c=function(t){function e(e,r,n,o){t.call(this),this._parent=e;var s,u=this;i.isFunction(r)?s=r:r&&(u=r,s=r.next,n=r.error,o=r.complete,i.isFunction(u.unsubscribe)&&this.add(u.unsubscribe.bind(u)),u.unsubscribe=this.unsubscribe.bind(this)),this._context=u,this._next=s,this._error=n,this._complete=o}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parent;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._parent;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},e.prototype.complete=function(){if(!this.isStopped){var t=this._parent;this._complete?t.syncErrorThrowable?(this.__tryOrSetError(t,this._complete),this.unsubscribe()):(this.__tryOrUnsub(this._complete),this.unsubscribe()):this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},e.prototype.__tryOrSetError=function(t,e,r){try{e.call(this._context,r)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},e.prototype._unsubscribe=function(){var t=this._parent;this._context=null,this._parent=null,t.unsubscribe()},e}(a)},{"./Observer":32,"./Subscription":34,"./symbol/rxSubscriber":40,"./util/isFunction":44}],34:[function(t,e,r){"use strict";var n=t("./util/isArray"),i=t("./util/isObject"),o=t("./util/isFunction"),s=t("./util/tryCatch"),u=t("./util/errorObject"),a=t("./util/UnsubscriptionError"),c=function(){function t(t){this.closed=!1,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){this.closed=!0;var r=this,c=r._unsubscribe,f=r._subscriptions;if(this._subscriptions=null,o.isFunction(c)){var l=s.tryCatch(c).call(this);l===u.errorObject&&(e=!0,(t=t||[]).push(u.errorObject.e))}if(n.isArray(f))for(var h=-1,p=f.length;++h<p;){var d=f[h];if(i.isObject(d)){var l=s.tryCatch(d.unsubscribe).call(d);if(l===u.errorObject){e=!0,t=t||[];var b=u.errorObject.e;b instanceof a.UnsubscriptionError?t=t.concat(b.errors):t.push(b)}}}if(e)throw new a.UnsubscriptionError(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)break;this.closed?r.unsubscribe():(this._subscriptions||(this._subscriptions=[])).push(r);break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return r},t.prototype.remove=function(e){if(null!=e&&e!==this&&e!==t.EMPTY){var r=this._subscriptions;if(r){var n=r.indexOf(e);n!==-1&&r.splice(n,1)}}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();r.Subscription=c},{"./util/UnsubscriptionError":41,"./util/errorObject":42,"./util/isArray":43,"./util/isFunction":44,"./util/isObject":45,"./util/tryCatch":48}],35:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber");r.filter=n;var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e._subscribe(new u(t,this.predicate,this.thisArg))},t}(),u=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return i(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}(o.Subscriber)},{"../Subscriber":33}],36:[function(t,e,r){"use strict";function n(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new s(t,e))}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber");r.map=n;var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e._subscribe(new u(t,this.project,this.thisArg))},t}();r.MapOperator=s;var u=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return i(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}(o.Subscriber)},{"../Subscriber":33}],37:[function(t,e,r){"use strict";function n(t,e){var r=!1;return arguments.length>=2&&(r=!0),this.lift(new s(t,e,r))}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber");r.reduce=n;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 u(t,this.accumulator,this.seed,this.hasSeed))},t}();r.ReduceOperator=s;var u=function(t){function e(e,r,n,i){t.call(this,e),this.accumulator=r,this.hasSeed=i,this.hasValue=!1,this.acc=n}return i(e,t),e.prototype._next=function(t){this.hasValue||(this.hasValue=this.hasSeed)?this._tryReduce(t):(this.acc=t,this.hasValue=!0)},e.prototype._tryReduce=function(t){var e;try{e=this.accumulator(this.acc,t)}catch(t){return void this.destination.error(t)}this.acc=e},e.prototype._complete=function(){(this.hasValue||this.hasSeed)&&this.destination.next(this.acc),this.destination.complete()},e}(o.Subscriber);r.ReduceSubscriber=u},{"../Subscriber":33}],38:[function(t,e,r){"use strict";function n(t){var e=this;if(t||(i.root.Rx&&i.root.Rx.config&&i.root.Rx.config.Promise?t=i.root.Rx.config.Promise:i.root.Promise&&(t=i.root.Promise)),!t)throw new Error("no Promise impl found");return new t(function(t,r){var n;e.subscribe(function(t){return n=t},function(t){return r(t)},function(){return t(n)})})}var i=t("../util/root");r.toPromise=n},{"../util/root":46}],39:[function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var i=t("../util/root");r.getSymbolObservable=n,r.$$observable=n(i.root)},{"../util/root":46}],40:[function(t,e,r){"use strict";var n=t("../util/root"),i=n.root.Symbol;r.$$rxSubscriber="function"==typeof i&&"function"==typeof i.for?i.for("rxSubscriber"):"@@rxSubscriber"},{"../util/root":46}],41:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e){t.call(this),this.errors=e;var r=Error.call(this,e?e.length+" errors occurred during unsubscription:\n "+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"");this.name=r.name="UnsubscriptionError",this.stack=r.stack,this.message=r.message}return n(e,t),e}(Error);r.UnsubscriptionError=i},{}],42:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],43:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],44:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],45:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],46:[function(t,e,r){(function(t){"use strict";if(r.root="object"==typeof window&&window.window===window&&window||"object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t,!r.root)throw new Error("RxJS could not find any global context (window, self, global)")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof i.Subscriber)return t;if(t[o.$$rxSubscriber])return t[o.$$rxSubscriber]()}return t||e||r?new i.Subscriber(t,e,r):new i.Subscriber(s.empty)}var i=t("../Subscriber"),o=t("../symbol/rxSubscriber"),s=t("../Observer");r.toSubscriber=n},{"../Observer":32,"../Subscriber":33,"../symbol/rxSubscriber":40}],48:[function(t,e,r){"use strict";function n(){try{return o.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function i(t){return o=t,n}var o,s=t("./errorObject");r.tryCatch=i},{"./errorObject":42}],49:[function(t,e,r){function n(t){return t.replace(/^\s*|\s*$/g,"")}r=e.exports=n,r.left=function(t){return t.replace(/^\s*/,"")},r.right=function(t){return t.replace(/\s*$/,"")}},{}],50:[function(t,e,r){function n(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var n in r)i.call(r,n)&&(t[n]=r[n])}return t}e.exports=n;var i=Object.prototype.hasOwnProperty},{}],51:[function(t,e,r){function n(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)i.call(r,n)&&(t[n]=r[n])}return t}e.exports=n;var i=Object.prototype.hasOwnProperty},{}]},{},[14])(14)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.SanityClient=t()}}(function(){return function t(e,r,n){function i(s,u){if(!r[s]){if(!e[s]){var a="function"==typeof require&&require;if(!u&&a)return a(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};e[s][0].call(f.exports,function(t){var r=e[s][1][t];return i(r?r:t)},f,f.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable"),o=t("../validators"),s={image:"images",file:"files"};i(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};o.validateAssetType(t);var n=o.hasDataset(this.client.clientConfig),u="contentType"in r?{"Content-Type":r.contentType}:{},a=s[t],c=r.label?"?label="+encodeURIComponent(r.label):"",f="/assets/"+a+"/"+n+c;return this.client.requestObservable({method:"POST",headers:i({Accept:"application/json"},u),uri:f,body:e,json:!1,timeout:0}).map(function(t){return"response"!==t.type?t:i({},t,{body:JSON.parse(t.body)})})}}),e.exports=n},{"../validators":18,"xtend/mutable":51}],2:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable");i(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"xtend/mutable":51}],3:[function(t,e,r){"use strict";var n=t("xtend/mutable"),i=t("./validators"),o=r.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};r.initConfig=function(t,e){var r=n({},o,e,t),s=r.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(s&&!r.projectId)throw new Error("Configuration must contain `projectId`");if(s&&i.projectId(r.projectId),r.dataset&&i.dataset(r.dataset),r.gradientMode)r.url=r.apiHost;else{var u=r.apiHost.split("://",2),a=u[0],c=u[1];r.useProjectHostname?r.url=a+"://"+r.projectId+"."+c+"/v1":r.url=r.apiHost+"/v1"}return r}},{"./validators":18,"xtend/mutable":51}],4:[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 i=t("xtend/mutable"),o=t("../validators"),s=t("./encodeQueryString"),u=t("./transaction"),a=t("./patch"),c=t("./listen"),f=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:f(t.returnDocuments,!0),visibility:t.visibility||"sync"}},h=1948;e.exports={listen:c,getDataUrl:function(t,e){var r=this.clientConfig.projectId;return this.clientConfig.gradientMode?"/"+t+"/"+r+"/"+e:"/data/"+t+"/"+e},fetch:function(t,e){return this.dataRequest("query",{query:t,params:e}).then(function(t){return t.result||[]})},getDocument:function(t){return this.request({uri:this.getDataUrl("doc",t),json:!0}).then(function(t){return t.documents&&t.documents[0]})},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return this._create(t,"createOrReplace",e)},patch:function(t,e){return new a(t,e,this)},delete:function(t,e){return o.validateDocumentId("delete",t),this.dataRequest("mutate",{mutations:[{delete:{id:t}}]},e)},mutate:function(t,e){var r=t instanceof a?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new u(t,this)},dataRequest:function(t,e){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u="mutate"===t,a=!u&&s(e),c=!u&&a.length<h,f=c?a:"",p=i.returnFirst;return o.promise.hasDataset(this.clientConfig).then(function(n){return r.request({method:c?"GET":"POST",uri:r.getDataUrl(t,""+n+f),json:!0,body:c?void 0:e,query:u&&l(i)})}).then(function(t){if(!u)return t;var e=t.results||[];if(i.returnDocuments)return p?e[0]&&e[0].document:e.map(function(t){return t.document});var r=p?"documentId":"documentIds",o=p?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId},r,o)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=o.hasDataset(this.clientConfig),u=n({},e,i({},t,{_id:t._id||s+"/"})),a=i({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[u]},a)}}},{"../validators":18,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"xtend/mutable":51}],5:[function(t,e,r){"use strict";var n=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,i=void 0===r?{}:r,o=t.options,s=void 0===o?{}:o,u=Object.keys(i).reduce(function(t,e){return t+"&"+n("$"+e)+"="+n(JSON.stringify(i[e]))},"?query="+n(e));return Object.keys(s).reduce(function(t,e){return s[e]?t+"&"+n(e)+"="+n(s[e]):t},u)}},{}],6:[function(t,e,r){"use strict";function n(t){try{var e=t.data&&JSON.parse(t.data)||{};return o({type:t.type},e)}catch(t){return t}}function i(t){if(t instanceof Error)return t;var e=n(t);return e instanceof Error?e:new Error(e.error||e.message||"Unknown listener error")}var o=t("xtend/mutable"),s=t("@sanity/observable/minimal"),u=t("./encodeQueryString"),a=t("../validators"),c=t("../util/pick"),f=t("../util/defaults"),l="undefined"!=typeof window&&window.EventSource?window.EventSource:t("@sanity/eventsource"),h=function(t,e,r){t.removeEventListener?t.removeEventListener(e,r,!1):t.removeListener(e,r)},p=["includePreviousRevision","includeResult"],d={includeResult:!0};e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},b=f(r,d),y=c(b,p),v=u({query:t,params:e,options:y}),m=a.hasDataset(this.clientConfig),g=this.getUrl("/data/listen/"+m+v),w=this.clientConfig.token,_=b.events?b.events:["mutation"],x=_.indexOf("reconnect")!==-1,E=new l(g,o({withCredentials:!0},w?{headers:{"Sanity-Token":w}}:{}));return new s(function(t){function e(){E.readyState===l.CLOSED?t.complete():E.readyState===l.CONNECTING&&a()}function r(e){t.error(i(e))}function o(e){var r=n(e);return r instanceof Error?t.error(r):t.next(r)}function s(e){t.complete(),u()}function u(){_.forEach(function(t){return h(E,t,o)}),h(E,"error",e),h(E,"channelError",r),h(E,"disconnect",s),E.close()}function a(){x&&t.next({type:"reconnect"})}return E.addEventListener("error",e,!1),E.addEventListener("channelError",r,!1),E.addEventListener("disconnect",s,!1),_.forEach(function(t){return E.addEventListener(t,o,!1)}),u})}},{"../util/defaults":16,"../util/pick":17,"../validators":18,"./encodeQueryString":5,"@sanity/eventsource":20,"@sanity/observable/minimal":22,"xtend/mutable":51}],7:[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}function i(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=u({},e),this.client=r}function o(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return{query:t.query};var e=["* Dataset-prefixed document ID (<dataset/docId>)","* Array of dataset-prefixed document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection for patch - must be one of:\n\n"+e)}var s=t("deep-assign"),u=t("xtend/mutable"),a=t("../validators"),c=a.validateObject,f=a.validateInsert;u(i.prototype,{clone:function(){return new i(this.selection,u({},this.operations),this.client)},merge:function(t){return c("merge",t),this._assign("merge",s(this.operations.merge||{},t))},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return c("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=u({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return c("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 i;return f(t,e,r),this._assign("insert",(i={},n(i,t,e),n(i,"items",r),i))},append:function(t,e){return this.insert("after",t+"[-1]",e)},prepend:function(t,e){return this.insert("before",t+"[0]",e)},splice:function(t,e,r,n){var i="undefined"==typeof r||r===-1,o=e<0?e-1:e,s=i?-1:Math.max(0,e+r),u=o<0&&s>=0?"":s,a=t+"["+o+":"+u+"]";return this.insert("replace",a,n||[])},serialize:function(){return u(o(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=u({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 c(t,e),this.operations=u({},this.operations,n({},t,u({},r&&this.operations[t]||{},e))),this}}),e.exports=i},{"../validators":18,"deep-assign":24,"xtend/mutable":51}],8:[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}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];this.operations=t,this.client=e}var o=t("xtend/mutable"),s=t("../validators"),u=t("./patch"),a={returnDocuments:!1};o(i.prototype,{clone:function(){return new i(this.operations.slice(0),this.client)},create:function(t){return this._create(t,"create")},createIfNotExists:function(t){return this._create(t,"createIfNotExists")},createOrReplace:function(t){return this._create(t,"createOrReplace")},delete:function(t){return s.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function t(e,r){var n="function"==typeof r,i=e instanceof u;if(i)return this._add({patch:e.serialize()});if(n){var t=r(new u(e,{},this.client));if(!(t instanceof u))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:t.serialize()})}return this._add({patch:o({id:e},r)})},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(),t||a)},reset:function(){return this.operations=[],this},_create:function(t,e){if(!t._id&&!this.client)throw new Error('Document needs an _id property when transaction is create outside a client scope. Pass `{_id: "<datasetName>:"}` to have Sanity generate an ID for you.');s.validateObject(e,t);var r=s.hasDataset(this.client.clientConfig),i=n({},e,o({},t,{_id:t._id||r+"/"}));return this._add(i)},_add:function(t){return this.operations.push(t),this}}),e.exports=i},{"../validators":18,"./patch":7,"xtend/mutable":51}],9:[function(t,e,r){"use strict";function n(t){this.request=t.request.bind(t)}var i=t("xtend/mutable"),o=t("../validators");i(n.prototype,{create:function(t){return this._modify("PUT",t)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e){return o.dataset(e),this.request({method:t,uri:"/datasets/"+e})}}),e.exports=n},{"../validators":18,"xtend/mutable":51}],10:[function(t,e,r){"use strict";function n(t){var e=function(e,r){return"undefined"==typeof t[r]?e:e.concat(i(r)+"="+i(t[r]))};return Object.keys(t).reduce(e,[]).join("&")}var i=function(t){return encodeURIComponent(t)};r.stringify=n},{}],11:[function(t,e,r){"use strict";function n(t,e){if(t.error&&t.message)return new Error(t.error+" - "+t.message);if(t.error&&t.error.description){var r=new Error(t.error.description);return r.details=t.error,r}return new Error(t.error||t.message||o(e))}function i(t,e,r){t.responseBody=s(e,r),t.statusCode=r.statusCode}function o(t){var e=t.statusMessage?" "+t.statusMessage:"";return"Server responded with HTTP "+t.statusCode+e+", no description"}function s(t,e){var r=(e.headers["content-type"]||"").toLowerCase(),n=r.indexOf("application/json")!==-1;return n?JSON.stringify(t,null,2):t}var u=t("@sanity/request"),a=t("./queryString"),c=t("@sanity/observable/minimal"),f=t("xtend/mutable"),l="".indexOf("sanity")!==-1,h=function(){};e.exports=function(t){t.query&&(t.uri+="?"+a.stringify(t.query)),l&&(h("HTTP %s %s",t.method||"GET",t.uri),"POST"===t.method&&t.body&&h("Request body: %s",JSON.stringify(t.body,null,2)));var e=new c(function(e){function r(t){return function(r){var n=r.lengthComputable?r.loaded/r.total*100:-1;e.next({type:"progress",stage:t,percent:n})}}var a=f({},t,{beforeSend:function(n){t.beforeSend&&t.beforeSend(n),"upload"in n&&"onprogress"in n.upload&&(n.upload.onprogress=r("upload")),"onprogress"in n&&(n.onprogress=r("download")),n.onabort=function(){e.next({type:"abort"}),e.complete()}}}),c=u(a,function(t,r,u){if(t)return void e.error(t);h("Response code: %s",r.statusCode),l&&u&&h("Response body: %s",s(u,r));var a=r.statusCode>=400;if(a&&u){var c=n(u,r);return i(c,u,r),void e.error(c)}if(a){var f=new Error(o(r));return f.statusCode=r.statusCode,void e.error(f)}e.next({type:"response",body:u}),e.complete()});return function(){return c.abort()}});return e.toPromise=function(){var t=void 0;return e.forEach(function(e){t=e}).then(function(){return t.body})},e}},{"./queryString":10,"@sanity/observable/minimal":22,"@sanity/request":23,"xtend/mutable":51}],12:[function(t,e,r){"use strict";var n="Sanity-Token",i="Sanity-Project-ID";e.exports=function(t){var e={};return t.token&&t.gradientMode?e.Authorization="Bearer "+t.token:t.token&&(e[n]=t.token),!t.useProjectHostname&&t.projectId&&(e[i]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:3e4,withCredentials:!0,json:!0}}},{}],13:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable");i(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"xtend/mutable":51}],14:[function(t,e,r){"use strict";function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;this.config(t),this.assets=new h(this),this.datasets=new f(this),this.projects=new l(this),this.users=new p(this),this.auth=new d(this)}function i(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=e.reduce(function(t,e){return t||e.headers?s(t||{},e.headers||{}):null},null);return s.apply(void 0,e.concat([n?{headers:n}:{}]))}function o(t){return new n(t)}var s=t("xtend/mutable"),u=t("./data/patch"),a=t("./data/transaction"),c=t("./data/dataMethods"),f=t("./datasets/datasetsClient"),l=t("./projects/projectsClient"),h=t("./assets/assetsClient"),p=t("./users/usersClient"),d=t("./auth/authClient"),b=t("./http/request"),y=t("./http/requestOptions"),v=t("./config"),m=v.defaultConfig,g=v.initConfig;s(n.prototype,c),s(n.prototype,{config:function(t){return"undefined"==typeof t?s({},this.clientConfig):(this.clientConfig=g(t,this.clientConfig||{}),this)},getUrl:function(t){return this.clientConfig.url+"/"+t.replace(/^\//,"")},request:function(t){return this.requestObservable(t).toPromise()},requestObservable:function(t){return b(i(y(this.clientConfig),t,{uri:this.getUrl(t.uri)}))}}),o.Patch=u,o.Transaction=a,e.exports=o},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":11,"./http/requestOptions":12,"./projects/projectsClient":13,"./users/usersClient":15,"xtend/mutable":51}],15:[function(t,e,r){"use strict";function n(t){this.client=t}var i=t("xtend/mutable");i(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"xtend/mutable":51}],16:[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]="undefined"==typeof t[n]?e[n]:t[n],r},{})}},{}],17:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce(function(e,r){return"undefined"==typeof t[r]?e:(e[r]=t[r],e)},{})}},{}],18:[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},i=["image","file"],o=["before","after","replace"];r.dataset=function(t){if(!/^[-\w]{1,128}$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes")},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(i.indexOf(t)===-1)throw new Error("Invalid asset type: "+t+". Must be one of "+i.join(", "))},r.validateObject=function(t,e){if(null===e||"object"!==("undefined"==typeof e?"undefined":n(e))||Array.isArray(e))throw new Error(t+"() takes an object of properties")},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[-_a-z0-9]{1,128}\/[-_a-z0-9\/]+$/i.test(e))throw new Error(t+"() takes a document ID in format dataset/docId")},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(o.indexOf(t)===-1){var i=o.map(function(t){return'"'+t+'"'}).join(", ");throw new Error(n+' takes an "at"-argument which is one of: '+i)}if("string"!=typeof e)throw new Error(n+' takes a "selector"-argument which must be a string');if(!Array.isArray(r))throw new Error(n+' takes an "items"-argument which must be an array')},r.hasDataset=function(t){if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset},r.promise={hasDataset:function(t){return new Promise(function(e){return e(r.hasDataset(t))})}}},{}],19:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<t.length;r++)e(t[r])}function i(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function o(t,e,r){var n=t;return l(e)?(r=e,"string"==typeof t&&(n={uri:t})):n=p(e,{uri:t}),n.callback=r,n}function s(t,e,r){return e=o(t,e,r),u(e)}function u(t){function e(){4===l.readyState&&o()}function r(){var t=void 0;if(t=l.response?l.response:l.responseText||a(l),_)try{t=JSON.parse(t)}catch(t){}return t}function n(t){return clearTimeout(b),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,c(t,f)}function o(){if(!d){var e;clearTimeout(b),e=t.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var n=f,i=null;return 0!==e?(n={body:r(),statusCode:e,method:v,headers:{},url:y,rawRequest:l},l.getAllResponseHeaders&&(n.headers=h(l.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),c(i,n,n.body)}}if("undefined"==typeof t.callback)throw new Error("callback argument missing");var u=!1,c=function(e,r,n){u||(u=!0,t.callback(e,r,n))},f={body:void 0,headers:{},statusCode:0,method:v,url:y,rawRequest:l},l=t.xhr||null;l||(l=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var p,d,b,y=l.url=t.uri||t.url,v=l.method=t.method||"GET",m=t.body||t.data||null,g=l.headers=t.headers||{},w=!!t.sync,_=!1;if(t.json===!0&&(_=!0,g.accept||g.Accept||(g.Accept="application/json"),"GET"!==v&&"HEAD"!==v&&(g["content-type"]||g["Content-Type"]||(g["Content-Type"]="application/json"),m=JSON.stringify(t.body))),l.onreadystatechange=e,l.onload=o,l.onerror=n,l.onprogress=function(){},l.ontimeout=n,l.open(v,y,!w,t.username,t.password),w||(l.withCredentials=!!t.withCredentials),!w&&t.timeout>0&&(b=setTimeout(function(){d=!0,l.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",n(t)},t.timeout)),l.setRequestHeader)for(p in g)g.hasOwnProperty(p)&&l.setRequestHeader(p,g[p]);else if(t.headers&&!i(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(l.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(l),l.send(m),l}function a(t){if("document"===t.responseType)return t.responseXML;var e=204===t.status&&t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}function c(){}var f=t("global/window"),l=t("is-function"),h=t("parse-headers"),p=t("xtend");e.exports=s,s.XMLHttpRequest=f.XMLHttpRequest||c,s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:f.XDomainRequest,n(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,r,n){return r=o(e,r,n),r.method=t.toUpperCase(),u(r)}})},{"global/window":27,"is-function":28,"parse-headers":30,xtend:50}],20:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":25}],21:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("rxjs/Observable"),o=i.Observable,s=t("rxjs/operator/map"),u=s.map,a=t("rxjs/operator/filter"),c=a.filter,f=t("rxjs/operator/reduce"),l=f.reduce,h=t("rxjs/operator/toPromise"),p=h.toPromise;n.prototype=Object.create(o.prototype),Object.defineProperty(n.prototype,"constructor",{value:n,enumerable:!1,writable:!0,configurable:!0}),n.prototype.lift=function(t){var e=new n;return e.source=this,e.operator=t,e},n.prototype.map=u,n.prototype.filter=c,n.prototype.reduce=l,n.prototype.toPromise=p,e.exports=n},{"rxjs/Observable":31,"rxjs/operator/filter":35,"rxjs/operator/map":36,"rxjs/operator/reduce":37,"rxjs/operator/toPromise":38}],22:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":21}],23:[function(t,e,r){e.exports=t("@bjoerge/xhr")},{"@bjoerge/xhr":19}],24:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function i(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(u.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");u.call(t,r)&&s(n)?t[r]=o(Object(t[r]),e[r]):t[r]=n}}function o(t,e){if(t===e)return t;e=Object(e);for(var r in e)u.call(e,r)&&i(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)a.call(e,n[o])&&i(t,e,n[o]);return t}var s=t("is-obj"),u=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)o(t,arguments[e]);return t}},{"is-obj":29}],25:[function(t,e,r){!function(t){function e(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"}function r(){return!(!window.XDomainRequest||!window.XMLHttpRequest||void 0!==(new XMLHttpRequest).responseType)}if(!t.EventSource||t._eventSourceImportPrefix){var n=(t._eventSourceImportPrefix||"")+"EventSource",i=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(i.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&&"undefined"!=typeof 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()},ondata: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],i=e.substring(this.cursor,n);this.parseStream(i),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){t=this.cache+this.normalizeToLF(t);var r,n,i,o,s,u,a=t.split("\n\n");for(r=0;r<a.length-1;r++){for(i="message",o=[],parts=a[r].split("\n"),n=0;n<parts.length;n++)s=this.trimWhiteSpace(parts[n]),0==s.indexOf("event")?i=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(u=parseInt(s.replace(/retry:?\s*/,"")),isNaN(u)||(this.interval=u)):0==s.indexOf("data")?o.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(o.length){var c=new e(i,o.join("\n"),window.location.origin,this.lastEventId);this.dispatchEvent(i,c)}}this.cache=a[a.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,i,o=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(i=o(n)+"="+o(e[n]),r.push(i))}return r.length>0?t.indexOf("?")==-1?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){var e=/^(\s|\u00A0)+|(\s|\u00A0)+$/g;return t.replace(e,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},r()){i.isPolyfill="IE_8-9";var o=i.prototype.defaultOptions;o.xhrHeaders=null,o.getArgs.evs_preamble=2056,i.prototype.XHR=function(t){request=new XDomainRequest,this._request=request,request.onprogress=function(){request._ready=!0,t.ondata()},request.onload=function(){this._loaded=!0,t.ondata()},request.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},request.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var e={};if(t.getArgs){var r=t.getArgs;for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n]);t.lastEventId&&(e.evs_last_event_id=t.lastEventId)}request.open("GET",t.urlWithParams(t.URL,e)),request.send()},i.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 i.isPolyfill="XHR",i.prototype.XHR=function(t){request=new XMLHttpRequest,this._request=request,t._xhr=this,request.onreadystatechange=function(){request.readyState>1&&t.readyState!=t.CLOSED&&(200==request.status||request.status>=300&&request.status<400?t.ondata():(request._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+request.status}),t.close()))},request.onprogress=function(){},request.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var e=t.xhrHeaders;for(var r in e)e.hasOwnProperty(r)&&request.setRequestHeader(r,e[r]);t.lastEventId&&request.setRequestHeader("Last-Event-Id",t.lastEventId),request.send()},i.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()}};t[n]=i}}(this)},{}],26:[function(t,e,r){function n(t,e,r){if(!u(e))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===a.call(t)?i(t,e,r):"string"==typeof t?o(t,e,r):s(t,e,r)}function i(t,e,r){for(var n=0,i=t.length;n<i;n++)c.call(t,n)&&e.call(r,t[n],n,t)}function o(t,e,r){for(var n=0,i=t.length;n<i;n++)e.call(r,t.charAt(n),n,t)}function s(t,e,r){for(var n in t)c.call(t,n)&&e.call(r,t[n],n,t)}var u=t("is-function");e.exports=n;var a=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":28}],27:[function(t,e,r){(function(t){"undefined"!=typeof window?e.exports=window:"undefined"!=typeof t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(t,e,r){function n(t){var e=i.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}e.exports=n;var i=Object.prototype.toString},{}],29:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],30:[function(t,e,r){var n=t("trim"),i=t("for-each"),o=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};var e={};return i(n(t).split("\n"),function(t){var r=t.indexOf(":"),i=n(t.slice(0,r)).toLowerCase(),s=n(t.slice(r+1));"undefined"==typeof e[i]?e[i]=s:o(e[i])?e[i].push(s):e[i]=[e[i],s]}),e}},{"for-each":26,trim:49}],31:[function(t,e,r){"use strict";var n=t("./util/root"),i=t("./util/toSubscriber"),o=t("./symbol/observable"),s=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,o=i.toSubscriber(t,e,r);if(n?n.call(o,this):o.add(this._subscribe(o)),o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var i=r.subscribe(function(e){if(i)try{t(e)}catch(t){n(t),i.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[o.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":39,"./util/root":46,"./util/toSubscriber":47}],32:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],33:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./util/isFunction"),o=t("./Subscription"),s=t("./Observer"),u=t("./symbol/rxSubscriber"),a=function(t){function e(r,n,i){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=s.empty;break;case 1:if(!r){this.destination=s.empty;break}if("object"==typeof r){r instanceof e?(this.destination=r,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new c(this,r));break}default:this.syncErrorThrowable=!0,this.destination=new c(this,r,n,i)}}return n(e,t),e.prototype[u.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var i=new e(t,r,n);return i.syncErrorThrowable=!1,i},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}(o.Subscription);r.Subscriber=a;var c=function(t){function e(e,r,n,o){t.call(this),this._parent=e;var s,u=this;i.isFunction(r)?s=r:r&&(u=r,s=r.next,n=r.error,o=r.complete,i.isFunction(u.unsubscribe)&&this.add(u.unsubscribe.bind(u)),u.unsubscribe=this.unsubscribe.bind(this)),this._context=u,this._next=s,this._error=n,this._complete=o}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parent;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._parent;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},e.prototype.complete=function(){if(!this.isStopped){var t=this._parent;this._complete?t.syncErrorThrowable?(this.__tryOrSetError(t,this._complete),this.unsubscribe()):(this.__tryOrUnsub(this._complete),this.unsubscribe()):this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},e.prototype.__tryOrSetError=function(t,e,r){try{e.call(this._context,r)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},e.prototype._unsubscribe=function(){var t=this._parent;this._context=null,this._parent=null,t.unsubscribe()},e}(a)},{"./Observer":32,"./Subscription":34,"./symbol/rxSubscriber":40,"./util/isFunction":44}],34:[function(t,e,r){"use strict";var n=t("./util/isArray"),i=t("./util/isObject"),o=t("./util/isFunction"),s=t("./util/tryCatch"),u=t("./util/errorObject"),a=t("./util/UnsubscriptionError"),c=function(){function t(t){this.closed=!1,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){this.closed=!0;var r=this,c=r._unsubscribe,f=r._subscriptions;if(this._subscriptions=null,o.isFunction(c)){var l=s.tryCatch(c).call(this);l===u.errorObject&&(e=!0,(t=t||[]).push(u.errorObject.e))}if(n.isArray(f))for(var h=-1,p=f.length;++h<p;){var d=f[h];if(i.isObject(d)){var l=s.tryCatch(d.unsubscribe).call(d);if(l===u.errorObject){e=!0,t=t||[];var b=u.errorObject.e;b instanceof a.UnsubscriptionError?t=t.concat(b.errors):t.push(b)}}}if(e)throw new a.UnsubscriptionError(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)break;this.closed?r.unsubscribe():(this._subscriptions||(this._subscriptions=[])).push(r);break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return r},t.prototype.remove=function(e){if(null!=e&&e!==this&&e!==t.EMPTY){var r=this._subscriptions;if(r){var n=r.indexOf(e);n!==-1&&r.splice(n,1)}}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();r.Subscription=c},{"./util/UnsubscriptionError":41,"./util/errorObject":42,"./util/isArray":43,"./util/isFunction":44,"./util/isObject":45,"./util/tryCatch":48}],35:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber");r.filter=n;var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e._subscribe(new u(t,this.predicate,this.thisArg))},t}(),u=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return i(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}(o.Subscriber)},{"../Subscriber":33}],36:[function(t,e,r){"use strict";function n(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new s(t,e))}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber");r.map=n;var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e._subscribe(new u(t,this.project,this.thisArg))},t}();r.MapOperator=s;var u=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return i(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}(o.Subscriber)},{"../Subscriber":33}],37:[function(t,e,r){"use strict";function n(t,e){var r=!1;return arguments.length>=2&&(r=!0),this.lift(new s(t,e,r))}var i=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("../Subscriber");r.reduce=n;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 u(t,this.accumulator,this.seed,this.hasSeed))},t}();r.ReduceOperator=s;var u=function(t){function e(e,r,n,i){t.call(this,e),this.accumulator=r,this.hasSeed=i,this.hasValue=!1,this.acc=n}return i(e,t),e.prototype._next=function(t){this.hasValue||(this.hasValue=this.hasSeed)?this._tryReduce(t):(this.acc=t,this.hasValue=!0)},e.prototype._tryReduce=function(t){var e;try{e=this.accumulator(this.acc,t)}catch(t){return void this.destination.error(t)}this.acc=e},e.prototype._complete=function(){(this.hasValue||this.hasSeed)&&this.destination.next(this.acc),this.destination.complete()},e}(o.Subscriber);r.ReduceSubscriber=u},{"../Subscriber":33}],38:[function(t,e,r){"use strict";function n(t){var e=this;if(t||(i.root.Rx&&i.root.Rx.config&&i.root.Rx.config.Promise?t=i.root.Rx.config.Promise:i.root.Promise&&(t=i.root.Promise)),!t)throw new Error("no Promise impl found");return new t(function(t,r){var n;e.subscribe(function(t){return n=t},function(t){return r(t)},function(){return t(n)})})}var i=t("../util/root");r.toPromise=n},{"../util/root":46}],39:[function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var i=t("../util/root");r.getSymbolObservable=n,r.$$observable=n(i.root)},{"../util/root":46}],40:[function(t,e,r){"use strict";var n=t("../util/root"),i=n.root.Symbol;r.$$rxSubscriber="function"==typeof i&&"function"==typeof i.for?i.for("rxSubscriber"):"@@rxSubscriber"},{"../util/root":46}],41:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function e(e){t.call(this),this.errors=e;var r=Error.call(this,e?e.length+" errors occurred during unsubscription:\n "+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"");this.name=r.name="UnsubscriptionError",this.stack=r.stack,this.message=r.message}return n(e,t),e}(Error);r.UnsubscriptionError=i},{}],42:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],43:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],44:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],45:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],46:[function(t,e,r){(function(t){"use strict";if(r.root="object"==typeof window&&window.window===window&&window||"object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t,!r.root)throw new Error("RxJS could not find any global context (window, self, global)")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof i.Subscriber)return t;if(t[o.$$rxSubscriber])return t[o.$$rxSubscriber]()}return t||e||r?new i.Subscriber(t,e,r):new i.Subscriber(s.empty)}var i=t("../Subscriber"),o=t("../symbol/rxSubscriber"),s=t("../Observer");r.toSubscriber=n},{"../Observer":32,"../Subscriber":33,"../symbol/rxSubscriber":40}],48:[function(t,e,r){"use strict";function n(){try{return o.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function i(t){return o=t,n}var o,s=t("./errorObject");r.tryCatch=i},{"./errorObject":42}],49:[function(t,e,r){function n(t){return t.replace(/^\s*|\s*$/g,"")}r=e.exports=n,r.left=function(t){return t.replace(/^\s*/,"")},r.right=function(t){return t.replace(/\s*$/,"")}},{}],50:[function(t,e,r){function n(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var n in r)i.call(r,n)&&(t[n]=r[n])}return t}e.exports=n;var i=Object.prototype.hasOwnProperty},{}],51:[function(t,e,r){function n(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)i.call(r,n)&&(t[n]=r[n])}return t}e.exports=n;var i=Object.prototype.hasOwnProperty},{}]},{},[14])(14)});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc