@sanity/client
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -80,4 +80,6 @@ 'use strict'; | ||
module.exports = function httpRequest(options) { | ||
var obs = request(options); | ||
function httpRequest(options) { | ||
var requester = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : request; | ||
var obs = requester(options); | ||
obs.toPromise = function () { | ||
@@ -93,3 +95,7 @@ return new Promise(function (resolve, reject) { | ||
return obs; | ||
}; | ||
} | ||
httpRequest.defaultRequester = request; | ||
module.exports = httpRequest; | ||
//# sourceMappingURL=request.js.map |
@@ -48,3 +48,3 @@ 'use strict'; | ||
requestObservable: function requestObservable(options) { | ||
return httpRequest(mergeOptions(getRequestOptions(this.clientConfig), options, { url: this.getUrl(options.url || options.uri) })); | ||
return httpRequest(mergeOptions(getRequestOptions(this.clientConfig), options, { url: this.getUrl(options.url || options.uri) }), this.clientConfig.requester); | ||
} | ||
@@ -74,4 +74,5 @@ }); | ||
createClient.Transaction = Transaction; | ||
createClient.requester = httpRequest.defaultRequester; | ||
module.exports = createClient; | ||
//# sourceMappingURL=sanityClient.js.map |
{ | ||
"name": "@sanity/client", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Client for retrieving data from Sanity", | ||
@@ -5,0 +5,0 @@ "main": "lib/sanityClient.js", |
@@ -15,2 +15,3 @@ /* eslint-disable strict */ | ||
const validators = require('../src/validators') | ||
const sanityObservable = require('@sanity/observable') | ||
const noop = () => {} // eslint-disable-line no-empty-function | ||
@@ -1020,2 +1021,27 @@ | ||
// Don't rely on this unless you're working at Sanity Inc ;) | ||
test('can use alternative http requester', t => { | ||
const requester = () => sanityObservable.of({ | ||
type: 'response', | ||
body: {documents: [{foo: 'bar'}]} | ||
}) | ||
getClient({requester}).getDocument('foo/bar') | ||
.then(res => { | ||
t.equal(res.foo, 'bar') | ||
t.end() | ||
}) | ||
.catch(err => { | ||
t.ifError(err) | ||
t.fail('should not call catch handler') | ||
t.end() | ||
}) | ||
}) | ||
// Don't rely on this unless you're working at Sanity Inc ;) | ||
test('exposes default requester', t => { | ||
t.equal(typeof sanityClient.requester, 'function') | ||
t.end() | ||
}) | ||
test('handles HTTP errors gracefully', t => { | ||
@@ -1041,3 +1067,3 @@ const doc = {_id: 'foo/bar', visits: 5} | ||
// @todo these tests are failing because `nock` doesn't work well with `nock` | ||
// @todo these tests are failing because `nock` doesn't work well with `timed-out` | ||
test.skip('handles connection timeouts gracefully', t => { | ||
@@ -1064,3 +1090,3 @@ const doc = {_id: 'foo/bar', visits: 5} | ||
// @todo these tests are failing because `nock` doesn't work well with `nock` | ||
// @todo these tests are failing because `nock` doesn't work well with `timed-out` | ||
test.skip('handles socket timeouts gracefully', t => { | ||
@@ -1067,0 +1093,0 @@ const doc = {_id: 'foo/bar', visits: 5} |
@@ -28,3 +28,3 @@ (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){ | ||
},{"../validators":17,"object-assign":42}],10:[function(require,module,exports){ | ||
"use strict";function retry5xx(e){return!!retry.shouldRetry(e)||e.response&&e.response.statusCode>=500}function extractError(e){var r=e.body;return this.response=e,this.statusCode=e.statusCode,this.responseBody=stringifyBody(r,e),r.error&&r.message?void(this.message=r.error+" - "+r.message):r.error&&r.error.description?(this.message=r.error.description,void(this.details=r.error)):void(this.message=r.error||r.message||httpErrorMessage(e))}function httpErrorMessage(e){var r=e.statusMessage?" "+e.statusMessage:"";return e.method+"-request to "+e.url+" resulted in HTTP "+e.statusCode+r}function stringifyBody(e,r){var t=(r.headers["content-type"]||"").toLowerCase(),s=t.indexOf("application/json")!==-1;return s?JSON.stringify(e,null,2):e}var getIt=require("get-it"),createErrorClass=require("create-error-class"),observable=require("get-it/lib/middleware/observable"),retry=require("get-it/lib/middleware/retry"),jsonRequest=require("get-it/lib/middleware/jsonRequest"),jsonResponse=require("get-it/lib/middleware/jsonResponse"),sanityObservable=require("@sanity/observable/minimal"),ClientError=createErrorClass("ClientError",extractError),ServerError=createErrorClass("ServerError",extractError),httpError={onResponse:function(e){if(e.statusCode>=500)throw new ServerError(e);if(e.statusCode>=400)throw new ClientError(e);return e}},middleware=[jsonRequest(),jsonResponse(),httpError,observable({implementation:sanityObservable}),retry({maxRetries:5,shouldRetry:retry5xx})],debug,request=getIt(middleware);module.exports=function(e){var r=request(e);return r.toPromise=function(){return new Promise(function(e,t){r.filter(function(e){return"response"===e.type}).subscribe(function(r){return e(r.body)},t)})},r}; | ||
"use strict";function retry5xx(e){return!!retry.shouldRetry(e)||e.response&&e.response.statusCode>=500}function extractError(e){var r=e.body;return this.response=e,this.statusCode=e.statusCode,this.responseBody=stringifyBody(r,e),r.error&&r.message?void(this.message=r.error+" - "+r.message):r.error&&r.error.description?(this.message=r.error.description,void(this.details=r.error)):void(this.message=r.error||r.message||httpErrorMessage(e))}function httpErrorMessage(e){var r=e.statusMessage?" "+e.statusMessage:"";return e.method+"-request to "+e.url+" resulted in HTTP "+e.statusCode+r}function stringifyBody(e,r){var t=(r.headers["content-type"]||"").toLowerCase(),s=t.indexOf("application/json")!==-1;return s?JSON.stringify(e,null,2):e}function httpRequest(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:request,t=r(e);return t.toPromise=function(){return new Promise(function(e,r){t.filter(function(e){return"response"===e.type}).subscribe(function(r){return e(r.body)},r)})},t}var getIt=require("get-it"),createErrorClass=require("create-error-class"),observable=require("get-it/lib/middleware/observable"),retry=require("get-it/lib/middleware/retry"),jsonRequest=require("get-it/lib/middleware/jsonRequest"),jsonResponse=require("get-it/lib/middleware/jsonResponse"),sanityObservable=require("@sanity/observable/minimal"),ClientError=createErrorClass("ClientError",extractError),ServerError=createErrorClass("ServerError",extractError),httpError={onResponse:function(e){if(e.statusCode>=500)throw new ServerError(e);if(e.statusCode>=400)throw new ClientError(e);return e}},middleware=[jsonRequest(),jsonResponse(),httpError,observable({implementation:sanityObservable}),retry({maxRetries:5,shouldRetry:retry5xx})],debug,request=getIt(middleware);httpRequest.defaultRequester=request,module.exports=httpRequest; | ||
@@ -38,3 +38,3 @@ },{"@sanity/observable/minimal":20,"create-error-class":22,"get-it":26,"get-it/lib/middleware/jsonRequest":28,"get-it/lib/middleware/jsonResponse":29,"get-it/lib/middleware/observable":30,"get-it/lib/middleware/retry":31}],11:[function(require,module,exports){ | ||
},{"object-assign":42}],13:[function(require,module,exports){ | ||
"use strict";function SanityClient(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:defaultConfig;this.config(t),this.assets=new AssetsClient(this),this.datasets=new DatasetsClient(this),this.projects=new ProjectsClient(this),this.users=new UsersClient(this),this.auth=new AuthClient(this)}function mergeOptions(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=e.reduce(function(t,e){return t||e.headers?assign(t||{},e.headers||{}):null},null);return assign.apply(void 0,e.concat([n?{headers:n}:{}]))}function createClient(t){return new SanityClient(t)}var assign=require("object-assign"),Patch=require("./data/patch"),Transaction=require("./data/transaction"),dataMethods=require("./data/dataMethods"),DatasetsClient=require("./datasets/datasetsClient"),ProjectsClient=require("./projects/projectsClient"),AssetsClient=require("./assets/assetsClient"),UsersClient=require("./users/usersClient"),AuthClient=require("./auth/authClient"),httpRequest=require("./http/request"),getRequestOptions=require("./http/requestOptions"),_require=require("./config"),defaultConfig=_require.defaultConfig,initConfig=_require.initConfig;assign(SanityClient.prototype,dataMethods),assign(SanityClient.prototype,{config:function(t){return"undefined"==typeof t?assign({},this.clientConfig):(this.clientConfig=initConfig(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 httpRequest(mergeOptions(getRequestOptions(this.clientConfig),t,{url:this.getUrl(t.url||t.uri)}))}}),createClient.Patch=Patch,createClient.Transaction=Transaction,module.exports=createClient; | ||
"use strict";function SanityClient(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:defaultConfig;this.config(e),this.assets=new AssetsClient(this),this.datasets=new DatasetsClient(this),this.projects=new ProjectsClient(this),this.users=new UsersClient(this),this.auth=new AuthClient(this)}function mergeOptions(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=t.reduce(function(e,t){return e||t.headers?assign(e||{},t.headers||{}):null},null);return assign.apply(void 0,t.concat([n?{headers:n}:{}]))}function createClient(e){return new SanityClient(e)}var assign=require("object-assign"),Patch=require("./data/patch"),Transaction=require("./data/transaction"),dataMethods=require("./data/dataMethods"),DatasetsClient=require("./datasets/datasetsClient"),ProjectsClient=require("./projects/projectsClient"),AssetsClient=require("./assets/assetsClient"),UsersClient=require("./users/usersClient"),AuthClient=require("./auth/authClient"),httpRequest=require("./http/request"),getRequestOptions=require("./http/requestOptions"),_require=require("./config"),defaultConfig=_require.defaultConfig,initConfig=_require.initConfig;assign(SanityClient.prototype,dataMethods),assign(SanityClient.prototype,{config:function(e){return"undefined"==typeof e?assign({},this.clientConfig):(this.clientConfig=initConfig(e,this.clientConfig||{}),this)},getUrl:function(e){return this.clientConfig.url+"/"+e.replace(/^\//,"")},request:function(e){return this.requestObservable(e).toPromise()},requestObservable:function(e){return httpRequest(mergeOptions(getRequestOptions(this.clientConfig),e,{url:this.getUrl(e.url||e.uri)}),this.clientConfig.requester)}}),createClient.Patch=Patch,createClient.Transaction=Transaction,createClient.requester=httpRequest.defaultRequester,module.exports=createClient; | ||
},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":10,"./http/requestOptions":11,"./projects/projectsClient":12,"./users/usersClient":14,"object-assign":42}],14:[function(require,module,exports){ | ||
@@ -55,2 +55,3 @@ "use strict";function UsersClient(e){this.client=e}var assign=require("object-assign");assign(UsersClient.prototype,{getById:function(e){return this.client.request({uri:"/users/"+e})}}),module.exports=UsersClient; | ||
"use strict";function SanityObservableMinimal(){Observable.apply(this,arguments)}var _require=require("rxjs/Observable"),Observable=_require.Observable,_require2=require("rxjs/operator/map"),map=_require2.map,_require3=require("rxjs/operator/filter"),filter=_require3.filter,_require4=require("rxjs/operator/reduce"),reduce=_require4.reduce,_require5=require("rxjs/operator/toPromise"),toPromise=_require5.toPromise,assign=require("object-assign");SanityObservableMinimal.prototype=Object.create(assign(Object.create(null),Observable.prototype)),Object.defineProperty(SanityObservableMinimal.prototype,"constructor",{value:SanityObservableMinimal,enumerable:!1,writable:!0,configurable:!0}),SanityObservableMinimal.prototype.lift=function(e){var r=new SanityObservableMinimal;return r.source=this,r.operator=e,r},SanityObservableMinimal.prototype.map=map,SanityObservableMinimal.prototype.filter=filter,SanityObservableMinimal.prototype.reduce=reduce,SanityObservableMinimal.prototype.toPromise=toPromise,module.exports=SanityObservableMinimal; | ||
},{"object-assign":42,"rxjs/Observable":46,"rxjs/operator/filter":50,"rxjs/operator/map":51,"rxjs/operator/reduce":52,"rxjs/operator/toPromise":53}],20:[function(require,module,exports){ | ||
@@ -60,6 +61,4 @@ module.exports=require("./lib/SanityObservableMinimal"); | ||
"use strict";module.exports=Error.captureStackTrace||function(r){var e=new Error;Object.defineProperty(r,"stack",{configurable:!0,get:function(){var r=e.stack;return Object.defineProperty(this,"stack",{value:r}),r}})}; | ||
},{}],22:[function(require,module,exports){ | ||
"use strict";function inherits(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}var captureStackTrace=require("capture-stack-trace");module.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(e))throw new Error("className contains invalid characters");t=t||function(e){this.message=e};var r=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),captureStackTrace(this,this.constructor),t.apply(this,arguments)};return inherits(r,Error),r}; | ||
},{"capture-stack-trace":21}],23:[function(require,module,exports){ | ||
@@ -69,5 +68,5 @@ "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}; | ||
!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); | ||
},{}],25:[function(require,module,exports){ | ||
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; | ||
},{"is-function":37}],26:[function(require,module,exports){ | ||
@@ -87,3 +86,2 @@ "use strict";var pubsub=require("nano-pubsub"),middlewareReducer=require("./util/middlewareReducer"),processOptions=require("./middleware/defaultOptionsProcessor"),httpRequest=require("./request"),channelNames=["request","response","progress","error","abort"],middlehooks=["processOptions","onRequest","onResponse","onError","onReturn","onHeaders"];module.exports=function e(){function r(e){function r(e,r,t){var s=e,u=r;if(!s)try{u=n("onResponse",r,t)}catch(e){u=null,s=e}s=s&&n("onError",s,t),s?o.error.publish(s):u&&o.response.publish(u)}var o=channelNames.reduce(function(e,r){return e[r]=pubsub(),e},{}),n=middlewareReducer(t),s=n("processOptions",e),u={options:s,channels:o,applyMiddleware:n},i=null,a=o.request.subscribe(function(e){i=httpRequest(e,function(o,n){return r(o,n,e)})});o.abort.subscribe(function(){a(),i&&i.abort()});var d=n("onReturn",o,u);return d===o&&o.request.publish(u),d}var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=[],t=middlehooks.reduce(function(e,r){return e[r]=e[r]||[],e},{processOptions:[processOptions]});return r.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&t.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");middlehooks.forEach(function(r){e[r]&&t[r].push(e[r])}),n.push(e)},r.clone=function(){return e(n)},o.forEach(r.use),r}; | ||
"use strict";var global=require("../util/global"),objectAssign=require("object-assign");module.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.implementation||global.Observable;if(!r)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(e,n){return new r(function(r){return e.error.subscribe(function(e){return r.error(e)}),e.progress.subscribe(function(e){return r.next(objectAssign({type:"progress"},e))}),e.response.subscribe(function(e){r.next(objectAssign({type:"response"},e)),r.complete()}),e.request.publish(n),function(){return e.abort.publish()}})}}}; | ||
},{"../util/global":35,"object-assign":42}],31:[function(require,module,exports){ | ||
@@ -110,3 +108,2 @@ "use strict";function getRetryDelay(e){return 100*Math.pow(2,e)+100*Math.random()}var objectAssign=require("object-assign"),defaultShouldRetry=require("../util/node-shouldRetry"),retry=module.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxRetries||5,r=e.retryDelay||getRetryDelay,u=e.shouldRetry||defaultShouldRetry;return{onError:function(e,o){var n=o.options,s=n.maxRetries||t,i=n.shouldRetry||u,l=n.attemptNumber||0;if(!i(e,l)||l>=s)return e;var a=objectAssign({},o,{options:objectAssign({},n,{attemptNumber:l+1})});return setTimeout(function(){return o.channels.request.publish(a)},r(l)),null}}};retry.shouldRetry=defaultShouldRetry; | ||
function isFunction(o){var t=toString.call(o);return"[object Function]"===t||"function"==typeof o&&"[object RegExp]"!==t||"undefined"!=typeof window&&(o===window.setTimeout||o===window.alert||o===window.confirm||o===window.prompt)}module.exports=isFunction;var toString=Object.prototype.toString; | ||
},{}],38:[function(require,module,exports){ | ||
@@ -121,2 +118,3 @@ "use strict";module.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}; | ||
module.exports=function(){function n(n){return r.push(n),function(){var u=r.indexOf(n);u>-1&&r.splice(u,1)}}function u(){for(var n=0;n<r.length;n++)r[n].apply(null,arguments)}var r=[];return{subscribe:n,publish:u}}; | ||
},{}],42:[function(require,module,exports){ | ||
@@ -126,6 +124,4 @@ "use strict";function toObject(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;var n=Object.getOwnPropertyNames(r).map(function(e){return r[e]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){t=Object(arguments[a]);for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);if(Object.getOwnPropertySymbols){n=Object.getOwnPropertySymbols(t);for(var s=0;s<n.length;s++)propIsEnumerable.call(t,n[s])&&(o[n[s]]=t[n[s]])}}return o}; | ||
var trim=require("trim"),forEach=require("for-each"),isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(r){if(!r)return{};var e={};return forEach(trim(r).split("\n"),function(r){var t=r.indexOf(":"),i=trim(r.slice(0,t)).toLowerCase(),o=trim(r.slice(t+1));"undefined"==typeof e[i]?e[i]=o:isArray(e[i])?e[i].push(o):e[i]=[e[i],o]}),e}; | ||
},{"for-each":25,"trim":66}],44:[function(require,module,exports){ | ||
"use strict";function querystring(e){for(var r,n=/([^=?&]+)=?([^&]*)/g,t={};r=n.exec(e);t[decodeURIComponent(r[1])]=decodeURIComponent(r[2]));return t}function querystringify(e,r){r=r||"";var n=[];"string"!=typeof r&&(r="?");for(var t in e)has.call(e,t)&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return n.length?r+n.join("&"):""}var has=Object.prototype.hasOwnProperty;exports.stringify=querystringify,exports.parse=querystring; | ||
},{}],45:[function(require,module,exports){ | ||
@@ -136,2 +132,3 @@ "use strict";module.exports=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}; | ||
"use strict";var root_1=require("./util/root"),toSubscriber_1=require("./util/toSubscriber"),observable_1=require("./symbol/observable"),Observable=function(){function r(r){this._isScalar=!1,r&&(this._subscribe=r)}return r.prototype.lift=function(o){var t=new r;return t.source=this,t.operator=o,t},r.prototype.subscribe=function(r,o,t){var e=this.operator,s=toSubscriber_1.toSubscriber(r,o,t);if(e?e.call(s,this.source):s.add(this._subscribe(s)),s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s},r.prototype.forEach=function(r,o){var t=this;if(o||(root_1.root.Rx&&root_1.root.Rx.config&&root_1.root.Rx.config.Promise?o=root_1.root.Rx.config.Promise:root_1.root.Promise&&(o=root_1.root.Promise)),!o)throw new Error("no Promise impl found");return new o(function(o,e){var s=t.subscribe(function(o){if(s)try{r(o)}catch(r){e(r),s.unsubscribe()}else r(o)},e,o)})},r.prototype._subscribe=function(r){return this.source.subscribe(r)},r.prototype[observable_1.$$observable]=function(){return this},r.create=function(o){return new r(o)},r}();exports.Observable=Observable; | ||
},{"./symbol/observable":54,"./util/root":61,"./util/toSubscriber":62}],47:[function(require,module,exports){ | ||
@@ -149,5 +146,5 @@ "use strict";exports.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}; | ||
"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":48}],52:[function(require,module,exports){ | ||
"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; | ||
},{"../Subscriber":48}],53:[function(require,module,exports){ | ||
@@ -189,3 +186,2 @@ "use strict";function toPromise(o){var r=this;if(o||(root_1.root.Rx&&root_1.root.Rx.config&&root_1.root.Rx.config.Promise?o=root_1.root.Rx.config.Promise:root_1.root.Promise&&(o=root_1.root.Promise)),!o)throw new Error("no Promise impl found");return new o(function(o,t){var i;r.subscribe(function(o){return i=o},function(o){return t(o)},function(){return o(i)})})}var root_1=require("../util/root");exports.toPromise=toPromise; | ||
"use strict";var url=require("url");module.exports=function(o,r,t){if(o===r)return!0;var p=url.parse(o,!1,!0),e=url.parse(r,!1,!0),s=0|p.port||("https"===p.protocol?443:80),u=0|e.port||("https"===e.protocol?443:80),l={proto:p.protocol===e.protocol,hostname:p.hostname===e.hostname,port:s===u};return l.proto&&l.hostname&&(l.port||t)}; | ||
},{"url":65}],65:[function(require,module,exports){ | ||
@@ -195,2 +191,3 @@ "use strict";var regex=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;module.exports={regex:regex,parse:function(e){var o=regex.exec(e);return o?{protocol:(o[1]||"").toLowerCase()||void 0,hostname:(o[5]||"").toLowerCase()||void 0,port:o[6]||void 0}:{}}}; | ||
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*$/,"")}; | ||
},{}],67:[function(require,module,exports){ | ||
@@ -201,4 +198,5 @@ "use strict";function extractProtocol(o){var t=protocolre.exec(o);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function resolve(o,t){for(var e=(t||"/").split("/").slice(0,-1).concat(o.split("/")),r=e.length,s=e[r-1],a=!1,l=0;r--;)"."===e[r]?e.splice(r,1):".."===e[r]?(e.splice(r,1),l++):l&&(0===r&&(a=!0),e.splice(r,1),l--);return a&&e.unshift(""),"."!==s&&".."!==s||e.push(""),e.join("/")}function URL(o,t,e){if(!(this instanceof URL))return new URL(o,t,e);var r,s,a,l,n,c,h=rules.slice(),i=typeof t,p=this,u=0;for("object"!==i&&"string"!==i&&(e=t,t=null),e&&"function"!=typeof e&&(e=qs.parse),t=lolcation(t),s=extractProtocol(o||""),r=!s.protocol&&!s.slashes,p.slashes=s.slashes||r&&t.slashes,p.protocol=s.protocol||t.protocol||"",o=s.rest,s.slashes||(h[2]=[/(.*)/,"pathname"]);u<h.length;u++)l=h[u],a=l[0],c=l[1],a!==a?p[c]=o:"string"==typeof a?~(n=o.indexOf(a))&&("number"==typeof l[2]?(p[c]=o.slice(0,n),o=o.slice(n+l[2])):(p[c]=o.slice(n),o=o.slice(0,n))):(n=a.exec(o))&&(p[c]=n[1],o=o.slice(0,n.index)),p[c]=p[c]||(r&&l[3]?t[c]||"":""),l[4]&&(p[c]=p[c].toLowerCase());e&&(p.query=e(p.query)),r&&t.slashes&&"/"!==p.pathname.charAt(0)&&(""!==p.pathname||""!==t.pathname)&&(p.pathname=resolve(p.pathname,t.pathname)),required(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(l=p.auth.split(":"),p.username=l[0]||"",p.password=l[1]||""),p.origin=p.protocol&&p.host&&"file:"!==p.protocol?p.protocol+"//"+p.host:"null",p.href=p.toString()}var required=require("requires-port"),lolcation=require("./lolcation"),qs=require("querystringify"),protocolre=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,rules=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]];URL.prototype.set=function(o,t,e){var r=this;switch(o){case"query":"string"==typeof t&&t.length&&(t=(e||qs.parse)(t)),r[o]=t;break;case"port":r[o]=t,required(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[o]="");break;case"hostname":r[o]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[o]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!e;break;case"pathname":r.pathname=t.length&&"/"!==t.charAt(0)?"/"+t:t;break;default:r[o]=t}for(var s=0;s<rules.length;s++){var a=rules[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin=r.protocol&&r.host&&"file:"!==r.protocol?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},URL.prototype.toString=function(o){o&&"function"==typeof o||(o=qs.stringify);var t,e=this,r=e.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var s=r+(e.slashes?"//":"");return e.username&&(s+=e.username,e.password&&(s+=":"+e.password),s+="@"),s+=e.host+e.pathname,t="object"==typeof e.query?o(e.query):e.query,t&&(s+="?"!==t.charAt(0)?"?"+t:t),e.hash&&(s+=e.hash),s},URL.extractProtocol=extractProtocol,URL.location=lolcation,URL.qs=qs,module.exports=URL; | ||
"use strict";var slashes=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,ignore={hash:1,query:1},URL;module.exports=function(e){e=e||global.location||{},URL=URL||require("./");var s,o={},r=typeof e;if("blob:"===e.protocol)o=new URL(unescape(e.pathname),{});else if("string"===r){o=new URL(e,{});for(s in ignore)delete o[s]}else if("object"===r){for(s in e)s in ignore||(o[s]=e[s]);void 0===o.slashes&&(o.slashes=slashes.test(e.href))}return o}; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./":67}]},{},[13])(13) | ||
}); |
@@ -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 o(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return o(r?r:t)},l,l.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign"),i=t("../validators"),s={image:"images",file:"files"};o(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.validateAssetType(t);var n=i.hasDataset(this.client.clientConfig),o="contentType"in r?{"Content-Type":r.contentType}:{},a=s[t],u=r.label?{label:r.label}:{},c="/assets/"+a+"/"+n;return this.client.requestObservable({method:"POST",timeout:0,query:u,headers:o,uri:c,body:e})}}),e.exports=n},{"../validators":17,"object-assign":42}],2:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"object-assign":42}],3:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("./validators"),i=r.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};r.initConfig=function(t,e){var r=n({},i,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&&o.projectId(r.projectId),r.dataset&&o.dataset(r.dataset),r.gradientMode)r.url=r.apiHost;else{var a=r.apiHost.split("://",2),u=a[0],c=a[1];r.useProjectHostname?r.url=u+"://"+r.projectId+"."+c+"/v1":r.url=r.apiHost+"/v1"}return r}},{"./validators":17,"object-assign":42}],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 o=t("object-assign"),i=t("../validators"),s=t("./encodeQueryString"),a=t("./transaction"),u=t("./patch"),c=t("./listen"),l=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:l(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).replace(/\/($|\?)/,"$1")},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 u(t,e,this)},delete:function(t,e){return i.validateDocumentId("delete",t),this.dataRequest("mutate",{mutations:[{delete:{id:t}}]},e)},mutate:function(t,e){var r=t instanceof u?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new a(t,this)},dataRequest:function(t,e){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a="mutate"===t,u=!a&&s(e),c=!a&&u.length<h,l=c?u:"",p=o.returnFirst;return i.promise.hasDataset(this.clientConfig).then(function(n){return r.request({method:c?"GET":"POST",uri:r.getDataUrl(t,""+n+l),json:!0,body:c?void 0:e,query:a&&f(o)})}).then(function(t){if(!a)return t;var e=t.results||[];if(o.returnDocuments)return p?e[0]&&e[0].document:e.map(function(t){return t.document});var r=p?"documentId":"documentIds",i=p?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId,results:e},r,i)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=i.hasDataset(this.clientConfig),a=n({},e,o({},t,{_id:t._id||s+"/"})),u=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[a]},u)}}},{"../validators":17,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"object-assign":42}],5:[function(t,e,r){"use strict";var n=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,o=void 0===r?{}:r,i=t.options,s=void 0===i?{}:i,a=Object.keys(o).reduce(function(t,e){return t+"&"+n("$"+e)+"="+n(JSON.stringify(o[e]))},"?query="+n(e));return Object.keys(s).reduce(function(t,e){return s[e]?t+"&"+n(e)+"="+n(s[e]):t},a)}},{}],6:[function(t,e,r){"use strict";function n(t){try{var e=t.data&&JSON.parse(t.data)||{};return i({type:t.type},e)}catch(t){return t}}function o(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 i=t("object-assign"),s=t("@sanity/observable/minimal"),a=t("./encodeQueryString"),u=t("../validators"),c=t("../util/pick"),l=t("../util/defaults"),f="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=l(r,d),y=c(b,p),v=a({query:t,params:e,options:y}),m=u.hasDataset(this.clientConfig),g=this.getDataUrl("listen",""+m+v),w=this.clientConfig.token,O=b.events?b.events:["mutation"],j=O.indexOf("reconnect")!==-1,x=new f(g,i({withCredentials:!0},w?{headers:{"Sanity-Token":w}}:{}));return new s(function(t){function e(){x.readyState===f.CLOSED?t.complete():x.readyState===f.CONNECTING&&u()}function r(e){t.error(o(e))}function i(e){var r=n(e);return r instanceof Error?t.error(r):t.next(r)}function s(e){t.complete(),a()}function a(){O.forEach(function(t){return h(x,t,i)}),h(x,"error",e),h(x,"channelError",r),h(x,"disconnect",s),x.close()}function u(){j&&t.next({type:"reconnect"})}return x.addEventListener("error",e,!1),x.addEventListener("channelError",r,!1),x.addEventListener("disconnect",s,!1),O.forEach(function(t){return x.addEventListener(t,i,!1)}),a})}},{"../util/defaults":15,"../util/pick":16,"../validators":17,"./encodeQueryString":5,"@sanity/eventsource":18,"@sanity/observable/minimal":20,"object-assign":42}],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 o(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=a({},e),this.client=r}function i(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"),a=t("object-assign"),u=t("../validators"),c=u.validateObject,l=u.validateInsert;a(o.prototype,{clone:function(){return new o(this.selection,a({},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=a({},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 o;return l(t,e,r),this._assign("insert",(o={},n(o,t,e),n(o,"items",r),o))},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 o="undefined"==typeof r||r===-1,i=e<0?e-1:e,s=o?-1:Math.max(0,e+r),a=i<0&&s>=0?"":s,u=t+"["+i+":"+a+"]";return this.insert("replace",u,n||[])},serialize:function(){return a(i(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=a({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=a({},this.operations,n({},t,a({},r&&this.operations[t]||{},e))),this}}),e.exports=o},{"../validators":17,"deep-assign":23,"object-assign":42}],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 o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];this.operations=t,this.client=e}var i=t("object-assign"),s=t("../validators"),a=t("./patch"),u={returnDocuments:!1};i(o.prototype,{clone:function(){return new o(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,o=e instanceof a;if(o)return this._add({patch:e.serialize()});if(n){var t=r(new a(e,{},this.client));if(!(t instanceof a))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:t.serialize()})}return this._add({patch:i({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||u)},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),o=n({},e,i({},t,{_id:t._id||r+"/"}));return this._add(o)},_add:function(t){return this.operations.push(t),this}}),e.exports=o},{"../validators":17,"./patch":7,"object-assign":42}],9:[function(t,e,r){"use strict";function n(t){this.request=t.request.bind(t)}var o=t("object-assign"),i=t("../validators");o(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 i.dataset(e),this.request({method:t,uri:"/datasets/"+e})}}),e.exports=n},{"../validators":17,"object-assign":42}],10:[function(t,e,r){"use strict";function n(t){return!!l.shouldRetry(t)||t.response&&t.response.statusCode>=500}function o(t){var e=t.body;return this.response=t,this.statusCode=t.statusCode,this.responseBody=s(e,t),e.error&&e.message?void(this.message=e.error+" - "+e.message):e.error&&e.error.description?(this.message=e.error.description,void(this.details=e.error)):void(this.message=e.error||e.message||i(t))}function i(t){var e=t.statusMessage?" "+t.statusMessage:"";return t.method+"-request to "+t.url+" resulted in HTTP "+t.statusCode+e}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 a=t("get-it"),u=t("create-error-class"),c=t("get-it/lib/middleware/observable"),l=t("get-it/lib/middleware/retry"),f=t("get-it/lib/middleware/jsonRequest"),h=t("get-it/lib/middleware/jsonResponse"),p=t("@sanity/observable/minimal"),d=u("ClientError",o),b=u("ServerError",o),y={onResponse:function(t){if(t.statusCode>=500)throw new b(t);if(t.statusCode>=400)throw new d(t);return t}},v=[f(),h(),y,c({implementation:p}),l({maxRetries:5,shouldRetry:n})],m=a(v);e.exports=function(t){var e=m(t);return e.toPromise=function(){return new Promise(function(t,r){e.filter(function(t){return"response"===t.type}).subscribe(function(e){return t(e.body)},r)})},e}},{"@sanity/observable/minimal":20,"create-error-class":22,"get-it":26,"get-it/lib/middleware/jsonRequest":28,"get-it/lib/middleware/jsonResponse":29,"get-it/lib/middleware/observable":30,"get-it/lib/middleware/retry":31}],11:[function(t,e,r){"use strict";var n="Sanity-Token",o="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[o]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:3e4,withCredentials:!0,json:!0}}},{}],12:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"object-assign":42}],13:[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 l(this),this.projects=new f(this),this.users=new p(this),this.auth=new d(this)}function o(){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 i(t){return new n(t)}var s=t("object-assign"),a=t("./data/patch"),u=t("./data/transaction"),c=t("./data/dataMethods"),l=t("./datasets/datasetsClient"),f=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(o(y(this.clientConfig),t,{url:this.getUrl(t.url||t.uri)}))}}),i.Patch=a,i.Transaction=u,e.exports=i},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":10,"./http/requestOptions":11,"./projects/projectsClient":12,"./users/usersClient":14,"object-assign":42}],14:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"object-assign":42}],15:[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},{})}},{}],16:[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)},{})}},{}],17:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=["image","file"],i=["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(o.indexOf(t)===-1)throw new Error("Invalid asset type: "+t+". Must be one of "+o.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(i.indexOf(t)===-1){var o=i.map(function(t){return'"'+t+'"'}).join(", ");throw new Error(n+' takes an "at"-argument which is one of: '+o)}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.gradientMode&&!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))})}}},{}],18:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":24}],19:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var o=t("rxjs/Observable"),i=o.Observable,s=t("rxjs/operator/map"),a=s.map,u=t("rxjs/operator/filter"),c=u.filter,l=t("rxjs/operator/reduce"),f=l.reduce,h=t("rxjs/operator/toPromise"),p=h.toPromise,d=t("object-assign");n.prototype=Object.create(d(Object.create(null),i.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=a,n.prototype.filter=c,n.prototype.reduce=f,n.prototype.toPromise=p,e.exports=n},{"object-assign":42,"rxjs/Observable":46,"rxjs/operator/filter":50,"rxjs/operator/map":51,"rxjs/operator/reduce":52,"rxjs/operator/toPromise":53}],20:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":19}],21:[function(t,e,r){"use strict";e.exports=Error.captureStackTrace||function(t){var e=new Error;Object.defineProperty(t,"stack",{configurable:!0,get:function(){var t=e.stack;return Object.defineProperty(this,"stack",{value:t}),t}})}},{}],22:[function(t,e,r){"use strict";function n(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}var o=t("capture-stack-trace");e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(t))throw new Error("className contains invalid characters");e=e||function(t){this.message=t};var r=function(){Object.defineProperty(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor),e.apply(this,arguments)};return n(r,Error),r}},{"capture-stack-trace":21}],23:[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 o(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(a.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");a.call(t,r)&&s(n)?t[r]=i(Object(t[r]),e[r]):t[r]=n}}function i(t,e){if(t===e)return t;e=Object(e);for(var r in e)a.call(e,r)&&o(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)u.call(e,n[i])&&o(t,e,n[i]);return t}var s=t("is-obj"),a=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)i(t,arguments[e]);return t}},{"is-obj":38}],24:[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",o=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(o.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],o=e.substring(this.cursor,n);this.parseStream(o),this.cursor=n}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){t=this.cache+this.normalizeToLF(t);var r,n,o,i,s,a,u=t.split("\n\n");for(r=0;r<u.length-1;r++){for(o="message",i=[],parts=u[r].split("\n"),n=0;n<parts.length;n++)s=this.trimWhiteSpace(parts[n]),0==s.indexOf("event")?o=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(a=parseInt(s.replace(/retry:?\s*/,"")),isNaN(a)||(this.interval=a)):0==s.indexOf("data")?i.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(i.length){var c=new e(o,i.join("\n"),window.location.origin,this.lastEventId);this.dispatchEvent(o,c)}}this.cache=u[u.length-1]},dispatchEvent:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=0;n<r.length;n++)r[n].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=r.length-1;n>=0;--n)if(r[n]===e){r.splice(n,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var r=[];if(e){var n,o,i=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(o=i(n)+"="+i(e[n]),r.push(o))}return r.length>0?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()){o.isPolyfill="IE_8-9";var i=o.prototype.defaultOptions;i.xhrHeaders=null,i.getArgs.evs_preamble=2056,o.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()},o.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 o.isPolyfill="XHR",o.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()},o.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]=o}}(this)},{}],25:[function(t,e,r){function n(t,e,r){if(!a(e))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===u.call(t)?o(t,e,r):"string"==typeof t?i(t,e,r):s(t,e,r)}function o(t,e,r){for(var n=0,o=t.length;n<o;n++)c.call(t,n)&&e.call(r,t[n],n,t)}function i(t,e,r){for(var n=0,o=t.length;n<o;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 a=t("is-function");e.exports=n;var u=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":37}],26:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./request"),a=["request","response","progress","error","abort"],u=["processOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){function e(t){function e(t,e,n){var o=t,s=e;if(!o)try{s=i("onResponse",e,n)}catch(t){s=null,o=t}o=o&&i("onError",o,n),o?r.error.publish(o):s&&r.response.publish(s)}var r=a.reduce(function(t,e){return t[e]=n(),t},{}),i=o(l),u=i("processOptions",t),c={options:u,channels:r,applyMiddleware:i},f=null,h=r.request.subscribe(function(t){f=s(t,function(r,n){return e(r,n,t)})});r.abort.subscribe(function(){h(),f&&f.abort()});var p=i("onReturn",r,c);return p===r&&r.request.publish(c),p}var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],c=[],l=u.reduce(function(t,e){return t[e]=t[e]||[],t},{processOptions:[i]});return e.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&l.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");u.forEach(function(e){t[e]&&l[e].push(t[e])}),c.push(t)},e.clone=function(){return t(c)},r.forEach(e.use),e}},{"./middleware/defaultOptionsProcessor":27,"./request":33,"./util/middlewareReducer":36,"nano-pubsub":41}],27:[function(t,e,r){"use strict";function n(t){if(t===!1||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?n(a.timeout):{connect:e,socket:e}}function o(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}var i=t("object-assign"),s=t("url-parse"),a={timeout:12e4};e.exports=function(t){var e="string"==typeof t?i({url:t},a):i({},a,t),r=s(e.url,{},!0);return e.timeout=n(e.timeout),e.query&&(r.query=i({},r.query,o(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(),e}},{"object-assign":42,"url-parse":67}],28:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"];e.exports=function(){return{processOptions:function(t){var e=t.body,r=s.indexOf("undefined"==typeof e?"undefined":n(e))!==-1||Array.isArray(e)||i(e)||e&&"function"==typeof e.toJSON;return r?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":39,"object-assign":42}],29:[function(t,e,r){"use strict";function n(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: "+t.message,t}}var o=t("object-assign");e.exports=function(){return{onResponse:function(t){var e=t.headers["content-type"];return t.body&&e&&e.indexOf("application/json")!==-1?o({},t,{body:n(t.body)}):t},processOptions:function(t){return o({},t,{headers:o({Accept:"application/json"},t.headers)})}}}},{"object-assign":42}],30:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.implementation||n.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(t,r){return new e(function(e){return t.error.subscribe(function(t){return e.error(t)}),t.progress.subscribe(function(t){return e.next(o({type:"progress"},t))}),t.response.subscribe(function(t){e.next(o({type:"response"},t)),e.complete(); | ||
}),t.request.publish(r),function(){return t.abort.publish()}})}}}},{"../util/global":35,"object-assign":42}],31:[function(t,e,r){"use strict";function n(t){return 100*Math.pow(2,t)+100*Math.random()}var o=t("object-assign"),i=t("../util/node-shouldRetry"),s=e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.maxRetries||5,r=t.retryDelay||n,s=t.shouldRetry||i;return{onError:function(t,n){var i=n.options,a=i.maxRetries||e,u=i.shouldRetry||s,c=i.attemptNumber||0;if(!u(t,c)||c>=a)return t;var l=o({},n,{options:o({},i,{attemptNumber:c+1})});return setTimeout(function(){return n.channels.request.publish(l)},r(c)),null}}};s.shouldRetry=i},{"../util/node-shouldRetry":34,"object-assign":42}],32:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=function(){},s=window,a=s.XMLHttpRequest||i,u="withCredentials"in new a,c=u?a:s.XDomainRequest,l="xhr";e.exports=function(t,e){function r(){O=!0,m.abort()}function i(e){x=!0,m.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+b.url:"Connection timed out on request to "+b.url);r.code=e,t.channels.error.publish(r)}function u(){S&&(f(),v.socket=setTimeout(function(){return i("ESOCKETTIMEDOUT")},S.socket))}function f(){(O||m.readyState>=2&&v.connect)&&clearTimeout(v.connect),v.socket&&clearTimeout(v.socket)}function h(){if(!j){f(),j=!0,m=null;var t=new Error("Network error while attempting to reach "+b.url);t.isNetworkError=!0,t.request=b,e(t)}}function p(){var t=m.status,e=m.statusText;if(g&&void 0===t)t=200;else{if(t>12e3&&t<12156)return h();t=1223===m.status?204:m.status,e=1223===m.status?"No Content":e}return{body:m.response||m.responseText,url:b.url,method:b.method,headers:g?{}:o(m.getAllResponseHeaders()),statusCode:t,statusMessage:e}}function d(){if(!(O||j||x)){if(0===m.status)return void h(new Error("Unknown XHR error"));f(),j=!0,e(null,p())}}var b=t.options,y=!n(s.location.href,b.url),v={},m=y?new c:new a,g=s.XDomainRequest&&m instanceof s.XDomainRequest,w=b.headers,O=!1,j=!1,x=!1;m.onerror=h,m.ontimeout=h,m.onabort=function(){O=!0},m.onprogress=function(){};var _=g?"onload":"onreadystatechange";if(m[_]=function(){u(),O||4!==m.readyState&&!g||0!==m.status&&d()},m.open(b.method,b.url,!0),m.withCredentials=!!b.withCredentials,w&&m.setRequestHeader)for(var E in w)w.hasOwnProperty(E)&&m.setRequestHeader(E,w[E]);else if(w&&g)throw new Error("Headers cannot be set on an XDomainRequest object");b.rawBody&&(m.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:b,adapter:l,request:m,context:t}),m.send(b.body||null);var S=b.timeout;return S&&(v.connect=setTimeout(function(){return i("ETIMEDOUT")},S.connect)),{abort:r}}},{"parse-headers":43,"same-origin":64}],33:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":32}],34:[function(t,e,r){"use strict";e.exports=function(t){return t.isNetworkError||!1}},{}],35:[function(t,e,r){(function(t){"use strict";"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:{})},{}],36:[function(t,e,r){"use strict";e.exports=function(t){var e=function(e,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return t[e].reduce(function(t,e){return e.apply(void 0,[t].concat(o))},r)};return e}},{}],37:[function(t,e,r){function n(t){var e=o.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 o=Object.prototype.toString},{}],38:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],39:[function(t,e,r){"use strict";function n(t){return o(t)===!0&&"[object Object]"===Object.prototype.toString.call(t)}var o=t("isobject");e.exports=function(t){var e,r;return n(t)!==!1&&(e=t.constructor,"function"==typeof e&&(r=e.prototype,n(r)!==!1&&r.hasOwnProperty("isPrototypeOf")!==!1))}},{isobject:40}],40:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}},{}],41:[function(t,e,r){e.exports=function(){function t(t){return r.push(t),function(){var e=r.indexOf(t);e>-1&&r.splice(e,1)}}function e(){for(var t=0;t<r.length;t++)r[t].apply(null,arguments)}var r=[];return{subscribe:t,publish:e}}},{}],42:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var r,o,a=n(t),u=1;u<arguments.length;u++){r=Object(arguments[u]);for(var c in r)i.call(r,c)&&(a[c]=r[c]);if(Object.getOwnPropertySymbols){o=Object.getOwnPropertySymbols(r);for(var l=0;l<o.length;l++)s.call(r,o[l])&&(a[o[l]]=r[o[l]])}}return a}},{}],43:[function(t,e,r){var n=t("trim"),o=t("for-each"),i=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};var e={};return o(n(t).split("\n"),function(t){var r=t.indexOf(":"),o=n(t.slice(0,r)).toLowerCase(),s=n(t.slice(r+1));"undefined"==typeof e[o]?e[o]=s:i(e[o])?e[o].push(s):e[o]=[e[o],s]}),e}},{"for-each":25,trim:66}],44:[function(t,e,r){"use strict";function n(t){for(var e,r=/([^=?&]+)=?([^&]*)/g,n={};e=r.exec(t);n[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return n}function o(t,e){e=e||"";var r=[];"string"!=typeof e&&(e="?");for(var n in t)i.call(t,n)&&r.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return r.length?e+r.join("&"):""}var i=Object.prototype.hasOwnProperty;r.stringify=o,r.parse=n},{}],45:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],46:[function(t,e,r){"use strict";var n=t("./util/root"),o=t("./util/toSubscriber"),i=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,i=o.toSubscriber(t,e,r);if(n?n.call(i,this.source):i.add(this._subscribe(i)),i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},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 o=r.subscribe(function(e){if(o)try{t(e)}catch(t){n(t),o.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[i.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":54,"./util/root":61,"./util/toSubscriber":62}],47:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],48:[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)},o=t("./util/isFunction"),i=t("./Subscription"),s=t("./Observer"),a=t("./symbol/rxSubscriber"),u=function(t){function e(r,n,o){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,o)}}return n(e,t),e.prototype[a.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e}(i.Subscription);r.Subscriber=u;var c=function(t){function e(e,r,n,i){t.call(this),this._parent=e;var s,a=this;o.isFunction(r)?s=r:r&&(a=r,s=r.next,n=r.error,i=r.complete,o.isFunction(a.unsubscribe)&&this.add(a.unsubscribe.bind(a)),a.unsubscribe=this.unsubscribe.bind(this)),this._context=a,this._next=s,this._error=n,this._complete=i}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}(u)},{"./Observer":47,"./Subscription":49,"./symbol/rxSubscriber":55,"./util/isFunction":59}],49:[function(t,e,r){"use strict";var n=t("./util/isArray"),o=t("./util/isObject"),i=t("./util/isFunction"),s=t("./util/tryCatch"),a=t("./util/errorObject"),u=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,l=r._subscriptions;if(this._subscriptions=null,i.isFunction(c)){var f=s.tryCatch(c).call(this);f===a.errorObject&&(e=!0,(t=t||[]).push(a.errorObject.e))}if(n.isArray(l))for(var h=-1,p=l.length;++h<p;){var d=l[h];if(o.isObject(d)){var f=s.tryCatch(d.unsubscribe).call(d);if(f===a.errorObject){e=!0,t=t||[];var b=a.errorObject.e;b instanceof u.UnsubscriptionError?t=t.concat(b.errors):t.push(b)}}}if(e)throw new u.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":56,"./util/errorObject":57,"./util/isArray":58,"./util/isFunction":59,"./util/isObject":60,"./util/tryCatch":63}],50:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}var o=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("../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 a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":48}],51:[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 o=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("../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 a(t,this.project,this.thisArg))},t}();r.MapOperator=s;var a=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":48}],52:[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 o=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("../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 a(t,this.accumulator,this.seed,this.hasSeed))},t}();r.ReduceOperator=s;var a=function(t){function e(e,r,n,o){t.call(this,e),this.accumulator=r,this.hasSeed=o,this.hasValue=!1,this.acc=n}return o(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}(i.Subscriber);r.ReduceSubscriber=a},{"../Subscriber":48}],53:[function(t,e,r){"use strict";function n(t){var e=this;if(t||(o.root.Rx&&o.root.Rx.config&&o.root.Rx.config.Promise?t=o.root.Rx.config.Promise:o.root.Promise&&(t=o.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 o=t("../util/root");r.toPromise=n},{"../util/root":61}],54:[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 o=t("../util/root");r.getSymbolObservable=n,r.$$observable=n(o.root)},{"../util/root":61}],55:[function(t,e,r){"use strict";var n=t("../util/root"),o=n.root.Symbol;r.$$rxSubscriber="function"==typeof o&&"function"==typeof o.for?o.for("rxSubscriber"):"@@rxSubscriber"},{"../util/root":61}],56:[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)},o=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=o},{}],57:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],58:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],59:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],60:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],61:[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:{})},{}],62:[function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof o.Subscriber)return t;if(t[i.$$rxSubscriber])return t[i.$$rxSubscriber]()}return t||e||r?new o.Subscriber(t,e,r):new o.Subscriber(s.empty)}var o=t("../Subscriber"),i=t("../symbol/rxSubscriber"),s=t("../Observer");r.toSubscriber=n},{"../Observer":47,"../Subscriber":48,"../symbol/rxSubscriber":55}],63:[function(t,e,r){"use strict";function n(){try{return i.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function o(t){return i=t,n}var i,s=t("./errorObject");r.tryCatch=o},{"./errorObject":57}],64:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!1,!0),s=0|o.port||("https"===o.protocol?443:80),a=0|i.port||("https"===i.protocol?443:80),u={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===a};return u.proto&&u.hostname&&(u.port||r)}},{url:65}],65:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],66:[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*$/,"")}},{}],67:[function(t,e,r){"use strict";function n(t){var e=c.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function o(t,e){for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}function i(t,e,r){if(!(this instanceof i))return new i(t,e,r);var c,f,h,p,d,b,y=l.slice(),v=typeof e,m=this,g=0;for("object"!==v&&"string"!==v&&(r=e,e=null),r&&"function"!=typeof r&&(r=u.parse),e=a(e),f=n(t||""),c=!f.protocol&&!f.slashes,m.slashes=f.slashes||c&&e.slashes,m.protocol=f.protocol||e.protocol||"",t=f.rest,f.slashes||(y[2]=[/(.*)/,"pathname"]);g<y.length;g++)p=y[g],h=p[0],b=p[1],h!==h?m[b]=t:"string"==typeof h?~(d=t.indexOf(h))&&("number"==typeof p[2]?(m[b]=t.slice(0,d),t=t.slice(d+p[2])):(m[b]=t.slice(d),t=t.slice(0,d))):(d=h.exec(t))&&(m[b]=d[1],t=t.slice(0,d.index)),m[b]=m[b]||(c&&p[3]?e[b]||"":""),p[4]&&(m[b]=m[b].toLowerCase());r&&(m.query=r(m.query)),c&&e.slashes&&"/"!==m.pathname.charAt(0)&&(""!==m.pathname||""!==e.pathname)&&(m.pathname=o(m.pathname,e.pathname)),s(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(p=m.auth.split(":"),m.username=p[0]||"",m.password=p[1]||""),m.origin=m.protocol&&m.host&&"file:"!==m.protocol?m.protocol+"//"+m.host:"null",m.href=m.toString()}var s=t("requires-port"),a=t("./lolcation"),u=t("querystringify"),c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]];i.prototype.set=function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||u.parse)(e)),n[t]=e;break;case"port":n[t]=e,s(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,/:\d+$/.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":n.pathname=e.length&&"/"!==e.charAt(0)?"/"+e:e;break;default:n[t]=e}for(var o=0;o<l.length;o++){var i=l[o];i[4]&&(n[i[1]]=n[i[1]].toLowerCase())}return n.origin=n.protocol&&n.host&&"file:"!==n.protocol?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},i.prototype.toString=function(t){t&&"function"==typeof t||(t=u.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var o=n+(r.slashes?"//":"");return r.username&&(o+=r.username,r.password&&(o+=":"+r.password),o+="@"),o+=r.host+r.pathname,e="object"==typeof r.query?t(r.query):r.query,e&&(o+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(o+=r.hash),o},i.extractProtocol=n,i.location=a,i.qs=u,e.exports=i},{"./lolcation":68,querystringify:44,"requires-port":45}],68:[function(t,e,r){(function(r){"use strict";var n,o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,i={hash:1,query:1};e.exports=function(e){e=e||r.location||{},n=n||t("./");var s,a={},u=typeof e;if("blob:"===e.protocol)a=new n(unescape(e.pathname),{});else if("string"===u){a=new n(e,{});for(s in i)delete a[s]}else if("object"===u){for(s in e)s in i||(a[s]=e[s]);void 0===a.slashes&&(a.slashes=o.test(e.href))}return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":67}]},{},[13])(13)}); | ||
!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 o(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return o(r?r:t)},l,l.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign"),i=t("../validators"),s={image:"images",file:"files"};o(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.validateAssetType(t);var n=i.hasDataset(this.client.clientConfig),o="contentType"in r?{"Content-Type":r.contentType}:{},a=s[t],u=r.label?{label:r.label}:{},c="/assets/"+a+"/"+n;return this.client.requestObservable({method:"POST",timeout:0,query:u,headers:o,uri:c,body:e})}}),e.exports=n},{"../validators":17,"object-assign":42}],2:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"object-assign":42}],3:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("./validators"),i=r.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};r.initConfig=function(t,e){var r=n({},i,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&&o.projectId(r.projectId),r.dataset&&o.dataset(r.dataset),r.gradientMode)r.url=r.apiHost;else{var a=r.apiHost.split("://",2),u=a[0],c=a[1];r.useProjectHostname?r.url=u+"://"+r.projectId+"."+c+"/v1":r.url=r.apiHost+"/v1"}return r}},{"./validators":17,"object-assign":42}],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 o=t("object-assign"),i=t("../validators"),s=t("./encodeQueryString"),a=t("./transaction"),u=t("./patch"),c=t("./listen"),l=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:l(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).replace(/\/($|\?)/,"$1")},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 u(t,e,this)},delete:function(t,e){return i.validateDocumentId("delete",t),this.dataRequest("mutate",{mutations:[{delete:{id:t}}]},e)},mutate:function(t,e){var r=t instanceof u?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new a(t,this)},dataRequest:function(t,e){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a="mutate"===t,u=!a&&s(e),c=!a&&u.length<h,l=c?u:"",p=o.returnFirst;return i.promise.hasDataset(this.clientConfig).then(function(n){return r.request({method:c?"GET":"POST",uri:r.getDataUrl(t,""+n+l),json:!0,body:c?void 0:e,query:a&&f(o)})}).then(function(t){if(!a)return t;var e=t.results||[];if(o.returnDocuments)return p?e[0]&&e[0].document:e.map(function(t){return t.document});var r=p?"documentId":"documentIds",i=p?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId,results:e},r,i)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=i.hasDataset(this.clientConfig),a=n({},e,o({},t,{_id:t._id||s+"/"})),u=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[a]},u)}}},{"../validators":17,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"object-assign":42}],5:[function(t,e,r){"use strict";var n=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,o=void 0===r?{}:r,i=t.options,s=void 0===i?{}:i,a=Object.keys(o).reduce(function(t,e){return t+"&"+n("$"+e)+"="+n(JSON.stringify(o[e]))},"?query="+n(e));return Object.keys(s).reduce(function(t,e){return s[e]?t+"&"+n(e)+"="+n(s[e]):t},a)}},{}],6:[function(t,e,r){"use strict";function n(t){try{var e=t.data&&JSON.parse(t.data)||{};return i({type:t.type},e)}catch(t){return t}}function o(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 i=t("object-assign"),s=t("@sanity/observable/minimal"),a=t("./encodeQueryString"),u=t("../validators"),c=t("../util/pick"),l=t("../util/defaults"),f="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=l(r,d),y=c(b,p),v=a({query:t,params:e,options:y}),m=u.hasDataset(this.clientConfig),g=this.getDataUrl("listen",""+m+v),w=this.clientConfig.token,O=b.events?b.events:["mutation"],j=O.indexOf("reconnect")!==-1,x=new f(g,i({withCredentials:!0},w?{headers:{"Sanity-Token":w}}:{}));return new s(function(t){function e(){x.readyState===f.CLOSED?t.complete():x.readyState===f.CONNECTING&&u()}function r(e){t.error(o(e))}function i(e){var r=n(e);return r instanceof Error?t.error(r):t.next(r)}function s(e){t.complete(),a()}function a(){O.forEach(function(t){return h(x,t,i)}),h(x,"error",e),h(x,"channelError",r),h(x,"disconnect",s),x.close()}function u(){j&&t.next({type:"reconnect"})}return x.addEventListener("error",e,!1),x.addEventListener("channelError",r,!1),x.addEventListener("disconnect",s,!1),O.forEach(function(t){return x.addEventListener(t,i,!1)}),a})}},{"../util/defaults":15,"../util/pick":16,"../validators":17,"./encodeQueryString":5,"@sanity/eventsource":18,"@sanity/observable/minimal":20,"object-assign":42}],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 o(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=a({},e),this.client=r}function i(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"),a=t("object-assign"),u=t("../validators"),c=u.validateObject,l=u.validateInsert;a(o.prototype,{clone:function(){return new o(this.selection,a({},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=a({},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 o;return l(t,e,r),this._assign("insert",(o={},n(o,t,e),n(o,"items",r),o))},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 o="undefined"==typeof r||r===-1,i=e<0?e-1:e,s=o?-1:Math.max(0,e+r),a=i<0&&s>=0?"":s,u=t+"["+i+":"+a+"]";return this.insert("replace",u,n||[])},serialize:function(){return a(i(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=a({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=a({},this.operations,n({},t,a({},r&&this.operations[t]||{},e))),this}}),e.exports=o},{"../validators":17,"deep-assign":23,"object-assign":42}],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 o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];this.operations=t,this.client=e}var i=t("object-assign"),s=t("../validators"),a=t("./patch"),u={returnDocuments:!1};i(o.prototype,{clone:function(){return new o(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,o=e instanceof a;if(o)return this._add({patch:e.serialize()});if(n){var t=r(new a(e,{},this.client));if(!(t instanceof a))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:t.serialize()})}return this._add({patch:i({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||u)},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),o=n({},e,i({},t,{_id:t._id||r+"/"}));return this._add(o)},_add:function(t){return this.operations.push(t),this}}),e.exports=o},{"../validators":17,"./patch":7,"object-assign":42}],9:[function(t,e,r){"use strict";function n(t){this.request=t.request.bind(t)}var o=t("object-assign"),i=t("../validators");o(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 i.dataset(e),this.request({method:t,uri:"/datasets/"+e})}}),e.exports=n},{"../validators":17,"object-assign":42}],10:[function(t,e,r){"use strict";function n(t){return!!f.shouldRetry(t)||t.response&&t.response.statusCode>=500}function o(t){var e=t.body;return this.response=t,this.statusCode=t.statusCode,this.responseBody=s(e,t),e.error&&e.message?void(this.message=e.error+" - "+e.message):e.error&&e.error.description?(this.message=e.error.description,void(this.details=e.error)):void(this.message=e.error||e.message||i(t))}function i(t){var e=t.statusMessage?" "+t.statusMessage:"";return t.method+"-request to "+t.url+" resulted in HTTP "+t.statusCode+e}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}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g,r=e(t);return r.toPromise=function(){return new Promise(function(t,e){r.filter(function(t){return"response"===t.type}).subscribe(function(e){return t(e.body)},e)})},r}var u=t("get-it"),c=t("create-error-class"),l=t("get-it/lib/middleware/observable"),f=t("get-it/lib/middleware/retry"),h=t("get-it/lib/middleware/jsonRequest"),p=t("get-it/lib/middleware/jsonResponse"),d=t("@sanity/observable/minimal"),b=c("ClientError",o),y=c("ServerError",o),v={onResponse:function(t){if(t.statusCode>=500)throw new y(t);if(t.statusCode>=400)throw new b(t);return t}},m=[h(),p(),v,l({implementation:d}),f({maxRetries:5,shouldRetry:n})],g=u(m);a.defaultRequester=g,e.exports=a},{"@sanity/observable/minimal":20,"create-error-class":22,"get-it":26,"get-it/lib/middleware/jsonRequest":28,"get-it/lib/middleware/jsonResponse":29,"get-it/lib/middleware/observable":30,"get-it/lib/middleware/retry":31}],11:[function(t,e,r){"use strict";var n="Sanity-Token",o="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[o]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:3e4,withCredentials:!0,json:!0}}},{}],12:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"object-assign":42}],13:[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 l(this),this.projects=new f(this),this.users=new p(this),this.auth=new d(this)}function o(){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 i(t){return new n(t)}var s=t("object-assign"),a=t("./data/patch"),u=t("./data/transaction"),c=t("./data/dataMethods"),l=t("./datasets/datasetsClient"),f=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(o(y(this.clientConfig),t,{url:this.getUrl(t.url||t.uri)}),this.clientConfig.requester)}}),i.Patch=a,i.Transaction=u,i.requester=b.defaultRequester,e.exports=i},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":10,"./http/requestOptions":11,"./projects/projectsClient":12,"./users/usersClient":14,"object-assign":42}],14:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"object-assign":42}],15:[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},{})}},{}],16:[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)},{})}},{}],17:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=["image","file"],i=["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(o.indexOf(t)===-1)throw new Error("Invalid asset type: "+t+". Must be one of "+o.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(i.indexOf(t)===-1){var o=i.map(function(t){return'"'+t+'"'}).join(", ");throw new Error(n+' takes an "at"-argument which is one of: '+o)}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.gradientMode&&!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))})}}},{}],18:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":24}],19:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var o=t("rxjs/Observable"),i=o.Observable,s=t("rxjs/operator/map"),a=s.map,u=t("rxjs/operator/filter"),c=u.filter,l=t("rxjs/operator/reduce"),f=l.reduce,h=t("rxjs/operator/toPromise"),p=h.toPromise,d=t("object-assign");n.prototype=Object.create(d(Object.create(null),i.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=a,n.prototype.filter=c,n.prototype.reduce=f,n.prototype.toPromise=p,e.exports=n},{"object-assign":42,"rxjs/Observable":46,"rxjs/operator/filter":50,"rxjs/operator/map":51,"rxjs/operator/reduce":52,"rxjs/operator/toPromise":53}],20:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":19}],21:[function(t,e,r){"use strict";e.exports=Error.captureStackTrace||function(t){var e=new Error;Object.defineProperty(t,"stack",{configurable:!0,get:function(){var t=e.stack;return Object.defineProperty(this,"stack",{value:t}),t}})}},{}],22:[function(t,e,r){"use strict";function n(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}var o=t("capture-stack-trace");e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(t))throw new Error("className contains invalid characters");e=e||function(t){this.message=t};var r=function(){Object.defineProperty(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor),e.apply(this,arguments)};return n(r,Error),r}},{"capture-stack-trace":21}],23:[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 o(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(a.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");a.call(t,r)&&s(n)?t[r]=i(Object(t[r]),e[r]):t[r]=n}}function i(t,e){if(t===e)return t;e=Object(e);for(var r in e)a.call(e,r)&&o(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)u.call(e,n[i])&&o(t,e,n[i]);return t}var s=t("is-obj"),a=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)i(t,arguments[e]);return t}},{"is-obj":38}],24:[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",o=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(o.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],o=e.substring(this.cursor,n);this.parseStream(o),this.cursor=n}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){t=this.cache+this.normalizeToLF(t);var r,n,o,i,s,a,u=t.split("\n\n");for(r=0;r<u.length-1;r++){for(o="message",i=[],parts=u[r].split("\n"),n=0;n<parts.length;n++)s=this.trimWhiteSpace(parts[n]),0==s.indexOf("event")?o=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(a=parseInt(s.replace(/retry:?\s*/,"")),isNaN(a)||(this.interval=a)):0==s.indexOf("data")?i.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(i.length){var c=new e(o,i.join("\n"),window.location.origin,this.lastEventId);this.dispatchEvent(o,c)}}this.cache=u[u.length-1]},dispatchEvent:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=0;n<r.length;n++)r[n].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=r.length-1;n>=0;--n)if(r[n]===e){r.splice(n,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var r=[];if(e){var n,o,i=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(o=i(n)+"="+i(e[n]),r.push(o))}return r.length>0?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()){o.isPolyfill="IE_8-9";var i=o.prototype.defaultOptions;i.xhrHeaders=null,i.getArgs.evs_preamble=2056,o.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()},o.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 o.isPolyfill="XHR",o.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()},o.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]=o}}(this)},{}],25:[function(t,e,r){function n(t,e,r){if(!a(e))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===u.call(t)?o(t,e,r):"string"==typeof t?i(t,e,r):s(t,e,r)}function o(t,e,r){for(var n=0,o=t.length;n<o;n++)c.call(t,n)&&e.call(r,t[n],n,t)}function i(t,e,r){for(var n=0,o=t.length;n<o;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 a=t("is-function");e.exports=n;var u=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":37}],26:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./request"),a=["request","response","progress","error","abort"],u=["processOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){function e(t){function e(t,e,n){var o=t,s=e;if(!o)try{s=i("onResponse",e,n)}catch(t){s=null,o=t}o=o&&i("onError",o,n),o?r.error.publish(o):s&&r.response.publish(s)}var r=a.reduce(function(t,e){return t[e]=n(),t},{}),i=o(l),u=i("processOptions",t),c={options:u,channels:r,applyMiddleware:i},f=null,h=r.request.subscribe(function(t){f=s(t,function(r,n){return e(r,n,t)})});r.abort.subscribe(function(){h(),f&&f.abort()});var p=i("onReturn",r,c);return p===r&&r.request.publish(c),p}var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],c=[],l=u.reduce(function(t,e){return t[e]=t[e]||[],t},{processOptions:[i]});return e.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&l.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");u.forEach(function(e){t[e]&&l[e].push(t[e])}),c.push(t)},e.clone=function(){return t(c)},r.forEach(e.use),e}},{"./middleware/defaultOptionsProcessor":27,"./request":33,"./util/middlewareReducer":36,"nano-pubsub":41}],27:[function(t,e,r){"use strict";function n(t){if(t===!1||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?n(a.timeout):{connect:e,socket:e}}function o(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}var i=t("object-assign"),s=t("url-parse"),a={timeout:12e4};e.exports=function(t){var e="string"==typeof t?i({url:t},a):i({},a,t),r=s(e.url,{},!0);return e.timeout=n(e.timeout),e.query&&(r.query=i({},r.query,o(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(),e}},{"object-assign":42,"url-parse":67}],28:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"];e.exports=function(){return{processOptions:function(t){var e=t.body,r=s.indexOf("undefined"==typeof e?"undefined":n(e))!==-1||Array.isArray(e)||i(e)||e&&"function"==typeof e.toJSON;return r?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":39,"object-assign":42}],29:[function(t,e,r){"use strict";function n(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: "+t.message,t}}var o=t("object-assign");e.exports=function(){return{onResponse:function(t){var e=t.headers["content-type"];return t.body&&e&&e.indexOf("application/json")!==-1?o({},t,{body:n(t.body)}):t},processOptions:function(t){return o({},t,{headers:o({Accept:"application/json"},t.headers)})}}}},{"object-assign":42}],30:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.implementation||n.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(t,r){return new e(function(e){return t.error.subscribe(function(t){return e.error(t)}),t.progress.subscribe(function(t){ | ||
return e.next(o({type:"progress"},t))}),t.response.subscribe(function(t){e.next(o({type:"response"},t)),e.complete()}),t.request.publish(r),function(){return t.abort.publish()}})}}}},{"../util/global":35,"object-assign":42}],31:[function(t,e,r){"use strict";function n(t){return 100*Math.pow(2,t)+100*Math.random()}var o=t("object-assign"),i=t("../util/node-shouldRetry"),s=e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.maxRetries||5,r=t.retryDelay||n,s=t.shouldRetry||i;return{onError:function(t,n){var i=n.options,a=i.maxRetries||e,u=i.shouldRetry||s,c=i.attemptNumber||0;if(!u(t,c)||c>=a)return t;var l=o({},n,{options:o({},i,{attemptNumber:c+1})});return setTimeout(function(){return n.channels.request.publish(l)},r(c)),null}}};s.shouldRetry=i},{"../util/node-shouldRetry":34,"object-assign":42}],32:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=function(){},s=window,a=s.XMLHttpRequest||i,u="withCredentials"in new a,c=u?a:s.XDomainRequest,l="xhr";e.exports=function(t,e){function r(){O=!0,m.abort()}function i(e){x=!0,m.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+b.url:"Connection timed out on request to "+b.url);r.code=e,t.channels.error.publish(r)}function u(){S&&(f(),v.socket=setTimeout(function(){return i("ESOCKETTIMEDOUT")},S.socket))}function f(){(O||m.readyState>=2&&v.connect)&&clearTimeout(v.connect),v.socket&&clearTimeout(v.socket)}function h(){if(!j){f(),j=!0,m=null;var t=new Error("Network error while attempting to reach "+b.url);t.isNetworkError=!0,t.request=b,e(t)}}function p(){var t=m.status,e=m.statusText;if(g&&void 0===t)t=200;else{if(t>12e3&&t<12156)return h();t=1223===m.status?204:m.status,e=1223===m.status?"No Content":e}return{body:m.response||m.responseText,url:b.url,method:b.method,headers:g?{}:o(m.getAllResponseHeaders()),statusCode:t,statusMessage:e}}function d(){if(!(O||j||x)){if(0===m.status)return void h(new Error("Unknown XHR error"));f(),j=!0,e(null,p())}}var b=t.options,y=!n(s.location.href,b.url),v={},m=y?new c:new a,g=s.XDomainRequest&&m instanceof s.XDomainRequest,w=b.headers,O=!1,j=!1,x=!1;m.onerror=h,m.ontimeout=h,m.onabort=function(){O=!0},m.onprogress=function(){};var _=g?"onload":"onreadystatechange";if(m[_]=function(){u(),O||4!==m.readyState&&!g||0!==m.status&&d()},m.open(b.method,b.url,!0),m.withCredentials=!!b.withCredentials,w&&m.setRequestHeader)for(var E in w)w.hasOwnProperty(E)&&m.setRequestHeader(E,w[E]);else if(w&&g)throw new Error("Headers cannot be set on an XDomainRequest object");b.rawBody&&(m.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:b,adapter:l,request:m,context:t}),m.send(b.body||null);var S=b.timeout;return S&&(v.connect=setTimeout(function(){return i("ETIMEDOUT")},S.connect)),{abort:r}}},{"parse-headers":43,"same-origin":64}],33:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":32}],34:[function(t,e,r){"use strict";e.exports=function(t){return t.isNetworkError||!1}},{}],35:[function(t,e,r){(function(t){"use strict";"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:{})},{}],36:[function(t,e,r){"use strict";e.exports=function(t){var e=function(e,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return t[e].reduce(function(t,e){return e.apply(void 0,[t].concat(o))},r)};return e}},{}],37:[function(t,e,r){function n(t){var e=o.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 o=Object.prototype.toString},{}],38:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],39:[function(t,e,r){"use strict";function n(t){return o(t)===!0&&"[object Object]"===Object.prototype.toString.call(t)}var o=t("isobject");e.exports=function(t){var e,r;return n(t)!==!1&&(e=t.constructor,"function"==typeof e&&(r=e.prototype,n(r)!==!1&&r.hasOwnProperty("isPrototypeOf")!==!1))}},{isobject:40}],40:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}},{}],41:[function(t,e,r){e.exports=function(){function t(t){return r.push(t),function(){var e=r.indexOf(t);e>-1&&r.splice(e,1)}}function e(){for(var t=0;t<r.length;t++)r[t].apply(null,arguments)}var r=[];return{subscribe:t,publish:e}}},{}],42:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var r,o,a=n(t),u=1;u<arguments.length;u++){r=Object(arguments[u]);for(var c in r)i.call(r,c)&&(a[c]=r[c]);if(Object.getOwnPropertySymbols){o=Object.getOwnPropertySymbols(r);for(var l=0;l<o.length;l++)s.call(r,o[l])&&(a[o[l]]=r[o[l]])}}return a}},{}],43:[function(t,e,r){var n=t("trim"),o=t("for-each"),i=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};var e={};return o(n(t).split("\n"),function(t){var r=t.indexOf(":"),o=n(t.slice(0,r)).toLowerCase(),s=n(t.slice(r+1));"undefined"==typeof e[o]?e[o]=s:i(e[o])?e[o].push(s):e[o]=[e[o],s]}),e}},{"for-each":25,trim:66}],44:[function(t,e,r){"use strict";function n(t){for(var e,r=/([^=?&]+)=?([^&]*)/g,n={};e=r.exec(t);n[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return n}function o(t,e){e=e||"";var r=[];"string"!=typeof e&&(e="?");for(var n in t)i.call(t,n)&&r.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return r.length?e+r.join("&"):""}var i=Object.prototype.hasOwnProperty;r.stringify=o,r.parse=n},{}],45:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],46:[function(t,e,r){"use strict";var n=t("./util/root"),o=t("./util/toSubscriber"),i=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,i=o.toSubscriber(t,e,r);if(n?n.call(i,this.source):i.add(this._subscribe(i)),i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},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 o=r.subscribe(function(e){if(o)try{t(e)}catch(t){n(t),o.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[i.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":54,"./util/root":61,"./util/toSubscriber":62}],47:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],48:[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)},o=t("./util/isFunction"),i=t("./Subscription"),s=t("./Observer"),a=t("./symbol/rxSubscriber"),u=function(t){function e(r,n,o){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,o)}}return n(e,t),e.prototype[a.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e}(i.Subscription);r.Subscriber=u;var c=function(t){function e(e,r,n,i){t.call(this),this._parent=e;var s,a=this;o.isFunction(r)?s=r:r&&(a=r,s=r.next,n=r.error,i=r.complete,o.isFunction(a.unsubscribe)&&this.add(a.unsubscribe.bind(a)),a.unsubscribe=this.unsubscribe.bind(this)),this._context=a,this._next=s,this._error=n,this._complete=i}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}(u)},{"./Observer":47,"./Subscription":49,"./symbol/rxSubscriber":55,"./util/isFunction":59}],49:[function(t,e,r){"use strict";var n=t("./util/isArray"),o=t("./util/isObject"),i=t("./util/isFunction"),s=t("./util/tryCatch"),a=t("./util/errorObject"),u=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,l=r._subscriptions;if(this._subscriptions=null,i.isFunction(c)){var f=s.tryCatch(c).call(this);f===a.errorObject&&(e=!0,(t=t||[]).push(a.errorObject.e))}if(n.isArray(l))for(var h=-1,p=l.length;++h<p;){var d=l[h];if(o.isObject(d)){var f=s.tryCatch(d.unsubscribe).call(d);if(f===a.errorObject){e=!0,t=t||[];var b=a.errorObject.e;b instanceof u.UnsubscriptionError?t=t.concat(b.errors):t.push(b)}}}if(e)throw new u.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":56,"./util/errorObject":57,"./util/isArray":58,"./util/isFunction":59,"./util/isObject":60,"./util/tryCatch":63}],50:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}var o=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("../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 a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":48}],51:[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 o=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("../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 a(t,this.project,this.thisArg))},t}();r.MapOperator=s;var a=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":48}],52:[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 o=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("../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 a(t,this.accumulator,this.seed,this.hasSeed))},t}();r.ReduceOperator=s;var a=function(t){function e(e,r,n,o){t.call(this,e),this.accumulator=r,this.hasSeed=o,this.hasValue=!1,this.acc=n}return o(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}(i.Subscriber);r.ReduceSubscriber=a},{"../Subscriber":48}],53:[function(t,e,r){"use strict";function n(t){var e=this;if(t||(o.root.Rx&&o.root.Rx.config&&o.root.Rx.config.Promise?t=o.root.Rx.config.Promise:o.root.Promise&&(t=o.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 o=t("../util/root");r.toPromise=n},{"../util/root":61}],54:[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 o=t("../util/root");r.getSymbolObservable=n,r.$$observable=n(o.root)},{"../util/root":61}],55:[function(t,e,r){"use strict";var n=t("../util/root"),o=n.root.Symbol;r.$$rxSubscriber="function"==typeof o&&"function"==typeof o.for?o.for("rxSubscriber"):"@@rxSubscriber"},{"../util/root":61}],56:[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)},o=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=o},{}],57:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],58:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],59:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],60:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],61:[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:{})},{}],62:[function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof o.Subscriber)return t;if(t[i.$$rxSubscriber])return t[i.$$rxSubscriber]()}return t||e||r?new o.Subscriber(t,e,r):new o.Subscriber(s.empty)}var o=t("../Subscriber"),i=t("../symbol/rxSubscriber"),s=t("../Observer");r.toSubscriber=n},{"../Observer":47,"../Subscriber":48,"../symbol/rxSubscriber":55}],63:[function(t,e,r){"use strict";function n(){try{return i.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function o(t){return i=t,n}var i,s=t("./errorObject");r.tryCatch=o},{"./errorObject":57}],64:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!1,!0),s=0|o.port||("https"===o.protocol?443:80),a=0|i.port||("https"===i.protocol?443:80),u={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===a};return u.proto&&u.hostname&&(u.port||r)}},{url:65}],65:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],66:[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*$/,"")}},{}],67:[function(t,e,r){"use strict";function n(t){var e=c.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function o(t,e){for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}function i(t,e,r){if(!(this instanceof i))return new i(t,e,r);var c,f,h,p,d,b,y=l.slice(),v=typeof e,m=this,g=0;for("object"!==v&&"string"!==v&&(r=e,e=null),r&&"function"!=typeof r&&(r=u.parse),e=a(e),f=n(t||""),c=!f.protocol&&!f.slashes,m.slashes=f.slashes||c&&e.slashes,m.protocol=f.protocol||e.protocol||"",t=f.rest,f.slashes||(y[2]=[/(.*)/,"pathname"]);g<y.length;g++)p=y[g],h=p[0],b=p[1],h!==h?m[b]=t:"string"==typeof h?~(d=t.indexOf(h))&&("number"==typeof p[2]?(m[b]=t.slice(0,d),t=t.slice(d+p[2])):(m[b]=t.slice(d),t=t.slice(0,d))):(d=h.exec(t))&&(m[b]=d[1],t=t.slice(0,d.index)),m[b]=m[b]||(c&&p[3]?e[b]||"":""),p[4]&&(m[b]=m[b].toLowerCase());r&&(m.query=r(m.query)),c&&e.slashes&&"/"!==m.pathname.charAt(0)&&(""!==m.pathname||""!==e.pathname)&&(m.pathname=o(m.pathname,e.pathname)),s(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(p=m.auth.split(":"),m.username=p[0]||"",m.password=p[1]||""),m.origin=m.protocol&&m.host&&"file:"!==m.protocol?m.protocol+"//"+m.host:"null",m.href=m.toString()}var s=t("requires-port"),a=t("./lolcation"),u=t("querystringify"),c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]];i.prototype.set=function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||u.parse)(e)),n[t]=e;break;case"port":n[t]=e,s(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,/:\d+$/.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":n.pathname=e.length&&"/"!==e.charAt(0)?"/"+e:e;break;default:n[t]=e}for(var o=0;o<l.length;o++){var i=l[o];i[4]&&(n[i[1]]=n[i[1]].toLowerCase())}return n.origin=n.protocol&&n.host&&"file:"!==n.protocol?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},i.prototype.toString=function(t){t&&"function"==typeof t||(t=u.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var o=n+(r.slashes?"//":"");return r.username&&(o+=r.username,r.password&&(o+=":"+r.password),o+="@"),o+=r.host+r.pathname,e="object"==typeof r.query?t(r.query):r.query,e&&(o+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(o+=r.hash),o},i.extractProtocol=n,i.location=a,i.qs=u,e.exports=i},{"./lolcation":68,querystringify:44,"requires-port":45}],68:[function(t,e,r){(function(r){"use strict";var n,o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,i={hash:1,query:1};e.exports=function(e){e=e||r.location||{},n=n||t("./");var s,a={},u=typeof e;if("blob:"===e.protocol)a=new n(unescape(e.pathname),{});else if("string"===u){a=new n(e,{});for(s in i)delete a[s]}else if("object"===u){for(s in e)s in i||(a[s]=e[s]);void 0===a.slashes&&(a.slashes=o.test(e.href))}return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":67}]},{},[13])(13)}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
402305
2385