-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaoconnect.bundle.js
1 lines (1 loc) · 265 KB
/
aoconnect.bundle.js
1
var AOConnect;(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{AoDryRun:()=>Bl,AoMessage:()=>Il,AoMessageResult:()=>Ll,AoResult:()=>jl});var r=Object.create,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,u=(e,t)=>function(){return t||(0,e[a(e)[0]])((t={exports:{}}).exports,t),t.exports},c=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},l=(e,t,u)=>(u=null!=e?r(s(e)):{},((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of a(t))o.call(e,r)||undefined===r||n(e,r,{get:()=>t[r],enumerable:!(s=i(t,r))||s.enumerable});return e})(!t&&e&&e.__esModule?u:n(u,"default",{value:e,enumerable:!0}),e)),h=u({"node_modules/obliterator/iterator.js"(e,t){function r(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}"undefined"!=typeof Symbol&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var e=arguments,t=e.length,n=0;return new r((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},r.empty=function(){return new r((function(){return{done:!0}}))},r.fromSequence=function(e){var t=0,n=e.length;return new r((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},r.is=function(e){return e instanceof r||"object"==typeof e&&null!==e&&"function"==typeof e.next},t.exports=r}}),d=u({"node_modules/obliterator/support.js"(e){e.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,e.SYMBOL_SUPPORT="undefined"!=typeof Symbol}}),f=u({"node_modules/obliterator/foreach.js"(e,t){var r=d(),n=r.ARRAY_BUFFER_SUPPORT,i=r.SYMBOL_SUPPORT;t.exports=function(e,t){var r,a,s,o,u;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if("function"!=typeof t)throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||n&&ArrayBuffer.isView(e)||"string"==typeof e||"[object Arguments]"===e.toString())for(s=0,o=e.length;s<o;s++)t(e[s],s);else if("function"!=typeof e.forEach)if(i&&Symbol.iterator in e&&"function"!=typeof e.next&&(e=e[Symbol.iterator]()),"function"!=typeof e.next)for(a in e)e.hasOwnProperty(a)&&t(e[a],a);else for(r=e,s=0;!0!==(u=r.next()).done;)t(u.value,s),s++;else e.forEach(t)}}}),p=u({"node_modules/mnemonist/utils/typed-arrays.js"(e){var t=Math.pow(2,8)-1,r=Math.pow(2,16)-1,n=Math.pow(2,32)-1,i=Math.pow(2,7)-1,a=Math.pow(2,15)-1,s=Math.pow(2,31)-1;e.getPointerArray=function(e){var i=e-1;if(i<=t)return Uint8Array;if(i<=r)return Uint16Array;if(i<=n)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},e.getSignedPointerArray=function(e){var t=e-1;return t<=i?Int8Array:t<=a?Int16Array:t<=s?Int32Array:Float64Array},e.getNumberType=function(e){return e===(0|e)?-1===Math.sign(e)?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var o={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(t,r){var n,i,a,s,u,c=null,l=0;for(s=0,u=t.length;s<u;s++)a=r?r(t[s]):t[s],i=e.getNumberType(a),(n=o[i.name])>l&&(l=n,c=i);return c},e.isTypedArray=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView(e)},e.concat=function(){var e,t,r,n=0;for(e=0,r=arguments.length;e<r;e++)n+=arguments[e].length;var i=new arguments[0].constructor(n);for(e=0,t=0;e<r;e++)i.set(arguments[e],t),t+=arguments[e].length;return i},e.indices=function(t){for(var r=new(e.getPointerArray(t))(t),n=0;n<t;n++)r[n]=n;return r}}}),g=u({"node_modules/mnemonist/utils/iterables.js"(e){var t=f(),r=p();function n(e){return"number"==typeof e.length?e.length:"number"==typeof e.size?e.size:void 0}e.isArrayLike=function(e){return Array.isArray(e)||r.isTypedArray(e)},e.guessLength=n,e.toArray=function(e){var r=n(e),i="number"==typeof r?new Array(r):[],a=0;return t(e,(function(e){i[a++]=e})),i},e.toArrayWithIndices=function(e){var i=n(e),a="number"==typeof i?r.getPointerArray(i):Array,s="number"==typeof i?new Array(i):[],o="number"==typeof i?new a(i):[],u=0;return t(e,(function(e){s[u]=e,o[u]=u++})),[s,o]}}}),y=u({"node_modules/mnemonist/lru-cache.js"(e,t){var r=h(),n=f(),i=p(),a=g();function s(e,t,r){if(arguments.length<2&&(r=e,e=null,t=null),this.capacity=r,"number"!=typeof this.capacity||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var n=i.getPointerArray(r);this.forward=new n(r),this.backward=new n(r),this.K="function"==typeof e?new e(r):new Array(r),this.V="function"==typeof t?new t(r):new Array(r),this.size=0,this.head=0,this.tail=0,this.items={}}s.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},s.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var r=this.backward[e],n=this.forward[e];return this.tail===e?this.tail=r:this.backward[n]=r,this.forward[r]=n,this.backward[t]=e,this.head=e,this.forward[e]=t,this},s.prototype.set=function(e,t){var r=this.items[e];if(void 0!==r)return this.splayOnTop(r),void(this.V[r]=t);this.size<this.capacity?r=this.size++:(r=this.tail,this.tail=this.backward[r],delete this.items[this.K[r]]),this.items[e]=r,this.K[r]=e,this.V[r]=t,this.forward[r]=this.head,this.backward[this.head]=r,this.head=r},s.prototype.setpop=function(e,t){var r=null,n=null,i=this.items[e];return void 0!==i?(this.splayOnTop(i),r=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:r}):(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],r=this.V[i],n=this.K[i],delete this.items[n]),this.items[e]=i,this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,n?{evicted:!0,key:n,value:r}:null)},s.prototype.has=function(e){return e in this.items},s.prototype.get=function(e){var t=this.items[e];if(void 0!==t)return this.splayOnTop(t),this.V[t]},s.prototype.peek=function(e){var t=this.items[e];if(void 0!==t)return this.V[t]},s.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var r=0,n=this.size,i=this.head,a=this.K,s=this.V,o=this.forward;r<n;)e.call(t,s[i],a[i],this),i=o[i],r++},s.prototype.keys=function(){var e=0,t=this.size,n=this.head,i=this.K,a=this.forward;return new r((function(){if(e>=t)return{done:!0};var r=i[n];return++e<t&&(n=a[n]),{done:!1,value:r}}))},s.prototype.values=function(){var e=0,t=this.size,n=this.head,i=this.V,a=this.forward;return new r((function(){if(e>=t)return{done:!0};var r=i[n];return++e<t&&(n=a[n]),{done:!1,value:r}}))},s.prototype.entries=function(){var e=0,t=this.size,n=this.head,i=this.K,a=this.V,s=this.forward;return new r((function(){if(e>=t)return{done:!0};var r=i[n],o=a[n];return++e<t&&(n=s[n]),{done:!1,value:[r,o]}}))},"undefined"!=typeof Symbol&&(s.prototype[Symbol.iterator]=s.prototype.entries),s.prototype.inspect=function(){for(var e,t=new Map,r=this.entries();!(e=r.next()).done;)t.set(e.value[0],e.value[1]);return Object.defineProperty(t,"constructor",{value:s,enumerable:!1}),t},"undefined"!=typeof Symbol&&(s.prototype[Symbol.for("nodejs.util.inspect.custom")]=s.prototype.inspect),s.from=function(e,t,r,i){if(arguments.length<2){if("number"!=typeof(i=a.guessLength(e)))throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else 2===arguments.length&&(i=t,t=null,r=null);var o=new s(t,r,i);return n(e,(function(e,t){o.set(t,e)})),o},t.exports=s}}),m=u({"node_modules/mnemonist/lru-map.js"(e,t){var r=y(),n=f(),i=p(),a=g();function s(e,t,r){if(arguments.length<2&&(r=e,e=null,t=null),this.capacity=r,"number"!=typeof this.capacity||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var n=i.getPointerArray(r);this.forward=new n(r),this.backward=new n(r),this.K="function"==typeof e?new e(r):new Array(r),this.V="function"==typeof t?new t(r):new Array(r),this.size=0,this.head=0,this.tail=0,this.items=new Map}s.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},s.prototype.set=function(e,t){var r=this.items.get(e);if(void 0!==r)return this.splayOnTop(r),void(this.V[r]=t);this.size<this.capacity?r=this.size++:(r=this.tail,this.tail=this.backward[r],this.items.delete(this.K[r])),this.items.set(e,r),this.K[r]=e,this.V[r]=t,this.forward[r]=this.head,this.backward[this.head]=r,this.head=r},s.prototype.setpop=function(e,t){var r=null,n=null,i=this.items.get(e);return void 0!==i?(this.splayOnTop(i),r=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:r}):(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],r=this.V[i],n=this.K[i],this.items.delete(n)),this.items.set(e,i),this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,n?{evicted:!0,key:n,value:r}:null)},s.prototype.has=function(e){return this.items.has(e)},s.prototype.get=function(e){var t=this.items.get(e);if(void 0!==t)return this.splayOnTop(t),this.V[t]},s.prototype.peek=function(e){var t=this.items.get(e);if(void 0!==t)return this.V[t]},s.prototype.splayOnTop=r.prototype.splayOnTop,s.prototype.forEach=r.prototype.forEach,s.prototype.keys=r.prototype.keys,s.prototype.values=r.prototype.values,s.prototype.entries=r.prototype.entries,"undefined"!=typeof Symbol&&(s.prototype[Symbol.iterator]=s.prototype.entries),s.prototype.inspect=r.prototype.inspect,s.from=function(e,t,r,i){if(arguments.length<2){if("number"!=typeof(i=a.guessLength(e)))throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else 2===arguments.length&&(i=t,t=null,r=null);var o=new s(t,r,i);return n(e,(function(e,t){o.set(t,e)})),o},t.exports=s}}),v=u({"node_modules/ms/index.js"(e,t){var r=1e3,n=60*r,i=60*n,a=24*i,s=7*a;function o(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var u,c,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var o=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return o*s;case"days":case"day":case"d":return o*a;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return o*n;case"seconds":case"second":case"secs":case"sec":case"s":return o*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}(e);if("number"===l&&isFinite(e))return t.long?(u=e,(c=Math.abs(u))>=a?o(u,c,a,"day"):c>=i?o(u,c,i,"hour"):c>=n?o(u,c,n,"minute"):c>=r?o(u,c,r,"second"):u+" ms"):function(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+"d":t>=i?Math.round(e/i)+"h":t>=n?Math.round(e/n)+"m":t>=r?Math.round(e/r)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),_=u({"node_modules/debug/src/common.js"(e,t){t.exports=function(e){function t(e){let n,i,a,s=null;function o(...e){if(!o.enabled)return;const r=o,i=Number(new Date),a=i-(n||i);r.diff=a,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";s++;const a=t.formatters[i];if("function"==typeof a){const t=e[s];n=a.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,a=t.enabled(e)),a),set:e=>{s=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=v(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}}}),w=u({"node_modules/debug/src/browser.js"(e,t){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),e.splice(i,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(e){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=_()(e);var{formatters:r}=t.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}}),b=u({"node_modules/base64-js/index.js"(e){e.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},e.toByteArray=function(e){var t,r,a=s(e),o=a[0],u=a[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,u)),l=0,h=u>0?o-4:o;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},e.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],s=16383,u=0,c=n-i;u<c;u+=s)a.push(o(e,u,u+s>c?c:u+s));return 1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),a.join("")};var t,r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(t=0;t<64;++t)r[t]=a[t],n[a.charCodeAt(t)]=t;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function o(e,t,n){for(var i,a,s=[],o=t;o<n;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(r[(a=i)>>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}}),x=u({"node_modules/ieee754/index.js"(e){e.read=function(e,t,r,n,i){var a,s,o=8*i-n-1,u=(1<<o)-1,c=u>>1,l=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,a=f&(1<<-l)-1,f>>=-l,l+=o;l>0;a=256*a+e[t+h],h+=d,l-=8);for(s=a&(1<<-l)-1,a>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===a)a=1-c;else{if(a===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),a-=c}return(f?-1:1)*s*Math.pow(2,a-n)},e.write=function(e,t,r,n,i,a){var s,o,u,c=8*a-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:a-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(o=0,s=l):s+h>=1?(o=(t*u-1)*Math.pow(2,i),s+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&o,f+=p,o/=256,i-=8);for(s=s<<i|o,c+=i;c>0;e[r+f]=255&s,f+=p,s/=256,c-=8);e[r+f-p]|=128*g}}}),E=u({"node_modules/buffer/index.js"(e){var t=b(),r=x(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},e.INSPECT_MAX_BYTES=50;var i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return o(e,t,r)}function o(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|f(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);const i=function(e){if(s.isBuffer(e)){const t=0|d(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?a(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|d(e))}function l(e){const t=e.length<0?0:0|d(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,s.prototype),n}function d(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(i)return n?-1:G(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Y(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){let a,s=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,o/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(a=r;a<o;a++)if(c(e,a)===c(t,-1===n?0:a-n)){if(-1===n&&(n=a),a-n+1===u)return n*s}else-1!==n&&(a-=a-n),n=-1}else for(r+u>o&&(r=o-u),a=r;a>=0;a--){let r=!0;for(let n=0;n<u;n++)if(c(e,a+n)!==c(t,n)){r=!1;break}if(r)return a}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const a=t.length;let s;for(n>a/2&&(n=a/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Y(n))return s;e[r+s]=n}return s}function _(e,t,r,n){return H(G(t,e.length-r),e,r,n)}function w(e,t,r,n){return H(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return H(W(t),e,r,n)}function A(e,t,r,n){return H(function(e,t){let r,n,i;const a=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function k(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function T(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let a=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,o,u;switch(s){case 1:t<128&&(a=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(a=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(a=u));break;case 4:r=e[i+1],n=e[i+2],o=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&o)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&o,u>65535&&u<1114112&&(a=u))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return function(e){const t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=S));return r}(n)}e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return o(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=s.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(q(t,Uint8Array))i+t.length>n.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0);const u=Math.min(a,o),c=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<u;++e)if(c[e]!==l[e]){a=c[e],o=l[e];break}return a<o?-1:o<a?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function O(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function C(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Q[e[n]];return i}function I(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function j(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,r,n,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i){D(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function U(e,t,r,n,i){D(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a>>=8,e[r+6]=a,a>>=8,e[r+5]=a,a>>=8,e[r+4]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function P(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,n,i,a){return t=+t,n>>>=0,a||P(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function Z(e,t,n,i,a){return t=+t,n>>>=0,a||P(e,0,n,8),r.write(e,t,n,i,52,8),n+8}s.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);let n=this[e],i=1,a=0;for(;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||j(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=J((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=J((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);let n=this[e],i=1,a=0;for(;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||j(e,t,this.length);let n=t,i=1,a=this[e+--n];for(;n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||j(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||j(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=J((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),s.prototype.readBigInt64BE=J((function(e){z(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||j(e,4,this.length),r.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||j(e,4,this.length),r.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||j(e,8,this.length),r.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||j(e,8,this.length),r.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||L(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||L(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=J((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=J((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);L(this,e,t,r,n-1,-n)}let i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=J((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=J((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return Z(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return Z(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const a=s.isBuffer(e)?e:s.from(e,n),o=a.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%o]}return this};var M={};function F(e,t,r){M[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function $(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function D(e,t,r,n,i,a){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=a>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(a+1)}${n}`:`>= -(2${n} ** ${8*(a+1)-1}${n}) and < 2 ** ${8*(a+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new M.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){z(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||V(t,e.length-(r+1))}(n,i,a)}function z(e,t){if("number"!=typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,r){if(Math.floor(e)!==e)throw z(e,r),new M.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=$(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=$(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);var K=/[^+/0-9A-Za-z-_]/g;function G(e,t){let r;t=t||1/0;const n=e.length;let i=null;const a=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function W(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}var Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function J(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}}}),A={"@@functional/placeholder":!0};function k(e){return e===A}function T(e){return function t(r){return 0===arguments.length||k(r)?t:e.apply(this,arguments)}}function S(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return k(r)?t:T((function(t){return e(r,t)}));default:return k(r)&&k(n)?t:k(r)?T((function(t){return e(t,n)})):k(n)?T((function(t){return e(r,t)})):e(r,n)}}}function O(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,r){return t.apply(this,arguments)};case 3:return function(e,r,n){return t.apply(this,arguments)};case 4:return function(e,r,n,i){return t.apply(this,arguments)};case 5:return function(e,r,n,i,a){return t.apply(this,arguments)};case 6:return function(e,r,n,i,a,s){return t.apply(this,arguments)};case 7:return function(e,r,n,i,a,s,o){return t.apply(this,arguments)};case 8:return function(e,r,n,i,a,s,o,u){return t.apply(this,arguments)};case 9:return function(e,r,n,i,a,s,o,u,c){return t.apply(this,arguments)};case 10:return function(e,r,n,i,a,s,o,u,c,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function C(e,t,r){return function(){for(var n=[],i=0,a=e,s=0,o=!1;s<t.length||i<arguments.length;){var u;s<t.length&&(!k(t[s])||i>=arguments.length)?u=t[s]:(u=arguments[i],i+=1),n[s]=u,k(u)?o=!0:a-=1,s+=1}return!o&&a<=0?r.apply(this,n):O(Math.max(0,a),C(e,n,r))}}var R=S((function(e,t){return 1===e?T(t):O(e,C(e,[],t))})),I=R;function j(e){return function t(r,n,i){switch(arguments.length){case 0:return t;case 1:return k(r)?t:S((function(t,n){return e(r,t,n)}));case 2:return k(r)&&k(n)?t:k(r)?S((function(t,r){return e(t,n,r)})):k(n)?S((function(t,n){return e(r,t,n)})):T((function(t){return e(r,n,t)}));default:return k(r)&&k(n)&&k(i)?t:k(r)&&k(n)?S((function(t,r){return e(t,r,i)})):k(r)&&k(i)?S((function(t,r){return e(t,n,r)})):k(n)&&k(i)?S((function(t,n){return e(r,t,n)})):k(r)?T((function(t){return e(t,n,i)})):k(n)?T((function(t){return e(r,t,i)})):k(i)?T((function(t){return e(r,n,t)})):e(r,n,i)}}}var L=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};function B(e,t,r){return function(){if(0===arguments.length)return r();var n=arguments[arguments.length-1];if(!L(n)){for(var i=0;i<e.length;){if("function"==typeof n[e[i]])return n[e[i]].apply(n,Array.prototype.slice.call(arguments,0,-1));i+=1}if(function(e){return null!=e&&"function"==typeof e["@@transducer/step"]}(n))return t.apply(null,Array.prototype.slice.call(arguments,0,-1))(n)}return r.apply(this,arguments)}}var U=function(){return this.xf["@@transducer/init"]()},P=function(e){return this.xf["@@transducer/result"](e)};function N(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function Z(e,t,r){for(var n=0,i=r.length;n<i;){if(e(t,r[n]))return!0;n+=1}return!1}function M(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var F="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},$=Object.prototype.toString,D=function(){return"[object Arguments]"===$.call(arguments)?function(e){return"[object Arguments]"===$.call(e)}:function(e){return M("callee",e)}}(),z=D,V=!{toString:null}.propertyIsEnumerable("toString"),K=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],G=function(){return arguments.propertyIsEnumerable("length")}(),W=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1},H="function"!=typeof Object.keys||G?T((function(e){if(Object(e)!==e)return[];var t,r,n=[],i=G&&z(e);for(t in e)M(t,e)&&(!i||"length"!==t)&&(n[n.length]=t);if(V)for(r=K.length-1;r>=0;)M(t=K[r],e)&&!W(n,t)&&(n[n.length]=t),r-=1;return n})):T((function(e){return Object(e)!==e?[]:Object.keys(e)})),q=H,Y=T((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)})),Q=Y;function J(e,t,r,n){var i=N(e);function a(e,t){return X(e,t,r.slice(),n.slice())}return!Z((function(e,t){return!Z(a,t,e)}),N(t),i)}function X(e,t,r,n){if(F(e,t))return!0;var i=Q(e);if(i!==Q(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!F(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!F(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var a=r.length-1;a>=0;){if(r[a]===e)return n[a]===t;a-=1}switch(i){case"Map":return e.size===t.size&&J(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&J(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var s=q(e);if(s.length!==q(t).length)return!1;var o=r.concat([e]),u=n.concat([t]);for(a=s.length-1;a>=0;){var c=s[a];if(!M(c,t)||!X(t[c],e[c],o,u))return!1;a-=1}return!0}var ee=S((function(e,t){return X(e,t,[],[])})),te=ee;function re(e,t){for(var r=0,n=t.length,i=Array(n);r<n;)i[r]=e(t[r]),r+=1;return i}function ne(e){return'"'+e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var ie=function(e){return(e<10?"0":"")+e},ae="function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+ie(e.getUTCMonth()+1)+"-"+ie(e.getUTCDate())+"T"+ie(e.getUTCHours())+":"+ie(e.getUTCMinutes())+":"+ie(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},se=ae;function oe(e,t,r){for(var n=0,i=r.length;n<i;)t=e(t,r[n]),n+=1;return t}var ue=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=U,e.prototype["@@transducer/result"]=P,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}(),ce=S(B(["fantasy-land/filter","filter"],(function(e){return function(t){return new ue(e,t)}}),(function(e,t){return function(e){return"[object Object]"===Object.prototype.toString.call(e)}(t)?oe((function(r,n){return e(t[n])&&(r[n]=t[n]),r}),{},q(t)):function(e,t){for(var r=0,n=t.length,i=[];r<n;)e(t[r])&&(i[i.length]=t[r]),r+=1;return i}(e,t)}))),le=ce,he=S((function(e,t){return le((r=e,function(){return!r.apply(this,arguments)}),t);var r})),de=he;function fe(e,t){var r=function(r){var n=t.concat([e]);return function(e,t){return function(e,t,r){var n,i;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(n=1/t;r<e.length;){if(0===(i=e[r])&&1/i===n)return r;r+=1}return-1}if(t!=t){for(;r<e.length;){if("number"==typeof(i=e[r])&&i!=i)return r;r+=1}return-1}return e.indexOf(t,r);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,r);case"object":if(null===t)return e.indexOf(t,r)}for(;r<e.length;){if(te(e[r],t))return r;r+=1}return-1}(t,e,0)>=0}(r,n)?"<Circular>":fe(r,n)},n=function(e,t){return re((function(t){return ne(t)+": "+r(e[t])}),t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+re(r,e).join(", ")+"))";case"[object Array]":return"["+re(r,e).concat(n(e,de((function(e){return/^\d+$/.test(e)}),q(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+r(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?r(NaN):ne(se(e)))+")";case"[object Map]":return"new Map("+r(Array.from(e))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+r(e.valueOf())+")":1/e==-1/0?"-0":e.toString(10);case"[object Set]":return"new Set("+r(Array.from(e).sort())+")";case"[object String]":return"object"==typeof e?"new String("+r(e.valueOf())+")":ne(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var i=e.toString();if("[object Object]"!==i)return i}return"{"+n(e,q(e)).join(", ")+"}"}}var pe=T((function(e){return fe(e,[])})),ge=pe,ye=S((function(e,t){if(e===t)return t;function r(e,t){if(e>t!=t>e)return t>e?t:e}var n=r(e,t);if(void 0!==n)return n;var i=r(typeof e,typeof t);if(void 0!==i)return i===typeof e?e:t;var a=ge(e),s=r(a,ge(t));return void 0!==s&&s===a?e:t})),me=ye,ve=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=U,e.prototype["@@transducer/result"]=P,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}(),_e=S(B(["fantasy-land/map","map"],(function(e){return function(t){return new ve(e,t)}}),(function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return I(t.length,(function(){return e.call(this,t.apply(this,arguments))}));case"[object Object]":return oe((function(r,n){return r[n]=e(t[n]),r}),{},q(t));default:return re(e,t)}}))),we=_e,be=Number.isInteger||function(e){return(0|e)===e};function xe(e){return"[object String]"===Object.prototype.toString.call(e)}function Ee(e,t){var r=e<0?t.length+e:e;return xe(t)?t.charAt(r):t[r]}var Ae,ke,Te,Se=S((function(e,t){if(null!=t)return be(e)?Ee(e,t):t[e]})),Oe=Se,Ce=S((function(e,t){return we(Oe(e),t)})),Re=Ce,Ie=T((function(e){return!!L(e)||!(!e||"object"!=typeof e||xe(e))&&(0===e.length||e.length>0&&e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1))})),je=Ie,Le=typeof Symbol<"u"?Symbol.iterator:"@@iterator",Be=S((function(e,t){return O(e.length,(function(){return e.apply(t,arguments)}))})),Ue=Be,Pe=(Ae=function(e,t,r){for(var n=0,i=r.length;n<i;){if((t=e["@@transducer/step"](t,r[n]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n+=1}return e["@@transducer/result"](t)},ke=function(e,t,r,n){return e["@@transducer/result"](r[n](Ue(e["@@transducer/step"],e),t))},Te=function(e,t,r){for(var n=r.next();!n.done;){if((t=e["@@transducer/step"](t,n.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n=r.next()}return e["@@transducer/result"](t)},function(e,t,r){if(je(r))return Ae(e,t,r);if(null==r)return t;if("function"==typeof r["fantasy-land/reduce"])return ke(e,t,r,"fantasy-land/reduce");if(null!=r[Le])return Te(e,t,r[Le]());if("function"==typeof r.next)return Te(e,t,r);if("function"==typeof r.reduce)return ke(e,t,r,"reduce");throw new TypeError("reduce: list must be array or iterable")}),Ne=Pe,Ze=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),Me=j((function(e,t,r){return Ne("function"==typeof e?function(e){return new Ze(e)}(e):e,t,r)})),Fe=Me;function $e(e,t){return function(){return t.call(this,e.apply(this,arguments))}}function De(e,t){return function(){var r=arguments.length;if(0===r)return t();var n=arguments[r-1];return L(n)||"function"!=typeof n[e]?t.apply(this,arguments):n[e].apply(n,Array.prototype.slice.call(arguments,0,r-1))}}var ze=j(De("slice",(function(e,t,r){return Array.prototype.slice.call(r,e,t)}))),Ve=T(De("tail",ze(1,1/0)));function Ke(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return O(arguments[0].length,Fe($e,arguments[0],Ve(arguments)))}var Ge=S((function(e,t){return I(Fe(me,0,Re("length",t)),(function(){var r=arguments,n=this;return e.apply(n,re((function(e){return e.apply(n,r)}),t))}))})),We=Ge,He=S((function(e,t){return null==t||t!=t?e:t})),qe=He,Ye=function(){function e(e,t){this.xf=t,this.f=e,this.found=!1}return e.prototype["@@transducer/init"]=U,e.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.found=!0,e=function(e){return e&&e["@@transducer/reduced"]?e:{"@@transducer/value":e,"@@transducer/reduced":!0}}(this.xf["@@transducer/step"](e,t))),e},e}(),Qe=S(B(["find"],(function(e){return function(t){return new Ye(e,t)}}),(function(e,t){for(var r=0,n=t.length;r<n;){if(e(t[r]))return t[r];r+=1}}))),Je=Qe,Xe=T((function(e){return We((function(){return Array.prototype.slice.call(arguments,0)}),e)})),et=Xe,tt=S((function(e,t){for(var r=t,n=0;n<e.length;n+=1){if(null==r)return;var i=e[n];r=be(i)?Ee(i,r):r[i]}return r})),rt=tt,nt=j((function(e,t,r){return te(e,Oe(t,r))})),it=nt,at=class extends Error{name="InvalidSchedulerLocation"},st=class extends Error{name="SchedulerTagNotFound"},ot=class extends Error{name="TransactionNotFound"};function ut(e=""){return(e=e.trim()).endsWith("/")?ut(e.slice(0,-1)):e}var ct=e=>{if(e.ok)return e;throw e},lt=e=>Ke(qe([]),Je(it(e,"name")),qe({}),Oe("value")),ht=e=>Ke((t=>{if(!t)throw new ot(e);return t}),Oe("tags"),qe([]));function dt({fetch:e,GRAPHQL_URL:t,GRAPHQL_MAX_RETRIES:r=0,GRAPHQL_RETRY_BACKOFF:n=300}){return async({query:i,variables:a})=>((e,{maxRetries:t=0,delay:r=300})=>{let n=(r,i)=>Promise.resolve().then(e).catch((e=>{if(r>=t)return Promise.reject(e);let a=r+1,s=i+i;return new Promise((e=>setTimeout(e,i))).then((()=>n(a,s)))}));return n(0,r)})((()=>e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:i,variables:a})}).then(ct).then((e=>e.json()))),{maxRetries:r,delay:n})}function ft({fetch:e,GRAPHQL_URL:t,GRAPHQL_MAX_RETRIES:r,GRAPHQL_RETRY_BACKOFF:n}){let i=dt({fetch:e,GRAPHQL_URL:t,GRAPHQL_MAX_RETRIES:r,GRAPHQL_RETRY_BACKOFF:n}),a=pt({fetch:e,GRAPHQL_URL:t,GRAPHQL_MAX_RETRIES:r,GRAPHQL_RETRY_BACKOFF:n});return async e=>i({query:"\n query GetTransactions ($transactionIds: [ID!]!) {\n transactions(ids: $transactionIds) {\n edges {\n node {\n tags {\n name\n value\n }\n }\n }\n }\n }\n ",variables:{transactionIds:[e]}}).then(rt(["data","transactions","edges","0","node"])).then(ht(`Process ${e} was not found on gateway`)).then(lt("Scheduler")).then((e=>{if(!e)throw new st('No "Scheduler" tag found on process');return a(e)}))}function pt({fetch:e,GRAPHQL_URL:t,GRAPHQL_MAX_RETRIES:r,GRAPHQL_RETRY_BACKOFF:n}){let i=dt({fetch:e,GRAPHQL_URL:t,GRAPHQL_MAX_RETRIES:r,GRAPHQL_RETRY_BACKOFF:n});return async e=>i({query:'\n query GetSchedulerLocation ($owner: String!) {\n transactions (\n owners: [$owner]\n tags: [\n { name: "Data-Protocol", values: ["ao"] },\n { name: "Type", values: ["Scheduler-Location"] }\n ]\n # Only need the most recent Scheduler-Location\n sort: HEIGHT_DESC\n first: 1\n ) {\n edges {\n node {\n tags {\n name\n value\n }\n }\n }\n }\n }\n ',variables:{owner:e}}).then(rt(["data","transactions","edges","0","node"])).then(ht(`Could not find 'Scheduler-Location' owner by wallet ${e}`)).then(et([lt("Url"),lt("Time-To-Live")])).then((([t,r])=>{if(!t)throw new at('No "Url" tag found on Scheduler-Location');if(!r)throw new at('No "Time-To-Live" tag found on Scheduler-Location');return{url:t,ttl:r,address:e}}))}var gt="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,yt=new Set,mt="object"==typeof process&&process?process:{},vt=(e,t,r,n)=>{"function"==typeof mt.emitWarning?mt.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},_t=globalThis.AbortController,wt=globalThis.AbortSignal;if(typeof _t>"u"){wt=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},_t=class{constructor(){t()}signal=new wt;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==mt.env?.LRU_CACHE_IGNORE_AC_WARNING,t=()=>{e&&(e=!1,vt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}Symbol("type");var bt,xt,Et=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),At=e=>Et(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?kt:null:null,kt=class extends Array{constructor(e){super(e),this.fill(0)}},Tt=class e{heap;length;static#e=!1;static create(t){let r=At(t);if(!r)return[];e.#e=!0;let n=new e(t,r);return e.#e=!1,n}constructor(t,r){if(!e.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},St=class e{#e;#t;#r;#n;#i;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#s;#o;#u;#c;#l;#h;#d;#f;#p;#g;#y;#m;#v;#_;#w;#b;static unsafeExposeInternals(e){return{starts:e.#m,ttls:e.#v,sizes:e.#y,keyMap:e.#o,keyList:e.#u,valList:e.#c,next:e.#l,prev:e.#h,get head(){return e.#d},get tail(){return e.#f},free:e.#p,isBackgroundFetch:t=>e.#x(t),backgroundFetch:(t,r,n,i)=>e.#E(t,r,n,i),moveToTail:t=>e.#A(t),indexes:t=>e.#k(t),rindexes:t=>e.#T(t),isStale:t=>e.#S(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#s}get size(){return this.#a}get fetchMethod(){return this.#i}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(t){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:u,dispose:c,disposeAfter:l,noDisposeOnSet:h,noUpdateTTL:d,maxSize:f=0,maxEntrySize:p=0,sizeCalculation:g,fetchMethod:y,noDeleteOnFetchRejection:m,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:w,ignoreFetchAbort:b}=t;if(0!==r&&!Et(r))throw new TypeError("max option must be a nonnegative integer");let x=r?At(r):Array;if(!x)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=f,this.maxEntrySize=p||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw new TypeError("fetchMethod must be a function if specified");if(this.#i=y,this.#w=!!y,this.#o=new Map,this.#u=new Array(r).fill(void 0),this.#c=new Array(r).fill(void 0),this.#l=new x(r),this.#h=new x(r),this.#d=0,this.#f=0,this.#p=Tt.create(r),this.#a=0,this.#s=0,"function"==typeof c&&(this.#r=c),"function"==typeof l?(this.#n=l,this.#g=[]):(this.#n=void 0,this.#g=void 0),this.#_=!!this.#r,this.#b=!!this.#n,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!m,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!b,0!==this.maxEntrySize){if(0!==this.#t&&!Et(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!Et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Et(i)||0===i?i:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!Et(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#C()}if(0===this.#e&&0===this.ttl&&0===this.#t)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t="LRU_CACHE_UNBOUNDED";(e=>!yt.has(e))(t)&&(yt.add(t),vt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,e))}}getRemainingTTL(e){return this.#o.has(e)?1/0:0}#C(){let e=new kt(this.#e),t=new kt(this.#e);this.#v=e,this.#m=t,this.#R=(r,n,i=gt.now())=>{if(t[r]=0!==n?i:0,e[r]=n,0!==n&&this.ttlAutopurge){let e=setTimeout((()=>{this.#S(r)&&this.delete(this.#u[r])}),n+1);e.unref&&e.unref()}},this.#I=r=>{t[r]=0!==e[r]?gt.now():0},this.#j=(i,a)=>{if(e[a]){let s=e[a],o=t[a];if(!s||!o)return;i.ttl=s,i.start=o,i.now=r||n();let u=i.now-o;i.remainingTTL=s-u}};let r=0,n=()=>{let e=gt.now();if(this.ttlResolution>0){r=e;let t=setTimeout((()=>r=0),this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=i=>{let a=this.#o.get(i);if(void 0===a)return 0;let s=e[a],o=t[a];return s&&o?s-((r||n())-o):1/0},this.#S=i=>{let a=t[i],s=e[i];return!!s&&!!a&&(r||n())-a>s}}#I=()=>{};#j=()=>{};#R=()=>{};#S=()=>!1;#O(){let e=new kt(this.#e);this.#s=0,this.#y=e,this.#L=t=>{this.#s-=e[t],e[t]=0},this.#B=(e,t,r,n)=>{if(this.#x(t))return 0;if(!Et(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!Et(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#U=(t,r,n)=>{if(e[t]=r,this.#t){let r=this.#t-e[t];for(;this.#s>r;)this.#P(!0)}this.#s+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#s)}}#L=e=>{};#U=(e,t,r)=>{};#B=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#f;this.#N(t)&&((e||!this.#S(t))&&(yield t),t!==this.#d);)t=this.#h[t]}*#T({allowStale:e=this.allowStale}={}){if(this.#a)for(let t=this.#d;this.#N(t)&&((e||!this.#S(t))&&(yield t),t!==this.#f);)t=this.#l[t]}#N(e){return void 0!==e&&this.#o.get(this.#u[e])===e}*entries(){for(let e of this.#k())void 0!==this.#c[e]&&void 0!==this.#u[e]&&!this.#x(this.#c[e])&&(yield[this.#u[e],this.#c[e]])}*rentries(){for(let e of this.#T())void 0!==this.#c[e]&&void 0!==this.#u[e]&&!this.#x(this.#c[e])&&(yield[this.#u[e],this.#c[e]])}*keys(){for(let e of this.#k()){let t=this.#u[e];void 0!==t&&!this.#x(this.#c[e])&&(yield t)}}*rkeys(){for(let e of this.#T()){let t=this.#u[e];void 0!==t&&!this.#x(this.#c[e])&&(yield t)}}*values(){for(let e of this.#k())void 0!==this.#c[e]&&!this.#x(this.#c[e])&&(yield this.#c[e])}*rvalues(){for(let e of this.#T())void 0!==this.#c[e]&&!this.#x(this.#c[e])&&(yield this.#c[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#k()){let n=this.#c[r],i=this.#x(n)?n.__staleWhileFetching:n;if(void 0!==i&&e(i,this.#u[r],this))return this.get(this.#u[r],t)}}forEach(e,t=this){for(let r of this.#k()){let n=this.#c[r],i=this.#x(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#u[r],this)}}rforEach(e,t=this){for(let r of this.#T()){let n=this.#c[r],i=this.#x(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#u[r],this)}}purgeStale(){let e=!1;for(let t of this.#T({allowStale:!0}))this.#S(t)&&(this.delete(this.#u[t]),e=!0);return e}info(e){let t=this.#o.get(e);if(void 0===t)return;let r=this.#c[t],n=this.#x(r)?r.__staleWhileFetching:r;if(void 0===n)return;let i={value:n};if(this.#v&&this.#m){let e=this.#v[t],r=this.#m[t];if(e&&r){let t=e-(gt.now()-r);i.ttl=t,i.start=Date.now()}}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#k({allowStale:!0})){let r=this.#u[t],n=this.#c[t],i=this.#x(n)?n.__staleWhileFetching:n;if(void 0===i||void 0===r)continue;let a={value:i};if(this.#v&&this.#m){a.ttl=this.#v[t];let e=gt.now()-this.#m[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([r,a])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let e=Date.now()-r.start;r.start=gt.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;let{ttl:n=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:o}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,c=this.#B(e,t,r.size||0,s);if(this.maxEntrySize&&c>this.maxEntrySize)return o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this.delete(e),this;let l=0===this.#a?void 0:this.#o.get(e);if(void 0===l)l=0===this.#a?this.#f:0!==this.#p.length?this.#p.pop():this.#a===this.#e?this.#P(!1):this.#a,this.#u[l]=e,this.#c[l]=t,this.#o.set(e,l),this.#l[this.#f]=l,this.#h[l]=this.#f,this.#f=l,this.#a++,this.#U(l,c,o),o&&(o.set="add"),u=!1;else{this.#A(l);let r=this.#c[l];if(t!==r){if(this.#w&&this.#x(r)){r.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:t}=r;void 0!==t&&!a&&(this.#_&&this.#r?.(t,e,"set"),this.#b&&this.#g?.push([t,e,"set"]))}else a||(this.#_&&this.#r?.(r,e,"set"),this.#b&&this.#g?.push([r,e,"set"]));if(this.#L(l),this.#U(l,c,o),this.#c[l]=t,o){o.set="replace";let e=r&&this.#x(r)?r.__staleWhileFetching:r;void 0!==e&&(o.oldValue=e)}}else o&&(o.set="update")}if(0!==n&&!this.#v&&this.#C(),this.#v&&(u||this.#R(l,n,i),o&&this.#j(o,l)),!a&&this.#b&&this.#g){let e,t=this.#g;for(;e=t?.shift();)this.#n?.(...e)}return this}pop(){try{for(;this.#a;){let e=this.#c[this.#d];if(this.#P(!0),this.#x(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#b&&this.#g){let e,t=this.#g;for(;e=t?.shift();)this.#n?.(...e)}}}#P(e){let t=this.#d,r=this.#u[t],n=this.#c[t];return this.#w&&this.#x(n)?n.__abortController.abort(new Error("evicted")):(this.#_||this.#b)&&(this.#_&&this.#r?.(n,r,"evict"),this.#b&&this.#g?.push([n,r,"evict"])),this.#L(t),e&&(this.#u[t]=void 0,this.#c[t]=void 0,this.#p.push(t)),1===this.#a?(this.#d=this.#f=0,this.#p.length=0):this.#d=this.#l[t],this.#o.delete(r),this.#a--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=this.#o.get(e);if(void 0!==i){let e=this.#c[i];if(this.#x(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#S(i))return r&&this.#I(i),n&&(n.has="hit",this.#j(n,i)),!0;n&&(n.has="stale",this.#j(n,i))}else n&&(n.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,n=this.#o.get(e);if(void 0===n||!r&&this.#S(n))return;let i=this.#c[n];return this.#x(i)?i.__staleWhileFetching:i}#E(e,t,r,n){let i=void 0===t?void 0:this.#c[t];if(this.#x(i))return i;let a=new _t,{signal:s}=r;s?.addEventListener("abort",(()=>a.abort(s.reason)),{signal:a.signal});let o={signal:a.signal,options:r,context:n},u=(n,i=!1)=>{let{aborted:s}=a.signal,u=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(s&&!i?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,u&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),s&&!u&&!i)return c(a.signal.reason);let h=l;return this.#c[t]===l&&(void 0===n?h.__staleWhileFetching?this.#c[t]=h.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,o.options))),n},c=n=>{let{aborted:i}=a.signal,s=i&&r.allowStaleOnFetchAbort,o=s||r.allowStaleOnFetchRejection,u=o||r.noDeleteOnFetchRejection,c=l;if(this.#c[t]===l&&(u&&void 0!==c.__staleWhileFetching?s||(this.#c[t]=c.__staleWhileFetching):this.delete(e)),o)return r.status&&void 0!==c.__staleWhileFetching&&(r.status.returnedStale=!0),c.__staleWhileFetching;if(c.__returned===c)throw n};r.status&&(r.status.fetchDispatched=!0);let l=new Promise(((t,n)=>{let s=this.#i?.(e,i,o);s&&s instanceof Promise&&s.then((e=>t(void 0===e?void 0:e)),n),a.signal.addEventListener("abort",(()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>u(e,!0)))}))})).then(u,(e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),c(e)))),h=Object.assign(l,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,h,{...o.options,status:void 0}),t=this.#o.get(e)):this.#c[t]=h,h}#x(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof _t}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:o=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=!1,status:y,signal:m}=t;if(!this.#w)return y&&(y.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:y});let v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:s,size:o,sizeCalculation:u,noUpdateTTL:c,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:f,ignoreFetchAbort:d,status:y,signal:m},_=this.#o.get(e);if(void 0===_){y&&(y.fetch="miss");let t=this.#E(e,_,v,p);return t.__returned=t}{let t=this.#c[_];if(this.#x(t)){let e=r&&void 0!==t.__staleWhileFetching;return y&&(y.fetch="inflight",e&&(y.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#S(_);if(!g&&!i)return y&&(y.fetch="hit"),this.#A(_),n&&this.#I(_),y&&this.#j(y,_),t;let a=this.#E(e,_,v,p),s=void 0!==a.__staleWhileFetching&&r;return y&&(y.fetch=i?"stale":"refresh",s&&i&&(y.returnedStale=!0)),s?a.__staleWhileFetching:a.__returned=a}}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,s=this.#o.get(e);if(void 0!==s){let t=this.#c[s],o=this.#x(t);return a&&this.#j(a,s),this.#S(s)?(a&&(a.get="stale"),o?(a&&r&&void 0!==t.__staleWhileFetching&&(a.returnedStale=!0),r?t.__staleWhileFetching:void 0):(i||this.delete(e),a&&r&&(a.returnedStale=!0),r?t:void 0)):(a&&(a.get="hit"),o?t.__staleWhileFetching:(this.#A(s),n&&this.#I(s),t))}a&&(a.get="miss")}#Z(e,t){this.#h[t]=e,this.#l[e]=t}#A(e){e!==this.#f&&(e===this.#d?this.#d=this.#l[e]:this.#Z(this.#h[e],this.#l[e]),this.#Z(this.#f,e),this.#f=e)}delete(e){let t=!1;if(0!==this.#a){let r=this.#o.get(e);if(void 0!==r)if(t=!0,1===this.#a)this.clear();else{this.#L(r);let t=this.#c[r];if(this.#x(t)?t.__abortController.abort(new Error("deleted")):(this.#_||this.#b)&&(this.#_&&this.#r?.(t,e,"delete"),this.#b&&this.#g?.push([t,e,"delete"])),this.#o.delete(e),this.#u[r]=void 0,this.#c[r]=void 0,r===this.#f)this.#f=this.#h[r];else if(r===this.#d)this.#d=this.#l[r];else{let e=this.#h[r];this.#l[e]=this.#l[r];let t=this.#l[r];this.#h[t]=this.#h[r]}this.#a--,this.#p.push(r)}}if(this.#b&&this.#g?.length){let e,t=this.#g;for(;e=t?.shift();)this.#n?.(...e)}return t}clear(){for(let e of this.#T({allowStale:!0})){let t=this.#c[e];if(this.#x(t))t.__abortController.abort(new Error("deleted"));else{let r=this.#u[e];this.#_&&this.#r?.(t,r,"delete"),this.#b&&this.#g?.push([t,r,"delete"])}}if(this.#o.clear(),this.#c.fill(void 0),this.#u.fill(void 0),this.#v&&this.#m&&(this.#v.fill(0),this.#m.fill(0)),this.#y&&this.#y.fill(0),this.#d=0,this.#f=0,this.#p.length=0,this.#s=0,this.#a=0,this.#b&&this.#g){let e,t=this.#g;for(;e=t?.shift();)this.#n?.(...e)}}};function Ot({cache:e}){return async t=>{if(e.max)return e.get(t)}}function Ct({cache:e}){return async(t,{url:r,address:n},i)=>{if(e.max)return e.set(t,{url:r,address:n},{ttl:i})}}function Rt({cache:e}){return async t=>{if(e.max)return e.get(t)}}function It({cache:e}){return async(t,r,n)=>{if(e.max)return e.set(t,{url:r,address:t,ttl:n},{ttl:n})}}function jt({fetch:e}){return async(t,r)=>{let n=await e(`${t}?process-id=${r}`,{method:"GET",redirect:"manual"});return[301,302,307,308].includes(n.status)?new URL(n.headers.get("Location")).origin:t}}!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},e.getValidEnumValues=t=>{let r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(let e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(let r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(bt||(bt={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(xt||(xt={}));var Lt=bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bt=e=>{switch(typeof e){case"undefined":return Lt.undefined;case"string":return Lt.string;case"number":return isNaN(e)?Lt.nan:Lt.number;case"boolean":return Lt.boolean;case"function":return Lt.function;case"bigint":return Lt.bigint;case"symbol":return Lt.symbol;case"object":return Array.isArray(e)?Lt.array:null===e?Lt.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Lt.promise:typeof Map<"u"&&e instanceof Map?Lt.map:typeof Set<"u"&&e instanceof Set?Lt.set:typeof Date<"u"&&e instanceof Date?Lt.date:Lt.object;default:return Lt.unknown}},Ut=bt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Pt=class e extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,bt.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};Pt.create=e=>new Pt(e);var Nt=(e,t)=>{let r;switch(e.code){case Ut.invalid_type:r=e.received===Lt.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Ut.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,bt.jsonStringifyReplacer)}`;break;case Ut.unrecognized_keys:r=`Unrecognized key(s) in object: ${bt.joinValues(e.keys,", ")}`;break;case Ut.invalid_union:r="Invalid input";break;case Ut.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${bt.joinValues(e.options)}`;break;case Ut.invalid_enum_value:r=`Invalid enum value. Expected ${bt.joinValues(e.options)}, received '${e.received}'`;break;case Ut.invalid_arguments:r="Invalid function arguments";break;case Ut.invalid_return_type:r="Invalid function return type";break;case Ut.invalid_date:r="Invalid date";break;case Ut.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:bt.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Ut.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Ut.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Ut.custom:r="Invalid input";break;case Ut.invalid_intersection_types:r="Intersection results could not be merged";break;case Ut.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ut.not_finite:r="Number must be finite";break;default:r=t.defaultError,bt.assertNever(e)}return{message:r}},Zt=Nt;function Mt(){return Zt}var Ft=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],s={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="",u=n.filter((e=>!!e)).slice().reverse();for(let e of u)o=e(s,{data:t,defaultError:o}).message;return{...i,path:a,message:o}};function $t(e,t){let r=Mt(),n=Ft({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Nt?void 0:Nt].filter((e=>!!e))});e.common.issues.push(n)}var Dt,zt,Vt,Kt=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return Gt;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(t,r){let n=[];for(let e of r){let t=await e.key,r=await e.value;n.push({key:t,value:r})}return e.mergeObjectSync(t,n)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return Gt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(typeof i.value<"u"||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}},Gt=Object.freeze({status:"aborted"}),Wt=e=>({status:"dirty",value:e}),Ht=e=>({status:"valid",value:e}),qt=e=>"aborted"===e.status,Yt=e=>"dirty"===e.status,Qt=e=>"valid"===e.status,Jt=e=>typeof Promise<"u"&&e instanceof Promise;function Xt(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function er(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(Dt||(Dt={}));var tr=class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},rr=(e,t)=>{if(Qt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Pt(e.common.issues);return this._error=t,this._error}}};function nr(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var a,s;let{message:o}=e;return"invalid_enum_value"===t.code?{message:o??i.defaultError}:typeof i.data>"u"?{message:null!==(a=o??n)&&void 0!==a?a:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(s=o??r)&&void 0!==s?s:i.defaultError}},description:i}}var ir,ar=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Bt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Bt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Kt,ctx:{common:e.parent.common,data:e.data,parsedType:Bt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Jt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!==(r=t?.async)&&void 0!==r&&r,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bt(e)},i=this._parseSync({data:e,path:n.path,parent:n});return rr(n,i)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bt(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(Jt(n)?n:Promise.resolve(n));return rr(r,i)}refine(e,t){let r=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{let i=e(t),a=()=>n.addIssue({code:Ut.custom,...r(t)});return typeof Promise<"u"&&i instanceof Promise?i.then((e=>!!e||(a(),!1))):!!i||(a(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new en({schema:this,typeName:dn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return tn.create(this,this._def)}nullable(){return rn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ur.create(this,this._def)}promise(){return Xr.create(this,this._def)}or(e){return Zr.create([this,e],this._def)}and(e){return Dr.create(this,e,this._def)}transform(e){return new en({...nr(this._def),schema:this,typeName:dn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t="function"==typeof e?e:()=>e;return new nn({...nr(this._def),innerType:this,defaultValue:t,typeName:dn.ZodDefault})}brand(){return new un({typeName:dn.ZodBranded,type:this,...nr(this._def)})}catch(e){let t="function"==typeof e?e:()=>e;return new an({...nr(this._def),innerType:this,catchValue:t,typeName:dn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return cn.create(this,e)}readonly(){return ln.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sr=/^c[^\s-]{8,}$/i,or=/^[0-9a-z]+$/,ur=/^[0-9A-HJKMNP-TV-Z]{26}$/,cr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,lr=/^[a-z0-9_-]{21}$/i,hr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,dr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,gr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",mr=new RegExp(`^${yr}$`);function vr(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function _r(e){return new RegExp(`^${vr(e)}$`)}function wr(e){let t=`${yr}T${vr(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function br(e,t){return!(("v4"!==t&&t||!fr.test(e))&&("v6"!==t&&t||!pr.test(e)))}var xr=class e extends ar{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Lt.string){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.string,received:t.parsedType}),Gt}let t,r=new Kt;for(let n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if("max"===n.kind)e.data.length>n.value&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if("length"===n.kind){let i=e.data.length>n.value,a=e.data.length<n.value;(i||a)&&(t=this._getOrReturnCtx(e,t),i?$t(t,{code:Ut.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):a&&$t(t,{code:Ut.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if("email"===n.kind)dr.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"email",code:Ut.invalid_string,message:n.message}),r.dirty());else if("emoji"===n.kind)ir||(ir=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ir.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"emoji",code:Ut.invalid_string,message:n.message}),r.dirty());else if("uuid"===n.kind)cr.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"uuid",code:Ut.invalid_string,message:n.message}),r.dirty());else if("nanoid"===n.kind)lr.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"nanoid",code:Ut.invalid_string,message:n.message}),r.dirty());else if("cuid"===n.kind)sr.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"cuid",code:Ut.invalid_string,message:n.message}),r.dirty());else if("cuid2"===n.kind)or.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"cuid2",code:Ut.invalid_string,message:n.message}),r.dirty());else if("ulid"===n.kind)ur.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"ulid",code:Ut.invalid_string,message:n.message}),r.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{t=this._getOrReturnCtx(e,t),$t(t,{validation:"url",code:Ut.invalid_string,message:n.message}),r.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"regex",code:Ut.invalid_string,message:n.message}),r.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):"datetime"===n.kind?wr(n).test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.invalid_string,validation:"datetime",message:n.message}),r.dirty()):"date"===n.kind?mr.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.invalid_string,validation:"date",message:n.message}),r.dirty()):"time"===n.kind?_r(n).test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.invalid_string,validation:"time",message:n.message}),r.dirty()):"duration"===n.kind?hr.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"duration",code:Ut.invalid_string,message:n.message}),r.dirty()):"ip"===n.kind?br(e.data,n.version)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"ip",code:Ut.invalid_string,message:n.message}),r.dirty()):"base64"===n.kind?gr.test(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{validation:"base64",code:Ut.invalid_string,message:n.message}),r.dirty()):bt.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Ut.invalid_string,...Dt.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...Dt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Dt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Dt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Dt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Dt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Dt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Dt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Dt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Dt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Dt.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:null!==(t=e?.offset)&&void 0!==t&&t,local:null!==(r=e?.local)&&void 0!==r&&r,...Dt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Dt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Dt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Dt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Dt.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Dt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Dt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Dt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Dt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Dt.errToObj(t)})}nonempty(e){return this.min(1,Dt.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function Er(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}xr.create=e=>{var t;return new xr({checks:[],typeName:dn.ZodString,coerce:null!==(t=e?.coerce)&&void 0!==t&&t,...nr(e)})};var Ar=class e extends ar{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Lt.number){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.number,received:t.parsedType}),Gt}let t,r=new Kt;for(let n of this._def.checks)"int"===n.kind?bt.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==Er(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.not_finite,message:n.message}),r.dirty()):bt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Dt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Dt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Dt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Dt.toString(t))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Dt.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:Dt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Dt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Dt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&bt.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ar.create=e=>new Ar({checks:[],typeName:dn.ZodNumber,coerce:e?.coerce||!1,...nr(e)});var kr=class e extends ar{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Lt.bigint){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.bigint,received:t.parsedType}),Gt}let t,r=new Kt;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):bt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Dt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Dt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Dt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Dt.toString(t))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Dt.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Dt.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};kr.create=e=>{var t;return new kr({checks:[],typeName:dn.ZodBigInt,coerce:null!==(t=e?.coerce)&&void 0!==t&&t,...nr(e)})};var Tr=class extends ar{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Lt.boolean){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.boolean,received:t.parsedType}),Gt}return Ht(e.data)}};Tr.create=e=>new Tr({typeName:dn.ZodBoolean,coerce:e?.coerce||!1,...nr(e)});var Sr=class e extends ar{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Lt.date){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.date,received:t.parsedType}),Gt}if(isNaN(e.data.getTime()))return $t(this._getOrReturnCtx(e),{code:Ut.invalid_date}),Gt;let t,r=new Kt;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(t=this._getOrReturnCtx(e,t),$t(t,{code:Ut.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):bt.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Dt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Dt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};Sr.create=e=>new Sr({checks:[],coerce:e?.coerce||!1,typeName:dn.ZodDate,...nr(e)});var Or=class extends ar{_parse(e){if(this._getType(e)!==Lt.symbol){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.symbol,received:t.parsedType}),Gt}return Ht(e.data)}};Or.create=e=>new Or({typeName:dn.ZodSymbol,...nr(e)});var Cr=class extends ar{_parse(e){if(this._getType(e)!==Lt.undefined){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.undefined,received:t.parsedType}),Gt}return Ht(e.data)}};Cr.create=e=>new Cr({typeName:dn.ZodUndefined,...nr(e)});var Rr=class extends ar{_parse(e){if(this._getType(e)!==Lt.null){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.null,received:t.parsedType}),Gt}return Ht(e.data)}};Rr.create=e=>new Rr({typeName:dn.ZodNull,...nr(e)});var Ir=class extends ar{constructor(){super(...arguments),this._any=!0}_parse(e){return Ht(e.data)}};Ir.create=e=>new Ir({typeName:dn.ZodAny,...nr(e)});var jr=class extends ar{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ht(e.data)}};jr.create=e=>new jr({typeName:dn.ZodUnknown,...nr(e)});var Lr=class extends ar{_parse(e){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.never,received:t.parsedType}),Gt}};Lr.create=e=>new Lr({typeName:dn.ZodNever,...nr(e)});var Br=class extends ar{_parse(e){if(this._getType(e)!==Lt.undefined){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.void,received:t.parsedType}),Gt}return Ht(e.data)}};Br.create=e=>new Br({typeName:dn.ZodVoid,...nr(e)});var Ur=class e extends ar{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==Lt.array)return $t(t,{code:Ut.invalid_type,expected:Lt.array,received:t.parsedType}),Gt;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&($t(t,{code:e?Ut.too_big:Ut.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&($t(t,{code:Ut.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&($t(t,{code:Ut.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new tr(t,e,t.path,r))))).then((e=>Kt.mergeArray(r,e)));let i=[...t.data].map(((e,r)=>n.type._parseSync(new tr(t,e,t.path,r))));return Kt.mergeArray(r,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Dt.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Dt.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Dt.toString(r)}})}nonempty(e){return this.min(1,e)}};function Pr(e){if(e instanceof Nr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=tn.create(Pr(n))}return new Nr({...e._def,shape:()=>t})}return e instanceof Ur?new Ur({...e._def,type:Pr(e.element)}):e instanceof tn?tn.create(Pr(e.unwrap())):e instanceof rn?rn.create(Pr(e.unwrap())):e instanceof zr?zr.create(e.items.map((e=>Pr(e)))):e}Ur.create=(e,t)=>new Ur({type:e,minLength:null,maxLength:null,exactLength:null,typeName:dn.ZodArray,...nr(t)});var Nr=class e extends ar{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=bt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Lt.object){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.object,received:t.parsedType}),Gt}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Lr&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let s=[];for(let e of i){let t=n[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new tr(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Lr){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&($t(r,{code:Ut.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new tr(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{let e=[];for(let t of s){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>Kt.mergeObjectSync(t,e))):Kt.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(t){return Dt.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,r)=>{var n,i,a,s;let o=null!==(a=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,e,r).message)&&void 0!==a?a:r.defaultError;return"unrecognized_keys"===e.code?{message:null!==(s=Dt.errToObj(t).message)&&void 0!==s?s:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:dn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};return bt.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(r[e]=this.shape[e])})),new e({...this._def,shape:()=>r})}omit(t){let r={};return bt.objectKeys(this.shape).forEach((e=>{t[e]||(r[e]=this.shape[e])})),new e({...this._def,shape:()=>r})}deepPartial(){return Pr(this)}partial(t){let r={};return bt.objectKeys(this.shape).forEach((e=>{let n=this.shape[e];t&&!t[e]?r[e]=n:r[e]=n.optional()})),new e({...this._def,shape:()=>r})}required(t){let r={};return bt.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof tn;)t=t._def.innerType;r[e]=t}})),new e({...this._def,shape:()=>r})}keyof(){return Yr(bt.objectKeys(this.shape))}};Nr.create=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strip",catchall:Lr.create(),typeName:dn.ZodObject,...nr(t)}),Nr.strictCreate=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strict",catchall:Lr.create(),typeName:dn.ZodObject,...nr(t)}),Nr.lazycreate=(e,t)=>new Nr({shape:e,unknownKeys:"strip",catchall:Lr.create(),typeName:dn.ZodObject,...nr(t)});var Zr=class extends ar{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map((e=>new Pt(e.ctx.common.issues)));return $t(t,{code:Ut.invalid_union,unionErrors:r}),Gt}));{let e,n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"===a.status&&!e&&(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map((e=>new Pt(e)));return $t(t,{code:Ut.invalid_union,unionErrors:i}),Gt}}get options(){return this._def.options}};Zr.create=(e,t)=>new Zr({options:e,typeName:dn.ZodUnion,...nr(t)});var Mr=e=>e instanceof Hr?Mr(e.schema):e instanceof en?Mr(e.innerType()):e instanceof qr?[e.value]:e instanceof Qr?e.options:e instanceof Jr?bt.objectValues(e.enum):e instanceof nn?Mr(e._def.innerType):e instanceof Cr?[void 0]:e instanceof Rr?[null]:e instanceof tn?[void 0,...Mr(e.unwrap())]:e instanceof rn?[null,...Mr(e.unwrap())]:e instanceof un||e instanceof ln?Mr(e.unwrap()):e instanceof an?Mr(e._def.innerType):[],Fr=class e extends ar{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Lt.object)return $t(t,{code:Ut.invalid_type,expected:Lt.object,received:t.parsedType}),Gt;let r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):($t(t,{code:Ut.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Gt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let e of r){let r=Mr(e.shape[t]);if(!r.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let n of r){if(i.has(n))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(n)}`);i.set(n,e)}}return new e({typeName:dn.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...nr(n)})}};function $r(e,t){let r=Bt(e),n=Bt(t);if(e===t)return{valid:!0,data:e};if(r===Lt.object&&n===Lt.object){let r=bt.objectKeys(t),n=bt.objectKeys(e).filter((e=>-1!==r.indexOf(e))),i={...e,...t};for(let r of n){let n=$r(e[r],t[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(r===Lt.array&&n===Lt.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let n=0;n<e.length;n++){let i=$r(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===Lt.date&&n===Lt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Dr=class extends ar{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(qt(e)||qt(n))return Gt;let i=$r(e.value,n.value);return i.valid?((Yt(e)||Yt(n))&&t.dirty(),{status:t.value,value:i.data}):($t(r,{code:Ut.invalid_intersection_types}),Gt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Dr.create=(e,t,r)=>new Dr({left:e,right:t,typeName:dn.ZodIntersection,...nr(r)});var zr=class e extends ar{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Lt.array)return $t(r,{code:Ut.invalid_type,expected:Lt.array,received:r.parsedType}),Gt;if(r.data.length<this._def.items.length)return $t(r,{code:Ut.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Gt;!this._def.rest&&r.data.length>this._def.items.length&&($t(r,{code:Ut.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map(((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new tr(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>Kt.mergeArray(t,e))):Kt.mergeArray(t,n)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};zr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zr({items:e,typeName:dn.ZodTuple,rest:null,...nr(t)})};var Vr=class e extends ar{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Lt.object)return $t(r,{code:Ut.invalid_type,expected:Lt.object,received:r.parsedType}),Gt;let n=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)n.push({key:i._parse(new tr(r,e,r.path,e)),value:a._parse(new tr(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Kt.mergeObjectAsync(t,n):Kt.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(t,r,n){return new e(r instanceof ar?{keyType:t,valueType:r,typeName:dn.ZodRecord,...nr(n)}:{keyType:xr.create(),valueType:t,typeName:dn.ZodRecord,...nr(r)})}},Kr=class extends ar{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Lt.map)return $t(r,{code:Ut.invalid_type,expected:Lt.map,received:r.parsedType}),Gt;let n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map((([e,t],a)=>({key:n._parse(new tr(r,e,r.path,[a,"key"])),value:i._parse(new tr(r,t,r.path,[a,"value"]))})));if(r.common.async){let e=new Map;return Promise.resolve().then((async()=>{for(let r of a){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return Gt;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}))}{let e=new Map;for(let r of a){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return Gt;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}};Kr.create=(e,t,r)=>new Kr({valueType:t,keyType:e,typeName:dn.ZodMap,...nr(r)});var Gr=class e extends ar{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Lt.set)return $t(r,{code:Ut.invalid_type,expected:Lt.set,received:r.parsedType}),Gt;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&($t(r,{code:Ut.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&($t(r,{code:Ut.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let n of e){if("aborted"===n.status)return Gt;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let s=[...r.data.values()].map(((e,t)=>i._parse(new tr(r,e,r.path,t))));return r.common.async?Promise.all(s).then((e=>a(e))):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:Dt.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Dt.toString(r)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Gr.create=(e,t)=>new Gr({valueType:e,minSize:null,maxSize:null,typeName:dn.ZodSet,...nr(t)});var Wr=class e extends ar{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Lt.function)return $t(t,{code:Ut.invalid_type,expected:Lt.function,received:t.parsedType}),Gt;function r(e,r){return Ft({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mt(),Nt].filter((e=>!!e)),issueData:{code:Ut.invalid_arguments,argumentsError:r}})}function n(e,r){return Ft({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Mt(),Nt].filter((e=>!!e)),issueData:{code:Ut.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Xr){let e=this;return Ht((async function(...t){let s=new Pt([]),o=await e._def.args.parseAsync(t,i).catch((e=>{throw s.addIssue(r(t,e)),s})),u=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw s.addIssue(n(u,e)),s}))}))}{let e=this;return Ht((function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new Pt([r(t,s.error)]);let o=Reflect.apply(a,this,s.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Pt([n(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:zr.create(t).rest(jr.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,r,n){return new e({args:t||zr.create([]).rest(jr.create()),returns:r||jr.create(),typeName:dn.ZodFunction,...nr(n)})}},Hr=class extends ar{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Hr.create=(e,t)=>new Hr({getter:e,typeName:dn.ZodLazy,...nr(t)});var qr=class extends ar{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return $t(t,{received:t.data,code:Ut.invalid_literal,expected:this._def.value}),Gt}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Yr(e,t){return new Qr({values:e,typeName:dn.ZodEnum,...nr(t)})}qr.create=(e,t)=>new qr({value:e,typeName:dn.ZodLiteral,...nr(t)});var Qr=class e extends ar{constructor(){super(...arguments),zt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return $t(t,{expected:bt.joinValues(r),received:t.parsedType,code:Ut.invalid_type}),Gt}if(Xt(this,zt,"f")||er(this,zt,new Set(this._def.values),"f"),!Xt(this,zt,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return $t(t,{received:t.data,code:Ut.invalid_enum_value,options:r}),Gt}return Ht(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter((e=>!t.includes(e))),{...this._def,...r})}};zt=new WeakMap,Qr.create=Yr;var Jr=class extends ar{constructor(){super(...arguments),Vt.set(this,void 0)}_parse(e){let t=bt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Lt.string&&r.parsedType!==Lt.number){let e=bt.objectValues(t);return $t(r,{expected:bt.joinValues(e),received:r.parsedType,code:Ut.invalid_type}),Gt}if(Xt(this,Vt,"f")||er(this,Vt,new Set(bt.getValidEnumValues(this._def.values)),"f"),!Xt(this,Vt,"f").has(e.data)){let e=bt.objectValues(t);return $t(r,{received:r.data,code:Ut.invalid_enum_value,options:e}),Gt}return Ht(e.data)}get enum(){return this._def.values}};Vt=new WeakMap,Jr.create=(e,t)=>new Jr({values:e,typeName:dn.ZodNativeEnum,...nr(t)});var Xr=class extends ar{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Lt.promise&&!1===t.common.async)return $t(t,{code:Ut.invalid_type,expected:Lt.promise,received:t.parsedType}),Gt;let r=t.parsedType===Lt.promise?t.data:Promise.resolve(t.data);return Ht(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}};Xr.create=(e,t)=>new Xr({type:e,typeName:dn.ZodPromise,...nr(t)});var en=class extends ar{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===dn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{$t(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Gt;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?Gt:"dirty"===n.status||"dirty"===t.value?Wt(n.value):n}));{if("aborted"===t.value)return Gt;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?Gt:"dirty"===n.status||"dirty"===t.value?Wt(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?Gt:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?Gt:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Qt(e))return e;let a=n.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>Qt(e)?Promise.resolve(n.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}bt.assertNever(n)}};en.create=(e,t,r)=>new en({schema:e,typeName:dn.ZodEffects,effect:t,...nr(r)}),en.createWithPreprocess=(e,t,r)=>new en({schema:t,effect:{type:"preprocess",transform:e},typeName:dn.ZodEffects,...nr(r)});var tn=class extends ar{_parse(e){return this._getType(e)===Lt.undefined?Ht(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};tn.create=(e,t)=>new tn({innerType:e,typeName:dn.ZodOptional,...nr(t)});var rn=class extends ar{_parse(e){return this._getType(e)===Lt.null?Ht(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};rn.create=(e,t)=>new rn({innerType:e,typeName:dn.ZodNullable,...nr(t)});var nn=class extends ar{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===Lt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};nn.create=(e,t)=>new nn({innerType:e,typeName:dn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...nr(t)});var an=class extends ar{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Jt(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Pt(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Pt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};an.create=(e,t)=>new an({innerType:e,typeName:dn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...nr(t)});var sn=class extends ar{_parse(e){if(this._getType(e)!==Lt.nan){let t=this._getOrReturnCtx(e);return $t(t,{code:Ut.invalid_type,expected:Lt.nan,received:t.parsedType}),Gt}return{status:"valid",value:e.data}}};sn.create=e=>new sn({typeName:dn.ZodNaN,...nr(e)});var on=Symbol("zod_brand"),un=class extends ar{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},cn=class e extends ar{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Gt:"dirty"===e.status?(t.dirty(),Wt(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Gt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(t,r){return new e({in:t,out:r,typeName:dn.ZodPipeline})}},ln=class extends ar{_parse(e){let t=this._def.innerType._parse(e);return Qt(t)&&(t.value=Object.freeze(t.value)),t}unwrap(){return this._def.innerType}};function hn(e,t={},r){return e?Ir.create().superRefine(((n,i)=>{var a,s;if(!e(n)){let e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:r)||void 0===s||s,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:o})}})):Ir.create()}ln.create=(e,t)=>new ln({innerType:e,typeName:dn.ZodReadonly,...nr(t)});var dn,fn={object:Nr.lazycreate};!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(dn||(dn={}));var pn=xr.create,gn=Ar.create,yn=sn.create,mn=kr.create,vn=Tr.create,_n=Sr.create,wn=Or.create,bn=Cr.create,xn=Rr.create,En=Ir.create,An=jr.create,kn=Lr.create,Tn=Br.create,Sn=Ur.create,On=Nr.create,Cn=Nr.strictCreate,Rn=Zr.create,In=Fr.create,jn=Dr.create,Ln=zr.create,Bn=Vr.create,Un=Kr.create,Pn=Gr.create,Nn=Wr.create,Zn=Hr.create,Mn=qr.create,Fn=Qr.create,$n=Jr.create,Dn=Xr.create,zn=en.create,Vn=tn.create,Kn=rn.create,Gn=en.createWithPreprocess,Wn=cn.create,Hn={string:e=>xr.create({...e,coerce:!0}),number:e=>Ar.create({...e,coerce:!0}),boolean:e=>Tr.create({...e,coerce:!0}),bigint:e=>kr.create({...e,coerce:!0}),date:e=>Sr.create({...e,coerce:!0})},qn=Gt,Yn=Object.freeze({__proto__:null,defaultErrorMap:Nt,setErrorMap:function(e){Zt=e},getErrorMap:Mt,makeIssue:Ft,EMPTY_PATH:[],addIssueToContext:$t,ParseStatus:Kt,INVALID:Gt,DIRTY:Wt,OK:Ht,isAborted:qt,isDirty:Yt,isValid:Qt,isAsync:Jt,get util(){return bt},get objectUtil(){return xt},ZodParsedType:Lt,getParsedType:Bt,ZodType:ar,datetimeRegex:wr,ZodString:xr,ZodNumber:Ar,ZodBigInt:kr,ZodBoolean:Tr,ZodDate:Sr,ZodSymbol:Or,ZodUndefined:Cr,ZodNull:Rr,ZodAny:Ir,ZodUnknown:jr,ZodNever:Lr,ZodVoid:Br,ZodArray:Ur,ZodObject:Nr,ZodUnion:Zr,ZodDiscriminatedUnion:Fr,ZodIntersection:Dr,ZodTuple:zr,ZodRecord:Vr,ZodMap:Kr,ZodSet:Gr,ZodFunction:Wr,ZodLazy:Hr,ZodLiteral:qr,ZodEnum:Qr,ZodNativeEnum:Jr,ZodPromise:Xr,ZodEffects:en,ZodTransformer:en,ZodOptional:tn,ZodNullable:rn,ZodDefault:nn,ZodCatch:an,ZodNaN:sn,BRAND:on,ZodBranded:un,ZodPipeline:cn,ZodReadonly:ln,custom:hn,Schema:ar,ZodSchema:ar,late:fn,get ZodFirstPartyTypeKind(){return dn},coerce:Hn,any:En,array:Sn,bigint:mn,boolean:vn,date:_n,discriminatedUnion:In,effect:zn,enum:Fn,function:Nn,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>hn((t=>t instanceof e),t),intersection:jn,lazy:Zn,literal:Mn,map:Un,nan:yn,nativeEnum:$n,never:kn,null:xn,nullable:Kn,number:gn,object:On,oboolean:()=>vn().optional(),onumber:()=>gn().optional(),optional:Vn,ostring:()=>pn().optional(),pipeline:Wn,preprocess:Gn,promise:Dn,record:Bn,set:Pn,strictObject:Cn,string:pn,symbol:wn,transformer:zn,tuple:Ln,undefined:bn,union:Rn,unknown:An,void:Tn,NEVER:qn,ZodIssueCode:Ut,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Pt}),Qn=Yn.object({url:Yn.string(),address:Yn.string()}),Jn=Yn.object({url:Yn.string(),address:Yn.string(),ttl:Yn.coerce.number()}),Xn=Yn.function().args(Yn.string(),Yn.string()).returns(Yn.promise(Yn.string())),ei=Yn.function().args(Yn.string()).returns(Yn.promise(Qn.nullish())),ti=Yn.function().args(Yn.string(),Qn,Yn.number()).returns(Yn.promise(Yn.any())),ri=Yn.function().args(Yn.string()).returns(Yn.promise(Jn.nullish())),ni=Yn.function().args(Yn.string(),Yn.string(),Yn.number()).returns(Yn.promise(Yn.any())),ii=Yn.function().args(Yn.string()).returns(Yn.promise(Jn)),ai=ii;function si({cacheSize:e=100,followRedirects:t=!1,GRAPHQL_URL:r="https://arweave.net/graphql",GRAPHQL_MAX_RETRIES:n=0,GRAPHQL_RETRY_BACKOFF:i=300}={}){let a=function({size:e}){return new St({max:e,maxSize:5e6,sizeCalculation:e=>JSON.stringify(e).length,allowStale:!0})}({size:e}),s=pt({fetch,GRAPHQL_URL:r,GRAPHQL_MAX_RETRIES:n,GRAPHQL_RETRY_BACKOFF:i}),o={getByProcess:Ot({cache:a}),getByOwner:Rt({cache:a}),setByProcess:Ct({cache:a}),setByOwner:It({cache:a})},u=function({loadProcessScheduler:e,loadScheduler:t,cache:r,followRedirects:n,checkForRedirect:i}){e=ai.implement(e),t=ii.implement(t),i=Xn.implement(i);let a=ei.implement(r.getByProcess),s=ri.implement(r.getByOwner),o=ti.implement(r.setByProcess),u=ni.implement(r.setByOwner);return(r,c)=>a(r).then((async a=>a||Promise.resolve().then((async()=>c?await s(c)||t(c).then((e=>(u(e.address,e.url,e.ttl),e))):e(r))).then((async e=>{let t=e.url;n&&(t=await i(e.url,r));let a={url:ut(t),address:e.address};return await o(r,a,e.ttl),a}))))}({loadProcessScheduler:ft({fetch,GRAPHQL_URL:r,GRAPHQL_MAX_RETRIES:n,GRAPHQL_RETRY_BACKOFF:i}),loadScheduler:s,cache:o,followRedirects:t,checkForRedirect:jt({fetch})}),c=function({loadScheduler:e,cache:t}){e=ii.implement(e);let r=ri.implement(t.getByOwner),n=ni.implement(t.setByOwner);return t=>r(t).then((r=>!!r||e(t).then((e=>n(t,e.url,e.ttl))).then((()=>!0)).catch((e=>{if(e instanceof at)return!1;throw e}))))}({loadScheduler:s,cache:o}),l=function({loadScheduler:e,cache:t}){e=ii.implement(e);let r=ri.implement(t.getByOwner),n=ni.implement(t.setByOwner);return t=>r(t).then((r=>r?{url:r.url}:e(t).then((e=>n(t,e.url,e.ttl).then((()=>({url:ut(e.url)}))))).catch((e=>{if(!(e instanceof at))throw e}))))}({loadScheduler:s,cache:o});return{locate:u,validate:c,raw:l}}var oi=globalThis.GRAPHQL_URL||void 0,ui=globalThis.SCHEDULER_UTILS_CACHE_SIZE||void 0,ci="true"===globalThis.SCHEDULER_UTILS_FOLLOW_REDIRECTS||void 0,li=globalThis.GRAPHQL_MAX_RETRIES||void 0,hi=globalThis.GRAPHQL_RETRY_BACKOFF||void 0,{locate:di,validate:fi,raw:pi}=si({GRAPHQL_URL:oi,cacheSize:ui,followRedirects:ci,GRAPHQL_MAX_RETRIES:li,GRAPHQL_RETRY_BACKOFF:hi}),gi=e=>({fork:e,toPromise:()=>new Promise(((t,r)=>e(r,t))),map:t=>gi(((r,n)=>e(r,(e=>n(t(e)))))),bimap:(t,r)=>gi(((n,i)=>e((e=>n(t(e))),(e=>i(r(e)))))),chain:t=>gi(((r,n)=>e(r,(e=>t(e).fork(r,n))))),bichain:(t,r)=>gi(((n,i)=>e((e=>t(e).fork(n,i)),(e=>r(e).fork(n,i))))),fold:(t,r)=>gi(((n,i)=>e((e=>t(e).fork(n,i)),(e=>r(e).fork(n,i)))))}),yi=e=>gi(((t,r)=>r(e))),mi=e=>gi(((t,r)=>r(e))),vi=e=>gi(((t,r)=>t(e))),_i=e=>(...t)=>gi(((r,n)=>e(...t).then(n).catch(r)));function wi({fetch:e,MU_URL:t,logger:r}){const n=r.child("deployMessage");return r=>yi(r).chain(_i((({processId:e,data:t,tags:r,anchor:n,signer:i})=>i({data:t,tags:r,target:e,anchor:n})))).chain((r=>yi(r).chain(_i((async r=>e(t,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},redirect:"follow",body:r.raw})))).bichain((e=>vi(new Error(`Error while communicating with MU: ${JSON.stringify(e)}`))),_i((async e=>{if(e.ok)return e.json();throw new Error(`${e.status}: ${await e.text()}`)}))).bimap(n.tap("Error encountered when writing message via MU"),n.tap("Successfully wrote message via MU")).map((e=>({res:e,messageId:r.id}))))).toPromise()}function bi({fetch:e,MU_URL:t,logger:r}){const n=r.child("deployProcess");return r=>yi(r).chain(_i((({data:e,tags:t,signer:r})=>r({data:e,tags:t})))).chain((r=>yi(r).chain(_i((async r=>e(t,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},redirect:"follow",body:r.raw})))).bichain((e=>vi(new Error(`Error while communicating with MU: ${JSON.stringify(e)}`))),_i((async e=>{if(e.ok)return e.json();throw new Error(`${e.status}: ${await e.text()}`)}))).bimap(n.tap("Error encountered when deploying process via MU"),n.tap("Successfully deployed process via MU")).map((e=>({res:e,processId:r.id}))))).toPromise()}function xi({fetch:e,MU_URL:t,logger:r}){const n=r.child("deployMonitor");return r=>yi(r).chain(_i((({processId:e,data:t,tags:r,anchor:n,signer:i})=>i({data:t,tags:r,target:e,anchor:n})))).chain((i=>yi(i).chain(_i((async n=>e(t+"/monitor/"+r.processId,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},redirect:"follow",body:n.raw})))).bichain((e=>vi(new Error(`Error while communicating with MU: ${JSON.stringify(e)}`))),_i((async e=>{if(e.ok)return{ok:!0};throw new Error(`${e.status}: ${await e.text()}`)}))).bimap(n.tap("Error encountered when subscribing to process via MU"),n.tap("Successfully subscribed to process via MU")).map((e=>({res:e,messageId:i.id}))))).toPromise()}function Ei({fetch:e,MU_URL:t,logger:r}){const n=r.child("deployUnmonitor");return r=>yi(r).chain(_i((({processId:e,data:t,tags:r,anchor:n,signer:i})=>i({data:t,tags:r,target:e,anchor:n})))).chain((i=>yi(i).chain(_i((async n=>e(t+"/monitor/"+r.processId,{method:"DELETE",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},redirect:"follow",body:n.raw})))).bichain((e=>vi(new Error(`Error while communicating with MU: ${JSON.stringify(e)}`))),_i((async e=>{if(e.ok)return{ok:!0};throw new Error(`${e.status}: ${await e.text()}`)}))).bimap(n.tap("Error encountered when unsubscribing to process via MU"),n.tap("Successfully unsubscribed to process via MU")).map((e=>({res:e,messageId:i.id}))))).toPromise()}function Ai({fetch:e,MU_URL:t,logger:r}){const n=r.child("deployAssign");return r=>yi(r).chain(_i((async({process:r,message:n,baseLayer:i,exclude:a})=>e(`${t}?process-id=${r}&assign=${n}${i?"&base-layer":""}${a?"&exclude="+a.join(","):""}`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"}})))).bichain((e=>vi(new Error(`Error while communicating with MU: ${JSON.stringify(e)}`))),_i((async e=>{if(e.ok)return e.json();throw new Error(`${e.status}: ${await e.text()}`)}))).bimap(n.tap("Error encountered when writing assignment via MU"),n.tap("Successfully wrote assignment via MU")).map((e=>({res:e,assignmentId:e.id}))).toPromise()}function ki({fetch:e,CU_URL:t,logger:r}){return n=>yi(n).map(r.tap("posting dryrun request to CU")).chain(_i((r=>e(`${t}/dry-run?process-id=${r.Target}`,{method:"POST",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify(r)}).then((e=>e.json()))))).toPromise()}function Ti({fetch:e,CU_URL:t,logger:r}){return({id:n,processId:i})=>yi(`${t}/result/${n}?process-id=${i}`).map(r.tap("fetching message result from CU")).chain(_i((async t=>e(t,{method:"GET",headers:{Accept:"application/json"},redirect:"follow"}).then((e=>e.json()))))).toPromise()}function Si({fetch:e,CU_URL:t,logger:r}){return({process:n,from:i,to:a,sort:s,limit:o})=>{const u=new URL(`${t}/results/${n}`),c=new URLSearchParams(u.search);return i&&c.append("from",i),a&&c.append("to",a),s&&c.append("sort",s),o&&c.append("limit",o),u.search=c,yi(u.toString()).map(r.tap("fetching message result from CU")).chain(_i((async t=>e(t,{method:"GET",headers:{Accept:"application/json"},redirect:"follow"}).then((e=>e.json()))))).toPromise()}}var Oi,Ci=l(m(),1),Ri=({logger:e,fetch:t,cache:r=Oi})=>async({suUrl:n,processId:i})=>r.has(i)?r.get(i):t(`${n}/processes/${i}`,{method:"GET",redirect:"follow"}).then((async t=>{if(t.ok)return t.json();throw e("Error Encountered when fetching process meta from SU '%s' for process '%s'",n,i),new Error(`Encountered Error fetching scheduled messages from Scheduler Unit: ${t.status}: ${await t.text()}`)})).then((t=>(e("Caching process meta for process '%s'",i),r.set(i,{tags:t.tags}),t))),Ii=function(){return!1},ji=function(){return!0},Li={"@@functional/placeholder":!0};function Bi(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function Ui(e){return function t(r){return 0===arguments.length||Bi(r)?t:e.apply(this,arguments)}}function Pi(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return Bi(r)?t:Ui((function(t){return e(r,t)}));default:return Bi(r)&&Bi(n)?t:Bi(r)?Ui((function(t){return e(t,n)})):Bi(n)?Ui((function(t){return e(r,t)})):e(r,n)}}}function Ni(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,r){return t.apply(this,arguments)};case 3:return function(e,r,n){return t.apply(this,arguments)};case 4:return function(e,r,n,i){return t.apply(this,arguments)};case 5:return function(e,r,n,i,a){return t.apply(this,arguments)};case 6:return function(e,r,n,i,a,s){return t.apply(this,arguments)};case 7:return function(e,r,n,i,a,s,o){return t.apply(this,arguments)};case 8:return function(e,r,n,i,a,s,o,u){return t.apply(this,arguments)};case 9:return function(e,r,n,i,a,s,o,u,c){return t.apply(this,arguments)};case 10:return function(e,r,n,i,a,s,o,u,c,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function Zi(e,t,r){return function(){for(var n=[],i=0,a=e,s=0,o=!1;s<t.length||i<arguments.length;){var u;s<t.length&&(!Bi(t[s])||i>=arguments.length)?u=t[s]:(u=arguments[i],i+=1),n[s]=u,Bi(u)?o=!0:a-=1,s+=1}return!o&&a<=0?r.apply(this,n):Ni(Math.max(0,a),Zi(e,n,r))}}var Mi=Pi((function(e,t){return 1===e?Ui(t):Ni(e,Zi(e,[],t))}));function Fi(e){return function t(r,n,i){switch(arguments.length){case 0:return t;case 1:return Bi(r)?t:Pi((function(t,n){return e(r,t,n)}));case 2:return Bi(r)&&Bi(n)?t:Bi(r)?Pi((function(t,r){return e(t,n,r)})):Bi(n)?Pi((function(t,n){return e(r,t,n)})):Ui((function(t){return e(r,n,t)}));default:return Bi(r)&&Bi(n)&&Bi(i)?t:Bi(r)&&Bi(n)?Pi((function(t,r){return e(t,r,i)})):Bi(r)&&Bi(i)?Pi((function(t,r){return e(t,n,r)})):Bi(n)&&Bi(i)?Pi((function(t,n){return e(r,t,n)})):Bi(r)?Ui((function(t){return e(t,n,i)})):Bi(n)?Ui((function(t){return e(r,t,i)})):Bi(i)?Ui((function(t){return e(r,n,t)})):e(r,n,i)}}}var $i=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};function Di(e,t,r){return function(){if(0===arguments.length)return r();var n=arguments[arguments.length-1];if(!$i(n)){for(var i=0;i<e.length;){if("function"==typeof n[e[i]])return n[e[i]].apply(n,Array.prototype.slice.call(arguments,0,-1));i+=1}if(function(e){return null!=e&&"function"==typeof e["@@transducer/step"]}(n))return t.apply(null,Array.prototype.slice.call(arguments,0,-1))(n)}return r.apply(this,arguments)}}var zi=function(){return this.xf["@@transducer/init"]()},Vi=function(e){return this.xf["@@transducer/result"](e)};function Ki(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function Gi(e,t,r){for(var n=0,i=r.length;n<i;){if(e(t,r[n]))return!0;n+=1}return!1}function Wi(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var Hi="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},qi=Object.prototype.toString,Yi=function(){return"[object Arguments]"===qi.call(arguments)?function(e){return"[object Arguments]"===qi.call(e)}:function(e){return Wi("callee",e)}}(),Qi=!{toString:null}.propertyIsEnumerable("toString"),Ji=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Xi=function(){return arguments.propertyIsEnumerable("length")}(),ea=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1},ta="function"!=typeof Object.keys||Xi?Ui((function(e){if(Object(e)!==e)return[];var t,r,n=[],i=Xi&&Yi(e);for(t in e)!Wi(t,e)||i&&"length"===t||(n[n.length]=t);if(Qi)for(r=Ji.length-1;r>=0;)Wi(t=Ji[r],e)&&!ea(n,t)&&(n[n.length]=t),r-=1;return n})):Ui((function(e){return Object(e)!==e?[]:Object.keys(e)})),ra=Ui((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function na(e,t,r,n){var i=Ki(e);function a(e,t){return ia(e,t,r.slice(),n.slice())}return!Gi((function(e,t){return!Gi(a,t,e)}),Ki(t),i)}function ia(e,t,r,n){if(Hi(e,t))return!0;var i,a,s=ra(e);if(s!==ra(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(s){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(i=e.constructor,null==(a=String(i).match(/^function (\w*)/))?"":a[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!Hi(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!Hi(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var o=r.length-1;o>=0;){if(r[o]===e)return n[o]===t;o-=1}switch(s){case"Map":return e.size===t.size&&na(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&na(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=ta(e);if(u.length!==ta(t).length)return!1;var c=r.concat([e]),l=n.concat([t]);for(o=u.length-1;o>=0;){var h=u[o];if(!Wi(h,t)||!ia(t[h],e[h],c,l))return!1;o-=1}return!0}var aa=Pi((function(e,t){return ia(e,t,[],[])}));function sa(e,t){return function(e,t,r){var n,i;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(n=1/t;r<e.length;){if(0===(i=e[r])&&1/i===n)return r;r+=1}return-1}if(t!=t){for(;r<e.length;){if("number"==typeof(i=e[r])&&i!=i)return r;r+=1}return-1}return e.indexOf(t,r);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,r);case"object":if(null===t)return e.indexOf(t,r)}for(;r<e.length;){if(aa(e[r],t))return r;r+=1}return-1}(t,e,0)>=0}function oa(e,t){for(var r=0,n=t.length,i=Array(n);r<n;)i[r]=e(t[r]),r+=1;return i}function ua(e){return'"'+e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var ca=function(e){return(e<10?"0":"")+e},la="function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+ca(e.getUTCMonth()+1)+"-"+ca(e.getUTCDate())+"T"+ca(e.getUTCHours())+":"+ca(e.getUTCMinutes())+":"+ca(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};function ha(e,t,r){for(var n=0,i=r.length;n<i;)t=e(t,r[n]),n+=1;return t}var da=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=zi,e.prototype["@@transducer/result"]=Vi,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}();function fa(e){return function(t){return new da(e,t)}}var pa=Pi(Di(["fantasy-land/filter","filter"],fa,(function(e,t){return r=t,"[object Object]"===Object.prototype.toString.call(r)?ha((function(r,n){return e(t[n])&&(r[n]=t[n]),r}),{},ta(t)):function(e,t){for(var r=0,n=t.length,i=[];r<n;)e(t[r])&&(i[i.length]=t[r]),r+=1;return i}(e,t);var r}))),ga=Pi((function(e,t){return pa((r=e,function(){return!r.apply(this,arguments)}),t);var r}));function ya(e,t){var r=function(r){var n=t.concat([e]);return sa(r,n)?"<Circular>":ya(r,n)},n=function(e,t){return oa((function(t){return ua(t)+": "+r(e[t])}),t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+oa(r,e).join(", ")+"))";case"[object Array]":return"["+oa(r,e).concat(n(e,ga((function(e){return/^\d+$/.test(e)}),ta(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+r(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?r(NaN):ua(la(e)))+")";case"[object Map]":return"new Map("+r(Array.from(e))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+r(e.valueOf())+")":1/e==-1/0?"-0":e.toString(10);case"[object Set]":return"new Set("+r(Array.from(e).sort())+")";case"[object String]":return"object"==typeof e?"new String("+r(e.valueOf())+")":ua(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var i=e.toString();if("[object Object]"!==i)return i}return"{"+n(e,ta(e)).join(", ")+"}"}}var ma=Ui((function(e){return ya(e,[])})),va=Pi((function(e,t){if(e===t)return t;function r(e,t){if(e>t!=t>e)return t>e?t:e}var n=r(e,t);if(void 0!==n)return n;var i=r(typeof e,typeof t);if(void 0!==i)return i===typeof e?e:t;var a=ma(e),s=r(a,ma(t));return void 0!==s&&s===a?e:t})),_a=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=zi,e.prototype["@@transducer/result"]=Vi,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}(),wa=function(e){return function(t){return new _a(e,t)}},ba=Pi(Di(["fantasy-land/map","map"],wa,(function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return Mi(t.length,(function(){return e.call(this,t.apply(this,arguments))}));case"[object Object]":return ha((function(r,n){return r[n]=e(t[n]),r}),{},ta(t));default:return oa(e,t)}}))),xa=Number.isInteger||function(e){return(0|e)===e};function Ea(e){return"[object String]"===Object.prototype.toString.call(e)}function Aa(e,t){var r=e<0?t.length+e:e;return Ea(t)?t.charAt(r):t[r]}var ka=Pi((function(e,t){if(null!=t)return xa(e)?Aa(e,t):t[e]})),Ta=Pi((function(e,t){return ba(ka(e),t)})),Sa=Ui((function(e){return!!$i(e)||!!e&&"object"==typeof e&&!Ea(e)&&(0===e.length||e.length>0&&e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1))})),Oa="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function Ca(e,t,r){return function(n,i,a){if(Sa(a))return e(n,i,a);if(null==a)return i;if("function"==typeof a["fantasy-land/reduce"])return t(n,i,a,"fantasy-land/reduce");if(null!=a[Oa])return r(n,i,a[Oa]());if("function"==typeof a.next)return r(n,i,a);if("function"==typeof a.reduce)return t(n,i,a,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function Ra(e,t,r){for(var n=0,i=r.length;n<i;){if((t=e["@@transducer/step"](t,r[n]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n+=1}return e["@@transducer/result"](t)}var Ia=Pi((function(e,t){return Ni(e.length,(function(){return e.apply(t,arguments)}))}));function ja(e,t,r){for(var n=r.next();!n.done;){if((t=e["@@transducer/step"](t,n.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n=r.next()}return e["@@transducer/result"](t)}function La(e,t,r,n){return e["@@transducer/result"](r[n](Ia(e["@@transducer/step"],e),t))}var Ba=Ca(Ra,La,ja),Ua=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),Pa=Fi((function(e,t,r){return Ba("function"==typeof e?new Ua(e):e,t,r)})),Na=Ui((function(e){return Mi(Pa(va,0,Ta("length",e)),(function(){for(var t=0,r=e.length;t<r;){if(!e[t].apply(this,arguments))return!1;t+=1}return!0}))})),Za=Ui((function(e){return function(){return e}})),Ma=Pi((function(e,t){return function(e,t){var r;t=t||[];var n=(e=e||[]).length,i=t.length,a=[];for(r=0;r<n;)a[a.length]=e[r],r+=1;for(r=0;r<i;)a[a.length]=t[r],r+=1;return a}(t,[e])})),Fa=Ui((function(e){return null==e})),$a=Fi((function e(t,r,n){if(0===t.length)return r;var i=t[0];if(t.length>1){var a=!Fa(n)&&Wi(i,n)&&"object"==typeof n[i]?n[i]:xa(t[1])?[]:{};r=e(Array.prototype.slice.call(t,1),r,a)}return function(e,t,r){if(xa(e)&&$i(r)){var n=[].concat(r);return n[e]=t,n}var i={};for(var a in r)i[a]=r[a];return i[e]=t,i}(i,r,n)})),Da=Fi((function(e,t,r){return $a([e],t,r)}));function za(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t}var Va="@@transducer/init",Ka="@@transducer/step",Ga="@@transducer/result",Wa=function(){function e(e){this.xf=e}return e.prototype[Va]=zi,e.prototype[Ga]=Vi,e.prototype[Ka]=function(e,t){var r=this.xf[Ka](e,t);return r["@@transducer/reduced"]?{"@@transducer/value":r,"@@transducer/reduced":!0}:r},e}(),Ha=function(){function e(e){this.xf=new Wa(e)}return e.prototype[Va]=zi,e.prototype[Ga]=Vi,e.prototype[Ka]=function(e,t){return Sa(t)?Ba(this.xf,e,t):Ra(this.xf,e,[t])},e}();function qa(e){return function(t){return wa(e)(function(e){return new Ha(e)}(t))}}var Ya=Pi(Di(["fantasy-land/chain","chain"],qa,(function(e,t){return"function"==typeof t?function(r){return e(t(r))(r)}:function(e){for(var t,r,n,i=[],a=0,s=e.length;a<s;){if(Sa(e[a]))for(n=0,r=(t=e[a]).length;n<r;)i[i.length]=t[n],n+=1;else i[i.length]=e[a];a+=1}return i}(ba(e,t))})));function Qa(e,t){return function(){return t.call(this,e.apply(this,arguments))}}function Ja(e,t){return function(){var r=arguments.length;if(0===r)return t();var n=arguments[r-1];return $i(n)||"function"!=typeof n[e]?t.apply(this,arguments):n[e].apply(n,Array.prototype.slice.call(arguments,0,r-1))}}var Xa=Ui(Ja("tail",Fi(Ja("slice",(function(e,t,r){return Array.prototype.slice.call(r,e,t)})))(1,1/0)));function es(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return Ni(arguments[0].length,Pa(Qa,arguments[0],Xa(arguments)))}function ts(e){return e}var rs=Ui(ts),ns=Pi((function(e,t){if($i(e)){if($i(t))return e.concat(t);throw new TypeError(ma(t)+" is not an array")}if(Ea(e)){if(Ea(t))return e+t;throw new TypeError(ma(t)+" is not a string")}if(null!=e&&za(e["fantasy-land/concat"]))return e["fantasy-land/concat"](t);if(null!=e&&za(e.concat))return e.concat(t);throw new TypeError(ma(e)+' does not have a method named "concat" or "fantasy-land/concat"')})),is=Ui((function(e){return Ni(Pa(va,0,ba((function(e){return e[0].length}),e)),(function(){for(var t=0;t<e.length;){if(e[t][0].apply(this,arguments))return e[t][1].apply(this,arguments);t+=1}}))})),as=Pi((function(e,t){return null==t||t!=t?e:t})),ss=Pi((function(e,t){if(0===e.length||Fa(t))return!1;for(var r=t,n=0;n<e.length;){if(Fa(r)||!Wi(e[n],r))return!1;r=r[e[n]],n+=1}return!0})),os=Pi((function(e,t){return ss([e],t)})),us=Fi((function(e,t,r){return Mi(Math.max(e.length,t.length,r.length),(function(){return e.apply(this,arguments)?t.apply(this,arguments):r.apply(this,arguments)}))})),cs=Pi(sa),ls=Pi((function(e,t){return Mi(e+1,(function(){var r=arguments[e];if(null!=r&&za(r[t]))return r[t].apply(r,Array.prototype.slice.call(arguments,0,e));throw new TypeError(ma(r)+' does not have a method named "'+t+'"')}))})),hs=Pi((function(e,t){return t instanceof e||null!=t&&(t.constructor===e||"Object"===e.name&&"object"==typeof t)})),ds=Ui((function(e){return!Fa(e)})),fs=ls(1,"join");function ps(e,t){for(var r=t,n=0;n<e.length;n+=1){if(null==r)return;var i=e[n];r=xa(i)?Aa(i,r):r[i]}return r}var gs=Pi(ps),ys=Fi((function(e,t,r){return aa(e,ka(t,r))})),ms=Fi((function(e,t,r){return as(e,ka(t,r))})),vs=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=zi,e.prototype["@@transducer/result"]=Vi,e.prototype["@@transducer/step"]=function(e,t){return this.f(t),this.xf["@@transducer/step"](e,t)},e}();function _s(e){return function(t){return new vs(e,t)}}var ws,bs,xs,Es=Pi(Di([],_s,(function(e,t){return e(t),t})));(bs=ws||(ws={})).assertEqual=e=>e,bs.assertIs=function(e){},bs.assertNever=function(e){throw new Error},bs.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},bs.getValidEnumValues=e=>{const t=bs.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),r={};for(const n of t)r[n]=e[n];return bs.objectValues(r)},bs.objectValues=e=>bs.objectKeys(e).map((function(t){return e[t]})),bs.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},bs.find=(e,t)=>{for(const r of e)if(t(r))return r},bs.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,bs.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},bs.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(xs||(xs={})).mergeShapes=(e,t)=>({...e,...t});var As=ws.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ks=e=>{switch(typeof e){case"undefined":return As.undefined;case"string":return As.string;case"number":return isNaN(e)?As.nan:As.number;case"boolean":return As.boolean;case"function":return As.function;case"bigint":return As.bigint;case"symbol":return As.symbol;case"object":return Array.isArray(e)?As.array:null===e?As.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?As.promise:"undefined"!=typeof Map&&e instanceof Map?As.map:"undefined"!=typeof Set&&e instanceof Set?As.set:"undefined"!=typeof Date&&e instanceof Date?As.date:As.object;default:return As.unknown}},Ts=ws.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ss=class e extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ws.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};Ss.create=e=>new Ss(e);var Os=(e,t)=>{let r;switch(e.code){case Ts.invalid_type:r=e.received===As.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Ts.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ws.jsonStringifyReplacer)}`;break;case Ts.unrecognized_keys:r=`Unrecognized key(s) in object: ${ws.joinValues(e.keys,", ")}`;break;case Ts.invalid_union:r="Invalid input";break;case Ts.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ws.joinValues(e.options)}`;break;case Ts.invalid_enum_value:r=`Invalid enum value. Expected ${ws.joinValues(e.options)}, received '${e.received}'`;break;case Ts.invalid_arguments:r="Invalid function arguments";break;case Ts.invalid_return_type:r="Invalid function return type";break;case Ts.invalid_date:r="Invalid date";break;case Ts.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ws.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Ts.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Ts.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Ts.custom:r="Invalid input";break;case Ts.invalid_intersection_types:r="Intersection results could not be merged";break;case Ts.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ts.not_finite:r="Number must be finite";break;default:r=t.defaultError,ws.assertNever(e)}return{message:r}},Cs=Os;function Rs(){return Cs}var Is=e=>{const{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],s={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="";const u=n.filter((e=>!!e)).slice().reverse();for(const e of u)o=e(s,{data:t,defaultError:o}).message;return{...i,path:a,message:o}};function js(e,t){const r=Rs(),n=Is({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Os?void 0:Os].filter((e=>!!e))});e.common.issues.push(n)}var Ls,Bs,Us,Ps,Ns=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return Zs;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(t,r){const n=[];for(const e of r){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return e.mergeObjectSync(t,n)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:i}=n;if("aborted"===t.status)return Zs;if("aborted"===i.status)return Zs;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!n.alwaysSet||(r[t.value]=i.value)}return{status:e.value,value:r}}},Zs=Object.freeze({status:"aborted"}),Ms=e=>({status:"dirty",value:e}),Fs=e=>({status:"valid",value:e}),$s=e=>"aborted"===e.status,Ds=e=>"dirty"===e.status,zs=e=>"valid"===e.status,Vs=e=>"undefined"!=typeof Promise&&e instanceof Promise;function Ks(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function Gs(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}(Bs=Ls||(Ls={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Bs.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var Ws=class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Hs=(e,t)=>{if(zs(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ss(e.common.issues);return this._error=t,this._error}}};function qs(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var a,s;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!==(a=null!=o?o:n)&&void 0!==a?a:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(s=null!=o?o:r)&&void 0!==s?s:i.defaultError}},description:i}}var Ys,Qs=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ks(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ns,ctx:{common:e.parent.common,data:e.data,parsedType:ks(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Vs(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Hs(n,i)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ks(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(Vs(n)?n:Promise.resolve(n));return Hs(r,i)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),a=()=>n.addIssue({code:Ts.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(a(),!1))):!!i||(a(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Ko({schema:this,typeName:ru.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Go.create(this,this._def)}nullable(){return Wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return To.create(this,this._def)}promise(){return Vo.create(this,this._def)}or(e){return Co.create([this,e],this._def)}and(e){return Lo.create(this,e,this._def)}transform(e){return new Ko({...qs(this._def),schema:this,typeName:ru.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ho({...qs(this._def),innerType:this,defaultValue:t,typeName:ru.ZodDefault})}brand(){return new Jo({typeName:ru.ZodBranded,type:this,...qs(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new qo({...qs(this._def),innerType:this,catchValue:t,typeName:ru.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Xo.create(this,e)}readonly(){return eu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Js=/^c[^\s-]{8,}$/i,Xs=/^[0-9a-z]+$/,eo=/^[0-9A-HJKMNP-TV-Z]{26}$/,to=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ro=/^[a-z0-9_-]{21}$/i,no=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,io=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ao=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,so=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,oo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,uo="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",co=new RegExp(`^${uo}$`);function lo(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ho(e){let t=`${uo}T${lo(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}var fo=class e extends Qs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==As.string){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.string,received:t.parsedType}),Zs}const t=new Ns;let r;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,i=e.data.length<a.value;(n||i)&&(r=this._getOrReturnCtx(e,r),n?js(r,{code:Ts.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&js(r,{code:Ts.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)io.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"email",code:Ts.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Ys||(Ys=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ys.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"emoji",code:Ts.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)to.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"uuid",code:Ts.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)ro.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"nanoid",code:Ts.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Js.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"cuid",code:Ts.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Xs.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"cuid2",code:Ts.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)eo.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"ulid",code:Ts.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(n){r=this._getOrReturnCtx(e,r),js(r,{validation:"url",code:Ts.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"regex",code:Ts.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?ho(a).test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?co.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?new RegExp(`^${lo(a)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?no.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"duration",code:Ts.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?(n=e.data,("v4"!==(i=a.version)&&i||!ao.test(n))&&("v6"!==i&&i||!so.test(n))&&(r=this._getOrReturnCtx(e,r),js(r,{validation:"ip",code:Ts.invalid_string,message:a.message}),t.dirty())):"base64"===a.kind?oo.test(e.data)||(r=this._getOrReturnCtx(e,r),js(r,{validation:"base64",code:Ts.invalid_string,message:a.message}),t.dirty()):ws.assertNever(a);var n,i;return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Ts.invalid_string,...Ls.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...Ls.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ls.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ls.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ls.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ls.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ls.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ls.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ls.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ls.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ls.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...Ls.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ls.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ls.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ls.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ls.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ls.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ls.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ls.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ls.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ls.errToObj(t)})}nonempty(e){return this.min(1,Ls.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function po(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}fo.create=e=>{var t;return new fo({checks:[],typeName:ru.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...qs(e)})};var go=class e extends Qs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==As.number){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.number,received:t.parsedType}),Zs}let t;const r=new Ns;for(const n of this._def.checks)"int"===n.kind?ws.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==po(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.not_finite,message:n.message}),r.dirty()):ws.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ls.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ls.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ls.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ls.toString(t))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Ls.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:Ls.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ls.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ls.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ls.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ls.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ls.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ls.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ls.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ls.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&ws.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};go.create=e=>new go({checks:[],typeName:ru.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...qs(e)});var yo=class e extends Qs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==As.bigint){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.bigint,received:t.parsedType}),Zs}let t;const r=new Ns;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),js(t,{code:Ts.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):ws.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ls.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ls.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ls.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ls.toString(t))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Ls.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ls.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ls.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ls.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ls.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ls.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};yo.create=e=>{var t;return new yo({checks:[],typeName:ru.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...qs(e)})};var mo=class extends Qs{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==As.boolean){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.boolean,received:t.parsedType}),Zs}return Fs(e.data)}};mo.create=e=>new mo({typeName:ru.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...qs(e)});var vo=class e extends Qs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==As.date){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.date,received:t.parsedType}),Zs}if(isNaN(e.data.getTime()))return js(this._getOrReturnCtx(e),{code:Ts.invalid_date}),Zs;const t=new Ns;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),js(r,{code:Ts.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):ws.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ls.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ls.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};vo.create=e=>new vo({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ru.ZodDate,...qs(e)});var _o=class extends Qs{_parse(e){if(this._getType(e)!==As.symbol){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.symbol,received:t.parsedType}),Zs}return Fs(e.data)}};_o.create=e=>new _o({typeName:ru.ZodSymbol,...qs(e)});var wo=class extends Qs{_parse(e){if(this._getType(e)!==As.undefined){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.undefined,received:t.parsedType}),Zs}return Fs(e.data)}};wo.create=e=>new wo({typeName:ru.ZodUndefined,...qs(e)});var bo=class extends Qs{_parse(e){if(this._getType(e)!==As.null){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.null,received:t.parsedType}),Zs}return Fs(e.data)}};bo.create=e=>new bo({typeName:ru.ZodNull,...qs(e)});var xo=class extends Qs{constructor(){super(...arguments),this._any=!0}_parse(e){return Fs(e.data)}};xo.create=e=>new xo({typeName:ru.ZodAny,...qs(e)});var Eo=class extends Qs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fs(e.data)}};Eo.create=e=>new Eo({typeName:ru.ZodUnknown,...qs(e)});var Ao=class extends Qs{_parse(e){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.never,received:t.parsedType}),Zs}};Ao.create=e=>new Ao({typeName:ru.ZodNever,...qs(e)});var ko=class extends Qs{_parse(e){if(this._getType(e)!==As.undefined){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.void,received:t.parsedType}),Zs}return Fs(e.data)}};ko.create=e=>new ko({typeName:ru.ZodVoid,...qs(e)});var To=class e extends Qs{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==As.array)return js(t,{code:Ts.invalid_type,expected:As.array,received:t.parsedType}),Zs;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(js(t,{code:e?Ts.too_big:Ts.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(js(t,{code:Ts.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(js(t,{code:Ts.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Ws(t,e,t.path,r))))).then((e=>Ns.mergeArray(r,e)));const i=[...t.data].map(((e,r)=>n.type._parseSync(new Ws(t,e,t.path,r))));return Ns.mergeArray(r,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Ls.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Ls.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Ls.toString(r)}})}nonempty(e){return this.min(1,e)}};function So(e){if(e instanceof Oo){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Go.create(So(n))}return new Oo({...e._def,shape:()=>t})}return e instanceof To?new To({...e._def,type:So(e.element)}):e instanceof Go?Go.create(So(e.unwrap())):e instanceof Wo?Wo.create(So(e.unwrap())):e instanceof Bo?Bo.create(e.items.map((e=>So(e)))):e}To.create=(e,t)=>new To({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ru.ZodArray,...qs(t)});var Oo=class e extends Qs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=ws.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==As.object){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.object,received:t.parsedType}),Zs}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ao&&"strip"===this._def.unknownKeys))for(const e in r.data)i.includes(e)||a.push(e);const s=[];for(const e of i){const t=n[e],i=r.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new Ws(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Ao){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of a)s.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(js(r,{code:Ts.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new Ws(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of s){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>Ns.mergeObjectSync(t,e))):Ns.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(t){return Ls.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,r)=>{var n,i,a,s;const o=null!==(a=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,e,r).message)&&void 0!==a?a:r.defaultError;return"unrecognized_keys"===e.code?{message:null!==(s=Ls.errToObj(t).message)&&void 0!==s?s:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ru.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const r={};return ws.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(r[e]=this.shape[e])})),new e({...this._def,shape:()=>r})}omit(t){const r={};return ws.objectKeys(this.shape).forEach((e=>{t[e]||(r[e]=this.shape[e])})),new e({...this._def,shape:()=>r})}deepPartial(){return So(this)}partial(t){const r={};return ws.objectKeys(this.shape).forEach((e=>{const n=this.shape[e];t&&!t[e]?r[e]=n:r[e]=n.optional()})),new e({...this._def,shape:()=>r})}required(t){const r={};return ws.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Go;)t=t._def.innerType;r[e]=t}})),new e({...this._def,shape:()=>r})}keyof(){return $o(ws.objectKeys(this.shape))}};Oo.create=(e,t)=>new Oo({shape:()=>e,unknownKeys:"strip",catchall:Ao.create(),typeName:ru.ZodObject,...qs(t)}),Oo.strictCreate=(e,t)=>new Oo({shape:()=>e,unknownKeys:"strict",catchall:Ao.create(),typeName:ru.ZodObject,...qs(t)}),Oo.lazycreate=(e,t)=>new Oo({shape:e,unknownKeys:"strip",catchall:Ao.create(),typeName:ru.ZodObject,...qs(t)});var Co=class extends Qs{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new Ss(e.ctx.common.issues)));return js(t,{code:Ts.invalid_union,unionErrors:r}),Zs}));{let e;const n=[];for(const i of r){const r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=n.map((e=>new Ss(e)));return js(t,{code:Ts.invalid_union,unionErrors:i}),Zs}}get options(){return this._def.options}};Co.create=(e,t)=>new Co({options:e,typeName:ru.ZodUnion,...qs(t)});var Ro=e=>e instanceof Mo?Ro(e.schema):e instanceof Ko?Ro(e.innerType()):e instanceof Fo?[e.value]:e instanceof Do?e.options:e instanceof zo?ws.objectValues(e.enum):e instanceof Ho?Ro(e._def.innerType):e instanceof wo?[void 0]:e instanceof bo?[null]:e instanceof Go?[void 0,...Ro(e.unwrap())]:e instanceof Wo?[null,...Ro(e.unwrap())]:e instanceof Jo||e instanceof eu?Ro(e.unwrap()):e instanceof qo?Ro(e._def.innerType):[],Io=class e extends Qs{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==As.object)return js(t,{code:Ts.invalid_type,expected:As.object,received:t.parsedType}),Zs;const r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(js(t,{code:Ts.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Zs)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const i=new Map;for(const e of r){const r=Ro(e.shape[t]);if(!r.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const n of r){if(i.has(n))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(n)}`);i.set(n,e)}}return new e({typeName:ru.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...qs(n)})}};function jo(e,t){const r=ks(e),n=ks(t);if(e===t)return{valid:!0,data:e};if(r===As.object&&n===As.object){const r=ws.objectKeys(t),n=ws.objectKeys(e).filter((e=>-1!==r.indexOf(e))),i={...e,...t};for(const r of n){const n=jo(e[r],t[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(r===As.array&&n===As.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const i=jo(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===As.date&&n===As.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Lo=class extends Qs{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if($s(e)||$s(n))return Zs;const i=jo(e.value,n.value);return i.valid?((Ds(e)||Ds(n))&&t.dirty(),{status:t.value,value:i.data}):(js(r,{code:Ts.invalid_intersection_types}),Zs)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Lo.create=(e,t,r)=>new Lo({left:e,right:t,typeName:ru.ZodIntersection,...qs(r)});var Bo=class e extends Qs{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==As.array)return js(r,{code:Ts.invalid_type,expected:As.array,received:r.parsedType}),Zs;if(r.data.length<this._def.items.length)return js(r,{code:Ts.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Zs;!this._def.rest&&r.data.length>this._def.items.length&&(js(r,{code:Ts.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Ws(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>Ns.mergeArray(t,e))):Ns.mergeArray(t,n)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Bo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bo({items:e,typeName:ru.ZodTuple,rest:null,...qs(t)})};var Uo=class e extends Qs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==As.object)return js(r,{code:Ts.invalid_type,expected:As.object,received:r.parsedType}),Zs;const n=[],i=this._def.keyType,a=this._def.valueType;for(const e in r.data)n.push({key:i._parse(new Ws(r,e,r.path,e)),value:a._parse(new Ws(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Ns.mergeObjectAsync(t,n):Ns.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(t,r,n){return new e(r instanceof Qs?{keyType:t,valueType:r,typeName:ru.ZodRecord,...qs(n)}:{keyType:fo.create(),valueType:t,typeName:ru.ZodRecord,...qs(r)})}},Po=class extends Qs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==As.map)return js(r,{code:Ts.invalid_type,expected:As.map,received:r.parsedType}),Zs;const n=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map((([e,t],a)=>({key:n._parse(new Ws(r,e,r.path,[a,"key"])),value:i._parse(new Ws(r,t,r.path,[a,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of a){const n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return Zs;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of a){const n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return Zs;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}};Po.create=(e,t,r)=>new Po({valueType:t,keyType:e,typeName:ru.ZodMap,...qs(r)});var No=class e extends Qs{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==As.set)return js(r,{code:Ts.invalid_type,expected:As.set,received:r.parsedType}),Zs;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(js(r,{code:Ts.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(js(r,{code:Ts.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function a(e){const r=new Set;for(const n of e){if("aborted"===n.status)return Zs;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const s=[...r.data.values()].map(((e,t)=>i._parse(new Ws(r,e,r.path,t))));return r.common.async?Promise.all(s).then((e=>a(e))):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:Ls.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Ls.toString(r)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};No.create=(e,t)=>new No({valueType:e,minSize:null,maxSize:null,typeName:ru.ZodSet,...qs(t)});var Zo=class e extends Qs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==As.function)return js(t,{code:Ts.invalid_type,expected:As.function,received:t.parsedType}),Zs;function r(e,r){return Is({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rs(),Os].filter((e=>!!e)),issueData:{code:Ts.invalid_arguments,argumentsError:r}})}function n(e,r){return Is({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rs(),Os].filter((e=>!!e)),issueData:{code:Ts.invalid_return_type,returnTypeError:r}})}const i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Vo){const e=this;return Fs((async function(...t){const s=new Ss([]),o=await e._def.args.parseAsync(t,i).catch((e=>{throw s.addIssue(r(t,e)),s})),u=await Reflect.apply(a,this,o),c=await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw s.addIssue(n(u,e)),s}));return c}))}{const e=this;return Fs((function(...t){const s=e._def.args.safeParse(t,i);if(!s.success)throw new Ss([r(t,s.error)]);const o=Reflect.apply(a,this,s.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Ss([n(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Bo.create(t).rest(Eo.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,r,n){return new e({args:t||Bo.create([]).rest(Eo.create()),returns:r||Eo.create(),typeName:ru.ZodFunction,...qs(n)})}},Mo=class extends Qs{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Mo.create=(e,t)=>new Mo({getter:e,typeName:ru.ZodLazy,...qs(t)});var Fo=class extends Qs{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return js(t,{received:t.data,code:Ts.invalid_literal,expected:this._def.value}),Zs}return{status:"valid",value:e.data}}get value(){return this._def.value}};function $o(e,t){return new Do({values:e,typeName:ru.ZodEnum,...qs(t)})}Fo.create=(e,t)=>new Fo({value:e,typeName:ru.ZodLiteral,...qs(t)});var Do=class e extends Qs{constructor(){super(...arguments),Us.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return js(t,{expected:ws.joinValues(r),received:t.parsedType,code:Ts.invalid_type}),Zs}if(Ks(this,Us,"f")||Gs(this,Us,new Set(this._def.values),"f"),!Ks(this,Us,"f").has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return js(t,{received:t.data,code:Ts.invalid_enum_value,options:r}),Zs}return Fs(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter((e=>!t.includes(e))),{...this._def,...r})}};Us=new WeakMap,Do.create=$o;var zo=class extends Qs{constructor(){super(...arguments),Ps.set(this,void 0)}_parse(e){const t=ws.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==As.string&&r.parsedType!==As.number){const e=ws.objectValues(t);return js(r,{expected:ws.joinValues(e),received:r.parsedType,code:Ts.invalid_type}),Zs}if(Ks(this,Ps,"f")||Gs(this,Ps,new Set(ws.getValidEnumValues(this._def.values)),"f"),!Ks(this,Ps,"f").has(e.data)){const e=ws.objectValues(t);return js(r,{received:r.data,code:Ts.invalid_enum_value,options:e}),Zs}return Fs(e.data)}get enum(){return this._def.values}};Ps=new WeakMap,zo.create=(e,t)=>new zo({values:e,typeName:ru.ZodNativeEnum,...qs(t)});var Vo=class extends Qs{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==As.promise&&!1===t.common.async)return js(t,{code:Ts.invalid_type,expected:As.promise,received:t.parsedType}),Zs;const r=t.parsedType===As.promise?t.data:Promise.resolve(t.data);return Fs(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}};Vo.create=(e,t)=>new Vo({type:e,typeName:ru.ZodPromise,...qs(t)});var Ko=class extends Qs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ru.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{js(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){const e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Zs;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?Zs:"dirty"===n.status||"dirty"===t.value?Ms(n.value):n}));{if("aborted"===t.value)return Zs;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?Zs:"dirty"===n.status||"dirty"===t.value?Ms(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?Zs:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?Zs:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!zs(e))return e;const a=n.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>zs(e)?Promise.resolve(n.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}ws.assertNever(n)}};Ko.create=(e,t,r)=>new Ko({schema:e,typeName:ru.ZodEffects,effect:t,...qs(r)}),Ko.createWithPreprocess=(e,t,r)=>new Ko({schema:t,effect:{type:"preprocess",transform:e},typeName:ru.ZodEffects,...qs(r)});var Go=class extends Qs{_parse(e){return this._getType(e)===As.undefined?Fs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Go.create=(e,t)=>new Go({innerType:e,typeName:ru.ZodOptional,...qs(t)});var Wo=class extends Qs{_parse(e){return this._getType(e)===As.null?Fs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Wo.create=(e,t)=>new Wo({innerType:e,typeName:ru.ZodNullable,...qs(t)});var Ho=class extends Qs{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===As.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ho.create=(e,t)=>new Ho({innerType:e,typeName:ru.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...qs(t)});var qo=class extends Qs{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vs(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ss(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Ss(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};qo.create=(e,t)=>new qo({innerType:e,typeName:ru.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...qs(t)});var Yo=class extends Qs{_parse(e){if(this._getType(e)!==As.nan){const t=this._getOrReturnCtx(e);return js(t,{code:Ts.invalid_type,expected:As.nan,received:t.parsedType}),Zs}return{status:"valid",value:e.data}}};Yo.create=e=>new Yo({typeName:ru.ZodNaN,...qs(e)});var Qo=Symbol("zod_brand"),Jo=class extends Qs{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Xo=class e extends Qs{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Zs:"dirty"===e.status?(t.dirty(),Ms(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Zs:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(t,r){return new e({in:t,out:r,typeName:ru.ZodPipeline})}},eu=class extends Qs{_parse(e){const t=this._def.innerType._parse(e),r=e=>(zs(e)&&(e.value=Object.freeze(e.value)),e);return Vs(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}};function tu(e,t={},r){return e?xo.create().superRefine(((n,i)=>{var a,s;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:r)||void 0===s||s,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:o})}})):xo.create()}eu.create=(e,t)=>new eu({innerType:e,typeName:ru.ZodReadonly,...qs(t)});var ru,nu,iu={object:Oo.lazycreate};(nu=ru||(ru={})).ZodString="ZodString",nu.ZodNumber="ZodNumber",nu.ZodNaN="ZodNaN",nu.ZodBigInt="ZodBigInt",nu.ZodBoolean="ZodBoolean",nu.ZodDate="ZodDate",nu.ZodSymbol="ZodSymbol",nu.ZodUndefined="ZodUndefined",nu.ZodNull="ZodNull",nu.ZodAny="ZodAny",nu.ZodUnknown="ZodUnknown",nu.ZodNever="ZodNever",nu.ZodVoid="ZodVoid",nu.ZodArray="ZodArray",nu.ZodObject="ZodObject",nu.ZodUnion="ZodUnion",nu.ZodDiscriminatedUnion="ZodDiscriminatedUnion",nu.ZodIntersection="ZodIntersection",nu.ZodTuple="ZodTuple",nu.ZodRecord="ZodRecord",nu.ZodMap="ZodMap",nu.ZodSet="ZodSet",nu.ZodFunction="ZodFunction",nu.ZodLazy="ZodLazy",nu.ZodLiteral="ZodLiteral",nu.ZodEnum="ZodEnum",nu.ZodEffects="ZodEffects",nu.ZodNativeEnum="ZodNativeEnum",nu.ZodOptional="ZodOptional",nu.ZodNullable="ZodNullable",nu.ZodDefault="ZodDefault",nu.ZodCatch="ZodCatch",nu.ZodPromise="ZodPromise",nu.ZodBranded="ZodBranded",nu.ZodPipeline="ZodPipeline",nu.ZodReadonly="ZodReadonly";var au=fo.create,su=go.create,ou=Yo.create,uu=yo.create,cu=mo.create,lu=vo.create,hu=_o.create,du=wo.create,fu=bo.create,pu=xo.create,gu=Eo.create,yu=Ao.create,mu=ko.create,vu=To.create,_u=Oo.create,wu=Oo.strictCreate,bu=Co.create,xu=Io.create,Eu=Lo.create,Au=Bo.create,ku=Uo.create,Tu=Po.create,Su=No.create,Ou=Zo.create,Cu=Mo.create,Ru=Fo.create,Iu=Do.create,ju=zo.create,Lu=Vo.create,Bu=Ko.create,Uu=Go.create,Pu=Wo.create,Nu=Ko.createWithPreprocess,Zu=Xo.create,Mu={string:e=>fo.create({...e,coerce:!0}),number:e=>go.create({...e,coerce:!0}),boolean:e=>mo.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>vo.create({...e,coerce:!0})},Fu=Zs,$u=Object.freeze({__proto__:null,defaultErrorMap:Os,setErrorMap:function(e){Cs=e},getErrorMap:Rs,makeIssue:Is,EMPTY_PATH:[],addIssueToContext:js,ParseStatus:Ns,INVALID:Zs,DIRTY:Ms,OK:Fs,isAborted:$s,isDirty:Ds,isValid:zs,isAsync:Vs,get util(){return ws},get objectUtil(){return xs},ZodParsedType:As,getParsedType:ks,ZodType:Qs,datetimeRegex:ho,ZodString:fo,ZodNumber:go,ZodBigInt:yo,ZodBoolean:mo,ZodDate:vo,ZodSymbol:_o,ZodUndefined:wo,ZodNull:bo,ZodAny:xo,ZodUnknown:Eo,ZodNever:Ao,ZodVoid:ko,ZodArray:To,ZodObject:Oo,ZodUnion:Co,ZodDiscriminatedUnion:Io,ZodIntersection:Lo,ZodTuple:Bo,ZodRecord:Uo,ZodMap:Po,ZodSet:No,ZodFunction:Zo,ZodLazy:Mo,ZodLiteral:Fo,ZodEnum:Do,ZodNativeEnum:zo,ZodPromise:Vo,ZodEffects:Ko,ZodTransformer:Ko,ZodOptional:Go,ZodNullable:Wo,ZodDefault:Ho,ZodCatch:qo,ZodNaN:Yo,BRAND:Qo,ZodBranded:Jo,ZodPipeline:Xo,ZodReadonly:eu,custom:tu,Schema:Qs,ZodSchema:Qs,late:iu,get ZodFirstPartyTypeKind(){return ru},coerce:Mu,any:pu,array:vu,bigint:uu,boolean:cu,date:lu,discriminatedUnion:xu,effect:Bu,enum:Iu,function:Ou,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>tu((t=>t instanceof e),t),intersection:Eu,lazy:Cu,literal:Ru,map:Tu,nan:ou,nativeEnum:ju,never:yu,null:fu,nullable:Pu,number:su,object:_u,oboolean:()=>cu().optional(),onumber:()=>su().optional(),optional:Uu,ostring:()=>au().optional(),pipeline:Zu,preprocess:Nu,promise:Lu,record:ku,set:Su,strictObject:wu,string:au,symbol:hu,transformer:Bu,tuple:Au,undefined:du,union:bu,unknown:gu,void:mu,NEVER:Fu,ZodIssueCode:Ts,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Ss});function Du({fetch:e,GRAPHQL_URL:t,logger:r}){const n=$u.object({data:$u.object({transactions:$u.object({edges:$u.array($u.object({node:$u.record($u.any())}))})})});return i=>yi(i).chain(_i((i=>e(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"\n query GetTransactions ($transactionIds: [ID!]!) {\n transactions(ids: $transactionIds) {\n edges {\n node {\n owner {\n address\n }\n tags {\n name\n value\n }\n block {\n id\n height\n timestamp\n }\n }\n }\n }\n }",variables:{transactionIds:[i]}})}).then((async e=>{if(e.ok)return e.json();throw r('Error Encountered when querying gateway for transaction "%s"',i),new Error(`${e.status}: ${await e.text()}`)})).then(n.parse).then(gs(["data","transactions","edges","0","node"]))))).toPromise()}var zu=l(w(),1),Vu=(e="@permaweb/aoconnect")=>{const t=(0,zu.default)(e);return t.child=e=>Vu(`${t.namespace}:${e}`),t.tap=(e,...r)=>Es(((...n)=>t(e,...r,...n))),t},Ku=({url:e,path:t})=>t?t.startsWith("/")?Ku({url:e,path:t.slice(1)}):((e=new URL(e)).pathname+=t,e.toString()):e;function Gu(e){return es(as([]),Pa(((e,t)=>es(ms([],t.name),Ma(t.value),Da(t.name,Li,e))(e)),{}),ba((e=>e.length>1?e:e[0])))(e)}function Wu(e,t){return r=>ga(Na([ys(e,"name"),us(Za(t),ys(t,"value"),ji)]),r)}function Hu(e){return is([[hs(String),aa(e)],[hs(Array),cs(e)],[ji,Ii]])}function qu(e){let t;var r;return hs(Ss,e)?(t=new Error((r=e,es((e=>function e(t,r,n){return Pa(((t,i)=>es(is([[aa(Ts.invalid_arguments),()=>e(i.argumentsError,422,"Invalid Arguments")],[aa(Ts.invalid_return_type),()=>e(i.returnTypeError,500,"Invalid Return")],[aa(Ts.invalid_union),()=>Ya((t=>e(t,400,"Invalid Union")),i.unionErrors)],[ji,()=>[{...i,status:r,contextCode:n}]]]),ns(t))(i.code)),[],t.issues)}(e,400,"")),(e=>Pa(((e,t)=>{const{message:r,path:n,contextCode:i}=t,a=n[1]||n[0],s=i?`${i} `:"";return e.push(`${s}'${a}': ${r}.`),e}),[],e)),fs(" | "))(r))),t.stack+=e.stack):t=hs(Error,e)?e:os("message",e)?new Error(e.message):hs(String,e)?new Error(e):new Error("An error occurred"),t}var Yu=$u.object({id:$u.string().min(1,{message:"message is required to be a message id"}),processId:$u.string().min(1,{message:"process is required to be a process id"})}),Qu=$u.object({name:$u.string(),value:$u.string()}),Ju=$u.function().args($u.object({Id:$u.string(),Target:$u.string(),Owner:$u.string(),Anchor:$u.string().optional(),Data:$u.any().default("1234"),Tags:$u.array($u.object({name:$u.string(),value:$u.string()}))})).returns($u.promise($u.any())),Xu=$u.function().args($u.object({id:$u.string().min(1,{message:"message id is required"}),processId:$u.string().min(1,{message:"process id is required"})})).returns($u.promise($u.any())),ec=$u.function().args($u.object({process:$u.string().min(1,{message:"process id is required"}),from:$u.string().optional(),to:$u.string().optional(),sort:$u.enum(["ASC","DESC"]).default("ASC"),limit:$u.number().optional()})).returns($u.promise($u.object({edges:$u.array($u.object({cursor:$u.string(),node:$u.object({Output:$u.any().optional(),Messages:$u.array($u.any()).optional(),Spawns:$u.array($u.any()).optional(),Error:$u.any().optional()})}))}))),tc=$u.function().args($u.object({processId:$u.string(),data:$u.any(),tags:$u.array(Qu),anchor:$u.string().optional(),signer:$u.any()})).returns($u.promise($u.object({messageId:$u.string()}).passthrough())),rc=$u.function().args($u.object({data:$u.any(),tags:$u.array(Qu),signer:$u.any()})).returns($u.promise($u.object({processId:$u.string()}).passthrough())),nc=$u.function().args($u.object({process:$u.string(),message:$u.string(),baseLayer:$u.boolean().optional(),exclude:$u.array($u.string()).optional()})).returns($u.promise($u.object({assignmentId:$u.string()}).passthrough())),ic=tc,ac=($u.function().args($u.object({suUrl:$u.string().url(),processId:$u.string()})).returns($u.promise($u.object({tags:$u.array(Qu)}).passthrough())),$u.function().args($u.string()).returns($u.promise($u.object({url:$u.string()}))),$u.function().args($u.string()).returns($u.promise($u.boolean()))),sc=$u.function().args($u.string()).returns($u.promise($u.object({tags:$u.array(Qu)}).passthrough())),oc=$u.function().args($u.object({data:$u.any(),tags:$u.array(Qu),target:$u.string().optional(),anchor:$u.string().optional()})).returns($u.promise($u.object({id:$u.string(),raw:$u.any()})));var uc=$u.array($u.object({name:$u.string(),value:$u.string()}));var cc=(e,t,r)=>n=>t(n[e])?mi(n):vi(`Tag '${e}': ${r}`);var lc=$u.array($u.object({name:$u.string(),value:$u.string()}));var hc=$u.object({process:$u.string().min(1,{message:"process identifier is required"}),from:$u.string().optional(),to:$u.string().optional(),sort:$u.enum(["ASC","DESC"]).default("ASC"),limit:$u.number().optional()});var dc=$u.object({Id:$u.string(),Target:$u.string(),Owner:$u.string(),Anchor:$u.string().optional(),Data:$u.any().default("1234"),Tags:$u.array($u.object({name:$u.string(),value:$u.string()}))});function fc({process:e,data:t,tags:r,anchor:n,...i}){return{Id:"1234",Owner:"1234",...i,Target:e,Data:t||"1234",Tags:r||[],Anchor:n||"0"}}function pc(e){const t=function(e){const t=nc.implement(e.deployAssign);return e=>yi(e).chain(_i((({process:e,message:r,baseLayer:n,exclude:i})=>t({process:e,message:r,baseLayer:n,exclude:i})))).map((t=>Da("assignmentId",t.assignmentId,e)))}(e);return({process:e,message:r,baseLayer:n,exclude:i})=>yi({process:e,message:r,baseLayer:n,exclude:i}).chain(t).map((e=>e.assignmentId)).bimap(qu,rs).toPromise()}var gc={};c(gc,{createDataItemSigner:()=>gl});var yc=l(E(),1),mc={};c(mc,{AVSCTap:()=>Jc,ArweaveSigner:()=>Hc,DataItem:()=>ul,MAX_TAG_BYTES:()=>sl,MIN_BINARY_SIZE:()=>ol,SIG_CONFIG:()=>Wc,SignatureConfig:()=>Dc,Signer:()=>Pc,createData:()=>ll,default:()=>dl,deserializeTags:()=>tl,indexToType:()=>qc,serializeTags:()=>Xc,tagsExceedLimit:()=>el,warparbundles:()=>fl});var vc=Object.create,_c=Object.defineProperty,wc=Object.getOwnPropertyDescriptor,bc=Object.getOwnPropertyNames,xc=Object.getPrototypeOf,Ec=Object.prototype.hasOwnProperty,Ac=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kc=(e,t,r)=>(r=null!=e?vc(xc(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of bc(t))!Ec.call(e,r)&&undefined!==r&&_c(e,r,{get:()=>t[r],enumerable:!(n=wc(t,r))||n.enumerable});return e})(!t&&e&&e.__esModule?r:_c(r,"default",{value:e,enumerable:!0}),e)),Tc=Ac((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var t=e.length,r=t%4;if(!r)return e;var n=t,i=4-r,a=t+i,s=Buffer.alloc(a);for(s.write(e);i--;)s.write("=",n++);return s.toString()}})),Sc=Ac((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Tc();function r(e,t){return void 0===t&&(t="utf8"),Buffer.isBuffer(e)?i(e.toString("base64")):i(Buffer.from(e,t).toString("base64"))}function n(e){return e=e.toString(),t.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function i(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var a=r;a.encode=r,a.decode=function(e,t){return void 0===t&&(t="utf8"),Buffer.from(n(e),"base64").toString(t)},a.toBase64=n,a.fromBase64=i,a.toBuffer=function(e){return Buffer.from(n(e),"base64")},e.default=a})),Oc=Ac(((e,t)=>{t.exports=Sc().default,t.exports.default=t.exports})),Cc=Ac((e=>{e.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},e.toByteArray=function(e){var t,r,a=s(e),o=a[0],u=a[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,u)),l=0,h=u>0?o-4:o;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},e.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],s=16383,o=0,c=n-i;o<c;o+=s)a.push(u(e,o,o+s>c?c:o+s));return 1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),a.join("")};var t,r=[],n=[],i=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(t=0;t<64;++t)r[t]=a[t],n[a.charCodeAt(t)]=t;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function o(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function u(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(o(n));return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63})),Rc=Ac((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.b64UrlDecode=e.b64UrlEncode=e.bufferTob64Url=e.bufferTob64=e.b64UrlToBuffer=e.stringToB64Url=e.stringToBuffer=e.bufferToString=e.b64UrlToString=e.concatBuffers=void 0;var t=Cc();function r(e){return new TextDecoder("utf-8",{fatal:!0}).decode(e)}function n(e){return(new TextEncoder).encode(e)}function i(e){return new Uint8Array(t.toByteArray(u(e)))}function a(e){return t.fromByteArray(new Uint8Array(e))}function s(e){return o(a(e))}function o(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}function u(e){let t;return t=(e=e.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-e.length%4,e.concat("=".repeat(t))}e.concatBuffers=function(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r].byteLength;let r=new Uint8Array(t),n=0;r.set(new Uint8Array(e[0]),n),n+=e[0].byteLength;for(let t=1;t<e.length;t++)r.set(new Uint8Array(e[t]),n),n+=e[t].byteLength;return r},e.b64UrlToString=function(e){return r(i(e))},e.bufferToString=r,e.stringToBuffer=n,e.stringToB64Url=function(e){return s(n(e))},e.b64UrlToBuffer=i,e.bufferTob64=a,e.bufferTob64Url=s,e.b64UrlEncode=o,e.b64UrlDecode=u})),Ic=Ac((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Rc();e.default=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let e=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),t=await this.driver.exportKey("jwk",e.privateKey);return{kty:t.kty,e:t.e,n:t.n,d:t.d,p:t.p,q:t.q,dp:t.dp,dq:t.dq,qi:t.qi}}async sign(e,t,{saltLength:r}={}){let n=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(e),t);return new Uint8Array(n)}async hash(e,t="SHA-256"){let r=await this.driver.digest(t,e);return new Uint8Array(r)}async verify(e,t,r){let n={kty:"RSA",e:"AQAB",n:e},i=await this.jwkToPublicCryptoKey(n),a=await this.driver.digest("SHA-256",t),s=await this.driver.verify({name:"RSA-PSS",saltLength:0},i,r,t),o=await this.driver.verify({name:"RSA-PSS",saltLength:32},i,r,t),u=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((i.algorithm.modulusLength-1)/8)-a.byteLength-2},i,r,t);return s||o||u}async jwkToCryptoKey(e){return this.driver.importKey("jwk",e,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(e){return this.driver.importKey("jwk",e,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let e=crypto?.subtle;return void 0!==e&&["generateKey","importKey","exportKey","digest","sign"].every((t=>"function"==typeof e[t]))}async encrypt(e,r,n){let i=await this.driver.importKey("raw","string"==typeof r?t.stringToBuffer(r):r,{name:"PBKDF2",length:32},!1,["deriveKey"]),a=await this.driver.deriveKey({name:"PBKDF2",salt:n?t.stringToBuffer(n):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=new Uint8Array(16);crypto.getRandomValues(s);let o=await this.driver.encrypt({name:"AES-CBC",iv:s},a,e);return t.concatBuffers([s,o])}async decrypt(e,r,n){let i=await this.driver.importKey("raw","string"==typeof r?t.stringToBuffer(r):r,{name:"PBKDF2",length:32},!1,["deriveKey"]),a=await this.driver.deriveKey({name:"PBKDF2",salt:n?t.stringToBuffer(n):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},i,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),s=e.slice(0,16),o=await this.driver.decrypt({name:"AES-CBC",iv:s},a,e.slice(16));return t.concatBuffers([o])}}})),jc=Ac((e=>{e.read=function(e,t,r,n,i){var a,s,o=8*i-n-1,u=(1<<o)-1,c=u>>1,l=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,a=f&(1<<-l)-1,f>>=-l,l+=o;l>0;a=256*a+e[t+h],h+=d,l-=8);for(s=a&(1<<-l)-1,a>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===a)a=1-c;else{if(a===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),a-=c}return(f?-1:1)*s*Math.pow(2,a-n)},e.write=function(e,t,r,n,i,a){var s,o,u,c=8*a-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:a-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(o=0,s=l):s+h>=1?(o=(t*u-1)*Math.pow(2,i),s+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&o,f+=p,o/=256,i-=8);for(s=s<<i|o,c+=i;c>0;e[r+f]=255&s,f+=p,s/=256,c-=8);e[r+f-p]|=128*g}})),Lc=Ac((e=>{var t=Cc(),r=jc(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},e.INSPECT_MAX_BYTES=50;var i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return o(e,t,r)}function o(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=0|f(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(W(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);let i=function(e){if(s.isBuffer(e)){let t=0|d(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||H(e.length)?a(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(i)return i;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|d(e))}function l(e){let t=e.length<0?0:0|d(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,s.prototype),n}function d(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(e).length;default:if(i)return n?-1:V(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),H(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){let a,s=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,o/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(a=r;a<o;a++)if(c(e,a)===c(t,-1===n?0:a-n)){if(-1===n&&(n=a),a-n+1===u)return n*s}else-1!==n&&(a-=a-n),n=-1}else for(r+u>o&&(r=o-u),a=r;a>=0;a--){let r=!0;for(let n=0;n<u;n++)if(c(e,a+n)!==c(t,n)){r=!1;break}if(r)return a}return-1}function v(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;let a,s=t.length;for(n>s/2&&(n=s/2),a=0;a<n;++a){let n=parseInt(t.substr(2*a,2),16);if(H(n))return a;e[r+a]=n}return a}function _(e,t,r,n){return G(V(t,e.length-r),e,r,n)}function w(e,t,r,n){return G(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function b(e,t,r,n){return G(K(t),e,r,n)}function x(e,t,r,n){return G(function(e,t){let r,n,i,a=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function E(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function A(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let t=e[i],a=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,o,u;switch(s){case 1:t<128&&(a=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(a=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(a=u));break;case 4:r=e[i+1],n=e[i+2],o=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&o)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&o,u>65535&&u<1114112&&(a=u))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return function(e){let t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=k));return r}(n)}e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch{return!1}}(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return o(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(W(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),W(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;let n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){let t=e[r];if(W(t,Uint8Array))i+t.length>n.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){let t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(W(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),u=Math.min(a,o),c=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<u;++e)if(c[e]!==l[e]){a=c[e],o=l[e];break}return a<o?-1:o<a?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}let i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return b(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function T(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function S(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function O(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=q[e[n]];return i}function C(e,t,r){let n=e.slice(t,r),i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function R(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,r,n,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i){F(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function L(e,t,r,n,i){F(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a>>=8,e[r+6]=a,a>>=8,e[r+5]=a,a>>=8,e[r+4]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function B(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,n,i,a){return t=+t,n>>>=0,a||B(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function P(e,t,n,i,a){return t=+t,n>>>=0,a||B(e,0,n,8),r.write(e,t,n,i,52,8),n+8}s.prototype.slice=function(e,t){let r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=this[e],i=1,a=0;for(;++a<t&&(i*=256);)n+=this[e+a]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||R(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=Y((function(e){$(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&D(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Y((function(e){$(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&D(e,this.length-8);let n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=this[e],i=1,a=0;for(;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||R(e,t,this.length);let n=t,i=1,a=this[e+--n];for(;n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||R(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||R(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=Y((function(e){$(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&D(e,this.length-8);let n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),s.prototype.readBigInt64BE=Y((function(e){$(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&D(e,this.length-8);let n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||R(e,4,this.length),r.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||R(e,4,this.length),r.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||R(e,8,this.length),r.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||R(e,8,this.length),r.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||I(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=Y((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Y((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);I(this,e,t,r,n-1,-n)}let i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);I(this,e,t,r,n-1,-n)}let i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=Y((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Y((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return P(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return P(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&0!==n&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);let i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){let t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,n),o=a.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%o]}return this};var N={};function Z(e,t,r){N[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function M(e){let t="",r=e.length,n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,n,i,a){if(e>r||e<t){let n,i="bigint"==typeof t?"n":"";throw n=a>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(a+1)}${i}`:`>= -(2${i} ** ${8*(a+1)-1}${i}) and < 2 ** ${8*(a+1)-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new N.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){$(t,"offset"),(void 0===e[t]||void 0===e[t+r])&&D(t,e.length-(r+1))}(n,i,a)}function $(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function D(e,t,r){throw Math.floor(e)!==e?($(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new N.ERR_BUFFER_OUT_OF_BOUNDS:new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}Z("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Z("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),Z("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=M(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=M(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);var z=/[^+/0-9A-Za-z-_]/g;function V(e,t){t=t||1/0;let r,n=e.length,i=null,a=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function K(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function W(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function H(e){return e!=e}var q=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Y(e){return typeof BigInt>"u"?Q:e}function Q(){throw new Error("BigInt not supported")}})),Bc=Ac(((e,t)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,t.exports={Buffer:Lc().Buffer,Crypto:window.crypto}):t.exports={Buffer:Lc().Buffer,Crypto:crypto}})),Uc={};((e,t)=>{for(var r in t)_c(e,r,{get:t[r],enumerable:!0})})(Uc,{AVSCTap:()=>Jc,ArweaveSigner:()=>Hc,DataItem:()=>ul,MAX_TAG_BYTES:()=>sl,MIN_BINARY_SIZE:()=>ol,SIG_CONFIG:()=>Wc,SignatureConfig:()=>Dc,Signer:()=>Pc,createData:()=>ll,deserializeTags:()=>tl,indexToType:()=>qc,serializeTags:()=>Xc,tagsExceedLimit:()=>el});var Pc=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(e,t,r,n){throw new Error("You must implement verify method on child")}},Nc=kc(Oc(),1),Zc=kc(Rc(),1);async function Mc(e){if(Array.isArray(e)){let t=(0,Zc.concatBuffers)([(0,Zc.stringToBuffer)("list"),(0,Zc.stringToBuffer)(e.length.toString())]);return await Fc(e,await Gc().hash(t,"SHA-384"))}let t=e,r=(0,Zc.concatBuffers)([(0,Zc.stringToBuffer)("blob"),(0,Zc.stringToBuffer)(t.byteLength.toString())]),n=(0,Zc.concatBuffers)([await Gc().hash(r,"SHA-384"),await Gc().hash(t,"SHA-384")]);return await Gc().hash(n,"SHA-384")}async function Fc(e,t){if(e.length<1)return t;let r=(0,Zc.concatBuffers)([t,await Mc(e[0])]),n=await Gc().hash(r,"SHA-384");return await Fc(e.slice(1),n)}var $c,Dc,zc=kc(Ic(),1),Vc=zc.default.default?zc.default.default:zc.default,Kc=class extends Vc{getPublicKey(e){throw new Error("Unimplemented")}};function Gc(){return $c??=new Kc}!function(e){e[e.ARWEAVE=1]="ARWEAVE",e[e.ED25519=2]="ED25519",e[e.ETHEREUM=3]="ETHEREUM",e[e.SOLANA=4]="SOLANA",e[e.INJECTEDAPTOS=5]="INJECTEDAPTOS",e[e.MULTIAPTOS=6]="MULTIAPTOS",e[e.TYPEDETHEREUM=7]="TYPEDETHEREUM"}(Dc||(Dc={}));var Wc={[Dc.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[Dc.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[Dc.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[Dc.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[Dc.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[Dc.MULTIAPTOS]:{sigLength:2052,pubLength:1025,sigName:"multiAptos"},[Dc.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},Hc=class{signatureType=1;ownerLength=Wc[1].pubLength;signatureLength=Wc[1].sigLength;jwk;pk;constructor(e){this.pk=e.n,this.jwk=e}get publicKey(){return Nc.default.toBuffer(this.pk)}sign(e){return Gc().sign(this.jwk,e)}static async verify(e,t,r){return await Gc().verify(e,t,r)}},qc={1:Hc},Yc=kc(Oc(),1);async function Qc(e){return Mc([(0,Zc.stringToBuffer)("dataitem"),(0,Zc.stringToBuffer)("1"),(0,Zc.stringToBuffer)(e.signatureType.toString()),e.rawOwner,e.rawTarget,e.rawAnchor,e.rawTags,e.rawData])}var Jc=class{buf;pos;constructor(e=Buffer.alloc(sl),t=0){this.buf=e,this.pos=t}writeTags(e){if(!Array.isArray(e))throw new Error("input must be array");let t,r=e.length;if(r)for(this.writeLong(r),t=0;t<r;t++){let r=e[t];if(void 0===r?.name||void 0===r?.value)throw new Error(`Invalid tag format for ${r}, expected {name:string, value: string}`);this.writeString(r.name),this.writeString(r.value)}this.writeLong(0)}toBuffer(){let e=Buffer.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(e,0,0,this.pos),e}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(e){let t,r,n=this.buf;if(e>=-1073741824&&e<1073741824){r=e>=0?e<<1:~e<<1|1;do{n[this.pos]=127&r,r>>=7}while(r&&(n[this.pos++]|=128))}else{t=e>=0?2*e:2*-e-1;do{n[this.pos]=127&t,t/=128}while(t>=1&&(n[this.pos++]|=128))}this.pos++,this.buf=n}writeString(e){let t=Buffer.byteLength(e),r=this.buf;this.writeLong(t);let n=this.pos;if(this.pos+=t,!(this.pos>r.length)){if(t>64)this.buf.write(e,this.pos-t,t,"utf8");else{let i,a,s,o;for(i=0,a=t;i<a;i++)s=e.charCodeAt(i),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=63&s|128):55296==(64512&s)&&56320==(64512&(o=e.charCodeAt(i+1)))?(s=65536+((1023&s)<<10)+(1023&o),i++,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}this.buf=r}}readLong(){let e,t,r,n,i=0,a=0,s=this.buf;do{e=s[this.pos++],t=128&e,i|=(127&e)<<a,a+=7}while(t&&a<28);if(t){r=i,n=268435456;do{e=s[this.pos++],r+=(127&e)*n,n*=128}while(128&e);return(r%2?-(r+1):r)/2}return i>>1^-(1&i)}skipLong(){let e=this.buf;for(;128&e[this.pos++];);}readTags(){let e,t=[];for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let e=this.readString(),r=this.readString();t.push({name:e,value:r})}return t}readString(){let e=this.readLong(),t=this.pos,r=this.buf;if(this.pos+=e,!(this.pos>r.length))return this.buf.slice(t,t+e).toString()}};function Xc(e){let t=new Jc;return t.writeTags(e),t.toBuffer()}function el(e){let t=new Jc;return t.writeTags(e),t.tagsExceedLimit()}function tl(e){return new Jc(e).readTags()}function rl(e){let t=0;for(let r=e.length-1;r>=0;r--)t=256*t+e[r];return t}function nl(e){let t=[0,0,0,0,0,0,0,0];for(let r=0;r<t.length;r++){let n=255&e;t[r]=n,e=(e-n)/256}return Uint8Array.from(t)}var il=kc(Bc(),1),al=kc(Lc(),1),sl=4096,ol=80,ul=class{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return void 0!==e.binary}get signatureType(){let e=rl(this.binary.subarray(0,2));if(void 0!==Dc?.[e])return e;throw new Error("Unknown signature type: "+e)}async isValid(){return ul.verify(this.binary)}get id(){return(async()=>Yc.default.encode(await this.rawId))()}set id(e){this._id=Yc.default.toBuffer(e)}get rawId(){return(async()=>al.Buffer.from(await il.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Yc.default.encode(this.rawSignature)}set rawOwner(e){if(e.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${e.byteLength} bytes.`);this.binary.set(e,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Wc[this.signatureType].sigLength}get owner(){return Yc.default.encode(this.rawOwner)}get ownerLength(){return Wc[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return 1==this.binary[e]?this.binary.subarray(e+1,e+33):al.Buffer.alloc(0)}get target(){return Yc.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return 1==this.binary[e]?this.binary.subarray(e+1,e+33):al.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let e=this.getTagsStart(),t=rl(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+t)}get tags(){let e=this.getTagsStart();if(0==rl(this.binary.subarray(e,e+8)))return[];let t=rl(this.binary.subarray(e+8,e+16));return tl(al.Buffer.from(this.binary.subarray(e+16,e+16+t)))}get tagsB64Url(){return this.tags.map((e=>({name:Yc.default.encode(e.name),value:Yc.default.encode(e.value)})))}getStartOfData(){let e=this.getTagsStart();return e+16+rl(this.binary.subarray(e+8,e+16))}get rawData(){let e=this.getTagsStart(),t=e+16+rl(this.binary.subarray(e+8,e+16));return this.binary.subarray(t,this.binary.length)}get data(){return Yc.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await async function(e,t){let{signature:r,id:n}=await async function(e,t){let r=await Qc(e),n=await t.sign(r),i=await Gc().hash(n);return{signature:Buffer.from(n),id:Buffer.from(i)}}(e,t);return e.getRaw().set(r,2),n}(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=al.Buffer.from(await Gc().hash(e))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map((e=>({name:Yc.default.encode(e.name),value:Yc.default.encode(e.value)}))),data:this.data}}static async verify(e){if(e.byteLength<ol)return!1;let t=new ul(e),r=t.signatureType,n=t.getTagsStart(),i=rl(e.subarray(n,n+8)),a=rl(e.subarray(n+8,n+16));if(a>sl)return!1;if(i>0)try{if(tl(al.Buffer.from(e.subarray(n+16,n+16+a))).length!==i)return!1}catch{return!1}let s=qc[r],o=await Qc(t);return await s.verify(t.rawOwner,o,t.rawSignature)}async getSignatureData(){return Qc(this)}getTagsStart(){let e=this.getTargetStart(),t=e+(1==this.binary[e]?33:1);return t+=1==this.binary[t]?33:1,t}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let e=this.getTargetStart()+1;return e+=1==this.binary[this.getTargetStart()]?32:0,e}},cl=kc(Oc(),1);function ll(e,t,r){let n=t.publicKey,i=r?.target?cl.default.toBuffer(r.target):null,a=1+(i?.byteLength??0),s=r?.anchor?Buffer.from(r.anchor):null,o=1+(s?.byteLength??0),u=(r?.tags?.length??0)>0?Xc(r.tags):null,c=16+(u?u.byteLength:0),l=Buffer.from(e),h=l.byteLength,d=2+t.signatureLength+t.ownerLength+a+o+c+h,f=Buffer.alloc(d);if(f.set(function(e){if(e>29)throw new Error("Short too long");let t=[0,0];for(let r=0;r<t.length;r++){let n=255&e;t[r]=n,e=(e-n)/256}return Uint8Array.from(t)}(t.signatureType),0),f.set(new Uint8Array(t.signatureLength).fill(0),2),n.byteLength!==t.ownerLength)throw new Error(`Owner must be ${t.ownerLength} bytes, but was incorrectly ${n.byteLength}`);f.set(n,2+t.signatureLength);let p=2+t.signatureLength+t.ownerLength;if(f[p]=i?1:0,i){if(32!==i.byteLength)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);f.set(i,p+1)}let g=p+a,y=g+1;if(f[g]=s?1:0,s){if(y+=s.byteLength,32!==s.byteLength)throw new Error("Anchor must be 32 bytes");f.set(s,g+1)}f.set(nl(r?.tags?.length??0),y);let m=nl(u?.byteLength??0);f.set(m,y+8),u&&f.set(u,y+16);let v=y+c;return f.set(l,v),new ul(f)}var hl={...Uc};globalThis.arbundles??=hl;var dl=hl,fl=hl;globalThis.Buffer||(globalThis.Buffer=yc.Buffer);var{DataItem:pl}=mc;function gl(e){return async({data:t,tags:r,target:n,anchor:i,createDataItem:a=e=>new pl(e)})=>{const s=await e.signDataItem({data:t,tags:r,target:n,anchor:i}),o=a(yc.Buffer.from(s));return{id:await o.id,raw:await o.getRaw()}}}var yl=globalThis.GATEWAY_URL||void 0,ml=globalThis.MU_URL||void 0,vl=globalThis.CU_URL||void 0,_l=globalThis.GRAPHQL_URL||void 0,wl=globalThis.GRAPHQL_MAX_RETRIES||void 0,bl=globalThis.GRAPHQL_RETRY_BACKOFF||void 0,{result:xl,results:El,message:Al,spawn:kl,monitor:Tl,unmonitor:Sl,dryrun:Ol,assign:Cl}=function({GRAPHQL_URL:e,GRAPHQL_MAX_RETRIES:t,GRAPHQL_RETRY_BACKOFF:r,GATEWAY_URL:n="https://arweave.net",MU_URL:i="https://mu.ao-testnet.xyz",CU_URL:a="https://cu.ao-testnet.xyz"}={}){const s=Vu();e||(e=Ku({url:n,path:"/graphql"}));const{validate:o}=si({cacheSize:100,GRAPHQL_URL:e,GRAPHQL_MAX_RETRIES:t,GRAPHQL_RETRY_BACKOFF:r}),u=(({MAX_SIZE:e})=>Oi||(Oi=new Ci.default(e)))({MAX_SIZE:25}),c=s.child("result"),l=function(e){const t=e=>yi(e).map(Yu.parse).map((()=>e)),r=function({loadResult:e}){return e=_i(Xu.implement(e)),t=>yi({id:t.id,processId:t.processId}).chain(e)}(e);return({message:n,process:i})=>yi({id:n,processId:i}).chain(t).chain(r).map(e.logger.tap('readResult result for message "%s": %O',n)).map((e=>e)).bimap(qu,rs).toPromise()}({loadResult:Ti({fetch,CU_URL:a,logger:c}),logger:c}),h=s.child("message"),d=function(e){const t=function(e){const t=e=>yi(e.tags).map(as([])).map(Wu("Data-Protocol","ao")).map(Wu("Variant")).map(Wu("Type")).map(Wu("SDK")).map(ns(Li,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(uc.parse).map(Da("tags",Li,e)),r=function({logger:e}){return t=>yi(t).chain(us(Za(t.data),(()=>mi(t)),(()=>mi(" ").map(Da("data",Li,t)).map((e=>es(ka("tags"),Wu("Content-Type"),Ma({name:"Content-Type",value:"text/plain"}),Da("tags",Li,e))(e))).map(e.tap('added pseudo-random string as message "data"')))))}(e),n=tc.implement(e.deployMessage);return e=>yi(e).chain(t).chain(r).chain(_i((({id:e,data:t,tags:r,anchor:i,signer:a})=>n({processId:e,data:t,tags:r,anchor:i,signer:oc.implement(a)})))).map((t=>Da("messageId",t.messageId,e)))}(e);return({process:e,data:r,tags:n,anchor:i,signer:a})=>yi({id:e,data:r,tags:n,anchor:i,signer:a}).chain(t).map((e=>e.messageId)).bimap(qu,rs).toPromise()}({loadProcessMeta:Ri({fetch,cache:u,logger:h}),deployMessage:wi({fetch,MU_URL:i,logger:h}),logger:h}),f=s.child("spawn"),p=function(e){const t=function(e){const t=e.logger.child("verifyInput"),r=function({loadTransactionMeta:e,logger:t}){return e=_i(sc.implement(e)),r=>yi(r).chain(e).map(ka("tags")).map(Gu).chain(cc("Data-Protocol",Hu("ao"),"value 'ao' was not found on module")).chain(cc("Type",Hu("Module"),"value 'Module' was not found on module")).chain(cc("Module-Format",ds,"was not found on module")).chain(cc("Input-Encoding",ds,"was not found on module")).chain(cc("Output-Encoding",ds,"was not found on module")).bimap(t.tap("Verifying module source failed: %s"),t.tap("Verified module source"))}(e={...e,logger:t}),n=function({logger:e,validateScheduler:t}){return t=_i(ac.implement(t)),r=>yi(r).chain((e=>t(e).chain((t=>t?mi(e):vi(`Valid Scheduler-Location owned by ${e} not found`))))).bimap(e.tap("Verifying scheduler failed: %s"),e.tap("Verified scheduler"))}(e),i=function({logger:e}){return t=>yi(t).map(e.tap("Checking for signer")).chain((e=>e?mi(e):vi("signer not found")))}(e);return e=>yi(e).chain((e=>r(e.module).map((()=>e)))).chain((e=>n(e.scheduler))).map((()=>e)).chain((e=>i(e.signer).map((()=>e)))).bimap(t.tap("Error when verify input: %s"),t.tap("Successfully verified inputs"))}(e),r=function(e){const t=e.logger.child("uploadProcess");e={...e,logger:t};const r=e=>yi(e).map(ka("tags")).map(as([])).map(Wu("Data-Protocol","ao")).map(Wu("Variant")).map(Wu("Type")).map(Wu("Module")).map(Wu("Scheduler")).map(Wu("SDK")).map(ns(Li,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:e.module},{name:"Scheduler",value:e.scheduler},{name:"SDK",value:"aoconnect"}])).map(lc.parse).map(Da("tags",Li,e)),n=function({logger:e}){return t=>yi(t).chain(us(Za(t.data),(()=>mi(t)),(()=>mi(" ").map(Da("data",Li,t)).map((e=>es(ka("tags"),Wu("Content-Type"),Ma({name:"Content-Type",value:"text/plain"}),Da("tags",Li,e))(e))).map(e.tap('added pseudo-random string as process "data"')))))}(e),i=rc.implement(e.deployProcess);return e=>yi(e).chain(r).chain(n).chain(_i((({data:e,tags:t,signer:r})=>i({data:e,tags:t,signer:oc.implement(r)})))).map((t=>Da("processId",t.processId,e)))}(e);return({module:e,scheduler:n,signer:i,tags:a,data:s})=>yi({module:e,scheduler:n,signer:i,tags:a,data:s}).chain(t).chain(r).map((e=>e.processId)).bimap(qu,rs).toPromise()}({loadTransactionMeta:Du({fetch,GRAPHQL_URL:e,logger:f}),validateScheduler:o,deployProcess:bi({fetch,MU_URL:i,logger:f}),logger:f}),g=s.child("monitor"),y=function(e){const t=function(e){const t=ic.implement(e.deployMonitor);return e=>yi(e).chain(_i((({id:e,signer:r})=>t({processId:e,signer:oc.implement(r),data:" ",tags:[]})))).map((t=>Da("monitorId",t.messageId,e)))}(e);return({process:e,signer:r})=>yi({id:e,signer:r}).chain(t).map((e=>e.monitorId)).bimap(qu,rs).toPromise()}({loadProcessMeta:Ri({fetch,cache:u,logger:g}),deployMonitor:xi({fetch,MU_URL:i,logger:g}),logger:g}),m=s.child("unmonitor"),v=function(e){const t=function(e){const t=ic.implement(e.deployUnmonitor);return e=>yi(e).chain(_i((({id:e,signer:r})=>t({processId:e,signer:oc.implement(r),data:" ",tags:[]})))).map((t=>Da("monitorId",t.messageId,e)))}(e);return({process:e,signer:r})=>yi({id:e,signer:r}).chain(t).map((e=>e.monitorId)).bimap(qu,rs).toPromise()}({loadProcessMeta:Ri({fetch,cache:u,logger:m}),deployUnmonitor:Ei({fetch,MU_URL:i,logger:m}),logger:g}),_=s.child("results"),w=function(e){const t=e=>yi(e).map(hc.parse).map((()=>e)),r=function({queryResults:e}){return e=_i(ec.implement(e)),t=>yi({process:t.process,from:t.from,to:t.to,sort:t.sort,limit:t.limit}).chain(e)}(e);return({process:n,from:i,to:a,sort:s,limit:o})=>yi({process:n,from:i,to:a,sort:s,limit:o}).chain(t).chain(r).map(e.logger.tap('readResults result for message "%s": %O',n)).map((e=>e)).bimap(qu,rs).toPromise()}({queryResults:Si({fetch,CU_URL:a,logger:_}),logger:_}),b=s.child("dryrun"),x=function(e){const t=e=>yi(e).map(dc.parse).map((e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))),r=function({dryrunFetch:e}){return _i(Ju.implement(e))}(e);return e=>yi(e).map(fc).chain(t).chain(r).toPromise()}({dryrunFetch:ki({fetch,CU_URL:a,logger:b}),logger:b}),E=s.child("assign");return{result:l,results:w,message:d,spawn:p,monitor:y,unmonitor:v,dryrun:x,assign:pc({deployAssign:Ai({fetch,MU_URL:i,logger:E}),logger:h})}}({GATEWAY_URL:yl,MU_URL:ml,CU_URL:vl,GRAPHQL_URL:_l,GRAPHQL_MAX_RETRIES:wl,GRAPHQL_RETRY_BACKOFF:bl}),Rl=gc.createDataItemSigner;function Il(e,t,r){return Al({process:e,tags:r,signer:Rl(window.arweaveWallet),data:t})}function jl(e,t){return xl({message:t,process:e})}function Ll(e,t,r){Al({process:e,tags:r,signer:Rl(window.arweaveWallet),data:t}).then((t=>(console.log(t),xl({message:t,process:e}))))}function Bl(e,t,r){return Ol({process:e,tags:r,signer:Rl(window.arweaveWallet),data:t})}AOConnect=t})();