PageSourceSearch

https://bfl.ai/_next/static/chunks/47998-6ba455e5a584e544.js?dpl=dpl_ERrSGK6M8RkzXTqf8jLCYykJD4tZ

js bfl.ai collected 2026-10-02 02:12:08 UTC 161,946 bytes, 16 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[47998],{1759:(e,t,r)=>{r.d(t,{U:()=>n});var n={now:function(){return(n.delegate||Date).now()},delegate:void 0}},1967:(e,t,r)=>{r.d(t,{Q6:()=>eZ,MZ:()=>ey,u_:()=>e_,gP:()=>eg,UU:()=>rt,x_:()=>eG});let n=!(typeof navigator>"u")&&"ReactNative"===navigator.product,s={timeout:n?6e4:12e4},i=function(e){let t={...s,..."string"==typeof e?{url:e}:e};if(t.timeout=function e(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;let r=Number(t);return isNaN(r)?e(s.timeout):{connect:r,socket:r}}(t.timeout),t.query){let{url:e,searchParams:r}=function(e){let t=e.indexOf("?");if(-1===t)return{url:e,searchParams:new URLSearchParams};let r=e.slice(0,t),s=e.slice(t+1);if(!n)return{url:r,searchParams:new URLSearchParams(s)};if("function"!=typeof decodeURIComponent)throw Error("Broken `URLSearchParams` implementation, and `decodeURIComponent` is not defined");let i=new URLSearchParams;for(let e of s.split("&")){let[t,r]=e.split("=");t&&i.append(o(t),o(r||""))}return{url:r,searchParams:i}}(t.url);for(let[n,s]of Object.entries(t.query)){if(void 0!==s)if(Array.isArray(s))for(let e of s)r.append(n,e);else r.append(n,s);let i=r.toString();i&&(t.url=`${e}?${i}`)}}return t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t};function o(e){return decodeURIComponent(e.replace(/\+/g," "))}let a=/^https?:\/\//i,u=function(e){if(!a.test(e.url))throw Error(`"${e.url}" is not a valid URL`)},c=["request","response","progress","error","abort"],l=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];var d,h,p=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(function(){if(h)return d;h=1;var e=function(e){return e.replace(/^\s+|\s+$/g,"")};return d=function(t){if(!t)return{};for(var r=Object.create(null),n=e(t).split("\n"),s=0;s<n.length;s++){var i,o=n[s],a=o.indexOf(":"),u=e(o.slice(0,a)).toLowerCase(),c=e(o.slice(a+1));typeof r[u]>"u"?r[u]=c:(i=r[u],"[object Array]"===Object.prototype.toString.call(i))?r[u].push(c):r[u]=[r[u],c]}return r}}());class f{onabort;onerror;onreadystatechange;ontimeout;readyState=0;response;responseText="";responseType="";status;statusText;withCredentials;#e;#t;#r;#n={};#s;#i={};#o;open(e,t,r){this.#e=e,this.#t=t,this.#r="",this.readyState=1,this.onreadystatechange?.(),this.#s=void 0}abort(){this.#s&&this.#s.abort()}getAllResponseHeaders(){return this.#r}setRequestHeader(e,t){this.#n[e]=t}setInit(e,t=!0){this.#i=e,this.#o=t}send(e){let t="arraybuffer"!==this.responseType,r={...this.#i,method:this.#e,headers:this.#n,body:e};"function"==typeof AbortController&&this.#o&&(this.#s=new AbortController,"u">typeof EventTarget&&this.#s.signal instanceof EventTarget&&(r.signal=this.#s.signal)),"u">typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(this.#t,r).then(e=>(e.headers.forEach((e,t)=>{this.#r+=`${t}: ${e}\r
2`}),this.status=e.status,this.statusText=e.statusText,this.readyState=3,this.onreadystatechange?.(),t?e.text():e.arrayBuffer())).then(e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange?.()}).catch(e=>{"AbortError"!==e.name?this.onerror?.(e):this.onabort?.()})}}let y="function"==typeof XMLHttpRequest?"xhr":"fetch",g="xhr"===y?XMLHttpRequest:f,v=(e,t)=>{let r=e.options,n=e.applyMiddleware("finalizeOptions",r),s={},i=e.applyMiddleware("interceptRequest",void 0,{adapter:y,context:e});if(i){let e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let o=new g;o instanceof f&&"object"==typeof n.fetch&&o.setInit(n.fetch,n.useAbortSignal??!0);let a=n.headers,u=n.timeout,c=!1,l=!1,d=!1;if(o.onerror=e=>{m(o instanceof f?e instanceof Error?e:Error(`Request error while attempting to reach is ${n.url}`,{cause:e}):Error(`Request error while attempting to reach is ${n.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},o.ontimeout=e=>{m(Error(`Request timeout while attempting to reach ${n.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},o.onabort=()=>
2{v(!0),c=!0},o.onreadystatechange=function(){u&&(v(),s.socket=setTimeout(()=>h("ESOCKETTIMEDOUT"),u.socket)),!c&&o&&4===o.readyState&&0!==o.status&&function(){if(!(c||l||d)){if(0===o.status)return m(Error("Unknown XHR error"));v(),l=!0,t(null,{body:o.response||(""===o.responseType||"text"===o.responseType?o.responseText:""),url:n.url,method:n.method,headers:p(o.getAllResponseHeaders()),statusCode:o.status,statusMessage:o.statusText})}}()},o.open(n.method,n.url,!0),o.withCredentials=!!n.withCredentials,a&&o.setRequestHeader)for(let e in a)a.hasOwnProperty(e)&&o.setRequestHeader(e,a[e]);return n.rawBody&&(o.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:y,request:o,context:e}),o.send(n.body||null),u&&(s.connect=setTimeout(()=>h("ETIMEDOUT"),u.connect)),{abort:function(){c=!0,o&&o.abort()}};function h(t){d=!0,o.abort();let r=Error("ESOCKETTIMEDOUT"===t?`Socket timed out on request to ${n.url}`:`Connection timed out on request to ${n.url}`);r.code=t,e.channels.error.publish(r)}function v(e){(e||c||o&&o.readyState>=2&&s.connect)&&clearTimeout(s.connect),s.socket&&clearTimeout(s.socket)}function m(e){if(l)return;v(!0),l=!0,o=null;let r=e||Error(`Network error while attempting to reach ${n.url}`);r.isNetworkError=!0,r.request=n,t(r)}};var m,b,w,_,x,E=r(37811),S=r(98178).hp,T={exports:{}};x||(x=1,function(e,t){let r;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;let r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(s=n))}),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch{}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!e&&"u">typeof E&&"env"in E&&(e=E.env.DEBUG),e},t.useColors=function(){let e;return"u">typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"u">typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch{}}(),r=!1,t.destroy=()=>{r||(r=!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=(_?w:(_=1,w=function(e){function t(e){let n,s,i,o=null;function a(...e){if(!a.enabled)return;let r=Number(new Date);a.diff=r-(n||r),a.prev=n,a.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,n)=>{if("%%"===r)return"%";s++;let i=t.formatters[n];if("function"==typeof i){let t=e[s];r=i.call(a,t),e.splice(s,1),s--}return r}),t.formatArgs.call(a,e),(a.log||t.log).apply(a,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set
2:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){let n=t(this.namespace+(typeof r>"u"?":":r)+e);return n.log=this.log,n}function n(e,t){let r=0,n=0,s=-1,i=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(s=n,i=r):r++,n++;else{if(-1===s)return!1;n=s+1,r=++i}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){for(let r of(t.save(e),t.namespaces=e,t.names=[],t.skips=[],("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===r[0]?t.skips.push(r.slice(1)):t.names.push(r)},t.enabled=function(e){for(let r of t.skips)if(n(e,r))return!1;for(let r of t.names)if(n(e,r))return!0;return!1},t.humanize=function(){if(b)return m;b=1;function e(e,t,r,n){return Math.round(e/r)+" "+n+(t>=1.5*r?"s":"")}return m=function(t,r){r=r||{};var n,s,i=typeof t;if("string"===i&&t.length>0){var o=t;if(!((o=String(o)).length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(a){var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*u;case"weeks":case"week":case"w":return 6048e5*u;case"days":case"day":case"d":return 864e5*u;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*u;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*u;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u}}}return}if("number"===i&&isFinite(t))return r.long?(s=Math.abs(t))>=864e5?e(t,s,864e5,"day"):s>=36e5?e(t,s,36e5,"hour"):s>=6e4?e(t,s,6e4,"minute"):s>=1e3?e(t,s,1e3,"second"):t+" ms":(n=Math.abs(t))>=864e5?Math.round(t/864e5)+"d":n>=36e5?Math.round(t/36e5)+"h":n>=6e4?Math.round(t/6e4)+"m":n>=1e3?Math.round(t/1e3)+"s":t+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)|0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}))(t);let{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(T,T.exports)),T.exports,Object.prototype.hasOwnProperty;let I=typeof S>"u"?()=>!1:e=>S.isBuffer(e);function $(e){return"[object Object]"===Object.prototype.toString.call(e)}let q=["boolean","string","number"],C={};"u">typeof globalThis?C=globalThis:"u">typeof window?C=window:"u">typeof global?C=global:"u">typeof self&&(C=self);var R=C;let k=(e={})=>{let t=e.implementation||Promise;if(!t)throw Error("`Promise` is not available in global scope, and no implementation was passed");return{onReturn:(r,n)=>new t((t,s)=>{let i=n.options.cancelToken;i&&i.promise.then(e=>{r.abort.publish(e),s(e)}),r.error.subscribe(s),r.response.subscribe(r=>{t(e.onlyBody?r.body:r)}),setTimeout(()=>{try{r.request.publish(n)}catch(e){s(e)}},0)})}};class O{__CANCEL__=!0;message;constructor(e){this.message=e}toString(){return"Cancel"+(this.message?`: ${this.message}`:"")}}class j{promise;reason;constructor(e){if("function"!=typeof e)throw TypeError("executor must be a function.");let t=null;this.promise=new Promise(e=>{t=e}),e(e=>{this.reason||(this.reason=new O(e),t(this.reason))})}static source=()=>{let e;return{token:new j(t=>{e=t}),cancel:e}}}k.Cancel=O,k.CancelToken=j,k.isCancel=e=>!(!e||!e?.__CANCEL__);var A=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function P(e){return 100*Math.pow(2,e)+100*Math.random()}let D=(e={})=>(e=>{let t=e.maxRetries||5,r=e.retryDelay||P,n=e.shouldRetry;return{onError:(e,s)=>{var i;let o=s.options,a=o.maxRetries||t,u=o.retryDelay||r,c=o.shouldRetry||n,l=o.attemptNumber||0;if(null!==(i=o.body)&&"object"==typeof i&&"function"==typeof i.pipe||!c(e,l,o)||l>=a)return e;let d=Object.assign({},s,{options:Object.assign({},o,{attemptNumber:l+1})});return setTimeout(()=>s.channels.request.publish(d),u(l)),null}}})({shouldRetry:A,...e});D.shouldRetry=A;var M=r(73621),N=r(78714),U=r(34792),F=r(20275),z=r(29844),L=r(9862),V=r(72666),H=r(8682),B=r(32517),W=r(5150),J=r(97923),X=r(54368),G=r(20615),Y=r(94460),Q=r(23537),K=r(15290),Z=r(86288),ee=r(95183),et=r(99670),er=r(33273),en=r(28052),es=r(55484),ei=r(60747),eo=r(92552),ea=r(36449),eu=r(55844);function ec(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=(0,eu.ms)(e);return r?(0,ea.F)(ec.apply(void 0,(0,er.fX)([],(0,er.zs)(e))),(0,eo.I)(r)):(0,es.N)(function(t,r){(0,en.P)((0,er.fX)([t],(0,er.zs)((0,ei.K)(e))))(r)})}var el=r(5124),ed=r(98299),eh=r(72817);let ep=/\r\n|[\n\r\u2028\u2029]/;function ef(e,t){let r=0;for(let n=0;n<t.length;n++){let s=t[n].length+1;if(r+s>e)return{line:n+1,column:e-r};r+=s}return{line:t.length,column:t[t.length-1]?.length??0}}
2class ey extends Error{response;statusCode=400;responseBody;details;constructor(e,t){let r=ev(e,t);super(r.message),Object.assign(this,r)}}class eg extends Error{response;statusCode=500;responseBody;details;constructor(e){let t=ev(e);super(t.message),Object.assign(this,t)}}function ev(e,t){var r,n,s;let i=e.body,o={response:e,statusCode:e.statusCode,responseBody:(r=i,-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(r,null,2):r),message:"",details:void 0};if(!(0,et.u4)(i))return o.message=ew(e,i),o;let a=i.error;if("string"==typeof a&&"string"==typeof i.message)return o.message=`${a} - ${i.message}`,o;if("object"!=typeof a||null===a)return"string"==typeof a?o.message=a:"string"==typeof i.message?o.message=i.message:o.message=ew(e,i),o;if("type"in(n=a)&&"mutationError"===n.type&&"description"in n&&"string"==typeof n.description||"type"in(s=a)&&"actionError"===s.type&&"description"in s&&"string"==typeof s.description){let e=a.items||[],t=e.slice(0,5).map(e=>e.error?.description).filter(Boolean),r=t.length?`:
3- ${t.join(`
4- `)}`:"";return e.length>5&&(r+=`
5...and ${e.length-5} more`),o.message=`${a.description}${r}`,o.details=i.error,o}return em(a)?(o.message=eb(a,t?.options?.query?.tag),o.details=i.error):"description"in a&&"string"==typeof a.description?(o.message=a.description,o.details=a):o.message=ew(e,i),o}function em(e){return(0,et.u4)(e)&&"queryParseError"===e.type&&"string"==typeof e.query&&"number"==typeof e.start&&"number"==typeof e.end}function eb(e,t){let{query:r,start:n,end:s,description:i}=e;if(!r||typeof n>"u")return`GROQ query parse error: ${i}`;let o=t?`
6
7Tag: ${t}`:"";return`GROQ query parse error:
8${function(e,t,r){let n=e.split(ep),{start:s,end:i,markerLines:o}=function(e,t){let r={...e.start},n={...r,...e.end},s=r.line??-1,i=r.column??0,o=n.line,a=n.column,u=Math.max(s-3,0),c=Math.min(t.length,o+3);-1===s&&(u=0),-1===o&&(c=t.length);let l=o-s,d={};if(l)for(let e=0;e<=l;e++){let r=e+s;if(i)if(0===e){let e=t[r-1].length;d[r]=[i,e-i+1]}else if(e===l)d[r]=[0,a];else{let n=t[r-e].length;d[r]=[0,n]}else d[r]=!0}else i===a?i?d[s]=[i,0]:d[s]=!0:d[s]=[i,a-i];return{start:u,end:c,markerLines:d}}({start:ef(t.start,n),end:t.end?ef(t.end,n):void 0},n),a=`${i}`.length;return e.split(ep,i).slice(s,i).map((e,t)=>{let n=s+1+t,i=` ${` ${n}`.slice(-a)} |`,u=o[n],c=!o[n+1];if(!u)return` ${i}${e.length>0?` ${e}`:""}`;let l="";if(Array.isArray(u)){let t=e.slice(0,Math.max(u[0]-1,0)).replace(/[^\t]/g," "),n=u[1]||1;l=`
9 `+i.replace(/\d/g," ")+" "+t+"^".repeat(n),c&&r&&(l+=" "+r)}return">"+i+(e.length>0?` ${e}`:"")+l}).join(`
10`)}(r,{start:n,end:s},i)}${o}`}function ew(e,t){var r,n;let s="string"==typeof t?` (${n=100,(r=t).length>100?`${r.slice(0,n)}\u2026`:r})`:"",i=e.statusMessage?` ${e.statusMessage}`:"";return`${e.method}-request to ${e.url} resulted in HTTP ${e.statusCode}${i}${s}`}class e_ extends Error{projectId;addOriginUrl;constructor({projectId:e}){super("CorsOriginError"),this.name="CorsOriginError",this.projectId=e;let t=new URL(`https://sanity.io/manage/project/${e}/api`);if("u">typeof location){let{origin:e}=location;t.searchParams.set("cors","add"),t.searchParams.set("origin",e),this.addOriginUrl=t,this.message=`The current origin is not allowed to connect to the Live Content API. Add it here: ${t}`}else this.message=`The current origin is not allowed to connect to the Live Content API. Change your configuration here: ${t}`}}let ex={onResponse:(e,t)=>{if(e.statusCode>=500)throw new eg(e);if(e.statusCode>=400)throw new ey(e,t);return e}};function eE(e,t={}){return((e=[],t=v)=>(function e(t,r){let n=[],s=l.reduce((e,t)=>(e[t]=e[t]||[],e),{processOptions:[i],validateOptions:[u]});function o(e){let t,n=c.reduce((e,t)=>(e[t]=function(){let e=Object.create(null),t=0;return{publish:function(t){for(let r in e)e[r](t)},subscribe:function(r){let n=t++;return e[n]=r,function(){delete e[n]}}}}(),e),{}),i=function(e,t,...r){let n="onError"===e,i=t;for(let t=0;t<s[e].length&&(i=(0,s[e][t])(i,...r),!n||i);t++);return i},o=i("processOptions",e);i("validateOptions",o);let a={options:o,channels:n,applyMiddleware:i},u=n.request.subscribe(e=>{t=r(e,(t,r)=>((e,t,r)=>{let s=e,o=t;if(!s)try{o=i("onResponse",t,r)}catch(e){o=null,s=e}(s=s&&i("onError",s,r))?n.error.publish(s):o&&n.response.publish(o)})(t,r,e))});n.abort.subscribe(()=>{u(),t&&t.abort()});let l=i("onReturn",n,a);return l===n&&n.request.publish(a),l}return o.use=function(e){if(!e)throw Error("Tried to add middleware that resolved to fal
10sey value");if("function"==typeof e)throw Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&s.onReturn.length>0)throw Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return l.forEach(t=>{e[t]&&s[t].push(e[t])}),n.push(e),o},o.clone=()=>e(n,r),t.forEach(o.use),o})(e,t))([D({shouldRetry:eS}),...e,function(e={}){let t={},r=t=>void 0!==e.ignoreWarnings&&(Array.isArray(e.ignoreWarnings)?e.ignoreWarnings:[e.ignoreWarnings]).some(e=>"string"==typeof e?t.includes(e):e instanceof RegExp&&e.test(t));return{onResponse:e=>{let n=e.headers["x-sanity-warning"];for(let e of Array.isArray(n)?n:[n])!e||t[e]||r(e)||(t[e]=!0,console.warn(e));return e}}}(t),{processOptions:e=>{let t=e.body;return!t||"function"==typeof t.pipe||I(t)||-1===q.indexOf(typeof t)&&!Array.isArray(t)&&!function(e){if(!1===$(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!1!==$(r)&&!1!==r.hasOwnProperty("isPrototypeOf")}(t)?e:Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})})}},{onResponse:e=>{let t=e.headers["content-type"]||"",r=-1!==t.indexOf("application/json");return e.body&&t&&r?Object.assign({},e,{body:function(e){try{return JSON.parse(e)}catch(e){throw e.message=`Failed to parsed response body as JSON: ${e.message}`,e}}(e.body)}):e},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})},{onRequest:e=>{if("xhr"!==e.adapter)return;let t=e.request,r=e.context;function n(e){return t=>{let 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"))}},ex,function(e={}){let t=e.implementation||R.Observable;if(!t)throw Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,r)=>new t(t=>(e.error.subscribe(e=>t.error(e)),e.progress.subscribe(e=>t.next(Object.assign({type:"progress"},e))),e.response.subscribe(e=>{t.next(Object.assign({type:"response"},e)),t.complete()}),e.request.publish(r),()=>e.abort.publish()))}}({implementation:M.c})])}function eS(e,t,r){if(0===r.maxRetries)return!1;let n="GET"===r.method||"HEAD"===r.method,s=(r.uri||r.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return(!!n||!!s)&&!!i||D.shouldRetry(e,t,r)}function eT(e){return"https://www.sanity.io/help/"+e}let eI=["image","file"],e$=["before","after","replace"],eq=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},eC=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`${e}() takes an object of properties`)},eR=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw Error(`${e}(): "${t}" is not a valid document ID`)},ek=(e,t)=>{if(!t._id)throw Error(`${e}() requires that the document contains an ID ("_id" property)`);eR(e,t._id)},eO=(e,t)=>{if(!t._type)throw Error(`\`${e}()\` requires that the document contains a type (\`_type\` property)`);((e,t)=>
10{if("string"!=typeof t)throw Error(`\`${e}()\`: \`${t}\` is not a valid document type`)})(e,t._type)},ej=e=>{if(e.dataset)return e.dataset;let t=e.resource;if(t&&"dataset"===t.type){let e=t.id.split(".");if(2!==e.length)throw Error('Dataset resource ID must be in the format "project.dataset"');return e[1]}throw Error("`dataset` must be provided to perform queries")},eA=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e},eP=e=>{let t=e.resource;if(!t)throw Error("`resource` must be provided to perform resource queries");let{type:r,id:n}=t;switch(r){case"dataset":if(2!==n.split(".").length)throw Error('Dataset resource ID must be in the format "project.dataset"');return;case"dashboard":case"media-library":case"canvas":return;default:throw Error(`Unsupported resource type: ${r.toString()}`)}},eD=(e,t)=>{if(t.resource)throw Error(`\`${e}\` does not support resource-based operations`)},eM=e=>(function(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)})((...t)=>console.warn(e.join(" "),...t)),eN=eM(["Because you set `withCredentials` to true, we will override your `useCdn`","setting to be false since (cookie-based) credentials are never set on the CDN"]),eU=eM(["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."]),eF=eM(["The Sanity client is configured with the `perspective` set to `drafts` or `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."]),ez=eM(["The `previewDrafts` perspective has been renamed to  `drafts` and will be removed in a future API version"]),eL=eM(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${eT("js-client-browser-token")} for more information and how to hide this warning.`]),eV=eM(["You have configured Sanity client to use a token, but also provided `withCredentials: true`.","This is no longer supported - only token will be used - remove `withCredentials: true`."]),eH=eM(["Using the Sanity client without specifying an API version is deprecated.",`See ${eT("js-client-api-version")}`]),eB=(eM(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),eM(["You have called `createVersion()` with a defined `document`. The recommended approach is to provide a `baseId` and `releaseId` instead."])),eW=eM(["The `~experimental_resource` configuration property has been renamed to `resource`.","Please update your client configuration to use `resource` instead. Support for `~experimental_resource` will be removed in a future version."]),eJ={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},eX=["localhost","127.0.0.1","0.0.0.0"];function eG(e){if(Array.isArray(e)&&e.length>1&&e.includes("raw"))throw TypeError('Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives')}let eY=(e,t)=>{let r,n={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||eJ.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};n.apiVersion||eH();let s={...eJ,...n};s["~experimental_resource"]&&!s.resource&&(eW(),s.resource=s["~experimental_resource"]);let i=s.resource,o=s.useProjectHostname&&!i;if(typeof Promise>"u"){let e=eT("js-client-promise-polyfill");throw Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(o&&!s.projectId)throw Error("Configuration must contain `projectId`");if(i&&eP(s),"u">typeof s.perspective&&eG(s.perspective),"encodeSourceMap"in s)throw Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in s)throw Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");
10if("boolean"!=typeof s.stega.enabled)throw Error(`stega.enabled must be a boolean, received ${s.stega.enabled}`);if(s.stega.enabled&&void 0===s.stega.studioUrl)throw Error("stega.studioUrl must be defined when stega.enabled is true");if(s.stega.enabled&&"string"!=typeof s.stega.studioUrl&&"function"!=typeof s.stega.studioUrl)throw Error(`stega.studioUrl must be a string or a function, received ${s.stega.studioUrl}`);let a="u">typeof window&&window.location&&window.location.hostname,u=a&&(r=window.location.hostname,-1!==eX.indexOf(r)),c=!!s.token;s.withCredentials&&c&&(eV(),s.withCredentials=!1),a&&u&&c&&!0!==s.ignoreBrowserTokenWarning?eL():typeof s.useCdn>"u"&&eU(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw Error("`projectId` can only contain only a-z, 0-9 and dashes")})(s.projectId),s.dataset&&eq(s.dataset),"requestTagPrefix"in s&&(s.requestTagPrefix=s.requestTagPrefix?eA(s.requestTagPrefix).replace(/\.+$/,""):void 0),s.apiVersion=`${s.apiVersion}`.replace(/^v/,""),s.isDefaultApi=s.apiHost===eJ.apiHost,!0===s.useCdn&&s.withCredentials&&eN(),s.useCdn=!1!==s.useCdn&&!s.withCredentials,function(e){if("1"===e||"X"===e)return;let t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(s.apiVersion);let l=s.apiHost.split("://",2),d=l[0],h=l[1],p=s.isDefaultApi?"apicdn.sanity.io":h;return o?(s.url=`${d}://${s.projectId}.${h}/v${s.apiVersion}`,s.cdnUrl=`${d}://${s.projectId}.${p}/v${s.apiVersion}`):(s.url=`${s.apiHost}/v${s.apiVersion}`,s.cdnUrl=s.url),s};class eQ extends Error{name="ConnectionFailedError"}class eK extends Error{name="DisconnectError";reason;constructor(e,t,r={}){super(e,r),this.reason=t}}class eZ extends Error{name="ChannelError";data;constructor(e,t){super(e),this.data=t}}class e0 extends Error{name="MessageError";data;constructor(e,t,r={}){super(e,r),this.data=t}}class e1 extends Error{name="MessageParseError"}let e3=["channelError","disconnect"];function e2(e,t){return(0,N.v)(()=>{let t=e();return(0,U.A)(t)?t:(0,F.of)(t)}).pipe((0,z.Z)(e=>{var r,n;return r=e,n=t,new M.c(e=>{let t=n.includes("open"),s=n.includes("reconnect");function i(t){if("data"in t){let[r,n]=e6(t);e.error(r?new e1("Unable to parse EventSource error message",{cause:n}):new e0((n?.data).message,n));return}r.readyState===r.CLOSED?e.error(new eQ("EventSource connection failed")):s&&e.next({type:"reconnect"})}function o(){e.next({type:"open"})}function a(t){let[n,s]=e6(t);if(n)return void e.error(new e1("Unable to parse EventSource message",{cause:n}));if("channelError"===t.type){let t=new URL(r.url).searchParams.get("tag");e.error(new eZ(function(e,t){let r=e.error;return r?em(r)?eb(r,t):r.description?r.description:"string"==typeof r?r:JSON.stringify(r,null,2):e.message||"Unknown listener error"}(s?.data,t),s.data));return}if("disconnect"===t.type)return void e.error(new eK(`Server disconnected client: ${s.data?.reason||"unknown error"}`));e.next({type:t.type,id:t.lastEventId,...s.data?{data:s.data}:{}})}r.addEventListener("error",i),t&&r.addEventListener("open",o);let u=[...new Set([...e3,...n])].filter(e=>"error"!==e&&"open"!==e&&"reconnect"!==e);return u.forEach(e=>r.addEventListener(e,a)),()=>{r.removeEventListener("error",i),t&&r.removeEventListener("open",o),u.forEach(e=>r.removeEventListener(e,a)),r.close()}})}))}function e6(e){try{let t="string"==typeof e.data&&JSON.parse(e.data);return[null,{type:e.type,id:e.lastEventId,...!function(e){for(let t in e)return!1;return!0}(t)?{data:t}:{}}]}catch(e){return[e,null]}}function e4(e){if("string"==typeof e)return{id:e};if(Array.isArray(e))return{query:"*[_id in $ids]",params:{ids: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};let t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join(`
11`);throw Error(`Unknown selection - must be one of:
12
13${t}`)}class e8{selection;operations;constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return eC("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw 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)=>{let n="insert(at, selector, items)";if(-1===e$.indexOf(e)){let e=e$.map(e=>`"${e}"`).join(", ");throw Error(`${n} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw Error(`${n} takes a "selector"-argument which must be a string`);if(!Array.isArray(r))throw Error(`${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",`${e}[-1]`,t)}prepend(e,t){return this.insert("before",`${e}[0]`,t)}splice(e,t,r,n){let s=t<0?t-1:t,i=typeof r>"u"||-1===r?-1:Math.max(0,t+r),o=`${e}[${s}:${s<0&&i>=0?"":i}]`;return this.insert("replace",o,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...e4(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,r=!0){return eC(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)}}class e9 extends e8{#a;constructor(e,t,r){super(e,t),this.#a=r}clone(){return new e9(this.selection,{...this.operations},this.#a)}commit(e){if(!this.#a)throw Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");let t=Object.assign({returnFirst:"string"==typeof this.selection,returnDocuments:!0},e);return this.#a.mutate({patch:this.serialize()},t)}}class e7 extends e8{#a;constructor(e,t,r){super(e,t),this.#a=r}clone(){return new e7(this.selection,{...this.operations},this.#a)}commit(e){if(!this.#a)throw Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");let t=Object.assign({returnFirst:"string"==typeof this.selection,returnDocuments:!0},e);return this.#a.mutate({patch:this.serialize()},t)}}let e5={returnDocuments:!1};class te{operations;trxId;constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return eC("create",e),this._add({create:e})}createIfNotExists(e){let t="createIfNotExists";return eC(t,e),ek(t,e),this._add({[t]:e})}createOrReplace(e){let t="createOrReplace";return eC(t,e),ek(t,e),this._add({[t]:e})}delete(e){return eR("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}}class tt extends te{#a;constructor(e,t,r){super(e,r),this.#a=t}clone(){return new tt([...this.operations],this.#a,this.trxId)}commit(e){if(!this.#a)throw Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#a.mutate(this.serialize(),Object.assign({transactionId:this.trxId},e5,e||{}))}patch(e,t){let r="function"==typeof t,n="string"!=typeof e&&e instanceof e7,s="object"==typeof e&&("query"in e||"id"in e);if(n)return this._add({patch:e.serialize()});if(r){let r=t(new e7(e,{},this.#a));if(!(r instanceof e7))throw Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}if(s){let r=new e7(e,t||{},this.#a);return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}class tr extends te{#a;constructor(e,t,r){super(e,r),this.#a=t}clone(){return new tr([...this.operations],this.#a,this.trxId)}commit(e){if(!this.#a)throw Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#a.mutate(this.serialize(),Object.assign({transactionId:this.trxId},e5,e||{}))}patch(e,t){let r="function"==typeof t;if("string"!=typeof e&&e instanceof e9)return this._add({patch:e.serialize()});if(r){let r=t(new e9(e,{},this.#a));if(!(r instanceof e9))throw Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}let tn=({query:e,params:t={},options:r={}})=>{let n=new URLSearchParams,{tag:s,includeMutations:i,returnQuery:o,...a}=r;for(let[r,i]of(s&&n.append("tag",s),n.append("query",e),Object.entries(t)))void 0!==i&&n.append(`$${r}`,JSON.stringify(i));for(let[e,t]of Object.entries(a))t&&n.append(e,`${t}`);return!1===o&&n.append("returnQuery","false"),!1===i&&n.append("includeMutations","fal
13se"),`?${n}`},ts=e=>"response"===e.type,ti=e=>e.body;function to(e,t,n,s,i={},o={}){let a="stega"in o?{...n||{},..."boolean"==typeof o.stega?{enabled:o.stega}:o.stega||{}}:n,u=a.enabled?(0,et.Q)(i):i,c=!1===o.filterResponse?e=>e:e=>e.result,{cache:l,next:d,...h}={useAbortSignal:"u">typeof o.signal,resultSourceMap:a.enabled?"withKeyArraySelector":o.resultSourceMap,...o,returnQuery:!1===o.filterResponse&&!1!==o.returnQuery},p=tw(e,t,"query",{query:s,params:u},"u">typeof l||"u">typeof d?{...h,fetch:{cache:l,next:d}}:h);return a.enabled?p.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ec.apply(void 0,(0,er.fX)([],(0,er.zs)(e)))}((0,L.H)(r.e(67204).then(r.bind(r,67204)).then(function(e){return e.stegaEncodeSourceMap$1}).then(({stegaEncodeSourceMap:e})=>e))),(0,Z.T)(([e,t])=>{let r=t(e.result,e.resultSourceMap,a);return c({...e,result:r})})):p.pipe((0,Z.T)(c))}function ta(e,t,r,n={}){let s={uri:tI(e,"doc",(()=>{if(!n.releaseId)return r;let e=(0,ed._S)(r);if(!e){if((0,ed.R8)(r))throw Error(`The document ID (\`${r}\`) is a draft, but \`options.releaseId\` is set as \`${n.releaseId}\``);return(0,ed.ct)(r,n.releaseId)}if(e!==n.releaseId)throw Error(`The document ID (\`${r}\`) is already a version of \`${e}\` release, but this does not match the provided \`options.releaseId\` (\`${n.releaseId}\`)`);return r})()),json:!0,tag:n.tag,signal:n.signal,query:void 0!==n.includeAllVersions?{includeAllVersions:n.includeAllVersions}:void 0};return tS(e,t,s).pipe((0,el.p)(ts),(0,Z.T)(e=>{let t=e.body.documents;return t?n.includeAllVersions?t:t[0]:n.includeAllVersions?[]:void 0}))}function tu(e,t,r,n={}){let s={uri:tI(e,"doc",r.join(",")),json:!0,tag:n.tag,signal:n.signal};return tS(e,t,s).pipe((0,el.p)(ts),(0,Z.T)(e=>{let t,n,s=(t=e.body.documents||[],n=e=>e._id,t.reduce((e,t)=>(e[n(t)]=t,e),Object.create(null)));return r.map(e=>s[e]||null)}))}function tc(e,t,r,n={}){return tw(e,t,"query",{query:"*[sanity::partOfRelease($releaseId)]",params:{releaseId:r}},n)}function tl(e,t,r,n){return ek("createIfNotExists",r),t_(e,t,r,"createIfNotExists",n)}function td(e,t,r,n){return ek("createOrReplace",r),t_(e,t,r,"createOrReplace",n)}function th(e,t,r,n,s){return ek("createVersion",r),eO("createVersion",r),eB(),tb(e,t,{actionType:"sanity.action.document.version.create",publishedId:n,document:r},s)}function tp(e,t,r,n,s,i,o){if(!n)throw Error("`createVersion()` requires `baseId` when no `document` is provided");if(!r)throw Error("`createVersion()` requires `publishedId` when `baseId` is provided");return eR("createVersion",n),eR("createVersion",r),tb(e,t,{actionType:"sanity.action.document.version.create",publishedId:r,baseId:n,versionId:s?(0,ed.ct)(r,s):(0,ed.T4)(r),ifBaseRevisionId:i},o)}function tf(e,t,r,n){return tw(e,t,"mutate",{mutations:[{delete:e4(r)}]},n)}function ty(e,t,r,n=!1,s){return tb(e,t,{actionType:"sanity.action.document.version.discard",versionId:r,purge:n},s)}function tg(e,t,r,n){return ek("replaceVersion",r),eO("replaceVersion",r),tb(e,t,{actionType:"sanity.action.document.version.replace",document:r},n)}function tv(e,t,r,n,s){return tb(e,t,{actionType:"sanity.action.document.version.unpublish",versionId:r,publishedId:n},s)}function tm(e,t,r,n){let s;return tw(e,t,"mutate",{mutations:Array.isArray(s=r instanceof e7||r instanceof e9?{patch:r.serialize()}:r instanceof tt||r instanceof tr?r.serialize():r)?s:[s],transactionId:n&&n.transactionId||void 0},n)}function tb(e,t,r,n){let s=Array.isArray(r)?r:[r],i=n&&n.transactionId||void 0;return tw(e,t,"actions",{actions:s,transactionId:i,skipCrossDatasetReferenceValidation:n&&n.skipCrossDatasetReferenceValidation||void 0,dryRun:n&&n.dryRun||void 0},n)}function tw(e,t,r,n,s={}){let i="mutate"===r,o="actions"===r,a=i||o?"":tn(n),u=!i&&!o&&a.length<11264,c=u?a:"",l=s.returnFirst,{timeout:d,token:h,tag:p,headers:f,returnQuery:y,lastLiveEventId:g,cacheMode:v}=s,m={method:u?"GET":"POST",uri:tI(e,r,c),json:!0,body:u?void 0:n,query:i&&((e={})=>{let t,r;return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:typeof t>"u"?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}})(s),timeout:d,headers:f,token:h,tag:p,returnQuery:y,perspective:s.perspective,resultSourceMap:s.resultSourceMap,lastLiveEventId:Array.isArray(g)?g[0]:g,cacheMode:v,canUseCdn:"query"===r,signal:s.signal,fetch:s.fetch,useAbortSignal:s.useAbortSignal,useCdn:s.useCdn};return tS(e,t,m).pipe((0,el.p)(ts),(0,Z.T)(ti),(0,Z.T)(e=>{if(!i)return e;let t=e.results||[];if(s.returnDocuments)return l?t[0]&&t[0].document:t.map(e=>e.document);let r=l?t[0]&&t[0].id:t.map(e=>e.id);return{transactionId:e.transactionId,results:t,[l?"documentId":"documentIds"]:r}}))}function t_(e,t,r,n,s={}){return tw(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},s))}let tx=e=>{let t=e.config();return void 0!==t.dataset&&void 0!==t.projectId||void 0!==t.resource},tE=(e,t)=>tx(e)&&t.startsWith(tI(e,"query"));function tS(e,t,r){var n;let s=r.url||r.uri,i=e.config(),o=typeof r.canUseCdn>"u"?["GET","HEAD"].indexOf(r.method||"GET")>=0&&(s.startsWith("/data/")||tE(e,s)||tx(e)&&s.startsWith(tI(e,"mutate"))||tx(e)&&s.startsWith(tI(e,"doc",""))||tx(e)&&s.startsWith(tI(e,"listen"))||tx(e)&&s.startsWith(tI(e,"history",""))):r.canUseCdn,a=(r.useCdn??i.useCdn)&&o,u=r.tag&&i.requestTagPrefix?[i.requestTagPrefix,r.tag].join("."):r.tag||i.requestTagPrefix;if(u&&null!==r.tag&&(r.query={tag:eA(u),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&tE(e,s)){let e=r.resultSourceMap??i.resultSourceMap;void 0!==e&&!1!==e&&(r.query={resultSourceMap:e,...r.query});let t=r.perspective||i.perspective;"u">typeof t&&("previewDrafts"===t&&ez(),eG(t),r.query={perspective:Array.isArray(t)?t.join(","):t,...r.query},(Array.isArray(t)&&t.length>0||"previewDrafts"===t||"drafts"===t)&&a&&(a=!1,eF())),r.lastLiveEventId&&(r.query={...r.query,lastLiveEventId:r.lastLiveEventId}),!1===r.returnQuery&&(r.query={returnQuery:"false",...r.query}),a&&"noStale"==r.cacheMode&&(r.query={cacheMode:"noStale",...r.query})}let c=function(e,t={}){let r={};e.headers&&Object.assign(r,e.headers);let n=t.token||e.token;n&&(r.Authorization=`Bearer ${n}`),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r["X-Sanity-Project-ID"]=e.projectId);let s=!!(typeof t.withCredentials>"u"?e.withCredentials:t.withCredentials),i=typeof t.timeout>"u"?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:typeof i>"u"?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:s,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(i,Object.assign({},r,{url:t$(e,s,a)})),l=new M.c(e=>t(c,i.requester).subscribe(e));return r.signal?l.pipe((n=r.signal,e=>new M.c(t=>{let r=()=>t.error(function(e){if(tq)return new DOMException(e?.reason??"The operation was aborted.","AbortError");let t=Error(e?.reason??"The operation was aborted.");return t.name="AbortError",t}(n));if(n&&n.aborted)return void r();let s=e.subscribe(t);return n.addEventListener("abort",r),()=>{n.removeEventListener("abort",r),s.unsubscribe()}}))):l}function tT(e,t,r){return tS(e,t,r).pipe((0,el.p)(e=>"response"===e.type),(0,Z.T)(e=>e.body))}function tI(e,t,r){let n=e.config();if(n.resource){eP(n);let e=tC(n),s=void 0!==r?`${t}/${r}`:t;return`${e}/${s}`.replace(/\/($|\?)/,"$1")}let s=ej(n),i=`/${t}/${s}`;return`/data${void 0!==r?`${i}/${r}`:i}`.replace(/\/($|\?)/,"$1")}function t$(e,t,r=!1){let{url:n,cdnUrl:s}=e.config();return`${r?s:n}/${t.replace(/^\//,"")}`}let tq=!!globalThis.DOMException,tC=e=>{let t=e.resource;if(!t)throw Error("`resource` must be provided to perform resource queries");let{type:r,id:n}=t;switch(r){case"dataset":{let e=n.split(".");if(2!==e.length)throw Error('Dataset ID must be in the format "project.dataset"');return`/projects/${e[0]}/datasets/${e[1]}`}case"canvas":return`/canvases/${n}`;case"media-library":return`/media-libraries/${n}`;case"dashboard":return`/dashboards/${n}`;default:throw Error(`Unsupported resource type: ${r.toString()}`)}};function tR(e,t,r){let n=ej(e.config());return tT(e,t,{method:"POST",uri:`/agent/action/generate/${n}`,body:r})}function tk(e,t,r){let n=ej(e.config());return tT(e,t,{method:"POST",uri:`/agent/action/transform/${n}`,body:r})}function tO(e,t,r){let n=ej(e.config());return tT(e,t,{method:"POST",uri:`/agent/action/translate/${n}`,body:r})}class tj{#a;#u;
13constructor(e,t){this.#a=e,this.#u=t}generate(e){return tR(this.#a,this.#u,e)}transform(e){return tk(this.#a,this.#u,e)}translate(e){return tO(this.#a,this.#u,e)}}class tA{#a;#u;constructor(e,t){this.#a=e,this.#u=t}generate(e){return(0,V.s)(tR(this.#a,this.#u,e))}transform(e){return(0,V.s)(tk(this.#a,this.#u,e))}translate(e){return(0,V.s)(tO(this.#a,this.#u,e))}prompt(e){return(0,V.s)(function(e,t,r){let n=ej(e.config());return tT(e,t,{method:"POST",uri:`/agent/action/prompt/${n}`,body:r})}(this.#a,this.#u,e))}patch(e){return(0,V.s)(function(e,t,r){let n=ej(e.config());return tT(e,t,{method:"POST",uri:`/agent/action/patch/${n}`,body:r})}(this.#a,this.#u,e))}}class tP{#a;#u;constructor(e,t){this.#a=e,this.#u=t}upload(e,t,r){return tM(this.#a,this.#u,e,t,r)}}class tD{#a;#u;constructor(e,t){this.#a=e,this.#u=t}upload(e,t,r){let n=tM(this.#a,this.#u,e,t,r);return(0,V.s)(n.pipe((0,el.p)(e=>"response"===e.type),(0,Z.T)(e=>e.body.document)))}}function tM(e,t,r,n,s={}){var i,o;if(-1===eI.indexOf(r))throw Error(`Invalid asset type: ${r}. Must be one of ${eI.join(", ")}`);let a=s.extract||void 0;a&&!a.length&&(a=["none"]);let u=e.config(),c=(i=s,o=n,!(typeof File>"u")&&o instanceof File?Object.assign({filename:!1===i.preserveFilename?void 0:o.name,contentType:o.type},i):i),{tag:l,label:d,title:h,description:p,creditLine:f,filename:y,source:g}=c,v=u.resource?.type==="media-library",m=v?{title:h,filename:y}:{label:d,title:h,description:p,filename:y,meta:a,creditLine:f};return g&&!v&&(m.sourceId=g.id,m.sourceName=g.name,m.sourceUrl=g.url),tS(e,t,{tag:l,method:"POST",timeout:c.timeout||0,uri:function(e,t){let r="image"===t?"images":"files",n=e.resource;if(n){let{type:e,id:t}=n;switch(e){case"dataset":throw Error("Assets are not supported for dataset resources, yet. Configure the client with `{projectId: <projectId>, dataset: <datasetId>}` instead.");case"canvas":return`/canvases/${t}/assets/${r}`;case"media-library":return`/media-libraries/${t}/upload`;case"dashboard":return`/dashboards/${t}/assets/${r}`;default:throw Error(`Unsupported resource type: ${e.toString()}`)}}let s=ej(e);return`assets/${r}/${s}`}(u,r),headers:c.contentType?{"Content-Type":c.contentType}:{},query:m,body:n})}let tN=(0,N.v)(()=>r.e(49250).then(r.t.bind(r,49250,19))).pipe((0,Z.T)(({default:e})=>e),(0,H.t)(1));function tU(){return function(e){return e.pipe((0,B.W)((e,t)=>e instanceof eQ?(0,W.x)((0,F.of)({type:"reconnect"}),(0,J.O)(1e3).pipe((0,z.Z)(()=>t))):(0,X.$)(()=>e)))}}let tF=["includePreviousRevision","includeResult","includeMutations","includeAllVersions","visibility","effectFormat","tag"],tz={includeResult:!0};function tL(e,t,r={}){let{url:n,token:s,withCredentials:i,requestTagPrefix:o,headers:a}=this.config(),u=r.tag&&o?[o,r.tag].join("."):r.tag,c={...Object.keys(tz).concat(Object.keys(r)).reduce((e,t)=>(e[t]=typeof r[t]>"u"?tz[t]:r[t],e),{}),tag:u},l=tn({query:e,params:t,options:{tag:u,...tF.reduce((e,t)=>(typeof c[t]>"u"||(e[t]=c[t]),e),{})}}),d=`${n}${tI(this,"listen",l)}`;if(d.length>14800)return(0,X.$)(()=>Error("Query too large for listener"));let h=c.events?c.events:["mutation"],p={};return i&&(p.withCredentials=!0),(s||a)&&(p.headers={},s&&(p.headers.Authorization=`Bearer ${s}`),a&&Object.assign(p.headers,a)),e2(()=>(typeof EventSource>"u"||p.headers?tN:(0,F.of)(EventSource)).pipe((0,Z.T)(e=>new e(d,p))),h).pipe(tU(),(0,el.p)(e=>h.includes(e.type)),(0,Z.T)(e=>({type:e.type,..."data"in e?e.data:{}})))}let tV="2021-03-25";class tH{#a;constructor(e){this.#a=e}events({includeDrafts:e=!1,tag:t}={}){var r,n,s,i;let{projectId:o,apiVersion:a,token:u,withCredentials:c,requestTagPrefix:l,headers:d}=this.#a.config(),h=a.replace(/^v/,"");if("X"!==h&&h<tV)throw Error(`The live events API requires API version ${tV} or later. The current API version is ${h}. Please update your API version to use this feature.`);if(e&&!u&&!c)throw Error("The live events API requires a token or withCredentials when 'includeDrafts: true'. Please update your client configuration. The token should have the lowest possible access role.");let p=tI(this.#a,"live/events"),f=new URL(this.#a.getUrl(p,!1)),y=t&&l?[l,t].join("."):t;y&&f.searchParams.set("tag",y),e&&f.searchParams.set("includeDrafts","true");let g={};e&&c&&(g.withCredentials=!0),(e&&u||d)&&(g.headers={},e&&u&&(g.headers.Authorization=`Bearer ${u}`),d&&Object.assign(g.headers,d));let v=`${f.href}::${JSON.stringify(g)}`,m=tB.get(v);if(m)return m;let b=e2(()=>(typeof EventSource>"u"||g.headers?tN:(0,F.of)(EventSource)).pipe((0,Z.T)(e=>
13new e(f.href,g))),["message","restart","welcome","reconnect","goaway"]),w=(n=f,s={method:"OPTIONS",mode:"cors",credentials:g.withCredentials?"include":"omit",headers:g.headers},new M.c(e=>{let t=new AbortController,r=t.signal;return fetch(n,{...s,signal:t.signal}).then(t=>{e.next(t),e.complete()},t=>{r.aborted||e.error(t)}),()=>t.abort()})).pipe((0,B.W)(()=>{throw new e_({projectId:o})})),_=b.pipe(tU(),(0,z.Z)(e=>"reconnect"===e.type?w.pipe((0,z.Z)(()=>(0,F.of)(e))):(0,F.of)(e)),(0,B.W)(e=>w.pipe((0,z.Z)(()=>{throw e}))),(0,Z.T)(e=>{if("message"===e.type){let{data:t,...r}=e;return{...r,tags:t.tags}}return e})).pipe((0,Y.j)(()=>tB.delete(v)),(i="function"==typeof(r={predicate:e=>"welcome"===e.type})?{predicate:r,...void 0}:r,e=>{let t,r=!1,{predicate:n,...s}=i,o=e.pipe((0,G.M)(e=>{i.predicate(e)&&(r=!0,t=e)}),(0,Y.j)(()=>{r=!1,t=void 0}),(0,Q.u)(s)),a=new M.c(e=>{r&&e.next(t),e.complete()});return(0,K.h)(o,a)}));return tB.set(v,_),_}}let tB=new Map;class tW{#a;#u;constructor(e,t){this.#a=e,this.#u=t}create(e,t){return tX(this.#a,this.#u,"PUT",e,t)}edit(e,t){return tX(this.#a,this.#u,"PATCH",e,t)}delete(e){return tX(this.#a,this.#u,"DELETE",e)}list(){eD("dataset",this.#a.config());let e=this.#a.config(),t=e.projectId,r="/datasets";return!1===e.useProjectHostname&&(r=`/projects/${t}/datasets`),tT(this.#a,this.#u,{uri:r,tag:null})}}class tJ{#a;#u;constructor(e,t){this.#a=e,this.#u=t}create(e,t){return eD("dataset",this.#a.config()),(0,V.s)(tX(this.#a,this.#u,"PUT",e,t))}edit(e,t){return eD("dataset",this.#a.config()),(0,V.s)(tX(this.#a,this.#u,"PATCH",e,t))}delete(e){return eD("dataset",this.#a.config()),(0,V.s)(tX(this.#a,this.#u,"DELETE",e))}list(){eD("dataset",this.#a.config());let e=this.#a.config(),t=e.projectId,r="/datasets";return!1===e.useProjectHostname&&(r=`/projects/${t}/datasets`),(0,V.s)(tT(this.#a,this.#u,{uri:r,tag:null}))}}function tX(e,t,r,n,s){return eD("dataset",e.config()),eq(n),tT(e,t,{method:r,uri:`/datasets/${n}`,body:s,tag:null})}class tG{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getPlaybackInfo(e,t={}){var r,n;let s=this.#a.config(),i=(s.resource||s["~experimental_resource"])?.id,{instanceId:o,libraryId:a}=function(e){let t="object"==typeof e&&"_ref"in e?e._ref:e,r=tQ.exec(t);if(r){let[,e,t]=r;return{libraryId:e,instanceId:t}}if("string"==typeof e&&e.startsWith("video-"))return{instanceId:e};throw Error(`Invalid video asset instance identifier "${t}": must be a valid video instance id or a Global Dataset Reference (GDR) to the video asset in the Media Library`)}(e),u=a||i;if(!u)throw Error("Could not determine Media Library ID - you need to provide a valid Media Library ID in the client config or a Media Library GDR");let c=(r=o,n=u,`/media-libraries/${n}/video/${r}/playback-info`),l=function(e){let t={};if(e.transformations){let{thumbnail:r,animated:n,storyboard:s}=e.transformations;r&&(r.width&&(t.thumbnailWidth=r.width),r.height&&(t.thumbnailHeight=r.height),void 0!==r.time&&(t.thumbnailTime=r.time),r.fit&&(t.thumbnailFit=r.fit),r.format&&(t.thumbnailFormat=r.format)),n&&(n.width&&(t.animatedWidth=n.width),n.height&&(t.animatedHeight=n.height),void 0!==n.start&&(t.animatedStart=n.start),void 0!==n.end&&(t.animatedEnd=n.end),n.fps&&(t.animatedFps=n.fps),n.format&&(t.animatedFormat=n.format)),s&&s.format&&(t.storyboardFormat=s.format)}return e.expiration&&(t.expiration=e.expiration),t}(t);return tT(this.#a,this.#u,{method:"GET",uri:c,query:l})}}class tY{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getPlaybackInfo(e,t={}){return(0,V.s)(new tG(this.#a.observable,this.#u).getPlaybackInfo(e,t))}}let tQ=/^media-library:(ml[^:]+):([^:]+)$/;class tK{#a;#u;constructor(e,t){this.#a=e,this.#u=t}list(e){let t={};return e?.includeMembers===!1&&(t.includeMembers="false"),e?.organizationId&&(t.organizationId=e.organizationId),tT(this.#a,this.#u,{uri:"/projects",query:t})}getById(e){return tT(this.#a,this.#u,{uri:`/projects/${e}`})}}class tZ{#a;#u;constructor(e,t){this.#a=e,this.#u=t}list(e){let t={};return e?.includeMembers===!1&&(t.includeMembers="false"),e?.organizationId&&(t.organizationId=e.organizationId),(0,V.s)(tT(this.#a,this.#u,{uri:"/projects",query:t}))}getById(e){return(0,V.s)(tT(this.#a,this.#u,{uri:`/projects/${e}`}))}}let t0=(0,eh.d_)("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",8),t1=(e,t)=>t?(0,ed.ct)(e,t):(0,ed.T4)(e);function t3(e,{releaseId:t,publishedId:r,document:n}){if(r&&n._id){let e=t1(r,t);return((e,t)=>{if(t._id&&t._id!==e)throw Error(`The provided document ID (\`${t._id}
13\`) does not match the generated version ID (\`${e}\`)`)})(e,n),e}if(n._id){let r=(0,ed.R8)(n._id),s=(0,ed.A_)(n._id);if(!r&&!s)throw Error(`\`${e}()\` requires a document with an \`_id\` that is a version or draft ID`);if(t){if(r)throw Error(`\`${e}()\` was called with a document ID (\`${n._id}\`) that is a draft ID, but a release ID (\`${t}\`) was also provided.`);let s=(0,ed._S)(n._id);if(s!==t)throw Error(`\`${e}()\` was called with a document ID (\`${n._id}\`) that is a version ID, but the release ID (\`${t}\`) does not match the document's version ID (\`${s}\`).`)}return n._id}if(r)return t1(r,t);throw Error(`\`${e}()\` requires either a publishedId or a document with an \`_id\``)}let t2=(e,t)=>{let[r,n,s]=((e,t)=>{if("object"==typeof e&&null!==e&&("releaseId"in e||"metadata"in e)){let{releaseId:r=t0(),metadata:n={}}=e;return[r,n,t]}return[t0(),{},e]})(e,t);return{action:{actionType:"sanity.action.release.create",releaseId:r,metadata:{...n,releaseType:n.releaseType||"undecided"}},options:s}};class t6{#a;#u;constructor(e,t){this.#a=e,this.#u=t}get({releaseId:e},t){return ta(this.#a,this.#u,`_.releases.${e}`,t)}create(e,t){let{action:r,options:n}=t2(e,t),{releaseId:s,metadata:i}=r;return tb(this.#a,this.#u,r,n).pipe((0,Z.T)(e=>({...e,releaseId:s,metadata:i})))}edit({releaseId:e,patch:t},r){return tb(this.#a,this.#u,{actionType:"sanity.action.release.edit",releaseId:e,patch:t},r)}publish({releaseId:e},t){return tb(this.#a,this.#u,{actionType:"sanity.action.release.publish",releaseId:e},t)}archive({releaseId:e},t){return tb(this.#a,this.#u,{actionType:"sanity.action.release.archive",releaseId:e},t)}unarchive({releaseId:e},t){return tb(this.#a,this.#u,{actionType:"sanity.action.release.unarchive",releaseId:e},t)}schedule({releaseId:e,publishAt:t},r){return tb(this.#a,this.#u,{actionType:"sanity.action.release.schedule",releaseId:e,publishAt:t},r)}unschedule({releaseId:e},t){return tb(this.#a,this.#u,{actionType:"sanity.action.release.unschedule",releaseId:e},t)}delete({releaseId:e},t){return tb(this.#a,this.#u,{actionType:"sanity.action.release.delete",releaseId:e},t)}fetchDocuments({releaseId:e},t){return tc(this.#a,this.#u,e,t)}}class t4{#a;#u;constructor(e,t){this.#a=e,this.#u=t}get({releaseId:e},t){return(0,V.s)(ta(this.#a,this.#u,`_.releases.${e}`,t))}async create(e,t){let{action:r,options:n}=t2(e,t),{releaseId:s,metadata:i}=r;return{...await (0,V.s)(tb(this.#a,this.#u,r,n)),releaseId:s,metadata:i}}edit({releaseId:e,patch:t},r){return(0,V.s)(tb(this.#a,this.#u,{actionType:"sanity.action.release.edit",releaseId:e,patch:t},r))}publish({releaseId:e},t){return(0,V.s)(tb(this.#a,this.#u,{actionType:"sanity.action.release.publish",releaseId:e},t))}archive({releaseId:e},t){return(0,V.s)(tb(this.#a,this.#u,{actionType:"sanity.action.release.archive",releaseId:e},t))}unarchive({releaseId:e},t){return(0,V.s)(tb(this.#a,this.#u,{actionType:"sanity.action.release.unarchive",releaseId:e},t))}schedule({releaseId:e,publishAt:t},r){return(0,V.s)(tb(this.#a,this.#u,{actionType:"sanity.action.release.schedule",releaseId:e,publishAt:t},r))}unschedule({releaseId:e},t){return(0,V.s)(tb(this.#a,this.#u,{actionType:"sanity.action.release.unschedule",releaseId:e},t))}delete({releaseId:e},t){return(0,V.s)(tb(this.#a,this.#u,{actionType:"sanity.action.release.delete",releaseId:e},t))}fetchDocuments({releaseId:e},t){return(0,V.s)(tc(this.#a,this.#u,e,t))}}class t8{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getById(e){return tT(this.#a,this.#u,{uri:`/users/${e}`})}}class t9{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getById(e){return(0,V.s)(tT(this.#a,this.#u,{uri:`/users/${e}`}))}}class t7{assets;datasets;live;mediaLibrary;projects;users;agent;releases;#c;#u;listen=tL;constructor(e,t=eJ){this.config(t),this.#u=e,this.assets=new tP(this,this.#u),this.datasets=new tW(this,this.#u),this.live=new tH(this),this.mediaLibrary={video:new tG(this,this.#u)},this.projects=new tK(this,this.#u),this.users=new t8(this,this.#u),this.agent={action:new tj(this,this.#u)},this.releases=new t6(this,this.#u)}clone(){return new t7(this.#u,this.config())}config(e){if(void 0===e)return{...this.#c};if(this.#c&&!1===this.#c.allowReconfigure)throw Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.#c=eY(e,this.#c||{}),this}withConfig(e){let t=this.config();return new t7(this.#u,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof e?.stega?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,r){return to(this,this.#u,this.#c.stega,e,t,r)}getDocument(e,t){if(t?.includeAllVersions===!0)return ta(this,this.#u,e,{...t,includeAllVersions:!0});let r={signal:t?.signal,tag:t?.tag,releaseId:t?.releaseId,...t&&"includeAllVersions"in t?{includeAllVersions:!1}:{}};return ta(this,this.#u,e,r)}getDocuments(e,t){return tu(this,this.#u,e,t)}create(e,t){return t_(this,this.#u,e,"create",t)}createIfNotExists(e,t){return tl(this,this.#u,e,t)}createOrReplace(e,t){return td(this,this.#u,e,t)}createVersion({document:e,publishedId:t,releaseId:r,baseId:n,ifBaseRevisionId:s},i){if(!e)return tp(this,this.#u,t,n,r,s,i);let o=t3("createVersion",{document:e,publishedId:t,releaseId:r}),a={...e,_id:o},u=t||(0,ed.IM)(e._id);return th(this,this.#u,a,u,i)}delete(e,t){return tf(this,this.#u,e,t)}discardVersion({releaseId:e,publishedId:t},r,n){let s=t1(t,e);return ty(this,this.#u,s,r,n)}replaceVersion({document:e,publishedId:t,releaseId:r},n){let s=t3("replaceVersion",{document:e,publishedId:t,releaseId:r}),i={...e,_id:s};return tg(this,this.#u,i,n)}unpublishVersion({releaseId:e,publishedId:t},r){let n=(0,ed.ct)(t,e);return tv(this,this.#u,n,t,r)}mutate(e,t){return tm(this,this.#u,e,t)}patch(e,t){return new e9(e,t,this)}transaction(e){return new tr(e,this)}action(e,t){return tb(this,this.#u,e,t)}request(e){return tT(this,this.#u,e)}getUrl(e,t){return t$(this,e,t)}getDataUrl(e,t){return tI(this,e,t)}}class t5{assets;datasets;live;mediaLibrary;projects;users;agent;releases;observable;#c;#u;listen=tL;constructor(e,t=eJ){this.config(t),this.#u=e,this.assets=new tD(this,this.#u),this.datasets=new tJ(this,this.#u),this.live=new tH(this),this.mediaLibrary={video:new tY(this,this.#u)}
13,this.projects=new tZ(this,this.#u),this.users=new t9(this,this.#u),this.agent={action:new tA(this,this.#u)},this.releases=new t4(this,this.#u),this.observable=new t7(e,t)}clone(){return new t5(this.#u,this.config())}config(e){if(void 0===e)return{...this.#c};if(this.#c&&!1===this.#c.allowReconfigure)throw Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),this.#c=eY(e,this.#c||{}),this}withConfig(e){let t=this.config();return new t5(this.#u,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof e?.stega?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,r){return(0,V.s)(to(this,this.#u,this.#c.stega,e,t,r))}getDocument(e,t){if(t?.includeAllVersions===!0)return(0,V.s)(ta(this,this.#u,e,{...t,includeAllVersions:!0}));let r={signal:t?.signal,tag:t?.tag,releaseId:t?.releaseId,...t&&"includeAllVersions"in t?{includeAllVersions:!1}:{}};return(0,V.s)(ta(this,this.#u,e,r))}getDocuments(e,t){return(0,V.s)(tu(this,this.#u,e,t))}create(e,t){return(0,V.s)(t_(this,this.#u,e,"create",t))}createIfNotExists(e,t){return(0,V.s)(tl(this,this.#u,e,t))}createOrReplace(e,t){return(0,V.s)(td(this,this.#u,e,t))}createVersion({document:e,publishedId:t,releaseId:r,baseId:n,ifBaseRevisionId:s},i){if(!e)return(0,ee._)(tp(this,this.#u,t,n,r,s,i));let o=t3("createVersion",{document:e,publishedId:t,releaseId:r}),a={...e,_id:o},u=t||(0,ed.IM)(e._id);return(0,ee._)(th(this,this.#u,a,u,i))}delete(e,t){return(0,V.s)(tf(this,this.#u,e,t))}discardVersion({releaseId:e,publishedId:t},r,n){let s=t1(t,e);return(0,V.s)(ty(this,this.#u,s,r,n))}replaceVersion({document:e,publishedId:t,releaseId:r},n){let s=t3("replaceVersion",{document:e,publishedId:t,releaseId:r}),i={...e,_id:s};return(0,ee._)(tg(this,this.#u,i,n))}unpublishVersion({releaseId:e,publishedId:t},r){let n=(0,ed.ct)(t,e);return(0,V.s)(tv(this,this.#u,n,t,r))}mutate(e,t){return(0,V.s)(tm(this,this.#u,e,t))}patch(e,t){return new e7(e,t,this)}transaction(e){return new tt(e,this)}action(e,t){return(0,V.s)(tb(this,this.#u,e,t))}request(e){return(0,V.s)(tT(this,this.#u,e))}dataRequest(e,t,r){return(0,V.s)(tw(this,this.#u,e,t,r))}getUrl(e,t){return t$(this,e,t)}getDataUrl(e,t){return tI(this,e,t)}}let re=function(e,t){return{requester:eE(e),createClient:r=>{let n=eE(e,{ignoreWarnings:r.ignoreWarnings});return new t((e,t)=>(t||n)({maxRedirects:0,maxRetries:r.maxRetries,retryDelay:r.retryDelay,lineage:r.lineage,...e}),r)}}}([],t5),rt=(re.requester,re.createClient)},5124:(e,t,r)=>{r.d(t,{p:()=>i});var n=r(55484),s=r(33272);function i(e,t){return(0,n.N)(function(r,n){var i=0;r.subscribe((0,s._)(n,function(r){return e.call(t,r,i++)&&n.next(r)}))})}},5150:(e,t,r)=>{r.d(t,{x:()=>o});var n=r(26993),s=r(55844),i=r(9862);function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0,n.K)()((0,i.H)(e,(0,s.lI)(e)))}},5363:(e,t,r)=>{r.d(t,{J:()=>o});var n=r(19410);let s=n.createContext(!0);function i(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}function o(e){let t=n.useRef(i);return n.useInsertionEffect(()=>{t.current=e},[e]),(...e)=>((()=>{try{return n.use(s)}catch{return!1}})()&&i(),(0,t.current)(...e))}},6171:(e,t,r)=>{r.d(t,{_:()=>s});var n=r(55484);function s(e,t){return void 0===t&&(t=0),(0,n.N)(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}},6325:(e,t,r)=>{r.d(t,{U:()=>i});var n=r(29844),s=r(62707);function i(e){return void 0===e&&(e=1/0),(0,n.Z)(s.D,e)}},8682:(e,t,r)=>{r.d(t,{t:()=>i});var n=r(85473),s=r(23537);function i(e,t,r){var i,o,a,u,c=!1;return e&&"object"==typeof e?(u=void 0===(i=e.bufferSize)?1/0:i,t=void 0===(o=e.windowTime)?1/0:o,c=void 0!==(a=e.refCount)&&a,r=e.scheduler):u=null!=e?e:1/0,(0,s.u)({connector:function(){return new n.m(u,t,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:c})}},9838:(e,t,r)=>{r.d(t,{$:()=>n});var n={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},9862:(e,t,r)=>{r.d(t,{H:()=>i});var n=r(58319),s=r(68326);function i(e,t){return t?(0,n.c)(e,t):(0,s.Tg)(e)}},10539:(e,t,r)=>{r.d(t,{q:()=>o});var n=r(33273),s=r(1759),i=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerA
13ctionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=s.U.now,e}(),o=function(e){function t(t,r){void 0===r&&(r=i.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return(0,n.C6)(t,e),t.prototype.flush=function(e){var t,r=this.actions;if(this._active)return void r.push(e);this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,t){for(;e=r.shift();)e.unsubscribe();throw t}},t}(i)},11368:(e,t,r)=>{r.d(t,{f:()=>s});var n=r(33273),s={setTimeout:function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=s.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,(0,n.fX)([e,t],(0,n.zs)(r))):setTimeout.apply(void 0,(0,n.fX)([e,t],(0,n.zs)(r)))},clearTimeout:function(e){var t=s.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0}},12845:(e,t,r)=>{r.d(t,{v:()=>n});function n(e){return e instanceof Date&&!isNaN(e)}},13073:(e,t,r)=>{r.d(t,{T:()=>n});function n(e){return"function"==typeof e}},14166:(e,t,r)=>{r.d(t,{y:()=>s});var n=r(13073);function s(e){return(0,n.T)(null==e?void 0:e.then)}},15290:(e,t,r)=>{r.d(t,{h:()=>u});var n=r(6325),s=r(68326),i=r(43459),o=r(55844),a=r(9862);function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=(0,o.lI)(e),u=(0,o.R0)(e,1/0);return e.length?1===e.length?(0,s.Tg)(e[0]):(0,n.U)(u)((0,a.H)(e,r)):i.w}},20275:(e,t,r)=>{r.d(t,{of:()=>i});var n=r(55844),s=r(9862);function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=(0,n.lI)(e);return(0,s.H)(e,r)}},20615:(e,t,r)=>{r.d(t,{M:()=>a});var n=r(13073),s=r(55484),i=r(33272),o=r(62707);function a(e,t,r){var a=(0,n.T)(e)||t||r?{next:e,error:t,complete:r}:e;return a?(0,s.N)(function(e,t){null==(r=a.subscribe)||r.call(a);var r,n=!0;e.subscribe((0,i._)(t,function(e){var r;null==(r=a.next)||r.call(a,e),t.next(e)},function(){var e;n=!1,null==(e=a.complete)||e.call(a),t.complete()},function(e){var r;n=!1,null==(r=a.error)||r.call(a,e),t.error(e)},function(){var e,t;n&&(null==(e=a.unsubscribe)||e.call(a)),null==(t=a.finalize)||t.call(a)}))}):o.D}},20836:(e,t,r)=>{r.d(t,{G:()=>n});var n=(0,r(61499).L)(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})},21143:(e,t,r)=>{r.d(t,{l:()=>i});var n=r(79728),s=r(13073);function i(e){return(0,s.T)(e[n.s])}},23537:(e,t,r)=>{r.d(t,{u:()=>u});var n=r(33273),s=r(68326),i=r(40182),o=r(72415),a=r(55484);function u(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new i.B}:t,n=e.resetOnError,u=void 0===n||n,l=e.resetOnComplete,d=void 0===l||l,h=e.resetOnRefCountZero,p=void 0===h||h;return function(e){var t,n,i,l=0,h=!1,f=!1,y=function(){null==n||n.unsubscribe(),n=void 0},g=function(){y(),t=i=void 0,h=f=!1},v=function(){var e=t;g(),null==e||e.unsubscribe()};return(0,a.N)(function(e,a){l++,f||h||y();var m=i=null!=i?i:r();a.add(function(){0!=--l||f||h||(n=c(v,p))}),m.subscribe(a),!t&&l>0&&(t=new o.Ms({next:function(e){return m.next(e)},error:function(e){f=!0,y(),n=c(g,u,e),m.error(e)},complete:function(){h=!0,y(),n=c(g,d),m.complete()}}),(0,s.Tg)(e).subscribe(t))})(e)}}function c(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(!0===t)return void e();if(!1!==t){var a=new o.Ms({next:function(){a.unsubscribe(),e()}});return(0,s.Tg)(t.apply(void 0,(0,n.fX)([],(0,n.zs)(r)))).subscribe(a)}}},25684:(e,t,r)=>{r.d(t,{m:()=>i});var n=r(9838),s=r(11368);function i(e){s.f.setTimeout(function(){var t=n.$.onUnhandledError;if(t)t(e);else throw e})}},26993:(e,t,r)=>{r.d(t,{K:()=>s});var n=r(6325);function s(){return(0,n.U)(1)}},28052:(e,t,r)=>{r.d(t,{P:()=>p,z:()=>h});var n=r(73621),s=r(60243),i=r(9862),o=r(62707),a=r(92552),u=r(55844),c=r(32674),l=r(33272),d=r(29245);function h(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=(0,u.lI)(e),l=(0,u.ms)(e),d=(0,s.D)(e),h=d.args,f=d.keys;if(0===h.length)return(0,i.H)([],r);var y=new n.c(p(h,r,f?function(e){return(0,c.e)(f,e)}:o.D));return l?y.pipe((0,a.I)(l)):y}function p(e,t,r){return void 0===r&&(r=o.D),function(n){f(t,function(){for(var s=e.length,o=Array(s),a=s,u=s,c=function(s){f(t,function(){var c=(0,i.H)(e[s],t),d=!1;c.subscribe((0,l._)(n,function(e){o[s]=e,!d&&(d=!0,u--),u||n.next(r(o.slice()))},function(){--a||n.complete()}
13))},n)},d=0;d<s;d++)c(d)},n)}}function f(e,t,r){e?(0,d.N)(r,e,t):t()}},29245:(e,t,r)=>{r.d(t,{N:()=>n});function n(e,t,r,n,s){void 0===n&&(n=0),void 0===s&&(s=!1);var i=t.schedule(function(){r(),s?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!s)return i}},29580:(e,t,r)=>{r.d(t,{DT:()=>h,mj:()=>function e({schemas:t,actors:r,actions:i,guards:o,delays:a}){return{assign:s.a,sendTo:d.s,raise:n.r,log:d.l,cancel:n.a,stopChild:n.s,enqueueActions:d.e,emit:d.a,spawnChild:n.b,createStateConfig:e=>e,createAction:e=>e,createMachine:e=>new l({...e,schemas:t},{actors:r,actions:i,guards:o,delays:a}),extend:n=>e({schemas:t,actors:r,actions:{...i,...n.actions},guards:{...o,...n.guards},delays:{...a,...n.delays}})}}}),r(61477);var n=r(38463),s=r(82232);let i=new WeakMap;function o(e,t,r){let n=i.get(e);return n?t in n||(n[t]=r()):(n={[t]:r()},i.set(e,n)),n[t]}let a={},u=e=>"string"==typeof e?{type:e}:"function"==typeof e?"resolve"in e?{type:e.type}:{type:e.name}:e;class c{constructor(e,t){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=t._parent,this.key=t._key,this.machine=t._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(n.S),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?(0,n.v)(this.config.states,(e,t)=>new c(e,{_parent:this,_key:t,_machine:this.machine})):a,"compound"===this.type&&!this.config.initial)throw Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=!0===this.config.history?"shallow":this.config.history||!1,this.entry=(0,n.t)(this.config.entry).slice(),this.exit=(0,n.t)(this.config.exit).slice(),this.meta=this.config.meta,this.output="final"!==this.type&&this.parent?void 0:this.config.output,this.tags=(0,n.t)(e.tags).slice()}_initialize(){this.transitions=(0,n.w)(this),this.config.always&&(this.always=(0,n.x)(this.config.always).map(e=>(0,n.y)(this,n.N,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.t
13ype,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(u),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(u),eventType:null})}:void 0,history:this.history,states:(0,n.v)(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(u)})),entry:this.entry.map(u),exit:this.exit.map(u),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return o(this,"invoke",()=>(0,n.t)(this.config.invoke).map((e,t)=>{let{src:r,systemId:s}=e,i=e.id??(0,n.B)(this.id,t),o="string"==typeof r?r:`xstate.invoke.${(0,n.B)(this.id,t)}`;return{...e,src:o,id:i,systemId:s,toJSON(){let{onDone:t,onError:r,...n}=e;return{...n,type:"xstate.invoke",src:o,id:i}}}}))}get on(){return o(this,"on",()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,r])=>(e[t]=e[t]||[],e[t].push(r),e),{}))}get after(){return o(this,"delayedTransitions",()=>(0,n.C)(this))}get initial(){return o(this,"initial",()=>(0,n.D)(this,this.config.initial))}next(e,t){let r,s=t.type,i=[];for(let a of o(this,`candidates-${s}`,()=>(0,n.E)(this,s))){let{guard:o}=a,u=e.context,c=!1;try{c=!o||(0,n.z)(o,u,t,e)}catch(t){let e="string"==typeof o?o:"object"==typeof o?o.type:void 0;throw Error(`Unable to evaluate guard ${e?`'${e}' `:""}in transition for event '${s}' in state node '${this.id}':
14${t.message}`)}if(c){i.push(...a.actions),r=a;break}}return r?[r]:void 0}get events(){return o(this,"events",()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let r of Object.keys(e)){let n=e[r];if(n.states)for(let e of n.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){return Array.from(new Set(Object.keys(Object.fromEntries(this.transitions)).filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter)))))}}class l{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new c(e,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:r,actors:n,delays:s}=this.implementations;return new l(this.config,{actions:{...t,...e.actions},guards:{...r,...e.guards},actors:{...n,...e.actors},delays:{...s,...e.delays}})}resolveState(e){let t=(0,n.F)(this.root,e.value),r=(0,n.G)((0,n.j)(this.root,t));return(0,n.H)({_nodes:[...r],context:e.context||{},children:{},status:(0,n.I)(r,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,r){return(0,n.J)(e,t,r,[]).snapshot}microstep(e,t,r){return(0,n.J)(e,t,r,[]).microstates}getTransitionData(e,t){return(0,n.K)(this.root,e.value,e,t)||[]}getPreInitialState(e,t,r){let{context:i}=this.config,o=(0,n.H)({context:"function"!=typeof i&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof i?(0,n.L)(o,t,e,[(0,s.a)(({spawn:e,event:t,self:r})=>i({spawn:e,input:t.input,self:r}))],r,void 0):o}getInitialSnapshot(e,t){let r=(0,n.M)(t),s=[],i=this.getPreInitialState(e,r,s),o=(0,n.O)([{target:[...(0,n.P)(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],i,e,r,!0,s),{snapshot:a}=(0,n.J)(o,r,e,s);return a}start(e){Object.values(e.children).forEach(e=>{"active"===e.getSnapshot().status&&e.start()})}getStateNodeById(e){let t=(0,n.Q)(e),r=t.slice(1),s=(0,n.R)(t[0])?t[0].slice(1):t[0],i=this.idMap.get(s);if(!i)throw Error(`Child state node '#${s}' does not exist on machine '${this.id}'`);return(0,n.T)(i,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return(0,n.U)(e,t)}restoreSnapshot(e,t){let r={},s=e.children;
14Object.keys(s).forEach(e=>{let i=s[e],o=i.snapshot,a=i.src,u="string"==typeof a?(0,n.V)(this,a):a;if(!u)return;let c=(0,n.c)(u,{id:e,parent:t.self,syncSnapshot:i.syncSnapshot,snapshot:o,src:a,systemId:i.systemId});r[e]=c});let i=function(e,t){if(!t||"object"!=typeof t)return{};let r={};for(let n in t)for(let s of t[n]){let t=function(e,t){if(t instanceof c)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}(e,s);t&&(r[n]??=[],r[n].push(t))}return r}(this.root,e.historyValue),o=(0,n.H)({...e,children:r,_nodes:Array.from((0,n.G)((0,n.j)(this.root,e.value))),historyValue:i},this),a=new Set;return!function e(t,r){if(!a.has(t))for(let s in a.add(t),t){let i=t[s];if(i&&"object"==typeof i){if("xstate$$type"in i&&i.xstate$$type===n.$){t[s]=r[i.id];continue}e(i,r)}}}(o.context,r),o}}var d=r(74061);function h(e,t){let r=(0,n.t)(t);if(!r.some(t=>(0,n.m)(e.type,t))){let t=1===r.length?`type matching "${r[0]}"`:`one of types matching "${r.join('", "')}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}},29844:(e,t,r)=>{r.d(t,{Z:()=>function e(t,r,u){return(void 0===u&&(u=1/0),(0,a.T)(r))?e(function(e,i){return(0,n.T)(function(t,n){return r(e,t,i,n)})((0,s.Tg)(t(e,i)))},u):("number"==typeof r&&(u=r),(0,i.N)(function(e,r){return(0,o.h)(e,r,t,u)}))}});var n=r(86288),s=r(68326),i=r(55484),o=r(66612),a=r(13073)},32517:(e,t,r)=>{r.d(t,{W:()=>function e(t){return(0,i.N)(function(r,i){var o,a=null,u=!1;a=r.subscribe((0,s._)(i,void 0,void 0,function(s){o=(0,n.Tg)(t(s,e(t)(r))),a?(a.unsubscribe(),a=null,o.subscribe(i)):u=!0})),u&&(a.unsubscribe(),a=null,o.subscribe(i))})}});var n=r(68326),s=r(33272),i=r(55484)},32674:(e,t,r)=>{r.d(t,{e:()=>n});function n(e,t){return e.reduce(function(e,r,n){return e[r]=t[n],e},{})}},33272:(e,t,r)=>{r.d(t,{H:()=>i,_:()=>s});var n=r(33273);function s(e,t,r,n,s){return new i(e,t,r,n,s)}var i=function(e){function t(t,r,n,s,i,o){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=o,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=s?function(e){try{s(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(0,n.C6)(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)||t.call(this)}},t}(r(72415).vU)},33273:(e,t,r)=>{r.d(t,{AQ:()=>p,C6:()=>s,Cl:()=>i,Ju:()=>u,N3:()=>h,YH:()=>a,fX:()=>d,gz:()=>l,sH:()=>o,xN:()=>f,zs:()=>c});var n=function(e,t){return(n=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])})(e,t)};function s(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};function o(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}u((n=n.apply(e,t||[])).next())})}function a(e,t){var r,n,s,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){var c=[a,u];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(s=2&c[0]?n.return:c[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,c[1])).done)return s;switch(n=0,s&&(c=[2&c[0],s.value]),c[0]){case 0:case 1:s=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!s||c[1]>s[0]&&c[1]<s[3])){i.label=c[1];break}if(6===c[0]&&i.label<s[1]){i.label=s[1],s=c;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(c);break}s[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=s=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
14if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,s,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){s={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(s)throw s.error}}return o}function l(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e}function d(e,t,r){if(r||2==arguments.length)for(var n,s=0,i=t.length;s<i;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}function h(e){return this instanceof h?(this.v=e,this):new h(e)}function p(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,s=r.apply(e,t||[]),i=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function o(e,t){s[e]&&(n[e]=function(t){return new Promise(function(r,n){i.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=s[e](t)).value instanceof h?Promise.resolve(r.value.v).then(u,c):l(i[0][2],r)}catch(e){l(i[0][3],e)}}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function f(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=u(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,s){var i,o,a;i=n,o=s,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:a})},o)})}}}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError},34265:(e,t,r)=>{r.d(t,{s:()=>o});var n=r(43459),s=r(55484),i=r(33272);function o(e){return e<=0?function(){return n.w}:(0,s.N)(function(t,r){var n=0;t.subscribe((0,i._)(r,function(t){++n<=e&&(r.next(t),e<=n&&r.complete())}))})}},34792:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(73621),s=r(13073);function i(e){return!!e&&(e instanceof n.c||(0,s.T)(e.lift)&&(0,s.T)(e.subscribe))}},35489:(e,t,r)=>{r.d(t,{T:()=>s});var n=r(13073);function s(e){return Symbol.asyncIterator&&(0,n.T)(null==e?void 0:e[Symbol.asyncIterator])}},36449:(e,t,r)=>{r.d(t,{F:()=>s,m:()=>i});var n=r(62707);function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(e)}function i(e){return 0===e.length?n.D:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}},38463:(e,t,r)=>{r.d(t,{$:()=>C,B:()=>E,C:()=>en,D:()=>eo,E:()=>er,F:()=>eI,G:()=>Q,H:()=>eO,I:()=>ee,J:()=>eE,K:()=>function e(t,r,n,s){if("string"==typeof r){let e=ed(t,r).next(n,s);return e&&e.length?e:t.next(n,s)}if(1===Object.keys(r).length){let i=Object.keys(r),o=e(ed(t,i[0]),r[i[0]],n,s);return o&&o.length?o:t.next(n,s)}let i=[];for(let o of Object.keys(r)){let a=r[o];if(!a)continue;let u=e(ed(t,o),a,n,s);u&&i.push(...u)}return i.length?i:t.next(n,s)},L:()=>ex,M:()=>d,N:()=>i,O:()=>eb,P:()=>el,Q:()=>f,R:()=>et,S:()=>s,T:()=>eh,U:()=>eA,V:()=>S,W:()=>a,X:()=>u,Y:()=>l,Z:()=>R,_:()=>ej,a:()=>D,b:()=>U,c:()=>j,e:()=>W,j:()=>ep,m:()=>T,n:()=>H,q:()=>x,r:()=>eM,s:()=>L,t:()=>v,v:()=>g,w:()=>ei,x:()=>w,y:()=>es,z:()=>J});class n{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}this._current=t,this._last=t,this._active&&this.flush()}flush(){for(;this._current;){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}}let s=".",i="",o="xstate.init",a="xstate.error",u="xstate.stop";function c(e,t){return{type:`xstate.done.state.${e}`,output:t}}function l(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}
14function d(e){return{type:o,input:e}}function h(e){setTimeout(()=>{throw e})}let p="function"==typeof Symbol&&Symbol.observable||"@@observable";function f(e){if(b(e))return e;let t=[],r="";for(let n=0;n<e.length;n++){switch(e.charCodeAt(n)){case 92:r+=e[n+1],n++;continue;case 46:t.push(r),r="";continue}r+=e[n]}return t.push(r),t}function y(e){var t;return(t=e)&&"object"==typeof t&&"machine"in t&&"value"in t?e.value:"string"!=typeof e?e:function(e){if(1===e.length)return e[0];let t={},r=t;for(let t=0;t<e.length-1;t++)if(t===e.length-2)r[e[t]]=e[t+1];else{let n=r;r={},n[e[t]]=r}return t}(f(e))}function g(e,t){let r={},n=Object.keys(e);for(let s=0;s<n.length;s++){let i=n[s];r[i]=t(e[i],i,e,s)}return r}function v(e){var t;return void 0===e?[]:b(t=e)?t:[t]}function m(e,t,r,n){return"function"==typeof e?e({context:t,event:r,self:n}):e}function b(e){return Array.isArray(e)}function w(e){var t;return(b(t=e)?t:[t]).map(e=>void 0===e||"string"==typeof e?{target:e}:e)}function _(e){if(void 0!==e&&""!==e)return v(e)}function x(e,t,r){let n="object"==typeof e,s=n?e:void 0;return{next:(n?e.next:e)?.bind(s),error:(n?e.error:t)?.bind(s),complete:(n?e.complete:r)?.bind(s)}}function E(e,t){return`${t}.${e}`}function S(e,t){let r=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!r)return e.implementations.actors[t];let[,n,s]=r,i=e.getStateNodeById(s).config.invoke;return(Array.isArray(i)?i[n]:i).src}function T(e,t){if(t===e||"*"===t)return!0;if(!t.endsWith(".*"))return!1;let r=t.split("."),n=e.split(".");for(let e=0;e<r.length;e++){let t=r[e],s=n[e];if("*"===t)return e===r.length-1;if(t!==s)return!1}return!0}function I(e,t){return`${e.sessionId}.${t}`}let $=0,q=!1,C=1,R=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({}),k={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class O{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new n(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=R.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let r={...k,...t},{clock:s,logger:i,parent:o,syncSnapshot:a,id:u,systemId:c,inspect:l}=r;this.system=o?o.system:function(e,t){let r=new Map,n=new Map,s=new WeakMap,i=new Set,o={},{clock:a,logger:u}=t,c={schedule:(e,t,r,n,s=Math.random().toString(36).slice(2))=>{let i={source:e,target:t,event:r,delay:n,id:s,startedAt:Date.now()},u=I(e,s);l._snapshot._scheduledEvents[u]=i;let c=a.setTimeout(()=>{delete o[u],delete l._snapshot._scheduledEvents[u],l._relay(e,t,r)},n);o[u]=c},cancel:(e,t)=>{let r=I(e,t),n=o[r];delete o[r],delete l._snapshot._scheduledEvents[r],void 0!==n&&a.clearTimeout(n)},cancelAll:e=>{for(let t in l._snapshot._scheduledEvents){let r=l._snapshot._scheduledEvents[t];r.source===e&&c.cancel(e,r.id)}}},l={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${$++}`,_register:(e,t)=>(r.set(e,t),e),_unregister:e=>{r.delete(e.sessionId);let t=s.get(e);void 0!==t&&(n.delete(t),s.delete(e))},get:e=>n.get(e),getAll:()=>Object.fromEntries(n.entries()),_set:(e,t)=>{let r=n.get(e);if(r&&r!==t)throw Error(`Actor with system ID '${e}' already exists.`);n.set(e,t),s.set(t,e)},inspect:e=>{let t=x(e);return i.add(t),{unsubscribe(){i.delete(t)}}},_sendInspectionEvent:t=>{if(!i.size)return;let r={...t,rootId:e.sessionId};i.forEach(e=>e.next?.(r))},_relay:(e,t,r)=>{l._sendInspectionEvent({type:"@xstate.event",sourceRef:e,actorRef:t,event:r}),t._send(r)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...l._snapshot._scheduledEvents}}),start:()=>{let e=l._snapshot._scheduledEvents;for(let t in l._snapshot._scheduledEvents={},e){let{source:r,target:n,event:s,delay:i,id:o}=e[t];c.schedule(r,n,s,i,o)}},_clock:a,_logger:u};return l}(this,{clock:s,logger:i}),l&&!o&&this.system.inspect(x(l)),this.sessionId=this.system._bookId(),this.id=u??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=o,this._syncSnapshot=a,this.options=r,this.src=r.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:e=>{this._deferred.push(e)},system:this.system,stopChild:e=>
14{if(e._parent!==this)throw Error(`Cannot stop child actor ${e.id} of ${this.id} because it is not a child`);e._stop()},emit:e=>{let t=this.eventListeners.get(e.type),r=this.eventListeners.get("*");if(t||r)for(let n of[...t?t.values():[],...r?r.values():[]])try{n(e)}catch(e){h(e)}},actionExecutor:e=>{let t=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:e.type,params:e.params}}),!e.exec)return;let t=q;try{q=!0,e.exec(e.info,e.params)}finally{q=t}};this._processingStatus===R.Running?t():this._deferred.push(t)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this.systemId=c,this.system._set(c,this)),this._initState(t?.snapshot??t?.state),c&&"active"!==this._snapshot.status&&this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(e){this._snapshot={status:"error",output:void 0,error:e}}}update(e,t){let r;for(this._snapshot=e;r=this._deferred.shift();)try{r()}catch(t){this._deferred.length=0,this._snapshot={...e,status:"error",error:t}}switch(this._snapshot.status){case"active":for(let t of this.observers)try{t.next?.(e)}catch(e){h(e)}break;case"done":var n;for(let t of this.observers)try{t.next?.(e)}catch(e){h(e)}this._stopProcedure(),this._complete(),this._doneEvent=(n=this.id,{type:`xstate.done.actor.${n}`,output:this._snapshot.output,actorId:n}),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error)}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:t,snapshot:e})}subscribe(e,t,r){let n=x(e,t,r);if(this._processingStatus!==R.Stopped)this.observers.add(n);else switch(this._snapshot.status){case"done":try{n.complete?.()}catch(e){h(e)}break;case"error":{let e=this._snapshot.error;if(n.error)try{n.error(e)}catch(e){h(e)}else h(e)}}return{unsubscribe:()=>{this.observers.delete(n)}}}on(e,t){let r=this.eventListeners.get(e);r||(r=new Set,this.eventListeners.set(e,r));let n=t.bind(void 0);return r.add(n),{unsubscribe:()=>{r.delete(n)}}}start(){if(this._processingStatus===R.Running)return this;this._syncSnapshot&&this.subscribe({next:e=>{"active"===e.status&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:e})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=R.Running;let e=d(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(e){return this._snapshot={...this._snapshot,status:"error",error:e},this._error(e),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let t,r;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(e){r={err:e}}if(r){let{err:e}=r;this._snapshot={...this._snapshot,status:"error",error:e},this._error(e);return}this.update(t,e),e.type===u&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===R.Stopped||((this.mailbox.clear(),this._processingStatus===R.NotStarted)?this._processingStatus=R.Stopped:this.mailbox.enqueue({type:u})),this}stop(){if(this._parent)throw Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(e){h(e)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||h(e),this.eventListeners.clear();return}let t=!1;for(let r of this.observers){let n=r.error;t||=!n;try{n?.(e)}catch(e){h(e)}}this.observers.clear(),this.eventListeners.clear(),t&&h(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,l(this.id,e))}_stopProcedure(){return this._processingStatus!==R.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new n(this._process.bind(this)),this._processingStatus=R.Stopped,this.system._unregister(this)),this}_send(e){this._processingStatus!==R.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;e&&("function"==typeof e?e:e=>{if("undefined"==typeof window)return;let t=function(){let e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r.g?r.g:void 0;if(e.__xstate__)return e.__xstate__}();t&&t.register(e)})(this)}toJSON(){return{xstate$$type:C,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[p](){return this}getSnapshot(){return this._snapshot}}function j(e,...[t]){return new O(e,t)}function A(e,t,r,n,{sendId:s}){return[t,{sendId:"function"==typeof s?s(r,n):s},void 0]}function P(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function D(e){function t(e,t){}return t.type="xstate.cancel",t.sendId=e,t.resolve=A,t.execute=P,t}function M(e,t,r,n,{id:s,systemId:i,src:o,input:a,syncSnapshot:u}){let c,l,d="string"==typeof o?S(t.machine,o):o,h="function"==typeof s?s(r):s;return d&&(l="function"==typeof a?a({context:t.context,event:r.event,self:e.self}):a,c=j(d,{id:h,src:o,parent:e.self,syncSnapshot:u,systemId:i,input:l})),[ej(t,{children:{...t.children,[h]:c}}),{id:s,systemId:i,actorRef:c,src:o,input:l},void 0]}function N(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==R.Stopped&&t.start()})}function U(...[e,{id:t,systemId:r,input:n,syncSnapshot:s=!1}={}]){function i(e,t){}return i.type="xstate.spawnChild",i.id=t,i.systemId=r,i.src=e,i.input=n,i.syncSnapshot=s,i.resolve=M,i.execute=N,i}function F(e,t,r,n,{actorRef:s}){let i="function"==typeof s?s(r,n):s,o="string"==typeof i?t.children[i]:i,a=t.children;return o&&(a={...a},delete a[o.id]),[ej(t,{children:a}),o,void 0]}function z(e,t){if(t){if(!function e(t,r){let n=r.getSnapshot();if(n&&"children"in n)for(let r of Object.values(n.children))e(t,r);t.system._unregister(r)}(e,t),t._processingStatus!==R.Running)return void e.stopChild(t);e.defer(()=>{e.stopChild(t)})}}function L(e){function t(e,t){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=F,t.execute=z,t}function V(e,{context:t,event:r},{guards:n}){return!J(n[0],t,r,e)}function H(e){function t(e,t){return!1}return t.check=V,t.guards=[e],t}function B(e,{context:t,event:r},{guards:n}){return n.every(n=>J(n,t,r,e))}function W(e){function t(e,t){return!1}return t.check=B,t.guards=e,t}function J(e,t,r,n){let{machine:s}=n,i="function"==typeof e,o=i?e:s.implementations.guards["string"==typeof e?e:e.type];if(!i&&!o)throw Error(`Guard '${"string"==typeof e?e:e.type}' is not implemented.'.`);if("function"!=typeof o)return J(o,t,r,n);let a={context:t,event:r},u=i||"string"==typeof e?void 0:"params"in e?"function"==typeof e.params?e.params({context:t,event:r}):e.params:void 0;return"check"in o?o.check(n,a,o):o(a,u)}function X(e){return"atomic"===e.type||"final"===e.type}function G(e){return Object.values(e.states).filter(e=>"history"!==e.type)}function Y(e,t){let r=[];if(t===e)return r;let n=e.parent;for(;n&&n!==t;)r.push(n),n=n.parent;return r}function Q(e){let t=new Set(e),r=K(t);for(let e of t)if("compound"!==e.type||r.get(e)&&r.get(e).length){if("parallel"===e.type){for(let r of G(e))if("history"!==r.type&&!t.has(r))for(let e of ec(r))t.add(e)}}
14else ec(e).forEach(e=>t.add(e));for(let e of t){let r=e.parent;for(;r;)t.add(r),r=r.parent}return t}function K(e){let t=new Map;for(let r of e)t.has(r)||t.set(r,[]),r.parent&&(t.has(r.parent)||t.set(r.parent,[]),t.get(r.parent).push(r));return t}function Z(e,t){return function e(t,r){let n=r.get(t);if(!n)return{};if("compound"===t.type){let e=n[0];if(!e)return{};if(X(e))return e.key}let s={};for(let t of n)s[t.key]=e(t,r);return s}(e,K(Q(t)))}function ee(e,t){return"compound"===t.type?G(t).some(t=>"final"===t.type&&e.has(t)):"parallel"===t.type?G(t).every(t=>ee(e,t)):"final"===t.type}let et=e=>"#"===e[0];function er(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(e=>T(t,e)).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))}function en(e){let t=e.config.after;return t?Object.keys(t).flatMap(r=>{let n=t[r],s=Number.isNaN(+r)?r:+r,i=(t=>{var r;let n=(r=e.id,{type:`xstate.after.${t}.${r}`}),s=n.type;return e.entry.push(eM(n,{id:s,delay:t})),e.exit.push(D(s)),s})(s);return v("string"==typeof n?{target:n}:n).map(e=>({...e,event:i,delay:s}))}).map(t=>{let{delay:r}=t;return{...es(e,t.event,t),delay:r}}):[]}function es(e,t,r){let n=_(r.target),i=r.reenter??!1,o=function(e,t){if(void 0!==t)return t.map(t=>{if("string"!=typeof t)return t;if(et(t))return e.machine.getStateNodeById(t);let r=t[0]===s;if(r&&!e.parent)return eh(e,t.slice(1));let n=r?e.key+t:t;if(e.parent)try{return eh(e.parent,n)}catch(t){throw Error(`Invalid transition definition for state node '${e.id}':
15${t.message}`)}throw Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}(e,n),a={...r,actions:v(r.actions),guard:r.guard,target:o,source:e,reenter
15:i,eventType:t,toJSON:()=>({...a,source:`#${e.id}`,target:o?o.map(e=>`#${e.id}`):void 0})};return a}function ei(e){let t=new Map;if(e.config.on)for(let r of Object.keys(e.config.on)){if(r===i)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let n=e.config.on[r];t.set(r,w(n).map(t=>es(e,r,t)))}if(e.config.onDone){let r=`xstate.done.state.${e.id}`;t.set(r,w(e.config.onDone).map(t=>es(e,r,t)))}for(let r of e.invoke){if(r.onDone){let n=`xstate.done.actor.${r.id}`;t.set(n,w(r.onDone).map(t=>es(e,n,t)))}if(r.onError){let n=`xstate.error.actor.${r.id}`;t.set(n,w(r.onError).map(t=>es(e,n,t)))}if(r.onSnapshot){let n=`xstate.snapshot.${r.id}`;t.set(n,w(r.onSnapshot).map(t=>es(e,n,t)))}}for(let r of e.after){let e=t.get(r.eventType);e||(e=[],t.set(r.eventType,e)),e.push(r)}return t}function eo(e,t){let r="string"==typeof t?e.states[t]:t?e.states[t.target]:void 0;if(!r&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let n={source:e,actions:t&&"string"!=typeof t?v(t.actions):[],eventType:null,reenter:!1,target:r?[r]:[],toJSON:()=>({...n,source:`#${e.id}`,target:r?[`#${r.id}`]:[]})};return n}function ea(e){let t=_(e.config.target);return t?{target:t.map(t=>"string"==typeof t?eh(e.parent,t):t)}:e.parent.initial}function eu(e){return"history"===e.type}function ec(e){let t=el(e);for(let r of t)for(let n of Y(r,e))t.add(n);return t}function el(e){let t=new Set;return!function e(r){if(!t.has(r)){if(t.add(r),"compound"===r.type)e(r.initial.target[0]);else if("parallel"===r.type)for(let t of G(r))e(t)}}(e),t}function ed(e,t){if(et(t))return e.machine.getStateNodeById(t);if(!e.states)throw Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);let r=e.states[t];if(!r)throw Error(`Child state '${t}' does not exist on '${e.id}'`);return r}function eh(e,t){if("string"==typeof t&&et(t))try{return e.machine.getStateNodeById(t)}catch{}let r=f(t).slice(),n=e;for(;r.length;){let e=r.shift();if(!e.length)break;n=ed(n,e)}return n}function ep(e,t){if("string"==typeof t){let r=e.states[t];if(!r)throw Error(`State '${t}' does not exist on '${e.id}'`);return[e,r]}let r=Object.keys(t),n=r.map(t=>ed(e,t)).filter(Boolean);return[e.machine.root,e].concat(n,r.reduce((r,n)=>{let s=ed(e,n);if(!s)return r;let i=ep(s,t[n]);return r.concat(i)},[]))}function ef(e,t){let r=e;for(;r.parent&&r.parent!==t;)r=r.parent;return r.parent===t}function ey(e,t,r){let n=new Set;for(let s of e){let e=!1,i=new Set;for(let o of n)if(function(e,t){let r=new Set(e),n=new Set(t);for(let e of r)if(n.has(e))return!0;for(let e of n)if(r.has(e))return!0;return!1}(em([s],t,r),em([o],t,r)))if(ef(s.source,o.source))i.add(o);else{e=!0;break}if(!e){for(let e of i)n.delete(e);n.add(s)}}return Array.from(n)}function eg(e,t){if(!e.target)return[];let r=new Set;for(let n of e.target)if(eu(n))if(t[n.id])for(let e of t[n.id])r.add(e);else for(let e of eg(ea(n),t))r.add(e);else r.add(n);return[...r]}function ev(e,t){let r=eg(e,t);if(!r)return;if(!e.reenter&&r.every(t=>t===e.source||ef(t,e.source)))return e.source;let n=function(e){let[t,...r]=e;for(let e of Y(t,void 0))if(r.every(t=>ef(t,e)))return e}(r.concat(e.source));return n||(e.reenter?void 0:e.source.machine.root)}function em(e,t,r){let n=new Set;for(let s of e)if(s.target?.length){let e=ev(s,r);for(let r of(s.reenter&&s.source===e&&n.add(e),t))ef(r,e)&&n.add(r)}return[...n]}function eb(e,t,r,n,s,i){if(!e.length)return t;let o=new Set(t._nodes),a=t.historyValue,u=ey(e,o,a),l=t;s||([l,a]=function(e,t,r,n,s,i,o,a){let u,c=e,l=em(n,s,i);for(let e of(l.sort((e,t)=>t.order-e.order),l))for(let t of function(e){return Object.keys(e.states).map(t=>e.states[t]).filter(e=>"history"===e.type)}(e)){let r;r="deep"===t.history?t=>X(t)&&ef(t,e):t=>t.parent===e,(u??={...i})[t.id]=Array.from(s).filter(r)}for(let e of l)c=ex(c,t,r,[...e.exit,...e.invoke.map(e=>L(e.id))],o,void 0),s.delete(e);return[c,u||i]}(l,n,r,u,o,a,i,r.actionExecutor)),l=function(e,t,r,n,s,i,o,a){let u=e,l=new Set,d=new Set;(function(e,t,r,n){for(let s of e){let e=ev(s,t);for(let i of s.target||[])!eu(i)&&(s.source!==i||s.source!==e||s.reenter)&&(n.add(i),r.add(i)),ew(i,t,r,n);for(let i of eg(s,t)){let o=Y(i,e);e?.type==="parallel"&&o.push(e),e_(n,t,r,o,!s.source.parent&&s.reenter?void 0:e)}}})(n,o,d,l),a&&d.add(e.machine.root);let h=new Set;for(let e of[...l].sort((e,t)=>
15e.order-t.order)){s.add(e);let n=[];for(let t of(n.push(...e.entry),e.invoke))n.push(U(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(d.has(e)){let t=e.initial.actions;n.push(...t)}if(u=ex(u,t,r,n,i,e.invoke.map(e=>e.id)),"final"===e.type){let n=e.parent,o=n?.type==="parallel"?n:n?.parent,a=o||e;for(n?.type==="compound"&&i.push(c(n.id,void 0!==e.output?m(e.output,u.context,t,r.self):void 0));o?.type==="parallel"&&!h.has(o)&&ee(s,o);)h.add(o),i.push(c(o.id)),a=o,o=o.parent;if(o)continue;u=ej(u,{status:"done",output:function(e,t,r,n,s){if(void 0===n.output)return;let i=c(s.id,void 0!==s.output&&s.parent?m(s.output,e.context,t,r.self):void 0);return m(n.output,e.context,i,r.self)}(u,t,r,u.machine.root,a)})}}return u}(l=ex(l,n,r,u.flatMap(e=>e.actions),i,void 0),n,r,u,o,i,a,s);let d=[...o];"done"===l.status&&(l=ex(l,n,r,d.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),i,void 0));try{if(a===t.historyValue&&function(e,t){if(e.length!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}(t._nodes,o))return l;return ej(l,{_nodes:d,historyValue:a})}catch(e){throw e}}function ew(e,t,r,n){var s,i,o,a;if(eu(e))if(t[e.id]){let o=t[e.id];for(let e of o)n.add(e),ew(e,t,r,n);for(let a of o){s=a,i=e.parent,e_(n,t,r,Y(s,i))}}else{let s=ea(e);for(let i of s.target)n.add(i),s===e.parent?.initial&&r.add(e.parent),ew(i,t,r,n);for(let i of s.target){o=i,a=e.parent,e_(n,t,r,Y(o,a))}}else if("compound"===e.type){let[s]=e.initial.target;eu(s)||(n.add(s),r.add(s)),ew(s,t,r,n),e_(n,t,r,Y(s,e))}else if("parallel"===e.type)for(let s of G(e).filter(e=>!eu(e)))[...n].some(e=>ef(e,s))||(eu(s)||(n.add(s),r.add(s)),ew(s,t,r,n))}function e_(e,t,r,n,s){for(let i of n)if((!s||ef(i,s))&&e.add(i),"parallel"===i.type)for(let n of G(i).filter(e=>!eu(e)))[...e].some(e=>ef(e,n))||(e.add(n),ew(n,t,r,e))}function ex(e,t,r,n,s,i){let o=i?[]:void 0,a=function e(t,r,n,s,i,o){let{machine:a}=t,u=t;for(let t of s){var c;let s="function"==typeof t,l=s?t:(c="string"==typeof t?t:t.type,a.implementations.actions[c]),d={context:u.context,event:r,self:n.self,system:n.system},h=s||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:u.context,event:r}):t.params:void 0;if(!l||!("resolve"in l)){n.actionExecutor({type:"string"==typeof t?t:"object"==typeof t?t.type:t.name||"(anonymous)",info:d,params:h,exec:l});continue}let[p,f,y]=l.resolve(n,u,d,h,l,i);u=p,"retryResolve"in l&&o?.push([l,f]),"execute"in l&&n.actionExecutor({type:l.type,info:d,params:f,exec:l.execute.bind(null,n,f)}),y&&(u=e(u,r,n,y,i,o))}return u}(e,t,r,n,{internalQueue:s,deferredActorIds:i},o);return o?.forEach(([e,t])=>{e.retryResolve(r,a,t)}),a}function eE(e,t,r,n){let s=e,i=[];function a(e,t,n){r.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:r.self,event:t,snapshot:e,_transitions:n}),i.push(e)}if(t.type===u)return a(s=ej(eS(s,t,r),{status:"stopped"}),t,[]),{snapshot:s,microstates:i};let c=t;if(c.type!==o){let t=c,o=t.type.startsWith("xstate.error.actor"),u=eT(t,s);if(o&&!u.length)return a(s=ej(e,{status:"error",error:t.error}),t,[]),{snapshot:s,microstates:i};a(s=eb(u,e,r,c,!1,n),t,u)}let l=!0;for(;"active"===s.status;){let e=l?function(e,t){let r=new Set;for(let n of e._nodes.filter(X))e:for(let s of[n].concat(Y(n,void 0)))if(s.always){for(let n of s.always)if(void 0===n.guard||J(n.guard,e.context,t,e)){r.add(n);break e}}return ey(Array.from(r),new Set(e._nodes),e.historyValue)}(s,c):[],t=e.length?s:void 0;if(!e.length){if(!n.length)break;e=eT(c=n.shift(),s)}l=(s=eb(e,s,r,c,!1,n))!==t,a(s,c,e)}return"active"!==s.status&&eS(s,c,r),{snapshot:s,microstates:i}}function eS(e,t,r){return ex(e,t,r,Object.values(e.children).map(e=>L(e)),[],void 0)}function eT(e,t){return t.machine.getTransitionData(t,e)}function eI(e,t){let r=Q(ep(e,t));return Z(e,[...r])}let e$=function(e){return function e(t,r){let n=y(t),s=y(r);return"string"==typeof s?"string"==typeof n&&s===n:"string"==typeof n?n in s:Object.keys(n).every(t=>t in s&&e(n[t],s[t]))}(e,this.value)},eq=function(e){return this.tags.has(e)},eC=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>void 0!==e.target||e.actions.length)},eR=function(){let{_nodes:e,tags:t,machine:r,getMeta:n,toJSON:s,can:i,hasTag:o,matches:a,...u}=this;return{...u,tags:Array.from(t)}},ek=function(){return this._nodes.reduce((e,t)=>
15(void 0!==t.meta&&(e[t.id]=t.meta),e),{})};function eO(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:Z(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:e$,hasTag:eq,can:eC,getMeta:ek,toJSON:eR}}function ej(e,t={}){return eO({...e,...t},e.machine)}function eA(e,t){let{_nodes:r,tags:n,machine:s,children:i,context:o,can:a,hasTag:u,matches:c,getMeta:l,toJSON:d,...h}=e,p={};for(let e in i){let r=i[e];p[e]={snapshot:r.getPersistedSnapshot(t),src:r.src,systemId:r.systemId,syncSnapshot:r._syncSnapshot}}return{...h,context:function e(t){let r;for(let n in t){let s=t[n];if(s&&"object"==typeof s)if("sessionId"in s&&"send"in s&&"ref"in s)(r??=Array.isArray(t)?t.slice():{...t})[n]={xstate$$type:C,id:s.id};else{let i=e(s);i!==s&&((r??=Array.isArray(t)?t.slice():{...t})[n]=i)}}return r??t}(o),children:p,historyValue:function(e){if("object"!=typeof e||null===e)return{};let t={};for(let r in e){let n=e[r];Array.isArray(n)&&(t[r]=n.map(e=>({id:e.id})))}return t}(h.historyValue)}}function eP(e,t,r,n,{event:s,id:i,delay:o},{internalQueue:a}){let u,c=t.machine.implementations.delays;if("string"==typeof s)throw Error(`Only event objects may be used with raise; use raise({ type: "${s}" }) instead`);let l="function"==typeof s?s(r,n):s;if("string"==typeof o){let e=c&&c[o];u="function"==typeof e?e(r,n):e}else u="function"==typeof o?o(r,n):o;return"number"!=typeof u&&a.push(l),[t,{event:l,id:i,delay:u},void 0]}function eD(e,t){let{event:r,delay:n,id:s}=t;if("number"==typeof n)return void e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,r,n,s)})}function eM(e,t){function r(e,t){}return r.type="xstate.raise",r.event=e,r.id=t?.id,r.delay=t?.delay,r.resolve=eP,r.execute=eD,r}},38960:(e,t,r)=>{let n;r.d(t,{V2:()=>C,FS:()=>O,IM:()=>P,Tx:()=>j,Rr:()=>A,vd:()=>k,_K:()=>R,e3:()=>N,dK:()=>L,CC:()=>q,RM:()=>H,Uc:()=>V,tP:()=>D});let s={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},i=new Uint8Array(16),o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));let a=function(e,t,r){if(s.randomUUID&&!t&&!e)return s.randomUUID();var a=e,u=r;let c=(a=a||{}).random??a.rng?.()??function(){if(!n){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");n=crypto.getRandomValues.bind(crypto)}return n(i)}();if(c.length<16)throw Error("Random bytes length must be >= 16");if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,t){if((u=u||0)<0||u+16>t.length)throw RangeError(`UUID byte range ${u}:${u+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[u+e]=c[e];return t}return function(e,t=0){return(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase()}(c)};var u=r(61477),c=r(29580),l=r(74061),d=r(82232),h=r(38463),p=r(78714),f=r(82222),y=r(86288),g=r(36449),v=r(5124),m=r(33273),b=r(55484),w=r(33272),_=r(88884),x=r(62936),E=r(34265),S=r(43459),T=r(99287);let I=e=>({context:t})=>{let{count:r,include:n,exclude:s,responseType:i="message.received"}=e;return{count:r,domain:t.domain,from:t.connectTo,include:n?Array.isArray(n)?n:[n]:[],exclude:s?Array.isArray(s)?s:[s]:[],responseType:i,target:t.target,to:t.name}},$=(0,p.v)(()=>(0,f.R)(window,"message")),q=e=>(0,u.OX)(({input:t})=>{let r;return $.pipe(e?(0,y.T)(e):(0,g.F)(),(0,v.p)((e=>t=>{let{data:r}=t;return(!e.include.length||e.include.includes(r.type))&&(!e.exclude.length||!e.exclude.includes(r.type))&&r.domain===e.domain&&r.from===e.from&&r.to===e.to&&(!e.target||t.source===e.target)})(t)),(0,y.T)((r=t.responseType,e=>({type:r,message:e}))),t.count?(0,g.F)(function(e,t){return void 0===t&&(t=null),t=null!=t?t:e,(0,b.N)(function(r,n){var s=[],i=0;r.subscribe((0,w._)(n,function(r){var o,a,u,c,l=null;i++%t==0&&s.push([]);try{for(var d=(0,m.Ju)(s),h=d.next();!h.done;h=d.next()){var p=h.value;p.push(r),e<=p.length&&(l=null!=l?l:[]).push(p)}}catch(e){o={error:e}}
15finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}if(l)try{for(var f=(0,m.Ju)(l),y=f.next();!y.done;y=f.next()){var p=y.value;(0,_.o)(s,p),n.next(p)}}catch(e){u={error:e}}finally{try{y&&!y.done&&(c=f.return)&&c.call(f)}finally{if(u)throw u.error}}},function(){var e,t;try{for(var r=(0,m.Ju)(s),i=r.next();!i.done;i=r.next()){var o=i.value;n.next(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}n.complete()},void 0,function(){s=null}))})}(t.count),(0,x.H)(e=>e),(0,E.s)(t.count)):(0,g.F)())}),C="sanity/comlink",R="comlink/response",k="comlink/heartbeat",O="comlink/disconnect",j="comlink/handshake/syn",A="comlink/handshake/syn-ack",P="comlink/handshake/ack",D=()=>(0,c.mj)({types:{},actors:{listen:(0,u.OX)(({input:e})=>{let t,r=e.signal?(0,f.R)(e.signal,"abort").pipe((t=`Request ${e.requestId} aborted`,e=>e.pipe((0,E.s)(1),(0,y.T)(()=>{throw Error(t)})))):S.w;return(0,f.R)(window,"message").pipe((0,v.p)(t=>t.data?.type===R&&t.data?.responseTo===e.requestId&&!!t.source&&e.sources.has(t.source)),(0,E.s)(e.sources.size),(0,T.Q)(r))})},actions:{"send message":({context:e},t)=>{let{sources:r,targetOrigin:n}=e,{message:s}=t;r.forEach(e=>{e.postMessage(s,{targetOrigin:n})})},"on success":(0,l.s)(({context:e})=>e.parentRef,({context:e,self:t})=>(e.response&&e.resolvable?.resolve(e.response),{type:"request.success",requestId:t.id,response:e.response,responseTo:e.responseTo})),"on fail":(0,l.s)(({context:e})=>e.parentRef,({context:e,self:t})=>(e.suppressWarnings||console.warn(`[@sanity/comlink] Received no response to message '${e.type}' on client '${e.from}' (ID: '${e.id}').`),e.resolvable?.reject(Error("No response received")),{type:"request.failed",requestId:t.id})),"on abort":(0,l.s)(({context:e})=>e.parentRef,({context:e,self:t})=>(e.resolvable?.reject(Error("Request aborted")),{type:"request.aborted",requestId:t.id}))},guards:{expectsResponse:({context:e})=>e.expectResponse},delays:{initialTimeout:0,responseTimeout:({context:e})=>e.responseTimeout??3e3}}).createMachine({context:({input:e})=>({channelId:e.channelId,data:e.data,domain:e.domain,expectResponse:e.expectResponse??!1,from:e.from,id:`msg-${a()}`,parentRef:e.parentRef,resolvable:e.resolvable,response:null,responseTimeout:e.responseTimeout,responseTo:e.responseTo,signal:e.signal,sources:e.sources instanceof Set?e.sources:new Set([e.sources]),suppressWarnings:e.suppressWarnings,targetOrigin:e.targetOrigin,to:e.to,type:e.type}),initial:"idle",on:{abort:".aborted"},states:{idle:{after:{initialTimeout:[{target:"sending"}]}},sending:{entry:{type:"send message",params:({context:e})=>{let{channelId:t,data:r,domain:n,from:s,id:i,responseTo:o,to:a,type:u}=e;return{message:{channelId:t,data:r,domain:n,from:s,id:i,to:a,type:u,responseTo:o}}}},always:[{guard:"expectsResponse",target:"awaiting"},"success"]},awaiting:{invoke:{id:"listen for response",src:"listen",input:({context:e})=>({requestId:e.id,sources:e.sources,signal:e.signal}),onError:"aborted"},after:{responseTimeout:"failed"},on:{message:{actions:(0,d.a)({response:({event:e})=>e.data.data,responseTo:({event:e})=>e.data.responseTo}),target:"success"}}},failed:{type:"final",entry:"on fail"},success:{type:"final",entry:"on success"},aborted:{type:"final",entry:"on abort"}},output:({context:e,self:t})=>({requestId:t.id,response:e.response,responseTo:e.responseTo})}),M=(0,u.SP)(({sendBack:e,input:t})=>{let r=()=>{e(t.event)};t.immediate&&r();let n=setInterval(r,t.interval);return()=>{clearInterval(n)}}),N=()=>(0,c.mj)({types:{},actors:{requestMachine:D(),listen:q(),sendBackAtInterval:M},actions:{"buffer message":(0,l.e)(({enqueue:e})=>{e.assign({buffer:({event:e,context:t})=>((0,c.DT)(e,"post"),[...t.buffer,e.data])}),e.emit(({event:e})=>((0,c.DT)(e,"post"),{type:"buffer.added",message:e.data}))}),"create request":(0,d.a)({requests:({context:e,event:t,self:r,spawn:n})=>{(0,c.DT)(t,"request");let s=(Array.isArray(t.data)?t.data:[t.data]).map(t=>n("requestMachine",{id:`req-${a()}`,input:{channelId:e.channelId,data:t.data,domain:e.domain,expectResponse:t.expectResponse,from:e.name,parentRef:r,responseTo:t.responseTo,sources:e.target,targetOrigin:e.targetOrigin,to:e.connectTo,type:t.type}}));return[...e.requests,...s]}}),"emit received message":(0,l.e)(({enqueue:e})=>{e.emit(({event:e})=>((0,c.DT)(e,"message.received"),{type:"message",message:e.message.data}))}),"emit status":(0,l.a)((e,t)=>({type:"status",status:t.status})),"post message":(0,h.r)(({event:e})=>((0,c.DT)(e,"post"),{type:"request",data:{data:e.data.data,expectResponse:!0,type:e.data.type}})),"remove request":(0,l.e)(({context:e,enqueue:t,event:r})=>{(0,c.DT)(r,["request.success","request.failed","request.aborted"]),(0,h.s)(r.requestId),t.assign({requests:e.requests.filter(({id:e})=>e!==r.requestId)})}),respond:(0,h.r)(({event:e})=>((0,c.DT)(e,"response"),{type:"request",data:{data:e.data,type:R,responseTo:e.respondTo}})),"send handshake ack":(0,h.r)({type:"request",data:{type:P}}),"send disconnect":(0,h.r)(()=>({type:"request",data:{type:O}})),"send handshake syn":(0,h.r)({type:"request",data:{type:j}}),"send pending messages":(0,l.e)(({enqueue:e})=>{e.raise(({context:e})=>({type:"request",data:e.buffer.map(({data:e,type:t})=>({data:e,type:t}))})),e.emit(({context:e})=>({type:"buffer.flushed",messages:e.buffer})),e.assign({buffer:[]})}),"set target":(0,d.a)({target:({event:e})=>((0,c.DT)(e,"target.set"),e.target)})},guards:{"has target":({context:e})=>!!e.target,"should send heartbeats":({context:e})=>e.heartbeat}}).createMachine({id:"connection",context:({input:e})=>({id:e.id||`${e.name}-${a()}`,buffer:[],channelId:`chn-${a()}`,connectTo:e.connectTo,domain:e.domain??C,heartbeat:e.heartbeat??!1,name:e.name,requests:[],target:e.target,targetOrigin:e.targetOrigin}),on:{"target.set":{actions:"set target"},"request.success":{actions:"remove request"},"request.failed":{actions:"remove request"}}
15,initial:"idle",states:{idle:{entry:[{type:"emit status",params:{status:"idle"}}],on:{connect:{target:"handshaking",guard:"has target"},post:{actions:"buffer message"}}},handshaking:{id:"handshaking",entry:[{type:"emit status",params:{status:"handshaking"}}],invoke:[{id:"send syn",src:"sendBackAtInterval",input:()=>({event:{type:"syn"},interval:500,immediate:!0})},{id:"listen for handshake",src:"listen",input:e=>I({include:A,count:1})(e)}],on:{syn:{actions:"send handshake syn"},request:{actions:"create request"},post:{actions:"buffer message"},"message.received":{target:"connected"},disconnect:{target:"disconnected"}},exit:"send handshake ack"},connected:{entry:["send pending messages",{type:"emit status",params:{status:"connected"}}],invoke:{id:"listen for messages",src:"listen",input:I({exclude:[R,k]})},on:{post:{actions:"post message"},request:{actions:"create request"},response:{actions:"respond"},"message.received":{actions:"emit received message"},disconnect:{target:"disconnected"}},initial:"heartbeat",states:{heartbeat:{initial:"checking",states:{checking:{always:{guard:"should send heartbeats",target:"sending"}},sending:{on:{"request.failed":{target:"#handshaking"}},invoke:{id:"send heartbeat",src:"sendBackAtInterval",input:()=>({event:{type:"post",data:{type:k,data:void 0}},interval:2e3,immediate:!1})}}}}}},disconnected:{id:"disconnected",entry:["send disconnect",{type:"emit status",params:{status:"disconnected"}}],on:{request:{actions:"create request"},post:{actions:"buffer message"},connect:{target:"handshaking",guard:"has target"}}}}}),U=(e,t=N())=>{let r=e.id||`${e.name}-${a()}`,n=(0,h.c)(t,{input:{...e,id:r}}),s=new Map,i=new Map;n.on("message",async({message:e})=>{let t=s.get(e.type);if(t)return void t.forEach(async t=>{let r=await t(e.data);r&&n.send({type:"response",respondTo:e.id,data:r})});let r=i.get(e.type);r?r.add(e):i.set(e.type,new Set([e]))});let o=()=>{n.stop()};return{actor:n,connect:()=>{n.send({type:"connect"})},disconnect:()=>{n.send({type:"disconnect"})},id:r,name:e.name,machine:t,on:(e,t,r)=>{let o=s.get(e)||new Set;s.has(e)||s.set(e,o),o.add(t);let a=i.get(e);if(a){let s=r?.replay??1;Array.from(a).slice(-s).forEach(async({data:e,id:r})=>{let s=await t(e);s&&n.send({type:"response",respondTo:r,data:s})}),i.delete(e)}return()=>{o.delete(t)}},onStatus:(e,t)=>{let r=n.on("status",r=>{t&&r.status!==t||e(r.status)});return()=>r.unsubscribe()},post:(e,t)=>{n.send({type:"post",data:{type:e,data:t}})},setTarget:e=>{n.send({type:"target.set",target:e})},start:()=>(n.start(),o),stop:o,get target(){return n.getSnapshot().context.target}}},F=e=>{e.disconnect(),setTimeout(()=>{e.stop()},0)},z=()=>{},L=e=>{let{targetOrigin:t}=e,r=new Set,n=new Set;return{addTarget:e=>{if(r.has(e))return z;if(!r.size||!n.size)return r.add(e),n.forEach(t=>{t.connections.forEach(t=>{t.setTarget(e),t.connect()})}),()=>{r.delete(e),n.forEach(t=>{t.connections.forEach(t=>{t.target===e&&t.disconnect()})})};r.add(e);let s=new Set;return n.forEach(r=>{let n=U({...r.input,target:e,targetOrigin:t},r.machine);s.add(n),r.connections.add(n),r.subscribers.forEach(({type:e,handler:t,unsubscribers:r})=>{r.push(n.on(e,t))}),r.internalEventSubscribers.forEach(({type:e,handler:t,unsubscribers:r})=>{let s=n.actor.on(e,t);r.push(()=>s.unsubscribe())}),r.statusSubscribers.forEach(({handler:e,unsubscribers:t})=>{t.push(n.onStatus(t=>e({connection:n.id,status:t})))}),n.start(),n.connect()}),()=>{r.delete(e),s.forEach(e=>{F(e),n.forEach(t=>{t.connections.delete(e)})})}},createChannel:(e,s=N())=>{let i={connections:new Set,input:e,internalEventSubscribers:new Set,machine:s,statusSubscribers:new Set,subscribers:new Set};n.add(i);let{connections:o,internalEventSubscribers:a,statusSubscribers:u,subscribers:c}=i;if(r.size)r.forEach(r=>{let n=U({...e,target:r,targetOrigin:t},s);o.add(n)});else{let r=U({...e,targetOrigin:t},s);o.add(r)}let l=()=>{let e=i.connections;e.forEach(F),e.clear(),n.delete(i)};return{on:(e,t)=>{let r=[];o.forEach(n=>{r.push(n.on(e,t))});let n={type:e,handler:t,unsubscribers:r};return c.add(n),()=>{r.forEach(e=>e()),c.delete(n)}},onInternalEvent:(e,t)=>
15{let r=[];o.forEach(n=>{let s=n.actor.on(e,t);r.push(()=>s.unsubscribe())});let n={type:e,handler:t,unsubscribers:r};return a.add(n),()=>{r.forEach(e=>e()),a.delete(n)}},onStatus:e=>{let t=[];o.forEach(r=>{t.push(r.onStatus(t=>e({connection:r.id,status:t})))});let r={handler:e,unsubscribers:t};return u.add(r),()=>{t.forEach(e=>e()),u.delete(r)}},post:(...e)=>{let[t,r]=e;o.forEach(e=>{e.post(t,r)})},start:()=>(o.forEach(e=>{e.start(),e.connect()}),l),stop:l}},destroy:()=>{n.forEach(({connections:e})=>{e.forEach(F),e.clear()}),n.clear(),r.clear()}}},V=()=>(0,c.mj)({types:{},actors:{requestMachine:D(),listen:q()},actions:{"buffer handshake":(0,d.a)({handshakeBuffer:({event:e,context:t})=>((0,c.DT)(e,"message.received"),[...t.handshakeBuffer,e])}),"buffer message":(0,l.e)(({enqueue:e})=>{e.assign({buffer:({event:e,context:t})=>((0,c.DT)(e,"post"),[...t.buffer,{data:e.data,resolvable:e.resolvable,options:e.options}])}),e.emit(({event:e})=>((0,c.DT)(e,"post"),{type:"buffer.added",message:e.data}))}),"create request":(0,d.a)({requests:({context:e,event:t,self:r,spawn:n})=>{(0,c.DT)(t,"request");let s=(Array.isArray(t.data)?t.data:[t.data]).map(t=>n("requestMachine",{id:`req-${a()}`,input:{channelId:e.channelId,data:t.data,domain:e.domain,expectResponse:t.expectResponse,from:e.name,parentRef:r,resolvable:t.resolvable,responseTimeout:t.options?.responseTimeout,responseTo:t.responseTo,signal:t.options?.signal,sources:e.target,suppressWarnings:t.options?.suppressWarnings,targetOrigin:e.targetOrigin,to:e.connectTo,type:t.type}}));return[...e.requests,...s]}}),"emit heartbeat":(0,l.a)(()=>({type:"heartbeat"})),"emit received message":(0,l.e)(({enqueue:e})=>{e.emit(({event:e})=>((0,c.DT)(e,"message.received"),{type:"message",message:e.message.data}))}),"emit status":(0,l.a)((e,t)=>({type:"status",status:t.status})),"post message":(0,h.r)(({event:e})=>((0,c.DT)(e,"post"),{type:"request",data:{data:e.data.data,expectResponse:!!e.resolvable,type:e.data.type,resolvable:e.resolvable,options:e.options}})),"process pending handshakes":(0,l.e)(({context:e,enqueue:t})=>{e.handshakeBuffer.forEach(e=>t.raise(e)),t.assign({handshakeBuffer:[]})}),"remove request":(0,l.e)(({context:e,enqueue:t,event:r})=>{(0,c.DT)(r,["request.success","request.failed","request.aborted"]),(0,h.s)(r.requestId),t.assign({requests:e.requests.filter(({id:e})=>e!==r.requestId)})}),"send response":(0,h.r)(({event:e})=>((0,c.DT)(e,["message.received","heartbeat.received"]),{type:"request",data:{type:R,responseTo:e.message.data.id,data:void 0}})),"send handshake syn ack":(0,h.r)({type:"request",data:{type:A}}),"send pending messages":(0,l.e)(({enqueue:e})=>{e.raise(({context:e})=>({type:"request",data:e.buffer.map(({data:e,resolvable:t,options:r})=>({data:e.data,type:e.type,expectResponse:!!t,resolvable:t,options:r}))})),e.emit(({context:e})=>({type:"buffer.flushed",messages:e.buffer.map(({data:e})=>e)})),e.assign({buffer:[]})}),"set connection config":(0,d.a)({channelId:({event:e})=>((0,c.DT)(e,"handshake.syn"),e.message.data.channelId),target:({event:e})=>((0,c.DT)(e,"handshake.syn"),e.message.source||void 0),targetOrigin:({event:e})=>((0,c.DT)(e,"handshake.syn"),e.message.origin)})},guards:{hasSource:({context:e})=>null!==e.target}}).createMachine({id:"node",context:({input:e})=>({buffer:[],channelId:null,connectTo:e.connectTo,domain:e.domain??C,handshakeBuffer:[],name:e.name,requests:[],target:void 0,targetOrigin:null}),invoke:{id:"listen for handshake syn",src:"listen",input:I({include:j,responseType:"handshake.syn"})},on:{"request.success":{actions:"remove request"},"request.failed":{actions:"remove request"},"request.aborted":{actions:"remove request"},"handshake.syn":{actions:"set connection config",target:".handshaking"}},initial:"idle",states:{idle:{entry:[{type:"emit status",params:{status:"idle"}}],on:{post:{actions:"buffer message"}}},handshaking:{guard:"hasSource",entry:["send handshake syn ack",{type:"emit status",params:{status:"handshaking"}}],invoke:[{id:"listen for handshake ack",src:"listen",input:I({include:P,count:1,responseType:"handshake.complete"}),onDone:"connected"},{id:"listen for disconnect",src:"listen",input:I({include:O,count:1,responseType:"disconnect"})},{id:"listen for messages",src:"listen",input:I({exclude:[O,j,P,k,R]})}],on:{request:{actions:"create request"},post:{actions:"buffer message"},"message.received":{actions:"buffer handshake"},disconnect:{target:"idle"}}},connected:{entry:["process pending handshakes","send pending messages",{type:"emit status",params:{status:"connected"}}],invoke:[{id:"listen for messages",src:"listen",input:I({exclude:[O,j,P,k,R]})},{id:"listen for heartbeat",src:"listen",input:I({include:k,responseType:"heartbeat.received"})},{id:"listen for disconnect",src:"listen",input:I({include:O,count:1,responseType:"disconnect"})}],on:{request:{actions:"create request"},post:{actions:"post message"},disconnect:{target:"idle"},"message.received":{actions:["send response","emit received message"]},"heartbeat.received":{actions:["send response","emit heartbeat"]}}}}}),H=(e,t=V())=>{let r,n=(0,h.c)(t,{input:e}),s=new Map,i=new Map;n.on("message",({message:e})=>{let t=s.get(e.type);if(t)return void t.forEach(t=>t(e.data));let r=i.get(e.type);r?r.add(e):i.set(e.type,new Set([e]))});let o=()=>{n.stop()};return{actor:n,fetch:(e,t,r)=>{let{responseTimeout:s=1e4,signal:i,suppressWarnings:o}=r||{},a=function(){let e,t;return"function"==typeof Promise.withResolvers?Promise.withResolvers():{promise:new Promise((r,n)=>{e=r,t=n}),resolve:e,reject:t}}();return n.send({type:"post",data:{type:e,data:t},resolvable:a,options:{responseTimeout:s,signal:i,suppressWarnings:o}}),a.promise},machine:t,on:(e,t,r)=>{let n=s.get(e)||new Set;s.has(e)||s.set(e,n),n.add(t);let o=i.get(e);if(o){let n=r?.replay??1;
15Array.from(o).slice(-n).forEach(({data:e})=>t(e)),i.delete(e)}return()=>{n.delete(t)}},onStatus:(e,t)=>{let s=n.on("status",n=>{r=n.status,t&&n.status!==t||e(n.status)});return r&&e(r),()=>s.unsubscribe()},post:(e,t)=>{n.send({type:"post",data:{type:e,data:t}})},start:()=>(n.start(),o),stop:o}}},40182:(e,t,r)=>{r.d(t,{B:()=>c});var n=r(33273),s=r(73621),i=r(84892),o=(0,r(61499).L)(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),a=r(88884),u=r(71016),c=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,n.C6)(t,e),t.prototype.lift=function(e){var t=new l(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new o},t.prototype.next=function(e){var t=this;(0,u.Y)(function(){var r,s;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=(0,n.Ju)(t.currentObservers),o=i.next();!o.done;o=i.next())o.value.next(e)}catch(e){r={error:e}}finally{try{o&&!o.done&&(s=i.return)&&s.call(i)}finally{if(r)throw r.error}}}})},t.prototype.error=function(e){var t=this;(0,u.Y)(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}})},t.prototype.complete=function(){var e=this;(0,u.Y)(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null==(e=this.observers)?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this.hasError,n=this.isStopped,s=this.observers;return r||n?i.Kn:(this.currentObservers=null,s.push(e),new i.yU(function(){t.currentObservers=null,(0,a.o)(s,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,r=this.thrownError,n=this.isStopped;t?e.error(r):n&&e.complete()},t.prototype.asObservable=function(){var e=new s.c;return e.source=this,e},t.create=function(e,t){return new l(e,t)},t}(s.c),l=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return(0,n.C6)(t,e),t.prototype.next=function(e){var t,r;null==(r=null==(t=this.destination)?void 0:t.next)||r.call(t,e)},t.prototype.error=function(e){var t,r;null==(r=null==(t=this.destination)?void 0:t.error)||r.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=null==(e=this.destination)?void 0:e.complete)||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!=(r=null==(t=this.source)?void 0:t.subscribe(e))?r:i.Kn},t}(c)},40359:(e,t,r)=>{r.d(t,{Q:()=>o});var n=r(29245),s=r(55484),i=r(33272);function o(e,t){return void 0===t&&(t=0),(0,s.N)(function(r,s){r.subscribe((0,i._)(s,function(r){return(0,n.N)(s,e,function(){return s.next(r)},t)},function(){return(0,n.N)(s,e,function(){return s.complete()},t)},function(r){return(0,n.N)(s,e,function(){return s.error(r)},t)}))})}},42870:(e,t,r)=>{r.d(t,{E:()=>s,b:()=>i});var n=r(78345),s=new(r(10539)).q(n.R),i=s},43459:(e,t,r)=>{r.d(t,{I:()=>i,w:()=>s});var n=r(73621),s=new n.c(function(e){return e.complete()});function i(e){var t;return e?(t=e,new n.c(function(e){return t.schedule(function(){return e.complete()})})):s}},47041:(e,t,r)=>{r.d(t,{l:()=>n});function n(){}},49609:(e,t,r)=>{r.d(t,{X:()=>n});var n=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},54368:(e,t,r)=>{r.d(t,{$:()=>i});var n=r(73621),s=r(13073);function i(e,t){var r=(0,s.T)(e)?e:function(){return e},i=function(e){return e.error(r())};return new n.c(t?function(e){return t.schedule(i,0,e)}:i)}},55484:(e,t,r)=>{r.d(t,{N:()=>i,S:()=>s});var n=r(13073);function s(e){return(0,n.T)(null==e?void 0:e.lift)}function i(e){return function(t){if(s(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}},55844:(e,t,r)=>{r.d(t,{R0:()=>u,lI:()=>a,ms:()=>o});var n=r(13073),s=r(68222);function i(e){return e[e.length-1]}function o(e){return(0,n.T)(i(e))?e.pop():void 0}function a(e){return(0,s.m)(i(e))?e.pop():void 0}function u(e,t){return"number"==typeof i(e)?e.pop():t}},58319:(e,t,r)=>{r.d(t,{c:()=>m});var n=r(68326),s=r(40359),i=r(6171),o=r(73621),a=r(70771),u=r(13073),c=r(29245);function l(e,t){if(!e)throw Error("Iterable cannot be null");return new o.c(function(r){(0,c.N)(r,t,function(){var n=e[Symbol.asyncIterator]();(0,c.N)(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}var d=r(21143),h=r(14166),p=r(49609),f=r(65899),y=r(35489),g=r(62237),v=r(96846);function m(e,t){if(null!=e){if((0,d.l)(e))return(0,n.Tg)(e).pipe((0,i._)(t),(0,s.Q)(t));if((0,p.X)(e))return new o.c(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[
15n++]),r.closed||this.schedule())})});if((0,h.y)(e))return(0,n.Tg)(e).pipe((0,i._)(t),(0,s.Q)(t));if((0,y.T)(e))return l(e,t);if((0,f.x)(e))return new o.c(function(r){var n;return(0,c.N)(r,t,function(){n=e[a.l](),(0,c.N)(r,t,function(){var e,t,s;try{t=(e=n.next()).value,s=e.done}catch(e){r.error(e);return}s?r.complete():r.next(t)},0,!0)}),function(){return(0,u.T)(null==n?void 0:n.return)&&n.return()}});if((0,v.U)(e))return l((0,v.C)(e),t)}throw(0,g.L)(e)}},60243:(e,t,r)=>{r.d(t,{D:()=>a});var n=Array.isArray,s=Object.getPrototypeOf,i=Object.prototype,o=Object.keys;function a(e){if(1===e.length){var t,r=e[0];if(n(r))return{args:r,keys:null};if((t=r)&&"object"==typeof t&&s(t)===i){var a=o(r);return{args:a.map(function(e){return r[e]}),keys:a}}}return{args:e,keys:null}}},60747:(e,t,r)=>{r.d(t,{K:()=>s});var n=Array.isArray;function s(e){return 1===e.length&&n(e[0])?e[0]:e}},61477:(e,t,r)=>{r.d(t,{H6:()=>g,K_:()=>c,OX:()=>l,SP:()=>i,Sx:()=>f});var n=r(38463);let s=new WeakMap;function i(e){return{config:e,start:(t,r)=>{let{self:n,system:i,emit:o}=r,a={receivers:void 0,dispose:void 0};s.set(n,a),a.dispose=e({input:t.input,system:i,self:n,sendBack:e=>{"stopped"!==n.getSnapshot().status&&n._parent&&i._relay(n,n._parent,e)},receive:e=>{a.receivers??=new Set,a.receivers.add(e)},emit:o})},transition:(e,t,r)=>{let i=s.get(r.self);return t.type===n.X?(e={...e,status:"stopped",error:void 0},s.delete(r.self),i.receivers?.clear(),i.dispose?.()):i.receivers?.forEach(e=>e(t)),e},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let o="xstate.observable.next",a="xstate.observable.error",u="xstate.observable.complete";function c(e){return{config:e,transition:(e,t)=>{if("active"!==e.status)return e;switch(t.type){case o:return{...e,context:t.data};case a:return{...e,status:"error",error:t.data,input:void 0,_subscription:void 0};case u:return{...e,status:"done",input:void 0,_subscription:void 0};case n.X:return e._subscription.unsubscribe(),{...e,status:"stopped",input:void 0,_subscription:void 0};default:return e}},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,context:void 0,input:t,_subscription:void 0}),start:(t,{self:r,system:n,emit:s})=>{"done"!==t.status&&(t._subscription=e({input:t.input,system:n,self:r,emit:s}).subscribe({next:e=>{n._relay(r,r,{type:o,data:e})},error:e=>{n._relay(r,r,{type:a,data:e})},complete:()=>{n._relay(r,r,{type:u})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}}function l(e){return{config:e,transition:(e,t)=>{if("active"!==e.status)return e;switch(t.type){case a:return{...e,status:"error",error:t.data,input:void 0,_subscription:void 0};case u:return{...e,status:"done",input:void 0,_subscription:void 0};case n.X:return e._subscription.unsubscribe(),{...e,status:"stopped",input:void 0,_subscription:void 0};default:return e}},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,context:void 0,input:t,_subscription:void 0}),start:(t,{self:r,system:n,emit:s})=>{"done"!==t.status&&(t._subscription=e({input:t.input,system:n,self:r,emit:s}).subscribe({next:e=>{r._parent&&n._relay(r,r._parent,e)},error:e=>{n._relay(r,r,{type:a,data:e})},complete:()=>{n._relay(r,r,{type:u})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}}let d="xstate.promise.resolve",h="xstate.promise.reject",p=new WeakMap;function f(e){return{config:e,transition:(e,t,r)=>{if("active"!==e.status)return e;switch(t.type){case d:{let r=t.data;return{...e,status:"done",output:r,input:void 0}}case h:return{...e,status:"error",error:t.data,input:void 0};case n.X:return p.get(r.self)?.abort(),p.delete(r.self),{...e,status:"stopped",input:void 0};default:return e}},start:(t,{self:r,system:n,emit:s})=>{if("active"!==t.status)return;let i=new AbortController;p.set(r,i),Promise.resolve(e({input:t.input,system:n,self:r,signal:i.signal,emit:s})).then(e=>{"active"===r.getSnapshot().status&&(p.delete(r),n._relay(r,r,{type:d,data:e}))},e=>{"active"===r.getSnapshot().status&&(p.delete(r),n._relay(r,r,{type:h,data:e}))})},getInitialSnapshot:(e,t)=>
15({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let y=function(e,t){return{config:e,transition:(t,r,n)=>({...t,context:e(t.context,r,n)}),getInitialSnapshot:(e,r)=>({status:"active",output:void 0,error:void 0,context:"function"==typeof t?t({input:r}):t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}(e=>void 0,void 0);function g(){return(0,n.c)(y)}},61499:(e,t,r)=>{r.d(t,{L:()=>n});function n(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}},62237:(e,t,r)=>{r.d(t,{L:()=>n});function n(e){return TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}},62707:(e,t,r)=>{r.d(t,{D:()=>n});function n(e){return e}},62936:(e,t,r)=>{r.d(t,{H:()=>i});var n=r(29844),s=r(13073);function i(e,t){return(0,s.T)(t)?(0,n.Z)(e,t,1):(0,n.Z)(e,1)}},65899:(e,t,r)=>{r.d(t,{x:()=>i});var n=r(70771),s=r(13073);function i(e){return(0,s.T)(null==e?void 0:e[n.l])}},66612:(e,t,r)=>{r.d(t,{h:()=>o});var n=r(68326),s=r(29245),i=r(33272);function o(e,t,r,o,a,u,c,l){var d=[],h=0,p=0,f=!1,y=function(){!f||d.length||h||t.complete()},g=function(e){return h<o?v(e):d.push(e)},v=function(e){u&&t.next(e),h++;var l=!1;(0,n.Tg)(r(e,p++)).subscribe((0,i._)(t,function(e){null==a||a(e),u?g(e):t.next(e)},function(){l=!0},void 0,function(){if(l)try{for(h--;d.length&&h<o;)!function(){var e=d.shift();c?(0,s.N)(t,c,function(){return v(e)}):v(e)}();y()}catch(e){t.error(e)}}))};return e.subscribe((0,i._)(t,g,function(){f=!0,y()})),function(){null==l||l()}}},68222:(e,t,r)=>{r.d(t,{m:()=>s});var n=r(13073);function s(e){return e&&(0,n.T)(e.schedule)}},68326:(e,t,r)=>{r.d(t,{Tg:()=>y});var n=r(33273),s=r(49609),i=r(14166),o=r(73621),a=r(21143),u=r(35489),c=r(62237),l=r(65899),d=r(96846),h=r(13073),p=r(25684),f=r(79728);function y(e){if(e instanceof o.c)return e;if(null!=e){var t,r,y,v,m;if((0,a.l)(e)){return t=e,new o.c(function(e){var r=t[f.s]();if((0,h.T)(r.subscribe))return r.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")})}if((0,s.X)(e)){return r=e,new o.c(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}if((0,i.y)(e)){return y=e,new o.c(function(e){y.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,p.m)})}if((0,u.T)(e))return g(e);if((0,l.x)(e)){return v=e,new o.c(function(e){var t,r;try{for(var s=(0,n.Ju)(v),i=s.next();!i.done;i=s.next()){var o=i.value;if(e.next(o),e.closed)return}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}e.complete()})}if((0,d.U)(e)){return m=e,g((0,d.C)(m))}}throw(0,c.L)(e)}function g(e){return new o.c(function(t){(function(e,t){var r,s,i,o;return(0,n.sH)(this,void 0,void 0,function(){var a;return(0,n.YH)(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=(0,n.xN)(e),u.label=1;case 1:return[4,r.next()];case 2:if((s=u.sent()).done)return[3,4];if(a=s.value,t.next(a),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return i={error:u.sent()},[3,11];case 6:if(u.trys.push([6,,9,10]),!(s&&!s.done&&(o=r.return)))return[3,8];return[4,o.call(r)];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}},70771:(e,t,r)=>{r.d(t,{l:()=>n});var n="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"},71016:(e,t,r)=>{r.d(t,{Y:()=>i,l:()=>o});var n=r(9838),s=null;function i(e){if(n.$.useDeprecatedSynchronousErrorHandling){var t=!s;if(t&&(s={errorThrown:!1,error:null}),e(),t){var r=s,i=r.errorThrown,o=r.error;if(s=null,i)throw o}}else e()}function o(e){n.$.useDeprecatedSynchronousErrorHandling&&s&&(s.errorThrown=!0,s.error=e)}},72415:(e,t,r)=>{r.d(t,{Ms:()=>v,vU:()=>p});var n=r(33273),s=r(13073),i=r(84892),o=r(9838),a=r(25684),u=r(47041),c=l("C",void 0,void 0);function l(e,t,r){return{kind:e,value:t,error:r}}var d=r(11368),h=r(71016),p=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,(0,i.Uv)(t)&&t.add(r)):r.destination=w,r}return(0,n.C6)(t,e),t.create=function(e,t,r){return new v(e,t,r)},t.prototype.next=function(e){this.isStopped?b(l("N",e,void 0),this):this._next(e)},t.prototype.error=function(e){this.isStopped?b(l("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?b(c,this):(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}(i.yU),f=Function.prototype.bind;function y(e,t){return f.call(e,t)}var g=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){m(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){m(e)}else m(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){m(e)}},e}(),v=function(e){function t(t,r,n){var i,a,u=e.call(this)||this;return(0,s.T)(t)||!t?i={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}
15:u&&o.$.useDeprecatedNextContext?((a=Object.create(t)).unsubscribe=function(){return u.unsubscribe()},i={next:t.next&&y(t.next,a),error:t.error&&y(t.error,a),complete:t.complete&&y(t.complete,a)}):i=t,u.destination=new g(i),u}return(0,n.C6)(t,e),t}(p);function m(e){o.$.useDeprecatedSynchronousErrorHandling?(0,h.l)(e):(0,a.m)(e)}function b(e,t){var r=o.$.onStoppedNotification;r&&d.f.setTimeout(function(){return r(e,t)})}var w={closed:!0,next:u.l,error:function(e){throw e},complete:u.l}},72666:(e,t,r)=>{r.d(t,{s:()=>s});var n=r(20836);function s(e,t){var r="object"==typeof t;return new Promise(function(s,i){var o,a=!1;e.subscribe({next:function(e){o=e,a=!0},error:i,complete:function(){a?s(o):r?s(t.defaultValue):i(new n.G)}})})}},72817:(e,t,r)=>{r.d(t,{Ak:()=>i,d_:()=>s});let n=e=>crypto.getRandomValues(new Uint8Array(e)),s=(e,t=21)=>((e,t,r)=>{let n=(2<<Math.log(e.length-1)/Math.LN2)-1,s=-~(1.6*n*t/e.length);return (i=t)=>{let o="";for(;;){let t=r(s),a=0|s;for(;a--;)if((o+=e[t[a]&n]||"").length===i)return o}}})(e,t,n),i=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>((t&=63)<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"")},73621:(e,t,r)=>{r.d(t,{c:()=>l});var n=r(72415),s=r(84892),i=r(79728),o=r(36449),a=r(9838),u=r(13073),c=r(71016),l=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 i=this,o=!function(e){return e&&e instanceof n.vU||e&&(0,u.T)(e.next)&&(0,u.T)(e.error)&&(0,u.T)(e.complete)&&(0,s.Uv)(e)}(e)?new n.Ms(e,t,r):e;return(0,c.Y)(function(){var e=i.operator,t=i.source;o.add(e?e.call(o,t):t?i._subscribe(o):i._trySubscribe(o))}),o},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=d(t))(function(t,s){var i=new n.Ms({next:function(t){try{e(t)}catch(e){s(e),i.unsubscribe()}},error:s,complete:t});r.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null==(t=this.source)?void 0:t.subscribe(e)},e.prototype[i.s]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0,o.m)(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=d(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 d(e){var t;return null!=(t=null!=e?e:a.$.Promise)?t:Promise}},74061:(e,t,r)=>{r.d(t,{a:()=>a,b:()=>p,e:()=>y,l:()=>m,s:()=>h});var n=r(38463),s=r(82232);function i(e,t,r,n,{event:s}){return[t,{event:"function"==typeof s?s(r,n):s},void 0]}function o(e,{event:t}){e.defer(()=>e.emit(t))}function a(e){function t(e,t){}return t.type="xstate.emit",t.event=e,t.resolve=i,t.execute=o,t}let u=function(e){return e.Parent="#_parent",e.Internal="#_internal",e}({});function c(e,t,r,n,{to:s,event:i,id:o,delay:a},c){let l,d,h=t.machine.implementations.delays;if("string"==typeof i)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);let p="function"==typeof i?i(r,n):i;if("string"==typeof a){let e=h&&h[a];l="function"==typeof e?e(r,n):e}else l="function"==typeof a?a(r,n):a;let f="function"==typeof s?s(r,n):s;if("string"==typeof f){if(!(d=f===u.Parent?e.self._parent:f===u.Internal?e.self:f.startsWith("#_")?t.children[f.slice(2)]:c.deferredActorIds?.includes(f)?f:t.children[f]))throw Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`)}else d=f||e.self;return[t,{to:d,targetId:"string"==typeof f?f:void 0,event:p,id:o,delay:l},void 0]}function l(e,t,r){"string"==typeof r.to&&(r.to=t.children[r.to])}function d(e,t){e.defer(()=>{let{to:r,event:s,delay:i,id:o}=t;if("number"==typeof i)return void e.system.scheduler.schedule(e.self,r,s,i,o);e.system._relay(e.self,r,s.type===n.W?(0,n.Y)(e.self.id,s.data):s)})}function h(e,t,r){function n(e,t){}return n.type="xstate.sendTo",n.to=e,n.event=t,n.id=r?.id,n.delay=r?.delay,n.resolve=c,n.retryResolve=l,n.execute=d,n}function p(e,t){return h(u.Parent,e,t)}function f(e,t,r,i,{collect:o}){let u=[],c=function(e){u.push(e)};return c.assign=(...e)=>{u.push((0,s.a)(...e))},c.cancel=(...e)=>{u.push((0,n.a)(...e))},c.raise=(...e)=>{u.push((0,n.r)(...e))},c.sendTo=(...e)=>{u.push(h(...e))},c.sendParent=(...e)=>{u.push(p(...e))},c.spawnChild=(...e)=>{u.push((0,n.b)(...e))},c.stopChild=(...e)=>{u.push((0,n.s)(...e))},c.emit=(...e)=>{u.push(a(...e))},o({context:r.context,event:r.event,enqueue:c,check:e=>(0,n.z)(e,t.context,r.event,t),self:e.self,system:e.system},i),[t,void 0,u]}function y(e){function t(e,t){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=f,t}function g(e,t,r,n,{value:s,label:i}){return[t,{value:"function"==typeof s?s(r,n):s,label:i},void 0]}function v({logger:e},{value:t,label:r}){r?e(r,t):e(t)}function m(e=({context:e,event:t})=>({context:e,event:t}),t){function r(e,t){}return r.type="xstate.log",r.value=e,r.label=t,r.resolve=g,r.execute=v,r}},78345:(e,t,r)=>{r.d(t,{R:()=>a});var n=r(33273),s=function(e){function t(t,r){return e.call(this)||this}return(0,n.C6)(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(84892).yU),i={setInterval:function(e,t){for(var r=[],s=2;s<arguments.length;s++)r[s-2]=arguments[s];var o=i.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,(0,n.fX)([e,t],(0,n.zs)(r))):setInterval.apply(void 0,(0,n.fX)([e,t],(0,n.zs)(r)))},clearInterval:function(e){var t=i.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},o=r(88884),a=function(e){function t(t,r){var n=e.call(this,t,r)||this;
15return n.scheduler=t,n.work=r,n.pending=!1,n}return(0,n.C6)(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r,n=this.id,s=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(s,n,t)),this.pending=!0,this.delay=t,this.id=null!=(r=this.id)?r:this.requestAsyncId(s,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),i.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&i.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,(0,o.o)(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(s)},78714:(e,t,r)=>{r.d(t,{v:()=>i});var n=r(73621),s=r(68326);function i(e){return new n.c(function(t){(0,s.Tg)(e()).subscribe(t)})}},79728:(e,t,r)=>{r.d(t,{s:()=>n});var n="function"==typeof Symbol&&Symbol.observable||"@@observable"},82222:(e,t,r)=>{r.d(t,{R:()=>function e(t,r,f,y){if((0,u.T)(f)&&(y=f,f=void 0),y)return e(t,r,f).pipe((0,c.I)(y));var g,v,m,b=(0,n.zs)((g=t,(0,u.T)(g.addEventListener)&&(0,u.T)(g.removeEventListener))?d.map(function(e){return function(n){return t[e](r,n,f)}}):(v=t,(0,u.T)(v.addListener)&&(0,u.T)(v.removeListener))?l.map(p(t,r)):(m=t,(0,u.T)(m.on)&&(0,u.T)(m.off))?h.map(p(t,r)):[],2),w=b[0],_=b[1];if(!w&&(0,a.X)(t))return(0,o.Z)(function(t){return e(t,r,f)})((0,s.Tg)(t));if(!w)throw TypeError("Invalid event target");return new i.c(function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.next(1<t.length?t:t[0])};return w(t),function(){return _(t)}})}});var n=r(33273),s=r(68326),i=r(73621),o=r(29844),a=r(49609),u=r(13073),c=r(92552),l=["addListener","removeListener"],d=["addEventListener","removeEventListener"],h=["on","off"];function p(e,t){return function(r){return function(n){return e[r](t,n)}}}},82232:(e,t,r)=>{r.d(t,{a:()=>i});var n=r(38463);function s(e,t,r,s,{assignment:i}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let o={},a={context:t.context,event:r.event,spawn:function(e,{machine:t,context:r},s,i){return(o,a)=>{let u=((o,a)=>{if("string"!=typeof o)return(0,n.c)(o,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:o,systemId:a?.systemId});{let u=(0,n.V)(t,o);if(!u)throw Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);let c=(0,n.c)(u,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:"function"==typeof a?.input?a.input({context:r,event:s,self:e.self}):a?.input,src:o,systemId:a?.systemId});return i[c.id]=c,c}})(o,a);return i[u.id]=u,e.defer(()=>{u._processingStatus!==n.Z.Stopped&&u.start()}),u}}(e,t,r.event,o),self:e.self,system:e.system},u={};if("function"==typeof i)u=i(a,s);else for(let e of Object.keys(i)){let t=i[e];u[e]="function"==typeof t?t(a,s):t}let c=Object.assign({},t.context,u);return[(0,n._)(t,{context:c,children:Object.keys(o).length?{...t.children,...o}:t.children}),void 0,void 0]}function i(e){function t(e,t){}return t.type="xstate.assign",t.assignment=e,t.resolve=s,t}},84892:(e,t,r)=>{r.d(t,{Kn:()=>u,yU:()=>a,Uv:()=>c});var n=r(33273),s=r(13073),i=(0,r(61499).L)(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}}),o=r(88884),a=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e,t,r,o,a,u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var c=(0,n.Ju)(u),d=c.next();!d.done;d=c.next())d.value.remove(this)}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else u.remove(this);var h=this.initialTeardown;
15if((0,s.T)(h))try{h()}catch(e){a=e instanceof i?e.errors:[e]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=(0,n.Ju)(p),y=f.next();!y.done;y=f.next()){var g=y.value;try{l(g)}catch(e){a=null!=a?a:[],e instanceof i?a=(0,n.fX)((0,n.fX)([],(0,n.zs)(a)),(0,n.zs)(e.errors)):a.push(e)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}}if(a)throw new i(a)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)l(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!=(r=this._finalizers)?r:[]).push(e)}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&(0,o.o)(t,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&(0,o.o)(r,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),u=a.EMPTY;function c(e){return e instanceof a||e&&"closed"in e&&(0,s.T)(e.remove)&&(0,s.T)(e.add)&&(0,s.T)(e.unsubscribe)}function l(e){(0,s.T)(e)?e():e.unsubscribe()}},85473:(e,t,r)=>{r.d(t,{m:()=>o});var n=r(33273),s=r(40182),i=r(1759),o=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=i.U);var s=e.call(this)||this;return s._bufferSize=t,s._windowTime=r,s._timestampProvider=n,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,r),s}return(0,n.C6)(t,e),t.prototype.next=function(t){var r=this.isStopped,n=this._buffer,s=this._infiniteTimeWindow,i=this._timestampProvider,o=this._windowTime;!r&&(n.push(t),s||n.push(i.now()+o)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),s=0;s<n.length&&!e.closed;s+=r?1:2)e.next(n[s]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this._bufferSize,t=this._timestampProvider,r=this._buffer,n=this._infiniteTimeWindow,s=(n?1:2)*e;if(e<1/0&&s<r.length&&r.splice(0,r.length-s),!n){for(var i=t.now(),o=0,a=1;a<r.length&&r[a]<=i;a+=2)o=a;o&&r.splice(0,o+1)}},t}(s.B)},86288:(e,t,r)=>{r.d(t,{T:()=>i});var n=r(55484),s=r(33272);function i(e,t){return(0,n.N)(function(r,n){var i=0;r.subscribe((0,s._)(n,function(r){n.next(e.call(t,r,i++))}))})}},88884:(e,t,r)=>{r.d(t,{o:()=>n});function n(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}},92552:(e,t,r)=>{r.d(t,{I:()=>o});var n=r(33273),s=r(86288),i=Array.isArray;function o(e){return(0,s.T)(function(t){return i(t)?e.apply(void 0,(0,n.fX)([],(0,n.zs)(t))):e(t)})}},94460:(e,t,r)=>{r.d(t,{j:()=>s});var n=r(55484);function s(e){return(0,n.N)(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}},95183:(e,t,r)=>{r.d(t,{_:()=>i});var n=r(20836),s=r(72415);function i(e,t){var r="object"==typeof t;return new Promise(function(i,o){var a=new s.Ms({next:function(e){i(e),a.unsubscribe()},error:o,complete:function(){r?i(t.defaultValue):o(new n.G)}});e.subscribe(a)})}},96846:(e,t,r)=>{r.d(t,{C:()=>i,U:()=>o});var n=r(33273),s=r(13073);function i(e){return(0,n.AQ)(this,arguments,function(){var t,r,s;return(0,n.YH)(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,(0,n.N3)(t.read())];case 3:if(s=(r=i.sent()).value,!r.done)return[3,5];return[4,(0,n.N3)(void 0)];case 4:return[2,i.sent()];case 5:return[4,(0,n.N3)(s)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function o(e){return(0,s.T)(null==e?void 0:e.getReader)}},97923:(e,t,r)=>{r.d(t,{O:()=>a});var n=r(73621),s=r(42870),i=r(68222),o=r(12845);function a(e,t,r){void 0===e&&(e=0),void 0===r&&(r=s.b);var a=-1;return null!=t&&((0,i.m)(t)?r=t:a=t),new n.c(function(t){var n=(0,o.v)(e)?e-r.now():e;n<0&&(n=0);var s=0;return r.schedule(function(){t.closed||(t.next(s++),0<=a?this.schedule(void 0,a):t.complete())},n)})}},98299:(e,t,r)=>{function n(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}r.d(t,{iz:()=>C,Jt:()=>l,T4:()=>w,IM:()=>E,_S:()=>x,ct:()=>_,R8:()=>v,_4:()=>b,A_:()=>m,Hf:()=>I,fO:()=>q,C:()=>f,dI:()=>d,KT:()=>function e(t,r,s=[]){if(null!==t&&Array.isArray(t))return t.map((t,i)=>{if(n(t)){let n=t._key;if("string"==typeof n)return e(t,r,s.concat({_key:n,_index:i}))}return e(t,r,s.concat(i))});if(n(t)){if("block"===t._type||"span"===t._type){let n={...t};return"block"===t._type?n.children=e(t.children,r,s.concat("children")):"span"===t._type&&(n.text=e(t.text,r,s.concat("text"))),n}return Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n,r,s.concat(t))]))}return r(t,s)}});let s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/_key\s*==\s*['"](.*)['"]/,o=/^\d*:\d*$/;function a(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}function u(e){return"string"==typeof e?i.test(e.trim()):"object"==typeof e&&"_key"in e}function c(e){if("string"==typeof e&&o.test(e))return!0;
15if(!Array.isArray(e)||2!==e.length)return!1;let[t,r]=e;return("number"==typeof t||""===t)&&("number"==typeof r||""===r)}function l(e,t,r){let n="string"==typeof t?h(t):t;if(!Array.isArray(n))throw Error("Path must be an array or a string");let s=e;for(let e=0;e<n.length;e++){let t=n[e];if(a(t)){if(!Array.isArray(s))return r;s=s[t]}if(u(t)){if(!Array.isArray(s))return r;s=s.find(e=>e._key===t._key)}if("string"==typeof t&&(s="object"==typeof s&&null!==s?s[t]:void 0),typeof s>"u")return r}return s}function d(e){if(!Array.isArray(e))throw Error("Path is not an array");return e.reduce((e,t,r)=>{let n=typeof t;if("number"===n)return`${e}[${t}]`;if("string"===n)return`${e}${0===r?"":"."}${t}`;if(u(t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){let[r,n]=t;return`${e}[${r}:${n}]`}throw Error(`Unsupported path segment \`${JSON.stringify(t)}\``)},"")}function h(e){if("string"!=typeof e)throw Error("Path is not a string");let t=e.match(s);if(!t)throw Error("Invalid path string");return t.map(p)}function p(e){return a(e)?Number(e.replace(/[^\d]/g,"")):u(e)?{_key:e.match(i)[1]}:c(e)?function(e){let[t,r]=e.split(":").map(e=>""===e?e:Number(e));return[t,r]}(e):e}var f=Object.freeze({__proto__:null,fromString:h,get:l,isIndexSegment:a,isIndexTuple:c,isKeySegment:u,reKeySegment:i,toString:d});let y="drafts.",g="versions.";function v(e){return e.startsWith(y)}function m(e){return e.startsWith(g)}function b(e){return!v(e)&&!m(e)}function w(e){return m(e)?y+E(e):v(e)?e:y+e}function _(e,t){if("drafts"===t||"published"===t)throw Error('Version can not be "published" or "drafts"');return`${g}${t}.${E(e)}`}function x(e){if(!m(e))return;let[t,r,...n]=e.split(".");return r}function E(e){return m(e)?e.split(".").slice(2).join("."):v(e)?e.slice(y.length):e}let S={"\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t","'":"\\'","\\":"\\\\"},T={"\\f":"\f","\\n":`
16`,"\\r":"\r","\\t":"	","\\'":"'","\\\\":"\\"};function I(e){let t,r=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;for(;null!==(t=n.exec(e));){if(void 0!==t[1]){let e=t[1].replace(/\\(\\|f|n|r|t|')/g,e=>T[e]);r.push(e);continue}if(void 0!==t[2]){r.push(parseInt(t[2],10));continue}if(void 0!==t[3]){let e=t[3].replace(/\\(\\')/g,e=>T[e]);r.push({_key:e,_index:-1});continue}}return r}function $(e){return e.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)})}function q(e,t){var r;if(!t?.mappings)return;let n=(r=$(e),`$${r.map(e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,e=>S[e])}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>S[e])}')]`:`[${e._index}]`).join("")}`);if(void 0!==t.mappings[n])return{mapping:t.mappings[n],matchedPath:n,pathSuffix:""};let s=$(e).map(e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,e=>S[e])}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>S[e])}')]`:`[${e._index}]`);for(let e=s.length-1;e>=0;e--){let r=`$${s.slice(0,e).join("")}`,i=t.mappings[r];if(i){let e=n.substring(r.length);return{mapping:i,matchedPath:r,pathSuffix:e}}}}function C(e){let{baseUrl:t,workspace:r="default",tool:n="default",id:s,type:i,path:o,projectId:a,dataset:u}=e;if(!t)throw Error("baseUrl is required");if(!o)throw Error("path is required");if(!s)throw Error("id is required");if("/"!==t&&t.endsWith("/"))throw Error("baseUrl must not end with a slash");let c="default"===r?void 0:r,l="default"===n?void 0:n,h=E(s),p=Array.isArray(o)?d(o.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)})):o,f=new URLSearchParams({baseUrl:t,id:h,type:i,path:p});if(c&&f.set("workspace",c),l&&f.set("tool",l),a&&f.set("projectId",a),u&&f.set("dataset",u),b(s))f.set("perspective","published");else if(m(s)){let e=x(s);f.set("perspective",e)}let y=["/"===t?"":t];c&&y.push(c);let g=["mode=presentation",`id=${h}`,`type=${i}`,`path=${encodeURIComponent(p)}`];return l&&g.push(`tool=${l}`),y.push("intent","edit",`${g.join(";")}?${f}`),y.join("/")}},99287:(e,t,r)=>{r.d(t,{Q:()=>a});var n=r(55484),s=r(33272),i=r(68326),o=r(47041);function a(e){return(0,n.N)(function(t,r){(0,i.Tg)(e).subscribe((0,s._)(r,function(){return r.complete()},o.l)),r.closed||t.subscribe(r)})}},99670:(e,t,r)=>{function n(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}r.d(t,{Q:()=>u,u4:()=>n});var s={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},i={0:8203,1:8204,2:8205,3:65279};[,,,,].fill(String.fromCodePoint(i[0])).join(""),Object.fromEntries(Object.entries(i).map(e=>e.reverse())),Object.fromEntries(Object.entries(s).map(e=>e.reverse()));var o=`${Object.values(s).map(e=>`\\u{${e.toString(16)}}`).join("")}`,a=RegExp(`[${o}]{4,}`,"gu");function u(e){var t,r;return e&&JSON.parse({cleaned:(t=JSON.stringify(e)).replace(a,""),encoded:(null==(r=t.match(a))?void 0:r[0])||""}.cleaned)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.