PageSourceSearch

https://cdn.apryse.com/4e43dd1/_next/static/chunks/04q5epzbgl564.js

js apryse.com collected 2026-10-02 05:19:22 UTC 97,495 bytes, 3 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,462576,e=>{"use strict";var t=e.i(271645);let n=t.default.createContext(!0);function r(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}let s="use"in t.default?()=>{try{return t.default.use(n)}catch{return!1}}:()=>!1;e.s(["useEffectEvent",0,function(e){let n=t.default.useRef(r);return t.default.useInsertionEffect(()=>{n.current=e},[e]),(...e)=>(s()&&r(),(0,n.current)(...e))}])},932549,e=>{"use strict";let t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/_key\s*==\s*['"](.*)['"]/,r=/^\d*:\d*$/;function s(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}function i(e){return"string"==typeof e?n.test(e.trim()):"object"==typeof e&&"_key"in e}function o(e){if("string"==typeof e&&r.test(e))return!0;if(!Array.isArray(e)||2!==e.length)return!1;let[t,n]=e;return("number"==typeof t||""===t)&&("number"==typeof n||""===n)}function a(e){if(!Array.isArray(e))throw Error("Path is not an array");return e.reduce((e,t,n)=>{let r=typeof t;if("number"===r)return`${e}[${t}]`;if("string"===r)return`${e}${0===n?"":"."}${t}`;if(i(t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){let[n,r]=t;return`${e}[${n}:${r}]`}throw Error(`Unsupported path segment \`${JSON.stringify(t)}\``)},"")}function u(e){if("string"!=typeof e)throw Error("Path is not a string");let n=e.match(t);if(!n)throw Error("Invalid path string");return n.map(l)}function l(e){return s(e)?Number(e.replace(/[^\d]/g,"")):i(e)?{_key:e.match(n)[1]}:o(e)?function(e){let[t,n]=e.split(":").map(e=>""===e?e:Number(e));return[t,n]}(e):e}var c=Object.freeze({__proto__:null,fromString:u,get:function(e,t,n){let r="string"==typeof t?u(t):t;if(!Array.isArray(r))throw Error("Path must be an array or a string");let o=e;for(let e=0;e<r.length;e++){let t=r[e];if(s(t)){if(!Array.isArray(o))return n;o=o[t]}if(i(t)){if(!Array.isArray(o))return n;o=o.find(e=>e._key===t._key)}if("string"==typeof t&&(o="object"==typeof o&&null!==o?o[t]:void 0),typeof o>"u")return n}return o},isIndexSegment:s,isIndexTuple:o,isKeySegment:i,reKeySegment:n,toString:a});let d="drafts.";function p(e){return e.startsWith(d)}function f(e){return e.startsWith("versions.")}function h(e){return f(e)?e.split(".").slice(2).join("."):p(e)?e.slice(d.length):e}e.s(["createEditUrl",0,function(e){let{baseUrl:t,workspace:n="default",tool:r="default",id:s,type:i,path:o,projectId:u,dataset:l}=e;if(!t)throw Error("baseUrl is required");if(!o)throw Error("path is required");if(!s)throw Error("id is required");if("/"!==t&&t.endsWith("/"))throw Error("baseUrl must not end with a slash");let c="default"===n?void 0:n,d="default"===r?void 0:r,y=h(s),m=Array.isArray(o)?a(o.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)})):o,g=new URLSearchParams({baseUrl:t,id:y,type:i,path:m});if(c&&g.set("workspace",c),d&&g.set("tool",d),u&&g.set("projectId",u),l&&g.set("dataset",l),p(s)||f(s)){if(f(s)){let e=function(e){if(!f(e))return;let[t,n,...r]=e.split(".");return n}(s);g.set("perspective",e)}}else g.set("perspective","published");let v=["/"===t?"":t];c&&v.push(c);let b=["mode=presentation",`id=${y}`,`type=${i}`,`path=${encodeURIComponent(m)}`];return d&&b.push(`tool=${d}`),v.push("intent","edit",`${b.join(";")}?${g}`),v.join("/")},"getDraftId",0,function(e){return f(e)?d+h(e):p(e)?e:d+e},"getPublishedId",0,h,"studioPath",0,c],932549)},807574,373534,e=>{"use strict";var t,n,r;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 i="xstate.init",o="xstate.stop";function a(e,t){return{type:`xstate.done.state.${e}`,output:t}}function u(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function l(e){return{type:i,input:e}}function c(e){setTimeout(()=>{throw e})}let d="function"==typeof Symbol&&Symbol.observable||"@@observable";function p(e){if(m(e))return e;let t=[],n="";for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n="";continue}n+=e[r]}return t.push(n),t}function f(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={},n=t;for(let t=0;t<e.length-1;t++)if(t===e.length-2)n[e[t]]=e[t+1];else{let r=n;n={},r[e[t]]=n}return t}(p(e))}function h(e){var t;return void 0===e?[]:m(t=e)?t:[t]}function y(e,t,n,r){return"function"==typeof e?e({context:t,event:n,self:r}):e}function m(e){return Array.isArray(e)}function g(e){var t;return(m(t=e)?t:[t]).map(e=>void 0===e||"string"==typeof e?{target:e}:e)}function v(e){if(void 0!==e&&""!==e)return h(e)}function b(e,t,n){let r="object"==typeof e,s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}function w(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,r,s]=n,i=e.getStateNodeById(s).config.invoke;return(Array.isArray(i)?i[r]:i).src}function x(e,t){return`${e.sessionId}.${t}`}let _=0,E=!1,k=((t={})[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped",t),S={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class I{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=[];const n={...S,...t},{clock:r,logger:i,parent:o,syncSnapshot:a,id:u,systemId:l,inspect:d}=n;this.system=o?o.system:function(e,t){let n=new Map,r=new Map,s=new WeakMap,i=new Set,o={},{clock:a,logger:u}=t,l={schedule:(e,t,n,r,s=Math.random().toString(36).slice(2))=>{let i={source:e,target:t,event:n,delay:r,id:s,startedAt:Date.now()},u=x(e,s);c._snapshot._scheduledEvents[u]=i;let l=a.setTimeout(()=>{delete o[u],delete c._snapshot._scheduledEvents[u],c._relay(e,t,n)},r);o[u]=l},cancel:(e,t)=>
1{let n=x(e,t),r=o[n];delete o[n],delete c._snapshot._scheduledEvents[n],void 0!==r&&a.clearTimeout(r)},cancelAll:e=>{for(let t in c._snapshot._scheduledEvents){let n=c._snapshot._scheduledEvents[t];n.source===e&&l.cancel(e,n.id)}}},c={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${_++}`,_register:(e,t)=>(n.set(e,t),e),_unregister:e=>{n.delete(e.sessionId);let t=s.get(e);void 0!==t&&(r.delete(t),s.delete(e))},get:e=>r.get(e),getAll:()=>Object.fromEntries(r.entries()),_set:(e,t)=>{let n=r.get(e);if(n&&n!==t)throw Error(`Actor with system ID '${e}' already exists.`);r.set(e,t),s.set(t,e)},inspect:e=>{let t=b(e);return i.add(t),{unsubscribe(){i.delete(t)}}},_sendInspectionEvent:t=>{if(!i.size)return;let n={...t,rootId:e.sessionId};i.forEach(e=>e.next?.(n))},_relay:(e,t,n)=>{c._sendInspectionEvent({type:"@xstate.event",sourceRef:e,actorRef:t,event:n}),t._send(n)},scheduler:l,getSnapshot:()=>({_scheduledEvents:{...c._snapshot._scheduledEvents}}),start:()=>{let e=c._snapshot._scheduledEvents;for(let t in c._snapshot._scheduledEvents={},e){let{source:n,target:r,event:s,delay:i,id:o}=e[t];l.schedule(n,r,s,i,o)}},_clock:a,_logger:u};return c}(this,{clock:r,logger:i}),d&&!o&&this.system.inspect(b(d)),this.sessionId=this.system._bookId(),this.id=u??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=o,this._syncSnapshot=a,this.options=n,this.src=n.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=>{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),n=this.eventListeners.get("*");if(t||n)for(let r of[...t?t.values():[],...n?n.values():[]])try{r(e)}catch(e){c(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=E;try{E=!0,e.exec(e.info,e.params)}finally{E=t}};this._processingStatus===k.Running?t():this._deferred.push(t)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),l&&(this.systemId=l,this.system._set(l,this)),this._initState(t?.snapshot??t?.state),l&&"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 n;for(this._snapshot=e;n=this._deferred.shift();)try{n()}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){c(e)}break;case"done":var r;for(let t of this.observers)try{t.next?.(e)}catch(e){c(e)}this._stopProcedure(),this._complete(),this._doneEvent=(r=this.id,{type:`xstate.done.actor.${r}`,output:this._snapshot.output,actorId:r}),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,n){let r=b(e,t,n);if(this._processingStatus!==k.Stopped)this.observers.add(r);else switch(this._snapshot.status){case"done":try{r.complete?.()}catch(e){c(e)}break;case"error":{let e=this._snapshot.error;if(r.error)try{r.error(e)}catch(e){c(e)}else c(e)}}return{unsubscribe:()=>{this.observers.delete(r)}}}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n));let r=t.bind(void 0);return n.add(r),{unsubscribe:()=>{n.delete(r)}}}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=l(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,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(e){n={err:e}}if(n){let{err:e}=n;this._snapshot={...this._snapshot,status:"error",error:e},this._error(e);return}this.update(t,e),e.type===o&&(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:o})),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){c(e)}this.observers.clear()}_reportError(e){if(!this.observers.size){this._parent||c(e);return}let t=!1;for(let n of this.observers){let r=n.error;t||=!r;try{r?.(e)}catch(e){c(e)}}this.observers.clear(),t&&c(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,u(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:t}=this.options;t&&("function"==typeof t?t:t=>{if("u"<typeof window)return;let n=function(){let t="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g;if(t.__xstate__)return t.__xstate__}();n&&n.register(t)})(this)}toJSON(){return{xstate$$type:1,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[d](){return this}getSnapshot(){return this._snapshot}}function $(e,...[t]){return new I(e,t)}function A(e,t,n,r,{sendId:s}){return[t,{sendId:"function"==typeof s?s(n,r):s},void 0]}function T(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function O(e){function t(e,t){}return t.type="xstate.cancel",t.sendId=e,t.resolve=A,t.execute=T,t}function M(e,t,n,r,{id:s,systemId:i,src:o,input:a,syncSnapshot:u}){let l,c,d="string"==typeof o?w(t.machine,o):o,p="function"==typeof s?s(n):s;return d&&(c="function"==typeof a?a({context:t.context,event:n.event,self:e.self}):a,l=$(d,{id:p,src:o,parent:e.self,syncSnapshot:u,systemId:i,input:c})),[eg(t,{children:{...t.children,[p]:l}}),{id:s,systemId:i,actorRef:l,src:o,input:c},void 0]}function N(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==k.Stopped&&t.start()})}function j(...[e,{id:t,systemId:n,input:r,syncSnapshot:s=!1}={}]){function i(e,t){}return i.type="xstate.spawnChild",i.id=t,i.systemId=n,i.src=e,i.input=r,i.syncSnapshot=s,i.resolve=M,i.execute=N,i}function R(e,t,n,r,{actorRef:s}){let i="function"==typeof s?s(n,r):s,o="string"==typeof i?t.children[i]:i,a=t.children;return o&&(a={...a},delete a[o.id]),[eg(t,{children:a}),o,void 0]}function P(e,t){if(t){if(e.system._unregister(t),t._processingStatus!==k.Running)return void e.stopChild(t);e.defer(()=>{e.stopChild(t)})}}function L(e){function t(e,t){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=R,t.execute=P,t}function C(e,t,n,r){let{machine:s}=r,i="function"==typeof e,o=i?e:s.implementations.guards["string"==typeof e?e:e.type];if(!i&&!o)throw Error(`Guard '${"string"==typeof e?e:e.type}' is not implemented.'.`);if("function"!=typeof o)return C(o,t,n,r);let a={context:t,event:n},u=i||"string"==typeof e?void 0:"params"in e?"function"==typeof e.params?e.params({context:t,event:n}):e.params:void 0;return"check"in o?o.check(r,a,o):o(a,u)}let q=e=>"atomic"===e.type||"final"===e.type;function D(e){return Object.values(e.states).filter(e=>"history"!==e.type)}function U(e,t){let n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function W(e){let t=new Set(e),n=V(t);for(let e of t)if("compound"!==e.type||n.get(e)&&n.get(e).length){if("parallel"===e.type){for(let n of D(e))if("history"!==n.type&&!t.has(n))for(let e of F(n))t.add(e)}}
1else F(e).forEach(e=>t.add(e));for(let e of t){let n=e.parent;for(;n;)t.add(n),n=n.parent}return t}function V(e){let t=new Map;for(let n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function G(e,t){return function e(t,n){let r=n.get(t);if(!r)return{};if("compound"===t.type){let e=r[0];if(!e)return{};if(q(e))return e.key}let s={};for(let t of r)s[t.key]=e(t,n);return s}(e,V(W(t)))}function z(e,t){return"compound"===t.type?D(t).some(t=>"final"===t.type&&e.has(t)):"parallel"===t.type?D(t).every(t=>z(e,t)):"final"===t.type}let B=e=>"#"===e[0];function J(e,t,n){let r=v(n.target),s=n.reenter??!1,i=function(e,t){if(void 0!==t)return t.map(t=>{if("string"!=typeof t)return t;if(B(t))return e.machine.getStateNodeById(t);let n="."===t[0];if(n&&!e.parent)return Q(e,t.slice(1));let r=n?e.key+t:t;if(e.parent)try{return Q(e.parent,r)}catch(t){throw Error(`Invalid transition definition for state node '${e.id}':
2${t.message}`)}throw Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}(e,r),o={...n,actions:h(n.actions),guard:n.guard,target:i,source:e,reenter
2:s,eventType:t,toJSON:()=>({...o,source:`#${e.id}`,target:i?i.map(e=>`#${e.id}`):void 0})};return o}function H(e){let t=v(e.config.target);return t?{target:t.map(t=>"string"==typeof t?Q(e.parent,t):t)}:e.parent.initial}function Y(e){return"history"===e.type}function F(e){let t=K(e);for(let n of t)for(let r of U(n,e))t.add(r);return t}function K(e){let t=new Set;return!function e(n){if(!t.has(n)){if(t.add(n),"compound"===n.type)e(n.initial.target[0]);else if("parallel"===n.type)for(let t of D(n))e(t)}}(e),t}function X(e,t){if(B(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 n=e.states[t];if(!n)throw Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function Q(e,t){if("string"==typeof t&&B(t))try{return e.machine.getStateNodeById(t)}catch{}let n=p(t).slice(),r=e;for(;n.length;){let e=n.shift();if(!e.length)break;r=X(r,e)}return r}function Z(e,t){if("string"==typeof t){let n=e.states[t];if(!n)throw Error(`State '${t}' does not exist on '${e.id}'`);return[e,n]}let n=Object.keys(t),r=n.map(t=>X(e,t)).filter(Boolean);return[e.machine.root,e].concat(r,n.reduce((n,r)=>{let s=X(e,r);if(!s)return n;let i=Z(s,t[r]);return n.concat(i)},[]))}function ee(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function et(e,t,n){let r=new Set;for(let s of e){let e=!1,i=new Set;for(let o of r)if(function(e,t){let n=new Set(e),r=new Set(t);for(let e of n)if(r.has(e))return!0;for(let e of r)if(n.has(e))return!0;return!1}(es([s],t,n),es([o],t,n)))if(ee(s.source,o.source))i.add(o);else{e=!0;break}if(!e){for(let e of i)r.delete(e);r.add(s)}}return Array.from(r)}function en(e,t){if(!e.target)return[];let n=new Set;for(let r of e.target)if(Y(r))if(t[r.id])for(let e of t[r.id])n.add(e);else for(let e of en(H(r),t))n.add(e);else n.add(r);return[...n]}function er(e,t){let n=en(e,t);if(!n)return;if(!e.reenter&&n.every(t=>t===e.source||ee(t,e.source)))return e.source;let r=function(e){let[t,...n]=e;for(let e of U(t,void 0))if(n.every(t=>ee(t,e)))return e}(n.concat(e.source));return r||(e.reenter?void 0:e.source.machine.root)}
2function es(e,t,n){let r=new Set;for(let s of e)if(s.target?.length){let e=er(s,n);for(let n of(s.reenter&&s.source===e&&r.add(e),t))ee(n,e)&&r.add(n)}return[...r]}function ei(e,t,n,r,s,i){if(!e.length)return t;let o=new Set(t._nodes),u=t.historyValue,l=et(e,o,u),c=t;s||([c,u]=function(e,t,n,r,s,i,o,a){let u,l=e,c=es(r,s,i);for(let e of(c.sort((e,t)=>t.order-e.order),c))for(let t of function(e){return Object.keys(e.states).map(t=>e.states[t]).filter(e=>"history"===e.type)}(e)){let n;n="deep"===t.history?t=>q(t)&&ee(t,e):t=>t.parent===e,(u??={...i})[t.id]=Array.from(s).filter(n)}for(let e of c)l=eu(l,t,n,[...e.exit,...e.invoke.map(e=>L(e.id))],o,void 0),s.delete(e);return[l,u||i]}(c,r,n,l,o,u,i,n.actionExecutor)),c=function(e,t,n,r,s,i,o,u){let l=e,c=new Set,d=new Set;(function(e,t,n,r){for(let s of e){let e=er(s,t);for(let i of s.target||[])!Y(i)&&(s.source!==i||s.source!==e||s.reenter)&&(r.add(i),n.add(i)),eo(i,t,n,r);for(let i of en(s,t)){let o=U(i,e);e?.type==="parallel"&&o.push(e),ea(r,t,n,o,!s.source.parent&&s.reenter?void 0:e)}}})(r,o,d,c),u&&d.add(e.machine.root);let p=new Set;for(let e of[...c].sort((e,t)=>e.order-t.order)){s.add(e);let r=[];for(let t of(r.push(...e.entry),e.invoke))r.push(j(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(d.has(e)){let t=e.initial.actions;r.push(...t)}if(l=eu(l,t,n,r,i,e.invoke.map(e=>e.id)),"final"===e.type){let r=e.parent,o=r?.type==="parallel"?r:r?.parent,u=o||e;for(r?.type==="compound"&&i.push(a(r.id,void 0!==e.output?y(e.output,l.context,t,n.self):void 0));o?.type==="parallel"&&!p.has(o)&&z(s,o);)p.add(o),i.push(a(o.id)),u=o,o=o.parent;if(o)continue;l=eg(l,{status:"done",output:function(e,t,n,r,s){if(void 0===r.output)return;let i=a(s.id,void 0!==s.output&&s.parent?y(s.output,e.context,t,n.self):void 0);return y(r.output,e.context,i,n.self)}(l,t,n,l.machine.root,u)})}}return l}(c=eu(c,r,n,l.flatMap(e=>e.actions),i,void 0),r,n,l,o,i,u,s);let d=[...o];"done"===c.status&&(c=eu(c,r,n,d.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),i,void 0));try{if(u===t.historyValue&&function(e,t){if(e.length!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}(t._nodes,o))return c;return eg(c,{_nodes:d,historyValue:u})}catch(e){throw e}}function eo(e,t,n,r){var s,i,o,a;if(Y(e))if(t[e.id]){let o=t[e.id];for(let e of o)r.add(e),eo(e,t,n,r);for(let a of o){s=a,i=e.parent,ea(r,t,n,U(s,i))}}else{let s=H(e);for(let i of s.target)r.add(i),s===e.parent?.initial&&n.add(e.parent),eo(i,t,n,r);for(let i of s.target){o=i,a=e.parent,ea(r,t,n,U(o,a))}}else if("compound"===e.type){let[s]=e.initial.target;Y(s)||(r.add(s),n.add(s)),eo(s,t,n,r),ea(r,t,n,U(s,e))}else if("parallel"===e.type)for(let s of D(e).filter(e=>!Y(e)))[...r].some(e=>ee(e,s))||(Y(s)||(r.add(s),n.add(s)),eo(s,t,n,r))}function ea(e,t,n,r,s){for(let i of r)if((!s||ee(i,s))&&e.add(i),"parallel"===i.type)for(let r of D(i).filter(e=>!Y(e)))[...e].some(e=>ee(e,r))||(e.add(r),eo(r,t,n,e))}function eu(e,t,n,r,s,i){let o=i?[]:void 0,a=function e(t,n,r,s,i,o){let{machine:a}=t,u=t;for(let t of s){var l;let s="function"==typeof t,c=s?t:(l="string"==typeof t?t:t.type,a.implementations.actions[l]),d={context:u.context,event:n,self:r.self,system:r.system},p=s||"string"==typeof t?void 0:"params"in t?"function"==typeof t.params?t.params({context:u.context,event:n}):t.params:void 0;if(!c||!("resolve"in c)){r.actionExecutor({type:"string"==typeof t?t:"object"==typeof t?t.type:t.name||"(anonymous)",info:d,params:p,exec:c}
2);continue}let[f,h,y]=c.resolve(r,u,d,p,c,i);u=f,"retryResolve"in c&&o?.push([c,h]),"execute"in c&&r.actionExecutor({type:c.type,info:d,params:h,exec:c.execute.bind(null,r,h)}),y&&(u=e(u,n,r,y,i,o))}return u}(e,t,n,r,{internalQueue:s,deferredActorIds:i},o);return o?.forEach(([e,t])=>{e.retryResolve(n,a,t)}),a}function el(e,t,n){return eu(e,t,n,Object.values(e.children).map(e=>L(e)),[],void 0)}function ec(e,t){return t.machine.getTransitionData(t,e)}let ed=function(e){return function e(t,n){let r=f(t),s=f(n);return"string"==typeof s?"string"==typeof r&&s===r:"string"==typeof r?r in s:Object.keys(r).every(t=>t in s&&e(r[t],s[t]))}(e,this.value)},ep=function(e){return this.tags.has(e)},ef=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>void 0!==e.target||e.actions.length)},eh=function(){let{_nodes:e,tags:t,machine:n,getMeta:r,toJSON:s,can:i,hasTag:o,matches:a,...u}=this;return{...u,tags:Array.from(t)}},ey=function(){return this._nodes.reduce((e,t)=>(void 0!==t.meta&&(e[t.id]=t.meta),e),{})};function em(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:G(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:ed,hasTag:ep,can:ef,getMeta:ey,toJSON:eh}}function eg(e,t={}){return em({...e,...t},e.machine)}function ev(e,t,n,r,{event:s,id:i,delay:o},{internalQueue:a}){let u,l=t.machine.implementations.delays;if("string"==typeof s)throw Error(`Only event objects may be used with raise; use raise({ type: "${s}" }) instead`);let c="function"==typeof s?s(n,r):s;if("string"==typeof o){let e=l&&l[o];u="function"==typeof e?e(n,r):e}else u="function"==typeof o?o(n,r):o;return"number"!=typeof u&&a.push(c),[t,{event:c,id:i,delay:u},void 0]}function eb(e,t){let{event:n,delay:r,id:s}=t;if("number"==typeof r)return void e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,n,r,s)})}function ew(e,t){function n(e,t){}return n.type="xstate.raise",n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=ev,n.execute=eb,n}e.s(["$",0,1,"B",0,function(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(e=>{if("*"===e)return!0;if(!e.endsWith(".*"))return!1;let n=e.split("."),r=t.split(".");for(let e=0;e<n.length;e++){let t=n[e],s=r[e];if("*"===t)return e===n.length-1;if(t!==s)return!1}return!0}).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))},"C",0,function(e,t){let n=W(Z(e,t));return G(e,[...n])},"D",0,W,"E",0,em,"F",0,z,"G",0,function(e,t,n,r){let s=e,a=[];function u(e,t,r){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:t,snapshot:e,_transitions:r}),a.push(e)}if(t.type===o)return u(s=eg(el(s,t,n),{status:"stopped"}),t,[]),{snapshot:s,microstates:a};let l=t;if(l.type!==i){let t=l,i=t.type.startsWith("xstate.error.actor"),o=ec(t,s);if(i&&!o.length)return u(s=eg(e,{status:"error",error:t.error}),t,[]),{snapshot:s,microstates:a};u(s=ei(o,e,n,l,!1,r),t,o)}let c=!0;for(;"active"===s.status;){let e=c?function(e,t){let n=new Set;for(let r of e._nodes.filter(q))e:for(let s of[r].concat(U(r,void 0)))if(s.always){for(let r of s.always)if(void 0===r.guard||C(r.guard,e.context,t,e)){n.add(r);break e}}return et(Array.from(n),new Set(e._nodes),e.historyValue)}(s,l):[],t=e.length?s:void 0;if(!e.length){if(!r.length)break;e=ec(l=r.shift(),s)}c=(s=ei(e,s,n,l,!1,r))!==t,u(s,l,e)}return"active"!==s.status&&el(s,l,n),{snapshot:s,microstates:a}},"H",0,function e(t,n,r,s){if("string"==typeof n){let e;return(e=X(t,n).next(r,s))&&e.length?e:t.next(r,s)}if(1===Object.keys(n).length){let i,o;return(o=e(X(t,(i=Object.keys(n))[0]),n[i[0]],r,s))&&o.length?o:t.next(r,s)}let i=[];for(let o of Object.keys(n)){let a=n[o];if(!a)continue;let u=e(X(t,o),a,r,s);u&&i.push(...u)}return i.length?i:t.next(r,s)},"I",0,eu,"J",0,l,"K",0,ei,"L",0,K,"M",0,p,"N",0,"","O",0,B,"P",0,Q,"Q",0,function(e,t){let{_nodes:n,tags:r,machine:s,children:i,context:o,can:a,hasTag:u,matches:l,getMeta:c,toJSON:d,...p}=e,f={};for(let e in i){let n=i[e];f[e]={snapshot:n.getPersistedSnapshot(t),src:n.src,systemId:n.systemId,syncSnapshot:n._syncSnapshot}}return{...p,context:function e(t){let n;for(let r in t){let s=t[r];
2if(s&&"object"==typeof s)if("sessionId"in s&&"send"in s&&"ref"in s)(n??=Array.isArray(t)?t.slice():{...t})[r]={xstate$$type:1,id:s.id};else{let i=e(s);i!==s&&((n??=Array.isArray(t)?t.slice():{...t})[r]=i)}}return n??t}(o),children:f,historyValue:function(e){if("object"!=typeof e||null===e)return{};let t={};for(let n in e){let r=e[n];Array.isArray(r)&&(t[n]=r.map(e=>({id:e.id})))}return t}(p.historyValue)}},"R",0,w,"S",0,".","T",0,"xstate.error","U",0,u,"V",0,k,"W",0,eg,"X",0,o,"a",0,O,"b",0,j,"c",0,$,"g",0,Z,"l",0,function(e,t){let n={},r=Object.keys(e);for(let s=0;s<r.length;s++){let i=r[s];n[i]=t(e[i],i,e,s)}return n},"q",0,function(e){let t=new Map;if(e.config.on)for(let n of Object.keys(e.config.on)){if(""===n)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let r=e.config.on[n];t.set(n,g(r).map(t=>J(e,n,t)))}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,g(e.config.onDone).map(t=>J(e,n,t)))}for(let n of e.invoke){if(n.onDone){let r=`xstate.done.actor.${n.id}`;t.set(r,g(n.onDone).map(t=>J(e,r,t)))}if(n.onError){let r=`xstate.error.actor.${n.id}`;t.set(r,g(n.onError).map(t=>J(e,r,t)))}if(n.onSnapshot){let r=`xstate.snapshot.${n.id}`;t.set(r,g(n.onSnapshot).map(t=>J(e,r,t)))}}for(let n of e.after){let e=t.get(n.eventType);e||(e=[],t.set(n.eventType,e)),e.push(n)}return t},"r",0,ew,"s",0,L,"t",0,h,"u",0,g,"v",0,J,"w",0,C,"x",0,function(e,t){return`${t}.${e}`},"y",0,function(e){let t=e.config.after;return t?Object.keys(t).flatMap(n=>{var r;let s,i,o=t[n],a=Number.isNaN(+n)?n:+n,u=(r=e.id,i=(s={type:`xstate.after.${a}.${r}`}).type,e.entry.push(ew(s,{id:i,delay:a})),e.exit.push(O(i)),i);return h("string"==typeof o?{target:o}:o).map(e=>({...e,event:u,delay:a}))}).map(t=>{let{delay:n}=t;return{...J(e,t.event,t),delay:n}}):[]},"z",0,function(e,t){let n="string"==typeof t?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let r={source:e,actions:t&&"string"!=typeof t?h(t.actions):[],eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}],373534);let ex=new WeakMap,e_="xstate.observable.error",eE="xstate.observable.complete",ek="xstate.promise.resolve",eS="xstate.promise.reject",eI=new WeakMap,e$=(r=void 0,{config:n=e=>void 0,transition:(e,t,r)=>({...e,context:n(e.context,t,r)}),getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,context:"function"==typeof r?r({input:t}):r}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e});e.s(["createEmptyActor",0,function(){return $(e$)},"fromCallback",0,function(e){return{config:e,start:(t,n)=>{let{self:r,system:s,emit:i}=n,o={receivers:void 0,dispose:void 0};ex.set(r,o),o.dispose=e({input:t.input,system:s,self:r,sendBack:e=>{"stopped"!==r.getSnapshot().status&&r._parent&&s._relay(r,r._parent,e)},receive:e=>{o.receivers??=new Set,o.receivers.add(e)},emit:i})},transition:(e,t,n)=>{let r=ex.get(n.self);return t.type===o?(e={...e,status:"stopped",error:void 0},r.dispose?.()):r.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}},"fromEventObservable",0,function(e){return{config:e,transition:(e,t)=>{if("active"!==e.status)return e;switch(t.type){case e_:return{...e,status:"error",error:t.data,input:void 0,_subscription:void 0};case eE:return{...e,status:"done",input:void 0,_subscription:void 0};case o: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:n,system:r,emit:s})=>{"done"!==t.status&&(t._subscription=e({input:t.input,system:r,self:n,emit:s}).subscribe({next:e=>{n._parent&&r._relay(n,n._parent,e)},error:e=>{r._relay(n,n,{type:e_,data:e})},complete:()=>{r._relay(n,n,{type:eE})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}},"fromPromise",0,function(e){return{config:e,transition:(e,t,n)=>{if("active"!==e.status)return e;switch(t.type){case ek:{let n=t.data;return{...e,status:"done",output:n,input:void 0}}case eS:return{...e,status:"error",error:t.data,input:void 0};case o:return eI.get(n.self)?.abort(),{...e,status:"stopped",input:void 0};default:return e}},start:(t,{self:n,system:r,emit:s})=>{if("active"!==t.status)return;let i=new AbortController;eI.set(n,i),Promise.resolve(e({input:t.input,system:r,self:n,signal:i.signal,emit:s})).then(e=>
2{"active"===n.getSnapshot().status&&(eI.delete(n),r._relay(n,n,{type:ek,data:e}))},e=>{"active"===n.getSnapshot().status&&(eI.delete(n),r._relay(n,n,{type:eS,data:e}))})},getInitialSnapshot:(e,t)=>({status:"active",output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}],807574)},389740,e=>{"use strict";let t=(0,e.i(807574).createEmptyActor)(),n=t,r=new Set;e.s(["actor",()=>n,"emptyActor",0,t,"isEmptyActor",0,function(e){return e===t},"listeners",0,r,"setActor",0,function(e){for(let t of(n=e,r))t()}])},566283,e=>{"use strict";function t(e){return e.split(/[[.\]]/g).filter(Boolean).map(e=>{var t;return e.includes("==")?function(e){let[t,n]=e.split("==");if("_key"!==t)throw Error(`Currently only "_key" is supported as path segment. Found ${t}`);if(typeof n>"u")throw Error('Invalid path segment, expected `key=="value"`');return{_key:n.replace(/^['"]/,"").replace(/['"]$/,"")}}(e):n.test(t=e)?Number(t):t})}let n=/^-?\d+$/,r=/^[a-z_$]+/;function s(e){return e.map((e,t)=>{var n;return n=0===t,Array.isArray(e)?`[${e[0]}:${e[1]||""}]`:"number"==typeof e?`[${e}]`:"object"==typeof e&&"_key"in e&&"string"==typeof e._key?`[_key==${JSON.stringify(e._key)}]`:"string"==typeof e&&r.test(e)?n?e:`.${e}`:`['${e}']`}).join("")}function i(e){if("createIfNotExists"in e)return{type:"createIfNotExists",document:e.createIfNotExists};if("createOrReplace"in e)return{type:"createOrReplace",document:e.createOrReplace};if("create"in e)return{type:"create",document:e.create};if("delete"in e)return{id:e.delete.id,type:"delete"};if("patch"in e){var n,r,s,i,a,u;return{type:"patch",id:e.patch.id,patches:[..."set"in(r=n=e.patch)?Object.keys(r.set).map(e=>({path:t(e),op:{type:"set",value:r.set[e]}})):[],..."setIfMissing"in(s=n)?Object.keys(s.setIfMissing).map(e=>({path:t(e),op:{type:"setIfMissing",value:s.setIfMissing[e]}})):[],..."unset"in(i=n)?i.unset.map(e=>({path:t(e),op:{type:"unset"}})):[],..."inc"in(a=n)?Object.keys(a.inc).map(e=>({path:t(e),op:{type:"inc",amount:a.inc[e]}})):[],..."inc"in(u=n)?Object.keys(u.dec).map(e=>({path:t(e),op:{type:"dec",amount:u.dec[e]}})):[],...function(e){if(!("insert"in e))return[];let n=function(e){let t=o.filter(t=>t in e);if(t.length>1)throw Error(`Insert patch is ambiguous. Should only contain one of: ${o.join(", ")}, instead found ${t.join(", ")}`);return t[0]}(e.insert);if(!n)throw Error("Insert patch missing position");let r=t(e.insert[n]),s=r.pop();return[{path:r,op:{type:"insert",position:n,referenceItem:s,items:e.insert.items}}]}(n)]}}throw Error(`Unknown mutation: ${JSON.stringify(e)}`)}let o=["before","replace","after"];function a(e){return l(e)}function u(e){return e.flatMap(a)}function l(e){if("create"===e.type||"createIfNotExists"===e.type||"createOrReplace"===e.type)return{[e.type]:e.document};if("delete"===e.type)return{delete:{id:e.id}};let t=e.options?.ifRevision;return e.patches.map(n=>({patch:{id:e.id,...t&&{ifRevisionID:t},...function(e){let{path:t,op:n}=e;if("unset"===n.type)return{unset:[s(t)]};if("insert"===n.type)return{insert:{[n.position]:s([...t,n.referenceItem]),items:n.items}};if("diffMatchPatch"===n.type)return{diffMatchPatch:{[s(t)]:n.value}};if("inc"===n.type)return{inc:{[s(t)]:n.amount}};if("dec"===n.type)return{dec:{[s(t)]:n.amount}};if("set"===n.type||"setIfMissing"===n.type)return{[n.type]:{[s(t)]:n.value}};if("truncate"===n.type){let e=[n.startIndex,"number"==typeof n.endIndex?n.endIndex:""].join(":");return{unset:[`${s(t)}[${e}]`]}}if("upsert"===n.type)return{unset:n.items.map(e=>s([...t,{_key:e._key}])),insert:{[n.position]:s([...t,n.referenceItem]),items:n.items}};if("assign"===n.type)return{set:Object.fromEntries(Object.keys(n.value).map(e=>[s(t.concat(e)),n.value[e]]))};if("unassign"===n.type)return{unset:n.keys.map(e=>s(t.concat(e)))};if("replace"===n.type)return{insert:{replace:s(t.concat(n.referenceItem)),items:n.items}};if("remove"===n.type)return{unset:[s(t.concat(n.referenceItem))]};throw Error(`Unknown operation type ${n.type}`)}(n)}}))}function c(e){return Array.isArray(e)?e:[e]}var d=Object.freeze({__proto__:null,decode:function(e){return i(e)},decodeAll:function(e){return e.map(i)},encode:a,encodeAll:u,encodeMutation:l,encodeTransaction:function(e){return{transactionId:e.id,mutations:u(e.mutations)}}});
2e.s(["SanityEncoder",0,d,"at",0,function(e,n){return{path:"string"==typeof e?t(e):e,op:n}},"createIfNotExists",0,function(e){return{type:"createIfNotExists",document:e}},"insert",0,function(e,t,n){return{type:"insert",referenceItem:n,position:t,items:c(e)}},"patch",0,function(e,t,n){return{type:"patch",id:e,patches:c(t),...n?{options:n}:{}}},"remove",0,function(e){return{type:"remove",referenceItem:e}},"truncate",0,function(e,t){return{type:"truncate",startIndex:e,endIndex:t}}],566283)},403241,e=>{"use strict";let t,n="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),r=new Uint8Array(16),s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));e.s(["v4",0,function(e,i,o){if(n&&!i&&!e)return n();let a=(e=e||{}).random??e.rng?.()??function(){if(!t){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(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,i){if((o=o||0)<0||o+16>i.length)throw RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[o+e]=a[e];return i}return function(e,t=0){return(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase()}(a)}],403241)},636536,71401,509820,521597,63244,312880,879887,160073,166100,881283,e=>{"use strict";var t,n=e.i(403241),r=e.i(807574),s=e.i(373534);function i(e,t,n,r,{assignment:o}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let a={},u={context:t.context,event:n.event,spawn:function(e,{machine:t,context:n},r,i){return(o,a)=>{let u=((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 u=(0,s.R)(t,o);if(!u)throw Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);let l=(0,s.c)(u,{id:a?.id,parent:e.self,syncSnapshot:a?.syncSnapshot,input:"function"==typeof a?.input?a.input({context:n,event:r,self:e.self}):a?.input,src:o,systemId:a?.systemId});return i[l.id]=l,l}})(o,a);return i[u.id]=u,e.defer(()=>{u._processingStatus!==s.V.Stopped&&u.start()}),u}}(e,t,n.event,a),self:e.self,system:e.system},l={};if("function"==typeof o)l=o(u,r);else for(let e of Object.keys(o)){let t=o[e];l[e]="function"==typeof t?t(u,r):t}let c=Object.assign({},t.context,l);return[(0,s.W)(t,{context:c,children:Object.keys(a).length?{...t.children,...a}:t.children}),void 0,void 0]}function o(e){function t(e,t){}return t.type="xstate.assign",t.assignment=e,t.resolve=i,t}let a=new WeakMap;function u(e,t,n){let r=a.get(e);return r?t in r||(r[t]=n()):(r={[t]:n()},a.set(e,r)),r[t]}let l={},c=e=>"string"==typeof e?{type:e}:"function"==typeof e?"resolve"in e?{type:e.type}:{type:e.name}:e;class d{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.l)(this.config.states,(e,t)=>new d(e,{_parent:this,_key:t,_machine:this.machine})):l,"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||
2!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.q)(this),this.config.always&&(this.always=(0,s.u)(this.config.always).map(e=>(0,s.v)(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.type,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.l)(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 u(this,"invoke",()=>(0,s.t)(this.config.invoke).map((e,t)=>{let{src:n,systemId:r}=e,i=e.id??(0,s.x)(this.id,t),o="string"==typeof n?n:`xstate.invoke.${(0,s.x)(this.id,t)}`;return{...e,src:o,id:i,systemId:r,toJSON(){let{onDone:t,onError:n,...r}=e;return{...r,type:"xstate.invoke",src:o,id:i}}}}))}get on(){return u(this,"on",()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,n])=>(e[t]=e[t]||[],e[t].push(n),e),{}))}get after(){return u(this,"delayedTransitions",()=>(0,s.y)(this))}get initial(){return u(this,"initial",()=>(0,s.z)(this,this.config.initial))}next(e,t){let n,r=t.type,i=[];for(let o of u(this,`candidates-${r}`,()=>(0,s.B)(this,r))){let{guard:a}=o,u=e.context,l=!1;try{l=!a||(0,s.w)(a,u,t,e)}catch(t){let e="string"==typeof a?a:"object"==typeof a?a.type:void 0;throw Error(`Unable to evaluate guard ${e?`'${e}' `:""}in transition for event '${r}' in state node '${this.id}':
3${t.message}`)}if(l){i.push(...o.actions),n=o;break}}return n?[n]:void 0}get events(){return u(this,"events",()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let r=e[n];if(r.states)for(let e of r.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){return Array.from(new Set([...this.transitions.keys()].filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter)))))}}class p{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new d(e,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:n,actors:r,delays:s}=this.implementations;return new p(this.config,{actions:{...t,...e.actions},guards:{...n,...e.guards},actors:{...r,...e.actors},delays:{...s,...e.delays}})}resolveState(e){let t=(0,s.C)(this.root,e.value),n=(0,s.D)((0,s.g)(this.root,t));return(0,s.E)({_nodes:[...n],context:e.context||{},children:{},status:(0,s.F)(n,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,n){return(0,s.G)(e,t,n,[]).snapshot}microstep(e,t,n){return(0,s.G)(e,t,n,[]).microstates}getTransitionData(e,t){return(0,s.H)(this.root,e.value,e,t)||[]}getPreInitialState(e,t,n){let{context:r}=this.config,i=(0,s.E)({context:"function"!=typeof r&&r?r:{},_nodes:[this.root],children:{},status:"active"},this);return"function"==typeof r?(0,s.I)(i,t,e,[o(({spawn:e,event:t,self:n})=>r({spawn:e,input:t.input,self:n}))],n,void 0):i}getInitialSnapshot(e,t){let n=(0,s.J)(t),r=[],i=this.getPreInitialState(e,n,r),o=(0,s.K)([{target:[...(0,s.L)(this.root)],source:this.root,reenter
3:!0,actions:[],eventType:null,toJSON:null}],i,e,n,!0,r),{snapshot:a}=(0,s.G)(o,n,e,r);return a}start(e){Object.values(e.children).forEach(e=>{"active"===e.getSnapshot().status&&e.start()})}getStateNodeById(e){let t=(0,s.M)(e),n=t.slice(1),r=(0,s.O)(t[0])?t[0].slice(1):t[0],i=this.idMap.get(r);if(!i)throw Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);return(0,s.P)(i,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return(0,s.Q)(e,t)}restoreSnapshot(e,t){let n={},r=e.children;Object.keys(r).forEach(e=>{let i=r[e],o=i.snapshot,a=i.src,u="string"==typeof a?(0,s.R)(this,a):a;if(!u)return;let l=(0,s.c)(u,{id:e,parent:t.self,syncSnapshot:i.syncSnapshot,snapshot:o,src:a,systemId:i.systemId});n[e]=l});let i=function(e,t){if(!t||"object"!=typeof t)return{};let n={};for(let r in t)for(let s of t[r]){let t=function(e,t){if(t instanceof d)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}(e,s);t&&(n[r]??=[],n[r].push(t))}return n}(this.root,e.historyValue),o=(0,s.E)({...e,children:n,_nodes:Array.from((0,s.D)((0,s.g)(this.root,e.value))),historyValue:i},this),a=new Set;return!function e(t,n){if(!a.has(t))for(let r in a.add(t),t){let i=t[r];if(i&&"object"==typeof i){if("xstate$$type"in i&&i.xstate$$type===s.$){t[r]=n[i.id];continue}e(i,n)}}}(o.context,n),o}}function f(e,t,n,r,{event:s}){return[t,{event:"function"==typeof s?s(n,r):s},void 0]}function h(e,{event:t}){e.defer(()=>e.emit(t))}function y(e){function t(e,t){}return t.type="xstate.emit",t.event=e,t.resolve=f,t.execute=h,t}let m=((t={}).Parent="#_parent",t.Internal="#_internal",t);function g(e,t,n,r,{to:s,event:i,id:o,delay:a},u){let l,c,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(n,r):i;if("string"==typeof a){let e=d&&d[a];l="function"==typeof e?e(n,r):e}else l="function"==typeof a?a(n,r):a;let f="function"==typeof s?s(n,r):s;if("string"==typeof f){if(!(c=f===m.Parent?e.self._parent:f===m.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 c=f||e.self;return[t,{to:c,targetId:"string"==typeof f?f:void 0,event:p,id:o,delay:l},void 0]}function v(e,t,n){"string"==typeof n.to&&(n.to=t.children[n.to])}function b(e,t){e.defer(()=>{let{to:n,event:r,delay:i,id:o}=t;"number"==typeof i?e.system.scheduler.schedule(e.self,n,r,i,o):e.system._relay(e.self,n,r.type===s.T?(0,s.U)(e.self.id,r.data):r)})}function w(e,t,n){function r(e,t){}return r.type="xstate.sendTo",r.to=e,r.event=t,r.id=n?.id,r.delay=n?.delay,r.resolve=g,r.retryResolve=v,r.execute=b,r}function x(e,t){return w(m.Parent,e,t)}function _(e,t,n,r,{collect:i}){let a=[],u=function(e){a.push(e)};return u.assign=(...e)=>{a.push(o(...e))},u.cancel=(...e)=>{a.push((0,s.a)(...e))},u.raise=(...e)=>{a.push((0,s.r)(...e))},u.sendTo=(...e)=>{a.push(w(...e))},u.sendParent=(...e)=>{a.push(x(...e))},u.spawnChild=(...e)=>{a.push((0,s.b)(...e))},u.stopChild=(...e)=>{a.push((0,s.s)(...e))},u.emit=(...e)=>{a.push(y(...e))},i({context:n.context,event:n.event,enqueue:u,check:e=>(0,s.w)(e,t.context,n.event,t),self:e.self,system:e.system},r),[t,void 0,a]}function E(e){function t(e,t){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=_,t}function k(e,t,n,r,{value:s,label:i}){return[t,{value:"function"==typeof s?s(n,r):s,label:i},void 0]}function S({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function I(e=({context:e,event:t})=>({context:e,event:t}),t){function n(e,t){}return n.type="xstate.log",n.value=e,n.label=t,n.resolve=k,n.execute=S,n}function $(e,t){let n=(0,s.t)(t);if(!n.includes(e.type)){let t=1===n.length?`type "${n[0]}"`:`one of types "${n.join('", "')}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}function A({schemas:e,actors:t,actions:n,guards:r,delays:i}){return{assign:o,sendTo:w,raise:s.r,log:I,cancel:s.a,stopChild:s.s,enqueueActions:E,emit:y,spawnChild:s.b,createStateConfig:e=>e,createAction:e=>e,createMachine:s=>new p({...s,schemas:e},{actors:t,actions:n,guards:r,delays:i})}}e.s(["a",0,y,"b",0,x,"e",0,E,"l",0,I,"s",0,w],71401),e.s(["assertEvent",0,$,"setup",0,A],509820),e.s(["assign",0,o],521597);var T=s;
3e.s(["createActor",()=>T.c],63244);var T=s;e.s(["enqueueActions",0,E],312880);var O=s;e.s(["raise",()=>O.r],879887);var O=s;e.s(["emit",0,y],160073);var M=s;e.s(["stopChild",()=>M.s],166100);var M=s,N=e.i(172441),j=e.i(290571),R=e.i(220324),P=e.i(394426),L=e.i(484973),C=e.i(987675),q=e.i(603752),D=e.i(272383),U=["addListener","removeListener"],W=["addEventListener","removeEventListener"],V=["on","off"];function G(e,t,n,r){if((0,q.isFunction)(n)&&(r=n,n=void 0),r)return G(e,t,n).pipe((0,D.mapOneOrManyArgs)(r));var s,i,o,a=(0,j.__read)((s=e,(0,q.isFunction)(s.addEventListener)&&(0,q.isFunction)(s.removeEventListener))?W.map(function(r){return function(s){return e[r](t,s,n)}}):(i=e,(0,q.isFunction)(i.addListener)&&(0,q.isFunction)(i.removeListener))?U.map(z(e,t)):(o=e,(0,q.isFunction)(o.on)&&(0,q.isFunction)(o.off))?V.map(z(e,t)):[],2),u=a[0],l=a[1];if(!u&&(0,C.isArrayLike)(e))return(0,L.mergeMap)(function(e){return G(e,t,n)})((0,R.innerFrom)(e));if(!u)throw TypeError("Invalid event target");return new P.Observable(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return u(t),function(){return l(t)}})}function z(e,t){return function(n){return function(r){return e[n](t,r)}}}var B=e.i(94059),J=e.i(282541),H=e.i(722249),Y=e.i(902965),F=e.i(627608),K=e.i(586903),X=e.i(96623);function Q(e){return e<=0?function(){return X.EMPTY}:(0,Y.operate)(function(t,n){var r=0;t.subscribe((0,F.createOperatorSubscriber)(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}var Z=e.i(114940);let ee=e=>({context:t})=>{let{count:n,include:r,exclude:s,responseType:i="message.received"}=e;return{count:n,domain:t.domain,from:t.connectTo,include:r?Array.isArray(r)?r:[r]:[],exclude:s?Array.isArray(s)?s:[s]:[],responseType:i,target:t.target,to:t.name}},et=(0,N.defer)(()=>G(window,"message")),en=e=>(0,r.fromEventObservable)(({input:t})=>{var n,r,s;let i;return et.pipe(e?(0,B.map)(e):(0,J.pipe)(),(0,H.filter)(e=>{let{data:n}=e;return(!t.include.length||t.include.includes(n.type))&&(!t.exclude.length||!t.exclude.includes(n.type))&&n.domain===t.domain&&n.from===t.from&&n.to===t.to&&(!t.target||e.source===t.target)}),(0,B.map)((i=t.responseType,e=>({type:i,message:e}))),t.count?(0,J.pipe)((n=t.count,void 0===r&&(r=null),r=null!=r?r:n,(0,Y.operate)(function(e,t){var s=[],i=0;e.subscribe((0,F.createOperatorSubscriber)(t,function(e){var o,a,u,l,c=null;i++%r==0&&s.push([]);try{for(var d=(0,j.__values)(s),p=d.next();!p.done;p=d.next()){var f=p.value;f.push(e),n<=f.length&&(c=null!=c?c:[]).push(f)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}if(c)try{for(var h=(0,j.__values)(c),y=h.next();!y.done;y=h.next()){var f=y.value;(0,K.arrRemove)(s,f),t.next(f)}}catch(e){u={error:e}}finally{try{y&&!y.done&&(l=h.return)&&l.call(h)}finally{if(u)throw u.error}}},function(){var e,n;try{for(var r=(0,j.__values)(s),i=r.next();!i.done;i=r.next()){var o=i.value;t.next(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}t.complete()},void 0,function(){s=null}))})),(s=e=>e,(0,q.isFunction)(void 0)?(0,L.mergeMap)(s,void 0,1):(0,L.mergeMap)(s,1)),Q(t.count)):(0,J.pipe)())}),er="sanity/comlink",es="comlink/response",ei="comlink/heartbeat",eo="comlink/disconnect",ea="comlink/handshake/syn",eu="comlink/handshake/syn-ack",el="comlink/handshake/ack",ec=()=>A({types:{},actors:{listen:(0,r.fromEventObservable)(({input:e})=>{let t,n=e.signal?G(e.signal,"abort").pipe((t=`Request ${e.requestId} aborted`,e=>e.pipe(Q(1),(0,B.map)(()=>{throw Error(t)})))):X.EMPTY;return G(window,"message").pipe((0,H.filter)(t=>t.data?.type===es&&t.data?.responseTo===e.requestId&&!!t.source&&e.sources.has(t.source)),Q(e.sources.size),(0,Y.operate)(function(e,t){(0,R.innerFrom)(n).subscribe((0,F.createOperatorSubscriber)(t,function(){return t.complete()},Z.noop)),t.closed||e.subscribe(t)}))})},actions:{"send message":({context:e},t)=>{let{sources:n,targetOrigin:r}=e,{message:s}=t;n.forEach(e=>{e.postMessage(s,{targetOrigin:r})})},"on success":w(({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":w(({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":w(({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-${(0,n.v4)()}`,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:n,domain:r,from:s,id:i,responseTo:o,to:a,type:u}=e;return{message:{channelId:t,data:n,domain:r,from:s,id:i,to:a,type:u,responseTo:o}}}},always:[{guard:"expectsResponse",target:"awaiting"},"success"]},awaiting:{invoke:{id:"listen for response",src:"listen",input:({context:e})=>({requestId:e.id,sources:e.sources,signal:e.signal}),onError:"aborted"},after:{responseTimeout:"failed"},on:{message:{actions:o({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,r.fromCallback)(({sendBack:e,input:t})=>{let n=()=>{e(t.event)};t.immediate&&n();let r=setInterval(n,t.interval);return()=>{clearInterval(r)}});let ed=()=>A({types:{},actors:{requestMachine:ec(),listen:en()},actions:{"buffer handshake":o({handshakeBuffer:({event:e,context:t})=>($(e,"message.received"),[...t.handshakeBuffer,e])}),"buffer message":E(({enqueue:e})=>{e.assign({buffer:({event:e,context:t})=>($(e,"post"),[...t.buffer,{data:e.data,resolvable:e.resolvable,options:e.options}])}),e.emit(({event:e})=>($(e,"post"),{type:"buffer.added",message:e.data}))}),"create request":o({requests:({context:e,event:t,self:r,spawn:s})=>{$(t,"request");let i=(Array.isArray(t.data)?t.data:[t.data]).map(t=>s("requestMachine",{id:`req-${(0,n.v4)()}`,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.o
3ptions?.suppressWarnings,targetOrigin:e.targetOrigin,to:e.connectTo,type:t.type}}));return[...e.requests,...i]}}),"emit heartbeat":y(()=>({type:"heartbeat"})),"emit received message":E(({enqueue:e})=>{e.emit(({event:e})=>($(e,"message.received"),{type:"message",message:e.message.data}))}),"emit status":y((e,t)=>({type:"status",status:t.status})),"post message":(0,O.r)(({event:e})=>($(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":E(({context:e,enqueue:t})=>{e.handshakeBuffer.forEach(e=>t.raise(e)),t.assign({handshakeBuffer:[]})}),"remove request":E(({context:e,enqueue:t,event:n})=>{$(n,["request.success","request.failed","request.aborted"]),(0,M.s)(n.requestId),t.assign({requests:e.requests.filter(({id:e})=>e!==n.requestId)})}),"send response":(0,O.r)(({event:e})=>($(e,["message.received","heartbeat.received"]),{type:"request",data:{type:es,responseTo:e.message.data.id,data:void 0}})),"send handshake syn ack":(0,O.r)({type:"request",data:{type:eu}}),"send pending messages":E(({enqueue:e})=>{e.raise(({context:e})=>({type:"request",data:e.buffer.map(({data:e,resolvable:t,options:n})=>({data:e.data,type:e.type,expectResponse:!!t,resolvable:t,options:n}))})),e.emit(({context:e})=>({type:"buffer.flushed",messages:e.buffer.map(({data:e})=>e)})),e.assign({buffer:[]})}),"set connection config":o({channelId:({event:e})=>($(e,"handshake.syn"),e.message.data.channelId),target:({event:e})=>($(e,"handshake.syn"),e.message.source||void 0),targetOrigin:({event:e})=>($(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??er,handshakeBuffer:[],name:e.name,requests:[],target:void 0,targetOrigin:null}),invoke:{id:"listen for handshake syn",src:"listen",input:ee({include:ea,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:ee({include:el,count:1,responseType:"handshake.complete"}),onDone:"connected"},{id:"listen for disconnect",src:"listen",input:ee({include:eo,count:1,responseType:"disconnect"})},{id:"listen for messages",src:"listen",input:ee({exclude:[eo,ea,el,ei,es]})}],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:ee({exclude:[eo,ea,el,ei,es]})},{id:"listen for heartbeat",src:"listen",input:ee({include:ei,responseType:"heartbeat.received"})},{id:"listen for disconnect",src:"listen",input:ee({include:eo,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"]}}}}});e.s(["DOMAIN",0,er,"MSG_DISCONNECT",0,eo,"MSG_HANDSHAKE_ACK",0,el,"MSG_HANDSHAKE_SYN",0,ea,"MSG_HANDSHAKE_SYN_ACK",0,eu,"MSG_HEARTBEAT",0,ei,"MSG_RESPONSE",0,es,"createListenLogic",0,en,"createNode",0,(e,t=ed())=>{let n,r=(0,T.c)(t,{input:e}),s=new Map,i=new Map;r.on("message",({message:e})=>{let t=s.get(e.type);if(t)return void t.forEach(t=>t(e.data));let n=i.get(e.type);n?n.add(e):i.set(e.type,new Set([e]))});let o=()=>{r.stop()};return{actor:r,fetch:(e,t,n)=>{let s,i,{responseTimeout:o=1e4,signal:a,suppressWarnings:u}=n||{},l="function"==typeof Promise.withResolvers?Promise.withResolvers():{promise:new Promise((e,t)=>
3{s=e,i=t}),resolve:s,reject:i};return r.send({type:"post",data:{type:e,data:t},resolvable:l,options:{responseTimeout:o,signal:a,suppressWarnings:u}}),l.promise},machine:t,on:(e,t,n)=>{let r=s.get(e)||new Set;s.has(e)||s.set(e,r),r.add(t);let o=i.get(e);if(o){let r=n?.replay??1;Array.from(o).slice(-r).forEach(({data:e})=>t(e)),i.delete(e)}return()=>{r.delete(t)}},onStatus:(e,t)=>{let s=r.on("status",r=>{n=r.status,t&&r.status!==t||e(r.status)});return n&&e(n),()=>s.unsubscribe()},post:(e,t)=>{r.send({type:"post",data:{type:e,data:t}})},start:()=>(r.start(),o),stop:o}},"createNodeMachine",0,ed,"createRequestMachine",0,ec],881283);let ep={"handshake/syn":ea,"handshake/syn-ack":eu,"handshake/ack":el,"channel/response":es,"channel/heartbeat":ei,"channel/disconnect":eo,"overlay/focus":"visual-editing/focus","overlay/navigate":"visual-editing/navigate","overlay/toggle":"visual-editing/toggle","presentation/toggleOverlay":"presentation/toggle-overlay"},ef={[ea]:"handshake/syn",[eu]:"handshake/syn-ack",[el]:"handshake/ack",[es]:"channel/response",[ei]:"channel/heartbeat",[eo]:"channel/disconnect","visual-editing/focus":"overlay/focus","visual-editing/navigate":"overlay/navigate","visual-editing/toggle":"overlay/toggle","presentation/toggle-overlay":"presentation/toggleOverlay"},eh=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=er),"overlays"===t.to&&(t.to="visual-editing"),"overlays"===t.from&&(t.from="visual-editing"),t.channelId=t.connectionId,delete t.connectionId,t.type=ep[t.type]??t.type),e},ey=({context:e},t)=>{let{sources:n,targetOrigin:r}=e,s=(e=>{let{channelId:t,...n}=e,r={...n,connectionId:t};return r.domain===er&&(r.domain="sanity/channels"),"visual-editing"===r.to&&(r.to="overlays"),"visual-editing"===r.from&&(r.from="overlays"),r.type=ef[r.type]??r.type,"channel/response"===r.type&&r.responseTo&&!r.data&&(r.data={responseTo:r.responseTo}),("handshake/syn"===r.type||"handshake/syn-ack"===r.type||"handshake/ack"===r.type)&&(r.data={id:r.connectionId}),r})(t.message);n.forEach(e=>{e.postMessage(s,{targetOrigin:r})})};e.s(["createCompatibilityActors",0,()=>({listen:en(eh),requestMachine:ec().provide({actions:{"send message":ey}})}),"isMaybePreviewIframe",0,function(){return window.self!==window.top},"isMaybePreviewWindow",0,function(){return!!window.opener}],636536)},523694,662966,718911,e=>{"use strict";let t,n;var r,s,i,o,a,u=e.i(881933),l=e.i(932549),c=e.i(271645),d=e.i(389740),p=e.i(566283),f=e.i(636536);let h=/_key\s*==\s*['"](.*)['"]/,y=/^\d*:\d*$/;function m(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}function g(e){return"string"==typeof e?h.test(e.trim()):"object"==typeof e&&"_key"in e}let v=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,b=/_key\s*==\s*['"](.*)['"]/;function w(e,t,n){let r="string"==typeof t?function(e){if("string"!=typeof e)throw Error("Path is not a string");let t=e.match(v);if(!t)throw Error("Invalid path string");return t.map(x)}(t):t;if(!Array.isArray(r))throw Error("Path must be an array or a string");let s=e;for(let e=0;e<r.length;e++){let t=r[e];if(m(t)){if(!Array.isArray(s))return n;s=s[t]}if(g(t)){if(!Array.isArray(s))return n;s=s.find(e=>e._key===t._key)}if("string"==typeof t&&(s="object"==typeof s&&null!==s?s[t]:void 0),typeof s>"u")return n}return s}function x(e){return m(e)?Number(e.replace(/[^\d]/g,"")):g(e)?{_key:e.match(b)[1]}:!function(e){if("string"==typeof e&&y.test(e))return!0;if(!Array.isArray(e)||2!==e.length)return!1;let[t,n]=e;return("number"==typeof t||""===t)&&("number"==typeof n||""===n)}(e)?e:function(e){let[t,n]=e.split(":").map(e=>""===e?e:Number(e));return[t,n]}(e)}function _(){return(0,c.useSyncExternalStore)(S,k,E)}function E(){return d.emptyActor}function k(){return d.actor}function S(e){return d.listeners.add(e),()=>d.listeners.delete(e)}function I(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(e,r)},t)}}function $(e,t){let n=(0,f.isMaybePreviewIframe)(),r=(0,f.isMaybePreviewWindow)();if((0,d.isEmptyActor)(t)||!n&&!r)throw Error("The `useDocuments` hook cannot be used in this context");let s=(0,l.getDraftId)(e),i=(0,l.getPublishedId)(e),o=t.getSnapshot().context?.documents,a=o?.[s],u=o?.[i],c=a||u;if(!c)throw Error(`Document "${e}" not found`);let p=a.getSnapshot().context?.local||u.getSnapshot().context?.local,h=new Promise(e=>{if(p)e(p);else{let t=c.on("ready",n=>{let{snapshot:r}=n;e(r||null),t.unsubscribe()})}});return{draftDoc:a,draftId:s,getSnapshot:()=>h,publishedDoc:u,publishedId:i,get snapshot(){if(!p)throw Error(`Snapshot for document "${e}" not found`);return p}}}function A(e){let t=(()=>
3{if(n)return n;n=[];for(let e=0;e<256;++e)n[e]=(e+256).toString(16).slice(1);return n})();return(function(e=16){let t=new Uint8Array(e);return function(e){let t="u">typeof window&&"crypto"in window?window.crypto:globalThis.crypto;if(!t||!t.getRandomValues)throw Error("WebCrypto not available in this environment");t.getRandomValues(e)}(t),t})(e).reduce((e,n)=>e+t[n],"").slice(0,e)}function T(e){let t,n,r="string"==typeof e?e:e.path,s=r.lastIndexOf("."),i=r.substring(s+1,r.length);if(!i.indexOf("["))throw Error("Invalid path: not an array");let o=r.lastIndexOf("["),a=r.substring(0,o);if(i.includes("_key")){let e=i.indexOf('"')+1,r=i.indexOf('"',e);t=i.substring(e,r),n=!0}else{let e=i.indexOf("[")+1,r=i.indexOf("]",e);t=i.substring(e,r),n=!1}if(!a||!t)throw Error("Invalid path");return{path:a,key:t,hasExplicitKey:n}}async function O(e,t,n){if(!e.type)throw Error("Node type is missing");let{path:r,key:s}=T(e),i=await t.getSnapshot(),o=w(i,r),a=w(i,e.path),u=o.findIndex(e=>e._key===s),l=-1,c="before";if("first"===n){if(0===u)return[];l=0,c="before"}else if("last"===n){if(u===o.length-1)return[];l=-1,c="after"}else if("next"===n){if(u===o.length-1)return[];l=u,c="after"}else if("previous"===n){if(0===u)return[];l=u-1,c="before"}return[(0,p.at)(r,(0,p.truncate)(u,u+1)),(0,p.at)(r,(0,p.insert)(a,c,l))]}function M(e){return{lang:e?.lang??s?.lang,message:e?.message,abortEarly:e?.abortEarly??s?.abortEarly,abortPipeEarly:e?.abortPipeEarly??s?.abortPipeEarly}}function N(e,t,n,r,s){var u,l,c,d;let p,f=s&&"input"in s?s.input:n.value,h=s?.expected??e.expects??null,y=s?.received??("string"==(p=typeof f)?`"${f}"`:"number"===p||"bigint"===p||"boolean"===p?`${f}`:"object"===p||"function"===p?(f&&Object.getPrototypeOf(f)?.constructor?.name)??"null":p),m={kind:e.kind,type:e.type,input:f,expected:h,received:y,message:`Invalid ${t}: ${h?`Expected ${h} but r`:"R"}eceived ${y}`,requirement:e.requirement,path:s?.path,issues:s?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},g="schema"===e.kind,v=s?.message??e.message??(u=e.reference,l=m.lang,a?.get(u)?.get(l))??(g?(c=m.lang,o?.get(c)):null)??r.message??(d=m.lang,i?.get(d));void 0!==v&&(m.message="function"==typeof v?v(m):v),g&&(n.typed=!1),n.issues?n.issues.push(m):n.issues=[m]}function j(e){return{version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},M())}}e.s(["get",0,w,"getArrayDuplicatePatches",0,function(e,t,n="after"){let{path:r,key:s}=T(e),i={...w(t,e.path),_key:A()};return[(0,p.at)(r,(0,p.insert)(i,n,{_key:s}))]},"getArrayInsertPatches",0,function(e,t,n){let{path:r,key:s}=T(e),i=A();return[(0,p.at)(r,(0,p.insert)([{_type:t,_key:i}],n,{_key:s}))]},"getArrayItemKeyAndParentPath",0,T,"getArrayMovePatches",0,O,"getArrayRemovePatches",0,function(e,t){let{path:n,key:r}=T(e),s=w(t,n).findIndex(e=>e._key===r);return[(0,p.at)(n,(0,p.truncate)(s,s+1))]},"useDocuments",0,function(){let e,t,n,r=(0,u.c)(7),s=_();r[0]!==s?(e=e=>({id:e,commit:()=>{let{draftDoc:t}=$(e,s);t.send({type:"submit"})},get:t=>{let{snapshot:n}=$(e,s);return t?w(n,t):n},getSnapshot:function(e,t){let{getSnapshot:n}=$(e,t);return n}(e,s),patch:async(t,n)=>{let r=$(e,s),{draftDoc:i,draftId:o,getSnapshot:a,publishedId:u}=r,{commit:l=!0}=n||{},c=await ("function"==typeof t?t({draftId:o,publishedId:u,get snapshot(){return r.snapshot},getSnapshot:a}):t),d=await a();if(!d)throw Error(`Snapshot for document "${e}" not found`);i.send({type:"mutate",mutations:[(0,p.createIfNotExists)({...d,_id:o}),(0,p.patch)(o,c)]}),l&&("object"==typeof l&&"debounce"in l?I(()=>i.send({type:"submit"}),l.debounce)():i.send({type:"submit"}))}}),r[0]=s,r[1]=e):e=r[1];let i=e;r[2]!==s?(t=(e,t,n)=>{let{draftDoc:r}=$(e,s),{commit:i}=n||{},o=void 0===i||i;r.send({type:"mutate",mutations:t}),o&&("object"==typeof o&&"debounce"in o?I(()=>r.send({type:"submit"}),o.debounce)():r.send({type:"submit"}))},r[2]=s,r[3]=t):t=r[3];let o=t;return r[4]!==i||r[5]!==o?(n={getDocument:i,mutateDocument:o},r[4]=i,r[5]=o,r[6]=n):n=r[6],n},"useOptimisticActor",0,_,"useOptimisticActorReady",0,function(){let e,t=(0,u.c)(2),n=_();return t[0]!==n?(e=(0,d.isEmptyActor)(n),t[0]=n,t[1]=e):e=t[1],!e}],662966);
3var R=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function P(e,t){return{kind:"validation",type:"min_length",reference:P,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length<this.requirement&&N(this,"length",e,t,{received:`${e.value.length}`}),e}}}function L(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function C(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}function q(e,t){return{kind:"schema",type:"object",reference:q,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(n&&"object"==typeof n)for(let r in e.typed=!0,e.value={},this.entries){let s=this.entries[r];if(r in n||("exact_optional"===s.type||"optional"===s.type||"nullish"===s.type)&&void 0!==s.default){let i=r in n?n[r]:C(s),o=s["~run"]({value:i},t);if(o.issues){let s={type:"object",origin:"value",input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(void 0!==s.fallback)e.value[r]=L(s);else if("exact_optional"!==s.type&&"optional"!==s.type&&"nullish"!==s.type&&(N(this,"key",e,t,{input:void 0,expected:`"${r}"`,path:[{type:"object",origin:"key",input:n,key:r,value:n[r]}]}),t.abortEarly))break}else N(this,"type",e,t);return e}}}function D(e,t){return{kind:"schema",type:"optional",reference:D,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return j(this)},"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=C(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}}}function U(e){return{kind:"schema",type:"string",reference:U,expects:"string",async:!1,message:e,get"~standard"(){return j(this)},"~run"(e,t){return"string"==typeof e.value?e.typed=!0:N(this,"type",e,t),e}}}function W(...e){return{...e[0],pipe:e,get"~standard"(){return j(this)},"~run"(t,n){for(let r of e)if("metadata"!==r.kind){if(t.issues&&("schema"===r.kind||"transformation"===r.kind)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=r["~run"](t,n))}return t}}}function V(e,t,n){let r=e["~run"]({value:t},M(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}let G=W(U(),P(1)),z=D(G),B=q({baseUrl:G,dataset:z,id:G,path:G,projectId:z,tool:z,type:z,workspace:z,perspective:{...r=U(),fallback:"drafts",get"~standard"(){return j(this)},"~run"(e,t){let n=r["~run"](e,t);return n.issues?{typed:!0,value:L(this,n,t)}:n}}});function J(e){return!B["~run"]({value:e},{abortEarly:!0}).issues}function H(e){let t="";for(let n of e){if("string"==typeof n){t&&(t+="."),t+=n;continue}if("number"==typeof n){t&&(t+=":"),t+=`${n}`;continue}if(null!==n&&Array.isArray(n)){t&&(t+=":"),t+=`${n.join(",")}}`;continue}if(n._key){t&&(t+=":"),t+=`${n._key}`;continue}}return t}let Y=/^([\w-]+):(0|[1-9][0-9]*)$/,F=/^([\w-]+):([0-9]+),([0-9]+)$/,K=/^([\w-]+):([\w-]+)$/,X=W(U(),P(1)),Q=q({origin:X,href:X,data:D(function e(t,n,r){return{kind:"schema",type:"record",reference:e,expects:"Object",async:!1,key:t,value:n,message:r,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(n&&"object"==typeof n){for(let r in e.typed=!0,e.value={},n)if(Object.hasOwn(n,r)&&"__proto__"!==r&&"prototype"!==r&&"constructor"!==r){let s=n[r],i=this.key["~run"]({value:r},t);if(i.issues){let o={type:"object",origin:"key",input:n,key:r,value:s};for(let t of i.issues)t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=i.issues),t.abortEarly){e.typed=!1;break}}let o=this.value["~run"]({value:s},t);if(o.issues){let i={type:"object",origin:"value",input:n,key:r,value:s};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}i.typed&&o.typed||(e.typed=!1),i.typed&&(e.value[i.value]=o.value)}}else N(this,"type",e,t);return e}}}(U(),function e(){return{kind:"schema",type:"unknown",reference:e,expects:"unknown",async:!1,get"~standard"(){return j(this)},"~run":e=>(e.typed=!0,e)}}()))});function Z(e){let t=V(B,e);if(t.success)return t.output;let n=V(Q,e);if(n.success)try{let e=new URL(n.output.href,typeof document>"u"?"https://example.com":location.origin);return e.searchParams.size>0?function(e,t){let n=e["~run"]({value:t},M(void 0));if(n.issues)throw new R(n.issues);return n.value}
3(B,Object.fromEntries(e.searchParams.entries())):n.output}catch(e){return console.error("Failed to parse sanity node",e),n.output}}function ee(e){if("object"==typeof e&&null!==e)return Z(e);try{let t=JSON.parse(e);return Z(t)}catch{let t=e.split(";").reduce((e,t)=>{let[n,r]=t.split("=");if(!n||t.includes("=")&&!r)return e;switch(n){case"id":e.id=r;break;case"type":e.type=r;break;case"path":e.path=l.studioPath.toString(function(e){let t=[];for(let n of e.split(".")){let e=Y.exec(n);if(e){t.push(e[1],Number(e[2]));continue}let r=F.exec(n);if(r){t.push(r[1],[Number(r[2]),Number(r[3])]);continue}let s=K.exec(n);if(s){t.push(s[1],{_key:s[2]});continue}t.push(n)}return t}(r));break;case"base":e.baseUrl=decodeURIComponent(r);break;case"perspective":e.perspective=r;break;case"tool":e.tool=r;break;case"workspace":e.workspace=r;break;case"projectId":e.projectId=r;break;case"dataset":e.dataset=r}return e},{});if(J(t))return t;return}}e.s(["createDataAttribute",0,function e(t){function n(e){return e?"string"==typeof e?l.studioPath.fromString(e):e:[]}function r(e){if(!e.id)throw Error("`id` is required to create a data attribute");if(!e.type)throw Error("`type` is required to create a data attribute");if(!e.path||!e.path.length)throw Error("`path` is required to create a data attribute");return function(e){let{id:t,path:n,baseUrl:r,tool:s,workspace:i,type:o}=e;return J(e)?[["id",(0,l.getPublishedId)(t)],["type",o],["path",H(l.studioPath.fromString(n))],["base",encodeURIComponent(r)],["workspace",i],["tool",s]].filter(([,e])=>!!e).map(e=>e.join("=")).join(";"):void 0}({baseUrl:e.baseUrl||"/",workspace:e.workspace,tool:e.tool,type:e.type,id:e.id,path:"string"==typeof e.path?e.path:l.studioPath.toString(e.path),perspective:e.perspective})}let s=e=>r({...t,path:[...n(t.path),...n(e)]});return s.toString=function(){return r(t)},s.combine=function(n){return e({...t,...n})},s.scope=function(r){return e({...t,path:[...n(t.path),...n(r)]})},s},"decodeSanityNodeData",0,ee,"pathToUrlString",0,H],718911);var et={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},en={0:8203,1:8204,2:8205,3:65279},er=[,,,,].fill(String.fromCodePoint(en[0])).join(""),es=Object.fromEntries(Object.entries(en).map(e=>e.reverse())),ei=Object.fromEntries(Object.entries(et).map(e=>e.reverse())),eo=`${Object.values(et).map(e=>`\\u{${e.toString(16)}}`).join("")}`,ea=RegExp(`[${eo}]{4,}`,"gu");let eu=[];for(let e=0;e<256;++e)eu.push((e+256).toString(16).slice(1));let el=new Uint8Array(16);var ec="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);function ed(e,n,r){if(ec&&!e)return ec();let s=(e=e||{}).random??e.rng?.()??function(){if(!t){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(el)}();if(s.length<16)throw Error("Random bytes length must be >= 16");return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(e,t=0){return(eu[e[t+0]]+eu[e[t+1]]+eu[e[t+2]]+eu[e[t+3]]+"-"+eu[e[t+4]]+eu[e[t+5]]+"-"+eu[e[t+6]]+eu[e[t+7]]+"-"+eu[e[t+8]]+eu[e[t+9]]+"-"+eu[e[t+10]]+eu[e[t+11]]+eu[e[t+12]]+eu[e[t+13]]+eu[e[t+14]]+eu[e[t+15]]).toLowerCase()}(s)}function ep(e){let t=e.getBoundingClientRect();return{x:t.x+scrollX,y:t.y+scrollY,w:t.width,h:t.height}}function ef(e,t,n){return"x"===n?{x:e.x+t,y:e.y,w:e.w-2*t,h:e.h}:{x:e.x,y:e.y+t,w:e.w,h:e.h-2*t}}function eh(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}function ey(e,t){let n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}function em(e,t,n){let r,s,i={x:e.x1,y:e.y1};if(t.some(e=>{var t;let r,s;return t=ef(e,Math.min(e.w,e.h)/10,"horizontal"===n?"x":"y"),r=i.x>=t.x&&i.x<=t.x+t.w,s=i.y>=t.y&&i.y<=t.y+t.h,r&&s}))return null;for(let o of t){let t=function(e,t){let n=[{x1:t.x,y1:t.y,x2:t.x+t.w,y2:t.y},{x1:t.x+t.w,y1:t.y,x2:t.x+t.w,y2:t.y+t.h},{x1:t.x+t.w,y1:t.y+t.h,x2:t.x,y2:t.y+t.h},{x1:t.x,y1:t.y+t.h,x2:t.x,y2:t.y}],r=[];for(let t=0;t<n.length;t++){let s=function(e,t){let{x1:n,y1:r,x2:s,y2:i}=e,{x1:o,y1:a,x2:u,y2:l}=t;if(n===s&&r===i||o===u&&a===l)return!1;
3let c=(l-a)*(s-n)-(u-o)*(i-r);if(0===c)return!1;let d=((u-o)*(r-a)-(l-a)*(n-o))/c,p=((s-n)*(r-a)-(i-r)*(n-o))/c;return!(d<0)&&!(d>1)&&!(p<0)&&!(p>1)&&{x:n+d*(s-n),y:r+d*(i-r)}}(e,n[t]);if(s){let e=!1;for(let t=0;t<r.length;t++)r[t].x===s.x&&r[t].y===s.y&&(e=!0);e||r.push(s)}}return 0!==r.length&&r.sort((t,n)=>ey(t,{x:e.x1,y:e.y1})-ey(n,{x:e.x1,y:e.y1}))}(e,ef(o,Math.min(o.w,o.h)/10,"horizontal"===n?"x":"y"));if(t){let e=t[0];r?ey(i,e)<ey(i,r)&&(r=e,s=o):(r=e,s=o)}}return s||null}function eg(e,t,n){let{x:r,y:s,w:i,h:o}=e,{x:a,y:u}=n;return{x:a+(r-a)*t,y:u+(s-u)*t,w:i*t,h:o*t}}function ev(e){let t=Math.max(0,Math.min(...e.map(e=>e.y))),n=Math.min(document.body.scrollHeight,Math.max(...e.map(e=>e.y+e.h)));return{min:t,max:n,height:n-t}}function eb(e,t){return t.find(t=>eh(ep(t.elements.element),e))?.sanity}function ew(e,t,n){return Object.values(t).every(e=>null===e)?null:"horizontal"===n?{left:t.left?{rect:t.left,sanity:eb(t.left,e)}:null,right:t.right?{rect:t.right,sanity:eb(t.right,e)}:null}:{top:t.top?{rect:t.top,sanity:eb(t.top,e)}:null,bottom:t.bottom?{rect:t.bottom,sanity:eb(t.bottom,e)}:null}}function ex(e){let t=document.body.getBoundingClientRect();return{x:Math.max(t.x,Math.min(e.clientX,t.x+t.width)),y:e.clientY+window.scrollY}}function e_(e,t,n){let r=ep(t),s=[...t.querySelectorAll(":where(h1, h2, h3, h4, p, a, img, span, button):not(:has(*))")];e.x<=r.x&&(e.x=r.x),e.x>=r.x+r.w&&(e.x=r.x+r.w),e.y>=r.y+r.h&&(e.y=r.y+r.h),e.y<=r.y&&(e.y=r.y);let i=s.map(e=>{let t=eg(ep(e),n,{x:r.x,y:r.y});return{x:t.x-r.x,y:t.y-r.y,w:t.w,h:t.h,tagName:e.tagName}});return{offsetX:(r.x-e.x)*n,offsetY:(r.y-e.y)*n,w:r.w*n,h:r.h*n,maxWidth:r.w*n*.75,childRects:i}}async function eE(e,t,n,r,s){return new Promise(i=>{e.addEventListener("transitionend",()=>{setTimeout(()=>{r({type:"overlay/dragEndMinimapTransition"})},2*s),i()},{once:!0}),r({type:"overlay/dragStartMinimapTransition"}),r({type:"overlay/dragToggleMinimap",display:!0}),document.body.style.overflow="hidden",document.body.style.height="100%",document.documentElement.style.overflow="initial",document.documentElement.style.height="100%",setTimeout(()=>{e.style.transformOrigin="50% 0px",e.style.transition="transform 150ms ease",e.style.transform=`translate3d(0px, ${-n+scrollY}px, 0px) scale(${t})`},25)})}function ek(e){let t,n,r=(t=Math.max(0,Math.min(...e.map(e=>e.x))),{min:t,max:n=Math.min(document.body.offsetWidth,Math.max(...e.map(e=>e.x+e.w))),width:n-t}),s=ev(e),i=r.min>8&&r.min+r.width<=window.innerWidth-8,o=s.min>8&&s.min+s.height<=document.body.scrollHeight-8,a=i&&o;return{x:a?r.min-8:r.min,y:a?s.min-8:s.min,w:a?r.width+16:r.width,h:a?s.height+16:s.height}}async function eS(e,t,n,r,s,i){return new Promise(o=>{if(1===new DOMMatrix(window.getComputedStyle(t).transform).a)return;let a=n-window.innerHeight,u=scrollY;(e-=window.innerHeight/2)<0&&(e=0),t.addEventListener("transitionend",()=>{t.style.transition="none",t.style.transform="none",scrollTo({top:e,behavior:"instant"}),setTimeout(()=>{r({type:"overlay/dragEndMinimapTransition"}),r({type:"overlay/dragToggleMinimap",display:!1})},2*s),o()},{once:!0}),r({type:"overlay/dragStartMinimapTransition"}),t.style.transform=`translateY(${Math.max(u-e,-a+u)}px) scale(1)`,i&&(document.body.style.overflow=i.body.overflow,document.body.style.height=i.body.height,document.documentElement.style.overflow=i.documentElement.overflow,document.documentElement.style.height=i.documentElement.height)})}let eI=!1,e$={y:0},eA={x:0,y:0},eT=typeof document>"u"?0:document.documentElement.scrollHeight,eO=null,eM=e=>e instanceof HTMLElement||e instanceof SVGElement,eN=e=>e&&eM(e)?e.dataset?.sanityOverlayElement?e:eN(e.parentElement):null;function ej(e){return ea.lastIndex=0,ea.test(e)}function eR(e,t=!1){return ej(e)?function(e,t=!1){try{let n=function(e){let t=e.match(ea);if(t)return function(e,t=!1){let n=Array.from(e);if(n.length%2==0){if(n.length%4||!e.startsWith(er))return function(e,t){var n;let r=[];for(let t=.5*e.length;t--;){let n=`${ei[e[2*t].codePointAt(0)]}${ei[e[2*t+1].codePointAt(0)]}`;r.unshift(String.fromCharCode(parseInt(n,16)))}let s=[],i=[r.join("")],o=10;for(;i.length;){let e=i.shift();try{if(s.push(JSON.parse(e)),t)break}catch(r){if(!o--)throw r;let t=+(null==(n=r.message.match(/\sposition\s(\d+)$/))?void 0:n[1]);if(!t)throw r;i.unshift(e.substring(0,t),e.substring(t))}}return s}(n,t)}
3else throw Error("Encoded data has invalid length");let r=[];for(let e=.25*n.length;e--;){let t=n.slice(4*e,4*e+4).map(e=>es[e.codePointAt(0)]).join("");r.unshift(String.fromCharCode(parseInt(t,4)))}if(t){r.shift();let e=r.indexOf("\0");return -1===e&&(e=r.length),[JSON.parse(r.slice(0,e).join(""))]}return r.join("").split("\0").filter(Boolean).map(e=>JSON.parse(e))}(t[0],!0)[0]}(e);return n&&"sanity.io"===n.origin?(t&&(n.href=n.href?.replace(".alt","")),n):null}catch(t){return console.error("Failed to decode stega for string: ",e,"with the original error: ",t),null}}(e,t):null}function eP(e){return"path"in e}function eL(e){if(!e.length||!e.map(e=>eP(e)).every((e,t,n)=>e===n[0]))return;if(!eP(e[0]))return e[0];let t=e.filter(eP),n=e[0],r=["projectId","dataset","id","baseUrl","workspace","tool"];for(let e=1;e<t.length;e++){let s=t[e];if(r.some(e=>s[e]!==n?.[e])){n=void 0;break}n={...n,path:function(e,t){let n=e.split("."),r=t.split("."),s=Math.min(n.length,r.length);return n=n.slice(0,s).reverse(),r=r.slice(0,s).reverse(),n.reduce((e,t,n)=>t===r[n]?[...e,t]:[],[]).reverse().join(".")}(n.path,s.path)}}return n}function eC(e){let t=e.lastIndexOf(".");return e.substring(t,e.length).includes("[")}function eq(e){if(!eC(e))return null;let t=e.split(".");return t[t.length-1]=t[t.length-1].replace(/\[.*?\]/g,"[]"),t.join(".")}function eD(e,t){return!!eC(e.path)&&!!eC(t.path)&&eq(e.path)===eq(t.path)}function eU(e,t,n,r){if(!e.getAttribute("data-sanity")||e.getAttribute("data-sanity-drag-disable")||!t||!eP(t)||!eC(t.path))return null;let s=e.getAttribute("data-sanity-drag-group"),i=[...n].reduce((e,n)=>{let i=r.get(n),o=n.getAttribute("data-sanity-drag-disable"),a=n.getAttribute("data-sanity-drag-group"),u=null!==n.getAttribute("data-sanity");return i?.sanity&&!o&&eP(i.sanity)&&eD(t,i.sanity)&&(null===s||s===a)&&u&&e.push(i),e},[]);return i.length<=1?null:i}let eW=(0,c.createContext)(null);e.s(["SharedStateContext",0,eW,"createOverlayController",0,function({handler:e,overlayElement:t,inFrame:n,inPopUp:r,optimisticActorReady:s}){let i=!1,o=new Map,a=new WeakMap,u=new Set,l=new WeakMap,c=new WeakMap,d,p,f,h=!1,y=[],m=()=>y[y.length-1];function g(e,t){e.removeEventListener("click",t.click,{capture:!0}),e.removeEventListener("contextmenu",t.contextmenu,{capture:!0}),e.removeEventListener("mousemove",t.mousemove,{capture:!0}),e.removeEventListener("mousedown",t.mousedown,{capture:!0}),e.removeEventListener("mouseenter",t.mouseenter),e.removeEventListener("mouseleave",t.mouseleave)}function v({id:t,elements:n,handlers:r}){let{element:s,measureElement:i}=n;s.addEventListener("click",r.click,{capture:!0}),s.addEventListener("contextmenu",r.contextmenu,{capture:!0}),s.addEventListener("mousemove",r.mousemove,{once:!0,capture:!0}),s.addEventListener("mousedown",r.mousedown,{capture:!0}),d.observe(i),e({type:"element/activate",id:t})}function b({id:t,elements:n,handlers:r}){let{element:s,measureElement:i}=n;g(s,r),d.unobserve(i),y=y.filter(e=>e!==s),e({type:"element/deactivate",id:t})}function w(t){if(!(!n&&!r||!s))for(let n of y){if(t===n){let n=a.get(t)?.sanity;if(!n||!eP(n))return;if(eU(t,n,u,a)){let n=t.style.cursor;n&&c.set(t,n),e({type:"overlay/setCursor",element:t,cursor:"move"});continue}}x(n)}}function x(t){let n=c.get(t);e({type:"overlay/setCursor",element:t,cursor:n})}function _(c){for(let d of function e(t){let n=[];function r(e,t,n,r){let s=ee(t);if(!s)return;let i=function e(t){let{display:n}=window.getComputedStyle(t);if("inline"!==n)return t;let r=t.parentElement;return r?e(r):null}(e);if(i)return{elements:{element:e,measureElement:i},sanity:s,reason:n,preventGrouping:r}}if(t)for(let s of t.childNodes)!function t(s,i){let o=function(t){let{nodeType:n,parentElement:s,textContent:i}=t;if(t.nodeType===Node.ELEMENT_NODE&&t.dataset?.sanityEditTarget!==void 0){let n=eL(e(t).map(e=>"element"===e.type?e.commonSanity:void 0).filter(e=>void 0!==e));if(n)return{reason:"edit-target",elements:{element:t,measureElement:t},sanity:n}}else if(n===Node.TEXT_NODE&&s&&i){let e=eR(i);return e?r(s,e,"stega-text",!0):void 0}else if(t.nodeType===Node.ELEMENT_NODE){if("SCRIPT"===t.tagName||"SANITY-VISUAL-EDITING"===t.tagName)return;if(t.dataset?.sanity)return r(t,t.dataset.sanity,"data-attribute",!!(t.textContent&&ej(t.textContent)));if(t.dataset?.sanityEditInfo)return r(t,t.dataset.sanityEditInfo,"data-attribute",!!(t.textContent&&ej(t.textContent)));if("IMG"===t.tagName){let e=eR(t.alt,!0);return e?r(t,e,"stega-attribute"):void 0}if("TIME"===t.tagName){let e=eR(t.dateTime,!0);return e?r(t,e,"stega-attribute"):void 0}if("SVG"===t.tagName.toUpperCase()){if(!t.ariaLabel)return;let e=eR(t.ariaLabel,!0);return e?r(t,e,"stega-attribute"):void 0}}}(s),a=i;if(s.nodeType===Node.ELEMENT_NODE&&s.dataset?.sanityEditGroup!==void 0&&(a={type:"group",elements:{element:s,measureElement:s},targets:[]},n.push(a)),o){let e={elements:o.elements,sanity:o.sanity,reason:o.reason};a&&!o.preventGrouping?a.targets.push(e):n.push({elements:o.elements,type:"element",targets:[e]})}if(s.nodeType===Node.ELEMENT_NODE&&"IMG"!==s.tagName&&"SCRIPT"!==s.tagName&&"SANITY-VISUAL-EDITING"!==s.tagName)for(let e of s.childNodes)t(e,a)}(s,void 0);return n.map(e=>{if(0===e.targets.length&&"group"===e.type)return{...e,commonSanity:void 0};let t=1===e.targets.length?e.targets[0].sanity:eL(e.targets.map(({s
3anity:e})=>e).filter(e=>void 0!==e))||e.targets[0].sanity;return t?{...e,commonSanity:t}:null}).filter(e=>null!==e)}(c)){if("group"===d.type){for(let e of d.targets){let t=a.get(e.elements.element);t&&"element"===t.type&&E(e.elements.element)}0===d.targets.length&&E(d.elements.element)}if(!d.commonSanity)continue;let{element:c}=d.elements;a.has(c)?function(t){let{element:n}=t.elements,r=a.get(n);r&&(a.set(n,{...r,sanity:t.commonSanity}),e({type:"element/update",elementType:r.type,id:r.id,rect:ep(n),sanity:t.commonSanity,targets:t.targets.map(e=>({sanity:e.sanity,element:e.elements.element}))}))}(d):function({type:c,elements:d,commonSanity:f,targets:g}){let{element:b,measureElement:_}=d,E={click(t){let r=t.target;if(b===m()&&b.contains(r)){n&&(t.preventDefault(),t.stopPropagation());let r=a.get(b)?.sanity;r&&!h&&e({type:"element/click",id:k,sanity:r})}},contextmenu(t){if(!("path"in f)||!n&&!r||!s||!f.path.split(".").pop()?.includes("[_key=="))return;let i=t.target;b===m()&&b.contains(i)&&((n||r)&&(t.preventDefault(),t.stopPropagation()),e({type:"element/contextmenu",id:k,position:{x:t.clientX,y:t.clientY},sanity:f}))},mousedown(t){if(t.preventDefault(),t.currentTarget!==y.at(-1)||b.getAttribute("data-sanity-drag-disable")||!n&&!r||!s)return;let i=a.get(b)?.sanity;if(!i||!eP(i)||!eC(i.path))return;let o=eU(b,f,u,a);o&&function(e){var t;let{mouseEvent:n,element:r,overlayGroup:s,handler:i,target:o,onSequenceStart:a,onSequenceEnd:u}=e;if(0!==n.button)return;window.focus();let l=s.map(e=>ep(e.elements.element)),c=r.getAttribute("data-sanity-drag-flow")||((t=l).some(e=>t.filter(t=>!eh(e,t)).some(t=>e.y===t.y))?"horizontal":"vertical"),d=r.getAttribute("data-sanity-drag-group"),p=!!r.getAttribute("data-sanity-drag-minimap-disable"),f=!!r.getAttribute("data-sanity-drag-prevent-default"),h=r.getAttribute("data-unstable_sanity-drag-document-height"),y=r.getAttribute("data-unstable_sanity-drag-group-height"),m=null,g=ex(n),v=document.body,{minYScaled:b,scaleFactor:w}=function(e,t){let n=t||ev(e).height,r=(n+=200)>window.innerHeight?window.innerHeight/n:1,{min:s}=ev(e.map(e=>eg(e,r,{x:window.innerWidth/2,y:0})));return{scaleFactor:r,minYScaled:s-100*r}}(l,y?~~y:null),x=!1,_=!1,E=!0;eI||(eO={body:{overflow:window.getComputedStyle(document.body).overflow,height:window.getComputedStyle(document.body).height},documentElement:{overflow:window.getComputedStyle(document.documentElement).overflow,height:window.getComputedStyle(document.documentElement).height}},eT=h?~~h:document.documentElement.scrollHeight);let k=setInterval(()=>{l=s.map(e=>ep(e.elements.element))},150),S=()=>{w>=1||(i({type:"overlay/dragUpdateSkeleton",skeleton:e_(eA,r,w)}),i({type:"overlay/dragToggleMinimapPrompt",display:!1}),eE(v,w,b,i,150).then(()=>{setTimeout(()=>{i({type:"overlay/dragUpdateGroupRect",groupRect:ek(l)})},300)}))},I=e=>{Math.abs(e.deltaY)>=10&&w<1&&!eI&&!_&&!p&&E&&(i({type:"overlay/dragToggleMinimapPrompt",display:!0}),_=!0),!e.shiftKey||eI||p||(window.dispatchEvent(new CustomEvent("unstable_sanity/dragApplyMinimap")),eI=!0,setTimeout(()=>{S()},50))},$=e=>{if(e.preventDefault(),e$=function(e){let t=document.body,n=window.getComputedStyle(t).transform;if("none"===n)return{x:e.x,y:e.y};let r=new DOMMatrix(n).inverse(),s=new DOMPoint(e.x,e.y).matrixTransform(r);return{x:s.x,y:s.y}}(eA=ex(e)),4>Math.abs(ey(eA,g)))return;if(!x){let e=ek(l),t=e_(eA,r,1);i({type:"overlay/dragStart",flow:c}),i({type:"overlay/dragUpdateSkeleton",skeleton:t}),i({type:"overlay/dragUpdateGroupRect",groupRect:e}),x=!0,a()}i({type:"overlay/dragUpdateCursorPosition",x:eA.x,y:eA.y}),!e.shiftKey||eI||p||(window.dispatchEvent(new CustomEvent("unstable_sanity/dragApplyMinimap")),eI=!0,setTimeout(()=>{S()},50));let t=function(e,t,n){if("horizontal"===n){let r={x1:e.x,y1:e.y,x2:e.x-1e8,y2:e.y},s={x1:e.x,y1:e.y,x2:e.x+1e8,y2:e.y};return{left:em(r,t,n),right:em(s,t,n)}}{let r={x1:e.x,y1:e.y,x2:e.x,y2:e.y-1e8},s={x1:e.x,y1:e.y,x2:e.x,y2:e.y+1e8};return{top:em(r,t,n),bottom:em(s,t,n)}}}(eA,l,c);JSON.stringify(m)!==JSON.stringify(t)&&i({type:"overlay/dragUpdateInsertPosition",insertPosition:ew(s,m=t,c)})},A=()=>{E=!1,i({type:"overlay/dragEnd",target:o,insertPosition:m?ew(s,m,c):null,dragGroup:d,flow:c,preventInsertDefault:f}),_&&i({type:"overlay/dragToggleMinimapPrompt",display:!1}),eI||(clearInterval(k),u(),j(),N()),M()},T=e=>{"Shift"===e.key&&eI&&(eI=!1,i({type:"overlay/dragUpdateSkeleton",skeleton:e_(eA,r,1/w)}),window.dispatchEvent(new CustomEvent("unstable_sanity/dragResetMinimap")),setTimeout(()=>{eS(e$.y,v,eT,i,150,eO)},50),i({type:"overlay/dragUpdateGroupRect",groupRect:null}),E||(clearInterval(k),M(),j(),N(),u()))},O=()=>{i({type:"overlay/dragUpdateGroupRect",groupRect:null}),window.dispatchEvent(new CustomEvent("unstable_sanity/dragResetMinimap")),setTimeout(()=>{eS(e$.y,v,eT,i,150,eO).then(()=>{eI=!1})},50),clearInterval(k),M(),j(),N(),u()},M=()=>{window.removeEventListener("mousemove",$),window.removeEventListener("wheel",I),window.removeEventListener("mouseup",A)},N=()=>{window.removeEventListener("keyup",T)},j=()=>{window.removeEventListener("blur",O)};window.addEventListener("blur",O),window.addEventListener("keyup",T),window.addEventListener("wheel",I),window.addEventListener("mousemove",$),window.addEventListener("mouseup",A)}({element:b,handler:e,mouseEvent:t,overlayGroup:o,target:i,onSequenceStart:()=>{h=!0},onSequenceEnd:()=>{setTimeout(()=>{h=!1},250)}})},mousemove(e){E.mouseenter(e);let t=e.currentTarget;t&&(t.addEventListener("mouseenter",E.mouseenter),t.addEventListener("mouseleave",E.mouseleave))},mouseenter(){document.querySelector("vercel-live-feedback")&&b.closest("[data-vercel-edit-info]")||b.closest("[data-vercel-edit-target]")||(y.push(b),e({type:"element/mouseenter",id:k,rect:ep(b)}),w(b))},mouseleave(n){function r(){y.pop();let t=m();if(e({type:"element/mouseleave",id:k}),t){w(t);let n=a.get(t);n&&e({type:"element/mouseenter",id:n.id,rect:ep(t)})}x(b)}let{relatedTarget:s}=n,i=eN(s),o=t.contains(i);if(eM(i)&&o)return function e(t){let n=s=>{let{relatedTarget:i}=s;eN(i)?i&&eM(i)&&(t.removeEventListener("mouseleave",n),e(i)):(t.removeEventListener("mouseleave",n),r())};t.addEventListener("mouseleave",n)}(i);r()}},k=ed(),S={type:c,id:k,elements:d,sanity:f,handlers:E};u.add(b),l.set(_,b),o.set(k,b),a.set(b,S),p?.observe(b),e({type:"element/register",elementType:c,id:k,element:b,rect:ep(b),sanity:f,dragDisabled:!!b.getAttribute("data-sanity-drag-disable"),targets:g.map(e=>({sanity:e.sanity,element:e.elements.element}))}),i&&v(S)}(d)}}function E(t){let n=a.get(t);if(n){let{id:r,handlers:s}=n;g(t,s),d.unobserve(t),a.delete(t),u.delete(t),o.delete(r),e({type:"element/unregister",id:r})}}function k(t){let n=a.get(t);n&&e({type:"element/updateRect",id:n.id,rect:ep(t)})}function S(e){if(i)for(let t of e){let{target:e}=t,n=eM(e)&&a.get(e);n&&(t.isIntersecting?v(n):b(n))}}function I(t){let n=eN(t.target);if(n){"capture"===n.dataset.sanityOverlayElement&&(t.preventDefault(),t.stopPropagation());return}y=[],e({type:"overlay/blur"})}function $(){y=[],e({type:"overlay/reset-mouse-state"})}function A(){for(let e of u)k(e)}function T(t){"Escape"===t.key&&(y=[],e({type:"overlay/blur"}))}function O(e){let{target:t}=e;if(!(t===window.document||!eM(t)))for(let e of u)t.contains(e)&&k(e)}function M(){i||(p=new IntersectionObserver(S,{threshold:.3}
3),u.forEach(e=>p.observe(e)),e({type:"overlay/activate"}),i=!0)}function N(){i&&(p?.disconnect(),u.forEach(e=>{let t=a.get(e);t&&b(t)}),e({type:"overlay/deactivate"}),i=!1)}function j(t){let{id:n}=t.detail,r=o.get(n);if(!r)return;let s=a.get(r)?.sanity;s&&e({type:"element/click",id:n,sanity:s})}return window.document.fonts.ready.then(()=>{for(let e of u)k(e)}),window.addEventListener("click",I),window.addEventListener("contextmenu",I),window.addEventListener("sanity-overlay/exclusive-plugin-closed",$),window.addEventListener("sanity-overlay/label-click",j),window.addEventListener("keydown",T),window.addEventListener("resize",A),window.addEventListener("scroll",O,{capture:!0,passive:!0}),d=new ResizeObserver(function(e){for(let t of e){let e=t.target;if(eM(e)){let t=l.get(e);if(!t)return;k(t)}}}),(f=new MutationObserver(function(e){let n=!1;for(let r of e){let{target:e,type:s}=r,i="characterData"===s?e.parentElement:e;if(!(i===t||t.contains(i))&&(n=!0,eM(i))){let e=i.parentElement?.closest("[data-sanity-edit-group]")||null;_({childNodes:[eM(e)?e:i]})}}if(n)for(let e of u)e.isConnected||E(e),a.get(e)?.type!=="group"||e.hasAttribute("data-sanity-edit-group")||E(e)})).observe(document.body,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),_(document.body),M(),{activate:M,deactivate:N,destroy:function(){window.removeEventListener("click",I),window.removeEventListener("contextmenu",I),window.removeEventListener("sanity-overlay/exclusive-plugin-closed",$),window.removeEventListener("sanity-overlay/label-click",j),window.removeEventListener("keydown",T),window.removeEventListener("resize",A),window.removeEventListener("scroll",O),f.disconnect(),d.disconnect(),u.forEach(e=>{E(e)}),o.clear(),u.clear(),y=[],N()}}},"sanityNodesExistInSameArray",0,eD,"useOptimistic",0,function(e,t){let n,r,s,i,o,a,p,f,h,y=(0,u.c)(17),[m,g]=(0,c.useState)(!0),[v,b]=(0,c.useState)(e),[w,x]=(0,c.useState)(null),[E,k]=(0,c.useState)(e),S=_(),I=(0,c.useRef)(null);y[0]!==t?(n=()=>{I.current=(e,n)=>(Array.isArray(t)?t:[t]).reduce((t,n)=>n(t,{document:e.document,id:(0,l.getPublishedId)(e.id),originalId:e.id,type:e.type}),n)},r=[t],y[0]=t,y[1]=n,y[2]=r):(n=y[1],r=y[2]),(0,c.useInsertionEffect)(n,r),y[3]!==e?(s=()=>k(e),y[3]=e,y[4]=s):s=y[4];let $=(0,c.useRef)(s);return y[5]!==e?(i=()=>{$.current=()=>k(e)},o=[e],y[5]=e,y[6]=i,y[7]=o):(i=y[6],o=y[7]),(0,c.useInsertionEffect)(i,o),y[8]!==S?(a=()=>{let e;if((0,d.isEmptyActor)(S))return;let t=S.on("rebased.local",t=>{let n={document:t.document,id:t.id,originalId:(0,l.getPublishedId)(t.id),type:"mutate"};b(e=>I.current?I.current(n,e):e),x(n),$.current(),g(!1),clearTimeout(e)}),n=S.on("pristine",()=>{e=setTimeout(()=>{(0,c.startTransition)(()=>g(!0))},15e3)});return()=>{t.unsubscribe(),n.unsubscribe()}},p=[S],y[8]=S,y[9]=a,y[10]=p):(a=y[9],p=y[10]),(0,c.useEffect)(a,p),y[11]!==w||y[12]!==E||y[13]!==e||y[14]!==m?(f=()=>{if(!m){if(!w)throw Error("No last event found when syncing passthrough");E!==e&&(0,c.startTransition)(()=>{b(I.current?I.current(w,e):e),k(e)})}},h=[w,E,e,m],y[11]=w,y[12]=E,y[13]=e,y[14]=m,y[15]=f,y[16]=h):(f=y[15],h=y[16]),(0,c.useEffect)(f,h),m?e:v},"v4",0,ed],523694)}]);

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.