ripplo 0.7.15 → 0.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,268 +0,0 @@
1
- #!/usr/bin/env node
2
- var sR=Object.create;var np=Object.defineProperty;var aR=Object.getOwnPropertyDescriptor;var lR=Object.getOwnPropertyNames;var uR=Object.getPrototypeOf,cR=Object.prototype.hasOwnProperty;var In=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var dR=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lR(t))!cR.call(e,i)&&i!==n&&np(e,i,{get:()=>t[i],enumerable:!(r=aR(t,i))||r.enumerable});return e};var Di=(e,t,n)=>(n=e!=null?sR(uR(e)):{},dR(t||!e||!e.__esModule?np(n,"default",{value:e,enumerable:!0}):n,e));var cp=In(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.timingSafeEqual=void 0;function up(e,t=""){if(!e)throw new Error(t)}function GR(e,t){if(e.byteLength!==t.byteLength)return!1;e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),t instanceof DataView||(t=new DataView(ArrayBuffer.isView(t)?t.buffer:t)),up(e instanceof DataView),up(t instanceof DataView);let n=e.byteLength,r=0,i=-1;for(;++i<n;)r|=e.getUint8(i)^t.getUint8(i);return r===0}Fi.timingSafeEqual=GR});var pp=In(He=>{"use strict";var HR=He&&He.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(He,"__esModule",{value:!0});var Ee=256,Ea=(function(){function e(t){t===void 0&&(t="="),this._paddingCharacter=t}return e.prototype.encodedLength=function(t){return this._paddingCharacter?(t+2)/3*4|0:(t*8+5)/6|0},e.prototype.encode=function(t){for(var n="",r=0;r<t.length-2;r+=3){var i=t[r]<<16|t[r+1]<<8|t[r+2];n+=this._encodeByte(i>>>18&63),n+=this._encodeByte(i>>>12&63),n+=this._encodeByte(i>>>6&63),n+=this._encodeByte(i>>>0&63)}var o=t.length-r;if(o>0){var i=t[r]<<16|(o===2?t[r+1]<<8:0);n+=this._encodeByte(i>>>18&63),n+=this._encodeByte(i>>>12&63),o===2?n+=this._encodeByte(i>>>6&63):n+=this._paddingCharacter||"",n+=this._paddingCharacter||""}return n},e.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(t*6+7)/8|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);for(var n=this._getPaddingLength(t),r=t.length-n,i=new Uint8Array(this.maxDecodedLength(r)),o=0,s=0,a=0,l=0,u=0,c=0,d=0;s<r-4;s+=4)l=this._decodeChar(t.charCodeAt(s+0)),u=this._decodeChar(t.charCodeAt(s+1)),c=this._decodeChar(t.charCodeAt(s+2)),d=this._decodeChar(t.charCodeAt(s+3)),i[o++]=l<<2|u>>>4,i[o++]=u<<4|c>>>2,i[o++]=c<<6|d,a|=l&Ee,a|=u&Ee,a|=c&Ee,a|=d&Ee;if(s<r-1&&(l=this._decodeChar(t.charCodeAt(s)),u=this._decodeChar(t.charCodeAt(s+1)),i[o++]=l<<2|u>>>4,a|=l&Ee,a|=u&Ee),s<r-2&&(c=this._decodeChar(t.charCodeAt(s+2)),i[o++]=u<<4|c>>>2,a|=c&Ee),s<r-3&&(d=this._decodeChar(t.charCodeAt(s+3)),i[o++]=c<<6|d,a|=d&Ee),a!==0)throw new Error("Base64Coder: incorrect characters for decoding");return i},e.prototype._encodeByte=function(t){var n=t;return n+=65,n+=25-t>>>8&6,n+=51-t>>>8&-75,n+=61-t>>>8&-15,n+=62-t>>>8&3,String.fromCharCode(n)},e.prototype._decodeChar=function(t){var n=Ee;return n+=(42-t&t-44)>>>8&-Ee+t-43+62,n+=(46-t&t-48)>>>8&-Ee+t-47+63,n+=(47-t&t-58)>>>8&-Ee+t-48+52,n+=(64-t&t-91)>>>8&-Ee+t-65+0,n+=(96-t&t-123)>>>8&-Ee+t-97+26,n},e.prototype._getPaddingLength=function(t){var n=0;if(this._paddingCharacter){for(var r=t.length-1;r>=0&&t[r]===this._paddingCharacter;r--)n++;if(t.length<4||n>2)throw new Error("Base64Coder: incorrect padding")}return n},e})();He.Coder=Ea;var Rr=new Ea;function qR(e){return Rr.encode(e)}He.encode=qR;function KR(e){return Rr.decode(e)}He.decode=KR;var dp=(function(e){HR(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(n){var r=n;return r+=65,r+=25-n>>>8&6,r+=51-n>>>8&-75,r+=61-n>>>8&-13,r+=62-n>>>8&49,String.fromCharCode(r)},t.prototype._decodeChar=function(n){var r=Ee;return r+=(44-n&n-46)>>>8&-Ee+n-45+62,r+=(94-n&n-96)>>>8&-Ee+n-95+63,r+=(47-n&n-58)>>>8&-Ee+n-48+52,r+=(64-n&n-91)>>>8&-Ee+n-65+0,r+=(96-n&n-123)>>>8&-Ee+n-97+26,r},t})(Ea);He.URLSafeCoder=dp;var fp=new dp;function YR(e){return fp.encode(e)}He.encodeURLSafe=YR;function JR(e){return fp.decode(e)}He.decodeURLSafe=JR;He.encodedLength=function(e){return Rr.encodedLength(e)};He.maxDecodedLength=function(e){return Rr.maxDecodedLength(e)};He.decodedLength=function(e){return Rr.decodedLength(e)}});var mp=In((hp,Bi)=>{"use strict";(function(e,t){var n={};t(n);var r=n.default;for(var i in n)r[i]=n[i];typeof Bi=="object"&&typeof Bi.exports=="object"?Bi.exports=r:typeof define=="function"&&define.amd?define(function(){return r}):e.sha256=r})(hp,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(d,f,h,p,m){for(var y,S,w,g,v,A,N,T,M,I,B,J,X;m>=64;){for(y=f[0],S=f[1],w=f[2],g=f[3],v=f[4],A=f[5],N=f[6],T=f[7],I=0;I<16;I++)B=p+I*4,d[I]=(h[B]&255)<<24|(h[B+1]&255)<<16|(h[B+2]&255)<<8|h[B+3]&255;for(I=16;I<64;I++)M=d[I-2],J=(M>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,M=d[I-15],X=(M>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,d[I]=(J+d[I-7]|0)+(X+d[I-16]|0);for(I=0;I<64;I++)J=(((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&A^~v&N)|0)+(T+(t[I]+d[I]|0)|0)|0,X=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&S^y&w^S&w)|0,T=N,N=A,A=v,v=g+J|0,g=w,w=S,S=y,y=J+X|0;f[0]+=y,f[1]+=S,f[2]+=w,f[3]+=g,f[4]+=v,f[5]+=A,f[6]+=N,f[7]+=T,p+=64,m-=64}return p}var r=(function(){function d(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return d.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},d.prototype.clean=function(){for(var f=0;f<this.buffer.length;f++)this.buffer[f]=0;for(var f=0;f<this.temp.length;f++)this.temp[f]=0;this.reset()},d.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var p=0;if(this.bytesHashed+=h,this.bufferLength>0){for(;this.bufferLength<64&&h>0;)this.buffer[this.bufferLength++]=f[p++],h--;this.bufferLength===64&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(h>=64&&(p=n(this.temp,this.state,f,p,h),h%=64);h>0;)this.buffer[this.bufferLength++]=f[p++],h--;return this},d.prototype.finish=function(f){if(!this.finished){var h=this.bytesHashed,p=this.bufferLength,m=h/536870912|0,y=h<<3,S=h%64<56?64:128;this.buffer[p]=128;for(var w=p+1;w<S-8;w++)this.buffer[w]=0;this.buffer[S-8]=m>>>24&255,this.buffer[S-7]=m>>>16&255,this.buffer[S-6]=m>>>8&255,this.buffer[S-5]=m>>>0&255,this.buffer[S-4]=y>>>24&255,this.buffer[S-3]=y>>>16&255,this.buffer[S-2]=y>>>8&255,this.buffer[S-1]=y>>>0&255,n(this.temp,this.state,this.buffer,0,S),this.finished=!0}for(var w=0;w<8;w++)f[w*4+0]=this.state[w]>>>24&255,f[w*4+1]=this.state[w]>>>16&255,f[w*4+2]=this.state[w]>>>8&255,f[w*4+3]=this.state[w]>>>0&255;return this},d.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},d.prototype._saveState=function(f){for(var h=0;h<this.state.length;h++)f[h]=this.state[h]},d.prototype._restoreState=function(f,h){for(var p=0;p<this.state.length;p++)this.state[p]=f[p];this.bytesHashed=h,this.finished=!1,this.bufferLength=0},d})();e.Hash=r;var i=(function(){function d(f){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var h=new Uint8Array(this.blockSize);if(f.length>this.blockSize)new r().update(f).finish(h).clean();else for(var p=0;p<f.length;p++)h[p]=f[p];for(var p=0;p<h.length;p++)h[p]^=54;this.inner.update(h);for(var p=0;p<h.length;p++)h[p]^=106;this.outer.update(h),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var p=0;p<h.length;p++)h[p]=0}return d.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},d.prototype.clean=function(){for(var f=0;f<this.istate.length;f++)this.ostate[f]=this.istate[f]=0;this.inner.clean(),this.outer.clean()},d.prototype.update=function(f){return this.inner.update(f),this},d.prototype.finish=function(f){return this.outer.finished?this.outer.finish(f):(this.inner.finish(f),this.outer.update(f,this.digestLength).finish(f)),this},d.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},d})();e.HMAC=i;function o(d){var f=new r().update(d),h=f.digest();return f.clean(),h}e.hash=o,e.default=o;function s(d,f){var h=new i(d).update(f),p=h.digest();return h.clean(),p}e.hmac=s;function a(d,f,h,p){var m=p[0];if(m===0)throw new Error("hkdf: cannot expand more");f.reset(),m>1&&f.update(d),h&&f.update(h),f.update(p),f.finish(d),p[0]++}var l=new Uint8Array(e.digestLength);function u(d,f,h,p){f===void 0&&(f=l),p===void 0&&(p=32);for(var m=new Uint8Array([1]),y=s(f,d),S=new i(y),w=new Uint8Array(S.digestLength),g=w.length,v=new Uint8Array(p),A=0;A<p;A++)g===w.length&&(a(w,S,h,m),g=0),v[A]=w[g++];return S.clean(),w.fill(0),m.fill(0),v}e.hkdf=u;function c(d,f,h,p){for(var m=new i(d),y=m.digestLength,S=new Uint8Array(4),w=new Uint8Array(y),g=new Uint8Array(y),v=new Uint8Array(p),A=0;A*y<p;A++){var N=A+1;S[0]=N>>>24&255,S[1]=N>>>16&255,S[2]=N>>>8&255,S[3]=N>>>0&255,m.reset(),m.update(f),m.update(S),m.finish(g);for(var T=0;T<y;T++)w[T]=g[T];for(var T=2;T<=h;T++){m.reset(),m.update(g).finish(g);for(var M=0;M<y;M++)w[M]^=g[M]}for(var T=0;T<y&&A*y+T<p;T++)v[A*y+T]=w[T]}for(var A=0;A<y;A++)w[A]=g[A]=0;for(var A=0;A<4;A++)S[A]=0;return m.clean(),v}e.pbkdf2=c})});var Ia=In(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.Webhook=Tn.WebhookVerificationError=void 0;var XR=cp(),yp=pp(),ZR=mp(),gp=300,Aa=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},Gt=class e extends Aa{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Tn.WebhookVerificationError=Gt;var Vi=class e{constructor(t,n){if(!t)throw new Error("Secret can't be empty.");if(n?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,r=>r.charCodeAt(0));else{if(typeof t!="string")throw new Error("Expected secret to be of type string");t.startsWith(e.prefix)&&(t=t.substring(e.prefix.length)),this.key=yp.decode(t)}}verify(t,n){let r={};for(let f of Object.keys(n))r[f.toLowerCase()]=n[f];let i=r["webhook-id"],o=r["webhook-signature"],s=r["webhook-timestamp"];if(!o||!i||!s)throw new Gt("Missing required headers");let a=this.verifyTimestamp(s),u=this.sign(i,a,t).split(",")[1],c=o.split(" "),d=new globalThis.TextEncoder;for(let f of c){let[h,p]=f.split(",");if(h==="v1"&&(0,XR.timingSafeEqual)(d.encode(p),d.encode(u)))return JSON.parse(t.toString())}throw new Gt("No matching signature found")}sign(t,n,r){if(typeof r!="string")if(r.constructor.name==="Buffer")r=r.toString();else throw new Error("Expected payload to be of type string or Buffer.");let i=new TextEncoder,o=Math.floor(n.getTime()/1e3),s=i.encode(`${t}.${o}.${r}`);return`v1,${yp.encode(ZR.hmac(this.key,s))}`}verifyTimestamp(t){let n=Math.floor(Date.now()/1e3),r=parseInt(t,10);if(isNaN(r))throw new Gt("Invalid Signature Headers");if(n-r>gp)throw new Gt("Message timestamp too old");if(r>n+gp)throw new Gt("Message timestamp too new");return new Date(r*1e3)}};Tn.Webhook=Vi;Vi.prefix="whsec_"});var Oh=In((xl,Mh)=>{"use strict";var{hasOwnProperty:Nr}=Object.prototype,fn=wl();fn.configure=wl;fn.stringify=fn;fn.default=fn;xl.stringify=fn;xl.configure=wl;Mh.exports=fn;var GC=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Ht(e){return e.length<5e3&&!GC.test(e)?`"${e}"`:JSON.stringify(e)}function bl(e,t){if(e.length>200||t)return e.sort(t);for(let n=1;n<e.length;n++){let r=e[n],i=n;for(;i!==0&&e[i-1]>r;)e[i]=e[i-1],i--;e[i]=r}return e}var HC=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Sl(e){return HC.call(e)!==void 0&&e.length!==0}function Ph(e,t,n){e.length<n&&(n=e.length);let r=t===","?"":" ",i=`"0":${r}${e[0]}`;for(let o=1;o<n;o++)i+=`${t}"${o}":${r}${e[o]}`;return i}function qC(e){if(Nr.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="string")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function KC(e){let t;if(Nr.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boolean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return t===void 0?!0:t}function YC(e,t){let n;if(Nr.call(e,t)&&(n=e[t],typeof n!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return n===void 0?!0:n}function Th(e,t){let n;if(Nr.call(e,t)){if(n=e[t],typeof n!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(n))throw new TypeError(`The "${t}" argument must be an integer`);if(n<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return n===void 0?1/0:n}function dn(e){return e===1?"1 item":`${e} items`}function JC(e){let t=new Set;for(let n of e)(typeof n=="string"||typeof n=="number")&&t.add(String(n));return t}function XC(e){if(Nr.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return n=>{let r=`Object can not safely be stringified. Received type ${typeof n}`;throw typeof n!="function"&&(r+=` (${n.toString()})`),new Error(r)}}}function wl(e){e={...e};let t=XC(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let n=qC(e),r=YC(e,"bigint"),i=KC(e),o=typeof i=="function"?i:void 0,s=Th(e,"maximumDepth"),a=Th(e,"maximumBreadth");function l(h,p,m,y,S,w){let g=p[h];switch(typeof g=="object"&&g!==null&&typeof g.toJSON=="function"&&(g=g.toJSON(h)),g=y.call(p,h,g),typeof g){case"string":return Ht(g);case"object":{if(g===null)return"null";if(m.indexOf(g)!==-1)return n;let v="",A=",",N=w;if(Array.isArray(g)){if(g.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(g),S!==""&&(w+=S,v+=`
3
- ${w}`,A=`,
4
- ${w}`);let X=Math.min(g.length,a),j=0;for(;j<X-1;j++){let mt=l(String(j),g,m,y,S,w);v+=mt!==void 0?mt:"null",v+=A}let Ne=l(String(j),g,m,y,S,w);if(v+=Ne!==void 0?Ne:"null",g.length-1>a){let mt=g.length-a-1;v+=`${A}"... ${dn(mt)} not stringified"`}return S!==""&&(v+=`
5
- ${N}`),m.pop(),`[${v}]`}let T=Object.keys(g),M=T.length;if(M===0)return"{}";if(s<m.length+1)return'"[Object]"';let I="",B="";S!==""&&(w+=S,A=`,
6
- ${w}`,I=" ");let J=Math.min(M,a);i&&!Sl(g)&&(T=bl(T,o)),m.push(g);for(let X=0;X<J;X++){let j=T[X],Ne=l(j,g,m,y,S,w);Ne!==void 0&&(v+=`${B}${Ht(j)}:${I}${Ne}`,B=A)}if(M>a){let X=M-a;v+=`${B}"...":${I}"${dn(X)} not stringified"`,B=A}return S!==""&&B.length>1&&(v=`
7
- ${w}${v}
8
- ${N}`),m.pop(),`{${v}}`}case"number":return isFinite(g)?String(g):t?t(g):"null";case"boolean":return g===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(g);default:return t?t(g):void 0}}function u(h,p,m,y,S,w){switch(typeof p=="object"&&p!==null&&typeof p.toJSON=="function"&&(p=p.toJSON(h)),typeof p){case"string":return Ht(p);case"object":{if(p===null)return"null";if(m.indexOf(p)!==-1)return n;let g=w,v="",A=",";if(Array.isArray(p)){if(p.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(p),S!==""&&(w+=S,v+=`
9
- ${w}`,A=`,
10
- ${w}`);let M=Math.min(p.length,a),I=0;for(;I<M-1;I++){let J=u(String(I),p[I],m,y,S,w);v+=J!==void 0?J:"null",v+=A}let B=u(String(I),p[I],m,y,S,w);if(v+=B!==void 0?B:"null",p.length-1>a){let J=p.length-a-1;v+=`${A}"... ${dn(J)} not stringified"`}return S!==""&&(v+=`
11
- ${g}`),m.pop(),`[${v}]`}m.push(p);let N="";S!==""&&(w+=S,A=`,
12
- ${w}`,N=" ");let T="";for(let M of y){let I=u(M,p[M],m,y,S,w);I!==void 0&&(v+=`${T}${Ht(M)}:${N}${I}`,T=A)}return S!==""&&T.length>1&&(v=`
13
- ${w}${v}
14
- ${g}`),m.pop(),`{${v}}`}case"number":return isFinite(p)?String(p):t?t(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(p);default:return t?t(p):void 0}}function c(h,p,m,y,S){switch(typeof p){case"string":return Ht(p);case"object":{if(p===null)return"null";if(typeof p.toJSON=="function"){if(p=p.toJSON(h),typeof p!="object")return c(h,p,m,y,S);if(p===null)return"null"}if(m.indexOf(p)!==-1)return n;let w=S;if(Array.isArray(p)){if(p.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(p),S+=y;let I=`
15
- ${S}`,B=`,
16
- ${S}`,J=Math.min(p.length,a),X=0;for(;X<J-1;X++){let Ne=c(String(X),p[X],m,y,S);I+=Ne!==void 0?Ne:"null",I+=B}let j=c(String(X),p[X],m,y,S);if(I+=j!==void 0?j:"null",p.length-1>a){let Ne=p.length-a-1;I+=`${B}"... ${dn(Ne)} not stringified"`}return I+=`
17
- ${w}`,m.pop(),`[${I}]`}let g=Object.keys(p),v=g.length;if(v===0)return"{}";if(s<m.length+1)return'"[Object]"';S+=y;let A=`,
18
- ${S}`,N="",T="",M=Math.min(v,a);Sl(p)&&(N+=Ph(p,A,a),g=g.slice(p.length),M-=p.length,T=A),i&&(g=bl(g,o)),m.push(p);for(let I=0;I<M;I++){let B=g[I],J=c(B,p[B],m,y,S);J!==void 0&&(N+=`${T}${Ht(B)}: ${J}`,T=A)}if(v>a){let I=v-a;N+=`${T}"...": "${dn(I)} not stringified"`,T=A}return T!==""&&(N=`
19
- ${S}${N}
20
- ${w}`),m.pop(),`{${N}}`}case"number":return isFinite(p)?String(p):t?t(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(p);default:return t?t(p):void 0}}function d(h,p,m){switch(typeof p){case"string":return Ht(p);case"object":{if(p===null)return"null";if(typeof p.toJSON=="function"){if(p=p.toJSON(h),typeof p!="object")return d(h,p,m);if(p===null)return"null"}if(m.indexOf(p)!==-1)return n;let y="",S=p.length!==void 0;if(S&&Array.isArray(p)){if(p.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(p);let N=Math.min(p.length,a),T=0;for(;T<N-1;T++){let I=d(String(T),p[T],m);y+=I!==void 0?I:"null",y+=","}let M=d(String(T),p[T],m);if(y+=M!==void 0?M:"null",p.length-1>a){let I=p.length-a-1;y+=`,"... ${dn(I)} not stringified"`}return m.pop(),`[${y}]`}let w=Object.keys(p),g=w.length;if(g===0)return"{}";if(s<m.length+1)return'"[Object]"';let v="",A=Math.min(g,a);S&&Sl(p)&&(y+=Ph(p,",",a),w=w.slice(p.length),A-=p.length,v=","),i&&(w=bl(w,o)),m.push(p);for(let N=0;N<A;N++){let T=w[N],M=d(T,p[T],m);M!==void 0&&(y+=`${v}${Ht(T)}:${M}`,v=",")}if(g>a){let N=g-a;y+=`${v}"...":"${dn(N)} not stringified"`}return m.pop(),`{${y}}`}case"number":return isFinite(p)?String(p):t?t(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(p);default:return t?t(p):void 0}}function f(h,p,m){if(arguments.length>1){let y="";if(typeof m=="number"?y=" ".repeat(Math.min(m,10)):typeof m=="string"&&(y=m.slice(0,10)),p!=null){if(typeof p=="function")return l("",{"":h},[],p,y,"");if(Array.isArray(p))return u("",h,[],JC(p),y,"")}if(y.length!==0)return c("",h,[],y,"")}return d("",h,[])}return f}});var oy=In((pH,du)=>{"use strict";var Oo=process||{},ry=Oo.argv||[],Mo=Oo.env||{},_P=!(Mo.NO_COLOR||ry.includes("--no-color"))&&(!!Mo.FORCE_COLOR||ry.includes("--color")||Oo.platform==="win32"||(Oo.stdout||{}).isTTY&&Mo.TERM!=="dumb"||!!Mo.CI),DP=(e,t,n=e)=>r=>{let i=""+r,o=i.indexOf(t,e.length);return~o?e+jP(i,t,n,o)+t:e+i+t},jP=(e,t,n,r)=>{let i="",o=0;do i+=e.substring(o,r)+n,o=r+t.length,r=e.indexOf(t,o);while(~r);return i+e.substring(o)},iy=(e=_P)=>{let t=e?DP:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};du.exports=iy();du.exports.createColors=iy});import{execFileSync as fR}from"child_process";import pR from"fs";import ji from"path";function hR(e){let t=yR(e);return t??rp(e)}function rp(e){let t=ji.dirname(e);return mR(ji.join(e,".ripplo"))?e:t===e?null:rp(t)}function mR(e){try{return pR.statSync(e).isDirectory()}catch{return!1}}function yR(e){let t=gR(["rev-parse","--show-toplevel"],e);if(t==null)return null;let n=t.trim();return n.length===0?null:ji.isAbsolute(n)?n:ji.resolve(e,n)}function gR(e,t){try{return fR("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}import bR from"pino";import SR from"pino-pretty";var be=bR({level:process.env.LOG_LEVEL??"info"},SR({ignore:"pid,hostname"}));import{readdir as wR,rm as xR,stat as vR}from"fs/promises";import sp from"path";var ip=sp.join(process.cwd(),".ripplo","debug"),op=360*60*1e3;async function RR({maxRuns:e}){try{let n=(await wR(ip,{withFileTypes:!0})).filter(u=>u.isDirectory()),r=Date.now(),i=await Promise.all(n.map(async u=>{let c=sp.join(ip,u.name),d=await vR(c);return{dirPath:c,mtime:d.mtimeMs}})),o=i.filter(u=>r-u.mtime>op),a=i.filter(u=>r-u.mtime<=op).toSorted((u,c)=>c.mtime-u.mtime).slice(e),l=[...o,...a];if(l.length===0)return;await Promise.allSettled(l.map(u=>xR(u.dirPath,{force:!0,recursive:!0}))),be.debug("Pruned %d old debug run(s)",l.length)}catch{be.warn("Debug run pruning failed, ignoring")}}var Pn=class extends Error{detail;serverUrl;constructor({detail:t,serverUrl:n}){super(`Failed to connect to Ripplo server at ${n}. Check the server is running and reachable. Details: ${t}`),this.name="GqlConnectionError",this.detail=t,this.serverUrl=n}},Sr=class extends Error{errors;constructor(t){super(t.map(n=>n.message).join(", ")),this.name="GqlRequestError",this.errors=t}};function kR(e){if(e instanceof Sr)return e.errors[0]?.extensions?.code}async function Le(e){let{print:t}=await import("graphql"),n=t(e.document),r=JSON.stringify({query:n,variables:e.variables}),i=`${e.config.ripploServerUrl}/graphql`,o=await CR({init:{body:r,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST"},serverUrl:e.config.ripploServerUrl,url:i}),s=await IR({res:o,url:i});if(!PR(s))throw new Error("Invalid GraphQL response");if(TR(s))throw new Sr(s.errors);if(s.data==null)throw new Error("No data returned from server");return s.data}async function CR({init:e,serverUrl:t,url:n}){let r=1,i=await ap({init:e,url:n});for(;i.retryable&&r<3;)await AR(ER(r)),r+=1,i=await ap({init:e,url:n});if(i.response!=null)return i.response;throw new Pn({detail:i.detail,serverUrl:t})}async function ap({init:e,url:t}){try{let n=await fetch(t,{...e,signal:AbortSignal.timeout(15e3)});return{detail:"",response:n,retryable:n.status>=500}}catch(n){return{detail:n instanceof Error?n.message:String(n),response:void 0,retryable:!0}}}function ER(e){return 300*3**(e-1)*(.5+Math.random())}function AR(e){return new Promise(t=>{setTimeout(t,e)})}async function IR({res:e,url:t}){let n=await e.text();if(n.length===0)throw new Error(`Empty response from Ripplo server at ${t} (status ${String(e.status)}). The server may have restarted or the request was rejected before a body was sent.`);try{return JSON.parse(n)}catch{throw new Error(`Non-JSON response from Ripplo server at ${t} (status ${String(e.status)}): ${n.slice(0,200)}`)}}function PR(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function TR(e){return Array.isArray(e.errors)&&e.errors.length>0}import{Agent as MR,RetryAgent as OR,setGlobalDispatcher as NR}from"undici";var LR=1500,$R=4e3,_R=3,DR=50,jR=100,lp=!1;function FR(){if(lp)return;lp=!0;let e=new MR({connections:jR,keepAliveMaxTimeout:$R,keepAliveTimeout:LR}),t=new OR(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:_R,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:DR});NR(t)}import vr from"fs";import ln from"fs";import BR from"os";import wr from"path";var VR=".local",UR=".ripplo";function va(e){return wr.join(e,".ripplo",VR)}function Ra(e){let t=va(e);ln.existsSync(t)||ln.mkdirSync(t,{recursive:!0});let n=wr.join(t,".gitignore");return ln.existsSync(n)||ln.writeFileSync(n,`*
21
- `),t}function zt(e,t){return wr.join(va(e),t)}function ka(){return wr.join(BR.homedir(),UR)}function xr(){let e=ka();return ln.existsSync(e)?ln.chmodSync(e,448):ln.mkdirSync(e,{mode:448,recursive:!0}),e}function un(e){return wr.join(ka(),e)}function Ca(){let e=process.env.RIPPLO_TOKEN;if(e!=null&&e.trim().length>0)return e.trim();let t=un("token");if(!vr.existsSync(t))return null;let n=vr.readFileSync(t,"utf8").trim();return n.length===0?null:n}function WR(e){xr(),vr.writeFileSync(un("token"),e+`
22
- `,{mode:384})}function zR(){let e=un("token");return vr.existsSync(e)?(vr.unlinkSync(e),!0):!1}var Sp=Di(Ia(),1);import bp from"crypto";function QR({body:e,secret:t}){let n=new Sp.Webhook(t),r=`msg_${bp.randomUUID()}`,i=new Date,o=n.sign(r,i,e),s=Math.floor(i.getTime()/1e3);return{"webhook-id":r,"webhook-signature":o,"webhook-timestamp":String(s)}}function ek(){return`whsec_${bp.randomBytes(24).toString("base64")}`}import vp from"fs";import Hi from"path";import{config as ok}from"dotenv";import{z as zi}from"zod";import{err as sk,ok as Rp}from"neverthrow";import Wi from"fs";import Ma from"path";import{err as Pa,ok as wp}from"neverthrow";import{z as Ui}from"zod";var tk=Ma.join(".ripplo","project.json"),Ta=[".env",".env.local"],nk=Ui.object({envFiles:Ui.array(Ui.string().min(1)).optional(),projectId:Ui.string().min(1)});function xp(e){return Ma.join(e,tk)}function Oa(e){let t=xp(e);return Wi.existsSync(t)?rk(t).andThen(n=>{let r=nk.safeParse(n);return r.success?wp({envFiles:r.data.envFiles??Ta,projectId:r.data.projectId}):Pa({issues:r.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`),kind:"project-file-invalid",path:t})}):Pa({kind:"project-file-missing",path:t})}function Na(e){return Oa(e).match(t=>t,()=>{})}function rk(e){try{return wp(JSON.parse(Wi.readFileSync(e,"utf8")))}catch(t){return Pa({issues:[t instanceof Error?t.message:String(t)],kind:"project-file-invalid",path:e})}}function qV({cwd:e,envFiles:t,projectId:n}){let r=xp(e);Wi.mkdirSync(Ma.dirname(r),{recursive:!0});let i={projectId:n};t!=null&&!ik(t)&&(i.envFiles=[...t]),Wi.writeFileSync(r,JSON.stringify(i,null,2)+`
23
- `)}function ik(e){return e.length!==Ta.length?!1:e.every((t,n)=>t===Ta[n])}function tU(e){let n=Na(e)?.envFiles??[".env",".env.local"],r=Hi.join(e,".ripplo");n.forEach(i=>{let o=Hi.resolve(r,i);vp.existsSync(o)&&ok({override:!0,path:o,quiet:!0})}),Gi=void 0}var ak=zi.object({RIPPLO_APP_URL:zi.url(),RIPPLO_ENGINE_URL:zi.url(),RIPPLO_WEBHOOK_SECRET:zi.string().min(1)}),Gi;function qi(){return Gi!=null?Rp(Gi):uk().map(e=>(Gi=e,e))}function lk(e){let n=Na(e)?.envFiles??[],r=Hi.join(e,".ripplo");return n.map(i=>Hi.resolve(r,i)).filter(i=>!vp.existsSync(i))}function uk(){let e=ak.safeParse(process.env);if(!e.success)return sk({issues:e.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`),kind:"env-invalid",missingEnvFiles:lk(process.cwd())});let t=e.data;return Rp({appUrl:t.RIPPLO_APP_URL,engineUrl:t.RIPPLO_ENGINE_URL,webhookSecret:t.RIPPLO_WEBHOOK_SECRET})}import{readFileSync as ck}from"fs";import{z as kp}from"zod";var dk=kp.object({version:kp.string()});function La(){let e=ck(new URL("../package.json",import.meta.url),"utf8");return dk.parse(JSON.parse(e)).version}import{z as Ki}from"zod";var fk=Ki.object({__codec:Ki.string().min(1),data:Ki.unknown(),version:Ki.number().int().positive()}),Yi=class extends Error{codec;currentVersion;gotVersion;constructor(t){super(`Unsupported ${t.codec} version ${String(t.gotVersion)} (current ${String(t.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=t.codec,this.currentVersion=t.currentVersion,this.gotVersion=t.gotVersion}},Ji=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}};function $a({name:e,schema:t}){return{currentVersion:1,name:e,decode:n=>mk({name:e,raw:n,schema:t}),encode:n=>({__codec:e,data:n,version:1})}}function pk(e,t){return JSON.stringify(e.encode(t))}function hk(e,t){let n=JSON.parse(t);return e.decode(n)}function mk({name:e,raw:t,schema:n}){let r=fk.parse(t);if(r.__codec!==e)throw new Ji({expected:e,got:r.__codec});if(r.version!==1)throw new Yi({codec:e,currentVersion:1,gotVersion:r.version});return n.parse(r.data)}import{z as k}from"zod";import{z as P}from"zod";var _a=P.enum(["fast","slow","async"]),Mn=P.object({ref:P.string().min(1)}),gt=P.union([P.string(),P.number(),P.boolean()]),Da=P.object({template:P.array(P.union([P.string(),Mn])).min(1)}),je=P.union([Mn,gt,Da,P.null()]),Cp=P.object({kind:P.literal("changed")}),ja=P.union([je,Cp]),Ct=P.union([P.string(),Mn,Da]),yk=P.object({by:P.literal("role"),name:P.union([Ct,P.undefined()]).optional().transform(e=>e),role:P.string().min(1)}),gk=P.object({by:P.literal("testId"),value:Ct}),bk=P.object({by:P.literal("inside"),scope:P.lazy(()=>Se),target:P.lazy(()=>Se)}),Se=P.discriminatedUnion("by",[yk,gk,bk]),Xi=P.enum(["string","number","boolean"]),Fa=P.enum(["strict","eventual"]),Sk=P.object({kind:P.literal("string"),maxLength:P.number().int().positive().optional(),minLength:P.number().int().nonnegative().optional(),pattern:P.string().optional()}),wk=P.object({kind:P.literal("number"),max:P.number().int().optional(),min:P.number().int().optional()}),xk=P.object({kind:P.literal("datetime"),maxOffsetDays:P.number().int(),minOffsetDays:P.number().int()}),Ep=P.discriminatedUnion("kind",[Sk,wk,xk]),Ap=P.enum(["company.name","date.iso","internet.email","internet.url","person.fullName","lorem.slug","lorem.word"]),Ba=P.object({constraints:Ep.optional(),generator:Ap,name:P.string().min(1),type:Xi,values:P.array(gt).min(1).optional()}),Ip=P.object({consistency:Fa.default("strict"),optional:P.boolean(),type:Xi,valueSpace:P.string().min(1).optional()}),Va=P.enum(["backend","client"]),Ua=P.object({description:P.string().optional(),identity:P.array(P.string().min(1)).min(1),identityKind:P.enum(["surrogate","natural"]),name:P.string().min(1),props:P.record(P.string().min(1),Ip),source:Va.default("backend")}),Wa=P.object({consistency:Fa.default("strict"),default:gt,description:P.string().optional(),name:P.string().min(1),source:Va.default("backend"),type:Xi,valueSpace:P.string().min(1).optional()}),Et=P.enum(["url","title","viewport"]);import{z as E}from"zod";var vk=E.discriminatedUnion("kind",[E.object({as:E.string().min(1),kind:E.literal("created"),props:E.record(E.string().min(1),je)}),E.object({as:E.string().min(1),kind:E.literal("updated"),props:E.record(E.string().min(1),ja)}),E.object({kind:E.literal("deleted")})]),Rk=E.object({kind:E.literal("is"),value:je}),Pp=E.lazy(()=>E.union([je,Ck])),kk=E.object({entity:E.string().min(1),where:E.record(E.string().min(1),Pp)}),Ck=E.object({field:E.string().min(1),kind:E.literal("within"),selection:kk}),bt=E.union([_a,E.undefined()]).optional().transform(e=>e),Tp=E.object({assertion:Rk,kind:E.literal("singleton"),singleton:E.string().min(1),wait:bt}),Mp=E.object({entity:E.string().min(1),kind:E.literal("count"),value:E.number().int().nonnegative()}),Zi=E.lazy(()=>E.discriminatedUnion("kind",[Tp,Mp,E.object({kind:E.literal("not"),predicate:Zi}),E.object({kind:E.literal("and"),predicates:E.array(Zi)})])),Ek=E.lazy(()=>E.object({condition:E.union([Zi,E.undefined()]).optional().transform(e=>e),consequence:E.array(On),name:E.string().min(1)})),On=E.lazy(()=>E.discriminatedUnion("kind",[E.object({kind:E.literal("visible"),locator:Se,wait:bt}),E.object({kind:E.literal("disabled"),locator:Se,wait:bt}),E.object({kind:E.literal("enabled"),locator:Se,wait:bt}),E.object({kind:E.literal("focused"),locator:Se,wait:bt}),E.object({kind:E.literal("checked"),locator:Se,wait:bt}),E.object({kind:E.literal("value"),locator:Se,value:Ct,wait:bt}),E.object({kind:E.literal("text"),locator:Se,value:Ct,wait:bt}),Tp,E.object({kind:E.literal("browser"),name:Et,value:Ct,wait:bt}),E.object({assertion:vk,entity:E.string().min(1),key:E.record(E.string().min(1),Pp),kind:E.literal("state"),wait:bt}),E.object({kind:E.literal("not"),predicate:On}),E.object({kind:E.literal("and"),predicates:E.array(On)}),Mp,E.object({branches:E.array(Ek),kind:E.literal("when")})]));var Op=k.discriminatedUnion("kind",[k.object({kind:k.literal("goto"),url:Ct}),k.object({kind:k.literal("fill"),locator:Se,value:je}),k.object({kind:k.literal("clear"),locator:Se}),k.object({kind:k.literal("click"),locator:Se}),k.object({kind:k.literal("dblclick"),locator:Se}),k.object({kind:k.literal("select"),locator:Se,value:je}),k.object({kind:k.literal("check"),locator:Se}),k.object({kind:k.literal("uncheck"),locator:Se}),k.object({kind:k.literal("hover"),locator:Se}),k.object({files:k.array(k.string().min(1)).min(1),kind:k.literal("upload"),locator:Se}),k.object({key:k.string().min(1),kind:k.literal("press"),locator:Se.optional()})]),za=k.object({action:Op,expect:k.array(On).default([])}),Ga=k.object({valueSpace:k.string().min(1)}),Qi=k.object({as:k.string().min(1),entity:k.string().min(1),set:k.record(k.string().min(1),je)}),Ha=k.object({entity:k.string().min(1),where:k.record(k.string().min(1),je)}),eo=k.object({absent:k.array(Ha).default([]),exclusive:k.array(k.string().min(1)).default([]),intent:k.string().min(1),name:k.string().min(1),params:k.record(k.string().min(1),Ga),singletons:k.record(k.string().min(1),je).default({}),slug:k.string().min(1),steps:k.array(za).default([]),workflow:k.string().min(1),world:k.array(Qi).default([])}),Np=k.object({absent:k.array(Ha).default([]),exclusive:k.array(k.string().min(1)).default([]),intent:k.string().min(1),maybe:k.array(Qi).default([]),name:k.string().min(1),params:k.record(k.string().min(1),Ga),singletons:k.record(k.string().min(1),je).default({}),sourcePath:k.string().min(1).optional(),steps:k.array(za).default([]),stub:k.boolean().default(!1),tests:k.array(eo).default([]),world:k.array(Qi).default([])}),Lp=k.object({sha256:k.string().regex(/^[0-9a-f]{64}$/u),size:k.number().int().nonnegative()}),to=k.object({entities:k.array(Ua),fixtures:k.record(k.string().min(1),Lp).default({}),singletons:k.array(Wa).default([]),valueSpaces:k.array(Ba),workflows:k.array(Np)}),Ak=$a({name:"ripplo-lockfile",schema:to});function cn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${cn(e.scope)} \u25B8 ${cn(e.target)}`:`${e.role} ${e.name??""}`.trim()}var no="__ripplo__",qa="__ripplo_seed__";import{z as kr}from"zod";var Ik=kr.object({index:kr.number().int().nonnegative(),kind:kr.string(),target:kr.string(),value:kr.string()});function Ka(e){let t=Pk(e);return{preconditions:e.entities.map(n=>({depends:t.get(n.name)??[],description:n.description??"",name:n.name,returns:n.identity})),singletons:e.singletons.map(n=>({defaultValue:String(n.default),description:n.description??"",name:n.name,type:n.type})),workflows:e.workflows.map(n=>({expectedOutcome:n.intent,name:n.intent,preconditions:Nk(Lk(n),t),requiresKeys:n.world.map(r=>({namespace:r.as,preconditionName:r.entity})),slug:qe(n.name),sourcePath:n.sourcePath??null,spec:n}))}}function Ya(e,t){return{index:t,kind:e.action.kind,target:$k(e.action),value:_k(e.action)}}function qe(e){return e.toLowerCase().replaceAll(/[^a-z0-9]/g,"-").split("-").filter(t=>t.length>0).join("-")}function Pk(e){let t=e.workflows.reduce((n,r)=>Tk(n,r),new Map);return new Map([...t].map(([n,r])=>[n,[...r]]))}function Tk(e,t){let n=[...t.world,...t.maybe],r=new Map(n.map(i=>[i.as,i.entity]));return n.reduce((i,o)=>{let s=Mk(o,r),a=i.get(o.entity)??new Set;return new Map([...i,[o.entity,new Set([...a,...s])]])},e)}function Mk(e,t){return Object.values(e.set).flatMap(n=>Ok(n)).map(n=>t.get(n)).filter(n=>n!=null&&n!==e.entity)}function Ok(e){return e==null||typeof e!="object"?[]:"ref"in e?[$p(e.ref)]:e.template.filter(t=>typeof t!="string").map(t=>$p(t.ref))}function $p(e){let[t]=e.split(".");return t??e}function Nk(e,t){let n=(r,i)=>r.has(i)?r:(t.get(i)??[]).reduce((o,s)=>n(o,s),new Set([...r,i]));return[...e.reduce((r,i)=>n(r,i),new Set)]}function Lk(e){return[...new Set(e.world.map(t=>t.entity))]}function $k(e){return e.kind==="goto"?ro(e.url):e.kind==="press"&&e.locator==null?"":io(e.locator)}function ro(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:e.template.map(t=>typeof t=="string"?t:`{${t.ref}}`).join("")}function io(e){return e.by==="testId"?`testId=${ro(e.value)}`:e.by==="inside"?`${io(e.scope)} \u25B8 ${io(e.target)}`:`${e.role} ${e.name==null?"":ro(e.name)}`.trim()}function _k(e){return e.kind==="fill"||e.kind==="select"?Dk(e.value):e.kind==="press"?e.key:""}function Dk(e){return e==null?"":typeof e!="object"?String(e):ro(e)}import{z as Re}from"zod";var _p=Re.enum(["Strict","Lax","None"]),Dp=Re.object({domain:Re.string().min(1),expires:Re.number(),httpOnly:Re.boolean(),name:Re.string().min(1),path:Re.string().min(1),sameSite:_p,secure:Re.boolean(),value:Re.string()}),jp=Re.object({localStorage:Re.array(Re.object({name:Re.string().min(1),value:Re.string()})),origin:Re.string().min(1)}),Ja=Re.object({cookies:Re.array(Dp),headers:Re.record(Re.string().min(1),Re.string()).optional(),origins:Re.array(jp)});import{z as K}from"zod";var Xa=K.union([gt,K.null()]),Za=K.record(K.string().min(1),Xa),Fp=K.object({as:K.string().min(1),entity:K.string().min(1),fields:K.record(K.string().min(1),je)}),jk=K.object({entities:K.array(Fp),runId:K.string().min(1),singletons:K.record(K.string().min(1),Xa).default({})}),Bp=K.object({as:K.string().min(1),row:Za,session:Ja.optional()}),Qa=K.object({rows:K.array(Bp)}),Fk=K.object({entities:K.array(K.string().min(1)),runId:K.string().min(1),singletons:K.array(K.string().min(1)).default([])}),el=K.object({entities:K.record(K.string().min(1),K.array(Za)),singletons:K.record(K.string().min(1),Xa).default({})}),Bk=K.object({runId:K.string().min(1)}),tl=K.object({ok:K.literal(!0)});import sl from"fs";import oo from"path";import{createJiti as Xk}from"jiti";import{err as Ar,ok as zp}from"neverthrow";import Vk from"fs";import Cr from"path";import Nn from"typescript";function Vp(e){let t=Cr.join(e,"index.ts"),n=zk(e);Vk.mkdirSync(Cr.dirname(n.tsBuildInfoFile??""),{recursive:!0});let r=Nn.createIncrementalCompilerHost(n),i=Nn.createIncrementalProgram({host:r,options:n,rootNames:[t]}),o=[...i.getSyntacticDiagnostics(),...i.getSemanticDiagnostics()];i.emit();let s=o.filter(u=>Uk(u,e));if(s.length===0)return{diagnostics:[],ok:!0};let a={getCanonicalFileName:u=>u,getCurrentDirectory:()=>Cr.dirname(e),getNewLine:()=>`
24
- `};return{diagnostics:Nn.formatDiagnosticsWithColorAndContext(s,a).split(`
25
- `).filter(u=>u.length>0),ok:!1}}function Uk(e,t){let n=e.file?.fileName;return n==null?!0:n.startsWith(t)}var Wk=Cr.join(".local","tsbuildinfo");function zk(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:Nn.ModuleKind.Preserve,moduleResolution:Nn.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:Nn.ScriptTarget.ES2022,tsBuildInfoFile:Cr.join(e,Wk)}}import{createHash as Gk}from"crypto";import Up from"fs/promises";import nl from"path";import{err as Ln,ok as rl,Result as Hk}from"neverthrow";var qk=".ripplo/fixtures",il=10*1024*1024,ol=50*1024*1024;async function Wp(e,t){let n=Kk(t);if(n.length===0)return rl({});let r=nl.join(e,qk),i=await Promise.all(n.map(o=>Yk({fixturesRoot:r,name:o})));return Hk.combine(i).andThen(Jk)}function Kk(e){let n=e.workflows.flatMap(r=>[...r.steps,...r.tests.flatMap(i=>i.steps)]).flatMap(r=>r.action.kind==="upload"?r.action.files:[]);return[...new Set(n)].toSorted((r,i)=>r.localeCompare(i))}async function Yk({fixturesRoot:e,name:t}){if(t.includes("..")||nl.isAbsolute(t))return Ln({kind:"fixture-invalid-name",name:t});let n=nl.join(e,t),r=await Up.lstat(n).catch(()=>null);if(r==null)return Ln({kind:"fixture-missing",name:t,path:n});if(r.isSymbolicLink())return Ln({kind:"fixture-symlink",name:t});if(!r.isFile())return Ln({kind:"fixture-not-file",name:t});let i=await Up.readFile(n);if(i.byteLength>il)return Ln({kind:"fixture-too-large",name:t,size:i.byteLength});let o=Gk("sha256").update(i).digest("hex");return rl([t,{sha256:o,size:i.byteLength}])}function Jk(e){let t=e.reduce((n,[,r])=>n+r.size,0);return t>ol?Ln({kind:"fixtures-total-too-large",total:t}):rl(Object.fromEntries(e))}var so=".ripplo/ripplo.lock",Er;async function Gp(e){let{result:t}=await Zk(e);return t}async function Zk(e){let t=eC(oo.join(e,".ripplo"));if(Er!=null&&Er.fingerprint===t&&Er.result.isOk())return{fingerprint:t,result:Er.result};let n=await Ir(e);return Er={fingerprint:t,result:n},{fingerprint:t,result:n}}async function Ir(e){let t=oo.join(e,".ripplo"),n=oo.join(t,"index.ts"),r=Vp(t);return r.ok?(await tC(n)).andThen(s=>rC({entryPath:n,exported:s})).match(async s=>(await Wp(e,s)).map(l=>({...s,fixtures:l})).mapErr(l=>({error:l,kind:"fixture-failed"})),s=>Promise.resolve(Ar(s))):Ar({diagnostics:r.diagnostics,kind:"typecheck-failed"})}var Qk=new Set([".local","debug","node_modules"]);function eC(e){return Hp(e).toSorted((t,n)=>t.localeCompare(n)).join("|")}function Hp(e){return(sl.existsSync(e)?sl.readdirSync(e,{withFileTypes:!0}):[]).flatMap(n=>{if(Qk.has(n.name))return[];let r=oo.join(e,n.name);if(n.isDirectory())return Hp(r);let i=sl.statSync(r);return[`${r}:${String(i.mtimeMs)}:${String(i.size)}`]})}async function tC(e){try{let n=await Xk(import.meta.url,{fsCache:!1,moduleCache:!1,sourceMaps:!0}).import(e),r=n!=null&&typeof n=="object"&&"default"in n?Reflect.get(n,"default"):n;return zp(r)}catch(t){return Ar({kind:"load-threw",message:nC(t)})}}function nC(e){return e instanceof Error?e.message:String(e)}function rC({entryPath:e,exported:t}){if(t==null||typeof t!="object"||!("lockfile"in t))return Ar({entryPath:e,kind:"not-ripplo"});let n=to.safeParse(Reflect.get(t,"lockfile"));return n.success?zp(n.data):Ar({issues:n.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"invalid-lockfile"})}function $n(e,t){return t==null?`Load \`/ripplo:${e}\` skill for instructions.`:`Load \`/ripplo:${e}\` skill for instructions on ${t}.`}function tW(e){return e.length===1?$n(e[0]):`Before proceeding, load the ${e.map(n=>`\`/ripplo:${n}\``).join(" and ")} skills \u2014 every one, each carries rules the others don't.`}function lo(e){return[`Compilation failed: ${iC(e)}`,$n("create","DSL authoring + lint rules")].join(`
26
- `)}function sW(){return`${so} is up to date`}function aW(e){return[`${so} is ${e==="missing"?"missing":"out of date"} \u2014 run \`npx ripplo compile\` and commit the result`,$n("setup")].join(`
27
- `)}function lW(){return`Wrote ${so}`}function iC(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...qp(e.diagnostics)].join(`
28
- `);case"not-ripplo":return`${e.entryPath} must default-export a Ripplo (createRipplo({ entities, singletons, workflows })). Check that the default export is the value returned by createRipplo, not a function or a re-export.`;case"invalid-lockfile":return["Lockfile failed schema validation (stale or hand-edited .ripplo/ripplo.lock?):",...qp(e.issues),"Regenerate with `npx ripplo compile` \u2014 never hand-edit the lockfile."].join(`
29
- `);case"load-threw":return[`.ripplo/index.ts threw while loading: ${e.message}`,"Usually a bad import or a top-level throw in .ripplo/ \u2014 run `npx ripplo compile` for the stack."].join(`
30
- `);case"fixture-failed":return oC(e.error)}}function qp(e,t=8){return e.length<=t?e:[...e.slice(0,t),`\u2026 and ${String(e.length-t)} more`]}function oC(e){switch(e.kind){case"fixture-missing":return`Fixture "${e.name}" not found at ${e.path} \u2014 add the file under .ripplo/fixtures/ or fix the upload() name.`;case"fixture-invalid-name":return`Invalid fixture name "${e.name}" \u2014 upload() takes a bare name under .ripplo/fixtures/, no .. or absolute paths.`;case"fixture-symlink":return`Fixture "${e.name}" is a symlink \u2014 only regular files are allowed.`;case"fixture-not-file":return`Fixture "${e.name}" is not a regular file.`;case"fixture-too-large":return`Fixture "${e.name}" is ${ao(e.size)} \u2014 over the ${ao(il)} per-file limit.`;case"fixtures-total-too-large":return`Fixtures total ${ao(e.total)} \u2014 over the ${ao(ol)} limit.`}}function ao(e){return`${String(Math.round(e/(1024*1024)*10)/10)} MB`}var uo=class extends Error{failure;constructor(t){super(t.kind),this.name="CliError",this.failure=t}};function hW(e){return e instanceof uo?al(e.failure):e instanceof Error?e.message:String(e)}function al(e){switch(e.kind){case"project-file-missing":return[`Missing ${e.path} \u2014 this directory is not a Ripplo project.`,"Run `npx ripplo init` to create it (or cd into the project root).",$n("setup")].join(`
31
- `);case"project-file-invalid":return[`${e.path} is invalid:`,...e.issues.map(t=>` ${t}`),"Fix the file by hand or re-run `npx ripplo init`."].join(`
32
- `);case"not-authenticated":return["Not signed in. Run `npx ripplo auth login`.","(Claude Code: run it yourself in the background \u2014 the user just approves in the browser.)"].join(`
33
- `);case"env-invalid":return sC(e);case"playwright-install-failed":return["Playwright browser install failed \u2014 Chromium is still missing.","Run `npx playwright install chromium` and check its output for network, proxy, or disk-space errors."].join(`
34
- `);case"gitdir-unrecognized":return`Unrecognized .git file at ${e.marker} \u2014 expected a directory or a "gitdir:" pointer (worktree). Is the repo corrupted?`;case"gitdir-empty":return`Empty gitdir pointer at ${e.marker} \u2014 the worktree's .git file points nowhere. Re-create the worktree.`;case"oauth-device-code-failed":return[`Could not start sign-in (device-code request failed): ${e.description}`,"Is the Ripplo server reachable? Check RIPPLO_SERVER_URL and retry."].join(`
35
- `);case"oauth-authorization-failed":return[`Sign-in failed (${e.code}): ${e.description}`,e.code==="expired_token"?"The approval window expired \u2014 run `npx ripplo auth login` again.":"Run `npx ripplo auth login` to retry."].join(`
36
- `);case"compilation-failed":return lo(e.error)}}function sC(e){let t=e.missingEnvFiles.length===0?[]:["Declared env files not found:",...e.missingEnvFiles.map(n=>` ${n}`),"In a git worktree? Env files aren't copied from the main checkout \u2014 recreate them, or symlink to a shared file outside the working tree."];return["Env config invalid:",...e.issues.map(n=>` ${n}`),"Add the missing values to the env files declared in .ripplo/project.json.",...t].join(`
37
- `)}import{err as uC,ok as cC}from"neverthrow";import{z as ll}from"zod";var aC="https://ripplo.ai";function Yp(){return Xp().RIPPLO_SERVER_URL}function Jp(){return Xp().RIPPLO_PROJECT_ID}var lC=ll.object({RIPPLO_PROJECT_ID:ll.string().min(1).optional(),RIPPLO_SERVER_URL:ll.string().min(1).default(aC)}),Kp;function Xp(){return Kp??=lC.parse(process.env),Kp}import Zp from"fs";import ul from"path";function Qp(e){let t=Zp.realpathSync(e),n=t,r=ul.dirname(n);for(;r!==n;){if(Zp.existsSync(ul.join(n,".git")))return n;n=r,r=ul.dirname(n)}return t}function AW(e){return Oa(e).andThen(t=>qi().andThen(n=>{let r=Ca();return r==null?uC({kind:"not-authenticated"}):cC({appUrl:n.appUrl,cwd:Qp(e),engineUrl:n.engineUrl,projectId:Jp()??t.projectId,ripploServerUrl:Yp(),token:r,webhookSecret:n.webhookSecret})}))}import eh from"fs";import{checkSync as dC,lockSync as fC}from"proper-lockfile";var pC="dev.pid",th=15e3;function nh(e){return zt(e,pC)}function rh(e){try{return dC(nh(e),{realpath:!1,stale:th})}catch{return!1}}var cl=class extends Error{pid;cwd;constructor({cwd:t,pid:n}){super("dev-lock-held"),this.name="DevLockHeldError",this.pid=n,this.cwd=t}};function OW({cwd:e,onCompromised:t}){Ra(e);let n=nh(e),r=hC({cwd:e,onCompromised:t,path:n});return eh.writeFileSync(n,String(process.pid)),()=>{try{r()}catch{}}}function hC({cwd:e,onCompromised:t,path:n}){try{return fC(n,{realpath:!1,stale:th,onCompromised:()=>{t()}})}catch(r){throw mC(r)?new cl({cwd:e,pid:yC(n)}):r}}function mC(e){if(!(e instanceof Error)||!("code"in e))return!1;let{code:t}=e;return t==="ELOCKED"}function yC(e){try{let t=eh.readFileSync(e,"utf8").trim(),n=Number.parseInt(t,10);return Number.isFinite(n)&&n>0?n:null}catch{return null}}import{createServer as vC}from"http";import{mkdir as RC,rm as kC,writeFile as CC}from"fs/promises";import EC from"path";import{z as ee}from"zod";import gC from"path";import{z as Pr}from"zod";var bC=["unspecified","internal","server","client","producer","consumer"],SC=["unset","ok","error"];function ih(e){return bC[e]??"unspecified"}function oh(e){return SC[e]??"unset"}var _W=Pr.looseObject({data:Pr.looseObject({source:Pr.number().optional()}).optional(),timestamp:Pr.number(),type:Pr.number()});function sh({debugDir:e,runId:t,worker:n}){let r=gC.join(e,t,"behavior.jsonl");return n.open({file:r,runId:t}),{close:i=>n.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(wC(i.noticeIfNoRrweb)),runId:t}),emit:i=>{let o={...i,timestamp:xC(i.timeNanos)};n.line({line:JSON.stringify(o),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{n.rrwebBatch({data:i,runId:t})}}}function _n(e){return String(BigInt(Math.round(e))*1000000n)}function wC(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function xC(e){return Number(BigInt(e)/1000000n)}var AC="otlp-port",lh=ee.object({key:ee.string(),value:ee.object({boolValue:ee.boolean().optional(),doubleValue:ee.number().optional(),intValue:ee.union([ee.string(),ee.number()]).optional(),stringValue:ee.string().optional()})}),IC=ee.object({attributes:ee.array(lh).default([]),endTimeUnixNano:ee.string(),kind:ee.number().default(0),name:ee.string(),parentSpanId:ee.string().optional(),spanId:ee.string(),startTimeUnixNano:ee.string(),status:ee.object({code:ee.number(),message:ee.string().optional()}).optional(),traceId:ee.string()}),PC=ee.object({resourceSpans:ee.array(ee.object({resource:ee.object({attributes:ee.array(lh).default([])}).optional(),scopeSpans:ee.array(ee.object({spans:ee.array(IC).default([])})).default([])})).default([])});async function dl({localDir:e,onRrwebBatch:t,onSpan:n,writePortFile:r}){let{port:i,server:o}=await TC({onRrwebBatch:t,onSpan:n}),s=EC.join(e,AC);return r&&(await RC(e,{recursive:!0}),await CC(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{r&&await kC(s,{force:!0}),await $C(o)}}}function TC(e){return new Promise((t,n)=>{let r=vC((i,o)=>{MC(i,o,e)});r.on("error",n),r.listen(0,()=>{let i=r.address();if(i==null||typeof i=="string"){n(new Error("otlp_receiver_no_port"));return}t({port:i.port,server:r})})})}function MC(e,t,n){let r=OC(e.url);if(r!=null){ah(e).then(i=>{n.onRrwebBatch(r,i),co(t)}).catch(()=>{co(t)});return}ah(e).then(i=>{NC(PC.parse(JSON.parse(i.toString("utf8"))),n.onSpan),co(t)}).catch(()=>{co(t)})}function OC(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function ah(e){return new Promise((t,n)=>{let r=[];e.on("data",i=>{r.push(i)}),e.on("end",()=>{t(Buffer.concat(r))}),e.on("error",n)})}function co(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function NC(e,t){e.resourceSpans.flatMap(n=>n.scopeSpans).flatMap(n=>n.spans).forEach(n=>{t({attributes:LC(n.attributes),durationMs:Number((BigInt(n.endTimeUnixNano)-BigInt(n.startTimeUnixNano))/1000000n),kind:"span",name:n.name,parentSpanId:n.parentSpanId,source:"server",spanId:n.spanId,spanKind:ih(n.kind),status:{code:oh(n.status?.code??0),message:n.status?.message},timeNanos:n.startTimeUnixNano,traceId:n.traceId})})}function LC(e){return Object.fromEntries(e.map(({key:t,value:n})=>[t,String(n.stringValue??n.intValue??n.doubleValue??n.boolValue??"")]))}function $C(e){return new Promise((t,n)=>{e.close(r=>{if(r==null){t();return}n(r)}),e.closeAllConnections()})}function At(e){let t=new URL(e,"https://ripplo.invalid"),n=[...t.searchParams.entries()].toSorted(([r],[i])=>r.localeCompare(i)).map(([r,i])=>`${r}=${i}`).join("&");return n.length===0?t.pathname:`${t.pathname}?${n}`}function Dn(e,t){return e==="url"?At(t):t}function fl(e,t,n){return Dn(e,String(t))===Dn(e,String(n))}function ch(e,t,n){return e!=="url"?fl(e,t,n):uh(String(t))===uh(String(n))}function uh(e){return new URL(e,"https://ripplo.invalid").pathname}function pl({actual:e,canon:t,pre:n,predicted:r}){return[...[...new Set([...r.entities.keys(),...e.entities.keys()])].flatMap(s=>_C({actual:e.entities.get(s),canon:t,entity:s,pre:n.entities.get(s),predicted:r.entities.get(s)})),...jC(n.singletons,r.singletons,e.singletons)]}function _C({actual:e,canon:t,entity:n,pre:r,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>DC({actual:e?.get(s),canon:t,entity:n,key:s,predicted:i?.get(s),preHadKey:r?.has(s)??!1,preRow:r?.get(s)}))}function DC({actual:e,canon:t,entity:n,key:r,predicted:i,preHadKey:o,preRow:s}){if(i==null)return[{mismatch:{entity:n,key:r,kind:"unexpected-row"},pending:o}];if(e==null)return[{mismatch:{entity:n,key:r,kind:"missing-row"},pending:!o}];let a=(u,c,d)=>ph(t(n,u,c),t(n,u,d));return[...new Set([...Object.keys(i),...Object.keys(e)])].filter(u=>!a(u,i[u],e[u])).map(u=>({mismatch:{entity:n,field:u,key:r,kind:"wrong-value",snapshot:i[u],sut:e[u]},pending:s==null?e[u]===void 0:a(u,s[u],e[u])}))}function ph(e,t){return dh(e)===dh(t)}function dh(e){return e==null?"\u2205":JSON.stringify(e)}function jC(e,t,n){return[...new Set([...Object.keys(t),...Object.keys(n)])].flatMap(i=>{let o=t[i],s=n[i];return o===void 0||s===void 0||fh(i,o,s)?[]:[{mismatch:{kind:"singleton-mismatch",singleton:i,snapshot:o,sut:s},pending:e[i]!==void 0&&fh(i,e[i],s)}]})}function fh(e,t,n){let r=Et.safeParse(e);return r.success?ch(r.data,t,n):ph(t,n)}function hl(e){let t=FC(e.entities),n=BC(e.singletons);return r=>VC(r,t,n)}function FC(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([n,r])=>[hh(t.name,n),r.consistency])))}function hh(e,t){return`${e}.${t}`}function BC(e){return new Map(e.map(t=>[t.name,t.consistency]))}function VC(e,t,n){return e.kind==="singleton-mismatch"?UC(e.singleton,n):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(hh(e.entity,e.field))??"strict"}function UC(e,t){return Et.safeParse(e).success?t.get(e)??"eventual":t.get(e)??"strict"}function ml(e){let t=new Set(e.valueSpaces.filter(n=>n.generator==="date.iso").map(n=>n.name));return(n,r,i)=>{if(!t.has(`${n}.${r}`)||typeof i!="string")return i;let o=Date.parse(i);return Number.isNaN(o)?i:new Date(o).toISOString()}}function yl({onlyFirst:e=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,e?void 0:"g")}var WC=yl();function gl(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(WC,"")}function yh(e,t,n){return{detail:n.slice(0,500),kind:"engine-http",path:e,status:t}}function Tr(e,t){return{code:Ih(t),kind:"engine-network",message:Or(t),path:e}}function gh(e){return{kind:"client-mount-missing",mountKey:e}}function bh(e,t){return{kind:"engine-decode",message:Or(t),path:e}}function Sh(e,t){return{entity:e,field:t,kind:"state-identity"}}function wh(e){return{as:e,kind:"setup-missing-row"}}function xh(e){return{count:e,kind:"conflicting-sessions"}}function Mr(e){return{kind:"driver-launch",message:Or(e)}}function vh(e){return{kind:"engine-unreachable",url:e}}function Rh(e,t){return{action:e,kind:"action-failed",message:Or(t)}}function kh(e){return{kind:"check-failed",message:Or(e)}}function Ch(){return{kind:"aborted"}}var mh=300;function It(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${Ah(e.detail)}${zC(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}`;case"client-mount-missing":return`client bridge "${e.mountKey}" never mounted; client singletons unreadable`;case"engine-decode":return`engine ${e.path} response did not match schema: ${e.message}`;case"state-identity":return`row of "${e.entity}" is missing identity field "${e.field}"`;case"setup-missing-row":return`setup returned no row for "${e.as}"`;case"conflicting-sessions":return`world established ${String(e.count)} distinct auth sessions in one browser context; sessions are exclusive \u2014 a single context holds one signed-in user`;case"engine-unreachable":return`the engine at ${e.url} did not respond in time \u2014 the dev server may still be recompiling. Re-run once it settles.`;case"driver-launch":return`browser driver failed to launch: ${e.message}`;case"action-failed":return`action "${e.action}" failed: ${e.message}`;case"check-failed":return`check failed: ${e.message}`;case"aborted":return"run aborted"}}function Eh(e){throw new Error(It(e))}function fo(){}function Ah(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=mh?t:`${t.slice(0,mh)}\u2026 [truncated]`}function zC(e){return e===404?" \u2014 the engine adapter is not mounted at RIPPLO_ENGINE_URL (or the mount path differs). Verify the adapter is wired into the app server and ENABLE_RIPPLO_TESTING=true; `ripplo doctor` checks the endpoint.":e===403||e===401?" \u2014 the adapter rejected the request: ENABLE_RIPPLO_TESTING is not true in the app's env, or RIPPLO_WEBHOOK_SECRET differs between the app and .ripplo env.":""}function Ih(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?Ih(e.cause):void 0}function Or(e){let t=e instanceof Error?e.message:String(e);return Ah(gl(t))}var vl=Di(Oh(),1),nz=vl.default.configure,po=vl.default;function G(e){return po(e)??""}function Pt(e,t){return[...new Map(e.map(n=>[t(n),n])).values()]}function Rl(e){return Pt(e,G)}function Nh(e){return G(e)}var Lr=class extends Error{name="AbortError";constructor(){super("aborted")}};function Lh(e){return e instanceof Error&&e.name==="AbortError"}function qt(e){if(e.aborted)throw new Lr}function kl(e,t){return t.aborted?Promise.reject(new Lr):new Promise((n,r)=>{let i=()=>{clearTimeout(o),r(new Lr)},o=setTimeout(()=>{t.removeEventListener("abort",i),n()},e);t.addEventListener("abort",i,{once:!0})})}var ZC={check:"Check",clear:"Clear",click:"Click",dblclick:"Double-click",fill:"Fill",goto:"Go to",hover:"Hover",press:"Press",select:"Select",uncheck:"Uncheck",upload:"Upload"};function $h(e){let t=ZC[e.kind]??e.kind;return e.kind==="press"&&e.key!=null?`${t}: ${e.key}`:t}function _h(e){return e.kind==="data-rule"?"data rule":Dh(e.check)}function Dh(e){return e.kind==="not"?`not ${Dh(e.inner)}`:e.kind==="browser"?e.name:`${jh(e.locator)} ${e.kind}`}function jh(e){return e.by==="testId"?"element":e.by==="inside"?jh(e.target):e.role}function zh(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var QC=()=>[];async function Il({canon:e,classify:t,initialSnapshot:n,observe:r,onAssertion:i,onStep:o,pageRulePendingChecks:s,steps:a},l){return Gh({acc:[],canon:e,classify:t,index:0,observe:r,onAssertion:i,onStep:o,pageRulePendingChecks:s??QC,signal:l,snapshot:n,steps:a})}async function Gh({acc:e,canon:t,classify:n,index:r,observe:i,onAssertion:o,onStep:s,pageRulePendingChecks:a,signal:l,snapshot:u,steps:c}){qt(l);let d=c[r];if(d==null)return{finalModel:u,findings:e};let f=Date.now(),h=await d.targetIds(),p=$h(d.step.action);if(!d.requiredState(u)){let m={kind:"impossible-action",step:d.step};return El(s,{annotations:[Cl({actionLabel:p,outcome:"failed",rrwebIds:h,startMs:f})],endMs:Date.now(),findings:[m],index:r,post:u,pre:u,startMs:f,url:Al(u)}),{finalModel:u,findings:[...e,m]}}return d.perform().match(()=>eE({acc:e,actionLabel:p,canon:t,classify:n,index:r,observe:i,onAssertion:o,onStep:s,pageRulePendingChecks:a,rrwebIds:h,signal:l,snapshot:u,startMs:f,step:d,steps:c}),m=>{let y=ho(m,d);return El(s,{annotations:[Cl({actionLabel:p,outcome:"failed",rrwebIds:h,startMs:f})],endMs:Date.now(),findings:[y],index:r,post:u,pre:u,startMs:f,url:Al(u)}),Promise.resolve({finalModel:u,findings:[...e,y]})})}function Cl({actionLabel:e,outcome:t,rrwebIds:n,startMs:r}){return{atMs:r,kind:"action",label:e,outcome:t,rrwebIds:n}}async function eE({acc:e,actionLabel:t,canon:n,classify:r,index:i,observe:o,onAssertion:s,onStep:a,pageRulePendingChecks:l,rrwebIds:u,signal:c,snapshot:d,startMs:f,step:h,steps:p}){let m=h.effect(d),y=await sE({canon:n,classify:r,observe:o,pre:d,predicted:m,signal:c,step:h}),S=[...h.pendingChecks,...l(d,y.snapshot)],w=await tE({onAssertion:s,pendingChecks:S,signal:c,step:h}),g=[...w.findings,...y.findings];El(a,{annotations:[Cl({actionLabel:t,outcome:g.length>0?"failed":"passed",rrwebIds:u,startMs:f}),...w.annotations],endMs:Date.now(),findings:g,index:i,post:y.snapshot,pre:d,startMs:f,url:Al(y.snapshot)});let v=[...e,...g];return g.length>0?{finalModel:y.snapshot,findings:v}:Gh({acc:v,canon:n,classify:r,index:i+1,observe:o,onAssertion:s,onStep:a,pageRulePendingChecks:l,signal:c,snapshot:y.snapshot,steps:p})}async function tE({onAssertion:e,pendingChecks:t,signal:n,step:r}){let i=[...new Map(t.map(s=>[Nh(s.source),s])).values()],o=await Promise.all(i.map(async s=>{let a=await nE(s,n),l=Date.now(),u=await s.targetIds();return{atMs:l,outcome:a,pendingCheck:s,rrwebIds:u}}));return o.forEach(s=>{rE(e,s.pendingCheck,s.outcome,r)}),{annotations:o.filter(s=>s.pendingCheck.source.kind==="step").map(s=>({atMs:s.atMs,kind:"assertion",label:_h(s.pendingCheck.source),outcome:Hh(s.outcome),rrwebIds:s.rrwebIds})),findings:o.flatMap(s=>iE(s.pendingCheck,s.outcome,r))}}function nE(e,t){if(e.check.kind==="decided"){let n=e.check.passed?"passed":"failed";return Promise.resolve({kind:n})}return aE(e.budget,e.check.run,t)}function rE(e,t,n,r){e?.({outcome:Hh(n),source:t.source,step:r.step})}function Hh(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function iE(e,t,n){return t.kind==="error"?[ho(t.error,n)]:t.kind==="failed"?[{budget:e.budget,kind:"pending-check",source:e.source,step:n.step}]:[]}function ho(e,t){return{error:e,kind:"driver-error",step:t.step}}function El(e,t){e?.(t)}function Al(e){let t=e.singletons.url;return typeof t=="string"?t:null}var $r={async:12e4,fast:5e3,slow:3e4},qh={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:$r.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:$r.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:$r.slow}};function Kh(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function Fh(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function oE(e,t,n){return n.reconcile==null?e:n.reconcile(e,t)}function Bh({canon:e,pre:t,predicted:n,step:r},i){let o=r.verifyChanges==null?[]:r.verifyChanges(n,i),s=oE(n,i,r),a=o.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...pl({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Yh(e,t){return{budget:t.sync,kind:"consistency",mismatch:e.mismatch,pending:e.pending,step:t.step}}function Vh(e,t,n){let r=e.probed.filter(i=>!i.pending&&n(i.mismatch)==="strict");return r.length>0?{findings:r.map(i=>Yh(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Uh(e,t,n){return{findings:[...e.probed.map(r=>Yh(r,t)),...n],snapshot:e.adopted}}async function sE({canon:e,classify:t,observe:n,pre:r,predicted:i,signal:o,step:s}){let a=qh[s.sync],l=Date.now()+a.timeoutMs,u=await Fh(n);if(!u.ok)return{findings:[ho(u.error,s)],snapshot:i};let c=Bh({canon:e,pre:r,predicted:i,step:s},u.observed),d=0;for(;Date.now()<l;){qt(o);let f=Vh(c,s,t);if(f!=null)return f;await kl(Kh(a,d),o),d+=1;let h=await Fh(n);if(!h.ok)return Uh(c,s,[ho(h.error,s)]);c=Bh({canon:e,pre:r,predicted:i,step:s},h.observed)}return Vh(c,s,t)??Uh(c,s,[])}async function aE(e,t,n){let r=qh[e],i=Date.now()+r.timeoutMs,o=await Wh(t),s=0;for(;o.kind==="pending"&&Date.now()<i;)qt(n),await kl(Kh(r,s),n),s+=1,o=await Wh(t);return o.kind==="pending"?{kind:"failed"}:o}function Wh(e){return e().match(t=>t?{kind:"passed"}:{kind:"pending"},t=>({error:t,kind:"error"}))}import{z as lE}from"zod";var Tl=lE.string().brand(),Q=Tl.parse("");function Tt(e){return Tl.parse(e)}function Ke(e,t){return Tl.parse(e.length===0?t:`${e}.${t}`)}function me(e){return Mn.safeParse(e).success}function pn(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function et(e){return typeof e=="object"&&e!==null&&"template"in e}function Pl(e,t,n){let r=Ke(t,e.ref);if(!n.has(r))throw new Error(`unresolved binding ref "${r}"`);return n.get(r)??null}function Jh(e,t,n){return uE(e).every(r=>n.has(Ke(t,r)))}function st(e,t,n){return typeof e=="string"?e:me(e)?String(Pl(e,t,n)):e.template.map(r=>typeof r=="string"?r:String(Pl(r,t,n))).join("")}function tt(e,t,n){return e===null||typeof e=="number"||typeof e=="boolean"?e:me(e)?Pl(e,t,n):st(e,t,n)}function Xh(e,t){return tt(e,Q,t)}function _r(e){return po(e)}function jn(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,tt(i,t,n)]))}function uE(e){return e==null||typeof e!="object"?[]:et(e)?e.template.flatMap(t=>typeof t=="string"?[]:[t.ref]):[e.ref]}function Kt(e){return typeof e=="object"&&e!==null&&"kind"in e}function hn(e){return Object.fromEntries(Object.entries(e).filter(t=>!Kt(t[1])))}function yo(e,t,n){return t.reduce((r,i)=>cE(r,i,n,e),e)}function Zh(e,t){return Object.keys(t).length===0?e:{...e,singletons:{...e.singletons,...t}}}function cE(e,t,n,r){if(!dE(t,n))return e;if(t.assertion.kind==="created"){let o=jn(t.assertion.props,Q,n);return fE(e,t.entity,_r(o),o)}if(t.assertion.kind==="deleted")return Ml(e,t.entity,yE(t.key,n,r));let i=jn(hn(t.assertion.props),Q,n);return Ml(e,t.entity,gE(t.key,i,n,r))}function dE(e,t){return("props"in e.assertion?[e.key,hn(e.assertion.props)]:[e.key]).every(r=>Object.values(r).every(i=>tm(i)||!me(i)||t.has(Tt(i.ref))))}function fE(e,t,n,r){let i=new Map([...e.entities.get(t)??[],[n,r]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function Ml(e,t,n){let r=n(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,r]])}}function mn(e,t,n,r){let i={env:r,key:n,snapshot:e};return[...(e.entities.get(t)??new Map).values()].filter(o=>go(o,i))}function Qh(e,t,n,r,i){let o={env:r,key:n,snapshot:e};return Ml(e,t,s=>new Map([...s].map(([a,l])=>[a,go(l,o)?i(l):l])))}function go(e,t){return Object.entries(t.key).every(([n,r])=>em(e[n],r,t))}function em(e,t,n){return tm(t)?pE(t,n).has(mo(e)):mo(e)===mo(mE(t,n.env))}function tm(e){return typeof e=="object"&&e!==null&&"kind"in e}function pE(e,t){let n=t.snapshot.entities.get(e.selection.entity);return n==null?new Set:new Set([...n.values()].filter(r=>hE(r,e.selection.where,t)).map(r=>mo(r[e.field])))}function hE(e,t,n){return Object.entries(t).every(([r,i])=>em(e[r],i,n))}function mo(e){return e==null?"\u2205":e instanceof Date?e.toISOString():JSON.stringify(e)}function mE(e,t){return tt(e,Q,t)}function yE(e,t,n){let r={env:t,key:e,snapshot:n};return i=>new Map([...i].filter(([,o])=>!go(o,r)))}function gE(e,t,n,r){let i={env:n,key:e,snapshot:r};return o=>new Map([...o].map(([s,a])=>go(a,i)?[s,{...a,...t}]:[s,a]))}function im(e){let t=e.predicates.filter(o=>lm(o)),n=t.filter(o=>o.assertion.kind==="created"),r=am(t);if(n.length===0&&r.length===0&&e.deferred.length===0&&e.adopt.length===0)return;let i=t.filter(o=>o.assertion.kind==="updated");return(o,s)=>{let a=n.reduce((c,d)=>kE(c,s,d,e.env),{env:e.env,snapshot:o}),l=r.reduce((c,d)=>RE(c,s,d,e.env),a.snapshot),u=i.reduce((c,d)=>SE(c,s,d),a.env);return bE(AE(l,e.deferred,u),s,e.adopt)}}function bE(e,t,n){if(n.length===0)return e;let r=n.reduce((i,o)=>{let s=t.snapshot.singletons[o];return s===void 0?i:{...i,[o]:s}},e.singletons);return{...e,singletons:r}}function om(e,t,n){return new Map([...e,...Object.entries(n).map(([r,i])=>[Ke(Q,`${t}.${r}`),i])])}function SE(e,t,n){let r=mn(t.snapshot,n.entity,n.key,e).at(0);return r==null?e:om(e,n.assertion.as,r)}function sm(e){let t=am(e.predicates.filter(n=>lm(n)));if(t.length!==0)return(n,r)=>t.flatMap(i=>wE(i,n,r,e.env))}function am(e){return e.filter(t=>t.assertion.kind==="updated"&&Ol(t.assertion.props).length>0)}function Ol(e){return Object.entries(e).filter(([,t])=>Kt(t)).map(([t])=>t)}function lm(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function wE(e,t,n,r){let i=mn(t,e.entity,e.key,r).at(0),o=mn(n.snapshot,e.entity,e.key,r).at(0);if(i==null||o==null)return[];let s=_r(xE(e.key,r));return Ol(e.assertion.props).flatMap(a=>nm(i[a])===nm(o[a])?[{entity:e.entity,field:a,key:s,kind:"expected-change",value:o[a]}]:[])}function xE(e,t){let n=Object.fromEntries(Object.entries(e).filter(r=>!vE(r[1])));return jn(n,Q,t)}function vE(e){return typeof e=="object"&&e!==null&&"kind"in e}function nm(e){return e==null?"\u2205":JSON.stringify(e)}function RE(e,t,n,r){let i=Ol(n.assertion.props),o=mn(t.snapshot,n.entity,n.key,r).at(0);return o==null?e:Qh(e,n.entity,n.key,r,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function kE(e,t,n,r){if(n.assertion.kind!=="created")return e;let i=jn(n.assertion.props,Q,r),o=_r(i),s=e.snapshot.entities.get(n.entity);if(s==null||!s.has(o))return e;let a=CE(t.snapshot.entities.get(n.entity),s,i);if(a==null)return e;let[l,u]=a,c=new Map(s);return c.delete(o),c.set(l,{...u,...i}),{env:om(e.env,n.assertion.as,u),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(n.entity,c)}}}function CE(e,t,n){if(e==null)return;let r=Object.entries(n),i=[...e].filter(([o])=>!t.has(o)).map(([o,s])=>({entry:[o,s],score:r.filter(([a,l])=>rm(s[a])===rm(l)).length}));return EE(i,r.length)}function rm(e){return e==null?"\u2205":JSON.stringify(e)}function EE(e,t){let n=e.reduce((i,o)=>Math.max(i,o.score),0);if(n===0)return;let r=e.filter(i=>i.score===n);if(!(n<t&&r.length!==1))return r[0]?.entry}function AE(e,t,n){let r=t.reduce((i,o)=>{let s=IE(o.value,n);return s==null?i:{...i,[o.name]:Dn(o.name,s)}},e.singletons);return{...e,singletons:r}}function IE(e,t){try{return st(e,Q,t)}catch{return}}function bo(e,t){if(e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked")return{kind:e.kind,locator:Dr(e.locator,t)};if(e.kind==="not"){let n=bo(e.predicate,t);return n==null?null:{inner:n,kind:"not"}}return e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:Dr(e.locator,t),value:st(e.value,Q,t)}:e.kind!=="browser"?null:{kind:"browser",name:e.name,value:st(e.value,Q,t)}}function jr(e,t){let n=e.expect.filter(a=>a.kind==="state"),r=LE(n),{adopt:i,deferred:o,immediate:s}=PE(e,t,r);return{action:$E(e.action,t),label:e.action.kind,pendingChecks:e.expect.flatMap(a=>DE(a,t)),reconcile:im({adopt:i,deferred:o,env:t,predicates:n}),verifyChanges:sm({adopt:i,deferred:o,env:t,predicates:n}),effect:a=>Zh(yo(a,n,t),s)}}function Dr(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:st(e.name,Q,t),role:e.role}:e.by==="inside"?{by:"inside",scope:Dr(e.scope,t),target:Dr(e.target,t)}:{by:"testId",value:st(e.value,Q,t)}}function PE(e,t,n){let r=e.action.kind==="goto"&&!e.expect.some(s=>s.kind==="browser"&&s.name==="url"),i=e.action.kind==="goto"&&!r?{url:At(st(e.action.url,Q,t))}:{},o=r?["url"]:[];return e.expect.reduce((s,a)=>a.kind==="browser"&&TE(a.value,n)?{...s,deferred:[...s.deferred,{name:a.name,value:a.value}]}:a.kind==="browser"||a.kind==="singleton"?{...s,immediate:{...s.immediate,...OE(a,t)}}:s,{adopt:o,deferred:[],immediate:i})}function TE(e,t){return ME(e).some(n=>t.has(n.split(".")[0]??n))}function ME(e){return typeof e=="string"?[]:me(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function OE(e,t){if(e.kind==="browser")return{[e.name]:NE(e,t)};if(e.kind==="singleton")return{[e.singleton]:tt(e.assertion.value,Q,t)};throw new Error("when() consequence must be a url (browser) or singleton assertion")}function NE(e,t){return Dn(e.name,st(e.value,Q,t))}function LE(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function $E(e,t){return{files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:_E(e,t),url:e.kind==="goto"?st(e.url,Q,t):void 0,value:"value"in e?Xh(e.value,t):void 0}}function _E(e,t){if(!(!("locator"in e)||e.locator==null))return Dr(e.locator,t)}function DE(e,t){if(e.kind==="browser"||e.kind==="singleton")return[];let n=bo(e,t),r="wait"in e?e.wait??"fast":"fast";return n==null?[]:[{budget:r,check:n}]}import{err as um,ok as Ll,okAsync as jE,Result as FE}from"neverthrow";function Fr(e,t,n){let r=HE(e),i={env:new Map,generate:n.generate,generatedParams:new Set,indexed:r,overrides:new Map(Object.entries(n.params??{}).map(([s,a])=>[Tt(s),a]))};qE(t.params,Q,i);let o=t.world.map(s=>KE(s,Q,i));return n.materialize(o).andThen(s=>ZE(s,i.env,r).map(a=>BE({base:a,generatedParams:i.generatedParams,lockfile:e,test:t})))}function $l(e,t){let n=new Map(t.map(r=>[r.name,r]));return r=>jE(WE(r,e,n).rows)}function _l(e){return t=>{let n=t.map(r=>({as:r.as,entity:r.entity,fields:r.fields}));return e(n).andThen(r=>UE(t,r))}}function cm(e,t){let n=So(t);return Object.fromEntries(Object.entries(e).filter(([r,i])=>n.includes(r)&&i!=null))}function So(e){return Object.keys(e.props)}function BE({base:e,generatedParams:t,lockfile:n,test:r}){let i=Object.fromEntries(n.singletons.map(c=>[c.name,c.default])),o=Object.fromEntries(Object.entries(r.singletons).map(([c,d])=>[c,tt(d,Q,e.env)])),s=Object.entries(r.singletons).filter(([,c])=>VE(c,t)).map(([c])=>c),a={...i,...o},l=new Set(n.singletons.filter(c=>c.source==="client").map(c=>c.name)),u=Object.fromEntries(Object.entries(a).filter(([c])=>l.has(c)));return{...e,clientState:u,generatedSingletons:s,snapshot:{...e.snapshot,singletons:a}}}function VE(e,t){return me(e)?t.has(Ke(Q,e.ref)):et(e)?e.template.some(n=>typeof n!="string"&&t.has(Ke(Q,n.ref))):!1}function UE(e,t){let n=new Map(t.map(r=>[r.as,r]));return FE.combine(e.map(r=>{let i=n.get(r.as);return i==null?um(wh(r.as)):Ll({as:r.as,entity:r.entity,generatedFields:r.generatedFields,row:i.row,session:i.session})}))}function WE(e,t,n){return e.reduce((r,i)=>{let o=zE(i.fields,r.env),s=eA({generate:t,model:i.model,seedPrefix:i.seedPrefix,set:o,valueSpaces:n}),a=Object.entries(s).map(([u,c])=>[`${i.as}.${u}`,c]),l=Object.keys(s).filter(u=>!(u in o));return{env:new Map([...r.env,...a]),rows:[...r.rows,{as:i.as,entity:i.entity,generatedFields:[...new Set([...i.generatedFields,...l])],row:s,session:void 0}]}},{env:new Map,rows:[]})}function zE(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>{if(me(r))return[n,GE(t,r.ref)];if(et(r))throw new Error(`template value not allowed in entity field "${n}"`);return[n,r]}))}function GE(e,t){let n=e.get(t);if(n==null)throw new Error(`setup ref "${t}" was not produced by an earlier entity`);return n}function HE(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function qE(e,t,n){Object.entries(e).forEach(([r,i])=>{let o=Ke(t,r),s=n.indexed.valueSpaces.get(i.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${i.valueSpace}" for param "${o}"`);let a=n.overrides.get(o);a==null&&n.generatedParams.add(o);let l=a??n.generate.value({anchor:void 0,constraints:s.constraints,generator:s.generator,nullable:!1,seed:o,type:s.type,values:s.values,valueSpace:i.valueSpace});n.env.set(o,l)})}function KE(e,t,n){let r=n.indexed.models.get(e.entity);if(r==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let i=Ke(t,e.as),o=YE(e.set,t,n.env),s=XE(r,o,i,n),a=Object.entries(e.set).filter(([,l])=>me(l)&&n.generatedParams.has(Ke(t,l.ref))).map(([l])=>l);return{as:i,entity:e.entity,fields:{...s,...o},generatedFields:[...Object.keys(s),...a],model:r,seedPrefix:i}}function YE(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,JE(i,t,n)]))}function JE(e,t,n){if(!me(e))return e;let r=Ke(t,e.ref);return n.get(r)??{ref:r}}function XE(e,t,n,r){return Object.fromEntries(Object.entries(e.props).filter(([i,o])=>!o.optional&&!e.identity.includes(i)&&!(i in t)).map(([i,o])=>[i,dm({field:i,generate:r.generate,model:e,seedPrefix:n,spec:o,valueSpaces:r.indexed.valueSpaces})]))}function ZE(e,t,n){let r=new Map,i=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)throw new Error(`model "${a.entity}" not found for setup "${a.as}"`);Object.entries(a.row).forEach(([c,d])=>t.set(Ke(Tt(a.as),c),d));let u=r.get(a.entity)??new Map;return u.set(Nl(a.row,l),cm(a.row,l)),r.set(a.entity,u),a.session==null?[]:[a.session]}),o=e.flatMap(a=>{let l=n.models.get(a.entity);return l==null?[]:[{alias:a.as,entity:a.entity,key:Nl(a.row,l)}]}),s=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)return[];let u=Nl(a.row,l);return a.generatedFields.map(c=>({entity:a.entity,field:c,key:u}))});return QE(i).map(a=>({aliases:o,auth:a,env:t,generated:s,snapshot:{entities:tA(r),singletons:{}}}))}function QE(e){if(e.length===0)return Ll(void 0);let t=new Set(e.map(r=>JSON.stringify(r.cookies))).size;if(t>1)return um(xh(t));let n=e.flatMap(r=>Object.entries(r.headers??{}));return Ll({cookies:e.flatMap(r=>r.cookies),headers:n.length===0?void 0:Object.fromEntries(n),origins:e.flatMap(r=>r.origins)})}function eA({generate:e,model:t,seedPrefix:n,set:r,valueSpaces:i}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in r)).map(([s,a])=>[s,dm({field:s,generate:e,model:t,seedPrefix:n,spec:a,valueSpaces:i})])),...r}}function dm({field:e,generate:t,model:n,seedPrefix:r,spec:i,valueSpaces:o}){let s=`${n.name}.${e}`;return t.value({anchor:void 0,constraints:o.get(s)?.constraints,generator:o.get(s)?.generator??"lorem.word",nullable:i.optional,seed:Ke(r,e),type:i.type,values:o.get(s)?.values,valueSpace:s})}function Nl(e,t){return t.identity.map(n=>String(e[n])).join(":")}function tA(e){return new Map([...e].map(([t,n])=>[t,new Map(n)]))}function Ye(e){return`${e.workflow}/${e.slug}`}function nt(e){return e.workflows.flatMap(t=>t.tests.map(n=>({ref:Ye(n),test:n,workflow:t})))}function St(e){return`${e.test}#${String(e.index)}`}function Fn(e){let t=nt(e).flatMap(n=>wo(e,n.test));return Pt(t,n=>`${n.test}:${G(n.steps)}`)}function wo(e,t){let n=hm(t),r=fm(n,t.singletons),i=CA(t,kA(e)),o=nA(e,t);return rA(r,EA(t.steps),n).reduce((a,{chunk:l,requiredState:u},c)=>({offset:a.offset+l.length,transitions:[...a.transitions,vA({chunk:l,index:c,intent:t.intent,namespace:n.namespace,paramSpaceOf:i,requiredState:u,testRef:Ye(t),whenChunk:o.slice(a.offset,a.offset+l.length)})]}),{offset:0,transitions:[]}).transitions}function fm(e,t){return{absences:SA(e),entities:xA(e),exclusives:e.exclusives,singletons:Object.fromEntries(Object.entries(t).filter(([,n])=>!me(n)&&!et(n)))}}function nA(e,t){let n=e.workflows.find(r=>r.name===t.workflow);return n==null||n.steps.length!==t.steps.length?t.steps:n.steps}function xo(e,t,n){return Object.values(e).flatMap(r=>me(r)?jl(r.ref,n):[]).find(r=>r.entity===t)?.aliasPath}function rA(e,t,n){return t.reduce((r,i)=>({requiredState:iA(r.requiredState,i,n),withRequiredState:[...r.withRequiredState,{chunk:i,requiredState:yA(r.requiredState,i)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function iA(e,t,n){let r=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>oA(i,o,n),e);return{...r,singletons:{...r.singletons,...pA(t)}}}function oA(e,t,n){return t.assertion.kind==="deleted"?sA(e,t,n):t.assertion.kind==="created"?uA(e,t.entity,t.assertion.as,t.assertion.props,n):dA(e,t,n)}function sA(e,t,n){let r=xo(t.key,t.entity,n.namespace),i=e.entities.find(a=>a.alias===r),o=Br(aA(t.key),n),s=i==null?{entity:t.entity,...o}:{entity:i.entity,...lA(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==r)}}function aA(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let n=t[1];return ym(n)?[]:[[t[0],n]]}))}function lA(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(n=>!t.relations.some(r=>r.field===n.field)),...t.relations]}}function uA(e,t,n,r,i){let o=Br(r,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!cA(o,s)),entities:[...e.entities,{alias:n,entity:t,...o}]}}function cA(e,t){return Object.entries(t.literals).every(([r,i])=>e.literals[r]===i)&&t.relations.every(r=>e.relations.some(i=>i.field===r.field&&i.targetAlias===r.targetAlias&&i.targetField===r.targetField))}function dA(e,t,n){if(t.assertion.kind!=="updated")return e;let r=xo(t.key,t.entity,n.namespace);if(r==null)return e;let i=Br(hn(t.assertion.props),n),o=Object.entries(t.assertion.props).filter(([,a])=>Kt(a)).map(([a])=>a),s=a=>a.alias===r?fA(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a))}}function fA(e,t,n){let r=Object.entries(e.literals).filter(([i])=>!n.includes(i)&&!(i in t.literals));return{...e,literals:{...Object.fromEntries(r),...t.literals},relations:[...e.relations.filter(i=>!t.relations.some(o=>o.field===i.field)),...t.relations]}}function pA(e){return e.reduce((t,n)=>({...t,...hA(n),...mA(n)}),{})}function hA(e){return e.action.kind==="goto"?{url:e.action.url}:{}}function mA(e){return Object.fromEntries(e.expect.flatMap(t=>t.kind==="browser"?[[t.name,t.value]]:t.kind==="singleton"?[[t.singleton,t.assertion.value]]:[]))}function yA(e,t){return t[0]?.action.kind!=="goto"?e:{...e,singletons:Object.fromEntries(Object.entries(e.singletons).filter(([n])=>n!=="url"))}}function vo(e,t){let n=hm(t);return{namespace:n.namespace,requiredState:fm(n,t.singletons)}}function pm(e,t){return[...new Set(e)].flatMap(n=>jl(n,t))}function at(e){return me(e)?[e.ref]:et(e)?e.template.flatMap(t=>me(t)?[t.ref]:[]):[]}function yn(e){switch(e.kind){case"visible":case"disabled":case"enabled":case"focused":case"checked":return Yt(e.locator);case"value":case"text":return[...Yt(e.locator),...at(e.value)];case"singleton":return at(e.assertion.value);case"browser":return at(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(hn(e.assertion.props)).flatMap(t=>at(t)),...Object.values(e.key).flatMap(t=>mm(t))];case"not":return yn(e.predicate);case"when":return e.branches.flatMap(t=>t.consequence.flatMap(n=>yn(n)));case"and":return e.predicates.flatMap(t=>yn(t));case"count":return[]}}function hm(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function Yt(e){return e.by==="inside"?[...Yt(e.scope),...Yt(e.target)]:e.by==="role"?e.name==null?[]:at(e.name):at(e.value)}function mm(e){return ym(e)?Object.values(e.selection.where).flatMap(t=>mm(t)):at(e)}function ym(e){return typeof e=="object"&&e!==null&&"kind"in e}function gA(e){return e.kind==="goto"?at(e.url):e.kind==="fill"||e.kind==="select"?[...Yt(e.locator),...at(e.value)]:e.kind==="press"?e.locator==null?[]:Yt(e.locator):(e.kind==="upload",Yt(e.locator))}function bA(e){return[...gA(e.action),...e.expect.flatMap(t=>yn(t))]}function SA(e){return e.absences.map(t=>({entity:t.entity,...Br(t.where,e)}))}function Br(e,t){let n=Object.entries(e),r=Object.fromEntries(n.flatMap(([o,s])=>me(s)||et(s)?[]:[[o,s]])),i=n.flatMap(o=>{let s=o[1];if(!me(s))return[];let a=jl(s.ref,t.namespace).at(0);return a==null?[]:[{entity:a.entity,field:o[0],targetAlias:a.aliasPath,targetField:a.field}]});return{literals:r,relations:i}}function wA(e,t){return e.map(n=>({alias:n.as,entity:n.entity,...Br(n.set,t)}))}function xA(e){return wA(e.setups,e)}function vA(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),n=t===-1?e.chunk:e.chunk.slice(0,t),r=e.chunk.slice(n.length),i=r.at(-1)??e.chunk.at(-1);if(i==null)throw new Error("empty transition chunk");let o=[...new Set(e.chunk.flatMap(s=>bA(s)))];return{effectStep:i,index:e.index,intent:e.intent,namespace:e.namespace,nav:n,paramSpaces:Object.fromEntries(o.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:r,test:e.testRef,wait:zh(r.flatMap(s=>RA(s))),whenSteps:e.whenChunk}}function RA(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function jl(e,t){let n=pn(e);if(n==null)return[];let r=t.get(n.alias);return r==null?[]:[{aliasPath:n.alias,entity:r,field:n.field,ref:e}]}function kA(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function CA(e,t){return new Map(Object.entries(e.params).map(([n,r])=>[n,t.get(r.valueSpace)]))}function EA(e){return Dl(e,0,[],[])}function Dl(e,t,n,r){let i=e[t];if(i==null)return n.length===0?r:[...r,n];let o=[...n,i];return AA(i)?Dl(e,t+1,[],[...r,o]):Dl(e,t+1,o,r)}function AA(e){return e.expect.some(t=>t.kind==="state")}function gm(e){return bm(e,new Map)}function IA(e,t){return e.reduce((n,r)=>n??t(r),null)}function bm(e,t){let n=e.variables.find(r=>!t.has(r));return n==null?t:IA(e.domain(n),r=>{let i=new Map([...t,[n,r]]);return e.consistent(i)?bm(e,i):null})}function wt(e,t){let n=PA(e,t);if(n==null)return null;let r=DA(n);return jA(e.singletons,t,r)?r:null}function PA(e,t){let{absences:n,entities:r,exclusives:i}=e,o=new Map(r.map(a=>[a.alias,a])),s=gm({variables:r.map(a=>a.alias),consistent:a=>TA(a)&&MA(r,a)&&NA(n,a,t),domain:a=>$A(o.get(a),t)});return s==null?null:_A(i,r,s,t)?s:null}function TA(e){let t=[...e.values()];return new Set(t).size===t.length}function MA(e,t){return e.every(n=>t.has(n.alias)?n.relations.every(r=>OA(n,r,t)):!0)}function OA(e,t,n){if(!n.has(t.targetAlias))return!0;let r=n.get(t.targetAlias)?.[t.targetField];return r==null?!0:n.get(e.alias)?.[t.field]===r}function NA(e,t,n){return e.every(r=>![...n.entities.get(r.entity)?.values()??[]].some(i=>LA(i,r,t)))}function LA(e,t,n){return Sm(e,t)?t.relations.every(r=>{if(!n.has(r.targetAlias))return!1;let i=n.get(r.targetAlias)?.[r.targetField];return i!=null&&e[r.field]===i}):!1}function Sm(e,t){return Object.entries(t.literals).every(([n,r])=>r===null?e[n]==null:e[n]===r)}function $A(e,t){return e==null?[]:[...t.entities.get(e.entity)?.values()??[]].filter(n=>Sm(n,e))}function _A(e,t,n,r){return e.every(i=>{let o=t.filter(a=>a.entity===i&&n.has(a.alias)).length;return(r.entities.get(i)?.size??0)===o})}function DA(e){return new Map([...e].flatMap(([t,n])=>Object.entries(n).flatMap(r=>{let i=r[1];return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[[Tt(`${t}.${r[0]}`),i]]:[]})))}function jA(e,t,n){return Object.entries(e).every(([r,i])=>{if(!Jh(i,Q,n))return!1;let o=tt(i,Q,n),s=t.singletons[r],a=Et.safeParse(r);return a.success?fl(a.data,o,s):s===o})}function xm(e,t,n){return e.reduce((r,i)=>{let o=yo(r.snapshot,FA(i),n);return{resolved:[...r.resolved,BA(i,o,n)],snapshot:o}},{resolved:[],snapshot:t}).resolved}function FA(e){return e.expect.filter(t=>t.kind==="state")}function BA(e,t,n){return e.expect.some(r=>r.kind==="when")?{...e,expect:e.expect.flatMap(r=>vm(r,{env:n,snapshot:t}))}:e}function vm(e,t){if(e.kind!=="when")return[e];let n=VA(e,t);return n==null?[]:n.flatMap(r=>vm(r,t))}function VA(e,t){return e.branches.find(n=>n.condition==null||Fl(n.condition,t))?.consequence}function Fl(e,t){if(e.kind==="count")return mn(t.snapshot,e.entity,{},t.env).length===e.value;if(e.kind==="singleton"){let n=tt(e.assertion.value,Q,t.env);return wm(t.snapshot.singletons[e.singleton])===wm(n)}return e.kind==="not"?!Fl(e.predicate,t):e.predicates.every(n=>Fl(n,t))}function wm(e){return e==null?"\u2205":JSON.stringify(e)}function Ro(e,t,n){let r=wt(e.requiredState,t);return r==null?null:new Map([...r,...Object.entries(n).map(([i,o])=>[Tt(i),o])])}function ko(e,t,n){let r=xm(e.whenSteps,n,t),i=r.at(-1)??e.effectStep,o=jr(i,t),s=zA(e,t),a=r.map(l=>jr(l,t));return{effect:GA(o.effect,s),steps:a.map(l=>({action:l.action,effect:l.effect,pendingChecks:l.pendingChecks,reconcile:l.reconcile,verifyChanges:l.verifyChanges}))}}function Bl(e,t,n){return wt(e.requiredState,n)==null?!1:gn(t(n))!==gn(n)||HA(e)||UA(e)}function UA(e){return[...e.nav,...e.steps].every(t=>t.expect.every(n=>n.kind!=="state"))}var Rm=new WeakMap;function gn(e){let t=Rm.get(e);if(t!=null)return t;let n=G({entities:[...e.entities].map(([r,i])=>[r,[...i]]),singletons:WA(e.singletons)});return Rm.set(e,n),n}function WA(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>t==="url"&&typeof n=="string"?[t,At(n)]:[t,n]))}function zA(e,t){let n=e.nav.at(-1);return n==null?void 0:jr(n,t).action.url}function GA(e,t){if(t==null)return e;let n=At(t);return r=>{let i=e(r);return{...i,singletons:{...i.singletons,url:n}}}}function HA(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(n=>Kt(n)))}function Vr(e,t,n){let r=Ro(e,t.snapshot,n);if(r==null)return null;let i=qA(e,r,t.snapshot);return i==null||!Bl(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function km(e,t,n){let r=Ro(e,t.snapshot,n);if(r==null)return"required-state-unsatisfied";try{return ko(e,r,t.snapshot),"no-effect"}catch{return"unresolvable"}}function qA(e,t,n){try{return ko(e,t,n)}catch{return null}}function Bn(e,t,n){return e.flatMap((r,i)=>{let o=n(r),s=Vr(r,t,o);return s==null?[]:[{idx:i,label:St(r),params:o,stepRun:s}]})}var KA={absences:[],entities:[],exclusives:[],singletons:{}};function Ur(e){return{...KA,...e}}function Wr(e,t){if(e==null)return new Set;if(e.by==="inside")return new Set([...Wr(e.scope,t),...Wr(e.target,t)]);let n=e.by==="role"?e.name:e.value;return new Set(t(n))}function Vl(e){return YA(e).flatMap(t=>JA(t))}function YA(e){return[...e.reduce((n,r)=>{let i=G([r.when.singletons,r.consequence]);return new Map([...n,[i,[...n.get(i)??[],r]]])},new Map).values()]}function JA(e){if(e.length<2)return[];let t=e.map(o=>new Set(o.when.entities.map(s=>Ul(s)))),[n]=t;if(n==null)return[];let r=[...n].filter(o=>t.every(s=>s.has(o))),i=e.toSorted((o,s)=>o.when.entities.length-s.when.entities.length)[0];return i==null||r.length===i.when.entities.length?[]:XA(e,r)?[]:tI(i,r,rI(e))}function Ul(e){return G([e.entity,e.literals])}function XA(e,t){return e.some(n=>{let r=Cm(n.consequence),i=ZA(r),o=QA(r);return n.when.entities.some(s=>!t.includes(Ul(s))&&(eI(s,i)||o.has(s.alias)))})}function Cm(e){return e.kind==="not"?Cm(e.predicate):"locator"in e?e.locator:void 0}function ZA(e){return Wr(e,t=>t==null||me(t)||et(t)?[]:[t])}function QA(e){return Wr(e,t=>{if(t==null||!me(t))return[];let n=pn(t.ref);return n==null?[]:[n.alias]})}function eI(e,t){return Object.values(e.literals).some(n=>typeof n=="string"&&t.has(n))}function tI(e,t,n){let r=e.when.entities.filter(l=>t.includes(Ul(l))),i=e.when.entities.filter(l=>!r.includes(l)).filter(l=>e.when.exclusives.includes(l.entity)).map(l=>({...l,literals:{},relations:[]})),o=[...r,...i],s=new Set(o.map(l=>l.alias));if(![...e.refs].every(l=>s.has(l)))return[];let a=Ur({entities:o.map(l=>nI(l,s)),exclusives:e.when.exclusives.filter(l=>o.some(u=>u.entity===l)),singletons:e.when.singletons});return[{consequence:e.consequence,origin:{kind:"generalized",tests:n},refs:e.refs,when:a}]}function nI(e,t){return{...e,relations:e.relations.filter(n=>t.has(n.targetAlias))}}function rI(e){return[...new Set(e.flatMap(t=>t.origin==null?[]:t.origin.kind==="generalized"?t.origin.tests:[t.origin.test]))]}function iI(e){return e.flatMap((t,n)=>e.slice(n+1).flatMap(r=>Tm(t,r)))}function Pm(e,t){return Tm(e,t).length>0}function Tm(e,t){let n=Em(e.when,t.when);return!n&&!Em(t.when,e.when)||!sI(e.consequence,t.consequence)?[]:[{a:e.consequence,b:t.consequence,when:n?t.when:e.when}]}function Em(e,t){return Am(e.entities,t.entities)&&Am(e.absences,t.absences)&&e.exclusives.every(n=>t.exclusives.includes(n))&&oI(e.singletons,t.singletons)}function Am(e,t){let n=new Set(t.map(r=>G(r)));return e.every(r=>n.has(G(r)))}function oI(e,t){return Object.entries(e).every(([n,r])=>G(t[n])===G(r))}function sI(e,t){return e.kind==="not"?Wl(e.predicate,t):t.kind==="not"?Wl(e,t.predicate):aI(e,t)||lI(e,t)}function Wl(e,t){return e.kind===t.kind&&"locator"in e&&"locator"in t&&Mm(e,t)}function Mm(e,t){return"locator"in t&&G(e.locator)===G(t.locator)}function aI(e,t){let n=new Set([e.kind,t.kind]);return n.has("enabled")&&n.has("disabled")&&"locator"in e&&"locator"in t?Mm(e,t):!1}function lI(e,t){let n=Im(e),r=Im(t);return n==null||r==null||e.kind!==t.kind?!1:Wl(e,t)&&G(n)!==G(r)}function Im(e){return e.kind==="value"||e.kind==="text"?e.value:null}function uI(e,t){return e.flatMap(n=>{let r=cI(n),i=new Set(n.requiredState.absences.map(o=>o.entity));return t.flatMap(o=>dI(n,o,r,i))})}function cI(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(n=>n.kind==="state"&&n.assertion.kind==="deleted"?[n.entity]:[])))}function dI(e,t,n,r){let{source:i,target:o}=t.reference;return!n.has(o)||n.has(i)||r.has(i)?[]:[{dataRule:t,source:i,target:o,transition:St(e)}]}function zl(e){return G({consequence:e.consequence,when:e.when})}function Gl(e){let t=[...fI(e),...CI(e)],n=Vl(t).reduce((r,i)=>[...t,...r].some(s=>Pm(i,s))?r:[...r,i],[]);return Pt([...t,...n],zl)}function Nm(e,t){return e.filter(n=>!pI(n)||hI(n)===t)}function Hl(e){return e.kind==="not"?Hl(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="value"||e.kind==="text"}function ql(e,t,n){if(wt(e.when,t)!=null)return null;let r=wt(e.when,n);return r==null?null:AI(e,r)}function fI(e){return Pt(nt(e).flatMap(t=>mI(e,t)),zl)}function pI(e){return e.origin==null||e.origin.kind==="generalized"?!1:yn(e.consequence).some(t=>pn(t)!=null)}function hI(e){let{origin:t}=e;if(!(t==null||t.kind==="generalized"))return t.test}function mI(e,{test:t,workflow:n}){let r=vo(e,t),i=yI(n.steps);return t.steps.reduce((o,s)=>({pageRules:[...o.pageRules,...kI({branchScoped:i,namespace:r.namespace,origin:{kind:"test",test:Ye(t)},requiredState:o.requiredState,step:s})],requiredState:gI(o.requiredState,s,r)}),{pageRules:[],requiredState:r.requiredState}).pageRules}function yI(e){let t=e.flatMap(n=>n.expect).flatMap(n=>Co(n)).map(n=>G(n));return new Set(t)}function Co(e){return e.kind==="not"?Co(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>Co(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>t.consequence.flatMap(n=>[n,...Co(n)]))}function gI(e,t,n){return t.expect.reduce((r,i)=>i.kind==="state"?bI(r,i,n):r,e)}function bI(e,t,n){if(t.assertion.kind==="created"){let o=SI(t.assertion.as,t.entity,t.assertion.props,n);return{...e,entities:[...e.entities,o]}}let r=xo(t.key,t.entity,n.namespace);if(r==null)return e;if(t.assertion.kind==="deleted")return vI(e,r);let i=hn(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===r?Lm(o,i,n):o)}}function SI(e,t,n,r){return Lm({alias:e,entity:t,literals:{},relations:[]},n,r)}function Lm(e,t,n){return Object.entries(t).reduce((r,[i,o])=>{if(et(o))return r;if(me(o)){let s=wI(o.ref,i,n.namespace);return{...r,literals:xI(r.literals,i),relations:s==null?r.relations:[...Om(r.relations,i),s]}}return{...r,literals:{...r.literals,[i]:o},relations:Om(r.relations,i)}},e)}function wI(e,t,n){let r=pn(e);if(r==null)return;let i=n.get(r.alias);return i==null?void 0:{entity:i,field:t,targetAlias:r.alias,targetField:r.field}}function xI(e,t){return Object.fromEntries(Object.entries(e).filter(([n])=>n!==t))}function Om(e,t){return e.filter(n=>n.field!==t)}function vI(e,t){let n=e.entities.find(i=>i.alias===t),r=RI(e,t);return n==null?r:{...r,absences:[...r.absences,{entity:n.entity,literals:n.literals,relations:n.relations}]}}function RI(e,t){return{...e,entities:e.entities.filter(n=>n.alias!==t)}}function kI({branchScoped:e,namespace:t,origin:n,requiredState:r,step:i}){if(i.action.kind!=="goto")return[];let o=i.action.url;return i.expect.filter(s=>Hl(s)).filter(s=>!e.has(G(s))).map(s=>$m({consequence:s,namespace:t,origin:n,requiredState:r,url:o}))}function $m({consequence:e,namespace:t,origin:n,requiredState:r,url:i}){return{consequence:e,origin:n,refs:new Set(pm([...at(i),...yn(e)],t).map(o=>o.aliasPath)),when:{...r,singletons:{...r.singletons,url:i}}}}function CI(e){return Pt(Fn(e).flatMap(t=>EI(t)),zl)}function EI(e){let t=e.nav.at(-1),n=e.steps[0]?.action,r=n!=null&&"locator"in n?n.locator:void 0;return t==null||t.action.kind!=="goto"||r==null?[]:[$m({consequence:{kind:"enabled",locator:r,wait:void 0},namespace:e.namespace,origin:{intent:e.intent,kind:"trigger",test:e.test},requiredState:e.requiredState,url:t.action.url})]}function AI(e,t){try{let n=bo(e.consequence,t);return n==null?null:{check:n}}catch{return null}}function Kl(e){return Rl(nt(e).flatMap(t=>II(e,t.test)))}function Yl(e,t){return wt(e.when,t)==null?!1:wt(e.holds,t)==null}function II(e,t){let n=vo(e,t);return n.requiredState.entities.flatMap(r=>r.relations.flatMap(i=>PI(e,r,i,n.namespace)?OI(r,i,n.namespace):[]))}function PI(e,t,n,r){let i=r.get(n.targetAlias);return i!=null&&!TI(e,t.entity,n.field)&&MI(e,i,n.targetField)}function TI(e,t,n){return e.entities.find(r=>r.name===t)?.props[n]?.optional===!0}function MI(e,t,n){return e.entities.find(r=>r.name===t)?.identity.includes(n)===!0}function OI(e,t,n){let r=n.get(t.targetAlias);if(r==null)return[];let i=_m(e.alias,e.entity),o=_m(t.targetAlias,r);return[{holds:Ur({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:r,targetField:t.targetField},when:Ur({entities:[i]})}]}function _m(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function Dm(e,t){let n=[...t.entities].flatMap(([o,s])=>[...s].map(([a,l])=>NI({entity:o,key:a,pre:e,row:l}))),r=[...e.entities].flatMap(([o,s])=>[...s].flatMap(([a,l])=>LI({entity:o,key:a,post:t,row:l}))),i=Object.entries(t.singletons).map(([o,s])=>({changed:e.singletons[o]!==s,name:o,value:s}));return{rows:[...n,...r],singletons:i}}function NI({entity:e,key:t,pre:n,row:r}){let i=$I(n.entities.get(e),t),o=Object.entries(r).map(([s,a])=>({changed:i==null||i[s]!==a,field:s,value:a}));return{changed:i==null||o.some(s=>s.changed),entity:e,fields:o,key:t,status:i==null?"created":"present"}}function LI({entity:e,key:t,post:n,row:r}){if(n.entities.get(e)?.has(t)===!0)return[];let i=Object.entries(r).map(([o,s])=>({changed:!1,field:o,value:s}));return[{changed:!0,entity:e,fields:i,key:t,status:"deleted"}]}function $I(e,t){return e?.get(t)}function Jl(e,t,n){return t.steps.map(r=>({effect:r.effect,pendingChecks:r.pendingChecks.map(i=>({budget:i.budget,check:{kind:"poll",run:()=>n.evaluate(i.check)},source:{check:i.check,kind:"step"},targetIds:()=>n.locateIds(Eo(i.check))})),reconcile:r.reconcile,step:{action:r.action,intent:e.intent,test:e.test},sync:e.wait,verifyChanges:r.verifyChanges,perform:()=>n.perform(r.action),requiredState:()=>!0,targetIds:()=>n.locateIds(r.action.locator)}))}function Eo(e){if(e.kind==="not")return Eo(e.inner);if(e.kind!=="browser")return e.locator}async function jm(e,t){let{params:n,transition:r}=e.stepRun,i=Vr(r,e.state,n);if(i==null){let s={intent:r.intent,kind:"unrunnable",reason:km(r,e.state,n),test:r.test};return{label:St(r),next:e.state,result:{finalModel:e.state.snapshot,findings:[s]}}}let o=await Il({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,pageRulePendingChecks:DI(e.pageRules,e.dataRules,e.driver),steps:Jl(e.stepRun.transition,i.resolved,e.driver)},t);return{label:St(e.stepRun.transition),next:{snapshot:o.finalModel},result:o}}function _I(e,t){return Yl(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function DI(e,t,n){return(r,i)=>[...e.flatMap(o=>jI(o,r,i,n)),...t.flatMap(o=>_I(o,i))]}function jI(e,t,n,r){let i=ql(e,t,n);return i==null?[]:[{budget:"fast",check:{kind:"poll",run:()=>r.evaluate(i.check)},source:{check:i.check,kind:"page-rule",origin:e.origin},targetIds:()=>r.locateIds(Eo(i.check))}]}function Zl(e,t){return Xl({acc:{findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function Xl({acc:e,index:t,params:n,signal:r,state:i,stepBase:o}){qt(r);let s=n.sequence[t];if(s==null)return e;let a=Date.now(),l=[],u=await jm({canon:n.canon,classify:n.classify,dataRules:n.dataRules,driver:n.driver,onAssertion:n.onAssertion,pageRules:n.pageRules,state:i,stepRun:s,onStep:d=>{l.push(d.index),n.onEvent({annotations:d.annotations,endMs:d.endMs,findings:d.findings,index:o+d.index,kind:"step",startMs:d.startMs,state:Dm(d.pre,d.post),url:d.url})}},r);if(u==null)return Xl({acc:e,index:t+1,params:n,signal:r,state:i,stepBase:o});n.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"ran",startMs:a}),u.result.findings.forEach(d=>{n.onEvent({finding:d,kind:"finding"})});let c={findings:[...e.findings,...u.result.findings],ran:[...e.ran,u.label]};return u.result.findings.length>0?c:Xl({acc:c,index:t+1,params:n,signal:r,state:u.next,stepBase:o+l.length})}var Vn={value:e=>FI(e)};function eu(e,t){return{value:n=>e.value({...n,seed:`${t}:${n.seed}`})}}function tu(e,t){return{value:n=>e.value({...n,anchor:t})}}function FI({anchor:e,constraints:t,generator:n,nullable:r,seed:i,type:o,values:s,valueSpace:a}){let l=Ql(`${a}:${i}`);return r&&l%4===0?null:s!=null&&s.length>0?s[l%s.length]??s[0]??null:n==="date.iso"?BI({anchor:e,constraints:t,n:l,timeHash:Ql(`${a}:${i}#tod`)}):o==="number"?VI(l,t):o==="boolean"?l%2===0:HI(n,l)}var Ao=864e5;function BI({anchor:e,constraints:t,n,timeHash:r}){if(t?.kind!=="datetime")throw new Error("datetime value space requires offsetDays constraints");if(e==null)throw new Error("datetime value space requires a run anchor timestamp");let i=Date.parse(e);if(Number.isNaN(i))throw new TypeError(`datetime anchor "${e}" is not a valid ISO timestamp`);let o=t.maxOffsetDays-t.minOffsetDays+1,s=o<=0?t.minOffsetDays:t.minOffsetDays+n%o,a=Math.floor(i/Ao)*Ao;return new Date(a+s*Ao+r%Ao).toISOString()}function Ql(e,t=0,n=7){return t>=e.length?n>>>0:Ql(e,t+1,n*31+(e.codePointAt(t)??0)>>>0)}function VI(e,t){if(t?.kind!=="number"||t.min==null||t.max==null)throw new Error("number value space requires min and max constraints");let n=t.max-t.min+1;return n<=0?t.min:t.min+e%n}var UI=["ada","bruno","carmen","dario","elena","felix","greta","hugo","iris","jonas","kira","lena","mateo","nadia","oscar","petra","quinn","rosa","stefan","tara","ugo","vera","wim","yara"],WI=["abreu","berg","costa","duval","eriksen","fischer","garza","holm","ito","jansen","kovac","laurent","moreau","novak","okafor","petrov","quist","rossi","sato","tanaka","ueda","vargas","weber","zhang"],zI=["amber","brisk","calm","deep","early","fond","glad","hazel","ivory","jade","keen","lush","mauve","noble","opal","plum","quiet","rapid","sage","teal","umber","vivid","warm","zesty"],GI=["aspen","brook","cedar","dune","ember","fjord","grove","harbor","isle","juniper","knoll","lagoon","meadow","nimbus","orchid","prairie","quartz","ridge","summit","thicket","umbra","vale","willow","zephyr"];function Io(e,t){let n=e[t%e.length];if(n==null)throw new Error("empty word list");return n}function Po(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function HI(e,t){let n=Io(UI,t),r=Io(WI,Math.floor(t/31)),i=Io(zI,t),o=Io(GI,Math.floor(t/29));return e==="internet.email"?`${n}.${r}${String(t%100)}@test.ripplo.ai`:e==="internet.url"?`https://${i}-${o}.example.com`:e==="person.fullName"?`${Po(n)} ${Po(r)}`:e==="company.name"?`${Po(i)} ${Po(o)}`:e==="lorem.slug"?`${i}-${o}`:`${o}-${String(t%1e3)}`}import{ResultAsync as ru}from"neverthrow";var zr=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}};function nu(e){return{read:t=>qI(t,e),seedScript:t=>`globalThis[${JSON.stringify(qa)}] = ${JSON.stringify(t)};`}}async function qI(e,t){let n={title:await e.title(),url:At(e.url()),viewport:JI(e.viewportSize())};if(t.length===0)return n;let r=await e.evaluate(YI,{mountKey:no,names:t,timeoutMs:KI});if(r.kind==="unmounted")throw new zr(no);return{...n,...r.values}}var KI=5e3;async function YI(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(r=>setTimeout(r,25));let n=Reflect.get(globalThis,e.mountKey);return n==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(r=>[r,n.readSingleton(r)??null]))}}function JI(e){return e==null?"":`${String(e.width)}x${String(e.height)}`}function iu(e,t,n){return{evaluate:r=>ru.fromPromise(Vm(XI(e,n,r),`check ${r.kind}`),Fm),locateIds:r=>rP(e,r),observe:()=>t.read().andThen(r=>ru.fromPromise(Vm(Um(e,n,0),"observe"),Fm).map(i=>({snapshot:{...r,singletons:{...r.singletons,...i}}}))),perform:r=>ru.fromPromise(zm(e,r,0),i=>Rh(r.kind,i))}}async function XI(e,t,n){try{return await Km(e,t,n)}catch(r){if(Wm(r))return!1;throw r}}function Fm(e){return e instanceof zr?gh(e.mountKey):kh(e)}var ZI=[100,250,500];async function Um(e,t,n){try{return await t.read(e)}catch(r){let i=ZI[n];if(i==null||!Wm(r))throw r;return await qm(i),Um(e,t,n+1)}}function Wm(e){let t=e instanceof Error?e.message:String(e);return/Execution context was destroyed|Cannot find context with specified id|[Ff]rame was detached|frame got detached/.test(t)}var Bm=35e3;function Vm(e,t){let n,r=new Promise((i,o)=>{n=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(Bm)}ms`))},Bm)});return Promise.race([e,r]).finally(()=>{clearTimeout(n)})}var QI=[250,750,2e3];async function zm(e,t,n){try{await eP(e,t)}catch(r){let i=QI[n];if(i==null||!oP(r))throw r;await qm(i),await zm(e,t,n+1)}}async function eP(e,t){if(t.kind==="goto"){await e.goto(Un(t.url,t,"url"));return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(Un(t.key,t,"key"));return}let n=t.kind!=="upload";await tP(e,Gm(e,t.locator,{visibleOnly:n}),t)}function Un(e,t,n){if(e==null)throw new Error(`action "${t.kind}" requires ${n}`);return e}function tP(e,t,n){switch(n.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(Un(n.value,n,"value")));case"clear":return t.clear();case"click":return t.click();case"dblclick":return t.dblclick();case"check":return t.check();case"uncheck":return t.uncheck();case"hover":return t.hover();case"select":return nP(e,t,String(Un(n.value,n,"value")));case"upload":return t.setInputFiles(Un(n.files,n,"files"));case"press":return t.press(Un(n.key,n,"key"))}}async function nP(e,t,n){if(await t.evaluate(i=>i.tagName==="SELECT")){await t.selectOption(n);return}await t.click(),await t.fill(n),await e.locator(Hm("option",n)).filter({visible:!0}).click()}async function rP(e,t){if(t==null)return[];try{let n=await To(e,t,{visibleOnly:!1}).evaluate(iP);return n>0?[n]:[]}catch{return[]}}function iP(e){return globalThis.__ripploRrwebMirror?.getId(e)??-1}function Gm(e,t,n){if(t==null)throw new Error("action requires a locator");return To(e,t,n)}function To(e,t,n){if(t.by==="inside"){let i=To(e,t.scope,n);return To(i,t.target,n)}let r=t.by==="testId"?e.getByTestId(t.value):e.locator(Hm(t.role,t.name));return n.visibleOnly?r.filter({visible:!0}):r}function Hm(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}function oP(e){let t=e instanceof Error?e.message:String(e);return/net::ERR_|ERR_HTTP_RESPONSE_CODE_FAILURE|ECONNREFUSED|ECONNRESET|socket hang up|fetch failed|page\.goto: Timeout/.test(t)}function qm(e){return new Promise(t=>{setTimeout(t,e)})}async function Km(e,t,n){if(n.kind==="browser")return aP(e,t,n.name,n.value);if(n.kind==="not")return!await Km(e,t,n.inner);let r=Gm(e,n.locator,{visibleOnly:!0});return n.kind==="value"?await r.inputValue()===n.value:n.kind==="text"?(await r.textContent()??"").includes(n.value):sP(r,n.kind)}function sP(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():e.evaluate(n=>n===n.ownerDocument.activeElement)}async function aP(e,t,n,r){let o=(await t.read(e))[n];return typeof o=="string"&&o.includes(r)}import lP from"path";async function ou({baseUrl:e,browser:t,capture:n,clientState:r,engine:i,fixturesDir:o,reader:s,session:a}){let l=await t.newContext({baseURL:e,reducedMotion:"reduce",storageState:a==null?void 0:{cookies:uP(a.cookies,e),origins:a.origins}});a?.headers!=null&&await l.setExtraHTTPHeaders(a.headers),await l.addInitScript(i.seedScript(r));let u=n==null?cP():await n.hub.attach(l,n.runId),c=await l.newPage();return u.onPage(c),{driver:pP(dP(iu(c,s,i),o),u),emitAssertion:u.emitAssertion,close:()=>hP({context:l,handle:u})}}async function su(e,t){let n=await Jm(e);try{return await t(n)}finally{await n.close()}}function uP(e,t){let n=new URL(t).hostname;return e.map(r=>({...r,domain:n}))}function cP(){return{emitAction:()=>{},emitAssertion:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function Jm(e){let{chromium:t}=await import("playwright");return t.launch({headless:!e})}function Xm({headed:e}){let t;return{acquire:async()=>{let i=t;if(i!=null){let o=await i.catch(()=>{});if(o?.isConnected()===!0)return o;t===i&&(t=void 0)}return t??=Jm(e),t},close:async()=>{let i=t;t=void 0,i!=null&&await i.then(o=>o.close()).catch(()=>{})}}}function dP(e,t){return{evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>e.perform(fP(n,t))}}function fP(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(n=>lP.join(t,n))}}function pP(e,t){return{evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>(t.emitAction(n),e.perform(n))}}async function hP({context:e,handle:t}){await Ym(t.finish()),await Ym(e.close())}var mP=15e3;async function Ym(e){let t,n=new Promise(r=>{t=setTimeout(r,mP)});await Promise.race([e.catch(()=>{}),n]).finally(()=>{clearTimeout(t)})}import{err as yP,ok as gP,Result as au}from"neverthrow";function lu(e,t,n){return{read:()=>n.read(e.map(r=>r.name),t).andThen(r=>bP(e,r))}}function bP(e,t){return au.combine(e.map(n=>SP(n,t.entities[n.name]??[]).map(r=>[n.name,r]))).map(n=>({entities:new Map(n),singletons:t.singletons}))}function SP(e,t){let n=So(e);return au.combine(t.map(r=>wP(r,e).map(i=>[i,xP(r,n)]))).map(r=>new Map(r))}function wP(e,t){return au.combine(t.identity.map(n=>{let r=e[n];return r==null?yP(Sh(t.name,n)):gP(String(r))})).map(n=>n.join(":"))}function xP(e,t){let n=t.map(r=>[r,e[r]]).filter(r=>r[1]!=null);return Object.fromEntries(n)}var Zm=Di(Ia(),1);import vP from"crypto";import{err as RP,errAsync as uu,ok as kP,ResultAsync as Wn}from"neverthrow";var CP=3e4,EP=[250,750,2e3],AP=[500,1e3,2e3,3e3];function cu({baseUrl:e,runId:t,secret:n},r){let i=new Zm.Webhook(n),o=(s,a,l)=>IP({baseUrl:e,body:a,path:s,retry:l.retry,schema:l.schema,signal:l.signal,webhook:i});return{query:{read:(s,a)=>o("/state",{entities:s,runId:t,singletons:a},{retry:"transient",schema:el,signal:r}).map(l=>({entities:l.entities,singletons:l.singletons}))},ready:()=>ey(e,r,0),setupWorld:s=>o("/setup",{entities:s,runId:t},{retry:"connection",schema:Qa,signal:r}).map(a=>a.rows),teardown:()=>o("/teardown",{runId:t},{retry:"connection",schema:tl,signal:void 0}).map(()=>{})}}function IP(e){return Qm(e.retry,()=>OP(e),0)}function Qm(e,t,n){return t().orElse(r=>{let i=EP[n];return i==null||!TP(r,e)?uu(r):Wn.fromSafePromise(ty(i)).andThen(()=>Qm(e,t,n+1))})}function ey(e,t,n){return Wn.fromPromise(fetch(e,{method:"HEAD",signal:ny(t)}),r=>Tr("",r)).map(()=>{}).orElse(()=>{let r=AP[n];return r==null||t.aborted?uu(vh(e)):Wn.fromSafePromise(ty(r)).andThen(()=>ey(e,t,n+1))})}var PP=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function TP(e,t){return e.kind==="aborted"?!1:MP(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function MP(e){return e.kind==="engine-network"&&e.code!=null&&PP.has(e.code)}function ty(e){return new Promise(t=>{setTimeout(t,e)})}function OP({baseUrl:e,body:t,path:n,schema:r,signal:i,webhook:o}){let s=JSON.stringify(t);return Wn.fromPromise(fetch(`${e}${n}`,{body:s,headers:{"Content-Type":"application/json",...NP(o,s)},method:"PUT",signal:ny(i)}),a=>Tr(n,a)).andThen(a=>LP(a,n)).andThen(a=>$P(r,a,n)).mapErr(a=>i?.aborted===!0?Ch():a)}function NP(e,t){let n=`msg_${vP.randomUUID()}`,r=new Date;return{"webhook-id":n,"webhook-signature":e.sign(n,r,t),"webhook-timestamp":String(Math.floor(r.getTime()/1e3))}}function ny(e){let t=AbortSignal.timeout(CP);return e==null?t:AbortSignal.any([e,t])}function LP(e,t){return e.ok?Wn.fromPromise(e.json(),n=>Tr(t,n)):Wn.fromPromise(e.text().catch(()=>""),n=>Tr(t,n)).andThen(n=>uu(yh(t,e.status,n)))}function $P(e,t,n){let r=e.safeParse(t);return r.success?kP(r.data):RP(bh(n,r.error))}var oe=Di(oy(),1),$e={actual:e=>oe.default.red(e),bad:e=>oe.default.red(oe.default.bold(e)),bold:e=>oe.default.bold(e),dim:e=>oe.default.dim(e),expected:e=>oe.default.green(e),good:e=>oe.default.green(oe.default.bold(e)),heading:e=>oe.default.bold(oe.default.cyan(e)),path:e=>oe.default.cyan(oe.default.underline(e)),warn:e=>oe.default.yellow(oe.default.bold(e))},FP={assertion:oe.default.yellow,consistency:oe.default.magenta,"data rule":oe.default.yellow,driver:oe.default.red,"impossible action":oe.default.cyan,"page rule":oe.default.yellow,skipped:oe.default.red};function lt(e){return`${oe.default.red(oe.default.bold("\u2717"))} ${FP[e](oe.default.bold(e))}`}var BP=oe.default.red("\u2717"),hH=oe.default.green("\u2713"),VP=oe.default.dim("\u203A"),UP=8;function sy(e,t,n){let r=n==null?"":` ${$e.dim(n)}`;return` ${$e.dim(e.padStart(UP))} ${t}${r}`}function Gn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Gn(e.scope)} \u25B8 ${Gn(e.target)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function pu(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${Gn(e.locator)}`:e.kind}function Hn(e){return e.kind==="not"?`not ${Hn(e.inner)}`:e.kind==="browser"?`${e.name}="${e.value}"`:e.kind==="value"||e.kind==="text"?`${e.kind} ${Gn(e.locator)}="${e.value}"`:`${e.kind} ${Gn(e.locator)}`}function Gr(e){let{field:t,source:n,target:r,targetField:i}=e.reference;return`${n}.${t} \u2192 ${r}.${i}`}function ly(e){return`${e.intent} \u203A ${pu(e.action)}`}function uy(e){return e.kind==="data-rule"?`data rule ${Gr(e.dataRule)}`:`${e.kind} ${Hn(e.check)}`}function _e(e){return e==null?"\u2205":JSON.stringify(e)}function cy(e){return e.kind==="unexpected-row"?`${e.entity} "${e.key}" present in the app but the test expected none`:e.kind==="missing-row"?`${e.entity} "${e.key}" expected by the test but missing in the app`:e.kind==="wrong-value"?`${e.entity}.${e.field} [${e.key}] expected=${_e(e.snapshot)} actual=${_e(e.sut)}`:e.kind==="expected-change"?`${e.entity}.${e.field} [${e.key}] expected to change but stayed ${_e(e.value)}`:`${e.singleton} expected=${_e(e.snapshot)} actual=${_e(e.sut)}`}function hu(e){return{label:uy(e.source),step:ly(e.step)}}function mu({evidencePath:e,finding:t}){let n=WP(t);return e==null?n:`${n} Evidence: ${$e.path(e)}`}function dy(e){return GP(HP(e))}function WP(e){return e.kind==="consistency"?tT(e):e.kind==="pending-check"?iT(e.source,e.step,e.budget):e.kind==="impossible-action"?`${lt("impossible action")} The step "${e.step.intent}" ran ${pu(e.step.action)} from a state the test says can't happen. Either the test's required state is stricter than the app really is, or the app exposes this action somewhere it shouldn't \u2014 check which before loosening the test.`:e.kind==="unrunnable"?`${lt("skipped")} The planned step "${e.intent}" could not run \u2014 ${fy(e.reason)}. A planned move was skipped, so this run proved less than it claims \u2014 fix the plan or the starting state rather than ignoring the skip.`:`${lt("driver")} The browser failed while running "${e.step.intent}" \u2014 ${It(e.error)}. This is an environment failure (daemon, dev server, ports), not an app or test bug \u2014 fix the run environment and rerun.`}var zP=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function GP(e){return e.replaceAll(zP,"").replaceAll(/\s+/g," ").trim()}function HP(e){if(e.kind==="consistency"){let t=e.step==null?"":` after "${e.step.intent}"`;return`${cy(e.mismatch)}${t}`}return e.kind==="pending-check"?`${sT(e.source)} failed at "${e.step.intent}": ${aT(e.source)}`:e.kind==="impossible-action"?`"${e.step.intent}" ran from a state the test says can't happen`:e.kind==="unrunnable"?`planned step "${e.intent}" could not run \u2014 ${fy(e.reason)}`:`driver failed at "${e.step.intent}": ${It(e.error)}`}var qP={"no-effect":"the action has no observable effect from this state","required-state-unsatisfied":"the live state doesn't satisfy the step's required state",unresolvable:"a step references a value that doesn't exist yet (e.g. a not-yet-created id)"};function fy(e){return qP[e]}function KP({debugDir:e,runId:t}){let n=`${e}/${t}`;return sy("behavior",$e.path(`${n}/behavior.jsonl`),void 0)}function YP(e){if(e.kind==="cascade-gap"){let{gap:n}=e;return`${lt("data rule")} ${n.transition} deletes ${n.target} but leaves ${n.source} rows pointing at the deleted row. That breaks the data rule ${Gr(n.dataRule)} \u2014 cascade the delete in the app or declare the cleanup on the deleting step.`}if(e.kind==="create-gap"){let{gap:n}=e,r=n.missing.length===1?"field":"fields",i=n.missing.length===1?"it":"them";return`${lt("data rule")} ${n.transition} creates ${n.entity} without setting the required ${r} ${n.missing.join(", ")}. Set ${i} on the creating step or drop the requirement from the entity.`}let{conflict:t}=e;return`${lt("page rule")} Two page rules contradict each other \u2014 ${t.a.kind} vs ${t.b.kind} when ${JSON.stringify(t.when.singletons)}. They were learned from different tests asserting opposite things about the same page \u2014 one of those tests is wrong, fix it before trusting either rule.`}function JP(e){return"locator"in e&&e.locator!=null?`${e.kind} ${fu(e.locator)}`:"url"in e?`${e.kind} ${XP(e.url)}`:e.kind}function XP(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:py(e)}function fu(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${ay(e.name)}`:e.by==="inside"?`${fu(e.scope)} \u25B8 ${fu(e.target)}`:ay(e.value)}function ay(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:py(e)}function py(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function No(e){return e==null?"At the end of the run":`After ${QP(e.action)} in ${e.intent}`}var ZP={click:"clicking",fill:"filling",goto:"opening",hover:"hovering over",press:"pressing",select:"selecting",upload:"uploading to"};function QP(e){return e.url!=null?`opening ${e.url}`:e.locator!=null?`${ZP[e.kind]??e.kind} ${zn(e.locator)}`:e.kind}function zn(e){return e.by==="testId"?`the element with testId "${e.value}"`:e.by==="inside"?`${zn(e.target)} inside ${zn(e.scope)}`:e.name==null?`the ${e.role}`:`the "${e.name}" ${e.role}`}function eT(e){return e.kind==="not"&&e.inner.kind==="visible"?`${zn(e.inner.locator)} never disappeared`:e.kind==="visible"?`${zn(e.locator)} never appeared`:e.kind==="value"||e.kind==="text"?`${zn(e.locator)} never showed "${e.value}"`:`the check ${Hn(e)} never held`}function tT(e){let t=e.pending?nT(e):rT(e.mismatch,e.step);return`${lt("consistency")} ${t}`}function nT(e){let t=`${hy(e.budget)} wait window`,n="If this write is legitimately slow, declare wait: on the expectation or move it to a slower tier.",{mismatch:r}=e,i=No(e.step);return r.kind==="wrong-value"?`${i}, ${r.entity}.${r.field} on row "${r.key}" never changed within the ${t} \u2014 it still showed ${$e.actual(_e(r.sut))} instead of ${$e.expected(_e(r.snapshot))}, so the write may not have landed at all. ${n}`:r.kind==="unexpected-row"?`${i}, the ${r.entity} row "${r.key}" was still there at the end of the ${t} \u2014 the delete may not have landed. ${n}`:r.kind==="missing-row"?`${i}, the ${r.entity} row "${r.key}" never appeared within the ${t} \u2014 the create may not have landed. ${n}`:r.kind==="expected-change"?`${i}, ${r.entity}.${r.field} on row "${r.key}" was expected to change but stayed ${$e.actual(_e(r.value))} through the ${t}, so the write may not have landed at all. ${n}`:`${i}, ${r.singleton} never changed within the ${t} \u2014 it still showed ${$e.actual(_e(r.sut))} instead of ${$e.expected(_e(r.snapshot))}, so the write may not have landed at all. ${n}`}function hy(e){return`${String($r[e]/1e3)}s`}function rT(e,t){let n=No(t);return e.kind==="wrong-value"?`${n}, ${e.entity}.${e.field} on row "${e.key}" showed ${$e.actual(_e(e.sut))} but the test expected ${$e.expected(_e(e.snapshot))}. This is an app bug if the expected value is the promised behavior \u2014 if the app legitimately owns this value, assert changed() instead.`:e.kind==="singleton-mismatch"?`${n}, ${e.singleton} showed ${$e.actual(_e(e.sut))} but the test expected ${$e.expected(_e(e.snapshot))}. This is an app bug if the expected value is the promised behavior \u2014 otherwise correct the expected value at the step that sets it.`:e.kind==="unexpected-row"?`${n}, the app held a ${e.entity} row "${e.key}" the test never expected. Some step writes this row without declaring it \u2014 declare the effect on the acting step (${e.entity}.created, updated, or deleted), or if this write belongs to a different flow, cover it in that flow's test.`:e.kind==="missing-row"?`${n}, the test expected a ${e.entity} row "${e.key}" but the app had none. This is an app bug if the write was promised \u2014 if it only happens from a different starting state, restrict this test's given and cover that state in its own test.`:`${n}, ${e.entity}.${e.field} on row "${e.key}" was expected to change but stayed ${$e.actual(_e(e.value))}. This is an app bug if this action should change it \u2014 if the change needs other preconditions, split that case into its own test with the right given.`}function iT(e,t,n){let r=`${hy(n)} wait window`;return e.kind==="data-rule"?`${lt("data rule")} ${No(t)}, the data rule ${Gr(e.dataRule)} stopped holding \u2014 a referenced row went missing. This is an app bug if the reference should survive this action \u2014 confirm in behavior.jsonl before relaxing the rule.`:e.kind==="page-rule"?`${lt("page rule")} A page rule learned from ${oT(e.origin)} says ${Hn(e.check)} at this URL \u2014 it never held here within the ${r}. Either the rule is broader than the app guarantees or this page regressed \u2014 confirm in behavior.jsonl before narrowing the rule.`:`${lt("assertion")} ${No(t)}, ${eT(e.check)} within the ${r}. This is usually a wrong accessible name, a UI regression, or a starting state this page doesn't have \u2014 confirm in behavior.jsonl before changing the test.`}function oT(e){return e==null?"another workflow":e.kind==="test"?`an assertion in test "${e.test}"`:e.kind==="trigger"?`the trigger of "${e.intent}" in test "${e.test}"`:`tests ${e.tests.map(n=>JSON.stringify(n)).join(", ")}`}function sT(e){return e.kind==="data-rule"?"data rule":e.kind==="page-rule"?"page rule":"assertion"}function aT(e){return e.kind==="data-rule"?Gr(e.dataRule):Hn(e.check)}import{err as b5,ok as S5,ResultAsync as w5}from"neverthrow";import bS from"path";import{existsSync as lT}from"fs";import{createRequire as uT}from"module";import{fileURLToPath as cT}from"url";import{Worker as dT}from"worker_threads";var fT=uT(import.meta.url);function my(e){let t=new dT(pT(),{workerData:e});t.unref();let n=new Map,r={next:0};t.on("message",o=>{let s=n.get(o.seq);s!=null&&(n.delete(o.seq),s())});let i=o=>{t.postMessage(o)};return{close:({noticeLineIfNoRrweb:o,runId:s})=>{let a=r.next;return r.next+=1,new Promise(l=>{n.set(a,l),i({noticeLineIfNoRrweb:o,runId:s,seq:a,t:"close"})})},line:({line:o,runId:s,timeNanos:a})=>{i({line:o,runId:s,t:"line",timeNanos:a})},open:({file:o,runId:s})=>{i({file:o,runId:s,t:"open"})},rrwebBatch:({data:o,runId:s})=>{i({data:o,runId:s,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function pT(){try{return fT.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(n=>cT(new URL(n,import.meta.url))),t=e.find(n=>lT(n));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as hT}from"fs/promises";import{createRequire as mT}from"module";import{fileURLToPath as yT}from"url";var gT=mT(import.meta.url);function yu(e,t){try{return gT.resolve(e)}catch{return yT(new URL(`assets/${t}`,import.meta.url))}}var bT=yu("@ripplo/browser-trace/bundle","browser-trace.js");async function gy(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await ST())}var yy;function ST(){return yy??=hT(bT,{encoding:"utf8"}),yy}import{readFile as UN}from"fs/promises";var wT=Object.defineProperty,xT=(e,t,n)=>t in e?wT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t,n)=>xT(e,typeof t!="symbol"?t+"":t,n),by,vT=Object.defineProperty,RT=(e,t,n)=>t in e?vT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sy=(e,t,n)=>RT(e,typeof t!="symbol"?t+"":t,n),Ie=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Ie||{}),wy={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},xy={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Lo={},kT=()=>!!globalThis.Zone;function wc(e){if(Lo[e])return Lo[e];let t=globalThis[e],n=t.prototype,r=e in wy?wy[e]:void 0,i=!!(r&&r.every(a=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(n,a))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),o=e in xy?xy[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof n[a]=="function"&&((l=n[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!kT())return Lo[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let u=l[e].prototype;return document.body.removeChild(a),u?Lo[e]=u:n}catch{return n}}var gu={};function Lt(e,t,n){var r;let i=`${e}.${String(n)}`;if(gu[i])return gu[i].call(t);let o=wc(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(gu[i]=s,s.call(t)):t[n]}var bu={};function bg(e,t,n){let r=`${e}.${String(n)}`;if(bu[r])return bu[r].bind(t);let o=wc(e)[n];return typeof o!="function"?t[n]:(bu[r]=o,o.bind(t))}function CT(e){return Lt("Node",e,"ownerDocument")}function ET(e){return Lt("Node",e,"childNodes")}function AT(e){return Lt("Node",e,"parentNode")}function IT(e){return Lt("Node",e,"parentElement")}function PT(e){return Lt("Node",e,"textContent")}function TT(e,t){return bg("Node",e,"contains")(t)}function MT(e){return bg("Node",e,"getRootNode")()}function OT(e){return!e||!("host"in e)?null:Lt("ShadowRoot",e,"host")}function NT(e){return e.styleSheets}function LT(e){return!e||!("shadowRoot"in e)?null:Lt("Element",e,"shadowRoot")}function $T(e,t){return Lt("Element",e,"querySelector")(t)}function _T(e,t){return Lt("Element",e,"querySelectorAll")(t)}function DT(){return wc("MutationObserver").constructor}function jT(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var De={ownerDocument:CT,childNodes:ET,parentNode:AT,parentElement:IT,textContent:PT,contains:TT,getRootNode:MT,host:OT,styleSheets:NT,shadowRoot:LT,querySelector:$T,querySelectorAll:_T,mutationObserver:DT,patch:jT};function Sg(e){return e.nodeType===e.ELEMENT_NODE}function Xr(e){let t=e&&"host"in e&&"mode"in e&&De.host(e)||null;return!!(t&&"shadowRoot"in t&&De.shadowRoot(t)===e)}function Zr(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function FT(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function BT(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function Mu(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);let r=Array.from(t,i=>wg(i,n)).join("");return FT(r)}catch{return null}}function wg(e,t){if(UT(e)){let n;try{n=Mu(e.styleSheet)||BT(e)}catch{n=e.cssText}return e.styleSheet.href?fs(n,e.styleSheet.href):n}else{let n=e.cssText;return WT(e)&&e.selectorText.includes(":")&&(n=VT(n)),t?fs(n,t):n}}function VT(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function UT(e){return"styleSheet"in e}function WT(e){return"selectorText"in e}var us=class{constructor(){Sy(this,"idNodeMap",new Map),Sy(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function zT(){return new us}function cs({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"",a=r&&Sn(r);return(t[n.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function Sn(e){return e.toLowerCase()}var vy="__rrweb_original__";function GT(e){let t=e.getContext("2d");if(!t)return!0;let n=50;for(let r=0;r<e.width;r+=n)for(let i=0;i<e.height;i+=n){let o=t.getImageData,s=vy in o?o[vy]:o;if(new Uint32Array(s.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function ds(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Sn(t):null}function xg(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r);return i?.[1]??null}function HT(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var qT=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,KT=/^(?:[a-z+]+:)?\/\//i,YT=/^www\..*/i,JT=/^(data:)([^,]*),(.*)/i;function fs(e,t){return(e||"").replace(qT,(n,r,i,o,s,a)=>{let l=i||s||a,u=r||o||"";if(!l)return n;if(KT.test(l)||YT.test(l))return`url(${u}${l}${u})`;if(JT.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${HT(t)+l}${u})`;let c=t.split("/"),d=l.split("/");c.pop();for(let f of d)f!=="."&&(f===".."?c.pop():c.push(f));return`url(${u}${c.join("/")}${u})`})}function $o(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function XT(e,t,n=!1){let r=Array.from(t.childNodes),i=[],o=0;if(r.length>1&&e&&typeof e=="string"){let s=$o(e,n),a=s.length/e.length;for(let l=1;l<r.length;l++)if(r[l].textContent&&typeof r[l].textContent=="string"){let u=$o(r[l].textContent,n),c=100,d=3;for(;d<u.length&&(u[d].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,d),1)!==-1);d++);for(;d<u.length;d++){let f=u.substring(0,d),h=s.split(f),p=-1;if(h.length===2)p=h[0].length;else if(h.length>2&&h[0]===""&&r[l-1].textContent!=="")p=s.indexOf(f,1);else if(h.length===1){if(f=f.substring(0,f.length-1),h=s.split(f),h.length<=1)return i.push(e),i;d=c+1}else d===u.length-1&&(p=s.indexOf(f));if(h.length>=2&&d>c){let m=r[l-1].textContent;if(m&&typeof m=="string"){let y=$o(m).length;p=s.indexOf(f,y)}p===-1&&(p=h[0].length)}if(p!==-1){let m=Math.floor(p/a);for(;m>0&&m<e.length;){if(o+=1,o>50*r.length)return i.push(e),i;let y=$o(e.substring(0,m),n);if(y.length===p){i.push(e.substring(0,m)),e=e.substring(m),s=s.substring(p);break}else y.length<p?m+=Math.max(1,Math.floor((p-y.length)/a)):m-=Math.max(1,Math.floor((y.length-p)*a))}break}}}}return i.push(e),i}function ZT(e,t){return XT(e,t).join("/* rr_split */")}var QT=1,eM=new RegExp("[^a-z0-9-_:]"),ei=-2;function vg(){return QT++}function tM(e){if(e instanceof HTMLFormElement)return"form";let t=Sn(e.tagName);return eM.test(t)?"div":t}var qn,Ry,nM=/^[^ \t\n\r\u000c]+/,rM=/^[, \t\n\r\u000c]+/;function iM(e,t){if(t.trim()==="")return t;let n=0;function r(o){let s,a=o.exec(t.substring(n));return a?(s=a[0],n+=s.length,s):""}let i=[];for(;r(rM),!(n>=t.length);){let o=r(nM);if(o.slice(-1)===",")o=Jn(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=Jn(e,o);let a=!1;for(;;){let l=t.charAt(n);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){n+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,n+=1}}}return i.join(", ")}var ky=new WeakMap;function Jn(e,t){return!t||t.trim()===""?t:xc(e,t)}function oM(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function xc(e,t){let n=ky.get(e);if(n||(n=e.createElement("a"),ky.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function Rg(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&["table","td","th"].includes(t)?Jn(e,r):n==="srcset"?iM(e,r):n==="style"?fs(r,xc(e)):t==="object"&&n==="data"?Jn(e,r):r)}function kg(e,t,n){return["video","audio"].includes(e)&&t==="autoplay"}function sM(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function ps(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?ps(De.parentNode(e),t,n):!1;for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}return n?ps(De.parentNode(e),t,n):!1}function Cg(e,t,n,r){let i;if(Sg(e)){if(i=e,!De.childNodes(i).length)return!1}else{if(De.parentElement(e)===null)return!1;i=De.parentElement(e)}try{if(typeof t=="string"){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(ps(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function aM(e,t,n){let r=e.contentWindow;if(!r)return;let i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function lM(e,t,n){let r=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),r=!0,t()})}function uM(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,dataURLOptions:d={},inlineImages:f,recordCanvas:h,keepIframeSrcFn:p,newlyAddedElement:m=!1,cssCaptured:y=!1}=t,S=cM(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Ie.Document,childNodes:[],compatMode:e.compatMode}:{type:Ie.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Ie.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return fM(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:d,inlineImages:f,recordCanvas:h,keepIframeSrcFn:p,newlyAddedElement:m,rootId:S});case e.TEXT_NODE:return dM(e,{doc:n,needsMask:s,maskTextFn:u,rootId:S,cssCaptured:y});case e.CDATA_SECTION_NODE:return{type:Ie.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:Ie.Comment,textContent:De.textContent(e)||"",rootId:S};default:return!1}}function cM(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function dM(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:o}=t,s=De.parentNode(e),a=s&&s.tagName,l="",u=a==="STYLE"?!0:void 0,c=a==="SCRIPT"?!0:void 0;return c?l="SCRIPT_PLACEHOLDER":o||(l=De.textContent(e),u&&l&&(l=fs(l,xc(t.doc)))),!u&&!c&&l&&n&&(l=r?r(l,De.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Ie.Text,textContent:l||"",rootId:i}}function fM(e,t){let{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:d,newlyAddedElement:f=!1,rootId:h}=t,p=sM(e,r,i),m=tM(e),y={},S=e.attributes.length;for(let g=0;g<S;g++){let v=e.attributes[g];kg(m,v.name,v.value)||(y[v.name]=Rg(n,m,Sn(v.name),v.value))}if(m==="link"&&o){let g=Array.from(n.styleSheets).find(A=>A.href===e.href),v=null;g&&(v=Mu(g)),v&&(delete y.rel,delete y.href,y._cssText=v)}if(m==="style"&&e.sheet){let g=Mu(e.sheet);g&&(e.childNodes.length>1&&(g=ZT(g,e)),y._cssText=g)}if(["input","textarea","select"].includes(m)){let g=e.value,v=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&g?y.value=cs({element:e,type:ds(e),tagName:m,value:g,maskInputOptions:s,maskInputFn:a}):v&&(y.checked=v)}if(m==="option"&&(e.selected&&!s.select?y.selected=!0:delete y.selected),m==="dialog"&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&c){if(e.__context==="2d")GT(e)||(y.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),v=n.createElement("canvas");v.width=e.width,v.height=e.height;let A=v.toDataURL(l.type,l.quality);g!==A&&(y.rr_dataURL=g)}}if(m==="img"&&u){qn||(qn=n.createElement("canvas"),Ry=qn.getContext("2d"));let g=e,v=g.currentSrc||g.getAttribute("src")||"<unknown-src>",A=g.crossOrigin,N=()=>{g.removeEventListener("load",N);try{qn.width=g.naturalWidth,qn.height=g.naturalHeight,Ry.drawImage(g,0,0),y.rr_dataURL=qn.toDataURL(l.type,l.quality)}catch(T){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?N():g.addEventListener("load",N);return}else console.warn(`Cannot inline img src=${v}! Error: ${T}`)}g.crossOrigin==="anonymous"&&(A?y.crossOrigin=A:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?N():g.addEventListener("load",N)}if(["audio","video"].includes(m)){let g=y;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),p){let{width:g,height:v}=e.getBoundingClientRect();y={class:y.class,rr_width:`${g}px`,rr_height:`${v}px`}}m==="iframe"&&!d(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let w;try{customElements.get(m)&&(w=!0)}catch{}return{type:Ie.Element,tagName:m,attributes:y,childNodes:[],isSVG:oM(e)||void 0,needBlock:p,rootId:h,isCustom:w}}function ae(e){return e==null?"":e.toLowerCase()}function Eg(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function pM(e,t){if(t.comment&&e.type===Ie.Comment)return!0;if(e.type===Ie.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&xg(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ae(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ae(e.attributes.name)==="application-name"||ae(e.attributes.rel)==="icon"||ae(e.attributes.rel)==="apple-touch-icon"||ae(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ae(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ae(e.attributes.property).match(/^(og|twitter|fb):/)||ae(e.attributes.name).match(/^(og|twitter):/)||ae(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ae(e.attributes.name)==="robots"||ae(e.attributes.name)==="googlebot"||ae(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ae(e.attributes.name)==="author"||ae(e.attributes.name)==="generator"||ae(e.attributes.name)==="framework"||ae(e.attributes.name)==="publisher"||ae(e.attributes.name)==="progid"||ae(e.attributes.property).match(/^article:/)||ae(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ae(e.attributes.name)==="google-site-verification"||ae(e.attributes.name)==="yandex-verification"||ae(e.attributes.name)==="csrf-token"||ae(e.attributes.name)==="p:domain_verify"||ae(e.attributes.name)==="verify-v1"||ae(e.attributes.name)==="verification"||ae(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Xn(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:d,maskInputFn:f,slimDOMOptions:h,dataURLOptions:p={},inlineImages:m=!1,recordCanvas:y=!1,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:A=5e3,keepIframeSrcFn:N=()=>!1,newlyAddedElement:T=!1,cssCaptured:M=!1}=t,{needsMask:I}=t,{preserveWhiteSpace:B=!0}=t;I||(I=Cg(e,s,a,I===void 0));let J=uM(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,dataURLOptions:p,inlineImages:m,recordCanvas:y,keepIframeSrcFn:N,newlyAddedElement:T,cssCaptured:M});if(!J)return console.warn(e,"not serialized"),null;let X;r.hasNode(e)?X=r.getId(e):pM(J,h)||!B&&J.type===Ie.Text&&!J.textContent.replace(/^\s+|\s+$/gm,"").length?X=ei:X=vg();let j=Object.assign(J,{id:X});if(r.add(e,j),X===ei)return null;S&&S(e);let Ne=!l;if(j.type===Ie.Element){Ne=Ne&&!j.needBlock,delete j.needBlock;let Ae=De.shadowRoot(e);Ae&&Zr(Ae)&&(j.isShadowHost=!0)}if((j.type===Ie.Document||j.type===Ie.Element)&&Ne){h.headWhitespace&&j.type===Ie.Element&&j.tagName==="head"&&(B=!1);let Ae={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:h,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:v,stylesheetLoadTimeout:A,keepIframeSrcFn:N,cssCaptured:!1};if(!(j.type===Ie.Element&&j.tagName==="textarea"&&j.attributes.value!==void 0)){j.type===Ie.Element&&j.attributes._cssText!==void 0&&typeof j.attributes._cssText=="string"&&(Ae.cssCaptured=!0);for(let on of Array.from(De.childNodes(e))){let yt=Xn(on,Ae);yt&&j.childNodes.push(yt)}}let Qe=null;if(Sg(e)&&(Qe=De.shadowRoot(e)))for(let on of Array.from(De.childNodes(Qe))){let yt=Xn(on,Ae);yt&&(Zr(Qe)&&(yt.isShadow=!0),j.childNodes.push(yt))}}let mt=De.parentNode(e);return mt&&Xr(mt)&&Zr(mt)&&(j.isShadow=!0),j.type===Ie.Element&&j.tagName==="iframe"&&aM(e,()=>{let Ae=e.contentDocument;if(Ae&&w){let Qe=Xn(Ae,{doc:Ae,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:h,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:v,stylesheetLoadTimeout:A,keepIframeSrcFn:N});Qe&&w(e,Qe)}},g),j.type===Ie.Element&&j.tagName==="link"&&typeof j.attributes.rel=="string"&&(j.attributes.rel==="stylesheet"||j.attributes.rel==="preload"&&typeof j.attributes.href=="string"&&xg(j.attributes.href)==="css")&&lM(e,()=>{if(v){let Ae=Xn(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:h,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:v,stylesheetLoadTimeout:A,keepIframeSrcFn:N});Ae&&v(e,Ae)}},A),j}function hM(e,t){let{mirror:n=new us,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:f,slimDOM:h=!1,dataURLOptions:p,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:v,keepIframeSrcFn:A=()=>!1}=t||{},N=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,T=Eg(h);return Xn(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:N,maskTextFn:d,maskInputFn:f,slimDOMOptions:T,dataURLOptions:p,inlineImages:l,recordCanvas:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:v,keepIframeSrcFn:A,newlyAddedElement:!1})}var mM=/(max|min)-device-(width|height)/,TH=new RegExp(mM.source,"g");function yM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function gM(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var vc={exports:{}},ce=String,Ag=function(){return{isColorSupported:!1,reset:ce,bold:ce,dim:ce,italic:ce,underline:ce,inverse:ce,hidden:ce,strikethrough:ce,black:ce,red:ce,green:ce,yellow:ce,blue:ce,magenta:ce,cyan:ce,white:ce,gray:ce,bgBlack:ce,bgRed:ce,bgGreen:ce,bgYellow:ce,bgBlue:ce,bgMagenta:ce,bgCyan:ce,bgWhite:ce}};vc.exports=Ag();vc.exports.createColors=Ag;var bM=vc.exports,SM={},wM=Object.freeze(Object.defineProperty({__proto__:null,default:SM},Symbol.toStringTag,{value:"Module"})),ct=gM(wM),Cy=bM,Ey=ct,Ou=class Ig extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Ig)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=Cy.isColorSupported),Ey&&t&&(n=Ey(n));let r=n.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),s=String(o).length,a,l;if(t){let{bold:u,gray:c,red:d}=Cy.createColors(!0);a=f=>u(d(f)),l=f=>c(f)}else a=l=u=>u;return r.slice(i,o).map((u,c)=>{let d=i+1+c,f=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let h=l(f.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(f)+u+`
38
- `+h+a("^")}return" "+l(f)+u}).join(`
39
- `)}toString(){let t=this.showSourceCode();return t&&(t=`
40
-
41
- `+t+`
42
- `),this.name+": "+this.message+t}},Rc=Ou;Ou.default=Ou;var ci={};ci.isClean=Symbol("isClean");ci.my=Symbol("my");var Ay={after:`
43
- `,beforeClose:`
44
- `,beforeComment:`
45
- `,beforeDecl:`
46
- `,beforeOpen:" ",beforeRule:`
47
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function xM(e){return e[0].toUpperCase()+e.slice(1)}var Nu=class{constructor(t){this.builder=t}atrule(t,n){let r="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?r+=t.raws.afterName:i&&(r+=" "),t.nodes)this.block(t,r+i);else{let o=(t.raws.between||"")+(n?";":"");this.builder(r+i+o,t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`
48
- `)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)r+=s}return r}block(t,n){let r=this.raw(t,"between","beforeOpen");this.builder(n+r+"{",t,"start");let i;t.nodes&&t.nodes.length?(this.body(t),i=this.raw(t,"after")):i=this.raw(t,"after","emptyBody"),i&&this.builder(i),this.builder("}",t,"end")}body(t){let n=t.nodes.length-1;for(;n>0&&t.nodes[n].type==="comment";)n-=1;let r=this.raw(t,"semicolon");for(let i=0;i<t.nodes.length;i++){let o=t.nodes[i],s=this.raw(o,"before");s&&this.builder(s),this.stringify(o,n!==i||r)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder("/*"+n+t.text+r+"*/",t)}decl(t,n){let r=this.raw(t,"between","colon"),i=t.prop+r+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),n&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],typeof i<"u"))return i;let o=t.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return Ay[r];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[r]<"u")return s.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let a="raw"+xM(r);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=Ay[r]),s.rawCache[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`
49
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
50
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
51
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`
52
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`
53
- `);return n=o[o.length-1],n=n.replace(/\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}},Pg=Nu;Nu.default=Nu;var vM=Pg;function Lu(e,t){new vM(t).stringify(e)}var Es=Lu;Lu.default=Lu;var{isClean:_o,my:RM}=ci,kM=Rc,CM=Pg,EM=Es;function $u(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(s=>$u(s,n)):(o==="object"&&i!==null&&(i=$u(i)),n[r]=i)}return n}var _u=class{constructor(t={}){this.raws={},this[_o]=!1,this[RM]=!0;for(let n in t)if(n==="nodes"){this.nodes=[];for(let r of t[n])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[n]=t[n]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let n=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${n.input.from}:${n.start.line}:${n.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let n in t)this[n]=t[n];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let n=$u(this);for(let r in t)n[r]=t[r];return n}cloneAfter(t={}){let n=this.clone(t);return this.parent.insertAfter(this,n),n}cloneBefore(t={}){let n=this.clone(t);return this.parent.insertBefore(this,n),n}error(t,n={}){if(this.source){let{end:r,start:i}=this.rangeBy(n);return this.source.input.error(t,{column:i.column,line:i.line},{column:r.column,line:r.line},n)}return new kM(t)}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:n==="root"?()=>t.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markDirty(){if(this[_o]){this[_o]=!1;let t=this;for(;t=t.parent;)t[_o]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,n){let r=this.source.start;if(t.index)r=this.positionInside(t.index,n);else if(t.word){n=this.toString();let i=n.indexOf(t.word);i!==-1&&(r=this.positionInside(i,n))}return r}positionInside(t,n){let r=n||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)r[s]===`
54
- `?(i=1,o+=1):i+=1;return{column:i,line:o}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let n={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:n.column+1,line:n.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(n=this.positionInside(o,i),r=this.positionInside(o+t.word.length,i))}else t.start?n={column:t.start.column,line:t.start.line}:t.index&&(n=this.positionInside(t.index)),t.end?r={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?r=this.positionInside(t.endIndex):t.index&&(r=this.positionInside(t.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line}),{end:r,start:n}}raw(t,n){return new CM().raw(this,t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let n=this,r=!1;for(let i of t)i===this?r=!0:r?(this.parent.insertAfter(n,i),n=i):this.parent.insertBefore(n,i);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,n){let r={},i=n==null;n=n||new Map;let o=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))r[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,n):l);else if(typeof a=="object"&&a.toJSON)r[s]=a.toJSON(null,n);else if(s==="source"){let l=n.get(a.input);l==null&&(l=o,n.set(a.input,o),o++),r[s]={end:a.end,inputId:l,start:a.start}}else r[s]=a}return i&&(r.inputs=[...n.keys()].map(s=>s.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=EM){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}get proxyOf(){return this}},As=_u;_u.default=_u;var AM=As,Du=class extends AM{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},Is=Du;Du.default=Du;var IM="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",PM=(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r},TM=(e=21)=>{let t="",n=e;for(;n--;)t+=IM[Math.random()*64|0];return t},MM={nanoid:TM,customAlphabet:PM},{SourceMapConsumer:Iy,SourceMapGenerator:Py}=ct,{existsSync:OM,readFileSync:NM}=ct,{dirname:Su,join:LM}=ct;function $M(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var ju=class{constructor(t,n){if(n.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=Su(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Iy(this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,o=/^data:application\/json,/;if(i.test(t)||o.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(n.test(t)||r.test(t))return $M(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let n=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t){if(this.root=Su(t),OM(t))return this.mapFile=t,NM(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof Iy)return Py.fromSourceMap(n).toString();if(n instanceof Py)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return t&&(r=LM(Su(t),r)),this.loadFile(r)}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Tg=ju;ju.default=ju;var{SourceMapConsumer:_M,SourceMapGenerator:DM}=ct,{fileURLToPath:Ty,pathToFileURL:Do}=ct,{isAbsolute:Fu,resolve:Bu}=ct,{nanoid:jM}=MM,wu=ct,My=Rc,FM=Tg,xu=Symbol("fromOffsetCache"),BM=!!(_M&&DM),Oy=!!(Bu&&Fu),hs=class{constructor(t,n={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,n.from&&(!Oy||/^\w+:\/\//.test(n.from)||Fu(n.from)?this.file=n.from:this.file=Bu(n.from)),Oy&&BM){let r=new FM(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+jM(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,s,a;if(n&&typeof n=="object"){let u=n,c=r;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);n=d.line,r=d.col}else n=u.line,r=u.column;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);s=d.line,a=d.col}else s=c.line,a=c.column}else if(!r){let u=this.fromOffset(n);n=u.line,r=u.col}let l=this.origin(n,r,s,a);return l?o=new My(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,i.plugin):o=new My(t,s===void 0?n:{column:r,line:n},s===void 0?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:n,source:this.css},this.file&&(Do&&(o.input.url=Do(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let n,r;if(this[xu])r=this[xu];else{let o=this.css.split(`
55
- `);r=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)r[a]=s,s+=o[a].length+1;this[xu]=r}n=r[r.length-1];let i=0;if(t>=n)i=r.length-1;else{let o=r.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<r[s])o=s-1;else if(t>=r[s+1])i=s+1;else{i=s;break}}return{col:t-r[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Bu(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:n,line:t});if(!s.source)return!1;let a;typeof r=="number"&&(a=o.originalPositionFor({column:i,line:r}));let l;Fu(s.source)?l=Do(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||Do(this.map.mapFile));let u={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(Ty)u.file=Ty(l);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(s.source);return c&&(u.source=c),u}toJSON(){let t={};for(let n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},Ps=hs;hs.default=hs;wu&&wu.registerInput&&wu.registerInput(hs);var{SourceMapConsumer:Mg,SourceMapGenerator:rs}=ct,{dirname:is,relative:Og,resolve:Ng,sep:Lg}=ct,{pathToFileURL:Ny}=ct,VM=Ps,UM=!!(Mg&&rs),WM=!!(is&&Ng&&Og&&Lg),zM=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let n=`
56
- `;this.css.includes(`\r
57
- `)&&(n=`\r
58
- `),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||is(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Mg(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(n)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),WM&&UM&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=rs.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new rs({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new rs({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(a,l,u)=>{if(this.css+=a,l&&u!=="end"&&(i.generated.line=t,i.generated.column=n-1,l.source&&l.source.start?(i.source=this.sourcePath(l),i.original.line=l.source.start.line,i.original.column=l.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),o=a.match(/\n/g),o?(t+=o.length,s=a.lastIndexOf(`
59
- `),n=a.length-s):n+=a.length,l&&u!=="start"){let c=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==c.last||c.raws.semicolon)&&(l.source&&l.source.end?(i.source=this.sourcePath(l),i.original.line=l.source.end.line,i.original.column=l.source.end.column-1,i.generated.line=t,i.generated.column=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?is(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=is(Ng(r,this.mapOpts.annotation)));let i=Og(r,t);return this.memoizedPaths.set(t,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new VM(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let n=this.memoizedFileURLs.get(t);if(n)return n;if(Ny){let r=Ny(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;Lg==="\\"&&(t=t.replace(/\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}},$g=zM,GM=As,Vu=class extends GM{constructor(t){super(t),this.type="comment"}},Ts=Vu;Vu.default=Vu;var{isClean:_g,my:Dg}=ci,jg=Is,Fg=Ts,HM=As,Bg,kc,Cc,Vg;function Ug(e){return e.map(t=>(t.nodes&&(t.nodes=Ug(t.nodes)),delete t.source,t))}function Wg(e){if(e[_g]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Wg(t)}var Ot=class zg extends HM{append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],i=t(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[n]+=1;return delete this.indexes[n],i}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:t[n]?n==="each"||typeof n=="string"&&n.startsWith("walk")?(...r)=>t[n](...r.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let s of i)this.proxyOf.nodes.splice(r+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],r<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,n){let r=this.index(t),i=r===0?"prepend":!1,o=this.normalize(n,this.proxyOf.nodes[r],i).reverse();r=this.index(t);for(let a of o)this.proxyOf.nodes.splice(r,0,a);let s;for(let a in this.indexes)s=this.indexes[a],r<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,n){if(typeof t=="string")t=Ug(Bg(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new jg(t)]}else if(t.selector)t=[new kc(t)];else if(t.name)t=[new Cc(t)];else if(t.text)t=[new Fg(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Dg]||zg.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[_g]&&Wg(i),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Ot.registerParse=e=>{Bg=e};Ot.registerRule=e=>{kc=e};Ot.registerAtRule=e=>{Cc=e};Ot.registerRoot=e=>{Vg=e};var wn=Ot;Ot.default=Ot;Ot.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Cc.prototype):e.type==="rule"?Object.setPrototypeOf(e,kc.prototype):e.type==="decl"?Object.setPrototypeOf(e,jg.prototype):e.type==="comment"?Object.setPrototypeOf(e,Fg.prototype):e.type==="root"&&Object.setPrototypeOf(e,Vg.prototype),e[Dg]=!0,e.nodes&&e.nodes.forEach(t=>{Ot.rebuild(t)})};var qM=wn,Gg,Hg,ti=class extends qM{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Gg(new Hg,this,t).stringify()}};ti.registerLazyResult=e=>{Gg=e};ti.registerProcessor=e=>{Hg=e};var Ec=ti;ti.default=ti;var Ly={},qg=function(t){Ly[t]||(Ly[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Uu=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},Kg=Uu;Uu.default=Uu;var KM=Kg,Wu=class{constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new KM(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},Ac=Wu;Wu.default=Wu;var vu=39,$y=34,jo=92,_y=47,Fo=10,Hr=32,Bo=12,Vo=9,Uo=13,YM=91,JM=93,XM=40,ZM=41,QM=123,eO=125,tO=59,nO=42,rO=58,iO=64,Wo=/[\t\n\f\r "#'()/;[\\\]{}]/g,zo=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,oO=/.[\r\n"'(/\\]/,Dy=/[\da-f]/i,sO=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,s,a,l,u,c,d,f,h,p,m=r.length,y=0,S=[],w=[];function g(){return y}function v(M){throw t.error("Unclosed "+M,y)}function A(){return w.length===0&&y>=m}function N(M){if(w.length)return w.pop();if(y>=m)return;let I=M?M.ignoreUnclosed:!1;switch(o=r.charCodeAt(y),o){case Fo:case Hr:case Vo:case Uo:case Bo:{s=y;do s+=1,o=r.charCodeAt(s);while(o===Hr||o===Fo||o===Vo||o===Uo||o===Bo);p=["space",r.slice(y,s)],y=s-1;break}case YM:case JM:case QM:case eO:case rO:case tO:case ZM:{let B=String.fromCharCode(o);p=[B,B,y];break}case XM:{if(f=S.length?S.pop()[1]:"",h=r.charCodeAt(y+1),f==="url"&&h!==vu&&h!==$y&&h!==Hr&&h!==Fo&&h!==Vo&&h!==Bo&&h!==Uo){s=y;do{if(c=!1,s=r.indexOf(")",s+1),s===-1)if(i||I){s=y;break}else v("bracket");for(d=s;r.charCodeAt(d-1)===jo;)d-=1,c=!c}while(c);p=["brackets",r.slice(y,s+1),y,s],y=s}else s=r.indexOf(")",y+1),l=r.slice(y,s+1),s===-1||oO.test(l)?p=["(","(",y]:(p=["brackets",l,y,s],y=s);break}case vu:case $y:{a=o===vu?"'":'"',s=y;do{if(c=!1,s=r.indexOf(a,s+1),s===-1)if(i||I){s=y+1;break}else v("string");for(d=s;r.charCodeAt(d-1)===jo;)d-=1,c=!c}while(c);p=["string",r.slice(y,s+1),y,s],y=s;break}case iO:{Wo.lastIndex=y+1,Wo.test(r),Wo.lastIndex===0?s=r.length-1:s=Wo.lastIndex-2,p=["at-word",r.slice(y,s+1),y,s],y=s;break}case jo:{for(s=y,u=!0;r.charCodeAt(s+1)===jo;)s+=1,u=!u;if(o=r.charCodeAt(s+1),u&&o!==_y&&o!==Hr&&o!==Fo&&o!==Vo&&o!==Uo&&o!==Bo&&(s+=1,Dy.test(r.charAt(s)))){for(;Dy.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===Hr&&(s+=1)}p=["word",r.slice(y,s+1),y,s],y=s;break}default:{o===_y&&r.charCodeAt(y+1)===nO?(s=r.indexOf("*/",y+2)+1,s===0&&(i||I?s=r.length:v("comment")),p=["comment",r.slice(y,s+1),y,s],y=s):(zo.lastIndex=y+1,zo.test(r),zo.lastIndex===0?s=r.length-1:s=zo.lastIndex-2,p=["word",r.slice(y,s+1),y,s],S.push(p),y=s);break}}return y++,p}function T(M){w.push(M)}return{back:T,endOfFile:A,nextToken:N,position:g}},Yg=wn,ms=class extends Yg{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},Ic=ms;ms.default=ms;Yg.registerAtRule(ms);var Jg=wn,Xg,Zg,Qn=class extends Jg{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new Xg(new Zg,this,t).stringify()}};Qn.registerLazyResult=e=>{Xg=e};Qn.registerProcessor=e=>{Zg=e};var di=Qn;Qn.default=Qn;Jg.registerRoot(Qn);var ni={comma(e){return ni.split(e,[","],!0)},space(e){let t=[" ",`
60
- `," "];return ni.split(e,t)},split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let c of e)u?u=!1:c==="\\"?u=!0:a?c===l&&(a=!1):c==='"'||c==="'"?(a=!0,l=c):c==="("?s+=1:c===")"?s>0&&(s-=1):s===0&&t.includes(c)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=c;return(n||i!=="")&&r.push(i.trim()),r}},Qg=ni;ni.default=ni;var eb=wn,aO=Qg,ys=class extends eb{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return aO.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}},Pc=ys;ys.default=ys;eb.registerRule(ys);var lO=Is,uO=sO,cO=Ts,dO=Ic,fO=di,jy=Pc,Fy={empty:!0,space:!0};function pO(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var hO=class{constructor(t){this.input=t,this.root=new fO,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let n=new dO;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){a=!0;break}else if(r==="}"){if(l.length>0){for(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(n.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(n,"params",l),s&&(t=l[l.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),a&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[s,a]of t.entries()){if(r=a,i=r[0],i==="("&&(n+=1),i===")"&&(n-=1),n===0&&i===":")if(!o)this.doubleColon(r);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=r}return!1}comment(t){let n=new cO;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=uO(this.input)}decl(t,n){let r=new lO;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||pO(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let u=t[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let u=t.length-1;u>=0;u--){if(o=t[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(t,u);c=this.spacesFromEnd(t)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=t.slice(0),d="";for(let f=u;f>0;f--){let h=c[f][0];if(d.trim().indexOf("!")===0&&h!=="space")break;d=c.pop()[1]+d}d.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=d,t=c)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=s.map(u=>u[1]).join(""),s=[]),this.raw(r,"value",s.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new jy;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],u=t;for(;u;){if(r=u[0],l.push(u),r==="("||r==="[")o||(o=u),s.push(r==="("?")":"]");else if(a&&i&&r==="{")o||(o=u),s.push("}");else if(s.length===0)if(r===";")if(i){this.decl(l,a);return}else break;else if(r==="{"){this.rule(l);return}else if(r==="}"){this.tokenizer.back(l.pop()),n=!0;break}else r===":"&&(i=!0);else r===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),s.length>0&&this.unclosedBracket(o),n&&i){if(!a)for(;l.length&&(u=l[l.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,n,r,i){let o,s,a=r.length,l="",u=!0,c,d;for(let f=0;f<a;f+=1)o=r[f],s=o[0],s==="space"&&f===a-1&&!i?u=!1:s==="comment"?(d=r[f-1]?r[f-1][0]:"empty",c=r[f+1]?r[f+1][0]:"empty",!Fy[d]&&!Fy[c]?l.slice(-1)===","?u=!1:l+=o[1]:u=!1):l+=o[1];if(!u){let f=r.reduce((h,p)=>h+p[1],"");t.raws[n]={raw:f,value:l}}t[n]=l}rule(t){t.pop();let n=new jy;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i<t.length;i++)r+=t[i][1];return t.splice(n,t.length-n),r}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,n){throw this.input.error("At-rule without name",{offset:n[2]},{offset:n[2]+n[1].length})}},mO=hO,yO=wn,gO=mO,bO=Ps;function gs(e,t){let n=new bO(e,t),r=new gO(n);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?i.message+=`
61
- You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?i.message+=`
62
- You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(i.message+=`
63
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}var Tc=gs;gs.default=gs;yO.registerParse(gs);var{isClean:xt,my:SO}=ci,wO=$g,xO=Es,vO=wn,RO=Ec,kO=qg,By=Ac,CO=Tc,EO=di,AO={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},IO={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},PO={Once:!0,postcssPlugin:!0,prepare:!0},er=0;function qr(e){return typeof e=="object"&&typeof e.then=="function"}function tb(e){let t=!1,n=AO[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,er,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,er,n+"Exit"]:[n,n+"Exit"]}function Vy(e){let t;return e.type==="document"?t=["Document",er,"DocumentExit"]:e.type==="root"?t=["Root",er,"RootExit"]:t=tb(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function zu(e){return e[xt]=!1,e.nodes&&e.nodes.forEach(t=>zu(t)),e}var Gu={},tr=class nb{constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=zu(n);else if(n instanceof nb||n instanceof By)i=zu(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=CO;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(s){this.processed=!0,this.error=s}i&&!i[SO]&&vO.rebuild(i)}this.result=new By(t,i,r),this.helpers={...Gu,postcss:Gu,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,n){let r=this.result.lastPlugin;try{if(n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=r.postcssPlugin,t.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,o=r.postcssVersion,s=this.result.processor.version,a=o.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+i+" uses "+o+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!IO[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!PO[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let n=this.plugins[t],r=this.runOnRoot(n);if(qr(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[xt];){t[xt]=!0;let n=[Vy(t)];for(;n.length>0;){let r=this.visitTick(n);if(qr(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(t,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return qr(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=xO;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let i=new wO(n,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let n=this.runOnRoot(t);if(qr(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[xt];)t[xt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return process.env.NODE_ENV!=="production"&&("from"in this.opts||kO("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(s){throw this.handleError(s,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(qr(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex<i.length){let[s,a]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=s;try{return a(r.toProxy(),this.helpers)}catch(l){throw this.handleError(l,r)}}if(n.iterator!==0){let s=n.iterator,a;for(;a=r.nodes[r.indexes[s]];)if(r.indexes[s]+=1,!a[xt]){a[xt]=!0,t.push(Vy(a));return}n.iterator=0,delete r.indexes[s]}let o=n.events;for(;n.eventIndex<o.length;){let s=o[n.eventIndex];if(n.eventIndex+=1,s===er){r.nodes&&r.nodes.length&&(r[xt]=!0,n.iterator=r.getIterator());return}else if(this.listeners[s]){n.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[xt]=!0;let n=tb(t);for(let r of n)if(r===er)t.nodes&&t.each(i=>{i[xt]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};tr.registerPostcss=e=>{Gu=e};var rb=tr;tr.default=tr;EO.registerLazyResult(tr);RO.registerLazyResult(tr);var TO=$g,MO=Es,OO=qg,NO=Tc,LO=Ac,Hu=class{constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i,o=MO;this.result=new LO(this._processor,i,this._opts),this.result.css=n;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new TO(o,i,this._opts,n);if(a.isMap()){let[l,u]=a.generate();l&&(this.result.css=l),u&&(this.result.map=u)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,n){return process.env.NODE_ENV!=="production"&&("from"in this._opts||OO("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,n)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,n=NO;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},$O=Hu;Hu.default=Hu;var _O=$O,DO=rb,jO=Ec,FO=di,ri=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(typeof r=="object"&&(r.parse||r.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new _O(this,t,n):new DO(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},BO=ri;ri.default=ri;FO.registerProcessor(ri);jO.registerProcessor(ri);var VO=Is,UO=Tg,WO=Ts,zO=Ic,GO=Ps,HO=di,qO=Pc;function ii(e,t){if(Array.isArray(e))return e.map(i=>ii(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:GO.prototype};o.map&&(o.map={...o.map,__proto__:UO.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>ii(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new HO(r);if(r.type==="decl")return new VO(r);if(r.type==="rule")return new qO(r);if(r.type==="comment")return new WO(r);if(r.type==="atrule")return new zO(r);throw new Error("Unknown node type: "+e.type)}var KO=ii;ii.default=ii;var YO=Rc,ib=Is,JO=rb,XO=wn,Mc=BO,ZO=Es,QO=KO,ob=Ec,e2=Kg,sb=Ts,ab=Ic,t2=Ac,n2=Ps,r2=Tc,i2=Qg,lb=Pc,ub=di,o2=As;function te(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Mc(e)}te.plugin=function(t,n){let r=!1;function i(...s){console&&console.warn&&!r&&(r=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
64
- https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
65
- https://www.w3ctech.com/topic/2226`));let a=n(...s);return a.postcssPlugin=t,a.postcssVersion=new Mc().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return te([i(l)]).process(s,a)},i};te.stringify=ZO;te.parse=r2;te.fromJSON=QO;te.list=i2;te.comment=e=>new sb(e);te.atRule=e=>new ab(e);te.decl=e=>new ib(e);te.rule=e=>new lb(e);te.root=e=>new ub(e);te.document=e=>new ob(e);te.CssSyntaxError=YO;te.Declaration=ib;te.Container=XO;te.Processor=Mc;te.Document=ob;te.Comment=sb;te.Warning=e2;te.AtRule=ab;te.Result=t2;te.Input=n2;te.Rule=lb;te.Root=ub;te.Node=o2;JO.registerPostcss(te);var s2=te;te.default=te;var fe=yM(s2);fe.stringify;fe.fromJSON;fe.plugin;fe.parse;fe.list;fe.document;fe.comment;fe.atRule;fe.rule;fe.decl;fe.root;fe.CssSyntaxError;fe.Declaration;fe.Container;fe.Processor;fe.Document;fe.Comment;fe.Warning;fe.AtRule;fe.Result;fe.Input;fe.Rule;fe.Root;fe.Node;var a2=Object.defineProperty,l2=(e,t,n)=>t in e?a2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rt=(e,t,n)=>l2(e,typeof t!="symbol"?t+"":t,n);function u2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c2(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Oc={exports:{}},de=String,cb=function(){return{isColorSupported:!1,reset:de,bold:de,dim:de,italic:de,underline:de,inverse:de,hidden:de,strikethrough:de,black:de,red:de,green:de,yellow:de,blue:de,magenta:de,cyan:de,white:de,gray:de,bgBlack:de,bgRed:de,bgGreen:de,bgYellow:de,bgBlue:de,bgMagenta:de,bgCyan:de,bgWhite:de}};Oc.exports=cb();Oc.exports.createColors=cb;var d2=Oc.exports,f2={},p2=Object.freeze(Object.defineProperty({__proto__:null,default:f2},Symbol.toStringTag,{value:"Module"})),dt=c2(p2),Uy=d2,Wy=dt,qu=class db extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,db)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=Uy.isColorSupported),Wy&&t&&(n=Wy(n));let r=n.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),s=String(o).length,a,l;if(t){let{bold:u,gray:c,red:d}=Uy.createColors(!0);a=f=>u(d(f)),l=f=>c(f)}else a=l=u=>u;return r.slice(i,o).map((u,c)=>{let d=i+1+c,f=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let h=l(f.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(f)+u+`
66
- `+h+a("^")}return" "+l(f)+u}).join(`
67
- `)}toString(){let t=this.showSourceCode();return t&&(t=`
68
-
69
- `+t+`
70
- `),this.name+": "+this.message+t}},Nc=qu;qu.default=qu;var fi={};fi.isClean=Symbol("isClean");fi.my=Symbol("my");var zy={after:`
71
- `,beforeClose:`
72
- `,beforeComment:`
73
- `,beforeDecl:`
74
- `,beforeOpen:" ",beforeRule:`
75
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function h2(e){return e[0].toUpperCase()+e.slice(1)}var Ku=class{constructor(t){this.builder=t}atrule(t,n){let r="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?r+=t.raws.afterName:i&&(r+=" "),t.nodes)this.block(t,r+i);else{let o=(t.raws.between||"")+(n?";":"");this.builder(r+i+o,t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`
76
- `)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)r+=s}return r}block(t,n){let r=this.raw(t,"between","beforeOpen");this.builder(n+r+"{",t,"start");let i;t.nodes&&t.nodes.length?(this.body(t),i=this.raw(t,"after")):i=this.raw(t,"after","emptyBody"),i&&this.builder(i),this.builder("}",t,"end")}body(t){let n=t.nodes.length-1;for(;n>0&&t.nodes[n].type==="comment";)n-=1;let r=this.raw(t,"semicolon");for(let i=0;i<t.nodes.length;i++){let o=t.nodes[i],s=this.raw(o,"before");s&&this.builder(s),this.stringify(o,n!==i||r)}}comment(t){let n=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder("/*"+n+t.text+r+"*/",t)}decl(t,n){let r=this.raw(t,"between","colon"),i=t.prop+r+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),n&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,n,r){let i;if(r||(r=n),n&&(i=t.raws[n],typeof i<"u"))return i;let o=t.parent;if(r==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return zy[r];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[r]<"u")return s.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let a="raw"+h2(r);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=zy[r]),s.rawCache[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`
77
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
78
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`
79
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`
80
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),n&&(n=n.replace(/\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`
81
- `);return n=o[o.length-1],n=n.replace(/\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}},fb=Ku;Ku.default=Ku;var m2=fb;function Yu(e,t){new m2(t).stringify(e)}var Ms=Yu;Yu.default=Yu;var{isClean:Go,my:y2}=fi,g2=Nc,b2=fb,S2=Ms;function Ju(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(s=>Ju(s,n)):(o==="object"&&i!==null&&(i=Ju(i)),n[r]=i)}return n}var Xu=class{constructor(t={}){this.raws={},this[Go]=!1,this[y2]=!0;for(let n in t)if(n==="nodes"){this.nodes=[];for(let r of t[n])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[n]=t[n]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let n=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${n.input.from}:${n.start.line}:${n.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let n in t)this[n]=t[n];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let n=Ju(this);for(let r in t)n[r]=t[r];return n}cloneAfter(t={}){let n=this.clone(t);return this.parent.insertAfter(this,n),n}cloneBefore(t={}){let n=this.clone(t);return this.parent.insertBefore(this,n),n}error(t,n={}){if(this.source){let{end:r,start:i}=this.rangeBy(n);return this.source.input.error(t,{column:i.column,line:i.line},{column:r.column,line:r.line},n)}return new g2(t)}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:n==="root"?()=>t.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markDirty(){if(this[Go]){this[Go]=!1;let t=this;for(;t=t.parent;)t[Go]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,n){let r=this.source.start;if(t.index)r=this.positionInside(t.index,n);else if(t.word){n=this.toString();let i=n.indexOf(t.word);i!==-1&&(r=this.positionInside(i,n))}return r}positionInside(t,n){let r=n||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)r[s]===`
82
- `?(i=1,o+=1):i+=1;return{column:i,line:o}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let n={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:n.column+1,line:n.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(n=this.positionInside(o,i),r=this.positionInside(o+t.word.length,i))}else t.start?n={column:t.start.column,line:t.start.line}:t.index&&(n=this.positionInside(t.index)),t.end?r={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?r=this.positionInside(t.endIndex):t.index&&(r=this.positionInside(t.index+1));return(r.line<n.line||r.line===n.line&&r.column<=n.column)&&(r={column:n.column+1,line:n.line}),{end:r,start:n}}raw(t,n){return new b2().raw(this,t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let n=this,r=!1;for(let i of t)i===this?r=!0:r?(this.parent.insertAfter(n,i),n=i):this.parent.insertBefore(n,i);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,n){let r={},i=n==null;n=n||new Map;let o=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))r[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,n):l);else if(typeof a=="object"&&a.toJSON)r[s]=a.toJSON(null,n);else if(s==="source"){let l=n.get(a.input);l==null&&(l=o,n.set(a.input,o),o++),r[s]={end:a.end,inputId:l,start:a.start}}else r[s]=a}return i&&(r.inputs=[...n.keys()].map(s=>s.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=S2){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}get proxyOf(){return this}},Os=Xu;Xu.default=Xu;var w2=Os,Zu=class extends w2{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},Ns=Zu;Zu.default=Zu;var x2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",v2=(e,t=21)=>(n=t)=>{let r="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r},R2=(e=21)=>{let t="",n=e;for(;n--;)t+=x2[Math.random()*64|0];return t},k2={nanoid:R2,customAlphabet:v2},{SourceMapConsumer:Gy,SourceMapGenerator:Hy}=dt,{existsSync:C2,readFileSync:E2}=dt,{dirname:Ru,join:A2}=dt;function I2(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Qu=class{constructor(t,n){if(n.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=Ru(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Gy(this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,o=/^data:application\/json,/;if(i.test(t)||o.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(n.test(t)||r.test(t))return I2(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let n=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t){if(this.root=Ru(t),C2(t))return this.mapFile=t,E2(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof Gy)return Hy.fromSourceMap(n).toString();if(n instanceof Hy)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return t&&(r=A2(Ru(t),r)),this.loadFile(r)}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},pb=Qu;Qu.default=Qu;var{SourceMapConsumer:P2,SourceMapGenerator:T2}=dt,{fileURLToPath:qy,pathToFileURL:Ho}=dt,{isAbsolute:ec,resolve:tc}=dt,{nanoid:M2}=k2,ku=dt,Ky=Nc,O2=pb,Cu=Symbol("fromOffsetCache"),N2=!!(P2&&T2),Yy=!!(tc&&ec),bs=class{constructor(t,n={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,n.from&&(!Yy||/^\w+:\/\//.test(n.from)||ec(n.from)?this.file=n.from:this.file=tc(n.from)),Yy&&N2){let r=new O2(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+M2(6)+">"),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,s,a;if(n&&typeof n=="object"){let u=n,c=r;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);n=d.line,r=d.col}else n=u.line,r=u.column;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);s=d.line,a=d.col}else s=c.line,a=c.column}else if(!r){let u=this.fromOffset(n);n=u.line,r=u.col}let l=this.origin(n,r,s,a);return l?o=new Ky(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,i.plugin):o=new Ky(t,s===void 0?n:{column:r,line:n},s===void 0?r:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:r,endColumn:a,endLine:s,line:n,source:this.css},this.file&&(Ho&&(o.input.url=Ho(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let n,r;if(this[Cu])r=this[Cu];else{let o=this.css.split(`
83
- `);r=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)r[a]=s,s+=o[a].length+1;this[Cu]=r}n=r[r.length-1];let i=0;if(t>=n)i=r.length-1;else{let o=r.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<r[s])o=s-1;else if(t>=r[s+1])i=s+1;else{i=s;break}}return{col:t-r[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:tc(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:n,line:t});if(!s.source)return!1;let a;typeof r=="number"&&(a=o.originalPositionFor({column:i,line:r}));let l;ec(s.source)?l=Ho(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||Ho(this.map.mapFile));let u={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(qy)u.file=qy(l);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(s.source);return c&&(u.source=c),u}toJSON(){let t={};for(let n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},Ls=bs;bs.default=bs;ku&&ku.registerInput&&ku.registerInput(bs);var{SourceMapConsumer:hb,SourceMapGenerator:os}=dt,{dirname:ss,relative:mb,resolve:yb,sep:gb}=dt,{pathToFileURL:Jy}=dt,L2=Ls,$2=!!(hb&&os),_2=!!(ss&&yb&&mb&&gb),D2=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let n=`
84
- `;this.css.includes(`\r
85
- `)&&(n=`\r
86
- `),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||ss(t.file),i;this.mapOpts.sourcesContent===!1?(i=new hb(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(n)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),_2&&$2&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=os.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new os({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new os({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(a,l,u)=>{if(this.css+=a,l&&u!=="end"&&(i.generated.line=t,i.generated.column=n-1,l.source&&l.source.start?(i.source=this.sourcePath(l),i.original.line=l.source.start.line,i.original.column=l.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),o=a.match(/\n/g),o?(t+=o.length,s=a.lastIndexOf(`
87
- `),n=a.length-s):n+=a.length,l&&u!=="start"){let c=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==c.last||c.raws.semicolon)&&(l.source&&l.source.end?(i.source=this.sourcePath(l),i.original.line=l.source.end.line,i.original.column=l.source.end.column-1,i.generated.line=t,i.generated.column=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?ss(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=ss(yb(r,this.mapOpts.annotation)));let i=mb(r,t);return this.memoizedPaths.set(t,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new L2(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(n,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let n=this.memoizedFileURLs.get(t);if(n)return n;if(Jy){let r=Jy(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;gb==="\\"&&(t=t.replace(/\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}},bb=D2,j2=Os,nc=class extends j2{constructor(t){super(t),this.type="comment"}},$s=nc;nc.default=nc;var{isClean:Sb,my:wb}=fi,xb=Ns,vb=$s,F2=Os,Rb,Lc,$c,kb;function Cb(e){return e.map(t=>(t.nodes&&(t.nodes=Cb(t.nodes)),delete t.source,t))}function Eb(e){if(e[Sb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Eb(t)}var Nt=class Ab extends F2{append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]<this.proxyOf.nodes.length&&(r=this.indexes[n],i=t(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[n]+=1;return delete this.indexes[n],i}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,n){return n==="proxyOf"?t:t[n]?n==="each"||typeof n=="string"&&n.startsWith("walk")?(...r)=>t[n](...r.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let s of i)this.proxyOf.nodes.splice(r+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],r<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,n){let r=this.index(t),i=r===0?"prepend":!1,o=this.normalize(n,this.proxyOf.nodes[r],i).reverse();r=this.index(t);for(let a of o)this.proxyOf.nodes.splice(r,0,a);let s;for(let a in this.indexes)s=this.indexes[a],r<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,n){if(typeof t=="string")t=Cb(Rb(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new xb(t)]}else if(t.selector)t=[new Lc(t)];else if(t.name)t=[new $c(t)];else if(t.text)t=[new vb(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[wb]||Ab.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Sb]&&Eb(i),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Nt.registerParse=e=>{Rb=e};Nt.registerRule=e=>{Lc=e};Nt.registerAtRule=e=>{$c=e};Nt.registerRoot=e=>{kb=e};var xn=Nt;Nt.default=Nt;Nt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,$c.prototype):e.type==="rule"?Object.setPrototypeOf(e,Lc.prototype):e.type==="decl"?Object.setPrototypeOf(e,xb.prototype):e.type==="comment"?Object.setPrototypeOf(e,vb.prototype):e.type==="root"&&Object.setPrototypeOf(e,kb.prototype),e[wb]=!0,e.nodes&&e.nodes.forEach(t=>{Nt.rebuild(t)})};var B2=xn,Ib,Pb,oi=class extends B2{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Ib(new Pb,this,t).stringify()}};oi.registerLazyResult=e=>{Ib=e};oi.registerProcessor=e=>{Pb=e};var _c=oi;oi.default=oi;var Xy={},Tb=function(t){Xy[t]||(Xy[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},rc=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},Mb=rc;rc.default=rc;var V2=Mb,ic=class{constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new V2(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},Dc=ic;ic.default=ic;var Eu=39,Zy=34,qo=92,Qy=47,Ko=10,Kr=32,Yo=12,Jo=9,Xo=13,U2=91,W2=93,z2=40,G2=41,H2=123,q2=125,K2=59,Y2=42,J2=58,X2=64,Zo=/[\t\n\f\r "#'()/;[\\\]{}]/g,Qo=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Z2=/.[\r\n"'(/\\]/,eg=/[\da-f]/i,Q2=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,s,a,l,u,c,d,f,h,p,m=r.length,y=0,S=[],w=[];function g(){return y}function v(M){throw t.error("Unclosed "+M,y)}function A(){return w.length===0&&y>=m}function N(M){if(w.length)return w.pop();if(y>=m)return;let I=M?M.ignoreUnclosed:!1;switch(o=r.charCodeAt(y),o){case Ko:case Kr:case Jo:case Xo:case Yo:{s=y;do s+=1,o=r.charCodeAt(s);while(o===Kr||o===Ko||o===Jo||o===Xo||o===Yo);p=["space",r.slice(y,s)],y=s-1;break}case U2:case W2:case H2:case q2:case J2:case K2:case G2:{let B=String.fromCharCode(o);p=[B,B,y];break}case z2:{if(f=S.length?S.pop()[1]:"",h=r.charCodeAt(y+1),f==="url"&&h!==Eu&&h!==Zy&&h!==Kr&&h!==Ko&&h!==Jo&&h!==Yo&&h!==Xo){s=y;do{if(c=!1,s=r.indexOf(")",s+1),s===-1)if(i||I){s=y;break}else v("bracket");for(d=s;r.charCodeAt(d-1)===qo;)d-=1,c=!c}while(c);p=["brackets",r.slice(y,s+1),y,s],y=s}else s=r.indexOf(")",y+1),l=r.slice(y,s+1),s===-1||Z2.test(l)?p=["(","(",y]:(p=["brackets",l,y,s],y=s);break}case Eu:case Zy:{a=o===Eu?"'":'"',s=y;do{if(c=!1,s=r.indexOf(a,s+1),s===-1)if(i||I){s=y+1;break}else v("string");for(d=s;r.charCodeAt(d-1)===qo;)d-=1,c=!c}while(c);p=["string",r.slice(y,s+1),y,s],y=s;break}case X2:{Zo.lastIndex=y+1,Zo.test(r),Zo.lastIndex===0?s=r.length-1:s=Zo.lastIndex-2,p=["at-word",r.slice(y,s+1),y,s],y=s;break}case qo:{for(s=y,u=!0;r.charCodeAt(s+1)===qo;)s+=1,u=!u;if(o=r.charCodeAt(s+1),u&&o!==Qy&&o!==Kr&&o!==Ko&&o!==Jo&&o!==Xo&&o!==Yo&&(s+=1,eg.test(r.charAt(s)))){for(;eg.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===Kr&&(s+=1)}p=["word",r.slice(y,s+1),y,s],y=s;break}default:{o===Qy&&r.charCodeAt(y+1)===Y2?(s=r.indexOf("*/",y+2)+1,s===0&&(i||I?s=r.length:v("comment")),p=["comment",r.slice(y,s+1),y,s],y=s):(Qo.lastIndex=y+1,Qo.test(r),Qo.lastIndex===0?s=r.length-1:s=Qo.lastIndex-2,p=["word",r.slice(y,s+1),y,s],S.push(p),y=s);break}}return y++,p}function T(M){w.push(M)}return{back:T,endOfFile:A,nextToken:N,position:g}},Ob=xn,Ss=class extends Ob{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},jc=Ss;Ss.default=Ss;Ob.registerAtRule(Ss);var Nb=xn,Lb,$b,nr=class extends Nb{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new Lb(new $b,this,t).stringify()}};nr.registerLazyResult=e=>{Lb=e};nr.registerProcessor=e=>{$b=e};var pi=nr;nr.default=nr;Nb.registerRoot(nr);var si={comma(e){return si.split(e,[","],!0)},space(e){let t=[" ",`
88
- `," "];return si.split(e,t)},split(e,t,n){let r=[],i="",o=!1,s=0,a=!1,l="",u=!1;for(let c of e)u?u=!1:c==="\\"?u=!0:a?c===l&&(a=!1):c==='"'||c==="'"?(a=!0,l=c):c==="("?s+=1:c===")"?s>0&&(s-=1):s===0&&t.includes(c)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=c;return(n||i!=="")&&r.push(i.trim()),r}},_b=si;si.default=si;var Db=xn,e6=_b,ws=class extends Db{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return e6.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}},Fc=ws;ws.default=ws;Db.registerRule(ws);var t6=Ns,n6=Q2,r6=$s,i6=jc,o6=pi,tg=Fc,ng={empty:!0,space:!0};function s6(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var a6=class{constructor(t){this.input=t,this.root=new o6,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let n=new i6;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,s=!1,a=!1,l=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){a=!0;break}else if(r==="}"){if(l.length>0){for(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(n.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(n,"params",l),s&&(t=l[l.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),a&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[s,a]of t.entries()){if(r=a,i=r[0],i==="("&&(n+=1),i===")"&&(n-=1),n===0&&i===":")if(!o)this.doubleColon(r);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=r}return!1}comment(t){let n=new r6;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(/^\s*$/.test(r))n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=n6(this.input)}decl(t,n){let r=new t6;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||s6(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let u=t[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let u=t.length-1;u>=0;u--){if(o=t[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(t,u);c=this.spacesFromEnd(t)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=t.slice(0),d="";for(let f=u;f>0;f--){let h=c[f][0];if(d.trim().indexOf("!")===0&&h!=="space")break;d=c.pop()[1]+d}d.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=d,t=c)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=s.map(u=>u[1]).join(""),s=[]),this.raw(r,"value",s.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new tg;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],u=t;for(;u;){if(r=u[0],l.push(u),r==="("||r==="[")o||(o=u),s.push(r==="("?")":"]");else if(a&&i&&r==="{")o||(o=u),s.push("}");else if(s.length===0)if(r===";")if(i){this.decl(l,a);return}else break;else if(r==="{"){this.rule(l);return}else if(r==="}"){this.tokenizer.back(l.pop()),n=!0;break}else r===":"&&(i=!0);else r===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),s.length>0&&this.unclosedBracket(o),n&&i){if(!a)for(;l.length&&(u=l[l.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,n,r,i){let o,s,a=r.length,l="",u=!0,c,d;for(let f=0;f<a;f+=1)o=r[f],s=o[0],s==="space"&&f===a-1&&!i?u=!1:s==="comment"?(d=r[f-1]?r[f-1][0]:"empty",c=r[f+1]?r[f+1][0]:"empty",!ng[d]&&!ng[c]?l.slice(-1)===","?u=!1:l+=o[1]:u=!1):l+=o[1];if(!u){let f=r.reduce((h,p)=>h+p[1],"");t.raws[n]={raw:f,value:l}}t[n]=l}rule(t){t.pop();let n=new tg;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i<t.length;i++)r+=t[i][1];return t.splice(n,t.length-n),r}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,n){throw this.input.error("At-rule without name",{offset:n[2]},{offset:n[2]+n[1].length})}},l6=a6,u6=xn,c6=l6,d6=Ls;function xs(e,t){let n=new d6(e,t),r=new c6(n);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?i.message+=`
89
- You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?i.message+=`
90
- You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(i.message+=`
91
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}var Bc=xs;xs.default=xs;u6.registerParse(xs);var{isClean:vt,my:f6}=fi,p6=bb,h6=Ms,m6=xn,y6=_c,g6=Tb,rg=Dc,b6=Bc,S6=pi,w6={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},x6={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},v6={Once:!0,postcssPlugin:!0,prepare:!0},rr=0;function Yr(e){return typeof e=="object"&&typeof e.then=="function"}function jb(e){let t=!1,n=w6[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,rr,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,rr,n+"Exit"]:[n,n+"Exit"]}function ig(e){let t;return e.type==="document"?t=["Document",rr,"DocumentExit"]:e.type==="root"?t=["Root",rr,"RootExit"]:t=jb(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function oc(e){return e[vt]=!1,e.nodes&&e.nodes.forEach(t=>oc(t)),e}var sc={},ir=class Fb{constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=oc(n);else if(n instanceof Fb||n instanceof rg)i=oc(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=b6;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(s){this.processed=!0,this.error=s}i&&!i[f6]&&m6.rebuild(i)}this.result=new rg(t,i,r),this.helpers={...sc,postcss:sc,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,n){let r=this.result.lastPlugin;try{if(n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=r.postcssPlugin,t.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,o=r.postcssVersion,s=this.result.processor.version,a=o.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+i+" uses "+o+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!x6[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!v6[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let n=this.plugins[t],r=this.runOnRoot(n);if(Yr(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[vt];){t[vt]=!0;let n=[ig(t)];for(;n.length>0;){let r=this.visitTick(n);if(Yr(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(t,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return Yr(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=h6;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let i=new p6(n,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let n=this.runOnRoot(t);if(Yr(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[vt];)t[vt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return process.env.NODE_ENV!=="production"&&("from"in this.opts||g6("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(s){throw this.handleError(s,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(Yr(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex<i.length){let[s,a]=i[n.visitorIndex];n.visitorIndex+=1,n.visitorIndex===i.length&&(n.visitors=[],n.visitorIndex=0),this.result.lastPlugin=s;try{return a(r.toProxy(),this.helpers)}catch(l){throw this.handleError(l,r)}}if(n.iterator!==0){let s=n.iterator,a;for(;a=r.nodes[r.indexes[s]];)if(r.indexes[s]+=1,!a[vt]){a[vt]=!0,t.push(ig(a));return}n.iterator=0,delete r.indexes[s]}let o=n.events;for(;n.eventIndex<o.length;){let s=o[n.eventIndex];if(n.eventIndex+=1,s===rr){r.nodes&&r.nodes.length&&(r[vt]=!0,n.iterator=r.getIterator());return}else if(this.listeners[s]){n.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[vt]=!0;let n=jb(t);for(let r of n)if(r===rr)t.nodes&&t.each(i=>{i[vt]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};ir.registerPostcss=e=>{sc=e};var Bb=ir;ir.default=ir;S6.registerLazyResult(ir);y6.registerLazyResult(ir);var R6=bb,k6=Ms,C6=Tb,E6=Bc,A6=Dc,ac=class{constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i,o=k6;this.result=new A6(this._processor,i,this._opts),this.result.css=n;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new R6(o,i,this._opts,n);if(a.isMap()){let[l,u]=a.generate();l&&(this.result.css=l),u&&(this.result.map=u)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,n){return process.env.NODE_ENV!=="production"&&("from"in this._opts||C6("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,n)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,n=E6;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},I6=ac;ac.default=ac;var P6=I6,T6=Bb,M6=_c,O6=pi,ai=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(typeof r=="object"&&(r.parse||r.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new P6(this,t,n):new T6(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},N6=ai;ai.default=ai;O6.registerProcessor(ai);M6.registerProcessor(ai);var L6=Ns,$6=pb,_6=$s,D6=jc,j6=Ls,F6=pi,B6=Fc;function li(e,t){if(Array.isArray(e))return e.map(i=>li(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:j6.prototype};o.map&&(o.map={...o.map,__proto__:$6.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>li(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new F6(r);if(r.type==="decl")return new L6(r);if(r.type==="rule")return new B6(r);if(r.type==="comment")return new _6(r);if(r.type==="atrule")return new D6(r);throw new Error("Unknown node type: "+e.type)}var V6=li;li.default=li;var U6=Nc,Vb=Ns,W6=Bb,z6=xn,Vc=N6,G6=Ms,H6=V6,Ub=_c,q6=Mb,Wb=$s,zb=jc,K6=Dc,Y6=Ls,J6=Bc,X6=_b,Gb=Fc,Hb=pi,Z6=Os;function ne(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Vc(e)}ne.plugin=function(t,n){let r=!1;function i(...s){console&&console.warn&&!r&&(r=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
92
- https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
93
- https://www.w3ctech.com/topic/2226`));let a=n(...s);return a.postcssPlugin=t,a.postcssVersion=new Vc().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return ne([i(l)]).process(s,a)},i};ne.stringify=G6;ne.parse=J6;ne.fromJSON=H6;ne.list=X6;ne.comment=e=>new Wb(e);ne.atRule=e=>new zb(e);ne.decl=e=>new Vb(e);ne.rule=e=>new Gb(e);ne.root=e=>new Hb(e);ne.document=e=>new Ub(e);ne.CssSyntaxError=U6;ne.Declaration=Vb;ne.Container=z6;ne.Processor=Vc;ne.Document=Ub;ne.Comment=Wb;ne.Warning=q6;ne.AtRule=zb;ne.Result=K6;ne.Input=Y6;ne.Rule=Gb;ne.Root=Hb;ne.Node=Z6;W6.registerPostcss(ne);var Q6=ne;ne.default=ne;var pe=u2(Q6);pe.stringify;pe.fromJSON;pe.plugin;pe.parse;pe.list;pe.document;pe.comment;pe.atRule;pe.rule;pe.decl;pe.root;pe.CssSyntaxError;pe.Declaration;pe.Container;pe.Processor;pe.Document;pe.Comment;pe.Warning;pe.AtRule;pe.Result;pe.Input;pe.Rule;pe.Root;pe.Node;var lc=class e{constructor(...t){rt(this,"parentElement",null),rt(this,"parentNode",null),rt(this,"ownerDocument"),rt(this,"firstChild",null),rt(this,"lastChild",null),rt(this,"previousSibling",null),rt(this,"nextSibling",null),rt(this,"ELEMENT_NODE",1),rt(this,"TEXT_NODE",3),rt(this,"nodeType"),rt(this,"nodeName"),rt(this,"RRNodeType")}get childNodes(){let t=[],n=this.firstChild;for(;n;)t.push(n),n=n.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,n){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};var og={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},sg={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},es={},eN=()=>!!globalThis.Zone;function Uc(e){if(es[e])return es[e];let t=globalThis[e],n=t.prototype,r=e in og?og[e]:void 0,i=!!(r&&r.every(a=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(n,a))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),o=e in sg?sg[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof n[a]=="function"&&((l=n[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!eN())return es[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let u=l[e].prototype;return document.body.removeChild(a),u?es[e]=u:n}catch{return n}}var Au={};function $t(e,t,n){var r;let i=`${e}.${String(n)}`;if(Au[i])return Au[i].call(t);let o=Uc(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(Au[i]=s,s.call(t)):t[n]}var Iu={};function qb(e,t,n){let r=`${e}.${String(n)}`;if(Iu[r])return Iu[r].bind(t);let o=Uc(e)[n];return typeof o!="function"?t[n]:(Iu[r]=o,o.bind(t))}function tN(e){return $t("Node",e,"ownerDocument")}function nN(e){return $t("Node",e,"childNodes")}function rN(e){return $t("Node",e,"parentNode")}function iN(e){return $t("Node",e,"parentElement")}function oN(e){return $t("Node",e,"textContent")}function sN(e,t){return qb("Node",e,"contains")(t)}function aN(e){return qb("Node",e,"getRootNode")()}function lN(e){return!e||!("host"in e)?null:$t("ShadowRoot",e,"host")}function uN(e){return e.styleSheets}function cN(e){return!e||!("shadowRoot"in e)?null:$t("Element",e,"shadowRoot")}function dN(e,t){return $t("Element",e,"querySelector")(t)}function fN(e,t){return $t("Element",e,"querySelectorAll")(t)}function Kb(){return Uc("MutationObserver").constructor}function vn(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var U={ownerDocument:tN,childNodes:nN,parentNode:rN,parentElement:iN,textContent:oN,contains:sN,getRootNode:aN,host:lN,styleSheets:uN,shadowRoot:cN,querySelector:dN,querySelectorAll:fN,mutationObserver:Kb,patch:vn};function Fe(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var Kn=`Please stop import mirror directly. Instead of that,\r
94
- now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
95
- or you can use record.mirror to access the mirror instance during recording.`,ag={map:{},getId(){return console.error(Kn),-1},getNode(){return console.error(Kn),null},removeNodeFromMap(){console.error(Kn)},has(){return console.error(Kn),!1},reset(){console.error(Kn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ag=new Proxy(ag,{get(e,t,n){return t==="map"&&console.error(Kn),Reflect.get(e,t,n)}}));function ui(e,t,n={}){let r=null,i=0;return function(...o){let s=Date.now();!i&&n.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(l,o)},a))}}function _s(e,t,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(s){setTimeout(()=>{n.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>_s(e,t,o||{},!0)}var vs=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(vs=()=>new Date().getTime());function Yb(e){var t,n,r,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=U.parentElement(o.body))==null?void 0:t.scrollLeft)||((n=o?.body)==null?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((r=U.parentElement(o.body))==null?void 0:r.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function Jb(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Xb(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Zb(e){return e?e.nodeType===e.ELEMENT_NODE?e:U.parentElement(e):null}function Be(e,t,n,r){if(!e)return!1;let i=Zb(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||r&&i.closest("."+t)!==null)return!0}else if(ps(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function pN(e,t){return t.getId(e)!==-1}function Pu(e,t,n){return e.tagName==="TITLE"&&n.headTitleMutations?!0:t.getId(e)===ei}function Qb(e,t){if(Xr(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=U.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:r?Qb(r,t):!0}function uc(e){return!!e.changedTouches}function hN(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function eS(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function tS(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function cc(e){return e?e instanceof lc&&"shadowRoot"in e?!!e.shadowRoot:!!U.shadowRoot(e):!1}var dc=class{constructor(){C(this,"id",1),C(this,"styleIDMap",new WeakMap),C(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function nS(e){var t;let n=null;return"getRootNode"in e&&((t=U.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&U.host(U.getRootNode(e))&&(n=U.host(U.getRootNode(e))),n}function mN(e){let t=e,n;for(;n=nS(t);)t=n;return t}function yN(e){let t=U.ownerDocument(e);if(!t)return!1;let n=mN(e);return U.contains(t,n)}function rS(e){let t=U.ownerDocument(e);return t?U.contains(t,e)||yN(e):!1}var H=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(H||{}),W=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(W||{}),We=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(We||{}),Mt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Mt||{}),or=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(or||{}),Yn=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Yn||{});var iS=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(iS||{});function lg(e){return"__ln"in e}var fc=class{constructor(){C(this,"length",0),C(this,"head",null),C(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=n?.next||null;return n}addNode(t){let n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&lg(t.previousSibling)){let r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&lg(t.nextSibling)&&t.nextSibling.__ln.previous){let r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){let n=t.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},ug=(e,t)=>`${e}@${t}`,pc=class{constructor(){C(this,"frozen",!1),C(this,"locked",!1),C(this,"texts",[]),C(this,"attributes",[]),C(this,"attributeMap",new WeakMap),C(this,"removes",[]),C(this,"mapRemoves",[]),C(this,"movedMap",{}),C(this,"addedSet",new Set),C(this,"movedSet",new Set),C(this,"droppedSet",new Set),C(this,"removesSubTreeCache",new Set),C(this,"mutationCb"),C(this,"blockClass"),C(this,"blockSelector"),C(this,"maskTextClass"),C(this,"maskTextSelector"),C(this,"inlineStylesheet"),C(this,"maskInputOptions"),C(this,"maskTextFn"),C(this,"maskInputFn"),C(this,"keepIframeSrcFn"),C(this,"recordCanvas"),C(this,"inlineImages"),C(this,"slimDOMOptions"),C(this,"dataURLOptions"),C(this,"doc"),C(this,"mirror"),C(this,"iframeManager"),C(this,"stylesheetManager"),C(this,"shadowDomManager"),C(this,"canvasManager"),C(this,"processedNodeManager"),C(this,"unattachedDoc"),C(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),C(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],n=new Set,r=new fc,i=l=>{let u=l,c=ei;for(;c===ei;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},o=l=>{let u=U.parentNode(l);if(!u||!rS(l))return;let c=!1;if(l.nodeType===Node.TEXT_NODE){let p=u.tagName;if(p==="TEXTAREA")return;p==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let d=Xr(u)?this.mirror.getId(nS(l)):this.mirror.getId(u),f=i(l);if(d===-1||f===-1)return r.addNode(l);let h=Xn(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:p=>{eS(p,this.mirror)&&this.iframeManager.addIframe(p),tS(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),cc(l)&&this.shadowDomManager.addShadowRoot(U.shadowRoot(l),this.doc)},onIframeLoad:(p,m)=>{this.iframeManager.attachIframe(p,m),this.shadowDomManager.observeAttachShadow(p)},onStylesheetLoad:(p,m)=>{this.stylesheetManager.attachLinkElement(p,m)},cssCaptured:c});h&&(t.push({parentId:d,nextId:f,node:h}),n.add(h.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)cg(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(U.parentNode(l))||o(l);for(let l of this.addedSet)!dg(this.droppedSet,l)&&!cg(this.removesSubTreeCache,l,this.mirror)||dg(this.movedSet,l)?o(l):this.droppedSet.add(l);let s=null;for(;r.length;){let l=null;if(s){let u=this.mirror.getId(U.parentNode(s.value)),c=i(s.value);u!==-1&&c!==-1&&(l=s)}if(!l){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let d=this.mirror.getId(U.parentNode(c.value));if(i(c.value)===-1)continue;if(d!==-1){l=c;break}else{let h=c.value,p=U.parentNode(h);if(p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=U.host(p);if(this.mirror.getId(m)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}s=l.previous,r.removeNode(l.value),o(l.value)}let a={texts:this.texts.map(l=>{let u=l.node,c=U.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:l.value}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:u}=l;if(typeof u.style=="string"){let c=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+d).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(a))}),C(this,"genTextAreaValueMutation",t=>{let n=this.attributeMap.get(t);n||(n={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(t,n));let r=Array.from(U.childNodes(t),i=>U.textContent(i)||"").join("");n.attributes.value=cs({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ds(t),value:r,maskInputFn:this.maskInputFn})}),C(this,"processMutation",t=>{if(!Pu(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let n=U.textContent(t.target);!Be(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:Cg(t.target,this.maskTextClass,this.maskTextSelector,!0)&&n?this.maskTextFn?this.maskTextFn(n,Zb(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=t.attributeName,i=t.target.getAttribute(r);if(r==="value"){let s=ds(n);i=cs({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(Be(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!n.contentDocument)r="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),r==="type"&&n.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!kg(n.tagName,r))if(o.attributes[r]=Rg(this.doc,Sn(n.tagName),Sn(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let s=this.unattachedDoc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(let a of Array.from(n.style)){let l=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||u!==s.style.getPropertyPriority(a)?u===""?o.styleDiff[a]=l:o.styleDiff[a]=[l,u]:o._unchangedStyles[a]=[l,u]}for(let a of Array.from(s.style))n.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else r==="open"&&n.tagName==="DIALOG"&&(n.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(Be(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{let r=this.mirror.getId(n),i=Xr(t.target)?this.mirror.getId(U.host(t.target)):this.mirror.getId(t.target);Be(t.target,this.blockClass,this.blockSelector,!1)||Pu(n,this.mirror,this.slimDOMOptions)||!pN(n,this.mirror)||(this.addedSet.has(n)?(hc(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Qb(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[ug(r,i)]?hc(this.movedSet,n):(this.removes.push({parentId:i,id:r,isShadow:Xr(t.target)&&Zr(t.target)?!0:void 0}),gN(n,this.removesSubTreeCache))),this.mapRemoves.push(n))});break}}}),C(this,"genAdds",(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Pu(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[ug(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Be(t,this.blockClass,this.blockSelector,!1)||(U.childNodes(t).forEach(r=>this.genAdds(r)),cc(t)&&U.childNodes(U.shadowRoot(t)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function hc(e,t){e.delete(t),U.childNodes(t).forEach(n=>hc(e,n))}function gN(e,t){let n=[e];for(;n.length;){let r=n.pop();t.has(r)||(t.add(r),U.childNodes(r).forEach(i=>n.push(i)))}}function cg(e,t,n){return e.size===0?!1:bN(e,t)}function bN(e,t,n){let r=U.parentNode(t);return r?e.has(r):!1}function dg(e,t){return e.size===0?!1:oS(e,t)}function oS(e,t){let n=U.parentNode(t);return n?e.has(n)?!0:oS(e,n):!1}var Qr;function SN(e){Qr=e}function wN(){Qr=void 0}var Y=e=>Qr?(...n)=>{try{return e(...n)}catch(r){if(Qr&&Qr(r)===!0)return;throw r}}:e,bn=[];function hi(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function sS(e,t){let n=new pc;bn.push(n),n.init(e);let r=new(Kb())(Y(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function xN({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=ui(Y(d=>{let f=Date.now()-a;e(s.map(h=>(h.timeOffset-=f,h)),d),s=[],a=null}),o),u=Y(ui(Y(d=>{let f=hi(d),{clientX:h,clientY:p}=uc(d)?d.changedTouches[0]:d;a||(a=vs()),s.push({x:h,y:p,id:r.getId(f),timeOffset:vs()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?W.Drag:d instanceof MouseEvent?W.MouseMove:W.TouchMove)}),i,{trailing:!1})),c=[Fe("mousemove",u,n),Fe("touchmove",u,n),Fe("drag",u,n)];return Y(()=>{c.forEach(d=>d())})}function vN({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,u=c=>d=>{let f=hi(d);if(Be(f,r,i,!0))return;let h=null,p=c;if("pointerType"in d){switch(d.pointerType){case"mouse":h=Mt.Mouse;break;case"touch":h=Mt.Touch;break;case"pen":h=Mt.Pen;break}h===Mt.Touch?We[c]===We.MouseDown?p="TouchStart":We[c]===We.MouseUp&&(p="TouchEnd"):Mt.Pen}else uc(d)&&(h=Mt.Touch);h!==null?(l=h,(p.startsWith("Touch")&&h===Mt.Touch||p.startsWith("Mouse")&&h===Mt.Mouse)&&(h=null)):We[c]===We.Click&&(h=l,l=null);let m=uc(d)?d.changedTouches[0]:d;if(!m)return;let y=n.getId(f),{clientX:S,clientY:w}=m;Y(e)({type:We[p],id:y,x:S,y:w,...h!==null&&{pointerType:h}})};return Object.keys(We).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&s[c]!==!1).forEach(c=>{let d=Sn(c),f=u(c);if(window.PointerEvent)switch(We[c]){case We.MouseDown:case We.MouseUp:d=d.replace("mouse","pointer");break;case We.TouchStart:case We.TouchEnd:return}a.push(Fe(d,f,t))}),Y(()=>{a.forEach(c=>c())})}function aS({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){let s=Y(ui(Y(a=>{let l=hi(a);if(!l||Be(l,r,i,!0))return;let u=n.getId(l);if(l===t&&t.defaultView){let c=Yb(t.defaultView);e({id:u,x:c.left,y:c.top})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Fe("scroll",s,t)}function RN({viewportResizeCb:e},{win:t}){let n=-1,r=-1,i=Y(ui(Y(()=>{let o=Jb(),s=Xb();(n!==o||r!==s)&&(e({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Fe("resize",i,t)}var kN=["INPUT","TEXTAREA","SELECT"],fg=new WeakMap;function CN({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(w){let g=hi(w),v=w.isTrusted,A=g&&g.tagName;if(g&&A==="OPTION"&&(g=U.parentElement(g)),!g||!A||kN.indexOf(A)<0||Be(g,r,i,!0)||g.classList.contains(o)||s&&g.matches(s))return;let N=g.value,T=!1,M=ds(g)||"";M==="radio"||M==="checkbox"?T=g.checked:(a[A.toLowerCase()]||a[M])&&(N=cs({element:g,maskInputOptions:a,tagName:A,type:M,value:N,maskInputFn:l})),f(g,c?{text:N,isChecked:T,userTriggered:v}:{text:N,isChecked:T});let I=g.name;M==="radio"&&I&&T&&t.querySelectorAll(`input[type="radio"][name="${I}"]`).forEach(B=>{if(B!==g){let J=B.value;f(B,c?{text:J,isChecked:!T,userTriggered:!1}:{text:J,isChecked:!T})}})}function f(w,g){let v=fg.get(w);if(!v||v.text!==g.text||v.isChecked!==g.isChecked){fg.set(w,g);let A=n.getId(w);Y(e)({...g,id:A})}}let p=(u.input==="last"?["change"]:["input","change"]).map(w=>Fe(w,Y(d),t)),m=t.defaultView;if(!m)return()=>{p.forEach(w=>w())};let y=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),S=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&p.push(...S.map(w=>_s(w[0],w[1],{set(){Y(d)({target:this,isTrusted:!1})}},!1,m))),Y(()=>{p.forEach(w=>w())})}function Rs(e){let t=[];function n(r,i){if(ts("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||ts("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||ts("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||ts("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let s=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(s)}else if(r.parentStyleSheet){let s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(s)}return i}return n(e,t)}function Jt(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function EN({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Y((c,d,f)=>{let[h,p]=f,{id:m,styleId:y}=Jt(d,t,n.styleMirror);return(m&&m!==-1||y&&y!==-1)&&e({id:m,styleId:y,adds:[{rule:h,index:p}]}),c.apply(d,f)})}),r.CSSStyleSheet.prototype.addRule=function(c,d,f=this.cssRules.length){let h=`${c} { ${d} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[h,f])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Y((c,d,f)=>{let[h]=f,{id:p,styleId:m}=Jt(d,t,n.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,removes:[{index:h}]}),c.apply(d,f)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let s;r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Y((c,d,f)=>{let[h]=f,{id:p,styleId:m}=Jt(d,t,n.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replace:h}),c.apply(d,f)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Y((c,d,f)=>{let[h]=f,{id:p,styleId:m}=Jt(d,t,n.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replaceSync:h}),c.apply(d,f)})}));let l={};ns("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(ns("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),ns("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),ns("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[c].insertRule,{apply:Y((f,h,p)=>{let[m,y]=p,{id:S,styleId:w}=Jt(h.parentStyleSheet,t,n.styleMirror);return(S&&S!==-1||w&&w!==-1)&&e({id:S,styleId:w,adds:[{rule:m,index:[...Rs(h),y||0]}]}),f.apply(h,p)})}),d.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:Y((f,h,p)=>{let[m]=p,{id:y,styleId:S}=Jt(h.parentStyleSheet,t,n.styleMirror);return(y&&y!==-1||S&&S!==-1)&&e({id:y,styleId:S,removes:[{index:[...Rs(h),m]}]}),f.apply(h,p)})})}),Y(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})})}function lS({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;n.nodeName==="#document"?s=e.getId(n):s=e.getId(U.host(n));let a=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(o=(i=n.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)==null?void 0:u.call(this)},set(u){var c;let d=(c=l.set)==null?void 0:c.call(this,u);if(s!==null&&s!==-1)try{t.adoptStyleSheets(u,s)}catch{}return d}}),Y(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function AN({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Y((a,l,u)=>{var c;let[d,f,h]=u;if(n.has(d))return o.apply(l,[d,f,h]);let{id:p,styleId:m}=Jt((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,set:{property:d,value:f,priority:h},index:Rs(l.parentRule)}),a.apply(l,u)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:Y((a,l,u)=>{var c;let[d]=u;if(n.has(d))return s.apply(l,[d]);let{id:f,styleId:h}=Jt((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,r.styleMirror);return(f&&f!==-1||h&&h!==-1)&&e({id:f,styleId:h,remove:{property:d},index:Rs(l.parentRule)}),a.apply(l,u)})}),Y(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function IN({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=Y(l=>ui(Y(u=>{let c=hi(u);if(!c||Be(c,t,n,!0))return;let{currentTime:d,volume:f,muted:h,playbackRate:p,loop:m}=c;e({type:l,id:r.getId(c),currentTime:d,volume:f,muted:h,playbackRate:p,loop:m})}),i.media||500)),a=[Fe("play",s(Yn.Play),o),Fe("pause",s(Yn.Pause),o),Fe("seeked",s(Yn.Seeked),o),Fe("volumechange",s(Yn.VolumeChange),o),Fe("ratechange",s(Yn.RateChange),o)];return Y(()=>{a.forEach(l=>l())})}function PN({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(l,u,c){let d=new o(l,u,c);return i.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};let s=vn(t.fonts,"add",function(a){return function(l){return setTimeout(Y(()=>{let u=i.get(l);u&&(e(u),i.delete(l))}),0),a.apply(this,[l])}});return r.push(()=>{n.FontFace=o}),r.push(s),Y(()=>{r.forEach(a=>a())})}function TN(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e,s=!0,a=Y(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){let f=l.getRangeAt(d),{startContainer:h,startOffset:p,endContainer:m,endOffset:y}=f;Be(h,r,i,!0)||Be(m,r,i,!0)||u.push({start:n.getId(h),startOffset:p,end:n.getId(m),endOffset:y})}o({ranges:u})});return a(),Fe("selectionchange",a)}function MN({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:vn(n.customElements,"define",function(i){return function(o,s,a){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,a])}})}function ON(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:f,selectionCb:h,customElementCb:p}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),n(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),r(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),i(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),o(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),s(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),a(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),l(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),u(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),c(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),d(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),f(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),p(...m)}}function NN(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};ON(e,t);let r;e.recordDOM&&(r=sS(e,e.doc));let i=xN(e),o=vN(e),s=aS(e),a=RN(e,{win:n}),l=CN(e),u=IN(e),c=()=>{},d=()=>{},f=()=>{},h=()=>{};e.recordDOM&&(c=EN(e,{win:n}),d=lS(e,e.doc),f=AN(e,{win:n}),e.collectFonts&&(h=PN(e)));let p=TN(e),m=MN(e),y=[];for(let S of e.plugins)y.push(S.observer(S.callback,n,S.options));return Y(()=>{bn.forEach(S=>S.reset()),r?.disconnect(),i(),o(),s(),a(),l(),u(),c(),d(),f(),h(),p(),m(),y.forEach(S=>S())})}function ts(e){return typeof window[e]<"u"}function ns(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ks=class{constructor(t){C(this,"iframeIdToRemoteIdMap",new WeakMap),C(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,n,r,i){let o=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(n);return a||(a=this.generateIdFn(),o.set(n,a),s.set(a,n)),a}getIds(t,n){let r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(o=>this.getId(t,o,r,i))}getRemoteId(t,n,r){let i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let o=i.get(n);return o||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}},mc=class{constructor(t){C(this,"iframes",new WeakMap),C(this,"crossOriginIframeMap",new WeakMap),C(this,"crossOriginIframeMirror",new ks(vg)),C(this,"crossOriginIframeStyleMirror"),C(this,"crossOriginIframeRootIdMap",new WeakMap),C(this,"mirror"),C(this,"mutationCb"),C(this,"wrappedEmit"),C(this,"loadListener"),C(this,"stylesheetManager"),C(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ks(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=t.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,n.data.event);o&&this.wrappedEmit(o,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case H.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);let i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:H.IncrementalSnapshot,data:{source:W.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case H.Meta:case H.Load:case H.DomContentLoaded:return!1;case H.Plugin:return n;case H.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case H.IncrementalSnapshot:switch(n.data.source){case W.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),n.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case W.Drag:case W.TouchMove:case W.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case W.ViewportResize:return!1;case W.MediaInteraction:case W.MouseInteraction:case W.Scroll:case W.CanvasMutation:case W.Input:return this.replaceIds(n.data,t,["id"]),n;case W.StyleSheetRule:case W.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case W.Font:return n;case W.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case W.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),n}}return!1}replace(t,n,r,i){for(let o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=t.getIds(r,n[o]):n[o]=t.getId(r,n[o]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==iS.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}},yc=class{constructor(t){C(this,"shadowDoms",new WeakSet),C(this,"mutationCb"),C(this,"scrollCb"),C(this,"bypassOptions"),C(this,"mirror"),C(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!Zr(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let r=sS({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(aS({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(U.host(t))),this.restoreHandlers.push(lS({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){let r=this;this.restoreHandlers.push(vn(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=U.shadowRoot(this);return a&&rS(this)&&r.addShadowRoot(a,n),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Zn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",LN=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Jr=0;Jr<Zn.length;Jr++)LN[Zn.charCodeAt(Jr)]=Jr;var Jr,$N=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=Zn[t[n]>>2],i+=Zn[(t[n]&3)<<4|t[n+1]>>4],i+=Zn[(t[n+1]&15)<<2|t[n+2]>>6],i+=Zn[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var pg=new Map;function _N(e,t){let n=pg.get(e);return n||(n=new Map,pg.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var uS=(e,t,n)=>{if(!e||!(dS(e,t)||typeof e=="object"))return;let r=e.constructor.name,i=_N(n,r),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function as(e,t,n){if(e instanceof Array)return e.map(r=>as(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let r=e.constructor.name,i=$N(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[as(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[as(e.data,t,n),e.width,e.height]};if(dS(e,t)||typeof e=="object"){let r=e.constructor.name,i=uS(e,t,n);return{rr_type:r,index:i}}}}return e}var cS=(e,t,n)=>e.map(r=>as(r,t,n)),dS=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function DN(e,t,n,r){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=vn(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...u){return Be(this.canvas,n,r,!0)||setTimeout(()=>{let c=cS(u,t,this);e(this.canvas,{type:or["2D"],property:s,args:c})},0),l.apply(this,u)}});i.push(a)}catch{let a=_s(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:or["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function jN(e){return e==="experimental-webgl"?"webgl":e}function hg(e,t,n,r){let i=[];try{let o=vn(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!Be(this,t,n,!0)){let u=jN(a);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(l[0]&&typeof l[0]=="object"){let c=l[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function mg(e,t,n,r,i,o){let s=[],a=Object.getOwnPropertyNames(e);for(let l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let u=vn(e,l,function(c){return function(...d){let f=c.apply(this,d);if(uS(f,o,this),"tagName"in this.canvas&&!Be(this.canvas,r,i,!0)){let h=cS(d,o,this),p={type:t,property:l,args:h};n(this.canvas,p)}return f}});s.push(u)}catch{let u=_s(e,l,{set(c){n(this.canvas,{type:t,property:l,args:[c],setter:!0})}});s.push(u)}return s}function FN(e,t,n,r){let i=[];return i.push(...mg(t.WebGLRenderingContext.prototype,or.WebGL,e,n,r,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...mg(t.WebGL2RenderingContext.prototype,or.WebGL2,e,n,r,t)),()=>{i.forEach(o=>o())}}var fS="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",BN=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),yg=typeof window<"u"&&window.Blob&&new Blob([BN(fS)],{type:"text/javascript;charset=utf-8"});function VN(e){let t;try{if(t=yg&&(window.URL||window.webkitURL).createObjectURL(yg),!t)throw"";let n=new Worker(t,{name:e?.name});return n.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;base64,"+fS,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var gc=class{constructor(t){C(this,"pendingCanvasMutations",new Map),C(this,"rafStamps",{latestId:0,invokeId:null}),C(this,"mirror"),C(this,"mutationCb"),C(this,"resetObservers"),C(this,"frozen",!1),C(this,"locked",!1),C(this,"processMutation",(l,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(u)});let{sampling:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&n==="all"&&this.initCanvasMutationObserver(r,i,o),s&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,i,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,n,r,i,o){let s=hg(n,r,i,!0),a=new Map,l=new VN;l.onmessage=p=>{let{id:m}=p.data;if(a.set(m,!1),!("base64"in p.data))return;let{base64:y,type:S,width:w,height:g}=p.data;this.mutationCb({id:m,type:or["2D"],commands:[{property:"clearRect",args:[0,0,w,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:S}]},0,0]}]})};let u=1e3/t,c=0,d,f=()=>{let p=[];return n.document.querySelectorAll("canvas").forEach(m=>{Be(m,r,i,!0)||p.push(m)}),p},h=p=>{if(c&&p-c<u){d=requestAnimationFrame(h);return}c=p,f().forEach(async m=>{var y;let S=this.mirror.getId(m);if(a.get(S)||m.width===0||m.height===0)return;if(a.set(S,!0),["webgl","webgl2"].includes(m.__context)){let g=m.getContext(m.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let w=await createImageBitmap(m);l.postMessage({id:S,bitmap:w,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[w])}),d=requestAnimationFrame(h)};d=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=hg(t,n,r,!1),o=DN(this.processMutation.bind(this),t,n,r),s=FN(this.processMutation.bind(this),t,n,r);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;let i=r.map(s=>{let{type:a,...l}=s;return l}),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},bc=class{constructor(t){C(this,"trackedLinkElements",new WeakSet),C(this,"mutationCb"),C(this,"adoptedStyleSheetCb"),C(this,"styleMirror",new dc),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;let r={id:n,styleIds:[]},i=[];for(let o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(a,l)=>({rule:wg(a,o.href),index:l}))})),r.styleIds.push(s)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Sc=class{constructor(){C(this,"nodeMap",new WeakMap),C(this,"active",!1)}inOtherBuffer(t,n){let r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}},we,ls,Tu,Cs=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((by=e.contentWindow)==null?void 0:by.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ut=zT();function Rn(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:f,slimDOMOptions:h,maskInputFn:p,maskTextFn:m,hooks:y,packFn:S,sampling:w={},dataURLOptions:g={},mousemoveWait:v,recordDOM:A=!0,recordCanvas:N=!1,recordCrossOriginIframes:T=!1,recordAfter:M=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:I=!1,collectFonts:B=!1,inlineImages:J=!1,plugins:X,keepIframeSrcFn:j=()=>!1,ignoreCSSAttributes:Ne=new Set([]),errorHandler:mt}=e;SN(mt);let Ae=T?window.parent===window:!0,Qe=!1;if(!Ae)try{window.parent.document&&(Qe=!1)}catch{Qe=!0}if(Ae&&!t)throw new Error("emit function is required");if(!Ae&&!Qe)return()=>{};v!==void 0&&w.mousemove===void 0&&(w.mousemove=v),ut.reset();let on=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},yt=Eg(h);hN();let Zf,Sa=0,Qf=Z=>{for(let ot of X||[])ot.eventProcessor&&(Z=ot.eventProcessor(Z));return S&&!Qe&&(Z=S(Z)),Z};we=(Z,ot)=>{var ye;let ge=Z;if(ge.timestamp=vs(),(ye=bn[0])!=null&&ye.isFrozen()&&ge.type!==H.FullSnapshot&&!(ge.type===H.IncrementalSnapshot&&ge.data.source===W.Mutation)&&bn.forEach(Ge=>Ge.unfreeze()),Ae)t?.(Qf(ge),ot);else if(Qe){let Ge={type:"rrweb",event:Qf(ge),origin:window.location.origin,isCheckout:ot};window.parent.postMessage(Ge,"*")}if(ge.type===H.FullSnapshot)Zf=ge,Sa=0;else if(ge.type===H.IncrementalSnapshot){if(ge.data.source===W.Mutation&&ge.data.isAttachIframe)return;Sa++;let Ge=r&&Sa>=r,ie=n&&ge.timestamp-Zf.timestamp>n;(Ge||ie)&&ls(!0)}};let $i=Z=>{we({type:H.IncrementalSnapshot,data:{source:W.Mutation,...Z}})},ep=Z=>we({type:H.IncrementalSnapshot,data:{source:W.Scroll,...Z}}),tp=Z=>we({type:H.IncrementalSnapshot,data:{source:W.CanvasMutation,...Z}}),oR=Z=>we({type:H.IncrementalSnapshot,data:{source:W.AdoptedStyleSheet,...Z}}),sn=new bc({mutationCb:$i,adoptedStyleSheetCb:oR}),an=new mc({mirror:ut,mutationCb:$i,stylesheetManager:sn,recordCrossOriginIframes:T,wrappedEmit:we});for(let Z of X||[])Z.getMirror&&Z.getMirror({nodeMirror:ut,crossOriginIframeMirror:an.crossOriginIframeMirror,crossOriginIframeStyleMirror:an.crossOriginIframeStyleMirror});let wa=new Sc;Tu=new gc({recordCanvas:N,mutationCb:tp,win:window,blockClass:i,blockSelector:o,mirror:ut,sampling:w.canvas,dataURLOptions:g});let _i=new yc({mutationCb:$i,scrollCb:ep,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:on,dataURLOptions:g,maskTextFn:m,maskInputFn:p,recordCanvas:N,inlineImages:J,sampling:w,slimDOMOptions:yt,iframeManager:an,stylesheetManager:sn,canvasManager:Tu,keepIframeSrcFn:j,processedNodeManager:wa},mirror:ut});ls=(Z=!1)=>{if(!A)return;we({type:H.Meta,data:{href:window.location.href,width:Xb(),height:Jb()}},Z),sn.reset(),_i.init(),bn.forEach(ye=>ye.lock());let ot=hM(document,{mirror:ut,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:on,maskTextFn:m,maskInputFn:p,slimDOM:yt,dataURLOptions:g,recordCanvas:N,inlineImages:J,onSerialize:ye=>{eS(ye,ut)&&an.addIframe(ye),tS(ye,ut)&&sn.trackLinkElement(ye),cc(ye)&&_i.addShadowRoot(U.shadowRoot(ye),document)},onIframeLoad:(ye,ge)=>{an.attachIframe(ye,ge),_i.observeAttachShadow(ye)},onStylesheetLoad:(ye,ge)=>{sn.attachLinkElement(ye,ge)},keepIframeSrcFn:j});if(!ot)return console.warn("Failed to snapshot the document");we({type:H.FullSnapshot,data:{node:ot,initialOffset:Yb(window)}},Z),bn.forEach(ye=>ye.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&sn.adoptStyleSheets(document.adoptedStyleSheets,ut.getId(document))};try{let Z=[],ot=ge=>{var Ge;return Y(NN)({mutationCb:$i,mousemoveCb:(ie,xa)=>we({type:H.IncrementalSnapshot,data:{source:xa,positions:ie}}),mouseInteractionCb:ie=>we({type:H.IncrementalSnapshot,data:{source:W.MouseInteraction,...ie}}),scrollCb:ep,viewportResizeCb:ie=>we({type:H.IncrementalSnapshot,data:{source:W.ViewportResize,...ie}}),inputCb:ie=>we({type:H.IncrementalSnapshot,data:{source:W.Input,...ie}}),mediaInteractionCb:ie=>we({type:H.IncrementalSnapshot,data:{source:W.MediaInteraction,...ie}}),styleSheetRuleCb:ie=>we({type:H.IncrementalSnapshot,data:{source:W.StyleSheetRule,...ie}}),styleDeclarationCb:ie=>we({type:H.IncrementalSnapshot,data:{source:W.StyleDeclaration,...ie}}),canvasMutationCb:tp,fontCb:ie=>we({type:H.IncrementalSnapshot,data:{source:W.Font,...ie}}),selectionCb:ie=>{we({type:H.IncrementalSnapshot,data:{source:W.Selection,...ie}})},customElementCb:ie=>{we({type:H.IncrementalSnapshot,data:{source:W.CustomElement,...ie}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:u,maskInputOptions:on,inlineStylesheet:c,sampling:w,recordDOM:A,recordCanvas:N,inlineImages:J,userTriggeredOnInput:I,collectFonts:B,doc:ge,maskInputFn:p,maskTextFn:m,keepIframeSrcFn:j,blockSelector:o,slimDOMOptions:yt,dataURLOptions:g,mirror:ut,iframeManager:an,stylesheetManager:sn,shadowDomManager:_i,processedNodeManager:wa,canvasManager:Tu,ignoreCSSAttributes:Ne,plugins:((Ge=X?.filter(ie=>ie.observer))==null?void 0:Ge.map(ie=>({observer:ie.observer,options:ie.options,callback:xa=>we({type:H.Plugin,data:{plugin:ie.name,payload:xa}})})))||[]},y)};an.addLoadListener(ge=>{try{Z.push(ot(ge.contentDocument))}catch(Ge){console.warn(Ge)}});let ye=()=>{ls(),Z.push(ot(document)),Cs=!0};return["interactive","complete"].includes(document.readyState)?ye():(Z.push(Fe("DOMContentLoaded",()=>{we({type:H.DomContentLoaded,data:{}}),M==="DOMContentLoaded"&&ye()})),Z.push(Fe("load",()=>{we({type:H.Load,data:{}}),M==="load"&&ye()},window))),()=>{Z.forEach(ge=>{try{ge()}catch(Ge){String(Ge).toLowerCase().includes("cross-origin")||console.warn(Ge)}}),wa.destroy(),Cs=!1,wN()}}catch(Z){console.warn(Z)}}Rn.addCustomEvent=(e,t)=>{if(!Cs)throw new Error("please add custom event after start recording");we({type:H.Custom,data:{tag:e,payload:t}})};Rn.freezePage=()=>{bn.forEach(e=>e.freeze())};Rn.takeFullSnapshot=e=>{if(!Cs)throw new Error("please take full snapshot after start recording");ls(e)};Rn.mirror=ut;var gg;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(gg||(gg={}));var uq=5*1e3;var{addCustomEvent:cq}=Rn,{freezePage:dq}=Rn,{takeFullSnapshot:fq}=Rn;var mS="__ripploEmitRrwebEvent";function yS(){return{eventTypes:pS(H),incrementalSources:pS(W)}}function pS(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,n])=>[n,t]))}var WN=yu("@ripplo/rrweb-bundle/bundle","rrweb.js"),hS;function gS(){return hS??=UN(WN,{encoding:"utf8"}),hS}async function zc({clientVersion:e,debugDir:t,writeOtlpPortFile:n}){let r=new Map,i=my(yS()),o=await dl({localDir:bS.join(bS.dirname(t),".local"),writePortFile:n,onRrwebBatch:(l,u)=>{r.get(l)?.emitRrwebBatch(u)},onSpan:l=>{let u=l.attributes["ripplo.run"];u!=null&&r.get(u)?.emit(l)}}),s=await gS();return{attach:async(l,u)=>{let c=sh({debugDir:t,runId:u,worker:i});c.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),r.set(u,c),await gy(l,u),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(o.port)};`),await GN(l,c);let d=[];return{emitAction:f=>{KN(c,f)},emitAssertion:f=>{YN(c,f)},finish:()=>HN(c,{pages:d,registry:r,runId:u}),onPage:f=>{d.push(f),qN(c,s,f)}}},close:async()=>{await o.stop(),await i.terminate()},injectSpan:(l,u)=>{r.get(l)?.emit(u)}}}async function zN(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function GN(e,t){await e.exposeBinding(mS,(n,r)=>{let i=typeof r=="string"?r:JSON.stringify(r);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}async function HN(e,t){await zN(t.pages),t.registry.delete(t.runId),await e.close({noticeIfNoRrweb:"rrweb capture unavailable: recorder never pushed an event \u2014 page never loaded the recorder (blank page, failed navigation, or CSP block)"})}function qN(e,t,n){n.on("load",()=>{n.addScriptTag({content:t}).catch(()=>{})}),n.on("response",r=>{QN(e,r)}),n.on("console",r=>{e.emit({kind:"console",level:r.type(),source:"browser",text:r.text(),timeNanos:_n(Date.now())})}),n.on("pageerror",r=>{e.emit({kind:"error",message:r.message,source:"browser",stack:r.stack,timeNanos:_n(Date.now())})})}function KN(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:JN(t),timeNanos:_n(Date.now()),value:XN(t)})}function YN(e,t){let n=hu(t);e.emit({kind:"assertion",label:n.label,outcome:t.outcome,source:"test",step:n.step,timeNanos:_n(Date.now())})}function JN(e){if(e.url!=null)return e.url;if(e.locator!=null)return Wc(e.locator)}function Wc(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Wc(e.scope)} \u25B8 ${Wc(e.target)}`:`${e.role} ${e.name??""}`.trim()}function XN(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var ZN=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;function QN(e,t){let n=t.request(),r=n.resourceType();if(r!=="fetch"&&r!=="xhr"||ZN.test(n.url()))return;let i=n.headers().traceparent?.split("-");e.emit({kind:"network",method:n.method(),resourceType:r,source:"browser",spanId:i?.[2],status:t.status(),timeNanos:_n(Date.now()),traceId:i?.[1],url:t.url()})}import{err as Lx,ok as vf,ResultAsync as l5}from"neverthrow";function Gc(e){return{dataRules:Kl(e),pageRules:Gl(e)}}var SS=Object.defineProperty,wS=(e,t)=>{let n={};for(var r in e)SS(n,r,{get:e[r],enumerable:!0});return t||SS(n,Symbol.toStringTag,{value:"Module"}),n};var e4=class xS{constructor(t){this.seed=t}clone(){return new xS(this.seed)}next(){let t=Hc(this.seed),n=qc(t),r=Hc(t),i=qc(r);return this.seed=Hc(r),qc(this.seed)+(i+(n<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function Hc(e){return Math.imul(e,214013)+2531011&4294967295}function qc(e){return(e&-2147483649)>>16}function vS(e){return new e4(e)}var t4="SUSgbA\\W`E[]KN2RUSo8XVU?HKBFRl11E\\KoWOg5B]XEWG;BE;1:oVK[`B^Z9Qd23^XTnhL>]Unda4f[X;_j9H5QD=cN<5H`3bW>9bk1mjoI2fK0obmAAINOV:>Mek_V9dd<hZ\\gC3?Fm7FEk07QH_3PLm^@?^i\\QMkgP<]oLHmFnlecg5F@7U^@4jhZ?WZS0k@GHehmM36:5^9;>Hmm`co>k:KOSkSbIINb1VFf>LXgP>GUAQTD>Ci>XMGkUflLlb?_FaFUk@?5N7i70@;1o68ah@I<HFH7R2^J:G][Gf962ITWID9GWK8ElD2G5=DcHcL]cA]P2n7A=[<bInM;IHDQnJMReRXDWbVldnGEIPij`E08Xdci3@0c:IBbD4:Nk]?lEN9j^;T`0blZX7eiWE8c`<ak7j05FZi>AjUDh?M1B?^??FAXKThf<aBOXZf7jXYGK>R<;NHk3S9YhM7STJ6`:MIE`S@7298X8W>PNK=@;lLX<i\\TXLL<W@X[X54H]in8M;;n?kkQbajgAMY=Tf9b;ZKf0QUB2FHYWfnfkDoU9YkcLd95T>lK6GM1YL\\lid:J>KYS=iJ]Y>QlF>?R5_[5QeYC=66;A32Ac>OHk_ne^0g>bK:g;KFPgbGUcPR_Z=TX3H9d03bKZ2IhEPKBo>LSGWd0iFdV8C<Y:<>T[O6lC\\blaZ>GoAYP4clf^j1IfnZJ]QeDe2X<HE[LJNWnaCg[P]Co^:IRbWPY?97UePBlZNNHY6LOBM8P>=h?Ye:_f_Sb9Ki5GDYBF4dWeMfdg^ccPllNWM7G1\\UMdoYeOOD5^e@foA22G?ADYo5:FVG[bWo96;>3kc_c1Ab30>30;1@4F8g2hY?DJ4[LOL;ZLLKo2]jo>[KMDUcR279N_kF=3WL@Dd620bMTdA\\U9k``ef2iD9JgJ8CZBHS>F^Uk;<laeaeHS<15OSeS`PcSSKBRBFY]aQ=EgUXGNg=?d56`KA@2BejY0^[_DCX`L=CGMT=BW^6S1i@2ATBVk>3_ocRA>2U:4GPQ6o>5jX2HIcV3S@On6KB<[SKB?FC_AAji9agbBFkAi\\;4I\\UJ]c36Ub@[;gQACVGY<V]SDJBUU]La\\_a@JdOO8gm2T0DJMa:8Hf7>E]noQ[1Kambn??QQ]S?1i0oMGOijb\\aGY6lQ^CJ?9bFle8<eH4UUjBINX;n8@VOA5ah^URV49B[A?ONHhHAC1J5;;h0SXYlG^0W=eJdHh^K4SGe=1HZLLam;D<Q3AOdbPcdX``82\\jo0En8jRVGC73WMCF9`d:0heS?80?C188cSn7H9<daZ]MgS4Pb^1HkA:1PU^5>^h_g[RQV@PnYBRI_]`B]Bh@Uk03eXGY`I16L76H28X`R>IROMeNVUdU[:lghLhPCQZ:4a<30YBZCYnXe[?;jc8gKI2QH2MjnWBm4nGCZW`aVU2a;P<AMI25mlW_Nm][2?b6o851X@lAm]YZ`bWRF1g<Ga:T]1NXH5Veja5P9S9>:aNg:Th1Y=5o78K>LQ8hW@5S?I83Lk5Xk;j5@I3o[d:4RjE^oS30:WP9gC\\i8aSI>QRE@4lP:7lDg8g2`Ql[2I8aBU\\BQ?B4_clL9Q]S;^e1Ob5[>3JER2`c7B=o]fPOWO<DGi;Niba1PoWPPE_Q3aX0OB0mZej\\f_M[J4Y6]1`h2MkF[GiW8Q^d3^_=<I1N2Q7]2<2j[iP7V3V821FaI]A`93bC^Z\\G=WJ;^Ih?B97_iIF@\\Dl<eK1je8SNTWo_=XFMZH<<JYLZ^YQMPgYOV45K_:]kSI8^XlO0]GY=VUfe_C_F6TOcoAlVUH:o=WhhT@K`2KFhe<3\\KXQ>W:M?S_4S5d@J^`[AGA7@3]DnGSCO`\\?E8HT75^d9\\:m\\m1egIfk8cd6bD9\\eU8\\n[Pb0Cgd^S0n9kGJHb]i5XodlKHc34Fhi9K>0U5WK`>7Ff2^KL=WC6:kc?e5C^a1T1:4:^S5flXlGNIj08AfO?Dh7T7dWO>E]NI9?ob7B7P_h[4TEP[EU;GllFTnSmg9:\\[N]<SAoKP_kPlG56A:I3T6EG8Hj=XnUE`KT5U@OQ?]7[N^MFN1_NU4KO_3::Le`8IL9[1Z1H1;V3SC\\N3]S@4U[F2mhT5dYM7[4Pg_Na0_8WTH0`bgceQS8]EG;XgD4Ib4iLTP@kE79Mn>AYRJA1U5^Blhgno:aHVYc03c3J0Vc9FjEV^M75Zfd8kVC9>iJDk`AJ[6f7DK2D^DL\\AX:6b5h31XH;RQB\\N<ZSM=J;6L[`UW^eOIFc1Y]6_dfedIe4ARh72mTXC0WND_IDHVCZRDE0eODARCEETQI5TPUQE=jEH5bS?LP[ai`F5ABRYDo2o\\@=]GT?_9;hc4Lm:\\SF9k1T<0E@fX9BG[]g0nY7k[Qmi@la8`PF0j6@Q?Ii7bLkXQ<lLHf]`:DCh@9JY5>hEVLTdhL\\b1EB0lLh<=WaO@F<;8g<d:@e:LA:cFIEdmQh7hNHfSRToW?8N4:Z1K;XEDRO;OIDh<UdVln?bjgL>?VE98[B\\K<BVjkG8LiSX;fb>jf?DUK00Aih<WY6QD6cEnHBZ8iN_fd<G8Ci`11RUW2QlW]IXV:m?;J0GXXHfGNQ>:D`=fLPbO?VOTEYLj^cNj5PM>jKB5HVjJ4U7lXaTQNL9<@\\1`m\\Ug@VQHd7>jW=ca0`miF7;N0F=GjoQ`RFchKMGTmn8cF@Oh4GGCm7m2`U9j93Tb>=kSERjE_J939F01I1;`<ijk_=_Vn=7RVAI6fnQI5KlF:C44bN<<8K=Z<2TP<1]5?<dB>^LA=ebloE2Y2:9lkh0\\<YKbHD97iE`<C5oj^1>X:??`H6BXF2hG1Q[dF0Q=>W=J?7C\\k1T?<;R44oW?1hY^G8Zm]ZKnfOf0eCFYo6?=D8?<`6HU5SXh1;=:23LmV_FSi;OJfV<^?GkIDPISeHg1LaGE:V3Y3K3H<QJfbY?=;ldZRhnhQT_mGXDLFXXhSONE6Do_0iNZagB:BPGOTH;VhHUTd6LhQm^[;dO]5Hlkg<R:F<Kn\\:I:EGojgWZ2X@SYO_dlH;G8S<>oEKabY`:oU;=JW7ig?S?EYb86b7n8ce\\]IRa]koiWY<RfO;5kUI;7lVeC?[@ZaXDiF04B8R]bg@>O<mQDoUcBLcf^f>m2kMBUloD>Ze@NN^Z11TM`inXYhE_I=kA`:ZF4d\\>`L@;ZP[`ENU5cL[BV6\\Z?Di76:jg3hE6oG6jFc8kP=[GS1;WSedYQW1:U4\\OF32GgmMC<AjO]872bdBb`bKAA?8j78b>T3VfcUB2m4J^CPRU;8dScI]LU]^bBYA5_3:Y0N5i^?200000",n4=class kS{constructor(t,n){this.states=t,this.index=n}clone(){return new kS(this.states.slice(),this.index)}next(){let t=this.states[this.index];return t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,this.index=Ds(this.states,this.index),t}getState(){return[this.index,...this.states]}jump(){let t=this.states.slice(),n=this.index;this.index=Ds(this.states,this.index);for(let r=19932;r>0;--r)t4.charCodeAt(r/6|0)-48&1<<r%6&&RS(this.states,this.index,t,n),this.index=Ds(this.states,this.index);RS(this.states,this.index,t,n)}};function RS(e,t,n,r){let i=0;if(r>=t){for(;i<624-r;i++)e[i+t]^=n[i+r];for(;i<624-t;i++)e[i+t]^=n[i+r-624];for(;i<624;i++)e[i+t-624]^=n[i+r-624]}else{for(;i<624-t;i++)e[i+t]^=n[i+r];for(;i<624-r;i++)e[i+t-624]^=n[i+r];for(;i<624;i++)e[i+t-624]^=n[i+r-624]}}function Ds(e,t){if(t<227){let n=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397]^n>>>1^-(n&1)&2567483615,t+1}else if(t<623){let n=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397-624]^n>>>1^-(n&1)&2567483615,t+1}else{let n=e[t]&2147483648|e[0]&2147483647;return e[t]=e[396]^n>>>1^-(n&1)&2567483615,0}}function r4(e){for(let t=0;t!==624;++t)Ds(e,t)}function CS(e){let t=[e|0];for(let n=1;n!==624;++n){let r=t[n-1]^t[n-1]>>>30;t.push(Math.imul(1812433253,r)+n|0)}return r4(t),new n4(t,0)}var i4=class ES{constructor(t,n,r,i){this.s01=t,this.s00=n,this.s11=r,this.s10=i}clone(){return new ES(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00^this.s00<<23,n=this.s01^(this.s01<<23|this.s00>>>9),r=t^this.s10^(t>>>18|n<<14)^(this.s10>>>5|this.s11<<27),i=n^this.s11^n>>>18^this.s11>>>5,o=this.s00+this.s10|0;return this.s01=this.s11,this.s00=this.s10,this.s11=i,this.s10=r,o}jump(){let t=0,n=0,r=0,i=0,o=[1667051007,2321340297,1548169110,304075285];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)o[s]&a&&(t^=this.s01,n^=this.s00,r^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=n,this.s11=r,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function Kc(e){return new i4(-1,~e,e|0,0)}var o4=class AS{constructor(t,n,r,i){this.s01=t,this.s00=n,this.s11=r,this.s10=i}clone(){return new AS(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00+this.s10|0,n=this.s10^this.s00,r=this.s11^this.s01,i=this.s00,o=this.s01;return this.s00=i<<24^o>>>8^n^n<<16,this.s01=o<<24^i>>>8^r^(r<<16|n>>>16),this.s10=r<<5^n>>>27,this.s11=n<<5^r>>>27,t}jump(){let t=0,n=0,r=0,i=0,o=[3639956645,3750757012,1261568508,386426335];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)o[s]&a&&(t^=this.s01,n^=this.s00,r^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=n,this.s11=r,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function IS(e){return new o4(-1,~e,e|0,0)}function PS(e,t){for(let n=0;n!==t;++n)e.next()}var TS=BigInt,s4=4294967296n;function OS(e,t,n){let r=n-t+1n,i=s4,o=1;for(;i<r;)i<<=32n,++o;let s=MS(o,e);if(s<r)return s+t;if(s+r<i)return s%r+t;let a=i-i%r;for(;s>=a;)s=MS(o,e);return s%r+t}function MS(e,t){let n=TS(t.next()+2147483648);for(let r=1;r<e;++r){let i=t.next();n=(n<<32n)+TS(i+2147483648)}return n}function mi(e,t){let n=t>2?~~(4294967296/t)*t:4294967296,r=e.next()+2147483648;for(;r>=n;)r=e.next()+2147483648;return r%t}function Yc(e,t){if(t<0){let n=-t;e.sign=-1,e.data[0]=~~(n/4294967296),e.data[1]=n>>>0}else e.sign=1,e.data[0]=~~(t/4294967296),e.data[1]=t>>>0;return e}function a4(e,t,n){let r=t.data[1],i=t.data[0],o=t.sign,s=n.data[1],a=n.data[0],l=n.sign;if(e.sign=1,o===1&&l===-1){let m=r+s,y=i+a+(m>4294967295?1:0);return e.data[0]=y>>>0,e.data[1]=m>>>0,e}let u=r,c=i,d=s,f=a;o===-1&&(u=s,c=a,d=r,f=i);let h=0,p=u-d;return p<0&&(h=1,p=p>>>0),e.data[0]=c-f-h,e.data[1]=p,e}function l4(e,t,n){let r=n[0]+1;for(t[0]=mi(e,r),t[1]=mi(e,4294967296);t[0]>=n[0]&&(t[0]!==n[0]||t[1]>=n[1]);)t[0]=mi(e,r),t[1]=mi(e,4294967296);return t}var u4=Number.MAX_SAFE_INTEGER,c4={sign:1,data:[0,0]},d4={sign:1,data:[0,0]},NS={sign:1,data:[0,0]},Jc=[0,0];function f4(e,t,n,r){let i=r<=u4?Yc(NS,r):a4(NS,Yc(c4,n),Yc(d4,t));return i.data[1]===4294967295?(i.data[0]+=1,i.data[1]=0):i.data[1]+=1,l4(e,Jc,i.data),Jc[0]*4294967296+Jc[1]+t}function js(e,t,n){let r=n-t;return r<=4294967295?mi(e,r+1)+t:f4(e,t,n,r)}var LS=Symbol.for("fast-check/PreconditionFailure"),rn=class extends Error{constructor(e=!1){super(),this.interruptExecution=e,this.footprint=LS}static isFailure(e){return e!=null&&e.footprint===LS}};function p4(e){if(!e)throw new rn}var h4=class{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}},m4=new h4;function y4(){return m4}function*g4(e,t){for(let n of e)yield t(n)}function*b4(e,t){for(let n of e)yield*t(n)}function*S4(e,t){for(let n of e)t(n)&&(yield n)}function*w4(e,t){for(let n=0;n<t;++n){let r=e.next();if(r.done)break;yield r.value}}function*x4(e,t){let n=e.next();for(;!n.done&&t(n.value);)yield n.value,n=e.next()}function*v4(e,t){for(let n=e.next();!n.done;n=e.next())yield n.value;for(let n of t)for(let r=n.next();!r.done;r=n.next())yield r.value}var R4=Symbol.iterator,F=class _t{static nil(){return new _t(y4())}static of(...t){return new _t(t[R4]())}constructor(t){this.g=t}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(t){return new _t(g4(this.g,t))}flatMap(t){return new _t(b4(this.g,t))}dropWhile(t){let n=!1;function*r(i){(n||!t(i))&&(n=!0,yield i)}return this.flatMap(r)}drop(t){if(t<=0)return this;let n=0;function r(){return n++<t}return this.dropWhile(r)}takeWhile(t){return new _t(x4(this.g,t))}take(t){return new _t(w4(this.g,t))}filter(t){return new _t(S4(this.g,t))}every(t){for(let n of this.g)if(!t(n))return!1;return!0}has(t){for(let n of this.g)if(t(n))return[!0,n];return[!1,null]}join(...t){return new _t(v4(this.g,t))}getNthOrLast(t){let n=t,r=null;for(let i of this.g){if(n--===0)return i;r=i}return r}};function tn(e){return new F(e)}var Te=Symbol.for("fast-check/cloneMethod");function Cn(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Te in e&&typeof e[Te]=="function"}function cr(e){return Cn(e)?e[Te]():e}var k4=Object.defineProperty,D=class{constructor(e,t,n){this.value_=e,this.context=t,this.hasToBeCloned=n!==void 0||Cn(e),this.readOnce=!1,this.value=e,this.hasToBeCloned&&k4(this,"value",{get:n!==void 0?n:this.getValue,enumerable:!1,configurable:!1})}getValue(){return this.hasToBeCloned?this.readOnce?this.value_[Te]():(this.readOnce=!0,this.value_):this.value_}},ue=class{filter(e){return new A4(this,e)}map(e,t){return new E4(this,e,t)}chain(e){return new C4(this,e)}},C4=class extends ue{constructor(e,t){super(),this.arb=e,this.chainer=t}generate(e,t){let n=e.clone(),r=this.arb.generate(e,t);return this.valueChainer(r,e,n,t)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?(t.stoppedForOriginal?F.nil():this.arb.shrink(t.originalValue,t.originalContext).map(n=>this.valueChainer(n,t.clonedMrng.clone(),t.clonedMrng,t.originalBias))).join(t.chainedArbitrary.shrink(e,t.chainedContext).map(n=>{let r={...t,chainedContext:n.context,stoppedForOriginal:!0};return new D(n.value_,r)})):F.nil()}valueChainer(e,t,n,r){let i=this.chainer(e.value_),o=i.generate(t,r),s={originalBias:r,originalValue:e.value_,originalContext:e.context,stoppedForOriginal:!1,chainedArbitrary:i,chainedContext:o.context,clonedMrng:n};return new D(o.value_,s)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalBias"in e&&"originalValue"in e&&"originalContext"in e&&"stoppedForOriginal"in e&&"chainedArbitrary"in e&&"chainedContext"in e&&"clonedMrng"in e}},E4=class extends ue{constructor(e,t,n){super(),this.arb=e,this.mapper=t,this.unmapper=n,this.bindValueMapper=r=>this.valueMapper(r)}generate(e,t){let n=this.arb.generate(e,t);return this.valueMapper(n)}canShrinkWithoutContext(e){if(this.unmapper!==void 0)try{let t=this.unmapper(e);return this.arb.canShrinkWithoutContext(t)}catch{return!1}return!1}shrink(e,t){if(this.isSafeContext(t))return this.arb.shrink(t.originalValue,t.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let n=this.unmapper(e);return this.arb.shrink(n,void 0).map(this.bindValueMapper)}return F.nil()}mapperWithCloneIfNeeded(e){let t=e.value,n=this.mapper(t);return e.hasToBeCloned&&(typeof n=="object"&&n!==null||typeof n=="function")&&Object.isExtensible(n)&&!Cn(n)&&Object.defineProperty(n,Te,{get:()=>()=>this.mapperWithCloneIfNeeded(e)[0]}),[n,t]}valueMapper(e){let[t,n]=this.mapperWithCloneIfNeeded(e);return new D(t,{originalValue:n,originalContext:e.context})}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalValue"in e&&"originalContext"in e}},A4=class extends ue{constructor(e,t){super(),this.arb=e,this.refinement=t,this.bindRefinementOnValue=n=>this.refinementOnValue(n)}generate(e,t){for(;;){let n=this.arb.generate(e,t);if(this.refinementOnValue(n))return n}}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)&&this.refinement(e)}shrink(e,t){return this.arb.shrink(e,t).filter(this.bindRefinementOnValue)}refinementOnValue(e){return this.refinement(e.value)}};function L1(e){return typeof e=="object"&&e!==null&&"generate"in e&&"shrink"in e&&"canShrinkWithoutContext"in e}function $1(e){if(!L1(e))throw new Error("Unexpected value received: not an instance of Arbitrary")}var _1=Function.prototype.apply,Xc=Symbol("apply");function I4(e){try{return e.apply}catch{return}}function P4(e,t,n){let r=e;r[Xc]=_1;let i=r[Xc](t,n);return delete r[Xc],i}function q(e,t,n){return I4(e)===_1?e.apply(t,n):P4(e,t,n)}var D1=Array,O=BigInt,T4=BigInt64Array,M4=BigUint64Array,j1=Boolean,Qs=Date,L=Error,F1=Float32Array,B1=Float64Array,O4=Int8Array,N4=Int16Array,L4=Int32Array,jt=Number,Ve=String,dr=Set,$4=Uint8Array,_4=Uint8ClampedArray,D4=Uint16Array,j4=Uint32Array,F4=encodeURIComponent,Ft=Map,Hs=Symbol,$S=Array.prototype.forEach,_S=Array.prototype.indexOf,DS=Array.prototype.join,jS=Array.prototype.map,FS=Array.prototype.flat,BS=Array.prototype.filter,VS=Array.prototype.push,US=Array.prototype.pop,WS=Array.prototype.splice,zS=Array.prototype.slice,GS=Array.prototype.sort,HS=Array.prototype.every;function B4(e){try{return e.forEach}catch{return}}function V4(e){try{return e.indexOf}catch{return}}function U4(e){try{return e.join}catch{return}}function W4(e){try{return e.map}catch{return}}function z4(e){try{return e.flat}catch{return}}function G4(e){try{return e.filter}catch{return}}function H4(e){try{return e.push}catch{return}}function q4(e){try{return e.pop}catch{return}}function K4(e){try{return e.splice}catch{return}}function Y4(e){try{return e.slice}catch{return}}function J4(e){try{return e.sort}catch{return}}function X4(e){try{return e.every}catch{return}}function V1(e,t){return B4(e)===$S?e.forEach(t):q($S,e,[t])}function Dt(e,...t){return V4(e)===_S?e.indexOf(...t):q(_S,e,t)}function le(e,...t){return U4(e)===DS?e.join(...t):q(DS,e,t)}function z(e,t){return W4(e)===jS?e.map(t):q(jS,e,[t])}function Z4(e,t){return z4(e)===FS?([].flat(),e.flat(t)):q(FS,e,[t])}function Q4(e,t){return G4(e)===BS?e.filter(t):q(BS,e,[t])}function $(e,...t){return H4(e)===VS?e.push(...t):q(VS,e,t)}function U1(e){return q4(e)===US?e.pop():q(US,e,[])}function W1(e,...t){return K4(e)===WS?e.splice(...t):q(WS,e,t)}function Oe(e,...t){return Y4(e)===zS?e.slice(...t):q(zS,e,t)}function z1(e,...t){return J4(e)===GS?e.sort(...t):q(GS,e,t)}function G1(e,...t){return X4(e)===HS?e.every(...t):q(HS,e,t)}var qS=Date.prototype.getTime,KS=Date.prototype.toISOString;function e3(e){try{return e.getTime}catch{return}}function t3(e){try{return e.toISOString}catch{return}}function ea(e){return e3(e)===qS?e.getTime():q(qS,e,[])}function n3(e){return t3(e)===KS?e.toISOString():q(KS,e,[])}var YS=Set.prototype.add,JS=Set.prototype.has;function r3(e){try{return e.add}catch{return}}function i3(e){try{return e.has}catch{return}}function wi(e,t){return r3(e)===YS?e.add(t):q(YS,e,[t])}function ta(e,t){return i3(e)===JS?e.has(t):q(JS,e,[t])}var XS=WeakMap.prototype.set,ZS=WeakMap.prototype.get;function o3(e){try{return e.set}catch{return}}function s3(e){try{return e.get}catch{return}}function a3(e,t,n){return o3(e)===XS?e.set(t,n):q(XS,e,[t,n])}function l3(e,t){return s3(e)===ZS?e.get(t):q(ZS,e,[t])}var QS=Map.prototype.set,ew=Map.prototype.get,tw=Map.prototype.has;function u3(e){try{return e.set}catch{return}}function c3(e){try{return e.get}catch{return}}function d3(e){try{return e.has}catch{return}}function ft(e,t,n){return u3(e)===QS?e.set(t,n):q(QS,e,[t,n])}function Ze(e,t){return c3(e)===ew?e.get(t):q(ew,e,[t])}function f3(e,t){return d3(e)===tw?e.has(t):q(tw,e,[t])}var nw=String.prototype.split,rw=String.prototype.startsWith,iw=String.prototype.endsWith,ow=String.prototype.substring,sw=String.prototype.toLowerCase,aw=String.prototype.toUpperCase,lw=String.prototype.padStart,uw=String.prototype.charCodeAt,cw=String.prototype.normalize,dw=String.prototype.replace;function p3(e){try{return e.split}catch{return}}function h3(e){try{return e.startsWith}catch{return}}function m3(e){try{return e.endsWith}catch{return}}function y3(e){try{return e.substring}catch{return}}function g3(e){try{return e.toLowerCase}catch{return}}function b3(e){try{return e.toUpperCase}catch{return}}function S3(e){try{return e.padStart}catch{return}}function w3(e){try{return e.charCodeAt}catch{return}}function x3(e){try{return e.normalize}catch{return}}function v3(e){try{return e.replace}catch{return}}function Ue(e,...t){return p3(e)===nw?e.split(...t):q(nw,e,t)}function R3(e,...t){return h3(e)===rw?e.startsWith(...t):q(rw,e,t)}function k3(e,...t){return m3(e)===iw?e.endsWith(...t):q(iw,e,t)}function he(e,...t){return y3(e)===ow?e.substring(...t):q(ow,e,t)}function vd(e){return g3(e)===sw?e.toLowerCase():q(sw,e,[])}function Kd(e){return b3(e)===aw?e.toUpperCase():q(aw,e,[])}function C3(e,...t){return S3(e)===lw?e.padStart(...t):q(lw,e,t)}function fr(e,t){return w3(e)===uw?e.charCodeAt(t):q(uw,e,[t])}function E3(e,t){return x3(e)===cw?e.normalize(t):q(cw,e,[t])}function A3(e,t,n){return v3(e)===dw?e.replace(t,n):q(dw,e,[t,n])}var fw=Number.prototype.toString;function I3(e){try{return e.toString}catch{return}}function xi(e,...t){return I3(e)===fw?e.toString(...t):q(fw,e,t)}var P3=Object.prototype.hasOwnProperty,T3=Object.prototype.toString;function H1(e,t){return q(P3,e,[t])}function Rd(e){return q(T3,e,[])}var M3=Error.prototype.toString;function O3(e){return q(M3,e,[])}var N3=class{constructor(e){this.producer=e}[Symbol.iterator](){return this.it===void 0&&(this.it=this.producer()),this.it}next(){return this.it===void 0&&(this.it=this.producer()),this.it.next()}};function en(e){return new N3(e)}var q1=Array.isArray,L3=Object.defineProperty;function K1(e,t){return L3(e,Te,{value:()=>{let n=[];for(let r=0;r!==t.length;++r)$(n,t[r].value);return K1(n,t),n}})}function Y1(e){let t=!1,n=[],r=[];for(let i=0;i!==e.length;++i){let o=e[i];t=t||o.hasToBeCloned,$(n,o.value),$(r,o.context)}return t&&K1(n,e),new D(n,r)}function J1(e,t,n){let r=[],i=q1(n)?n:[];for(let o=0;o!==e.length;++o)$(r,en(()=>e[o].shrink(t[o],i[o]).map(s=>{let a=z(t,(l,u)=>new D(cr(l),i[u]));return[...Oe(a,0,o),s,...Oe(a,o+1)]}).map(Y1)));return F.nil().join(...r)}var $3=class extends ue{constructor(e){super(),this.arbs=e;for(let t=0;t!==e.length;++t){let n=e[t];if(n==null||n.generate===null||n.generate===void 0)throw new Error(`Invalid parameter encountered at index ${t}: expecting an Arbitrary`)}}generate(e,t){let n=[];for(let r=0;r!==this.arbs.length;++r)$(n,this.arbs[r].generate(e,t));return Y1(n)}canShrinkWithoutContext(e){if(!q1(e)||e.length!==this.arbs.length)return!1;for(let t=0;t!==this.arbs.length;++t)if(!this.arbs[t].canShrinkWithoutContext(e[t]))return!1;return!0}shrink(e,t){return J1(this.arbs,e,t)}};function V(...e){return new $3(e)}var _3=Math.log;function X1(e){return 2+~~(_3(e+1)*.4342944819032518)}var Yd={};function D3(e){Yd=e}function pt(){return Yd}function j3(){Yd={}}var vi=Symbol("UndefinedContextPlaceholder");function pr(e){return e.context!==void 0?e:e.hasToBeCloned?new D(e.value_,vi,()=>e.value):new D(e.value_,vi)}var pw=()=>{},F3=class{constructor(e,t){this.arb=e,this.predicate=t;let{asyncBeforeEach:n,asyncAfterEach:r,beforeEach:i,afterEach:o}=pt()||{};if(n!==void 0&&i!==void 0)throw L(`Global "asyncBeforeEach" and "beforeEach" parameters can't be set at the same time when running async properties`);if(r!==void 0&&o!==void 0)throw L(`Global "asyncAfterEach" and "afterEach" parameters can't be set at the same time when running async properties`);this.beforeEachHook=n||i||pw,this.afterEachHook=r||o||pw}isAsync(){return!0}generate(e,t){return pr(this.arb.generate(e,t!==void 0?X1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return F.nil();let t=e.context!==vi?e.context:void 0;return this.arb.shrink(e.value_,t).map(pr)}async runBeforeEach(){await this.beforeEachHook()}async runAfterEach(){await this.afterEachHook()}async run(e){try{let t=await this.predicate(e);return t===void 0||t===!0?null:{error:new L("Property failed by returning false")}}catch(t){return rn.isFailure(t)?t:{error:t}}}beforeEach(e){let t=this.beforeEachHook;return this.beforeEachHook=()=>e(t),this}afterEach(e){let t=this.afterEachHook;return this.afterEachHook=()=>e(t),this}},Z1=class extends ue{constructor(e){super(),this.arb=e}generate(e,t){return pr(this.arb.generate(e,t))}canShrinkWithoutContext(e){return!0}shrink(e,t){if(t===void 0&&!this.arb.canShrinkWithoutContext(e))return F.nil();let n=t!==vi?t:void 0;return this.arb.shrink(e,n).map(pr)}};function B3(...e){if(e.length<2)throw new Error("asyncProperty expects at least two parameters");let t=Oe(e,0,e.length-1),n=e[e.length-1];return V1(t,$1),new F3(V(...z(t,r=>new Z1(r))),r=>n(...r))}var hw=()=>{},Q1=class{constructor(e,t){this.arb=e,this.predicate=t;let{beforeEach:n=hw,afterEach:r=hw,asyncBeforeEach:i,asyncAfterEach:o}=pt()||{};if(i!==void 0)throw L(`"asyncBeforeEach" can't be set when running synchronous properties`);if(o!==void 0)throw L(`"asyncAfterEach" can't be set when running synchronous properties`);this.beforeEachHook=n,this.afterEachHook=r}isAsync(){return!1}generate(e,t){return pr(this.arb.generate(e,t!==void 0?X1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return F.nil();let t=e.context!==vi?e.context:void 0;return this.arb.shrink(e.value_,t).map(pr)}runBeforeEach(){this.beforeEachHook()}runAfterEach(){this.afterEachHook()}run(e){try{let t=this.predicate(e);return t===void 0||t===!0?null:{error:new L("Property failed by returning false")}}catch(t){return rn.isFailure(t)?t:{error:t}}}beforeEach(e){let t=this.beforeEachHook;return this.beforeEachHook=()=>e(t),this}afterEach(e){let t=this.afterEachHook;return this.afterEachHook=()=>e(t),this}};function V3(...e){if(e.length<2)throw new Error("property expects at least two parameters");let t=Oe(e,0,e.length-1),n=e[e.length-1];return V1(t,$1),new Q1(V(...z(t,r=>new Z1(r))),r=>n(...r))}var U3=(function(e){return e[e.None=0]="None",e[e.Verbose=1]="Verbose",e[e.VeryVerbose=2]="VeryVerbose",e})({});function kd(e){return"unsafeNext"in e?e.unsafeJump===void 0?{clone:()=>kd(e),next:()=>e.unsafeNext(),getState:()=>e.getState()}:{clone:()=>kd(e),next:()=>e.unsafeNext(),jump:()=>e.unsafeJump(),getState:()=>e.getState()}:e}function e0(e){return"jump"in e&&typeof e.jump=="function"?e:{clone:()=>e0(e),next:()=>e.next(),jump:()=>PS(e,42),getState:()=>e.getState()}}function oa(e){return e0(kd(e))}var W3=Date.now,z3=Math.min,G3=Math.random,H3=class{constructor(e){let t=e||{};this.seed=q3(t),this.randomType=K3(t),this.numRuns=Y3(t),this.verbose=J3(t),this.maxSkipsPerRun=t.maxSkipsPerRun!==void 0?t.maxSkipsPerRun:100,this.timeout=Qc(t.timeout),this.skipAllAfterTimeLimit=Qc(t.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=Qc(t.interruptAfterTimeLimit),this.markInterruptAsFailure=t.markInterruptAsFailure===!0,this.skipEqualValues=t.skipEqualValues===!0,this.ignoreEqualValues=t.ignoreEqualValues===!0,this.logger=t.logger!==void 0?t.logger:n=>{console.log(n)},this.path=t.path!==void 0?t.path:"",this.unbiased=t.unbiased===!0,this.examples=t.examples!==void 0?t.examples:[],this.endOnFailure=t.endOnFailure===!0,this.reporter=t.reporter,this.asyncReporter=t.asyncReporter,this.includeErrorInReport=t.includeErrorInReport===!0}toParameters(){return{seed:this.seed,randomType:this.randomType,numRuns:this.numRuns,maxSkipsPerRun:this.maxSkipsPerRun,timeout:this.timeout,skipAllAfterTimeLimit:this.skipAllAfterTimeLimit,interruptAfterTimeLimit:this.interruptAfterTimeLimit,markInterruptAsFailure:this.markInterruptAsFailure,skipEqualValues:this.skipEqualValues,ignoreEqualValues:this.ignoreEqualValues,path:this.path,logger:this.logger,unbiased:this.unbiased,verbose:this.verbose,examples:this.examples,endOnFailure:this.endOnFailure,reporter:this.reporter,asyncReporter:this.asyncReporter,includeErrorInReport:this.includeErrorInReport}}};function Zc(e){return t=>oa(e(t))}function q3(e){if(e.seed===void 0)return W3()^G3()*4294967296;let t=e.seed|0;return e.seed===t?t:t^(e.seed-t)*4294967296}function K3(e){if(e.randomType===void 0)return Kc;if(typeof e.randomType=="string")switch(e.randomType){case"mersenne":return Zc(CS);case"congruential":case"congruential32":return Zc(vS);case"xorshift128plus":return Kc;case"xoroshiro128plus":return IS;default:throw new Error(`Invalid random specified: '${e.randomType}'`)}let t=e.randomType(0);if("min"in t&&t.min!==-2147483648)throw new Error(`Invalid random number generator: min must equal -0x80000000, got ${String(t.min)}`);if("max"in t&&t.max!==2147483647)throw new Error(`Invalid random number generator: max must equal 0x7fffffff, got ${String(t.max)}`);return t===oa(t)?e.randomType:Zc(e.randomType)}function Y3(e){return e.numRuns!==void 0?e.numRuns:e.num_runs!==void 0?e.num_runs:100}function J3(e){return e.verbose===void 0?0:typeof e.verbose=="boolean"?e.verbose===!0?1:0:e.verbose<=0?0:e.verbose>=2?2:e.verbose|0}function Qc(e){if(e!==void 0)return z3(e,2147483647)}function Jd(e){return new H3(e)}function X3(e,t,n){let r=null;return{clear:()=>n(r),promise:new Promise(i=>{r=t(()=>{i(new rn(!0))},e)})}}var mw=class{constructor(e,t,n,r,i,o){this.property=e,this.getTime=t,this.interruptExecution=r,this.setTimeoutSafe=i,this.clearTimeoutSafe=o,this.skipAfterTime=this.getTime()+n}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}run(e){let t=this.skipAfterTime-this.getTime();if(t<=0){let n=new rn(this.interruptExecution);return this.isAsync()?Promise.resolve(n):n}if(this.interruptExecution&&this.isAsync()){let n=X3(t,this.setTimeoutSafe,this.clearTimeoutSafe),r=Promise.race([this.property.run(e),n.promise]);return r.then(n.clear,n.clear),r}return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Z3=(e,t,n)=>{let r=null;return{clear:()=>n(r),promise:new Promise(i=>{r=t(()=>{i({error:new L(`Property timeout: exceeded limit of ${e} milliseconds`)})},e)})}},Q3=class{constructor(e,t,n,r){this.property=e,this.timeMs=t,this.setTimeoutSafe=n,this.clearTimeoutSafe=r}isAsync(){return!0}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}async run(e){let t=Z3(this.timeMs,this.setTimeoutSafe,this.clearTimeoutSafe),n=Promise.race([this.property.run(e),t.promise]);return n.then(t.clear,t.clear),n}runBeforeEach(){return Promise.resolve(this.property.runBeforeEach())}runAfterEach(){return Promise.resolve(this.property.runAfterEach())}},t0=class{constructor(e){this.property=e}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,void 0)}shrink(e){return this.property.shrink(e)}run(e){return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},yw=Array.from,gw=typeof Buffer<"u"?Buffer.isBuffer:void 0,sr=JSON.stringify,bw=Number.isNaN,eL=Object.keys,tL=Object.getOwnPropertySymbols,nL=Object.getOwnPropertyDescriptor,Sw=Object.getPrototypeOf,ww=Number.NEGATIVE_INFINITY,rL=Number.POSITIVE_INFINITY,ht=Symbol.for("fast-check/toStringMethod");function Xd(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&ht in e&&typeof e[ht]=="function"}var Bt=Symbol.for("fast-check/asyncToStringMethod");function Zd(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Bt in e&&typeof e[Bt]=="function"}var iL=/^Symbol\((.*)\)$/;function oL(e){if(e.description!==void 0)return e.description;let t=iL.exec(Ve(e));return t&&t[1].length?t[1]:null}function xw(e){switch(e){case 0:return 1/e===ww?"-0":"0";case ww:return"Number.NEGATIVE_INFINITY";case rL:return"Number.POSITIVE_INFINITY";default:return e===e?Ve(e):"Number.NaN"}}function sL(e){let t=-1;for(let n in e){let r=Number(n);if(r!==t+1)return!0;t=r}return t+1!==e.length}function Xe(e,t,n){let r=[...t,e];if(typeof e=="object"&&Dt(t,e)!==-1)return"[cyclic]";if(Zd(e)){let i=n(e);if(i.state==="fulfilled")return i.value}if(Xd(e))try{return e[ht]()}catch{}switch(Rd(e)){case"[object Array]":{let i=e;if(i.length>=50&&sL(i)){let s=[];for(let a in i)bw(Number(a))||$(s,`${a}:${Xe(i[a],r,n)}`);return s.length!==0?`Object.assign(Array(${i.length}),{${le(s,",")}})`:`Array(${i.length})`}let o=le(z(i,s=>Xe(s,r,n)),",");return i.length===0||i.length-1 in i?`[${o}]`:`[${o},]`}case"[object BigInt]":return`${e}n`;case"[object Boolean]":{let i=e==!0?"true":"false";return typeof e=="boolean"?i:`new Boolean(${i})`}case"[object Date]":{let i=e;return bw(ea(i))?"new Date(NaN)":`new Date(${sr(n3(i))})`}case"[object Map]":return`new Map(${Xe(Array.from(e),r,n)})`;case"[object Null]":return"null";case"[object Number]":return typeof e=="number"?xw(e):`new Number(${xw(Number(e))})`;case"[object Object]":{try{let o=e.toString;if(typeof o=="function"&&o!==Object.prototype.toString)return e.toString()}catch{return"[object Object]"}let i=o=>`${o==="__proto__"?'["__proto__"]':typeof o=="symbol"?`[${Xe(o,r,n)}]`:sr(o)}:${Xe(e[o],r,n)}`;return"{"+le([...Sw(e)===null?["__proto__:null"]:[],...z(eL(e),i),...z(Q4(tL(e),o=>{let s=nL(e,o);return s&&s.enumerable}),i)],",")+"}"}case"[object Set]":return`new Set(${Xe(Array.from(e),r,n)})`;case"[object String]":return typeof e=="string"?sr(e):`new String(${sr(e)})`;case"[object Symbol]":{let i=e;if(Hs.keyFor(i)!==void 0)return`Symbol.for(${sr(Hs.keyFor(i))})`;let o=oL(i);return o===null?"Symbol()":i===(o.startsWith("Symbol.")&&Hs[o.substring(7)])?o:`Symbol(${sr(o)})`}case"[object Promise]":{let i=n(e);switch(i.state){case"fulfilled":return`Promise.resolve(${Xe(i.value,r,n)})`;case"rejected":return`Promise.reject(${Xe(i.value,r,n)})`;case"pending":return"new Promise(() => {/*pending*/})";default:return"new Promise(() => {/*unknown*/})"}}case"[object Error]":if(e instanceof Error)return`new Error(${Xe(e.message,r,n)})`;break;case"[object Undefined]":return"undefined";case"[object Int8Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Int16Array]":case"[object Uint16Array]":case"[object Int32Array]":case"[object Uint32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object BigInt64Array]":case"[object BigUint64Array]":{if(typeof gw=="function"&&gw(e))return`Buffer.from(${e.buffer.detached?"/*detached ArrayBuffer*/":Xe(yw(e.values()),r,n)})`;let i=Sw(e),o=i&&i.constructor&&i.constructor.name;if(typeof o=="string"){let s=e;return s.buffer.detached?`${o}.from(/*detached ArrayBuffer*/)`:`${o}.from(${Xe(yw(s.values()),r,n)})`}break}}try{return e.toString()}catch{return Rd(e)}}function ve(e){return Xe(e,[],()=>({state:"unknown",value:void 0}))}function n0(e){let t=Hs(),n=[],r=new Ft;function i(){let l=null,u=()=>{l!==null&&clearTimeout(l)};return{delay:new Promise(c=>{l=setTimeout(()=>{l=null,c(t)},0)}),cancel:u}}let o={state:"unknown",value:void 0},s=function(u){let c=u;if(r.has(c))return r.get(c);let d=i(),f=Bt in u?Promise.resolve().then(()=>u[Bt]()):u;return f.catch(()=>{}),n.push(Promise.race([f,d.delay]).then(h=>{h===t?r.set(c,{state:"pending",value:void 0}):r.set(c,{state:"fulfilled",value:h}),d.cancel()},h=>{r.set(c,{state:"rejected",value:h}),d.cancel()})),r.set(c,o),o};function a(){let l=Xe(e,[],s);return n.length===0?l:Promise.all(n.splice(0)).then(a)}return a()}async function Qd(e){return Promise.resolve(n0(e))}function vw(e){return e===null?new rn:e}function aL(...e){return e[1]?e[0].then(vw):vw(e[0])}function lL(e,t){return aL(e,t)}var Rw=class{constructor(e,t){this.property=e,this.skipRuns=t,this.coveredCases=new Map}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}run(e){let t=ve(e);if(this.coveredCases.has(t)){let r=this.coveredCases.get(t);return this.skipRuns?lL(r,this.property.isAsync()):r}let n=this.property.run(e);return this.coveredCases.set(t,n),n}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},kw=Date.now,ed=setTimeout,td=clearTimeout;function uL(e,t){let n=e;return e.isAsync()&&t.timeout!==void 0&&(n=new Q3(n,t.timeout,ed,td)),t.unbiased&&(n=new t0(n)),t.skipAllAfterTimeLimit!==void 0&&(n=new mw(n,kw,t.skipAllAfterTimeLimit,!1,ed,td)),t.interruptAfterTimeLimit!==void 0&&(n=new mw(n,kw,t.interruptAfterTimeLimit,!0,ed,td)),t.skipEqualValues&&(n=new Rw(n,!0)),t.ignoreEqualValues&&(n=new Rw(n,!1)),n}var cL=(function(e){return e[e.Success=0]="Success",e[e.Skipped=-1]="Skipped",e[e.Failure=1]="Failure",e})({}),dL=class r0{constructor(t,n){this.verbosity=t,this.interruptedAsFailure=n,this.rootExecutionTrees=[],this.currentLevelExecutionTrees=this.rootExecutionTrees,this.failure=null,this.numSkips=0,this.numSuccesses=0,this.interrupted=!1}appendExecutionTree(t,n){let r={status:t,value:n,children:[]};return this.currentLevelExecutionTrees.push(r),r}fail(t,n,r){if(this.verbosity>=1){let i=this.appendExecutionTree(1,t);this.currentLevelExecutionTrees=i.children}this.pathToFailure===void 0?this.pathToFailure=`${n}`:this.pathToFailure+=`:${n}`,this.value=t,this.failure=r}skip(t){this.verbosity>=2&&this.appendExecutionTree(-1,t),this.pathToFailure===void 0&&++this.numSkips}success(t){this.verbosity>=2&&this.appendExecutionTree(0,t),this.pathToFailure===void 0&&++this.numSuccesses}interrupt(){this.interrupted=!0}isSuccess(){return this.pathToFailure===void 0}firstFailure(){return this.pathToFailure!==void 0?+Ue(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?Ue(this.pathToFailure,":").length-1:0}extractFailures(){if(this.isSuccess())return[];let t=[],n=this.rootExecutionTrees;for(;n.length>0&&n[n.length-1].status===1;){let r=n[n.length-1];t.push(r.value),n=r.children}return t}static mergePaths(t,n){if(t.length===0)return n;let r=t.split(":"),i=n.split(":"),o=+r[r.length-1]+ +i[0];return[...r.slice(0,r.length-1),`${o}`,...i.slice(1)].join(":")}toRunDetails(t,n,r,i){if(!this.isSuccess())return{failed:!0,interrupted:this.interrupted,numRuns:this.firstFailure()+1-this.numSkips,numSkips:this.numSkips,numShrinks:this.numShrinks(),seed:t,counterexample:this.value,counterexamplePath:r0.mergePaths(n,this.pathToFailure),errorInstance:this.failure.error,failures:this.extractFailures(),executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:i.toParameters()};let o=this.interruptedAsFailure||this.numSuccesses===0;return{failed:this.numSkips>r||this.interrupted&&o,interrupted:this.interrupted,numRuns:this.numSuccesses,numSkips:this.numSkips,numShrinks:0,seed:t,counterexample:null,counterexamplePath:null,error:null,errorInstance:null,failures:[],executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:i.toParameters()}}},i0=class{constructor(e,t,n,r){this.sourceValues=e,this.shrink=t,this.runExecution=new dL(n,r),this.currentIdx=-1,this.nextValues=e}[Symbol.iterator](){return this}next(){let e=this.nextValues.next();return e.done||this.runExecution.interrupted?{done:!0,value:void 0}:(this.currentValue=e.value,++this.currentIdx,{done:!1,value:e.value.value_})}handleResult(e){e!==null&&typeof e=="object"&&!rn.isFailure(e)?(this.runExecution.fail(this.currentValue.value_,this.currentIdx,e),this.currentIdx=-1,this.nextValues=this.shrink(this.currentValue)):e!==null?e.interruptExecution?this.runExecution.interrupt():(this.runExecution.skip(this.currentValue.value_),this.sourceValues.skippedOne()):this.runExecution.success(this.currentValue.value_)}},fL=class{constructor(e,t,n){this.initialValues=e,this.maxInitialIterations=t,this.remainingSkips=n}[Symbol.iterator](){return this}next(){if(--this.maxInitialIterations!==-1&&this.remainingSkips>=0){let e=this.initialValues.next();if(!e.done)return{value:e.value,done:!1}}return{value:void 0,done:!0}}skippedOne(){--this.remainingSkips,++this.maxInitialIterations}},pL=-2147483648,hL=2147483647,mL=Math.pow(2,27),yL=Math.pow(2,-53),ef=class o0{constructor(t){this.internalRng=oa(t.clone())}clone(){return new o0(this.internalRng)}next(t){return js(this.internalRng,0,(1<<t)-1)}nextBoolean(){return js(this.internalRng,0,1)===1}nextInt(t,n){return js(this.internalRng,t===void 0?pL:t,n===void 0?hL:n)}nextBigInt(t,n){return OS(this.internalRng,t,n)}nextDouble(){let t=this.next(26),n=this.next(27);return(t*mL+n)*yL}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState=="function")return this.internalRng.getState()}};function gL(e,t,n){return t.jump(),e.generate(new ef(t),n)}function*s0(e,t,n,r){for(let i=0;i!==r.length;++i)yield new D(r[i],void 0);for(let i=0,o=n(t);;++i)yield gL(e,o,i)}function bL(e,t,n){return()=>e.generate(new ef(t),n)}function*a0(e,t,n,r){yield*z(r,s=>()=>new D(s,void 0));let i=0,o=oa(n(t));for(;;)o.jump(),yield bL(e,o,i++)}function Cw(e){return e()}function l0(e,t,n){let r=t,i=e.split(":").map(s=>+s);if(i.length===0)return r.map(Cw);if(!i.every(s=>!Number.isNaN(s)))throw new Error(`Unable to replay, got invalid path=${e}`);let o=r.drop(i[0]).map(Cw);for(let s of i.slice(1)){let a=o.getNthOrLast(0);if(a===null)throw new Error(`Unable to replay, got wrong path=${e}`);o=n(a).drop(s)}return o}var SL=Object.assign;function wL(e){return e.length===1?`Hint: ${e[0]}`:e.map((t,n)=>`Hint (${n+1}): ${t}`).join(`
96
- `)}function xL(e,t){return`Encountered failures were:
97
- - ${e.map(t).join(`
98
- - `)}`}function tf(e,t){let n=[],r=[];for(let i=e.length-1;i>=0;--i)r.push({depth:1,tree:e[i]});for(;r.length!==0;){let i=r.pop(),o=i.tree,s=i.depth,a=o.status===0?"\x1B[32m\u221A\x1B[0m":o.status===1?"\x1B[31m\xD7\x1B[0m":"\x1B[33m!\x1B[0m",l=s!==0?". ".repeat(s-1):"";n.push(`${l}${a} ${t(o.value)}`);for(let u=o.children.length-1;u>=0;--u)r.push({depth:s+1,tree:o.children[u]})}return`Execution summary:
99
- ${n.join(`
100
- `)}`}function vL(e,t){let n=`Failed to run property, too many pre-condition failures encountered
101
- { seed: ${e.seed} }
102
-
103
- Ran ${e.numRuns} time(s)
104
- Skipped ${e.numSkips} time(s)`,r=null,i=["Try to reduce the number of rejected values by combining map, chain and built-in arbitraries","Increase failure tolerance by setting maxSkipsPerRun to an higher value"];return e.verbose>=2?r=tf(e.executionSummary,t):$(i,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:n,details:r,hints:i}}function RL(e){if(e instanceof L&&e.stack!==void 0)return e.stack;try{return Ve(e)}catch{}if(e instanceof L)try{return O3(e)}catch{}if(e!==null&&typeof e=="object")try{return Rd(e)}catch{}return"Failed to serialize errorInstance"}function kL(e,t){let n=e.runConfiguration.includeErrorInReport?`
105
- Got ${A3(RL(e.errorInstance),/^Error: /,"error: ")}`:"",r=`Property failed after ${e.numRuns} tests
106
- { seed: ${e.seed}, path: "${e.counterexamplePath}", endOnFailure: true }
107
- Counterexample: ${t(e.counterexample)}
108
- Shrunk ${e.numShrinks} time(s)${n}`,i=null,o=[];return e.verbose>=2?i=tf(e.executionSummary,t):e.verbose===1?i=xL(e.failures,t):$(o,"Enable verbose mode in order to have the list of all failing values encountered during the run"),{message:r,details:i,hints:o}}function CL(e,t){let n=`Property interrupted after ${e.numRuns} tests
109
- { seed: ${e.seed} }`,r=null,i=[];return e.verbose>=2?r=tf(e.executionSummary,t):$(i,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:n,details:r,hints:i}}function Cd(e,t){if(!e.failed)return;let{message:n,details:r,hints:i}=e.counterexamplePath===null?e.interrupted?CL(e,t):vL(e,t):kL(e,t),o=n;return r!==null&&(o+=`
110
-
111
- ${r}`),i.length>0&&(o+=`
112
-
113
- ${wL(i)}`),o}function u0(e){return Cd(e,ve)}async function c0(e){let t=[];function n(s){let a=n0(s);return typeof a=="string"?a:(t.push(Promise.all([s,a])),"\u2026")}let r=Cd(e,n);if(t.length===0)return r;let i=new Ft(await Promise.all(t));function o(s){let a=Ze(i,s);return a!==void 0?a:ve(s)}return Cd(e,o)}function d0(e,t){if(t.runConfiguration.includeErrorInReport)throw new L(e);let n=new L(e,{cause:t.errorInstance});return"cause"in n||SL(n,{cause:t.errorInstance}),n}function EL(e){if(e.failed)throw d0(u0(e),e)}async function AL(e){if(e.failed)throw d0(await c0(e),e)}function IL(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):EL(e)}async function PL(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):AL(e)}function TL(e,t,n,r,i){let o=new i0(n,t,r,i);for(let s of o){e.runBeforeEach();let a=e.run(s);e.runAfterEach(),o.handleResult(a)}return o.runExecution}async function ML(e,t,n,r,i){let o=new i0(n,t,r,i);for(let s of o){await e.runBeforeEach();let a=await e.run(s);await e.runAfterEach(),o.handleResult(a)}return o.runExecution}function f0(e,t){if(e==null||e.generate===null||e.generate===void 0)throw new Error("Invalid property encountered, please use a valid property");if(e.run===null||e.run===void 0)throw new Error("Invalid property encountered, please use a valid property not an arbitrary");let n=Jd({...pt(),...t});if(n.reporter!==void 0&&n.asyncReporter!==void 0)throw new Error("Invalid parameters encountered, reporter and asyncReporter cannot be specified together");if(n.asyncReporter!==void 0&&!e.isAsync())throw new Error("Invalid parameters encountered, only asyncProperty can be used when asyncReporter specified");let r=uL(e,n),i=n.path.length===0||n.path.indexOf(":")===-1?n.numRuns:-1,o=n.numRuns*n.maxSkipsPerRun,s=(...u)=>r.shrink(...u),a=new fL(n.path.length===0?s0(r,n.seed,n.randomType,n.examples):l0(n.path,tn(a0(r,n.seed,n.randomType,n.examples)),s),i,o),l=n.endOnFailure?F.nil:s;return r.isAsync()?ML(r,l,a,n.verbose,n.markInterruptAsFailure).then(u=>u.toRunDetails(n.seed,n.path,o,n)):TL(r,l,a,n.verbose,n.markInterruptAsFailure).toRunDetails(n.seed,n.path,o,n)}function OL(e,t){let n=f0(e,t);if(e.isAsync())return n.then(PL);IL(n)}function NL(e,t){let n=Object.prototype.hasOwnProperty.call(e,"isAsync")?e:new Q1(e,()=>!0);return t.unbiased===!0?new t0(n):n}function p0(e,t){let n=Jd(typeof t=="number"?{...pt(),numRuns:t}:{...pt(),...t}),r=NL(e,n),i=r.shrink.bind(r);return(n.path.length===0?tn(s0(r,n.seed,n.randomType,n.examples)):l0(n.path,tn(a0(r,n.seed,n.randomType,n.examples)),i)).take(n.numRuns).map(o=>o.value_)}function LL(e,t){return[...p0(e,t)]}function $L(e){return(Math.round(e*100)/100).toFixed(2)}function _L(e,t,n){let r=Jd(typeof n=="number"?{...pt(),numRuns:n}:{...pt(),...n}),i={};for(let l of p0(e,n)){let u=t(l),c=Array.isArray(u)?u:[u];for(let d of c)i[d]=(i[d]||0)+1}let o=Object.entries(i).sort((l,u)=>u[1]-l[1]).map(l=>[l[0],`${$L(l[1]*100/r.numRuns)}%`]),s=o.map(l=>l[0].length).reduce((l,u)=>Math.max(l,u),0),a=o.map(l=>l[1].length).reduce((l,u)=>Math.max(l,u),0);for(let l of o)r.logger(`${l[0].padEnd(s,".")}..${l[1].padStart(a,".")}`)}var DL=Object.assign;function Ed(e,t,n,r){let i=n(),o=e.clone(),s={mrng:e.clone(),biasFactor:t,history:[]},a=u=>{let c=i[s.history.length];if(c!==void 0&&c.arb===u){let f=c.value;return $(s.history,{arb:u,value:f,context:c.context,mrng:c.mrng}),o=c.mrng.clone(),f}let d=u.generate(o,t);return $(s.history,{arb:u,value:d.value_,context:d.context,mrng:o.clone()}),d.value},l=(u,...c)=>a(r(u,c));return new D(DL(l,{values(){return z(s.history,u=>u.value)},[Te](){return Ed(e,t,n,r).value},[ht](){return ve(z(s.history,u=>u.value))}}),s)}var nd=Array.isArray,Ew=Object.keys,jL=Object.is;function FL(e){let t=new Ft;return function(r,i){let o=Ze(t,r);if(o===void 0){let l=r(...i);return ft(t,r,[{args:i,value:l}]),l}let s=o;for(let l of s)if(e(i,l.args))return l.value;let a=r(...i);return $(s,{args:i,value:a}),a}}function h0(e,t){if(e!==null&&typeof e=="object"&&t!==null&&typeof t=="object"){if(nd(e)){if(!nd(t)||e.length!==t.length)return!1}else if(nd(t))return!1;if(Ew(e).length!==Ew(t).length)return!1;for(let n in e)if(!(n in t)||!h0(e[n],t[n]))return!1;return!0}else return jL(e,t)}var BL=class extends ue{constructor(...e){super(...e),this.arbitraryCache=FL(h0)}generate(e,t){return Ed(e,t,()=>[],this.arbitraryCache)}canShrinkWithoutContext(e){return!1}shrink(e,t){if(t===void 0)return F.nil();let n=t,r=n.mrng,i=n.biasFactor,o=n.history;return J1(o.map(s=>s.arb),o.map(s=>s.value),o.map(s=>s.context)).map(s=>{function a(){let l=s.value,u=s.context;return z(o,(c,d)=>({arb:c.arb,value:l[d],context:u[d],mrng:c.mrng}))}return Ed(r,i,a,this.arbitraryCache)})}};function VL(){return new BL}var UL=Math.floor,Aw=Math.log;function WL(e){return UL(Aw(e)/Aw(2))}function zL(e){return e===O(0)?O(0):O(Ve(e).length)}function m0(e,t,n){if(e===t)return[{min:e,max:t}];if(e<0&&t>0){let s=n(-e),a=n(t);return[{min:-s,max:a},{min:t-a,max:t},{min:e,max:e+s}]}let r=n(t-e),i={min:e,max:e+r},o={min:t-r,max:t};return e<0?[o,i]:[i,o]}var GL=Math.ceil,HL=Math.floor;function Iw(e){return HL(e/2)}function Pw(e){return GL(e/2)}function Tw(e,t,n){let r=e-t;function*i(){let s=n?void 0:t,a=n?r:Iw(r);for(let l=a;l>0;l=Iw(l)){let u=l===r?t:e-l;yield new D(u,s),s=u}}function*o(){let s=n?void 0:t,a=n?r:Pw(r);for(let l=a;l<0;l=Pw(l)){let u=l===r?t:e-l;yield new D(u,s),s=u}}return r>0?tn(i()):tn(o())}var Mw=Math.sign,qL=Number.isInteger,KL=Object.is,hr=class y0 extends ue{constructor(t,n){super(),this.min=t,this.max=n}generate(t,n){let r=this.computeGenerateRange(t,n);return new D(t.nextInt(r.min,r.max),void 0)}canShrinkWithoutContext(t){return typeof t=="number"&&qL(t)&&!KL(t,-0)&&this.min<=t&&t<=this.max}shrink(t,n){return y0.isValidContext(t,n)?this.isLastChanceTry(t,n)?F.of(new D(n,void 0)):Tw(t,n,!1):Tw(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?0:this.min<0?this.max:this.min}computeGenerateRange(t,n){if(n===void 0||t.nextInt(1,n)!==1)return{min:this.min,max:this.max};let r=m0(this.min,this.max,WL);if(r.length===1)return r[0];let i=t.nextInt(-2*(r.length-1),r.length-2);return i<0?r[0]:r[i+1]}isLastChanceTry(t,n){return t>0?t===n+1&&t>this.min:t<0?t===n-1&&t<this.max:!1}static isValidContext(t,n){if(n===void 0)return!1;if(typeof n!="number")throw new Error("Invalid context type passed to IntegerArbitrary (#1)");if(n!==0&&Mw(t)!==Mw(n))throw new Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}},Ow=Number.isInteger;function YL(e){return{min:e.min!==void 0?e.min:-2147483648,max:e.max!==void 0?e.max:2147483647}}function re(e={}){let t=YL(e);if(t.min>t.max)throw new Error("fc.integer maximum value should be equal or greater than the minimum one");if(!Ow(t.min))throw new Error("fc.integer minimum value should be an integer");if(!Ow(t.max))throw new Error("fc.integer maximum value should be an integer");return new hr(t.min,t.max)}var Nw=new Map;function nf(e){if(e===void 0)return{depth:0};if(typeof e!="string")return e;let t=Ze(Nw,e);if(t!==void 0)return t;let n={depth:0};return ft(Nw,e,n),n}function rf(){return{depth:0}}var JL=class{constructor(e,t,n){this.arb=e,this.mrng=t,this.biasFactor=n}attemptExact(){}next(){return this.arb.generate(this.mrng,this.biasFactor)}},XL=Math.min,ZL=Math.max,QL=class{constructor(e,t,n,r){this.arb=e,this.mrng=t,this.slices=n,this.biasFactor=r,this.activeSliceIndex=0,this.nextIndexInSlice=0,this.lastIndexInSlice=-1}attemptExact(e){if(e!==0&&this.mrng.nextInt(1,this.biasFactor)===1){let t=[];for(let n=0;n!==this.slices.length;++n)this.slices[n].length===e&&$(t,n);if(t.length===0)return;this.activeSliceIndex=t[this.mrng.nextInt(0,t.length-1)],this.nextIndexInSlice=0,this.lastIndexInSlice=e-1}}next(){if(this.nextIndexInSlice<=this.lastIndexInSlice)return new D(this.slices[this.activeSliceIndex][this.nextIndexInSlice++],void 0);if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.arb.generate(this.mrng,this.biasFactor);this.activeSliceIndex=this.mrng.nextInt(0,this.slices.length-1);let e=this.slices[this.activeSliceIndex];if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.nextIndexInSlice=1,this.lastIndexInSlice=e.length-1,new D(e[0],void 0);let t=this.mrng.nextInt(0,e.length-1),n=this.mrng.nextInt(0,e.length-1);return this.nextIndexInSlice=XL(t,n),this.lastIndexInSlice=ZL(t,n),new D(e[this.nextIndexInSlice++],void 0)}};function Lw(e,t,n,r){return r===void 0||n.length===0||t.nextInt(1,r)!==1?new JL(e,t,r):new QL(e,t,n,r)}var e$=Math.floor,$w=Math.log,_w=Math.max,t$=Array.isArray;function rd(e,t){return e===t?e:e+e$($w(t-e)/$w(2))}var g0=class b0 extends ue{constructor(t,n,r,i,o,s,a){super(),this.arb=t,this.minLength=n,this.maxGeneratedLength=r,this.maxLength=i,this.setBuilder=s,this.customSlices=a,this.lengthArb=re({min:n,max:r}),this.depthContext=nf(o)}preFilter(t){if(this.setBuilder===void 0)return t;let n=this.setBuilder();for(let r=0;r!==t.length;++r)n.tryAdd(t[r]);return n.getData()}static makeItCloneable(t,n){return t[Te]=()=>{let r=[];for(let i=0;i!==n.length;++i)$(r,n[i].value);return this.makeItCloneable(r,n),r},t}generateNItemsNoDuplicates(t,n,r,i){let o=0,s=t(),a=Lw(this.arb,r,this.customSlices,i);for(;s.size()<n&&o<this.maxGeneratedLength;){let l=a.next();s.tryAdd(l)?o=0:o+=1}return s.getData()}safeGenerateNItemsNoDuplicates(t,n,r,i){let o=_w(0,n-rd(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=o;try{return this.generateNItemsNoDuplicates(t,n,r,i)}finally{this.depthContext.depth-=o}}generateNItems(t,n,r){let i=[],o=Lw(this.arb,n,this.customSlices,r);o.attemptExact(t);for(let s=0;s!==t;++s)$(i,o.next());return i}safeGenerateNItems(t,n,r){let i=_w(0,t-rd(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=i;try{return this.generateNItems(t,n,r)}finally{this.depthContext.depth-=i}}wrapper(t,n,r,i){let o=n?this.preFilter(t):t,s=!1,a=[],l=[];for(let u=0;u!==o.length;++u){let c=o[u];s=s||c.hasToBeCloned,$(a,c.value),$(l,c.context)}return s&&b0.makeItCloneable(a,o),new D(a,{shrunkOnce:n,lengthContext:t.length===o.length&&r!==void 0?r:void 0,itemsContexts:l,startIndex:i})}generate(t,n){let r=this.applyBias(t,n),i=r.size,o=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,i,t,r.biasFactorItems):this.safeGenerateNItems(i,t,r.biasFactorItems);return this.wrapper(o,!1,void 0,0)}applyBias(t,n){if(n===void 0)return{size:this.lengthArb.generate(t,void 0).value};if(this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(t,void 0).value,biasFactorItems:n};if(t.nextInt(1,n)!==1)return{size:this.lengthArb.generate(t,void 0).value};if(t.nextInt(1,n)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(t,void 0).value,biasFactorItems:n};let r=rd(this.minLength,this.maxGeneratedLength);return{size:re({min:this.minLength,max:r}).generate(t,void 0).value,biasFactorItems:n}}canShrinkWithoutContext(t){if(!t$(t)||this.minLength>t.length||t.length>this.maxLength)return!1;for(let n=0;n!==t.length;++n)if(!(n in t)||!this.arb.canShrinkWithoutContext(t[n]))return!1;return this.preFilter(z(t,n=>new D(n,void 0))).length===t.length}shrinkItemByItem(t,n,r){let i=[];for(let o=n.startIndex;o<r;++o)$(i,en(()=>this.arb.shrink(t[o],n.itemsContexts[o]).map(s=>{let a=z(Oe(t,0,o),(u,c)=>new D(cr(u),n.itemsContexts[c])),l=z(Oe(t,o+1),(u,c)=>new D(cr(u),n.itemsContexts[c+o+1]));return[[...a,s,...l],void 0,o]})));return F.nil().join(...i)}shrinkImpl(t,n){if(t.length===0)return F.nil();let r=n!==void 0?n:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(t.length,r.lengthContext).drop(r.shrunkOnce&&r.lengthContext===void 0&&t.length>this.minLength+1?1:0).map(i=>{let o=t.length-i.value;return[z(Oe(t,o),(s,a)=>new D(cr(s),r.itemsContexts[a+o])),i.context,0]}).join(en(()=>t.length>this.minLength?this.shrinkItemByItem(t,r,1):this.shrinkItemByItem(t,r,t.length))).join(t.length>this.minLength?en(()=>{let i={shrunkOnce:!1,lengthContext:void 0,itemsContexts:Oe(r.itemsContexts,1),startIndex:0};return this.shrinkImpl(Oe(t,1),i).filter(o=>this.minLength<=o[0].length+1).map(o=>[[new D(cr(t[0]),r.itemsContexts[0]),...o[0]],void 0,0])}):F.nil())}shrink(t,n){return this.shrinkImpl(t,n).map(r=>this.wrapper(r[0],!0,r[1],r[2]))}},n$=Math.floor,r$=Math.min,En=2147483647,ar=["xsmall","small","medium","large","xlarge"],i$=["-4","-3","-2","-1","=","+1","+2","+3","+4"],of="small";function o$(e,t){switch(t){case"xsmall":return n$(1.1*e)+1;case"small":return 2*e+10;case"medium":return 11*e+100;case"large":return 101*e+1e3;case"xlarge":return 1001*e+1e4;default:throw new Error(`Unable to compute lengths based on received size: ${t}`)}}function Ci(e,t){let n=Dt(i$,e);if(n===-1)return e;let r=Dt(ar,t);if(r===-1)throw new Error(`Unable to offset size based on the unknown defaulted one: ${t}`);let i=r+n-4;return i<0?ar[0]:i>=ar.length?ar[ar.length-1]:ar[i]}function Ri(e,t,n,r){let{baseSize:i=of,defaultSizeToMaxWhenMaxSpecified:o}=pt()||{},s=e!==void 0?e:r&&o?"max":i;return s==="max"?n:r$(o$(t,Ci(s,i)),n)}function s$(e,t){if(typeof e=="number")return 1/e;let{baseSize:n=of,defaultSizeToMaxWhenMaxSpecified:r}=pt()||{},i=e!==void 0?e:t&&r?"max":n;if(i==="max")return 0;switch(Ci(i,n)){case"xsmall":return 1;case"small":return .5;case"medium":return .25;case"large":return .125;case"xlarge":return .0625}}function sf(e){let{baseSize:t=of}=pt()||{};return e===void 0?t:Ci(e,t)}function se(e,t={}){let n=t.size,r=t.minLength||0,i=t.maxLength,o=t.depthIdentifier,s=i!==void 0?i:En;return new g0(e,r,Ri(n,r,s,i!==void 0),s,o,void 0,t.experimentalCustomSlices||[])}function Fs(e){return e/O(2)}function Dw(e,t,n){let r=e-t;function*i(){let s=n?void 0:t,a=n?r:Fs(r);for(let l=a;l>0;l=Fs(l)){let u=e-l;yield new D(u,s),s=u}}function*o(){let s=n?void 0:t,a=n?r:Fs(r);for(let l=a;l<0;l=Fs(l)){let u=e-l;yield new D(u,s),s=u}}return r>0?tn(i()):tn(o())}var a$=class S0 extends ue{constructor(t,n){super(),this.min=t,this.max=n}generate(t,n){let r=this.computeGenerateRange(t,n);return new D(t.nextBigInt(r.min,r.max),void 0)}computeGenerateRange(t,n){if(n===void 0||t.nextInt(1,n)!==1)return{min:this.min,max:this.max};let r=m0(this.min,this.max,zL);if(r.length===1)return r[0];let i=t.nextInt(-2*(r.length-1),r.length-2);return i<0?r[0]:r[i+1]}canShrinkWithoutContext(t){return typeof t=="bigint"&&this.min<=t&&t<=this.max}shrink(t,n){return S0.isValidContext(t,n)?this.isLastChanceTry(t,n)?F.of(new D(n,void 0)):Dw(t,n,!1):Dw(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?O(0):this.min<0?this.max:this.min}isLastChanceTry(t,n){return t>0?t===n+O(1)&&t>this.min:t<0?t===n-O(1)&&t<this.max:!1}static isValidContext(t,n){if(n===void 0)return!1;if(typeof n!="bigint")throw new Error("Invalid context type passed to BigIntArbitrary (#1)");let r=t>0&&n<0||t<0&&n>0;if(n!==O(0)&&r)throw new Error("Invalid context value passed to BigIntArbitrary (#2)");return!0}};function l$(e){let n=O(-1)<<O(255),r=(O(1)<<O(255))-O(1),i=e.min,o=e.max;return{min:i!==void 0?i:n-(o!==void 0&&o<O(0)?o*o:O(0)),max:o!==void 0?o:r+(i!==void 0&&i>O(0)?i*i:O(0))}}function u$(e){return e[0]===void 0?{}:e[1]===void 0?e[0]:{min:e[0],max:e[1]}}function nn(...e){let t=l$(u$(e));if(t.min>t.max)throw new Error("fc.bigInt expects max to be greater than or equal to min");return new a$(t.min,t.max)}var c$=Object.getPrototypeOf,yi=class extends ue{constructor(e){super(),this.arb=e}generate(e,t){return this.arb.generate(e,void 0)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return this.arb.shrink(e,t)}};function na(e){return c$(e)===yi.prototype&&e.generate===yi.prototype.generate&&e.canShrinkWithoutContext===yi.prototype.canShrinkWithoutContext&&e.shrink===yi.prototype.shrink?e:new yi(e)}function d$(e){return e===1}function f$(e){if(typeof e!="boolean")throw new Error("Unsupported input type");return e===!0?1:0}function Ei(){return na(re({min:0,max:1}).map(d$,f$))}var Si=Object.is,p$=class{constructor(e){this.values=e,this.fastValues=new dr(this.values);let t=!1,n=!1;if(ta(this.fastValues,0))for(let r=0;r!==this.values.length;++r){let i=this.values[r];t=t||Si(i,-0),n=n||Si(i,0)}this.hasMinusZero=t,this.hasPlusZero=n}has(e){return e===0?Si(e,0)?this.hasPlusZero:this.hasMinusZero:ta(this.fastValues,e)}},w0=class extends ue{constructor(e){super(),this.values=e}generate(e,t){let n=this.values.length===1?0:e.nextInt(0,this.values.length-1),r=this.values[n];return Cn(r)?new D(r,n,()=>r[Te]()):new D(r,n)}canShrinkWithoutContext(e){return this.values.length===1?Si(this.values[0],e):(this.fastValues===void 0&&(this.fastValues=new p$(this.values)),this.fastValues.has(e))}shrink(e,t){return t===0||Si(e,this.values[0])?F.nil():F.of(new D(this.values[0],0))}};function kt(...e){if(e.length===0)throw new Error("fc.constantFrom expects at least one parameter");return new w0(e)}function h$(e){return!e||!e.withBigInt?kt(!1,null,void 0,0,"",NaN):kt(!1,null,void 0,0,"",NaN,O(0))}function xe(e){return new w0([e])}var m$=class x0{constructor(){this.receivedLogs=[]}log(t){this.receivedLogs.push(t)}size(){return this.receivedLogs.length}toString(){return JSON.stringify({logs:this.receivedLogs})}[Te](){return new x0}};function y$(){return xe(new m$)}var g$=NaN,b$=Number.isNaN;function v0(e){return new Qs(e)}function R0(e){if(!(e instanceof Qs)||e.constructor!==Qs)throw new L("Not a valid value for date unmapper");return ea(e)}function S$(e){return t=>t===e?new Qs(g$):v0(t)}function w$(e){return t=>{let n=R0(t);return b$(n)?e:n}}var jw=Number.isNaN;function k0(e={}){let t=e.min!==void 0?ea(e.min):-864e13,n=e.max!==void 0?ea(e.max):864e13,r=e.noInvalidDate;if(jw(t))throw new Error("fc.date min must be valid instance of Date");if(jw(n))throw new Error("fc.date max must be valid instance of Date");if(t>n)throw new Error("fc.date max must be greater or equal to min");if(r)return re({min:t,max:n}).map(v0,R0);let i=n+1;return re({min:t,max:n+1}).map(S$(i),w$(i))}var x$=class extends ue{constructor(e,t){super(),this.startArb=e,this.chainer=t}generate(e,t){let n=[],r=e.clone(),i=this.startArb.generate(e,t);for(n.push({arbitrary:this.startArb,value:i.value_,context:i.context,clonedMrng:r});;){let s=this.chainer(i.value_);if(s===void 0)break;let a=e.clone();i=s.generate(e,t),n.push({arbitrary:s,value:i.value_,context:i.context,clonedMrng:a})}let o={biasFactor:t,entries:n,currentShrinkLevel:0};return new D(i.value_,o)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?new F(this.shrinkIterator(t)):F.nil()}*shrinkIterator(e){let{entries:t,currentShrinkLevel:n,biasFactor:r}=e;for(let i=n;i<t.length;++i){let o=t[i],s=o.arbitrary.shrink(o.value,o.context);for(let a of s){let l=t.slice(0,i);l.push({arbitrary:o.arbitrary,value:a.value_,context:a.context,clonedMrng:o.clonedMrng});let u=a,c=o.clonedMrng.clone();for(;;){let h=this.chainer(u.value_);if(h===void 0)break;let p=c.clone(),m=h.generate(c,r);l.push({arbitrary:h,value:m.value_,context:m.context,clonedMrng:p}),u=m}let d=l[l.length-1],f={biasFactor:r,entries:l,currentShrinkLevel:i};yield new D(d.value,f)}}}isSafeContext(e){return e!=null&&typeof e=="object"&&"biasFactor"in e&&"entries"in e&&"currentShrinkLevel"in e}};function v$(e,t){return new x$(e,t)}var R$=Symbol.iterator,k$=Array.isArray,C$=Object.is,E$=class C0 extends ue{constructor(t,n){super(),this.arb=t,this.numValues=n}generate(t,n){let r=[];if(this.numValues<=0)return this.wrapper(r);for(let i=0;i!==this.numValues-1;++i)$(r,this.arb.generate(t.clone(),n));return $(r,this.arb.generate(t,n)),this.wrapper(r)}canShrinkWithoutContext(t){if(!k$(t)||t.length!==this.numValues)return!1;if(t.length===0)return!0;for(let n=1;n<t.length;++n)if(!C$(t[0],t[n]))return!1;return this.arb.canShrinkWithoutContext(t[0])}shrink(t,n){return t.length===0?F.nil():new F(this.shrinkImpl(t,n!==void 0?n:[])).map(r=>this.wrapper(r))}*shrinkImpl(t,n){let r=z(t,(o,s)=>this.arb.shrink(o,n[s])[R$]()),i=z(r,o=>o.next());for(;!i[0].done;)yield z(i,o=>o.value),i=z(r,o=>o.next())}static makeItCloneable(t,n){return t[Te]=()=>{let r=[];for(let i=0;i!==n.length;++i)$(r,n[i].value);return this.makeItCloneable(r,n),r},t}wrapper(t){let n=!1,r=[],i=[];for(let o=0;o!==t.length;++o){let s=t[o];n=n||s.hasToBeCloned,$(r,s.value),$(i,s.context)}return n&&C0.makeItCloneable(r,t),new D(r,i)}};function A$(e,t){return new E$(e,t)}var Fw=class{constructor(e){this.isEqual=e,this.data=[]}tryAdd(e){for(let t=0;t!==this.data.length;++t)if(this.isEqual(this.data[t],e))return!1;return $(this.data,e),!0}size(){return this.data.length}getData(){return this.data}},I$=Number.isNaN,P$=class{constructor(e){this.selector=e,this.selectedItemsExceptNaN=new dr,this.data=[]}tryAdd(e){let t=this.selector(e);if(I$(t))return $(this.data,e),!0;let n=this.selectedItemsExceptNaN.size;return wi(this.selectedItemsExceptNaN,t),n!==this.selectedItemsExceptNaN.size?($(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},T$=Object.is,M$=class{constructor(e){this.selector=e,this.selectedItemsExceptMinusZero=new dr,this.data=[],this.hasMinusZero=!1}tryAdd(e){let t=this.selector(e);if(T$(t,-0))return this.hasMinusZero?!1:($(this.data,e),this.hasMinusZero=!0,!0);let n=this.selectedItemsExceptMinusZero.size;return wi(this.selectedItemsExceptMinusZero,t),n!==this.selectedItemsExceptMinusZero.size?($(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},O$=class{constructor(e){this.selector=e,this.selectedItems=new dr,this.data=[]}tryAdd(e){let t=this.selector(e),n=this.selectedItems.size;return wi(this.selectedItems,t),n!==this.selectedItems.size?($(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}};function N$(e){if(typeof e.comparator=="function"){if(e.selector===void 0){let a=e.comparator,l=(u,c)=>a(u.value_,c.value_);return()=>new Fw(l)}let r=e.comparator,i=e.selector,o=a=>i(a.value_),s=(a,l)=>r(o(a),o(l));return()=>new Fw(s)}let t=e.selector||(r=>r),n=r=>t(r.value_);switch(e.comparator){case"IsStrictlyEqual":return()=>new P$(n);case"SameValueZero":return()=>new O$(n);case"SameValue":case void 0:return()=>new M$(n)}}function An(e,t={}){let n=t.minLength!==void 0?t.minLength:0,r=t.maxLength!==void 0?t.maxLength:En,i=Ri(t.size,n,r,t.maxLength!==void 0),o=t.depthIdentifier,s=new g0(e,n,i,r,o,N$(t),[]);return n===0?s:s.filter(a=>a.length>=n)}var L$=Object.create,$$=Object.defineProperty,_$=Object.getOwnPropertyDescriptor,Bw=Object.getPrototypeOf,D$=Object.prototype,j$=Reflect.ownKeys;function F$(e){let t=e[1]?L$(null):{};for(let n of e[0])$$(t,n[0],{enumerable:!0,configurable:!0,writable:!0,value:n[1]});return t}function B$(e){return e!==void 0&&!!e.configurable&&!!e.enumerable&&!!e.writable&&e.get===void 0&&e.set===void 0}function V$(e){if(typeof e!="object"||e===null)throw new L("Incompatible instance received: should be a non-null object");let t=Bw(e)===null,n=Bw(e)===D$;if(!t&&!n)throw new L("Incompatible instance received: should be of exact type Object");let r=z(j$(e),i=>[i,_$(e,i)]);if(!G1(r,([,i])=>B$(i)))throw new L("Incompatible instance received: should contain only c/e/w properties without get/set");return[z(r,([i,o])=>[i,o.value]),t]}function U$(e){return e[0]}function af(e,t,n={}){let r=!!n.noNullPrototype;return V(An(V(e,t),{minLength:n.minKeys,maxLength:n.maxKeys,size:n.size,selector:U$,depthIdentifier:n.depthIdentifier}),r?xe(!1):Ei()).map(F$,V$)}var W$=Number.POSITIVE_INFINITY,z$=Number.MAX_SAFE_INTEGER,G$=Number.isInteger,H$=Math.floor,q$=Math.pow,K$=Math.min,Ad=class E0 extends ue{static from(t,n,r){if(t.length===0)throw new Error(`${r} expects at least one weighted arbitrary`);let i=0;for(let o=0;o!==t.length;++o){if(t[o].arbitrary===void 0)throw new Error(`${r} expects arbitraries to be specified`);let s=t[o].weight;if(i+=s,!G$(s))throw new Error(`${r} expects weights to be integer values`);if(s<0)throw new Error(`${r} expects weights to be superior or equal to 0`)}if(i<=0)throw new Error(`${r} expects the sum of weights to be strictly superior to 0`);return new E0(t,{depthBias:s$(n.depthSize,n.maxDepth!==void 0),maxDepth:n.maxDepth!==void 0?n.maxDepth:W$,withCrossShrink:!!n.withCrossShrink},nf(n.depthIdentifier))}constructor(t,n,r){super(),this.warbs=t,this.constraints=n,this.context=r;let i=0;this.cumulatedWeights=[];for(let o=0;o!==t.length;++o)i+=t[o].weight,$(this.cumulatedWeights,i);this.totalWeight=i}generate(t,n){if(this.mustGenerateFirst())return this.safeGenerateForIndex(t,0,n);let r=t.nextInt(this.computeNegDepthBenefit(),this.totalWeight-1);for(let i=0;i!==this.cumulatedWeights.length;++i)if(r<this.cumulatedWeights[i])return this.safeGenerateForIndex(t,i,n);throw new Error("Unable to generate from fc.frequency")}canShrinkWithoutContext(t){return this.canShrinkWithoutContextIndex(t)!==-1}shrink(t,n){if(n!==void 0){let i=n,o=i.selectedIndex,s=i.originalBias,a=this.warbs[o].arbitrary.shrink(t,i.originalContext).map(l=>this.mapIntoValue(o,l,null,s));if(i.clonedMrngForFallbackFirst!==null){i.cachedGeneratedForFirst===void 0&&(i.cachedGeneratedForFirst=this.safeGenerateForIndex(i.clonedMrngForFallbackFirst,0,s));let l=i.cachedGeneratedForFirst;return F.of(l).join(a)}return a}let r=this.canShrinkWithoutContextIndex(t);return r===-1?F.nil():this.defaultShrinkForFirst(r).join(this.warbs[r].arbitrary.shrink(t,void 0).map(i=>this.mapIntoValue(r,i,null,void 0)))}defaultShrinkForFirst(t){++this.context.depth;try{if(!this.mustFallbackToFirstInShrink(t)||this.warbs[0].fallbackValue===void 0)return F.nil()}finally{--this.context.depth}let n=new D(this.warbs[0].fallbackValue.default,void 0);return F.of(this.mapIntoValue(0,n,null,void 0))}canShrinkWithoutContextIndex(t){if(this.mustGenerateFirst())return this.warbs[0].arbitrary.canShrinkWithoutContext(t)?0:-1;try{++this.context.depth;for(let n=0;n!==this.warbs.length;++n){let r=this.warbs[n];if(r.weight!==0&&r.arbitrary.canShrinkWithoutContext(t))return n}return-1}finally{--this.context.depth}}mapIntoValue(t,n,r,i){let o={selectedIndex:t,originalBias:i,originalContext:n.context,clonedMrngForFallbackFirst:r};return new D(n.value,o)}safeGenerateForIndex(t,n,r){++this.context.depth;try{let i=this.warbs[n].arbitrary.generate(t,r),o=this.mustFallbackToFirstInShrink(n)?t.clone():null;return this.mapIntoValue(n,i,o,r)}finally{--this.context.depth}}mustGenerateFirst(){return this.constraints.maxDepth<=this.context.depth}mustFallbackToFirstInShrink(t){return t!==0&&this.constraints.withCrossShrink&&this.warbs[0].weight!==0}computeNegDepthBenefit(){let t=this.constraints.depthBias;if(t<=0||this.warbs[0].weight===0)return 0;let n=H$(q$(1+t,this.context.depth))-1;return-K$(this.totalWeight*n,z$)||0}};function Y$(e){return e!=null&&typeof e=="object"&&!("generate"in e)&&!("arbitrary"in e)&&!("weight"in e)}function Vw(e){return L1(e)?{arbitrary:e,weight:1}:e}function Pe(...e){let t=e[0];if(Y$(t)){let r=z(Oe(e,1),Vw);return Ad.from(r,t,"fc.oneof")}let n=z(e,Vw);return Ad.from(n,{},"fc.oneof")}var J$=Number.isInteger;function Qt(e){let t=typeof e=="number"?e:e&&e.max!==void 0?e.max:2147483647;if(t<0)throw new Error("fc.nat value should be greater than or equal to 0");if(!J$(t))throw new Error("fc.nat maximum value should be an integer");return new hr(0,t)}var X$=Object.is;function Z$(e){let t=0,n=[];for(let r of e){let i=t;t=i+r.num;let o=t-1;n.push({from:i,to:o,entry:r})}return n}function Q$(e,t){let n=0,r=e.length;for(;r-n>1;){let i=~~((n+r)/2);t<e[i].from?r=i:n=i}return e[n]}function e_(e){let t=Z$(e);return function(r){let i=Q$(t,r);return i.entry.build(r-i.from)}}function t_(e){let t={mapping:new Ft,negativeZeroIndex:void 0},n=0;for(let r=0;r!==e.length;++r){let i=e[r];for(let o=0;o!==i.num;++o){let s=i.build(o);s===0&&1/s===jt.NEGATIVE_INFINITY?t.negativeZeroIndex=n:ft(t.mapping,s,n),++n}}return t}function n_(e){let t=null;return function(r){t===null&&(t=t_(e));let i=X$(r,-0)?t.negativeZeroIndex:Ze(t.mapping,r);if(i===void 0)throw new L("Unknown value encountered cannot be built using this mapToConstant");return i}}function r_(e){if(e.length===0)throw new L("fc.mapToConstant expects at least one option");let t=0;for(let n=0;n!==e.length;++n){if(e[n].num<0)throw new L("fc.mapToConstant expects all options to have a number of entries greater or equal to zero");t+=e[n].num}if(t===0)throw new L("fc.mapToConstant expects at least one choice among options");return t}function mr(...e){return Qt({max:r_(e)-1}).map(e_(e),n_(e))}function A0(e,t,n,r){if(t.length===0)return n>0?void 0:[];if(r<=0)return;let i=[{endIndexChunks:0,nextStartIndex:1,chunks:[]}];for(;i.length>0;){let o=U1(i);for(let s=o.nextStartIndex;s<=t.length;++s){let a=he(t,o.endIndexChunks,s);if(e.canShrinkWithoutContext(a)){let l=[...o.chunks,a];if(s===t.length){if(l.length<n)break;return l}$(i,{endIndexChunks:o.endIndexChunks,nextStartIndex:s+1,chunks:o.chunks}),l.length<r&&$(i,{endIndexChunks:s,nextStartIndex:s+1,chunks:l});break}}}}function i_(e){return le(e,"")}function I0(e){return e.minLength!==void 0?e.minLength:0}function P0(e){return e.maxLength!==void 0?e.maxLength:En}function o_(e,t){return I0(t)<=e.length&&e.length<=P0(t)}function s_(e,t){return function(r){if(typeof r!="string")throw new L("Unsupported value");let i=A0(e,r,I0(t),P0(t));if(i===void 0)throw new L("Unable to unmap received string");return i}}var T0=["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","apply","arguments","bind","call","caller","length","name","prototype","key","ref"];function a_(e,t,n){let r;try{r=n(e)}catch{return}for(let i of r)if(!t.canShrinkWithoutContext(i))return;return r}function l_(e,t){let n=[];for(let r of T0){let i=a_(r,e,t);i!==void 0&&$(n,i)}return n}var Uw=new WeakMap;function u_(e){let t=[];for(let n of T0){let r=A0(e,n,0,En);r!==void 0&&$(t,r)}return t}function c_(e,t){let n=l3(Uw,e);n===void 0&&(n=u_(e),a3(Uw,e,n));let r=[];for(let i of n)o_(i,t)&&$(r,i);return r}var d_=[[0,127]],f_=[[0,55295],[57344,1114111]],p_=[[32,126],[160,172],[174,767],[880,887],[890,895],[900,906],[908],[910,929],[931,1154],[1162,1327],[1329,1366],[1369,1418],[1421,1423],[1470],[1472],[1475],[1478],[1488,1514],[1519,1524],[1542,1551],[1563],[1565,1610],[1632,1647],[1649,1749],[1758],[1765,1766],[1769],[1774,1805],[1808],[1810,1839],[1869,1957],[1969],[1984,2026],[2036,2042],[2046,2069],[2074],[2084],[2088],[2096,2110],[2112,2136],[2142],[2144,2154],[2160,2190],[2208,2249],[2308,2361],[2365],[2384],[2392,2401],[2404,2432],[2437,2444],[2447,2448],[2451,2472],[2474,2480],[2482],[2486,2489],[2493],[2510],[2524,2525],[2527,2529],[2534,2557],[2565,2570],[2575,2576],[2579,2600],[2602,2608],[2610,2611],[2613,2614],[2616,2617],[2649,2652],[2654],[2662,2671],[2674,2676],[2678],[2693,2701],[2703,2705],[2707,2728],[2730,2736],[2738,2739],[2741,2745],[2749],[2768],[2784,2785],[2790,2801],[2809],[2821,2828],[2831,2832],[2835,2856],[2858,2864],[2866,2867],[2869,2873],[2877],[2908,2909],[2911,2913],[2918,2935],[2947],[2949,2954],[2958,2960],[2962,2965],[2969,2970],[2972],[2974,2975],[2979,2980],[2984,2986],[2990,3001],[3024],[3046,3066],[3077,3084],[3086,3088],[3090,3112],[3114,3129],[3133],[3160,3162],[3165],[3168,3169],[3174,3183],[3191,3200],[3204,3212],[3214,3216],[3218,3240],[3242,3251],[3253,3257],[3261],[3293,3294],[3296,3297],[3302,3311],[3313,3314],[3332,3340],[3342,3344],[3346,3386],[3389],[3407],[3412,3414],[3416,3425],[3430,3455],[3461,3478],[3482,3505],[3507,3515],[3517],[3520,3526],[3558,3567],[3572],[3585,3632],[3634],[3647,3654],[3663,3675],[3713,3714],[3716],[3718,3722],[3724,3747],[3749],[3751,3760],[3762],[3773],[3776,3780],[3782],[3792,3801],[3804,3807],[3840,3863],[3866,3892],[3894],[3896],[3898,3901],[3904,3911],[3913,3948],[3973],[3976,3980],[4030,4037],[4039,4044],[4046,4058],[4096,4138],[4159,4181],[4186,4189],[4193],[4197,4198],[4206,4208],[4213,4225],[4238],[4240,4249],[4254,4293],[4295],[4301],[4304,4351],[4608,4680],[4682,4685],[4688,4694],[4696],[4698,4701],[4704,4744],[4746,4749],[4752,4784],[4786,4789],[4792,4798],[4800],[4802,4805],[4808,4822],[4824,4880],[4882,4885],[4888,4954],[4960,4988],[4992,5017],[5024,5109],[5112,5117],[5120,5788],[5792,5880],[5888,5905],[5919,5937],[5941,5942],[5952,5969],[5984,5996],[5998,6e3],[6016,6067],[6100,6108],[6112,6121],[6128,6137],[6144,6154],[6160,6169],[6176,6264],[6272,6276],[6279,6312],[6314],[6320,6389],[6400,6430],[6464],[6468,6509],[6512,6516],[6528,6571],[6576,6601],[6608,6618],[6622,6678],[6686,6740],[6784,6793],[6800,6809],[6816,6829],[6917,6963],[6981,6988],[6992,7018],[7028,7038],[7043,7072],[7086,7141],[7164,7203],[7227,7241],[7245,7304],[7312,7354],[7357,7367],[7379],[7401,7404],[7406,7411],[7413,7414],[7418],[7424,7615],[7680,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],[8025],[8027],[8029],[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[8192,8202],[8208,8233],[8239,8287],[8304,8305],[8308,8334],[8336,8348],[8352,8384],[8448,8587],[8592,9254],[9280,9290],[9312,11123],[11126,11157],[11159,11502],[11506,11507],[11513,11557],[11559],[11565],[11568,11623],[11631,11632],[11648,11670],[11680,11686],[11688,11694],[11696,11702],[11704,11710],[11712,11718],[11720,11726],[11728,11734],[11736,11742],[11776,11869],[11904,11929],[11931,12019],[12032,12245],[12272,12329],[12336,12351],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12771],[12783,12830],[12832,13312],[19903,19968],[40959,42124],[42128,42182],[42192,42539],[42560,42606],[42611],[42622,42653],[42656,42735],[42738,42743],[42752,42954],[42960,42961],[42963],[42965,42969],[42994,43009],[43011,43013],[43015,43018],[43020,43042],[43048,43051],[43056,43065],[43072,43127],[43138,43187],[43214,43225],[43250,43262],[43264,43301],[43310,43334],[43359],[43396,43442],[43457,43469],[43471,43481],[43486,43492],[43494,43518],[43520,43560],[43584,43586],[43588,43595],[43600,43609],[43612,43642],[43646,43695],[43697],[43701,43702],[43705,43709],[43712],[43714],[43739,43754],[43760,43764],[43777,43782],[43785,43790],[43793,43798],[43808,43814],[43816,43822],[43824,43883],[43888,44002],[44011],[44016,44025],[44032],[55203],[63744,64109],[64112,64217],[64256,64262],[64275,64279],[64285],[64287,64310],[64312,64316],[64318],[64320,64321],[64323,64324],[64326,64450],[64467,64911],[64914,64967],[64975],[65008,65023],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65136,65140],[65142,65276],[65281,65437],[65440,65470],[65474,65479],[65482,65487],[65490,65495],[65498,65500],[65504,65510],[65512,65518],[65532,65533],[65536,65547],[65549,65574],[65576,65594],[65596,65597],[65599,65613],[65616,65629],[65664,65786],[65792,65794],[65799,65843],[65847,65934],[65936,65948],[65952],[66e3,66044],[66176,66204],[66208,66256],[66273,66299],[66304,66339],[66349,66378],[66384,66421],[66432,66461],[66463,66499],[66504,66517],[66560,66717],[66720,66729],[66736,66771],[66776,66811],[66816,66855],[66864,66915],[66927,66938],[66940,66954],[66956,66962],[66964,66965],[66967,66977],[66979,66993],[66995,67001],[67003,67004],[67072,67382],[67392,67413],[67424,67431],[67456,67461],[67463,67504],[67506,67514],[67584,67589],[67592],[67594,67637],[67639,67640],[67644],[67647,67669],[67671,67742],[67751,67759],[67808,67826],[67828,67829],[67835,67867],[67871,67897],[67903],[67968,68023],[68028,68047],[68050,68096],[68112,68115],[68117,68119],[68121,68149],[68160,68168],[68176,68184],[68192,68255],[68288,68324],[68331,68342],[68352,68405],[68409,68437],[68440,68466],[68472,68497],[68505,68508],[68521,68527],[68608,68680],[68736,68786],[68800,68850],[68858,68899],[68912,68921],[69216,69246],[69248,69289],[69293],[69296,69297],[69376,69415],[69424,69445],[69457,69465],[69488,69505],[69510,69513],[69552,69579],[69600,69622],[69635,69687],[69703,69709],[69714,69743],[69745,69746],[69749],[69763,69807],[69819,69820],[69822,69825],[69840,69864],[69872,69881],[69891,69926],[69942,69956],[69959],[69968,70002],[70004,70006],[70019,70066],[70081],[70084,70088],[70093],[70096,70111],[70113,70132],[70144,70161],[70163,70187],[70200,70205],[70207,70208],[70272,70278],[70280],[70282,70285],[70287,70301],[70303,70313],[70320,70366],[70384,70393],[70405,70412],[70415,70416],[70419,70440],[70442,70448],[70450,70451],[70453,70457],[70461],[70480],[70493,70497],[70656,70708],[70727,70747],[70749],[70751,70753],[70784,70831],[70852,70855],[70864,70873],[71040,71086],[71105,71131],[71168,71215],[71233,71236],[71248,71257],[71264,71276],[71296,71338],[71352,71353],[71360,71369],[71424,71450],[71472,71494],[71680,71723],[71739],[71840,71922],[71935,71942],[71945],[71948,71955],[71957,71958],[71960,71983],[72004,72006],[72016,72025],[72096,72103],[72106,72144],[72161,72163],[72192],[72203,72242],[72255,72262],[72272],[72284,72323],[72346,72354],[72368,72440],[72448,72457],[72704,72712],[72714,72750],[72768,72773],[72784,72812],[72816,72847],[72960,72966],[72968,72969],[72971,73008],[73040,73049],[73056,73061],[73063,73064],[73066,73097],[73112],[73120,73129],[73440,73458],[73463,73464],[73476,73488],[73490,73523],[73539,73561],[73648],[73664,73713],[73727,74649],[74752,74862],[74864,74868],[74880,75075],[77712,77810],[77824,78895],[78913,78918],[82944,83526],[92160,92728],[92736,92766],[92768,92777],[92782,92862],[92864,92873],[92880,92909],[92917],[92928,92975],[92983,92997],[93008,93017],[93019,93025],[93027,93047],[93053,93071],[93760,93850],[93952,94026],[94032],[94099,94111],[94176,94179],[94208],[100343],[100352,101589],[101632],[101640],[110576,110579],[110581,110587],[110589,110590],[110592,110882],[110898],[110928,110930],[110933],[110948,110951],[110960,111355],[113664,113770],[113776,113788],[113792,113800],[113808,113817],[113820],[113823],[118608,118723],[118784,119029],[119040,119078],[119081,119140],[119146,119148],[119171,119172],[119180,119209],[119214,119274],[119296,119361],[119365],[119488,119507],[119520,119539],[119552,119638],[119648,119672],[119808,119892],[119894,119964],[119966,119967],[119970],[119973,119974],[119977,119980],[119982,119993],[119995],[119997,120003],[120005,120069],[120071,120074],[120077,120084],[120086,120092],[120094,120121],[120123,120126],[120128,120132],[120134],[120138,120144],[120146,120485],[120488,120779],[120782,121343],[121399,121402],[121453,121460],[121462,121475],[121477,121483],[122624,122654],[122661,122666],[122928,122989],[123136,123180],[123191,123197],[123200,123209],[123214,123215],[123536,123565],[123584,123627],[123632,123641],[123647],[124112,124139],[124144,124153],[124896,124902],[124904,124907],[124909,124910],[124912,124926],[124928,125124],[125127,125135],[125184,125251],[125259],[125264,125273],[125278,125279],[126065,126132],[126209,126269],[126464,126467],[126469,126495],[126497,126498],[126500],[126503],[126505,126514],[126516,126519],[126521],[126523],[126530],[126535],[126537],[126539],[126541,126543],[126545,126546],[126548],[126551],[126553],[126555],[126557],[126559],[126561,126562],[126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[126704,126705],[126976,127019],[127024,127123],[127136,127150],[127153,127167],[127169,127183],[127185,127221],[127232,127405],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127994],[128e3,128727],[128732,128748],[128752,128764],[128768,128886],[128891,128985],[128992,129003],[129008],[129024,129035],[129040,129095],[129104,129113],[129120,129159],[129168,129197],[129200,129201],[129280,129619],[129632,129645],[129648,129660],[129664,129672],[129680,129725],[129727,129733],[129742,129755],[129760,129768],[129776,129784],[129792,129938],[129940,129994],[130032,130041],[131072],[173791],[173824],[177977],[177984],[178205],[178208],[183969],[183984],[191456],[191472],[192093],[194560,195101],[196608],[201546],[201552],[205743]],h_=[[192,197],[199,207],[209,214],[217,221],[224,229],[231,239],[241,246],[249,253],[255,271],[274,293],[296,304],[308,311],[313,318],[323,328],[332,337],[340,357],[360,382],[416,417],[431,432],[461,476],[478,483],[486,496],[500,501],[504,539],[542,543],[550,563],[901,902],[904,906],[908],[910,912],[938,944],[970,974],[979,980],[1024,1025],[1027],[1031],[1036,1038],[1049],[1081],[1104,1105],[1107],[1111],[1116,1118],[1142,1143],[1217,1218],[1232,1235],[1238,1239],[1242,1247],[1250,1255],[1258,1269],[1272,1273],[1570,1574],[1728],[1730],[1747],[2345],[2353],[2356],[2392,2399],[2524,2525],[2527],[2611],[2614],[2649,2651],[2654],[2908,2909],[2964],[3907],[3917],[3922],[3927],[3932],[3945],[4134],[6918],[6920],[6922],[6924],[6926],[6930],[7680,7833],[7835],[7840,7929],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],[8025],[8027],[8029],[8031,8048],[8050],[8052],[8054],[8056],[8058],[8060],[8064,8116],[8118,8122],[8124],[8129,8132],[8134,8136],[8138],[8140,8146],[8150,8154],[8157,8162],[8164,8170],[8172,8173],[8178,8180],[8182,8184],[8186],[8188],[8602,8603],[8622],[8653,8655],[8708],[8713],[8716],[8740],[8742],[8769],[8772],[8775],[8777],[8800],[8802],[8813,8817],[8820,8821],[8824,8825],[8832,8833],[8836,8837],[8840,8841],[8876,8879],[8928,8931],[8938,8941],[10972],[12364],[12366],[12368],[12370],[12372],[12374],[12376],[12378],[12380],[12382],[12384],[12386],[12389],[12391],[12393],[12400,12401],[12403,12404],[12406,12407],[12409,12410],[12412,12413],[12436],[12446],[12460],[12462],[12464],[12466],[12468],[12470],[12472],[12474],[12476],[12478],[12480],[12482],[12485],[12487],[12489],[12496,12497],[12499,12500],[12502,12503],[12505,12506],[12508,12509],[12532],[12535,12538],[12542],[44032],[55203],[64285],[64287],[64298,64310],[64312,64316],[64318],[64320,64321],[64323,64324],[64326,64334],[69786],[69788],[69803],[119134,119140],[119227,119232]],Ww=String.fromCodePoint,m_=Math.min,y_=Math.max;function Id(e){if(e.length===1){let n=Ww(e[0]);return{num:1,build:()=>n}}let t=e[0];return{num:e[1]-e[0]+1,build:n=>Ww(t+n)}}function zw(e,t){let n=[],r=0,i=0;for(;r<e.length&&i<t.length;){let o=e[r],s=o[0],a=o.length===1?o[0]:o[1],l=t[i],u=l[0],c=l.length===1?l[0]:l[1];if(a<u)r+=1;else if(c<s)i+=1;else{let d=y_(s,u),f=m_(a,c);if(n.length>=1){let h=n[n.length-1];(h.length===1?h[0]:h[1])+1===d&&(d=h[0],U1(n))}$(n,d===f?[d]:[d,f]),a<=f&&(r+=1),c<=f&&(i+=1)}}return n}var Gw=Object.create(null);function g_(e){switch(e){case"full":return f_;case"ascii":return d_}}function b_(e,t){let n=`${e}:${t}`,r=Gw[n];if(r!==void 0)return r;let i=g_(t),o=e==="binary"?i:zw(i,p_),s=[];for(let l of o)$(s,Id(l));if(e==="grapheme"){let l=zw(i,h_);for(let u of l){let c=Id(u);$(s,{num:c.num,build:d=>E3(c.build(d),"NFD")})}}let a=mr(...s);return Gw[n]=a,a}function gi(e,t){return b_(e,t)}function S_(e){if(typeof e.unit=="object")return e.unit;switch(e.unit){case"grapheme":return gi("grapheme","full");case"grapheme-composite":return gi("composite","full");case"grapheme-ascii":case void 0:return gi("grapheme","ascii");case"binary":return gi("binary","full");case"binary-ascii":return gi("binary","ascii")}}function Ce(e={}){let t=S_(e),n=s_(t,e),r=c_(t,e);return se(t,{...e,experimentalCustomSlices:r}).map(i_,n)}var M0=Map,lf=String.fromCharCode,uf={num:26,build:e=>lf(e+97)},w_={num:26,build:e=>lf(e+65)},O0={num:10,build:e=>lf(e+48)};function x_(e){let t=F4(e);return e!==t?t:`%${xi(fr(e,0),16)}`}function v_(e){if(typeof e!="string")throw new Error("Unsupported");return decodeURIComponent(e)}var R_=()=>Ce({unit:"binary",minLength:1,maxLength:1}).map(x_,v_),id;function k_(){return id===void 0&&(id=mr(uf)),id}var Bs;function Pd(e){Bs===void 0&&(Bs=new M0);let t=Ze(Bs,e);return t===void 0&&(t=mr(uf,O0,{num:e.length,build:n=>e[n]}),ft(Bs,e,t)),t}function C_(e){return mr(uf,w_,O0,{num:e.length,build:t=>e[t]})}var Vs;function cf(e){Vs===void 0&&(Vs=new M0);let t=Ze(Vs,e);return t===void 0&&(t=Pe({weight:10,arbitrary:C_(e)},{weight:1,arbitrary:R_()}),ft(Vs,e,t)),t}function Vt(e,t={}){let n=t.freq===void 0?6:t.freq,r=H1(t,"nil")?t.nil:null,i=[{arbitrary:xe(r),weight:1,fallbackValue:{default:r}},{arbitrary:e,weight:n-1}],o={withCrossShrink:!0,depthSize:t.depthSize,maxDepth:t.maxDepth,depthIdentifier:t.depthIdentifier};return Ad.from(i,o,"fc.option")}function E_(e){return e.length>63?!1:e.length<4||e[0]!=="x"||e[1]!=="n"||e[2]!=="-"||e[3]!=="-"}var N0=Symbol("adapted-value");function A_(e,t){let n=t(e.value_);return n.adapted?new D(n.value,N0):e}var I_=class extends ue{constructor(e,t){super(),this.sourceArb=e,this.adapter=t,this.adaptValue=n=>A_(n,t)}generate(e,t){let n=this.sourceArb.generate(e,t);return this.adaptValue(n)}canShrinkWithoutContext(e){return this.sourceArb.canShrinkWithoutContext(e)&&!this.adapter(e).adapted}shrink(e,t){return t===N0?this.sourceArb.canShrinkWithoutContext(e)?this.sourceArb.shrink(e,void 0).map(this.adaptValue):F.nil():this.sourceArb.shrink(e,t).map(this.adaptValue)}};function L0(e,t){return new I_(e,t)}function P_([e,t]){return t===null?e:`${e}${t[0]}${t[1]}`}function T_(e){if(typeof e!="string"||e.length===0)throw new Error("Unsupported");return e.length===1?[e[0],null]:[e[0],[he(e,1,e.length-1),e[e.length-1]]]}function M_(e){let t=Pd("");return V(t,Vt(V(Ce({unit:Pd("-"),size:e,maxLength:61}),t))).map(P_,T_).filter(E_)}function O_(e){return`${le(e[0],".")}.${e[1]}`}function N_(e){if(typeof e!="string")throw new Error("Unsupported type");let t=e.lastIndexOf(".");return[Ue(he(e,0,t),"."),he(e,t+1)]}function L_(e){let[t,n]=e,r=n.length;for(let i=0;i!==t.length;++i)if(r+=1+t[i].length,r>255)return{adapted:!0,value:[Oe(t,0,i),n]};return{adapted:!1,value:e}}function df(e={}){let t=sf(e.size),n=Ci("-1",t),r=Ce({unit:k_(),minLength:2,maxLength:63,size:n});return L0(V(se(M_(t),{size:n,minLength:1,maxLength:127}),r),L_).map(O_,N_)}function $_(e){let t=e[0].length;for(let n=1;n!==e.length;++n)if(t+=1+e[n].length,t>64)return{adapted:!0,value:Oe(e,0,n)};return{adapted:!1,value:e}}function __(e){return le(e,".")}function D_(e){if(typeof e!="string")throw new Error("Unsupported");return Ue(e,".")}function j_(e){return`${e[0]}@${e[1]}`}function F_(e){if(typeof e!="string")throw new Error("Unsupported");return Ue(e,"@",2)}function B_(e={}){return V(L0(se(Ce({unit:Pd("!#$%&'*+-/=?^_`{|}~"),minLength:1,maxLength:64,size:e.size}),{minLength:1,maxLength:32,size:e.size}),$_).map(__,D_),df({size:e.size})).map(j_,F_)}var V_=jt.NEGATIVE_INFINITY,Td=jt.POSITIVE_INFINITY,$0=jt.EPSILON,ff=O(2146435072)*O(4294967296),U_=-ff-O(1),Hw=4503599627370496,W_=O(0xfffffffffffff),qw=O("9007199254740992"),Md=new Float64Array(1),Kw=new Uint32Array(Md.buffer,Md.byteOffset);function z_(e){return Md[0]=e,[Kw[1],Kw[0]]}function G_(e){let{0:t,1:n}=z_(e),r=t>>>31,i=t>>>20&2047,o=(t&1048575)*4294967296+n,s=i===0?-1022:i-1023,a=i===0?0:1;return a+=o*$0,a*=r===0?1:-1,{exponent:s,significand:a}}function Yw(e,t){return e===-1022?O(t*Hw):O((t-1)*Hw)+(O(e+1023)<<O(52))}function pf(e){if(e===Td)return ff;if(e===V_)return U_;let t=G_(e),n=t.exponent,r=t.significand;return e>0||e===0&&1/e===Td?Yw(n,r):-Yw(n,-r)-O(1)}function Od(e){if(e<0)return-Od(-e-O(1));if(e===ff)return Td;if(e<qw)return jt(e)*2**-1074;let t=e-qw,n=-1021+jt(t>>O(52));return(1+jt(t&W_)*$0)*2**n}var Jw=Number.isInteger,Xw=Object.is,od=Number.NEGATIVE_INFINITY,sd=Number.POSITIVE_INFINITY;function _0(e,t,n,r){let{noDefaultInfinity:i=!1,minExcluded:o=!1,maxExcluded:s=!1,min:a=i?-t:od,max:l=i?t:sd}=e,u=o?a<-n?-r:Math.max(a,-n):a===od?Math.max(a,-r):Math.max(a,-n),c=s?l>n?r:Math.min(l,n):l===sd?Math.min(l,r):Math.min(l,n);return{noDefaultInfinity:!1,minExcluded:o||(a!==od||o)&&Jw(u),maxExcluded:s||(l!==sd||s)&&Jw(c),min:Xw(u,-0)?0:u,max:Xw(c,0)?-0:c,noNaN:e.noNaN||!1}}var D0=Number.NEGATIVE_INFINITY,j0=Number.POSITIVE_INFINITY,H_=Number.MAX_VALUE,q_=45035996273704955e-1,Nd=4503599627370496;function K_(e){return _0(e,H_,q_,Nd)}function Y_(e){return e===4503599627370496?j0:e===-4503599627370496?D0:e}function J_(e){if(typeof e!="number")throw new Error("Unsupported type");return e===j0?Nd:e===D0?-Nd:e}var X_=Number.isInteger,F0=Number.isNaN,Z_=Number.NEGATIVE_INFINITY,Q_=Number.POSITIVE_INFINITY,Zw=Number.MAX_VALUE,eD=NaN;function Qw(e,t){if(F0(e))throw new Error("fc.double constraints."+t+" must be a 64-bit float");return pf(e)}function tD(e){if(typeof e!="number")throw new Error("Unsupported type");return pf(e)}function nD(e){return!X_(e)}function e1(e){let{noDefaultInfinity:t=!1,noNaN:n=!1,minExcluded:r=!1,maxExcluded:i=!1,min:o=t?-Zw:Z_,max:s=t?Zw:Q_}=e,a=Qw(o,"min"),l=r?a+O(1):a,u=Qw(s,"max"),c=i?u-O(1):u;if(c<l)throw new Error("fc.double constraints.min must be smaller or equal to constraints.max");if(n)return nn({min:l,max:c}).map(Od,tD);let d=c>O(0),f=d?l:l-O(1),h=d?c+O(1):c;return nn({min:f,max:h}).map(p=>c<p||p<l?eD:Od(p),p=>{if(typeof p!="number")throw new Error("Unsupported type");return F0(p)?c!==h?h:f:pf(p)})}function sa(e={}){return e.noInteger?e1(K_(e)).map(Y_,J_).filter(nD):e1(e)}var rD=Number.NEGATIVE_INFINITY,Ld=Number.POSITIVE_INFINITY,iD=Math.imul,$d=2**127*(1+(2**23-1)/2**23),B0=2139095040,oD=-2139095041,_d=new Float32Array(1),sD=new Uint32Array(_d.buffer,_d.byteOffset);function aD(e){return _d[0]=e,sD[0]}function lD(e){let t=aD(e),n=t>>>31,r=t>>>23&255,i=t&8388607,o=r===0?-126:r-127,s=r===0?0:1;return s+=i/2**23,s*=n===0?1:-1,{exponent:o,significand:s}}function t1(e,t){return e===-126?t*8388608:iD(e+127,8388608)+(t-1)*8388608}function hf(e){if(e===Ld)return B0;if(e===rD)return oD;let t=lD(e),n=t.exponent,r=t.significand;return e>0||e===0&&1/e===Ld?t1(n,r):-t1(n,-r)-1}function Dd(e){if(e<0)return-Dd(-e-1);if(e===B0)return Ld;if(e<16777216)return e*2**-149;let t=e-16777216,n=-125+(t>>23);return(1+(t&8388607)/8388608)*2**n}var V0=Number.NEGATIVE_INFINITY,U0=Number.POSITIVE_INFINITY,uD=$d,cD=83886075e-1,jd=8388608;function dD(e){return _0(e,uD,cD,jd)}function fD(e){return e===8388608?U0:e===-8388608?V0:e}function pD(e){if(typeof e!="number")throw new Error("Unsupported type");return e===U0?jd:e===V0?-jd:e}var hD=Number.isInteger,W0=Number.isNaN,mD=Math.fround,yD=Number.NEGATIVE_INFINITY,gD=Number.POSITIVE_INFINITY,bD=NaN;function n1(e,t){let n="fc.float constraints."+t+" must be a 32-bit float - you can convert any double to a 32-bit float by using `Math.fround(myDouble)`";if(W0(e)||mD(e)!==e)throw new Error(n);return hf(e)}function SD(e){if(typeof e!="number")throw new Error("Unsupported type");return hf(e)}function wD(e){return!hD(e)}function r1(e){let{noDefaultInfinity:t=!1,noNaN:n=!1,minExcluded:r=!1,maxExcluded:i=!1,min:o=t?-$d:yD,max:s=t?$d:gD}=e,a=n1(o,"min"),l=r?a+1:a,u=n1(s,"max"),c=i?u-1:u;if(l>c)throw new Error("fc.float constraints.min must be smaller or equal to constraints.max");if(n)return re({min:l,max:c}).map(Dd,SD);let d=c>0?l:l-1,f=c>0?c+1:c;return re({min:d,max:f}).map(h=>h>c||h<l?bD:Dd(h),h=>{if(typeof h!="number")throw new Error("Unsupported type");return W0(h)?c!==f?f:d:hf(h)})}function z0(e={}){return e.noInteger?r1(dD(e)).map(fD,pD).filter(wD):r1(e)}function xD(e){return e.replace(/([$`\\])/g,"\\$1").replace(/\r/g,"\\r")}function G0(e){return e.replace(/\*\//g,"*\\/")}var Je=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function ra(e){let t=4294967295;for(let n=0;n<e.length;++n){let r=fr(e,n);if(r<128)t=Je[t&255^r]^t>>8;else if(r<2048)t=Je[t&255^(192|r>>6&31)]^t>>8,t=Je[t&255^(128|r&63)]^t>>8;else if(r>=55296&&r<57344){let i=fr(e,++n);if(r>=56320||i<56320||i>57343||Number.isNaN(i))n-=1,t=Je[t&255^239]^t>>8,t=Je[t&255^191]^t>>8,t=Je[t&255^189]^t>>8;else{let o=(r&1023)+64,s=i&1023;t=Je[t&255^(240|o>>8&7)]^t>>8,t=Je[t&255^(128|o>>2&63)]^t>>8,t=Je[t&255^(128|s>>6&15|(o&3)<<4)]^t>>8,t=Je[t&255^(128|s&63)]^t>>8}}else t=Je[t&255^(224|r>>12&15)]^t>>8,t=Je[t&255^(128|r>>6&63)]^t>>8,t=Je[t&255^(128|r&63)]^t>>8}return(t|0)+2147483648}var vD=Object.getPrototypeOf,bi=class extends ue{constructor(e){super(),this.arb=e}generate(e,t){return this.arb.generate(e,t)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return F.nil()}};function ia(e){return vD(e)===bi.prototype&&e.generate===bi.prototype.generate&&e.canShrinkWithoutContext===bi.prototype.canShrinkWithoutContext&&e.shrink===bi.prototype.shrink?e:new bi(e)}var RD=Object.assign,kD=Object.keys;function H0(e){return V(ia(re()),ia(re({min:1,max:4294967295}))).map(([t,n])=>{let r=()=>{let i={};return RD((s,a)=>{let l=ve(s),u=ve(a),c=e(ra(`${t}${l}`)%n,ra(`${t}${u}`)%n);return i[`[${l},${u}]`]=c,c},{toString:()=>{let s=kD(i).sort().map(a=>`${a} => ${ve(i[a])}`).map(a=>`/* ${G0(a)} */`);return`function(a, b) {
114
- // With hash and stringify coming from fast-check${s.length!==0?`
115
- ${le(s,`
116
- `)}`:""}
117
- const cmp = ${e};
118
- const hA = hash('${t}' + stringify(a)) % ${n};
119
- const hB = hash('${t}' + stringify(b)) % ${n};
120
- return cmp(hA, hB);
121
- }`},[Te]:r})};return r()})}var CD=Object.assign;function ED(){return H0(CD((e,t)=>e<t,{toString(){return"(hA, hB) => hA < hB"}}))}var AD=Object.assign;function ID(){return H0(AD((e,t)=>e-t,{toString(){return"(hA, hB) => hA - hB"}}))}var PD=Object.defineProperties,TD=Object.keys;function MD(e){return V(se(e,{minLength:1}),ia(re())).map(([t,n])=>{let r=()=>{let i={},o=(...a)=>{let l=ve(a),u=t[ra(`${n}${l}`)%t.length];return i[l]=u,Cn(u)?u[Te]():u};function s(a){let l=z(z(z1(TD(i)),u=>`${u} => ${ve(i[u])}`),u=>`/* ${G0(u)} */`);return`function(...args) {
122
- // With hash and stringify coming from fast-check${l.length!==0?`
123
- ${l.join(`
124
- `)}`:""}
125
- const outs = ${a};
126
- return outs[hash('${n}' + stringify(args)) % outs.length];
127
- }`}return PD(o,{toString:{value:()=>s(ve(t))},[ht]:{value:()=>s(ve(t))},[Bt]:{value:async()=>s(await Qd(t))},[Te]:{value:r,configurable:!0}})};return r()})}var OD=Number.MIN_SAFE_INTEGER,ND=Number.MAX_SAFE_INTEGER;function q0(){return new hr(OD,ND)}var LD=Number.MAX_SAFE_INTEGER;function $D(){return new hr(0,LD)}var _D=Number.parseInt;function DD(e){let[t,n]=e;switch(t){case"oct":return`0${xi(n,8)}`;case"hex":return`0x${xi(n,16)}`;default:return`${n}`}}function qs(e,t){let n=_D(e,t);if(xi(n,t)!==e)throw new Error("Invalid value");return n}function jD(e){if(typeof e!="string")throw new Error("Invalid type");return e.length>=2&&e[0]==="0"?e[1]==="x"?["hex",qs(he(e,2),16)]:["oct",qs(he(e,1),8)]:["dec",qs(e,10)]}function FD(e){return le(e,".")}function BD(e){if(typeof e!="string")throw new Error("Invalid type");return z(Ue(e,"."),t=>qs(t,10))}function mf(){return V(Qt(255),Qt(255),Qt(255),Qt(255)).map(FD,BD)}function Rt(e){return V(kt("dec","oct","hex"),Qt(e)).map(DD,jD)}function ad(e){return le(e,".")}function ld(e){if(typeof e!="string")throw new Error("Invalid type");return Ue(e,".")}function K0(){return Pe(V(Rt(255),Rt(255),Rt(255),Rt(255)).map(ad,ld),V(Rt(255),Rt(255),Rt(65535)).map(ad,ld),V(Rt(255),Rt(16777215)).map(ad,ld),Rt(4294967295))}function yf(e){return e.length===0?[]:Ue(e,":")}function gf(e){let t=Ue(e,":");return t.length>=2&&t[t.length-1].length<=4?[Oe(t,0,t.length-2),`${t[t.length-2]}:${t[t.length-1]}`]:[Oe(t,0,t.length-1),t[t.length-1]]}function VD(e){return`${le(e[0],":")}:${e[1]}`}function UD(e){if(typeof e!="string")throw new Error("Invalid type");return gf(e)}function WD(e){return`::${le(e[0],":")}:${e[1]}`}function zD(e){if(typeof e!="string")throw new Error("Invalid type");if(!R3(e,"::"))throw new Error("Invalid value");return gf(he(e,2))}function Ks(e){return`${le(e[0],":")}::${le(e[1],":")}:${e[2]}`}function Ys(e){if(typeof e!="string")throw new Error("Invalid type");let[t,n]=Ue(e,"::",2),[r,i]=gf(n);return[yf(t),r,i]}function GD(e){return Ks([e[0],[e[1]],e[2]])}function HD(e){let t=Ys(e);return[t[0],le(t[1],":"),t[2]]}function i1(e){return`${le(e[0],":")}::${e[1]}`}function o1(e){if(typeof e!="string")throw new Error("Invalid type");let[t,n]=Ue(e,"::",2);return[yf(t),n]}function qD(e){return`${le(e[0],":")}::`}function KD(e){if(typeof e!="string")throw new Error("Invalid type");if(!k3(e,"::"))throw new Error("Invalid value");return[yf(he(e,0,e.length-2))]}function YD([e,t]){return`${e}:${t}`}function JD(e){if(typeof e!="string")throw new L("Invalid type");if(!e.includes(":"))throw new L("Invalid value");return e.split(":",2)}var XD="0123456789abcdef",ud;function ZD(){return ud===void 0&&(ud=re({min:0,max:15}).map(e=>XD[e],e=>{if(typeof e!="string")throw new L("Not a string");if(e.length!==1)throw new L("Invalid length");let t=fr(e,0);if(t<=57)return t-48;if(t<97)throw new L("Invalid character");return t-87})),ud}function Y0(){let e=Ce({unit:ZD(),minLength:1,maxLength:4,size:"max"}),t=Pe(V(e,e).map(YD,JD),mf());return Pe(V(se(e,{minLength:6,maxLength:6,size:"max"}),t).map(VD,UD),V(se(e,{minLength:5,maxLength:5,size:"max"}),t).map(WD,zD),V(se(e,{minLength:0,maxLength:1,size:"max"}),se(e,{minLength:4,maxLength:4,size:"max"}),t).map(Ks,Ys),V(se(e,{minLength:0,maxLength:2,size:"max"}),se(e,{minLength:3,maxLength:3,size:"max"}),t).map(Ks,Ys),V(se(e,{minLength:0,maxLength:3,size:"max"}),se(e,{minLength:2,maxLength:2,size:"max"}),t).map(Ks,Ys),V(se(e,{minLength:0,maxLength:4,size:"max"}),e,t).map(GD,HD),V(se(e,{minLength:0,maxLength:5,size:"max"}),t).map(i1,o1),V(se(e,{minLength:0,maxLength:6,size:"max"}),e).map(i1,o1),V(se(e,{minLength:0,maxLength:7,size:"max"})).map(qD,KD))}var QD=class extends ue{constructor(e){super(),this.name=e,this.underlying=null}generate(e,t){if(this.underlying===null)throw new Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.generate(e,t)}canShrinkWithoutContext(e){if(this.underlying===null)throw new Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.canShrinkWithoutContext(e)}shrink(e,t){if(this.underlying===null)throw new Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.shrink(e,t)}},e7=Object.getOwnPropertyNames;function t7(){let e=new Ft;return n=>{let r=Ze(e,n);return r!==void 0||(r=new QD(String(n)),ft(e,n,r)),r}}function J0(e){let t=t7(),n=e(t),r=e7(n);for(let i of r){let o=t(i);o.underlying=n[i]}return n}function n7(e,t){for(let n of e){let r=t[n]||{};if(r.maxLength===void 0||r.maxLength>0)return!0}return!1}function r7(e,t){if(e.length===0)return xe([]);if(!n7(e,t))throw new L("Contraints on pool must accept at least one entity, maxLength cannot sum to 0");return V(...e.map(n=>se(xe(n),t[n]))).map(n=>Z4(n)).filter(n=>n.length>0)}var s1=Object.assign,Js=Object.create,X0=Object.defineProperty,a1=Object.getPrototypeOf,i7=Object.prototype;function o7(e){return X0(Js(null),ht,{configurable:!1,enumerable:!1,writable:!1,value:()=>e})}function l1(e,t){return o7(`<${Ve(e)}#${t}>`)}function s7(e,t){let n=Js(i7);for(let r in e){let i=e[r],o=[];for(let s of i){let a=s1(Js(a1(s)),s);o.push(a)}n[r]=o}for(let r in t){let i=t[r];for(let o=0;o!==i.length;++o){let s=i[o],a=n[r][o];for(let l in s){let u=s[l];a[l]=u.index===void 0?void 0:typeof u.index=="number"?n[u.type][u.index]:z(u.index,c=>n[u.type][c])}X0(a,ht,{configurable:!1,enumerable:!1,writable:!1,value:()=>{let l=e[r][o],u=s1(Js(a1(l)),l);for(let c in s){let d=s[c];u[c]=d.index===void 0?void 0:typeof d.index=="number"?l1(d.type,d.index):z(d.index,f=>l1(d.type,f))}return ve(u)}})}}return n}function a7(e){let t=0,n=new Ft;for(let i in e){let o=e[i];for(let s in o){let a=o[s];if(a.arity!=="inverse")continue;let l=Ze(n,a.type);if(l===void 0&&(l=new Ft,ft(n,a.type,l)),f3(l,a.forwardRelationship))throw new L(`Cannot declare multiple inverse relationships for the same forward relationship ${Ve(a.forwardRelationship)} on type ${Ve(a.type)}`);ft(l,a.forwardRelationship,{type:i,property:s}),t+=1}}let r=new Ft;if(t===0)return r;for(let i in e){let o=e[i],s=Ze(n,i);if(s!==void 0)for(let a in o){let l=o[a];if(l.arity==="inverse")continue;let u=Ze(s,a);if(u!==void 0){if(u.type!==l.type)throw new L(`Inverse relationship ${Ve(u.property)} on type ${Ve(u.type)} references forward relationship ${Ve(a)} but types do not match`);ft(r,l,u)}}}if(r.size!==t)throw new L("Some inverse relationships could not be matched with their corresponding forward relationships");return r}var u1=Object.create;function l7(e,t,n){switch(e){case"exclusive":return xe(n);case"successor":return na(re({min:t!==void 0?t+1:0,max:n}));case"any":return na(re({min:0,max:n}))}}function u7(e,t,n,r,i,o,s){let a=l7(t,n,r);switch(e){case"0-1":return Vt(a,{nil:void 0,depthIdentifier:i}).generate(o,s).value;case"1":return a.generate(o,s).value;case"many":{let l=0,u=Vt(An(a,{depthIdentifier:i,selector:d=>d===r?d+ ++l:d,minLength:1}),{nil:[],depthIdentifier:i}).generate(o,s).value,c=0;return z(u,d=>d===r?d+c++:d)}}}var c7=class extends ue{constructor(e,t){super(),this.relations=e,this.defaultEntities=t;let n=new dr,r=new dr;for(let i in e){let o=e[i];for(let s in o){let a=o[s];if(a.arity!=="inverse"){if(a.strategy==="exclusive"){if(ta(n,a.type))throw new L(`Cannot mix exclusive with other strategies for type ${Ve(a.type)}`);wi(r,a.type)}else{if(ta(r,a.type))throw new L(`Cannot mix exclusive with other strategies for type ${Ve(a.type)}`);wi(n,a.type)}if(a.strategy==="successor"&&a.type!==i)throw new L("Cannot mix types for the strategy successor");if(a.strategy==="successor"&&a.arity==="1")throw new L("Cannot use an arity of 1 for the strategy successor")}}}this.inversedRelations=a7(e)}createEmptyLinksInstanceFor(e){let t=u1(null),n=this.relations[e];for(let r in n){let i=n[r];i.arity==="inverse"&&(t[r]={type:i.type,index:[]})}return t}generate(e,t){let n=u1(null);for(let o in this.relations)n[o]=[];let r=[];for(let o of this.defaultEntities)$(r,{type:o,indexInType:n[o].length,depth:0}),$(n[o],this.createEmptyLinksInstanceFor(o));let i=-1;for(;++i<r.length;){let o=r[i],s=this.relations[o.type],a=n[o.type][o.indexInType],l=rf();l.depth=o.depth;for(let u in s){let c=s[u];if(c.arity==="inverse")continue;let d=c.type,f=n[d],h=f.length,p=u7(c.arity,c.strategy||"any",d===o.type?o.indexInType:void 0,f.length,l,e,t);a[u]={type:d,index:p};let m=p===void 0?[]:typeof p=="number"?[p]:p;for(let y of m){y>=h&&($(r,{type:d,indexInType:y,depth:o.depth+1}),$(f,this.createEmptyLinksInstanceFor(d)));let S=Ze(this.inversedRelations,c);if(S!==void 0){let w=f[y][S.property].index;$(w,o.indexInType)}}}}return r.length=0,new D(n,void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return F.nil()}};function d7(e,t){return new c7(e,t)}var f7=Object.keys,p7=Object.getOwnPropertySymbols,h7=Object.getOwnPropertyDescriptor;function m7(e){let t=f7(e),n=p7(e);for(let r=0;r!==n.length;++r){let i=n[r],o=h7(e,i);o&&o.enumerable&&t.push(i)}return t}var y7=Object.create,g7=Object.defineProperty,b7=Object.getOwnPropertyDescriptor,S7=Object.getOwnPropertyNames,w7=Object.getOwnPropertySymbols;function x7(e,t){return function(r){let i=r[1]?y7(null):{};for(let o=0;o!==e.length;++o){let s=r[0][o];s!==t&&g7(i,e[o],{value:s,configurable:!0,enumerable:!0,writable:!0})}return i}}function v7(e,t){return function(r){if(typeof r!="object"||r===null)throw new Error("Incompatible instance received: should be a non-null object");let i=Object.getPrototypeOf(r)===null,o="constructor"in r&&r.constructor===Object;if(!i&&!o)throw new Error("Incompatible instance received: should be of exact type Object");let s=0,a=[];for(let c=0;c!==e.length;++c){let d=b7(r,e[c]);if(d!==void 0){if(!d.configurable||!d.enumerable||!d.writable)throw new Error("Incompatible instance received: should contain only c/e/w properties");if(d.get!==void 0||d.set!==void 0)throw new Error("Incompatible instance received: should contain only no get/set properties");++s,$(a,d.value)}else $(a,t)}let l=S7(r).length,u=w7(r).length;if(s!==l+u)throw new Error("Incompatible instance received: should not contain extra properties");return[a,i]}}var cd=Symbol("no-key");function dd(e,t,n){let r=m7(e),i=[];for(let o=0;o!==r.length;++o){let s=r[o],a=e[s];t===void 0||Dt(t,s)!==-1?$(i,a):$(i,Vt(a,{nil:cd}))}return V(V(...i),n?xe(!1):Ei()).map(x7(r,cd),v7(r,cd))}function Fd(e,t){let n=t!==void 0&&!!t.noNullPrototype;if(t===void 0||!("requiredKeys"in t&&t.requiredKeys!==void 0))return dd(e,void 0,n);let r=("requiredKeys"in t?t.requiredKeys:void 0)||[];for(let i=0;i!==r.length;++i){let o=Object.getOwnPropertyDescriptor(e,r[i]);if(o===void 0)throw new Error("requiredKeys cannot reference keys that have not been defined in recordModel");if(!o.enumerable)throw new Error("requiredKeys cannot reference keys that are not enumerable in recordModel")}return dd(e,r,n)}var R7=Object.create;function k7(e,t,n,r){let i=R7(null);for(let o in e){let s=e[o],a=Fd(s,r),l=t(o),u=n(o),c={minLength:l,maxLength:l};i[o]=u!==void 0?An(a,{...c,selector:u}):se(a,c)}return Fd(i)}var c1=Object.create,C7=Object.keys;function E7(e,t,n={}){let r=C7(e),i=n.initialPoolConstraints||c1(null),o=n.unicityConstraints||c1(null),s={noNullPrototype:n.noNullPrototype};return r7(r,i).chain(a=>d7(t,a).chain(l=>k7(e,u=>l[u].length,u=>o[u],s).map(u=>s7(u,l))))}function A7(e){return le(z(e,t=>t[t.length-1]===","?he(t,0,t.length-1):t)," ")}function I7(e){return function(n){if(typeof n!="string")throw new Error("Unsupported type");let r=[];for(let i of Ue(n," "))if(e.canShrinkWithoutContext(i))$(r,i);else if(e.canShrinkWithoutContext(i+","))$(r,i+",");else throw new Error("Unsupported word");return r}}function P7(e){let t=le(e," ");return t[t.length-1]===","&&(t=he(t,0,t.length-1)),Kd(t[0])+he(t,1)+"."}function T7(e){return function(n){if(typeof n!="string")throw new Error("Unsupported type");if(n.length<2||n[n.length-1]!=="."||n[n.length-2]===","||Kd(vd(n[0]))!==n[0])throw new Error("Unsupported value");let r=vd(n[0])+he(n,1,n.length-1),i=[],o=Ue(r," ");for(let s=0;s!==o.length;++s){let a=o[s];if(e.canShrinkWithoutContext(a))$(i,a);else if(s===o.length-1&&e.canShrinkWithoutContext(a+","))$(i,a+",");else throw new Error("Unsupported word")}return i}}function M7(e){return le(e," ")}function O7(e){if(typeof e!="string")throw new Error("Unsupported type");let t=Ue(e,". ");for(let n=0;n<t.length-1;++n)t[n]+=".";return t}var b=(e,t)=>({arbitrary:xe(e),weight:t});function N7(){return Pe(b("non",6),b("adipiscing",5),b("ligula",5),b("enim",5),b("pellentesque",5),b("in",5),b("augue",5),b("et",5),b("nulla",5),b("lorem",4),b("sit",4),b("sed",4),b("diam",4),b("fermentum",4),b("ut",4),b("eu",4),b("aliquam",4),b("mauris",4),b("vitae",4),b("felis",4),b("ipsum",3),b("dolor",3),b("amet,",3),b("elit",3),b("euismod",3),b("mi",3),b("orci",3),b("erat",3),b("praesent",3),b("egestas",3),b("leo",3),b("vel",3),b("sapien",3),b("integer",3),b("curabitur",3),b("convallis",3),b("purus",3),b("risus",2),b("suspendisse",2),b("lectus",2),b("nec,",2),b("ultricies",2),b("sed,",2),b("cras",2),b("elementum",2),b("ultrices",2),b("maecenas",2),b("massa,",2),b("varius",2),b("a,",2),b("semper",2),b("proin",2),b("nec",2),b("nisl",2),b("amet",2),b("duis",2),b("congue",2),b("libero",2),b("vestibulum",2),b("pede",2),b("blandit",2),b("sodales",2),b("ante",2),b("nibh",2),b("ac",2),b("aenean",2),b("massa",2),b("suscipit",2),b("sollicitudin",2),b("fusce",2),b("tempus",2),b("aliquam,",2),b("nunc",2),b("ullamcorper",2),b("rhoncus",2),b("metus",2),b("faucibus,",2),b("justo",2),b("magna",2),b("at",2),b("tincidunt",2),b("consectetur",1),b("tortor,",1),b("dignissim",1),b("congue,",1),b("non,",1),b("porttitor,",1),b("nonummy",1),b("molestie,",1),b("est",1),b("eleifend",1),b("mi,",1),b("arcu",1),b("scelerisque",1),b("vitae,",1),b("consequat",1),b("in,",1),b("pretium",1),b("volutpat",1),b("pharetra",1),b("tempor",1),b("bibendum",1),b("odio",1),b("dui",1),b("primis",1),b("faucibus",1),b("luctus",1),b("posuere",1),b("cubilia",1),b("curae,",1),b("hendrerit",1),b("velit",1),b("mauris,",1),b("gravida",1),b("ornare",1),b("ut,",1),b("pulvinar",1),b("varius,",1),b("turpis",1),b("nibh,",1),b("eros",1),b("id",1),b("aliquet",1),b("quis",1),b("lobortis",1),b("consectetuer",1),b("morbi",1),b("vehicula",1),b("tortor",1),b("tellus,",1),b("id,",1),b("eu,",1),b("quam",1),b("feugiat,",1),b("posuere,",1),b("iaculis",1),b("lectus,",1),b("tristique",1),b("mollis,",1),b("nisl,",1),b("vulputate",1),b("sem",1),b("vivamus",1),b("placerat",1),b("imperdiet",1),b("cursus",1),b("rutrum",1),b("iaculis,",1),b("augue,",1),b("lacus",1))}function L7(e={}){let{maxCount:t,mode:n="words",size:r}=e;if(t!==void 0&&t<1)throw new Error("lorem has to produce at least one word/sentence");let i=N7();return n==="sentences"?se(se(i,{minLength:1,size:"small"}).map(P7,T7(i)),{minLength:1,maxLength:t,size:r}).map(M7,O7):se(i,{minLength:1,maxLength:t,size:r}).map(A7,I7(i))}function $7(e){return new Map(e)}function _7(e){if(typeof e!="object"||e===null)throw new Error("Incompatible instance received: should be a non-null object");if(!("constructor"in e)||e.constructor!==Map)throw new Error("Incompatible instance received: should be of exact type Map");return Array.from(e)}function D7(e){return e[0]}function Bd(e,t,n={}){return An(V(e,t),{minLength:n.minKeys,maxLength:n.maxKeys,size:n.size,selector:D7,depthIdentifier:n.depthIdentifier,comparator:"SameValueZero"}).map($7,_7)}var Us=10;function j7(e){let t={};return(n=>{let r=n!==void 0?n:Us;if(!H1(t,r)){let i=Us;Us=r-1,t[r]=e(r),Us=i}return t[r]})}function F7(e){let t=0;for(;e>O(0);)e&O(1)&&++t,e>>=O(1);return t}function B7(e,t){let n=(O(1)<<O(t))-O(1),r=e&n,i=F7(e-r),o=r;for(let s=O(1);s<=n&&i!==0;s<<=O(1))o&s||(o|=s,--i);return o}function Ws(e,t){let n=[];for(let r=e.length-1;r!==-1;--r)t(e[r])!==e[r]&&$(n,r);return n}function V7(e,t,n){let r=O(0);for(let i=0,o=O(1);i!==n.length;++i,o<<=O(1))e[n[i]]!==t[n[i]]&&(r|=o);return r}function fd(e,t,n,r){for(let i=0,o=O(1);i!==n.length;++i,o<<=O(1))t&o&&(e[n[i]]=r(e[n[i]]))}var U7=class extends ue{constructor(e,t,n){super(),this.stringArb=e,this.toggleCase=t,this.untoggleAll=n}buildContextFor(e,t){return{rawString:e.value,rawStringContext:e.context,flags:t.value,flagsContext:t.context}}generate(e,t){let n=this.stringArb.generate(e,t),r=[...n.value],i=Ws(r,this.toggleCase),o=nn(O(0),(O(1)<<O(i.length))-O(1)).generate(e,void 0);return fd(r,o.value,i,this.toggleCase),new D(le(r,""),this.buildContextFor(n,o))}canShrinkWithoutContext(e){return typeof e!="string"?!1:this.untoggleAll!==void 0?this.stringArb.canShrinkWithoutContext(this.untoggleAll(e)):this.stringArb.canShrinkWithoutContext(e)}shrink(e,t){let n;if(t!==void 0)n=t;else if(this.untoggleAll!==void 0){let o=this.untoggleAll(e),s=[...e],a=[...o];n={rawString:o,rawStringContext:void 0,flags:V7(a,s,Ws(a,this.toggleCase)),flagsContext:void 0}}else n={rawString:e,rawStringContext:void 0,flags:O(0),flagsContext:void 0};let r=n.rawString,i=n.flags;return this.stringArb.shrink(r,n.rawStringContext).map(o=>{let s=[...o.value],a=Ws(s,this.toggleCase),l=B7(i,a.length);return fd(s,l,a,this.toggleCase),new D(le(s,""),this.buildContextFor(o,new D(l,void 0)))}).join(en(()=>{let o=[...r],s=Ws(o,this.toggleCase);return nn(O(0),(O(1)<<O(s.length))-O(1)).shrink(i,n.flagsContext).map(a=>{let l=Oe(o);return fd(l,a.value,s,this.toggleCase),new D(le(l,""),this.buildContextFor(new D(r,n.rawStringContext),a))})}))}};function W7(e){let t=Kd(e);return t!==e?t:vd(e)}function z7(e,t){return new U7(e,t&&t.toggleCase||W7,t&&t.untoggleAll)}function G7(e){return F1.from(e)}function H7(e){if(!(e instanceof F1))throw new Error("Unexpected type");return[...e]}function Z0(e={}){return se(z0(e),e).map(G7,H7)}function q7(e){return B1.from(e)}function K7(e){if(!(e instanceof B1))throw new Error("Unexpected type");return[...e]}function Q0(e={}){return se(sa(e),e).map(q7,K7)}function Ut(e,t,n,r,i){let o=r.name,{min:s=t,max:a=n,...l}=e;if(s>a)throw new Error(`Invalid range passed to ${o}: min must be lower than or equal to max`);if(s<t)throw new Error(`Invalid min value passed to ${o}: min must be greater than or equal to ${t}`);if(a>n)throw new Error(`Invalid max value passed to ${o}: max must be lower than or equal to ${n}`);return se(i({min:s,max:a}),l).map(u=>r.from(u),u=>{if(!(u instanceof r))throw new Error("Invalid type");return[...u]})}function ex(e={}){return Ut(e,-32768,32767,N4,re)}function tx(e={}){return Ut(e,-2147483648,2147483647,L4,re)}function nx(e={}){return Ut(e,-128,127,O4,re)}function rx(e={}){return Ut(e,0,65535,D4,re)}function ix(e={}){return Ut(e,0,4294967295,j4,re)}function ox(e={}){return Ut(e,0,255,$4,re)}function sx(e={}){return Ut(e,0,255,_4,re)}function Y7(e){return e!==void 0}function d1(e){return e.hasToBeCloned?new D(e.value_,{generatorContext:e.context},()=>e.value):new D(e.value_,{generatorContext:e.context})}function f1(e){return e.hasToBeCloned?new D(e.value_,{shrinkerContext:e.context},()=>e.value):new D(e.value_,{shrinkerContext:e.context})}var J7=class extends ue{constructor(e,t){super(),this.generatorArbitrary=e,this.shrinkerArbitrary=t}generate(e,t){return d1(this.generatorArbitrary.generate(e,t))}canShrinkWithoutContext(e){return this.shrinkerArbitrary.canShrinkWithoutContext(e)}shrink(e,t){return Y7(t)?"generatorContext"in t?this.generatorArbitrary.shrink(e,t.generatorContext).map(d1):this.shrinkerArbitrary.shrink(e,t.shrinkerContext).map(f1):this.shrinkerArbitrary.shrink(e,void 0).map(f1)}};function Vd(e,t,n){let r=re({min:e,max:t});return t===n?r:new J7(r,re({min:e,max:n}))}var X7=Math.min,Ud=Math.max,p1=D1.isArray,Z7=Object.entries;function Q7(e){let t=-1;for(let n=0;n!==e.length;++n)t=Ud(t,e[n][0]);return t}function e8(e,t){let n=D1(e);for(let r=0;r!==t.length;++r){let i=t[r];i[0]<e&&(n[i[0]]=i[1])}return n}function ax(e,t={}){let{size:n,minNumElements:r=0,maxLength:i=En,maxNumElements:o=i,noTrailingHole:s,depthIdentifier:a}=t,l=Ri(n,Ri(n,r,o,t.maxNumElements!==void 0),i,t.maxLength!==void 0);if(r>i)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal length of the array");if(r>o)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal number of non-holes");let u=X7(o,i),c=t.maxNumElements!==void 0||n!==void 0?n:"=",d=An(V(Vd(0,Ud(l-1,0),Ud(i-1,0)),e),{size:c,minLength:r,maxLength:u,selector:f=>f[0],depthIdentifier:a}).map(f=>e8(Q7(f)+1,f),f=>{if(!p1(f))throw new Error("Not supported entry type");if(s&&f.length!==0&&!(f.length-1 in f))throw new Error("No trailing hole");return z(Z7(f),h=>[Number(h[0]),h[1]])});return s||i===r?d:V(d,Vd(r,l,i)).map(f=>{let h=f[0],p=f[1];if(h.length>=p)return h;let m=Oe(h);return m.length=p,m},f=>{if(!p1(f))throw new Error("Not supported entry type");return[f,f.length]})}function t8(e){return new Set(e)}function n8(e){if(typeof e!="object"||e===null)throw new Error("Incompatible instance received: should be a non-null object");if(!("constructor"in e)||e.constructor!==Set)throw new Error("Incompatible instance received: should be of exact type Set");return Array.from(e)}function lx(e,t={}){return An(e,{minLength:t.minLength,maxLength:t.maxLength,size:t.size,depthIdentifier:t.depthIdentifier,comparator:"SameValueZero"}).map(t8,n8)}function r8(e,t,n,r,i,o){return af(e,t,{maxKeys:n,noNullPrototype:!o,size:r,depthIdentifier:i})}function i8(e){return Pe(nx(e),ox(e),sx(e),ex(e),rx(e),tx(e),ix(e),Z0(e),Q0(e))}function ux(e){let t=e.values,n=e.depthSize,r=rf(),i=e.maxDepth,o=e.maxKeys,s=e.size,a=Pe(...t,...e.withBigInt?[nn()]:[],...e.withDate?[k0()]:[]);return J0(l=>({anything:Pe({maxDepth:i,depthSize:n,depthIdentifier:r},a,l("array"),l("object"),...e.withMap?[l("map")]:[],...e.withSet?[l("set")]:[],...e.withObjectString?[l("anything").map(u=>ve(u))]:[],...e.withTypedArray?[i8({maxLength:o,size:s})]:[],...e.withSparseArray?[ax(l("anything"),{maxNumElements:o,size:s,depthIdentifier:r})]:[]),keys:e.withObjectString?Pe({arbitrary:e.key,weight:10},{arbitrary:l("anything").map(u=>ve(u)),weight:1}):e.key,array:se(l("anything"),{maxLength:o,size:s,depthIdentifier:r}),set:lx(l("anything"),{maxLength:o,size:s,depthIdentifier:r}),map:Pe(Bd(l("keys"),l("anything"),{maxKeys:o,size:s,depthIdentifier:r}),Bd(l("anything"),l("anything"),{maxKeys:o,size:s,depthIdentifier:r})),object:r8(l("keys"),l("anything"),o,s,r,e.withNullPrototype)})).anything}function o8(e){switch(typeof e){case"boolean":return new j1(e);case"number":return new jt(e);case"string":return new Ve(e);default:return e}}function s8(e){return typeof e!="object"||e===null||!("constructor"in e)?e:e.constructor===j1||e.constructor===jt||e.constructor===Ve?e.valueOf():e}function a8(e){return e.map(o8,s8)}function l8(e,t){return[Ei(),q0(),sa(),t(e),Pe(t(e),xe(null),xe(void 0))]}function u8(e){return e.map(t=>a8(t))}function c8(e,t){return t?u8(e).concat(e):e}function cx(e={}){let t={size:e.size,unit:"stringUnit"in e?e.stringUnit:e.withUnicodeString?"binary":void 0};return{key:e.key!==void 0?e.key:Ce(t),values:c8(e.values!==void 0?e.values:l8(t,Ce),e.withBoxedValues===!0),depthSize:e.depthSize,maxDepth:e.maxDepth,maxKeys:e.maxKeys,size:e.size,withSet:e.withSet===!0,withMap:e.withMap===!0,withObjectString:e.withObjectString===!0,withNullPrototype:e.withNullPrototype===!0,withBigInt:e.withBigInt===!0,withDate:e.withDate===!0,withTypedArray:e.withTypedArray===!0,withSparseArray:e.withSparseArray===!0}}function d8(e){return af(e.key,ux(e),{maxKeys:e.maxKeys,noNullPrototype:!e.withNullPrototype,size:e.size})}function f8(e){return d8(cx(e))}function p8(e,t){let{depthSize:n,maxDepth:r}=t;return{key:e,values:[Ei(),sa({noDefaultInfinity:!0,noNaN:!0}),e,xe(null)],depthSize:n,maxDepth:r}}function dx(e){return ux(cx(e))}function fx(e={}){let t=e.noUnicodeString===void 0||e.noUnicodeString===!0;return dx(p8("stringUnit"in e?Ce({unit:e.stringUnit}):t?Ce():Ce({unit:"binary"}),e))}var h8=JSON.stringify,m8=JSON.parse;function y8(e){if(typeof e!="string")throw new L("Cannot unmap the passed value");return m8(e)}function g8(e={}){return fx(e).map(h8,y8)}var b8=Object.defineProperties;function pd(e,t){return`Stream(${t!==void 0?`${le(t,",")}\u2026`:`${e} emitted`})`}var S8=class extends ue{constructor(e,t){super(),this.arb=e,this.history=t}generate(e,t){let n=t!==void 0&&e.nextInt(1,t)===1?t:void 0,r=()=>{let i=this.history?[]:null,o=0,s=function*(a,l){for(;;){let u=a.generate(l,n).value;o++,i!==null&&$(i,u),yield u}};return b8(new F(s(this.arb,e.clone())),{toString:{value:()=>pd(o,i!==null?i.map(ve):void 0)},[ht]:{value:()=>pd(o,i!==null?i.map(ve):void 0)},[Bt]:{value:async()=>pd(o,i!==null?await Promise.all(i.map(Qd)):void 0)},[Te]:{value:r,enumerable:!0}})};return new D(r(),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return F.nil()}};function w8(e,t){return new S8(e,t!==void 0&&typeof t=="object"&&"noHistory"in t?!t.noHistory:!0)}function x8(e){return le(e,"")}function h1(e){if(typeof e!="string")throw new Error("Cannot unmap the passed value");return[...e]}function v8(e){switch(e.length%4){case 0:return e;case 3:return`${e}=`;case 2:return`${e}==`;default:return he(e,1)}}function R8(e){if(typeof e!="string"||e.length%4!==0)throw new Error("Invalid string received");let t=e.indexOf("=");if(t===-1)return e;if(e.length-t>2)throw new Error("Cannot unmap the passed value");return he(e,0,t)}var hd=String.fromCharCode;function k8(e){return e<26?hd(e+65):e<52?hd(e+97-26):e<62?hd(e+48-52):e===62?"+":"/"}function C8(e){if(typeof e!="string"||e.length!==1)throw new L("Invalid entry");let t=fr(e,0);return t>=65&&t<=90?t-65:t>=97&&t<=122?t-97+26:t>=48&&t<=57?t-48+52:t===43?62:t===47?63:-1}function E8(){return re({min:0,max:63}).map(k8,C8)}function A8(e={}){let{minLength:t=0,maxLength:n=En,size:r}=e,i=t+3-(t+3)%4,o=n-n%4,s=e.maxLength===void 0&&r===void 0?"=":r;if(i>o)throw new L("Minimal length should be inferior or equal to maximal length");if(i%4!==0)throw new L("Minimal length of base64 strings must be a multiple of 4");if(o%4!==0)throw new L("Maximal length of base64 strings must be a multiple of 4");let a=E8();return se(a,{minLength:i,maxLength:o,size:s,experimentalCustomSlices:l_(a,h1)}).map(x8,h1).map(v8,R8)}var m1=Object.is;function I8(e,t){let n=new Ft,r=0;for(let i of e)m1(i,-0)?++r:ft(n,i,(Ze(n,i)||0)+1);for(let i=0;i!==t.length;++i){if(!(i in t))return!1;let o=t[i];if(m1(o,-0)){if(r===0)return!1;--r}else{let s=Ze(n,o)||0;if(s===0)return!1;ft(n,o,s-1)}}return!0}var P8=Math.floor,y1=Math.log,T8=Array.isArray,px=class extends ue{constructor(e,t,n,r){if(super(),this.originalArray=e,this.isOrdered=t,this.minLength=n,this.maxLength=r,n<0||n>e.length)throw new Error("fc.*{s|S}ubarrayOf expects the minimal length to be between 0 and the size of the original array");if(r<0||r>e.length)throw new Error("fc.*{s|S}ubarrayOf expects the maximal length to be between 0 and the size of the original array");if(n>r)throw new Error("fc.*{s|S}ubarrayOf expects the minimal length to be inferior or equal to the maximal length");this.lengthArb=new hr(n,r),this.biasedLengthArb=n!==r?new hr(n,n+P8(y1(r-n)/y1(2))):this.lengthArb}generate(e,t){let n=(t!==void 0&&e.nextInt(1,t)===1?this.biasedLengthArb:this.lengthArb).generate(e,void 0),r=n.value,i=z(this.originalArray,(s,a)=>a),o=[];for(let s=0;s!==r;++s){let a=e.nextInt(0,i.length-1);$(o,i[a]),W1(i,a,1)}return this.isOrdered&&z1(o,(s,a)=>s-a),new D(z(o,s=>this.originalArray[s]),n.context)}canShrinkWithoutContext(e){return!T8(e)||!this.lengthArb.canShrinkWithoutContext(e.length)?!1:I8(this.originalArray,e)}shrink(e,t){return e.length===0?F.nil():this.lengthArb.shrink(e.length,t).map(n=>new D(Oe(e,e.length-n.value),n.context)).join(e.length>this.minLength?en(()=>this.shrink(Oe(e,1),void 0).filter(n=>this.minLength<=n.value.length+1).map(n=>new D([e[0],...n.value],void 0))):F.nil())}};function M8(e,t={}){let{minLength:n=0,maxLength:r=e.length}=t;return new px(e,!0,n,r)}function O8(e,t={}){let{minLength:n=0,maxLength:r=e.length}=t;return new px(e,!1,n,r)}var N8={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F",16:"G",17:"H",18:"J",19:"K",20:"M",21:"N",22:"P",23:"Q",24:"R",25:"S",26:"T",27:"V",28:"W",29:"X",30:"Y",31:"Z"},L8={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,G:16,H:17,J:18,K:19,M:20,N:21,P:22,Q:23,R:24,S:25,T:26,V:27,W:28,X:29,Y:30,Z:31};function $8(e){return e<10?Ve(e):N8[e]}function g1(e,t){let n="";for(;e.length+n.length<t;)n+="0";return n+e}function b1(e){let t="";for(let n=e;n!==0;){let r=n>>5;t=$8(n-(r<<5))+t,n=r}return t}function _8(e,t){let n=~~(e/1073741824),r=e&1073741823;return g1(b1(n),t-6)+g1(b1(r),6)}function hx(e){return function(n){return _8(n,e)}}function md(e){if(typeof e!="string")throw new L("Unsupported type");let t=0,n=1;for(let r=e.length-1;r>=0;--r){let i=L8[e[r]];if(i===void 0)throw new L("Unsupported type");t+=i*n,n*=32}return t}var D8=hx(10),S1=hx(8);function j8(e){return D8(e[0])+S1(e[1])+S1(e[2])}function F8(e){if(typeof e!="string"||e.length!==26)throw new Error("Unsupported type");return[md(e.slice(0,10)),md(e.slice(10,18)),md(e.slice(18))]}function B8(){return V(re({min:0,max:0xffffffffffff}),re({min:0,max:0xffffffffff}),re({min:0,max:0xffffffffff})).map(j8,F8)}function mx(e){return C3(xi(e,16),8,"0")}function V8(e){if(typeof e!="string")throw new Error("Unsupported type");if(e.length!==8)throw new Error("Unsupported value: invalid length");let t=parseInt(e,16);if(e!==mx(t))throw new Error("Unsupported value: invalid content");return t}function yd(e,t){return re({min:e,max:t}).map(mx,V8)}function U8(e){return`${e[0]}-${he(e[1],4)}-${he(e[1],0,4)}-${he(e[2],0,4)}-${he(e[2],4)}${e[3]}`}var W8=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/;function z8(e){if(typeof e!="string")throw new Error("Unsupported type");let t=W8.exec(e);if(t===null)throw new Error("Unsupported type");return[t[1],t[3]+t[2],t[4]+he(t[5],0,4),he(t[5],4)]}var w1="0123456789abcdef";function G8(e){let t={},n={};for(let o=0;o!==e.length;++o){let s=w1[o],a=w1[e[o]];t[s]=a,n[a]=s}function r(o){return t[o[0]]+he(o,1)}function i(o){if(typeof o!="string")throw new L("Cannot produce non-string values");let s=n[o[0]];if(s===void 0)throw new L("Cannot produce strings not starting by the version in hexa code");return s+he(o,1)}return{versionsApplierMapper:r,versionsApplierUnmapper:i}}function H8(e){let t={};for(let n of e){if(t[n])throw new L(`Version ${n} has been requested at least twice for uuid`);if(t[n]=!0,n<1||n>15)throw new L(`Version must be a value in [1-15] for uuid, but received ${n}`);if(~~n!==n)throw new L(`Version must be an integer value for uuid, but received ${n}`)}if(e.length===0)throw new L("Must provide at least one version for uuid")}function q8(e={}){let t=yd(0,4294967295),n=e.version!==void 0?typeof e.version=="number"?[e.version]:e.version:[1,2,3,4,5,6,7,8];H8(n);let{versionsApplierMapper:r,versionsApplierUnmapper:i}=G8(n);return V(t,yd(0,268435456*n.length-1).map(r,i),yd(2147483648,3221225471),t).map(U8,z8)}function K8(e){return Ce({unit:cf("-._~!$&'()*+,;=:"),size:e})}function Y8([e,t,n]){return(e===null?"":`${e}@`)+t+(n===null?"":`:${n}`)}function J8(e){if(typeof e!="string")throw new Error("Unsupported");let t=e.indexOf("@"),n=t!==-1?e.substring(0,t):null,r=/:(\d+)$/.exec(e),i=r!==null?Number(r[1]):null;return[n,r!==null?e.substring(t+1,e.length-r[1].length-1):e.substring(t+1),i]}function X8(e){return`[${e}]`}function Z8(e){if(typeof e!="string"||e[0]!=="["||e[e.length-1]!=="]")throw new Error("Unsupported");return e.substring(1,e.length-1)}function yx(e){let t=e||{},n=t.size,r=[df({size:n}),...t.withIPv4===!0?[mf()]:[],...t.withIPv6===!0?[Y0().map(X8,Z8)]:[],...t.withIPv4Extended===!0?[K0()]:[]];return V(t.withUserInfo===!0?Vt(K8(n)):xe(null),Pe(...r),t.withPort===!0?Vt(Qt(65535)):xe(null)).map(Y8,J8)}function gx(e){return Ce({unit:cf("-._~!$&'()*+,;=:@/?"),size:e})}function bx(e={}){return gx(e.size)}function Sx(e={}){return Ce({unit:cf("-._~!$&'()*+,;=:@"),size:e.size})}function Q8(e){return le(z(e,t=>`/${t}`),"")}function e9(e){if(typeof e!="string")throw new Error("Incompatible value received: type");if(e.length!==0&&e[0]!=="/")throw new Error("Incompatible value received: start");return W1(Ue(e,"/"),1)}function t9(e){switch(e){case"xsmall":return["xsmall","xsmall"];case"small":return["small","xsmall"];case"medium":return["small","small"];case"large":return["medium","small"];case"xlarge":return["medium","medium"]}}function gd(e,t){return se(Sx({size:e}),{size:t}).map(Q8,e9)}function n9(e){let[t,n]=t9(e);return t===n?gd(t,n):Pe(gd(t,n),gd(n,t))}function wx(e){return n9(sf((e||{}).size))}function xx(e={}){return gx(e.size)}function r9(e){let[t,n,r]=e;return`${t}://${n}${r}${e[3]===null?"":`?${e[3]}`}${e[4]===null?"":`#${e[4]}`}`}var i9=/^([[A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)([^?#]*)(\?[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?(#[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?$/;function o9(e){if(typeof e!="string")throw new Error("Incompatible value received: type");let t=i9.exec(e);if(t===null)throw new Error("Incompatible value received");let n=t[1],r=t[2],i=t[3],o=t[4],s=t[5];return[n,r,i,o!==void 0?o.substring(1):null,s!==void 0?s.substring(1):null]}function s9(e){let t=e||{},n=sf(t.size),r=t.authoritySettings!==void 0&&t.authoritySettings.size!==void 0?Ci(t.authoritySettings.size,n):n,i={...t.authoritySettings,size:r};return V(kt(...t.validSchemes||["http","https"]),yx(i),wx({size:n}),t.withQueryParameters===!0?Vt(xx({size:n})):xe(null),t.withFragments===!0?Vt(bx({size:n})):xe(null)).map(r9,o9)}var a9=class vx{constructor(t,n){this.commands=t,this.metadataForReplay=n,this[Te]=function(){return new vx(this.commands.map(r=>r.clone()),this.metadataForReplay)}}[Symbol.iterator](){return this.commands[Symbol.iterator]()}toString(){let t=this.commands.filter(r=>r.hasRan).map(r=>r.toString()).join(","),n=this.metadataForReplay();return n.length!==0?`${t} /*${n}*/`:t}},l9=class Wd{constructor(t){if(this.cmd=t,this.hasRan=!1,Xd(t)){let n=t[ht];this[ht]=function(){return n.call(t)}}if(Zd(t)){let n=t[Bt];this[Bt]=function(){return n.call(t)}}}check(t){return this.cmd.check(t)}run(t,n){return this.hasRan=!0,this.cmd.run(t,n)}clone(){return Cn(this.cmd)?new Wd(this.cmd[Te]()):new Wd(this.cmd)}toString(){return this.cmd.toString()}},x1=class{static parse(e){let[t,n]=e.split(":"),r=this.parseCounts(t),i=this.parseChanges(n);return this.parseOccurences(r,i)}static stringify(e){let t=this.countOccurences(e);return`${this.stringifyCounts(t)}:${this.stringifyChanges(t)}`}static intToB64(e){return e<26?String.fromCharCode(e+65):e<52?String.fromCharCode(e+97-26):e<62?String.fromCharCode(e+48-52):String.fromCharCode(e===62?43:47)}static b64ToInt(e){return e>="a"?e.charCodeAt(0)-97+26:e>="A"?e.charCodeAt(0)-65:e>="0"?e.charCodeAt(0)-48+52:e==="+"?62:63}static countOccurences(e){return e.reduce((t,n)=>(t.length===0||t[t.length-1].count===64||t[t.length-1].value!==n?t.push({value:n,count:1}):t[t.length-1].count+=1,t),[])}static parseOccurences(e,t){let n=[];for(let r=0;r!==e.length;++r){let i=e[r],o=t[r];for(let s=0;s!==i;++s)n.push(o)}return n}static stringifyChanges(e){let t="";for(let n=0;n<e.length;n+=6){let r=e.slice(n,n+6).reduceRight((i,o)=>(i<<1)+(o.value?1:0),0);t+=this.intToB64(r)}return t}static parseChanges(e){let t=e.split("").map(r=>this.b64ToInt(r)),n=[];for(let r=0;r!==t.length;++r){let i=t[r];for(let o=0;o!==6;++o,i>>=1)n.push(i%2===1)}return n}static stringifyCounts(e){return e.map(({count:t})=>this.intToB64(t-1)).join("")}static parseCounts(e){return e.split("").map(t=>this.b64ToInt(t)+1)}},u9=class extends ue{constructor(e,t,n,r,i){super(),this.sourceReplayPath=r,this.disableReplayLog=i,this.oneCommandArb=Pe(...e).map(o=>new l9(o)),this.lengthArb=Vd(0,t,n),this.replayPath=[],this.replayPathPosition=0}metadataForReplay(){return this.disableReplayLog?"":`replayPath=${JSON.stringify(x1.stringify(this.replayPath))}`}buildValueFor(e,t){let n=e.map(i=>i.value_),r={shrunkOnce:t,items:e};return new D(new a9(n,()=>this.metadataForReplay()),r)}generate(e){let t=this.lengthArb.generate(e,void 0).value,n=Array(t);for(let r=0;r!==t;++r)n[r]=this.oneCommandArb.generate(e,void 0);return this.replayPathPosition=0,this.buildValueFor(n,!1)}canShrinkWithoutContext(e){return!1}filterOnExecution(e){let t=[];for(let n of e)n.value_.hasRan?(this.replayPath.push(!0),t.push(n)):this.replayPath.push(!1);return t}filterOnReplay(e){return e.filter((t,n)=>{let r=this.replayPath[this.replayPathPosition+n];if(r===void 0)throw new Error("Too short replayPath");if(!r&&t.value_.hasRan)throw new Error("Mismatch between replayPath and real execution");return r})}filterForShrinkImpl(e){this.replayPathPosition===0&&(this.replayPath=this.sourceReplayPath!==null?x1.parse(this.sourceReplayPath):[]);let t=this.replayPathPosition<this.replayPath.length?this.filterOnReplay(e):this.filterOnExecution(e);return this.replayPathPosition+=e.length,t}shrink(e,t){if(t===void 0)return F.nil();let n=t,r=n.shrunkOnce,i=n.items,o=this.filterForShrinkImpl(i);if(o.length===0)return F.nil();let s=r?F.nil():new F([[]][Symbol.iterator]()),a=[];for(let l=0;l!==o.length;++l)a.push(en(()=>{let u=o.slice(0,l);return this.lengthArb.shrink(o.length-1-l,void 0).map(c=>u.concat(o.slice(o.length-(c.value+1))))}));for(let l=0;l!==o.length;++l)a.push(en(()=>this.oneCommandArb.shrink(o[l].value_,o[l].context).map(u=>o.slice(0,l).concat([u],o.slice(l+1)))));return s.join(...a).map(l=>this.buildValueFor(l.map(u=>new D(u.value_.clone(),u.context)),!0))}};function c9(e,t={}){let{size:n,maxCommands:r=En,disableReplayLog:i=!1,replayPath:o=null}=t;return new u9(e,Ri(n,0,r,t.maxCommands!==void 0),r,o,i)}var d9=class{constructor(e,t){this.s=e,this.cmd=t}async check(e){let t=null,n=!1;if((await this.s.scheduleSequence([{label:`check@${this.cmd.toString()}`,builder:async()=>{try{n=await Promise.resolve(this.cmd.check(e))}catch(r){throw t=r,r}}}]).task).faulty)throw t;return n}async run(e,t){let n=null;if((await this.s.scheduleSequence([{label:`run@${this.cmd.toString()}`,builder:async()=>{try{await this.cmd.run(e,t)}catch(r){throw n=r,r}}}]).task).faulty)throw n}},f9=function*(e,t){for(let n of t)yield new d9(e,n)},Rx=(e,t,n,r,i)=>e.then(o=>{let{model:s,real:a}=o,l=n;for(let u of t)l=i(l,()=>r(u,s,a));return l}),p9=(e,t)=>Rx({then:o=>{o(e())}},t,void 0,(o,s,a)=>{o.check(s)&&o.run(s,a)},(o,s)=>s()),h9=e=>typeof e.then=="function",kx=async(e,t,n=Promise.resolve())=>await Rx({then:s=>{let a=e();return h9(a)?a.then(s):s(a)}},t,n,async(s,a,l)=>{await s.check(a)&&await s.run(a,l)},(s,a)=>s.then(a));function m9(e,t){p9(e,t)}async function y9(e,t){await kx(e,t)}async function g9(e,t,n){let r=kx(t,f9(e,n),e.schedule(Promise.resolve(),"startModel"));await e.waitFor(r),await e.waitAll()}var zs=e=>e(),Cx=class zd{constructor(t,n){this.act=t,this.taskSelector=n,this.lastTaskId=0,this.sourceTaskSelector=n.clone(),this.scheduledTasks=[],this.triggeredTasks=[],this.scheduledWatchers=[],this[Te]=function(){return new zd(this.act,this.sourceTaskSelector)}}static buildLog(t){return`[task\${${t.taskId}}] ${t.label.length!==0?`${t.schedulingType}::${t.label}`:t.schedulingType} ${t.status}${t.outputValue!==void 0?` with value ${xD(t.outputValue)}`:""}`}log(t,n,r,i,o,s){this.triggeredTasks.push({status:o,schedulingType:t,taskId:n,label:r,metadata:i,outputValue:s!==void 0?ve(s):void 0})}scheduleInternal(t,n,r,i,o,s){let a=++this.lastTaskId,l,u=new Promise((c,d)=>{l=()=>{let f=Promise.resolve(s!==void 0?r.then(()=>s()):r);return f.then(h=>{this.log(t,a,n,i,"resolved",h),c(h)},h=>{this.log(t,a,n,i,"rejected",h),d(h)}),f}});return this.scheduledTasks.push({original:r,trigger:l,schedulingType:t,taskId:a,label:n,metadata:i,customAct:o}),this.scheduledWatchers.length!==0&&this.scheduledWatchers[0](),u}schedule(t,n,r,i){return this.scheduleInternal("promise",n||"",t,r,i||zs)}scheduleFunction(t,n){return(...r)=>this.scheduleInternal("function",`${t.name}(${r.map(ve).join(",")})`,t(...r),void 0,n||zs)}scheduleSequence(t,n){let r={done:!1,faulty:!1},i={then:c=>c()},o=()=>{},s=new Promise(c=>{o=()=>c({done:r.done,faulty:r.faulty})}),a=()=>{r.faulty=!0,o()},l=()=>{r.done=!0,o()},u=(c,d)=>{if(c>=t.length){d.then(l,a);return}d.then(()=>{let f=t[c],[h,p,m]=typeof f=="function"?[f,f.name,void 0]:[f.builder,f.label,f.metadata],y=this.scheduleInternal("sequence",p,i,m,n||zs,()=>h());u(c+1,y)},a)};return u(0,i),Object.assign(r,{task:s})}count(){return this.scheduledTasks.length}internalWaitOne(){if(this.scheduledTasks.length===0)throw new Error("No task scheduled");let t=this.taskSelector.nextTaskIndex(this.scheduledTasks),[n]=this.scheduledTasks.splice(t,1);return n.customAct(()=>n.trigger().catch(r=>{}))}waitOne(t){let n=t||zs;return this.act(()=>n(()=>this.internalWaitOne()))}async waitAll(t){for(;this.scheduledTasks.length>0;)await this.waitOne(t)}async internalWaitFor(t,n){let r=!1,i=n.customAct,o=n.onWaitStart,s=n.onWaitIdle,a=n.launchAwaiterOnInit,l,u,c=0,d=null,f=null,h=async()=>{for(c=50,c=50;!r&&c>0;--c)await Promise.resolve();if(!r&&this.scheduledTasks.length>0)return o!==void 0&&o(),f=this.waitOne(i),f.then(()=>(f=null,h()),S=>{throw f=null,r=!0,u(S),S});!r&&s!==void 0&&s(),d=null},p=()=>{if(d!==null){c=51;return}d=h().catch(()=>{})},m=()=>{let S=this.scheduledWatchers.indexOf(p);S!==-1&&this.scheduledWatchers.splice(S,1),S===0&&this.scheduledWatchers.length!==0&&this.scheduledWatchers[0]()},y=new Promise((S,w)=>{l=g=>{m(),S(g)},u=g=>{m(),w(g)}});return t.then(S=>{r=!0,f===null?l(S):f.then(()=>l(S),w=>u(w))},S=>{r=!0,f===null?u(S):f.then(()=>u(S),()=>u(S))}),(this.scheduledTasks.length>0||a)&&this.scheduledWatchers.length===0&&p(),this.scheduledWatchers.push(p),y}waitNext(t,n){let r,i=t,o=i<=0?Promise.resolve():new Promise(s=>{r=()=>{--i<=0&&s()}});return this.internalWaitFor(o,{customAct:n,onWaitStart:r,onWaitIdle:void 0,launchAwaiterOnInit:!1})}waitIdle(t){let n,r=new Promise(i=>n=i);return this.internalWaitFor(r,{customAct:t,onWaitStart:void 0,onWaitIdle:n,launchAwaiterOnInit:!0})}waitFor(t,n){return this.internalWaitFor(t,{customAct:n,onWaitStart:void 0,onWaitIdle:void 0,launchAwaiterOnInit:!1})}report(){return[...this.triggeredTasks,...this.scheduledTasks.map(t=>({status:"pending",schedulingType:t.schedulingType,taskId:t.taskId,label:t.label,metadata:t.metadata}))]}toString(){return"schedulerFor()`\n"+this.report().map(zd.buildLog).map(t=>`-> ${t}`).join(`
128
- `)+"`"}};function Ex(e){let t=0;return{clone:()=>Ex(e),nextTaskIndex:n=>{if(e.length<=t)throw new Error("Invalid schedulerFor defined: too many tasks have been scheduled");let r=n.findIndex(i=>i.taskId===e[t]);if(r===-1)throw new Error("Invalid schedulerFor defined: unable to find next task");return++t,r}}}function v1(e,t){return new Cx(e,Ex(t))}function Ax(e){let t=e.clone();return{clone:()=>Ax(t),nextTaskIndex:n=>e.nextInt(0,n.length-1)}}var b9=class extends ue{constructor(e){super(),this.act=e}generate(e,t){return new D(new Cx(this.act,Ax(e.clone())),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return F.nil()}};function S9(e){let{act:t=n=>n()}=e||{};return new b9(t)}function w9(e,t){let{act:n=r=>r()}=Array.isArray(e)?t||{}:e||{};return Array.isArray(e)?v1(n,e):function(r,...i){return v1(n,i)}}function x9(e={}){return Ut(e,O("-9223372036854775808"),O("9223372036854775807"),T4,nn)}function v9(e={}){return Ut(e,O(0),O("18446744073709551615"),M4,nn)}function R9(e,t){return t}var bd=Math.floor,k9=Math.min;function it(e,t){switch(e.type){case"Char":return{astNode:e,minLength:1};case"Repetition":switch(e.quantifier.kind){case"*":{let n=it(e.expression,t);return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:t},expression:n.astNode},minLength:0}}case"+":{let n=it(e.expression,t),r=n.minLength>1?n.minLength:1;return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:1,to:bd(t/r)},expression:n.astNode},minLength:n.minLength}}case"?":{let n=it(e.expression,t);return t<n.minLength?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:0},expression:n.astNode},minLength:0}:{astNode:{...e,expression:n.astNode},minLength:0}}case"Range":{let n=e.quantifier.from>1?bd(t/e.quantifier.from):t,r=it(e.expression,n),i=r.minLength>1?r.minLength:1;return e.quantifier.to===void 0||e.quantifier.to*i>t?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",to:bd(t/i)},expression:r.astNode},minLength:e.quantifier.from*r.minLength}:{astNode:{...e,expression:r.astNode},minLength:e.quantifier.from*r.minLength}}default:return R9(e.quantifier,{astNode:e,minLength:0})}case"Quantifier":return{astNode:e,minLength:0};case"Alternative":{let n=0,r=[];for(let o=0;o!==e.expressions.length;++o){let s=t-n,a=it(e.expressions[o],s);n+=a.minLength,$(r,{value:a,allowance:s})}let i=[];for(let o=0;o!==r.length;++o){let s=r[o].value,a=r[o].allowance,l=t-n+s.minLength;$(i,(l!==a?it(s.astNode,l):s).astNode)}return{astNode:{...e,expressions:i},minLength:n}}case"CharacterClass":return{astNode:e,minLength:1};case"ClassRange":return{astNode:e,minLength:1};case"Group":{let n=it(e.expression,t);return{astNode:{...e,expression:n.astNode},minLength:n.minLength}}case"Disjunction":{if(e.left===null){if(e.right===null)return{astNode:e,minLength:0};let i=it(e.right,t),o=i.minLength>t?null:i.astNode;return{astNode:{...e,left:null,right:o},minLength:0}}if(e.right===null){let i=it(e.left,t),o=i.minLength>t?null:i.astNode;return{astNode:{...e,left:o,right:null},minLength:0}}let n=it(e.left,t),r=it(e.right,t);return n.minLength>t?r:r.minLength>t?n:{astNode:{...e,left:n.astNode,right:r.astNode},minLength:k9(n.minLength,r.minLength)}}case"Assertion":return{astNode:e,minLength:0};case"Backreference":return{astNode:e,minLength:0};case"UnicodeProperty":return{astNode:e,minLength:1}}}function C9(e,t){return it(e,t).astNode}function E9(e){return new Error(`Unsupported AST node! Received: ${ve(e)}`)}function Xs(e,t,n){if(!t&&!n)return e;let r={hasStart:!1,hasEnd:!1},i=Ix(e,t,n,r),o=t&&!r.hasStart,s=n&&!r.hasEnd;if(!o&&!s)return i;let a=[];return o&&(a.push({type:"Assertion",kind:"^"}),a.push({type:"Repetition",quantifier:{type:"Quantifier",kind:"*",greedy:!0},expression:{type:"Char",kind:"meta",symbol:".",value:".",codePoint:NaN}})),a.push(i),s&&(a.push({type:"Repetition",quantifier:{type:"Quantifier",kind:"*",greedy:!0},expression:{type:"Char",kind:"meta",symbol:".",value:".",codePoint:NaN}}),a.push({type:"Assertion",kind:"$"})),{type:"Group",capturing:!1,expression:{type:"Alternative",expressions:a}}}function Ix(e,t,n,r){switch(e.type){case"Char":return e;case"Repetition":return e;case"Quantifier":throw new Error("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return r.hasStart=!0,r.hasEnd=!0,{...e,expressions:e.expressions.map((i,o)=>Xs(i,t&&o===0,n&&o===e.expressions.length-1))};case"CharacterClass":return e;case"ClassRange":return e;case"Group":return{...e,expression:Ix(e.expression,t,n,r)};case"Disjunction":return r.hasStart=!0,r.hasEnd=!0,{...e,left:e.left!==null?Xs(e.left,t,n):null,right:e.right!==null?Xs(e.right,t,n):null};case"Assertion":if(e.kind==="^"||e.kind==="Lookahead")return r.hasStart=!0,e;if(e.kind==="$"||e.kind==="Lookbehind")return r.hasEnd=!0,e;throw new Error(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":return e;case"UnicodeProperty":return e;default:throw E9(e)}}function A9(e){return Xs(e,!0,!0)}function R1(e,t){return e[t]>="\uD800"&&e[t]<="\uDBFF"&&e[t+1]>="\uDC00"&&e[t+1]<="\uDFFF"?2:1}function ke(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"}function Gd(e){return e>="0"&&e<="9"}function Px(e,t){for(let n=t;n!==e.length;++n){let r=e[n];if(r==="\\")n+=1;else if(r==="]")return n}throw new Error("Missing closing ']'")}function I9(e,t){let n=0;for(let r=t;r!==e.length;++r){let i=e[r];if(i==="\\")r+=1;else if(i===")"){if(n===0)return r;n-=1}else i==="["?r=Px(e,r):i==="("&&(n+=1)}throw new Error("Missing closing ')'")}function P9(e,t){let n=!1;for(let r=t;r!==e.length;++r){let i=e[r];if(!Gd(i)){if(t===r)return-1;if(i===","){if(n)return-1;n=!0}else return i==="}"?r:-1}}return-1}function T9(e,t,n,r){switch(e[t]){case"[":return r===1?t+1:Px(e,t+1)+1;case"{":{if(r===1)return t+1;let i=P9(e,t+1);return i===-1?t+1:i+1}case"(":return r===1?t+1:I9(e,t+1)+1;case"]":case"}":case")":return t+1;case"\\":{let i=e[t+1];switch(i){case"x":if(ke(e[t+2])&&ke(e[t+3]))return t+4;throw new Error(`Unexpected token '${e.substring(t,t+4)}' found`);case"u":if(e[t+2]==="{"){if(!n)return t+2;if(e[t+4]==="}"){if(ke(e[t+3]))return t+5;throw new Error(`Unexpected token '${e.substring(t,t+5)}' found`)}if(e[t+5]==="}"){if(ke(e[t+3])&&ke(e[t+4]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`)}if(e[t+6]==="}"){if(ke(e[t+3])&&ke(e[t+4])&&ke(e[t+5]))return t+7;throw new Error(`Unexpected token '${e.substring(t,t+7)}' found`)}if(e[t+7]==="}"){if(ke(e[t+3])&&ke(e[t+4])&&ke(e[t+5])&&ke(e[t+6]))return t+8;throw new Error(`Unexpected token '${e.substring(t,t+8)}' found`)}if(e[t+8]==="}"&&ke(e[t+3])&&ke(e[t+4])&&ke(e[t+5])&&ke(e[t+6])&&ke(e[t+7]))return t+9;throw new Error(`Unexpected token '${e.substring(t,t+9)}' found`)}if(ke(e[t+2])&&ke(e[t+3])&&ke(e[t+4])&&ke(e[t+5]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`);case"p":case"P":{if(!n)return t+2;let o=t+2;for(;o<e.length&&e[o]!=="}";o+=e[o]==="\\"?2:1);if(e[o]!=="}")throw new Error("Invalid \\P definition");return o+1}case"k":{let o=t+2;for(;o<e.length&&e[o]!==">";++o);if(e[o]!==">"){if(!n)return t+2;throw new Error("Invalid \\k definition")}return o+1}default:if(Gd(i)){let o=n?e.length:Math.min(t+4,e.length),s=t+2;for(;s<o&&Gd(e[s]);++s);return s}return t+(n?R1(e,t+1):1)+1}}default:return t+(n?R1(e,t):1)}}function Gs(e,t,n,r){let i=T9(e,t,n,r);return e.substring(t,i)}var k1={gc:"General_Category",sc:"Script",scx:"Script_Extensions"},aa={ASCII:"ASCII",ASCII_Hex_Digit:"AHex",Alphabetic:"Alpha",Any:"Any",Assigned:"Assigned",Bidi_Control:"Bidi_C",Bidi_Mirrored:"Bidi_M",Case_Ignorable:"CI",Cased:"Cased",Changes_When_Casefolded:"CWCF",Changes_When_Casemapped:"CWCM",Changes_When_Lowercased:"CWL",Changes_When_NFKC_Casefolded:"CWKCF",Changes_When_Titlecased:"CWT",Changes_When_Uppercased:"CWU",Dash:"Dash",Default_Ignorable_Code_Point:"DI",Deprecated:"Dep",Diacritic:"Dia",Emoji:"Emoji",Emoji_Component:"Emoji_Component",Emoji_Modifier:"Emoji_Modifier",Emoji_Modifier_Base:"Emoji_Modifier_Base",Emoji_Presentation:"Emoji_Presentation",Extended_Pictographic:"Extended_Pictographic",Extender:"Ext",Grapheme_Base:"Gr_Base",Grapheme_Extend:"Gr_Ext",Hex_Digit:"Hex",IDS_Binary_Operator:"IDSB",IDS_Trinary_Operator:"IDST",ID_Continue:"IDC",ID_Start:"IDS",Ideographic:"Ideo",Join_Control:"Join_C",Logical_Order_Exception:"LOE",Lowercase:"Lower",Math:"Math",Noncharacter_Code_Point:"NChar",Pattern_Syntax:"Pat_Syn",Pattern_White_Space:"Pat_WS",Quotation_Mark:"QMark",Radical:"Radical",Regional_Indicator:"RI",Sentence_Terminal:"STerm",Soft_Dotted:"SD",Terminal_Punctuation:"Term",Unified_Ideograph:"UIdeo",Uppercase:"Upper",Variation_Selector:"VS",White_Space:"space",XID_Continue:"XIDC",XID_Start:"XIDS"},ki=Sf(aa),bf={Cased_Letter:"LC",Close_Punctuation:"Pe",Connector_Punctuation:"Pc",Control:["Cc","cntrl"],Currency_Symbol:"Sc",Dash_Punctuation:"Pd",Decimal_Number:["Nd","digit"],Enclosing_Mark:"Me",Final_Punctuation:"Pf",Format:"Cf",Initial_Punctuation:"Pi",Letter:"L",Letter_Number:"Nl",Line_Separator:"Zl",Lowercase_Letter:"Ll",Mark:["M","Combining_Mark"],Math_Symbol:"Sm",Modifier_Letter:"Lm",Modifier_Symbol:"Sk",Nonspacing_Mark:"Mn",Number:"N",Open_Punctuation:"Ps",Other:"C",Other_Letter:"Lo",Other_Number:"No",Other_Punctuation:"Po",Other_Symbol:"So",Paragraph_Separator:"Zp",Private_Use:"Co",Punctuation:["P","punct"],Separator:"Z",Space_Separator:"Zs",Spacing_Mark:"Mc",Surrogate:"Cs",Symbol:"S",Titlecase_Letter:"Lt",Unassigned:"Cn",Uppercase_Letter:"Lu"},Hd=Sf(bf),Tx={Adlam:"Adlm",Ahom:"Ahom",Anatolian_Hieroglyphs:"Hluw",Arabic:"Arab",Armenian:"Armn",Avestan:"Avst",Balinese:"Bali",Bamum:"Bamu",Bassa_Vah:"Bass",Batak:"Batk",Bengali:"Beng",Bhaiksuki:"Bhks",Bopomofo:"Bopo",Brahmi:"Brah",Braille:"Brai",Buginese:"Bugi",Buhid:"Buhd",Canadian_Aboriginal:"Cans",Carian:"Cari",Caucasian_Albanian:"Aghb",Chakma:"Cakm",Cham:"Cham",Cherokee:"Cher",Common:"Zyyy",Coptic:["Copt","Qaac"],Cuneiform:"Xsux",Cypriot:"Cprt",Cyrillic:"Cyrl",Deseret:"Dsrt",Devanagari:"Deva",Dogra:"Dogr",Duployan:"Dupl",Egyptian_Hieroglyphs:"Egyp",Elbasan:"Elba",Ethiopic:"Ethi",Georgian:"Geor",Glagolitic:"Glag",Gothic:"Goth",Grantha:"Gran",Greek:"Grek",Gujarati:"Gujr",Gunjala_Gondi:"Gong",Gurmukhi:"Guru",Han:"Hani",Hangul:"Hang",Hanifi_Rohingya:"Rohg",Hanunoo:"Hano",Hatran:"Hatr",Hebrew:"Hebr",Hiragana:"Hira",Imperial_Aramaic:"Armi",Inherited:["Zinh","Qaai"],Inscriptional_Pahlavi:"Phli",Inscriptional_Parthian:"Prti",Javanese:"Java",Kaithi:"Kthi",Kannada:"Knda",Katakana:"Kana",Kayah_Li:"Kali",Kharoshthi:"Khar",Khmer:"Khmr",Khojki:"Khoj",Khudawadi:"Sind",Lao:"Laoo",Latin:"Latn",Lepcha:"Lepc",Limbu:"Limb",Linear_A:"Lina",Linear_B:"Linb",Lisu:"Lisu",Lycian:"Lyci",Lydian:"Lydi",Mahajani:"Mahj",Makasar:"Maka",Malayalam:"Mlym",Mandaic:"Mand",Manichaean:"Mani",Marchen:"Marc",Medefaidrin:"Medf",Masaram_Gondi:"Gonm",Meetei_Mayek:"Mtei",Mende_Kikakui:"Mend",Meroitic_Cursive:"Merc",Meroitic_Hieroglyphs:"Mero",Miao:"Plrd",Modi:"Modi",Mongolian:"Mong",Mro:"Mroo",Multani:"Mult",Myanmar:"Mymr",Nabataean:"Nbat",New_Tai_Lue:"Talu",Newa:"Newa",Nko:"Nkoo",Nushu:"Nshu",Ogham:"Ogam",Ol_Chiki:"Olck",Old_Hungarian:"Hung",Old_Italic:"Ital",Old_North_Arabian:"Narb",Old_Permic:"Perm",Old_Persian:"Xpeo",Old_Sogdian:"Sogo",Old_South_Arabian:"Sarb",Old_Turkic:"Orkh",Oriya:"Orya",Osage:"Osge",Osmanya:"Osma",Pahawh_Hmong:"Hmng",Palmyrene:"Palm",Pau_Cin_Hau:"Pauc",Phags_Pa:"Phag",Phoenician:"Phnx",Psalter_Pahlavi:"Phlp",Rejang:"Rjng",Runic:"Runr",Samaritan:"Samr",Saurashtra:"Saur",Sharada:"Shrd",Shavian:"Shaw",Siddham:"Sidd",SignWriting:"Sgnw",Sinhala:"Sinh",Sogdian:"Sogd",Sora_Sompeng:"Sora",Soyombo:"Soyo",Sundanese:"Sund",Syloti_Nagri:"Sylo",Syriac:"Syrc",Tagalog:"Tglg",Tagbanwa:"Tagb",Tai_Le:"Tale",Tai_Tham:"Lana",Tai_Viet:"Tavt",Takri:"Takr",Tamil:"Taml",Tangut:"Tang",Telugu:"Telu",Thaana:"Thaa",Thai:"Thai",Tibetan:"Tibt",Tifinagh:"Tfng",Tirhuta:"Tirh",Ugaritic:"Ugar",Vai:"Vaii",Warang_Citi:"Wara",Yi:"Yiii",Zanabazar_Square:"Zanb"},C1=Sf(Tx);function Sf(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(Array.isArray(r))for(let i=0;i!==r.length;++i)t[r[i]]=n;else t[r]=n}return t}function M9(e){return e in bf||e in Hd}function O9(e){return e in aa||e in ki}function E1(e){if(e in k1)return k1[e];if(e in ki)return ki[e];if(e in aa||e==="General_Category"||e==="Script"||e==="Script_Extensions")return e;throw new Error(`Unknown Unicode property name: ${e}`)}function A1(e){if(e in Hd)return Hd[e];if(e in C1)return C1[e];if(e in ki)return ki[e];if(e in bf||e in Tx||e in aa)return e;throw new Error(`Unknown Unicode property value: ${e}`)}function N9(e,t){let n=e.indexOf("=");if(n!==-1){let r=e.substring(0,n),i=e.substring(n+1);return{type:"UnicodeProperty",name:r,value:i,negative:t,shorthand:!1,binary:!1,canonicalName:E1(r),canonicalValue:A1(i)}}if(M9(e))return{type:"UnicodeProperty",name:"General_Category",value:e,negative:t,shorthand:!0,binary:!1,canonicalName:"General_Category",canonicalValue:A1(e)};if(O9(e)){let r=E1(e);return{type:"UnicodeProperty",name:e,value:e,negative:t,shorthand:!1,binary:!0,canonicalName:r,canonicalValue:r}}throw new Error(`Invalid Unicode property: ${e}`)}var Sd=String.fromCodePoint;function wd(e){let t=e.pop();if(t===void 0)throw new Error("Unable to extract token preceeding the currently parsed one");return t}function Mx(e){return e>="0"&&e<="9"}function Zs(e,t){return{type:"Char",kind:"simple",symbol:e,value:e,codePoint:e.codePointAt(0)||-1,escaped:t}}function lr(e,t){return{type:"Char",kind:"meta",symbol:t,value:e,codePoint:t.codePointAt(0)||-1}}function Xt(e,t){if(e.length>1)return{type:"Alternative",expressions:e};if(!t&&e.length===0)throw new Error("Unsupported no token");return e[0]}function xd(e){if(e[0]==="\\"){let t=e[1];switch(t){case"x":{let n=e.substring(2),r=Number.parseInt(n,16);return{type:"Char",kind:"hex",symbol:Sd(r),value:e,codePoint:r}}case"u":{if(e==="\\u")return Zs("u",!0);let n=e[2]==="{"?e.substring(3,e.length-1):e.substring(2),r=Number.parseInt(n,16);return{type:"Char",kind:"unicode",symbol:Sd(r),value:e,codePoint:r}}case"0":return lr(e,"\0");case"n":return lr(e,`
129
- `);case"f":return lr(e,"\f");case"r":return lr(e,"\r");case"t":return lr(e," ");case"v":return lr(e,"\v");case"w":case"W":case"d":case"D":case"s":case"S":case"b":case"B":return{type:"Char",kind:"meta",symbol:void 0,value:e,codePoint:NaN};default:if(Mx(t)){let n=e.substring(1),r=Number(n);return{type:"Char",kind:"decimal",symbol:Sd(r),value:e,codePoint:r}}if(e.length>2&&(t==="p"||t==="P")){let n=t==="P";return N9(e.substring(3,e.length-1),n)}return Zs(e.substring(1),!0)}}return Zs(e)}function ur(e,t,n,r){let i=null;for(let o=0,s=Gs(t,o,n,0);o!==t.length;o+=s.length,s=Gs(t,o,n,0)){let a=s[0];switch(a){case"|":i===null&&(i=[]),i.push(Xt(e.splice(0),!0)||null);break;case".":e.push({type:"Char",kind:"meta",symbol:s,value:s,codePoint:NaN});break;case"*":case"+":{let l=wd(e);e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:a,greedy:!0}});break}case"?":{let l=wd(e);l.type==="Repetition"?(l.quantifier.greedy=!1,e.push(l)):e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:a,greedy:!0}});break}case"{":{if(s==="{"){e.push(Zs(s));break}let l=wd(e),u=s.substring(1,s.length-1).split(","),c=Number(u[0]),d=u.length===1?c:u[1].length!==0?Number(u[1]):void 0;e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:"Range",greedy:!0,from:c,to:d}});break}case"[":{let l=s.substring(1,s.length-1),u=[],c,d=!1;for(let f=0,h=Gs(l,f,n,1);f!==l.length;f+=h.length,h=Gs(l,f,n,1)){if(f===0&&h==="^"){c=!0;continue}let p=xd(h);if(h==="-")u.push(p),d=!0;else{let m=u.length>=2?u[u.length-2]:void 0;d&&m!==void 0&&m.type==="Char"&&p.type==="Char"?(u.pop(),u.pop(),u.push({type:"ClassRange",from:m,to:p})):u.push(p),d=!1}}e.push({type:"CharacterClass",expressions:u,negative:c});break}case"(":{let l=s.substring(1,s.length-1),u=[];if(l[0]==="?")if(l[1]===":")ur(u,l.substring(2),n,r),e.push({type:"Group",capturing:!1,expression:Xt(u)});else if(l[1]==="="||l[1]==="!")ur(u,l.substring(2),n,r),e.push({type:"Assertion",kind:"Lookahead",negative:l[1]==="!"?!0:void 0,assertion:Xt(u)});else if(l[1]==="<"&&(l[2]==="="||l[2]==="!"))ur(u,l.substring(3),n,r),e.push({type:"Assertion",kind:"Lookbehind",negative:l[2]==="!"?!0:void 0,assertion:Xt(u)});else{let c=l.split(">");if(c.length<2||c[0][1]!=="<")throw new Error(`Unsupported regex content found at ${JSON.stringify(s)}`);let d=++r.lastIndex,f=c[0].substring(2);r.named.set(f,d),ur(u,c.slice(1).join(">"),n,r),e.push({type:"Group",capturing:!0,nameRaw:f,name:f,number:d,expression:Xt(u)})}else{let c=++r.lastIndex;ur(u,l,n,r),e.push({type:"Group",capturing:!0,number:c,expression:Xt(u)})}break}default:if(s==="^")e.push({type:"Assertion",kind:s});else if(s==="$")e.push({type:"Assertion",kind:s});else if(s[0]==="\\"&&Mx(s[1])){let l=Number(s.substring(1));n||l<=r.lastIndex?e.push({type:"Backreference",kind:"number",number:l,reference:l}):e.push(xd(s))}else if(s[0]==="\\"&&s[1]==="k"&&s.length!==2){let l=s.substring(3,s.length-1);e.push({type:"Backreference",kind:"name",number:r.named.get(l)||0,referenceRaw:l,reference:l})}else e.push(xd(s));break}}if(i!==null){i.push(Xt(e.splice(0),!0)||null);let o={type:"Disjunction",left:i[0],right:i[1]};for(let s=2;s<i.length;++s)o={type:"Disjunction",left:o,right:i[s]};e.push(o)}}function L9(e){let t=Dt([...e.flags],"u")!==-1,n=e.source,r=[];return ur(r,n,t,{lastIndex:0,named:new Map}),Xt(r)}var $9=String.fromCodePoint;function _9(e){return e.binary||e.shorthand?e.canonicalValue:`${e.canonicalName}=${e.canonicalValue}`}function I1(e,t,n,r){let i=-1;for(let o=t;o<=n;++o)if(e.test($9(o)))i===-1&&(i=o);else if(i!==-1){let s=o-1;r.push(i===s?[s]:[i,s]),i=-1}i!==-1&&r.push(i===n?[n]:[i,n])}function D9(e,t){let n=new RegExp(`^\\${t?"P":"p"}{${e}}$`,"u"),r=[];return I1(n,0,55295,r),I1(n,57344,1114111,r),r}var P1=new Map;function j9(e,t){let n=`${t?"P":"p"}:${e}`,r=P1.get(n);if(r!==void 0)return r;let i=D9(e,t);return P1.set(n,i),i}function F9(e){return mr(...z(j9(_9(e),e.negative),t=>Id(t)))}var B9=String.fromCodePoint,T1=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],M1=[..."0123456789"],O1=[...` \r
130
- \v\f`],qd=[...`\r
131
- `],Ox=[...""],V9=[...qd,...Ox],kn=()=>Ce({unit:"grapheme-ascii",minLength:1,maxLength:1});function N1(e){return new L(`Unsupported AST node! Received: ${ve(e)}`)}function Zt(e,t,n){switch(e.type){case"Char":if(e.kind==="meta")switch(e.value){case"\\w":return kt(...T1);case"\\W":return kn().filter(r=>Dt(T1,r)===-1);case"\\d":return kt(...M1);case"\\D":return kn().filter(r=>Dt(M1,r)===-1);case"\\s":return kt(...O1);case"\\S":return kn().filter(r=>Dt(O1,r)===-1);case"\\b":case"\\B":throw new L(`Meta character ${e.value} not implemented yet!`);case".":{let r=n.dotAll?Ox:V9;return kn().filter(i=>Dt(r,i)===-1)}}if(e.symbol===void 0)throw new L(`Unexpected undefined symbol received for non-meta Char! Received: ${ve(e)}`);return xe(e.symbol);case"Repetition":{let r=Zt(e.expression,t,n);switch(e.quantifier.kind){case"*":return Ce({...t,unit:r});case"+":return Ce({...t,minLength:1,unit:r});case"?":return Ce({...t,minLength:0,maxLength:1,unit:r});case"Range":return Ce({...t,minLength:e.quantifier.from,maxLength:e.quantifier.to,unit:r});default:throw N1(e.quantifier)}}case"Quantifier":throw new L("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return V(...z(e.expressions,r=>Zt(r,t,n))).map(r=>le(r,""));case"CharacterClass":if(e.negative){let r=z(e.expressions,i=>Zt(i,t,n));return kn().filter(i=>G1(r,o=>!o.canShrinkWithoutContext(i)))}return Pe(...z(e.expressions,r=>Zt(r,t,n)));case"ClassRange":{let r=e.from.codePoint,i=e.to.codePoint;return re({min:r,max:i}).map(o=>B9(o),o=>{if(typeof o!="string")throw new L("Invalid type");if([...o].length!==1)throw new L("Invalid length");return fr(o,0)})}case"Group":return Zt(e.expression,t,n);case"Disjunction":return Pe(e.left!==null?Zt(e.left,t,n):xe(""),e.right!==null?Zt(e.right,t,n):xe(""));case"Assertion":if(e.kind==="^"||e.kind==="$")return n.multiline?e.kind==="^"?Pe(xe(""),V(Ce({unit:kn()}),kt(...qd)).map(r=>`${r[0]}${r[1]}`,r=>{if(typeof r!="string"||r.length===0)throw new L("Invalid type");return[he(r,0,r.length-1),r[r.length-1]]})):Pe(xe(""),V(kt(...qd),Ce({unit:kn()})).map(r=>`${r[0]}${r[1]}`,r=>{if(typeof r!="string"||r.length===0)throw new L("Invalid type");return[r[0],he(r,1)]})):xe("");throw new L(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":throw new L("Backreference nodes not implemented yet!");case"UnicodeProperty":return F9(e);default:throw N1(e)}}function U9(e,t={}){for(let a of e.flags)if(a!=="d"&&a!=="g"&&a!=="m"&&a!=="s"&&a!=="u")throw new L(`Unable to use "stringMatching" against a regex using the flag ${a}`);let n=t.maxLength,r={size:t.size,maxLength:n},i={multiline:e.multiline,dotAll:e.dotAll},o=A9(L9(e));n!==void 0&&(o=C9(o,n));let s=Zt(o,r,i);return n!==void 0?s.filter(a=>[...a].length<=n):s}function W9(e){let t=[];for(let n=0;n!==e.length;++n)t.push(e[n].next());return t}function z9(e,t){for(let n=0;n!==e.length;++n)t[n]=e[n].next()}function G9(e){for(let t=0;t!==e.length;++t)if(e[t].done)return!0;return!1}function*H9(...e){let t=W9(e);for(;!G9(t);)yield t.map(n=>n.value),z9(e,t)}function*q9(e){let t=e;for(;;)yield t,++t}var K9=class extends ue{constructor(e,t){super(),this.arb=e,this.maxShrinks=t}generate(e,t){let n=this.arb.generate(e,t);return this.valueMapper(n,0)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return this.isSafeContext(t)?this.safeShrink(e,t.originalContext,t.length):this.safeShrink(e,void 0,0)}safeShrink(e,t,n){let r=this.maxShrinks-n;return r<=0?F.nil():new F(H9(this.arb.shrink(e,t),q9(n+1))).take(r).map(i=>this.valueMapper(i[0],i[1]))}valueMapper(e,t){let n={originalContext:e.context,length:t};return new D(e.value,n)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalContext"in e&&"length"in e}};function Y9(e,t){return new K9(e,t)}var J9=wS({Arbitrary:()=>ue,ExecutionStatus:()=>cL,PreconditionFailure:()=>rn,Random:()=>ef,Stream:()=>F,Value:()=>D,VerbosityLevel:()=>U3,__commitHash:()=>Q9,__type:()=>X9,__version:()=>Z9,anything:()=>dx,array:()=>se,assert:()=>OL,asyncDefaultReportMessage:()=>c0,asyncModelRun:()=>y9,asyncProperty:()=>B3,asyncStringify:()=>Qd,asyncToStringMethod:()=>Bt,base64String:()=>A8,bigInt:()=>nn,bigInt64Array:()=>x9,bigUint64Array:()=>v9,boolean:()=>Ei,chainUntil:()=>v$,check:()=>f0,clone:()=>A$,cloneIfNeeded:()=>cr,cloneMethod:()=>Te,commands:()=>c9,compareBooleanFunc:()=>ED,compareFunc:()=>ID,configureGlobal:()=>D3,constant:()=>xe,constantFrom:()=>kt,context:()=>y$,createDepthIdentifier:()=>rf,date:()=>k0,defaultReportMessage:()=>u0,dictionary:()=>af,domain:()=>df,double:()=>sa,emailAddress:()=>B_,entityGraph:()=>E7,falsy:()=>h$,float:()=>z0,float32Array:()=>Z0,float64Array:()=>Q0,func:()=>MD,gen:()=>VL,getDepthContextFor:()=>nf,hasAsyncToStringMethod:()=>Zd,hasCloneMethod:()=>Cn,hasToStringMethod:()=>Xd,hash:()=>ra,infiniteStream:()=>w8,int16Array:()=>ex,int32Array:()=>tx,int8Array:()=>nx,integer:()=>re,ipV4:()=>mf,ipV4Extended:()=>K0,ipV6:()=>Y0,json:()=>g8,jsonValue:()=>fx,letrec:()=>J0,limitShrink:()=>Y9,lorem:()=>L7,map:()=>Bd,mapToConstant:()=>mr,maxSafeInteger:()=>q0,maxSafeNat:()=>$D,memo:()=>j7,mixedCase:()=>z7,modelRun:()=>m9,nat:()=>Qt,noBias:()=>na,noShrink:()=>ia,object:()=>f8,oneof:()=>Pe,option:()=>Vt,pre:()=>p4,property:()=>V3,readConfigureGlobal:()=>pt,record:()=>Fd,resetConfigureGlobal:()=>j3,sample:()=>LL,scheduledModelRun:()=>g9,scheduler:()=>S9,schedulerFor:()=>w9,set:()=>lx,shuffledSubarray:()=>O8,sparseArray:()=>ax,statistics:()=>_L,stream:()=>tn,string:()=>Ce,stringMatching:()=>U9,stringify:()=>ve,subarray:()=>M8,toStringMethod:()=>ht,tuple:()=>V,uint16Array:()=>rx,uint32Array:()=>ix,uint8Array:()=>ox,uint8ClampedArray:()=>sx,ulid:()=>B8,uniqueArray:()=>An,uuid:()=>q8,webAuthority:()=>yx,webFragments:()=>bx,webPath:()=>wx,webQueryParameters:()=>xx,webSegment:()=>Sx,webUrl:()=>s9}),X9="module",Z9="4.8.0",Q9="c0da76fbcf6470339ad7bb2f0dfcebee06ede56c",Me=J9;function la(e){return e?.values!=null&&e.values.length>0?Me.constantFrom(...e.values):e5(e)}function e5(e){if(e?.type==="number")return Me.integer();if(e?.type==="boolean")return Me.boolean();let t=e?.generator==null?void 0:n5[e.generator];if(t!=null)return t;let n=e?.constraints?.kind==="string"?e.constraints:void 0;return Me.string({maxLength:n?.maxLength,minLength:n?.minLength??1}).filter(r=>r.trim().length>0&&r===r.trim())}var t5="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],yr=e=>Me.array(Me.constantFrom(...t5),{maxLength:e,minLength:1}).map(t=>t.join("")),wf=(e,t)=>Me.array(yr(10),{maxLength:t,minLength:1}).map(n=>n.join(e)),n5={"company.name":wf(" ",3),"date.iso":r5(),"internet.email":i5(),"internet.url":o5(),"lorem.slug":wf("-",3),"lorem.word":yr(10),"person.fullName":wf(" ",2)};function r5(){return Me.date({max:new Date("2030-12-31T23:59:59.999Z"),min:new Date("2020-01-01T00:00:00.000Z"),noInvalidDate:!0}).map(e=>e.toISOString())}function i5(){return Me.tuple(yr(12),yr(10),Me.constantFrom("com","dev","io","org","ai")).map(([e,t,n])=>`${e}@${t}.${n}`)}function o5(){return Me.tuple(Me.constantFrom("http","https"),yr(12),Me.constantFrom("app","com","dev","io","org"),Me.array(yr(8),{maxLength:3})).map(([e,t,n,r])=>{let i=r.length===0?"":`/${r.join("/")}`;return`${e}://${t}.${n}${i}`})}var Nx=new WeakMap;function xf(e){let t=Nx.get(e);if(t!=null)return t;let n=Object.fromEntries(Object.entries(e.paramSpaces).map(([r,i])=>[r,a5(i)]));return Nx.set(e,n),n}var s5=24301;function a5(e){let[t]=Me.sample(la(e),{numRuns:1,seed:s5});if(t==null)throw new Error("arbitrary produced no sample");return t}function Ai(e){return{aborted:!0,findings:[],ran:[],teardown:e}}function Rf(e,t){return new l5(u5(e,t))}async function u5({browser:e,hub:t,request:n},r){if(r.aborted)return vf(Ai("skipped"));let i=m5({lockfile:n.lockfile,options:n.options,runId:n.runId,signal:r}),o=async s=>{try{return vf(await d5({browser:e,established:s,hub:t,request:n,signal:r}))}catch(a){return Lx(Mr(a))}};return h5(i,n).match(o,s=>c5(s,i.teardown))}async function c5(e,t){return e.kind!=="aborted"?Lx(e):vf(Ai(await $x(t)))}function $x(e){return e().match(()=>"done",()=>"failed")}async function d5(e){let t=await f5(e);if(t.kind==="completed")return await e.established.teardown().match(fo,Eh),{aborted:!1,...t.result};let n=await $x(e.established.teardown);if(t.kind==="aborted")return Ai(n);throw t.error}async function f5({browser:e,established:t,hub:n,request:r,signal:i}){try{qt(i);let{close:o,driver:s,emitAssertion:a}=await ou({baseUrl:r.options.baseUrl,browser:e,capture:r.capture?{hub:n,runId:r.runId}:null,clientState:t.clientState,engine:nu(g5(r.lockfile)),fixturesDir:r.options.fixturesDir,reader:t.reader,session:t.auth});try{r.onEvent?.({aliases:t.aliases,generated:t.generated,generatedSingletons:t.generatedSingletons,kind:"world"});let l=Gc(r.lockfile);return{kind:"completed",result:await Zl({canon:ml(r.lockfile),classify:hl(r.lockfile),dataRules:l.dataRules,driver:s,initialState:{snapshot:t.snapshot},onAssertion:a,onEvent:r.onEvent??fo,pageRules:Nm(l.pageRules,Ye(r.test)),sequence:r.sequence??p5(r.lockfile,r.test,r.params)},i)}}finally{await o()}}catch(o){return Lh(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function p5(e,t,n){return wo(e,t).map(r=>({params:{...xf(r),...n},transition:r}))}function h5(e,t){return e.ready().andThen(()=>Fr(t.lockfile,t.test,{generate:tu(eu(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params}).map(n=>({aliases:n.aliases,auth:n.auth,clientState:n.clientState,generated:n.generated,generatedSingletons:n.generatedSingletons,reader:e.reader,snapshot:n.snapshot,teardown:e.teardown})))}function m5({lockfile:e,options:t,runId:n,signal:r}){let i=cu({baseUrl:t.engineUrl,runId:n,secret:t.secret},r);return{materialize:_l(i.setupWorld),reader:lu(e.entities,y5(e),i.query),ready:i.ready,teardown:i.teardown}}function y5(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function g5(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}function x5({clientVersion:e,debugDir:t,headed:n,writeOtlpPortFile:r}){let i=Xm({headed:n}),o,s,a=async()=>(o??=zc({clientVersion:e,debugDir:t,writeOtlpPortFile:r}),s=await o,s),l=async(d,f)=>{if(f.aborted)return S5(Ai("skipped"));try{let h=await a();return d.options.headed&&!n?await su(!0,async p=>Rf({browser:p,hub:h,request:d},f)):await Rf({browser:await i.acquire(),hub:h,request:d},f)}catch(h){return b5(Mr(h))}};return{close:async()=>{await i.close();let d=o;o=void 0,s=void 0,d!=null&&await d.then(f=>f.close()).catch(()=>{})},prewarm:async()=>{await a(),await i.acquire()},injectSpan:(d,f)=>{s?.injectSpan(d,f)},runOnce:(d,f)=>new w5(l(d,f))}}function Ii(e,t){let n=e.axes.flatMap(r=>r.classify(t).map(([i,o])=>`${i}:${o}`));return[t.label,...n.toSorted((r,i)=>r.localeCompare(i))].join("|")}function kf(e){return e.axes.map(t=>t.name).join("+")}function Cf(e){return{name:`counts(${e})`,classify:({pre:t})=>[...t.entities].flatMap(([n,r])=>r.size===0?[]:[[n,R5(e,r.size)]])}}function Ef(e){let t=_x(e);return{name:"enum-fields",classify:({pre:n})=>[...n.entities].flatMap(([r,i])=>[...i.values()].flatMap(o=>v5(r,o,t)))}}function v5(e,t,n){return Object.entries(t).flatMap(([r,i])=>n.has(`${e}.${r}`)?[[`${e}.${r}`,k5(i)]]:[])}function _x(e){let t=e.valueSpaces.flatMap(r=>r.values==null?[]:[r.name]),n=new Set(t);return new Set(e.entities.flatMap(r=>Object.entries(r.props).flatMap(([i,o])=>o.type==="boolean"||o.valueSpace!=null&&n.has(o.valueSpace)?[`${r.name}.${i}`]:[])))}function R5(e,t){return e==="presence"?"1+":e==="unit"?t===1?"1":"2+":t<=2?String(t):"3+"}function k5(e){return e==null?"\u2205":String(e)}import{createHash as C5}from"crypto";import{appendFile as E5,mkdir as jx,readFile as A5,writeFile as I5}from"fs/promises";import Fx from"path";import{ResultAsync as Af}from"neverthrow";import{z as R}from"zod";var gr=R.enum(["crash","data-rule","page-rule","frame"]),Dx=R.object({intent:R.string().min(1),test:R.string().min(1)}),P5=R.union([R.object({kind:R.literal("singleton-mismatch"),singleton:R.string().min(1)}),R.object({entity:R.string().min(1),kind:R.string().min(1)})]),Bx=R.discriminatedUnion("kind",[R.object({kind:R.literal("consistency"),layer:gr,mismatch:P5,step:Dx.nullable()}),R.object({kind:R.literal("pending-check"),layer:gr,source:R.string().min(1),step:Dx}),R.object({intent:R.string().min(1),kind:R.literal("unrunnable"),layer:gr,reason:R.string().min(1),test:R.string().min(1)}),R.object({error:R.string().min(1),kind:R.literal("driver-error"),layer:gr,step:R.string().min(1)}),R.object({kind:R.literal("impossible-action"),layer:gr,step:R.string().min(1)})]),T5=R.object({actionHash:R.string().min(1),at:R.string().min(1),kind:R.literal("covered"),lensId:R.string().min(1),targetKey:R.string().min(1)}),M5=R.object({actionHash:R.string().min(1),at:R.string().min(1),baseState:R.string().min(1),evidence:R.array(R.string().min(1)),kind:R.literal("finding"),lensId:R.string().min(1),lockfileHash:R.string().min(1),parts:R.array(Bx),runId:R.string().min(1).optional(),signature:R.string().min(1),targetKey:R.string().min(1),trail:R.array(R.string().min(1)),trailParams:R.array(R.record(R.string(),R.union([gt,R.null()]))),verifierLayer:gr}),O5=R.object({actionHash:R.string().min(1),at:R.string().min(1),baseState:R.string().min(1),evidence:R.array(R.string().min(1)),kind:R.literal("flaky-candidate"),lensId:R.string().min(1),parts:R.array(Bx),signature:R.string().min(1),targetKey:R.string().min(1),trail:R.array(R.string().min(1))}),N5=R.object({at:R.string().min(1),kind:R.literal("saturation"),lensId:R.string().min(1),lockfileHash:R.string().min(1),ring:R.number().int().nonnegative()}),L5=R.object({at:R.string().min(1),kind:R.literal("resolution"),signature:R.string().min(1)}),$5=R.object({arrangement:R.string().min(1),at:R.string().min(1),canonicalKey:R.string().min(1),kind:R.literal("derived-baseState")}),ua=R.discriminatedUnion("kind",[T5,M5,O5,N5,L5,$5]);function ca(e){return Tf(e).slice(0,12)}function ze(e){return`${e.lensId} ${e.actionHash} ${e.targetKey}`}function Pi(e){return e.reduce((t,n)=>U5(t,n),V5())}function Ti(e){return Af.fromPromise(D5(e),t=>({error:t,kind:"io"})).map(t=>F5(t))}function If(e,t){let n=t.map(r=>`${JSON.stringify(r)}
132
- `).join("");return Af.fromPromise(jx(Fx.dirname(e),{recursive:!0}).then(()=>E5(e,n)),r=>({error:r,kind:"io"}))}function _5(e,t){let n=t.map(r=>`${JSON.stringify(r)}
133
- `).join("");return Af.fromPromise(jx(Fx.dirname(e),{recursive:!0}).then(()=>I5(e,n)),r=>({error:r,kind:"io"}))}function Pf(e,t){let n=G({effect:t.effectStep,nav:t.nav,params:t.paramSpaces,requiredState:t.requiredState,steps:t.steps}),r=e.entities.filter(i=>n.includes(`"${i.name}"`));return Tf(G({entities:r,spec:n}))}function Mi(e){return Tf(G(e))}async function D5(e){return(await A5(e,"utf8").catch(n=>{if(j5(n))return"";throw n})).split(`
134
- `).filter(n=>n.length>0)}function j5(e){return e instanceof Error&&"code"in e&&e.code==="ENOENT"}function F5(e){return e.flatMap(t=>{let n=ua.safeParse(B5(t));return n.success?[n.data]:[]})}function B5(e){try{return JSON.parse(e)}catch{return null}}function Tf(e){return C5("sha256").update(e).digest("hex")}function V5(){return{covered:new Set,findings:new Map,flaky:new Map,saturations:new Map}}function U5(e,t){if(t.kind==="covered")return{...e,covered:new Set([...e.covered,ze(t)])};if(t.kind==="flaky-candidate")return{...e,covered:new Set([...e.covered,ze(t)]),flaky:W5(e.flaky,t)};if(t.kind==="finding")return{...e,covered:new Set([...e.covered,ze(t)]),findings:z5(e.findings,t)};if(t.kind==="resolution")return{...e,findings:G5(e.findings,t)};if(t.kind==="saturation"){let n=`${t.lensId} ${String(t.ring)}`;return{...e,saturations:new Map([...e.saturations,[n,t]])}}return e}function W5(e,t){let n=e.get(t.signature),r=n==null?{first:t,occurrences:1}:{first:n.first,occurrences:n.occurrences+1};return new Map([...e,[t.signature,r]])}function z5(e,t){let n=e.get(t.signature),r=n==null?{first:t,latest:t,occurrences:1,resolvedAt:void 0}:{first:n.first,latest:t,occurrences:n.occurrences+1,resolvedAt:void 0};return new Map([...e,[t.signature,r]])}function G5(e,t){let n=e.get(t.signature);return n==null?e:new Map([...e,[t.signature,{...n,resolvedAt:t.at}]])}function Mf(e){let t={edges:new Map,saturationDepth:0,seen:new Set,states:0,targets:new Map},n=e.baseStates.map(r=>(t.seen.add(gn(r.snapshot)),{baseState:r.name,lastLabel:null,snapshot:r.snapshot,trail:[]}));return q5(e,n,t),{edges:t.edges,saturationDepth:t.saturationDepth,states:t.seen.size,targets:t.targets}}var H5=24301,Vx=new WeakMap;function da(e,t){let n=Vx.get(e)??new Map;Vx.set(e,n);let r=n.get(t);if(r!=null)return r;let i=Object.fromEntries(Object.entries(e.paramSpaces).map(([o,s])=>[o,Q5(s,t)]));return n.set(t,i),i}function q5(e,t,n){let r=[...t],i=0;for(;i<r.length;){let o=r[i];i+=1,o!=null&&K5(e,o,n).forEach(s=>r.push(s))}}function K5(e,t,n){let r={snapshot:t.snapshot},i=o=>da(o,Z5(t.trail,e.corpus,o));return Bn(e.corpus,r,i).flatMap(o=>{let s=e.corpus[o.idx];if(s==null)return[];let a=[...t.trail,{idx:o.idx,params:o.params}],l={baseState:t.baseState,trail:a,transitionIndex:o.idx};return Y5({acc:n,node:t,option:o,params:e,transition:s,witness:l}),J5({acc:n,node:t,option:o,params:e,trail:a})})}function Y5({acc:e,node:t,option:n,params:r,transition:i,witness:o}){let s={label:n.label,params:n.params,pre:t.snapshot,spaces:i.paramSpaces},a=Ii(r.lens,s);if(e.targets.has(a)||(e.targets.set(a,o),e.saturationDepth=Math.max(e.saturationDepth,o.trail.length)),t.lastLabel!=null){let l=`${t.lastLabel} \u2192 ${n.label}`;e.edges.has(l)||e.edges.set(l,o)}}function J5({acc:e,node:t,option:n,params:r,trail:i}){if(i.length>=r.maxDepth)return[];let o=n.stepRun.next.snapshot;if(X5(t.snapshot,o,r.maxCount))return[];let s=gn(o);return e.seen.has(s)?[]:(e.seen.add(s),[{baseState:t.baseState,lastLabel:n.label,snapshot:o,trail:i}])}function X5(e,t,n){return[...t.entities].some(([r,i])=>{let o=e.entities.get(r)?.size??0;return i.size>o&&i.size>n})}function Z5(e,t,n){return e.filter(r=>t[r.idx]===n).length}function Q5(e,t){let[n]=Me.sample(la(e),{numRuns:1,seed:H5+t});if(n==null)throw new Error("arbitrary produced no sample");return n}var ej=10;function Of(e){return $f(e).reduce((t,n)=>t+Wx(e,n).length,0)}function Nf(e){return e.targets.size+e.edges.size}function Lf(e){let t=$f(e).map(o=>Wx(e,o)),n=tj(e,t);if(n!=null)return n;let r=t.find(o=>o.length>0);return r==null?{kind:"saturated",ring:t.length}:{kind:"cover",target:r.reduce((o,s)=>Ux(e,s)>Ux(e,o)?s:o)}}function $f(e){return[{entries:e.graph.targets,index:1},{entries:e.graph.edges,index:2}]}function Wx(e,t){return[...t.entries].flatMap(([n,r])=>{let i=zx({params:e,ring:t.index,targetKey:n,witness:r});return e.covered.has(Gx(e,i))?[]:[i]})}function zx({params:e,ring:t,targetKey:n,witness:r}){let i=e.actionHashes[r.transitionIndex];if(i==null)throw new Error("transition index out of corpus range");return{actionHash:i,ring:t,targetKey:n,witness:r}}function Gx(e,t){return ze({actionHash:t.actionHash,lensId:e.lensId,targetKey:t.targetKey})}function tj(e,t){if(e.tick===0||e.tick%ej!==0)return null;let n=$f(e).flatMap(i=>[...i.entries].flatMap(([o,s])=>{let a=zx({params:e,ring:i.index,targetKey:o,witness:s});return e.covered.has(Gx(e,a))?[a]:[]}));if(n.length===0||t.every(i=>i.length===0))return null;let r=n[e.tick%n.length];return r==null?null:{kind:"revalidate",target:r}}var nj=/delete|remove|cancel|deactivate|revoke|archive/i;function Ux(e,t){let n=t.ring===2&&rj(e,t)?4:0,r=nj.test(t.targetKey)?2:0,i=1/(1+t.witness.trail.length);return n+r+i}function rj(e,t){return new Set(t.witness.trail.flatMap(r=>{let i=e.corpus[r.idx];return i==null?[]:[i.test]})).size>1}function ij(e){let t=oj(e,e.witnessTrail);return t==null?{covers:[],stepRuns:[]}:aj(e,t)}function oj(e,t){return t.reduce((n,r)=>n==null?null:sj(e,n,r),{covers:[],snapshot:e.baseStateSnapshot,stepRuns:[]})}function sj(e,t,n){let r=e.corpus[n.idx];if(r==null)return null;let i=Vr(r,{snapshot:t.snapshot},n.params);if(i==null)return null;let o=Hx({params:e,planned:n,pre:t.snapshot,transition:r});return{covers:[...t.covers,o],snapshot:i.next.snapshot,stepRuns:[...t.stepRuns,n]}}function Hx({params:e,planned:t,pre:n,transition:r}){let i={label:`${r.test}#${String(r.index)}`,params:t.params,pre:n,spaces:r.paramSpaces},o=e.actionHashes[t.idx];if(o==null)throw new Error("transition index out of corpus range");return{actionHash:o,targetKey:Ii(e.lens,i)}}function aj(e,t){let n=new Set([...e.covered,...t.covers.map(i=>ze({...i,lensId:e.lensId}))]),r=qx({params:e,seen:n,state:t});return{covers:r.covers,stepRuns:r.stepRuns}}function qx({params:e,seen:t,state:n}){if(n.stepRuns.length>=e.maxLength)return n;let r=lj({params:e,seen:t,state:n});return r==null?n:(t.add(ze({...r.coverage,lensId:e.lensId})),qx({params:e,seen:t,state:{covers:[...n.covers,r.coverage],snapshot:r.snapshot,stepRuns:[...n.stepRuns,r.planned]}}))}function lj({params:e,seen:t,state:n}){let r=o=>da(o,uj(n.stepRuns,e.corpus,o));return Bn(e.corpus,{snapshot:n.snapshot},r).map(o=>{let s=e.corpus[o.idx];if(s==null)return null;let a={idx:o.idx,params:o.params};return{coverage:Hx({params:e,planned:a,pre:n.snapshot,transition:s}),planned:a,snapshot:o.stepRun.next.snapshot}}).find(o=>o!=null&&!t.has(ze({...o.coverage,lensId:e.lensId})))??null}function uj(e,t,n){return e.filter(r=>t[r.idx]===n).length}function _f(e,{sweep:t}){let n=Pt(nt(e),r=>G({s:r.test.singletons,w:r.test.world})).map(r=>({name:r.ref,test:r.test}));return t?[...n,...n.flatMap(r=>cj(r))]:n}function Df(e,t,n){return Fr(e,t.test,n)}function cj(e){return dj(e.test).map(t=>{let n={...t,as:`${t.as}~2`},r=`${e.name} +${t.entity}`;return{name:r,test:{...e.test,name:r,world:[...e.test.world,n]}}})}function dj(e){return e.world.filter(t=>{let n=G({...e,world:e.world.filter(r=>r!==t)});return!n.includes(`"${t.as}.`)&&!n.includes(`"ref":"${t.as}"`)})}async function fj(e,t){let n=await pa({attemptIndex:0,capture:!1,params:e,stepRuns:e.trail.stepRuns},t);return n.kind!=="completed"?Yx(n):n.findings.length===0?{kind:"clean",rows:Sj(e)}:pj(e,Oi(e.baseState.name,n.findings),t)}function Yx(e){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:e.kind}}async function pj(e,t,n){let r=await pa({attemptIndex:1,capture:!1,params:e,stepRuns:e.trail.stepRuns},n);return r.kind!=="completed"?Yx(r):Oi(e.baseState.name,r.findings).signature!==t.signature?{kind:"flaky",rows:[wj(e,t)]}:hj({digest:t,params:e,signal:n})}async function pa({attemptIndex:e,capture:t,params:n,stepRuns:r},i){let o=n.runIdFor(e);return(await n.session.runOnce({capture:t,lockfile:n.lockfile,onEvent:void 0,options:n.options,params:void 0,runId:o,sequence:bj(n,r),test:n.baseState.test},AbortSignal.any([i,AbortSignal.timeout(n.attemptTimeoutMs)]))).match(a=>a.aborted?{kind:i.aborted?"aborted":"timeout"}:{findings:a.findings,kind:"completed",runId:o},a=>({error:a,kind:"error"}))}async function hj({digest:e,params:t,signal:n}){let r=await Ff({attemptIndex:2,budget:t.shrinkBudget,chunks:2,params:t,runId:t.runIdFor(1),signal:n,signature:e.signature,stepRuns:t.trail.stepRuns});if(r.kind!=="shrunk")return r.outcome;let i=await mj({params:t,signal:n,signature:e.signature,stepRuns:r.stepRuns});if(i.kind==="aborted")return{kind:"aborted"};let o=kj({digest:e,minimal:r.stepRuns,params:t,runId:i.kind==="reproduced"?i.runId:void 0});return{finding:o,kind:"finding",minimal:r.stepRuns,rows:[o],runId:i.kind==="reproduced"?i.runId:r.runId}}async function mj({params:e,signal:t,signature:n,stepRuns:r}){let i=await pa({attemptIndex:e.shrinkBudget+2,capture:!0,params:e,stepRuns:r},t);return i.kind==="aborted"?{kind:"aborted"}:i.kind==="completed"&&Oi(e.baseState.name,i.findings).signature===n?{kind:"reproduced",runId:i.runId}:{kind:"no-repro"}}async function Ff(e){return e.budget<=0||e.stepRuns.length<=1?fa(e):Jx(e,gj(e.stepRuns,e.chunks))}function fa(e){return{kind:"shrunk",runId:e.runId,stepRuns:e.stepRuns}}async function Jx(e,t){let[n,...r]=t;if(n==null)return yj(e);if(e.budget<=0)return fa(e);let i=await pa({attemptIndex:e.attemptIndex,capture:!1,params:e.params,stepRuns:n},e.signal);if(i.kind==="aborted")return{kind:"halted",outcome:{kind:"aborted"}};if(i.kind==="timeout")return fa(e);let o={...e,attemptIndex:e.attemptIndex+1,budget:e.budget-1};return i.kind==="completed"&&Oi(e.params.baseState.name,i.findings).signature===e.signature?Ff({...o,chunks:2,runId:i.runId,stepRuns:n}):Jx(o,r)}function yj(e){return e.chunks>=e.stepRuns.length?Promise.resolve(fa(e)):Ff({...e,chunks:e.chunks*2})}function gj(e,t){let n=Math.min(t,e.length),r=Math.ceil(e.length/n);return Array.from({length:n},(i,o)=>e.filter((s,a)=>a<o*r||a>=(o+1)*r)).filter(i=>i.length>0&&i.length<e.length)}function bj(e,t){return t.map(n=>{let r=e.corpus[n.idx];if(r==null)throw new Error("transition index out of corpus range");return{params:n.params,transition:r}})}function Sj(e){return e.trail.covers.map(t=>({actionHash:t.actionHash,at:e.now(),kind:"covered",lensId:e.lensId,targetKey:t.targetKey}))}function wj(e,t){return{actionHash:jf(e).actionHash,at:e.now(),baseState:e.baseState.name,evidence:[...t.evidence],kind:"flaky-candidate",lensId:e.lensId,parts:[...t.parts],signature:t.signature,targetKey:jf(e).targetKey,trail:e.trail.covers.map(n=>n.targetKey)}}function Xx(e){return e.kind==="driver-error"||e.kind==="unrunnable"?"crash":e.kind==="pending-check"?e.source.kind==="data-rule"?"data-rule":e.source.kind==="page-rule"?"page-rule":"frame":"frame"}function Oi(e,t){let n=t.map(i=>({line:dy(i),part:vj(i)})).toSorted((i,o)=>G(i.part).localeCompare(G(o.part))),r=n.map(i=>i.part);return{evidence:n.map(i=>i.line),layer:xj(r),parts:r,signature:G({baseState:e,parts:r.map(i=>G(i))})}}var Kx={crash:0,"data-rule":1,frame:3,"page-rule":2};function xj(e){return e.map(n=>n.layer).toSorted((n,r)=>Kx[n]-Kx[r]).at(0)??"frame"}function vj(e){let t=Xx(e);switch(e.kind){case"consistency":return{kind:"consistency",layer:t,mismatch:Rj(e.mismatch),step:e.step==null?null:{intent:e.step.intent,test:e.step.test}};case"pending-check":return{kind:"pending-check",layer:t,source:e.source.kind,step:{intent:e.step.intent,test:e.step.test}};case"unrunnable":return{intent:e.intent,kind:"unrunnable",layer:t,reason:e.reason,test:e.test};case"driver-error":return{error:e.error.kind,kind:"driver-error",layer:t,step:e.step.intent};case"impossible-action":return{kind:"impossible-action",layer:t,step:e.step.intent}}}function Rj(e){return e.kind==="singleton-mismatch"?{kind:e.kind,singleton:e.singleton}:{entity:e.entity,kind:e.kind}}function kj({digest:e,minimal:t,params:n,runId:r}){let i=jf(n);return{actionHash:i.actionHash,at:n.now(),baseState:n.baseState.name,evidence:[...e.evidence],kind:"finding",lensId:n.lensId,lockfileHash:n.lockfileHash,parts:[...e.parts],runId:r,signature:e.signature,targetKey:i.targetKey,trail:t.map(o=>{let s=n.corpus[o.idx];if(s==null)throw new Error("transition index out of corpus range");return`${s.test}#${String(s.index)}`}),trailParams:t.map(o=>o.params),verifierLayer:e.layer}}function jf(e){let t=e.trail.covers.at(-1);if(t==null)throw new Error("trail has no coverage");return t}function XJ(e){switch(e.kind){case"already-running":return`ripplo daemon: daemon already running (socket ${e.socketPath}).`;case"bind-failed":return`ripplo daemon: failed to bind IPC socket: ${e.message}`}}function ZJ({projectId:e,serverUrl:t}){return[`Project "${e}" (from .ripplo/project.json) was not found on ${t}, or this account does not have access to it.`,"Run `npx ripplo projects list` to see your projects, then update .ripplo/project.json (or re-run `npx ripplo init --project <id>`)."].join(`
135
- `)}function QJ({devSessionId:e,version:t}){return`ripplo daemon: v${t} ready as local executor for session ${e} (syncs on every \`npx ripplo run\` \u2014 Ctrl-C to stop)`}function eX({cwd:e,pid:t}){return`ripplo daemon: another daemon is already running for this project${t==null?"":` (pid ${String(t)})`} (cwd ${e}).`}function tX(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project. Shutting down."}function nX(e){if(e.kind==="not-running")return"daemon: not running";if(e.kind==="unresponsive")return`daemon: running but no reply within ${String(e.timeoutMs/1e3)}s \u2014 likely busy executing runs, retry when the batch drains`;let{status:t}=e,n=t.version==null?"version unknown (pre-0.7.8)":`v${t.version}`,r=`${String(t.active)} active, ${String(t.queued)} queued`,i=`explorer: ${t.explorer}, ${String(t.exploring)} exploring`,o=`daemon: running (${n} | ${r} | ${i} | ${Cj(t.progress)})`;if(t.sseHealth!=null&&!t.sseHealth.ok){let s=t.sseHealth.detail==null?"":`: ${t.sseHealth.detail}`;return`${o}
136
- daemon: cannot subscribe to run dispatch${s} \u2014 server-side, restarting the daemon will not help`}return o}function Cj(e){if(e.total===0)return"explore: idle";let t=`covered ${String(e.covered)}/${String(e.total)} targets`,n=e.deferred===0?"":` (${String(e.deferred)} deferred \u2014 timed out or errored, retried after cooldown)`,r=Ej(e);return`explore: ${t}${n}, ${String(e.findings)} findings, ${r}`}function rX(e){let t=e.daemonVersion==null?"an older version":`v${e.daemonVersion}`;return e.kind==="restarted"?`ripplo: daemon was ${t} \u2014 restarted on the current version`:`ripplo: daemon ${t} is older than this CLI but has runs in flight \u2014 restart it when idle to update`}function iX(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:e.findings.map(t=>mu({evidencePath:`.ripplo/debug/${e.runId}/behavior.jsonl`,finding:t})),kind:"findings"};case"error":return{detail:It(e.error),kind:"error"};case"dispatch-failed":return{detail:e.reason,kind:"dispatch-error"}}}function Ej(e){return e.saturated?e.deferred===0?"saturated":"waiting \u2014 every open target is deferred, retrying after cooldown":"searching"}import Aj from"p-queue";var Ij=4,Pj={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},ha=new Aj({concurrency:Ij}),Wt={headedActive:0,interactiveActive:0,interactiveQueued:0},Zx={current:null};function aX({headed:e,task:t,workClass:n}){let r=Pj[n];return n==="p3-explore"?ha.add(t,{priority:r}):(Wt.interactiveQueued+=1,ma(),ha.add(()=>Tj({headed:e,task:t}),{priority:r}))}function lX(e){!Number.isFinite(e)||e<1||(ha.concurrency=Math.floor(e),ma())}function Bf(){return{active:Wt.interactiveActive,headedActive:Wt.headedActive,poolSize:ha.concurrency,queued:Wt.interactiveQueued}}function uX(e){Zx.current=e}async function Tj({headed:e,task:t}){Wt.interactiveQueued-=1,Wt.interactiveActive+=1,Wt.headedActive+=e?1:0,ma();try{return await t()}finally{Wt.interactiveActive-=1,Wt.headedActive-=e?1:0,ma()}}function ma(){Zx.current?.()}import Vf from"fs";import Uf from"path";function Qx(e){try{let t=Mj(e);if(t==null)return;let n=Uf.join(t,"HEAD"),r=Vf.readFileSync(n,"utf8").trim(),i="ref: refs/heads/";return r.startsWith(i)?r.slice(i.length):r.length===0?void 0:r.slice(0,7)}catch{return}}function Mj(e){let t=Uf.join(e,".git");if(Vf.statSync(t).isDirectory())return t;let r=Vf.readFileSync(t,"utf8").trim(),i="gitdir:";if(!r.startsWith(i))return;let o=r.slice(i.length).trim();if(o.length!==0)return Uf.resolve(e,o)}import Oj from"crypto";import{graphql as Nj}from"gql.tada";import{err as Lj,ok as $j}from"neverthrow";var _j=Nj(`
137
- mutation SyncDevSession(
138
- $projectId: String!
139
- $cwd: String!
140
- $branch: String
141
- $preconditions: [SyncDevPreconditionInput!]!
142
- $singletons: [SyncDevSingletonInput!]
143
- $workflows: [SyncDevWorkflowInput!]!
144
- ) {
145
- syncDevSession(
146
- projectId: $projectId
147
- cwd: $cwd
148
- branch: $branch
149
- preconditions: $preconditions
150
- singletons: $singletons
151
- workflows: $workflows
152
- ) {
153
- id
154
- hooksPaused
155
- }
156
- }
157
- `);async function xX(e,t){let n=await Ir(e);if(n.isErr())return Lj({error:n.error,kind:"compilation-failed"});let r=await Wf({config:t,cwd:e,lockfile:n.value});return $j({devSessionId:r.devSessionId,lockfile:n.value})}async function Wf(e){let t=Ka(e.lockfile);return jj({config:e.config,cwd:e.cwd,payload:t})}function Dj(e){return Oj.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function jj({config:e,cwd:t,payload:n}){let r=Dj(n),i=Qx(t),o=await Le({config:e,document:_j,variables:{branch:i??null,cwd:t,preconditions:n.preconditions.map(s=>({depends:[...s.depends],description:s.description,name:s.name,returns:[...s.returns]})),projectId:e.projectId,singletons:n.singletons.map(s=>({defaultValue:s.defaultValue,description:s.description,name:s.name,type:s.type})),workflows:n.workflows.map(s=>({expectedOutcome:s.expectedOutcome,name:s.name,preconditions:[...s.preconditions],requiresKeys:s.requiresKeys.map(a=>({namespace:a.namespace,preconditionName:a.preconditionName})),slug:s.slug,sourcePath:s.sourcePath,spec:JSON.stringify(s.spec)}))}});if(o.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:o.syncDevSession.id,hash:r,hooksPaused:o.syncDevSession.hooksPaused}}import{randomUUID as oF}from"crypto";import{createId as sF}from"@paralleldrive/cuid2";import{CancellationTokenSource as aF,ResponseError as lF}from"vscode-jsonrpc/node";import{graphql as uF}from"gql.tada";import{createMessageConnection as Fj,NotificationType as ev,RequestType as tv,RequestType0 as nv,SocketMessageReader as Bj,SocketMessageWriter as Vj}from"vscode-jsonrpc/node";import{z as x}from"zod";var Uj="daemon.sock",Wj="daemon.log";function EX(e){return zt(e,Uj)}function AX(e){return zt(e,Wj)}function rv(e){return Fj(new Bj(e),new Vj(e))}var iv=x.object({all:x.boolean(),headed:x.boolean(),tests:x.array(x.string())}),IX=x.object({jobId:x.string(),total:x.number()}),zj=x.enum(["holder","standby","off"]),Gj=x.object({covered:x.number(),deferred:x.number(),findings:x.number(),saturated:x.boolean(),total:x.number()}),PX=x.object({active:x.number(),explorer:zj,exploring:x.number(),progress:Gj,queued:x.number(),sseHealth:x.object({detail:x.string().optional(),ok:x.boolean()}).optional(),version:x.string().optional()}),zf=x.discriminatedUnion("kind",[x.object({kind:x.literal("pass")}),x.object({findingLines:x.array(x.string()),kind:x.literal("findings")}),x.object({detail:x.string(),kind:x.literal("error")}),x.object({detail:x.string(),kind:x.literal("dispatch-error")}),x.object({detail:x.string(),kind:x.literal("infra-error")})]),Hj=x.discriminatedUnion("kind",[x.object({kind:x.literal("test-started"),runId:x.string(),testName:x.string(),workflowName:x.string()}),x.object({kind:x.literal("test-outcome"),outcome:zf,runId:x.string(),testName:x.string(),workflowName:x.string()})]),TX=x.object({event:Hj,jobId:x.string()}),MX=x.object({failed:x.number(),jobId:x.string(),notRun:x.number(),passed:x.number()}),OX=x.discriminatedUnion("code",[x.object({code:x.literal("compile-failed"),detail:x.string(),diagnostics:x.array(x.string()).default([])}),x.object({code:x.literal("selection-conflicting-flags")}),x.object({code:x.literal("selection-nothing-selected")}),x.object({code:x.literal("selection-unknown-ids"),known:x.array(x.string()),unknown:x.array(x.string())}),x.object({code:x.literal("scope-failed"),detail:x.string()}),x.object({code:x.literal("app-unreachable"),detail:x.string(),url:x.string()}),x.object({code:x.literal("sync-failed"),detail:x.string()}),x.object({code:x.literal("bad-message")})]),ov=x.object({findingId:x.string().min(1)}),NX=x.discriminatedUnion("kind",[x.object({kind:x.literal("resolved")}),x.object({kind:x.literal("unreachable")}),x.object({kind:x.literal("still-failing"),runId:x.string().optional()}),x.object({kind:x.literal("diverged"),runId:x.string().optional()}),x.object({kind:x.literal("flaky")}),x.object({kind:x.literal("aborted")}),x.object({kind:x.literal("finding-not-found")}),x.object({kind:x.literal("unreplayable"),reason:x.enum(["base-state-missing","action-missing","ledger-unreadable"])}),x.object({kind:x.literal("error"),reason:x.string()})]),sv=new tv("ripplo/exploreReplay"),av=new tv("ripplo/enqueue"),lv=new nv("ripplo/status"),uv=new nv("ripplo/shutdownIfIdle"),cv=new ev("ripplo/jobEvent"),dv=new ev("ripplo/jobDone");import{graphql as qj}from"gql.tada";async function fv(e,t){let r=(await Le({config:e,document:Kj,variables:{cwd:t,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(r.flatMap(i=>i.tests.map(o=>[`${i.slug}/${o.slug}`,{testId:o.id,workflowId:i.id}])))}var Kj=qj(`
158
- query DaemonWorkflows($projectId: String!, $cwd: String!) {
159
- project(id: $projectId) {
160
- id
161
- devSession(cwd: $cwd) {
162
- id
163
- workflows {
164
- id
165
- slug
166
- tests {
167
- id
168
- slug
169
- }
170
- }
171
- }
172
- }
173
- }
174
- `);import{CancellationTokenSource as Yj}from"vscode-jsonrpc/node";function Gf(e){return`${e.workflowSlug}/${e.testSlug}`}function pv(e){let{headed:t,inflight:n,jobId:r,lockfileHashValue:i,onExpire:o,runId:s,selection:a,timeoutMs:l}=e,u=Gf(a),c=`${u}@${i}@${String(t)}`,d=n.get(c);if(d!=null)return d.jobIds.add(r),null;let f={cancellation:new Yj,claimed:!1,claimKey:u,headed:t,inflightKey:c,jobIds:new Set([r]),runId:s,testName:a.testName,timer:null,workflowName:a.workflowName};return f.timer=setTimeout(()=>{ya(n,f),o(f)},l),n.set(c,f),f}function ya(e,t){t.timer!=null&&(clearTimeout(t.timer),t.timer=null),e.delete(t.inflightKey)}function hv(e,t){let n=[...e.values()].find(r=>r.runId===t&&!r.claimed);return n==null?null:(n.claimed=!0,n.timer!=null&&(clearTimeout(n.timer),n.timer=null),n)}function mv(e,t){[...e.values()].filter(n=>n.jobIds.has(t)).forEach(n=>{n.jobIds.delete(t),n.jobIds.size===0&&(ya(e,n),n.cancellation.cancel())})}import{err as Hf,ok as yv}from"neverthrow";function bv({all:e,ids:t,lockfile:n}){if(e&&t.length>0)return Hf({kind:"conflicting-flags"});if(e)return yv(n.workflows.filter(o=>!o.stub).flatMap(o=>o.tests.map(s=>Ye(s))));if(t.length===0)return Hf({kind:"nothing-selected"});let r=t.map(o=>({id:o,refs:Xj(n,o)})),i=r.filter(o=>o.refs.length===0).map(o=>o.id);return i.length>0?Hf({kind:"unknown-ids",known:Jj(n),unknown:i}):yv([...new Set(r.flatMap(o=>o.refs))])}function Sv(e,t){let n=new Map(nt(e).map(r=>[r.ref,{testName:r.test.name,testSlug:r.test.slug,workflowName:r.workflow.name,workflowSlug:qe(r.workflow.name)}]));return t.map(r=>{let i=n.get(r);if(i==null)throw new Error(`selectionsFor: ref not in lockfile: ${r}`);return i})}function Jj(e){return e.workflows.map(t=>qe(t.name))}function Xj(e,t){let n=e.workflows.find(r=>r.name===t||qe(r.name)===qe(t));return n!=null?n.tests.map(r=>Ye(r)):nt(e).filter(r=>r.ref===t||gv(r.ref)===gv(t)).map(r=>r.ref)}function gv(e){let t=e.lastIndexOf("/");return t===-1?qe(e):`${qe(e.slice(0,t))}/${qe(e.slice(t+1))}`}import{err as qf,ok as xv}from"neverthrow";import{graphql as vv}from"gql.tada";import{execFileSync as Zj}from"child_process";var Qj=256*1024*1024;function ga(e,t){return Zj("git",[...e],{cwd:t,encoding:"utf8",maxBuffer:Qj,stdio:["ignore","pipe","pipe"]})}async function Rv({config:e,cwd:t,lockfile:n}){await tF({config:e,cwd:t,lockfile:n});let r=await rF(e);if(r.isErr())return qf(r.error);let i=new Map(n.workflows.filter(s=>!s.stub).map(s=>[qe(s.name),s])),o=[...new Set(r.value)].flatMap(s=>{let a=i.get(s);return a==null?[]:a.tests.map(l=>Ye(l))});return o.length===0?qf({kind:"scope-empty"}):xv(o)}var eF=vv(`
175
- mutation AddDirtyTestsToScope($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
176
- addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
177
- __typename
178
- }
179
- }
180
- `);async function tF({config:e,cwd:t,lockfile:n}){let r=new Set(iF(t)),i=n.workflows.filter(o=>o.sourcePath!=null&&r.has(o.sourcePath)).map(o=>qe(o.name));i.length!==0&&await Le({config:e,document:eF,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:i}}).catch(o=>{be.warn({err:o},"auto-scope of dirty tests failed")})}var nF=vv(`
181
- query ScopeSelection($projectId: String!, $cwd: String!) {
182
- project(id: $projectId) {
183
- id
184
- devSession(cwd: $cwd) {
185
- id
186
- scopeItems {
187
- id
188
- workflow {
189
- id
190
- slug
191
- }
192
- }
193
- }
194
- }
195
- }
196
- `);async function rF(e){try{let n=(await Le({config:e,document:nF,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return xv(n.flatMap(r=>r.workflow==null?[]:[r.workflow.slug]))}catch(t){return qf({detail:t instanceof Error?t.message:String(t),kind:"scope-fetch-failed"})}}var wv=".ripplo/workflows/";function iF(e){try{return ga(["status","--porcelain","--",".ripplo/workflows"],e).split(`
197
- `).map(t=>t.slice(3).trim()).filter(t=>t.startsWith(wv)&&t.endsWith(".ts")).map(t=>t.slice(wv.length)).filter(t=>t!=="index.ts"&&!t.endsWith("/index.ts"))}catch{return[]}}var cF=12e4,dF=-32099;function fF(e){let t=new AbortController;return e.isCancellationRequested?(t.abort(),t.signal):(e.onCancellationRequested(()=>{t.abort()}),t.signal)}function hZ(e){let t={...e,inflight:new Map,jobs:new Map};return{claim:n=>gF(t,n),handleConnection:n=>{pF(t,n)},idle:()=>Ev(t)}}function pF(e,t){let n=rv(t);n.onRequest(av,(r,i)=>hF({connection:n,ctx:e,params:r,token:i})),n.onRequest(lv,()=>{let r=Bf();return{active:r.active,queued:r.queued,sseHealth:e.sseHealth(),version:La(),...e.explorationStatus()}}),n.onRequest(sv,async(r,i)=>{let o=ov.safeParse(r);return o.success?(await e.ready,e.replayFinding(o.data.findingId,fF(i))):{kind:"error",reason:"bad-message"}}),n.onRequest(uv,()=>{let r=Ev(e);return r&&e.onShutdownRequest(),r}),n.onClose(()=>{mF(e,n)}),n.onError(r=>{be.warn({err:r},"ipc connection error")}),t.on("error",r=>{be.warn({err:r},"ipc socket error")}),n.listen()}function Ev(e){let t=Bf();return e.jobs.size===0&&t.active===0&&t.queued===0}async function hF({connection:e,ctx:t,params:n,token:r}){let i=iv.safeParse(n);if(!i.success)throw kv({code:"bad-message"});await t.ready;let o=await SF({config:t.config,cwd:t.cwd,message:i.data});if(o.kind==="error")throw kv(o.error);let s=oF(),a=new aF;return r.onCancellationRequested(()=>{Av(t,s)}),t.jobs.set(s,{cancellation:a,connection:e,failed:0,notRun:0,passed:0,total:o.selections.length}),IF({ctx:t,headed:i.data.headed,jobId:s,lockfileHashValue:o.lockfileHashValue,selections:o.selections,targetsByClaimKey:o.targetsByClaimKey,token:a.token}).catch(l=>{be.error({err:l},"ipc dispatch failed")}),{jobId:s,total:o.selections.length}}function kv(e){return new lF(dF,e.code,e)}function Av(e,t){let n=e.jobs.get(t);n!=null&&(n.cancellation.cancel(),e.jobs.delete(t),mv(e.inflight,t))}function mF(e,t){[...e.jobs.entries()].filter(([,n])=>n.connection===t).forEach(([n])=>{Av(e,n)})}function Iv(e,t,n){let r=e.jobs.get(t);r!=null&&(Cv(()=>r.connection.sendNotification(cv,{event:n,jobId:t})),n.kind==="test-outcome"&&(yF(r,n.outcome.kind),r.passed+r.failed+r.notRun>=r.total&&(Cv(()=>r.connection.sendNotification(dv,{failed:r.failed,jobId:t,notRun:r.notRun,passed:r.passed})),e.jobs.delete(t))))}function Cv(e){e().catch(t=>{be.warn({err:t},"ipc notification failed")})}function yF(e,t){if(t==="pass"){e.passed+=1;return}if(t==="dispatch-error"||t==="infra-error"){e.notRun+=1;return}e.failed+=1}function ba(e,t,n){t.jobIds.forEach(r=>{Iv(e,r,n)})}function gF(e,t){let n=hv(e.inflight,t);return n==null?null:{headed:n.headed,token:n.cancellation.token,finished:(r,i)=>{e.inflight.delete(n.inflightKey),ba(e,n,{kind:"test-outcome",outcome:i,runId:n.runId,testName:n.testName,workflowName:n.workflowName})},started:()=>{ba(e,n,{kind:"test-started",runId:n.runId,testName:n.testName,workflowName:n.workflowName})}}}function bF(e){return e.kind==="typecheck-failed"?e.diagnostics.slice(0,5):e.kind==="invalid-lockfile"?e.issues.slice(0,5):e.kind==="load-threw"?[e.message]:[]}async function SF({config:e,cwd:t,message:n}){return(await Gp(t)).match(i=>wF({config:e,cwd:t,lockfile:i,message:n}),i=>Promise.resolve({error:{code:"compile-failed",detail:i.kind,diagnostics:[...bF(i)]},kind:"error"}))}async function wF({config:e,cwd:t,lockfile:n,message:r}){let i=await vF(e.appUrl);if(i!=null)return{error:{code:"app-unreachable",detail:i,url:e.appUrl},kind:"error"};let o=await RF({config:e,cwd:t,lockfile:n});return o!=null?{error:{code:"sync-failed",detail:o},kind:"error"}:(await kF({config:e,cwd:t,lockfile:n,message:r})).match(async a=>({kind:"ready",lockfileHashValue:Mi(n),selections:Sv(n,a),targetsByClaimKey:await fv(e,t)}),a=>Promise.resolve({error:a,kind:"error"}))}var xF=2e3;async function vF(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(xF)}),null}catch(t){return t instanceof Error?t.message:String(t)}}async function RF(e){try{return await Wf(e),null}catch(t){return t instanceof Error?t.message:String(t)}}async function kF({config:e,cwd:t,lockfile:n,message:r}){return!r.all&&r.tests.length===0?(await Rv({config:e,cwd:t,lockfile:n})).mapErr(CF):bv({all:r.all,ids:r.tests,lockfile:n}).mapErr(EF)}function CF(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function EF(e){switch(e.kind){case"conflicting-flags":return{code:"selection-conflicting-flags"};case"nothing-selected":return{code:"selection-nothing-selected"};case"unknown-ids":return{code:"selection-unknown-ids",known:[...e.known],unknown:[...e.unknown]}}}var AF=uF(`
198
- mutation DaemonCreateRun(
199
- $id: String
200
- $workflowId: String!
201
- $testId: String
202
- $clientVersion: String
203
- ) {
204
- createRun(
205
- id: $id
206
- workflowId: $workflowId
207
- testId: $testId
208
- executor: local
209
- clientVersion: $clientVersion
210
- ) {
211
- __typename
212
- ... on MutationCreateRunSuccess {
213
- data {
214
- id
215
- }
216
- }
217
- }
218
- }
219
- `);async function IF(e){await e.selections.reduce((t,n)=>t.then(()=>PF(e,n)),Promise.resolve())}async function PF(e,t){let{ctx:n,headed:r,jobId:i,lockfileHashValue:o,targetsByClaimKey:s,token:a}=e;if(a.isCancellationRequested)return;let l=Gf(t),u=s.get(l);if(u==null){Iv(n,i,{kind:"test-outcome",outcome:{detail:"test-not-found",kind:"dispatch-error"},runId:"",testName:t.testName,workflowName:t.workflowName});return}let c=pv({headed:r,inflight:n.inflight,jobId:i,lockfileHashValue:o,runId:sF(),selection:t,timeoutMs:cF,onExpire:f=>{ba(n,f,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-error"},runId:"",testName:f.testName,workflowName:f.workflowName})}});if(c==null)return;let d=await TF(n.config,u,c.runId);d!=null&&(ya(n.inflight,c),ba(n,c,{kind:"test-outcome",outcome:d,runId:"",testName:t.testName,workflowName:t.workflowName}))}async function TF(e,t,n){try{let i=(await Le({config:e,document:AF,variables:{clientVersion:La(),id:n,testId:t.testId,workflowId:t.workflowId}})).createRun;return i==null?{detail:"create-run-null",kind:"dispatch-error"}:i.__typename==="MutationCreateRunSuccess"?null:{detail:i.__typename,kind:"dispatch-error"}}catch(r){return r instanceof Pn?{detail:r.message,kind:"infra-error"}:{detail:r instanceof Error?r.message:String(r),kind:"dispatch-error"}}}function MF(e){let{backoffActive:t,explorerHolder:n,headedActive:r,interactiveActive:i,interactiveQueued:o}=e,{explorationActive:s,exploreConcurrency:a,poolSize:l}=e;if(!n||r||o>0)return{abortCount:s,refillCount:0};if(t)return{abortCount:0,refillCount:0};let u=Math.min(a,l-1,l-i);return{abortCount:0,refillCount:Math.max(0,u-s)}}function yZ(e){let t={active:new Map,backoffUntil:0,cancelBackoffTimer:null,cancelHeartbeat:null,holder:!1,prevInteractiveActive:e.probe().interactiveActive,stopped:!1};return Mv(t,e),{explorationActive:()=>t.active.size,explorerHolder:()=>t.holder,notifyQueueChange:()=>{OF(t,e)},setExplorerHolder:n=>{t.holder=n,Ni(t,e)},stop:()=>{t.stopped=!0,t.cancelBackoffTimer?.(),t.cancelBackoffTimer=null,t.cancelHeartbeat?.(),t.cancelHeartbeat=null,Ov(t,t.active.size)}}}function Mv(e,t){e.stopped||(e.cancelHeartbeat=t.setTimer(()=>{Ni(e,t),Mv(e,t)},15e3))}function Ni(e,t){if(e.stopped)return;let n=t.probe(),r=MF({backoffActive:t.now()<e.backoffUntil,explorationActive:e.active.size,exploreConcurrency:t.exploreConcurrency,explorerHolder:e.holder&&t.exploreEnabled,headedActive:n.headedActive>0,interactiveActive:n.interactiveActive,interactiveQueued:n.interactiveQueued,poolSize:n.poolSize});Ov(e,r.abortCount),Nv({count:r.refillCount,params:t,state:e})}function Ov(e,t){[...e.active.values()].slice(0,t).forEach(({controller:n})=>{n.abort()})}function OF(e,t){let n=t.probe();n.interactiveActive<e.prevInteractiveActive&&NF(e,t),e.prevInteractiveActive=n.interactiveActive,Ni(e,t)}function NF(e,t){e.backoffUntil=t.now()+3e4,e.cancelBackoffTimer?.(),e.cancelBackoffTimer=t.setTimer(()=>{e.cancelBackoffTimer=null,Ni(e,t)},3e4)}function Nv({count:e,params:t,state:n}){if(e<=0)return;let r=LF(t.sources);r!=null&&($F({params:t,pulled:r,state:n}),Nv({count:e-1,params:t,state:n}))}function LF(e){return e.reduce((t,n)=>{if(t!=null)return t;let r=n.next();return r==null?null:{job:r,source:n}},null)}function $F({params:e,pulled:t,state:n}){let{job:r,source:i}=t,o=new AbortController;n.active.set(r.id,{controller:o,job:r,source:i}),e.execute({job:r,priority:i.priority,signal:o.signal}).then(()=>{Tv({job:r,outcome:Pv(o.signal,null),params:e,source:i,state:n})}).catch(s=>{Tv({job:r,outcome:Pv(o.signal,{error:s}),params:e,source:i,state:n})})}function Pv(e,t){return e.aborted?{kind:"aborted"}:t==null?{kind:"completed"}:{error:t.error,kind:"error"}}function Tv({job:e,outcome:t,params:n,source:r,state:i}){i.active.delete(e.id),r.onResult(e,t),Ni(i,n)}import _F from"fs";import DF from"path";async function kZ(e){let t=DF.join(e,".ripplo","index.ts");if(!_F.existsSync(t))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let n=await Ir(e);return n.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:lo(n.error),path:".ripplo/"}],valid:!1,warnings:[]}:qi().match(r=>({appUrl:r.appUrl,engineUrl:r.engineUrl,errors:[],valid:!0,warnings:[]}),r=>({appUrl:void 0,engineUrl:void 0,errors:[{message:al(r),path:""}],valid:!1,warnings:[]}))}async function CZ(e){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(5e3)});return}catch{return`appUrl (${e}) is not responding. Make sure your dev server is running on that port.`}}async function EZ({appUrl:e,engineUrl:t}){let n=t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`;try{return(await fetch(`${n}/setup`,{body:JSON.stringify({}),headers:{"Content-Type":"application/json"},method:"PUT",signal:AbortSignal.timeout(5e3)})).ok?"Engine endpoint accepted an unsigned request \u2014 webhook signature verification may be missing.":void 0}catch{return}}import VF from"fs";import jF from"fs";import Kf from"path";var FF=["MERGE_HEAD","rebase-merge","rebase-apply","CHERRY_PICK_HEAD","REVERT_HEAD"];function Lv(e){let t=BF(e);return t==null?!1:FF.some(n=>jF.existsSync(Kf.join(t,n)))}function BF(e){try{let t=ga(["rev-parse","--git-dir"],e).trim();return t.length===0?null:Kf.isAbsolute(t)?t:Kf.resolve(e,t)}catch{return null}}function UF(e){return zt(e,"hooks-paused")}function _Z(e){return VF.existsSync(UF(e))||Lv(e)?!1:rh(e)}import WF from"fs";import{lockSync as zF}from"proper-lockfile";var GF="explorer.lock",HF=15e3,qF=15e3;function KF(){return un(GF)}function VZ({onChange:e}){let t={release:null,stopped:!1},n=()=>{t.release=null,t.stopped||e(!1)},r=()=>{if(t.stopped||t.release!=null)return;let o=YF(n);o!=null&&(t.release=o,e(!0))};r();let i=setInterval(r,qF);return{holder:()=>t.release!=null,stop:()=>{t.stopped=!0,clearInterval(i),t.release?.(),t.release=null}}}function YF(e){try{xr();let t=KF(),n=zF(t,{onCompromised:e,realpath:!1,stale:HF});return WF.writeFileSync(t,String(process.pid)),()=>{try{n()}catch{}}}catch{return null}}import JF from"path";import{randomUUID as XF}from"crypto";function $v(e){return{axes:[Cf("unit"),Ef(e)]}}var _v=12,Dv=15,jv=4,Fv=2,zZ=12e4;var Uv={covered:0,deferred:0,findings:0,saturated:!1,total:0};function XZ(){return{priority:"p3",next:()=>null,onResult:()=>{},ready:()=>Promise.resolve(),status:()=>Uv,stop:()=>Promise.resolve()}}function ZZ(e){let t={claimed:new Set,consecutiveErrors:0,covered:new Set,deferred:new Map,findings:0,haltedUntil:0,prepared:null,preparing:!1,refreshing:!1,saturated:!1,tick:0},n=Yf(e,t);return{priority:"p3",next:()=>nB(e,t),onResult:()=>{},ready:()=>n,status:()=>t.prepared==null?Uv:eB(t.prepared,t),stop:()=>Promise.resolve()}}async function Yf(e,t){if(!t.preparing){t.preparing=!0;try{let n=await e.loadLockfile();if(n==null)return;let r=await ZF(n);if(r==null)return;await Ti(zv(e.cwd)).match(i=>{let o=Pi(i);t.covered=new Set(o.covered),t.findings=[...o.findings.values()].filter(s=>s.resolvedAt==null).length,t.prepared=r,t.consecutiveErrors=0,t.haltedUntil=0,t.deferred.clear(),e.notifyWork()},i=>{be.warn("explore findings log unreadable, exploration disabled: %s",i.kind)})}finally{t.preparing=!1}}}async function ZF({fingerprint:e,lockfile:t}){let n=$v(t),r=Fn(t);if(r.length===0)return null;let i=_f(t,{sweep:!1}),o=await QF(t,i),s=Mf({baseStates:o,corpus:r,lens:n,maxCount:Fv,maxDepth:jv});return{actionHashes:r.map(a=>Pf(t,a)),baseStates:i,corpus:r,fingerprint:e,graph:s,lens:n,lensIdValue:kf(n),lockfile:t,lockfileHashValue:Mi(t)}}async function QF(e,t){let n={generate:Vn,materialize:$l(Vn,e.valueSpaces),params:void 0};return(await Promise.all(t.map(async i=>(await Df(e,i,n)).match(s=>({name:i.name,snapshot:s.snapshot}),()=>null)))).flatMap(i=>i==null?[]:[i])}var Bv=20,Wv=6e5,Vv=3e5;function eB(e,t){let n=Nf(e.graph),r=Of({actionHashes:e.actionHashes,corpus:e.corpus,covered:t.covered,graph:e.graph,lensId:e.lensIdValue,tick:t.tick});return{covered:n-r,deferred:Hv(t).size,findings:t.findings,saturated:t.saturated,total:n}}async function tB(e,t){if(!(t.refreshing||t.preparing||t.prepared==null)){t.refreshing=!0;try{let n=await e.loadLockfile();if(n==null||n.fingerprint===t.prepared.fingerprint)return;be.info("workflow definitions changed, re-preparing exploration targets"),t.prepared=null,await Yf(e,t)}finally{t.refreshing=!1}}}function nB(e,t){tB(e,t);let n=t.prepared;if(n==null||Date.now()<t.haltedUntil)return null;let r=Lf({actionHashes:n.actionHashes,corpus:n.corpus,covered:new Set([...t.covered,...t.claimed,...Hv(t)]),graph:n.graph,lensId:n.lensIdValue,tick:t.tick});if(t.tick+=1,r.kind==="saturated")return t.saturated=!0,null;t.saturated=!1;let i=cB(n,r.target);return t.claimed.add(i),{id:`explore:${XF()}`,label:r.target.targetKey,run:o=>rB({choice:r.target,key:i,params:e,prepared:n,signal:o,state:t})}}async function rB({choice:e,key:t,params:n,prepared:r,signal:i,state:o}){try{let s=oB({choice:e,params:n,prepared:r});if(s==null)return;if(!await n.probeApp()){Gv(o,"app-unreachable");return}let a=await n.executeTrail(s,i);if(a.kind==="aborted")return;if(a.kind==="error"){aB({key:t,params:n,reason:a.reason,state:o});return}o.consecutiveErrors=0,be.info("exploration trail %s: %s @ %s",a.kind,a.trail.map(l=>l.label).join(" -> "),e.targetKey.slice(0,80)),n.onTrailDone?.({kind:a.kind,label:e.targetKey,trail:a.trail}),await sB({outcome:iB(a,e,r),params:n,state:o})}finally{o.claimed.delete(t)}}function iB(e,t,n){let r={actionHash:t.actionHash,at:new Date().toISOString(),kind:"covered",lensId:n.lensIdValue,targetKey:t.targetKey};return{...e,rows:[...e.rows,r]}}function oB({choice:e,params:t,prepared:n}){let r=n.baseStates.find(i=>i.name===e.witness.baseState);return r==null?null:{baseStateTest:r.test,lensId:n.lensIdValue,lockfileFingerprint:n.fingerprint,lockfileHash:n.lockfileHashValue,maxLength:t.maxTrailLength??_v,shrinkBudget:Dv,stepRuns:e.witness.trail.map(i=>({idx:i.idx,params:i.params}))}}async function sB({outcome:e,params:t,state:n}){let r=e.rows.filter(i=>i.kind!=="covered"||!n.covered.has(ze(i)));r.forEach(i=>{(i.kind==="covered"||i.kind==="finding"||i.kind==="flaky-candidate")&&n.covered.add(ze(i))}),e.kind==="finding"&&(n.findings+=1,be.info("exploration finding recorded")),r.length!==0&&await If(zv(t.cwd),r).match(()=>{},i=>{be.warn("explore findings log append failed: %s",i.kind)})}function zv(e){return JF.join(e,".ripplo",".local","explore-ledger.jsonl")}function aB({key:e,params:t,reason:n,state:r}){if(n==="lockfile:fingerprint-mismatch"){lB(t,r);return}if(uB(r,e),n==="trail-timeout"){be.warn("exploration attempt timed out, target deferred for %ds",Wv/1e3);return}Gv(r,n)}function lB(e,t){t.preparing||(t.prepared=null,Yf(e,t))}function uB(e,t){e.deferred.set(t,Date.now()+Wv)}function Gv(e,t){e.consecutiveErrors+=1,be.debug("exploration trail error: %s",t),e.consecutiveErrors>=Bv&&(e.haltedUntil=Date.now()+Vv,e.consecutiveErrors=0,be.warn("exploration cooling down for %ds after %d consecutive trail errors (last: %s)",Vv/1e3,Bv,t))}function Hv(e){let t=Date.now();return[...e.deferred].filter(([,n])=>n<=t).forEach(([n])=>e.deferred.delete(n)),new Set(e.deferred.keys())}function cB(e,t){return ze({actionHash:t.actionHash,lensId:e.lensIdValue,targetKey:t.targetKey})}import dB from"path";var fB=3;function nQ(e){return Ti(pB(e)).map(t=>hB(Pi(t)))}function pB(e){return dB.join(e,".ripplo",".local","explore-ledger.jsonl")}function hB(e){let t=[...e.findings.entries()].filter(([,r])=>r.resolvedAt==null).map(([r,i])=>mB(r,i)).toSorted(gB),n=[...e.flaky.entries()].filter(([,r])=>r.occurrences>=fB).map(([r,i])=>yB(r,i)).toSorted((r,i)=>i.occurrences-r.occurrences);return{pending:t,recurrentFlaky:n}}function mB(e,t){let n=t.latest;return{baseState:n.baseState,evidence:n.evidence,firstSeen:t.first.at,id:ca(e),lastSeen:n.at,occurrences:t.occurrences,parts:n.parts,runId:n.runId,trail:n.trail,verifierLayer:n.verifierLayer}}function yB(e,t){return{at:t.first.at,baseState:t.first.baseState,id:ca(e),occurrences:t.occurrences,trail:t.first.trail}}var qv={crash:0,"data-rule":1,frame:3,"page-rule":2};function gB(e,t){let n=qv[e.verifierLayer]-qv[t.verifierLayer];return n===0?t.occurrences-e.occurrences:n}import{createMessageConnection as Kv,IPCMessageReader as Yv,IPCMessageWriter as Jv,NotificationType as bB,NotificationType0 as Xv,RequestType as Jf}from"vscode-jsonrpc/node";import{z as _}from"zod";var uQ=_.object({headed:_.boolean(),lockfileFingerprint:_.string(),runId:_.string().min(1),testRef:_.string().min(1)}),cQ=_.object({fingerprint:_.string()}),dQ=_.object({lockfileJson:_.string().optional(),unavailable:_.string().optional()}),SB=_.enum(["unspecified","internal","server","client","producer","consumer"]),wB=_.enum(["unset","ok","error"]),xB=_.object({attributes:_.record(_.string(),_.string()),durationMs:_.number(),kind:_.literal("span"),name:_.string(),parentSpanId:_.union([_.string(),_.undefined()]),source:_.literal("server"),spanId:_.string(),spanKind:SB,status:_.object({code:wB,message:_.union([_.string(),_.undefined()])}),timeNanos:_.string(),traceId:_.string()}),fQ=_.object({runId:_.string().min(1),span:xB}),pQ=_.object({outcome:zf,serverNotified:_.boolean()}),hQ=_.object({baseStateTest:eo,lensId:_.string().min(1),lockfileFingerprint:_.string(),lockfileHash:_.string().min(1),maxLength:_.number().int().positive(),shrinkBudget:_.number().int().nonnegative(),stepRuns:_.array(_.object({idx:_.number().int().nonnegative(),params:_.record(_.string(),_.union([gt,_.null()]))}))}),vB=_.object({actions:_.array(_.string()),label:_.string().min(1)}),mQ=_.object({kind:_.enum(["aborted","clean","error","flaky","finding"]),reason:_.string().optional(),rows:_.array(ua),trail:_.array(vB).default([])}),yQ=new Xv("worker/ready"),gQ=new Jf("worker/run"),bQ=new Jf("worker/lockfile"),SQ=new Jf("worker/exploreTrail"),wQ=new bB("worker/span"),xQ=new Xv("worker/shutdown");function vQ(e){let t=Kv(new Yv(e),new Jv(e));return t.listen(),t}function RQ(){let e=Kv(new Yv(process),new Jv(process));return e.listen(),e}import{gzip as TB}from"zlib";import{promisify as MB}from"util";import{existsSync as OB,readFileSync as NB}from"fs";import tR from"path";import{graphql as br}from"gql.tada";function Zv(e){return[e.kind,e.target,e.value].filter(t=>t.length>0).join(" ")}var RB={"no-effect":"noEffect","required-state-unsatisfied":"requiredStateUnsatisfied",unresolvable:"unresolvable"},kB={"data-rule":"dataRule","page-rule":"pageRule",step:"step"},CB={aborted:"aborted","action-failed":"actionFailed","check-failed":"checkFailed","client-mount-missing":"clientMountMissing","conflicting-sessions":"conflictingSessions","driver-launch":"driverLaunch","engine-decode":"engineDecode","engine-http":"engineHttp","engine-network":"engineNetwork","engine-unreachable":"engineUnreachable","setup-missing-row":"setupMissingRow","state-identity":"stateIdentity"};function Qv(e){return e.kind==="consistency"?{consistency:{mismatch:IB(e.mismatch),pending:e.pending}}:e.kind==="pending-check"?{pendingCheck:{budget:e.budget,source:kB[e.source.kind],...EB(e.source)}}:e.kind==="unrunnable"?{unrunnable:{reason:RB[e.reason]}}:e.kind==="driver-error"?{driverError:{errorKind:CB[e.error.kind],message:PB(e.error)}}:{impossibleAction:{subject:AB(e.step.action)}}}function EB(e){return"check"in e?eR(e.check,!1):{checkKind:void 0,expected:void 0,negated:void 0,subject:void 0}}function eR(e,t){return e.kind==="not"?eR(e.inner,!t):e.kind==="browser"?{checkKind:"browser",expected:e.value,negated:t,subject:e.name}:e.kind==="value"||e.kind==="text"?{checkKind:e.kind,expected:e.value,negated:t,subject:cn(e.locator)}:{checkKind:e.kind,expected:void 0,negated:t,subject:cn(e.locator)}}function AB(e){let t=e.locator==null?e.url??"":cn(e.locator);return`${e.kind} ${t}`.trim()}function IB(e){return e.kind==="wrong-value"?{wrongValue:{entity:e.entity,field:e.field,key:e.key,snapshot:Li(e.snapshot),sut:Li(e.sut)}}:e.kind==="expected-change"?{expectedChange:{entity:e.entity,field:e.field,key:e.key,value:Li(e.value)}}:e.kind==="singleton-mismatch"?{singletonMismatch:{singleton:e.singleton,snapshot:Li(e.snapshot),sut:Li(e.sut)}}:e.kind==="unexpected-row"?{unexpectedRow:{entity:e.entity,key:e.key}}:{missingRow:{entity:e.entity,key:e.key}}}function Li(e){return e==null?null:String(e)}function PB(e){return"message"in e?e.message:"detail"in e?e.detail:null}async function LB({config:e,cwd:t,fixturesDir:n,headed:r,lockfile:i,runId:o,session:s,signal:a,test:l}){if(!await QB(e,o))return{kind:"dispatch-failed",reason:"already-claimed",runId:o};let c=tR.join(t,".ripplo","debug"),d=[];return(await s.runOnce({capture:!0,lockfile:i,options:{baseUrl:e.appUrl,engineUrl:e.engineUrl,fixturesDir:n,generate:Vn,headed:r,secret:e.webhookSecret},params:void 0,runId:o,sequence:void 0,test:l,onEvent:h=>{d.push(h)}},a)).match(async h=>{await $B({config:e,debugDir:c,events:d,runId:o,test:l,total:h.ran.length});let p=nR(d).flatMap(m=>m.findings);return p.length>0?{findings:p,kind:"findings",runId:o}:{kind:"pass",runId:o}},async h=>(await iR(e,o,It(h)),{error:h,kind:"error",runId:o}))}async function $B({config:e,debugDir:t,events:n,runId:r,test:i}){let o=nR(n),s=_B(t,r);if(s==null)throw new Error("recording-missing");await Promise.all([zB({aliases:[...FB(n),...BB(o,i)],config:e,generated:VB(n),generatedSingletons:UB(n),origin:s.origin,records:o,rrwebEvents:s.events,runId:r,test:i}),XB(e,r,s)]),await ZB(e,r,o)}function nR(e){return e.flatMap(t=>t.kind==="step"?[{annotations:t.annotations,endMs:t.endMs,findings:t.findings,index:t.index,startMs:t.startMs,state:t.state,url:t.url}]:[])}function _B(e,t){let n=tR.join(e,t,"behavior.jsonl");if(!OB(n))return null;let r=NB(n,"utf8").split(`
220
- `).filter(o=>o.length>0).map(o=>DB(o)).flatMap(o=>jB(o)?[o.event]:[]),i=r[0];return i==null?null:{events:r,origin:i.timestamp}}function DB(e){return JSON.parse(e)}function jB(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}function FB(e){return e.flatMap(t=>t.kind==="world"?t.aliases:[])}function BB(e,t){return e.flatMap(n=>{let r=WB(t.steps[n.index]);return r.flatMap(i=>{let s=r.filter(l=>l.entity===i.entity).indexOf(i),a=n.state.rows.filter(l=>l.status==="created"&&l.entity===i.entity).at(s);return a==null?[]:[{alias:i.as,entity:i.entity,key:a.key}]})})}function VB(e){return new Set(e.flatMap(t=>t.kind==="world"?t.generated.map(n=>rR(n)):[]))}function rR({entity:e,field:t,key:n}){return`${e}\0${n}\0${t}`}function UB(e){return new Set(e.flatMap(t=>t.kind==="world"?t.generatedSingletons:[]))}function WB(e){return e==null?[]:e.expect.flatMap(t=>Xf(t))}function Xf(e){return e.kind==="state"&&e.assertion.kind==="created"?[{as:e.assertion.as,entity:e.entity}]:e.kind==="and"?e.predicates.flatMap(t=>Xf(t)):e.kind==="when"?e.branches.flatMap(t=>t.consequence.flatMap(n=>Xf(n))):[]}async function zB({aliases:e,config:t,generated:n,generatedSingletons:r,origin:i,records:o,rrwebEvents:s,runId:a,test:l}){let u=o.map(c=>KB({aliases:e,generated:n,generatedSingletons:r,origin:i,record:c,rrwebEvents:s,test:l}));await Le({config:t,document:tV,variables:{items:[{runId:a,steps:u}]}})}var GB=3,HB=0;function qB({endMs:e,rrwebEvents:t,startMs:n}){let r=t.find(i=>i.type===GB&&i.data?.source===HB&&i.timestamp>=n&&i.timestamp<=e);return r==null?n:r.timestamp}function KB({aliases:e,generated:t,generatedSingletons:n,origin:r,record:i,rrwebEvents:o,test:s}){let a=s.steps[i.index];if(a==null)throw new Error("step-descriptor-missing");let l=Ya(a,i.index),u=qB({endMs:i.endMs,rrwebEvents:o,startMs:i.startMs}),c=i.annotations.map(f=>({kind:f.kind,label:f.label,outcome:f.outcome,recordingStartMs:Math.max(0,(f.kind==="action"?u:f.atMs)-r),rrwebIds:[...f.rrwebIds]})),d=i.annotations.find(f=>f.kind==="action")?.rrwebIds??[];return{annotations:c,detail:null,duration:Math.max(0,i.endMs-i.startMs),findings:i.findings.map(f=>Qv(f)),nodeType:l.kind,recordingEndMs:Math.max(0,i.endMs-r),recordingStartMs:Math.max(0,u-r),rrwebIds:[...d],snapshotTimestamp:Math.max(0,i.endMs-r),stateRows:i.state.rows.map(f=>YB({aliases:e,generated:t,row:f})),stateSingletons:i.state.singletons.map(f=>({changed:f.changed,generated:n.has(f.name),name:f.name,value:f.value==null?null:String(f.value)})),status:i.findings.length>0?"failed":"passed",stepIndex:i.index,title:Zv(l),url:i.url}}function YB({aliases:e,generated:t,row:n}){let r=e.find(i=>i.entity===n.entity&&i.key===n.key);return{entity:n.entity,fields:n.fields.map(i=>({changed:i.changed,field:i.field,generated:t.has(rR({entity:n.entity,field:i.field,key:n.key})),value:i.value==null?null:String(i.value)})),key:n.key,label:r?.alias??n.key,status:n.status}}var JB=MB(TB);async function iR(e,t,n){await Le({config:e,document:iV,variables:{reason:n,runId:t}}).catch(r=>{be.error(r,"failRun submission failed")})}async function XB(e,t,n){let r=n.events.map(s=>JSON.stringify(s)).join(`
221
- `),i=await JB(Buffer.from(r,"utf8")),o=n.events.at(-1);await Le({config:e,document:nV,variables:{input:{bodyBase64:i.toString("base64"),chunkIndex:0,endTimestamp:Math.max(0,(o?.timestamp??n.origin)-n.origin),eventCount:n.events.length,runId:t,startTimestamp:0}}})}async function ZB(e,t,n){let r=n.filter(s=>s.findings.length>0).length,i=n.length-r,o=n.reduce((s,a)=>s+Math.max(0,a.endMs-a.startMs),0);await Le({config:e,document:rV,variables:{items:[{duration:o,failCount:r,passCount:i,runId:t,status:r>0?"failed":"passed",summary:null,warnCount:0}]}})}async function QB(e,t){return((await Le({config:e,document:eV,variables:{runIds:[t]}})).startRunsBatch??[]).some(r=>r.id===t)}var eV=br(`
222
- mutation StartRunsBatch($runIds: [String!]!) {
223
- startRunsBatch(runIds: $runIds) {
224
- id
225
- }
226
- }
227
- `),tV=br(`
228
- mutation SubmitRunStepsBatch($items: [SubmitRunStepsItem!]!) {
229
- submitRunStepsBatch(items: $items)
230
- }
231
- `),nV=br(`
232
- mutation SubmitRunRecordingChunk($input: SubmitRunRecordingChunkInput!) {
233
- submitRunRecordingChunk(input: $input)
234
- }
235
- `),rV=br(`
236
- mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
237
- completeRunsBatch(items: $items) {
238
- id
239
- status
240
- }
241
- }
242
- `),iV=br(`
243
- mutation FailRun($runId: String!, $reason: String!) {
244
- failRun(runId: $runId, reason: $reason)
245
- }
246
- `),jQ=br(`
247
- mutation MarkRunArtifactsUploadedBatch($runIds: [String!]!) {
248
- markRunArtifactsUploadedBatch(runIds: $runIds)
249
- }
250
- `);export{hR as a,be as b,RR as c,Pn as d,kR as e,Le as f,Ra as g,zt as h,un as i,Ca as j,WR as k,zR as l,FR as m,QR as n,ek as o,qV as p,tU as q,qi as r,lk as s,La as t,pk as u,hk as v,Ak as w,qe as x,qk as y,so as z,Zk as A,Ir as B,$n as C,tW as D,lo as E,sW as F,aW as G,lW as H,hW as I,al as J,Yp as K,Xp as L,AW as M,rh as N,cl as O,OW as P,ga as Q,Lv as R,kZ as S,CZ as T,EZ as U,$l as V,Ye as W,nt as X,Fn as Y,iI as Z,uI as _,Vn as $,$e as aa,KP as ba,YP as ca,JP as da,dl as ea,Gc as fa,x5 as ga,ca as ha,Pi as ia,Ti as ja,If as ka,_5 as la,Pf as ma,Mi as na,ij as oa,_f as pa,Df as qa,fj as ra,UF as sa,_Z as ta,VZ as ua,$v as va,zZ as wa,XZ as xa,ZZ as ya,nQ as za,pB as Aa,XJ as Ba,ZJ as Ca,QJ as Da,eX as Ea,tX as Fa,nX as Ga,Cj as Ha,rX as Ia,iX as Ja,EX as Ka,AX as La,rv as Ma,IX as Na,PX as Oa,TX as Pa,MX as Qa,OX as Ra,NX as Sa,sv as Ta,av as Ua,lv as Va,uv as Wa,cv as Xa,dv as Ya,aX as Za,lX as _a,Bf as $a,uX as ab,Qx as bb,xX as cb,Wf as db,fF as eb,hZ as fb,LB as gb,iR as hb,uQ as ib,cQ as jb,fQ as kb,pQ as lb,hQ as mb,mQ as nb,yQ as ob,gQ as pb,bQ as qb,SQ as rb,wQ as sb,xQ as tb,vQ as ub,RQ as vb,yZ as wb};
251
- /*! Bundled license information:
252
-
253
- rrweb/dist/rrweb.js:
254
- (*! *****************************************************************************
255
- Copyright (c) Microsoft Corporation.
256
-
257
- Permission to use, copy, modify, and/or distribute this software for any
258
- purpose with or without fee is hereby granted.
259
-
260
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
261
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
262
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
263
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
264
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
265
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
266
- PERFORMANCE OF THIS SOFTWARE.
267
- ***************************************************************************** *)
268
- */