var WorkerThread=function(e){function t(e){return i.has(e)?i.get(e):(i.set(e,a),s.push(e),a++)}function r(){let e=s;return s=[],e}function n(e,t){0<l&&e[58]&&(u=!0,d=d.concat(t),Promise.resolve().then(t=>{if(u){t=new Uint16Array(function(){let e=c;return c=[],e}().reduce((e,t)=>e.concat(t[8]),[])).buffer;let n=new Uint16Array(d).buffer;e.postMessage({54:l,12:2===l?3:2,37:t,41:r(),36:n},[t,n]),d=[],u=!1,l=2}}))}function o(e,r,o){o=Object.assign(Object.create(null),o);let a=Object.defineProperty;return a(o,"length",{get(){return Object.keys(this).length}}),a(o,"key",{value(e){let t=Object.keys(this);return 0<=e&&e<t.length?t[e]:null}}),a(o,"getItem",{value(e){return(e=this[e])?e:null}}),a(o,"setItem",{value(o,a){a=String(a),this[o]=a,n(e,[12,2,r,t(o)+1,t(a)+1])}}),a(o,"removeItem",{value(o){delete this[o],n(e,[12,2,r,t(o)+1,0])}}),a(o,"clear",{value(){Object.keys(this).forEach(e=>{delete this[e]}),n(e,[12,2,r,0,0])}}),o}let a=0,s=[],i=new Map,l=0,c=[],u=!1,d=[];let f={};class m{constructor(){this.removeGlobalEventListener=this.addGlobalEventListener=this.postMessage=this.defaultView=void 0,this[58]=!0,this[7]=-1,this.defaultView={document:this}}59(){l=2}}let h={Array:!0,ArrayBuffer:!0,BigInt:!0,BigInt64Array:!0,BigUint64Array:!0,Boolean:!0,Cache:!0,CustomEvent:!0,DataView:!0,Date:!0,Error:!0,EvalError:!0,Event:!0,EventTarget:!0,Float32Array:!0,Float64Array:!0,Function:!0,Infinity:!0,Int16Array:!0,Int32Array:!0,Int8Array:!0,Intl:!0,JSON:!0,Map:!0,Math:!0,NaN:!0,Number:!0,Object:!0,Promise:!0,Proxy:!0,RangeError:!0,ReferenceError:!0,Reflect:!0,RegExp:!0,Set:!0,String:!0,Symbol:!0,SyntaxError:!0,TextDecoder:!0,TextEncoder:!0,TypeError:!0,URIError:!0,URL:!0,Uint16Array:!0,Uint32Array:!0,Uint8Array:!0,Uint8ClampedArray:!0,WeakMap:!0,WeakSet:!0,WebAssembly:!0,WebSocket:!0,XMLHttpRequest:!0,atob:!0,addEventListener:!0,removeEventListener:!0,btoa:!0,caches:!0,clearInterval:!0,clearTimeout:!0,console:!0,decodeURI:!0,decodeURIComponent:!0,document:!0,encodeURI:!0,encodeURIComponent:!0,escape:!0,fetch:!0,indexedDB:!0,isFinite:!0,isNaN:!0,location:!0,navigator:!0,onerror:!0,onrejectionhandled:!0,onunhandledrejection:!0,parseFloat:!0,parseInt:!0,performance:!0,requestAnimationFrame:!0,cancelAnimationFrame:!0,self:!0,setTimeout:!0,setInterval:!0,unescape:!0},g=()=>{},y=function(e,t,r){const n=new m;return n.postMessage=e,n.addGlobalEventListener=t,n.removeGlobalEventListener=r,n.defaultView}(postMessage.bind(self)||g,addEventListener.bind(self)||g,removeEventListener.bind(self)||g);return function(){let e=self;for(;e&&e.constructor!==EventTarget;){let t=[],r=[];Object.getOwnPropertyNames(e).forEach(n=>{e:{var o=e;if(!h.hasOwnProperty(n))try{delete o[n];var a=!0;break e}catch(e){}a=!1}a?t.push(n):r.push(n)}),console.info(`Removed ${t.length} references from`,e,":",t),r.length&&console.info(`Failed to remove ${r.length} references from`,e,":",r),e=Object.getPrototypeOf(e)}}(),self.AMP=new class{constructor(e){this.document=e}getState(e=""){return new Promise(r=>{let o=t=>{11===(t=t.data)[12]&&t[74]===e&&(this.document.removeGlobalEventListener("message",o),r(t[21]))};this.document.addGlobalEventListener("message",o),n(this.document,[12,1,2,t(e)+1,0]),setTimeout(r,500,null)})}setState(e){let r;try{r=JSON.stringify(e)}catch(e){throw Error("AMP.setState only accepts valid JSON as input.")}n(this.document,[12,2,2,0,t(r)+1])}}(y.document),self.exportFunction=function(e,t){if(!e||""===e)throw Error("[worker-dom]: Attempt to export function was missing an identifier.");if("function"!=typeof t)throw Error(`[worker-dom]: Attempt to export non-function failed: ("${e}", ${typeof t}).`);if(e in f)throw Error(`[worker-dom]: Attempt to re-export function failed: "${e}".`);f[e]=t},addEventListener("message",e=>function(e,r){if(12===(e=e.data)[12]){var o=e[77],a=JSON.parse(e[78]),s=e[7];(e=f[o])?Promise.resolve(e).then(e=>e.apply(null,a)).then(e=>{n(r,[13,1,s,t(JSON.stringify(e))])},e=>{let a=JSON.stringify(e.message||e);n(r,[13,2,s,t(JSON.stringify({stack:e.stack||"",message:`[worker-dom]: Function "${o}" threw: "${a}"`}))])}):n(r,[13,2,s,t(JSON.stringify({stack:"",message:`[worker-dom]: Exported function "${o}" could not be found.`}))])}}(e,y.document)),e.hydrate=(e,t,r,n,a,s,i,l)=>{t=e.defaultView,i.storage?t.localStorage=o(e,0,i.storage):console.warn(i.errorMsg),l.storage?t.sessionStorage=o(e,1,l.storage):console.warn(l.errorMsg)},e.workerDOM=y,e}({});
//# sourceMappingURL=worker.nodom.mjs.map
