@sanity/client 6.12.3 → 6.12.4
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/_chunks/{browserMiddleware-zDVeirri.js → browserMiddleware-FL0Mlm8l.js} +2 -2
- package/dist/_chunks/{browserMiddleware-zDVeirri.js.map → browserMiddleware-FL0Mlm8l.js.map} +1 -1
- package/dist/_chunks/{browserMiddleware-IWUpjfF7.cjs → browserMiddleware-dqqEd6vl.cjs} +2 -2
- package/dist/_chunks/{browserMiddleware-IWUpjfF7.cjs.map → browserMiddleware-dqqEd6vl.cjs.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-Gh18jsRe.cjs → nodeMiddleware-iUs-kdpz.cjs} +3 -3
- package/dist/_chunks/{nodeMiddleware-Gh18jsRe.cjs.map → nodeMiddleware-iUs-kdpz.cjs.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-OX5-R8Hk.js → nodeMiddleware-scsxYdRh.js} +3 -3
- package/dist/_chunks/{nodeMiddleware-OX5-R8Hk.js.map → nodeMiddleware-scsxYdRh.js.map} +1 -1
- package/dist/_chunks/{stegaEncodeSourceMap-gZIRaYar.js → stegaEncodeSourceMap-LDHMEOVo.js} +9 -11
- package/dist/_chunks/{stegaEncodeSourceMap-gZIRaYar.js.map → stegaEncodeSourceMap-LDHMEOVo.js.map} +1 -1
- package/dist/_chunks/{stegaEncodeSourceMap-OKnT3zAM.js → stegaEncodeSourceMap-OHUCEAgw.js} +9 -11
- package/dist/_chunks/stegaEncodeSourceMap-OHUCEAgw.js.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-ZDmZYDbM.cjs → stegaEncodeSourceMap-hWSK_ZZK.cjs} +9 -11
- package/dist/_chunks/stegaEncodeSourceMap-hWSK_ZZK.cjs.map +1 -0
- package/dist/_chunks/{stegaEncodeSourceMap-YNx-0kzT.cjs → stegaEncodeSourceMap-oPlkdofZ.cjs} +9 -11
- package/dist/_chunks/{stegaEncodeSourceMap-YNx-0kzT.cjs.map → stegaEncodeSourceMap-oPlkdofZ.cjs.map} +1 -1
- package/dist/index.browser.cjs +1 -1
- package/dist/index.browser.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/stega.browser.cjs +2 -2
- package/dist/stega.browser.js +3 -3
- package/dist/stega.cjs +2 -2
- package/dist/stega.js +3 -3
- package/package.json +6 -6
- package/src/stega/stegaEncodeSourceMap.ts +7 -9
- package/umd/sanityClient.js +9 -11
- package/umd/sanityClient.min.js +1 -1
- package/dist/_chunks/stegaEncodeSourceMap-OKnT3zAM.js.map +0 -1
- package/dist/_chunks/stegaEncodeSourceMap-ZDmZYDbM.cjs.map +0 -1
package/umd/sanityClient.min.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
function R(e){return"[object Object]"===Object.prototype.toString.call(e)}!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=M(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(I,I.exports);const D="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),F=["boolean","string","number"];function q(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o;return!("function"==typeof t.pipe)&&!D(t)&&(-1!==F.indexOf(typeof t)||Array.isArray(t)||!1!==R(n=t)&&(void 0===(r=n.constructor)||!1!==R(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 N(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 U={};"undefined"!=typeof globalThis?U=globalThis:"undefined"!=typeof window?U=window:"undefined"!=typeof global?U=global:"undefined"!=typeof self&&(U=self);var W=U;function H(e={}){const t=e.implementation||W.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 z{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const L=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 z(e),t(this.reason))}))}};L.source=()=>{let e;return{token:new L((t=>{e=t})),cancel:e}};var $=(e,t,n)=>("GET"===n.method||"HEAD"===n.method)&&(e.isNetworkError||!1);function B(e){return 100*Math.pow(2,e)+100*Math.random()}const J=(e={})=>(e=>{const t=e.maxRetries||5,n=e.retryDelay||B,r=e.shouldRetry;return{onError:(e,o)=>{const i=o.options,s=i.maxRetries||t,a=i.shouldRetry||r,c=i.attemptNumber||0;if(null!==(u=i.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,i)||c>=s)return e;const l=Object.assign({},o,{options:Object.assign({},i,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),n(c)),null}}})({shouldRetry:$,...e});J.shouldRetry=$;var G=function(e,t){return G=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])},G(e,t)};function V(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}G(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Y(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function X(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function K(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 Z(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function Q(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;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 ee(e){return this instanceof ee?(this.v=e,this):new ee(e)}function te(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof ee?Promise.resolve(n.value.v).then(c,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function ne(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=K(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function re(e){return"function"==typeof e}function oe(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}"function"==typeof SuppressedError&&SuppressedError;var ie=oe((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 se(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ae=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 i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=K(i),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else i.remove(this);var c=this.initialTeardown;if(re(c))try{c()}catch(e){o=e instanceof ie?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=K(u),d=l.next();!d.done;d=l.next()){var f=d.value;try{ue(f)}catch(e){o=null!=o?o:[],e instanceof ie?o=Q(Q([],Z(o)),Z(e.errors)):o.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new ie(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ue(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)&&se(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&se(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ce(e){return e instanceof ae||e&&"closed"in e&&re(e.remove)&&re(e.add)&&re(e.unsubscribe)}function ue(e){re(e)?e():e.unsubscribe()}ae.EMPTY;var le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},de={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Q([e,t],Z(n)))},clearTimeout:function(e){var t=de.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function fe(e){de.setTimeout((function(){throw e}))}function he(){}var pe=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ce(t)&&t.add(n)):n.destination=we,n}return V(t,e),t.create=function(e,t,n){return new ve(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}(ae),ye=Function.prototype.bind;function ge(e,t){return ye.call(e,t)}var me=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){be(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){be(e)}else be(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){be(e)}},e}(),ve=function(e){function t(t,n,r){var o,i,s=e.call(this)||this;re(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&le.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&ge(t.next,i),error:t.error&&ge(t.error,i),complete:t.complete&&ge(t.complete,i)}):o=t;return s.destination=new me(o),s}return V(t,e),t}(pe);function be(e){fe(e)}var we={closed:!0,next:he,error:function(e){throw e},complete:he},Ce="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ee(e){return e}function xe(e){return 0===e.length?Ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Se=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,i=(r=e)&&r instanceof pe||function(e){return e&&re(e.next)&&re(e.error)&&re(e.complete)}(r)&&ce(r)?e:new ve(e,t,n);return function(){var e=o,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}(),i},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=Te(t))((function(t,r){var o=new ve({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[Ce]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Te(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 Te(e){var t;return null!==(t=null!=e?e:le.Promise)&&void 0!==t?t:Promise}function _e(e){return function(t){if(function(e){return re(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 Oe(e,t,n,r,o){return new je(e,t,n,r,o)}var je=function(e){function t(t,n,r,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,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 V(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}(pe);var ke=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ae(e){return re(null==e?void 0:e.then)}function Ie(e){return re(e[Ce])}function Pe(e){return Symbol.asyncIterator&&re(null==e?void 0:e[Symbol.asyncIterator])}function Me(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Re="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function De(e){return re(null==e?void 0:e[Re])}function Fe(e){return te(this,arguments,(function(){var t,n,r;return X(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ee(t.read())];case 3:return n=o.sent(),r=n.value,n.done?[4,ee(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ee(r)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function qe(e){return re(null==e?void 0:e.getReader)}function Ne(e){if(e instanceof Se)return e;if(null!=e){if(Ie(e))return o=e,new Se((function(e){var t=o[Ce]();if(re(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ke(e))return r=e,new Se((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(Ae(e))return n=e,new Se((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,fe)}));if(Pe(e))return Ue(e);if(De(e))return t=e,new Se((function(e){var n,r;try{for(var o=K(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}e.complete()}));if(qe(e))return Ue(Fe(e))}var t,n,r,o;throw Me(e)}function Ue(e){return new Se((function(t){(function(e,t){var n,r,o,i;return Y(this,void 0,void 0,(function(){var s,a;return X(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=ne(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function We(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var i=t.schedule((function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(i),!o)return i}function He(e,t){return void 0===t&&(t=0),_e((function(n,r){n.subscribe(Oe(r,(function(n){return We(r,e,(function(){return r.next(n)}),t)}),(function(){return We(r,e,(function(){return r.complete()}),t)}),(function(n){return We(r,e,(function(){return r.error(n)}),t)})))}))}function ze(e,t){return void 0===t&&(t=0),_e((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function Le(e,t){if(!e)throw new Error("Iterable cannot be null");return new Se((function(n){We(n,t,(function(){var r=e[Symbol.asyncIterator]();We(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function $e(e,t){if(null!=e){if(Ie(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(ke(e))return function(e,t){return new Se((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(Ae(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(Pe(e))return Le(e,t);if(De(e))return function(e,t){return new Se((function(n){var r;return We(n,t,(function(){r=e[Re](),We(n,t,(function(){var e,t,o;try{t=(e=r.next()).value,o=e.done}catch(e){return void n.error(e)}o?n.complete():n.next(t)}),0,!0)})),function(){return re(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(qe(e))return function(e,t){return Le(Fe(e),t)}(e,t)}throw Me(e)}function Be(e,t){return t?$e(e,t):Ne(e)}var Je=oe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ge(e,t){var n="object"==typeof t;return new Promise((function(r,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?r(i):n?r(t.defaultValue):o(new Je)}})}))}function Ve(e,t){return _e((function(n,r){var o=0;n.subscribe(Oe(r,(function(n){r.next(e.call(t,n,o++))})))}))}var Ye=Array.isArray;function Xe(e){return Ve((function(t){return function(e,t){return Ye(t)?e.apply(void 0,Q([],Z(t))):e(t)}(e,t)}))}function Ke(e,t,n){e?We(n,e,t):t()}var Ze=Array.isArray;function Qe(e,t){return _e((function(n,r){var o=0;n.subscribe(Oe(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}function et(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return re((t=e)[t.length-1])?e.pop():void 0;var t}(e);return n?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)}(et.apply(void 0,Q([],Z(e))),Xe(n)):_e((function(t,n){var r,o,i;(r=Q([t],Z(function(e){return 1===e.length&&Ze(e[0])?e[0]:e}(e))),void 0===i&&(i=Ee),function(e){Ke(o,(function(){for(var t=r.length,n=new Array(t),s=t,a=t,c=function(t){Ke(o,(function(){var c=Be(r[t],o),u=!1;c.subscribe(Oe(e,(function(r){n[t]=r,u||(u=!0,a--),a||e.next(i(n.slice()))}),(function(){--s||e.complete()})))}),e)},u=0;u<t;u++)c(u)}),e)})(n)}))}class tt extends Error{constructor(e){const t=rt(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class nt extends Error{constructor(e){const t=rt(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function rt(e){const t=e.body,n={response:e,statusCode:e.statusCode,responseBody:it(t,e),message:"",details:void 0};if(t.error&&t.message)return n.message="".concat(t.error," - ").concat(t.message),n;if(function(e){return ot(e)&&ot(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],r=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=r.length?":\n- ".concat(r.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),n.message="".concat(t.error.description).concat(o),n.details=t.error,n}return 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 ot(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function it(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const st={onResponse:e=>{if(e.statusCode>=500)throw new nt(e);if(e.statusCode>=400)throw new tt(e);return e}},at={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function ct(e,{maxRetries:t=5,retryDelay:n}){const r=j([t>0?J({retryDelay:n,maxRetries:t,shouldRetry:ut}):{},...e,at,q(),N(),{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"))}},st,H({implementation:Se})]);function o(e,t=r){return t({maxRedirects:0,...e})}return o.defaultRequester=r,o}function ut(e,t,n){const r="GET"===n.method||"HEAD"===n.method,o=(n.uri||n.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!r&&!o||!i)||J.shouldRetry(e,t,n)}function lt(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 dt=["image","file"],ft=["before","after","replace"],ht=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")},pt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},yt=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},gt=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));yt(e,t._id)},mt=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},vt=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};var bt,wt,Ct=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Et=(e,t,n)=>(Ct(e,t,"read from private field"),n?n.call(e):t.get(e)),xt=(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)},St=(e,t,n,r)=>(Ct(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Tt{constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return pt("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===ft.indexOf(e)){const e=ft.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,i=void 0===n||-1===n?-1:Math.max(0,t+n),s=o<0&&i>=0?"":i,a="".concat(e,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,r||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...lt(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,n=!0){return pt(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)}}bt=new WeakMap;let _t=class e extends Tt{constructor(e,t,n){super(e,t),xt(this,bt,void 0),St(this,bt,n)}clone(){return new e(this.selection,{...this.operations},Et(this,bt))}commit(e){if(!Et(this,bt))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 Et(this,bt).mutate({patch:this.serialize()},n)}};wt=new WeakMap;let Ot=class e extends Tt{constructor(e,t,n){super(e,t),xt(this,wt,void 0),St(this,wt,n)}clone(){return new e(this.selection,{...this.operations},Et(this,wt))}commit(e){if(!Et(this,wt))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 Et(this,wt).mutate({patch:this.serialize()},n)}};var jt,kt,At=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},It=(e,t,n)=>(At(e,t,"read from private field"),n?n.call(e):t.get(e)),Pt=(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)},Mt=(e,t,n,r)=>(At(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const Rt={returnDocuments:!1};class Dt{constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return pt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return pt(t,e),gt(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return pt(t,e),gt(t,e),this._add({[t]:e})}delete(e){return yt("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}}jt=new WeakMap;let Ft=class e extends Dt{constructor(e,t,n){super(e,n),Pt(this,jt,void 0),Mt(this,jt,t)}clone(){return new e([...this.operations],It(this,jt),this.trxId)}commit(e){if(!It(this,jt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,jt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Rt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof Ot)return this._add({patch:e.serialize()});if(n){const n=t(new Ot(e,{},It(this,jt)));if(!(n instanceof Ot))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};kt=new WeakMap;let qt=class e extends Dt{constructor(e,t,n){super(e,n),Pt(this,kt,void 0),Mt(this,kt,t)}clone(){return new e([...this.operations],It(this,kt),this.trxId)}commit(e){if(!It(this,kt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,kt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Rt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof _t)return this._add({patch:e.serialize()});if(n){const n=t(new _t(e,{},It(this,kt)));if(!(n instanceof _t))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};function Nt(e){return"https://www.sanity.io/help/"+e}const Ut=e=>function(e){let t,n=!1;return(...r)=>(n||(t=e(...r),n=!0),t)}(((...t)=>console.warn(e.join(" "),...t))),Wt=Ut(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Ht=Ut(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),zt=Ut(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Nt("js-client-browser-token")," for more information and how to hide this warning.")]),Lt=Ut(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Nt("js-client-api-version"))]),$t=Ut(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},Jt=["localhost","127.0.0.1","0.0.0.0"],Gt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},Vt=(e,t)=>{const n={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||Bt.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};n.apiVersion||Lt();const r={...Bt,...n},o=r.useProjectHostname;if("undefined"==typeof Promise){const e=Nt("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`");if("string"==typeof r.perspective&&Gt(r.perspective),"encodeSourceMap"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if("boolean"!=typeof r.stega.enabled)throw new Error("stega.enabled must be a boolean, received ".concat(r.stega.enabled));if(r.stega.enabled&&void 0===r.stega.studioUrl)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(r.stega.enabled&&"string"!=typeof r.stega.studioUrl&&"function"!=typeof r.stega.studioUrl)throw new Error("stega.studioUrl must be a string or a function, received ".concat(r.stega.studioUrl));const i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(e=>-1!==Jt.indexOf(e))(window.location.hostname);i&&s&&r.token&&!0!==r.ignoreBrowserTokenWarning?zt():void 0===r.useCdn&&Wt(),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&&ht(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?vt(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===Bt.apiHost,r.useCdn=!1!==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},Yt="X-Sanity-Project-ID";var Xt={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},Kt={0:8203,1:8204,2:8205,3:65279},Zt=new Array(4).fill(String.fromCodePoint(Kt[0])).join("");function Qt(e,t,n="auto"){return!0===n||"auto"===n&&(function(e){return!!Number.isNaN(Number(e))&&Boolean(Date.parse(e))}(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${function(e){let t=JSON.stringify(e);return`${Zt}${Array.from(t).map((e=>{let n=e.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map((e=>String.fromCodePoint(Kt[e]))).join("")})).join("")}`}(t)}`}Object.fromEntries(Object.entries(Kt).map((e=>e.reverse()))),Object.fromEntries(Object.entries(Xt).map((e=>e.reverse())));var en=`${Object.values(Xt).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,tn=new RegExp(`[${en}]{4,}`,"gu");function nn(e){try{return JSON.parse(JSON.stringify(e,((e,t)=>{return"string"!=typeof t?t:(n=t,{cleaned:n.replace(tn,""),encoded:(null==(r=n.match(tn))?void 0:r[0])||""}).cleaned;var n,r})))}catch{return e}}const rn=({query:e,params:t={},options:n={}})=>{const r=new URLSearchParams,{tag:o,...i}=n;o&&r.append("tag",o),r.append("query",e);for(const[e,n]of Object.entries(t))r.append("$".concat(e),JSON.stringify(n));for(const[e,t]of Object.entries(i))t&&r.append(e,"".concat(t));return"?".concat(r)},on=(e={})=>{return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,n=!0,!1===t?void 0:void 0===t?n:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,n},sn=e=>"response"===e.type,an=e=>e.body,cn=11264;function un(e,t,n,r,o={},i={}){const s="stega"in i?{...n||{},..."boolean"==typeof i.stega?{enabled:i.stega}:i.stega||{}}:n,a=s.enabled?nn(o):o,c=!1===i.filterResponse?e=>e:e=>e.result,{cache:u,next:l,...d}={useAbortSignal:void 0!==i.signal,resultSourceMap:s.enabled?"withKeyArraySelector":i.resultSourceMap,...i},f=gn(e,t,"query",{query:r,params:a},void 0!==u||void 0!==l?{...d,fetch:{cache:u,next:l}}:d);return s.enabled?f.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return et.apply(void 0,Q([],Z(e)))}(Be(Promise.resolve().then((function(){return Gr})).then((function(e){return e.stegaEncodeSourceMap$1})).then((({stegaEncodeSourceMap:e})=>e)))),Ve((([e,t])=>{const n=t(e.result,e.resultSourceMap,s);return c({...e,result:n})}))):f.pipe(Ve(c))}function ln(e,t,n,r={}){return vn(e,t,{uri:wn(e,"doc",n),json:!0,tag:r.tag}).pipe(Qe(sn),Ve((e=>e.body.documents&&e.body.documents[0])))}function dn(e,t,n,r={}){return vn(e,t,{uri:wn(e,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(Qe(sn),Ve((e=>{const t=(r=e.body.documents||[],o=e=>e._id,r.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var r,o;return n.map((e=>t[e]||null))})))}function fn(e,t,n,r){return gt("createIfNotExists",n),mn(e,t,n,"createIfNotExists",r)}function hn(e,t,n,r){return gt("createOrReplace",n),mn(e,t,n,"createOrReplace",r)}function pn(e,t,n,r){return gn(e,t,"mutate",{mutations:[{delete:lt(n)}]},r)}function yn(e,t,n,r){let o;o=n instanceof Ot||n instanceof _t?{patch:n.serialize()}:n instanceof Ft||n instanceof qt?n.serialize():n;return gn(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId||void 0},r)}function gn(e,t,n,r,o={}){const i="mutate"===n,s="query"===n,a=i?"":rn(r),c=!i&&a.length<cn,u=c?a:"",l=o.returnFirst,{timeout:d,token:f,tag:h,headers:p}=o;return vn(e,t,{method:c?"GET":"POST",uri:wn(e,n,u),json:!0,body:c?void 0:r,query:i&&on(o),timeout:d,headers:p,token:f,tag:h,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:s,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(Qe(sn),Ve(an),Ve((e=>{if(!i)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 mn(e,t,n,r,o={}){return gn(e,t,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function vn(e,t,n){var r,o;const i=n.url||n.uri,s=e.config(),a=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===i.indexOf("/data/"):n.canUseCdn;let c=(null!=(r=n.useCdn)?r:s.useCdn)&&a;const u=n.tag&&s.requestTagPrefix?[s.requestTagPrefix,n.tag].join("."):n.tag||s.requestTagPrefix;if(u&&null!==n.tag&&(n.query={tag:vt(u),...n.query}),["GET","HEAD","POST"].indexOf(n.method||"GET")>=0&&0===i.indexOf("/data/query/")){const e=null!=(o=n.resultSourceMap)?o:s.resultSourceMap;void 0!==e&&!1!==e&&(n.query={resultSourceMap:e,...n.query});const t=n.perspective||s.perspective;"string"==typeof t&&"raw"!==t&&(Gt(t),n.query={perspective:t,...n.query},"previewDrafts"===t&&c&&(c=!1,Ht()))}const l=function(e,t={}){const n={},r=t.token||e.token;r&&(n.Authorization="Bearer ".concat(r)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(n[Yt]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),i=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},n,t.headers||{}),timeout:void 0===i?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(s,Object.assign({},n,{url:Cn(e,i,c)})),d=new Se((e=>t(l,s.requester).subscribe(e)));return n.signal?d.pipe((f=n.signal,e=>new Se((t=>{const n=()=>t.error(function(e){var t,n;if(En)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const r=new Error(null!=(n=null==e?void 0:e.reason)?n:"The operation was aborted.");return r.name="AbortError",r}(f));if(f&&f.aborted)return void n();const r=e.subscribe(t);return f.addEventListener("abort",n),()=>{f.removeEventListener("abort",n),r.unsubscribe()}})))):d;var f}function bn(e,t,n){return vn(e,t,n).pipe(Qe((e=>"response"===e.type)),Ve((e=>e.body)))}function wn(e,t,n){const r=e.config(),o=mt(r),i="/".concat(t,"/").concat(o),s=n?"".concat(i,"/").concat(n):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")}function Cn(e,t,n=!1){const{url:r,cdnUrl:o}=e.config();return"".concat(n?o:r,"/").concat(t.replace(/^\//,""))}const En=Boolean(globalThis.DOMException);var xn,Sn,Tn,_n,On=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},jn=(e,t,n)=>(On(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)},An=(e,t,n,r)=>(On(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class In{constructor(e,t){kn(this,xn,void 0),kn(this,Sn,void 0),An(this,xn,e),An(this,Sn,t)}upload(e,t,n){return Mn(jn(this,xn),jn(this,Sn),e,t,n)}}xn=new WeakMap,Sn=new WeakMap;class Pn{constructor(e,t){kn(this,Tn,void 0),kn(this,_n,void 0),An(this,Tn,e),An(this,_n,t)}upload(e,t,n){return Ge(Mn(jn(this,Tn),jn(this,_n),e,t,n).pipe(Qe((e=>"response"===e.type)),Ve((e=>e.body.document))))}}function Mn(e,t,n,r,o={}){(e=>{if(-1===dt.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(dt.join(", ")))})(n);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=mt(e.config()),a="image"===n?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,r),{tag:u,label:l,title:d,description:f,creditLine:h,filename:p,source:y}=c,g={label:l,title:d,description:f,filename:p,meta:i,creditLine:h};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),vn(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(s),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:r})}Tn=new WeakMap,_n=new WeakMap;var Rn=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{});const Dn=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Fn={includeResult:!0};function qn(e,t,n={}){const{url:r,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=n.tag&&s?[s,n.tag].join("."):n.tag,c={...Rn(n,Fn),tag:a},u=(l=c,Dn.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const d=rn({query:e,params:t,options:{tag:a,...u}}),f="".concat(r).concat(wn(this,"listen",d));if(f.length>14800)return new Se((e=>e.error(new Error("Query too large for listener"))));const h=c.events?c.events:["mutation"],p=-1!==h.indexOf("reconnect"),y={};return(o||i)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new Se((e=>{let t,n;u().then((e=>{t=e})).catch((t=>{e.error(t),d()}));let r=!1;function o(){r||(p&&e.next({type:"reconnect"}),r||t.readyState===t.CLOSED&&(c(),clearTimeout(n),n=setTimeout(l,100)))}function i(t){e.error(function(e){if(e instanceof Error)return e;const t=Nn(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function s(t){const n=Nn(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",i),t.removeEventListener("disconnect",a),h.forEach((e=>t.removeEventListener(e,s))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Xr})),t=new e(f,y);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),h.forEach((e=>t.addEventListener(e,s))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),d()}))}function d(){r=!0,c()}return d}))}function Nn(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var Un,Wn,Hn,zn,Ln=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},$n=(e,t,n)=>(Ln(e,t,"read from private field"),n?n.call(e):t.get(e)),Bn=(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)},Jn=(e,t,n,r)=>(Ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Gn{constructor(e,t){Bn(this,Un,void 0),Bn(this,Wn,void 0),Jn(this,Un,e),Jn(this,Wn,t)}create(e,t){return Yn($n(this,Un),$n(this,Wn),"PUT",e,t)}edit(e,t){return Yn($n(this,Un),$n(this,Wn),"PATCH",e,t)}delete(e){return Yn($n(this,Un),$n(this,Wn),"DELETE",e)}list(){return bn($n(this,Un),$n(this,Wn),{uri:"/datasets",tag:null})}}Un=new WeakMap,Wn=new WeakMap;class Vn{constructor(e,t){Bn(this,Hn,void 0),Bn(this,zn,void 0),Jn(this,Hn,e),Jn(this,zn,t)}create(e,t){return Ge(Yn($n(this,Hn),$n(this,zn),"PUT",e,t))}edit(e,t){return Ge(Yn($n(this,Hn),$n(this,zn),"PATCH",e,t))}delete(e){return Ge(Yn($n(this,Hn),$n(this,zn),"DELETE",e))}list(){return Ge(bn($n(this,Hn),$n(this,zn),{uri:"/datasets",tag:null}))}}function Yn(e,t,n,r,o){return ht(r),bn(e,t,{method:n,uri:"/datasets/".concat(r),body:o,tag:null})}Hn=new WeakMap,zn=new WeakMap;var Xn,Kn,Zn,Qn,er=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},tr=(e,t,n)=>(er(e,t,"read from private field"),n?n.call(e):t.get(e)),nr=(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)},rr=(e,t,n,r)=>(er(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class or{constructor(e,t){nr(this,Xn,void 0),nr(this,Kn,void 0),rr(this,Xn,e),rr(this,Kn,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return bn(tr(this,Xn),tr(this,Kn),{uri:t})}getById(e){return bn(tr(this,Xn),tr(this,Kn),{uri:"/projects/".concat(e)})}}Xn=new WeakMap,Kn=new WeakMap;class ir{constructor(e,t){nr(this,Zn,void 0),nr(this,Qn,void 0),rr(this,Zn,e),rr(this,Qn,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Ge(bn(tr(this,Zn),tr(this,Qn),{uri:t}))}getById(e){return Ge(bn(tr(this,Zn),tr(this,Qn),{uri:"/projects/".concat(e)}))}}Zn=new WeakMap,Qn=new WeakMap;var sr,ar,cr,ur,lr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},dr=(e,t,n)=>(lr(e,t,"read from private field"),n?n.call(e):t.get(e)),fr=(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)},hr=(e,t,n,r)=>(lr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class pr{constructor(e,t){fr(this,sr,void 0),fr(this,ar,void 0),hr(this,sr,e),hr(this,ar,t)}getById(e){return bn(dr(this,sr),dr(this,ar),{uri:"/users/".concat(e)})}}sr=new WeakMap,ar=new WeakMap;class yr{constructor(e,t){fr(this,cr,void 0),fr(this,ur,void 0),hr(this,cr,e),hr(this,ur,t)}getById(e){return Ge(bn(dr(this,cr),dr(this,ur),{uri:"/users/".concat(e)}))}}cr=new WeakMap,ur=new WeakMap;var gr,mr,vr,br,wr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Cr=(e,t,n)=>(wr(e,t,"read from private field"),n?n.call(e):t.get(e)),Er=(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)},xr=(e,t,n,r)=>(wr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);gr=new WeakMap,mr=new WeakMap;let Sr=class e{constructor(e,t=Bt){Er(this,gr,void 0),Er(this,mr,void 0),this.listen=qn,this.config(t),xr(this,mr,e),this.assets=new In(this,Cr(this,mr)),this.datasets=new Gn(this,Cr(this,mr)),this.projects=new or(this,Cr(this,mr)),this.users=new pr(this,Cr(this,mr))}clone(){return new e(Cr(this,mr),this.config())}config(e){if(void 0===e)return{...Cr(this,gr)};if(Cr(this,gr)&&!1===Cr(this,gr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return xr(this,gr,Vt(e,Cr(this,gr)||{})),this}withConfig(t){const n=this.config();return new e(Cr(this,mr),{...n,...t,stega:{...n.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,n){return un(this,Cr(this,mr),Cr(this,gr).stega,e,t,n)}getDocument(e,t){return ln(this,Cr(this,mr),e,t)}getDocuments(e,t){return dn(this,Cr(this,mr),e,t)}create(e,t){return mn(this,Cr(this,mr),e,"create",t)}createIfNotExists(e,t){return fn(this,Cr(this,mr),e,t)}createOrReplace(e,t){return hn(this,Cr(this,mr),e,t)}delete(e,t){return pn(this,Cr(this,mr),e,t)}mutate(e,t){return yn(this,Cr(this,mr),e,t)}patch(e,t){return new _t(e,t,this)}transaction(e){return new qt(e,this)}request(e){return bn(this,Cr(this,mr),e)}getUrl(e,t){return Cn(this,e,t)}getDataUrl(e,t){return wn(this,e,t)}};vr=new WeakMap,br=new WeakMap;let Tr=class e{constructor(e,t=Bt){Er(this,vr,void 0),Er(this,br,void 0),this.listen=qn,this.config(t),xr(this,br,e),this.assets=new Pn(this,Cr(this,br)),this.datasets=new Vn(this,Cr(this,br)),this.projects=new ir(this,Cr(this,br)),this.users=new yr(this,Cr(this,br)),this.observable=new Sr(e,t)}clone(){return new e(Cr(this,br),this.config())}config(e){if(void 0===e)return{...Cr(this,vr)};if(Cr(this,vr)&&!1===Cr(this,vr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),xr(this,vr,Vt(e,Cr(this,vr)||{})),this}withConfig(t){const n=this.config();return new e(Cr(this,br),{...n,...t,stega:{...n.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,n){return Ge(un(this,Cr(this,br),Cr(this,vr).stega,e,t,n))}getDocument(e,t){return Ge(ln(this,Cr(this,br),e,t))}getDocuments(e,t){return Ge(dn(this,Cr(this,br),e,t))}create(e,t){return Ge(mn(this,Cr(this,br),e,"create",t))}createIfNotExists(e,t){return Ge(fn(this,Cr(this,br),e,t))}createOrReplace(e,t){return Ge(hn(this,Cr(this,br),e,t))}delete(e,t){return Ge(pn(this,Cr(this,br),e,t))}mutate(e,t){return Ge(yn(this,Cr(this,br),e,t))}patch(e,t){return new Ot(e,t,this)}transaction(e){return new Ft(e,this)}request(e){return Ge(bn(this,Cr(this,br),e))}dataRequest(e,t,n){return Ge(gn(this,Cr(this,br),e,t,n))}getUrl(e,t){return Cn(this,e,t)}getDataUrl(e,t){return wn(this,e,t)}};const _r=function(e,t){return{requester:ct(e,{}).defaultRequester,createClient:n=>new t(ct(e,{maxRetries:n.maxRetries,retryDelay:n.retryDelay}),n)}}([],Tr),Or=_r.requester,jr=_r.createClient,kr=function(e){return function(t){return $t(),e(t)}}(jr),Ar=/_key\s*==\s*['"](.*)['"]/;function Ir(e){if(!Array.isArray(e))throw new Error("Path is not an array");return e.reduce(((e,t,n)=>{const r=typeof t;if("number"===r)return"".concat(e,"[").concat(t,"]");if("string"===r){const r=0===n?"":".";return"".concat(e).concat(r).concat(t)}if(function(e){return"string"==typeof e?Ar.test(e.trim()):"object"==typeof e&&"_key"in e}(t)&&t._key)return"".concat(e,'[_key=="').concat(t._key,'"]');if(Array.isArray(t)){const[n,r]=t;return"".concat(e,"[").concat(n,":").concat(r,"]")}throw new Error("Unsupported path segment `".concat(JSON.stringify(t),"`"))}),"")}const Pr={"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","'":"\\'","\\":"\\\\"},Mr={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t","\\'":"'","\\\\":"\\"};function Rr(e){const t=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let r;for(;null!==(r=n.exec(e));)if(void 0===r[1])if(void 0===r[2])if(void 0===r[3]);else{const e=r[3].replace(/\\(\\')/g,(e=>Mr[e]));t.push({_key:e,_index:-1})}else t.push(parseInt(r[2],10));else{const e=r[1].replace(/\\(\\|f|n|r|t|')/g,(e=>Mr[e]));t.push(e)}return t}function Dr(e){return e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))}))}function Fr(e,t){if(!(null==t?void 0:t.mappings))return;const n=function(e){return"$".concat(e.map((e=>{if("string"==typeof e){const t=e.replace(/[\f\n\r\t'\\]/g,(e=>Pr[e]));return"['".concat(t,"']")}if("number"==typeof e)return"[".concat(e,"]");if(""!==e._key){const t=e._key.replace(/['\\]/g,(e=>Pr[e]));return"[?(@._key=='".concat(t,"')]")}return"[".concat(e._index,"]")})).join(""))}(e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))})));if(void 0!==t.mappings[n])return{mapping:t.mappings[n],matchedPath:n,pathSuffix:""};const r=Object.entries(t.mappings).filter((([e])=>n.startsWith(e))).sort((([e],[t])=>t.length-e.length));if(0==r.length)return;const[o,i]=r[0];return{mapping:i,matchedPath:o,pathSuffix:n.substring(o.length)}}function qr(e){return"object"==typeof e&&null!==e}function Nr(e,t,n=[]){return function(e){return null!==e&&Array.isArray(e)}(e)?e.map(((e,r)=>{if(qr(e)){const o=e._key;if("string"==typeof o)return Nr(e,t,n.concat({_key:o,_index:r}))}return Nr(e,t,n.concat(r))})):qr(e)?Object.fromEntries(Object.entries(e).map((([e,r])=>[e,Nr(r,t,n.concat(e))]))):t(e,n)}function Ur(e,t,n){return Nr(e,((e,r)=>{if("string"!=typeof e)return e;const o=Fr(r,t);if(!o)return e;const{mapping:i,matchedPath:s}=o;if("value"!==i.type)return e;if("documentValue"!==i.source.type)return e;const a=t.documents[i.source.document],c=t.paths[i.source.path],u=Rr(s),l=Rr(c).concat(r.slice(u.length));return n({sourcePath:l,sourceDocument:a,resultPath:r,value:e})}))}const Wr="drafts.";function Hr(e){const{baseUrl:t,workspace:n="default",tool:r="default",id:o,type:i,path:s}=e;if(!t)throw new Error("baseUrl is required");if(!s)throw new Error("path is required");if(!o)throw new Error("id is required");if("/"!==t&&t.endsWith("/"))throw new Error("baseUrl must not end with a slash");const a="default"===n?void 0:n,c="default"===r?void 0:r,u=function(e){return e.startsWith(Wr)?e.slice(Wr.length):e}(o),l=Array.isArray(s)?Ir(Dr(s)):s,d=new URLSearchParams({baseUrl:t,id:u,type:i,path:l});a&&d.set("workspace",a),c&&d.set("tool",c);const f=["/"===t?"":t];a&&f.push(a);const h=["mode=presentation","id=".concat(u),"type=".concat(i),"path=".concat(encodeURIComponent(l))];return c&&h.push("tool=".concat(c)),f.push("intent","edit","".concat(h.join(";"),"?").concat(d)),f.join("/")}const zr=({sourcePath:e,value:t})=>{if(/^\d{4}-\d{2}-\d{2}/.test(n=t)&&Boolean(Date.parse(n))||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(t))return!1;var n;const r=e.at(-1);return("slug"!==e.at(-2)||"current"!==r)&&(("string"!=typeof r||!r.startsWith("_"))&&(("number"!=typeof r||"marks"!==e.at(-2))&&(("href"!==r||"number"!=typeof e.at(-2)||"markDefs"!==e.at(-3))&&("style"!==r&&"listItem"!==r&&(!e.some((e=>"meta"===e||"metadata"===e||"openGraph"===e||"seo"===e))&&("string"!=typeof r||!Lr.has(r)))))))},Lr=new Set(["color","colour","currency","email","format","gid","hex","href","hsl","hsla","icon","id","index","key","language","layout","link","linkAction","locale","lqip","page","path","ref","rgb","rgba","route","secret","slug","status","tag","template","theme","type","unit","url","username","variant","website"]);function $r(e,t,n){var r,o,i,s,a,c,u,l,d;const{filter:f,logger:h,enabled:p}=n;if(!p){const o="config.enabled must be true, don't call this function otherwise";throw null==(r=null==h?void 0:h.error)||r.call(h,"[@sanity/client/stega]: ".concat(o),{result:e,resultSourceMap:t,config:n}),new TypeError(o)}if(!t)return null==(o=null==h?void 0:h.error)||o.call(h,"[@sanity/client/stega]: Missing Content Source Map from response body",{result:e,resultSourceMap:t,config:n}),e;if(!n.studioUrl){const r="config.studioUrl must be defined";throw null==(i=null==h?void 0:h.error)||i.call(h,"[@sanity/client/stega]: ".concat(r),{result:e,resultSourceMap:t,config:n}),new TypeError(r)}const y={encoded:[],skipped:[]},g=Ur(e,t,(({sourcePath:e,sourceDocument:t,resultPath:r,value:o})=>{if(!1===("function"==typeof f?f({sourcePath:e,resultPath:r,filterDefault:zr,sourceDocument:t,value:o}):zr({sourcePath:e,resultPath:r,filterDefault:zr,sourceDocument:t,value:o})))return h&&y.skipped.push({path:Br(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length}),o;h&&y.encoded.push({path:Br(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length});const{baseUrl:i,workspace:s,tool:a}=function(e){let t="string"==typeof e?e:e.baseUrl;return"/"!==t&&(t=t.replace(/\/$/,"")),"string"==typeof e?{baseUrl:t}:{...e,baseUrl:t}}("function"==typeof n.studioUrl?n.studioUrl(t):n.studioUrl);if(!i)return o;const{_id:c,_type:u}=t;return Qt(o,{origin:"sanity.io",href:Hr({baseUrl:i,workspace:s,tool:a,id:c,type:u,path:e})},!1)}));if(h){const e=y.skipped.length,t=y.encoded.length;if((e||t)&&(null==(s=(null==h?void 0:h.groupCollapsed)||h.log)||s("[@sanity/client/stega]: Encoding source map into result"),null==(a=h.log)||a.call(h,"[@sanity/client/stega]: Paths encoded: ".concat(y.encoded.length,", skipped: ").concat(y.skipped.length))),y.encoded.length>0&&(null==(c=null==h?void 0:h.log)||c.call(h,"[@sanity/client/stega]: Table of encoded paths"),null==(u=(null==h?void 0:h.table)||h.log)||u(y.encoded)),y.skipped.length>0){const e=new Set;for(const{path:t}of y.skipped)e.add(t.replace(Ar,"0").replace(/\[\d+\]/g,"[]"));null==(l=null==h?void 0:h.log)||l.call(h,"[@sanity/client/stega]: List of skipped paths",[...e.values()])}(e||t)&&(null==(d=null==h?void 0:h.groupEnd)||d.call(h))}return g}function Br(e){return Ir(Dr(e))}var Jr=Object.freeze({__proto__:null,stegaEncodeSourceMap:$r}),Gr=Object.freeze({__proto__:null,encodeIntoResult:Ur,stegaEncodeSourceMap:$r,stegaEncodeSourceMap$1:Jr}),Vr={exports:{}};
|
|
8
|
+
function R(e){return"[object Object]"===Object.prototype.toString.call(e)}!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=M(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(I,I.exports);const D="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),F=["boolean","string","number"];function q(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o;return!("function"==typeof t.pipe)&&!D(t)&&(-1!==F.indexOf(typeof t)||Array.isArray(t)||!1!==R(n=t)&&(void 0===(r=n.constructor)||!1!==R(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 N(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 U={};"undefined"!=typeof globalThis?U=globalThis:"undefined"!=typeof window?U=window:"undefined"!=typeof global?U=global:"undefined"!=typeof self&&(U=self);var W=U;function H(e={}){const t=e.implementation||W.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 z{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const L=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 z(e),t(this.reason))}))}};L.source=()=>{let e;return{token:new L((t=>{e=t})),cancel:e}};var $=(e,t,n)=>("GET"===n.method||"HEAD"===n.method)&&(e.isNetworkError||!1);function B(e){return 100*Math.pow(2,e)+100*Math.random()}const J=(e={})=>(e=>{const t=e.maxRetries||5,n=e.retryDelay||B,r=e.shouldRetry;return{onError:(e,o)=>{const i=o.options,s=i.maxRetries||t,a=i.shouldRetry||r,c=i.attemptNumber||0;if(null!==(u=i.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,i)||c>=s)return e;const l=Object.assign({},o,{options:Object.assign({},i,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),n(c)),null}}})({shouldRetry:$,...e});J.shouldRetry=$;var G=function(e,t){return G=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])},G(e,t)};function V(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}G(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function Y(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function X(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function K(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 Z(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function Q(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;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 ee(e){return this instanceof ee?(this.v=e,this):new ee(e)}function te(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=o[e](t)).value instanceof ee?Promise.resolve(n.value.v).then(c,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function ne(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=K(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function re(e){return"function"==typeof e}function oe(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}"function"==typeof SuppressedError&&SuppressedError;var ie=oe((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 se(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ae=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 i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=K(i),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else i.remove(this);var c=this.initialTeardown;if(re(c))try{c()}catch(e){o=e instanceof ie?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=K(u),d=l.next();!d.done;d=l.next()){var f=d.value;try{ue(f)}catch(e){o=null!=o?o:[],e instanceof ie?o=Q(Q([],Z(o)),Z(e.errors)):o.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new ie(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ue(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)&&se(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&se(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ce(e){return e instanceof ae||e&&"closed"in e&&re(e.remove)&&re(e.add)&&re(e.unsubscribe)}function ue(e){re(e)?e():e.unsubscribe()}ae.EMPTY;var le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},de={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Q([e,t],Z(n)))},clearTimeout:function(e){var t=de.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function fe(e){de.setTimeout((function(){throw e}))}function he(){}var pe=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ce(t)&&t.add(n)):n.destination=we,n}return V(t,e),t.create=function(e,t,n){return new ve(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}(ae),ye=Function.prototype.bind;function ge(e,t){return ye.call(e,t)}var me=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){be(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){be(e)}else be(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){be(e)}},e}(),ve=function(e){function t(t,n,r){var o,i,s=e.call(this)||this;re(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&le.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&ge(t.next,i),error:t.error&&ge(t.error,i),complete:t.complete&&ge(t.complete,i)}):o=t;return s.destination=new me(o),s}return V(t,e),t}(pe);function be(e){fe(e)}var we={closed:!0,next:he,error:function(e){throw e},complete:he},Ce="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ee(e){return e}function xe(e){return 0===e.length?Ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Se=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,i=(r=e)&&r instanceof pe||function(e){return e&&re(e.next)&&re(e.error)&&re(e.complete)}(r)&&ce(r)?e:new ve(e,t,n);return function(){var e=o,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}(),i},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=Te(t))((function(t,r){var o=new ve({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[Ce]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Te(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 Te(e){var t;return null!==(t=null!=e?e:le.Promise)&&void 0!==t?t:Promise}function _e(e){return function(t){if(function(e){return re(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 Oe(e,t,n,r,o){return new je(e,t,n,r,o)}var je=function(e){function t(t,n,r,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,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 V(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}(pe);var ke=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ae(e){return re(null==e?void 0:e.then)}function Ie(e){return re(e[Ce])}function Pe(e){return Symbol.asyncIterator&&re(null==e?void 0:e[Symbol.asyncIterator])}function Me(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Re="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function De(e){return re(null==e?void 0:e[Re])}function Fe(e){return te(this,arguments,(function(){var t,n,r;return X(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ee(t.read())];case 3:return n=o.sent(),r=n.value,n.done?[4,ee(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ee(r)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function qe(e){return re(null==e?void 0:e.getReader)}function Ne(e){if(e instanceof Se)return e;if(null!=e){if(Ie(e))return o=e,new Se((function(e){var t=o[Ce]();if(re(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ke(e))return r=e,new Se((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(Ae(e))return n=e,new Se((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,fe)}));if(Pe(e))return Ue(e);if(De(e))return t=e,new Se((function(e){var n,r;try{for(var o=K(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}e.complete()}));if(qe(e))return Ue(Fe(e))}var t,n,r,o;throw Me(e)}function Ue(e){return new Se((function(t){(function(e,t){var n,r,o,i;return Y(this,void 0,void 0,(function(){var s,a;return X(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=ne(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function We(e,t,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var i=t.schedule((function(){n(),o?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(i),!o)return i}function He(e,t){return void 0===t&&(t=0),_e((function(n,r){n.subscribe(Oe(r,(function(n){return We(r,e,(function(){return r.next(n)}),t)}),(function(){return We(r,e,(function(){return r.complete()}),t)}),(function(n){return We(r,e,(function(){return r.error(n)}),t)})))}))}function ze(e,t){return void 0===t&&(t=0),_e((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function Le(e,t){if(!e)throw new Error("Iterable cannot be null");return new Se((function(n){We(n,t,(function(){var r=e[Symbol.asyncIterator]();We(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function $e(e,t){if(null!=e){if(Ie(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(ke(e))return function(e,t){return new Se((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(Ae(e))return function(e,t){return Ne(e).pipe(ze(t),He(t))}(e,t);if(Pe(e))return Le(e,t);if(De(e))return function(e,t){return new Se((function(n){var r;return We(n,t,(function(){r=e[Re](),We(n,t,(function(){var e,t,o;try{t=(e=r.next()).value,o=e.done}catch(e){return void n.error(e)}o?n.complete():n.next(t)}),0,!0)})),function(){return re(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(qe(e))return function(e,t){return Le(Fe(e),t)}(e,t)}throw Me(e)}function Be(e,t){return t?$e(e,t):Ne(e)}var Je=oe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ge(e,t){var n="object"==typeof t;return new Promise((function(r,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?r(i):n?r(t.defaultValue):o(new Je)}})}))}function Ve(e,t){return _e((function(n,r){var o=0;n.subscribe(Oe(r,(function(n){r.next(e.call(t,n,o++))})))}))}var Ye=Array.isArray;function Xe(e){return Ve((function(t){return function(e,t){return Ye(t)?e.apply(void 0,Q([],Z(t))):e(t)}(e,t)}))}function Ke(e,t,n){e?We(n,e,t):t()}var Ze=Array.isArray;function Qe(e,t){return _e((function(n,r){var o=0;n.subscribe(Oe(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}function et(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return re((t=e)[t.length-1])?e.pop():void 0;var t}(e);return n?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)}(et.apply(void 0,Q([],Z(e))),Xe(n)):_e((function(t,n){var r,o,i;(r=Q([t],Z(function(e){return 1===e.length&&Ze(e[0])?e[0]:e}(e))),void 0===i&&(i=Ee),function(e){Ke(o,(function(){for(var t=r.length,n=new Array(t),s=t,a=t,c=function(t){Ke(o,(function(){var c=Be(r[t],o),u=!1;c.subscribe(Oe(e,(function(r){n[t]=r,u||(u=!0,a--),a||e.next(i(n.slice()))}),(function(){--s||e.complete()})))}),e)},u=0;u<t;u++)c(u)}),e)})(n)}))}class tt extends Error{constructor(e){const t=rt(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class nt extends Error{constructor(e){const t=rt(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function rt(e){const t=e.body,n={response:e,statusCode:e.statusCode,responseBody:it(t,e),message:"",details:void 0};if(t.error&&t.message)return n.message="".concat(t.error," - ").concat(t.message),n;if(function(e){return ot(e)&&ot(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],r=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=r.length?":\n- ".concat(r.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),n.message="".concat(t.error.description).concat(o),n.details=t.error,n}return 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 ot(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function it(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const st={onResponse:e=>{if(e.statusCode>=500)throw new nt(e);if(e.statusCode>=400)throw new tt(e);return e}},at={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function ct(e,{maxRetries:t=5,retryDelay:n}){const r=j([t>0?J({retryDelay:n,maxRetries:t,shouldRetry:ut}):{},...e,at,q(),N(),{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"))}},st,H({implementation:Se})]);function o(e,t=r){return t({maxRedirects:0,...e})}return o.defaultRequester=r,o}function ut(e,t,n){const r="GET"===n.method||"HEAD"===n.method,o=(n.uri||n.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!r&&!o||!i)||J.shouldRetry(e,t,n)}function lt(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 dt=["image","file"],ft=["before","after","replace"],ht=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")},pt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},yt=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},gt=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));yt(e,t._id)},mt=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},vt=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};var bt,wt,Ct=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Et=(e,t,n)=>(Ct(e,t,"read from private field"),n?n.call(e):t.get(e)),xt=(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)},St=(e,t,n,r)=>(Ct(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Tt{constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return pt("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===ft.indexOf(e)){const e=ft.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,i=void 0===n||-1===n?-1:Math.max(0,t+n),s=o<0&&i>=0?"":i,a="".concat(e,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,r||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...lt(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,n=!0){return pt(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)}}bt=new WeakMap;let _t=class e extends Tt{constructor(e,t,n){super(e,t),xt(this,bt,void 0),St(this,bt,n)}clone(){return new e(this.selection,{...this.operations},Et(this,bt))}commit(e){if(!Et(this,bt))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 Et(this,bt).mutate({patch:this.serialize()},n)}};wt=new WeakMap;let Ot=class e extends Tt{constructor(e,t,n){super(e,t),xt(this,wt,void 0),St(this,wt,n)}clone(){return new e(this.selection,{...this.operations},Et(this,wt))}commit(e){if(!Et(this,wt))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 Et(this,wt).mutate({patch:this.serialize()},n)}};var jt,kt,At=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},It=(e,t,n)=>(At(e,t,"read from private field"),n?n.call(e):t.get(e)),Pt=(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)},Mt=(e,t,n,r)=>(At(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const Rt={returnDocuments:!1};class Dt{constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return pt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return pt(t,e),gt(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return pt(t,e),gt(t,e),this._add({[t]:e})}delete(e){return yt("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}}jt=new WeakMap;let Ft=class e extends Dt{constructor(e,t,n){super(e,n),Pt(this,jt,void 0),Mt(this,jt,t)}clone(){return new e([...this.operations],It(this,jt),this.trxId)}commit(e){if(!It(this,jt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,jt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Rt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof Ot)return this._add({patch:e.serialize()});if(n){const n=t(new Ot(e,{},It(this,jt)));if(!(n instanceof Ot))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};kt=new WeakMap;let qt=class e extends Dt{constructor(e,t,n){super(e,n),Pt(this,kt,void 0),Mt(this,kt,t)}clone(){return new e([...this.operations],It(this,kt),this.trxId)}commit(e){if(!It(this,kt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return It(this,kt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},Rt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof _t)return this._add({patch:e.serialize()});if(n){const n=t(new _t(e,{},It(this,kt)));if(!(n instanceof _t))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};function Nt(e){return"https://www.sanity.io/help/"+e}const Ut=e=>function(e){let t,n=!1;return(...r)=>(n||(t=e(...r),n=!0),t)}(((...t)=>console.warn(e.join(" "),...t))),Wt=Ut(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Ht=Ut(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),zt=Ut(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Nt("js-client-browser-token")," for more information and how to hide this warning.")]),Lt=Ut(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Nt("js-client-api-version"))]),$t=Ut(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},Jt=["localhost","127.0.0.1","0.0.0.0"],Gt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},Vt=(e,t)=>{const n={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||Bt.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};n.apiVersion||Lt();const r={...Bt,...n},o=r.useProjectHostname;if("undefined"==typeof Promise){const e=Nt("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`");if("string"==typeof r.perspective&&Gt(r.perspective),"encodeSourceMap"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if("boolean"!=typeof r.stega.enabled)throw new Error("stega.enabled must be a boolean, received ".concat(r.stega.enabled));if(r.stega.enabled&&void 0===r.stega.studioUrl)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(r.stega.enabled&&"string"!=typeof r.stega.studioUrl&&"function"!=typeof r.stega.studioUrl)throw new Error("stega.studioUrl must be a string or a function, received ".concat(r.stega.studioUrl));const i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(e=>-1!==Jt.indexOf(e))(window.location.hostname);i&&s&&r.token&&!0!==r.ignoreBrowserTokenWarning?zt():void 0===r.useCdn&&Wt(),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&&ht(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?vt(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===Bt.apiHost,r.useCdn=!1!==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},Yt="X-Sanity-Project-ID";var Xt={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},Kt={0:8203,1:8204,2:8205,3:65279},Zt=new Array(4).fill(String.fromCodePoint(Kt[0])).join("");function Qt(e,t,n="auto"){return!0===n||"auto"===n&&(function(e){return!!Number.isNaN(Number(e))&&Boolean(Date.parse(e))}(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${function(e){let t=JSON.stringify(e);return`${Zt}${Array.from(t).map((e=>{let n=e.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map((e=>String.fromCodePoint(Kt[e]))).join("")})).join("")}`}(t)}`}Object.fromEntries(Object.entries(Kt).map((e=>e.reverse()))),Object.fromEntries(Object.entries(Xt).map((e=>e.reverse())));var en=`${Object.values(Xt).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,tn=new RegExp(`[${en}]{4,}`,"gu");function nn(e){try{return JSON.parse(JSON.stringify(e,((e,t)=>{return"string"!=typeof t?t:(n=t,{cleaned:n.replace(tn,""),encoded:(null==(r=n.match(tn))?void 0:r[0])||""}).cleaned;var n,r})))}catch{return e}}const rn=({query:e,params:t={},options:n={}})=>{const r=new URLSearchParams,{tag:o,...i}=n;o&&r.append("tag",o),r.append("query",e);for(const[e,n]of Object.entries(t))r.append("$".concat(e),JSON.stringify(n));for(const[e,t]of Object.entries(i))t&&r.append(e,"".concat(t));return"?".concat(r)},on=(e={})=>{return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,n=!0,!1===t?void 0:void 0===t?n:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,n},sn=e=>"response"===e.type,an=e=>e.body,cn=11264;function un(e,t,n,r,o={},i={}){const s="stega"in i?{...n||{},..."boolean"==typeof i.stega?{enabled:i.stega}:i.stega||{}}:n,a=s.enabled?nn(o):o,c=!1===i.filterResponse?e=>e:e=>e.result,{cache:u,next:l,...d}={useAbortSignal:void 0!==i.signal,resultSourceMap:s.enabled?"withKeyArraySelector":i.resultSourceMap,...i},f=gn(e,t,"query",{query:r,params:a},void 0!==u||void 0!==l?{...d,fetch:{cache:u,next:l}}:d);return s.enabled?f.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return et.apply(void 0,Q([],Z(e)))}(Be(Promise.resolve().then((function(){return Gr})).then((function(e){return e.stegaEncodeSourceMap$1})).then((({stegaEncodeSourceMap:e})=>e)))),Ve((([e,t])=>{const n=t(e.result,e.resultSourceMap,s);return c({...e,result:n})}))):f.pipe(Ve(c))}function ln(e,t,n,r={}){return vn(e,t,{uri:wn(e,"doc",n),json:!0,tag:r.tag}).pipe(Qe(sn),Ve((e=>e.body.documents&&e.body.documents[0])))}function dn(e,t,n,r={}){return vn(e,t,{uri:wn(e,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(Qe(sn),Ve((e=>{const t=(r=e.body.documents||[],o=e=>e._id,r.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var r,o;return n.map((e=>t[e]||null))})))}function fn(e,t,n,r){return gt("createIfNotExists",n),mn(e,t,n,"createIfNotExists",r)}function hn(e,t,n,r){return gt("createOrReplace",n),mn(e,t,n,"createOrReplace",r)}function pn(e,t,n,r){return gn(e,t,"mutate",{mutations:[{delete:lt(n)}]},r)}function yn(e,t,n,r){let o;o=n instanceof Ot||n instanceof _t?{patch:n.serialize()}:n instanceof Ft||n instanceof qt?n.serialize():n;return gn(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId||void 0},r)}function gn(e,t,n,r,o={}){const i="mutate"===n,s="query"===n,a=i?"":rn(r),c=!i&&a.length<cn,u=c?a:"",l=o.returnFirst,{timeout:d,token:f,tag:h,headers:p}=o;return vn(e,t,{method:c?"GET":"POST",uri:wn(e,n,u),json:!0,body:c?void 0:r,query:i&&on(o),timeout:d,headers:p,token:f,tag:h,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:s,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(Qe(sn),Ve(an),Ve((e=>{if(!i)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 mn(e,t,n,r,o={}){return gn(e,t,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function vn(e,t,n){var r,o;const i=n.url||n.uri,s=e.config(),a=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===i.indexOf("/data/"):n.canUseCdn;let c=(null!=(r=n.useCdn)?r:s.useCdn)&&a;const u=n.tag&&s.requestTagPrefix?[s.requestTagPrefix,n.tag].join("."):n.tag||s.requestTagPrefix;if(u&&null!==n.tag&&(n.query={tag:vt(u),...n.query}),["GET","HEAD","POST"].indexOf(n.method||"GET")>=0&&0===i.indexOf("/data/query/")){const e=null!=(o=n.resultSourceMap)?o:s.resultSourceMap;void 0!==e&&!1!==e&&(n.query={resultSourceMap:e,...n.query});const t=n.perspective||s.perspective;"string"==typeof t&&"raw"!==t&&(Gt(t),n.query={perspective:t,...n.query},"previewDrafts"===t&&c&&(c=!1,Ht()))}const l=function(e,t={}){const n={},r=t.token||e.token;r&&(n.Authorization="Bearer ".concat(r)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(n[Yt]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),i=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},n,t.headers||{}),timeout:void 0===i?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(s,Object.assign({},n,{url:Cn(e,i,c)})),d=new Se((e=>t(l,s.requester).subscribe(e)));return n.signal?d.pipe((f=n.signal,e=>new Se((t=>{const n=()=>t.error(function(e){var t,n;if(En)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const r=new Error(null!=(n=null==e?void 0:e.reason)?n:"The operation was aborted.");return r.name="AbortError",r}(f));if(f&&f.aborted)return void n();const r=e.subscribe(t);return f.addEventListener("abort",n),()=>{f.removeEventListener("abort",n),r.unsubscribe()}})))):d;var f}function bn(e,t,n){return vn(e,t,n).pipe(Qe((e=>"response"===e.type)),Ve((e=>e.body)))}function wn(e,t,n){const r=e.config(),o=mt(r),i="/".concat(t,"/").concat(o),s=n?"".concat(i,"/").concat(n):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")}function Cn(e,t,n=!1){const{url:r,cdnUrl:o}=e.config();return"".concat(n?o:r,"/").concat(t.replace(/^\//,""))}const En=Boolean(globalThis.DOMException);var xn,Sn,Tn,_n,On=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},jn=(e,t,n)=>(On(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)},An=(e,t,n,r)=>(On(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class In{constructor(e,t){kn(this,xn,void 0),kn(this,Sn,void 0),An(this,xn,e),An(this,Sn,t)}upload(e,t,n){return Mn(jn(this,xn),jn(this,Sn),e,t,n)}}xn=new WeakMap,Sn=new WeakMap;class Pn{constructor(e,t){kn(this,Tn,void 0),kn(this,_n,void 0),An(this,Tn,e),An(this,_n,t)}upload(e,t,n){return Ge(Mn(jn(this,Tn),jn(this,_n),e,t,n).pipe(Qe((e=>"response"===e.type)),Ve((e=>e.body.document))))}}function Mn(e,t,n,r,o={}){(e=>{if(-1===dt.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(dt.join(", ")))})(n);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=mt(e.config()),a="image"===n?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,r),{tag:u,label:l,title:d,description:f,creditLine:h,filename:p,source:y}=c,g={label:l,title:d,description:f,filename:p,meta:i,creditLine:h};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),vn(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(s),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:r})}Tn=new WeakMap,_n=new WeakMap;var Rn=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{});const Dn=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Fn={includeResult:!0};function qn(e,t,n={}){const{url:r,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=n.tag&&s?[s,n.tag].join("."):n.tag,c={...Rn(n,Fn),tag:a},u=(l=c,Dn.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const d=rn({query:e,params:t,options:{tag:a,...u}}),f="".concat(r).concat(wn(this,"listen",d));if(f.length>14800)return new Se((e=>e.error(new Error("Query too large for listener"))));const h=c.events?c.events:["mutation"],p=-1!==h.indexOf("reconnect"),y={};return(o||i)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new Se((e=>{let t,n;u().then((e=>{t=e})).catch((t=>{e.error(t),d()}));let r=!1;function o(){r||(p&&e.next({type:"reconnect"}),r||t.readyState===t.CLOSED&&(c(),clearTimeout(n),n=setTimeout(l,100)))}function i(t){e.error(function(e){if(e instanceof Error)return e;const t=Nn(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function s(t){const n=Nn(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",i),t.removeEventListener("disconnect",a),h.forEach((e=>t.removeEventListener(e,s))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Xr})),t=new e(f,y);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),h.forEach((e=>t.addEventListener(e,s))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),d()}))}function d(){r=!0,c()}return d}))}function Nn(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var Un,Wn,Hn,zn,Ln=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},$n=(e,t,n)=>(Ln(e,t,"read from private field"),n?n.call(e):t.get(e)),Bn=(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)},Jn=(e,t,n,r)=>(Ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Gn{constructor(e,t){Bn(this,Un,void 0),Bn(this,Wn,void 0),Jn(this,Un,e),Jn(this,Wn,t)}create(e,t){return Yn($n(this,Un),$n(this,Wn),"PUT",e,t)}edit(e,t){return Yn($n(this,Un),$n(this,Wn),"PATCH",e,t)}delete(e){return Yn($n(this,Un),$n(this,Wn),"DELETE",e)}list(){return bn($n(this,Un),$n(this,Wn),{uri:"/datasets",tag:null})}}Un=new WeakMap,Wn=new WeakMap;class Vn{constructor(e,t){Bn(this,Hn,void 0),Bn(this,zn,void 0),Jn(this,Hn,e),Jn(this,zn,t)}create(e,t){return Ge(Yn($n(this,Hn),$n(this,zn),"PUT",e,t))}edit(e,t){return Ge(Yn($n(this,Hn),$n(this,zn),"PATCH",e,t))}delete(e){return Ge(Yn($n(this,Hn),$n(this,zn),"DELETE",e))}list(){return Ge(bn($n(this,Hn),$n(this,zn),{uri:"/datasets",tag:null}))}}function Yn(e,t,n,r,o){return ht(r),bn(e,t,{method:n,uri:"/datasets/".concat(r),body:o,tag:null})}Hn=new WeakMap,zn=new WeakMap;var Xn,Kn,Zn,Qn,er=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},tr=(e,t,n)=>(er(e,t,"read from private field"),n?n.call(e):t.get(e)),nr=(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)},rr=(e,t,n,r)=>(er(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class or{constructor(e,t){nr(this,Xn,void 0),nr(this,Kn,void 0),rr(this,Xn,e),rr(this,Kn,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return bn(tr(this,Xn),tr(this,Kn),{uri:t})}getById(e){return bn(tr(this,Xn),tr(this,Kn),{uri:"/projects/".concat(e)})}}Xn=new WeakMap,Kn=new WeakMap;class ir{constructor(e,t){nr(this,Zn,void 0),nr(this,Qn,void 0),rr(this,Zn,e),rr(this,Qn,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Ge(bn(tr(this,Zn),tr(this,Qn),{uri:t}))}getById(e){return Ge(bn(tr(this,Zn),tr(this,Qn),{uri:"/projects/".concat(e)}))}}Zn=new WeakMap,Qn=new WeakMap;var sr,ar,cr,ur,lr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},dr=(e,t,n)=>(lr(e,t,"read from private field"),n?n.call(e):t.get(e)),fr=(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)},hr=(e,t,n,r)=>(lr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class pr{constructor(e,t){fr(this,sr,void 0),fr(this,ar,void 0),hr(this,sr,e),hr(this,ar,t)}getById(e){return bn(dr(this,sr),dr(this,ar),{uri:"/users/".concat(e)})}}sr=new WeakMap,ar=new WeakMap;class yr{constructor(e,t){fr(this,cr,void 0),fr(this,ur,void 0),hr(this,cr,e),hr(this,ur,t)}getById(e){return Ge(bn(dr(this,cr),dr(this,ur),{uri:"/users/".concat(e)}))}}cr=new WeakMap,ur=new WeakMap;var gr,mr,vr,br,wr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Cr=(e,t,n)=>(wr(e,t,"read from private field"),n?n.call(e):t.get(e)),Er=(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)},xr=(e,t,n,r)=>(wr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);gr=new WeakMap,mr=new WeakMap;let Sr=class e{constructor(e,t=Bt){Er(this,gr,void 0),Er(this,mr,void 0),this.listen=qn,this.config(t),xr(this,mr,e),this.assets=new In(this,Cr(this,mr)),this.datasets=new Gn(this,Cr(this,mr)),this.projects=new or(this,Cr(this,mr)),this.users=new pr(this,Cr(this,mr))}clone(){return new e(Cr(this,mr),this.config())}config(e){if(void 0===e)return{...Cr(this,gr)};if(Cr(this,gr)&&!1===Cr(this,gr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return xr(this,gr,Vt(e,Cr(this,gr)||{})),this}withConfig(t){const n=this.config();return new e(Cr(this,mr),{...n,...t,stega:{...n.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,n){return un(this,Cr(this,mr),Cr(this,gr).stega,e,t,n)}getDocument(e,t){return ln(this,Cr(this,mr),e,t)}getDocuments(e,t){return dn(this,Cr(this,mr),e,t)}create(e,t){return mn(this,Cr(this,mr),e,"create",t)}createIfNotExists(e,t){return fn(this,Cr(this,mr),e,t)}createOrReplace(e,t){return hn(this,Cr(this,mr),e,t)}delete(e,t){return pn(this,Cr(this,mr),e,t)}mutate(e,t){return yn(this,Cr(this,mr),e,t)}patch(e,t){return new _t(e,t,this)}transaction(e){return new qt(e,this)}request(e){return bn(this,Cr(this,mr),e)}getUrl(e,t){return Cn(this,e,t)}getDataUrl(e,t){return wn(this,e,t)}};vr=new WeakMap,br=new WeakMap;let Tr=class e{constructor(e,t=Bt){Er(this,vr,void 0),Er(this,br,void 0),this.listen=qn,this.config(t),xr(this,br,e),this.assets=new Pn(this,Cr(this,br)),this.datasets=new Vn(this,Cr(this,br)),this.projects=new ir(this,Cr(this,br)),this.users=new yr(this,Cr(this,br)),this.observable=new Sr(e,t)}clone(){return new e(Cr(this,br),this.config())}config(e){if(void 0===e)return{...Cr(this,vr)};if(Cr(this,vr)&&!1===Cr(this,vr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),xr(this,vr,Vt(e,Cr(this,vr)||{})),this}withConfig(t){const n=this.config();return new e(Cr(this,br),{...n,...t,stega:{...n.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,n){return Ge(un(this,Cr(this,br),Cr(this,vr).stega,e,t,n))}getDocument(e,t){return Ge(ln(this,Cr(this,br),e,t))}getDocuments(e,t){return Ge(dn(this,Cr(this,br),e,t))}create(e,t){return Ge(mn(this,Cr(this,br),e,"create",t))}createIfNotExists(e,t){return Ge(fn(this,Cr(this,br),e,t))}createOrReplace(e,t){return Ge(hn(this,Cr(this,br),e,t))}delete(e,t){return Ge(pn(this,Cr(this,br),e,t))}mutate(e,t){return Ge(yn(this,Cr(this,br),e,t))}patch(e,t){return new Ot(e,t,this)}transaction(e){return new Ft(e,this)}request(e){return Ge(bn(this,Cr(this,br),e))}dataRequest(e,t,n){return Ge(gn(this,Cr(this,br),e,t,n))}getUrl(e,t){return Cn(this,e,t)}getDataUrl(e,t){return wn(this,e,t)}};const _r=function(e,t){return{requester:ct(e,{}).defaultRequester,createClient:n=>new t(ct(e,{maxRetries:n.maxRetries,retryDelay:n.retryDelay}),n)}}([],Tr),Or=_r.requester,jr=_r.createClient,kr=function(e){return function(t){return $t(),e(t)}}(jr),Ar=/_key\s*==\s*['"](.*)['"]/;function Ir(e){if(!Array.isArray(e))throw new Error("Path is not an array");return e.reduce(((e,t,n)=>{const r=typeof t;if("number"===r)return"".concat(e,"[").concat(t,"]");if("string"===r){const r=0===n?"":".";return"".concat(e).concat(r).concat(t)}if(function(e){return"string"==typeof e?Ar.test(e.trim()):"object"==typeof e&&"_key"in e}(t)&&t._key)return"".concat(e,'[_key=="').concat(t._key,'"]');if(Array.isArray(t)){const[n,r]=t;return"".concat(e,"[").concat(n,":").concat(r,"]")}throw new Error("Unsupported path segment `".concat(JSON.stringify(t),"`"))}),"")}const Pr={"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","'":"\\'","\\":"\\\\"},Mr={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t","\\'":"'","\\\\":"\\"};function Rr(e){const t=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let r;for(;null!==(r=n.exec(e));)if(void 0===r[1])if(void 0===r[2])if(void 0===r[3]);else{const e=r[3].replace(/\\(\\')/g,(e=>Mr[e]));t.push({_key:e,_index:-1})}else t.push(parseInt(r[2],10));else{const e=r[1].replace(/\\(\\|f|n|r|t|')/g,(e=>Mr[e]));t.push(e)}return t}function Dr(e){return e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))}))}function Fr(e,t){if(!(null==t?void 0:t.mappings))return;const n=function(e){return"$".concat(e.map((e=>{if("string"==typeof e){const t=e.replace(/[\f\n\r\t'\\]/g,(e=>Pr[e]));return"['".concat(t,"']")}if("number"==typeof e)return"[".concat(e,"]");if(""!==e._key){const t=e._key.replace(/['\\]/g,(e=>Pr[e]));return"[?(@._key=='".concat(t,"')]")}return"[".concat(e._index,"]")})).join(""))}(e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(-1!==e._index)return e._index;throw new Error("invalid segment:".concat(JSON.stringify(e)))})));if(void 0!==t.mappings[n])return{mapping:t.mappings[n],matchedPath:n,pathSuffix:""};const r=Object.entries(t.mappings).filter((([e])=>n.startsWith(e))).sort((([e],[t])=>t.length-e.length));if(0==r.length)return;const[o,i]=r[0];return{mapping:i,matchedPath:o,pathSuffix:n.substring(o.length)}}function qr(e){return"object"==typeof e&&null!==e}function Nr(e,t,n=[]){return function(e){return null!==e&&Array.isArray(e)}(e)?e.map(((e,r)=>{if(qr(e)){const o=e._key;if("string"==typeof o)return Nr(e,t,n.concat({_key:o,_index:r}))}return Nr(e,t,n.concat(r))})):qr(e)?Object.fromEntries(Object.entries(e).map((([e,r])=>[e,Nr(r,t,n.concat(e))]))):t(e,n)}function Ur(e,t,n){return Nr(e,((e,r)=>{if("string"!=typeof e)return e;const o=Fr(r,t);if(!o)return e;const{mapping:i,matchedPath:s}=o;if("value"!==i.type)return e;if("documentValue"!==i.source.type)return e;const a=t.documents[i.source.document],c=t.paths[i.source.path],u=Rr(s),l=Rr(c).concat(r.slice(u.length));return n({sourcePath:l,sourceDocument:a,resultPath:r,value:e})}))}const Wr="drafts.";function Hr(e){const{baseUrl:t,workspace:n="default",tool:r="default",id:o,type:i,path:s}=e;if(!t)throw new Error("baseUrl is required");if(!s)throw new Error("path is required");if(!o)throw new Error("id is required");if("/"!==t&&t.endsWith("/"))throw new Error("baseUrl must not end with a slash");const a="default"===n?void 0:n,c="default"===r?void 0:r,u=function(e){return e.startsWith(Wr)?e.slice(Wr.length):e}(o),l=Array.isArray(s)?Ir(Dr(s)):s,d=new URLSearchParams({baseUrl:t,id:u,type:i,path:l});a&&d.set("workspace",a),c&&d.set("tool",c);const f=["/"===t?"":t];a&&f.push(a);const h=["mode=presentation","id=".concat(u),"type=".concat(i),"path=".concat(encodeURIComponent(l))];return c&&h.push("tool=".concat(c)),f.push("intent","edit","".concat(h.join(";"),"?").concat(d)),f.join("/")}const zr=({sourcePath:e,value:t})=>{if(/^\d{4}-\d{2}-\d{2}/.test(n=t)&&Boolean(Date.parse(n))||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(t))return!1;var n;const r=e.at(-1);return("slug"!==e.at(-2)||"current"!==r)&&(("string"!=typeof r||!r.startsWith("_"))&&(("number"!=typeof r||"marks"!==e.at(-2))&&(("href"!==r||"number"!=typeof e.at(-2)||"markDefs"!==e.at(-3))&&("style"!==r&&"listItem"!==r&&(!e.some((e=>"meta"===e||"metadata"===e||"openGraph"===e||"seo"===e))&&("string"!=typeof r||!Lr.has(r)))))))},Lr=new Set(["color","colour","currency","email","format","gid","hex","href","hsl","hsla","icon","id","index","key","language","layout","link","linkAction","locale","lqip","page","path","ref","rgb","rgba","route","secret","slug","status","tag","template","theme","type","unit","url","username","variant","website"]);function $r(e,t,n){var r,o,i,s,a,c,u,l,d;const{filter:f,logger:h,enabled:p}=n;if(!p){const o="config.enabled must be true, don't call this function otherwise";throw null==(r=null==h?void 0:h.error)||r.call(h,"[@sanity/client]: ".concat(o),{result:e,resultSourceMap:t,config:n}),new TypeError(o)}if(!t)return null==(o=null==h?void 0:h.error)||o.call(h,"[@sanity/client]: Missing Content Source Map from response body",{result:e,resultSourceMap:t,config:n}),e;if(!n.studioUrl){const r="config.studioUrl must be defined";throw null==(i=null==h?void 0:h.error)||i.call(h,"[@sanity/client]: ".concat(r),{result:e,resultSourceMap:t,config:n}),new TypeError(r)}const y={encoded:[],skipped:[]},g=Ur(e,t,(({sourcePath:e,sourceDocument:t,resultPath:r,value:o})=>{if(!1===("function"==typeof f?f({sourcePath:e,resultPath:r,filterDefault:zr,sourceDocument:t,value:o}):zr({sourcePath:e,resultPath:r,filterDefault:zr,sourceDocument:t,value:o})))return h&&y.skipped.push({path:Br(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length}),o;h&&y.encoded.push({path:Br(e),value:"".concat(o.slice(0,20)).concat(o.length>20?"...":""),length:o.length});const{baseUrl:i,workspace:s,tool:a}=function(e){let t="string"==typeof e?e:e.baseUrl;return"/"!==t&&(t=t.replace(/\/$/,"")),"string"==typeof e?{baseUrl:t}:{...e,baseUrl:t}}("function"==typeof n.studioUrl?n.studioUrl(t):n.studioUrl);if(!i)return o;const{_id:c,_type:u}=t;return Qt(o,{origin:"sanity.io",href:Hr({baseUrl:i,workspace:s,tool:a,id:c,type:u,path:e})},!1)}));if(h){const e=y.skipped.length,t=y.encoded.length;if((e||t)&&(null==(s=(null==h?void 0:h.groupCollapsed)||h.log)||s("[@sanity/client]: Encoding source map into result"),null==(a=h.log)||a.call(h,"[@sanity/client]: Paths encoded: ".concat(y.encoded.length,", skipped: ").concat(y.skipped.length))),y.encoded.length>0&&(null==(c=null==h?void 0:h.log)||c.call(h,"[@sanity/client]: Table of encoded paths"),null==(u=(null==h?void 0:h.table)||h.log)||u(y.encoded)),y.skipped.length>0){const e=new Set;for(const{path:t}of y.skipped)e.add(t.replace(Ar,"0").replace(/\[\d+\]/g,"[]"));null==(l=null==h?void 0:h.log)||l.call(h,"[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&(null==(d=null==h?void 0:h.groupEnd)||d.call(h))}return g}function Br(e){return Ir(Dr(e))}var Jr=Object.freeze({__proto__:null,stegaEncodeSourceMap:$r}),Gr=Object.freeze({__proto__:null,encodeIntoResult:Ur,stegaEncodeSourceMap:$r,stegaEncodeSourceMap$1:Jr}),Vr={exports:{}};
|
|
9
9
|
/** @license
|
|
10
10
|
* eventsource.js
|
|
11
11
|
* Available under MIT License (MIT)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stegaEncodeSourceMap-OKnT3zAM.js","sources":["../../src/stega/encodeIntoResult.ts","../../src/stega/filterDefault.ts","../../src/stega/stegaEncodeSourceMap.ts"],"sourcesContent":["import {parseJsonPath} from '../csm/jsonPath'\nimport {resolveMapping} from '../csm/resolveMapping'\nimport type {ContentSourceMap} from '../csm/types'\nimport {walkMap} from '../csm/walkMap'\nimport type {Encoder} from './types'\n\n/**\n * @internal\n */\nexport function encodeIntoResult<Result>(\n result: Result,\n csm: ContentSourceMap,\n encoder: Encoder,\n): Result {\n return walkMap(result, (value, path) => {\n // Only map strings, we could extend this in the future to support other types like integers...\n if (typeof value !== 'string') {\n return value\n }\n\n const resolveMappingResult = resolveMapping(path, csm)\n if (!resolveMappingResult) {\n return value\n }\n\n const {mapping, matchedPath} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = csm.documents[mapping.source.document!]\n const sourcePath = csm.paths[mapping.source.path]\n\n const matchPathSegments = parseJsonPath(matchedPath)\n const sourcePathSegments = parseJsonPath(sourcePath)\n const fullSourceSegments = sourcePathSegments.concat(path.slice(matchPathSegments.length))\n\n return encoder({\n sourcePath: fullSourceSegments,\n sourceDocument,\n resultPath: path,\n value,\n })\n }) as Result\n}\n","import type {FilterDefault} from './types'\n\nexport const filterDefault: FilterDefault = ({sourcePath, value}) => {\n // Skips encoding on URL or Date strings, similar to the `skip: 'auto'` parameter in vercelStegaCombine()\n if (isValidDate(value) || isValidURL(value)) {\n return false\n }\n\n const endPath = sourcePath.at(-1)\n // Never encode slugs\n if (sourcePath.at(-2) === 'slug' && endPath === 'current') {\n return false\n }\n\n // Skip underscored keys, needs better heuristics but it works for now\n if (typeof endPath === 'string' && endPath.startsWith('_')) {\n return false\n }\n\n /**\n * Best effort infer Portable Text paths that should not be encoded.\n * Nothing is for certain, and the below implementation may cause paths that aren't Portable Text and otherwise be safe to encode to be skipped.\n * However, that's ok as userland can always opt-in with the `encodeSourceMapAtPath` option and mark known safe paths as such, which will override this heuristic.\n */\n // If the path ends in marks[number] it's likely a PortableTextSpan: https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#LL154C16-L154C16\n if (typeof endPath === 'number' && sourcePath.at(-2) === 'marks') {\n return false\n }\n // Or if it's [number].markDefs[number].href it's likely a PortableTextLink: https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#L163\n if (\n endPath === 'href' &&\n typeof sourcePath.at(-2) === 'number' &&\n sourcePath.at(-3) === 'markDefs'\n ) {\n return false\n }\n // Otherwise we have to deal with special properties of PortableTextBlock, and we can't confidently know if it's actually a `_type: 'block'` array item or not.\n // All we know is that if it is indeed a block, and we encode the strings on these keys it'll for sure break the PortableText rendering and thus we skip encoding.\n // https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#L48-L58\n if (endPath === 'style' || endPath === 'listItem') {\n return false\n }\n\n // Don't encode into anything that is suggested it'll render for SEO in meta tags\n if (\n sourcePath.some(\n (path) => path === 'meta' || path === 'metadata' || path === 'openGraph' || path === 'seo',\n )\n ) {\n return false\n }\n\n // Finally, we ignore a bunch of paths that are typically used for page building\n if (typeof endPath === 'string' && denylist.has(endPath)) {\n return false\n }\n\n return true\n}\n\nconst denylist = new Set([\n 'color',\n 'colour',\n 'currency',\n 'email',\n 'format',\n 'gid',\n 'hex',\n 'href',\n 'hsl',\n 'hsla',\n 'icon',\n 'id',\n 'index',\n 'key',\n 'language',\n 'layout',\n 'link',\n 'linkAction',\n 'locale',\n 'lqip',\n 'page',\n 'path',\n 'ref',\n 'rgb',\n 'rgba',\n 'route',\n 'secret',\n 'slug',\n 'status',\n 'tag',\n 'template',\n 'theme',\n 'type',\n 'unit',\n 'url',\n 'username',\n 'variant',\n 'website',\n])\n\nfunction isValidDate(dateString: string) {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(dateString) ? Boolean(Date.parse(dateString)) : false\n}\n\nfunction isValidURL(url: string) {\n try {\n new URL(url, url.startsWith('/') ? 'https://acme.com' : undefined)\n } catch {\n return false\n }\n return true\n}\n","import {vercelStegaCombine} from '@vercel/stega'\n\nimport {createEditUrl} from '../csm/createEditUrl'\nimport {jsonPathToStudioPath} from '../csm/jsonPath'\nimport {resolveStudioBaseRoute} from '../csm/resolveEditInfo'\nimport {reKeySegment, toString as studioPathToString} from '../csm/studioPath'\nimport {encodeIntoResult} from './encodeIntoResult'\nimport {filterDefault} from './filterDefault'\nimport {ContentSourceMap, ContentSourceMapParsedPath, InitializedStegaConfig} from './types'\n\nconst TRUNCATE_LENGTH = 20\n\n/**\n * Uses `@vercel/stega` to embed edit info JSON into strings in your query result.\n * The JSON payloads are added using invisible characters so they don't show up visually.\n * The edit info is generated from the Content Source Map (CSM) that is returned from Sanity for the query.\n * @public\n */\nexport function stegaEncodeSourceMap<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n config: InitializedStegaConfig,\n): Result {\n const {filter, logger, enabled} = config\n if (!enabled) {\n const msg = \"config.enabled must be true, don't call this function otherwise\"\n logger?.error?.(`[@sanity/client/stega]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n if (!resultSourceMap) {\n logger?.error?.('[@sanity/client/stega]: Missing Content Source Map from response body', {\n result,\n resultSourceMap,\n config,\n })\n return result\n }\n\n if (!config.studioUrl) {\n const msg = 'config.studioUrl must be defined'\n logger?.error?.(`[@sanity/client/stega]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n const report: Record<'encoded' | 'skipped', {path: string; length: number; value: string}[]> = {\n encoded: [],\n skipped: [],\n }\n\n const resultWithStega = encodeIntoResult(\n result,\n resultSourceMap,\n ({sourcePath, sourceDocument, resultPath, value}) => {\n // Allow userland to control when to opt-out of encoding\n if (\n (typeof filter === 'function'\n ? filter({sourcePath, resultPath, filterDefault, sourceDocument, value})\n : filterDefault({sourcePath, resultPath, filterDefault, sourceDocument, value})) === false\n ) {\n if (logger) {\n report.skipped.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${\n value.length > TRUNCATE_LENGTH ? '...' : ''\n }`,\n length: value.length,\n })\n }\n return value\n }\n\n if (logger) {\n report.encoded.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? '...' : ''}`,\n length: value.length,\n })\n }\n\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof config.studioUrl === 'function'\n ? config.studioUrl(sourceDocument)\n : config.studioUrl!,\n )\n if (!baseUrl) return value\n const {_id: id, _type: type} = sourceDocument\n\n return vercelStegaCombine(\n value,\n {\n origin: 'sanity.io',\n href: createEditUrl({\n baseUrl,\n workspace,\n tool,\n id,\n type,\n path: sourcePath,\n }),\n },\n // We use custom logic to determine if we should skip encoding\n false,\n )\n },\n )\n\n if (logger) {\n const isSkipping = report.skipped.length\n const isEncoding = report.encoded.length\n if (isSkipping || isEncoding) {\n ;(logger?.groupCollapsed || logger.log)?.(\n '[@sanity/client/stega]: Encoding source map into result',\n )\n logger.log?.(\n `[@sanity/client/stega]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`,\n )\n }\n if (report.encoded.length > 0) {\n logger?.log?.(`[@sanity/client/stega]: Table of encoded paths`)\n ;(logger?.table || logger.log)?.(report.encoded)\n }\n if (report.skipped.length > 0) {\n const skipped = new Set<string>()\n for (const {path} of report.skipped) {\n skipped.add(path.replace(reKeySegment, '0').replace(/\\[\\d+\\]/g, '[]'))\n }\n logger?.log?.(`[@sanity/client/stega]: List of skipped paths`, [...skipped.values()])\n }\n\n if (isSkipping || isEncoding) {\n logger?.groupEnd?.()\n }\n }\n\n return resultWithStega\n}\n\nfunction prettyPathForLogging(path: ContentSourceMapParsedPath): string {\n return studioPathToString(jsonPathToStudioPath(path))\n}\n"],"names":["vercelStegaCombine","studioPathToString"],"mappings":";;;AASgB,SAAA,gBAAA,CACd,MACA,EAAA,GAAA,EACA,OACQ,EAAA;AACR,EAAA,OAAO,OAAQ,CAAA,MAAA,EAAQ,CAAC,KAAA,EAAO,IAAS,KAAA;AAEtC,IAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAM,MAAA,oBAAA,GAAuB,cAAe,CAAA,IAAA,EAAM,GAAG,CAAA,CAAA;AACrD,IAAA,IAAI,CAAC,oBAAsB,EAAA;AACzB,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAM,MAAA,EAAC,OAAS,EAAA,WAAA,EAAe,GAAA,oBAAA,CAAA;AAC/B,IAAI,IAAA,OAAA,CAAQ,SAAS,OAAS,EAAA;AAC5B,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAI,IAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,KAAS,eAAiB,EAAA;AAC3C,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAA,MAAM,cAAiB,GAAA,GAAA,CAAI,SAAU,CAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,CAAA;AAC7D,IAAA,MAAM,UAAa,GAAA,GAAA,CAAI,KAAM,CAAA,OAAA,CAAQ,OAAO,IAAI,CAAA,CAAA;AAEhD,IAAM,MAAA,iBAAA,GAAoB,cAAc,WAAW,CAAA,CAAA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A,EAAc,GAAG,CAAE,CAAA,OAAA,CAAQ,UAAY,EAAA,IAAI,CAAC,CAAA,CAAA;AAAA,OACvE;AACA,MAAA,CAAA,EAAA,GAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAQ,QAAR,IAAc,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,MAAA,EAAA,+CAAA,EAAiD,CAAC,GAAG,OAAA,CAAQ,QAAQ,CAAA,CAAA,CAAA;AAAA,KACrF;AAEA,IAAA,IAAI,cAAc,UAAY,EAAA;AAC5B,MAAA,CAAA,EAAA,GAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAQ,QAAR,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,MAAA,CAAA,CAAA;AAAA,KACF;AAAA,GACF;AAEA,EAAO,OAAA,eAAA,CAAA;AACT,CAAA;AAEA,SAAS,qBAAqB,IAA0C,EAAA;AACtE,EAAO,OAAAC,QAAA,CAAmB,oBAAqB,CAAA,IAAI,CAAC,CAAA,CAAA;AACtD;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stegaEncodeSourceMap-ZDmZYDbM.cjs","sources":["../../src/stega/encodeIntoResult.ts","../../src/stega/filterDefault.ts","../../src/stega/stegaEncodeSourceMap.ts"],"sourcesContent":["import {parseJsonPath} from '../csm/jsonPath'\nimport {resolveMapping} from '../csm/resolveMapping'\nimport type {ContentSourceMap} from '../csm/types'\nimport {walkMap} from '../csm/walkMap'\nimport type {Encoder} from './types'\n\n/**\n * @internal\n */\nexport function encodeIntoResult<Result>(\n result: Result,\n csm: ContentSourceMap,\n encoder: Encoder,\n): Result {\n return walkMap(result, (value, path) => {\n // Only map strings, we could extend this in the future to support other types like integers...\n if (typeof value !== 'string') {\n return value\n }\n\n const resolveMappingResult = resolveMapping(path, csm)\n if (!resolveMappingResult) {\n return value\n }\n\n const {mapping, matchedPath} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = csm.documents[mapping.source.document!]\n const sourcePath = csm.paths[mapping.source.path]\n\n const matchPathSegments = parseJsonPath(matchedPath)\n const sourcePathSegments = parseJsonPath(sourcePath)\n const fullSourceSegments = sourcePathSegments.concat(path.slice(matchPathSegments.length))\n\n return encoder({\n sourcePath: fullSourceSegments,\n sourceDocument,\n resultPath: path,\n value,\n })\n }) as Result\n}\n","import type {FilterDefault} from './types'\n\nexport const filterDefault: FilterDefault = ({sourcePath, value}) => {\n // Skips encoding on URL or Date strings, similar to the `skip: 'auto'` parameter in vercelStegaCombine()\n if (isValidDate(value) || isValidURL(value)) {\n return false\n }\n\n const endPath = sourcePath.at(-1)\n // Never encode slugs\n if (sourcePath.at(-2) === 'slug' && endPath === 'current') {\n return false\n }\n\n // Skip underscored keys, needs better heuristics but it works for now\n if (typeof endPath === 'string' && endPath.startsWith('_')) {\n return false\n }\n\n /**\n * Best effort infer Portable Text paths that should not be encoded.\n * Nothing is for certain, and the below implementation may cause paths that aren't Portable Text and otherwise be safe to encode to be skipped.\n * However, that's ok as userland can always opt-in with the `encodeSourceMapAtPath` option and mark known safe paths as such, which will override this heuristic.\n */\n // If the path ends in marks[number] it's likely a PortableTextSpan: https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#LL154C16-L154C16\n if (typeof endPath === 'number' && sourcePath.at(-2) === 'marks') {\n return false\n }\n // Or if it's [number].markDefs[number].href it's likely a PortableTextLink: https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#L163\n if (\n endPath === 'href' &&\n typeof sourcePath.at(-2) === 'number' &&\n sourcePath.at(-3) === 'markDefs'\n ) {\n return false\n }\n // Otherwise we have to deal with special properties of PortableTextBlock, and we can't confidently know if it's actually a `_type: 'block'` array item or not.\n // All we know is that if it is indeed a block, and we encode the strings on these keys it'll for sure break the PortableText rendering and thus we skip encoding.\n // https://github.com/portabletext/types/blob/e54eb24f136d8efd51a46c6a190e7c46e79b5380/src/portableText.ts#L48-L58\n if (endPath === 'style' || endPath === 'listItem') {\n return false\n }\n\n // Don't encode into anything that is suggested it'll render for SEO in meta tags\n if (\n sourcePath.some(\n (path) => path === 'meta' || path === 'metadata' || path === 'openGraph' || path === 'seo',\n )\n ) {\n return false\n }\n\n // Finally, we ignore a bunch of paths that are typically used for page building\n if (typeof endPath === 'string' && denylist.has(endPath)) {\n return false\n }\n\n return true\n}\n\nconst denylist = new Set([\n 'color',\n 'colour',\n 'currency',\n 'email',\n 'format',\n 'gid',\n 'hex',\n 'href',\n 'hsl',\n 'hsla',\n 'icon',\n 'id',\n 'index',\n 'key',\n 'language',\n 'layout',\n 'link',\n 'linkAction',\n 'locale',\n 'lqip',\n 'page',\n 'path',\n 'ref',\n 'rgb',\n 'rgba',\n 'route',\n 'secret',\n 'slug',\n 'status',\n 'tag',\n 'template',\n 'theme',\n 'type',\n 'unit',\n 'url',\n 'username',\n 'variant',\n 'website',\n])\n\nfunction isValidDate(dateString: string) {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(dateString) ? Boolean(Date.parse(dateString)) : false\n}\n\nfunction isValidURL(url: string) {\n try {\n new URL(url, url.startsWith('/') ? 'https://acme.com' : undefined)\n } catch {\n return false\n }\n return true\n}\n","import {vercelStegaCombine} from '@vercel/stega'\n\nimport {createEditUrl} from '../csm/createEditUrl'\nimport {jsonPathToStudioPath} from '../csm/jsonPath'\nimport {resolveStudioBaseRoute} from '../csm/resolveEditInfo'\nimport {reKeySegment, toString as studioPathToString} from '../csm/studioPath'\nimport {encodeIntoResult} from './encodeIntoResult'\nimport {filterDefault} from './filterDefault'\nimport {ContentSourceMap, ContentSourceMapParsedPath, InitializedStegaConfig} from './types'\n\nconst TRUNCATE_LENGTH = 20\n\n/**\n * Uses `@vercel/stega` to embed edit info JSON into strings in your query result.\n * The JSON payloads are added using invisible characters so they don't show up visually.\n * The edit info is generated from the Content Source Map (CSM) that is returned from Sanity for the query.\n * @public\n */\nexport function stegaEncodeSourceMap<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n config: InitializedStegaConfig,\n): Result {\n const {filter, logger, enabled} = config\n if (!enabled) {\n const msg = \"config.enabled must be true, don't call this function otherwise\"\n logger?.error?.(`[@sanity/client/stega]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n if (!resultSourceMap) {\n logger?.error?.('[@sanity/client/stega]: Missing Content Source Map from response body', {\n result,\n resultSourceMap,\n config,\n })\n return result\n }\n\n if (!config.studioUrl) {\n const msg = 'config.studioUrl must be defined'\n logger?.error?.(`[@sanity/client/stega]: ${msg}`, {result, resultSourceMap, config})\n throw new TypeError(msg)\n }\n\n const report: Record<'encoded' | 'skipped', {path: string; length: number; value: string}[]> = {\n encoded: [],\n skipped: [],\n }\n\n const resultWithStega = encodeIntoResult(\n result,\n resultSourceMap,\n ({sourcePath, sourceDocument, resultPath, value}) => {\n // Allow userland to control when to opt-out of encoding\n if (\n (typeof filter === 'function'\n ? filter({sourcePath, resultPath, filterDefault, sourceDocument, value})\n : filterDefault({sourcePath, resultPath, filterDefault, sourceDocument, value})) === false\n ) {\n if (logger) {\n report.skipped.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${\n value.length > TRUNCATE_LENGTH ? '...' : ''\n }`,\n length: value.length,\n })\n }\n return value\n }\n\n if (logger) {\n report.encoded.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? '...' : ''}`,\n length: value.length,\n })\n }\n\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof config.studioUrl === 'function'\n ? config.studioUrl(sourceDocument)\n : config.studioUrl!,\n )\n if (!baseUrl) return value\n const {_id: id, _type: type} = sourceDocument\n\n return vercelStegaCombine(\n value,\n {\n origin: 'sanity.io',\n href: createEditUrl({\n baseUrl,\n workspace,\n tool,\n id,\n type,\n path: sourcePath,\n }),\n },\n // We use custom logic to determine if we should skip encoding\n false,\n )\n },\n )\n\n if (logger) {\n const isSkipping = report.skipped.length\n const isEncoding = report.encoded.length\n if (isSkipping || isEncoding) {\n ;(logger?.groupCollapsed || logger.log)?.(\n '[@sanity/client/stega]: Encoding source map into result',\n )\n logger.log?.(\n `[@sanity/client/stega]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`,\n )\n }\n if (report.encoded.length > 0) {\n logger?.log?.(`[@sanity/client/stega]: Table of encoded paths`)\n ;(logger?.table || logger.log)?.(report.encoded)\n }\n if (report.skipped.length > 0) {\n const skipped = new Set<string>()\n for (const {path} of report.skipped) {\n skipped.add(path.replace(reKeySegment, '0').replace(/\\[\\d+\\]/g, '[]'))\n }\n logger?.log?.(`[@sanity/client/stega]: List of skipped paths`, [...skipped.values()])\n }\n\n if (isSkipping || isEncoding) {\n logger?.groupEnd?.()\n }\n }\n\n return resultWithStega\n}\n\nfunction prettyPathForLogging(path: ContentSourceMapParsedPath): string {\n return studioPathToString(jsonPathToStudioPath(path))\n}\n"],"names":["walkMap","resolveMapping","parseJsonPath","resolveStudioBaseRoute","vercelStegaCombine","createEditUrl","reKeySegment","studioPathToString","jsonPathToStudioPath"],"mappings":";;;;;AASgB,SAAA,gBAAA,CACd,MACA,EAAA,GAAA,EACA,OACQ,EAAA;AACR,EAAA,OAAOA,uBAAQ,CAAA,MAAA,EAAQ,CAAC,KAAA,EAAO,IAAS,KAAA;AAEtC,IAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAM,MAAA,oBAAA,GAAuBC,8BAAe,CAAA,IAAA,EAAM,GAAG,CAAA,CAAA;AACrD,IAAA,IAAI,CAAC,oBAAsB,EAAA;AACzB,MAAO,OAAA,KAAA,CAAA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