@sanity/client 5.0.0-esm.1 → 5.0.0-esm.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +244 -170
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +244 -170
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +245 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +128 -154
- package/dist/index.js +245 -171
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/SanityClient.ts +11 -77
- package/src/auth/AuthClient.ts +13 -9
- package/src/data/dataMethods.ts +29 -4
- package/src/data/listen.ts +4 -3
- package/src/datasets/DatasetsClient.ts +73 -57
- package/src/projects/ProjectsClient.ts +37 -23
- package/src/users/UsersClient.ts +37 -28
- package/umd/sanityClient.js +244 -170
- package/umd/sanityClient.min.js +3 -3
package/umd/sanityClient.min.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function s(e){try{return encodeURIComponent(e)}catch(e){return null}}n.stringify=function(e,t){t=t||"";var n,o,i=[];for(o in"string"!=typeof t&&(t="?"),e)if(r.call(e,o)){if((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=s(o),n=s(n),null===o||null===n)continue;i.push(o+"="+n)}return i.length?t+i.join("&"):""},n.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var s=o(t[1]),i=o(t[2]);null===s||null===i||s in r||(r[s]=i)}return r};var i=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},a=n,c=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,u=/[\n\r\t]/g,l=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,h=/:\d+$/,d=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,p=/^[a-zA-Z]:/;function f(e){return(e||"").toString().replace(c,"")}var y=[["#","hash"],["?","query"],function(e,t){return v(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],m={hash:1,query:1};function g(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(e=e||r);if("blob:"===e.protocol)o=new b(unescape(e.pathname),{});else if("string"===s)for(n in o=new b(e,{}),m)delete o[n];else if("object"===s){for(n in e)n in m||(o[n]=e[n]);void 0===o.slashes&&(o.slashes=l.test(e.href))}return o}function v(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function w(e,t){e=(e=f(e)).replace(u,""),t=t||{};var n,r=d.exec(e),o=r[1]?r[1].toLowerCase():"",s=!!r[2],i=!!r[3],a=0;return s?i?(n=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(n=r[2]+r[4],a=r[2].length):i?(n=r[3]+r[4],a=r[3].length):n=r[4],"file:"===o?a>=2&&(n=n.slice(2)):v(o)?n=r[4]:o?s&&(n=n.slice(2)):a>=2&&v(t.protocol)&&(n=r[4]),{protocol:o,slashes:s||v(o),slashesCount:a,rest:n}}function b(e,t,n){if(e=(e=f(e)).replace(u,""),!(this instanceof b))return new b(e,t,n);var r,o,s,c,l,h,d=y.slice(),m=typeof t,C=this,E=0;for("object"!==m&&"string"!==m&&(n=t,t=null),n&&"function"!=typeof n&&(n=a.parse),r=!(o=w(e||"",t=g(t))).protocol&&!o.slashes,C.slashes=o.slashes||r&&t.slashes,C.protocol=o.protocol||t.protocol||"",e=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||p.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!v(C.protocol)))&&(d[3]=[/(.*)/,"pathname"]);E<d.length;E++)"function"!=typeof(c=d[E])?(s=c[0],h=c[1],s!=s?C[h]=e:"string"==typeof s?~(l="@"===s?e.lastIndexOf(s):e.indexOf(s))&&("number"==typeof c[2]?(C[h]=e.slice(0,l),e=e.slice(l+c[2])):(C[h]=e.slice(l),e=e.slice(0,l))):(l=s.exec(e))&&(C[h]=l[1],e=e.slice(0,l.index)),C[h]=C[h]||r&&c[3]&&t[h]||"",c[4]&&(C[h]=C[h].toLowerCase())):e=c(e,C);n&&(C.query=n(C.query)),r&&t.slashes&&"/"!==C.pathname.charAt(0)&&(""!==C.pathname||""!==t.pathname)&&(C.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,o=n[r-1],s=!1,i=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),i++):i&&(0===r&&(s=!0),n.splice(r,1),i--);return s&&n.unshift(""),"."!==o&&".."!==o||n.push(""),n.join("/")}(C.pathname,t.pathname)),"/"!==C.pathname.charAt(0)&&v(C.protocol)&&(C.pathname="/"+C.pathname),i(C.port,C.protocol)||(C.host=C.hostname,C.port=""),C.username=C.password="",C.auth&&(~(l=C.auth.indexOf(":"))?(C.username=C.auth.slice(0,l),C.username=encodeURIComponent(decodeURIComponent(C.username)),C.password=C.auth.slice(l+1),C.password=encodeURIComponent(decodeURIComponent(C.password))):C.username=encodeURIComponent(decodeURIComponent(C.auth)),C.auth=C.password?C.username+":"+C.password:C.username),C.origin="file:"!==C.protocol&&v(C.protocol)&&C.host?C.protocol+"//"+C.host:"null",C.href=C.toString()}b.prototype={set:function(e,t,n){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||a.parse)(t)),r[e]=t;break;case"port":r[e]=t,i(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,h.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=!n;break;case"pathname":case"hash":if(t){var o="pathname"===e?"/":"#";r[e]=t.charAt(0)!==o?o+t:t}else r[e]=t;break;case"username":case"password":r[e]=encodeURIComponent(t);break;case"auth":var s=t.indexOf(":");~s?(r.username=t.slice(0,s),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=t.slice(s+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(t))}for(var c=0;c<y.length;c++){var u=y[c];u[4]&&(r[u[1]]=r[u[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&v(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=a.stringify);var t,n=this,r=n.host,o=n.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(n.protocol&&n.slashes||v(n.protocol)?"//":"");return n.username?(s+=n.username,n.password&&(s+=":"+n.password),s+="@"):n.password?(s+=":"+n.password,s+="@"):"file:"!==n.protocol&&v(n.protocol)&&!r&&"/"!==n.pathname&&(s+="@"),(":"===r[r.length-1]||h.test(n.hostname)&&!n.port)&&(r+=":"),s+=r+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(s+=n.hash),s}},b.extractProtocol=w,b.location=g,b.trimLeft=f,b.qs=a;var C=b;const E="undefined"!=typeof navigator&&"ReactNative"===navigator.product,x=Object.prototype.hasOwnProperty,T={timeout:E?6e4:12e4};function O(e){const t="string"==typeof e?Object.assign({url:e},T):Object.assign({},T,e),n=C(t.url,{},!0);return t.timeout=j(t.timeout),t.query&&Object.assign(n.query,function(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}(t.query)),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=n.toString(_),t}function _(e){const t=[];for(const t in e)x.call(e,t)&&n(t,e[t]);return t.length?t.join("&"):"";function n(e,r){Array.isArray(r)?r.forEach((t=>n(e,t))):t.push([e,r].map(encodeURIComponent).join("="))}}function j(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const t=Number(e);return isNaN(t)?j(T.timeout):{connect:t,socket:t}}const S=/^https?:\/\//i;function R(e){if(!S.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))}var A=function(e){return e.replace(/^\s+|\s+$/g,"")},k=function(e){if(!e)return{};for(var t,n={},r=A(e).split("\n"),o=0;o<r.length;o++){var s=r[o],i=s.indexOf(":"),a=A(s.slice(0,i)).toLowerCase(),c=A(s.slice(i+1));void 0===n[a]?n[a]=c:(t=n[a],"[object Array]"===Object.prototype.toString.call(t)?n[a].push(c):n[a]=[n[a],c])}return n},I=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/,F={regex:I,parse:function(e){var t=I.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}},q=F;const P=["request","response","progress","error","abort"],D=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function N(e,t){const n=[],r=D.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[O],validateOptions:[R]});function o(e){const n=P.reduce(((e,t)=>{var n,r;return e[t]=(n=Object.create(null),r=0,{publish:function(e){for(var t in n)n[t](e)},subscribe:function(e){var t=r++;return n[t]=e,function(){delete n[t]}}}),e}),{}),o=(e=>function(t,n){const r="onError"===t;let o=n;for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(let n=0;n<e[t].length&&(o=(0,e[t][n])(o,...i),!r||o);n++);return o})(r),s=o("processOptions",e);o("validateOptions",s);const i={options:s,channels:n,applyMiddleware:o};let a=null;const c=n.request.subscribe((e=>{a=t(e,((t,r)=>function(e,t,r){let s=e,i=t;if(!s)try{i=o("onResponse",t,r)}catch(e){i=null,s=e}s=s&&o("onError",s,r),s?n.error.publish(s):i&&n.response.publish(i)}(t,r,e)))}));n.abort.subscribe((()=>{c(),a&&a.abort()}));const u=o("onReturn",n,i);return u===n&&n.request.publish(i),u}return o.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&r.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return D.forEach((t=>{e[t]&&r[t].push(e[t])})),n.push(e),o},o.clone=function(){return N(n,t)},e.forEach(o.use),o}function M(){this.readyState=0}M.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},M.prototype.abort=function(){this._controller&&this._controller.abort()},M.prototype.getAllResponseHeaders=function(){return this._resHeaders},M.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},M.prototype.send=function(e){const t=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,r={method:this._method,headers:this._headers,signal:t&&t.signal||void 0,body:e};"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(this._url,r).then((e=>(e.headers.forEach(((e,t)=>{this._resHeaders+="".concat(t,": ").concat(e,"\r\n")})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,n?e.text():e.arrayBuffer()))).then((e=>{n?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{"AbortError"!==e.name?this.onerror(e):this.onabort()}))};const U="undefined"==typeof document||"undefined"==typeof window?void 0:window,H=U?"xhr":"fetch";let z="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){};const L="withCredentials"in new z,W="undefined"==typeof XDomainRequest?void 0:XDomainRequest;let $=L?z:W;U||(z=M,$=M);var B=(e,t)=>{const n=e.options,r=e.applyMiddleware("finalizeOptions",n),o={},s=U&&U.location&&!function(e,t,n){if(e===t)return!0;var r=q.parse(e,!1,!0),o=q.parse(t,!1,!0),s=0|r.port||("https"===r.protocol?443:80),i=0|o.port||("https"===o.protocol?443:80),a={proto:r.protocol===o.protocol,hostname:r.hostname===o.hostname,port:s===i};return a.proto&&a.hostname&&(a.port||n)}(U.location.href,r.url),i=e.applyMiddleware("interceptRequest",void 0,{adapter:H,context:e});if(i){const e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let a=s?new $:new z;const c=U&&U.XDomainRequest&&a instanceof U.XDomainRequest,u=r.headers,l=r.timeout;let h=!1,d=!1,p=!1;a.onerror=m,a.ontimeout=m,a.onabort=()=>{y(!0),h=!0},a.onprogress=()=>{};if(a[c?"onload":"onreadystatechange"]=()=>{!function(){if(!l)return;y(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),l.socket)}(),h||4!==a.readyState&&!c||0!==a.status&&function(){if(h||d||p)return;if(0===a.status)return void m(new Error("Unknown XHR error"));y(),d=!0,t(null,function(){let e=a.status,t=a.statusText;if(c&&void 0===e)e=200;else{if(e>12e3&&e<12156)return m();e=1223===a.status?204:a.status,t=1223===a.status?"No Content":t}return{body:a.response||a.responseText,url:r.url,method:r.method,headers:c?{}:k(a.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},a.open(r.method,r.url,!0),a.withCredentials=!!r.withCredentials,u&&a.setRequestHeader)for(const e in u)u.hasOwnProperty(e)&&a.setRequestHeader(e,u[e]);else if(u&&c)throw new Error("Headers cannot be set on an XDomainRequest object");return r.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:r,adapter:H,request:a,context:e}),a.send(r.body||null),l&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),l.connect)),{abort:function(){h=!0,a&&a.abort()}};function f(t){p=!0,a.abort();const n=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(r.url):"Connection timed out on request to ".concat(r.url));n.code=t,e.channels.error.publish(n)}function y(e){(e||h||a.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function m(e){if(d)return;y(!0),d=!0,a=null;const n=e||new Error("Network error while attempting to reach ".concat(r.url));n.isNetworkError=!0,n.request=r,t(n)}};var V,X,J={};function G(){if(X)return V;X=1;var e=1e3,t=60*e,n=60*t,r=24*n,o=7*r,s=365.25*r;function i(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}return V=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var s=Math.abs(o);if(s>=r)return i(o,s,r,"day");if(s>=n)return i(o,s,n,"hour");if(s>=t)return i(o,s,t,"minute");if(s>=e)return i(o,s,e,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=r)return Math.round(o/r)+"d";if(s>=n)return Math.round(o/n)+"h";if(s>=t)return Math.round(o/t)+"m";if(s>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var Y=function(e){function t(e){let r,o,s,i=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),s=o-(r||o);n.diff=s,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];r=s.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=G(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Y(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}({get exports(){return J},set exports(e){J=e}},J);var Z=Error.captureStackTrace||function(e){var t=new Error;Object.defineProperty(e,"stack",{configurable:!0,get:function(){var e=t.stack;return Object.defineProperty(this,"stack",{value:e}),e}})};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={},n=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function s(e){try{return encodeURIComponent(e)}catch(e){return null}}r.stringify=function(e,t){t=t||"";var r,o,i=[];for(o in"string"!=typeof t&&(t="?"),e)if(n.call(e,o)){if((r=e[o])||null!=r&&!isNaN(r)||(r=""),o=s(o),r=s(r),null===o||null===r)continue;i.push(o+"="+r)}return i.length?t+i.join("&"):""},r.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var s=o(t[1]),i=o(t[2]);null===s||null===i||s in n||(n[s]=i)}return n};var i=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},a=r,c=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,u=/[\n\r\t]/g,l=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,h=/:\d+$/,d=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,p=/^[a-zA-Z]:/;function f(e){return(e||"").toString().replace(c,"")}var y=[["#","hash"],["?","query"],function(e,t){return v(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],m={hash:1,query:1};function g(e){var r,n=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(e=e||n);if("blob:"===e.protocol)o=new b(unescape(e.pathname),{});else if("string"===s)for(r in o=new b(e,{}),m)delete o[r];else if("object"===s){for(r in e)r in m||(o[r]=e[r]);void 0===o.slashes&&(o.slashes=l.test(e.href))}return o}function v(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function w(e,t){e=(e=f(e)).replace(u,""),t=t||{};var r,n=d.exec(e),o=n[1]?n[1].toLowerCase():"",s=!!n[2],i=!!n[3],a=0;return s?i?(r=n[2]+n[3]+n[4],a=n[2].length+n[3].length):(r=n[2]+n[4],a=n[2].length):i?(r=n[3]+n[4],a=n[3].length):r=n[4],"file:"===o?a>=2&&(r=r.slice(2)):v(o)?r=n[4]:o?s&&(r=r.slice(2)):a>=2&&v(t.protocol)&&(r=n[4]),{protocol:o,slashes:s||v(o),slashesCount:a,rest:r}}function b(e,t,r){if(e=(e=f(e)).replace(u,""),!(this instanceof b))return new b(e,t,r);var n,o,s,c,l,h,d=y.slice(),m=typeof t,C=this,E=0;for("object"!==m&&"string"!==m&&(r=t,t=null),r&&"function"!=typeof r&&(r=a.parse),n=!(o=w(e||"",t=g(t))).protocol&&!o.slashes,C.slashes=o.slashes||n&&t.slashes,C.protocol=o.protocol||t.protocol||"",e=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||p.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!v(C.protocol)))&&(d[3]=[/(.*)/,"pathname"]);E<d.length;E++)"function"!=typeof(c=d[E])?(s=c[0],h=c[1],s!=s?C[h]=e:"string"==typeof s?~(l="@"===s?e.lastIndexOf(s):e.indexOf(s))&&("number"==typeof c[2]?(C[h]=e.slice(0,l),e=e.slice(l+c[2])):(C[h]=e.slice(l),e=e.slice(0,l))):(l=s.exec(e))&&(C[h]=l[1],e=e.slice(0,l.index)),C[h]=C[h]||n&&c[3]&&t[h]||"",c[4]&&(C[h]=C[h].toLowerCase())):e=c(e,C);r&&(C.query=r(C.query)),n&&t.slashes&&"/"!==C.pathname.charAt(0)&&(""!==C.pathname||""!==t.pathname)&&(C.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],s=!1,i=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),i++):i&&(0===n&&(s=!0),r.splice(n,1),i--);return s&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(C.pathname,t.pathname)),"/"!==C.pathname.charAt(0)&&v(C.protocol)&&(C.pathname="/"+C.pathname),i(C.port,C.protocol)||(C.host=C.hostname,C.port=""),C.username=C.password="",C.auth&&(~(l=C.auth.indexOf(":"))?(C.username=C.auth.slice(0,l),C.username=encodeURIComponent(decodeURIComponent(C.username)),C.password=C.auth.slice(l+1),C.password=encodeURIComponent(decodeURIComponent(C.password))):C.username=encodeURIComponent(decodeURIComponent(C.auth)),C.auth=C.password?C.username+":"+C.password:C.username),C.origin="file:"!==C.protocol&&v(C.protocol)&&C.host?C.protocol+"//"+C.host:"null",C.href=C.toString()}b.prototype={set:function(e,t,r){var n=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||a.parse)(t)),n[e]=t;break;case"port":n[e]=t,i(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,h.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var o="pathname"===e?"/":"#";n[e]=t.charAt(0)!==o?o+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var c=0;c<y.length;c++){var u=y[c];u[4]&&(n[u[1]]=n[u[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&v(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(e){e&&"function"==typeof e||(e=a.stringify);var t,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(r.protocol&&r.slashes||v(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&v(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||h.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(s+=r.hash),s}},b.extractProtocol=w,b.location=g,b.trimLeft=f,b.qs=a;var C=b;const E="undefined"!=typeof navigator&&"ReactNative"===navigator.product,x=Object.prototype.hasOwnProperty,T={timeout:E?6e4:12e4};function O(e){const t="string"==typeof e?Object.assign({url:e},T):Object.assign({},T,e),r=C(t.url,{},!0);return t.timeout=j(t.timeout),t.query&&Object.assign(r.query,function(e){const t={};for(const r in e)void 0!==e[r]&&(t[r]=e[r]);return t}(t.query)),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(_),t}function _(e){const t=[];for(const t in e)x.call(e,t)&&r(t,e[t]);return t.length?t.join("&"):"";function r(e,n){Array.isArray(n)?n.forEach((t=>r(e,t))):t.push([e,n].map(encodeURIComponent).join("="))}}function j(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const t=Number(e);return isNaN(t)?j(T.timeout):{connect:t,socket:t}}const S=/^https?:\/\//i;function k(e){if(!S.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))}var R=function(e){return e.replace(/^\s+|\s+$/g,"")},A=function(e){if(!e)return{};for(var t,r={},n=R(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=R(s.slice(0,i)).toLowerCase(),c=R(s.slice(i+1));void 0===r[a]?r[a]=c:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(c):r[a]=[r[a],c])}return r},I=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/,F={regex:I,parse:function(e){var t=I.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}},q=F;const P=["request","response","progress","error","abort"],D=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function M(e,t){const r=[],n=D.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[O],validateOptions:[k]});function o(e){const r=P.reduce(((e,t)=>{var r,n;return e[t]=(r=Object.create(null),n=0,{publish:function(e){for(var t in r)r[t](e)},subscribe:function(e){var t=n++;return r[t]=e,function(){delete r[t]}}}),e}),{}),o=(e=>function(t,r){const n="onError"===t;let o=r;for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(let r=0;r<e[t].length&&(o=(0,e[t][r])(o,...i),!n||o);r++);return o})(n),s=o("processOptions",e);o("validateOptions",s);const i={options:s,channels:r,applyMiddleware:o};let a=null;const c=r.request.subscribe((e=>{a=t(e,((t,n)=>function(e,t,n){let s=e,i=t;if(!s)try{i=o("onResponse",t,n)}catch(e){i=null,s=e}s=s&&o("onError",s,n),s?r.error.publish(s):i&&r.response.publish(i)}(t,n,e)))}));r.abort.subscribe((()=>{c(),a&&a.abort()}));const u=o("onReturn",r,i);return u===r&&r.request.publish(i),u}return o.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&n.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return D.forEach((t=>{e[t]&&n[t].push(e[t])})),r.push(e),o},o.clone=function(){return M(r,t)},e.forEach(o.use),o}function N(){this.readyState=0}N.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},N.prototype.abort=function(){this._controller&&this._controller.abort()},N.prototype.getAllResponseHeaders=function(){return this._resHeaders},N.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},N.prototype.send=function(e){const t=this._controller="function"==typeof AbortController&&new AbortController,r="arraybuffer"!==this.responseType,n={method:this._method,headers:this._headers,signal:t&&t.signal||void 0,body:e};"undefined"!=typeof document&&(n.credentials=this.withCredentials?"include":"omit"),fetch(this._url,n).then((e=>(e.headers.forEach(((e,t)=>{this._resHeaders+="".concat(t,": ").concat(e,"\r\n")})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,r?e.text():e.arrayBuffer()))).then((e=>{r?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{"AbortError"!==e.name?this.onerror(e):this.onabort()}))};const H="undefined"==typeof document||"undefined"==typeof window?void 0:window,U=H?"xhr":"fetch";let z="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){};const L="withCredentials"in new z,W="undefined"==typeof XDomainRequest?void 0:XDomainRequest;let B=L?z:W;H||(z=N,B=N);var $=(e,t)=>{const r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},s=H&&H.location&&!function(e,t,r){if(e===t)return!0;var n=q.parse(e,!1,!0),o=q.parse(t,!1,!0),s=0|n.port||("https"===n.protocol?443:80),i=0|o.port||("https"===o.protocol?443:80),a={proto:n.protocol===o.protocol,hostname:n.hostname===o.hostname,port:s===i};return a.proto&&a.hostname&&(a.port||r)}(H.location.href,n.url),i=e.applyMiddleware("interceptRequest",void 0,{adapter:U,context:e});if(i){const e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let a=s?new B:new z;const c=H&&H.XDomainRequest&&a instanceof H.XDomainRequest,u=n.headers,l=n.timeout;let h=!1,d=!1,p=!1;a.onerror=m,a.ontimeout=m,a.onabort=()=>{y(!0),h=!0},a.onprogress=()=>{};if(a[c?"onload":"onreadystatechange"]=()=>{!function(){if(!l)return;y(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),l.socket)}(),h||4!==a.readyState&&!c||0!==a.status&&function(){if(h||d||p)return;if(0===a.status)return void m(new Error("Unknown XHR error"));y(),d=!0,t(null,function(){let e=a.status,t=a.statusText;if(c&&void 0===e)e=200;else{if(e>12e3&&e<12156)return m();e=1223===a.status?204:a.status,t=1223===a.status?"No Content":t}return{body:a.response||a.responseText,url:n.url,method:n.method,headers:c?{}:A(a.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},a.open(n.method,n.url,!0),a.withCredentials=!!n.withCredentials,u&&a.setRequestHeader)for(const e in u)u.hasOwnProperty(e)&&a.setRequestHeader(e,u[e]);else if(u&&c)throw new Error("Headers cannot be set on an XDomainRequest object");return n.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:U,request:a,context:e}),a.send(n.body||null),l&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),l.connect)),{abort:function(){h=!0,a&&a.abort()}};function f(t){p=!0,a.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(n.url):"Connection timed out on request to ".concat(n.url));r.code=t,e.channels.error.publish(r)}function y(e){(e||h||a.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function m(e){if(d)return;y(!0),d=!0,a=null;const r=e||new Error("Network error while attempting to reach ".concat(n.url));r.isNetworkError=!0,r.request=n,t(r)}};var V,X,J={};function G(){if(X)return V;X=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,s=365.25*n;function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return V=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var s=Math.abs(o);if(s>=n)return i(o,s,n,"day");if(s>=r)return i(o,s,r,"hour");if(s>=t)return i(o,s,t,"minute");if(s>=e)return i(o,s,e,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=n)return Math.round(o/n)+"d";if(s>=r)return Math.round(o/r)+"h";if(s>=t)return Math.round(o/t)+"m";if(s>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var Y=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=G(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Y(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}({get exports(){return J},set exports(e){J=e}},J);var Z=Error.captureStackTrace||function(e){var t=new Error;Object.defineProperty(e,"stack",{configurable:!0,get:function(){var e=t.stack;return Object.defineProperty(this,"stack",{value:e}),e}})};
|
|
2
2
|
/*!
|
|
3
3
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
function K(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){if("string"!=typeof e)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(e))throw new Error("className contains invalid characters");t=t||function(e){this.message=e};var n,r,o=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),Z(this,this.constructor),t.apply(this,arguments)};n=o,r=Error,n.super_=r,n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}("HttpError",(function(e,t){const n=e.url.length>400?"".concat(e.url.slice(0,399),"…"):e.url;let r="".concat(e.method,"-request to ").concat(n," resulted in ");r+="HTTP ".concat(e.statusCode," ").concat(e.statusMessage),this.message=r.trim(),this.response=e,this.request=t.options}));const Q=["boolean","string","number"];function ee(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o,s;return!("function"==typeof t.pipe)&&!((s=t).constructor&&"function"==typeof s.constructor.isBuffer&&s.constructor.isBuffer(s))&&(-1!==Q.indexOf(typeof t)||Array.isArray(t)||!1!==K(n=t)&&(void 0===(r=n.constructor)||!1!==K(o=r.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function te(e){return{onResponse:n=>{const r=n.headers["content-type"]||"",o=e&&e.force||-1!==r.indexOf("application/json");return n.body&&r&&o?Object.assign({},n,{body:t(n.body)}):n},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let ne;ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var re=ne;function oe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.implementation||re.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,n)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(n),()=>e.abort.publish())))}}class se{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const ie=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new se(e),t(this.reason))}))}};ie.source=()=>{let e;return{token:new ie((t=>{e=t})),cancel:e}};var ae=function(e,t){return ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ae(e,t)};function ce(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}ae(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function ue(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function le(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function he(e,t,n){if(n||2===arguments.length)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function de(e){return"function"==typeof e}function pe(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var fe=pe((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function ye(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var me=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=ue(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(de(c))try{c()}catch(e){o=e instanceof fe?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=ue(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{ve(d)}catch(e){o=null!=o?o:[],e instanceof fe?o=he(he([],le(o)),le(e.errors)):o.push(e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new fe(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ve(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ye(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&ye(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ge(e){return e instanceof me||e&&"closed"in e&&de(e.remove)&&de(e.add)&&de(e.unsubscribe)}function ve(e){de(e)?e():e.unsubscribe()}me.EMPTY;var we={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},be={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=be.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,he([e,t],le(n))):setTimeout.apply(void 0,he([e,t],le(n)))},clearTimeout:function(e){var t=be.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Ce(){}var Ee=null;var xe=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ge(t)&&t.add(n)):n.destination=Re,n}return ce(t,e),t.create=function(e,t,n){return new je(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(me),Te=Function.prototype.bind;function Oe(e,t){return Te.call(e,t)}var _e=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Se(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Se(e)}else Se(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Se(e)}},e}(),je=function(e){function t(t,n,r){var o,s,i=e.call(this)||this;de(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:i&&we.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&Oe(t.next,s),error:t.error&&Oe(t.error,s),complete:t.complete&&Oe(t.complete,s)}):o=t;return i.destination=new _e(o),i}return ce(t,e),t}(xe);function Se(e){var t;t=e,be.setTimeout((function(){throw t}))}var Re={closed:!0,next:Ce,error:function(e){throw e},complete:Ce},Ae="function"==typeof Symbol&&Symbol.observable||"@@observable";function ke(e){return e}function Ie(e){return 0===e.length?ke:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Fe=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,o=this,s=(r=e)&&r instanceof xe||function(e){return e&&de(e.next)&&de(e.error)&&de(e.complete)}(r)&&ge(r)?e:new je(e,t,n);return function(e){if(we.useDeprecatedSynchronousErrorHandling){var t=!Ee;if(t&&(Ee={errorThrown:!1,error:null}),e(),t){var n=Ee,r=n.errorThrown,o=n.error;if(Ee=null,r)throw o}}else e()}((function(){var e=o,t=e.operator,n=e.source;s.add(t?t.call(s,n):n?o._subscribe(s):o._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=qe(t))((function(t,r){var o=new je({next:function(t){try{e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t});n.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Ae]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ie(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=qe(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function qe(e){var t;return null!==(t=null!=e?e:we.Promise)&&void 0!==t?t:Promise}function Pe(e){return function(t){if(function(e){return de(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function De(e,t,n,r,o){return new Ne(e,t,n,r,o)}var Ne=function(e){function t(t,n,r,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return ce(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(xe),Me=pe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ue(e,t){var n="object"==typeof t;return new Promise((function(r,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?r(s):n?r(t.defaultValue):o(new Me)}})}))}function He(e,t){return Pe((function(n,r){var o=0;n.subscribe(De(r,(function(n){r.next(e.call(t,n,o++))})))}))}function ze(e,t){return Pe((function(n,r){var o=0;n.subscribe(De(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}var Le={};!function(e,t){var n="undefined"!=typeof Reflect?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;function s(e){void 0!==e&&r(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&r(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor)}void 0===o&&(o=function(e){var t=new Error;r(e,"stack",{configurable:!0,get:function(){var e=t.stack;return r(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){r(e,"stack",{configurable:!0,value:t,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var i=function(){function e(e,t){return r(e,"name",{configurable:!0,value:t})}try{var t=function(){};if(e(t,"foo"),"foo"===t.name)return e}catch(e){}}();t=e.exports=function(e,t){if(null==t||t===Error)t=s;else if("function"!=typeof t)throw new TypeError("super_ should be a function");var r;if("string"==typeof e)r=e,e=void 0!==n?function(){return n(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==i&&(i(e,r),r=void 0);else if("function"!=typeof e)throw new TypeError("constructor should be either a string or a function");e.super_=e.super=t;var o={constructor:{configurable:!0,value:e,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),e.prototype=Object.create(t.prototype,o),e},t.BaseError=s}({get exports(){return Le},set exports(e){Le=e}},Le);var We={};
|
|
8
|
+
function K(e){return"[object Object]"===Object.prototype.toString.call(e)}!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,n,o=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),Z(this,this.constructor),t.apply(this,arguments)};r=o,n=Error,r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})}("HttpError",(function(e,t){const r=e.url.length>400?"".concat(e.url.slice(0,399),"…"):e.url;let n="".concat(e.method,"-request to ").concat(r," resulted in ");n+="HTTP ".concat(e.statusCode," ").concat(e.statusMessage),this.message=n.trim(),this.response=e,this.request=t.options}));const Q=["boolean","string","number"];function ee(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o,s;return!("function"==typeof t.pipe)&&!((s=t).constructor&&"function"==typeof s.constructor.isBuffer&&s.constructor.isBuffer(s))&&(-1!==Q.indexOf(typeof t)||Array.isArray(t)||!1!==K(r=t)&&(void 0===(n=r.constructor)||!1!==K(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function te(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let re;re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var ne=re;function oe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.implementation||ne.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,r)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(r),()=>e.abort.publish())))}}class se{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const ie=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new se(e),t(this.reason))}))}};ie.source=()=>{let e;return{token:new ie((t=>{e=t})),cancel:e}};var ae=function(e,t){return ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},ae(e,t)};function ce(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}ae(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function ue(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function le(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function he(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function de(e){return"function"==typeof e}function pe(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var fe=pe((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function ye(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var me=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=ue(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(de(c))try{c()}catch(e){o=e instanceof fe?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=ue(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{ve(d)}catch(e){o=null!=o?o:[],e instanceof fe?o=he(he([],le(o)),le(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new fe(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ve(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ye(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&ye(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ge(e){return e instanceof me||e&&"closed"in e&&de(e.remove)&&de(e.add)&&de(e.unsubscribe)}function ve(e){de(e)?e():e.unsubscribe()}me.EMPTY;var we={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},be={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=be.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,he([e,t],le(r))):setTimeout.apply(void 0,he([e,t],le(r)))},clearTimeout:function(e){var t=be.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Ce(){}var Ee=null;var xe=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ge(t)&&t.add(r)):r.destination=ke,r}return ce(t,e),t.create=function(e,t,r){return new je(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(me),Te=Function.prototype.bind;function Oe(e,t){return Te.call(e,t)}var _e=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Se(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Se(e)}else Se(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Se(e)}},e}(),je=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;de(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&we.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&Oe(t.next,s),error:t.error&&Oe(t.error,s),complete:t.complete&&Oe(t.complete,s)}):o=t;return i.destination=new _e(o),i}return ce(t,e),t}(xe);function Se(e){var t;t=e,be.setTimeout((function(){throw t}))}var ke={closed:!0,next:Ce,error:function(e){throw e},complete:Ce},Re="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ae(e){return e}function Ie(e){return 0===e.length?Ae:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Fe=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof xe||function(e){return e&&de(e.next)&&de(e.error)&&de(e.complete)}(n)&&ge(n)?e:new je(e,t,r);return function(e){if(we.useDeprecatedSynchronousErrorHandling){var t=!Ee;if(t&&(Ee={errorThrown:!1,error:null}),e(),t){var r=Ee,n=r.errorThrown,o=r.error;if(Ee=null,n)throw o}}else e()}((function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=qe(t))((function(t,n){var o=new je({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[Re]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ie(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=qe(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function qe(e){var t;return null!==(t=null!=e?e:we.Promise)&&void 0!==t?t:Promise}function Pe(e){return function(t){if(function(e){return de(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function De(e,t,r,n,o){return new Me(e,t,r,n,o)}var Me=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return ce(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(xe),Ne=pe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function He(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Ne)}})}))}function Ue(e,t){return Pe((function(r,n){var o=0;r.subscribe(De(n,(function(r){n.next(e.call(t,r,o++))})))}))}function ze(e,t){return Pe((function(r,n){var o=0;r.subscribe(De(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}var Le={};!function(e,t){var r="undefined"!=typeof Reflect?Reflect.construct:void 0,n=Object.defineProperty,o=Error.captureStackTrace;function s(e){void 0!==e&&n(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&n(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor)}void 0===o&&(o=function(e){var t=new Error;n(e,"stack",{configurable:!0,get:function(){var e=t.stack;return n(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){n(e,"stack",{configurable:!0,value:t,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var i=function(){function e(e,t){return n(e,"name",{configurable:!0,value:t})}try{var t=function(){};if(e(t,"foo"),"foo"===t.name)return e}catch(e){}}();t=e.exports=function(e,t){if(null==t||t===Error)t=s;else if("function"!=typeof t)throw new TypeError("super_ should be a function");var n;if("string"==typeof e)n=e,e=void 0!==r?function(){return r(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==i&&(i(e,n),n=void 0);else if("function"!=typeof e)throw new TypeError("constructor should be either a string or a function");e.super_=e.super=t;var o={constructor:{configurable:!0,value:e,writable:!0}};return void 0!==n&&(o.name={configurable:!0,value:n,writable:!0}),e.prototype=Object.create(t.prototype,o),e},t.BaseError=s}({get exports(){return Le},set exports(e){Le=e}},Le);var We={};
|
|
9
9
|
/** @license
|
|
10
10
|
* eventsource.js
|
|
11
11
|
* Available under MIT License (MIT)
|
|
12
12
|
* https://github.com/Yaffle/EventSource/
|
|
13
13
|
*/
|
|
14
|
-
!function(e,n){!function(t){var r=t.setTimeout,o=t.clearTimeout,s=t.XMLHttpRequest,i=t.XDomainRequest,a=t.ActiveXObject,c=t.EventSource,u=t.document,l=t.Promise,h=t.fetch,d=t.Response,p=t.TextDecoder,f=t.TextEncoder,y=t.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var m=h;h=function(e,t){var n=t.signal;return m(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==s&&(c<128||c>191||!t(i<<6|63&c,s-6,n(s,i)))&&(s=0,i=r,o+=String.fromCharCode(i)),0===s?(c>=0&&c<=127?(s=0,i=c):c>=192&&c<=223?(s=6,i=31&c):c>=224&&c<=239?(s=12,i=15&c):c>=240&&c<=247?(s=18,i=7&c):(s=0,i=r),0===s||t(i,s,n(s,i))||(s=0,i=r)):(s-=6,i=i<<6|63&c),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=g);var v=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),s=o.shift(),i=o.join(": ");t[b(s)]=i}this._map=t}function E(){}function x(e){this._headers=e}function T(){}function O(){this._listeners=Object.create(null)}function _(e){r((function(){throw e}),0)}function j(e){this.type=e,this.target=void 0}function S(e,t){j.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function R(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function A(e,t){j.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var n=this,i=this._xhr,a=1,c=0;this._abort=function(e){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==c&&(o(c),c=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in i)e=200,t="OK",r=i.contentType;else try{e=i.status,t=i.statusText,r=i.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){c=r((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(c=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=r((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[b(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,n,r,o,i,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(n,r,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,n,r,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var r=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});n(o),r()}})).catch((function(e){t(e)}))};r()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){r(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var o=t[r];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},O.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,s=0;s<r.length;s+=1)r[s]===t&&(o=!0);o||r.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],s=0;s<r.length;s+=1)r[s]!==t&&o.push(r[s]);0===o.length?delete n[e]:n[e]=o}},S.prototype=Object.create(j.prototype),R.prototype=Object.create(j.prototype),A.prototype=Object.create(j.prototype);var k=-1,I=-1,F=/^text\/event\-stream(;.*)?$/i,q=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),P(n)},P=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){_(e)}};function N(e,t){O.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,n){t=String(t);var a=Boolean(n.withCredentials),c=n.lastEventIdQueryParameterName||"lastEventId",u=P(1e3),l=q(n.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=n.headers||{},m=n.Transport,g=M&&null==m?void 0:new w(null!=m?new m:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=m&&"string"!=typeof m?new m:null==g?new T:new E,b=void 0,C=0,x=k,O="",_="",j="",N="",U=0,H=0,z=0,L=function(t,n,r,o){if(0===x)if(200===t&&null!=r&&F.test(r)){x=1,p=Date.now(),d=u,e.readyState=1;var s=new R("open",{status:t,statusText:n,headers:o});e.dispatchEvent(s),D(e,e.onopen,s)}else{var i="";200!==t?(n&&(n=n.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",B();s=new R("error",{status:t,statusText:n,headers:o});e.dispatchEvent(s),D(e,e.onerror,s),console.error(i)}},W=function(t){if(1===x){for(var n=-1,s=0;s<t.length;s+=1){(c=t.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(n=s)}var i=(-1!==n?N:"")+t.slice(0,n+1);N=(-1===n?N:"")+t.slice(n+1),""!==t&&(p=Date.now(),f+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(U===I&&c==="\n".charCodeAt(0))U=0;else if(U===I&&(U=0),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(0!==U){1===U&&(z=a+1);var y=i.slice(H,z-1),m=i.slice(z+(z<a&&i.charCodeAt(z)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=m):"id"===y?_=m:"event"===y?j=m:"retry"===y?(u=q(m,u),d=u):"heartbeatTimeout"===y&&(l=q(m,l),0!==C&&(o(C),C=r((function(){V()}),l)))}if(0===U){if(""!==O){h=_,""===j&&(j="message");var g=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(g),"open"===j?D(e,e.onopen,g):"message"===j?D(e,e.onmessage,g):"error"===j&&D(e,e.onerror,g),2===x)return}O="",j=""}U=c==="\r".charCodeAt(0)?I:0}else 0===U&&(H=a,U=1),1===U?c===":".charCodeAt(0)&&(z=a+1,U=2):2===U&&(U=3)}}},$=function(t){if(1===x||0===x){x=k,0!==C&&(o(C),C=0),C=r((function(){V()}),d),d=P(Math.min(16*u,2*d)),e.readyState=0;var n=new A("error",{error:t});e.dispatchEvent(n),D(e,e.onerror,n),null!=t&&console.error(t)}},B=function(){x=2,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=2},V=function(){if(C=0,x===k){p=!1,f=0,C=r((function(){V()}),l),x=0,O="",j="",_=h,N="",H=0,z=0,U=0;var n=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var o=t.indexOf("?");n=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),n+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u]);try{b=v.open(g,L,W,$,n,s,i)}catch(e){throw B(),e}}else if(p||null==b){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=r((function(){V()}),d)}else $(new Error("No activity within "+l+" milliseconds. "+(0===x?"No response received.":f+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=B,V()}(this,e,t)}var M=null!=h&&null!=d&&"body"in d.prototype;N.prototype=Object.create(O.prototype),N.prototype.CONNECTING=0,N.prototype.OPEN=1,N.prototype.CLOSED=2,N.prototype.close=function(){this._close()},N.CONNECTING=0,N.OPEN=1,N.CLOSED=2,N.prototype.withCredentials=void 0;var U,H=c;null==s||null!=c&&"withCredentials"in c.prototype||(H=N),U=function(e){e.EventSourcePolyfill=N,e.NativeEventSource=c,e.EventSource=H}(n),void 0!==U&&(e.exports=U)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:t:globalThis)}({get exports(){return We},set exports(e){We=e}},We);var $e=We.EventSourcePolyfill;class Be extends Le.BaseError{constructor(e){const t=Xe(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class Ve extends Le.BaseError{constructor(e){const t=Xe(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Xe(e){const t=e.body,n={response:e,statusCode:e.statusCode,responseBody:Je(t,e),message:"",details:void 0};return t.error&&t.message?(n.message="".concat(t.error," - ").concat(t.message),n):t.error&&t.error.description?(n.message=t.error.description,n.details=t.error,n):(n.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),n)}function Je(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Ge={onResponse:e=>{if(e.statusCode>=500)throw new Ve(e);if(e.statusCode>=400)throw new Be(e);return e}},Ye={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};const Ze="X-Sanity-Project-ID";function Ke(e){if("string"==typeof e||Array.isArray(e))return{id:e};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const Qe=["image","file"],et=["before","after","replace"],tt=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},nt=e=>{if(-1===Qe.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Qe.join(", ")))},rt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},ot=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},st=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));ot(e,t._id)},it=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},at=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e},ct=encodeURIComponent;var ut,lt,ht=e=>{let{query:t,params:n={},options:r={}}=e;const{tag:o,...s}=r,i="query=".concat(ct(t)),a=o?"?tag=".concat(ct(o),"&").concat(i):"?".concat(i),c=Object.keys(n).reduce(((e,t)=>"".concat(e,"&").concat(ct("$".concat(t)),"=").concat(ct(JSON.stringify(n[t])))),a);return Object.keys(s).reduce(((e,t)=>r[t]?"".concat(e,"&").concat(ct(t),"=").concat(ct(r[t])):e),c)},dt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pt=(e,t,n)=>(dt(e,t,"read from private field"),n?n.call(e):t.get(e)),ft=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},yt=(e,t,n,r)=>(dt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class mt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=e,this.operations=t}replace(e){return rt("replace",e),this._set("set",{$:e})}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return rt("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,n){return((e,t,n)=>{const r="insert(at, selector, items)";if(-1===et.indexOf(e)){const e=et.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(r,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(r,' takes a "selector"-argument which must be a string'));if(!Array.isArray(n))throw new Error("".concat(r,' takes an "items"-argument which must be an array'))})(e,t,n),this._assign("insert",{[e]:t,items:n})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,n,r){const o=t<0?t-1:t,s=void 0===n||-1===n?-1:Math.max(0,t+n),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,r||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...Ke(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return rt(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},n&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}const gt=class extends mt{constructor(e,t,n){super(e,t),ft(this,ut,void 0),yt(this,ut,n)}clone(){return new gt(this.selection,{...this.operations},pt(this,ut))}commit(e){if(!pt(this,ut))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,ut).mutate({patch:this.serialize()},n)}};let vt=gt;ut=new WeakMap;const wt=class extends mt{constructor(e,t,n){super(e,t),ft(this,lt,void 0),yt(this,lt,n)}clone(){return new wt(this.selection,{...this.operations},pt(this,lt))}commit(e){if(!pt(this,lt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,lt).mutate({patch:this.serialize()},n)}};let bt=wt;lt=new WeakMap;var Ct,Et,xt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(xt(e,t,"read from private field"),n?n.call(e):t.get(e)),Ot=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},_t=(e,t,n,r)=>(xt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const jt={returnDocuments:!1};class St{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.operations=e,this.trxId=t}create(e){return rt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return rt(t,e),st(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return rt(t,e),st(t,e),this._add({[t]:e})}delete(e){return ot("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}const Rt=class extends St{constructor(e,t,n){super(e,n),Ot(this,Ct,void 0),_t(this,Ct,t)}clone(){return new Rt([...this.operations],Tt(this,Ct),this.trxId)}commit(e){if(!Tt(this,Ct))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,Ct).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof bt)return this._add({patch:e.serialize()});if(n){const n=t(new bt(e,{},Tt(this,Ct)));if(!(n instanceof bt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};let At=Rt;Ct=new WeakMap;const kt=class extends St{constructor(e,t,n){super(e,n),Ot(this,Et,void 0),_t(this,Et,t)}clone(){return new kt([...this.operations],Tt(this,Et),this.trxId)}commit(e){if(!Tt(this,Et))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,Et).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof vt)return this._add({patch:e.serialize()});if(n){const n=t(new vt(e,{},Tt(this,Et)));if(!(n instanceof vt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};let It=kt;Et=new WeakMap;const Ft=(e,t)=>!1===e?void 0:void 0===e?t:e,qt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:Ft(e.returnDocuments,!0),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}},Pt=e=>"response"===e.type,Dt=e=>e.body,Nt=(e,t)=>e.reduce(((e,n)=>(e[t(n)]=n,e)),Object.create(null));function Mt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?e=>e:e=>e.result;return Bt(e,t,"query",{query:n,params:r},o).pipe(He(s))}function Ut(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:e.getDataUrl("doc",n),json:!0,tag:r.tag};return Xt(e,t,o).pipe(ze(Pt),He((e=>e.body.documents&&e.body.documents[0])))}function Ht(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:e.getDataUrl("doc",n.join(",")),json:!0,tag:r.tag};return Xt(e,t,o).pipe(ze(Pt),He((e=>{const t=Nt(e.body.documents||[],(e=>e._id));return n.map((e=>t[e]||null))})))}function zt(e,t,n,r){return st("createIfNotExists",n),Vt(e,t,n,"createIfNotExists",r)}function Lt(e,t,n,r){return st("createOrReplace",n),Vt(e,t,n,"createOrReplace",r)}function Wt(e,t,n,r){return Bt(e,t,"mutate",{mutations:[{delete:Ke(n)}]},r)}function $t(e,t,n,r){const o=n instanceof bt||n instanceof vt||n instanceof At||n instanceof It?n.serialize():n;return Bt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function Bt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===n,i="query"===n,a=s?"":ht(r),c=!s&&a.length<11264,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o,y=e.getDataUrl(n,u),m={method:c?"GET":"POST",uri:y,json:!0,body:c?void 0:r,query:s&&qt(o),timeout:h,headers:f,token:d,tag:p,canUseCdn:i};return Xt(e,t,m).pipe(ze(Pt),He(Dt),He((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const n=l?"documentId":"documentIds",r=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[n]:r}})))}function Vt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s={[r]:n},i=Object.assign({returnFirst:!0,returnDocuments:!0},o);return Bt(e,t,"mutate",{mutations:[s]},i)}function Xt(e,t,n){const r=n.url||n.uri,o=e.config(),s=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===r.indexOf("/data/"):n.canUseCdn,i=o.useCdn&&s,a=n.tag&&o.requestTagPrefix?[o.requestTagPrefix,n.tag].join("."):n.tag||o.requestTagPrefix;a&&(n.query={tag:at(a),...n.query});const c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={},r=t.token||e.token;r&&(n.Authorization="Bearer ".concat(r)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(n[Ze]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},n,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o})}(o,Object.assign({},n,{url:e.getUrl(r,i)}));return new Fe((e=>t(c,o.requester).subscribe(e)))}function Jt(e,t,n){return Xt(e,t,n).pipe(ze((e=>"response"===e.type)),He((e=>e.body)))}var Gt,Yt,Zt,Kt,Qt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},en=(e,t,n)=>(Qt(e,t,"read from private field"),n?n.call(e):t.get(e)),tn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},nn=(e,t,n,r)=>(Qt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class rn{constructor(e,t){tn(this,Gt,void 0),tn(this,Yt,void 0),nn(this,Gt,e),nn(this,Yt,t)}upload(e,t,n){return sn(en(this,Gt),en(this,Yt),e,t,n)}}Gt=new WeakMap,Yt=new WeakMap;class on{constructor(e,t){tn(this,Zt,void 0),tn(this,Kt,void 0),nn(this,Zt,e),nn(this,Kt,t)}upload(e,t,n){return Ue(sn(en(this,Zt),en(this,Kt),e,t,n).pipe(ze((e=>"response"===e.type)),He((e=>e.body.document))))}}function sn(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};nt(n);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=it(e.config()),a="image"===n?"images":"files",c=an(o,r),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,m={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(m.sourceId=y.id,m.sourceName=y.name,m.sourceUrl=y.url),Xt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:m,body:r})}function an(e,t){return"undefined"!=typeof window&&t instanceof window.File?Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}Zt=new WeakMap,Kt=new WeakMap;var cn,un,ln,hn,dn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pn=(e,t,n)=>(dn(e,t,"read from private field"),n?n.call(e):t.get(e)),fn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},yn=(e,t,n,r)=>(dn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class mn{constructor(e,t){fn(this,cn,void 0),fn(this,un,void 0),yn(this,cn,e),yn(this,un,t)}getLoginProviders(){return Jt(pn(this,cn),pn(this,un),{uri:"/auth/providers"})}logout(){return Jt(pn(this,cn),pn(this,un),{uri:"/auth/logout",method:"POST"})}}cn=new WeakMap,un=new WeakMap;class gn{constructor(e,t){fn(this,ln,void 0),fn(this,hn,void 0),yn(this,ln,e),yn(this,hn,t)}getLoginProviders(){return Ue(Jt(pn(this,ln),pn(this,hn),{uri:"/auth/providers"}))}logout(){return Ue(Jt(pn(this,ln),pn(this,hn),{uri:"/auth/logout",method:"POST"}))}}ln=new WeakMap,hn=new WeakMap;function vn(e){return"https://docs.sanity.io/help/"+e}const wn=e=>(e=>{let t,n=!1;return function(){return n||(t=e(...arguments),n=!0),t}})((function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.warn(e.join(" "),...n)})),bn=wn(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(vn("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),Cn=wn(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(vn("js-client-browser-token")," for more information and how to hide this warning.")]),En=wn(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(vn("js-client-api-version"))]),xn={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Tn=["localhost","127.0.0.1","0.0.0.0"],On=(e,t)=>{const n=Object.assign({},t,e);n.apiVersion||En();const r=Object.assign({},xn,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const e=vn("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!r.projectId)throw new Error("Configuration must contain `projectId`");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==Tn.indexOf(e))(window.location.hostname);s&&i&&r.token&&!0!==r.ignoreBrowserTokenWarning?Cn():void 0===r.useCdn&&bn(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(r.projectId),r.dataset&&tt(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?at(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===xn.apiHost,r.useCdn=Boolean(r.useCdn)&&!r.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(r.apiVersion);const a=r.apiHost.split("://",2),c=a[0],u=a[1],l=r.isDefaultApi?"apicdn.sanity.io":u;return r.useProjectHostname?(r.url="".concat(c,"://").concat(r.projectId,".").concat(u,"/v").concat(r.apiVersion),r.cdnUrl="".concat(c,"://").concat(r.projectId,".").concat(l,"/v").concat(r.apiVersion)):(r.url="".concat(r.apiHost,"/v").concat(r.apiVersion),r.cdnUrl=r.url),r};var _n=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{}),jn=(e,t)=>t.reduce(((t,n)=>(void 0===e[n]||(t[n]=e[n]),t)),{});const Sn=$e,Rn=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],An={includeResult:!0};function kn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:r,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=n.tag&&i?[i,n.tag].join("."):n.tag,c={..._n(n,An),tag:a},u=jn(c,Rn),l=ht({query:e,params:t,options:{tag:a,...u}}),h="".concat(r).concat(this.getDataUrl("listen",l));if(h.length>14800)return new Fe((e=>e.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],p=-1!==d.indexOf("reconnect"),f={};return(o||s)&&(f.withCredentials=!0),o&&(f.headers={Authorization:"Bearer ".concat(o)}),new Fe((e=>{let t,n=u(),r=!1;function o(){r||(p&&e.next({type:"reconnect"}),r||n.readyState===Sn.CLOSED&&(c(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(Fn(t))}function i(t){const n=In(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",s,!1),n.removeEventListener("disconnect",a,!1),d.forEach((e=>n.removeEventListener(e,i,!1))),n.close()}function u(){const e=new Sn(h,f);return e.addEventListener("error",o,!1),e.addEventListener("channelError",s,!1),e.addEventListener("disconnect",a,!1),d.forEach((t=>e.addEventListener(t,i,!1))),e}function l(){n=u()}return function(){r=!0,c()}}))}function In(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}function Fn(e){if(e instanceof Error)return e;const t=In(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}var qn,Pn,Dn=(e,t,n)=>(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)})(e,t,"access private method"),n);class Nn{constructor(){((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,qn)}create(e,t){return Dn(this,qn,Pn).call(this,"PUT",e,t)}edit(e,t){return Dn(this,qn,Pn).call(this,"PATCH",e,t)}delete(e){return Dn(this,qn,Pn).call(this,"DELETE",e)}list(){return this.client.request({uri:"/datasets"})}}qn=new WeakSet,Pn=function(e,t,n){return tt(t),this.client.request({method:e,uri:"/datasets/".concat(t),body:n})};class Mn extends Nn{constructor(e){super(),this.client=e}}class Un extends Nn{constructor(e){super(),this.client=e}}class Hn{list(){return this.client.request({uri:"/projects"})}getById(e){return this.client.request({uri:"/projects/".concat(e)})}}class zn extends Hn{constructor(e){super(),this.client=e}}class Ln extends Hn{constructor(e){super(),this.client=e}}class Wn{getById(e){return this.client.request({uri:"/users/".concat(e)})}}class $n extends Wn{constructor(e){super(),this.client=e}}class Bn extends Wn{constructor(e){super(),this.client=e}}var Vn,Xn,Jn,Gn,Yn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Zn=(e,t,n)=>(Yn(e,t,"read from private field"),n?n.call(e):t.get(e)),Kn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Qn=(e,t,n,r)=>(Yn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const er=class{constructor(e,t){Kn(this,Vn,void 0),Kn(this,Xn,void 0),this.config(t),Qn(this,Xn,e),this.assets=new rn(this,Zn(this,Xn)),this.auth=new mn(this,Zn(this,Xn)),this.datasets=new Mn(this),this.projects=new zn(this),this.users=new $n(this)}clone(){return new er(Zn(this,Xn),this.config())}config(e){if(void 0===e)return{...Zn(this,Vn)};if(Zn(this,Vn)&&!1===Zn(this,Vn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Qn(this,Vn,On(e,Zn(this,Vn)||{})),this}withConfig(e){return new er(Zn(this,Xn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Mt(this,Zn(this,Xn),e,t,n)}getDocument(e,t){return Ut(this,Zn(this,Xn),e,t)}getDocuments(e,t){return Ht(this,Zn(this,Xn),e,t)}create(e,t){return Vt(this,Zn(this,Xn),e,"create",t)}createIfNotExists(e,t){return zt(this,Zn(this,Xn),e,t)}createOrReplace(e,t){return Lt(this,Zn(this,Xn),e,t)}delete(e,t){return Wt(this,Zn(this,Xn),e,t)}mutate(e,t){return $t(this,Zn(this,Xn),e,t)}patch(e,t){return new vt(e,t,this)}transaction(e){return new It(e,this)}request(e){return Jt(this,Zn(this,Xn),e)}getUrl(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Zn(this,Vn).cdnUrl:Zn(this,Vn).url;return"".concat(t,"/").concat(e.replace(/^\//,""))}getDataUrl(e,t){const n=this.config(),r=it(n),o="/".concat(e,"/").concat(r),s=t?"".concat(o,"/").concat(t):o;return"/data".concat(s).replace(/\/($|\?)/,"$1")}};let tr=er;Vn=new WeakMap,Xn=new WeakMap;const nr=class{constructor(e,t){Kn(this,Jn,void 0),Kn(this,Gn,void 0),this.listen=kn,this.config(t),Qn(this,Gn,e),this.assets=new on(this,Zn(this,Gn)),this.auth=new gn(this,Zn(this,Gn)),this.datasets=new Un(this),this.projects=new Ln(this),this.users=new Bn(this),this.observable=new tr(e,this.config())}clone(){return new nr(Zn(this,Gn),this.config())}config(e){if(void 0===e)return{...Zn(this,Jn)};if(Zn(this,Jn)&&!1===Zn(this,Jn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable.config(e),Qn(this,Jn,On(e,Zn(this,Jn)||{})),this}withConfig(e){return new nr(Zn(this,Gn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Ue(Mt(this,Zn(this,Gn),e,t,n))}getDocument(e,t){return Ue(Ut(this,Zn(this,Gn),e,t))}getDocuments(e,t){return Ue(Ht(this,Zn(this,Gn),e,t))}create(e,t){return Ue(Vt(this,Zn(this,Gn),e,"create",t))}createIfNotExists(e,t){return Ue(zt(this,Zn(this,Gn),e,t))}createOrReplace(e,t){return Ue(Lt(this,Zn(this,Gn),e,t))}delete(e,t){return Ue(Wt(this,Zn(this,Gn),e,t))}mutate(e,t){return Ue($t(this,Zn(this,Gn),e,t))}patch(e,t){return new bt(e,t,this)}transaction(e){return new At(e,this)}request(e){return Ue(Jt(this,Zn(this,Gn),e))}dataRequest(e,t,n){return Ue(Bt(this,Zn(this,Gn),e,t,n))}getUrl(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Zn(this,Jn).cdnUrl:Zn(this,Jn).url;return"".concat(t,"/").concat(e.replace(/^\//,""))}getDataUrl(e,t){const n=this.config(),r=it(n),o="/".concat(e,"/").concat(r),s=t?"".concat(o,"/").concat(t):o;return"/data".concat(s).replace(/\/($|\?)/,"$1")}};let rr=nr;Jn=new WeakMap,Gn=new WeakMap;const or=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:B;return N(e,t)}([...e,Ye,ee(),te(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,n=e.context;function r(e){return t=>{const r=t.lengthComputable?t.loaded/t.total*100:-1;n.channels.progress.publish({stage:e,percent:r,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=r("upload")),"onprogress"in t&&(t.onprogress=r("download"))}},Ge,oe({implementation:Fe})]);function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return n({maxRedirects:0,...e})}return n.defaultRequester=t,n}([]),sr=or.defaultRequester;e.BasePatch=mt,e.BaseTransaction=St,e.ClientError=Be,e.ObservablePatch=vt,e.ObservableSanityClient=tr,e.ObservableTransaction=It,e.Patch=bt,e.SanityClient=rr,e.ServerError=Ve,e.Transaction=At,e.createClient=function(e){return new rr(or,e)},e.requester=sr}));
|
|
14
|
+
!function(e,r){!function(t){var n=t.setTimeout,o=t.clearTimeout,s=t.XMLHttpRequest,i=t.XDomainRequest,a=t.ActiveXObject,c=t.EventSource,u=t.document,l=t.Promise,h=t.fetch,d=t.Response,p=t.TextDecoder,f=t.TextEncoder,y=t.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var m=h;h=function(e,t){var r=t.signal;return m(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==s&&(c<128||c>191||!t(i<<6|63&c,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(c>=0&&c<=127?(s=0,i=c):c>=192&&c<=223?(s=6,i=31&c):c>=224&&c<=239?(s=12,i=15&c):c>=240&&c<=247?(s=18,i=7&c):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&c),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=g);var v=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");t[b(s)]=i}this._map=t}function E(){}function x(e){this._headers=e}function T(){}function O(){this._listeners=Object.create(null)}function _(e){n((function(){throw e}),0)}function j(e){this.type=e,this.target=void 0}function S(e,t){j.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function k(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function R(e,t){j.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,c=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==c&&(o(c),c=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in i)e=200,t="OK",n=i.contentType;else try{e=i.status,t=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},d=function(){c=n((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(c=n((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[b(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(r,n,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,r,n,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},O.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===t&&(o=!0);o||n.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==t&&o.push(n[s]);0===o.length?delete r[e]:r[e]=o}},S.prototype=Object.create(j.prototype),k.prototype=Object.create(j.prototype),R.prototype=Object.create(j.prototype);var A=-1,I=-1,F=/^text\/event\-stream(;.*)?$/i,q=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),P(r)},P=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){_(e)}};function M(e,t){O.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,r){t=String(t);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=P(1e3),l=q(r.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=r.headers||{},m=r.Transport,g=N&&null==m?void 0:new w(null!=m?new m:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=m&&"string"!=typeof m?new m:null==g?new T:new E,b=void 0,C=0,x=A,O="",_="",j="",M="",H=0,U=0,z=0,L=function(t,r,n,o){if(0===x)if(200===t&&null!=n&&F.test(n)){x=1,p=Date.now(),d=u,e.readyState=1;var s=new k("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(e,e.onopen,s)}else{var i="";200!==t?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",$();s=new k("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(e,e.onerror,s),console.error(i)}},W=function(t){if(1===x){for(var r=-1,s=0;s<t.length;s+=1){(c=t.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?M:"")+t.slice(0,r+1);M=(-1===r?M:"")+t.slice(r+1),""!==t&&(p=Date.now(),f+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(H===I&&c==="\n".charCodeAt(0))H=0;else if(H===I&&(H=0),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(0!==H){1===H&&(z=a+1);var y=i.slice(U,z-1),m=i.slice(z+(z<a&&i.charCodeAt(z)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=m):"id"===y?_=m:"event"===y?j=m:"retry"===y?(u=q(m,u),d=u):"heartbeatTimeout"===y&&(l=q(m,l),0!==C&&(o(C),C=n((function(){V()}),l)))}if(0===H){if(""!==O){h=_,""===j&&(j="message");var g=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(g),"open"===j?D(e,e.onopen,g):"message"===j?D(e,e.onmessage,g):"error"===j&&D(e,e.onerror,g),2===x)return}O="",j=""}H=c==="\r".charCodeAt(0)?I:0}else 0===H&&(U=a,H=1),1===H?c===":".charCodeAt(0)&&(z=a+1,H=2):2===H&&(H=3)}}},B=function(t){if(1===x||0===x){x=A,0!==C&&(o(C),C=0),C=n((function(){V()}),d),d=P(Math.min(16*u,2*d)),e.readyState=0;var r=new R("error",{error:t});e.dispatchEvent(r),D(e,e.onerror,r),null!=t&&console.error(t)}},$=function(){x=2,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=2},V=function(){if(C=0,x===A){p=!1,f=0,C=n((function(){V()}),l),x=0,O="",j="",_=h,M="",U=0,z=0,H=0;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u]);try{b=v.open(g,L,W,B,r,s,i)}catch(e){throw $(),e}}else if(p||null==b){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){V()}),d)}else B(new Error("No activity within "+l+" milliseconds. "+(0===x?"No response received.":f+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=$,V()}(this,e,t)}var N=null!=h&&null!=d&&"body"in d.prototype;M.prototype=Object.create(O.prototype),M.prototype.CONNECTING=0,M.prototype.OPEN=1,M.prototype.CLOSED=2,M.prototype.close=function(){this._close()},M.CONNECTING=0,M.OPEN=1,M.CLOSED=2,M.prototype.withCredentials=void 0;var H,U=c;null==s||null!=c&&"withCredentials"in c.prototype||(U=M),H=function(e){e.EventSourcePolyfill=M,e.NativeEventSource=c,e.EventSource=U}(r),void 0!==H&&(e.exports=H)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:t:globalThis)}({get exports(){return We},set exports(e){We=e}},We);var Be=We.EventSourcePolyfill;class $e extends Le.BaseError{constructor(e){const t=Xe(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class Ve extends Le.BaseError{constructor(e){const t=Xe(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Xe(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:Je(t,e),message:"",details:void 0};return t.error&&t.message?(r.message="".concat(t.error," - ").concat(t.message),r):t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function Je(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Ge={onResponse:e=>{if(e.statusCode>=500)throw new Ve(e);if(e.statusCode>=400)throw new $e(e);return e}},Ye={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};const Ze="X-Sanity-Project-ID";function Ke(e){if("string"==typeof e||Array.isArray(e))return{id:e};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const Qe=["image","file"],et=["before","after","replace"],tt=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},rt=e=>{if(-1===Qe.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Qe.join(", ")))},nt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},ot=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},st=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));ot(e,t._id)},it=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},at=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e},ct=encodeURIComponent;var ut,lt,ht=e=>{let{query:t,params:r={},options:n={}}=e;const{tag:o,...s}=n,i="query=".concat(ct(t)),a=o?"?tag=".concat(ct(o),"&").concat(i):"?".concat(i),c=Object.keys(r).reduce(((e,t)=>"".concat(e,"&").concat(ct("$".concat(t)),"=").concat(ct(JSON.stringify(r[t])))),a);return Object.keys(s).reduce(((e,t)=>n[t]?"".concat(e,"&").concat(ct(t),"=").concat(ct(n[t])):e),c)},dt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},pt=(e,t,r)=>(dt(e,t,"read from private field"),r?r.call(e):t.get(e)),ft=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},yt=(e,t,r,n)=>(dt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class mt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=e,this.operations=t}replace(e){return nt("replace",e),this._set("set",{$:e})}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return nt("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===et.indexOf(e)){const e=et.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...Ke(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return nt(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}const gt=class extends mt{constructor(e,t,r){super(e,t),ft(this,ut,void 0),yt(this,ut,r)}clone(){return new gt(this.selection,{...this.operations},pt(this,ut))}commit(e){if(!pt(this,ut))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,ut).mutate({patch:this.serialize()},r)}};let vt=gt;ut=new WeakMap;const wt=class extends mt{constructor(e,t,r){super(e,t),ft(this,lt,void 0),yt(this,lt,r)}clone(){return new wt(this.selection,{...this.operations},pt(this,lt))}commit(e){if(!pt(this,lt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,lt).mutate({patch:this.serialize()},r)}};let bt=wt;lt=new WeakMap;var Ct,Et,xt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Tt=(e,t,r)=>(xt(e,t,"read from private field"),r?r.call(e):t.get(e)),Ot=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},_t=(e,t,r,n)=>(xt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const jt={returnDocuments:!1};class St{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.operations=e,this.trxId=t}create(e){return nt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return nt(t,e),st(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return nt(t,e),st(t,e),this._add({[t]:e})}delete(e){return ot("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}const kt=class extends St{constructor(e,t,r){super(e,r),Ot(this,Ct,void 0),_t(this,Ct,t)}clone(){return new kt([...this.operations],Tt(this,Ct),this.trxId)}commit(e){if(!Tt(this,Ct))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,Ct).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof bt)return this._add({patch:e.serialize()});if(r){const r=t(new bt(e,{},Tt(this,Ct)));if(!(r instanceof bt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};let Rt=kt;Ct=new WeakMap;const At=class extends St{constructor(e,t,r){super(e,r),Ot(this,Et,void 0),_t(this,Et,t)}clone(){return new At([...this.operations],Tt(this,Et),this.trxId)}commit(e){if(!Tt(this,Et))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,Et).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof vt)return this._add({patch:e.serialize()});if(r){const r=t(new vt(e,{},Tt(this,Et)));if(!(r instanceof vt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};let It=At;Et=new WeakMap;const Ft=(e,t)=>!1===e?void 0:void 0===e?t:e,qt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:Ft(e.returnDocuments,!0),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}},Pt=e=>"response"===e.type,Dt=e=>e.body,Mt=(e,t)=>e.reduce(((e,r)=>(e[t(r)]=r,e)),Object.create(null));function Nt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?e=>e:e=>e.result;return $t(e,t,"query",{query:r,params:n},o).pipe(Ue(s))}function Ht(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:Gt(e,"doc",r),json:!0,tag:n.tag};return Xt(e,t,o).pipe(ze(Pt),Ue((e=>e.body.documents&&e.body.documents[0])))}function Ut(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:Gt(e,"doc",r.join(",")),json:!0,tag:n.tag};return Xt(e,t,o).pipe(ze(Pt),Ue((e=>{const t=Mt(e.body.documents||[],(e=>e._id));return r.map((e=>t[e]||null))})))}function zt(e,t,r,n){return st("createIfNotExists",r),Vt(e,t,r,"createIfNotExists",n)}function Lt(e,t,r,n){return st("createOrReplace",r),Vt(e,t,r,"createOrReplace",n)}function Wt(e,t,r,n){return $t(e,t,"mutate",{mutations:[{delete:Ke(r)}]},n)}function Bt(e,t,r,n){const o=r instanceof bt||r instanceof vt||r instanceof Rt||r instanceof It?r.serialize():r;return $t(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId},n)}function $t(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":ht(n),c=!s&&a.length<11264,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o,y=Gt(e,r,u),m={method:c?"GET":"POST",uri:y,json:!0,body:c?void 0:n,query:s&&qt(o),timeout:h,headers:f,token:d,tag:p,canUseCdn:i};return Xt(e,t,m).pipe(ze(Pt),Ue(Dt),Ue((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function Vt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s={[n]:r},i=Object.assign({returnFirst:!0,returnDocuments:!0},o);return $t(e,t,"mutate",{mutations:[s]},i)}function Xt(e,t,r){const n=r.url||r.uri,o=e.config(),s=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn,i=o.useCdn&&s,a=r.tag&&o.requestTagPrefix?[o.requestTagPrefix,r.tag].join("."):r.tag||o.requestTagPrefix;a&&(r.query={tag:at(a),...r.query});const c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[Ze]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o})}(o,Object.assign({},r,{url:Yt(e,n,i)}));return new Fe((e=>t(c,o.requester).subscribe(e)))}function Jt(e,t,r){return Xt(e,t,r).pipe(ze((e=>"response"===e.type)),Ue((e=>e.body)))}function Gt(e,t,r){const n=e.config(),o=it(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Yt(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=e.config(),s=r?o:n;return"".concat(s,"/").concat(t.replace(/^\//,""))}var Zt,Kt,Qt,er,tr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},rr=(e,t,r)=>(tr(e,t,"read from private field"),r?r.call(e):t.get(e)),nr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},or=(e,t,r,n)=>(tr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class sr{constructor(e,t){nr(this,Zt,void 0),nr(this,Kt,void 0),or(this,Zt,e),or(this,Kt,t)}upload(e,t,r){return ar(rr(this,Zt),rr(this,Kt),e,t,r)}}Zt=new WeakMap,Kt=new WeakMap;class ir{constructor(e,t){nr(this,Qt,void 0),nr(this,er,void 0),or(this,Qt,e),or(this,er,t)}upload(e,t,r){return He(ar(rr(this,Qt),rr(this,er),e,t,r).pipe(ze((e=>"response"===e.type)),Ue((e=>e.body.document))))}}function ar(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};rt(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=it(e.config()),a="image"===r?"images":"files",c=cr(o,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,m={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(m.sourceId=y.id,m.sourceName=y.name,m.sourceUrl=y.url),Xt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:m,body:n})}function cr(e,t){return"undefined"!=typeof window&&t instanceof window.File?Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}Qt=new WeakMap,er=new WeakMap;var ur,lr,hr,dr,pr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},fr=(e,t,r)=>(pr(e,t,"read from private field"),r?r.call(e):t.get(e)),yr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},mr=(e,t,r,n)=>(pr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class gr{constructor(e,t){yr(this,ur,void 0),yr(this,lr,void 0),mr(this,ur,e),mr(this,lr,t)}getLoginProviders(){return Jt(fr(this,ur),fr(this,lr),{uri:"/auth/providers"})}logout(){return Jt(fr(this,ur),fr(this,lr),{uri:"/auth/logout",method:"POST"})}}ur=new WeakMap,lr=new WeakMap;class vr{constructor(e,t){yr(this,hr,void 0),yr(this,dr,void 0),mr(this,hr,e),mr(this,dr,t)}getLoginProviders(){return He(Jt(fr(this,hr),fr(this,dr),{uri:"/auth/providers"}))}logout(){return He(Jt(fr(this,hr),fr(this,dr),{uri:"/auth/logout",method:"POST"}))}}hr=new WeakMap,dr=new WeakMap;function wr(e){return"https://docs.sanity.io/help/"+e}const br=e=>(e=>{let t,r=!1;return function(){return r||(t=e(...arguments),r=!0),t}})((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return console.warn(e.join(" "),...r)})),Cr=br(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(wr("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),Er=br(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(wr("js-client-browser-token")," for more information and how to hide this warning.")]),xr=br(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(wr("js-client-api-version"))]),Tr={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Or=["localhost","127.0.0.1","0.0.0.0"],_r=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||xr();const n=Object.assign({},Tr,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=wr("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==Or.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?Er():void 0===n.useCdn&&Cr(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&tt(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?at(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===Tr.apiHost,n.useCdn=Boolean(n.useCdn)&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n};var jr=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{}),Sr=(e,t)=>t.reduce(((t,r)=>(void 0===e[r]||(t[r]=e[r]),t)),{});const kr=Be,Rr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Ar={includeResult:!0};function Ir(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={...jr(r,Ar),tag:a},u=Sr(c,Rr),l=ht({query:e,params:t,options:{tag:a,...u}}),h="".concat(n).concat(Gt(this,"listen",l));if(h.length>14800)return new Fe((e=>e.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],p=-1!==d.indexOf("reconnect"),f={};return(o||s)&&(f.withCredentials=!0),o&&(f.headers={Authorization:"Bearer ".concat(o)}),new Fe((e=>{let t,r=u(),n=!1;function o(){n||(p&&e.next({type:"reconnect"}),n||r.readyState===kr.CLOSED&&(c(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(qr(t))}function i(t){const r=Fr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",s,!1),r.removeEventListener("disconnect",a,!1),d.forEach((e=>r.removeEventListener(e,i,!1))),r.close()}function u(){const e=new kr(h,f);return e.addEventListener("error",o,!1),e.addEventListener("channelError",s,!1),e.addEventListener("disconnect",a,!1),d.forEach((t=>e.addEventListener(t,i,!1))),e}function l(){r=u()}return function(){n=!0,c()}}))}function Fr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}function qr(e){if(e instanceof Error)return e;const t=Fr(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}var Pr,Dr,Mr,Nr,Hr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ur=(e,t,r)=>(Hr(e,t,"read from private field"),r?r.call(e):t.get(e)),zr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Lr=(e,t,r,n)=>(Hr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Wr{constructor(e,t){zr(this,Pr,void 0),zr(this,Dr,void 0),Lr(this,Pr,e),Lr(this,Dr,t)}create(e,t){return $r(Ur(this,Pr),Ur(this,Dr),"PUT",e,t)}edit(e,t){return $r(Ur(this,Pr),Ur(this,Dr),"PATCH",e,t)}delete(e){return $r(Ur(this,Pr),Ur(this,Dr),"DELETE",e)}list(){return Jt(Ur(this,Pr),Ur(this,Dr),{uri:"/datasets"})}}Pr=new WeakMap,Dr=new WeakMap;class Br{constructor(e,t){zr(this,Mr,void 0),zr(this,Nr,void 0),Lr(this,Mr,e),Lr(this,Nr,t)}create(e,t){return He($r(Ur(this,Mr),Ur(this,Nr),"PUT",e,t))}edit(e,t){return He($r(Ur(this,Mr),Ur(this,Nr),"PATCH",e,t))}delete(e){return He($r(Ur(this,Mr),Ur(this,Nr),"DELETE",e))}list(){return He(Jt(Ur(this,Mr),Ur(this,Nr),{uri:"/datasets"}))}}function $r(e,t,r,n,o){return tt(n),Jt(e,t,{method:r,uri:"/datasets/".concat(n),body:o})}Mr=new WeakMap,Nr=new WeakMap;var Vr,Xr,Jr,Gr,Yr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Zr=(e,t,r)=>(Yr(e,t,"read from private field"),r?r.call(e):t.get(e)),Kr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Qr=(e,t,r,n)=>(Yr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class en{constructor(e,t){Kr(this,Vr,void 0),Kr(this,Xr,void 0),Qr(this,Vr,e),Qr(this,Xr,t)}list(){return Jt(Zr(this,Vr),Zr(this,Xr),{uri:"/projects"})}getById(e){return Jt(Zr(this,Vr),Zr(this,Xr),{uri:"/projects/".concat(e)})}}Vr=new WeakMap,Xr=new WeakMap;class tn{constructor(e,t){Kr(this,Jr,void 0),Kr(this,Gr,void 0),Qr(this,Jr,e),Qr(this,Gr,t)}list(){return He(Jt(Zr(this,Jr),Zr(this,Gr),{uri:"/projects"}))}getById(e){return He(Jt(Zr(this,Jr),Zr(this,Gr),{uri:"/projects/".concat(e)}))}}Jr=new WeakMap,Gr=new WeakMap;var rn,nn,on,sn,an=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},cn=(e,t,r)=>(an(e,t,"read from private field"),r?r.call(e):t.get(e)),un=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ln=(e,t,r,n)=>(an(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class hn{constructor(e,t){un(this,rn,void 0),un(this,nn,void 0),ln(this,rn,e),ln(this,nn,t)}getById(e){return Jt(cn(this,rn),cn(this,nn),{uri:"/users/".concat(e)})}}rn=new WeakMap,nn=new WeakMap;class dn{constructor(e,t){un(this,on,void 0),un(this,sn,void 0),ln(this,on,e),ln(this,sn,t)}getById(e){return He(Jt(cn(this,on),cn(this,sn),{uri:"/users/".concat(e)}))}}on=new WeakMap,sn=new WeakMap;var pn,fn,yn,mn,gn=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},vn=(e,t,r)=>(gn(e,t,"read from private field"),r?r.call(e):t.get(e)),wn=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},bn=(e,t,r,n)=>(gn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const Cn=class{constructor(e,t){wn(this,pn,void 0),wn(this,fn,void 0),this.config(t),bn(this,fn,e),this.assets=new sr(this,vn(this,fn)),this.auth=new gr(this,vn(this,fn)),this.datasets=new Wr(this,vn(this,fn)),this.projects=new en(this,vn(this,fn)),this.users=new hn(this,vn(this,fn))}clone(){return new Cn(vn(this,fn),this.config())}config(e){if(void 0===e)return{...vn(this,pn)};if(vn(this,pn)&&!1===vn(this,pn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return bn(this,pn,_r(e,vn(this,pn)||{})),this}withConfig(e){return new Cn(vn(this,fn),{...this.config(),...e})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Nt(this,vn(this,fn),e,t,r)}getDocument(e,t){return Ht(this,vn(this,fn),e,t)}getDocuments(e,t){return Ut(this,vn(this,fn),e,t)}create(e,t){return Vt(this,vn(this,fn),e,"create",t)}createIfNotExists(e,t){return zt(this,vn(this,fn),e,t)}createOrReplace(e,t){return Lt(this,vn(this,fn),e,t)}delete(e,t){return Wt(this,vn(this,fn),e,t)}mutate(e,t){return Bt(this,vn(this,fn),e,t)}patch(e,t){return new vt(e,t,this)}transaction(e){return new It(e,this)}request(e){return Jt(this,vn(this,fn),e)}};let En=Cn;pn=new WeakMap,fn=new WeakMap;const xn=class{constructor(e,t){wn(this,yn,void 0),wn(this,mn,void 0),this.listen=Ir,this.observable=new En(e,t),this.config(t),bn(this,mn,e),this.assets=new ir(this,vn(this,mn)),this.auth=new vr(this,vn(this,mn)),this.datasets=new Br(this,vn(this,mn)),this.projects=new tn(this,vn(this,mn)),this.users=new dn(this,vn(this,mn))}clone(){return new xn(vn(this,mn),this.config())}config(e){if(void 0===e)return{...vn(this,yn)};if(vn(this,yn)&&!1===vn(this,yn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable.config(e),bn(this,yn,_r(e,vn(this,yn)||{})),this}withConfig(e){return new xn(vn(this,mn),{...this.config(),...e})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return He(Nt(this,vn(this,mn),e,t,r))}getDocument(e,t){return He(Ht(this,vn(this,mn),e,t))}getDocuments(e,t){return He(Ut(this,vn(this,mn),e,t))}create(e,t){return He(Vt(this,vn(this,mn),e,"create",t))}createIfNotExists(e,t){return He(zt(this,vn(this,mn),e,t))}createOrReplace(e,t){return He(Lt(this,vn(this,mn),e,t))}delete(e,t){return He(Wt(this,vn(this,mn),e,t))}mutate(e,t){return He(Bt(this,vn(this,mn),e,t))}patch(e,t){return new bt(e,t,this)}transaction(e){return new Rt(e,this)}request(e){return He(Jt(this,vn(this,mn),e))}dataRequest(e,t,r){return He($t(this,vn(this,mn),e,t,r))}};let Tn=xn;yn=new WeakMap,mn=new WeakMap;const On=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$;return M(e,t)}([...e,Ye,ee(),te(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},Ge,oe({implementation:Fe})]);function r(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return r({maxRedirects:0,...e})}return r.defaultRequester=t,r}([]),_n=On.defaultRequester;e.BasePatch=mt,e.BaseTransaction=St,e.ClientError=$e,e.ObservablePatch=vt,e.ObservableSanityClient=En,e.ObservableTransaction=It,e.Patch=bt,e.SanityClient=Tn,e.ServerError=Ve,e.Transaction=Rt,e.createClient=function(e){return new Tn(On,e)},e.requester=_n}));
|