@sanity/client 6.10.0 → 6.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/_chunks/{nodeMiddleware-KnoWsJY5.js → nodeMiddleware-KmzBikOI.js} +2 -2
- package/dist/_chunks/{nodeMiddleware-KnoWsJY5.js.map → nodeMiddleware-KmzBikOI.js.map} +1 -1
- package/dist/_chunks/{nodeMiddleware-1l7OW-D5.cjs → nodeMiddleware-qHjfdThT.cjs} +2 -2
- package/dist/_chunks/{nodeMiddleware-1l7OW-D5.cjs.map → nodeMiddleware-qHjfdThT.cjs.map} +1 -1
- package/dist/_chunks/{resolveEditInfo-AeWgV4US.js → resolveEditInfo-FaeuCV4M.js} +9 -9
- package/dist/_chunks/resolveEditInfo-FaeuCV4M.js.map +1 -0
- package/dist/_chunks/{resolveEditInfo-v_7g85GR.cjs → resolveEditInfo-TYjTkHKU.cjs} +9 -8
- package/dist/_chunks/resolveEditInfo-TYjTkHKU.cjs.map +1 -0
- package/dist/csm.cjs +33 -4
- package/dist/csm.cjs.map +1 -1
- package/dist/csm.d.ts +4 -0
- package/dist/csm.js +35 -6
- package/dist/csm.js.map +1 -1
- package/dist/index.browser.cjs +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.js +2 -2
- package/dist/stega.browser.cjs +2 -2
- package/dist/stega.browser.cjs.map +1 -1
- package/dist/stega.browser.js.map +1 -1
- package/dist/stega.cjs +4 -4
- package/dist/stega.js +3 -3
- package/package.json +12 -10
- package/src/csm/applySourceDocuments.ts +41 -3
- package/src/csm/getPublishedId.ts +1 -1
- package/src/csm/types.ts +1 -0
- package/umd/sanityClient.js +0 -4
- package/umd/sanityClient.min.js +1 -1
- package/dist/_chunks/resolveEditInfo-AeWgV4US.js.map +0 -1
- package/dist/_chunks/resolveEditInfo-v_7g85GR.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 F(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 r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=I(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(R,R.exports);const P="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),D=["boolean","string","number"];function q(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!P(t)&&(-1!==D.indexOf(typeof t)||Array.isArray(t)||!1!==F(r=t)&&(void 0===(n=r.constructor)||!1!==F(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function N(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let H={};"undefined"!=typeof globalThis?H=globalThis:"undefined"!=typeof window?H=window:"undefined"!=typeof global?H=global:"undefined"!=typeof self&&(H=self);var W=H;function z(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||W.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,r)=>new e((e=>(t.error.subscribe((t=>e.error(t))),t.progress.subscribe((t=>e.next(Object.assign({type:"progress"},t)))),t.response.subscribe((t=>{e.next(Object.assign({type:"response"},t)),e.complete()})),t.request.publish(r),()=>t.abort.publish())))}}class U{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 U(e),t(this.reason))}))}};L.source=()=>{let e;return{token:new L((t=>{e=t})),cancel:e}};var B=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function $(e){return 100*Math.pow(2,e)+100*Math.random()}const G=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||$,n=e.shouldRetry;return{onError:(e,o)=>{const s=o.options,i=s.maxRetries||t,a=s.shouldRetry||n,c=s.attemptNumber||0;if(null!==(u=s.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,s)||c>=i)return e;const l=Object.assign({},o,{options:Object.assign({},s,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),r(c)),null}}})({shouldRetry:B,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};G.shouldRetry=B;var V=function(e,t){return V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},V(e,t)};function J(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}V(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function X(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function K(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function Z(e){return"function"==typeof e}function Q(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 ee=Q((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 te(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var re=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=X(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(Z(c))try{c()}catch(e){o=e instanceof ee?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=X(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{oe(d)}catch(e){o=null!=o?o:[],e instanceof ee?o=K(K([],Y(o)),Y(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new ee(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)oe(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&te(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&te(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ne(e){return e instanceof re||e&&"closed"in e&&Z(e.remove)&&Z(e.add)&&Z(e.unsubscribe)}function oe(e){Z(e)?e():e.unsubscribe()}re.EMPTY;var se={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ie={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ie.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,K([e,t],Y(r))):setTimeout.apply(void 0,K([e,t],Y(r)))},clearTimeout:function(e){var t=ie.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ae(){}var ce=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ne(t)&&t.add(r)):r.destination=fe,r}return J(t,e),t.create=function(e,t,r){return new de(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(re),ue=Function.prototype.bind;function le(e,t){return ue.call(e,t)}var he=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){pe(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){pe(e)}else pe(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){pe(e)}},e}(),de=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;Z(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&se.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&le(t.next,s),error:t.error&&le(t.error,s),complete:t.complete&&le(t.complete,s)}):o=t;return i.destination=new he(o),i}return J(t,e),t}(ce);function pe(e){var t;t=e,ie.setTimeout((function(){throw t}))}var fe={closed:!0,next:ae,error:function(e){throw e},complete:ae},ye="function"==typeof Symbol&&Symbol.observable||"@@observable";function ge(e){return e}var ve=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof ce||function(e){return e&&Z(e.next)&&Z(e.error)&&Z(e.complete)}(n)&&ne(n)?e:new de(e,t,r);return function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}(),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=me(t))((function(t,n){var o=new de({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[ye]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?ge:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=me(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function me(e){var t;return null!==(t=null!=e?e:se.Promise)&&void 0!==t?t:Promise}function we(e){return function(t){if(function(e){return Z(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 be(e,t,r,n,o){return new Ce(e,t,r,n,o)}var Ce=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return J(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(ce),Ee=Q((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function xe(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Ee)}})}))}function Te(e,t){return we((function(r,n){var o=0;r.subscribe(be(n,(function(r){n.next(e.call(t,r,o++))})))}))}function Oe(e,t){return we((function(r,n){var o=0;r.subscribe(be(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}class Se extends Error{constructor(e){const t=je(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class _e extends Error{constructor(e){const t=je(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function je(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:ke(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message="".concat(t.error," - ").concat(t.message),r;if(function(e){return Ae(e)&&Ae(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?":\n- ".concat(n.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),r.message="".concat(t.error.description).concat(o),r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function Ae(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ke(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Re={onResponse:e=>{if(e.statusCode>=500)throw new _e(e);if(e.statusCode>=400)throw new Se(e);return e}},Me={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function Ie(e,t){let{maxRetries:r=5,retryDelay:n}=t;const o=j([r>0?G({retryDelay:n,maxRetries:r,shouldRetry:Fe}):{},...e,Me,q(),N(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},Re,z({implementation:ve})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function Fe(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||G.shouldRetry(e,t,r)}function Pe(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 De=["image","file"],qe=["before","after","replace"],Ne=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")},He=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},We=(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'))},ze=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));We(e,t._id)},Ue=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},Le=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 Be,$e,Ge=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ve=(e,t,r)=>(Ge(e,t,"read from private field"),r?r.call(e):t.get(e)),Je=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Xe=(e,t,r,n)=>(Ge(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Ye{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return He("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===qe.indexOf(e)){const e=qe.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...Pe(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return He(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}Be=new WeakMap;let Ke=class e extends Ye{constructor(e,t,r){super(e,t),Je(this,Be,void 0),Xe(this,Be,r)}clone(){return new e(this.selection,{...this.operations},Ve(this,Be))}commit(e){if(!Ve(this,Be))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Ve(this,Be).mutate({patch:this.serialize()},r)}};$e=new WeakMap;let Ze=class e extends Ye{constructor(e,t,r){super(e,t),Je(this,$e,void 0),Xe(this,$e,r)}clone(){return new e(this.selection,{...this.operations},Ve(this,$e))}commit(e){if(!Ve(this,$e))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Ve(this,$e).mutate({patch:this.serialize()},r)}};var Qe,et,tt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},rt=(e,t,r)=>(tt(e,t,"read from private field"),r?r.call(e):t.get(e)),nt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ot=(e,t,r,n)=>(tt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const st={returnDocuments:!1};class it{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.operations=e,this.trxId=t}create(e){return He("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return He(t,e),ze(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return He(t,e),ze(t,e),this._add({[t]:e})}delete(e){return We("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}}Qe=new WeakMap;let at=class e extends it{constructor(e,t,r){super(e,r),nt(this,Qe,void 0),ot(this,Qe,t)}clone(){return new e([...this.operations],rt(this,Qe),this.trxId)}commit(e){if(!rt(this,Qe))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return rt(this,Qe).mutate(this.serialize(),Object.assign({transactionId:this.trxId},st,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ze)return this._add({patch:e.serialize()});if(r){const r=t(new Ze(e,{},rt(this,Qe)));if(!(r instanceof Ze))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};et=new WeakMap;let ct=class e extends it{constructor(e,t,r){super(e,r),nt(this,et,void 0),ot(this,et,t)}clone(){return new e([...this.operations],rt(this,et),this.trxId)}commit(e){if(!rt(this,et))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return rt(this,et).mutate(this.serialize(),Object.assign({transactionId:this.trxId},st,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ke)return this._add({patch:e.serialize()});if(r){const r=t(new Ke(e,{},rt(this,et)));if(!(r instanceof Ke))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};function ut(e){return"https://www.sanity.io/help/"+e}const lt=e=>function(e){let t,r=!1;return function(){return r||(t=e(...arguments),r=!0),t}}((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return console.warn(e.join(" "),...r)})),ht=lt(["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."]),dt=lt(["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."]),pt=lt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(ut("js-client-browser-token")," for more information and how to hide this warning.")]),ft=lt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(ut("js-client-api-version"))]),yt=lt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),gt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},vt=["localhost","127.0.0.1","0.0.0.0"],mt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},wt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||ft();const n=Object.assign({},gt,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=ut("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&mt(n.perspective),"encodeSourceMapAtPath"in n||"encodeSourceMap"in n||"studioUrl"in n||"logger"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import.");if("stega"in n&&void 0!==n.stega&&!1!==n.stega)throw new Error("It looks like you're using options meant for '@sanity/client/stega'. Make sure you're using the right import. Or set 'stega' in 'createClient' to 'false'.");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==vt.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?pt():void 0===n.useCdn&&ht(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&Ne(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?Le(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===gt.apiHost,n.useCdn=!1!==n.useCdn&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n},bt="X-Sanity-Project-ID";const Ct=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.append("tag",s),o.append("query",t);for(const[e,t]of Object.entries(r))o.append("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.append(e,"".concat(t));return"?".concat(o)},Et=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},xt=e=>"response"===e.type,Tt=e=>e.body,Ot=11264;function St(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if("stega"in o&&void 0!==o.stega&&!1!==o.stega)throw new Error("It looks like you're using options meant for '@sanity/client/stega'. Make sure you're using the right import. Or set 'stega' in 'fetch' to 'false'.");const s=!1===o.filterResponse?e=>e:e=>e.result,{cache:i,next:a,...c}={useAbortSignal:void 0!==o.signal,...o};return It(e,t,"query",{query:r,params:n},void 0!==i||void 0!==a?{...c,fetch:{cache:i,next:a}}:c).pipe(Te(s))}function _t(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Pt(e,t,{uri:qt(e,"doc",r),json:!0,tag:n.tag}).pipe(Oe(xt),Te((e=>e.body.documents&&e.body.documents[0])))}function jt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Pt(e,t,{uri:qt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(Oe(xt),Te((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function At(e,t,r,n){return ze("createIfNotExists",r),Ft(e,t,r,"createIfNotExists",n)}function kt(e,t,r,n){return ze("createOrReplace",r),Ft(e,t,r,"createOrReplace",n)}function Rt(e,t,r,n){return It(e,t,"mutate",{mutations:[{delete:Pe(r)}]},n)}function Mt(e,t,r,n){let o;o=r instanceof Ze||r instanceof Ke?{patch:r.serialize()}:r instanceof at||r instanceof ct?r.serialize():r;return It(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function It(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":Ct(n),c=!s&&a.length<Ot,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o;return Pt(e,t,{method:c?"GET":"POST",uri:qt(e,r,u),json:!0,body:c?void 0:n,query:s&&Et(o),timeout:h,headers:f,token:d,tag:p,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:i,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(Oe(xt),Te(Tt),Te((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function Ft(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return It(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Pt(e,t,r){var n,o;const s=r.url||r.uri,i=e.config(),a=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===s.indexOf("/data/"):r.canUseCdn;let c=(null!=(n=r.useCdn)?n:i.useCdn)&&a;const u=r.tag&&i.requestTagPrefix?[i.requestTagPrefix,r.tag].join("."):r.tag||i.requestTagPrefix;if(u&&null!==r.tag&&(r.query={tag:Le(u),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===s.indexOf("/data/query/")){const e=null!=(o=r.resultSourceMap)?o:i.resultSourceMap;void 0!==e&&!1!==e&&(r.query={resultSourceMap:e,...r.query});const t=r.perspective||i.perspective;"string"==typeof t&&"raw"!==t&&(mt(t),r.query={perspective:t,...r.query},"previewDrafts"===t&&c&&(c=!1,dt()))}const l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[bt]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(i,Object.assign({},r,{url:Nt(e,s,c)})),h=new ve((e=>t(l,i.requester).subscribe(e)));return r.signal?h.pipe((d=r.signal,e=>new ve((t=>{const r=()=>t.error(function(e){var t,r;if(Ht)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(d));if(d&&d.aborted)return void r();const n=e.subscribe(t);return d.addEventListener("abort",r),()=>{d.removeEventListener("abort",r),n.unsubscribe()}})))):h;var d}function Dt(e,t,r){return Pt(e,t,r).pipe(Oe((e=>"response"===e.type)),Te((e=>e.body)))}function qt(e,t,r){const n=e.config(),o=Ue(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Nt(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=e.config();return"".concat(r?o:n,"/").concat(t.replace(/^\//,""))}const Ht=Boolean(globalThis.DOMException);var Wt,zt,Ut,Lt,Bt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},$t=(e,t,r)=>(Bt(e,t,"read from private field"),r?r.call(e):t.get(e)),Gt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Vt=(e,t,r,n)=>(Bt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Jt{constructor(e,t){Gt(this,Wt,void 0),Gt(this,zt,void 0),Vt(this,Wt,e),Vt(this,zt,t)}upload(e,t,r){return Yt($t(this,Wt),$t(this,zt),e,t,r)}}Wt=new WeakMap,zt=new WeakMap;class Xt{constructor(e,t){Gt(this,Ut,void 0),Gt(this,Lt,void 0),Vt(this,Ut,e),Vt(this,Lt,t)}upload(e,t,r){return xe(Yt($t(this,Ut),$t(this,Lt),e,t,r).pipe(Oe((e=>"response"===e.type)),Te((e=>e.body.document))))}}function Yt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===De.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(De.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Ue(e.config()),a="image"===r?"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,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,g={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),Pt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:n})}Ut=new WeakMap,Lt=new WeakMap;var Kt=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const Zt=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Qt={includeResult:!0};function er(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={...Kt(r,Qt),tag:a},u=(l=c,Zt.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=Ct({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(qt(this,"listen",h));if(d.length>14800)return new ve((e=>e.error(new Error("Query too large for listener"))));const p=c.events?c.events:["mutation"],f=-1!==p.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new ve((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(f&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(c(),clearTimeout(r),r=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=tr(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 i(t){const r=tr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",s),t.removeEventListener("disconnect",a),p.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Xr})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),p.forEach((e=>t.addEventListener(e,i))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){n=!0,c()}return h}))}function tr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var rr,nr,or,sr,ir=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ar=(e,t,r)=>(ir(e,t,"read from private field"),r?r.call(e):t.get(e)),cr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ur=(e,t,r,n)=>(ir(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class lr{constructor(e,t){cr(this,rr,void 0),cr(this,nr,void 0),ur(this,rr,e),ur(this,nr,t)}create(e,t){return dr(ar(this,rr),ar(this,nr),"PUT",e,t)}edit(e,t){return dr(ar(this,rr),ar(this,nr),"PATCH",e,t)}delete(e){return dr(ar(this,rr),ar(this,nr),"DELETE",e)}list(){return Dt(ar(this,rr),ar(this,nr),{uri:"/datasets",tag:null})}}rr=new WeakMap,nr=new WeakMap;class hr{constructor(e,t){cr(this,or,void 0),cr(this,sr,void 0),ur(this,or,e),ur(this,sr,t)}create(e,t){return xe(dr(ar(this,or),ar(this,sr),"PUT",e,t))}edit(e,t){return xe(dr(ar(this,or),ar(this,sr),"PATCH",e,t))}delete(e){return xe(dr(ar(this,or),ar(this,sr),"DELETE",e))}list(){return xe(Dt(ar(this,or),ar(this,sr),{uri:"/datasets",tag:null}))}}function dr(e,t,r,n,o){return Ne(n),Dt(e,t,{method:r,uri:"/datasets/".concat(n),body:o,tag:null})}or=new WeakMap,sr=new WeakMap;var pr,fr,yr,gr,vr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},mr=(e,t,r)=>(vr(e,t,"read from private field"),r?r.call(e):t.get(e)),wr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},br=(e,t,r,n)=>(vr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Cr{constructor(e,t){wr(this,pr,void 0),wr(this,fr,void 0),br(this,pr,e),br(this,fr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Dt(mr(this,pr),mr(this,fr),{uri:t})}getById(e){return Dt(mr(this,pr),mr(this,fr),{uri:"/projects/".concat(e)})}}pr=new WeakMap,fr=new WeakMap;class Er{constructor(e,t){wr(this,yr,void 0),wr(this,gr,void 0),br(this,yr,e),br(this,gr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return xe(Dt(mr(this,yr),mr(this,gr),{uri:t}))}getById(e){return xe(Dt(mr(this,yr),mr(this,gr),{uri:"/projects/".concat(e)}))}}yr=new WeakMap,gr=new WeakMap;var xr,Tr,Or,Sr,_r=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},jr=(e,t,r)=>(_r(e,t,"read from private field"),r?r.call(e):t.get(e)),Ar=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},kr=(e,t,r,n)=>(_r(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Rr{constructor(e,t){Ar(this,xr,void 0),Ar(this,Tr,void 0),kr(this,xr,e),kr(this,Tr,t)}getById(e){return Dt(jr(this,xr),jr(this,Tr),{uri:"/users/".concat(e)})}}xr=new WeakMap,Tr=new WeakMap;class Mr{constructor(e,t){Ar(this,Or,void 0),Ar(this,Sr,void 0),kr(this,Or,e),kr(this,Sr,t)}getById(e){return xe(Dt(jr(this,Or),jr(this,Sr),{uri:"/users/".concat(e)}))}}Or=new WeakMap,Sr=new WeakMap;var Ir,Fr,Pr,Dr,qr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nr=(e,t,r)=>(qr(e,t,"read from private field"),r?r.call(e):t.get(e)),Hr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Wr=(e,t,r,n)=>(qr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Ir=new WeakMap,Fr=new WeakMap;let zr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt;Hr(this,Ir,void 0),Hr(this,Fr,void 0),this.listen=er,this.config(t),Wr(this,Fr,e),this.assets=new Jt(this,Nr(this,Fr)),this.datasets=new lr(this,Nr(this,Fr)),this.projects=new Cr(this,Nr(this,Fr)),this.users=new Rr(this,Nr(this,Fr))}clone(){return new e(Nr(this,Fr),this.config())}config(e){if(void 0===e)return{...Nr(this,Ir)};if(Nr(this,Ir)&&!1===Nr(this,Ir).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Wr(this,Ir,wt(e,Nr(this,Ir)||{})),this}withConfig(t){return new e(Nr(this,Fr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return St(this,Nr(this,Fr),e,t,r)}getDocument(e,t){return _t(this,Nr(this,Fr),e,t)}getDocuments(e,t){return jt(this,Nr(this,Fr),e,t)}create(e,t){return Ft(this,Nr(this,Fr),e,"create",t)}createIfNotExists(e,t){return At(this,Nr(this,Fr),e,t)}createOrReplace(e,t){return kt(this,Nr(this,Fr),e,t)}delete(e,t){return Rt(this,Nr(this,Fr),e,t)}mutate(e,t){return Mt(this,Nr(this,Fr),e,t)}patch(e,t){return new Ke(e,t,this)}transaction(e){return new ct(e,this)}request(e){return Dt(this,Nr(this,Fr),e)}getUrl(e,t){return Nt(this,e,t)}getDataUrl(e,t){return qt(this,e,t)}};Pr=new WeakMap,Dr=new WeakMap;let Ur=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt;Hr(this,Pr,void 0),Hr(this,Dr,void 0),this.listen=er,this.config(t),Wr(this,Dr,e),this.assets=new Xt(this,Nr(this,Dr)),this.datasets=new hr(this,Nr(this,Dr)),this.projects=new Er(this,Nr(this,Dr)),this.users=new Mr(this,Nr(this,Dr)),this.observable=new zr(e,t)}clone(){return new e(Nr(this,Dr),this.config())}config(e){if(void 0===e)return{...Nr(this,Pr)};if(Nr(this,Pr)&&!1===Nr(this,Pr).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),Wr(this,Pr,wt(e,Nr(this,Pr)||{})),this}withConfig(t){return new e(Nr(this,Dr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return xe(St(this,Nr(this,Dr),e,t,r))}getDocument(e,t){return xe(_t(this,Nr(this,Dr),e,t))}getDocuments(e,t){return xe(jt(this,Nr(this,Dr),e,t))}create(e,t){return xe(Ft(this,Nr(this,Dr),e,"create",t))}createIfNotExists(e,t){return xe(At(this,Nr(this,Dr),e,t))}createOrReplace(e,t){return xe(kt(this,Nr(this,Dr),e,t))}delete(e,t){return xe(Rt(this,Nr(this,Dr),e,t))}mutate(e,t){return xe(Mt(this,Nr(this,Dr),e,t))}patch(e,t){return new Ze(e,t,this)}transaction(e){return new at(e,this)}request(e){return xe(Dt(this,Nr(this,Dr),e))}dataRequest(e,t,r){return xe(It(this,Nr(this,Dr),e,t,r))}getUrl(e,t){return Nt(this,e,t)}getDataUrl(e,t){return qt(this,e,t)}};const Lr=function(e,t){return{requester:Ie(e,{}).defaultRequester,createClient:r=>new t(Ie(e,{maxRetries:r.maxRetries,retryDelay:r.retryDelay}),r)}}([],Ur),Br=Lr.requester,$r=Lr.createClient,Gr=function(e){return function(t){return yt(),e(t)}}($r);var Vr={exports:{}};
|
|
8
|
+
function F(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 r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=I(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(R,R.exports);const P="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),D=["boolean","string","number"];function q(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!P(t)&&(-1!==D.indexOf(typeof t)||Array.isArray(t)||!1!==F(r=t)&&(void 0===(n=r.constructor)||!1!==F(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function N(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let H={};"undefined"!=typeof globalThis?H=globalThis:"undefined"!=typeof window?H=window:"undefined"!=typeof global?H=global:"undefined"!=typeof self&&(H=self);var W=H;function z(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||W.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,r)=>new e((e=>(t.error.subscribe((t=>e.error(t))),t.progress.subscribe((t=>e.next(Object.assign({type:"progress"},t)))),t.response.subscribe((t=>{e.next(Object.assign({type:"response"},t)),e.complete()})),t.request.publish(r),()=>t.abort.publish())))}}class U{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 U(e),t(this.reason))}))}};L.source=()=>{let e;return{token:new L((t=>{e=t})),cancel:e}};var B=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function $(e){return 100*Math.pow(2,e)+100*Math.random()}const G=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||$,n=e.shouldRetry;return{onError:(e,o)=>{const s=o.options,i=s.maxRetries||t,a=s.shouldRetry||n,c=s.attemptNumber||0;if(null!==(u=s.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,s)||c>=i)return e;const l=Object.assign({},o,{options:Object.assign({},s,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),r(c)),null}}})({shouldRetry:B,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};G.shouldRetry=B;var V=function(e,t){return V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},V(e,t)};function J(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}V(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function X(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Y(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function K(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function Z(e){return"function"==typeof e}function Q(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 ee=Q((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 te(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var re=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=X(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(Z(c))try{c()}catch(e){o=e instanceof ee?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=X(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{oe(d)}catch(e){o=null!=o?o:[],e instanceof ee?o=K(K([],Y(o)),Y(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new ee(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)oe(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&te(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&te(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ne(e){return e instanceof re||e&&"closed"in e&&Z(e.remove)&&Z(e.add)&&Z(e.unsubscribe)}function oe(e){Z(e)?e():e.unsubscribe()}re.EMPTY;var se={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ie={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,K([e,t],Y(r)))},clearTimeout:function(e){var t=ie.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ae(){}var ce=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ne(t)&&t.add(r)):r.destination=fe,r}return J(t,e),t.create=function(e,t,r){return new de(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(re),ue=Function.prototype.bind;function le(e,t){return ue.call(e,t)}var he=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){pe(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){pe(e)}else pe(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){pe(e)}},e}(),de=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;Z(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&se.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&le(t.next,s),error:t.error&&le(t.error,s),complete:t.complete&&le(t.complete,s)}):o=t;return i.destination=new he(o),i}return J(t,e),t}(ce);function pe(e){var t;t=e,ie.setTimeout((function(){throw t}))}var fe={closed:!0,next:ae,error:function(e){throw e},complete:ae},ye="function"==typeof Symbol&&Symbol.observable||"@@observable";function ge(e){return e}var ve=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof ce||function(e){return e&&Z(e.next)&&Z(e.error)&&Z(e.complete)}(n)&&ne(n)?e:new de(e,t,r);return function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}(),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=me(t))((function(t,n){var o=new de({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[ye]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?ge:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=me(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function me(e){var t;return null!==(t=null!=e?e:se.Promise)&&void 0!==t?t:Promise}function we(e){return function(t){if(function(e){return Z(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 be(e,t,r,n,o){return new Ce(e,t,r,n,o)}var Ce=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return J(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(ce),Ee=Q((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function xe(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Ee)}})}))}function Te(e,t){return we((function(r,n){var o=0;r.subscribe(be(n,(function(r){n.next(e.call(t,r,o++))})))}))}function Oe(e,t){return we((function(r,n){var o=0;r.subscribe(be(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}class Se extends Error{constructor(e){const t=je(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class _e extends Error{constructor(e){const t=je(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function je(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:ke(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message="".concat(t.error," - ").concat(t.message),r;if(function(e){return Ae(e)&&Ae(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?":\n- ".concat(n.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),r.message="".concat(t.error.description).concat(o),r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function Ae(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ke(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Re={onResponse:e=>{if(e.statusCode>=500)throw new _e(e);if(e.statusCode>=400)throw new Se(e);return e}},Me={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function Ie(e,t){let{maxRetries:r=5,retryDelay:n}=t;const o=j([r>0?G({retryDelay:n,maxRetries:r,shouldRetry:Fe}):{},...e,Me,q(),N(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},Re,z({implementation:ve})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function Fe(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||G.shouldRetry(e,t,r)}function Pe(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 De=["image","file"],qe=["before","after","replace"],Ne=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")},He=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},We=(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'))},ze=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));We(e,t._id)},Ue=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},Le=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 Be,$e,Ge=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ve=(e,t,r)=>(Ge(e,t,"read from private field"),r?r.call(e):t.get(e)),Je=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Xe=(e,t,r,n)=>(Ge(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Ye{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return He("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===qe.indexOf(e)){const e=qe.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...Pe(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return He(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}Be=new WeakMap;let Ke=class e extends Ye{constructor(e,t,r){super(e,t),Je(this,Be,void 0),Xe(this,Be,r)}clone(){return new e(this.selection,{...this.operations},Ve(this,Be))}commit(e){if(!Ve(this,Be))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Ve(this,Be).mutate({patch:this.serialize()},r)}};$e=new WeakMap;let Ze=class e extends Ye{constructor(e,t,r){super(e,t),Je(this,$e,void 0),Xe(this,$e,r)}clone(){return new e(this.selection,{...this.operations},Ve(this,$e))}commit(e){if(!Ve(this,$e))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Ve(this,$e).mutate({patch:this.serialize()},r)}};var Qe,et,tt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},rt=(e,t,r)=>(tt(e,t,"read from private field"),r?r.call(e):t.get(e)),nt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ot=(e,t,r,n)=>(tt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const st={returnDocuments:!1};class it{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.operations=e,this.trxId=t}create(e){return He("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return He(t,e),ze(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return He(t,e),ze(t,e),this._add({[t]:e})}delete(e){return We("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}}Qe=new WeakMap;let at=class e extends it{constructor(e,t,r){super(e,r),nt(this,Qe,void 0),ot(this,Qe,t)}clone(){return new e([...this.operations],rt(this,Qe),this.trxId)}commit(e){if(!rt(this,Qe))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return rt(this,Qe).mutate(this.serialize(),Object.assign({transactionId:this.trxId},st,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ze)return this._add({patch:e.serialize()});if(r){const r=t(new Ze(e,{},rt(this,Qe)));if(!(r instanceof Ze))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};et=new WeakMap;let ct=class e extends it{constructor(e,t,r){super(e,r),nt(this,et,void 0),ot(this,et,t)}clone(){return new e([...this.operations],rt(this,et),this.trxId)}commit(e){if(!rt(this,et))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return rt(this,et).mutate(this.serialize(),Object.assign({transactionId:this.trxId},st,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ke)return this._add({patch:e.serialize()});if(r){const r=t(new Ke(e,{},rt(this,et)));if(!(r instanceof Ke))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};function ut(e){return"https://www.sanity.io/help/"+e}const lt=e=>function(e){let t,r=!1;return function(){return r||(t=e(...arguments),r=!0),t}}((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return console.warn(e.join(" "),...r)})),ht=lt(["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."]),dt=lt(["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."]),pt=lt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(ut("js-client-browser-token")," for more information and how to hide this warning.")]),ft=lt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(ut("js-client-api-version"))]),yt=lt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),gt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},vt=["localhost","127.0.0.1","0.0.0.0"],mt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},wt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||ft();const n=Object.assign({},gt,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=ut("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&mt(n.perspective),"encodeSourceMapAtPath"in n||"encodeSourceMap"in n||"studioUrl"in n||"logger"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import.");if("stega"in n&&void 0!==n.stega&&!1!==n.stega)throw new Error("It looks like you're using options meant for '@sanity/client/stega'. Make sure you're using the right import. Or set 'stega' in 'createClient' to 'false'.");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==vt.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?pt():void 0===n.useCdn&&ht(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&Ne(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?Le(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===gt.apiHost,n.useCdn=!1!==n.useCdn&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n},bt="X-Sanity-Project-ID";const Ct=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.append("tag",s),o.append("query",t);for(const[e,t]of Object.entries(r))o.append("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.append(e,"".concat(t));return"?".concat(o)},Et=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},xt=e=>"response"===e.type,Tt=e=>e.body,Ot=11264;function St(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if("stega"in o&&void 0!==o.stega&&!1!==o.stega)throw new Error("It looks like you're using options meant for '@sanity/client/stega'. Make sure you're using the right import. Or set 'stega' in 'fetch' to 'false'.");const s=!1===o.filterResponse?e=>e:e=>e.result,{cache:i,next:a,...c}={useAbortSignal:void 0!==o.signal,...o};return It(e,t,"query",{query:r,params:n},void 0!==i||void 0!==a?{...c,fetch:{cache:i,next:a}}:c).pipe(Te(s))}function _t(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Pt(e,t,{uri:qt(e,"doc",r),json:!0,tag:n.tag}).pipe(Oe(xt),Te((e=>e.body.documents&&e.body.documents[0])))}function jt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Pt(e,t,{uri:qt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(Oe(xt),Te((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function At(e,t,r,n){return ze("createIfNotExists",r),Ft(e,t,r,"createIfNotExists",n)}function kt(e,t,r,n){return ze("createOrReplace",r),Ft(e,t,r,"createOrReplace",n)}function Rt(e,t,r,n){return It(e,t,"mutate",{mutations:[{delete:Pe(r)}]},n)}function Mt(e,t,r,n){let o;o=r instanceof Ze||r instanceof Ke?{patch:r.serialize()}:r instanceof at||r instanceof ct?r.serialize():r;return It(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function It(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":Ct(n),c=!s&&a.length<Ot,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o;return Pt(e,t,{method:c?"GET":"POST",uri:qt(e,r,u),json:!0,body:c?void 0:n,query:s&&Et(o),timeout:h,headers:f,token:d,tag:p,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:i,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(Oe(xt),Te(Tt),Te((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function Ft(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return It(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Pt(e,t,r){var n,o;const s=r.url||r.uri,i=e.config(),a=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===s.indexOf("/data/"):r.canUseCdn;let c=(null!=(n=r.useCdn)?n:i.useCdn)&&a;const u=r.tag&&i.requestTagPrefix?[i.requestTagPrefix,r.tag].join("."):r.tag||i.requestTagPrefix;if(u&&null!==r.tag&&(r.query={tag:Le(u),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===s.indexOf("/data/query/")){const e=null!=(o=r.resultSourceMap)?o:i.resultSourceMap;void 0!==e&&!1!==e&&(r.query={resultSourceMap:e,...r.query});const t=r.perspective||i.perspective;"string"==typeof t&&"raw"!==t&&(mt(t),r.query={perspective:t,...r.query},"previewDrafts"===t&&c&&(c=!1,dt()))}const l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[bt]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(i,Object.assign({},r,{url:Nt(e,s,c)})),h=new ve((e=>t(l,i.requester).subscribe(e)));return r.signal?h.pipe((d=r.signal,e=>new ve((t=>{const r=()=>t.error(function(e){var t,r;if(Ht)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(d));if(d&&d.aborted)return void r();const n=e.subscribe(t);return d.addEventListener("abort",r),()=>{d.removeEventListener("abort",r),n.unsubscribe()}})))):h;var d}function Dt(e,t,r){return Pt(e,t,r).pipe(Oe((e=>"response"===e.type)),Te((e=>e.body)))}function qt(e,t,r){const n=e.config(),o=Ue(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Nt(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=e.config();return"".concat(r?o:n,"/").concat(t.replace(/^\//,""))}const Ht=Boolean(globalThis.DOMException);var Wt,zt,Ut,Lt,Bt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},$t=(e,t,r)=>(Bt(e,t,"read from private field"),r?r.call(e):t.get(e)),Gt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Vt=(e,t,r,n)=>(Bt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Jt{constructor(e,t){Gt(this,Wt,void 0),Gt(this,zt,void 0),Vt(this,Wt,e),Vt(this,zt,t)}upload(e,t,r){return Yt($t(this,Wt),$t(this,zt),e,t,r)}}Wt=new WeakMap,zt=new WeakMap;class Xt{constructor(e,t){Gt(this,Ut,void 0),Gt(this,Lt,void 0),Vt(this,Ut,e),Vt(this,Lt,t)}upload(e,t,r){return xe(Yt($t(this,Ut),$t(this,Lt),e,t,r).pipe(Oe((e=>"response"===e.type)),Te((e=>e.body.document))))}}function Yt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===De.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(De.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Ue(e.config()),a="image"===r?"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,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,g={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),Pt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:n})}Ut=new WeakMap,Lt=new WeakMap;var Kt=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const Zt=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Qt={includeResult:!0};function er(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={...Kt(r,Qt),tag:a},u=(l=c,Zt.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=Ct({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(qt(this,"listen",h));if(d.length>14800)return new ve((e=>e.error(new Error("Query too large for listener"))));const p=c.events?c.events:["mutation"],f=-1!==p.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new ve((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(f&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(c(),clearTimeout(r),r=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=tr(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 i(t){const r=tr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",s),t.removeEventListener("disconnect",a),p.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Xr})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),p.forEach((e=>t.addEventListener(e,i))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){n=!0,c()}return h}))}function tr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var rr,nr,or,sr,ir=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ar=(e,t,r)=>(ir(e,t,"read from private field"),r?r.call(e):t.get(e)),cr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ur=(e,t,r,n)=>(ir(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class lr{constructor(e,t){cr(this,rr,void 0),cr(this,nr,void 0),ur(this,rr,e),ur(this,nr,t)}create(e,t){return dr(ar(this,rr),ar(this,nr),"PUT",e,t)}edit(e,t){return dr(ar(this,rr),ar(this,nr),"PATCH",e,t)}delete(e){return dr(ar(this,rr),ar(this,nr),"DELETE",e)}list(){return Dt(ar(this,rr),ar(this,nr),{uri:"/datasets",tag:null})}}rr=new WeakMap,nr=new WeakMap;class hr{constructor(e,t){cr(this,or,void 0),cr(this,sr,void 0),ur(this,or,e),ur(this,sr,t)}create(e,t){return xe(dr(ar(this,or),ar(this,sr),"PUT",e,t))}edit(e,t){return xe(dr(ar(this,or),ar(this,sr),"PATCH",e,t))}delete(e){return xe(dr(ar(this,or),ar(this,sr),"DELETE",e))}list(){return xe(Dt(ar(this,or),ar(this,sr),{uri:"/datasets",tag:null}))}}function dr(e,t,r,n,o){return Ne(n),Dt(e,t,{method:r,uri:"/datasets/".concat(n),body:o,tag:null})}or=new WeakMap,sr=new WeakMap;var pr,fr,yr,gr,vr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},mr=(e,t,r)=>(vr(e,t,"read from private field"),r?r.call(e):t.get(e)),wr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},br=(e,t,r,n)=>(vr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Cr{constructor(e,t){wr(this,pr,void 0),wr(this,fr,void 0),br(this,pr,e),br(this,fr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Dt(mr(this,pr),mr(this,fr),{uri:t})}getById(e){return Dt(mr(this,pr),mr(this,fr),{uri:"/projects/".concat(e)})}}pr=new WeakMap,fr=new WeakMap;class Er{constructor(e,t){wr(this,yr,void 0),wr(this,gr,void 0),br(this,yr,e),br(this,gr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return xe(Dt(mr(this,yr),mr(this,gr),{uri:t}))}getById(e){return xe(Dt(mr(this,yr),mr(this,gr),{uri:"/projects/".concat(e)}))}}yr=new WeakMap,gr=new WeakMap;var xr,Tr,Or,Sr,_r=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},jr=(e,t,r)=>(_r(e,t,"read from private field"),r?r.call(e):t.get(e)),Ar=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},kr=(e,t,r,n)=>(_r(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Rr{constructor(e,t){Ar(this,xr,void 0),Ar(this,Tr,void 0),kr(this,xr,e),kr(this,Tr,t)}getById(e){return Dt(jr(this,xr),jr(this,Tr),{uri:"/users/".concat(e)})}}xr=new WeakMap,Tr=new WeakMap;class Mr{constructor(e,t){Ar(this,Or,void 0),Ar(this,Sr,void 0),kr(this,Or,e),kr(this,Sr,t)}getById(e){return xe(Dt(jr(this,Or),jr(this,Sr),{uri:"/users/".concat(e)}))}}Or=new WeakMap,Sr=new WeakMap;var Ir,Fr,Pr,Dr,qr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nr=(e,t,r)=>(qr(e,t,"read from private field"),r?r.call(e):t.get(e)),Hr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Wr=(e,t,r,n)=>(qr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Ir=new WeakMap,Fr=new WeakMap;let zr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt;Hr(this,Ir,void 0),Hr(this,Fr,void 0),this.listen=er,this.config(t),Wr(this,Fr,e),this.assets=new Jt(this,Nr(this,Fr)),this.datasets=new lr(this,Nr(this,Fr)),this.projects=new Cr(this,Nr(this,Fr)),this.users=new Rr(this,Nr(this,Fr))}clone(){return new e(Nr(this,Fr),this.config())}config(e){if(void 0===e)return{...Nr(this,Ir)};if(Nr(this,Ir)&&!1===Nr(this,Ir).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Wr(this,Ir,wt(e,Nr(this,Ir)||{})),this}withConfig(t){return new e(Nr(this,Fr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return St(this,Nr(this,Fr),e,t,r)}getDocument(e,t){return _t(this,Nr(this,Fr),e,t)}getDocuments(e,t){return jt(this,Nr(this,Fr),e,t)}create(e,t){return Ft(this,Nr(this,Fr),e,"create",t)}createIfNotExists(e,t){return At(this,Nr(this,Fr),e,t)}createOrReplace(e,t){return kt(this,Nr(this,Fr),e,t)}delete(e,t){return Rt(this,Nr(this,Fr),e,t)}mutate(e,t){return Mt(this,Nr(this,Fr),e,t)}patch(e,t){return new Ke(e,t,this)}transaction(e){return new ct(e,this)}request(e){return Dt(this,Nr(this,Fr),e)}getUrl(e,t){return Nt(this,e,t)}getDataUrl(e,t){return qt(this,e,t)}};Pr=new WeakMap,Dr=new WeakMap;let Ur=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt;Hr(this,Pr,void 0),Hr(this,Dr,void 0),this.listen=er,this.config(t),Wr(this,Dr,e),this.assets=new Xt(this,Nr(this,Dr)),this.datasets=new hr(this,Nr(this,Dr)),this.projects=new Er(this,Nr(this,Dr)),this.users=new Mr(this,Nr(this,Dr)),this.observable=new zr(e,t)}clone(){return new e(Nr(this,Dr),this.config())}config(e){if(void 0===e)return{...Nr(this,Pr)};if(Nr(this,Pr)&&!1===Nr(this,Pr).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),Wr(this,Pr,wt(e,Nr(this,Pr)||{})),this}withConfig(t){return new e(Nr(this,Dr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return xe(St(this,Nr(this,Dr),e,t,r))}getDocument(e,t){return xe(_t(this,Nr(this,Dr),e,t))}getDocuments(e,t){return xe(jt(this,Nr(this,Dr),e,t))}create(e,t){return xe(Ft(this,Nr(this,Dr),e,"create",t))}createIfNotExists(e,t){return xe(At(this,Nr(this,Dr),e,t))}createOrReplace(e,t){return xe(kt(this,Nr(this,Dr),e,t))}delete(e,t){return xe(Rt(this,Nr(this,Dr),e,t))}mutate(e,t){return xe(Mt(this,Nr(this,Dr),e,t))}patch(e,t){return new Ze(e,t,this)}transaction(e){return new at(e,this)}request(e){return xe(Dt(this,Nr(this,Dr),e))}dataRequest(e,t,r){return xe(It(this,Nr(this,Dr),e,t,r))}getUrl(e,t){return Nt(this,e,t)}getDataUrl(e,t){return qt(this,e,t)}};const Lr=function(e,t){return{requester:Ie(e,{}).defaultRequester,createClient:r=>new t(Ie(e,{maxRetries:r.maxRetries,retryDelay:r.retryDelay}),r)}}([],Ur),Br=Lr.requester,$r=Lr.createClient,Gr=function(e){return function(t){return yt(),e(t)}}($r);var Vr={exports:{}};
|
|
9
9
|
/** @license
|
|
10
10
|
* eventsource.js
|
|
11
11
|
* Available under MIT License (MIT)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveEditInfo-AeWgV4US.js","sources":["../../src/csm/studioPath.ts","../../src/csm/jsonPath.ts","../../src/csm/resolveMapping.ts","../../src/csm/isArray.ts","../../src/csm/isRecord.ts","../../src/csm/walkMap.ts","../../src/csm/getPublishedId.ts","../../src/csm/createEditUrl.ts","../../src/csm/resolveEditInfo.ts"],"sourcesContent":["/** @alpha */\nexport type KeyedSegment = {_key: string}\n\n/** @alpha */\nexport type IndexTuple = [number | '', number | '']\n\n/** @alpha */\nexport type PathSegment = string | number | KeyedSegment | IndexTuple\n\n/** @alpha */\nexport type Path = PathSegment[]\n\nconst rePropName =\n /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g\n/** @internal */\nexport const reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/\nconst reIndexTuple = /^\\d*:\\d*$/\n\n/** @internal */\nexport function isIndexSegment(segment: PathSegment): segment is number {\n return typeof segment === 'number' || (typeof segment === 'string' && /^\\[\\d+\\]$/.test(segment))\n}\n\n/** @internal */\nexport function isKeySegment(segment: PathSegment): segment is KeyedSegment {\n if (typeof segment === 'string') {\n return reKeySegment.test(segment.trim())\n }\n\n return typeof segment === 'object' && '_key' in segment\n}\n\n/** @internal */\nexport function isIndexTuple(segment: PathSegment): segment is IndexTuple {\n if (typeof segment === 'string' && reIndexTuple.test(segment)) {\n return true\n }\n\n if (!Array.isArray(segment) || segment.length !== 2) {\n return false\n }\n\n const [from, to] = segment\n return (typeof from === 'number' || from === '') && (typeof to === 'number' || to === '')\n}\n\n/** @internal */\nexport function get<Result = unknown, Fallback = unknown>(\n obj: unknown,\n path: Path | string,\n defaultVal?: Fallback,\n): Result | typeof defaultVal {\n const select = typeof path === 'string' ? fromString(path) : path\n if (!Array.isArray(select)) {\n throw new Error('Path must be an array or a string')\n }\n\n let acc: unknown | undefined = obj\n for (let i = 0; i < select.length; i++) {\n const segment = select[i]\n if (isIndexSegment(segment)) {\n if (!Array.isArray(acc)) {\n return defaultVal\n }\n\n acc = acc[segment]\n }\n\n if (isKeySegment(segment)) {\n if (!Array.isArray(acc)) {\n return defaultVal\n }\n\n acc = acc.find((item) => item._key === segment._key)\n }\n\n if (typeof segment === 'string') {\n acc =\n typeof acc === 'object' && acc !== null\n ? ((acc as Record<string, unknown>)[segment] as Result)\n : undefined\n }\n\n if (typeof acc === 'undefined') {\n return defaultVal\n }\n }\n\n return acc as Result\n}\n\n/** @alpha */\nexport function toString(path: Path): string {\n if (!Array.isArray(path)) {\n throw new Error('Path is not an array')\n }\n\n return path.reduce<string>((target, segment, i) => {\n const segmentType = typeof segment\n if (segmentType === 'number') {\n return `${target}[${segment}]`\n }\n\n if (segmentType === 'string') {\n const separator = i === 0 ? '' : '.'\n return `${target}${separator}${segment}`\n }\n\n if (isKeySegment(segment) && segment._key) {\n return `${target}[_key==\"${segment._key}\"]`\n }\n\n if (Array.isArray(segment)) {\n const [from, to] = segment\n return `${target}[${from}:${to}]`\n }\n\n throw new Error(`Unsupported path segment \\`${JSON.stringify(segment)}\\``)\n }, '')\n}\n\n/** @alpha */\nexport function fromString(path: string): Path {\n if (typeof path !== 'string') {\n throw new Error('Path is not a string')\n }\n\n const segments = path.match(rePropName)\n if (!segments) {\n throw new Error('Invalid path string')\n }\n\n return segments.map(parsePathSegment)\n}\n\nfunction parsePathSegment(segment: string): PathSegment {\n if (isIndexSegment(segment)) {\n return parseIndexSegment(segment)\n }\n\n if (isKeySegment(segment)) {\n return parseKeySegment(segment)\n }\n\n if (isIndexTuple(segment)) {\n return parseIndexTupleSegment(segment)\n }\n\n return segment\n}\n\nfunction parseIndexSegment(segment: string): PathSegment {\n return Number(segment.replace(/[^\\d]/g, ''))\n}\n\nfunction parseKeySegment(segment: string): KeyedSegment {\n const segments = segment.match(reKeySegment)\n return {_key: segments![1]}\n}\n\nfunction parseIndexTupleSegment(segment: string): IndexTuple {\n const [from, to] = segment.split(':').map((seg) => (seg === '' ? seg : Number(seg)))\n return [from, to]\n}\n","import * as studioPath from './studioPath'\nimport type {\n ContentSourceMapParsedPath,\n ContentSourceMapParsedPathKeyedSegment,\n ContentSourceMapPaths,\n Path,\n} from './types'\n\nconst ESCAPE: Record<string, string> = {\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',\n \"'\": \"\\\\'\",\n '\\\\': '\\\\\\\\',\n}\n\nconst UNESCAPE: Record<string, string> = {\n '\\\\f': '\\f',\n '\\\\n': '\\n',\n '\\\\r': '\\r',\n '\\\\t': '\\t',\n \"\\\\'\": \"'\",\n '\\\\\\\\': '\\\\',\n}\n\n/**\n * @internal\n */\nexport function jsonPath(path: ContentSourceMapParsedPath): ContentSourceMapPaths[number] {\n return `$${path\n .map((segment) => {\n if (typeof segment === 'string') {\n const escapedKey = segment.replace(/[\\f\\n\\r\\t'\\\\]/g, (match) => {\n return ESCAPE[match]\n })\n return `['${escapedKey}']`\n }\n\n if (typeof segment === 'number') {\n return `[${segment}]`\n }\n\n if (segment._key !== '') {\n const escapedKey = segment._key.replace(/['\\\\]/g, (match) => {\n return ESCAPE[match]\n })\n return `[?(@._key=='${escapedKey}')]`\n }\n\n return `[${segment._index}]`\n })\n .join('')}`\n}\n\n/**\n * @internal\n */\nexport function parseJsonPath(path: ContentSourceMapPaths[number]): ContentSourceMapParsedPath {\n const parsed: ContentSourceMapParsedPath = []\n\n const parseRe = /\\['(.*?)'\\]|\\[(\\d+)\\]|\\[\\?\\(@\\._key=='(.*?)'\\)\\]/g\n let match: RegExpExecArray | null\n\n while ((match = parseRe.exec(path)) !== null) {\n if (match[1] !== undefined) {\n const key = match[1].replace(/\\\\(\\\\|f|n|r|t|')/g, (m) => {\n return UNESCAPE[m]\n })\n\n parsed.push(key)\n continue\n }\n\n if (match[2] !== undefined) {\n parsed.push(parseInt(match[2], 10))\n continue\n }\n\n if (match[3] !== undefined) {\n const _key = match[3].replace(/\\\\(\\\\')/g, (m) => {\n return UNESCAPE[m]\n })\n\n parsed.push({\n _key,\n _index: -1,\n })\n continue\n }\n }\n\n return parsed\n}\n\n/**\n * @internal\n */\nexport function jsonPathToStudioPath(path: ContentSourceMapParsedPath): Path {\n return path.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (segment._key !== '') {\n return {_key: segment._key}\n }\n\n if (segment._index !== -1) {\n return segment._index\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n\n/**\n * @internal\n */\nexport function studioPathToJsonPath(path: Path | string): ContentSourceMapParsedPath {\n const parsedPath = typeof path === 'string' ? studioPath.fromString(path) : path\n\n return parsedPath.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (Array.isArray(segment)) {\n throw new Error(`IndexTuple segments aren't supported:${JSON.stringify(segment)}`)\n }\n\n if (isContentSourceMapParsedPathKeyedSegment(segment)) {\n return segment\n }\n\n if (segment._key) {\n return {_key: segment._key, _index: -1}\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n\nfunction isContentSourceMapParsedPathKeyedSegment(\n segment: studioPath.PathSegment | ContentSourceMapParsedPath[number],\n): segment is ContentSourceMapParsedPathKeyedSegment {\n return typeof segment === 'object' && '_key' in segment && '_index' in segment\n}\n\n/**\n * @internal\n */\nexport function jsonPathToMappingPath(path: ContentSourceMapParsedPath): (string | number)[] {\n return path.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (segment._index !== -1) {\n return segment._index\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n","import {jsonPath, jsonPathToMappingPath} from './jsonPath'\nimport type {ContentSourceMap, ContentSourceMapMapping, ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolveMapping(\n resultPath: ContentSourceMapParsedPath,\n csm?: ContentSourceMap,\n):\n | {\n mapping: ContentSourceMapMapping\n matchedPath: string\n pathSuffix: string\n }\n | undefined {\n if (!csm?.mappings) {\n return undefined\n }\n const resultMappingPath = jsonPath(jsonPathToMappingPath(resultPath))\n\n if (csm.mappings[resultMappingPath] !== undefined) {\n return {\n mapping: csm.mappings[resultMappingPath],\n matchedPath: resultMappingPath,\n pathSuffix: '',\n }\n }\n\n const mappings = Object.entries(csm.mappings)\n .filter(([key]) => resultMappingPath.startsWith(key))\n .sort(([key1], [key2]) => key2.length - key1.length)\n\n if (mappings.length == 0) {\n return undefined\n }\n\n const [matchedPath, mapping] = mappings[0]\n const pathSuffix = resultMappingPath.substring(matchedPath.length)\n return {mapping, matchedPath, pathSuffix}\n}\n","/** @internal */\nexport function isArray(value: unknown): value is Array<unknown> {\n return value !== null && Array.isArray(value)\n}\n","/** @internal */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n","import {isArray} from './isArray'\nimport {isRecord} from './isRecord'\nimport type {ContentSourceMapParsedPath, WalkMapFn} from './types'\n\n/**\n * generic way to walk a nested object or array and apply a mapping function to each value\n * @internal\n */\nexport function walkMap(\n value: unknown,\n mappingFn: WalkMapFn,\n path: ContentSourceMapParsedPath = [],\n): unknown {\n if (isArray(value)) {\n return value.map((v, idx) => {\n if (isRecord(v)) {\n const _key = v['_key']\n if (typeof _key === 'string') {\n return walkMap(v, mappingFn, path.concat({_key, _index: idx}))\n }\n }\n\n return walkMap(v, mappingFn, path.concat(idx))\n })\n }\n\n if (isRecord(value)) {\n return Object.fromEntries(\n Object.entries(value).map(([k, v]) => [k, walkMap(v, mappingFn, path.concat(k))]),\n )\n }\n\n return mappingFn(value, path)\n}\n","const DRAFTS_PREFIX = 'drafts.'\n\n/** @internal */\nexport function getPublishedId(id: string): string {\n if (id.startsWith(DRAFTS_PREFIX)) {\n return id.slice(DRAFTS_PREFIX.length)\n }\n\n return id\n}\n","import {getPublishedId} from './getPublishedId'\nimport {jsonPathToStudioPath} from './jsonPath'\nimport * as studioPath from './studioPath'\nimport type {CreateEditUrlOptions, EditIntentUrl, StudioBaseUrl} from './types'\n\n/** @internal */\nexport function createEditUrl(options: CreateEditUrlOptions): `${StudioBaseUrl}${EditIntentUrl}` {\n const {\n baseUrl,\n workspace: _workspace = 'default',\n tool: _tool = 'default',\n id: _id,\n type,\n path,\n } = options\n\n if (!baseUrl) {\n throw new Error('baseUrl is required')\n }\n if (!path) {\n throw new Error('path is required')\n }\n if (!_id) {\n throw new Error('id is required')\n }\n if (baseUrl !== '/' && baseUrl.endsWith('/')) {\n throw new Error('baseUrl must not end with a slash')\n }\n\n const workspace = _workspace === 'default' ? undefined : _workspace\n const tool = _tool === 'default' ? undefined : _tool\n // eslint-disable-next-line no-warning-comments\n // @TODO allow passing draft prefixed IDs, to better open the right perspective mode\n const id = getPublishedId(_id)\n const stringifiedPath = Array.isArray(path)\n ? studioPath.toString(jsonPathToStudioPath(path))\n : path\n\n // eslint-disable-next-line no-warning-comments\n // @TODO Using searchParams as a temporary workaround until `@sanity/overlays` can decode state from the path reliably\n const searchParams = new URLSearchParams({\n baseUrl,\n id,\n type,\n path: stringifiedPath,\n })\n if (workspace) {\n searchParams.set('workspace', workspace)\n }\n if (tool) {\n searchParams.set('tool', tool)\n }\n\n const segments = [baseUrl === '/' ? '' : baseUrl]\n if (workspace) {\n segments.push(workspace)\n }\n const routerParams = [\n 'mode=presentation',\n `id=${id}`,\n `type=${type}`,\n `path=${encodeURIComponent(stringifiedPath)}`,\n ]\n if (tool) {\n routerParams.push(`tool=${tool}`)\n }\n segments.push('intent', 'edit', `${routerParams.join(';')}?${searchParams}`)\n return segments.join('/') as unknown as `${StudioBaseUrl}${EditIntentUrl}`\n}\n","import {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport type {\n CreateEditUrlOptions,\n ResolveEditInfoOptions,\n StudioBaseRoute,\n StudioBaseUrl,\n StudioUrl,\n} from './types'\n\n/** @internal */\nexport function resolveEditInfo(options: ResolveEditInfoOptions): CreateEditUrlOptions | undefined {\n const {resultSourceMap: csm, resultPath} = options\n const {mapping, pathSuffix} = resolveMapping(resultPath, csm) || {}\n\n if (!mapping) {\n // console.warn('no mapping for path', { path: resultPath, sourceMap: csm })\n return undefined\n }\n\n if (mapping.source.type === 'literal') {\n return undefined\n }\n\n if (mapping.source.type === 'unknown') {\n return undefined\n }\n\n const sourceDoc = csm.documents[mapping.source.document]\n const sourcePath = csm.paths[mapping.source.path]\n\n if (sourceDoc && sourcePath) {\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof options.studioUrl === 'function' ? options.studioUrl(sourceDoc) : options.studioUrl,\n )\n if (!baseUrl) return undefined\n const {_id, _type} = sourceDoc\n return {\n baseUrl,\n workspace,\n tool,\n id: _id,\n type: _type,\n path: parseJsonPath(sourcePath + pathSuffix),\n } satisfies CreateEditUrlOptions\n }\n\n return undefined\n}\n\n/** @internal */\nexport function resolveStudioBaseRoute(studioUrl: StudioUrl): StudioBaseRoute {\n let baseUrl: StudioBaseUrl = typeof studioUrl === 'string' ? studioUrl : studioUrl.baseUrl\n if (baseUrl !== '/') {\n baseUrl = baseUrl.replace(/\\/$/, '')\n }\n if (typeof studioUrl === 'string') {\n return {baseUrl}\n }\n return {...studioUrl, baseUrl}\n}\n"],"names":["rePropName","reKeySegment","reIndexTuple","isIndexSegment","segment","test","isKeySegment","trim","isIndexTuple","Array","isArray","length","from","to","get","obj","path","defaultVal","select","fromString","Error","acc","i","find","item","_key","toString","reduce","target","segmentType","concat","separator","stringify","segments","match","map","parsePathSegment","parseIndexSegment","parseKeySegment","parseIndexTupleSegment","Number","replace","split","seg","ESCAPE","UNESCAPE","jsonPath","escapedKey","_index","join","parseJsonPath","parsed","parseRe","exec","key","m","push","parseInt","jsonPathToStudioPath","JSON","studioPathToJsonPath","parsedPath","studioPath.fromString","isContentSourceMapParsedPathKeyedSegment","jsonPathToMappingPath","resolveMapping","resultPath","csm","mappings","resultMappingPath","mapping","matchedPath","pathSuffix","Object","entries","filter","_ref","startsWith","sort","_ref2","_ref3","key1","key2","substring","value","isRecord","walkMap","mappingFn","arguments","undefined","v","idx","fromEntries","_ref4","k","DRAFTS_PREFIX","getPublishedId","id","slice","createEditUrl","options","baseUrl","workspace","_workspace","tool","_tool","_id","type","endsWith","stringifiedPath","studioPath.toString","searchParams","URLSearchParams","set","routerParams","resolveEditInfo","resultSourceMap","source","sourceDoc","documents","document","sourcePath","paths","resolveStudioBaseRoute","studioUrl","_type"],"mappings":"AAYA,MAAMA,UACJ,GAAA,kGAAA;AAEK,MAAMC,YAAe,GAAA,0BAAA;AAC5B,MAAMC,YAAe,GAAA,WAAA;AAGd,SAASC,eAAeC,OAAyC,EAAA;EAC/D,OAAA,OAAOA,YAAY,QAAa,IAAA,OAAOA,YAAY,QAAY,IAAA,WAAA,CAAYC,KAAKD,OAAO,CAAA;AAChG;AAGO,SAASE,aAAaF,OAA+C,EAAA;EACtE,IAAA,OAAOA,YAAY,QAAU,EAAA;IAC/B,OAAOH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A;MAACK,GAAK;MAAAmB;IAAS,CAAA,GAAAP,SAAA;IACd,OAAA;MACLjB,OAAA;MACAC,SAAA;MACAE,IAAA;MACAP,EAAI,EAAAS,GAAA;MACJC,IAAM,EAAAkB,KAAA;MACN7G,IAAA,EAAMkC,aAAc,CAAAuE,UAAA,GAAajD,UAAU;IAAA,CAC7C;EACF;EAEO,OAAA,KAAA,CAAA;AACT;AAGO,SAASmD,uBAAuBC,SAAuC,EAAA;EAC5E,IAAIvB,OAAyB,GAAA,OAAOuB,SAAc,KAAA,QAAA,GAAWA,YAAYA,SAAU,CAAAvB,OAAA;EACnF,IAAIA,YAAY,GAAK,EAAA;IACTA,OAAA,GAAAA,OAAA,CAAQ5D,OAAQ,CAAA,KAAA,EAAO,EAAE,CAAA;EACrC;EACI,IAAA,OAAOmF,cAAc,QAAU,EAAA;IACjC,OAAO;MAACvB;IAAO,CAAA;EACjB;EACO,OAAA;IAAC,GAAGuB,SAAA;IAAWvB;GAAO;AAC/B;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveEditInfo-v_7g85GR.cjs","sources":["../../src/csm/studioPath.ts","../../src/csm/jsonPath.ts","../../src/csm/resolveMapping.ts","../../src/csm/isArray.ts","../../src/csm/isRecord.ts","../../src/csm/walkMap.ts","../../src/csm/getPublishedId.ts","../../src/csm/createEditUrl.ts","../../src/csm/resolveEditInfo.ts"],"sourcesContent":["/** @alpha */\nexport type KeyedSegment = {_key: string}\n\n/** @alpha */\nexport type IndexTuple = [number | '', number | '']\n\n/** @alpha */\nexport type PathSegment = string | number | KeyedSegment | IndexTuple\n\n/** @alpha */\nexport type Path = PathSegment[]\n\nconst rePropName =\n /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g\n/** @internal */\nexport const reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/\nconst reIndexTuple = /^\\d*:\\d*$/\n\n/** @internal */\nexport function isIndexSegment(segment: PathSegment): segment is number {\n return typeof segment === 'number' || (typeof segment === 'string' && /^\\[\\d+\\]$/.test(segment))\n}\n\n/** @internal */\nexport function isKeySegment(segment: PathSegment): segment is KeyedSegment {\n if (typeof segment === 'string') {\n return reKeySegment.test(segment.trim())\n }\n\n return typeof segment === 'object' && '_key' in segment\n}\n\n/** @internal */\nexport function isIndexTuple(segment: PathSegment): segment is IndexTuple {\n if (typeof segment === 'string' && reIndexTuple.test(segment)) {\n return true\n }\n\n if (!Array.isArray(segment) || segment.length !== 2) {\n return false\n }\n\n const [from, to] = segment\n return (typeof from === 'number' || from === '') && (typeof to === 'number' || to === '')\n}\n\n/** @internal */\nexport function get<Result = unknown, Fallback = unknown>(\n obj: unknown,\n path: Path | string,\n defaultVal?: Fallback,\n): Result | typeof defaultVal {\n const select = typeof path === 'string' ? fromString(path) : path\n if (!Array.isArray(select)) {\n throw new Error('Path must be an array or a string')\n }\n\n let acc: unknown | undefined = obj\n for (let i = 0; i < select.length; i++) {\n const segment = select[i]\n if (isIndexSegment(segment)) {\n if (!Array.isArray(acc)) {\n return defaultVal\n }\n\n acc = acc[segment]\n }\n\n if (isKeySegment(segment)) {\n if (!Array.isArray(acc)) {\n return defaultVal\n }\n\n acc = acc.find((item) => item._key === segment._key)\n }\n\n if (typeof segment === 'string') {\n acc =\n typeof acc === 'object' && acc !== null\n ? ((acc as Record<string, unknown>)[segment] as Result)\n : undefined\n }\n\n if (typeof acc === 'undefined') {\n return defaultVal\n }\n }\n\n return acc as Result\n}\n\n/** @alpha */\nexport function toString(path: Path): string {\n if (!Array.isArray(path)) {\n throw new Error('Path is not an array')\n }\n\n return path.reduce<string>((target, segment, i) => {\n const segmentType = typeof segment\n if (segmentType === 'number') {\n return `${target}[${segment}]`\n }\n\n if (segmentType === 'string') {\n const separator = i === 0 ? '' : '.'\n return `${target}${separator}${segment}`\n }\n\n if (isKeySegment(segment) && segment._key) {\n return `${target}[_key==\"${segment._key}\"]`\n }\n\n if (Array.isArray(segment)) {\n const [from, to] = segment\n return `${target}[${from}:${to}]`\n }\n\n throw new Error(`Unsupported path segment \\`${JSON.stringify(segment)}\\``)\n }, '')\n}\n\n/** @alpha */\nexport function fromString(path: string): Path {\n if (typeof path !== 'string') {\n throw new Error('Path is not a string')\n }\n\n const segments = path.match(rePropName)\n if (!segments) {\n throw new Error('Invalid path string')\n }\n\n return segments.map(parsePathSegment)\n}\n\nfunction parsePathSegment(segment: string): PathSegment {\n if (isIndexSegment(segment)) {\n return parseIndexSegment(segment)\n }\n\n if (isKeySegment(segment)) {\n return parseKeySegment(segment)\n }\n\n if (isIndexTuple(segment)) {\n return parseIndexTupleSegment(segment)\n }\n\n return segment\n}\n\nfunction parseIndexSegment(segment: string): PathSegment {\n return Number(segment.replace(/[^\\d]/g, ''))\n}\n\nfunction parseKeySegment(segment: string): KeyedSegment {\n const segments = segment.match(reKeySegment)\n return {_key: segments![1]}\n}\n\nfunction parseIndexTupleSegment(segment: string): IndexTuple {\n const [from, to] = segment.split(':').map((seg) => (seg === '' ? seg : Number(seg)))\n return [from, to]\n}\n","import * as studioPath from './studioPath'\nimport type {\n ContentSourceMapParsedPath,\n ContentSourceMapParsedPathKeyedSegment,\n ContentSourceMapPaths,\n Path,\n} from './types'\n\nconst ESCAPE: Record<string, string> = {\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',\n \"'\": \"\\\\'\",\n '\\\\': '\\\\\\\\',\n}\n\nconst UNESCAPE: Record<string, string> = {\n '\\\\f': '\\f',\n '\\\\n': '\\n',\n '\\\\r': '\\r',\n '\\\\t': '\\t',\n \"\\\\'\": \"'\",\n '\\\\\\\\': '\\\\',\n}\n\n/**\n * @internal\n */\nexport function jsonPath(path: ContentSourceMapParsedPath): ContentSourceMapPaths[number] {\n return `$${path\n .map((segment) => {\n if (typeof segment === 'string') {\n const escapedKey = segment.replace(/[\\f\\n\\r\\t'\\\\]/g, (match) => {\n return ESCAPE[match]\n })\n return `['${escapedKey}']`\n }\n\n if (typeof segment === 'number') {\n return `[${segment}]`\n }\n\n if (segment._key !== '') {\n const escapedKey = segment._key.replace(/['\\\\]/g, (match) => {\n return ESCAPE[match]\n })\n return `[?(@._key=='${escapedKey}')]`\n }\n\n return `[${segment._index}]`\n })\n .join('')}`\n}\n\n/**\n * @internal\n */\nexport function parseJsonPath(path: ContentSourceMapPaths[number]): ContentSourceMapParsedPath {\n const parsed: ContentSourceMapParsedPath = []\n\n const parseRe = /\\['(.*?)'\\]|\\[(\\d+)\\]|\\[\\?\\(@\\._key=='(.*?)'\\)\\]/g\n let match: RegExpExecArray | null\n\n while ((match = parseRe.exec(path)) !== null) {\n if (match[1] !== undefined) {\n const key = match[1].replace(/\\\\(\\\\|f|n|r|t|')/g, (m) => {\n return UNESCAPE[m]\n })\n\n parsed.push(key)\n continue\n }\n\n if (match[2] !== undefined) {\n parsed.push(parseInt(match[2], 10))\n continue\n }\n\n if (match[3] !== undefined) {\n const _key = match[3].replace(/\\\\(\\\\')/g, (m) => {\n return UNESCAPE[m]\n })\n\n parsed.push({\n _key,\n _index: -1,\n })\n continue\n }\n }\n\n return parsed\n}\n\n/**\n * @internal\n */\nexport function jsonPathToStudioPath(path: ContentSourceMapParsedPath): Path {\n return path.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (segment._key !== '') {\n return {_key: segment._key}\n }\n\n if (segment._index !== -1) {\n return segment._index\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n\n/**\n * @internal\n */\nexport function studioPathToJsonPath(path: Path | string): ContentSourceMapParsedPath {\n const parsedPath = typeof path === 'string' ? studioPath.fromString(path) : path\n\n return parsedPath.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (Array.isArray(segment)) {\n throw new Error(`IndexTuple segments aren't supported:${JSON.stringify(segment)}`)\n }\n\n if (isContentSourceMapParsedPathKeyedSegment(segment)) {\n return segment\n }\n\n if (segment._key) {\n return {_key: segment._key, _index: -1}\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n\nfunction isContentSourceMapParsedPathKeyedSegment(\n segment: studioPath.PathSegment | ContentSourceMapParsedPath[number],\n): segment is ContentSourceMapParsedPathKeyedSegment {\n return typeof segment === 'object' && '_key' in segment && '_index' in segment\n}\n\n/**\n * @internal\n */\nexport function jsonPathToMappingPath(path: ContentSourceMapParsedPath): (string | number)[] {\n return path.map((segment) => {\n if (typeof segment === 'string') {\n return segment\n }\n\n if (typeof segment === 'number') {\n return segment\n }\n\n if (segment._index !== -1) {\n return segment._index\n }\n\n throw new Error(`invalid segment:${JSON.stringify(segment)}`)\n })\n}\n","import {jsonPath, jsonPathToMappingPath} from './jsonPath'\nimport type {ContentSourceMap, ContentSourceMapMapping, ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolveMapping(\n resultPath: ContentSourceMapParsedPath,\n csm?: ContentSourceMap,\n):\n | {\n mapping: ContentSourceMapMapping\n matchedPath: string\n pathSuffix: string\n }\n | undefined {\n if (!csm?.mappings) {\n return undefined\n }\n const resultMappingPath = jsonPath(jsonPathToMappingPath(resultPath))\n\n if (csm.mappings[resultMappingPath] !== undefined) {\n return {\n mapping: csm.mappings[resultMappingPath],\n matchedPath: resultMappingPath,\n pathSuffix: '',\n }\n }\n\n const mappings = Object.entries(csm.mappings)\n .filter(([key]) => resultMappingPath.startsWith(key))\n .sort(([key1], [key2]) => key2.length - key1.length)\n\n if (mappings.length == 0) {\n return undefined\n }\n\n const [matchedPath, mapping] = mappings[0]\n const pathSuffix = resultMappingPath.substring(matchedPath.length)\n return {mapping, matchedPath, pathSuffix}\n}\n","/** @internal */\nexport function isArray(value: unknown): value is Array<unknown> {\n return value !== null && Array.isArray(value)\n}\n","/** @internal */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n","import {isArray} from './isArray'\nimport {isRecord} from './isRecord'\nimport type {ContentSourceMapParsedPath, WalkMapFn} from './types'\n\n/**\n * generic way to walk a nested object or array and apply a mapping function to each value\n * @internal\n */\nexport function walkMap(\n value: unknown,\n mappingFn: WalkMapFn,\n path: ContentSourceMapParsedPath = [],\n): unknown {\n if (isArray(value)) {\n return value.map((v, idx) => {\n if (isRecord(v)) {\n const _key = v['_key']\n if (typeof _key === 'string') {\n return walkMap(v, mappingFn, path.concat({_key, _index: idx}))\n }\n }\n\n return walkMap(v, mappingFn, path.concat(idx))\n })\n }\n\n if (isRecord(value)) {\n return Object.fromEntries(\n Object.entries(value).map(([k, v]) => [k, walkMap(v, mappingFn, path.concat(k))]),\n )\n }\n\n return mappingFn(value, path)\n}\n","const DRAFTS_PREFIX = 'drafts.'\n\n/** @internal */\nexport function getPublishedId(id: string): string {\n if (id.startsWith(DRAFTS_PREFIX)) {\n return id.slice(DRAFTS_PREFIX.length)\n }\n\n return id\n}\n","import {getPublishedId} from './getPublishedId'\nimport {jsonPathToStudioPath} from './jsonPath'\nimport * as studioPath from './studioPath'\nimport type {CreateEditUrlOptions, EditIntentUrl, StudioBaseUrl} from './types'\n\n/** @internal */\nexport function createEditUrl(options: CreateEditUrlOptions): `${StudioBaseUrl}${EditIntentUrl}` {\n const {\n baseUrl,\n workspace: _workspace = 'default',\n tool: _tool = 'default',\n id: _id,\n type,\n path,\n } = options\n\n if (!baseUrl) {\n throw new Error('baseUrl is required')\n }\n if (!path) {\n throw new Error('path is required')\n }\n if (!_id) {\n throw new Error('id is required')\n }\n if (baseUrl !== '/' && baseUrl.endsWith('/')) {\n throw new Error('baseUrl must not end with a slash')\n }\n\n const workspace = _workspace === 'default' ? undefined : _workspace\n const tool = _tool === 'default' ? undefined : _tool\n // eslint-disable-next-line no-warning-comments\n // @TODO allow passing draft prefixed IDs, to better open the right perspective mode\n const id = getPublishedId(_id)\n const stringifiedPath = Array.isArray(path)\n ? studioPath.toString(jsonPathToStudioPath(path))\n : path\n\n // eslint-disable-next-line no-warning-comments\n // @TODO Using searchParams as a temporary workaround until `@sanity/overlays` can decode state from the path reliably\n const searchParams = new URLSearchParams({\n baseUrl,\n id,\n type,\n path: stringifiedPath,\n })\n if (workspace) {\n searchParams.set('workspace', workspace)\n }\n if (tool) {\n searchParams.set('tool', tool)\n }\n\n const segments = [baseUrl === '/' ? '' : baseUrl]\n if (workspace) {\n segments.push(workspace)\n }\n const routerParams = [\n 'mode=presentation',\n `id=${id}`,\n `type=${type}`,\n `path=${encodeURIComponent(stringifiedPath)}`,\n ]\n if (tool) {\n routerParams.push(`tool=${tool}`)\n }\n segments.push('intent', 'edit', `${routerParams.join(';')}?${searchParams}`)\n return segments.join('/') as unknown as `${StudioBaseUrl}${EditIntentUrl}`\n}\n","import {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport type {\n CreateEditUrlOptions,\n ResolveEditInfoOptions,\n StudioBaseRoute,\n StudioBaseUrl,\n StudioUrl,\n} from './types'\n\n/** @internal */\nexport function resolveEditInfo(options: ResolveEditInfoOptions): CreateEditUrlOptions | undefined {\n const {resultSourceMap: csm, resultPath} = options\n const {mapping, pathSuffix} = resolveMapping(resultPath, csm) || {}\n\n if (!mapping) {\n // console.warn('no mapping for path', { path: resultPath, sourceMap: csm })\n return undefined\n }\n\n if (mapping.source.type === 'literal') {\n return undefined\n }\n\n if (mapping.source.type === 'unknown') {\n return undefined\n }\n\n const sourceDoc = csm.documents[mapping.source.document]\n const sourcePath = csm.paths[mapping.source.path]\n\n if (sourceDoc && sourcePath) {\n const {baseUrl, workspace, tool} = resolveStudioBaseRoute(\n typeof options.studioUrl === 'function' ? options.studioUrl(sourceDoc) : options.studioUrl,\n )\n if (!baseUrl) return undefined\n const {_id, _type} = sourceDoc\n return {\n baseUrl,\n workspace,\n tool,\n id: _id,\n type: _type,\n path: parseJsonPath(sourcePath + pathSuffix),\n } satisfies CreateEditUrlOptions\n }\n\n return undefined\n}\n\n/** @internal */\nexport function resolveStudioBaseRoute(studioUrl: StudioUrl): StudioBaseRoute {\n let baseUrl: StudioBaseUrl = typeof studioUrl === 'string' ? studioUrl : studioUrl.baseUrl\n if (baseUrl !== '/') {\n baseUrl = baseUrl.replace(/\\/$/, '')\n }\n if (typeof studioUrl === 'string') {\n return {baseUrl}\n }\n return {...studioUrl, baseUrl}\n}\n"],"names":["rePropName","reKeySegment","reIndexTuple","isIndexSegment","segment","test","isKeySegment","trim","isIndexTuple","Array","isArray","length","from","to","get","obj","path","defaultVal","select","fromString","Error","acc","i","find","item","_key","toString","reduce","target","segmentType","concat","separator","stringify","segments","match","map","parsePathSegment","parseIndexSegment","parseKeySegment","parseIndexTupleSegment","Number","replace","split","seg","ESCAPE","UNESCAPE","jsonPath","escapedKey","_index","join","parseJsonPath","parsed","parseRe","exec","key","m","push","parseInt","jsonPathToStudioPath","JSON","studioPathToJsonPath","parsedPath","studioPath.fromString","isContentSourceMapParsedPathKeyedSegment","jsonPathToMappingPath","resolveMapping","resultPath","csm","mappings","resultMappingPath","mapping","matchedPath","pathSuffix","Object","entries","filter","_ref","startsWith","sort","_ref2","_ref3","key1","key2","substring","value","isRecord","walkMap","mappingFn","arguments","undefined","v","idx","fromEntries","_ref4","k","DRAFTS_PREFIX","getPublishedId","id","slice","createEditUrl","options","baseUrl","workspace","_workspace","tool","_tool","_id","type","endsWith","stringifiedPath","studioPath.toString","searchParams","URLSearchParams","set","routerParams","resolveEditInfo","resultSourceMap","source","sourceDoc","documents","document","sourcePath","paths","resolveStudioBaseRoute","studioUrl","_type"],"mappings":";;AAYA,MAAMA,UACJ,GAAA,kGAAA;AAEK,MAAMC,YAAe,GAAA,0BAAA;AAC5B,MAAMC,YAAe,GAAA,WAAA;AAGd,SAASC,eAAeC,OAAyC,EAAA;EAC/D,OAAA,OAAOA,YAAY,QAAa,IAAA,OAAOA,YAAY,QAAY,IAAA,WAAA,CAAYC,K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