UNPKG

@lastos/page-spy-plugin-data-harbor

Version:
3 lines 118 kB
function e(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function t(t,n,a){return(n=e(n))in t?Object.defineProperty(t,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[n]=a,t}function n(){return"object"==typeof window&&"object"==typeof document&&"[object HTMLDocument]"===Object.prototype.toString.call(document)}function a(){return Math.random().toString(36).slice(2)}function r(e){return Object.prototype.toString.call(e)}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function i(e){return"number"==typeof e}function o(e){return"[object BigInt]"===r(e)}function c(e){return e instanceof Array}function d(e){return"object"==typeof e&&null!==e}const l=["zh-CN","zh-HK","zh-TW","zh","zh-Hans-CN"];const u=e=>"".concat(e),h=e=>({ok:!0,value:e});function p(e){return void 0===e?h(u(e)):null===e?h(e):i(e)&&(e===-1/0||e===1/0||Number.isNaN(e))?h(u(e)):o(e)?h("".concat(e,"n")):"symbol"==typeof e||"function"==typeof e?h(u(e.toString())):e instanceof Error?h(u(e.stack)):e===Object.prototype?{value:null,ok:!1}:e instanceof Object||"object"==typeof e?{value:e,ok:!1}:h(e)}function m(e){return void 0===e?"undefined":null===e?"null":o(e)?"bigint":e instanceof Object?e instanceof Error?"error":"function"==typeof e?"function":"object":typeof e}const f={...console},g=["log","info","error","warn","debug"].reduce(((e,t)=>(e[t]=function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];console[t]("[PageSpy] [".concat(t.toLocaleUpperCase(),"] "),...n)},e.unproxy[t]=function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];f[t]("[PageSpy] [".concat(t.toLocaleUpperCase(),"] "),...n)},e)),{unproxy:{}}),v=e=>e.replace(/\/$/,"");var y=Uint8Array,_=Uint16Array,b=Int32Array,w=new y([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),k=new y([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),x=new y([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),T=function(e,t){for(var n=new _(31),a=0;a<31;++a)n[a]=t+=1<<e[a-1];var r=new b(n[30]);for(a=1;a<30;++a)for(var s=n[a];s<n[a+1];++s)r[s]=s-n[a]<<5|a;return{b:n,r:r}},I=T(w,2),C=I.b,S=I.r;C[28]=258,S[258]=28;for(var O=T(k,0).r,E=new _(32768),P=0;P<32768;++P){var A=(43690&P)>>1|(21845&P)<<1;A=(61680&(A=(52428&A)>>2|(13107&A)<<2))>>4|(3855&A)<<4,E[P]=((65280&A)>>8|(255&A)<<8)>>1}var Z=function(e,t,n){for(var a=e.length,r=0,s=new _(t);r<a;++r)e[r]&&++s[e[r]-1];var i,o=new _(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;if(n){i=new _(1<<t);var c=15-t;for(r=0;r<a;++r)if(e[r])for(var d=r<<4|e[r],l=t-e[r],u=o[e[r]-1]++<<l,h=u|(1<<l)-1;u<=h;++u)i[E[u]>>c]=d}else for(i=new _(a),r=0;r<a;++r)e[r]&&(i[r]=E[o[e[r]-1]++]>>15-e[r]);return i},N=new y(288);for(P=0;P<144;++P)N[P]=8;for(P=144;P<256;++P)N[P]=9;for(P=256;P<280;++P)N[P]=7;for(P=280;P<288;++P)N[P]=8;var j=new y(32);for(P=0;P<32;++P)j[P]=5;var D=Z(N,9,0),L=Z(j,5,0),R=function(e){return(e+7)/8|0},M=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new y(e.subarray(t,n))},z=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],q=function(e,t,n){var a=new Error(t||z[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,q),!n)throw a;return a},H=function(e,t,n){n<<=7&t;var a=t/8|0;e[a]|=n,e[a+1]|=n>>8},F=function(e,t,n){n<<=7&t;var a=t/8|0;e[a]|=n,e[a+1]|=n>>8,e[a+2]|=n>>16},B=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var r=n.length,s=n.slice();if(!r)return{t:J,l:0};if(1==r){var i=new y(n[0].s+1);return i[n[0].s]=1,{t:i,l:1}}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var o=n[0],c=n[1],d=0,l=1,u=2;for(n[0]={s:-1,f:o.f+c.f,l:o,r:c};l!=r-1;)o=n[n[d].f<n[u].f?d++:u++],c=n[d!=l&&n[d].f<n[u].f?d++:u++],n[l++]={s:-1,f:o.f+c.f,l:o,r:c};var h=s[0].s;for(a=1;a<r;++a)s[a].s>h&&(h=s[a].s);var p=new _(h+1),m=U(n[l-1],p,0);if(m>t){a=0;var f=0,g=m-t,v=1<<g;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));a<r;++a){var b=s[a].s;if(!(p[b]>t))break;f+=v-(1<<m-p[b]),p[b]=t}for(f>>=g;f>0;){var w=s[a].s;p[w]<t?f-=1<<t-p[w]++-1:++a}for(;a>=0&&f;--a){var k=s[a].s;p[k]==t&&(--p[k],++f)}m=t}return{t:new y(p),l:m}},U=function(e,t,n){return-1==e.s?Math.max(U(e.l,t,n+1),U(e.r,t,n+1)):t[e.s]=n},V=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new _(++t),a=0,r=e[0],s=1,i=function(e){n[a++]=e},o=1;o<=t;++o)if(e[o]==r&&o!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(r),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(r);s=1,r=e[o]}return{c:n.subarray(0,a),n:t}},W=function(e,t){for(var n=0,a=0;a<t.length;++a)n+=e[a]*t[a];return n},$=function(e,t,n){var a=n.length,r=R(t+2);e[r]=255&a,e[r+1]=a>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var s=0;s<a;++s)e[r+s+4]=n[s];return 8*(r+4+a)},K=function(e,t,n,a,r,s,i,o,c,d,l){H(t,l++,n),++r[256];for(var u=B(r,15),h=u.t,p=u.l,m=B(s,15),f=m.t,g=m.l,v=V(h),y=v.c,b=v.n,T=V(f),I=T.c,C=T.n,S=new _(19),O=0;O<y.length;++O)++S[31&y[O]];for(O=0;O<I.length;++O)++S[31&I[O]];for(var E=B(S,7),P=E.t,A=E.l,R=19;R>4&&!P[x[R-1]];--R);var M,z,q,U,K=d+5<<3,G=W(r,N)+W(s,j)+i,J=W(r,h)+W(s,f)+i+14+3*R+W(S,P)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&K<=G&&K<=J)return $(t,l,e.subarray(c,c+d));if(H(t,l,1+(J<G)),l+=2,J<G){M=Z(h,p,0),z=h,q=Z(f,g,0),U=f;var X=Z(P,A,0);H(t,l,b-257),H(t,l+5,C-1),H(t,l+10,R-4),l+=14;for(O=0;O<R;++O)H(t,l+3*O,P[x[O]]);l+=3*R;for(var Y=[y,I],Q=0;Q<2;++Q){var ee=Y[Q];for(O=0;O<ee.length;++O){var te=31&ee[O];H(t,l,X[te]),l+=P[te],te>15&&(H(t,l,ee[O]>>5&127),l+=ee[O]>>12)}}}else M=D,z=N,q=L,U=j;for(O=0;O<o;++O){var ne=a[O];if(ne>255){F(t,l,M[(te=ne>>18&31)+257]),l+=z[te+257],te>7&&(H(t,l,ne>>23&31),l+=w[te]);var ae=31&ne;F(t,l,q[ae]),l+=U[ae],ae>3&&(F(t,l,ne>>5&8191),l+=k[ae])}else F(t,l,M[ne]),l+=z[ne]}return F(t,l,M[256]),l+z[256]},G=new b([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),J=new y(0),X=function(){var e=1,t=0;return{p:function(n){for(var a=e,r=t,s=0|n.length,i=0;i!=s;){for(var o=Math.min(i+2655,s);i<o;++i)r+=a+=n[i];a=(65535&a)+15*(a>>16),r=(65535&r)+15*(r>>16)}e=a,t=r},d:function(){return(255&(e%=65521))<<24|(65280&e)<<8|(255&(t%=65521))<<8|t>>8}}},Y=function(e,t,n,a,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),i=new y(s.length+e.length);i.set(s),i.set(e,s.length),e=i,r.w=s.length}return function(e,t,n,a,r,s){var i=s.z||e.length,o=new y(a+i+5*(1+Math.ceil(i/7e3))+r),c=o.subarray(a,o.length-r),d=s.l,l=7&(s.r||0);if(t){l&&(c[0]=s.r>>3);for(var u=G[t-1],h=u>>13,p=8191&u,m=(1<<n)-1,f=s.p||new _(32768),g=s.h||new _(m+1),v=Math.ceil(n/3),x=2*v,T=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<x)&m},I=new b(25e3),C=new _(288),E=new _(32),P=0,A=0,Z=s.i||0,N=0,j=s.w||0,D=0;Z+2<i;++Z){var L=T(Z),z=32767&Z,q=g[L];if(f[z]=q,g[L]=z,j<=Z){var H=i-Z;if((P>7e3||N>24576)&&(H>423||!d)){l=K(e,c,0,I,C,E,A,N,D,Z-D,l),N=P=A=0,D=Z;for(var F=0;F<286;++F)C[F]=0;for(F=0;F<30;++F)E[F]=0}var B=2,U=0,V=p,W=z-q&32767;if(H>2&&L==T(Z-W))for(var J=Math.min(h,H)-1,X=Math.min(32767,Z),Y=Math.min(258,H);W<=X&&--V&&z!=q;){if(e[Z+B]==e[Z+B-W]){for(var Q=0;Q<Y&&e[Z+Q]==e[Z+Q-W];++Q);if(Q>B){if(B=Q,U=W,Q>J)break;var ee=Math.min(W,Q-2),te=0;for(F=0;F<ee;++F){var ne=Z-W+F&32767,ae=ne-f[ne]&32767;ae>te&&(te=ae,q=ne)}}}W+=(z=q)-(q=f[z])&32767}if(U){I[N++]=268435456|S[B]<<18|O[U];var re=31&S[B],se=31&O[U];A+=w[re]+k[se],++C[257+re],++E[se],j=Z+B,++P}else I[N++]=e[Z],++C[e[Z]]}}for(Z=Math.max(Z,j);Z<i;++Z)I[N++]=e[Z],++C[e[Z]];l=K(e,c,d,I,C,E,A,N,D,Z-D,l),d||(s.r=7&l|c[l/8|0]<<3,l-=7,s.h=g,s.p=f,s.i=Z,s.w=j)}else{for(Z=s.w||0;Z<i+d;Z+=65535){var ie=Z+65535;ie>=i&&(c[l/8|0]=d,ie=i),l=$(c,l+1,e.subarray(Z,ie))}s.i=i}return M(o,0,a+R(l)+r)}(e,null==t.level?6:t.level,null==t.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,n,a,r)},Q=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function ee(e,t){t||(t={});var n=X();n.p(e);var a=Y(e,t,t.dictionary?6:2,4);return function(e,t){var n=t.level,a=0==n?0:n<6?1:9==n?3:2;if(e[0]=120,e[1]=a<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var r=X();r.p(t.dictionary),Q(e,2,r.d())}}(a,t),Q(a,a.length-4,n.d()),a}var te="undefined"!=typeof TextEncoder&&new TextEncoder,ne="undefined"!=typeof TextDecoder&&new TextDecoder;try{ne.decode(J,{stream:!0}),1}catch(e){}function ae(e,t){if(t){for(var n="",a=0;a<e.length;a+=16384)n+=String.fromCharCode.apply(null,e.subarray(a,a+16384));return n}if(ne)return ne.decode(e);var r=function(e){for(var t="",n=0;;){var a=e[n++],r=(a>127)+(a>223)+(a>239);if(n+r>e.length)return{s:t,r:M(e,n-1)};r?3==r?(a=((15&a)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a)):t+=1&r?String.fromCharCode((31&a)<<6|63&e[n++]):String.fromCharCode((15&a)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(a)}}(e),s=r.s;return(n=r.r).length&&q(8),s}const re=()=>{if(n()){var e,t;const n=sessionStorage.getItem("page-spy-room");var a;return n?(null===(a=JSON.parse(n))||void 0===a?void 0:a.address)||"--":(null===(e=window.$pageSpy)||void 0===e?void 0:e.address)||(null===(t=window.PageSpy)||void 0===t||null===(t=t.instance)||void 0===t?void 0:t.address)||"--"}return"--"},se=e=>e.toString().replace(/[^\w]/g,"_"),ie=e=>ae(ee(function(e,t){if(t){for(var n=new y(e.length),a=0;a<e.length;++a)n[a]=e.charCodeAt(a);return n}if(te)return te.encode(e);var r=e.length,s=new y(e.length+(e.length>>1)),i=0,o=function(e){s[i++]=e};for(a=0;a<r;++a){if(i+5>s.length){var c=new y(i+8+(r-a<<1));c.set(s),s=c}var d=e.charCodeAt(a);d<128||t?o(d):d<2048?(o(192|d>>6),o(128|63&d)):d>55295&&d<57344?(o(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++a))>>18),o(128|d>>12&63),o(128|d>>6&63),o(128|63&d)):(o(224|d>>12),o(128|d>>6&63),o(128|63&d))}return M(s,0,i)}(JSON.stringify(e)),{level:9}),!0);function oe(e){return e>=10?e.toString():"0".concat(e)}function ce(e){const t=Math.floor(e/3600),n=Math.floor((e-3600*t)/60),a=Math.floor(e-3600*t-60*n),r=oe(t),s=oe(n),i=oe(a);return 0===t?"".concat(s,":").concat(i):"".concat(r,":").concat(s,":").concat(i)}const de="message",le="broadcast",ue="ping",he="updateRoomInfo";var pe,me=Object.freeze({__proto__:null,BROADCAST:le,CLOSE:"close",CONNECT:"connect",ERROR:"error",JOIN:"join",LEAVE:"leave",MESSAGE:de,PING:ue,PONG:"pong",UPDATE_ROOM_INFO:he});function fe(e,t){return{role:"client",type:e,data:{...(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&{id:a()},...t}}}class ge{constructor(e){t(this,"id",""),t(this,"method",""),t(this,"url",""),t(this,"requestType","xhr"),t(this,"requestHeader",null),t(this,"status",0),t(this,"statusText",""),t(this,"readyState",0),t(this,"response","__PLACEHOLDER_RESPONSE_DEFINED_BY_PAGE_SPY__"),t(this,"responseReason",null),t(this,"responseType",""),t(this,"responseHeader",null),t(this,"startTime",0),t(this,"endTime",0),t(this,"costTime",0),t(this,"postData",null),t(this,"requestPayload",null),t(this,"withCredentials",!1),t(this,"lastEventId",""),this.id=e}}!function(e){e[e.UNSENT=0]="UNSENT",e[e.OPENED=1]="OPENED",e[e.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",e[e.LOADING=3]="LOADING",e[e.DONE=4]="DONE"}(pe||(pe={}));class ve{constructor(e){t(this,"socketStore",void 0),t(this,"reqMap",Object.create(null)),this.socketStore=e}getRequestMap(){return this.reqMap}getRequest(e){return this.reqMap[e]}removeRequest(e){delete this.reqMap[e]}createRequest(e){return e?this.reqMap[e]?(g.warn("The request object has been in store, disallow duplicate create"),!1):(this.reqMap[e]=new ge(e),!0):(g.warn('The "id" is required when init request object'),!1)}setRequest(e,t){return!(!e||!t)&&(this.reqMap[e]=t,!0)}sendRequestItem(e,t){var n;if(!1!==(null===(n=ve.dataProcessor)||void 0===n?void 0:n.call(ve,t)))try{this.reqMap[e]||(this.reqMap[e]=t);const n=fe("network",{...t},!1);this.socketStore.dispatchEvent("public-data",n),this.socketStore.broadcastMessage(n,t.readyState!==pe.DONE),this.deferDeleteRequest(e)}catch(e){g.error(e.message)}}deferDeleteRequest(e){const t=this.getRequest(e);t&&t.readyState===pe.DONE&&setTimeout((()=>{delete this.reqMap[e]}),3e3)}}t(ve,"dataProcessor",void 0);class ye{constructor(){t(this,"store",{}),t(this,"instanceStore",{})}getStore(){return this.store}resetStore(){this.store={}}getInstanceStore(){return this.instanceStore}resetInstanceStore(){this.instanceStore={}}transformToAtom(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{value:n,ok:r}=p(e),s=a();if(r)return{id:s,type:m(e),value:n};if(t)try{return{id:s,type:"json",value:JSON.stringify(e)}}catch(e){return{id:s,type:"json",value:null}}return this.add(e)}get(e){const t=this.store[e],n=this.instanceStore[e];if(!t)return null;const r={},i=Object.getOwnPropertyDescriptors(t);Object.keys(i).forEach((e=>{const t=i[e];s(t,"value")&&(t.value=this.transformToAtom(t.value)),r[e]=ye.getAtomOverview({atomId:a(),instanceId:n,value:t})}));const o=this.addExtraProperty(e);return{...r,...o}}getOrigin(e){const t=this.store[e];return t||null}add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=a();let r=n;var i;d(i=e)&&s(i,"constructor")&&"function"==typeof i.constructor&&(r=t),this.store[n]=e,this.instanceStore[n]=r;const o=ye.getSemanticValue(e);return ye.getAtomOverview({atomId:n,value:o,instanceId:r})}static getAtomOverview(e){let{instanceId:t="",atomId:n,value:r}=e;return{id:a(),type:"atom",__atomId:n,instanceId:t,value:r}}static getSemanticValue(e){if(d(t=e)&&"[object Object]"===r(t))return"Object {...}";var t;if(c(e))return"Array (".concat(e.length,")");return e.constructor.name}addExtraProperty(e){const t=this.store[e],n=this.instanceStore[e],a={};if((t instanceof String||t instanceof Number||t instanceof Boolean)&&(a["[[PrimitiveValue]]"]=this.transformToAtom(t.valueOf())),t instanceof Set){const e={};let n=0;for(const a of t)e[n++]=a;e.size=t.size,a["[[Entries]]"]=this.transformToAtom(e)}if(t instanceof Map){const e={};let n=0;for(const[a,r]of t.entries())e[n++]={key:a,value:r};e.size=t.size,a["[[Entries]]"]=this.transformToAtom(e)}var r;return(c(t)||(r=t,"function"==typeof NodeList&&"NodeList"===NodeList.name&&r instanceof NodeList||"function"==typeof HTMLCollection&&"HTMLCollection"===HTMLCollection.name&&r instanceof HTMLCollection))&&(a.length=this.transformToAtom(t.length)),null!==Object.getPrototypeOf(t)?a["[[Prototype]]"]=this.add(Object.getPrototypeOf(t),n):a.___proto___=this.transformToAtom(null),a}}const _e=new ye;var be,we;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" | ";return e.map((e=>"string"==typeof e?"'".concat(e,"'"):e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(be||(be={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(we||(we={}));const ke=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=e=>{switch(typeof e){case"undefined":return ke.undefined;case"string":return ke.string;case"number":return isNaN(e)?ke.nan:ke.number;case"boolean":return ke.boolean;case"function":return ke.function;case"bigint":return ke.bigint;case"symbol":return ke.symbol;case"object":return Array.isArray(e)?ke.array:null===e?ke.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ke.promise:"undefined"!=typeof Map&&e instanceof Map?ke.map:"undefined"!=typeof Set&&e instanceof Set?ke.set:"undefined"!=typeof Date&&e instanceof Date?ke.date:ke.object;default:return ke.unknown}},Te=be.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"]);class Ie extends Error{get errors(){return this.issues}constructor(e){var t;super(),t=this,this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.issues=[...t.issues,...e]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(e){if(!(e instanceof Ie))throw new Error("Not a ZodError: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e=>e.message;const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Ie.create=e=>new Ie(e);const Ce=(e,t)=>{let n;switch(e.code){case Te.invalid_type:n=e.received===ke.undefined?"Required":"Expected ".concat(e.expected,", received ").concat(e.received);break;case Te.invalid_literal:n="Invalid literal value, expected ".concat(JSON.stringify(e.expected,be.jsonStringifyReplacer));break;case Te.unrecognized_keys:n="Unrecognized key(s) in object: ".concat(be.joinValues(e.keys,", "));break;case Te.invalid_union:n="Invalid input";break;case Te.invalid_union_discriminator:n="Invalid discriminator value. Expected ".concat(be.joinValues(e.options));break;case Te.invalid_enum_value:n="Invalid enum value. Expected ".concat(be.joinValues(e.options),", received '").concat(e.received,"'");break;case Te.invalid_arguments:n="Invalid function arguments";break;case Te.invalid_return_type:n="Invalid function return type";break;case Te.invalid_date:n="Invalid date";break;case Te.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n='Invalid input: must include "'.concat(e.validation.includes,'"'),"number"==typeof e.validation.position&&(n="".concat(n," at one or more positions greater than or equal to ").concat(e.validation.position))):"startsWith"in e.validation?n='Invalid input: must start with "'.concat(e.validation.startsWith,'"'):"endsWith"in e.validation?n='Invalid input: must end with "'.concat(e.validation.endsWith,'"'):be.assertNever(e.validation):n="regex"!==e.validation?"Invalid ".concat(e.validation):"Invalid";break;case Te.too_small:n="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"more than"," ").concat(e.minimum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"over"," ").concat(e.minimum," character(s)"):"number"===e.type?"Number must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(e.minimum):"date"===e.type?"Date must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(e.minimum))):"Invalid input";break;case Te.too_big:n="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"less than"," ").concat(e.maximum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"under"," ").concat(e.maximum," character(s)"):"number"===e.type?"Number must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"bigint"===e.type?"BigInt must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"date"===e.type?"Date must be ".concat(e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(e.maximum))):"Invalid input";break;case Te.custom:n="Invalid input";break;case Te.invalid_intersection_types:n="Intersection results could not be merged";break;case Te.not_multiple_of:n="Number must be a multiple of ".concat(e.multipleOf);break;case Te.not_finite:n="Number must be finite";break;default:n=t.defaultError,be.assertNever(e)}return{message:n}};let Se=Ce;function Oe(){return Se}const Ee=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,s=[...n,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}};function Pe(e,t){const n=Oe(),a=Ee({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ce?void 0:Ce].filter((e=>!!e))});e.common.issues.push(a)}class Ae{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return Ze;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return Ae.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return Ze;if("aborted"===r.status)return Ze;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}}const Ze=Object.freeze({status:"aborted"}),Ne=e=>({status:"dirty",value:e}),je=e=>({status:"valid",value:e}),De=e=>"aborted"===e.status,Le=e=>"dirty"===e.status,Re=e=>"valid"===e.status,Me=e=>"undefined"!=typeof Promise&&e instanceof Promise;function ze(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function qe(e,t,n,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,n):r?r.value=n:t.set(e,n),n}var He,Fe,Be;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(He||(He={}));class Ue{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}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}}const Ve=(e,t)=>{if(Re(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 Ie(e.common.issues);return this._error=t,this._error}}};function We(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!==(s=null!=o?o:a)&&void 0!==s?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:r.defaultError}},description:r}}class $e{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ae,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Me(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Ve(a,r)}"~validate"(e){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Re(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null===(n=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then((e=>Re(e)?{value:e.value}:{issues:a.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={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:xe(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(Me(a)?a:Promise.resolve(a));return Ve(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const r=e(t),s=()=>a.addIssue({code:Te.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(s(),!1))):!!r||(s(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new $t({schema:this,typeName:on.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Kt.create(this,this._def)}nullable(){return Gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ot.create(this)}promise(){return Wt.create(this,this._def)}or(e){return At.create([this,e],this._def)}and(e){return Dt.create(this,e,this._def)}transform(e){return new $t({...We(this._def),schema:this,typeName:on.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Jt({...We(this._def),innerType:this,defaultValue:t,typeName:on.ZodDefault})}brand(){return new en({typeName:on.ZodBranded,type:this,...We(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Xt({...We(this._def),innerType:this,catchValue:t,typeName:on.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return tn.create(this,e)}readonly(){return nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ke=/^c[^\s-]{8,}$/i,Ge=/^[0-9a-z]+$/,Je=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xe=/^[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,Ye=/^[a-z0-9_-]{21}$/i,Qe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,et=/^[-+]?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)?)??$/,tt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let nt;const at=/^(?:(?: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])$/,rt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,st=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,it=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ot=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ct=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dt="((\\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])))",lt=new RegExp("^".concat(dt,"$"));function ut(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t="".concat(t,"\\.\\d{").concat(e.precision,"}"):null==e.precision&&(t="".concat(t,"(\\.\\d+)?")),t}function ht(e){let t="".concat(dt,"T").concat(ut(e));const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t="".concat(t,"(").concat(n.join("|"),")"),new RegExp("^".concat(t,"$"))}function pt(e,t){if(!Qe.test(e))return!1;try{const[n]=e.split("."),a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return"object"==typeof r&&null!==r&&(!(!r.typ||!r.alg)&&(!t||r.alg===t))}catch(e){return!1}}function mt(e,t){return!("v4"!==t&&t||!rt.test(e))||!("v6"!==t&&t||!it.test(e))}class ft extends $e{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ke.string){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.string,received:t.parsedType}),Ze}const t=new Ae;let n;for(const s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("max"===s.kind)e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("length"===s.kind){const a=e.data.length>s.value,r=e.data.length<s.value;(a||r)&&(n=this._getOrReturnCtx(e,n),a?Pe(n,{code:Te.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):r&&Pe(n,{code:Te.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if("email"===s.kind)tt.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"email",code:Te.invalid_string,message:s.message}),t.dirty());else if("emoji"===s.kind)nt||(nt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nt.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"emoji",code:Te.invalid_string,message:s.message}),t.dirty());else if("uuid"===s.kind)Xe.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"uuid",code:Te.invalid_string,message:s.message}),t.dirty());else if("nanoid"===s.kind)Ye.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"nanoid",code:Te.invalid_string,message:s.message}),t.dirty());else if("cuid"===s.kind)Ke.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"cuid",code:Te.invalid_string,message:s.message}),t.dirty());else if("cuid2"===s.kind)Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"cuid2",code:Te.invalid_string,message:s.message}),t.dirty());else if("ulid"===s.kind)Je.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"ulid",code:Te.invalid_string,message:s.message}),t.dirty());else if("url"===s.kind)try{new URL(e.data)}catch(a){n=this._getOrReturnCtx(e,n),Pe(n,{validation:"url",code:Te.invalid_string,message:s.message}),t.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"regex",code:Te.invalid_string,message:s.message}),t.dirty())}else if("trim"===s.kind)e.data=e.data.trim();else if("includes"===s.kind)e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty());else if("toLowerCase"===s.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===s.kind)e.data=e.data.toUpperCase();else if("startsWith"===s.kind)e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty());else if("endsWith"===s.kind)e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty());else if("datetime"===s.kind){ht(s).test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.invalid_string,validation:"datetime",message:s.message}),t.dirty())}else if("date"===s.kind){lt.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.invalid_string,validation:"date",message:s.message}),t.dirty())}else if("time"===s.kind){new RegExp("^".concat(ut(s),"$")).test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.invalid_string,validation:"time",message:s.message}),t.dirty())}else"duration"===s.kind?et.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"duration",code:Te.invalid_string,message:s.message}),t.dirty()):"ip"===s.kind?(a=e.data,("v4"!==(r=s.version)&&r||!at.test(a))&&("v6"!==r&&r||!st.test(a))&&(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"ip",code:Te.invalid_string,message:s.message}),t.dirty())):"jwt"===s.kind?pt(e.data,s.alg)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"jwt",code:Te.invalid_string,message:s.message}),t.dirty()):"cidr"===s.kind?mt(e.data,s.version)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"cidr",code:Te.invalid_string,message:s.message}),t.dirty()):"base64"===s.kind?ot.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"base64",code:Te.invalid_string,message:s.message}),t.dirty()):"base64url"===s.kind?ct.test(e.data)||(n=this._getOrReturnCtx(e,n),Pe(n,{validation:"base64url",code:Te.invalid_string,message:s.message}),t.dirty()):be.assertNever(s);var a,r;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:Te.invalid_string,...He.errToObj(n)})}_addCheck(e){return new ft({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...He.errToObj(e)})}url(e){return this._addCheck({kind:"url",...He.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...He.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...He.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...He.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...He.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...He.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...He.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...He.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...He.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...He.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...He.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...He.errToObj(e)})}datetime(e){var t,n;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!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...He.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,...He.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...He.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...He.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...He.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...He.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...He.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...He.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...He.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...He.errToObj(t)})}nonempty(e){return this.min(1,He.errToObj(e))}trim(){return new ft({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ft({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ft({...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 isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===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 gt(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return parseInt(e.toFixed(r).replace(".",""))%parseInt(t.toFixed(r).replace(".",""))/Math.pow(10,r)}ft.create=e=>{var t;return new ft({checks:[],typeName:on.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...We(e)})};class vt extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ke.number){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.number,received:t.parsedType}),Ze}let t;const n=new Ae;for(const a of this._def.checks)if("int"===a.kind)be.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==gt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.not_finite,message:a.message}),n.dirty()):be.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,He.toString(t))}gt(e,t){return this.setLimit("min",e,!1,He.toString(t))}lte(e,t){return this.setLimit("max",e,!0,He.toString(t))}lt(e,t){return this.setLimit("max",e,!1,He.toString(t))}setLimit(e,t,n,a){return new vt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:He.toString(a)}]})}_addCheck(e){return new vt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:He.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:He.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:He.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:He.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:He.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:He.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:He.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:He.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:He.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&&be.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}vt.create=e=>new vt({checks:[],typeName:on.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...We(e)});class yt extends $e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==ke.bigint)return this._getInvalidInput(e);let t;const n=new Ae;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Pe(t,{code:Te.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):be.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.bigint,received:t.parsedType}),Ze}gte(e,t){return this.setLimit("min",e,!0,He.toString(t))}gt(e,t){return this.setLimit("min",e,!1,He.toString(t))}lte(e,t){return this.setLimit("max",e,!0,He.toString(t))}lt(e,t){return this.setLimit("max",e,!1,He.toString(t))}setLimit(e,t,n,a){return new yt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:He.toString(a)}]})}_addCheck(e){return new yt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:He.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:He.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:He.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:He.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:He.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}}yt.create=e=>{var t;return new yt({checks:[],typeName:on.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...We(e)})};class _t extends $e{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ke.boolean){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.boolean,received:t.parsedType}),Ze}return je(e.data)}}_t.create=e=>new _t({typeName:on.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...We(e)});class bt extends $e{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ke.date){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.date,received:t.parsedType}),Ze}if(isNaN(e.data.getTime())){return Pe(this._getOrReturnCtx(e),{code:Te.invalid_date}),Ze}const t=new Ae;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),Pe(n,{code:Te.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):be.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:He.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:He.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}}bt.create=e=>new bt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:on.ZodDate,...We(e)});class wt extends $e{_parse(e){if(this._getType(e)!==ke.symbol){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.symbol,received:t.parsedType}),Ze}return je(e.data)}}wt.create=e=>new wt({typeName:on.ZodSymbol,...We(e)});class kt extends $e{_parse(e){if(this._getType(e)!==ke.undefined){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.undefined,received:t.parsedType}),Ze}return je(e.data)}}kt.create=e=>new kt({typeName:on.ZodUndefined,...We(e)});class xt extends $e{_parse(e){if(this._getType(e)!==ke.null){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.null,received:t.parsedType}),Ze}return je(e.data)}}xt.create=e=>new xt({typeName:on.ZodNull,...We(e)});class Tt extends $e{constructor(){super(...arguments),this._any=!0}_parse(e){return je(e.data)}}Tt.create=e=>new Tt({typeName:on.ZodAny,...We(e)});class It extends $e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return je(e.data)}}It.create=e=>new It({typeName:on.ZodUnknown,...We(e)});class Ct extends $e{_parse(e){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.never,received:t.parsedType}),Ze}}Ct.create=e=>new Ct({typeName:on.ZodNever,...We(e)});class St extends $e{_parse(e){if(this._getType(e)!==ke.undefined){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.void,received:t.parsedType}),Ze}return je(e.data)}}St.create=e=>new St({typeName:on.ZodVoid,...We(e)});class Ot extends $e{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==ke.array)return Pe(t,{code:Te.invalid_type,expected:ke.array,received:t.parsedType}),Ze;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(Pe(t,{code:e?Te.too_big:Te.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(Pe(t,{code:Te.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(Pe(t,{code:Te.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new Ue(t,e,t.path,n))))).then((e=>Ae.mergeArray(n,e)));const r=[...t.data].map(((e,n)=>a.type._parseSync(new Ue(t,e,t.path,n))));return Ae.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new Ot({...this._def,minLength:{value:e,message:He.toString(t)}})}max(e,t){return new Ot({...this._def,maxLength:{value:e,message:He.toString(t)}})}length(e,t){return new Ot({...this._def,exactLength:{value:e,message:He.toString(t)}})}nonempty(e){return this.min(1,e)}}function Et(e){if(e instanceof Pt){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Kt.create(Et(a))}return new Pt({...e._def,shape:()=>t})}return e instanceof Ot?new Ot({...e._def,type:Et(e.element)}):e instanceof Kt?Kt.create(Et(e.unwrap())):e instanceof Gt?Gt.create(Et(e.unwrap())):e instanceof Lt?Lt.create(e.items.map((e=>Et(e)))):e}Ot.create=(e,t)=>new Ot({type:e,minLength:null,maxLength:null,exactLength:null,typeName:on.ZodArray,...We(t)});class Pt extends $e{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=be.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ke.object){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.object,received:t.parsedType}),Ze}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ct&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||s.push(e);const i=[];for(const e of r){const t=a[e],r=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new Ue(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ct){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(Pe(n,{code:Te.unrecognized_keys,keys:s}),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 s){const a=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new Ue(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>Ae.mergeObjectSync(t,e))):Ae.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return He.errToObj,new Pt({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,r,s,i;const o=null!==(s=null===(r=(a=this._def).errorMap)||void 0===r?void 0:r.call(a,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=He.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new Pt({...this._def,unknownKeys:"strip"})}passthrough(){return new Pt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:on.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Pt({...this._def,catchall:e})}pick(e){const t={};return be.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new Pt({...this._def,shape:()=>t})}omit(e){const t={};return be.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new Pt({...this._def,shape:()=>t})}deepPartial(){return Et(this)}partial(e){const t={};return be.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new Pt({...this._def,shape:()=>t})}required(e){const t={};return be.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Kt;)e=e._def.innerType;t[n]=e}})),new Pt({...this._def,shape:()=>t})}keyof(){return Bt(be.objectKeys(this.shape))}}Pt.create=(e,t)=>new Pt({shape:()=>e,unknownKeys:"strip",catchall:Ct.create(),typeName:on.ZodObject,...We(t)}),Pt.strictCreate=(e,t)=>new Pt({shape:()=>e,unknownKeys:"strict",catchall:Ct.create(),typeName:on.ZodObject,...We(t)}),Pt.lazycreate=(e,t)=>new Pt({shape:e,unknownKeys:"strip",catchall:Ct.create(),typeName:on.ZodObject,...We(t)});class At extends $e{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Ie(e.ctx.common.issues)));return Pe(t,{code:Te.invalid_union,unionErrors:n}),Ze}));{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map((e=>new Ie(e)));return Pe(t,{code:Te.invalid_union,unionErrors:r}),Ze}}get options(){return this._def.options}}At.create=(e,t)=>new At({options:e,typeName:on.ZodUnion,...We(t)});const Zt=e=>e instanceof Ht?Zt(e.schema):e instanceof $t?Zt(e.innerType()):e instanceof Ft?[e.value]:e instanceof Ut?e.options:e instanceof Vt?be.objectValues(e.enum):e instanceof Jt?Zt(e._def.innerType):e instanceof kt?[void 0]:e instanceof xt?[null]:e instanceof Kt?[void 0,...Zt(e.unwrap())]:e instanceof Gt?[null,...Zt(e.unwrap())]:e instanceof en||e instanceof nn?Zt(e.unwrap()):e instanceof Xt?Zt(e._def.innerType):[];class Nt extends $e{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ke.object)return Pe(t,{code:Te.invalid_type,expected:ke.object,received:t.parsedType}),Ze;const n=this.discriminator,a=t.data[n],r=this.optionsMap.get(a);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Pe(t,{code:Te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ze)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=Zt(n.shape[e]);if(!t.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(const r of t){if(a.has(r))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(r)));a.set(r,n)}}return new Nt({typeName:on.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...We(n)})}}function jt(e,t){const n=xe(e),a=xe(t);if(e===t)return{valid:!0,data:e};if(n===ke.object&&a===ke.object){const n=be.objectKeys(t),a=be.objectKeys(e).filter((e=>-1!==n.indexOf(e))),r={...e,...t};for(const n of a){const a=jt(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===ke.array&&a===ke.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=jt(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===ke.date&&a===ke.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Dt extends $e{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(De(e)||De(a))return Ze;const r=jt(e.value,a.value);return r.valid?((Le(e)||Le(a))&&t.dirty(),{status:t.value,value:r.data}):(Pe(n,{code:Te.invalid_intersection_types}),Ze)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((e=>{let[t,n]=e;return a(t,n)})):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Dt.create=(e,t,n)=>new Dt({left:e,right:t,typeName:on.ZodIntersection,...We(n)});class Lt extends $e{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.array)return Pe(n,{code:Te.invalid_type,expected:ke.array,received:n.parsedType}),Ze;if(n.data.length<this._def.items.length)return Pe(n,{code:Te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ze;!this._def.rest&&n.data.length>this._def.items.length&&(Pe(n,{code:Te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new Ue(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>Ae.mergeArray(t,e))):Ae.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Lt({...this._def,rest:e})}}Lt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lt({items:e,typeName:on.ZodTuple,rest:null,...We(t)})};class Rt extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.object)return Pe(n,{code:Te.invalid_type,expected:ke.object,received:n.parsedType}),Ze;const a=[],r=this._def.keyType,s=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new Ue(n,e,n.path,e)),value:s._parse(new Ue(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ae.mergeObjectAsync(t,a):Ae.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new Rt(t instanceof $e?{keyType:e,valueType:t,typeName:on.ZodRecord,...We(n)}:{keyType:ft.create(),valueType:e,typeName:on.ZodRecord,...We(t)})}}class Mt extends $e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.map)return Pe(n,{code:Te.invalid_type,expected:ke.map,received:n.parsedType}),Ze;const a=this._def.keyType,r=this._def.valueType,s=[...n.data.entries()].map(((e,t)=>{let[s,i]=e;return{key:a._parse(new Ue(n,s,n.path,[t,"key"])),value:r._parse(new Ue(n,i,n.path,[t,"value"]))}}));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return Ze;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return Ze;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}}Mt.create=(e,t,n)=>new Mt({valueType:t,keyType:e,typeName:on.ZodMap,...We(n)});class zt extends $e{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.set)return Pe(n,{code:Te.invalid_type,expected:ke.set,received:n.parsedType}),Ze;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(Pe(n,{code:Te.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(Pe(n,{code:Te.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function s(e){const n=new Set;for(const a of e){if("aborted"===a.status)return Ze;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map(((e,t)=>r._parse(new Ue(n,e,n.path,t))));return n.common.async?Promise.all(i).then((e=>s(e))):s(i)}min(e,t){return new zt({...this._def,minSize:{value:e,message:He.toString(t)}})}max(e,t){return new zt({...this._def,maxSize:{value:e,message:He.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}zt.create=(e,t)=>new zt({valueType:e,minSize:null,maxSize:null,typeName:on.ZodSet,...We(t)});class qt extends $e{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ke.function)return Pe(t,{code:Te.invalid_type,expected:ke.function,received:t.parsedType}),Ze;function n(e,n){return Ee({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oe(),Ce].filter((e=>!!e)),issueData:{code:Te.invalid_arguments,argumentsError:n}})}function a(e,n){return Ee({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oe(),Ce].filter((e=>!!e)),issueData:{code:Te.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Wt){const e=this;return je((async function(){for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];const c=new Ie([]),d=await e._def.args.parseAsync(i,r).catch((e=>{throw c.addIssue(n(i,e)),c})),l=await Reflect.apply(s,this,d);return await e._def.returns._def.type.parseAsync(l,r).catch((e=>{throw c.addIssue(a(l,e)),c}))}))}{const e=this;return je((function(){for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];const c=e._def.args.safeParse(i,r);if(!c.success)throw new Ie([n(i,c.error)]);const d=Reflect.apply(s,this,c.data),l=e._def.returns.safeParse(d,r);if(!l.success)throw new Ie([a(d,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new qt({...this._def,args:Lt.create(t).rest(It.create())})}returns(e){return new qt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new qt({args:e||Lt.create([]).rest(It.create()),returns:t||It.create(),typeName:on.ZodFunction,...We(n)})}}class Ht extends $e{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})}}Ht.create=(e,t)=>new Ht({getter:e,typeName:on.ZodLazy,...We(t)});class Ft extends $e{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Pe(t,{received:t.data,code:Te.invalid_literal,expected:this._def.value}),Ze}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Bt(e,t){return new Ut({values:e,typeName:on.ZodEnum,...We(t)})}Ft.create=(e,t)=>new Ft({value:e,typeName:on.ZodLiteral,...We(t)});class Ut extends $e{constructor(){super(...arguments),Fe.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Pe(t,{expected:be.joinValues(n),received:t.parsedType,code:Te.invalid_type}),Ze}if(ze(this,Fe,"f")||qe(this,Fe,new Set(this._def.values),"f"),!ze(this,Fe,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Pe(t,{received:t.data,code:Te.invalid_enum_value,options:n}),Ze}return je(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(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._def;return Ut.create(e,{...this._def,...t})}exclude(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._def;return Ut.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Fe=new WeakMap,Ut.create=Bt;class Vt extends $e{constructor(){super(...arguments),Be.set(this,void 0)}_parse(e){const t=be.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ke.string&&n.parsedType!==ke.number){const e=be.objectValues(t);return Pe(n,{expected:be.joinValues(e),received:n.parsedType,code:Te.invalid_type}),Ze}if(ze(this,Be,"f")||qe(this,Be,new Set(be.getValidEnumValues(this._def.values)),"f"),!ze(this,Be,"f").has(e.data)){const e=be.objectValues(t);return Pe(n,{received:n.data,code:Te.invalid_enum_value,options:e}),Ze}return je(e.data)}get enum(){return this._def.values}}Be=new WeakMap,Vt.create=(e,t)=>new Vt({values:e,typeName:on.ZodNativeEnum,...We(t)});class Wt extends $e{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ke.promise&&!1===t.common.async)return Pe(t,{code:Te.invalid_type,expected:ke.promise,received:t.parsedType}),Ze;const n=t.parsedType===ke.promise?t.data:Promise.resolve(t.data);return je(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Wt.create=(e,t)=>new Wt({type:e,typeName:on.ZodPromise,...We(t)});class $t extends $e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===on.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{Pe(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Ze;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ze:"dirty"===a.status||"dirty"===t.value?Ne(a.value):a}));{if("aborted"===t.value)return Ze;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ze:"dirty"===a.status||"dirty"===t.value?Ne(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);if(n.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===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?Ze:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?Ze:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Re(e))return e;const s=a.transform(e.value,r);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Re(e)?Promise.resolve(a.transform(e.value,r)).then((e=>({status:t.value,value:e}))):e))}be.assertNever(a)}}$t.create=(e,t,n)=>new $t({schema:e,typeName:on.ZodEffects,effect:t,...We(n)}),$t.createWithPreprocess=(e,t,n)=>new $t({schema:t,effect:{type:"preprocess",transform:e},typeName:on.ZodEffects,...We(n)});class Kt extends $e{_parse(e){return this._getType(e)===ke.undefined?je(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Kt.create=(e,t)=>new Kt({innerType:e,typeName:on.ZodOptional,...We(t)});class Gt extends $e{_parse(e){return this._getType(e)===ke.null?je(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gt.create=(e,t)=>new Gt({innerType:e,typeName:on.ZodNullable,...We(t)});class Jt extends $e{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===ke.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Jt.create=(e,t)=>new Jt({innerType:e,typeName:on.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...We(t)});class Xt extends $e{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Me(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ie(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Ie(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Xt.create=(e,t)=>new Xt({innerType:e,typeName:on.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...We(t)});class Yt extends $e{_parse(e){if(this._getType(e)!==ke.nan){const t=this._getOrReturnCtx(e);return Pe(t,{code:Te.invalid_type,expected:ke.nan,received:t.parsedType}),Ze}return{status:"valid",value:e.data}}}Yt.create=e=>new Yt({typeName:on.ZodNaN,...We(e)});const Qt=Symbol("zod_brand");class en extends $e{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class tn extends $e{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Ze:"dirty"===e.status?(t.dirty(),Ne(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Ze:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new tn({in:e,out:t,typeName:on.ZodPipeline})}}class nn extends $e{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Re(e)&&(e.value=Object.freeze(e.value)),e);return Me(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function an(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function rn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return e?Tt.create().superRefine(((a,r)=>{var s,i;const o=e(a);if(o instanceof Promise)return o.then((e=>{var s,i;if(!e){const e=an(t,a),o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;r.addIssue({code:"custom",...e,fatal:o})}}));if(!o){const e=an(t,a),o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;r.addIssue({code:"custom",...e,fatal:o})}})):Tt.create()}nn.create=(e,t)=>new nn({innerType:e,typeName:on.ZodReadonly,...We(t)});const sn={object:Pt.lazycreate};var on;!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"}(on||(on={}));const cn=ft.create,dn=vt.create,ln=Yt.create,un=yt.create,hn=_t.create,pn=bt.create,mn=wt.create,fn=kt.create,gn=xt.create,vn=Tt.create,yn=It.create,_n=Ct.create,bn=St.create,wn=Ot.create,kn=Pt.create,xn=Pt.strictCreate,Tn=At.create,In=Nt.create,Cn=Dt.create,Sn=Lt.create,On=Rt.create,En=Mt.create,Pn=zt.create,An=qt.create,Zn=Ht.create,Nn=Ft.create,jn=Ut.create,Dn=Vt.create,Ln=Wt.create,Rn=$t.create,Mn=Kt.create,zn=Gt.create,qn=$t.createWithPreprocess,Hn=tn.create,Fn={string:e=>ft.create({...e,coerce:!0}),number:e=>vt.create({...e,coerce:!0}),boolean:e=>_t.create({...e,coerce:!0}),bigint:e=>yt.create({...e,coerce:!0}),date:e=>bt.create({...e,coerce:!0})},Bn=Ze;var Un=Object.freeze({__proto__:null,defaultErrorMap:Ce,setErrorMap:function(e){Se=e},getErrorMap:Oe,makeIssue:Ee,EMPTY_PATH:[],addIssueToContext:Pe,ParseStatus:Ae,INVALID:Ze,DIRTY:Ne,OK:je,isAborted:De,isDirty:Le,isValid:Re,isAsync:Me,get util(){return be},get objectUtil(){return we},ZodParsedType:ke,getParsedType:xe,ZodType:$e,datetimeRegex:ht,ZodString:ft,ZodNumber:vt,ZodBigInt:yt,ZodBoolean:_t,ZodDate:bt,ZodSymbol:wt,ZodUndefined:kt,ZodNull:xt,ZodAny:Tt,ZodUnknown:It,ZodNever:Ct,ZodVoid:St,ZodArray:Ot,ZodObject:Pt,ZodUnion:At,ZodDiscriminatedUnion:Nt,ZodIntersection:Dt,ZodTuple:Lt,ZodRecord:Rt,ZodMap:Mt,ZodSet:zt,ZodFunction:qt,ZodLazy:Ht,ZodLiteral:Ft,ZodEnum:Ut,ZodNativeEnum:Vt,ZodPromise:Wt,ZodEffects:$t,ZodTransformer:$t,ZodOptional:Kt,ZodNullable:Gt,ZodDefault:Jt,ZodCatch:Xt,ZodNaN:Yt,BRAND:Qt,ZodBranded:en,ZodPipeline:tn,ZodReadonly:nn,custom:rn,Schema:$e,ZodSchema:$e,late:sn,get ZodFirstPartyTypeKind(){return on},coerce:Fn,any:vn,array:wn,bigint:un,boolean:hn,date:pn,discriminatedUnion:In,effect:Rn,enum:jn,function:An,instanceof:function(e){return rn((t=>t instanceof e),arguments.length>1&&void 0!==arguments[1]?arguments[1]:{message:"Input not instance of ".concat(e.name)})},intersection:Cn,lazy:Zn,literal:Nn,map:En,nan:ln,nativeEnum:Dn,never:_n,null:gn,nullable:zn,number:dn,object:kn,oboolean:()=>hn().optional(),onumber:()=>dn().optional(),optional:Mn,ostring:()=>cn().optional(),pipeline:Hn,preprocess:qn,promise:Ln,record:On,set:Pn,strictObject:xn,string:cn,symbol:mn,transformer:Rn,tuple:Sn,undefined:fn,union:Tn,unknown:yn,void:bn,NEVER:Bn,ZodIssueCode:Te,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Ie});const Vn=()=>Un.function().args(Un.custom()).returns(Un.boolean().optional()),Wn=Un.enum(["dev","test","uat","prod"]);var $n;Un.object({api:Un.string().refine((e=>!e.startsWith("http")),{message:"Just need host part in url"}),project:Un.string().min(1,"Missing value"),title:Un.string().min(1,"Missing value"),env:Wn.or(Un.literal("")),version:Un.string(),enableSSL:Un.boolean(),messageCapacity:Un.number(),useSecret:Un.boolean(),secret:Un.string().refine((e=>!e),{message:"Secret is not allowed to be set manually"}),offline:Un.boolean(),serializeData:Un.boolean(),disabledPlugins:Un.array(Un.string()),dataProcessor:Un.object({console:Vn(),network:Vn(),storage:Vn(),database:Vn(),page:Vn(),system:Vn()}).partial().strict()}).partial().strict(),function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}($n||($n={}));const Kn=2e3,Gn=Math.pow(1.5,4)*Kn;class Jn{getSocket(){return this.socketWrapper}updateRoomInfo(){if(this.getPageSpyConfig){var e;const{project:t,title:n,env:a,version:r}=this.getPageSpyConfig(),s=null===(e=this.getClient)||void 0===e?void 0:e.call(this).getName();this.send({type:he,content:{info:{name:s,group:t,tags:{title:n,name:s,group:t,env:a,version:r}}}},!0)}}constructor(){t(this,"socketUrl",""),t(this,"socketConnection",null),t(this,"debuggerConnection",null),t(this,"pingTimer",null),t(this,"pongTimer",null),t(this,"retryTimer",null),t(this,"isOffline",!1),t(this,"messageCapacity",0),t(this,"messages",[]),t(this,"events",{debug:[],refresh:[],"atom-detail":[],"atom-getter":[],"debugger-online":[],"database-pagination":[],"public-data":[],"harbor-clear":[]}),t(this,"retryInterval",Kn),t(this,"connectable",!0),t(this,"getPageSpyConfig",null),t(this,"getClient",null),this.addListener("atom-detail",Jn.handleResolveAtom),this.addListener("atom-getter",Jn.handleAtomPropertyGetter),this.addListener("debugger-online",this.handleFlushBuffer)}async init(e){try{var t,n,a,r,s;if(!e)throw Error("WebSocket url cannot be empty");this.socketWrapper.clearListeners(),this.socketWrapper.getState()===$n.OPEN&&await new Promise((e=>{this.socketWrapper.onClose((()=>{this.socketWrapper.clearListeners(),e()})),this.socketWrapper.close()})),null===(t=this.socketWrapper)||void 0===t||t.onOpen((()=>{this.connectOnline()})),null===(n=this.socketWrapper)||void 0===n||n.onMessage((e=>{this.handleMessage(e)})),null===(a=this.socketWrapper)||void 0===a||a.onClose((()=>{this.connectOffline()})),null===(r=this.socketWrapper)||void 0===r||r.onError((()=>{this.connectOffline()})),this.socketUrl=e,null===(s=this.socketWrapper)||void 0===s||s.init(e)}catch(e){g.error(e.message)}}addListener(e,t){this.events[e]||(this.events[e]=[]),this.events[e].push(t)}removeListener(e,t){const n=this.events[e]||[],a=n.indexOf(t);a>-1&&n.splice(a,1)}broadcastMessage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=function(e){return{type:le,content:{data:e}}}(e);this.send(n,t)}close(){var e;this.connectable=!1,this.clearPing(),null===(e=this.socketWrapper)||void 0===e||e.close(),this.messages=[],Object.entries(this.events).forEach((e=>{let[t,n]=e;["atom-detail","atom-getter","debugger-online"].includes(t)||n.splice(0)}))}connectOnline(){this.retryInterval=Kn,this.updateRoomInfo(),this.ping()}connectOffline(){this.socketConnection=null,this.debuggerConnection=null,this.clearPing(),this.retryTimer&&clearTimeout(this.retryTimer),this.connectable&&(this.retryTimer=setTimeout((()=>{this.retryInterval<Gn&&(this.retryInterval*=1.5),this.retryTimer=null,this.tryReconnect()}),this.retryInterval))}tryReconnect(){this.init(this.socketUrl)}ping(){this.pingTimer&&clearTimeout(this.pingTimer),this.pongTimer&&clearTimeout(this.pongTimer),this.pingTimer=setTimeout((()=>{this.send({type:"ping",content:null}),this.pingTimer=null,this.pongTimer=setTimeout((()=>{this.connectOffline(),this.pongTimer=null}),5e3)}),5e3)}clearPing(){this.pingTimer&&(clearTimeout(this.pingTimer),this.pingTimer=null),this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null)}handlePong(){clearTimeout(this.pongTimer),this.pongTimer=null,this.ping()}handleMessage(e){var t;Jn.messageFilters.length&&Jn.messageFilters.forEach((t=>{e=t(e)}));const{CONNECT:n,MESSAGE:a,ERROR:r,JOIN:s,PING:i,PONG:o,LEAVE:c,CLOSE:d,BROADCAST:l}=me,u=JSON.parse(e.data),{type:h}=u;switch(h){case n:const{selfConnection:e,roomConnections:i}=u.content;this.socketConnection=e,this.debuggerConnection=i.find((e=>"Debugger"===e.userId))||null;break;case s:case c:const{connection:o}=u.content;"Debugger"===o.userId&&(h===s?(this.debuggerConnection=o,this.sendClientInfo()):this.debuggerConnection=null);break;case a:const{data:l,from:p,to:m}=u.content;m.address===(null===(t=this.socketConnection)||void 0===t?void 0:t.address)&&this.dispatchEvent(l.type,{source:l,from:p,to:m});break;case d:case r:this.connectOffline()}this.handlePong()}dispatchEvent(e,t){var n;["public-data"].includes(e)?this.events["public-data"].forEach((e=>{e(t)})):null===(n=this.events[e])||void 0===n||n.forEach((e=>{e.call(this,t,(e=>{this.unicastMessage(e,t.from)}))}))}unicastMessage(e,t){const n=function(e,t,n){return{type:de,content:{data:e,from:t,to:n}}}(e,this.socketConnection,t);this.send(n)}handleFlushBuffer(e){const{latestId:t}=e.source.data,n=this.messages.findIndex((e=>e.content.data.data.id===t));this.messages.slice(n+1).forEach((t=>{const n={type:de,content:{data:t.content.data,from:this.socketConnection,to:e.from}};this.send(n,!0)}))}static handleResolveAtom(e,t){let{source:n}=e;const{type:a,data:r}=n;if("atom-detail"===a){const e=_e.get(r)||{};t(fe("atom-detail-".concat(r),e,!1))}}static handleAtomPropertyGetter(e,t){let{source:n}=e;const{type:a,data:r}=n;if("atom-getter"===a){const{id:e,parentId:n,key:a,instanceId:i}=r,o=_e.getOrigin(i),c=_e.getOrigin(n);let d={};var s;if(o&&c)d=null===(s=Object.getOwnPropertyDescriptor(c,a))||void 0===s||null===(s=s.get)||void 0===s?void 0:s.call(o);else d=new Error("Getter computed failed");t(fe("atom-getter-".concat(e),_e.transformToAtom(d)))}}send(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.checkIfSend(e))try{var n;const t=e;t.createdAt=Date.now(),t.requestId=a();const r=function(e){const{ok:t,value:n}=p(e);return t?n:JSON.stringify(e,((e,t)=>p(t).value),2)}(t);null===(n=this.socketWrapper)||void 0===n||n.send(r)}catch(e){g.error("Incompatible: ".concat(e.message)),this.connectOffline()}this.checkIfCache(e,t)&&(0!==this.messageCapacity&&this.messages.length>=this.messageCapacity&&this.messages.shift(),this.messages.push(e))}checkIfSend(e){return this.socketWrapper.getState()===$n.OPEN&&(!![he,ue].includes(e.type)||!!this.debuggerConnection)}checkIfCache(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.isOffline&&!t&&![de,ue].includes(e.type)}sendClientInfo(){var e;const t=null===(e=this.getClient)||void 0===e?void 0:e.call(this).makeClientInfoMsg();this.broadcastMessage({role:"client",type:"client-info",data:t},!0)}}t(Jn,"messageFilters",[]);const Xn=function(){if(n()){const{lang:e}=document.documentElement;return e?l.some((t=>t===e)):l.some((e=>e===navigator.language))}return!1}()?"zh":"en";const Yn=new class{constructor(e){t(this,"locales",void 0),t(this,"currentLang",void 0);const{locales:n,defaultLang:a=Xn}=e;if(!n||0===Object.keys(n).length)throw new Error("[PageSpy] Locales cannot be empty");if(!n[a])throw new Error('[PageSpy] Language "'.concat(a,'" not found'));this.locales=n,this.currentLang=a}t(e,t){const n=t||this.currentLang,a=this.locales[n];return a?a[e]||e:(g.warn("Language '".concat(n,"' not found, falling back to default")),e)}setLang(e){this.locales[e]?this.currentLang=e:g.error("Language '".concat(e,"' is not supported"))}getCurrentLang(){return this.currentLang}getSupportedLangs(){return Object.keys(this.locales)}}({locales:{zh:{title:"离线日志",uploadPeriods:"上传时间段",downloadPeriods:"下载时间段",readying:"准备数据...",ready:"数据已就绪",success:"处理成功",fail:"处理失败",invalid:"无法上传",copied:"已复制调试连接",selectPeriod:"选择时间段",periodDuration:"每段时长",remark:"备注",remarkPlaceholder:"上传后,可以看到备注信息",from:"从",to:"到",refreshed:"已刷新",minutes:"分钟",eventCountNotEnough:"时间段内的数据量不足以回放",invalidPeriods:"选择的开始时间无效",invalidParams:"调用 onOfflineLog() 的参数不正确",copyUrl:"复制调试链接",copyFailed:"复制失败",paused:"已暂停",pausedInfoText:"暂停期间数据不会被记录",noData:"请先选择时间段"},en:{title:"Offline log",uploadPeriods:"Upload Periods",downloadPeriods:"Download Periods",readying:"Handling...",ready:"Ready",success:"Succeed",fail:"Failed",invalid:"Cannot upload",copied:"Replay url copied",selectPeriod:"Select period",periodDuration:"Each duration",remark:"Remark",remarkPlaceholder:"After uploading, you can view the remark information.",from:"From",to:"To",refreshed:"Refreshed",minutes:"minutes",eventCountNotEnough:"The data within the time period is insufficient for playback",invalidPeriods:"The start of selected period is invalid",invalidParams:"Incorrect params which you call onOfflineLog()",copyUrl:"Copy URL",copyFailed:"Copy failed",paused:"Paused",pausedInfoText:"Data will not be recorded during pause",noData:"Please select period"}}});let Qn=0;const ea="PERIOD_DIVIDE_IDENTIFIER",ta=10485760;class na{constructor(e){var a;t(this,"stock",[]),t(this,"container",[]),t(this,"maximum",ta),t(this,"periodList",{stable:[],active:[]}),i(a=null==e?void 0:e.maximum)&&a>=0&&(this.maximum=e.maximum),n()&&window.addEventListener("beforeunload",(()=>{this.stock.forEach((e=>{URL.revokeObjectURL(e)}))}))}add(e){const t=0===this.periodList.active.length&&0===this.stock.length&&0===this.container.length,n=e===ea;try{if((t||n)&&(this.periodList.active.push({time:new Date,stockIndex:null,dataIndex:this.container.length}),n))return!0;if(0===this.maximum)return this.container.push(e),!0;const{size:a}=new Blob([JSON.stringify(e)],{type:"application/json"}),r=Qn+a;if(r>=this.maximum){const t=URL.createObjectURL(new Blob([JSON.stringify(this.container)],{type:"application/json"}));this.stock.push(t),this.flushActivePeriod(),this.container=[e],Qn=0}else this.container.push(e),Qn=r;return!0}catch(e){return!1}}flushActivePeriod(){const e=this.periodList.active.map((e=>({...e,stockIndex:this.stock.length-1})));this.periodList.stable.push(...e),this.periodList.active=[]}getPeriodList(){const e={time:new Date,stockIndex:null,dataIndex:this.container.length};return[...this.periodList.stable,...this.periodList.active,e]}async getPeriodData(e){const{head:t,tail:n}=this.getHeadAndTailPeriods(e),{endTime:a}=e,{stockIndex:r=null,dataIndex:s}=t||{},{stockIndex:o=null,dataIndex:c}=n||{};let d=[];if(null===r&&null===o)d=this.container.slice(s,c);else{if(null===r)throw new Error(Yn.t("invalidPeriods"));d=(await Promise.all(this.stock.map((async(e,t)=>{try{if(t<r||i(o)&&t>o)return null;const n=await fetch(e);if(!n.ok)return null;const a=await n.json();return t===r?t===o?a.slice(s,c):a.slice(s):t===o?a.slice(0,c):a}catch(e){return null}})))).reduce(((e,t)=>t?e.concat(t):e),[]),i(o)||(d=d.concat(this.container.slice(0,c)))}return d.filter((e=>e.timestamp<=a))}getHeadAndTailPeriods(e){let{startTime:t,endTime:n}=e;const a=this.getPeriodList(),r=a.findLast((e=>e.time.getTime()<=t)),s=a.find((e=>e.time.getTime()>=n));return{head:r,tail:s}}async getAll(){const e=await Promise.all(this.stock.map((async e=>{try{const t=await fetch(e);return t.ok?await t.json():null}catch(e){return null}})));return e.filter(Boolean).reduce(((e,t)=>e.concat(t)),[]).concat(this.container)}clear(){this.stock.forEach((e=>URL.revokeObjectURL(e))),this.stock=[],this.container=[],this.periodList={stable:[],active:[]}}}function aa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ra=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],a=0;a<e.rangeCount;a++)n.push(e.getRangeAt(a));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},sa={"text/plain":"Text","text/html":"Url",default:"Text"};var ia=function(e,t){var n,a,r,s,i,o,c=!1;t||(t={}),n=t.debug||!1;try{if(r=ra(),s=document.createRange(),i=document.getSelection(),(o=document.createElement("span")).textContent=e,o.ariaHidden="true",o.style.all="unset",o.style.position="fixed",o.style.top=0,o.style.clip="rect(0, 0, 0, 0)",o.style.whiteSpace="pre",o.style.webkitUserSelect="text",o.style.MozUserSelect="text",o.style.msUserSelect="text",o.style.userSelect="text",o.addEventListener("copy",(function(a){if(a.stopPropagation(),t.format)if(a.preventDefault(),void 0===a.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=sa[t.format]||sa.default;window.clipboardData.setData(r,e)}else a.clipboardData.clearData(),a.clipboardData.setData(t.format,e);t.onCopy&&(a.preventDefault(),t.onCopy(a.clipboardData))})),document.body.appendChild(o),s.selectNodeContents(o),i.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),a=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,e)}}finally{i&&("function"==typeof i.removeRange?i.removeRange(s):i.removeAllRanges()),o&&document.body.removeChild(o),r()}return c},oa=aa(ia),ca="content-LZZnQ",da="timeInfo-Icd9h",la="recorder-BbZe0",ua="paused-ByjEq",ha="duration-xNczp",pa="colon-layOC",ma="pauseIcon-3NXkY",fa="infoIcon-EKSZE",ga="pausedInfo-4u2DI",va="pausedInfoText-FHdmg",ya="periodInfo-HnHms",_a="label-attmz",ba="periodTips-F91zM",wa="refreshIcon-9zYat",ka="selectPeriod-h8D6d",xa="track-g8egA",Ta="range-cWHDf",Ia="remarkInfo-0rspp",Ca="result-CAAkx";!function(){const e=document.createElement("style");e.setAttribute("data-harbor-style","true"),e.textContent=".content-LZZnQ {\n  padding-top: var(--block-padding);\n}\n.timeInfo-Icd9h {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n.timeInfo-Icd9h .recorder-BbZe0 {\n  padding: var(--input-padding-lg);\n  font-size: var(--text-base);\n  border-radius: 999px;\n  transition: background-color 0.15s ease, transform 0.15s ease;\n  cursor: pointer;\n  -webkit-user-select: none;\n          user-select: none;\n  background-color: hsl(0, 0%, 94%);\n}\n.timeInfo-Icd9h .recorder-BbZe0:hover {\n  background-color: hsl(0, 0%, 90%);\n}\n.timeInfo-Icd9h .recorder-BbZe0:active {\n  transform: scale(0.95);\n}\n.timeInfo-Icd9h .recorder-BbZe0.paused-ByjEq > div:nth-child(1) {\n  display: none;\n}\n.timeInfo-Icd9h .recorder-BbZe0.paused-ByjEq > div:nth-child(2) {\n  display: flex;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div {\n  gap: var(--input-padding-lg);\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(1) {\n  display: flex;\n  align-items: center;\n  position: relative;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(1)::before {\n  content: '';\n  width: 1.07142857em;\n  height: 1.07142857em;\n  border-radius: 1.07142857em;\n  background-color: #ff0f0f;\n  animation: fade-uxQdC 0.8s ease-in-out infinite alternate;\n}\n@keyframes fade-uxQdC {\n  from {\n    opacity: 1;\n  }\n  to {\n    opacity: 0.05;\n  }\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(1) .duration-xNczp {\n  display: flex;\n  align-items: center;\n  font-size: var(--text-3xl);\n  font-weight: 700;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(1) .duration-xNczp span {\n  display: inline-flex;\n  justify-content: center;\n  align-items: center;\n  width: 0.64em;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(1) .duration-xNczp span.colon-layOC {\n  width: 0.36em;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) {\n  display: none;\n  align-items: center;\n  color: var(--text-primary);\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) b {\n  color: var(--text-primary);\n  font-size: var(--text-3xl);\n  font-weight: 700;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) svg {\n  width: 1em;\n  height: 1em;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) .pauseIcon-3NXkY {\n  font-size: var(--text-3xl);\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) .infoIcon-EKSZE {\n  font-size: var(--text-lg);\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) .pausedInfo-4u2DI {\n  position: relative;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) .pausedInfo-4u2DI:hover .pausedInfoText-FHdmg,\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) .pausedInfo-4u2DI:active .pausedInfoText-FHdmg {\n  display: block;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) .pausedInfo-4u2DI .pausedInfoText-FHdmg {\n  display: none;\n  position: absolute;\n  left: 0;\n  top: 0;\n  transform: translate(-65%, -170%);\n  white-space: nowrap;\n  font-size: var(--text-base);\n  color: var(--text-primary);\n  background-color: #fff;\n  padding: var(--input-padding-lg);\n  border-radius: 0.29em;\n  box-shadow: var(--dark-shadow);\n  z-index: 1;\n}\n.timeInfo-Icd9h .recorder-BbZe0 > div:nth-child(2) .pausedInfo-4u2DI .pausedInfoText-FHdmg::before {\n  content: '';\n  position: absolute;\n  left: 65%;\n  bottom: 0;\n  transform: translate(0, 30%) rotate(45deg);\n  width: 0.86em;\n  height: 0.86em;\n  background-color: #fff;\n  border-radius: 2px;\n  z-index: -1;\n}\n.periodInfo-HnHms {\n  margin-top: 1.43em;\n}\n.periodInfo-HnHms .label-attmz {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  margin-bottom: 2.29em;\n}\n.periodInfo-HnHms .label-attmz .periodTips-F91zM {\n  display: flex;\n  align-items: center;\n  gap: var(--gap);\n}\n.periodInfo-HnHms .label-attmz .periodTips-F91zM b {\n  font-size: 1em;\n  color: var(--text-primary);\n}\n.periodInfo-HnHms .label-attmz .periodTips-F91zM span {\n  color: var(--text-secondary);\n  font-size: var(--text-sm);\n}\n.periodInfo-HnHms .label-attmz .refreshIcon-9zYat {\n  cursor: pointer;\n}\n.periodInfo-HnHms .label-attmz .refreshIcon-9zYat svg {\n  width: 1.71em;\n  height: 1.71em;\n  color: var(--primary-color);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d {\n  position: relative;\n  width: 92%;\n  margin: 0 auto;\n  --thumb-size: 1.71em;\n  --thumb-shadow: 0 0 0 5px var(--primary-color) inset, 0 0 0 99px white inset;\n  --thumb-shadow-hover: 0 0 0 7px var(--primary-color) inset,\n      0 0 0 99px white inset;\n  --thumb-shadow-disabled: 0 0 0 5px var(--disabled-color) inset,\n      0 0 0 99px white inset;\n  --track-size: calc(var(--thumb-size) / 2);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d.disabled-wsWXG {\n  cursor: not-allowed;\n}\n.periodInfo-HnHms .selectPeriod-h8D6d.disabled-wsWXG .track-g8egA .range-cWHDf {\n  background-color: var(--disabled-color);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d.disabled-wsWXG input:disabled {\n  --thumb-shadow: var(--thumb-shadow-disabled);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d.disabled-wsWXG input:disabled::-webkit-slider-thumb {\n  cursor: not-allowed;\n}\n.periodInfo-HnHms .selectPeriod-h8D6d.disabled-wsWXG input:disabled::-moz-range-thumb {\n  cursor: not-allowed;\n}\n.periodInfo-HnHms .selectPeriod-h8D6d.disabled-wsWXG input:disabled::-ms-thumb {\n  cursor: not-allowed;\n}\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA {\n  width: 100%;\n  height: var(--track-size);\n  background-color: var(--divider-color);\n  border-radius: var(--track-size);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA .range-cWHDf {\n  --left: 0;\n  --right: 0;\n  --min-text: 'From';\n  --max-text: 'To';\n  position: absolute;\n  left: var(--left);\n  right: var(--right);\n  height: 100%;\n  background-color: var(--primary-color);\n  border-radius: var(--track-size);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA .range-cWHDf[data-min-text-position='bottom']::before {\n  top: calc(var(--thumb-size));\n}\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA .range-cWHDf[data-max-text-position='bottom']::after {\n  top: calc(var(--thumb-size));\n}\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA .range-cWHDf::before,\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA .range-cWHDf::after {\n  position: absolute;\n  top: calc(var(--thumb-size) * -1);\n  transition: top 0.15s ease-in-out;\n  font-size: var(--text-base);\n  font-weight: 500;\n  color: var(--text-placeholder);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA .range-cWHDf::before {\n  content: var(--min-text);\n  left: 0;\n  transform: translateX(-50%) scale(0.8);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d .track-g8egA .range-cWHDf::after {\n  content: var(--max-text);\n  right: 0;\n  transform: translateX(50%) scale(0.8);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d input {\n  -webkit-appearance: none;\n          appearance: none;\n  pointer-events: none;\n  position: absolute;\n  left: calc(var(--track-size) * -1);\n  top: 0;\n  width: calc(100% + var(--thumb-size));\n  height: var(--track-size);\n  background-color: transparent;\n  z-index: 2;\n}\n.periodInfo-HnHms .selectPeriod-h8D6d input:hover {\n  --thumb-shadow: var(--thumb-shadow-hover);\n}\n.periodInfo-HnHms .selectPeriod-h8D6d input::-webkit-slider-thumb {\n  -webkit-appearance: none;\n          appearance: none;\n  pointer-events: auto;\n  width: var(--thumb-size);\n  height: var(--thumb-size);\n  border-radius: var(--thumb-size);\n  background-color: white;\n  box-shadow: var(--thumb-shadow);\n  cursor: grab;\n  -webkit-transition: 0.15s;\n  transition: 0.15s;\n  border: 0.14em solid white;\n}\n.periodInfo-HnHms .selectPeriod-h8D6d input::-moz-range-thumb {\n  appearance: none;\n  pointer-events: auto;\n  width: var(--thumb-size);\n  height: var(--thumb-size);\n  border-radius: var(--thumb-size);\n  background-color: white;\n  box-shadow: var(--thumb-shadow);\n  cursor: grab;\n  -moz-transition: 0.15s;\n  transition: 0.15s;\n  border: 0.14em solid white;\n}\n.periodInfo-HnHms .selectPeriod-h8D6d input::-ms-thumb {\n  appearance: none;\n  pointer-events: auto;\n  width: var(--thumb-size);\n  height: var(--thumb-size);\n  border-radius: var(--thumb-size);\n  background-color: white;\n  box-shadow: var(--thumb-shadow);\n  cursor: grab;\n  -ms-transition: 0.15s;\n  transition: 0.15s;\n  border: 0.14em solid white;\n}\n.remarkInfo-0rspp {\n  margin-top: 1.43em;\n}\n.remarkInfo-0rspp .label-attmz {\n  margin-bottom: 0.86em;\n  font-size: 1em;\n  font-weight: 700;\n  color: var(--text-primary);\n}\n.remarkInfo-0rspp textarea {\n  width: 100%;\n  padding: var(--input-padding);\n  background-color: hsl(0, 0%, 95%);\n  border-radius: 0.29em;\n  box-sizing: border-box;\n  border: var(--border);\n  outline: none;\n  color: var(--text-primary);\n  font-size: var(--text-base);\n  line-height: 1.5;\n  font-family: var(--font-family);\n}\n.remarkInfo-0rspp textarea:focus,\n.remarkInfo-0rspp textarea:active {\n  border-color: var(--primary-color);\n}\n.result-CAAkx {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  gap: var(--gap-lg);\n  padding-top: var(--gap-lg);\n  padding-bottom: var(--gap-lg);\n}\n.result-CAAkx svg {\n  width: 2.86em;\n  height: 2.86em;\n  color: var(--primary-color);\n}\n.result-CAAkx b {\n  font-size: var(--text-lg);\n}\n",window.dataHarborStyles&&Array.isArray(window.dataHarborStyles)||(window.dataHarborStyles=[]),window.dataHarborStyles.push(e)}();function Sa(e){return e<10?.2:e<30?.16:.135}const Oa=e=>{let{plugin:t,modal:n,toast:a}=e;const r=(new DOMParser).parseFromString('\n    \x3c!-- Add button for default modal --\x3e\n    <button class="page-spy-btn" data-dashed id="open-log-action">\n      '.concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 21v-3m0 0H9.197c-1.118 0-1.678 0-2.105-.218a2 2 0 0 1-.874-.874C6 16.48 6 15.92 6 14.8V6m12 12h3M6 6H3m3 0V3m4 3h4.8c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874c.218.427.218.987.218 2.105V14"/>\n  </svg>',"\n      <span>").concat(Yn.t("title"),'</span>\n    </button>\n\n    \x3c!-- Show modal content on button#open-log-action clicked --\x3e\n    <div class="').concat(ca,'">\n      <div class="').concat(da,'">\n        <div class="').concat(la,'">\n          <div>\n            <span class="').concat(ha,'">--</span>\n          </div>\n          <div>\n            <span class="').concat(ma,'">').concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <path fill="currentColor"\n      d="M9 16h2V8H9zm4 0h2V8h-2zm-1 6q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8" />\n  </svg>  \n',"</span>\n            <b>").concat(Yn.t("paused"),'</b>\n            <div class="').concat(ga,'">\n              <span class="').concat(fa,'">').concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <path fill="currentColor"\n      d="M12.3 7.29c.2-.18.44-.29.7-.29c.27 0 .5.11.71.29c.19.21.29.45.29.71c0 .27-.1.5-.29.71c-.21.19-.44.29-.71.29c-.26 0-.5-.1-.7-.29c-.19-.21-.3-.44-.3-.71c0-.26.11-.5.3-.71m-2.5 4.68s2.17-1.72 2.96-1.79c.74-.06.59.79.52 1.23l-.01.06c-.14.53-.31 1.17-.48 1.78c-.38 1.39-.75 2.75-.66 3c.1.34.72-.09 1.17-.39c.06-.04.11-.08.16-.11c0 0 .08-.08.16.03c.02.03.04.06.06.08c.09.14.14.19.02.27l-.04.02c-.22.15-1.16.81-1.54 1.05c-.41.27-1.98 1.17-1.74-.58c.21-1.23.49-2.29.71-3.12c.41-1.5.59-2.18-.33-1.59c-.37.22-.59.36-.72.45c-.11.08-.12.08-.19-.05l-.03-.06l-.05-.08c-.07-.1-.07-.11.03-.2M22 12c0 5.5-4.5 10-10 10S2 17.5 2 12S6.5 2 12 2s10 4.5 10 10m-2 0c0-4.42-3.58-8-8-8s-8 3.58-8 8s3.58 8 8 8s8-3.58 8-8" />\n  </svg>\n','</span>\n              <div class="').concat(va,'">\n                <span>').concat(Yn.t("pausedInfoText"),'</span>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n      <div class="').concat(ya,'">\n        <div class="').concat(_a,'">\n          <div class="').concat(ba,'">\n            <b>').concat(Yn.t("selectPeriod"),'</b>\n          </div>\n          <div class="').concat(wa,'">').concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <path fill="currentColor" d="M3.5 12q0-3.616 2.664-6.058T12.5 3.5v-.692q0-.242.217-.354t.43.03l2.163 1.62q.323.242.323.646t-.323.646l-2.164 1.62q-.212.142-.429.03t-.217-.354V6Q9.86 6 7.93 7.718T6 12q0 .883.247 1.713t.73 1.556q.217.323.167.69t-.348.583l-.407.298q-.373.293-.818.227t-.711-.444q-.668-1.017-1.014-2.2Q3.5 13.241 3.5 12m8 8.5v.692q0 .243-.217.354q-.217.112-.43-.03l-2.162-1.62q-.324-.242-.324-.646t.323-.646l2.164-1.62q.212-.142.429-.03t.217.354V18q2.64 0 4.57-1.718T18 12q0-.883-.247-1.722q-.247-.84-.73-1.566q-.217-.323-.167-.69t.348-.583l.407-.298q.373-.293.818-.225t.712.442q.661 1.036 1.01 2.21T20.5 12q0 3.616-2.664 6.058T11.5 20.5"/>\n  </svg>\n','</div>\n        </div>\n        <div class="').concat(ka,'">\n          <div class="').concat(xa,'">\n            <div class="').concat(Ta,'"></div>\n          </div>\n          <input type="range" id="period-min" min="0" step="1" />\n          <input type="range" id="period-max" min="0" step="1" />\n        </div>\n      </div>\n      <div class="').concat(Ia,'">\n        <div class="').concat(_a,'">').concat(Yn.t("remark"),'</div>\n        <textarea rows="4" id="harbor-remark" placeholder="').concat(Yn.t("remarkPlaceholder"),'"></textarea>\n      </div>\n    </div>\n\n    \x3c!-- Upload / Download log button --\x3e\n    <button class="page-spy-btn" data-primary id="upload-periods">\n      ').concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <path fill="currentColor" d="M9.8 21.75q-3.425-.775-5.613-3.5T2 12t2.188-6.25T9.8 2.25q.475-.125.838.175t.362.8q0 .35-.2.625t-.55.35Q7.5 4.825 5.75 7T4 12t1.75 5t4.5 2.8q.35.075.55.35t.2.625q0 .5-.362.8t-.838.175m4.4 0q-.475.125-.837-.175t-.363-.8q0-.35.2-.625t.55-.35q.675-.15 1.313-.413t1.212-.637q.275-.2.613-.15t.587.3q.35.35.3.813t-.45.737q-.725.45-1.513.775t-1.612.525m4.7-4.25q-.25-.25-.3-.587t.15-.613q.375-.575.638-1.225t.412-1.325q.075-.35.35-.537t.625-.188q.5 0 .8.363t.175.837q-.2.825-.525 1.613t-.775 1.512q-.275.4-.737.45t-.813-.3m1.875-6.5q-.35 0-.625-.2t-.35-.55q-.15-.675-.413-1.312t-.637-1.213q-.2-.3-.15-.637t.3-.588q.35-.35.813-.3t.737.475q.45.725.775 1.513T21.75 9.8q.125.475-.175.838t-.8.362m-4.5-5.75q-.575-.375-1.212-.638T13.75 4.2q-.35-.075-.55-.35t-.2-.625q0-.5.363-.8t.837-.175q.825.2 1.613.525t1.512.775q.425.275.475.738t-.3.812q-.25.25-.587.3t-.638-.15M11.975 17q-.425 0-.712-.288T10.975 16v-5.125l-1.875 1.9q-.3.3-.712.3t-.713-.3t-.312-.712t.287-.713l3.625-3.65q.275-.275.7-.275t.7.275l3.575 3.575q.3.3.313.725t-.288.725t-.725.3t-.725-.3l-1.85-1.85V16q0 .425-.287.713t-.713.287"/>\n  </svg>\n',"\n      <span>").concat(Yn.t("uploadPeriods"),'</span>\n    </button>\n    <button class="page-spy-btn" id="download-periods">\n      ').concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <path fill="currentColor" d="M10.975 21.95q-1.9-.2-3.537-1.062t-2.838-2.2t-1.887-3.063t-.688-3.65q0-3.875 2.563-6.712T11 2v2q-3.025.425-5 2.688t-1.975 5.287T6 17.263t4.975 2.687zm1-4.95L6.95 11.95l1.425-1.425l2.6 2.6V7h2v6.125l2.575-2.575L16.975 12zm1 4.95v-2q1.075-.15 2.063-.575t1.837-1.075l1.45 1.45q-1.175.925-2.525 1.488t-2.825.712m3.95-16.3Q16.05 5 15.063 4.575T13 4V2q1.475.15 2.825.713t2.5 1.487zm2.8 12.65l-1.4-1.425q.65-.85 1.05-1.837t.55-2.063h2.05q-.2 1.475-.75 2.838t-1.5 2.487m.2-7.325q-.15-1.075-.55-2.062t-1.05-1.838l1.4-1.425q.95 1.125 1.525 2.488t.725 2.837z"/>\n  </svg>\n',"\n      <span>").concat(Yn.t("downloadPeriods"),'</span>\n    </button>\n\n    \x3c!-- Result --\x3e\n    <div class="').concat(Ca,'">\n      ').concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <path fill="currentColor" fill-rule="evenodd"\n      d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-1.177-7.86l-2.765-2.767L7 12.431l3.119 3.121a1 1 0 0 0 1.414 0l5.952-5.95l-1.062-1.062z" />\n  </svg>\n',"\n      <b>").concat(Yn.t("success"),'</b>\n    </div>\n\n    <button class="page-spy-btn" data-primary id="copy-replay-url" data-url>\n      ').concat('\n  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">\n    <g fill="none" stroke="white" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">\n      <path\n        d="M7 9.667A2.667 2.667 0 0 1 9.667 7h8.666A2.667 2.667 0 0 1 21 9.667v8.666A2.667 2.667 0 0 1 18.333 21H9.667A2.667 2.667 0 0 1 7 18.333z" />\n      <path d="M4.012 16.737A2 2 0 0 1 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1" />\n    </g>\n  </svg>\n',"\n      <span>").concat(Yn.t("copyUrl"),"</span>\n    </button>\n    "),"text/html"),s=e=>r.querySelector.call(r,e),i=e=>s(".".concat(e)),o=s("#open-log-action"),c=i(ca),d=i(wa),l=i(Ta),u=s("#period-min"),h=s("#period-max"),p=s("#harbor-remark"),m=s("#upload-periods"),f=s("#download-periods"),v=i(Ca),y=s("#copy-replay-url"),_=i(la),b=i(ha),w=i(ga),k={max:0,periods:[],firstTime:0,lastTime:0},x=()=>{const{max:e}=k,t=+u.value,n=+h.value,a=t/e,r=1-n/e;l.style.setProperty("--left","".concat((100*a).toFixed(3),"%")),l.style.setProperty("--right","".concat((100*r).toFixed(3),"%")),l.style.setProperty("--min-text",'"'.concat(ce(t),'"')),l.style.setProperty("--max-text",'"'.concat(ce(n),'"'))},T=()=>{const e=t.harbor.getPeriodList(),n=e[0].time.getTime(),a=e[e.length-1].time.getTime(),r=Math.floor((a-n)/1e3),s=r.toString();u.max=s,u.value="0",h.max=s,h.value=s,k.max=r,k.periods=e,k.firstTime=n,k.lastTime=a,x()},I=()=>{const{firstTime:e}=k;return{startTime:e+1e3*+u.value,endTime:e+1e3*+h.value,remark:p.value}};d.addEventListener("click",(()=>{T(),a.message(Yn.t("refreshed"))})),u.addEventListener("input",(function(){const e=+h.value,t=+this.value;if(t>e-1)return void(u.value=String(e-1));(e-t)/k.max<=Sa(k.max)?l.dataset.maxTextPosition="bottom":l.dataset.maxTextPosition="top",l.dataset.minTextPosition="top",x()})),h.addEventListener("input",(function(){const e=+u.value,t=+this.value;if(t<e+1)return void(h.value=String(e+1));(t-e)/k.max<=Sa(k.max)?l.dataset.minTextPosition="bottom":l.dataset.minTextPosition="top",l.dataset.maxTextPosition="top",x()})),y.addEventListener("click",(()=>{const{url:e}=y.dataset,t=oa(e);a.message(t?Yn.t("copied"):Yn.t("copyFailed")),n.close()})),m.addEventListener("click",(async()=>{try{m.disabled=!0;const e=await t.onOfflineLog("upload-periods",I());y.dataset.url=e,n.show({content:v,footer:[y]})}catch(e){g.error(e),a.message(e.message)}finally{m.disabled=!1}})),f.addEventListener("click",(async()=>{try{f.disabled=!0,await t.onOfflineLog("download-periods",I()),a.message(Yn.t("success"))}catch(e){g.error(e),a.message(e.message)}finally{f.disabled=!1}}));let C=null;const S=()=>{const{isPaused:e,startTimestamp:n}=t;if(e)_.classList.add(ua);else if(_.classList.remove(ua),n&&b){const e=parseInt(String((Date.now()-n)/1e3),10);b.innerHTML=ce(e).split("").map((e=>'<span class="'.concat(":"===e?pa:"duration-item",'">').concat(e,"</span>"))).join("")}};_.addEventListener("click",(()=>{t.isPaused?t.resume():t.pause(),S()})),w.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault()})),null==o||o.addEventListener("click",(()=>{var e;null!==(e=t.$pageSpyConfig)&&void 0!==e&&e.api?m.disabled=!1:m.disabled=!0,C&&clearInterval(C),S(),C=setInterval(S,1e3),T(),n.show({content:c,footer:[m,f]})})),n.build({footer:[...n.config.footer,o]})},Ea={maximum:ta,caredData:{console:!0,network:!0,storage:!0,system:!0,"rrweb-event":!0},filename:()=>(new Date).toLocaleString(),onDownload:null,onAfterUpload:null};class Pa{constructor(e){t(this,"enforce","pre"),t(this,"name","DataHarborPlugin"),t(this,"apiBase",""),t(this,"isPaused",!1),t(this,"startTimestamp",0),t(this,"periodTimer",null),t(this,"$socketStore",null),t(this,"$pageSpyConfig",null),this.$harborConfig={...Ea,...e},this.harbor=new na({maximum:this.$harborConfig.maximum})}async onInit(e){let{socketStore:t,config:n}=e;if(Pa.hasInited)return;Pa.hasInited=!0,this.$pageSpyConfig=n,this.$socketStore=t;const{api:a,enableSSL:r,offline:s,lang:i}=n;if(i&&Yn.setLang(i),s||a){const e=r?"https://":"http://";this.apiBase=v("".concat(e).concat(a))}else g.warn("Cannot upload log to PageSpy for miss 'api' configuration. See: ",n);this.initPeriodTimer(),this.$socketStore.addListener("public-data",(e=>{if(this.isPaused||!this.isCaredPublicData(e))return;const t=((e,t)=>(sessionStorage.getItem("harbor-debug")&&g.unproxy.debug("harbor-debug",t),{type:e,timestamp:Date.now(),data:ie(t)}))(e.type,e.data);this.startTimestamp||(this.startTimestamp=t.timestamp);this.harbor.add(t)||g.warn("[".concat(this.name,"] Fail to save data in harbor "),t)}))}initPeriodTimer(){this.periodTimer&&clearInterval(this.periodTimer),this.periodTimer=setInterval((()=>{var e;this.harbor.add(ea),null===(e=this.$socketStore)||void 0===e||e.dispatchEvent("harbor-clear",null)}),3e5)}onMounted(e){var t;let{modal:n,toast:a,root:r}=e;Pa.hasMounted||(Pa.hasMounted=!0,null===(t=window.dataHarborStyles)||void 0===t||t.forEach((e=>{r.appendChild(e.cloneNode(!0))})),n&&a&&Oa({plugin:this,modal:n,toast:a}))}async getParams(e,t){var n;let a;if(["download-periods","upload-periods"].includes(e)){if(!(e=>!!e&&["startTime","endTime"].every((t=>Object.prototype.hasOwnProperty.call(e,t))))(t)||t.startTime>t.endTime)throw new Error(Yn.t("invalidParams"));if(a=await this.harbor.getPeriodData(t),!a.length)throw new Error(Yn.t("noData"));const e=t.startTime,n=a[0].timestamp,r=e<n?n:e,s=a.filter((e=>e.timestamp>=r&&e.timestamp<=t.endTime)).length;if(s<5)throw new Error(Yn.t("eventCountNotEnough"));a.push({type:"meta",timestamp:t.endTime,data:ie({ua:navigator.userAgent,title:document.title,url:window.location.href,...t,startTime:r})})}else{var r;if(a=await this.harbor.getAll(),!a.length)throw new Error(Yn.t("noData"));const e=a[0].timestamp,n=a[a.length-1].timestamp;a.push({type:"meta",timestamp:n,data:ie({ua:navigator.userAgent,title:document.title,url:window.location.href,startTime:e,endTime:n,remark:null!==(r=null==t?void 0:t.remark)&&void 0!==r?r:""})})}const{onDownload:s,filename:i}=this.$harborConfig;if("download"===e||"download-periods"===e)return{data:a,filename:i,customDownload:s};const{project:o="",title:c=""}=this.$pageSpyConfig||{},d={project:o,title:c,deviceId:re(),userAgent:navigator.userAgent,remark:null!==(n=null==t?void 0:t.remark)&&void 0!==n?n:""};if("upload"===e||"upload-periods"===e){const e=((e,t)=>{const n=new Blob([JSON.stringify(e)],{type:"application/json"});return new File([n],"".concat(se(t),".json"),{type:"application/json"})})(a,i()),t=new FormData;return t.append("log",e),{url:"".concat(this.apiBase,"/api/v1/log/upload?").concat(new URLSearchParams(d).toString()),body:t}}}async onOfflineLog(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{clearCache:!0,remark:""};const n=await this.getParams(e,t),a=["upload","upload-periods"].includes(e)?await(async e=>{let{url:t,body:n}=e;try{const e=await fetch(t,{method:"POST",body:n});if(!e.ok)return g.warn("Upload failed"),null;const a=await e.json();return a.success?a:(g.warn(a.message),null)}catch(e){return g.error(e.message),null}})(n):await(async e=>{let{data:t,filename:n,customDownload:a}=e;if(a)return void await a(t);const r=new Blob([JSON.stringify(t)],{type:"application/json"}),s=document.getElementsByTagName("body")[0]||document.documentElement;if(!s)throw new Error("Download file failed because cannot find the document.body & document.documentElement");const i=URL.createObjectURL(r),o=document.createElement("a");o.download="".concat(se(n()),".json"),o.href=i,o.style.display="none",s.insertAdjacentElement("beforeend",o),o.click(),s.removeChild(o),URL.revokeObjectURL(i),g.info("".concat(Yn.t("success")))})(n);if(!0===t.clearCache&&this.clearAndNotify(),a){var r,s;const e=this.getDebugUrl(a);return null===(r=(s=this.$harborConfig).onAfterUpload)||void 0===r||r.call(s,e,n.remark),e}}async upload(e){return await this.onOfflineLog("upload",e)}async uploadPeriods(e){return await this.onOfflineLog("upload-periods",e)}async download(e){await this.onOfflineLog("download",e)}async downloadPeriods(e){await this.onOfflineLog("download-periods",e)}onReset(){this.periodTimer&&(clearInterval(this.periodTimer),this.periodTimer=null),this.clearAndNotify(!1),Pa.hasInited=!1,Pa.hasMounted=!1}pause(){this.isPaused=!0}resume(){this.isPaused=!1}reharbor(){this.initPeriodTimer(),this.clearAndNotify(),this.isPaused&&(this.isPaused=!1)}clearAndNotify(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t;(this.harbor.clear(),this.startTimestamp=0,e)&&(null===(t=this.$socketStore)||void 0===t||t.dispatchEvent("harbor-clear",null))}isCaredPublicData(e){if(!e)return!1;const{type:t}=e,{caredData:n}=this.$harborConfig;switch(t){case"console":case"storage":case"system":case"rrweb-event":return n[t];case"network":const{url:a}=e.data,r=this.harbor.stock.includes(a);return!(!n.network||r);default:return!1}}getDebugUrl(e){var t;if(!e||!e.success)return"";const n="".concat(v(null===(t=this.$pageSpyConfig)||void 0===t?void 0:t.clientOrigin),"/#/replay"),a="".concat(this.apiBase,"/api/v1/log/download?fileId=").concat(e.data.fileId);return"".concat(n,"?url=").concat(a)}}t(Pa,"hasInited",!1),t(Pa,"hasMounted",!1);export{Pa as default};
//# sourceMappingURL=index.min.js.map