PageSourceSearch

https://www.geosociety.org/_next/static/chunks/576.b2af28a753d0a306.js

js geosociety.org collected 2026-09-24 08:37:07 UTC 48,019 bytes, 3 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[576],{70576:(t,e,s)=>{let n;s.r(e),s.d(e,{default:()=>ew});let i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},r=new Uint8Array(16),o=[];for(let t=0;t<256;++t)o.push((t+256).toString(16).slice(1));let a=function(t,e,s){if(i.randomUUID&&!e&&!t)return i.randomUUID();let a=(t=t||{}).random??t.rng?.()??function(){if(!n){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");n=crypto.getRandomValues.bind(crypto)}return n(r)}();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,e){if((s=s||0)<0||s+16>e.length)throw RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[s+t]=a[t];return e}return function(t,e=0){return(o[t[e+0]]+o[t[e+1]]+o[t[e+2]]+o[t[e+3]]+"-"+o[t[e+4]]+o[t[e+5]]+"-"+o[t[e+6]]+o[t[e+7]]+"-"+o[t[e+8]]+o[t[e+9]]+"-"+o[t[e+10]]+o[t[e+11]]+o[t[e+12]]+o[t[e+13]]+o[t[e+14]]+o[t[e+15]]).toLowerCase()}(a)},c=t=>{if("undefined"==typeof window)return;let e=function(){let t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==s.g?s.g:void 0;if(t.__xstate__)return t.__xstate__}();e&&e.register(t)};class u{constructor(t){this._process=t,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(t){let e={value:t,next:null};if(this._current){this._last.next=e,this._last=e;return}this._current=e,this._last=e,this._active&&this.flush()}flush(){for(;this._current;){let t=this._current;this._process(t.value),this._current=t.next}this._last=null}}let l="xstate.init",h="xstate.stop";function d(t,e){return{type:`xstate.done.state.${t}`,output:e}}function p(t,e){return{type:`xstate.error.actor.${t}`,error:e,actorId:t}}function f(t){return{type:l,input:t}}function y(t){setTimeout(()=>{throw t})}let g="function"==typeof Symbol&&Symbol.observable||"@@observable";function m(t){if(w(t))return t;let e=[],s="";for(let n=0;n<t.length;n++){switch(t.charCodeAt(n)){case 92:s+=t[n+1],n++;continue;case 46:e.push(s),s="";continue}s+=t[n]}return e.push(s),e}function v(t){var e;return(e=t)&&"object"==typeof e&&"machine"in e&&"value"in e?t.value:"string"!=typeof t?t:function(t){if(1===t.length)return t[0];let e={},s=e;for(let e=0;e<t.length-1;e++)if(e===t.length-2)s[t[e]]=t[e+1];else{let n=s;s={},n[t[e]]=s}return e}(m(t))}function _(t,e){let s={},n=Object.keys(t);for(let i=0;i<n.length;i++){let r=n[i];s[r]=e(t[r],r,t,i)}return s}function b(t){return w(t)?t:[t]}function x(t){var e;return void 0===t?[]:w(e=t)?e:[e]}function S(t,e,s,n){return"function"==typeof t?t({context:e,event:s,self:n}):t}function w(t){return Array.isArray(t)}function k(t){var e;return(w(e=t)?e:[e]).map(t=>void 0===t||"string"==typeof t?{target:t}:t)}function I(t){if(void 0!==t&&""!==t)return x(t)}function $(t,e,s){let n="object"==typeof t,i=n?t:void 0;return{next:(n?t.next:t)?.bind(i),error:(n?t.error:e)?.bind(i),complete:(n?t.complete:s)?.bind(i)}}function E(t,e){let s=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!s)return t.implementations.actors[e];let[,n,i]=s,r=t.getStateNodeById(i).config.invoke;return(Array.isArray(r)?r[n]:r).src}function T(t,e){return`${t.sessionId}.${e}`}let R=0,q=!1,O=function(t){return t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped",t}({}),A={clock:{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},logger:console.log.bind(console),devTools:!1};
1class j{constructor(t,e){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new u(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=O.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 s={...A,...e},{clock:n,logger:i,parent:r,syncSnapshot:o,id:a,systemId:c,inspect:l}=s;this.system=r?r.system:function(t,e){let s=new Map,n=new Map,i=new WeakMap,r=new Set,o={},{clock:a,logger:c}=e,u={schedule:(t,e,s,n,i=Math.random().toString(36).slice(2))=>{let r={source:t,target:e,event:s,delay:n,id:i,startedAt:Date.now()},c=T(t,i);l._snapshot._scheduledEvents[c]=r;let u=a.setTimeout(()=>{delete o[c],delete l._snapshot._scheduledEvents[c],l._relay(t,e,s)},n);o[c]=u},cancel:(t,e)=>{let s=T(t,e),n=o[s];delete o[s],delete l._snapshot._scheduledEvents[s],void 0!==n&&a.clearTimeout(n)},cancelAll:t=>{for(let e in l._snapshot._scheduledEvents){let s=l._snapshot._scheduledEvents[e];s.source===t&&u.cancel(t,s.id)}}},l={_snapshot:{_scheduledEvents:(e?.snapshot&&e.snapshot.scheduler)??{}},_bookId:()=>`x:${R++}`,_register:(t,e)=>(s.set(t,e),t),_unregister:t=>{s.delete(t.sessionId);let e=i.get(t);void 0!==e&&(n.delete(e),i.delete(t))},get:t=>n.get(t),getAll:()=>Object.fromEntries(n.entries()),_set:(t,e)=>{let s=n.get(t);if(s&&s!==e)throw Error(`Actor with system ID '${t}' already exists.`);n.set(t,e),i.set(e,t)},inspect:t=>{let e=$(t);return r.add(e),{unsubscribe(){r.delete(e)}}},_sendInspectionEvent:e=>{if(!r.size)return;let s={...e,rootId:t.sessionId};r.forEach(t=>t.next?.(s))},_relay:(t,e,s)=>{l._sendInspectionEvent({type:"@xstate.event",sourceRef:t,actorRef:e,event:s}),e._send(s)},scheduler:u,getSnapshot:()=>({_scheduledEvents:{...l._snapshot._scheduledEvents}}),start:()=>{let t=l._snapshot._scheduledEvents;for(let e in l._snapshot._scheduledEvents={},t){let{source:s,target:n,event:i,delay:r,id:o}=t[e];u.schedule(s,n,i,r,o)}},_clock:a,_logger:c};return l}(this,{clock:n,logger:i}),l&&!r&&this.system.inspect($(l)),this.sessionId=this.system._bookId(),this.id=a??this.sessionId,this.logger=e?.logger??this.system._logger,this.clock=e?.clock??this.system._clock,this._parent=r,this._syncSnapshot=o,this.options=s,this.src=s.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:t=>{this._deferred.push(t)},system:this.system,stopChild:t=>{if(t._parent!==this)throw Error(`Cannot stop child actor ${t.id} of ${this.id} because it is not a child`);t._stop()},emit:t=>{let e=this.eventListeners.get(t.type),s=this.eventListeners.get("*");if(e||s)for(let n of[...e?e.values():[],...s?s.values():[]])try{n(t)}catch(t){y(t)}},actionExecutor:t=>{let e=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:t.type,params:t.params}}),!t.exec)return;let e=q;try{q=!0,t.exec(t.info,t.params)}finally{q=e}};this._processingStatus===O.Running?e():this._deferred.push(e)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this.systemId=c,this.system._set(c,this)),this._initState(e?.snapshot??e?.state),c&&"active"!==this._snapshot.status&&this.system._unregister(this)}_initState(t){try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(t){this._snapshot={status:"error",output:void 0,error:t}}}update(t,e){let s;for(this._snapshot=t;s=this._deferred.shift();)try{s()}catch(e){this._deferred.length=0,this._snapshot={...t,status:"error",error:e}}switch(this._snapshot.status){case"active":for(let e of this.observers)try{e.next?.(t)}catch(t){y(t)}break;case"done":var n;for(let e of this.observers)try{e.next?.(t)}catch(t){y(t)}this._stopProcedure(),this._complete(),this._doneEvent=(n=this.id,{type:`xstate.done.actor.${n}`,output:this._snapshot.output,actorId:n}
1),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:e,snapshot:t})}subscribe(t,e,s){let n=$(t,e,s);if(this._processingStatus!==O.Stopped)this.observers.add(n);else switch(this._snapshot.status){case"done":try{n.complete?.()}catch(t){y(t)}break;case"error":{let t=this._snapshot.error;if(n.error)try{n.error(t)}catch(t){y(t)}else y(t)}}return{unsubscribe:()=>{this.observers.delete(n)}}}on(t,e){let s=this.eventListeners.get(t);s||(s=new Set,this.eventListeners.set(t,s));let n=e.bind(void 0);return s.add(n),{unsubscribe:()=>{s.delete(n)}}}start(){if(this._processingStatus===O.Running)return this;this._syncSnapshot&&this.subscribe({next:t=>{"active"===t.status&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:t})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=O.Running;let t=f(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t}),this._snapshot.status){case"done":return this.update(this._snapshot,t),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(t){return this._snapshot={...this._snapshot,status:"error",error:t},this._error(t),this}return this.update(this._snapshot,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let e,s;try{e=this.logic.transition(this._snapshot,t,this._actorScope)}catch(t){s={err:t}}if(s){let{err:t}=s;this._snapshot={...this._snapshot,status:"error",error:t},this._error(t);return}this.update(e,t),t.type===h&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===O.Stopped||((this.mailbox.clear(),this._processingStatus===O.NotStarted)?this._processingStatus=O.Stopped:this.mailbox.enqueue({type:h})),this}stop(){if(this._parent)throw Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let t of this.observers)try{t.complete?.()}catch(t){y(t)}this.observers.clear()}_reportError(t){if(!this.observers.size){this._parent||y(t);return}let e=!1;for(let s of this.observers){let n=s.error;e||=!n;try{n?.(t)}catch(t){y(t)}}this.observers.clear(),e&&y(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,p(this.id,t))}_stopProcedure(){return this._processingStatus!==O.Running||(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new u(this._process.bind(this)),this._processingStatus=O.Stopped,this.system._unregister(this)),this}_send(t){this._processingStatus!==O.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){let{devTools:t}=this.options;t&&("function"==typeof t?t:c)(this)}toJSON(){return{xstate$$type:1,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[g](){return this}getSnapshot(){return this._snapshot}}function M(t,...[e]){return new j(t,e)}function N(t,e,s,n,{sendId:i}){return[e,{sendId:"function"==typeof i?i(s,n):i},void 0]}function P(t,e){t.defer(()=>{t.system.scheduler.cancel(t.self,e.sendId)})}function C(t){function e(t,e){}return e.type="xstate.cancel",e.sendId=t,e.resolve=N,e.execute=P,e}function D(t,e,s,n,{id:i,systemId:r,src:o,input:a,syncSnapshot:c}){let u,l,h="string"==typeof o?E(e.machine,o):o,d="function"==typeof i?i(s):i;return h&&(l="function"==typeof a?a({context:e.context,event:s.event,self:t.self}):a,u=M(h,{id:d,src:o,parent:t.self,syncSnapshot:c,systemId:r,input:l})),[tI(e,{children:{...e.children,[d]:u}}),{id:i,systemId:r,actorRef:u,src:o,input:l},void 0]}function U(t,{actorRef:e}){e&&t.defer(()=>{e._processingStatus!==O.Stopped&&e.start()})}function V(...[t,{id:e,systemId:s,input:n,syncSnapshot:i=!1}={}]){function r(t,e){}return r.type="xstate.spawnChild",r.id=e,r.systemId=s,r.src=t,r.input=n,r.syncSnapshot=i,r.resolve=D,r.execute=U,r}function B(t,e,s,n,{actorRef:i}){let r="function"==typeof i?i(s,n):i,o="string"==typeof r?e.children[r]:r,a=e.children;return o&&(a={...a},delete a[o.id]),[tI(e,{children:a}),o,void 0]}function J(t,e){if(e){if(t.system._unregister(e),e._processingStatus!==O.Running){t.stopChild(e);return}t.defer(()=>{t.stopChild(e)})}}function W(t){function e(t,e){}return e.type="xstate.stopChild",e.actorRef=t,e.resolve=B,e.execute=J,e}function z(t,e,s,n){let{machine:i}=n,r="function"==typeof t,o=r?t:i.implementations.guards["string"==typeof t?t:t.type];if(!r&&!o)throw Error(`Guard '${"string"==typeof t?t:t.type}' is not implemented.'.`);if("function"!=typeof o)return z(o,e,s,n);let a={context:e,event:s},c=r||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:e,event:s}):t.params:void 0;return"check"in o?o.check(n,a,o):o(a,c)}let L=t=>"atomic"===t.type||"final"===t.type;function F(t){return Object.values(t.states).filter(t=>"history"!==t.type)}function G(t,e){let s=[];if(e===t)return s;let n=t.parent;for(;n&&n!==e;)s.push(n),n=n.parent;return s}function H(t){let e=new Set(t),s=Q(e);for(let t of e)if("compound"!==t.type||s.get(t)&&s.get(t).length){if("parallel"===t.type){for(let s of F(t))if("history"!==s.type&&!e.has(s))for(let t of ts(s))e.add(t)}}else ts(t).forEach(t=>e.add(t));for(let t of e){let s=t.parent;for(;s;)e.add(s),s=s.parent}return e}function Q(t){let e=new Map;for(let s of t)e.has(s)||e.set(s,[]),s.parent&&(e.has(s.parent)||e.set(s.parent,[]),e.get(s.parent).push(s));return e}function K(t,e){return function t(e,s){let n=s.get(e);if(!n)return{};if("compound"===e.type){let t=n[0];if(!t)return{};if(L(t))return t.key}let i={};for(let e of n)i[e.key]=t(e,s);return i}(t,Q(H(e)))}function X(t,e){return"compound"===e.type?F(e).some(e=>"final"===e.type&&t.has(e)):"parallel"===e.type?F(e).every(e=>X(t,e)):"final"===e.type}let Y=t=>"#"===t[0];function Z(t,e,s){let n=I(s.target),i=s.reenter??!1,r=function(t,e){if(void 0!==e)return e.map(e=>{if("string"!=typeof e)return e;if(Y(e))return t.machine.getStateNodeById(e);let s="."===e[0];if(s&&!t.parent)return tr(t,e.slice(1));let n=s?t.key+e:e;if(t.parent)try{return tr(t.parent,n)}catch(e){throw Error(`Invalid transition definition for state node '${t.id}':
2${e.message}`)}else throw Error(`Invalid target: "${e}" is not a valid target from the root node. Did you mean ".${e}"?`)})}(t,n),o={...s,actions:x(s.actions),guard:s.guard,target:r,source:t,reenter
2:i,eventType:e,toJSON:()=>({...o,source:`#${t.id}`,target:r?r.map(t=>`#${t.id}`):void 0})};return o}function tt(t){let e=I(t.config.target);return e?{target:e.map(e=>"string"==typeof e?tr(t.parent,e):e)}:t.parent.initial}function te(t){return"history"===t.type}function ts(t){let e=tn(t);for(let s of e)for(let n of G(s,t))e.add(n);return e}function tn(t){let e=new Set;return!function t(s){if(!e.has(s)){if(e.add(s),"compound"===s.type)t(s.initial.target[0]);else if("parallel"===s.type)for(let e of F(s))t(e)}}(t),e}function ti(t,e){if(Y(e))return t.machine.getStateNodeById(e);if(!t.states)throw Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);let s=t.states[e];if(!s)throw Error(`Child state '${e}' does not exist on '${t.id}'`);return s}function tr(t,e){if("string"==typeof e&&Y(e))try{return t.machine.getStateNodeById(e)}catch{}let s=m(e).slice(),n=t;for(;s.length;){let t=s.shift();if(!t.length)break;n=ti(n,t)}return n}function to(t,e){if("string"==typeof e){let s=t.states[e];if(!s)throw Error(`State '${e}' does not exist on '${t.id}'`);return[t,s]}let s=Object.keys(e),n=s.map(e=>ti(t,e)).filter(Boolean);return[t.machine.root,t].concat(n,s.reduce((s,n)=>{let i=ti(t,n);if(!i)return s;let r=to(i,e[n]);return s.concat(r)},[]))}function ta(t,e){let s=t;for(;s.parent&&s.parent!==e;)s=s.parent;return s.parent===e}function tc(t,e,s){let n=new Set;for(let i of t){let t=!1,r=new Set;for(let o of n)if(function(t,e){let s=new Set(t),n=new Set(e);for(let t of s)if(n.has(t))return!0;for(let t of n)if(s.has(t))return!0;return!1}(th([i],e,s),th([o],e,s)))if(ta(i.source,o.source))r.add(o);else{t=!0;break}if(!t){for(let t of r)n.delete(t);n.add(i)}}return Array.from(n)}function tu(t,e){if(!t.target)return[];let s=new Set;for(let n of t.target)if(te(n))if(e[n.id])for(let t of e[n.id])s.add(t);else for(let t of tu(tt(n),e))s.add(t);else s.add(n);return[...s]}function tl(t,e){let s=tu(t,e);if(!s)return;if(!t.reenter&&s.every(e=>e===t.source||ta(e,t.source)))return t.source;let n=function(t){let[e,...s]=t;for(let t of G(e,void 0))if(s.every(e=>ta(e,t)))return t}(s.concat(t.source));return n||(t.reenter?void 0:t.source.machine.root)}function th(t,e,s){let n=new Set;for(let i of t)if(i.target?.length){let t=tl(i,s);for(let s of(i.reenter&&i.source===t&&n.add(t),e))ta(s,t)&&n.add(s)}return[...n]}function td(t,e,s,n,i,r){if(!t.length)return e;let o=new Set(e._nodes),a=e.historyValue,c=tc(t,o,a),u=e;i||([u,a]=function(t,e,s,n,i,r,o,a){let c,u=t,l=th(n,i,r);for(let t of(l.sort((t,e)=>e.order-t.order),l))for(let e of function(t){return Object.keys(t.states).map(e=>t.states[e]).filter(t=>"history"===t.type)}(t)){let s;s="deep"===e.history?e=>L(e)&&ta(e,t):e=>e.parent===t,(c??={...r})[e.id]=Array.from(i).filter(s)}for(let t of l)u=ty(u,e,s,[...t.exit,...t.invoke.map(t=>W(t.id))],o,void 0),i.delete(t);return[u,c||r]}(u,n,s,c,o,a,r,s.actionExecutor)),u=function(t,e,s,n,i,r,o,a){let c=t,u=new Set,l=new Set;(function(t,e,s,n){for(let i of t){let t=tl(i,e);for(let r of i.target||[])!te(r)&&(i.source!==r||i.source!==t||i.reenter)&&(n.add(r),s.add(r)),tp(r,e,s,n);for(let r of tu(i,e)){let o=G(r,t);t?.type==="parallel"&&o.push(t),tf(n,e,s,o,!i.source.parent&&i.reenter?void 0:t)}}})(n,o,l,u),a&&l.add(t.machine.root);let h=new Set;for(let t of[...u].sort((t,e)=>t.order-e.order)){i.add(t);let n=[];for(let e of(n.push(...t.entry),t.invoke))n.push(V(e.src,{...e,syncSnapshot:!!e.onSnapshot}));if(l.has(t)){let e=t.initial.actions;n.push(...e)}if(c=ty(c,e,s,n,r,t.invoke.map(t=>t.id)),"final"===t.type){let n=t.parent,o=n?.type==="parallel"?n:n?.parent,a=o||t;for(n?.type==="compound"&&r.push(d(n.id,void 0!==t.output?S(t.output,c.context,e,s.self):void 0));o?.type==="parallel"&&!h.has(o)&&X(i,o);)h.add(o),r.push(d(o.id)),a=o,o=o.parent;if(o)continue;c=tI(c,{status:"done",output:function(t,e,s,n,i){if(void 0===n.output)return;let r=d(i.id,void 0!==i.output&&i.parent?S(i.output,t.context,e,s.self):void 0);return S(n.output,t.context,r,s.self)}(c,e,s,c.machine.root,a)})}}return c}(u=ty(u,n,s,c.flatMap(t=>t.actions),r,void 0),n,s,c,o,r,a,i);let l=[...o];"done"===u.status&&(u=ty(u,n,s,l.sort((t,e)=>e.order-t.order).flatMap(t=>t.exit),r,void 0));try{if(a===e.historyValue&&function(t,e){if(t.length!==e.size)return!1;for(let s of t)if(!e.has(s))return!1;return!0}(e._nodes,o))return u;return tI(u,{_nodes:l,historyValue:a})}catch(t){throw t}}function tp(t,e,s,n){var i,r,o,a;if(te(t))if(e[t.id]){let o=e[t.id];for(let t of o)n.add(t),tp(t,e,s,n);for(let a of o){i=a,r=t.parent,tf(n,e,s,G(i,r))}}else{let i=tt(t);for(let r of i.target)n.add(r),i===t.parent?.initial&&s.add(t.parent),tp(r,e,s,n);for(let r of i.target){o=r,a=t.parent,tf(n,e,s,G(o,a))}}else if("compound"===t.type){let[i]=t.initial.target;te(i)||(n.add(i),s.add(i)),tp(i,e,s,n),tf(n,e,s,G(i,t))}else if("parallel"===t.type)for(let i of F(t).filter(t=>!te(t)))[...n].some(t=>ta(t,i))||(te(i)||(n.add(i),s.add(i)),tp(i,e,s,n))}function tf(t,e,s,n,i){for(let r of n)if((!i||ta(r,i))&&t.add(r),"parallel"===r.type)for(let n of F(r).filter(t=>!te(t)))[...t].some(t=>ta(t,n))||(t.add(n),tp(n,e,s,t))}function ty(t,e,s,n,i,r){let o=r?[]:void 0,a=function t(e,s,n,i,r,o){let{machine:a}=e,c=e;for(let e of i){var u;let i="function"==typeof e,l=i?e:(u="string"==typeof e?e:e.type,a.implementations.actions[u]),h={context:c.context,event:s,self:n.self,system:n.system},d=i||"string"==typeof e?void 0:"params"in e?"function"==typeof e.params?e.params({context:c.context,event:s}):e.params:void 0;if(!l||!("resolve"in l)){n.actionExecutor({type:"string"==typeof e?e:"object"==typeof e?e.type:e.name||"(anonymous)",info:h,params:d,exec:l});continue}let[p,f,y]=l.resolve(n,c,h,d,l,r);c=p,"retryResolve"in l&&o?.push([l,f]),"execute"in l&&n.actionExecutor({type:l.type,info:h,params:f,exec:l.execute.bind(null,n,f)}),y&&(c=t(c,s,n,y,r,o))}return c}(t,e,s,n,{internalQueue:i,deferredActorIds:r},o);return o?.forEach(([t,e])=>{t.retryResolve(s,a,e)}),a}function tg(t,e,s,n){let i=t,r=[];function o(t,e,n){s.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:s.self,event:e,snapshot:t,_transitions:n}),r.push(t)}if(e.type===h)return o(i=tI(tm(i,e,s),{status:"stopped"}),e,[]),{snapshot:i,microstates:r};let a=e;if(a.type!==l){let e=a,c=e.type.startsWith("xstate.error.actor"),u=tv(e,i);if(c&&!u.length)return o(i=tI(t,{status:"error",error:e.error}),e,[]),{snapshot:i,microstates:r};o(i=td(u,t,s,a,!1,n),e,u)}let c=!0;for(;"active"===i.status;){let t=c?function(t,e){let s=new Set;for(let n of t._nodes.filter(L))t:for(let i of[n].concat(G(n,void 0)))if(i.always){for(let n of i.always)if(void 0===n.guard||z(n.guard,t.context,e,t)){s.add(n);break t}}return tc(Array.from(s),new Set(t._nodes),t.historyValue)}
2(i,a):[],e=t.length?i:void 0;if(!t.length){if(!n.length)break;t=tv(a=n.shift(),i)}c=(i=td(t,i,s,a,!1,n))!==e,o(i,a,t)}return"active"!==i.status&&tm(i,a,s),{snapshot:i,microstates:r}}function tm(t,e,s){return ty(t,e,s,Object.values(t.children).map(t=>W(t)),[],void 0)}function tv(t,e){return e.machine.getTransitionData(e,t)}let t_=function(t){return function t(e,s){let n=v(e),i=v(s);return"string"==typeof i?"string"==typeof n&&i===n:"string"==typeof n?n in i:Object.keys(n).every(e=>e in i&&t(n[e],i[e]))}(t,this.value)},tb=function(t){return this.tags.has(t)},tx=function(t){let e=this.machine.getTransitionData(this,t);return!!e?.length&&e.some(t=>void 0!==t.target||t.actions.length)},tS=function(){let{_nodes:t,tags:e,machine:s,getMeta:n,toJSON:i,can:r,hasTag:o,matches:a,...c}=this;return{...c,tags:Array.from(e)}},tw=function(){return this._nodes.reduce((t,e)=>(void 0!==e.meta&&(t[e.id]=e.meta),t),{})};function tk(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:K(e.root,t._nodes),tags:new Set(t._nodes.flatMap(t=>t.tags)),children:t.children,historyValue:t.historyValue||{},matches:t_,hasTag:tb,can:tx,getMeta:tw,toJSON:tS}}function tI(t,e={}){return tk({...t,...e},t.machine)}function t$(t,e,s,n,{event:i,id:r,delay:o},{internalQueue:a}){let c,u=e.machine.implementations.delays;if("string"==typeof i)throw Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);let l="function"==typeof i?i(s,n):i;if("string"==typeof o){let t=u&&u[o];c="function"==typeof t?t(s,n):t}else c="function"==typeof o?o(s,n):o;return"number"!=typeof c&&a.push(l),[e,{event:l,id:r,delay:c},void 0]}function tE(t,e){let{event:s,delay:n,id:i}=e;if("number"==typeof n){t.defer(()=>{let e=t.self;t.system.scheduler.schedule(e,e,s,n,i)});return}}function tT(t,e){function s(t,e){}return s.type="xstate.raise",s.event=t,s.id=e?.id,s.delay=e?.delay,s.resolve=t$,s.execute=tE,s}let tR="xstate.observable.error",tq="xstate.observable.complete";function tO(t){return{config:t,transition:(t,e)=>{if("active"!==t.status)return t;switch(e.type){case tR:return{...t,status:"error",error:e.data,input:void 0,_subscription:void 0};case tq:return{...t,status:"done",input:void 0,_subscription:void 0};case h:return t._subscription.unsubscribe(),{...t,status:"stopped",input:void 0,_subscription:void 0};default:return t}},getInitialSnapshot:(t,e)=>({status:"active",output:void 0,error:void 0,context:void 0,input:e,_subscription:void 0}),start:(e,{self:s,system:n,emit:i})=>{"done"!==e.status&&(e._subscription=t({input:e.input,system:n,self:s,emit:i}).subscribe({next:t=>{s._parent&&n._relay(s,s._parent,t)},error:t=>{n._relay(s,s,{type:tR,data:t})},complete:()=>{n._relay(s,s,{type:tq})}}))},getPersistedSnapshot:({_subscription:t,...e})=>e,restoreSnapshot:t=>({...t,_subscription:void 0})}}function tA(t,e,s,n,{assignment:i}){if(!e.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let r={},o={context:e.context,event:s.event,spawn:function(t,{machine:e,context:s},n,i){let r=(r,o)=>{if("string"!=typeof r)return M(r,{id:o?.id,parent:t.self,syncSnapshot:o?.syncSnapshot,input:o?.input,src:r,systemId:o?.systemId});{let a=E(e,r);if(!a)throw Error(`Actor logic '${r}' not implemented in machine '${e.id}'`);let c=M(a,{id:o?.id,parent:t.self,syncSnapshot:o?.syncSnapshot,input:"function"==typeof o?.input?o.input({context:s,event:n,self:t.self}):o?.input,src:r,systemId:o?.systemId});return i[c.id]=c,c}};return(e,s)=>{let n=r(e,s);return i[n.id]=n,t.defer(()=>{n._processingStatus!==O.Stopped&&n.start()}),n}}(t,e,s.event,r),self:t.self,system:t.system},a={};if("function"==typeof i)a=i(o,n);else for(let t of Object.keys(i)){let e=i[t];a[t]="function"==typeof e?e(o,n):e}let c=Object.assign({},e.context,a);return[tI(e,{context:c,children:Object.keys(r).length?{...e.children,...r}:e.children}),void 0,void 0]}function tj(t){function e(t,e){}return e.type="xstate.assign",e.assignment=t,e.resolve=tA,e}new WeakMap,function(t,e){;}(t=>void 0,void 0);let tM=new WeakMap;function tN(t,e,s){let n=tM.get(t);return n?e in n||(n[e]=s()):(n={[e]:s()},tM.set(t,n)),n[e]}let tP={},tC=t=>"string"==typeof t?{type:t}:"function"==typeof t?"resolve"in t?{type:t.type}:{type:t.name}:t;class tD{constructor(t,e){if(this.config=t,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=e._parent,this.key=e._key,this.machine=e._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join("."),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?_(this.config.states,(t,e)=>new tD(t,{_parent:this,_key:e,_machine:this.machine})):tP,"compound"===this.type&&!this.config.initial)throw Error(`No initial state specified for c
2ompound 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=x(this.config.entry).slice(),this.exit=x(this.config.exit).slice(),this.meta=this.config.meta,this.output="final"!==this.type&&this.parent?void 0:this.config.output,this.tags=x(t.tags).slice()}_initialize(){this.transitions=function(t){let e=new Map;if(t.config.on)for(let s of Object.keys(t.config.on)){if(""===s)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let n=t.config.on[s];e.set(s,k(n).map(e=>Z(t,s,e)))}if(t.config.onDone){let s=`xstate.done.state.${t.id}`;e.set(s,k(t.config.onDone).map(e=>Z(t,s,e)))}for(let s of t.invoke){if(s.onDone){let n=`xstate.done.actor.${s.id}`;e.set(n,k(s.onDone).map(e=>Z(t,n,e)))}if(s.onError){let n=`xstate.error.actor.${s.id}`;e.set(n,k(s.onError).map(e=>Z(t,n,e)))}if(s.onSnapshot){let n=`xstate.snapshot.${s.id}`;e.set(n,k(s.onSnapshot).map(e=>Z(t,n,e)))}}for(let s of t.after){let t=e.get(s.eventType);t||(t=[],e.set(s.eventType,t)),t.push(s)}return e}(this),this.config.always&&(this.always=k(this.config.always).map(t=>Z(this,"",t))),Object.keys(this.states).forEach(t=>{this.states[t]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.t
2ype,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(tC),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(t=>`#${t.id}`),source:`#${this.id}`,actions:this.initial.actions.map(tC),eventType:null})}:void 0,history:this.history,states:_(this.states,t=>t.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(t=>({...t,actions:t.actions.map(tC)})),entry:this.entry.map(tC),exit:this.exit.map(tC),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 tN(this,"invoke",()=>x(this.config.invoke).map((t,e)=>{var s,n;let{src:i,systemId:r}=t,o=t.id??(s=this.id,`${e}.${s}`),a="string"==typeof i?i:`xstate.invoke.${n=this.id,`${e}.${n}`}`;return{...t,src:a,id:o,systemId:r,toJSON(){let{onDone:e,onError:s,...n}=t;return{...n,type:"xstate.invoke",src:a,id:o}}}}))}get on(){return tN(this,"on",()=>[...this.transitions].flatMap(([t,e])=>e.map(e=>[t,e])).reduce((t,[e,s])=>(t[e]=t[e]||[],t[e].push(s),t),{}))}get after(){return tN(this,"delayedTransitions",()=>(function(t){let e=t.config.after;if(!e)return[];let s=e=>{var s;let n=(s=t.id,{type:`xstate.after.${e}.${s}`}),i=n.type;return t.entry.push(tT(n,{id:i,delay:e})),t.exit.push(C(i)),i};return Object.keys(e).flatMap(t=>{let n=e[t],i=Number.isNaN(+t)?t:+t,r=s(i);return x("string"==typeof n?{target:n}:n).map(t=>({...t,event:r,delay:i}))}).map(e=>{let{delay:s}=e;return{...Z(t,e.event,e),delay:s}})})(this))}get initial(){return tN(this,"initial",()=>(function(t,e){let s="string"==typeof e?t.states[e]:e?t.states[e.target]:void 0;if(!s&&e)throw Error(`Initial state node "${e}" not found on parent state node #${t.id}`);let n={source:t,actions:e&&"string"!=typeof e?x(e.actions):[],eventType:null,reenter:!1,target:s?[s]:[],toJSON:()=>({...n,source:`#${t.id}`,target:s?[`#${s.id}`]:[]})};return n})(this,this.config.initial))}next(t,e){let s,n=e.type,i=[];for(let r of tN(this,`candidates-${n}`,()=>{var t;return t=this,t.transitions.get(n)||[...t.transitions.keys()].filter(t=>{if("*"===t)return!0;if(!t.endsWith(".*"))return!1;let e=t.split("."),s=n.split(".");for(let t=0;t<e.length;t++){let n=e[t],i=s[t];if("*"===n)return t===e.length-1;if(n!==i)return!1}return!0}).sort((t,e)=>e.length-t.length).flatMap(e=>t.transitions.get(e))})){let{guard:o}=r,a=t.context,c=!1;try{c=!o||z(o,a,e,t)}catch(e){let t="string"==typeof o?o:"object"==typeof o?o.type:void 0;throw Error(`Unable to evaluate guard ${t?`'${t}' `:""}in transition for event '${n}' in state node '${this.id}':
3${e.message}`)}if(c){i.push(...r.actions),s=r;break}}return s?[s]:void 0}get events(){return tN(this,"events",()=>{let{states:t}=this,e=new Set(this.ownEvents);if(t)for(let s of Object.keys(t)){let n=t[s];if(n.states)for(let t of n.events)e.add(`${t}`)}return Array.from(e)})}get ownEvents(){return Array.from(new Set([...this.transitions.keys()].filter(t=>this.transitions.get(t).some(t=>!(!t.target&&!t.actions.length&&!t.reenter)))))}}class tU{constructor(t,e){this.config=t,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=t.id||"(machine)",this.implementations={actors:e?.actors??{},actions:e?.actions??{},delays:e?.delays??{},guards:e?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new tD(t,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(t){let{actions:e,guards:s,actors:n,delays:i}=this.implementations;return new tU(this.config,{actions:{...e,...t.actions},guards:{...s,...t.guards},actors:{...n,...t.actors},delays:{...i,...t.delays}})}resolveState(t){let e=function(t,e){let s=H(to(t,e));return K(t,[...s])}(this.root,t.value),s=H(to(this.root,e));return tk({_nodes:[...s],context:t.context||{},children:{},status:X(s,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,e,s){return tg(t,e,s,[]).snapshot}microstep(t,e,s){return tg(t,e,s,[]).microstates}getTransitionData(t,e){return function t(e,s,n,i){if("string"==typeof s){let t=ti(e,s).next(n,i);return t&&t.length?t:e.next(n,i)}if(1===Object.keys(s).length){let r=Object.keys(s),o=t(ti(e,r[0]),s[r[0]],n,i);return o&&o.length?o:e.next(n,i)}let r=[];for(let o of Object.keys(s)){let a=s[o];if(!a)continue;let c=t(ti(e,o),a,n,i);c&&r.push(...c)}return r.length?r:e.next(n,i)}(this.root,t.value,t,e)||[]}getPreInitialState(t,e,s){let{context:n}=this.config,i=tk({context:"function"!=typeof n&&n?n:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof n?ty(i,e,t,[tj(({spawn:t,event:e,self:s})=>n({spawn:t,input:e.input,self:s}))],s,void 0):i}getInitialSnapshot(t,e){let s=f(e),n=[],i=this.getPreInitialState(t,s,n),{snapshot:r}
3=tg(td([{target:[...tn(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],i,t,s,!0,n),s,t,n);return r}start(t){Object.values(t.children).forEach(t=>{"active"===t.getSnapshot().status&&t.start()})}getStateNodeById(t){let e=m(t),s=e.slice(1),n=Y(e[0])?e[0].slice(1):e[0],i=this.idMap.get(n);if(!i)throw Error(`Child state node '#${n}' does not exist on machine '${this.id}'`);return tr(i,s)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,e){let{_nodes:s,tags:n,machine:i,children:r,context:o,can:a,hasTag:c,matches:u,getMeta:l,toJSON:h,...d}=t,p={};for(let t in r){let s=r[t];p[t]={snapshot:s.getPersistedSnapshot(e),src:s.src,systemId:s.systemId,syncSnapshot:s._syncSnapshot}}return{...d,context:function t(e){let s;for(let n in e){let i=e[n];if(i&&"object"==typeof i)if("sessionId"in i&&"send"in i&&"ref"in i)(s??=Array.isArray(e)?e.slice():{...e})[n]={xstate$$type:1,id:i.id};else{let r=t(i);r!==i&&((s??=Array.isArray(e)?e.slice():{...e})[n]=r)}}return s??e}(o),children:p,historyValue:function(t){if("object"!=typeof t||null===t)return{};let e={};for(let s in t){let n=t[s];Array.isArray(n)&&(e[s]=n.map(t=>({id:t.id})))}return e}(d.historyValue)}}restoreSnapshot(t,e){let s={},n=t.children;Object.keys(n).forEach(t=>{let i=n[t],r=i.snapshot,o=i.src,a="string"==typeof o?E(this,o):o;if(!a)return;let c=M(a,{id:t,parent:e.self,syncSnapshot:i.syncSnapshot,snapshot:r,src:o,systemId:i.systemId});s[t]=c});let i=function(t,e){if(!e||"object"!=typeof e)return{};let s={};for(let n in e)for(let i of e[n]){let e=function(t,e){if(e instanceof tD)return e;try{return t.machine.getStateNodeById(e.id)}catch{}}(t,i);e&&(s[n]??=[],s[n].push(e))}return s}(this.root,t.historyValue),r=tk({...t,children:s,_nodes:Array.from(H(to(this.root,t.value))),historyValue:i},this),o=new Set;return!function t(e,s){if(!o.has(e))for(let n in o.add(e),e){let i=e[n];if(i&&"object"==typeof i){if("xstate$$type"in i&&1===i.xstate$$type){e[n]=s[i.id];continue}t(i,s)}}}(r.context,s),r}}function tV(t,e,s,n,{event:i}){return[e,{event:"function"==typeof i?i(s,n):i},void 0]}function tB(t,{event:e}){t.defer(()=>t.emit(e))}function tJ(t){function e(t,e){}return e.type="xstate.emit",e.event=t,e.resolve=tV,e.execute=tB,e}let tW=function(t){return t.Parent="#_parent",t.Internal="#_internal",t}({});function tz(t,e,s,n,{to:i,event:r,id:o,delay:a},c){let u,l,h=e.machine.implementations.delays;if("string"==typeof r)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${r}" }) instead`);let d="function"==typeof r?r(s,n):r;if("string"==typeof a){let t=h&&h[a];u="function"==typeof t?t(s,n):t}else u="function"==typeof a?a(s,n):a;let p="function"==typeof i?i(s,n):i;if("string"==typeof p){if(!(l=p===tW.Parent?t.self._parent:p===tW.Internal?t.self:p.startsWith("#_")?e.children[p.slice(2)]:c.deferredActorIds?.includes(p)?p:e.children[p]))throw Error(`Unable to send event to actor '${p}' from machine '${e.machine.id}'.`)}else l=p||t.self;return[e,{to:l,targetId:"string"==typeof p?p:void 0,event:d,id:o,delay:u},void 0]}function tL(t,e,s){"string"==typeof s.to&&(s.to=e.children[s.to])}function tF(t,e){t.defer(()=>{let{to:s,event:n,delay:i,id:r}=e;if("number"==typeof i){t.system.scheduler.schedule(t.self,s,n,i,r);return}t.system._relay(t.self,s,"xstate.error"===n.type?p(t.self.id,n.data):n)})}function tG(t,e,s){function n(t,e){}return n.type="xstate.sendTo",n.to=t,n.event=e,n.id=s?.id,n.delay=s?.delay,n.resolve=tz,n.retryResolve=tL,n.execute=tF,n}function tH(t,e,s,n,{collect:i}){let r=[],o=function(t){r.push(t)};return o.assign=(...t)=>{r.push(tj(...t))},o.cancel=(...t)=>{r.push(C(...t))},o.raise=(...t)=>{r.push(tT(...t))},o.sendTo=(...t)=>{r.push(tG(...t))},o.sendParent=(...t)=>{r.push(function(t,e){return tG(tW.Parent,t,e)}(...t))},o.spawnChild=(...t)=>{r.push(V(...t))},o.stopChild=(...t)=>{r.push(W(...t))},o.emit=(...t)=>{r.push(tJ(...t))},i({context:s.context,event:s.event,enqueue:o,check:t=>z(t,e.context,s.event,e),self:t.self,system:t.system},n),[e,void 0,r]}function tQ(t){function e(t,e){}return e.type="xstate.enqueueActions",e.collect=t,e.resolve=tH,e}function tK(t,e,s,n,{value:i,label:r}){return[e,{value:"function"==typeof i?i(s,n):i,label:r},void 0]}function tX({logger:t},{value:e,label:s}){s?t(s,e):t(e)}function tY(t=({context:t,event:e})=>({context:t,event:e}),e){function s(t,e){}return s.type="xstate.log",s.value=t,s.label=e,s.resolve=tK,s.execute=tX,s}function tZ(t,e){let s=x(e);if(!s.includes(t.type)){let e=1===s.length?`type "${s[0]}"`:`one of types "${s.join('", "')}"`;throw Error(`Expected event ${JSON.stringify(t)} to have ${e}`)}}
3function t0({schemas:t,actors:e,actions:s,guards:n,delays:i}){return{assign:tj,sendTo:tG,raise:tT,log:tY,cancel:C,stopChild:W,enqueueActions:tQ,emit:tJ,spawnChild:V,createStateConfig:t=>t,createAction:t=>t,createMachine:r=>new tU({...r,schemas:t},{actors:e,actions:s,guards:n,delays:i}),extend:r=>t0({schemas:t,actors:e,actions:{...s,...r.actions},guards:{...n,...r.guards},delays:{...i,...r.delays}})}}var t1,t6=s(3352),t2=s(48248),t3=s(49254),t8=s(77811),t5=s(37574),t4=s(95333),t9=s(38894),t7=s(3863),et=s(16753),ee=s(88829);let es=t=>({context:e})=>{let{count:s,include:n,exclude:i,responseType:r="message.received"}=t;return{count:s,domain:e.domain,from:e.connectTo,include:n?Array.isArray(n)?n:[n]:[],exclude:i?Array.isArray(i)?i:[i]:[],responseType:r,target:e.target,to:e.name}},en=t=>e=>{let{data:s}=e;return(!t.include.length||t.include.includes(s.type))&&(!t.exclude.length||!t.exclude.includes(s.type))&&s.domain===t.domain&&s.from===t.from&&s.to===t.to&&(!t.target||e.source===t.target)},ei=t=>e=>({type:t,message:e}),er=(0,t6.v)(()=>(0,t2.R)(window,"message")),eo=t=>tO(({input:e})=>er.pipe(t?(0,t3.T)(t):(0,t8.F)(),(0,t5.p)(en(e)),(0,t3.T)(ei(e.responseType)),e.count?(0,t8.F)((0,t4.S)(e.count),(0,t9.H)(t=>t),(0,t7.s)(e.count)):(0,t8.F)())),ea="comlink/response",ec="comlink/heartbeat",eu="comlink/disconnect",el="comlink/handshake/syn",eh="comlink/handshake/syn-ack",ed="comlink/handshake/ack",ep=t=>e=>e.pipe((0,t7.s)(1),(0,t3.T)(()=>{throw Error(t)})),ef=()=>t0({types:{},actors:{listen:tO(({input:t})=>{let e=t.signal?(0,t2.R)(t.signal,"abort").pipe(ep(`Request ${t.requestId} aborted`)):et.w;return(0,t2.R)(window,"message").pipe((0,t5.p)(e=>e.data?.type===ea&&e.data?.responseTo===t.requestId&&!!e.source&&t.sources.has(e.source)),(0,t7.s)(t.sources.size),(0,ee.Q)(e))})},actions:{"send message":({context:t},e)=>{let{sources:s,targetOrigin:n}=t,{message:i}=e;s.forEach(t=>{t.postMessage(i,{targetOrigin:n})})},"on success":tG(({context:t})=>t.parentRef,({context:t,self:e})=>(t.response&&t.resolvable?.resolve(t.response),{type:"request.success",requestId:e.id,response:t.response,responseTo:t.responseTo})),"on fail":tG(({context:t})=>t.parentRef,({context:t,self:e})=>(t.suppressWarnings||console.warn(`[@sanity/comlink] Received no response to message '${t.type}' on client '${t.from}' (ID: '${t.id}').`),t.resolvable?.reject(Error("No response received")),{type:"request.failed",requestId:e.id})),"on abort":tG(({context:t})=>t.parentRef,({context:t,self:e})=>(t.resolvable?.reject(Error("Request aborted")),{type:"request.aborted",requestId:e.id}))},guards:{expectsResponse:({context:t})=>t.expectResponse},delays:{initialTimeout:0,responseTimeout:({context:t})=>t.responseTimeout??3e3}}).createMachine({context:({input:t})=>({channelId:t.channelId,data:t.data,domain:t.domain,expectResponse:t.expectResponse??!1,from:t.from,id:`msg-${a()}`,parentRef:t.parentRef,resolvable:t.resolvable,response:null,responseTimeout:t.responseTimeout,responseTo:t.responseTo,signal:t.signal,sources:t.sources instanceof Set?t.sources:new Set([t.sources]),suppressWarnings:t.suppressWarnings,targetOrigin:t.targetOrigin,to:t.to,type:t.type}),initial:"idle",on:{abort:".aborted"},states:{idle:{after:{initialTimeout:[{target:"sending"}]}},sending:{entry:{type:"send message",params:({context:t})=>{let{channelId:e,data:s,domain:n,from:i,id:r,responseTo:o,to:a,type:c}=t;return{message:{channelId:e,data:s,domain:n,from:i,id:r,to:a,type:c,responseTo:o}}}},always:[{guard:"expectsResponse",target:"awaiting"},"success"]},awaiting:{invoke:{id:"listen for response",src:"listen",input:({context:t})=>({requestId:t.id,sources:t.sources,signal:t.signal}),onError:"aborted"},after:{responseTimeout:"failed"},on:{message:{actions:tj({response:({event:t})=>t.data.data,responseTo:({event:t})=>t.data.responseTo}),target:"success"}}},failed:{type:"final",entry:"on fail"},success:{type:"final",entry:"on success"},aborted:{type:"final",entry:"on abort"}},output:({context:t,self:e})=>({requestId:e.id,response:t.response,responseTo:t.responseTo})});t1=({sendBack:t,input:e})=>{let s=()=>{t(e.event)};e.immediate&&s();let n=setInterval(s,e.interval);return()=>{clearInterval(n)}};let ey=()=>t0({types:{},actors:{requestMachine:ef(),listen:eo()},actions:{"buffer handshake":tj({handshakeBuffer:({event:t,context:e})=>(tZ(t,"message.received"),[...e.handshakeBuffer,t])}),"buffer message":tQ(({enqueue:t})=>{t.assign({buffer:({event:t,context:e})=>(tZ(t,"post"),[...e.buffer,{data:t.data,resolvable:t.resolvable,options:t.options}])}),t.emit(({event:t})=>(tZ(t,"post"),{type:"buffer.added",message:t.data}))}),"create request":tj({requests:({context:t,event:e,self:s,spawn:n})=>{tZ(e,"request");let i=(Array.isArray(e.data)?e.data:[e.data]).map(e=>n("requestMachine",{id:`req-${a()}`,input:{channelId:t.channelId,data:e.data,domain:t.domain,expectResponse:e.expectResponse,from:t.name,parentRef:s,resolvable:e.resolvable,responseTimeout:e.options?.responseTimeout,responseTo:e.responseTo,signal:e.options?.signal,sources:t.target,suppressWarnings:e.options?.suppressWarnings,targetOrigin:t.targetOrigin,to:t.connectTo,type:e.type}}));return[...t.requests,...i]}}),"emit heartbeat":tJ(()=>({type:"heartbeat"})),"emit received message":tQ(({enqueue:t})=>{t.emit(({event:t})=>(tZ(t,"message.received"),{type:"message",message:t.message.data}))}),"emit status":tJ((t,e)=>({type:"status",status:e.status})),"post message":tT(({event:t})=>(tZ(t,"post"),{type:"request",data:{data:t.data.data,expectResponse:!!t.resolvable,type:t.data.type,resolvable:t.resolvable,options:t.options}})),"process pending handshakes":tQ(({context:t,enqueue:e})=>{t.handshakeBuffer.forEach(t=>e.raise(t)),e.assign({handshakeBuffer:[]})}),"remove request":tQ(({context:t,enqueue:e,event:s})=>{tZ(s,["request.success","request.failed","request.aborted"]),W(s.requestId),e.assign({requests:t.requests.filter(({id:t})=>t!==s.requestId)})}),"send response":tT(({event:t})=>(tZ(t,["message.received","heartbeat.received"]),{type:"request",data:{type:ea,responseTo:t.message.data.id,data:void 0}})),"send handshake syn ack":tT({type:"request",data:{type:eh}}),"send pending messages":tQ(({enqueue:t})=>{t.raise(({context:t})=>({type:"request",data:t.buffer.map(({data:t,resolvable:e,options:s})=>({data:t.data,type:t.type,expectResponse:!!e,resolvable:e,options:s}))})),t.emit(({context:t})=>({type:"buffer.flushed",messages:t.buffer.map(({data:t})=>t)})),t.assign({buffer:[]})}),"set connection config":tj({channelId:({event:t})=>(tZ(t,"handshake.syn"),t.message.data.channelId),target:({event:t})=>(tZ(t,"handshake.syn"),t.message.source||void 0),targetOrigin:({event:t})=>(tZ(t,"handshake.syn"),t.message.origin)})},guards:{hasSource:({context:t})=>null!==t.target}}).createMachine({id:"node",context:({input:t})=>({buffer:[],channelId:null,connectTo:t.connectTo,domain:t.domain??"sanity/comlink",handshakeBuffer:[],name:t.name,requests:[],target:void 0,targetOrigin:null}),invoke:{id:"listen for handshake syn",src:"listen",input:es({include:el,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"}}
3,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:es({include:ed,count:1,responseType:"handshake.complete"}),onDone:"connected"},{id:"listen for disconnect",src:"listen",input:es({include:eu,count:1,responseType:"disconnect"})},{id:"listen for messages",src:"listen",input:es({exclude:[eu,el,ed,ec,ea]})}],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:es({exclude:[eu,el,ed,ec,ea]})},{id:"listen for heartbeat",src:"listen",input:es({include:ec,responseType:"heartbeat.received"})},{id:"listen for disconnect",src:"listen",input:es({include:eu,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"]}}}}}),eg=(t,e=ey())=>{let s,n=M(e,{input:t}),i=new Map,r=new Map;n.on("message",({message:t})=>{let e=i.get(t.type);if(e){e.forEach(e=>e(t.data));return}let s=r.get(t.type);s?s.add(t):r.set(t.type,new Set([t]))});let o=()=>{n.stop()};return{actor:n,fetch:(t,e,s)=>{let{responseTimeout:i=1e4,signal:r,suppressWarnings:o}=s||{},a=function(){let t,e;return"function"==typeof Promise.withResolvers?Promise.withResolvers():{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}}();return n.send({type:"post",data:{type:t,data:e},resolvable:a,options:{responseTimeout:i,signal:r,suppressWarnings:o}}),a.promise},machine:e,on:(t,e,s)=>{let n=i.get(t)||new Set;i.has(t)||i.set(t,n),n.add(e);let o=r.get(t);if(o){let n=s?.replay??1;Array.from(o).slice(-n).forEach(({data:t})=>e(t)),r.delete(t)}return()=>{n.delete(e)}},onStatus:(t,e)=>{let i=n.on("status",n=>{s=n.status,e&&n.status!==e||t(n.status)});return s&&t(s),()=>i.unsubscribe()},post:(t,e)=>{n.send({type:"post",data:{type:t,data:e}})},start:()=>(n.start(),o),stop:o}};var em=s(40908),ev=s(81582),e_=s(62942),eb=s(7620),ex=s(39092),eS=s(59594);function ew(t){let{projectId:e,dataset:s,draftModeEnabled:n,draftModePerspective:i}=t,r=(0,e_.useRouter)();(0,eb.useEffect)(()=>{(0,eS.lc)(e,s)},[s,e]);let o=(0,ex.J)((t,e)=>{n&&t!==i&&(0,em.L)(t).then(()=>{e.aborted||r.refresh()}).catch(t=>console.error("Failed to set the preview perspective cookie",t))});return(0,eb.useEffect)(()=>{let t,e=eg({name:"loaders",connectTo:"presentation"},ey().provide({actors:(0,ev.jF)()}));e.on("loader/perspective",e=>{t?.abort(),t=new AbortController,o(e.perspective,t.signal)});let s=e.start();return(0,eS.El)(e),()=>{s()}},[]),null}ew.displayName="PresentationComlink"}}]);

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.