1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7003],{2990:(e,t,r)=>{r.d(t,{Fk:()=>u,jF:()=>c,v$:()=>l,vY:()=>h});var s=r(51623);let n={"handshake/syn":s.Tx,"handshake/syn-ack":s.Rr,"handshake/ack":s.IM,"channel/response":s._K,"channel/heartbeat":s.vd,"channel/disconnect":s.FS,"overlay/focus":"visual-editing/focus","overlay/navigate":"visual-editing/navigate","overlay/toggle":"visual-editing/toggle","presentation/toggleOverlay":"presentation/toggle-overlay"},i={[s.Tx]:"handshake/syn",[s.Rr]:"handshake/syn-ack",[s.IM]:"handshake/ack",[s._K]:"channel/response",[s.vd]:"channel/heartbeat",[s.FS]:"channel/disconnect","visual-editing/focus":"overlay/focus","visual-editing/navigate":"overlay/navigate","visual-editing/toggle":"overlay/toggle","presentation/toggle-overlay":"presentation/toggleOverlay"},o=e=>{let{data:t}=e;return t&&"object"==typeof t&&"domain"in t&&"type"in t&&"from"in t&&"to"in t&&("sanity/channels"===t.domain&&(t.domain=s.V2),"overlays"===t.to&&(t.to="visual-editing"),"overlays"===t.from&&(t.from="visual-editing"),t.channelId=t.connectionId,delete t.connectionId,t.type=n[t.type]??t.type),e},a=({context:e},t)=>{let{sources:r,targetOrigin:n}=e,o=(e=>{let{channelId:t,...r}=e,n={...r,connectionId:t};return n.domain===s.V2&&(n.domain="sanity/channels"),"visual-editing"===n.to&&(n.to="overlays"),"visual-editing"===n.from&&(n.from="overlays"),n.type=i[n.type]??n.type,"channel/response"===n.type&&n.responseTo&&!n.data&&(n.data={responseTo:n.responseTo}),("handshake/syn"===n.type||"handshake/syn-ack"===n.type||"handshake/ack"===n.type)&&(n.data={id:n.connectionId}),n})(t.message);r.forEach(e=>{e.postMessage(o,{targetOrigin:n})})},c=()=>({listen:(0,s.CC)(o),requestMachine:(0,s.tP)().provide({actions:{"send message":a}})});function u(){return window.self!==window.top}function l(){return!!window.opener}function h(){return u()||l()}},8835:(e,t,r)=>{r.d(t,{default:()=>tQ});
1var s=r(54568),n=r(42531),i=r(17861),o=r(12288),a=r(51599),c=r(82747),u=r(32280),l=r(49417),h=r(8795),d=r(73358),p=r(72909),f=r(21268),y=r(29830),g=r(49585),m=r(16771),v=r(10732),b=r(50341),w=r(58782),_=r(74435),$=r(43715),x=r(38138),I=r(87039),q=r(53912),S=r(41101);let E="drafts.",R="versions.";function T(e){return e.startsWith(E)}function k(e){return e.startsWith(R)}function j(e){return k(e)?E+C(e):T(e)?e:E+e}function A(e,t){if("drafts"===t||"published"===t)throw Error('Version can not be "published" or "drafts"');return`${R}${t}.${C(e)}`}function O(e){if(!k(e))return;let[t,r]=e.split(".");return r}function C(e){return k(e)?e.split(".").slice(2).join("."):T(e)?e.slice(E.length):e}var D=r(3441);let P=/\r\n|[\n\r\u2028\u2029]/;function M(e,t){let r=0;for(let s=0;s<t.length;s++){let n=t[s].length+1;if(r+n>e)return{line:s+1,column:e-r};r+=n}return{line:t.length,column:t[t.length-1]?.length??0}}class N extends Error{response;statusCode=400;responseBody;traceId;details;constructor(e,t){let r=V(e,t);super(r.message),Object.assign(this,r)}}class L extends Error{response;statusCode=500;responseBody;traceId;details;constructor(e){let t=V(e);super(t.message),Object.assign(this,t)}}function V(e,t){var r,s,n;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),traceId:function(e){let t=e?.headers?.traceparent;if(t)return t.split("-")[1]}(e),message:"",details:void 0};if(!(0,I.u4)(i))return o.message=`${W(e,i)}${H(o.traceId)}`,o;let a=i.error;if("string"==typeof a&&"string"==typeof i.message)return o.message=`${a} - ${i.message}${H(o.traceId)}`,o;if("object"!=typeof a||null===a)return"string"==typeof a?o.message=`${a}${H(o.traceId)}`:"string"==typeof i.message?o.message=`${i.message}${H(o.traceId)}`:o.message=`${W(e,i)}${H(o.traceId)}`,o;if("type"in(s=a)&&"mutationError"===s.type&&"description"in s&&"string"==typeof s.description||"type"in(n=a)&&"actionError"===n.type&&"description"in n&&"string"==typeof n.description){let e=a.items||[],t=e.slice(0,5).map(e=>e.error?.description).filter(Boolean),r=t.length?`: 2- ${t.join(` 3- `)}`:"";return e.length>5&&(r+=` 4...and ${e.length-5} more`),o.message=`${a.description}${H(o.traceId)}${r}`,o.details=i.error,o}return U(a)?(o.message=z(a,t?.options?.query?.tag,o.traceId),o.details=i.error):"description"in a&&"string"==typeof a.description?(o.message=`${a.description}${H(o.traceId)}`,o.details=a):o.message=`${W(e,i)}${H(o.traceId)}`,o}function U(e){return(0,I.u4)(e)&&"queryParseError"===e.type&&"string"==typeof e.query&&"number"==typeof e.start&&"number"==typeof e.end}function z(e,t,r){let{query:s,start:n,end:i,description:o}=e,a=r?` 5(traceId: ${r})`:"";if(!s||typeof n>"u")return`GROQ query parse error: ${o}${a}`;let c=t?` 6 7Tag: ${t}`:"";return`GROQ query parse error: 8${function(e,t,r){let s=e.split(P),{start:n,end:i,markerLines:o}=function(e,t){let r={...e.start},s={...r,...e.end},n=r.line??-1,i=r.column??0,o=s.line,a=s.column,c=Math.max(n-3,0),u=Math.min(t.length,o+3);-1===n&&(c=0),-1===o&&(u=t.length);let l=o-n,h={};if(l)for(let e=0;e<=l;e++){let r=e+n;if(i)if(0===e){let e=t[r-1].length;h[r]=[i,e-i+1]}else if(e===l)h[r]=[0,a];else{let s=t[r-e].length;h[r]=[0,s]}else h[r]=!0}else i===a?i?h[n]=[i,0]:h[n]=!0:h[n]=[i,a-i];return{start:c,end:u,markerLines:h}}({start:M(t.start,s),end:t.end?M(t.end,s):void 0},s),a=`${i}`.length;return e.split(P,i).slice(n,i).map((e,t)=>{let s=n+1+t,i=` ${` ${s}`.slice(-a)} |`,c=o[s],u=!o[s+1];if(!c)return` ${i}${e.length>0?` ${e}`:""}`;let l="";if(Array.isArray(c)){let t=e.slice(0,Math.max(c[0]-1,0)).replace(/[^\t]/g," "),s=c[1]||1;l=` 9 `+i.replace(/\d/g," ")+" "+t+"^".repeat(s),u&&r&&(l+=" "+r)}return">"+i+(e.length>0?` ${e}`:"")+l}).join(` 10`)}(s,{start:n,end:i},o)}${c}${a}`}function W(e,t){var r,s;let n="string"==typeof t?` (${s=100,(r=t).length>100?`${r.slice(0,s)}\u2026`:r})`:"",i=e.statusMessage?` ${e.statusMessage}`:"";return`${e.method}-request to ${e.url} resulted in HTTP ${e.statusCode}${i}${n}`}function H(e){return e?` (traceId: ${e})`:""}
10class B extends Error{projectId;addOriginUrl;constructor({projectId:e,credentials:t}={}){if(super("CorsOriginError"),this.name="CorsOriginError",this.projectId=e,e&&"u">typeof location){let r=new URL(`https://sanity.io/manage/project/${e}/api`),{origin:s}=location;r.searchParams.set("cors","add"),r.searchParams.set("origin",s),t&&r.searchParams.set("credentials",""),this.addOriginUrl=r,this.message=`The current origin is not allowed to connect to the Live Content API. Add it here: ${r}`}else e?this.message=`The current origin is not allowed to connect to the Live Content API. Change your configuration here: https://sanity.io/manage/project/${e}/api`:this.message="The current origin is not allowed to connect to the Live Content API."}}let F={onResponse:(e,t)=>{if(e.statusCode>=500)throw new L(e);if(e.statusCode>=400)throw new N(e,t);return e}};function J(e,t={}){return(0,n.af)([(0,i.L5)({shouldRetry:G}),...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 s=e.headers["x-sanity-warning"];for(let e of Array.isArray(s)?s:[s])!e||t[e]||r(e)||(t[e]=!0,console.warn(e));return e}}}(t),(0,i.UX)(),(0,i.Yf)(),(0,i.qB)(),F,(0,i.sH)({implementation:o.c})])}function G(e,t,r){if(0===r.maxRetries)return!1;let s="GET"===r.method||"HEAD"===r.method,n=(r.uri||r.url).startsWith("/data/query"),o=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return(!!s||!!n)&&!!o||i.L5.shouldRetry(e,t,r)}function Y(e){return"https://www.sanity.io/help/"+e}let Q=["image","file"],X=["before","after","replace"],Z=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")},K=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`${e}() takes an object of properties`)},ee=(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`)},et=(e,t)=>{if(!t._id)throw Error(`${e}() requires that the document contains an ID ("_id" property)`);ee(e,t._id)},er=(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)},es=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")},en=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},ei=e=>{let t=e.resource;if(!t)throw Error("`resource` must be provided to perform resource queries");let{type:r,id:s}=t;switch(r){case"dataset":if(2!==s.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()}`)}},eo=(e,t)=>{if(t.resource)throw Error(`\`${e}\` does not support resource-based operations`)},ea=e=>(function(e){let t=!1,r;return(...s)=>(t||(r=e(...s),t=!0),r)})((...t)=>console.warn(e.join(" "),...t)),ec=ea(["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=ea(["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."]),el=ea(["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."]),eh=ea(["The `previewDrafts` perspective has been renamed to `drafts` and will be removed in a future API version"]),ed=ea(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${Y("js-client-browser-token")} for more information and how to hide this warning.`]),ep=ea(["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`."]),ef=ea(["Using the Sanity client without specifying an API version is deprecated.",`See ${Y("js-client-api-version")}`]),ey=(ea(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),ea(["You have called `createVersion()` with a defined `document`. The recommended approach is to provide a `baseId` and `releaseId` instead."])),eg=ea(["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."]),em={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},ev=["localhost","127.0.0.1","0.0.0.0"];function eb(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 ew=(e,t)=>{let r,s={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||em.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};s.apiVersion||ef();let n={...em,...s};n["~experimental_resource"]&&!n.resource&&(eg(),n.resource=n["~experimental_resource"]);let i=n.resource,o=n.useProjectHostname&&!i;if(typeof Promise>"u"){let e=Y("js-client-promise-polyfill");throw Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(o&&!n.projectId)throw Error("Configuration must contain `projectId`");if(i&&ei(n),"u">typeof n.perspective&&eb(n.perspective),"encodeSourceMap"in n)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 n)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 n.stega.enabled)throw Error(`stega.enabled must be a boolean, received ${n.stega.enabled}`);if(n.stega.enabled&&void 0===n.stega.studioUrl)throw Error("stega.studioUrl must be defined when stega.enabled is true");if(n.stega.enabled&&"string"!=typeof n.stega.studioUrl&&"function"!=typeof n.stega.studioUrl)throw Error(`stega.studioUrl must be a string or a function, received ${n.stega.studioUrl}`);let a="u">typeof window&&window.location&&window.location.hostname,c=a&&(r=window.location.hostname,-1!==ev.indexOf(r)),u=!!n.token;n.withCredentials&&u&&(ep(),n.withCredentials=!1),a&&c&&u&&!0!==n.ignoreBrowserTokenWarning?ed():typeof n.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")})(n.projectId),n.dataset&&Z(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?en(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion=`${n.apiVersion}`.replace(/^v/,""),n.isDefaultApi=n.apiHost===em.apiHost,!0===n.useCdn&&n.withCredentials&&ec(),n.useCdn=!1!==n.useCdn&&!n.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`")}(n.apiVersion);let l=n.apiHost.split("://",2),h=l[0],d=l[1],p=n.isDefaultApi?"apicdn.sanity.io":d;return o?(n.url=`${h}://${n.projectId}.${d}/v${n.apiVersion}`,n.cdnUrl=`${h}://${n.projectId}.${p}/v${n.apiVersion}`):(n.url=`${n.apiHost}/v${n.apiVersion}`,n.cdnUrl=n.url),n};class e_ extends Error{name="ConnectionFailedError"}class e$ extends Error{name="DisconnectError";reason;constructor(e,t,r={}){super(e,r),this.reason=t}}class ex extends Error{name="ChannelError";data;constructor(e,t){super(e),this.data=t}}class eI extends Error{name="MessageError";data;constructor(e,t,r={}){super(e,r),this.data=t}}class eq extends Error{name="MessageParseError"}let eS=["channelError","disconnect"];function eE(e,t){return(0,a.v)(()=>{let t=e();return(0,c.A)(t)?t:(0,u.of)(t)}).pipe((0,l.Z)(e=>{var r,s;return r=e,s=t,new o.c(e=>{let t=s.includes("open"),n=s.includes("reconnect");function i(t){if("data"in t){let[r,s]=eR(t);e.error(r?new eq("Unable to parse EventSource error message",{cause:s}):new eI((s?.data).message,s));return}r.readyState===r.CLOSED?e.error(new e_("EventSource connection failed")):n&&e.next({type:"reconnect"})}function o(){e.next({type:"open"})}function a(t){let[s,n]=eR(t);if(s)return void e.error(new eq("Unable to parse EventSource message",{cause:s}));if("channelError"===t.type){let t=new URL(r.url).searchParams.get("tag");e.error(new ex(function(e,t){let r=e.error;return r?U(r)?z(r,t):r.description?r.description:"string"==typeof r?r:JSON.stringify(r,null,2):e.message||"Unknown listener error"}(n?.data,t),n.data));return}if("disconnect"===t.type)return void e.error(new e$(`Server disconnected client: ${n.data?.reason||"unknown error"}`));e.next({type:t.type,id:t.lastEventId,...n.data?{data:n.data}:{}})}r.addEventListener("error",i),t&&r.addEventListener("open",o);let c=[...new Set([...eS,...s])].filter(e=>"error"!==e&&"open"!==e&&"reconnect"!==e);return c.forEach(e=>r.addEventListener(e,a)),()=>{r.removeEventListener("error",i),t&&r.removeEventListener("open",o),c.forEach(e=>r.removeEventListener(e,a)),r.close()}})}))}function eR(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 eT(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 ek{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 K("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 s="insert(at, selector, items)";if(-1===X.indexOf(e)){let e=X.map(e=>`"${e}"`).join(", ");throw Error(`${s} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw Error(`${s} takes a "selector"-argument which must be a string`);if(!Array.isArray(r))throw Error(`${s} 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,s){let n=t<0?t-1:t,i=typeof r>"u"||-1===r?-1:Math.max(0,t+r),o=`${e}[${n}:${n<0&&i>=0?"":i}]`;return this.insert("replace",o,s||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...eT(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,r=!0){return K(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 ej extends ek{#e;constructor(e,t,r){super(e,t),this.#e=r}clone(){return new ej(this.selection,{...this.operations},this.#e)}commit(e){if(!this.#e)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.#e.mutate({patch:this.serialize()},t)}}class eA extends ek{#e;constructor(e,t,r){super(e,t),this.#e=r}clone(){return new eA(this.selection,{...this.operations},this.#e)}commit(e){if(!this.#e)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.#e.mutate({patch:this.serialize()},t)}}let eO={returnDocuments:!1};class eC{operations;trxId;constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return K("create",e),this._add({create:e})}createIfNotExists(e){let t="createIfNotExists";return K(t,e),et(t,e),this._add({[t]:e})}createOrReplace(e){let t="createOrReplace";return K(t,e),et(t,e),this._add({[t]:e})}delete(e){return ee("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 eD extends eC{#e;constructor(e,t,r){super(e,r),this.#e=t}clone(){return new eD([...this.operations],this.#e,this.trxId)}commit(e){if(!this.#e)throw Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#e.mutate(this.serialize(),Object.assign({transactionId:this.trxId},eO,e||{}))}patch(e,t){let r="function"==typeof t,s="string"!=typeof e&&e instanceof eA,n="object"==typeof e&&("query"in e||"id"in e);if(s)return this._add({patch:e.serialize()});if(r){let r=t(new eA(e,{},this.#e));if(!(r instanceof eA))throw Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}if(n){let r=new eA(e,t||{},this.#e);return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}class eP extends eC{#e;constructor(e,t,r){super(e,r),this.#e=t}clone(){return new eP([...this.operations],this.#e,this.trxId)}commit(e){if(!this.#e)throw Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#e.mutate(this.serialize(),Object.assign({transactionId:this.trxId},eO,e||{}))}patch(e,t){let r="function"==typeof t;if("string"!=typeof e&&e instanceof ej)return this._add({patch:e.serialize()});if(r){let r=t(new ej(e,{},this.#e));if(!(r instanceof ej))throw Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}let eM=({query:e,params:t={},options:r={}})=>{let s=new URLSearchParams,{tag:n,includeMutations:i,returnQuery:o,...a}=r;for(let[r,i]of(n&&s.append("tag",n),s.append("query",e),Object.entries(t)))void 0!==i&&s.append(`$${r}`,JSON.stringify(i));for(let[e,t]of Object.entries(a))t&&s.append(e,`${t}`);return!1===o&&s.append("returnQuery","false"),!1===i&&s.append("includeMutations","fal
13se"),`?${s}`},eN=e=>"response"===e.type,eL=e=>e.body;function eV(e,t,s,n,i={},o={}){let a="stega"in o?{...s||{},..."boolean"==typeof o.stega?{enabled:o.stega}:o.stega||{}}:s,c=a.enabled?(0,I.Q)(i):i,u=!1===o.filterResponse?e=>e:e=>e.result,{cache:l,next:d,...p}={useAbortSignal:"u">typeof o.signal,resultSourceMap:a.enabled?"withKeyArraySelector":o.resultSourceMap,...o,returnQuery:!1===o.filterResponse&&!1!==o.returnQuery},f=e0(e,t,"query",{query:n,params:c},"u">typeof l||"u">typeof d?{...p,fetch:{cache:l,next:d}}:p);return a.enabled?f.pipe((0,q.v)((0,h.H)(r.e(1873).then(r.bind(r,71873)).then(function(e){return e.stegaEncodeSourceMap$1}).then(({stegaEncodeSourceMap:e})=>e))),(0,$.T)(([e,t])=>{let r=t(e.result,e.resultSourceMap,a);return u({...e,result:r})})):f.pipe((0,$.T)(u))}function eU(e,t,r,s={}){let n={uri:e6(e,"doc",(()=>{if(!s.releaseId)return r;let e=O(r);if(!e){if(T(r))throw Error(`The document ID (\`${r}\`) is a draft, but \`options.releaseId\` is set as \`${s.releaseId}\``);return A(r,s.releaseId)}if(e!==s.releaseId)throw Error(`The document ID (\`${r}\`) is already a version of \`${e}\` release, but this does not match the provided \`options.releaseId\` (\`${s.releaseId}\`)`);return r})()),json:!0,tag:s.tag,signal:s.signal,query:void 0!==s.includeAllVersions?{includeAllVersions:s.includeAllVersions}:void 0};return e7(e,t,n).pipe((0,S.p)(eN),(0,$.T)(e=>{let t=e.body.documents;return t?s.includeAllVersions?t:t[0]:s.includeAllVersions?[]:void 0}))}function ez(e,t,r,s={}){let n={uri:e6(e,"doc",r.join(",")),json:!0,tag:s.tag,signal:s.signal};return e7(e,t,n).pipe((0,S.p)(eN),(0,$.T)(e=>{let t,s,n=(t=e.body.documents||[],s=e=>e._id,t.reduce((e,t)=>(e[s(t)]=t,e),Object.create(null)));return r.map(e=>n[e]||null)}))}function eW(e,t,r,s={}){return e0(e,t,"query",{query:"*[sanity::partOfRelease($releaseId)]",params:{releaseId:r}},s)}function eH(e,t,r,s){return et("createIfNotExists",r),e1(e,t,r,"createIfNotExists",s)}function eB(e,t,r,s){return et("createOrReplace",r),e1(e,t,r,"createOrReplace",s)}function eF(e,t,r,s,n){return et("createVersion",r),er("createVersion",r),ey(),eK(e,t,{actionType:"sanity.action.document.version.create",publishedId:s,document:r},n)}function eJ(e,t,r,s,n,i,o){if(!s)throw Error("`createVersion()` requires `baseId` when no `document` is provided");if(!r)throw Error("`createVersion()` requires `publishedId` when `baseId` is provided");return ee("createVersion",s),ee("createVersion",r),eK(e,t,{actionType:"sanity.action.document.version.create",publishedId:r,baseId:s,versionId:n?A(r,n):j(r),ifBaseRevisionId:i},o)}function eG(e,t,r,s){return e0(e,t,"mutate",{mutations:[{delete:eT(r)}]},s)}function eY(e,t,r,s=!1,n){return eK(e,t,{actionType:"sanity.action.document.version.discard",versionId:r,purge:s},n)}function eQ(e,t,r,s){return et("replaceVersion",r),er("replaceVersion",r),eK(e,t,{actionType:"sanity.action.document.version.replace",document:r},s)}function eX(e,t,r,s,n){return eK(e,t,{actionType:"sanity.action.document.version.unpublish",versionId:r,publishedId:s},n)}function eZ(e,t,r,s){let n;return e0(e,t,"mutate",{mutations:Array.isArray(n=r instanceof eA||r instanceof ej?{patch:r.serialize()}:r instanceof eD||r instanceof eP?r.serialize():r)?n:[n],transactionId:s&&s.transactionId||void 0},s)}function eK(e,t,r,s){let n=Array.isArray(r)?r:[r],i=s&&s.transactionId||void 0;return e0(e,t,"actions",{actions:n,transactionId:i,skipCrossDatasetReferenceValidation:s&&s.skipCrossDatasetReferenceValidation||void 0,dryRun:s&&s.dryRun||void 0},s)}function e0(e,t,r,s,n={}){let i="mutate"===r,o="actions"===r,a=i||o?"":eM(s),c=!i&&!o&&a.length<11264,u=c?a:"",l=n.returnFirst,{timeout:h,token:d,tag:p,headers:f,returnQuery:y,lastLiveEventId:g,cacheMode:m}=n,v={method:c?"GET":"POST",uri:e6(e,r,u),json:!0,body:c?void 0:s,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}})(n),timeout:h,headers:f,token:d,tag:p,returnQuery:y,perspective:n.perspective,resultSourceMap:n.resultSourceMap,lastLiveEventId:Array.isArray(g)?g[0]:g,cacheMode:m,canUseCdn:"query"===r,signal:n.signal,fetch:n.fetch,useAbortSignal:n.useAbortSignal,useCdn:n.useCdn};return e7(e,t,v).pipe((0,S.p)(eN),(0,$.T)(eL),(0,$.T)(e=>{if(!i)return e;let t=e.results||[];if(n.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 e1(e,t,r,s,n={}){return e0(e,t,"mutate",{mutations:[{[s]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},n))}let e2=e=>{let t=e.config();return void 0!==t.dataset&&void 0!==t.projectId||void 0!==t.resource},e9=(e,t)=>
13e2(e)&&t.startsWith(e6(e,"query"));function e7(e,t,r){var s;let n=r.url||r.uri,i=e.config(),a=typeof r.canUseCdn>"u"?["GET","HEAD"].indexOf(r.method||"GET")>=0&&(n.startsWith("/data/")||e9(e,n)||e2(e)&&n.startsWith(e6(e,"mutate"))||e2(e)&&n.startsWith(e6(e,"doc",""))||e2(e)&&n.startsWith(e6(e,"listen"))||e2(e)&&n.startsWith(e6(e,"history",""))):r.canUseCdn,c=(r.useCdn??i.useCdn)&&a,u=r.tag&&i.requestTagPrefix?[i.requestTagPrefix,r.tag].join("."):r.tag||i.requestTagPrefix;if(u&&null!==r.tag&&(r.query={tag:en(u),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&e9(e,n)){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&&eh(),eb(t),r.query={perspective:Array.isArray(t)?t.join(","):t,...r.query},(Array.isArray(t)&&t.length>0||"previewDrafts"===t||"drafts"===t)&&c&&(c=!1,el())),r.lastLiveEventId&&(r.query={...r.query,lastLiveEventId:r.lastLiveEventId}),!1===r.returnQuery&&(r.query={returnQuery:"false",...r.query}),c&&"noStale"==r.cacheMode&&(r.query={cacheMode:"noStale",...r.query})}let l=function(e,t={}){let r={};e.headers&&Object.assign(r,e.headers);let s=t.token||e.token;s&&(r.Authorization=`Bearer ${s}`),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r["X-Sanity-Project-ID"]=e.projectId);let n=!!(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:n,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(i,Object.assign({},r,{url:e5(e,n,c)})),h=new o.c(e=>t(l,i.requester).subscribe(e));return r.signal?h.pipe((s=r.signal,e=>new o.c(t=>{let r=()=>t.error(function(e){if(e8)return new DOMException(e?.reason??"The operation was aborted.","AbortError");let t=Error(e?.reason??"The operation was aborted.");return t.name="AbortError",t}(s));if(s&&s.aborted)return void r();let n=e.subscribe(t);return s.addEventListener("abort",r),()=>{s.removeEventListener("abort",r),n.unsubscribe()}}))):h}function e3(e,t,r){return e7(e,t,r).pipe((0,S.p)(e=>"response"===e.type),(0,$.T)(e=>e.body))}function e6(e,t,r){let s=e.config();if(s.resource){ei(s);let e=e4(s),n=void 0!==r?`${t}/${r}`:t;return`${e}/${n}`.replace(/\/($|\?)/,"$1")}let n=es(s),i=`/${t}/${n}`;return`/data${void 0!==r?`${i}/${r}`:i}`.replace(/\/($|\?)/,"$1")}function e5(e,t,r=!1){let{url:s,cdnUrl:n}=e.config();return`${r?n:s}/${t.replace(/^\//,"")}`}let e8=!!globalThis.DOMException,e4=e=>{let t=e.resource;if(!t)throw Error("`resource` must be provided to perform resource queries");let{type:r,id:s}=t;switch(r){case"dataset":{let e=s.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/${s}`;case"media-library":return`/media-libraries/${s}`;case"dashboard":return`/dashboards/${s}`;default:throw Error(`Unsupported resource type: ${r.toString()}`)}};function te(e,t,r){let s=es(e.config());return e3(e,t,{method:"POST",uri:`/agent/action/generate/${s}`,body:r})}function tt(e,t,r){let s=es(e.config());return e3(e,t,{method:"POST",uri:`/agent/action/transform/${s}`,body:r})}function tr(e,t,r){let s=es(e.config());return e3(e,t,{method:"POST",uri:`/agent/action/translate/${s}`,body:r})}class ts{#e;#t;constructor(e,t){this.#e=e,this.#t=t}generate(e){return te(this.#e,this.#t,e)}transform(e){return tt(this.#e,this.#t,e)}translate(e){return tr(this.#e,this.#t,e)}}class tn{#e;#t;constructor(e,t){this.#e=e,this.#t=t}generate(e){return(0,d.s)(te(this.#e,this.#t,e))}transform(e){return(0,d.s)(tt(this.#e,this.#t,e))}translate(e){return(0,d.s)(tr(this.#e,this.#t,e))}prompt(e){return(0,d.s)(function(e,t,r){let s=es(e.config());return e3(e,t,{method:"POST",uri:`/agent/action/prompt/${s}`,body:r})}(this.#e,this.#t,e))}patch(e){return(0,d.s)(function(e,t,r){let s=es(e.config());return e3(e,t,{method:"POST",uri:`/agent/action/patch/${s}`,body:r})}(this.#e,this.#t,e))}}class ti{#e;#t;constructor(e,t){this.#e=e,this.#t=t}upload(e,t,r){return ta(this.#e,this.#t,e,t,r)}}class to{#e;#t;constructor(e,t){this.#e=e,this.#t=t}upload(e,t,r){let s=ta(this.#e,this.#t,e,t,r);return(0,d.s)(s.pipe((0,S.p)(e=>"response"===e.type),(0,$.T)(e=>e.body.document)))}}function ta(e,t,r,s,n={}){var i,o;if(-1===Q.indexOf(r))throw Error(`Invalid asset type: ${r}. Must be one of ${Q.join(", ")}`);let a=n.extract||void 0;a&&!a.length&&(a=["none"]);let c=e.config(),u=(i=n,o=s,!(typeof File>"u")&&o instanceof File?Object.assign({filename:!1===i.preserveFilename?void 0:o.name,contentType:o.type},i):i),{tag:l,label:h,title:d,description:p,creditLine:f,filename:y,source:g}=u,m=c.resource?.type==="media-library",v=m?{title:d,filename:y}:{label:h,title:d,description:p,filename:y,meta:a,creditLine:f};return g&&!m&&(v.sourceId=g.id,v.sourceName=g.name,v.sourceUrl=g.url),e7(e,t,{tag:l,method:"POST",timeout:u.timeout||0,uri:function(e,t){let r="image"===t?"images":"files",s=e.resource;if(s){let{type:e,id:t}=s;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 n=es(e);return`assets/${r}/${n}`}(c,r),headers:u.contentType?{"Content-Type":u.contentType}:{},query:v,body:s})}let tc=(0,a.v)(()=>r.e(584).then(r.t.bind(r,50584,19))).pipe((0,$.T)(({default:e})=>e),(0,p.t)(1));function tu(){return function(e){return e.pipe((0,f.W)((e,t)=>e instanceof e_?(0,y.x)((0,u.of)({type:"reconnect"}),(0,g.O)(1e3).pipe((0,l.Z)(()=>t))):(0,m.$)(()=>e)))}}let tl=["includePreviousRevision","includeResult","includeMutations","includeAllVersions","visibility","effectFormat","enableResume","tag"],th={includeResult:!0};function td(e,t,r={}){let{url:s,token:n,withCredentials:i,requestTagPrefix:o,headers:a}=this.config(),c=r.tag&&o?[o,r.tag].join("."):r.tag,l={...Object.keys(th).concat(Object.keys(r)).reduce((e,t)=>
13(e[t]=typeof r[t]>"u"?th[t]:r[t],e),{}),tag:c},h=eM({query:e,params:t,options:{tag:c,...tl.reduce((e,t)=>(typeof l[t]>"u"||(e[t]=l[t]),e),{})}}),d=`${s}${e6(this,"listen",h)}`;if(d.length>14800)return(0,m.$)(()=>Error("Query too large for listener"));let p=l.events?l.events:["mutation"],f={};return i&&(f.withCredentials=!0),(n||a)&&(f.headers={},n&&(f.headers.Authorization=`Bearer ${n}`),a&&Object.assign(f.headers,a)),eE(()=>(typeof EventSource>"u"||f.headers?tc:(0,u.of)(EventSource)).pipe((0,$.T)(e=>new e(d,f))),p).pipe(tu(),(0,S.p)(e=>p.includes(e.type)),(0,$.T)(e=>({type:e.type,..."data"in e?e.data:{}})))}let tp="2021-03-25";class tf{#e;constructor(e){this.#e=e}events({includeDrafts:e=!1,tag:t,waitFor:r}={}){var s,n,i,a,c;let{projectId:h,apiVersion:d,token:p,withCredentials:y,requestTagPrefix:g,headers:x}=this.#e.config(),I=d.replace(/^v/,"");if("X"!==I&&I<tp)throw Error(`The live events API requires API version ${tp} or later. The current API version is ${I}. Please update your API version to use this feature.`);if(e&&!p&&!y)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 q=e6(this.#e,"live/events"),S=new URL(this.#e.getUrl(q,!1)),E=t&&g?[g,t].join("."):t;E&&S.searchParams.set("tag",E),e&&S.searchParams.set("includeDrafts","true"),r&&S.searchParams.set("waitFor",r);let R={};e&&y&&(R.withCredentials=!0),(e&&p||x)&&(R.headers={},e&&p&&(R.headers.Authorization=`Bearer ${p}`),x&&Object.assign(R.headers,x));let T=`${S.href}::${JSON.stringify(R)}`,k=ty.get(T);if(k)return k;let j=eE(()=>(typeof EventSource>"u"||R.headers?tc:(0,u.of)(EventSource)).pipe((0,$.T)(e=>
13new e(S.href,R))),["message","restart","welcome","reconnect","goaway"]),A=(n=new URL(this.#e.getUrl("/check/cors",!1)),i=h,a=!0===R.withCredentials,new o.c(e=>{let t=new AbortController,{signal:r}=t;return fetch(n,{method:"GET",mode:"cors",credentials:"omit",signal:r}).then(e=>{if(!(r.aborted||!e.ok))return e.json()}).then(t=>{if(!r.aborted){if(a&&t?.result?.withCredentials===!1)return void e.error(new B({projectId:i,credentials:!0}));if(t?.result?.allowed===!1)return void e.error(new B({projectId:i,credentials:a}));e.next(),e.complete()}}).catch(()=>{r.aborted||e.closed||(e.next(),e.complete())}),()=>t.abort()})),O=j.pipe(tu(),(0,l.Z)(e=>"reconnect"===e.type?A.pipe((0,l.Z)(()=>(0,u.of)(e))):(0,u.of)(e)),(0,f.W)(e=>e instanceof B?(0,m.$)(()=>e):A.pipe((0,l.Z)(()=>{throw e}))),(0,$.T)(e=>{if("message"===e.type){let{data:t,...r}=e;return{...r,tags:t.tags}}return e})).pipe((0,b.j)(()=>ty.delete(T)),(c="function"==typeof(s={predicate:e=>"welcome"===e.type})?{predicate:s,...void 0}:s,e=>{let t,r=!1,{predicate:s,...n}=c,i=e.pipe((0,v.M)(e=>{c.predicate(e)&&(r=!0,t=e)}),(0,b.j)(()=>{r=!1,t=void 0}),(0,w.u)(n)),a=new o.c(e=>{r&&e.next(t),e.complete()});return(0,_.h)(i,a)}));return ty.set(T,O),O}}let ty=new Map;class tg{#e;#t;constructor(e,t){this.#e=e,this.#t=t}create(e,t){return tb(this.#e,this.#t,"PUT",e,t)}edit(e,t){return tb(this.#e,this.#t,"PATCH",e,t)}delete(e){return tb(this.#e,this.#t,"DELETE",e)}list(){eo("dataset",this.#e.config());let e=this.#e.config(),t=e.projectId,r="/datasets";return!1===e.useProjectHostname&&(r=`/projects/${t}/datasets`),e3(this.#e,this.#t,{uri:r,tag:null})}getEmbeddingsSettings(e){return eo("dataset",this.#e.config()),Z(e),e3(this.#e,this.#t,{uri:tv(this.#e,e),tag:null})}editEmbeddingsSettings(e,t){return eo("dataset",this.#e.config()),Z(e),e3(this.#e,this.#t,{method:"PUT",uri:tv(this.#e,e),body:t,tag:null})}}class tm{#e;#t;constructor(e,t){this.#e=e,this.#t=t}create(e,t){return eo("dataset",this.#e.config()),(0,d.s)(tb(this.#e,this.#t,"PUT",e,t))}edit(e,t){return eo("dataset",this.#e.config()),(0,d.s)(tb(this.#e,this.#t,"PATCH",e,t))}delete(e){return eo("dataset",this.#e.config()),(0,d.s)(tb(this.#e,this.#t,"DELETE",e))}list(){eo("dataset",this.#e.config());let e=this.#e.config(),t=e.projectId,r="/datasets";return!1===e.useProjectHostname&&(r=`/projects/${t}/datasets`),(0,d.s)(e3(this.#e,this.#t,{uri:r,tag:null}))}getEmbeddingsSettings(e){return eo("dataset",this.#e.config()),Z(e),(0,d.s)(e3(this.#e,this.#t,{uri:tv(this.#e,e),tag:null}))}editEmbeddingsSettings(e,t){return eo("dataset",this.#e.config()),Z(e),(0,d.s)(e3(this.#e,this.#t,{method:"PUT",uri:tv(this.#e,e),body:t,tag:null}))}}function tv(e,t){let r=e.config();return!1===r.useProjectHostname?`/projects/${r.projectId}/datasets/${t}/settings/embeddings`:`/datasets/${t}/settings/embeddings`}function tb(e,t,r,s,n){return eo("dataset",e.config()),Z(s),e3(e,t,{method:r,uri:`/datasets/${s}`,body:n,tag:null})}class tw{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getPlaybackInfo(e,t={}){var r,s;let n=this.#e.config(),i=(n.resource||n["~experimental_resource"])?.id,{instanceId:o,libraryId:a}=function(e){let t="object"==typeof e&&"_ref"in e?e._ref:e,r=t$.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),c=a||i;if(!c)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 u=(r=o,s=c,`/media-libraries/${s}/video/${r}/playback-info`),l=function(e){let t={};if(e.transformations){let{thumbnail:r,animated:s,storyboard:n}=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)),s&&(s.width&&(t.animatedWidth=s.width),s.height&&(t.animatedHeight=s.height),void 0!==s.start&&(t.animatedStart=s.start),void 0!==s.end&&(t.animatedEnd=s.end),s.fps&&(t.animatedFps=s.fps),s.format&&(t.animatedFormat=s.format)),n&&n.format&&(t.storyboardFormat=n.format)}return e.expiration&&(t.expiration=e.expiration),t}(t);return e3(this.#e,this.#t,{method:"GET",uri:u,query:l})}}class t_{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getPlaybackInfo(e,t={}){return(0,d.s)(new tw(this.#e.observable,this.#t).getPlaybackInfo(e,t))}}
13let t$=/^media-library:(ml[^:]+):([^:]+)$/;class tx{#e;#t;constructor(e,t){this.#e=e,this.#t=t}list(e){let t={};return e?.includeMembers===!1&&(t.includeMembers="false"),e?.includeFeatures===!1&&(t.includeFeatures="false"),e?.organizationId&&(t.organizationId=e.organizationId),e?.onlyExplicitMembership&&(t.onlyExplicitMembership="true"),e3(this.#e,this.#t,{uri:"/projects",query:t})}getById(e){return e3(this.#e,this.#t,{uri:`/projects/${e}`})}}class tI{#e;#t;constructor(e,t){this.#e=e,this.#t=t}list(e){let t={};return e?.includeMembers===!1&&(t.includeMembers="false"),e?.includeFeatures===!1&&(t.includeFeatures="false"),e?.organizationId&&(t.organizationId=e.organizationId),e?.onlyExplicitMembership&&(t.onlyExplicitMembership="true"),(0,d.s)(e3(this.#e,this.#t,{uri:"/projects",query:t}))}getById(e){return(0,d.s)(e3(this.#e,this.#t,{uri:`/projects/${e}`}))}}let tq=(0,D.d_)("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",8),tS=(e,t)=>t?A(e,t):j(e);function tE(e,{releaseId:t,publishedId:r,document:s}){if(r&&s._id){let e=tS(r,t);return((e,t)=>{if(t._id&&t._id!==e)throw Error(`The provided document ID (\`${t._id}\`) does not match the generated version ID (\`${e}\`)`)})(e,s),e}if(s._id){let r=T(s._id),n=k(s._id);if(!r&&!n)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 (\`${s._id}\`) that is a draft ID, but a release ID (\`${t}\`) was also provided.`);let n=O(s._id);if(n!==t)throw Error(`\`${e}()\` was called with a document ID (\`${s._id}\`) that is a version ID, but the release ID (\`${t}\`) does not match the document's version ID (\`${n}\`).`)}return s._id}if(r)return tS(r,t);throw Error(`\`${e}()\` requires either a publishedId or a document with an \`_id\``)}let tR=(e,t)=>{let[r,s,n]=((e,t)=>{if("object"==typeof e&&null!==e&&("releaseId"in e||"metadata"in e)){let{releaseId:r=tq(),metadata:s={}}=e;return[r,s,t]}return[tq(),{},e]})(e,t);return{action:{actionType:"sanity.action.release.create",releaseId:r,metadata:{...s,releaseType:s.releaseType||"undecided"}},options:n}};class tT{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get({releaseId:e},t){return eU(this.#e,this.#t,`_.releases.${e}`,t)}create(e,t){let{action:r,options:s}=tR(e,t),{releaseId:n,metadata:i}=r;return eK(this.#e,this.#t,r,s).pipe((0,$.T)(e=>({...e,releaseId:n,metadata:i})))}edit({releaseId:e,patch:t},r){return eK(this.#e,this.#t,{actionType:"sanity.action.release.edit",releaseId:e,patch:t},r)}publish({releaseId:e},t){return eK(this.#e,this.#t,{actionType:"sanity.action.release.publish",releaseId:e},t)}archive({releaseId:e},t){return eK(this.#e,this.#t,{actionType:"sanity.action.release.archive",releaseId:e},t)}unarchive({releaseId:e},t){return eK(this.#e,this.#t,{actionType:"sanity.action.release.unarchive",releaseId:e},t)}schedule({releaseId:e,publishAt:t},r){return eK(this.#e,this.#t,{actionType:"sanity.action.release.schedule",releaseId:e,publishAt:t},r)}unschedule({releaseId:e},t){return eK(this.#e,this.#t,{actionType:"sanity.action.release.unschedule",releaseId:e},t)}delete({releaseId:e},t){return eK(this.#e,this.#t,{actionType:"sanity.action.release.delete",releaseId:e},t)}fetchDocuments({releaseId:e},t){return eW(this.#e,this.#t,e,t)}}class tk{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get({releaseId:e},t){return(0,d.s)(eU(this.#e,this.#t,`_.releases.${e}`,t))}async create(e,t){let{action:r,options:s}=tR(e,t),{releaseId:n,metadata:i}=r;return{...await (0,d.s)(eK(this.#e,this.#t,r,s)),releaseId:n,metadata:i}}edit({releaseId:e,patch:t},r){return(0,d.s)(eK(this.#e,this.#t,{actionType:"sanity.action.release.edit",releaseId:e,patch:t},r))}publish({releaseId:e},t){return(0,d.s)(eK(this.#e,this.#t,{actionType:"sanity.action.release.publish",releaseId:e},t))}archive({releaseId:e},t){return(0,d.s)(eK(this.#e,this.#t,{actionType:"sanity.action.release.archive",releaseId:e},t))}unarchive({releaseId:e},t){return(0,d.s)(eK(this.#e,this.#t,{actionType:"sanity.action.release.unarchive",releaseId:e},t))}schedule({releaseId:e,publishAt:t},r){return(0,d.s)(eK(this.#e,this.#t,{actionType:"sanity.action.release.schedule",releaseId:e,publishAt:t},r))}unschedule({releaseId:e},t){return(0,d.s)(eK(this.#e,this.#t,{actionType:"sanity.action.release.unschedule",releaseId:e},t))}delete({releaseId:e},t){return(0,d.s)(eK(this.#e,this.#t,{actionType:"sanity.action.release.delete",releaseId:e},t))}fetchDocuments({releaseId:e},t){return(0,d.s)(eW(this.#e,this.#t,e,t))}}class tj{#e;#t;constructor(e,t){this.#e=e,this.#t=t}getById(e){return e3(this.#e,this.#t,{uri:`/users/${e}`})}}class tA{#e;#t;constructor(e,t){this.#e=e,this.#t=t}
13getById(e){return(0,d.s)(e3(this.#e,this.#t,{uri:`/users/${e}`}))}}class tO{assets;datasets;live;mediaLibrary;projects;users;agent;releases;#r;#s;#t;listen=td;constructor(e,t=em){this.config(t),this.#s=e;let r=t._requestHandler;this.#t=r?(()=>{let s;return(n,i)=>(s||(s=new tC(e,{...t,_requestHandler:void 0})),r(n,t=>e(t,i),s))})():e,this.assets=new ti(this,this.#t),this.datasets=new tg(this,this.#t),this.live=new tf(this),this.mediaLibrary={video:new tw(this,this.#t)},this.projects=new tx(this,this.#t),this.users=new tj(this,this.#t),this.agent={action:new ts(this,this.#t)},this.releases=new tT(this,this.#t)}clone(){return new tO(this.#s,this.config())}config(e){if(void 0===e)return{...this.#r};if(this.#r&&!1===this.#r.allowReconfigure)throw Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.#r=ew(e,this.#r||{}),this}withConfig(e){let t=this.config();return new tO(this.#s,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof e?.stega?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,r){return eV(this,this.#t,this.#r.stega,e,t,r)}getDocument(e,t){if(t?.includeAllVersions===!0)return eU(this,this.#t,e,{...t,includeAllVersions:!0});let r={signal:t?.signal,tag:t?.tag,releaseId:t?.releaseId,...t&&"includeAllVersions"in t?{includeAllVersions:!1}:{}};return eU(this,this.#t,e,r)}getDocuments(e,t){return ez(this,this.#t,e,t)}create(e,t){return e1(this,this.#t,e,"create",t)}createIfNotExists(e,t){return eH(this,this.#t,e,t)}createOrReplace(e,t){return eB(this,this.#t,e,t)}createVersion({document:e,publishedId:t,releaseId:r,baseId:s,ifBaseRevisionId:n},i){if(!e)return eJ(this,this.#t,t,s,r,n,i);let o=tE("createVersion",{document:e,publishedId:t,releaseId:r}),a={...e,_id:o},c=t||C(e._id);return eF(this,this.#t,a,c,i)}delete(e,t){return eG(this,this.#t,e,t)}discardVersion({releaseId:e,publishedId:t},r,s){let n=tS(t,e);return eY(this,this.#t,n,r,s)}replaceVersion({document:e,publishedId:t,releaseId:r},s){let n=tE("replaceVersion",{document:e,publishedId:t,releaseId:r}),i={...e,_id:n};return eQ(this,this.#t,i,s)}unpublishVersion({releaseId:e,publishedId:t},r){let s=A(t,e);return eX(this,this.#t,s,t,r)}mutate(e,t){return eZ(this,this.#t,e,t)}patch(e,t){return new ej(e,t,this)}transaction(e){return new eP(e,this)}action(e,t){return eK(this,this.#t,e,t)}request(e){return e3(this,this.#t,e)}getUrl(e,t){return e5(this,e,t)}getDataUrl(e,t){return e6(this,e,t)}}class tC{assets;datasets;live;mediaLibrary;projects;users;agent;releases;observable;#r;#s;#t;listen=td;constructor(e,t=em){this.config(t),this.#s=e;let r=t._requestHandler;this.#t=r?(()=>{let s;return(n,i)=>(s||(s=new tC(e,{...t,_requestHandler:void 0})),r(n,t=>e(t,i),s))})():e,this.assets=new to(this,this.#t),this.datasets=new tm(this,this.#t),this.live=new tf(this),this.mediaLibrary={video:new t_(this,this.#t)},this.projects=new tI(this,this.#t),this.users=new tA(this,this.#t),this.agent={action:new tn(this,this.#t)},this.releases=new tk(this,this.#t),this.observable=new tO(e,t)}clone(){return new tC(this.#s,this.config())}config(e){if(void 0===e)return{...this.#r};if(this.#r&&!1===this.#r.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.#r=ew(e,this.#r||{}),this}withConfig(e){let t=this.config();return new tC(this.#s,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof e?.stega?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,r){return(0,d.s)(eV(this,this.#t,this.#r.stega,e,t,r))}getDocument(e,t){if(t?.includeAllVersions===!0)return(0,d.s)(eU(this,this.#t,e,{...t,includeAllVersions:!0}));let r={signal:t?.signal,tag:t?.tag,releaseId:t?.releaseId,...t&&"includeAllVersions"in t?{includeAllVersions:!1}:{}};return(0,d.s)(eU(this,this.#t,e,r))}getDocuments(e,t){return(0,d.s)(ez(this,this.#t,e,t))}create(e,t){return(0,d.s)(e1(this,this.#t,e,"create",t))}createIfNotExists(e,t){return(0,d.s)(eH(this,this.#t,e,t))}createOrReplace(e,t){return(0,d.s)(eB(this,this.#t,e,t))}createVersion({document:e,publishedId:t,releaseId:r,baseId:s,ifBaseRevisionId:n},i){if(!e)return(0,x._)(eJ(this,this.#t,t,s,r,n,i));let o=tE("createVersion",{document:e,publishedId:t,releaseId:r}),a={...e,_id:o}
13,c=t||C(e._id);return(0,x._)(eF(this,this.#t,a,c,i))}delete(e,t){return(0,d.s)(eG(this,this.#t,e,t))}discardVersion({releaseId:e,publishedId:t},r,s){let n=tS(t,e);return(0,d.s)(eY(this,this.#t,n,r,s))}replaceVersion({document:e,publishedId:t,releaseId:r},s){let n=tE("replaceVersion",{document:e,publishedId:t,releaseId:r}),i={...e,_id:n};return(0,x._)(eQ(this,this.#t,i,s))}unpublishVersion({releaseId:e,publishedId:t},r){let s=A(t,e);return(0,d.s)(eX(this,this.#t,s,t,r))}mutate(e,t){return(0,d.s)(eZ(this,this.#t,e,t))}patch(e,t){return new eA(e,t,this)}transaction(e){return new eD(e,this)}action(e,t){return(0,d.s)(eK(this,this.#t,e,t))}request(e){return(0,d.s)(e3(this,this.#t,e))}dataRequest(e,t,r){return(0,d.s)(e0(this,this.#t,e,t,r))}getUrl(e,t){return e5(this,e,t)}getDataUrl(e,t){return e6(this,e,t)}}let tD=function(e,t){return{requester:J(e),createClient:r=>{let s=J(e,{ignoreWarnings:r.ignoreWarnings});return new t((e,t)=>(t||s)({maxRedirects:0,maxRetries:r.maxRetries,retryDelay:r.retryDelay,lineage:r.lineage,...e}),r)}}}([],tC),tP=(tD.requester,tD.createClient);var tM=r(44935),tN=r(2990),tL=r(96442),tV=r(27541),tU=r(7620),tz=r(75629),tW=r(34047);let tH=(0,tL.default)(()=>r.e(9827).then(r.bind(r,39827)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../_chunks-es/PresentationComlink.js")]},ssr:!1}),tB=(0,tL.default)(()=>r.e(1979).then(r.bind(r,71979)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../_chunks-es/RefreshOnMount.js")]},ssr:!1}),tF=(0,tL.default)(()=>r.e(786).then(r.bind(r,20786)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../_chunks-es/RefreshOnFocus.js")]},ssr:!1}),tJ=(0,tL.default)(()=>r.e(9507).then(r.bind(r,89507)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../_chunks-es/RefreshOnReconnect.js")]},ssr:!1});function tG(e){var t;e instanceof B?console.warn("Sanity Live is unable to connect to the Sanity API as the current origin - ".concat(window.origin," - is not in the list of allowed CORS origins for this Sanity Project."),e.addOriginUrl&&"Add it here:",null==(t=e.addOriginUrl)?void 0:t.toString()):console.error(e)}function tY(e,t){t?console.warn("Sanity Live connection closed, switching to long polling set to a interval of",t/1e3,"seconds and the server gave this reason:",e.reason):console.error("Sanity Live connection closed, automatic revalidation is disabled, the server gave this reason:",e.reason)}function tQ(e){let{projectId:t,dataset:r,apiHost:n,apiVersion:i,useProjectHostname:o,token:a,requestTagPrefix:c,draftModeEnabled:u,draftModePerspective:l,refreshOnMount:h=!1,refreshOnFocus:d=!u&&(typeof window>"u"||window.self===window.top),refreshOnReconnect:p=!0,intervalOnGoAway:f=3e4,requestTag:y="next-loader.live",onError:g=tG,onGoAway:m=tY,revalidateSyncTags:v=tM.Q}=e,b=(0,tU.useMemo)(()=>tP({projectId:t,dataset:r,apiHost:n,apiVersion:i,useProjectHostname:o,ignoreBrowserTokenWarning:!0,token:a,useCdn:!1,requestTagPrefix:c}),[n,i,r,t,c,a,o]),[w,_]=(0,tU.useState)(!1),$=(0,tV.useRouter)(),x=(0,tz.J)(e=>{"message"===e.type?v(e.tags).then(e=>{"refresh"===e&&$.refresh()}):"restart"===e.type||"reconnect"===e.type?$.refresh():"goaway"===e.type&&(m(e,f),_(f))});(0,tU.useEffect)(()=>{let e=b.live.events({includeDrafts:!!a,tag:y}).subscribe({next:x,error:e=>{g(e)}});return()=>e.unsubscribe()},[b.live,g,y,a]),(0,tU.useEffect)(()=>{u&&l?(0,tW.NL)(l):(0,tW.NL)("unknown")},[u,l]);let[I,q]=(0,tU.useState)(!1);(0,tU.useEffect)(()=>{if(!(0,tN.vY)()){if(u&&a)return void(0,tW.kN)("live");if(u)return void(0,tW.kN)("static");(0,tW.kN)("unknown")}},[u,a]),(0,tU.useEffect)(()=>{if(!(0,tN.vY)())return;let e=new AbortController,t=setTimeout(()=>(0,tW.kN)("live"),3e3);return window.addEventListener("message",r=>{let{data:s}=r;s&&"object"==typeof s&&"domain"in s&&"sanity/channels"===s.domain&&"from"in s&&"presentation"===s.from&&(clearTimeout(t),(0,tW.kN)((0,tN.v$)()?"presentation-window":"presentation-iframe"),q(!0),e.abort())},{signal:e.signal}),()=>{clearTimeout(t),e.abort()}},[]);let S=(0,tU.useRef)(void 0);return(0,tU.useEffect)(()=>{if(u)return clearTimeout(S.current),()=>{S.current=setTimeout(()=>{console.warn("Sanity Live: Draft mode was enabled, but is now being disabled")})}},[u]),(0,tU.useEffect)(()=>
13{if(!w)return;let e=setInterval(()=>$.refresh(),w);return()=>clearInterval(e)},[w,$]),(0,s.jsxs)(s.Fragment,{children:[u&&I&&(0,s.jsx)(tH,{projectId:t,dataset:r,draftModeEnabled:u,draftModePerspective:l}),!u&&h&&(0,s.jsx)(tB,{}),!u&&d&&(0,s.jsx)(tF,{}),!u&&p&&(0,s.jsx)(tJ,{})]})}tQ.displayName="SanityLive"},12247:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{callServer:function(){return s.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return n.findSourceMapURL}});let s=r(69612),n=r(20816),i=r(97102)},13898:(e,t,r)=>{r.d(t,{DT:()=>d,mj:()=>function e({schemas:t,actors:r,actions:i,guards:o,delays:a}){return{assign:n.a,sendTo:h.s,raise:s.r,log:h.l,cancel:s.a,stopChild:s.s,enqueueActions:h.e,emit:h.a,spawnChild:s.b,createStateConfig:e=>e,createAction:e=>e,createMachine:e=>new l({...e,schemas:t},{actors:r,actions:i,guards:o,delays:a}),extend:s=>e({schemas:t,actors:r,actions:{...i,...s.actions},guards:{...o,...s.guards},delays:{...a,...s.delays}})}}});var s=r(67379),n=r(16850);let i=new WeakMap;function o(e,t,r){let s=i.get(e);return s?t in s||(s[t]=r()):(s={[t]:r()},i.set(e,s)),s[t]}let a={},c=e=>"string"==typeof e?{type:e}:"function"==typeof e?"resolve"in e?{type:e.type}:{type:e.name}:e;class u{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(s.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,s.y)(this.config.states,(e,t)=>new u(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,s.t)(this.config.entry).slice(),this.exit=(0,s.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,s.t)(e.tags).slice()}_initialize(){this.transitions=(0,s.z)(this),this.config.always&&(this.always=(0,s.B)(this.config.always).map(e=>(0,s.C)(this,s.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(c),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(c),eventType:null})}:void 0,history:this.history,states:(0,s.y)(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(c)})),entry:this.entry.map(c),exit:this.exit.map(c),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,s.t)(this.config.invoke).map((e,t)=>{let{src:r,systemId:n}=e,i=e.id??(0,s.E)(this.id,t),o="string"==typeof r?r:`xstate.invoke.${(0,s.E)(this.id,t)}`;return{...e,src:o,id:i,systemId:n,toJSON(){let{onDone:t,onError:r,...s}=e;return{...s,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,s.F)(this))}get initial(){return o(this,"initial",()=>(0,s.G)(this,this.config.initial))}next(e,t){let r,n=t.type,i=[];for(let a of o(this,`candidates-${n}`,()=>(0,s.H)(this,n))){let{guard:o}=a,c=e.context,u=!1;try{u=!o||(0,s.D)(o,c,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 '${n}' in state node '${this.id}': 14${t.message}`)}if(u){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 s=e[r];if(s.states)for(let e of s.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.options=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.options={maxIterations:1/0,...this.config.options},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 u(e,{_key:this.id,_machine:this}),this.root._initialize(),(0,s.I)(this.root),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:r,actors:s,delays:n}=this.implementations;return new l(this.config,{actions:{...t,...e.actions},guards:{...r,...e.guards},actors:{...s,...e.actors},delays:{...n,...e.delays}})}resolveState(e){let t=(0,s.J)(this.root,e.value),r=(0,s.K)((0,s.p)(this.root,t));return(0,s.L)({_nodes:[...r],context:e.context||{},children:{},status:(0,s.M)(r,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,r){return(0,s.d)(e,t,r,[]).snapshot}microstep(e,t,r){return(0,s.d)(e,t,r,[]).microsteps.map(([e])=>e)}getTransitionData(e,t){return(0,s.O)(this.root,e.value,e,t)||[]}_getPreInitialState(e,t,r){let{context:i}=this.config,o=(0,s.L)({context:"function"!=typeof i&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof i?(0,s.P)(o,t,e,[(0,n.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,s.e)(t),n=[],i=this._getPreInitialState(e,r,n),[o]=(0,s.f)(this.root,i,e,r,n),{snapshot:a}=(0,s.d)(o,r,e,n);return a}start(e){Object.values(e.children).forEach(e=>{"active"===e.getSnapshot().status&&e.start()})}getStateNodeById(e){let t=(0,s.Q)(e),r=t.slice(1),n=(0,s.R)(t[0])?t[0].slice(1):t[0],i=this.idMap.get(n);if(!i)throw Error(`Child state node '#${n}' does not exist on machine '${this.id}'`);return(0,s.T)(i,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return(0,s.U)(e,t)}restoreSnapshot(e,t){let r={},n=e.children;
14Object.keys(n).forEach(e=>{let i=n[e],o=i.snapshot,a=i.src,c="string"==typeof a?(0,s.V)(this,a):a;if(!c)return;let u=(0,s.c)(c,{id:e,parent:t.self,syncSnapshot:i.syncSnapshot,snapshot:o,src:a,systemId:i.systemId});r[e]=u});let i=function(e,t){if(!t||"object"!=typeof t)return{};let r={};for(let s in t)for(let n of t[s]){let t=function(e,t){if(t instanceof u)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}(e,n);t&&(r[s]??=[],r[s].push(t))}return r}(this.root,e.historyValue),o=(0,s.L)({...e,children:r,_nodes:Array.from((0,s.K)((0,s.p)(this.root,e.value))),historyValue:i},this),a=new Set;return!function e(t,r){if(!a.has(t))for(let n in a.add(t),t){let i=t[n];if(i&&"object"==typeof i){if("xstate$$type"in i&&i.xstate$$type===s.$){t[n]=r[i.id];continue}e(i,r)}}}(o.context,r),o}}var h=r(20101);function d(e,t){let r=(0,s.t)(t);if(!r.some(t=>(0,s.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}`)}}},16850:(e,t,r)=>{r.d(t,{a:()=>i});var s=r(67379);function n(e,t,r,n,{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},n,i){return(o,a)=>{let c=((o,a)=>{if("string"!=typeof o)return(0,s.c)(o,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:o,systemId:a?.systemId});{let c=(0,s.V)(t,o);if(!c)throw Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);let u=(0,s.c)(c,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:"function"==typeof a?.input?a.input({context:r,event:n,self:e.self}):a?.input,src:o,systemId:a?.systemId});return i[u.id]=u,u}})(o,a);return i[c.id]=c,e.defer(()=>{c._processingStatus!==s.Z.Stopped&&c.start()}),c}}(e,t,r.event,o),self:e.self,system:e.system},c={};if("function"==typeof i)c=i(a,n);else for(let e of Object.keys(i)){let t=i[e];c[e]="function"==typeof t?t(a,n):t}let u=Object.assign({},t.context,c);return[(0,s._)(t,{context:u,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=n,t}},20101:(e,t,r)=>{r.d(t,{a:()=>a,b:()=>p,e:()=>y,l:()=>v,s:()=>d});var s=r(67379),n=r(16850);function i(e,t,r,s,{event:n}){return[t,{event:"function"==typeof n?n(r,s):n},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 c=function(e){return e.Parent="#_parent",e.Internal="#_internal",e}({});function u(e,t,r,s,{to:n,event:i,id:o,delay:a},u){let l,h,d=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,s):i;if("string"==typeof a){let e=d&&d[a];l="function"==typeof e?e(r,s):e}else l="function"==typeof a?a(r,s):a;let f="function"==typeof n?n(r,s):n;if("string"==typeof f){if(!(h=f===c.Parent?e.self._parent:f===c.Internal?e.self:f.startsWith("#_")?t.children[f.slice(2)]:u.deferredActorIds?.includes(f)?f:t.children[f]))throw Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`)}else h=f||e.self;return[t,{to:h,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 h(e,t){e.defer(()=>{let{to:r,event:n,delay:i,id:o}=t;if("number"==typeof i)return void e.system.scheduler.schedule(e.self,r,n,i,o);e.system._relay(e.self,r,n.type===s.W?(0,s.Y)(e.self.id,n.data):n)})}function d(e,t,r){function s(e,t){}return s.type="xstate.sendTo",s.to=e,s.event=t,s.id=r?.id,s.delay=r?.delay,s.resolve=u,s.retryResolve=l,s.execute=h,s}function p(e,t){return d(c.Parent,e,t)}function f(e,t,r,i,{collect:o}){let c=[],u=function(e){c.push(e)};return u.assign=(...e)=>{c.push((0,n.a)(...e))},u.cancel=(...e)=>{c.push((0,s.a)(...e))},u.raise=(...e)=>{c.push((0,s.r)(...e))},u.sendTo=(...e)=>{c.push(d(...e))},u.sendParent=(...e)=>{c.push(p(...e))},u.spawnChild=(...e)=>{c.push((0,s.b)(...e))},u.stopChild=(...e)=>{c.push((0,s.s)(...e))},u.emit=(...e)=>{c.push(a(...e))},o({context:r.context,event:r.event,enqueue:u,check:e=>(0,s.D)(e,t.context,r.event,t),self:e.self,system:e.system},i),[t,void 0,c]}function y(e){function t(e,t){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=f,t}function g(e,t,r,s,{value:n,label:i}){return[t,{value:"function"==typeof n?n(r,s):n,label:i},void 0]}function m({logger:e},{value:t,label:r}){r?e(r,t):e(t)}function v(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=m,r}},22397:(e,t,r)=>{r.d(t,{H6:()=>f,OX:()=>c,SP:()=>i,Sx:()=>d});var s=r(67379);let n=new WeakMap;function i(e){return{config:e,start:(t,r)=>{let{self:s,system:i,emit:o}=r,a={receivers:void 0,dispose:void 0};n.set(s,a),a.dispose=e({input:t.input,system:i,self:s,sendBack:e=>
14{"stopped"!==s.getSnapshot().status&&s._parent&&i._relay(s,s._parent,e)},receive:e=>{a.receivers??=new Set,a.receivers.add(e)},emit:o})},transition:(e,t,r)=>{let i=n.get(r.self);return t.type===s.X?(e={...e,status:"stopped",error:void 0},n.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.error",a="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,status:"error",error:t.data,input:void 0,_subscription:void 0};case a:return{...e,status:"done",input:void 0,_subscription:void 0};case s.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:s,emit:n})=>{"done"!==t.status&&(t._subscription=e({input:t.input,system:s,self:r,emit:n}).subscribe({next:e=>{r._parent&&s._relay(r,r._parent,e)},error:e=>{s._relay(r,r,{type:o,data:e})},complete:()=>{s._relay(r,r,{type:a})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}}let u="xstate.promise.resolve",l="xstate.promise.reject",h=new WeakMap;function d(e){return{config:e,transition:(e,t,r)=>{if("active"!==e.status)return e;switch(t.type){case u:{let r=t.data;return{...e,status:"done",output:r,input:void 0}}case l:return{...e,status:"error",error:t.data,input:void 0};case s.X:return h.get(r.self)?.abort(),h.delete(r.self),{...e,status:"stopped",input:void 0};default:return e}},start:(t,{self:r,system:s,emit:n})=>{if("active"!==t.status)return;let i=new AbortController;h.set(r,i),Promise.resolve(e({input:t.input,system:s,self:r,signal:i.signal,emit:n})).then(e=>{"active"===r.getSnapshot().status&&(h.delete(r),s._relay(r,r,{type:u,data:e}))},e=>{"active"===r.getSnapshot().status&&(h.delete(r),s._relay(r,r,{type:l,data:e}))})},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let p=function(e,t){return{config:e,transition:(t,r,s)=>({...t,context:e(t.context,r,s)}),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 f(){return(0,s.c)(p)}},34047:(e,t,r)=>{r.d(t,{El:()=>l,Hi:()=>c,NL:()=>i,kN:()=>a,lc:()=>h,sq:()=>u});let s=new Set,n="checking";function i(e){if(n!==e)for(let t of(n=e,s))t()}let o=new Set;function a(e){for(let e of o)e()}let c=new Set,u=null;function l(e){for(let t of(u=e,c))t()}function h(e,t){for(let e of c)e()}},39979:(e,t,r)=>{r.d(t,{default:()=>i});var s=r(54568);let n=(0,r(96442).default)(()=>r.e(1769).then(r.bind(r,91769)),{loadableGenerated:{webpack:()=>[require.resolveWeak("../_chunks-es/SanityLiveStream.js")]},ssr:!1});function i(e){return(0,s.jsx)(n,{...e})}},51623:(e,t,r)=>{let s;r.d(t,{V2:()=>N,FS:()=>U,IM:()=>H,Tx:()=>z,Rr:()=>W,vd:()=>V,_K:()=>L,CC:()=>M,RM:()=>J,Uc:()=>F,tP:()=>B});let n={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(n.randomUUID&&!t&&!e)return n.randomUUID();let a=(e=e||{}).random??e.rng?.()??function(){if(!s){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");s=crypto.getRandomValues.bind(crypto)}return s(i)}();if(a.length<16)throw Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=a[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()}(a)};var c=r(22397),u=r(13898),l=r(20101),h=r(16850),d=r(67379),p=r(51599),f=r(17867),y=r(18231),g=r(12288),m=r(49417),v=r(10440),b=r(59574),w=r(14947),_=["addListener","removeListener"],$=["addEventListener","removeEventListener"],x=["on","off"];function I(e,t,r,s){if((0,b.T)(r)&&(s=r,r=void 0),s)return I(e,t,r).pipe((0,w.I)(s));var n,i,o,a=(0,f.zs)((n=e,(0,b.T)(n.addEventListener)&&(0,b.T)(n.removeEventListener))?$.map(function(s){return function(n){return e[s](t,n,r)}}):(i=e,(0,b.T)(i.addListener)&&(0,b.T)(i.removeListener))?_.map(q(e,t)):(o=e,(0,b.T)(o.on)&&(0,b.T)(o.off))?x.map(q(e,t)):[],2),c=a[0],u=a[1];if(!c&&(0,v.X)(e))return(0,m.Z)(function(e){return I(e,t,r)})((0,y.Tg)(e));if(!c)throw TypeError("Invalid event target");return new g.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 c(t),function(){return u(t)}})}function q(e,t){return function(r){return function(s){return e[r](t,s)}}}var S=r(43715),E=r(24362),R=r(41101),T=r(79007),k=r(8777),j=r(64373),A=r(4070);function O(e){return e<=0?function(){return A.w}:(0,T.N)(function(t,r){var s=0;t.subscribe((0,k._)(r,function(t){++s<=e&&(r.next(t),e<=s&&r.complete())}))})}var C=r(93190);let D=e=>({context:t})=>{let{count:r,include:s,exclude:n,responseType:i="message.received"}=e;return{count:r,domain:t.domain,from:t.connectTo,include:s?Array.isArray(s)?s:[s]:[],exclude:n?Array.isArray(n)?n:[n]:[],responseType:i,target:t.target,to:t.name}},P=(0,p.v)(()=>I(window,"message")),M=e=>(0,c.OX)(({input:t})=>{let r;return P.pipe(e?(0,S.T)(e):(0,E.F)(),(0,R.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,S.T)((r=t.responseType,e=>({type:r,message:e}))),t.count?(0,E.F)(function(e,t){return void 0===t&&(t=null),t=null!=t?t:e,(0,T.N)(function(r,s){var n=[],i=0;r.subscribe((0,k._)(s,function(r){var o,a,c,u,l=null;i++%t==0&&n.push([]);try{for(var h=(0,f.Ju)(n),d=h.next();!d.done;d=h.next()){var p=d.value;p.push(r),e<=p.length&&(l=null!=l?l:[]).push(p)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}if(l)try{for(var y=(0,f.Ju)(l),g=y.next();!g.done;g=y.next()){var p=g.value;(0,j.o)(n,p),s.next(p)}}catch(e){c={error:e}}finally{try{g&&!g.done&&(u=y.return)&&u.call(y)}finally{if(c)throw c.error}}},function(){var e,t;try{for(var r=(0,f.Ju)(n),i=r.next();!i.done;i=r.next()){var o=i.value;s.next(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}s.complete()},void 0,function(){n=null}))})}(t.count),function(e,t){return(0,b.T)(void 0)?(0,m.Z)(e,void 0,1):(0,m.Z)(e,1)}(e=>e),O(t.count)):(0,E.F)())}),N="sanity/comlink",L="comlink/response",V="comlink/heartbeat",U="c
14omlink/disconnect",z="comlink/handshake/syn",W="comlink/handshake/syn-ack",H="comlink/handshake/ack",B=()=>(0,u.mj)({types:{},actors:{listen:(0,c.OX)(({input:e})=>{let t,r=e.signal?I(e.signal,"abort").pipe((t=`Request ${e.requestId} aborted`,e=>e.pipe(O(1),(0,S.T)(()=>{throw Error(t)})))):A.w;return I(window,"message").pipe((0,R.p)(t=>t.data?.type===L&&t.data?.responseTo===e.requestId&&!!t.source&&e.sources.has(t.source)),O(e.sources.size),(0,T.N)(function(e,t){(0,y.Tg)(r).subscribe((0,k._)(t,function(){return t.complete()},C.l)),t.closed||e.subscribe(t)}))})},actions:{"send message":({context:e},t)=>{let{sources:r,targetOrigin:s}=e,{message:n}=t;r.forEach(e=>{e.postMessage(n,{targetOrigin:s})})},"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:s,from:n,id:i,responseTo:o,to:a,type:c}=e;return{message:{channelId:t,data:r,domain:s,from:n,id:i,to:a,type:c,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,h.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})});(0,c.SP)(({sendBack:e,input:t})=>{let r=()=>{e(t.event)};t.immediate&&r();let s=setInterval(r,t.interval);return()=>{clearInterval(s)}});let F=()=>(0,u.mj)({types:{},actors:{requestMachine:B(),listen:M()},actions:{"buffer handshake":(0,h.a)({handshakeBuffer:({event:e,context:t})=>((0,u.DT)(e,"message.received"),[...t.handshakeBuffer,e])}),"buffer message":(0,l.e)(({enqueue:e})=>{e.assign({buffer:({event:e,context:t})=>((0,u.DT)(e,"post"),[...t.buffer,{data:e.data,resolvable:e.resolvable,options:e.options}])}),e.emit(({event:e})=>((0,u.DT)(e,"post"),{type:"buffer.added",message:e.data}))}),"create request":(0,h.a)({requests:({context:e,event:t,self:r,spawn:s})=>{(0,u.DT)(t,"request");let n=(Array.isArray(t.data)?t.data:[t.data]).map(t=>s("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,...n]}}),"emit heartbeat":(0,l.a)(()=>({type:"heartbeat"})),"emit received message":(0,l.e)(({enqueue:e})=>{e.emit(({event:e})=>((0,u.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,d.r)(({event:e})=>((0,u.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})=>
14{e.handshakeBuffer.forEach(e=>t.raise(e)),t.assign({handshakeBuffer:[]})}),"remove request":(0,l.e)(({context:e,enqueue:t,event:r})=>{(0,u.DT)(r,["request.success","request.failed","request.aborted"]),(0,d.s)(r.requestId),t.assign({requests:e.requests.filter(({id:e})=>e!==r.requestId)})}),"send response":(0,d.r)(({event:e})=>((0,u.DT)(e,["message.received","heartbeat.received"]),{type:"request",data:{type:L,responseTo:e.message.data.id,data:void 0}})),"send handshake syn ack":(0,d.r)({type:"request",data:{type:W}}),"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,h.a)({channelId:({event:e})=>((0,u.DT)(e,"handshake.syn"),e.message.data.channelId),target:({event:e})=>((0,u.DT)(e,"handshake.syn"),e.message.source||void 0),targetOrigin:({event:e})=>((0,u.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??N,handshakeBuffer:[],name:e.name,requests:[],target:void 0,targetOrigin:null}),invoke:{id:"listen for handshake syn",src:"listen",input:D({include:z,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:D({include:H,count:1,responseType:"handshake.complete"}),onDone:"connected"},{id:"listen for disconnect",src:"listen",input:D({include:U,count:1,responseType:"disconnect"})},{id:"listen for messages",src:"listen",input:D({exclude:[U,z,H,V,L]})}],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:D({exclude:[U,z,H,V,L]})},{id:"listen for heartbeat",src:"listen",input:D({include:V,responseType:"heartbeat.received"})},{id:"listen for disconnect",src:"listen",input:D({include:U,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"]}}}}}),J=(e,t=F())=>{let r,s=(0,d.c)(t,{input:e}),n=new Map,i=new Map;s.on("message",({message:e})=>{let t=n.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=()=>{s.stop()};return{actor:s,fetch:(e,t,r)=>{let{responseTimeout:n=1e4,signal:i,suppressWarnings:o}=r||{},a=function(){let e,t;return"function"==typeof Promise.withResolvers?Promise.withResolvers():{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}();return s.send({type:"post",data:{type:e,data:t},resolvable:a,options:{responseTimeout:n,signal:i,suppressWarnings:o}}),a.promise},machine:t,on:(e,t,r)=>{let s=n.get(e)||new Set;n.has(e)||n.set(e,s),s.add(t);let o=i.get(e);if(o){let s=r?.replay??1;Array.from(o).slice(-s).forEach(({data:e})=>t(e)),i.delete(e)}return()=>{s.delete(t)}},onStatus:(e,t)=>{let n=s.on("status",s=>{r=s.status,t&&s.status!==t||e(s.status)});return r&&e(r),()=>n.unsubscribe()},post:(e,t)=>{s.send({type:"post",data:{type:e,data:t}})},start:()=>(s.start(),o),stop:o}}},67379:(e,t,r)=>{r.d(t,{$:()=>T,B:()=>w,C:()=>et,D:()=>H,E:()=>x,F:()=>ee,G:()=>en,H:()=>K,I:()=>es,J:()=>eq,K:()=>G,L:()=>ej,M:()=>X,N:()=>i,O:()=>function e(t,r,s,n){if("string"==typeof r){let e=eu(t,r).next(s,n);return e&&e.length?e:t.next(s,n)}if(1===Object.keys(r).length){let i=Object.keys(r),o=e(eu(t,i[0]),r[
14i[0]],s,n);return o&&o.length?o:t.next(s,n)}let i=[];for(let o of Object.keys(r)){let a=r[o];if(!a)continue;let c=e(eu(t,o),a,s,n);c&&i.push(...c)}return i.length?i:t.next(s,n)},P:()=>e_,Q:()=>f,R:()=>Z,S:()=>n,T:()=>el,U:()=>eO,V:()=>I,W:()=>a,X:()=>c,Y:()=>l,Z:()=>k,_:()=>eA,a:()=>P,b:()=>L,c:()=>O,d:()=>e$,e:()=>h,f:()=>em,m:()=>q,p:()=>eh,r:()=>eP,s:()=>z,t:()=>m,y:()=>g,z:()=>er});class s{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 n=".",i="",o="xstate.init",a="xstate.error",c="xstate.stop";function u(e,t){return{type:`xstate.done.state.${e}`,output:t}}function l(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function h(e){return{type:o,input:e}}function d(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 s=0;s<e.length;s++){switch(e.charCodeAt(s)){case 92:r+=e[s+1],s++;continue;case 46:t.push(r),r="";
14continue}r+=e[s]}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 s=r;r={},s[e[t]]=r}return t}(f(e))}function g(e,t){let r={},s=Object.keys(e);for(let n=0;n<s.length;n++){let i=s[n];r[i]=t(e[i],i,e,n)}return r}function m(e){var t;return void 0===e?[]:b(t=e)?t:[t]}function v(e,t,r,s){return"function"==typeof e?e({context:t,event:r,self:s}):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 m(e)}function $(e,t,r){let s="object"==typeof e,n=s?e:void 0;return{next:(s?e.next:e)?.bind(n),error:(s?e.error:t)?.bind(n),complete:(s?e.complete:r)?.bind(n)}}function x(e,t){return`${t}.${e}`}function I(e,t){let r=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!r)return e.implementations.actors[t];let[,s,n]=r,i=e.getStateNodeById(n).config.invoke;return(Array.isArray(i)?i[s]:i).src}function q(e,t){if(t===e||"*"===t)return!0;if(!t.endsWith(".*"))return!1;let r=t.split("."),s=e.split(".");for(let e=0;e<r.length;e++){let t=r[e],n=s[e];if("*"===t)return e===r.length-1;if(t!==n)return!1}return!0}function S(e,t){return`${e.sessionId}.${t}`}let E=0,R=!1,T=1,k=function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e}({}),j={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class A{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 s(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=k.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={...j,...t},{clock:n,logger:i,parent:o,syncSnapshot:a,id:c,systemId:u,inspect:l}=r;this.system=o?o.system:function(e,t){let r=new Map,s=new Map,n=new WeakMap,i=new Set,o={},{clock:a,logger:c}=t,u={schedule:(e,t,r,s,n=Math.random().toString(36).slice(2))=>{let i={source:e,target:t,event:r,delay:s,id:n,startedAt:Date.now()},c=S(e,n);l._snapshot._scheduledEvents[c]=i;let u=a.setTimeout(()=>{delete o[c],delete l._snapshot._scheduledEvents[c],l._relay(e,t,r)},s);o[c]=u},cancel:(e,t)=>{let r=S(e,t),s=o[r];delete o[r],delete l._snapshot._scheduledEvents[r],void 0!==s&&a.clearTimeout(s)},cancelAll:e=>{for(let t in l._snapshot._scheduledEvents){let r=l._snapshot._scheduledEvents[t];r.source===e&&u.cancel(e,r.id)}}},l={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${E++}`,_register:(e,t)=>(r.set(e,t),e),_unregister:e=>{r.delete(e.sessionId);let t=n.get(e);void 0!==t&&(s.delete(t),n.delete(e))},get:e=>s.get(e),getAll:()=>Object.fromEntries(s.entries()),_set:(e,t)=>{let r=s.get(e);if(r&&r!==t)throw Error(`Actor with system ID '${e}' already exists.`);s.set(e,t),n.set(t,e)},inspect:e=>{let t=$(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:u,getSnapshot:()=>({_scheduledEvents:{...l._snapshot._scheduledEvents}}),start:()=>{let e=l._snapshot._scheduledEvents;for(let t in l._snapshot._scheduledEvents={},e){let{source:r,target:s,event:n,delay:i,id:o}=e[t];u.schedule(r,s,n,i,o)}},_clock:a,_logger:c};return l}(this,{clock:n,logger:i}),l&&!o&&this.system.inspect($(l)),this.sessionId=this.system._bookId(),this.id=c??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 s of[...t?t.values():[],...r?r.values():[]])try{s(e)}catch(e){d(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=R;try{R=!0,e.exec(e.info,e.params)}finally{R=t}};this._processingStatus===k.Running?t():this._deferred.push(t)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),u&&(this.systemId=u,this.system._set(u,this)),this._initState(t?.snapshot??t?.state),u&&"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){d(e)}break;case"done":var s;for(let t of this.observers)try{t.next?.(e)}catch(e){d(e)}this._stopProcedure(),this._complete(),this._doneEvent=(s=this.id,{type:`xstate.done.actor.${s}`,output:this._snapshot.output,actorId:s}),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 s=$(e,t,r);if(this._processingStatus!==k.Stopped)this.observers.add(s);else switch(this._snapshot.status){case"done":try{s.complete?.()}catch(e){d(e)}break;case"error":{let e=this._snapshot.error;if(s.error)try{s.error(e)}catch(e){d(e)}else d(e)}}return{unsubscribe:()=>{this.observers.delete(s)}}}on(e,t){let r=this.eventListeners.get(e);r||(r=new Set,this.eventListeners.set(e,r));let s=t.bind(void 0);return r.add(s),{unsubscribe:()=>{r.delete(s)}}}select(e,t=Object.is){return{subscribe:r=>{let s=$(r),n=e(this.getSnapshot());return this.subscribe(r=>{let i=e(r);t(n,i)||(n=i,s.next?.(i))})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===k.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=k.Running;let e=h(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===c&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===k.Stopped||((this.mailbox.clear(),this._processingStatus===k.NotStarted)?this._processingStatus=k.Stopped:this.mailbox.enqueue({type:c})),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){d(e)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||d(e),this.eventListeners.clear();return}let t=!1;for(let r of this.observers){let s=r.error;t||=!s;try{s?.(e)}catch(e){d(e)}}this.observers.clear(),this.eventListeners.clear(),t&&d(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,l(this.id,e))}_stopProcedure(){return this._processingStatus!==k.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new s(this._process.bind(this)),this._processingStatus=k.Stopped,this.system._unregister(this)),this}_send(e){this._processingStatus!==k.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:T,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[p](){return this}getSnapshot(){return this._snapshot}}function O(e,...[t]){return new A(e,t)}function C(e,t,r,s,{sendId:n}){return[t,{sendId:"function"==typeof n?n(r,s):n},void 0]}function D(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function P(e){function t(e,t){}return t.type="xstate.cancel",t.sendId=e,t.resolve=C,t.execute=D,t}function M(e,t,r,s,{id:n,systemId:i,src:o,input:a,syncSnapshot:c}){let u,l,h="string"==typeof o?I(t.machine,o):o,d="function"==typeof n?n(r):n;return h&&(l="function"==typeof a?a({context:t.context,event:r.event,self:e.self}):a,u=O(h,{id:d,src:o,parent:e.self,syncSnapshot:c,systemId:i,input:l})),[eA(t,{children:{...t.children,[d]:u}}),{id:n,systemId:i,actorRef:u,src:o,input:l},void 0]}function N(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==k.Stopped&&t.start()})}function L(...[e,{id:t,systemId:r,input:s,syncSnapshot:n=!1}={}]){function i(e,t){}return i.type="xstate.spawnChild",i.id=t,i.systemId=r,i.src=e,i.input=s,i.syncSnapshot=n,i.resolve=M,i.execute=N,i}function V(e,t,r,s,{actorRef:n}){let i="function"==typeof n?n(r,s):n,o="string"==typeof i?t.children[i]:i,a=t.children;return o&&(a={...a},delete a[o.id]),[eA(t,{children:a}),o,void 0]}function U(e,t){if(t){if(!function e(t,r){let s=r.getSnapshot();if(s&&"children"in s)for(let r of Object.values(s.children))e(t,r);t.system._unregister(r)}(e,t),t._processingStatus!==k.Running)return void e.stopChild(t);e.defer(()=>{e.stopChild(t)})}}function z(e){function t(e,t){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=V,t.execute=U,t}function W(e,{context:t,event:r},{guards:s}){return s.every(s=>H(s,t,r,e))}function H(e,t,r,s){let{machine:n}=s,i="function"==typeof e,o=i?e:n.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 H(o,t,r,s);let a={context:t,event:r},c=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(s,a,o):o(a,c)}function B(e){return"atomic"===e.type||"final"===e.type}function F(e){return Object.values(e.states).filter(e=>"history"!==e.type)}function J(e,t){let r=[];if(t===e)return r;let s=e.parent;for(;s&&s!==t;)r.push(s),s=s.parent;return r}function G(e){let t=new Set(e),r=Y(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 F(e))if("history"!==r.type&&!t.has(r))for(let e of ea(r))t.add(e)}}
14else ea(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 Y(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 Q(e,t){return function e(t,r){let s=r.get(t);if(!s)return{};if("compound"===t.type){let e=s[0];if(!e)return{};if(B(e))return e.key}let n={};for(let t of s)n[t.key]=e(t,r);return n}(e,Y(G(t)))}function X(e,t){return"compound"===t.type?F(t).some(t=>"final"===t.type&&e.has(t)):"parallel"===t.type?F(t).every(t=>X(e,t)):"final"===t.type}let Z=e=>"#"===e[0];function K(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(e=>q(t,e)).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))}function ee(e){let t=e.config.after;return t?Object.keys(t).flatMap(r=>{let s=t[r],n=Number.isNaN(+r)?r:+r,i=(t=>{var r;let s=(r=e.id,{type:`xstate.after.${t}.${r}`}),n=s.type;return e.entry.push(eP(s,{id:n,delay:t})),e.exit.push(P(n)),n})(n);return m("string"==typeof s?{target:s}:s).map(e=>({...e,event:i,delay:n}))}).map(t=>{let{delay:r}=t;return{...et(e,t.event,t),delay:r}}):[]}function et(e,t,r){let s=_(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(Z(t))return e.machine.getStateNodeById(t);let r=t[0]===n;if(r&&!e.parent)return el(e,t.slice(1));let s=r?e.key+t:t;if(e.parent)try{return el(e.parent,s)}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,s),a={...r,actions:m(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 er(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 s=e.config.on[r];t.set(r,w(s).map(t=>et(e,r,t)))}if(e.config.onDone){let r=`xstate.done.state.${e.id}`;t.set(r,w(e.config.onDone).map(t=>et(e,r,t)))}for(let r of e.invoke){if(r.onDone){let s=`xstate.done.actor.${r.id}`;t.set(s,w(r.onDone).map(t=>et(e,s,t)))}if(r.onError){let s=`xstate.error.actor.${r.id}`;t.set(s,w(r.onError).map(t=>et(e,s,t)))}if(r.onSnapshot){let s=`xstate.snapshot.${r.id}`;t.set(s,w(r.onSnapshot).map(t=>et(e,s,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 es(e){let t=[],r=s=>{Object.values(s).forEach(s=>{if(s.config.route&&s.config.id){let r=s.config.id,n=s.config.route.guard,i=({event:e})=>e.to===`#${r}`,o={...s.config.route,guard:n?function(e){function t(e,t){return!1}return t.check=W,t.guards=e,t}([i,n]):i,target:`#${r}`};t.push(et(e,"xstate.route",o))}s.states&&r(s.states)})};r(e.states),t.length>0&&e.transitions.set("xstate.route",t)}function en(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 s={source:e,actions:t&&"string"!=typeof t?m(t.actions):[],eventType:null,reenter:!1,target:r?[r]:[],toJSON:()=>({...s,source:`#${e.id}`,target:r?[`#${r.id}`]:[]})};return s}function ei(e){let t=_(e.config.target);return t?{target:t.map(t=>"string"==typeof t?el(e.parent,t):t)}:e.parent.initial}function eo(e){return"history"===e.type}function ea(e){let t=ec(e);for(let r of t)for(let s of J(r,e))t.add(s);return t}function ec(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 F(r))e(t)}}(e),t}function eu(e,t){if(Z(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 el(e,t){if("string"==typeof t&&Z(t))try{return e.machine.getStateNodeById(t)}catch{}let r=f(t).slice(),s=e;for(;r.length;){let e=r.shift();if(!e.length)break;s=eu(s,e)}return s}function eh(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),s=r.map(t=>eu(e,t)).filter(Boolean);return[e.machine.root,e].concat(s,r.reduce((r,s)=>{let n=eu(e,s);if(!n)return r;let i=eh(n,t[s]);return r.concat(i)},[]))}function ed(e,t){let r=e;for(;r.parent&&r.parent!==t;)r=r.parent;return r.parent===t}function ep(e,t,r){let s=new Set;for(let n of e){let e=!1,i=new Set;for(let o of s)if(function(e,t){let r=new Set(e),s=new Set(t);for(let e of r)if(s.has(e))return!0;for(let e of s)if(r.has(e))return!0;return!1}(eg([n],t,r),eg([o],t,r)))if(ed(n.source,o.source))i.add(o);else{e=!0;break}if(!e){for(let e of i)s.delete(e);s.add(n)}}return Array.from(s)}function ef(e,t){if(!e.target)return[];let r=new Set;for(let s of e.target)if(eo(s))if(t[s.id])for(let e of t[s.id])r.add(e);else for(let e of ef(ei(s),t))r.add(e);else r.add(s);return[...r]}function ey(e,t){let r=ef(e,t);if(!r)return;if(!e.reenter&&r.every(t=>t===e.source||ed(t,e.source)))return e.source;let s=function(e){let[t,...r]=e;for(let e of J(t,void 0))if(r.every(t=>ed(t,e)))return e}(r.concat(e.source));return s||(e.reenter?void 0:e.source.machine.root)}function eg(e,t,r){let s=new Set;for(let n of e)if(n.target?.length){let e=ey(n,r);for(let r of(n.reenter&&n.source===e&&s.add(e),t))ed(r,e)&&s.add(r)}return[...s]}function em(e,t,r,s,n){return ev([{target:[...ec(e)],source:e,reenter
15:!0,actions:[],eventType:null,toJSON:null}],t,r,s,!0,n)}function ev(e,t,r,s,n,i){let o=[];if(!e.length)return[t,o];let a=r.actionExecutor;r.actionExecutor=e=>{o.push(e),a(e)};try{let a=new Set(t._nodes),c=t.historyValue,l=ep(e,a,c),h=t;n||([h,c]=function(e,t,r,s,n,i,o,a){let c,u=e,l=eg(s,n,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=>B(t)&&ed(t,e):t=>t.parent===e,(c??={...i})[t.id]=Array.from(n).filter(r)}for(let e of l)u=e_(u,t,r,[...e.exit,...e.invoke.map(e=>z(e.id))],o,void 0),n.delete(e);return[u,c||i]}(h,s,r,l,a,c,i,r.actionExecutor)),h=e_(h,s,r,l.flatMap(e=>e.actions),i,void 0),h=function(e,t,r,s,n,i,o,a){let c=e,l=new Set,h=new Set;(function(e,t,r,s){for(let n of e){let e=ey(n,t);for(let i of n.target||[])!eo(i)&&(n.source!==i||n.source!==e||n.reenter)&&(s.add(i),r.add(i)),eb(i,t,r,s);for(let i of ef(n,t)){let o=J(i,e);e?.type==="parallel"&&o.push(e),ew(s,t,r,o,!n.source.parent&&n.reenter?void 0:e)}}})(s,o,h,l),a&&h.add(e.machine.root);let d=new Set;for(let e of[...l].sort((e,t)=>e.order-t.order)){n.add(e);let s=[];for(let t of(s.push(...e.entry),e.invoke))s.push(L(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(h.has(e)){let t=e.initial.actions;s.push(...t)}if(c=e_(c,t,r,s,i,e.invoke.map(e=>e.id)),"final"===e.type){let s=e.parent,o=s?.type==="parallel"?s:s?.parent,a=o||e;for(s?.type==="compound"&&i.push(u(s.id,void 0!==e.output?v(e.output,c.context,t,r.self):void 0));o?.type==="parallel"&&!d.has(o)&&X(n,o);)d.add(o),i.push(u(o.id)),a=o,o=o.parent;if(o)continue;c=eA(c,{status:"done",output:function(e,t,r,s,n){if(void 0===s.output)return;let i=u(n.id,void 0!==n.output&&n.parent?v(n.output,e.context,t,r.self):void 0);return v(s.output,e.context,i,r.self)}(c,t,r,c.machine.root,a)})}}return c}(h,s,r,l,a,i,c,n);let d=[...a];"done"===h.status&&(h=e_(h,s,r,d.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),i,void 0));try{if(c===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,a))return[h,o];return[eA(h,{_nodes:d,historyValue:c}),o]}catch(e){throw e}}finally{r.actionExecutor=a}}function eb(e,t,r,s){var n,i,o,a;if(eo(e))if(t[e.id]){let o=t[e.id];for(let e of o)s.add(e),eb(e,t,r,s);for(let a of o){n=a,i=e.parent,ew(s,t,r,J(n,i))}}else{let n=ei(e);for(let i of n.target)s.add(i),n===e.parent?.initial&&r.add(e.parent),eb(i,t,r,s);for(let i of n.target){o=i,a=e.parent,ew(s,t,r,J(o,a))}}else if("compound"===e.type){let[n]=e.initial.target;eo(n)||(s.add(n),r.add(n)),eb(n,t,r,s),ew(s,t,r,J(n,e))}else if("parallel"===e.type)for(let n of F(e).filter(e=>!eo(e)))[...s].some(e=>ed(e,n))||(eo(n)||(s.add(n),r.add(n)),eb(n,t,r,s))}function ew(e,t,r,s,n){for(let i of s)if((!n||ed(i,n))&&e.add(i),"parallel"===i.type)for(let s of F(i).filter(e=>!eo(e)))[...e].some(e=>ed(e,s))||(e.add(s),eb(s,t,r,e))}function e_(e,t,r,s,n,i){let o=i?[]:void 0,a=function e(t,r,s,n,i,o){let{machine:a}=t,c=t;for(let t of n){var u;let n="function"==typeof t,l=n?t:(u="string"==typeof t?t:t.type,a.implementations.actions[u]),h={context:c.context,event:r,self:s.self,system:s.system},d=n||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:c.context,event:r}):t.params:void 0;if(!l||!("resolve"in l)){s.actionExecutor({type:"string"==typeof t?t:"object"==typeof t?t.type:t.name||"(anonymous)",info:h,params:d,exec:l});continue}let[p,f,y]=l.resolve(s,c,h,d,l,i);c=p,"retryResolve"in l&&o?.push([l,f]),"execute"in l&&s.actionExecutor({type:l.type,info:h,params:f,exec:l.execute.bind(null,s,f)}),y&&(c=e(c,r,s,y,i,o))}return c}(e,t,r,s,{internalQueue:n,deferredActorIds:i},o);return o?.forEach(([e,t])=>{e.retryResolve(r,a,t)}),a}function e$(e,t,r,s){let n=e,i=[];function a(e,t,s){r.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:r.self,event:t,snapshot:e[0],_transitions:s}),i.push(e)}if(t.type===c)return a([n=eA(ex(n,t,r),{status:"stopped"}),[]],t,[]),{snapshot:n,microsteps:i};let u=t;if(u.type!==o){let t=u,o=t.type.startsWith("xstate.error.actor"),c=eI(t,n);if(o&&!c.length)return a([n=eA(e,{status:"error",error:t.error}),[]],t,[]),{snapshot:n,microsteps:i};let l=ev(c,e,r,u,!1,s);n=l[0],a(l,t,c)}let l=!0,h=e.machine.options?.maxIterations??1/0,d=0;for(;"active"===n.status;){if(++d>h)throw Error(`Infinite loop detected: the machine has processed more than ${h} microsteps without reaching a stable state. This usually happens when there's a cycle of transitions (e.g., eventless transitions or raised events causing state A -> B -> C -> A).`);let e=l?function(e,t){let r=new Set;
15for(let s of e._nodes.filter(B))e:for(let n of[s].concat(J(s,void 0)))if(n.always){for(let s of n.always)if(void 0===s.guard||H(s.guard,e.context,t,e)){r.add(s);break e}}return ep(Array.from(r),new Set(e._nodes),e.historyValue)}(n,u):[],t=e.length?n:void 0;if(!e.length){if(!s.length)break;e=eI(u=s.shift(),n)}let i=ev(e,n,r,u,!1,s);l=(n=i[0])!==t,a(i,u,e)}return"active"!==n.status&&ex(n,u,r),{snapshot:n,microsteps:i}}function ex(e,t,r){return e_(e,t,r,Object.values(e.children).map(e=>z(e)),[],void 0)}function eI(e,t){return t.machine.getTransitionData(t,e)}function eq(e,t){let r=G(eh(e,t));return Q(e,[...r])}let eS=function(e){return function e(t,r){let s=y(t),n=y(r);return"string"==typeof n?"string"==typeof s&&n===s:"string"==typeof s?s in n:Object.keys(s).every(t=>t in n&&e(s[t],n[t]))}(e,this.value)},eE=function(e){return this.tags.has(e)},eR=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>void 0!==e.target||e.actions.length)},eT=function(){let{_nodes:e,tags:t,machine:r,getMeta:s,toJSON:n,can:i,hasTag:o,matches:a,...c}=this;return{...c,tags:Array.from(t)}},ek=function(){return this._nodes.reduce((e,t)=>(void 0!==t.meta&&(e[t.id]=t.meta),e),{})};function ej(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:Q(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:eS,hasTag:eE,can:eR,getMeta:ek,toJSON:eT}}function eA(e,t={}){return ej({...e,...t},e.machine)}function eO(e,t){let{_nodes:r,tags:s,machine:n,children:i,context:o,can:a,hasTag:c,matches:u,getMeta:l,toJSON:h,...d}=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{...d,context:function e(t){let r;for(let s in t){let n=t[s];if(n&&"object"==typeof n)if("sessionId"in n&&"send"in n&&"ref"in n)(r??=Array.isArray(t)?t.slice():{...t})[s]={xstate$$type:T,id:n.id};else{let i=e(n);i!==n&&((r??=Array.isArray(t)?t.slice():{...t})[s]=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 s=e[r];Array.isArray(s)&&(t[r]=s.map(e=>({id:e.id})))}return t}(d.historyValue)}}function eC(e,t,r,s,{event:n,id:i,delay:o},{internalQueue:a}){let c,u=t.machine.implementations.delays;if("string"==typeof n)throw Error(`Only event objects may be used with raise; use raise({ type: "${n}" }) instead`);let l="function"==typeof n?n(r,s):n;if("string"==typeof o){let e=u&&u[o];c="function"==typeof e?e(r,s):e}else c="function"==typeof o?o(r,s):o;return"number"!=typeof c&&a.push(l),[t,{event:l,id:i,delay:c},void 0]}function eD(e,t){let{event:r,delay:s,id:n}=t;if("number"==typeof s)return void e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,r,s,n)})}function eP(e,t){function r(e,t){}return r.type="xstate.raise",r.event=e,r.id=t?.id,r.delay=t?.delay,r.resolve=eC,r.execute=eD,r}},75629:(e,t,r)=>{r.d(t,{J:()=>o});var s=r(7620);let n=s.createContext(!0);function i(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}function o(e){let t=s.useRef(i);return s.useInsertionEffect(()=>{t.current=e},[e]),(...e)=>((()=>{try{return s.use(n)}catch{return!1}})()&&i(),(0,t.current)(...e))}},76276:(e,t,r)=>{r.d(t,{default:()=>o});var s=r(54568),n=r(7620);let i=(0,n.lazy)(()=>Promise.all([r.e(8406),r.e(7325),r.e(6917),r.e(7294),r.e(3170),r.e(1850)]).then(r.bind(r,68966)));function o(e){return(0,s.jsx)(n.Suspense,{fallback:null,children:(0,s.jsx)(i,{...e})})}},87039:(e,t,r)=>{function s(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}r.d(t,{Q:()=>h,u4:()=>s,y:()=>c});var n={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},o={0:String.fromCodePoint(i[0]),1:String.fromCodePoint(i[1]),2:String.fromCodePoint(i[2]),3:String.fromCodePoint(i[3])},a=[,,,,].fill(String.fromCodePoint(i[0])).join("");function c(e,t,r="auto"){return!0===r||"auto"===r&&(!(!Number.isNaN(Number(e))||/[a-z]/i.test(e)&&!/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(e))&&Date.parse(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${function(e){let t=JSON.stringify(e),r=new TextEncoder().encode(t),s="";for(let e=0;e<r.length;e++){let t=r[e];s+=o[t>>6&3]+o[t>>4&3]+o[t>>2&3]+o[3&t]}return a+s}(t)}`}Object.fromEntries(Object.entries(o).map(e=>[e[1],+e[0]])),Object.fromEntries(Object.entries(n).map(e=>e.reverse()));var u=`${Object.values(n).map(e=>`\\u{${e.toString(16)}}`).join("")}`,l=RegExp(`[${u}]{4,}`,"gu");function h(e){var t,r;return e&&JSON.parse({cleaned:(t=JSON.stringify(e)).replace(l,""),encoded:(null==(r=t.match(l))?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.