ripplo 0.7.2 → 0.7.3
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.
- package/dist/index.js +236 -204
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var bR=Object.create;var Lf=Object.defineProperty;var wR=Object.getOwnPropertyDescriptor;var SR=Object.getOwnPropertyNames;var vR=Object.getPrototypeOf,xR=Object.prototype.hasOwnProperty;var qr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var kR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of SR(t))!xR.call(e,i)&&i!==r&&Lf(e,i,{get:()=>t[i],enumerable:!(n=wR(t,i))||n.enumerable});return e};var so=(e,t,r)=>(r=e!=null?bR(vR(e)):{},kR(t||!e||!e.__esModule?Lf(r,"default",{value:e,enumerable:!0}):r,e));var Vf=qr(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.timingSafeEqual=void 0;function Bf(e,t=""){if(!e)throw new Error(t)}function JR(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)),Bf(e instanceof DataView),Bf(t instanceof DataView);let r=e.byteLength,n=0,i=-1;for(;++i<r;)n|=e.getUint8(i)^t.getUint8(i);return n===0}co.timingSafeEqual=JR});var Hf=qr(nt=>{"use strict";var YR=nt&&nt.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(nt,"__esModule",{value:!0});var $e=256,yl=(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 r="",n=0;n<t.length-2;n+=3){var i=t[n]<<16|t[n+1]<<8|t[n+2];r+=this._encodeByte(i>>>18&63),r+=this._encodeByte(i>>>12&63),r+=this._encodeByte(i>>>6&63),r+=this._encodeByte(i>>>0&63)}var o=t.length-n;if(o>0){var i=t[n]<<16|(o===2?t[n+1]<<8:0);r+=this._encodeByte(i>>>18&63),r+=this._encodeByte(i>>>12&63),o===2?r+=this._encodeByte(i>>>6&63):r+=this._paddingCharacter||"",r+=this._paddingCharacter||""}return r},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 r=this._getPaddingLength(t),n=t.length-r,i=new Uint8Array(this.maxDecodedLength(n)),o=0,s=0,a=0,l=0,c=0,u=0,d=0;s<n-4;s+=4)l=this._decodeChar(t.charCodeAt(s+0)),c=this._decodeChar(t.charCodeAt(s+1)),u=this._decodeChar(t.charCodeAt(s+2)),d=this._decodeChar(t.charCodeAt(s+3)),i[o++]=l<<2|c>>>4,i[o++]=c<<4|u>>>2,i[o++]=u<<6|d,a|=l&$e,a|=c&$e,a|=u&$e,a|=d&$e;if(s<n-1&&(l=this._decodeChar(t.charCodeAt(s)),c=this._decodeChar(t.charCodeAt(s+1)),i[o++]=l<<2|c>>>4,a|=l&$e,a|=c&$e),s<n-2&&(u=this._decodeChar(t.charCodeAt(s+2)),i[o++]=c<<4|u>>>2,a|=u&$e),s<n-3&&(d=this._decodeChar(t.charCodeAt(s+3)),i[o++]=u<<6|d,a|=d&$e),a!==0)throw new Error("Base64Coder: incorrect characters for decoding");return i},e.prototype._encodeByte=function(t){var r=t;return r+=65,r+=25-t>>>8&6,r+=51-t>>>8&-75,r+=61-t>>>8&-15,r+=62-t>>>8&3,String.fromCharCode(r)},e.prototype._decodeChar=function(t){var r=$e;return r+=(42-t&t-44)>>>8&-$e+t-43+62,r+=(46-t&t-48)>>>8&-$e+t-47+63,r+=(47-t&t-58)>>>8&-$e+t-48+52,r+=(64-t&t-91)>>>8&-$e+t-65+0,r+=(96-t&t-123)>>>8&-$e+t-97+26,r},e.prototype._getPaddingLength=function(t){var r=0;if(this._paddingCharacter){for(var n=t.length-1;n>=0&&t[n]===this._paddingCharacter;n--)r++;if(t.length<4||r>2)throw new Error("Base64Coder: incorrect padding")}return r},e})();nt.Coder=yl;var Hn=new yl;function ZR(e){return Hn.encode(e)}nt.encode=ZR;function XR(e){return Hn.decode(e)}nt.decode=XR;var Uf=(function(e){YR(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(r){var n=r;return n+=65,n+=25-r>>>8&6,n+=51-r>>>8&-75,n+=61-r>>>8&-13,n+=62-r>>>8&49,String.fromCharCode(n)},t.prototype._decodeChar=function(r){var n=$e;return n+=(44-r&r-46)>>>8&-$e+r-45+62,n+=(94-r&r-96)>>>8&-$e+r-95+63,n+=(47-r&r-58)>>>8&-$e+r-48+52,n+=(64-r&r-91)>>>8&-$e+r-65+0,n+=(96-r&r-123)>>>8&-$e+r-97+26,n},t})(yl);nt.URLSafeCoder=Uf;var Wf=new Uf;function QR(e){return Wf.encode(e)}nt.encodeURLSafe=QR;function eE(e){return Wf.decode(e)}nt.decodeURLSafe=eE;nt.encodedLength=function(e){return Hn.encodedLength(e)};nt.maxDecodedLength=function(e){return Hn.maxDecodedLength(e)};nt.decodedLength=function(e){return Hn.decodedLength(e)}});var Gf=qr((zf,uo)=>{"use strict";(function(e,t){var r={};t(r);var n=r.default;for(var i in r)n[i]=r[i];typeof uo=="object"&&typeof uo.exports=="object"?uo.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(zf,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 r(d,p,h,f,m){for(var g,w,S,y,v,C,M,R,E,x,U,X,Q;m>=64;){for(g=p[0],w=p[1],S=p[2],y=p[3],v=p[4],C=p[5],M=p[6],R=p[7],x=0;x<16;x++)U=f+x*4,d[x]=(h[U]&255)<<24|(h[U+1]&255)<<16|(h[U+2]&255)<<8|h[U+3]&255;for(x=16;x<64;x++)E=d[x-2],X=(E>>>17|E<<15)^(E>>>19|E<<13)^E>>>10,E=d[x-15],Q=(E>>>7|E<<25)^(E>>>18|E<<14)^E>>>3,d[x]=(X+d[x-7]|0)+(Q+d[x-16]|0);for(x=0;x<64;x++)X=(((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&C^~v&M)|0)+(R+(t[x]+d[x]|0)|0)|0,Q=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&w^g&S^w&S)|0,R=M,M=C,C=v,v=y+X|0,y=S,S=w,w=g,g=X+Q|0;p[0]+=g,p[1]+=w,p[2]+=S,p[3]+=y,p[4]+=v,p[5]+=C,p[6]+=M,p[7]+=R,f+=64,m-=64}return f}var n=(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 p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},d.prototype.update=function(p,h){if(h===void 0&&(h=p.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var f=0;if(this.bytesHashed+=h,this.bufferLength>0){for(;this.bufferLength<64&&h>0;)this.buffer[this.bufferLength++]=p[f++],h--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(h>=64&&(f=r(this.temp,this.state,p,f,h),h%=64);h>0;)this.buffer[this.bufferLength++]=p[f++],h--;return this},d.prototype.finish=function(p){if(!this.finished){var h=this.bytesHashed,f=this.bufferLength,m=h/536870912|0,g=h<<3,w=h%64<56?64:128;this.buffer[f]=128;for(var S=f+1;S<w-8;S++)this.buffer[S]=0;this.buffer[w-8]=m>>>24&255,this.buffer[w-7]=m>>>16&255,this.buffer[w-6]=m>>>8&255,this.buffer[w-5]=m>>>0&255,this.buffer[w-4]=g>>>24&255,this.buffer[w-3]=g>>>16&255,this.buffer[w-2]=g>>>8&255,this.buffer[w-1]=g>>>0&255,r(this.temp,this.state,this.buffer,0,w),this.finished=!0}for(var S=0;S<8;S++)p[S*4+0]=this.state[S]>>>24&255,p[S*4+1]=this.state[S]>>>16&255,p[S*4+2]=this.state[S]>>>8&255,p[S*4+3]=this.state[S]>>>0&255;return this},d.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},d.prototype._saveState=function(p){for(var h=0;h<this.state.length;h++)p[h]=this.state[h]},d.prototype._restoreState=function(p,h){for(var f=0;f<this.state.length;f++)this.state[f]=p[f];this.bytesHashed=h,this.finished=!1,this.bufferLength=0},d})();e.Hash=n;var i=(function(){function d(p){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var h=new Uint8Array(this.blockSize);if(p.length>this.blockSize)new n().update(p).finish(h).clean();else for(var f=0;f<p.length;f++)h[f]=p[f];for(var f=0;f<h.length;f++)h[f]^=54;this.inner.update(h);for(var f=0;f<h.length;f++)h[f]^=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 f=0;f<h.length;f++)h[f]=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 p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},d.prototype.update=function(p){return this.inner.update(p),this},d.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},d.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},d})();e.HMAC=i;function o(d){var p=new n().update(d),h=p.digest();return p.clean(),h}e.hash=o,e.default=o;function s(d,p){var h=new i(d).update(p),f=h.digest();return h.clean(),f}e.hmac=s;function a(d,p,h,f){var m=f[0];if(m===0)throw new Error("hkdf: cannot expand more");p.reset(),m>1&&p.update(d),h&&p.update(h),p.update(f),p.finish(d),f[0]++}var l=new Uint8Array(e.digestLength);function c(d,p,h,f){p===void 0&&(p=l),f===void 0&&(f=32);for(var m=new Uint8Array([1]),g=s(p,d),w=new i(g),S=new Uint8Array(w.digestLength),y=S.length,v=new Uint8Array(f),C=0;C<f;C++)y===S.length&&(a(S,w,h,m),y=0),v[C]=S[y++];return w.clean(),S.fill(0),m.fill(0),v}e.hkdf=c;function u(d,p,h,f){for(var m=new i(d),g=m.digestLength,w=new Uint8Array(4),S=new Uint8Array(g),y=new Uint8Array(g),v=new Uint8Array(f),C=0;C*g<f;C++){var M=C+1;w[0]=M>>>24&255,w[1]=M>>>16&255,w[2]=M>>>8&255,w[3]=M>>>0&255,m.reset(),m.update(p),m.update(w),m.finish(y);for(var R=0;R<g;R++)S[R]=y[R];for(var R=2;R<=h;R++){m.reset(),m.update(y).finish(y);for(var E=0;E<g;E++)S[E]^=y[E]}for(var R=0;R<g&&C*g+R<f;R++)v[C*g+R]=S[R]}for(var C=0;C<g;C++)S[C]=y[C]=0;for(var C=0;C<4;C++)w[C]=0;return m.clean(),v}e.pbkdf2=u})});var wl=qr(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.Webhook=Kr.WebhookVerificationError=void 0;var tE=Vf(),qf=Hf(),rE=Gf(),Kf=300,bl=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},nr=class e extends bl{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Kr.WebhookVerificationError=nr;var po=class e{constructor(t,r){if(!t)throw new Error("Secret can't be empty.");if(r?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,n=>n.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=qf.decode(t)}}verify(t,r){let n={};for(let p of Object.keys(r))n[p.toLowerCase()]=r[p];let i=n["webhook-id"],o=n["webhook-signature"],s=n["webhook-timestamp"];if(!o||!i||!s)throw new nr("Missing required headers");let a=this.verifyTimestamp(s),c=this.sign(i,a,t).split(",")[1],u=o.split(" "),d=new globalThis.TextEncoder;for(let p of u){let[h,f]=p.split(",");if(h==="v1"&&(0,tE.timingSafeEqual)(d.encode(f),d.encode(c)))return JSON.parse(t.toString())}throw new nr("No matching signature found")}sign(t,r,n){if(typeof n!="string")if(n.constructor.name==="Buffer")n=n.toString();else throw new Error("Expected payload to be of type string or Buffer.");let i=new TextEncoder,o=Math.floor(r.getTime()/1e3),s=i.encode(`${t}.${o}.${n}`);return`v1,${qf.encode(rE.hmac(this.key,s))}`}verifyTimestamp(t){let r=Math.floor(Date.now()/1e3),n=parseInt(t,10);if(isNaN(n))throw new nr("Invalid Signature Headers");if(r-n>Kf)throw new nr("Message timestamp too old");if(n>r+Kf)throw new nr("Message timestamp too new");return new Date(n*1e3)}};Kr.Webhook=po;po.prefix="whsec_"});var Sm=qr((sc,wm)=>{"use strict";var{hasOwnProperty:Qn}=Object.prototype,Nr=oc();Nr.configure=oc;Nr.stringify=Nr;Nr.default=Nr;sc.stringify=Nr;sc.configure=oc;wm.exports=Nr;var eA=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function ur(e){return e.length<5e3&&!eA.test(e)?`"${e}"`:JSON.stringify(e)}function nc(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.length;r++){let n=e[r],i=r;for(;i!==0&&e[i-1]>n;)e[i]=e[i-1],i--;e[i]=n}return e}var tA=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function ic(e){return tA.call(e)!==void 0&&e.length!==0}function ym(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",i=`"0":${n}${e[0]}`;for(let o=1;o<r;o++)i+=`${t}"${o}":${n}${e[o]}`;return i}function rA(e){if(Qn.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 nA(e){let t;if(Qn.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 iA(e,t){let r;if(Qn.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function bm(e,t){let r;if(Qn.call(e,t)){if(r=e[t],typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function Mr(e){return e===1?"1 item":`${e} items`}function oA(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function sA(e){if(Qn.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 r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function oc(e){e={...e};let t=sA(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=rA(e),n=iA(e,"bigint"),i=nA(e),o=typeof i=="function"?i:void 0,s=bm(e,"maximumDepth"),a=bm(e,"maximumBreadth");function l(h,f,m,g,w,S){let y=f[h];switch(typeof y=="object"&&y!==null&&typeof y.toJSON=="function"&&(y=y.toJSON(h)),y=g.call(f,h,y),typeof y){case"string":return ur(y);case"object":{if(y===null)return"null";if(m.indexOf(y)!==-1)return r;let v="",C=",",M=S;if(Array.isArray(y)){if(y.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(y),w!==""&&(S+=w,v+=`
|
|
2
|
+
var vR=Object.create;var Lf=Object.defineProperty;var xR=Object.getOwnPropertyDescriptor;var kR=Object.getOwnPropertyNames;var CR=Object.getPrototypeOf,RR=Object.prototype.hasOwnProperty;var qr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ER=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kR(t))!RR.call(e,i)&&i!==r&&Lf(e,i,{get:()=>t[i],enumerable:!(n=xR(t,i))||n.enumerable});return e};var so=(e,t,r)=>(r=e!=null?vR(CR(e)):{},ER(t||!e||!e.__esModule?Lf(r,"default",{value:e,enumerable:!0}):r,e));var Uf=qr(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.timingSafeEqual=void 0;function Vf(e,t=""){if(!e)throw new Error(t)}function nE(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)),Vf(e instanceof DataView),Vf(t instanceof DataView);let r=e.byteLength,n=0,i=-1;for(;++i<r;)n|=e.getUint8(i)^t.getUint8(i);return n===0}co.timingSafeEqual=nE});var zf=qr(nt=>{"use strict";var iE=nt&&nt.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(nt,"__esModule",{value:!0});var $e=256,yl=(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 r="",n=0;n<t.length-2;n+=3){var i=t[n]<<16|t[n+1]<<8|t[n+2];r+=this._encodeByte(i>>>18&63),r+=this._encodeByte(i>>>12&63),r+=this._encodeByte(i>>>6&63),r+=this._encodeByte(i>>>0&63)}var o=t.length-n;if(o>0){var i=t[n]<<16|(o===2?t[n+1]<<8:0);r+=this._encodeByte(i>>>18&63),r+=this._encodeByte(i>>>12&63),o===2?r+=this._encodeByte(i>>>6&63):r+=this._paddingCharacter||"",r+=this._paddingCharacter||""}return r},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 r=this._getPaddingLength(t),n=t.length-r,i=new Uint8Array(this.maxDecodedLength(n)),o=0,s=0,a=0,l=0,c=0,u=0,d=0;s<n-4;s+=4)l=this._decodeChar(t.charCodeAt(s+0)),c=this._decodeChar(t.charCodeAt(s+1)),u=this._decodeChar(t.charCodeAt(s+2)),d=this._decodeChar(t.charCodeAt(s+3)),i[o++]=l<<2|c>>>4,i[o++]=c<<4|u>>>2,i[o++]=u<<6|d,a|=l&$e,a|=c&$e,a|=u&$e,a|=d&$e;if(s<n-1&&(l=this._decodeChar(t.charCodeAt(s)),c=this._decodeChar(t.charCodeAt(s+1)),i[o++]=l<<2|c>>>4,a|=l&$e,a|=c&$e),s<n-2&&(u=this._decodeChar(t.charCodeAt(s+2)),i[o++]=c<<4|u>>>2,a|=u&$e),s<n-3&&(d=this._decodeChar(t.charCodeAt(s+3)),i[o++]=u<<6|d,a|=d&$e),a!==0)throw new Error("Base64Coder: incorrect characters for decoding");return i},e.prototype._encodeByte=function(t){var r=t;return r+=65,r+=25-t>>>8&6,r+=51-t>>>8&-75,r+=61-t>>>8&-15,r+=62-t>>>8&3,String.fromCharCode(r)},e.prototype._decodeChar=function(t){var r=$e;return r+=(42-t&t-44)>>>8&-$e+t-43+62,r+=(46-t&t-48)>>>8&-$e+t-47+63,r+=(47-t&t-58)>>>8&-$e+t-48+52,r+=(64-t&t-91)>>>8&-$e+t-65+0,r+=(96-t&t-123)>>>8&-$e+t-97+26,r},e.prototype._getPaddingLength=function(t){var r=0;if(this._paddingCharacter){for(var n=t.length-1;n>=0&&t[n]===this._paddingCharacter;n--)r++;if(t.length<4||r>2)throw new Error("Base64Coder: incorrect padding")}return r},e})();nt.Coder=yl;var Hn=new yl;function oE(e){return Hn.encode(e)}nt.encode=oE;function sE(e){return Hn.decode(e)}nt.decode=sE;var Wf=(function(e){iE(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(r){var n=r;return n+=65,n+=25-r>>>8&6,n+=51-r>>>8&-75,n+=61-r>>>8&-13,n+=62-r>>>8&49,String.fromCharCode(n)},t.prototype._decodeChar=function(r){var n=$e;return n+=(44-r&r-46)>>>8&-$e+r-45+62,n+=(94-r&r-96)>>>8&-$e+r-95+63,n+=(47-r&r-58)>>>8&-$e+r-48+52,n+=(64-r&r-91)>>>8&-$e+r-65+0,n+=(96-r&r-123)>>>8&-$e+r-97+26,n},t})(yl);nt.URLSafeCoder=Wf;var Hf=new Wf;function aE(e){return Hf.encode(e)}nt.encodeURLSafe=aE;function lE(e){return Hf.decode(e)}nt.decodeURLSafe=lE;nt.encodedLength=function(e){return Hn.encodedLength(e)};nt.maxDecodedLength=function(e){return Hn.maxDecodedLength(e)};nt.decodedLength=function(e){return Hn.decodedLength(e)}});var qf=qr((Gf,uo)=>{"use strict";(function(e,t){var r={};t(r);var n=r.default;for(var i in r)n[i]=r[i];typeof uo=="object"&&typeof uo.exports=="object"?uo.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(Gf,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 r(d,p,h,f,m){for(var g,w,S,y,v,C,M,R,E,x,U,X,Q;m>=64;){for(g=p[0],w=p[1],S=p[2],y=p[3],v=p[4],C=p[5],M=p[6],R=p[7],x=0;x<16;x++)U=f+x*4,d[x]=(h[U]&255)<<24|(h[U+1]&255)<<16|(h[U+2]&255)<<8|h[U+3]&255;for(x=16;x<64;x++)E=d[x-2],X=(E>>>17|E<<15)^(E>>>19|E<<13)^E>>>10,E=d[x-15],Q=(E>>>7|E<<25)^(E>>>18|E<<14)^E>>>3,d[x]=(X+d[x-7]|0)+(Q+d[x-16]|0);for(x=0;x<64;x++)X=(((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&C^~v&M)|0)+(R+(t[x]+d[x]|0)|0)|0,Q=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&w^g&S^w&S)|0,R=M,M=C,C=v,v=y+X|0,y=S,S=w,w=g,g=X+Q|0;p[0]+=g,p[1]+=w,p[2]+=S,p[3]+=y,p[4]+=v,p[5]+=C,p[6]+=M,p[7]+=R,f+=64,m-=64}return f}var n=(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 p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},d.prototype.update=function(p,h){if(h===void 0&&(h=p.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var f=0;if(this.bytesHashed+=h,this.bufferLength>0){for(;this.bufferLength<64&&h>0;)this.buffer[this.bufferLength++]=p[f++],h--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(h>=64&&(f=r(this.temp,this.state,p,f,h),h%=64);h>0;)this.buffer[this.bufferLength++]=p[f++],h--;return this},d.prototype.finish=function(p){if(!this.finished){var h=this.bytesHashed,f=this.bufferLength,m=h/536870912|0,g=h<<3,w=h%64<56?64:128;this.buffer[f]=128;for(var S=f+1;S<w-8;S++)this.buffer[S]=0;this.buffer[w-8]=m>>>24&255,this.buffer[w-7]=m>>>16&255,this.buffer[w-6]=m>>>8&255,this.buffer[w-5]=m>>>0&255,this.buffer[w-4]=g>>>24&255,this.buffer[w-3]=g>>>16&255,this.buffer[w-2]=g>>>8&255,this.buffer[w-1]=g>>>0&255,r(this.temp,this.state,this.buffer,0,w),this.finished=!0}for(var S=0;S<8;S++)p[S*4+0]=this.state[S]>>>24&255,p[S*4+1]=this.state[S]>>>16&255,p[S*4+2]=this.state[S]>>>8&255,p[S*4+3]=this.state[S]>>>0&255;return this},d.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},d.prototype._saveState=function(p){for(var h=0;h<this.state.length;h++)p[h]=this.state[h]},d.prototype._restoreState=function(p,h){for(var f=0;f<this.state.length;f++)this.state[f]=p[f];this.bytesHashed=h,this.finished=!1,this.bufferLength=0},d})();e.Hash=n;var i=(function(){function d(p){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var h=new Uint8Array(this.blockSize);if(p.length>this.blockSize)new n().update(p).finish(h).clean();else for(var f=0;f<p.length;f++)h[f]=p[f];for(var f=0;f<h.length;f++)h[f]^=54;this.inner.update(h);for(var f=0;f<h.length;f++)h[f]^=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 f=0;f<h.length;f++)h[f]=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 p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},d.prototype.update=function(p){return this.inner.update(p),this},d.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},d.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},d})();e.HMAC=i;function o(d){var p=new n().update(d),h=p.digest();return p.clean(),h}e.hash=o,e.default=o;function s(d,p){var h=new i(d).update(p),f=h.digest();return h.clean(),f}e.hmac=s;function a(d,p,h,f){var m=f[0];if(m===0)throw new Error("hkdf: cannot expand more");p.reset(),m>1&&p.update(d),h&&p.update(h),p.update(f),p.finish(d),f[0]++}var l=new Uint8Array(e.digestLength);function c(d,p,h,f){p===void 0&&(p=l),f===void 0&&(f=32);for(var m=new Uint8Array([1]),g=s(p,d),w=new i(g),S=new Uint8Array(w.digestLength),y=S.length,v=new Uint8Array(f),C=0;C<f;C++)y===S.length&&(a(S,w,h,m),y=0),v[C]=S[y++];return w.clean(),S.fill(0),m.fill(0),v}e.hkdf=c;function u(d,p,h,f){for(var m=new i(d),g=m.digestLength,w=new Uint8Array(4),S=new Uint8Array(g),y=new Uint8Array(g),v=new Uint8Array(f),C=0;C*g<f;C++){var M=C+1;w[0]=M>>>24&255,w[1]=M>>>16&255,w[2]=M>>>8&255,w[3]=M>>>0&255,m.reset(),m.update(p),m.update(w),m.finish(y);for(var R=0;R<g;R++)S[R]=y[R];for(var R=2;R<=h;R++){m.reset(),m.update(y).finish(y);for(var E=0;E<g;E++)S[E]^=y[E]}for(var R=0;R<g&&C*g+R<f;R++)v[C*g+R]=S[R]}for(var C=0;C<g;C++)S[C]=y[C]=0;for(var C=0;C<4;C++)w[C]=0;return m.clean(),v}e.pbkdf2=u})});var wl=qr(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.Webhook=Kr.WebhookVerificationError=void 0;var cE=Uf(),Kf=zf(),uE=qf(),Jf=300,bl=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},nr=class e extends bl{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Kr.WebhookVerificationError=nr;var po=class e{constructor(t,r){if(!t)throw new Error("Secret can't be empty.");if(r?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,n=>n.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=Kf.decode(t)}}verify(t,r){let n={};for(let p of Object.keys(r))n[p.toLowerCase()]=r[p];let i=n["webhook-id"],o=n["webhook-signature"],s=n["webhook-timestamp"];if(!o||!i||!s)throw new nr("Missing required headers");let a=this.verifyTimestamp(s),c=this.sign(i,a,t).split(",")[1],u=o.split(" "),d=new globalThis.TextEncoder;for(let p of u){let[h,f]=p.split(",");if(h==="v1"&&(0,cE.timingSafeEqual)(d.encode(f),d.encode(c)))return JSON.parse(t.toString())}throw new nr("No matching signature found")}sign(t,r,n){if(typeof n!="string")if(n.constructor.name==="Buffer")n=n.toString();else throw new Error("Expected payload to be of type string or Buffer.");let i=new TextEncoder,o=Math.floor(r.getTime()/1e3),s=i.encode(`${t}.${o}.${n}`);return`v1,${Kf.encode(uE.hmac(this.key,s))}`}verifyTimestamp(t){let r=Math.floor(Date.now()/1e3),n=parseInt(t,10);if(isNaN(n))throw new nr("Invalid Signature Headers");if(r-n>Jf)throw new nr("Message timestamp too old");if(n>r+Jf)throw new nr("Message timestamp too new");return new Date(n*1e3)}};Kr.Webhook=po;po.prefix="whsec_"});var vm=qr((sc,Sm)=>{"use strict";var{hasOwnProperty:Qn}=Object.prototype,Nr=oc();Nr.configure=oc;Nr.stringify=Nr;Nr.default=Nr;sc.stringify=Nr;sc.configure=oc;Sm.exports=Nr;var lA=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function ur(e){return e.length<5e3&&!lA.test(e)?`"${e}"`:JSON.stringify(e)}function nc(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.length;r++){let n=e[r],i=r;for(;i!==0&&e[i-1]>n;)e[i]=e[i-1],i--;e[i]=n}return e}var cA=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function ic(e){return cA.call(e)!==void 0&&e.length!==0}function bm(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",i=`"0":${n}${e[0]}`;for(let o=1;o<r;o++)i+=`${t}"${o}":${n}${e[o]}`;return i}function uA(e){if(Qn.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 dA(e){let t;if(Qn.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 pA(e,t){let r;if(Qn.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function wm(e,t){let r;if(Qn.call(e,t)){if(r=e[t],typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function Mr(e){return e===1?"1 item":`${e} items`}function fA(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function hA(e){if(Qn.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 r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function oc(e){e={...e};let t=hA(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=uA(e),n=pA(e,"bigint"),i=dA(e),o=typeof i=="function"?i:void 0,s=wm(e,"maximumDepth"),a=wm(e,"maximumBreadth");function l(h,f,m,g,w,S){let y=f[h];switch(typeof y=="object"&&y!==null&&typeof y.toJSON=="function"&&(y=y.toJSON(h)),y=g.call(f,h,y),typeof y){case"string":return ur(y);case"object":{if(y===null)return"null";if(m.indexOf(y)!==-1)return r;let v="",C=",",M=S;if(Array.isArray(y)){if(y.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(y),w!==""&&(S+=w,v+=`
|
|
3
3
|
${S}`,C=`,
|
|
4
|
-
${S}`);let Q=Math.min(y.length,a),
|
|
4
|
+
${S}`);let Q=Math.min(y.length,a),B=0;for(;B<Q-1;B++){let Rt=l(String(B),y,m,g,w,S);v+=Rt!==void 0?Rt:"null",v+=C}let Ge=l(String(B),y,m,g,w,S);if(v+=Ge!==void 0?Ge:"null",y.length-1>a){let Rt=y.length-a-1;v+=`${C}"... ${Mr(Rt)} not stringified"`}return w!==""&&(v+=`
|
|
5
5
|
${M}`),m.pop(),`[${v}]`}let R=Object.keys(y),E=R.length;if(E===0)return"{}";if(s<m.length+1)return'"[Object]"';let x="",U="";w!==""&&(S+=w,C=`,
|
|
6
|
-
${S}`,x=" ");let X=Math.min(E,a);i&&!ic(y)&&(R=nc(R,o)),m.push(y);for(let Q=0;Q<X;Q++){let
|
|
6
|
+
${S}`,x=" ");let X=Math.min(E,a);i&&!ic(y)&&(R=nc(R,o)),m.push(y);for(let Q=0;Q<X;Q++){let B=R[Q],Ge=l(B,y,m,g,w,S);Ge!==void 0&&(v+=`${U}${ur(B)}:${x}${Ge}`,U=C)}if(E>a){let Q=E-a;v+=`${U}"...":${x}"${Mr(Q)} not stringified"`,U=C}return w!==""&&U.length>1&&(v=`
|
|
7
7
|
${S}${v}
|
|
8
8
|
${M}`),m.pop(),`{${v}}`}case"number":return isFinite(y)?String(y):t?t(y):"null";case"boolean":return y===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(y);default:return t?t(y):void 0}}function c(h,f,m,g,w,S){switch(typeof f=="object"&&f!==null&&typeof f.toJSON=="function"&&(f=f.toJSON(h)),typeof f){case"string":return ur(f);case"object":{if(f===null)return"null";if(m.indexOf(f)!==-1)return r;let y=S,v="",C=",";if(Array.isArray(f)){if(f.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(f),w!==""&&(S+=w,v+=`
|
|
9
9
|
${S}`,C=`,
|
|
@@ -13,58 +13,58 @@ ${S}`,M=" ");let R="";for(let E of g){let x=c(E,f[E],m,g,w,S);x!==void 0&&(v+=`$
|
|
|
13
13
|
${S}${v}
|
|
14
14
|
${y}`),m.pop(),`{${v}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return t?t(f):void 0}}function u(h,f,m,g,w){switch(typeof f){case"string":return ur(f);case"object":{if(f===null)return"null";if(typeof f.toJSON=="function"){if(f=f.toJSON(h),typeof f!="object")return u(h,f,m,g,w);if(f===null)return"null"}if(m.indexOf(f)!==-1)return r;let S=w;if(Array.isArray(f)){if(f.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(f),w+=g;let x=`
|
|
15
15
|
${w}`,U=`,
|
|
16
|
-
${w}`,X=Math.min(f.length,a),Q=0;for(;Q<X-1;Q++){let Ge=u(String(Q),f[Q],m,g,w);x+=Ge!==void 0?Ge:"null",x+=U}let
|
|
16
|
+
${w}`,X=Math.min(f.length,a),Q=0;for(;Q<X-1;Q++){let Ge=u(String(Q),f[Q],m,g,w);x+=Ge!==void 0?Ge:"null",x+=U}let B=u(String(Q),f[Q],m,g,w);if(x+=B!==void 0?B:"null",f.length-1>a){let Ge=f.length-a-1;x+=`${U}"... ${Mr(Ge)} not stringified"`}return x+=`
|
|
17
17
|
${S}`,m.pop(),`[${x}]`}let y=Object.keys(f),v=y.length;if(v===0)return"{}";if(s<m.length+1)return'"[Object]"';w+=g;let C=`,
|
|
18
|
-
${w}`,M="",R="",E=Math.min(v,a);ic(f)&&(M+=
|
|
18
|
+
${w}`,M="",R="",E=Math.min(v,a);ic(f)&&(M+=bm(f,C,a),y=y.slice(f.length),E-=f.length,R=C),i&&(y=nc(y,o)),m.push(f);for(let x=0;x<E;x++){let U=y[x],X=u(U,f[U],m,g,w);X!==void 0&&(M+=`${R}${ur(U)}: ${X}`,R=C)}if(v>a){let x=v-a;M+=`${R}"...": "${Mr(x)} not stringified"`,R=C}return R!==""&&(M=`
|
|
19
19
|
${w}${M}
|
|
20
|
-
${S}`),m.pop(),`{${M}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return t?t(f):void 0}}function d(h,f,m){switch(typeof f){case"string":return ur(f);case"object":{if(f===null)return"null";if(typeof f.toJSON=="function"){if(f=f.toJSON(h),typeof f!="object")return d(h,f,m);if(f===null)return"null"}if(m.indexOf(f)!==-1)return r;let g="",w=f.length!==void 0;if(w&&Array.isArray(f)){if(f.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(f);let M=Math.min(f.length,a),R=0;for(;R<M-1;R++){let x=d(String(R),f[R],m);g+=x!==void 0?x:"null",g+=","}let E=d(String(R),f[R],m);if(g+=E!==void 0?E:"null",f.length-1>a){let x=f.length-a-1;g+=`,"... ${Mr(x)} not stringified"`}return m.pop(),`[${g}]`}let S=Object.keys(f),y=S.length;if(y===0)return"{}";if(s<m.length+1)return'"[Object]"';let v="",C=Math.min(y,a);w&&ic(f)&&(g+=
|
|
21
|
-
`),t}function
|
|
22
|
-
`,{mode:384})}function ml(){let e=
|
|
23
|
-
`)}function sE(e){return e.length!==kl.length?!1:e.every((t,r)=>t===kl[r])}function Jr(e){let r=El(e)?.envFiles??[".env",".env.local"],n=yo.join(e,".ripplo");r.forEach(i=>{let o=yo.resolve(n,i);eh.existsSync(o)&&aE({override:!0,path:o,quiet:!0})}),go=void 0}var cE=mo.object({RIPPLO_APP_URL:mo.url(),RIPPLO_ENGINE_URL:mo.url(),RIPPLO_WEBHOOK_SECRET:mo.string().min(1)}),go;function Yr(){return go!=null?th(go):uE().map(e=>(go=e,e))}function Il(e){let r=El(e)?.envFiles??[],n=yo.join(e,".ripplo");return r.map(i=>yo.resolve(n,i)).filter(i=>!eh.existsSync(i))}function uE(){let e=cE.safeParse(process.env);if(!e.success)return lE({issues:e.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"env-invalid",missingEnvFiles:Il(process.cwd())});let t=e.data;return th({appUrl:t.RIPPLO_APP_URL,engineUrl:t.RIPPLO_ENGINE_URL,webhookSecret:t.RIPPLO_WEBHOOK_SECRET})}import uz from"yargs";import{hideBin as dz}from"yargs/helpers";import{readFileSync as dE}from"fs";import{z as rh}from"zod";var pE=rh.object({version:rh.string()});function nh(){let e=dE(new URL("../package.json",import.meta.url),"utf8");return pE.parse(JSON.parse(e)).version}var bo=class extends Error{failure;constructor(t){super(t.kind),this.name="CliError",this.failure=t}};import Gl from"fs";import Io from"path";import{createJiti as DE}from"jiti";import{err as Ao,ok as xh}from"neverthrow";import{z as I}from"zod";var Al=I.enum(["fast","slow","async"]),Zr=I.object({ref:I.string().min(1)}),ir=I.union([I.string(),I.number(),I.boolean()]),Pl=I.object({template:I.array(I.union([I.string(),Zr])).min(1)}),Qe=I.union([Zr,ir,Pl,I.null()]),ih=I.object({kind:I.literal("changed")}),Tl=I.union([Qe,ih]),Dt=I.union([I.string(),Zr,Pl]),fE=I.object({by:I.literal("role"),name:I.union([Dt,I.undefined()]).optional().transform(e=>e),role:I.string().min(1)}),hE=I.object({by:I.literal("testId"),value:Dt}),mE=I.object({by:I.literal("inside"),scope:I.lazy(()=>Pe),target:I.lazy(()=>Pe)}),Pe=I.discriminatedUnion("by",[fE,hE,mE]),wo=I.enum(["string","number","boolean"]),Ol=I.enum(["strict","eventual"]),gE=I.object({kind:I.literal("string"),maxLength:I.number().int().positive().optional(),minLength:I.number().int().nonnegative().optional(),pattern:I.string().optional()}),yE=I.object({kind:I.literal("number"),max:I.number().int().optional(),min:I.number().int().optional()}),bE=I.object({kind:I.literal("datetime"),maxOffsetDays:I.number().int(),minOffsetDays:I.number().int()}),oh=I.discriminatedUnion("kind",[gE,yE,bE]),sh=I.enum(["company.name","date.iso","internet.email","internet.url","person.fullName","lorem.slug","lorem.word"]),Ml=I.object({constraints:oh.optional(),generator:sh,name:I.string().min(1),type:wo,values:I.array(ir).min(1).optional()}),ah=I.object({consistency:Ol.default("strict"),optional:I.boolean(),stable:I.boolean(),type:wo,valueSpace:I.string().min(1).optional()}),Nl=I.enum(["backend","client"]),Ll=I.object({description:I.string().optional(),identity:I.array(I.string().min(1)).min(1),identityKind:I.enum(["surrogate","natural"]),name:I.string().min(1),props:I.record(I.string().min(1),ah),source:Nl.default("backend")}),$l=I.object({consistency:Ol.default("strict"),default:ir,description:I.string().optional(),name:I.string().min(1),source:Nl.default("backend"),type:wo,valueSpace:I.string().min(1).optional()}),_t=I.enum(["url","title","viewport"]);import{z as T}from"zod";var wE=T.discriminatedUnion("kind",[T.object({as:T.string().min(1),kind:T.literal("created"),props:T.record(T.string().min(1),Qe)}),T.object({as:T.string().min(1),kind:T.literal("updated"),props:T.record(T.string().min(1),Tl)}),T.object({kind:T.literal("deleted")})]),SE=T.object({kind:T.literal("is"),value:Qe}),lh=T.lazy(()=>T.union([Qe,xE])),vE=T.object({entity:T.string().min(1),where:T.record(T.string().min(1),lh)}),xE=T.object({field:T.string().min(1),kind:T.literal("within"),selection:vE}),jt=T.union([Al,T.undefined()]).optional().transform(e=>e),or=T.lazy(()=>T.discriminatedUnion("kind",[T.object({kind:T.literal("visible"),locator:Pe,wait:jt}),T.object({kind:T.literal("disabled"),locator:Pe,wait:jt}),T.object({kind:T.literal("enabled"),locator:Pe,wait:jt}),T.object({kind:T.literal("focused"),locator:Pe,wait:jt}),T.object({kind:T.literal("value"),locator:Pe,value:Dt,wait:jt}),T.object({kind:T.literal("text"),locator:Pe,value:Dt,wait:jt}),T.object({assertion:SE,kind:T.literal("singleton"),singleton:T.string().min(1),wait:jt}),T.object({kind:T.literal("browser"),name:_t,value:Dt,wait:jt}),T.object({assertion:wE,entity:T.string().min(1),key:T.record(T.string().min(1),lh),kind:T.literal("state"),wait:jt}),T.object({kind:T.literal("not"),predicate:or}),T.object({kind:T.literal("and"),predicates:T.array(or)}),T.object({entity:T.string().min(1),kind:T.literal("count"),value:T.number().int().nonnegative()}),T.object({condition:or,consequence:or,kind:T.literal("when"),otherwise:T.union([or,T.undefined()]).optional().transform(e=>e)})]));import{z as So}from"zod";var kE=So.object({__codec:So.string().min(1),data:So.unknown(),version:So.number().int().positive()}),vo=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}},xo=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}};function Dl({name:e,schema:t}){return{currentVersion:1,name:e,decode:r=>CE({name:e,raw:r,schema:t}),encode:r=>({__codec:e,data:r,version:1})}}function Ft(e,t){return JSON.stringify(e.encode(t))}function _l(e,t){let r=JSON.parse(t);return e.decode(r)}function CE({name:e,raw:t,schema:r}){let n=kE.parse(t);if(n.__codec!==e)throw new xo({expected:e,got:n.__codec});if(n.version!==1)throw new vo({codec:e,currentVersion:1,gotVersion:n.version});return r.parse(n.data)}var ko="__ripplo__",jl="__ripplo_seed__";import{z as P}from"zod";var ch=P.discriminatedUnion("kind",[P.object({kind:P.literal("goto"),url:Dt}),P.object({kind:P.literal("fill"),locator:Pe,value:Qe}),P.object({kind:P.literal("clear"),locator:Pe}),P.object({kind:P.literal("click"),locator:Pe}),P.object({kind:P.literal("dblclick"),locator:Pe}),P.object({kind:P.literal("select"),locator:Pe,value:Qe}),P.object({kind:P.literal("check"),locator:Pe}),P.object({kind:P.literal("uncheck"),locator:Pe}),P.object({kind:P.literal("hover"),locator:Pe}),P.object({files:P.array(P.string().min(1)).min(1),kind:P.literal("upload"),locator:Pe}),P.object({key:P.string().min(1),kind:P.literal("press"),locator:Pe.optional()})]),uh=P.object({action:ch,expect:P.array(or).default([])}),dh=P.object({example:ir.optional(),valueSpace:P.string().min(1)}),Fl=P.object({as:P.string().min(1),entity:P.string().min(1),set:P.record(P.string().min(1),Qe)}),ph=P.object({entity:P.string().min(1),where:P.record(P.string().min(1),Qe)}),fh=P.object({absent:P.array(ph).default([]),exclusive:P.array(P.string().min(1)).default([]),intent:P.string().min(1),maybe:P.array(Fl).default([]),name:P.string().min(1),params:P.record(P.string().min(1),dh),singletons:P.record(P.string().min(1),Qe).default({}),sourcePath:P.string().min(1).optional(),steps:P.array(uh).default([]),stub:P.boolean().default(!1),world:P.array(Fl).default([])}),hh=P.object({sha256:P.string().regex(/^[0-9a-f]{64}$/u),size:P.number().int().nonnegative()}),Co=P.object({entities:P.array(Ll),fixtures:P.record(P.string().min(1),hh).default({}),singletons:P.array($l).default([]),tests:P.array(fh),valueSpaces:P.array(Ml)}),ht=Dl({name:"ripplo-lockfile",schema:Co});import{z as sr}from"zod";var mh=sr.object({index:sr.number().int().nonnegative(),kind:sr.string(),target:sr.string(),value:sr.string()}),RE=sr.object({steps:sr.array(mh),stub:sr.boolean().default(!1)});function zn(e,t){return{index:t,kind:e.action.kind,target:EE(e.action),value:IE(e.action)}}function ge(e){return e.toLowerCase().replaceAll(/[^a-z0-9]/g,"-").split("-").filter(t=>t.length>0).join("-")}function EE(e){return e.kind==="goto"?Ro(e.url):e.kind==="press"&&e.locator==null?"":Eo(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 Eo(e){return e.by==="testId"?`testId=${Ro(e.value)}`:e.by==="inside"?`${Eo(e.scope)} \u25B8 ${Eo(e.target)}`:`${e.role} ${e.name==null?"":Ro(e.name)}`.trim()}function IE(e){return e.kind==="fill"||e.kind==="select"?AE(e.value):e.kind==="press"?e.key:""}function AE(e){return e==null?"":typeof e!="object"?String(e):Ro(e)}import{z as Te}from"zod";var gh=Te.enum(["Strict","Lax","None"]),yh=Te.object({domain:Te.string().min(1),expires:Te.number(),httpOnly:Te.boolean(),name:Te.string().min(1),path:Te.string().min(1),sameSite:gh,secure:Te.boolean(),value:Te.string()}),bh=Te.object({localStorage:Te.array(Te.object({name:Te.string().min(1),value:Te.string()})),origin:Te.string().min(1)}),Bl=Te.object({cookies:Te.array(yh),headers:Te.record(Te.string().min(1),Te.string()).optional(),origins:Te.array(bh)});import{z as J}from"zod";var Vl=J.union([ir,J.null()]),Ul=J.record(J.string().min(1),Vl),wh=J.object({as:J.string().min(1),entity:J.string().min(1),fields:J.record(J.string().min(1),Qe)}),PE=J.object({entities:J.array(wh),runId:J.string().min(1),singletons:J.record(J.string().min(1),Vl).default({})}),Sh=J.object({as:J.string().min(1),row:Ul,session:Bl.optional()}),Wl=J.object({rows:J.array(Sh)}),TE=J.object({entities:J.array(J.string().min(1)),runId:J.string().min(1),singletons:J.array(J.string().min(1)).default([])}),Hl=J.object({entities:J.record(J.string().min(1),J.array(Ul)),singletons:J.record(J.string().min(1),Vl).default({})}),OE=J.object({runId:J.string().min(1)}),zl=J.object({ok:J.literal(!0)});import ME from"fs";import Gn from"path";import Xr from"typescript";function vh(e){let t=Gn.join(e,"index.ts"),r=$E(e);ME.mkdirSync(Gn.dirname(r.tsBuildInfoFile??""),{recursive:!0});let n=Xr.createIncrementalCompilerHost(r),i=Xr.createIncrementalProgram({host:n,options:r,rootNames:[t]}),o=[...i.getSyntacticDiagnostics(),...i.getSemanticDiagnostics()];i.emit();let s=o.filter(c=>NE(c,e));if(s.length===0)return{diagnostics:[],ok:!0};let a={getCanonicalFileName:c=>c,getCurrentDirectory:()=>Gn.dirname(e),getNewLine:()=>`
|
|
20
|
+
${S}`),m.pop(),`{${M}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return t?t(f):void 0}}function d(h,f,m){switch(typeof f){case"string":return ur(f);case"object":{if(f===null)return"null";if(typeof f.toJSON=="function"){if(f=f.toJSON(h),typeof f!="object")return d(h,f,m);if(f===null)return"null"}if(m.indexOf(f)!==-1)return r;let g="",w=f.length!==void 0;if(w&&Array.isArray(f)){if(f.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(f);let M=Math.min(f.length,a),R=0;for(;R<M-1;R++){let x=d(String(R),f[R],m);g+=x!==void 0?x:"null",g+=","}let E=d(String(R),f[R],m);if(g+=E!==void 0?E:"null",f.length-1>a){let x=f.length-a-1;g+=`,"... ${Mr(x)} not stringified"`}return m.pop(),`[${g}]`}let S=Object.keys(f),y=S.length;if(y===0)return"{}";if(s<m.length+1)return'"[Object]"';let v="",C=Math.min(y,a);w&&ic(f)&&(g+=bm(f,",",a),S=S.slice(f.length),C-=f.length,v=","),i&&(S=nc(S,o)),m.push(f);for(let M=0;M<C;M++){let R=S[M],E=d(R,f[R],m);E!==void 0&&(g+=`${v}${ur(R)}:${E}`,v=",")}if(y>a){let M=y-a;g+=`${v}"...":"${Mr(M)} not stringified"`}return m.pop(),`{${g}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return t?t(f):void 0}}function p(h,f,m){if(arguments.length>1){let g="";if(typeof m=="number"?g=" ".repeat(Math.min(m,10)):typeof m=="string"&&(g=m.slice(0,10)),f!=null){if(typeof f=="function")return l("",{"":h},[],f,g,"");if(Array.isArray(f))return c("",h,[],fA(f),g,"")}if(g.length!==0)return u("",h,[],g,"")}return d("",h,[])}return p}});var jg=qr((iZ,Zc)=>{"use strict";var Jo=process||{},Dg=Jo.argv||[],Ko=Jo.env||{},xO=!(Ko.NO_COLOR||Dg.includes("--no-color"))&&(!!Ko.FORCE_COLOR||Dg.includes("--color")||Jo.platform==="win32"||(Jo.stdout||{}).isTTY&&Ko.TERM!=="dumb"||!!Ko.CI),kO=(e,t,r=e)=>n=>{let i=""+n,o=i.indexOf(t,e.length);return~o?e+CO(i,t,r,o)+t:e+i+t},CO=(e,t,r,n)=>{let i="",o=0;do i+=e.substring(o,n)+r,o=n+t.length,n=e.indexOf(t,o);while(~n);return i+e.substring(o)},_g=(e=xO)=>{let t=e?kO:()=>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")}};Zc.exports=_g();Zc.exports.createColors=_g});import{execFileSync as IR}from"child_process";import AR from"fs";import ao from"path";function dl(e){let t=TR(e);return t??$f(e)}function $f(e){let t=ao.dirname(e);return PR(ao.join(e,".ripplo"))?e:t===e?null:$f(t)}function PR(e){try{return AR.statSync(e).isDirectory()}catch{return!1}}function TR(e){let t=OR(["rev-parse","--show-toplevel"],e);if(t==null)return null;let r=t.trim();return r.length===0?null:ao.isAbsolute(r)?r:ao.resolve(e,r)}function OR(e,t){try{return IR("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}import{readdir as NR,rm as LR,stat as $R}from"fs/promises";import jf from"path";import MR from"pino";var j=MR({level:process.env.LOG_LEVEL??"info",transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}});var Df=jf.join(process.cwd(),".ripplo","debug"),_f=360*60*1e3;async function lo({maxRuns:e}){try{let r=(await NR(Df,{withFileTypes:!0})).filter(c=>c.isDirectory()),n=Date.now(),i=await Promise.all(r.map(async c=>{let u=jf.join(Df,c.name),d=await $R(u);return{dirPath:u,mtime:d.mtimeMs}})),o=i.filter(c=>n-c.mtime>_f),a=i.filter(c=>n-c.mtime<=_f).toSorted((c,u)=>u.mtime-c.mtime).slice(e),l=[...o,...a];if(l.length===0)return;await Promise.allSettled(l.map(c=>LR(c.dirPath,{force:!0,recursive:!0}))),j.debug("Pruned %d old debug run(s)",l.length)}catch{j.warn("Debug run pruning failed, ignoring")}}import{print as DR}from"graphql";var _R=15e3,jR=3,FR=300,Fn=class extends Error{errors;constructor(t){super(t.map(r=>r.message).join(", ")),this.name="GqlRequestError",this.errors=t}};function Bn(e){if(e instanceof Fn)return e.errors[0]?.extensions?.code}async function D(e){let t=DR(e.document),r=JSON.stringify({query:t,variables:e.variables}),n=`${e.config.ripploServerUrl}/graphql`,i=await BR({init:{body:r,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST"},serverUrl:e.config.ripploServerUrl,url:n}),o=await WR({res:i,url:n});if(!HR(o))throw new Error("Invalid GraphQL response");if(zR(o))throw new Fn(o.errors);if(o.data==null)throw new Error("No data returned from server");return o.data}async function BR({init:e,serverUrl:t,url:r}){let n=1,i=await Ff({init:e,url:r});for(;i.retryable&&n<jR;)await UR(VR(n)),n+=1,i=await Ff({init:e,url:r});if(i.response!=null)return i.response;throw new Error(`Failed to connect to Ripplo server at ${t}. Check the server is running and reachable. Details: ${i.detail}`)}async function Ff({init:e,url:t}){try{let r=await fetch(t,{...e,signal:AbortSignal.timeout(_R)});return{detail:"",response:r,retryable:r.status>=500}}catch(r){return{detail:r instanceof Error?r.message:String(r),response:void 0,retryable:!0}}}function VR(e){return FR*3**(e-1)*(.5+Math.random())}function UR(e){return new Promise(t=>{setTimeout(t,e)})}async function WR({res:e,url:t}){let r=await e.text();if(r.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(r)}catch{throw new Error(`Non-JSON response from Ripplo server at ${t} (status ${String(e.status)}): ${r.slice(0,200)}`)}}function HR(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function zR(e){return Array.isArray(e.errors)&&e.errors.length>0}import Wn from"fs";import Or from"fs";import GR from"os";import Vn from"path";var qR=".local",KR=".ripplo";function pl(e){return Vn.join(e,".ripplo",qR)}function Dt(e){let t=pl(e);Or.existsSync(t)||Or.mkdirSync(t,{recursive:!0});let r=Vn.join(t,".gitignore");return Or.existsSync(r)||Or.writeFileSync(r,`*
|
|
21
|
+
`),t}function It(e,t){return Vn.join(pl(e),t)}function fl(){return Vn.join(GR.homedir(),KR)}function Un(){let e=fl();return Or.existsSync(e)?Or.chmodSync(e,448):Or.mkdirSync(e,{mode:448,recursive:!0}),e}function At(e){return Vn.join(fl(),e)}function ut(){let e=process.env.RIPPLO_TOKEN;if(e!=null&&e.trim().length>0)return e.trim();let t=At("token");if(!Wn.existsSync(t))return null;let r=Wn.readFileSync(t,"utf8").trim();return r.length===0?null:r}function hl(e){Un(),Wn.writeFileSync(At("token"),e+`
|
|
22
|
+
`,{mode:384})}function ml(){let e=At("token");return Wn.existsSync(e)?(Wn.unlinkSync(e),!0):!1}import{Agent as JR,RetryAgent as YR,setGlobalDispatcher as ZR}from"undici";var XR=1500,QR=4e3,eE=3,tE=50,rE=100,Bf=!1;function gl(){if(Bf)return;Bf=!0;let e=new JR({connections:rE,keepAliveMaxTimeout:QR,keepAliveTimeout:XR}),t=new YR(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:eE,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:tE});ZR(t)}var Zf=so(wl(),1);import Yf from"crypto";function Sl({body:e,secret:t}){let r=new Zf.Webhook(t),n=`msg_${Yf.randomUUID()}`,i=new Date,o=r.sign(n,i,e),s=Math.floor(i.getTime()/1e3);return{"webhook-id":n,"webhook-signature":o,"webhook-timestamp":String(s)}}function vl(){return`whsec_${Yf.randomBytes(24).toString("base64")}`}import th from"fs";import yo from"path";import{config as mE}from"dotenv";import{z as mo}from"zod";import{err as gE,ok as rh}from"neverthrow";import ho from"fs";import Cl from"path";import{err as xl,ok as Xf}from"neverthrow";import{z as fo}from"zod";var dE=Cl.join(".ripplo","project.json"),kl=[".env",".env.local"],pE=fo.object({envFiles:fo.array(fo.string().min(1)).optional(),projectId:fo.string().min(1)});function Qf(e){return Cl.join(e,dE)}function Rl(e){let t=Qf(e);return ho.existsSync(t)?fE(t).andThen(r=>{let n=pE.safeParse(r);return n.success?Xf({envFiles:n.data.envFiles??kl,projectId:n.data.projectId}):xl({issues:n.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`),kind:"project-file-invalid",path:t})}):xl({kind:"project-file-missing",path:t})}function El(e){return Rl(e).match(t=>t,()=>{})}function fE(e){try{return Xf(JSON.parse(ho.readFileSync(e,"utf8")))}catch(t){return xl({issues:[t instanceof Error?t.message:String(t)],kind:"project-file-invalid",path:e})}}function eh({cwd:e,envFiles:t,projectId:r}){let n=Qf(e);ho.mkdirSync(Cl.dirname(n),{recursive:!0});let i={projectId:r};t!=null&&!hE(t)&&(i.envFiles=[...t]),ho.writeFileSync(n,JSON.stringify(i,null,2)+`
|
|
23
|
+
`)}function hE(e){return e.length!==kl.length?!1:e.every((t,r)=>t===kl[r])}function Jr(e){let r=El(e)?.envFiles??[".env",".env.local"],n=yo.join(e,".ripplo");r.forEach(i=>{let o=yo.resolve(n,i);th.existsSync(o)&&mE({override:!0,path:o,quiet:!0})}),go=void 0}var yE=mo.object({RIPPLO_APP_URL:mo.url(),RIPPLO_ENGINE_URL:mo.url(),RIPPLO_WEBHOOK_SECRET:mo.string().min(1)}),go;function Yr(){return go!=null?rh(go):bE().map(e=>(go=e,e))}function Il(e){let r=El(e)?.envFiles??[],n=yo.join(e,".ripplo");return r.map(i=>yo.resolve(n,i)).filter(i=>!th.existsSync(i))}function bE(){let e=yE.safeParse(process.env);if(!e.success)return gE({issues:e.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"env-invalid",missingEnvFiles:Il(process.cwd())});let t=e.data;return rh({appUrl:t.RIPPLO_APP_URL,engineUrl:t.RIPPLO_ENGINE_URL,webhookSecret:t.RIPPLO_WEBHOOK_SECRET})}import Sz from"yargs";import{hideBin as vz}from"yargs/helpers";import{readFileSync as wE}from"fs";import{z as nh}from"zod";var SE=nh.object({version:nh.string()});function ih(){let e=wE(new URL("../package.json",import.meta.url),"utf8");return SE.parse(JSON.parse(e)).version}var bo=class extends Error{failure;constructor(t){super(t.kind),this.name="CliError",this.failure=t}};import Gl from"fs";import Io from"path";import{createJiti as HE}from"jiti";import{err as Ao,ok as kh}from"neverthrow";import{z as I}from"zod";var Al=I.enum(["fast","slow","async"]),Zr=I.object({ref:I.string().min(1)}),ir=I.union([I.string(),I.number(),I.boolean()]),Pl=I.object({template:I.array(I.union([I.string(),Zr])).min(1)}),Qe=I.union([Zr,ir,Pl,I.null()]),oh=I.object({kind:I.literal("changed")}),Tl=I.union([Qe,oh]),_t=I.union([I.string(),Zr,Pl]),vE=I.object({by:I.literal("role"),name:I.union([_t,I.undefined()]).optional().transform(e=>e),role:I.string().min(1)}),xE=I.object({by:I.literal("testId"),value:_t}),kE=I.object({by:I.literal("inside"),scope:I.lazy(()=>Pe),target:I.lazy(()=>Pe)}),Pe=I.discriminatedUnion("by",[vE,xE,kE]),wo=I.enum(["string","number","boolean"]),Ol=I.enum(["strict","eventual"]),CE=I.object({kind:I.literal("string"),maxLength:I.number().int().positive().optional(),minLength:I.number().int().nonnegative().optional(),pattern:I.string().optional()}),RE=I.object({kind:I.literal("number"),max:I.number().int().optional(),min:I.number().int().optional()}),EE=I.object({kind:I.literal("datetime"),maxOffsetDays:I.number().int(),minOffsetDays:I.number().int()}),sh=I.discriminatedUnion("kind",[CE,RE,EE]),ah=I.enum(["company.name","date.iso","internet.email","internet.url","person.fullName","lorem.slug","lorem.word"]),Ml=I.object({constraints:sh.optional(),generator:ah,name:I.string().min(1),type:wo,values:I.array(ir).min(1).optional()}),lh=I.object({consistency:Ol.default("strict"),optional:I.boolean(),stable:I.boolean(),type:wo,valueSpace:I.string().min(1).optional()}),Nl=I.enum(["backend","client"]),Ll=I.object({description:I.string().optional(),identity:I.array(I.string().min(1)).min(1),identityKind:I.enum(["surrogate","natural"]),name:I.string().min(1),props:I.record(I.string().min(1),lh),source:Nl.default("backend")}),$l=I.object({consistency:Ol.default("strict"),default:ir,description:I.string().optional(),name:I.string().min(1),source:Nl.default("backend"),type:wo,valueSpace:I.string().min(1).optional()}),jt=I.enum(["url","title","viewport"]);import{z as T}from"zod";var IE=T.discriminatedUnion("kind",[T.object({as:T.string().min(1),kind:T.literal("created"),props:T.record(T.string().min(1),Qe)}),T.object({as:T.string().min(1),kind:T.literal("updated"),props:T.record(T.string().min(1),Tl)}),T.object({kind:T.literal("deleted")})]),AE=T.object({kind:T.literal("is"),value:Qe}),ch=T.lazy(()=>T.union([Qe,TE])),PE=T.object({entity:T.string().min(1),where:T.record(T.string().min(1),ch)}),TE=T.object({field:T.string().min(1),kind:T.literal("within"),selection:PE}),Ft=T.union([Al,T.undefined()]).optional().transform(e=>e),or=T.lazy(()=>T.discriminatedUnion("kind",[T.object({kind:T.literal("visible"),locator:Pe,wait:Ft}),T.object({kind:T.literal("disabled"),locator:Pe,wait:Ft}),T.object({kind:T.literal("enabled"),locator:Pe,wait:Ft}),T.object({kind:T.literal("focused"),locator:Pe,wait:Ft}),T.object({kind:T.literal("value"),locator:Pe,value:_t,wait:Ft}),T.object({kind:T.literal("text"),locator:Pe,value:_t,wait:Ft}),T.object({assertion:AE,kind:T.literal("singleton"),singleton:T.string().min(1),wait:Ft}),T.object({kind:T.literal("browser"),name:jt,value:_t,wait:Ft}),T.object({assertion:IE,entity:T.string().min(1),key:T.record(T.string().min(1),ch),kind:T.literal("state"),wait:Ft}),T.object({kind:T.literal("not"),predicate:or}),T.object({kind:T.literal("and"),predicates:T.array(or)}),T.object({entity:T.string().min(1),kind:T.literal("count"),value:T.number().int().nonnegative()}),T.object({condition:or,consequence:or,kind:T.literal("when"),otherwise:T.union([or,T.undefined()]).optional().transform(e=>e)})]));import{z as So}from"zod";var OE=So.object({__codec:So.string().min(1),data:So.unknown(),version:So.number().int().positive()}),vo=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}},xo=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}};function Dl({name:e,schema:t}){return{currentVersion:1,name:e,decode:r=>ME({name:e,raw:r,schema:t}),encode:r=>({__codec:e,data:r,version:1})}}function Bt(e,t){return JSON.stringify(e.encode(t))}function _l(e,t){let r=JSON.parse(t);return e.decode(r)}function ME({name:e,raw:t,schema:r}){let n=OE.parse(t);if(n.__codec!==e)throw new xo({expected:e,got:n.__codec});if(n.version!==1)throw new vo({codec:e,currentVersion:1,gotVersion:n.version});return r.parse(n.data)}var ko="__ripplo__",jl="__ripplo_seed__";import{z as P}from"zod";var uh=P.discriminatedUnion("kind",[P.object({kind:P.literal("goto"),url:_t}),P.object({kind:P.literal("fill"),locator:Pe,value:Qe}),P.object({kind:P.literal("clear"),locator:Pe}),P.object({kind:P.literal("click"),locator:Pe}),P.object({kind:P.literal("dblclick"),locator:Pe}),P.object({kind:P.literal("select"),locator:Pe,value:Qe}),P.object({kind:P.literal("check"),locator:Pe}),P.object({kind:P.literal("uncheck"),locator:Pe}),P.object({kind:P.literal("hover"),locator:Pe}),P.object({files:P.array(P.string().min(1)).min(1),kind:P.literal("upload"),locator:Pe}),P.object({key:P.string().min(1),kind:P.literal("press"),locator:Pe.optional()})]),dh=P.object({action:uh,expect:P.array(or).default([])}),ph=P.object({example:ir.optional(),valueSpace:P.string().min(1)}),Fl=P.object({as:P.string().min(1),entity:P.string().min(1),set:P.record(P.string().min(1),Qe)}),fh=P.object({entity:P.string().min(1),where:P.record(P.string().min(1),Qe)}),hh=P.object({absent:P.array(fh).default([]),exclusive:P.array(P.string().min(1)).default([]),intent:P.string().min(1),maybe:P.array(Fl).default([]),name:P.string().min(1),params:P.record(P.string().min(1),ph),singletons:P.record(P.string().min(1),Qe).default({}),sourcePath:P.string().min(1).optional(),steps:P.array(dh).default([]),stub:P.boolean().default(!1),world:P.array(Fl).default([])}),mh=P.object({sha256:P.string().regex(/^[0-9a-f]{64}$/u),size:P.number().int().nonnegative()}),Co=P.object({entities:P.array(Ll),fixtures:P.record(P.string().min(1),mh).default({}),singletons:P.array($l).default([]),tests:P.array(hh),valueSpaces:P.array(Ml)}),ht=Dl({name:"ripplo-lockfile",schema:Co});import{z as sr}from"zod";var gh=sr.object({index:sr.number().int().nonnegative(),kind:sr.string(),target:sr.string(),value:sr.string()}),NE=sr.object({steps:sr.array(gh),stub:sr.boolean().default(!1)});function zn(e,t){return{index:t,kind:e.action.kind,target:LE(e.action),value:$E(e.action)}}function de(e){return e.toLowerCase().replaceAll(/[^a-z0-9]/g,"-").split("-").filter(t=>t.length>0).join("-")}function LE(e){return e.kind==="goto"?Ro(e.url):e.kind==="press"&&e.locator==null?"":Eo(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 Eo(e){return e.by==="testId"?`testId=${Ro(e.value)}`:e.by==="inside"?`${Eo(e.scope)} \u25B8 ${Eo(e.target)}`:`${e.role} ${e.name==null?"":Ro(e.name)}`.trim()}function $E(e){return e.kind==="fill"||e.kind==="select"?DE(e.value):e.kind==="press"?e.key:""}function DE(e){return e==null?"":typeof e!="object"?String(e):Ro(e)}import{z as Te}from"zod";var yh=Te.enum(["Strict","Lax","None"]),bh=Te.object({domain:Te.string().min(1),expires:Te.number(),httpOnly:Te.boolean(),name:Te.string().min(1),path:Te.string().min(1),sameSite:yh,secure:Te.boolean(),value:Te.string()}),wh=Te.object({localStorage:Te.array(Te.object({name:Te.string().min(1),value:Te.string()})),origin:Te.string().min(1)}),Bl=Te.object({cookies:Te.array(bh),headers:Te.record(Te.string().min(1),Te.string()).optional(),origins:Te.array(wh)});import{z as J}from"zod";var Vl=J.union([ir,J.null()]),Ul=J.record(J.string().min(1),Vl),Sh=J.object({as:J.string().min(1),entity:J.string().min(1),fields:J.record(J.string().min(1),Qe)}),_E=J.object({entities:J.array(Sh),runId:J.string().min(1),singletons:J.record(J.string().min(1),Vl).default({})}),vh=J.object({as:J.string().min(1),row:Ul,session:Bl.optional()}),Wl=J.object({rows:J.array(vh)}),jE=J.object({entities:J.array(J.string().min(1)),runId:J.string().min(1),singletons:J.array(J.string().min(1)).default([])}),Hl=J.object({entities:J.record(J.string().min(1),J.array(Ul)),singletons:J.record(J.string().min(1),Vl).default({})}),FE=J.object({runId:J.string().min(1)}),zl=J.object({ok:J.literal(!0)});import BE from"fs";import Gn from"path";import Xr from"typescript";function xh(e){let t=Gn.join(e,"index.ts"),r=WE(e);BE.mkdirSync(Gn.dirname(r.tsBuildInfoFile??""),{recursive:!0});let n=Xr.createIncrementalCompilerHost(r),i=Xr.createIncrementalProgram({host:n,options:r,rootNames:[t]}),o=[...i.getSyntacticDiagnostics(),...i.getSemanticDiagnostics()];i.emit();let s=o.filter(c=>VE(c,e));if(s.length===0)return{diagnostics:[],ok:!0};let a={getCanonicalFileName:c=>c,getCurrentDirectory:()=>Gn.dirname(e),getNewLine:()=>`
|
|
24
24
|
`};return{diagnostics:Xr.formatDiagnosticsWithColorAndContext(s,a).split(`
|
|
25
|
-
`).filter(c=>c.length>0),ok:!1}}function
|
|
26
|
-
`)}function
|
|
27
|
-
`)}function
|
|
28
|
-
`);case"not-ripplo":return`${e.entryPath} must default-export a Ripplo (createRipplo({ entities, invariants, singletons, tests })). 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?):",...
|
|
25
|
+
`).filter(c=>c.length>0),ok:!1}}function VE(e,t){let r=e.file?.fileName;return r==null?!0:r.startsWith(t)}var UE=Gn.join(".local","tsbuildinfo");function WE(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:Xr.ModuleKind.Preserve,moduleResolution:Xr.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:Xr.ScriptTarget.ES2022,tsBuildInfoFile:Gn.join(e,UE)}}var et=".ripplo/ripplo.lock",qn;async function Ch(e){let{result:t}=await Kn(e);return t}async function Kn(e){let t=GE(Io.join(e,".ripplo"));if(qn!=null&&qn.fingerprint===t&&qn.result.isOk())return{fingerprint:t,result:qn.result};let r=await we(e);return qn={fingerprint:t,result:r},{fingerprint:t,result:r}}async function we(e){let t=Io.join(e,".ripplo"),r=Io.join(t,"index.ts"),n=xh(t);return n.ok?(await qE(r)).andThen(o=>JE({entryPath:r,exported:o})):Ao({diagnostics:n.diagnostics,kind:"typecheck-failed"})}var zE=new Set([".local","debug","node_modules"]);function GE(e){return Rh(e).toSorted((t,r)=>t.localeCompare(r)).join("|")}function Rh(e){return(Gl.existsSync(e)?Gl.readdirSync(e,{withFileTypes:!0}):[]).flatMap(r=>{if(zE.has(r.name))return[];let n=Io.join(e,r.name);if(r.isDirectory())return Rh(n);let i=Gl.statSync(n);return[`${n}:${String(i.mtimeMs)}:${String(i.size)}`]})}async function qE(e){try{let r=await HE(import.meta.url,{fsCache:!1,moduleCache:!1,sourceMaps:!0}).import(e),n=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;return kh(n)}catch(t){return Ao({kind:"load-threw",message:KE(t)})}}function KE(e){return e instanceof Error?e.message:String(e)}function JE({entryPath:e,exported:t}){if(t==null||typeof t!="object"||!("lockfile"in t))return Ao({entryPath:e,kind:"not-ripplo"});let r=Co.safeParse(Reflect.get(t,"lockfile"));return r.success?kh(r.data):Ao({issues:r.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`),kind:"invalid-lockfile"})}function F(e,t){return t==null?`Load \`/ripplo:${e}\` skill for instructions.`:`Load \`/ripplo:${e}\` skill for instructions on ${t}.`}function Eh(e){return e.length===1?F(e[0]):`REQUIRED before proceeding: load ${e.map(r=>`\`/ripplo:${r}\``).join(" AND ")} skills (load every one \u2014 each carries rules the others don't).`}function Oe(e){return[`Compilation failed: ${YE(e)}`,F("create","DSL authoring + lint rules")].join(`
|
|
26
|
+
`)}function Ah(){return`${et} is up to date`}function Ph(e){return[`${et} is ${e==="missing"?"missing":"out of date"} \u2014 run \`ripplo compile\` and commit the result`,F("setup")].join(`
|
|
27
|
+
`)}function Th(){return`wrote ${et}`}function YE(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...Ih(e.diagnostics)].join(`
|
|
28
|
+
`);case"not-ripplo":return`${e.entryPath} must default-export a Ripplo (createRipplo({ entities, invariants, singletons, tests })). 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?):",...Ih(e.issues),"Regenerate with `npx ripplo compile` \u2014 never hand-edit the lockfile."].join(`
|
|
29
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
|
-
`)}}function
|
|
30
|
+
`)}}function Ih(e,t=8){return e.length<=t?e:[...e.slice(0,t),`\u2026 and ${String(e.length-t)} more`]}function Oh(e){return e instanceof bo?qe(e.failure):e instanceof Error?e.message:String(e)}function qe(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).",F("setup")].join(`
|
|
31
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
32
|
`);case"not-authenticated":return["Not authenticated. Run `ripplo auth login`.","(Claude Code: run it yourself as a background process \u2014 device-code flow, the user only approves in the browser.)"].join(`
|
|
33
|
-
`);case"env-invalid":return
|
|
33
|
+
`);case"env-invalid":return ZE(e);case"playwright-install-failed":return["Playwright browser installation failed (Chromium still missing after install).","Try manually: `npx playwright install chromium` \u2014 look for network/proxy or disk-space errors in its output."].join(`
|
|
34
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
35
|
`);case"oauth-authorization-failed":return[`Sign-in failed (${e.code}): ${e.description}`,e.code==="expired_token"?"The approval window expired \u2014 run `ripplo auth login` again.":"Run `ripplo auth login` to retry."].join(`
|
|
36
|
-
`);case"compilation-failed":return Oe(e.error)}}function
|
|
37
|
-
`)}import{graphql as
|
|
36
|
+
`);case"compilation-failed":return Oe(e.error)}}function ZE(e){let t=e.missingEnvFiles.length===0?[]:["Declared env file(s) not found at this path:",...e.missingEnvFiles.map(r=>` ${r}`),"If you're in a git worktree, the env file may not have been copied from the main checkout \u2014 recreate it (or symlink to a shared file outside the working tree)."];return["Env config invalid:",...e.issues.map(r=>` ${r}`),"Add missing values to the env file(s) declared in .ripplo/project.json.",...t].join(`
|
|
37
|
+
`)}import{graphql as fI}from"gql.tada";import{exec as rI}from"child_process";import{createAuthClient as XE}from"better-auth/client";import{deviceAuthorizationClient as QE}from"better-auth/client/plugins";function Mh({baseURL:e}){return XE({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[QE()]})}import{err as $h,ok as nI}from"neverthrow";import{z as ql}from"zod";var eI="https://ripplo.ai";function it(){return Po().RIPPLO_SERVER_URL}function Lh(){return Po().RIPPLO_PROJECT_ID}var tI=ql.object({RIPPLO_PROJECT_ID:ql.string().min(1).optional(),RIPPLO_SERVER_URL:ql.string().min(1).default(eI)}),Nh;function Po(){return Nh??=tI.parse(process.env),Nh}var iI=5e3,Dh="ripplo-cli";async function _h({onDeviceCode:e,url:t}){let r=t??Po().RIPPLO_SERVER_URL,n=Mh({baseURL:r}),i=await n.device.code({client_id:Dh});if(i.error!=null)return $h({description:i.error.error_description,kind:"oauth-device-code-failed"});let{device_code:o,user_code:s,verification_uri_complete:a}=i.data;return e({userCode:s,verificationUrl:a}),uI(a),(await oI({authClient:n,deviceCode:o})).map(c=>(hl(c),c))}async function oI({authClient:e,deviceCode:t}){for(;;){await lI(iI);let r=await e.device.token({client_id:Dh,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(r.data?.access_token!=null)return nI(r.data.access_token);if(r.error==null)continue;if(!aI(r.error.error))return $h({code:r.error.error,description:r.error.error_description,kind:"oauth-authorization-failed"})}}var sI=new Set(["authorization_pending","slow_down"]);function aI(e){return sI.has(e)}function lI(e){return new Promise(t=>{setTimeout(t,e)})}function cI(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function uI(e){let t=cI();rI(`${t} "${e}"`,()=>{})}function ar({serverUrl:e,token:t}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:t,webhookSecret:""}}import dI from"fs";import pI from"path";function ae(e){return dI.existsSync(pI.join(e,".ripplo"))}var hI=fI(`
|
|
38
38
|
query AuthViewer {
|
|
39
39
|
currentUser {
|
|
40
40
|
name
|
|
41
41
|
email
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
`);async function
|
|
44
|
+
`);async function jh(){let e=it(),t=ut();if(t!=null&&await mI(e,t))return;let n=(await _h({url:e,onDeviceCode:a=>{process.stdout.write(`Opening your browser to finish sign-in.
|
|
45
45
|
`),process.stdout.write(`If it didn't open, visit: ${a.verificationUrl}
|
|
46
46
|
`),process.stdout.write(`Verification code: ${a.userCode}
|
|
47
47
|
|
|
48
48
|
`),process.stdout.write(`Waiting for you to approve...
|
|
49
49
|
`)}})).match(a=>a,a=>{process.stderr.write(`${qe(a)}
|
|
50
50
|
`),process.exit(1)}),i=await Kl({serverUrl:e,token:n}),o=ae(process.cwd()),s=o?"Welcome back":"Welcome to Ripplo";process.stdout.write(`
|
|
51
|
-
`),process.stdout.write(i.kind==="ok"?`${s}, ${
|
|
51
|
+
`),process.stdout.write(i.kind==="ok"?`${s}, ${gI(i.viewer)}.
|
|
52
52
|
`:`${s}.
|
|
53
|
-
`),process.stdout.write(`Session saved to ${
|
|
54
|
-
`),o||(process.stdout.write("\nNext: run `/ripplo:setup` in Claude Code to wire Ripplo into this project,\n"),process.stdout.write("or `npx ripplo init` to set it up by hand.\n"))}async function
|
|
53
|
+
`),process.stdout.write(`Session saved to ${At("token")}.
|
|
54
|
+
`),o||(process.stdout.write("\nNext: run `/ripplo:setup` in Claude Code to wire Ripplo into this project,\n"),process.stdout.write("or `npx ripplo init` to set it up by hand.\n"))}async function mI(e,t){let r=await Kl({serverUrl:e,token:t});return r.kind==="ok"?(process.stdout.write(`Already signed in as ${r.viewer.email}. Run \`ripplo auth logout\` to switch.
|
|
55
55
|
`),!0):(r.kind==="unreachable"&&(process.stdout.write(`Could not reach the Ripplo server at ${e} (${r.message}). Your saved session may still be valid \u2014 fix connectivity and retry.
|
|
56
56
|
`),process.exit(1)),process.stdout.write(`Your saved session expired \u2014 let's sign you back in.
|
|
57
57
|
|
|
58
|
-
`),!1)}async function
|
|
58
|
+
`),!1)}async function Fh(){let e=ut();e==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login`.\n"),process.exit(1));let t=it(),r=await Kl({serverUrl:t,token:e});r.kind==="unreachable"&&(process.stdout.write(`Could not reach the Ripplo server at ${t} (${r.message}). The token may still be valid \u2014 check the server / network and retry.
|
|
59
59
|
`),process.exit(1)),r.kind==="rejected"&&(process.stdout.write("Token rejected by the server. Run `ripplo auth login` to re-authenticate.\n"),process.stdout.write(`(Claude Code: run this yourself as a background process \u2014 device-code flow, the user only approves in the browser.)
|
|
60
60
|
`),process.exit(1)),process.stdout.write(`Authenticated as ${r.viewer.name} <${r.viewer.email}> (${t})
|
|
61
|
-
`)}function
|
|
62
|
-
`);return}process.stdout.write(`Removed ${
|
|
63
|
-
`)}async function Kl({serverUrl:e,token:t}){try{let n=(await
|
|
64
|
-
`),process.exit(1));let n=
|
|
65
|
-
`);return}process.stderr.write(`${
|
|
66
|
-
`),process.exit(1)}await
|
|
67
|
-
`)}import{graphql as
|
|
61
|
+
`)}function Bh(){if(!ml()){process.stdout.write(`No token to remove.
|
|
62
|
+
`);return}process.stdout.write(`Removed ${At("token")}
|
|
63
|
+
`)}async function Kl({serverUrl:e,token:t}){try{let n=(await D({config:ar({serverUrl:e,token:t}),document:hI,variables:void 0})).currentUser;return n==null?{kind:"rejected"}:{kind:"ok",viewer:{email:n.email,name:n.name}}}catch(r){return Bn(r)==="UNAUTHENTICATED"?{kind:"rejected"}:{kind:"unreachable",message:r instanceof Error?r.message:String(r)}}}function gI(e){let t=e.name.trim().split(/\s+/)[0];return t!=null&&t.length>0?t:e.email}import{readFile as yI,writeFile as bI}from"fs/promises";import wI from"path";async function Vh(e){let t=process.cwd(),r=await we(t);r.isErr()&&(process.stderr.write(`${Oe(r.error)}
|
|
64
|
+
`),process.exit(1));let n=Bt(ht,r.value),i=wI.join(t,et);if(e.check){let o=await yI(i,"utf8").catch(()=>null);if(o===n){process.stdout.write(`${Ah()}
|
|
65
|
+
`);return}process.stderr.write(`${Ph(o==null?"missing":"stale")}
|
|
66
|
+
`),process.exit(1)}await bI(i,n),process.stdout.write(`${Th()}
|
|
67
|
+
`)}import{graphql as Hh}from"gql.tada";function Jl(e){return e==null?"Max local concurrent runs: unknown (not signed in?)":`Max local concurrent runs: ${String(e)} (the daemon applies changes live)`}import{graphql as xI}from"gql.tada";import{err as SI,ok as vI}from"neverthrow";import Uh from"fs";import Yl from"path";function Wh(e){let t=Uh.realpathSync(e),r=t,n=Yl.dirname(r);for(;n!==r;){if(Uh.existsSync(Yl.join(r,".git")))return r;r=n,n=Yl.dirname(r)}return t}function je(e){return Rl(e).andThen(t=>Yr().andThen(r=>{let n=ut();return n==null?SI({kind:"not-authenticated"}):vI({appUrl:r.appUrl,cwd:Wh(e),engineUrl:r.engineUrl,projectId:Lh()??t.projectId,ripploServerUrl:it(),token:n,webhookSecret:r.webhookSecret})}))}var kI=xI(`
|
|
68
68
|
query DevSessionCheckPreflight($projectId: String!, $cwd: String!) {
|
|
69
69
|
project(id: $projectId) {
|
|
70
70
|
id
|
|
@@ -73,26 +73,26 @@ ${S}`),m.pop(),`{${M}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
`);function
|
|
77
|
-
`),process.stderr.write(`${
|
|
78
|
-
`),process.exit(1)})}async function Jn(e){(await
|
|
79
|
-
`),process.exit(1))}var
|
|
76
|
+
`);function mt(){return je(process.cwd()).match(e=>e,e=>{process.stderr.write(`${qe(e)}
|
|
77
|
+
`),process.stderr.write(`${F("setup")}
|
|
78
|
+
`),process.exit(1)})}async function Jn(e){(await D({config:e,document:kI,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession==null&&(process.stderr.write("No active dev session. Start `npx ripplo daemon` as a background process (your app's dev server must also be running), then retry. Or run `/ripplo:start` in Claude Code.\n"),process.stderr.write(`${F("setup")}
|
|
79
|
+
`),process.exit(1))}var CI=Hh(`
|
|
80
80
|
mutation CliUpdateMaxLocalConcurrentRuns($value: Int!) {
|
|
81
81
|
updateMaxLocalConcurrentRuns(value: $value) {
|
|
82
82
|
id
|
|
83
83
|
maxLocalConcurrentRuns
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
`),
|
|
86
|
+
`),RI=Hh(`
|
|
87
87
|
query CliMaxLocalConcurrentRuns {
|
|
88
88
|
currentUser {
|
|
89
89
|
id
|
|
90
90
|
maxLocalConcurrentRuns
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
`);async function
|
|
94
|
-
`);return}let r=await
|
|
95
|
-
`)}import{graphql as
|
|
93
|
+
`);async function zh({value:e}){let t=mt();if(e==null){let n=await D({config:t,document:RI,variables:{}});process.stdout.write(`${Jl(n.currentUser?.maxLocalConcurrentRuns)}
|
|
94
|
+
`);return}let r=await D({config:t,document:CI,variables:{value:e}});process.stdout.write(`${Jl(r.updateMaxLocalConcurrentRuns?.maxLocalConcurrentRuns)}
|
|
95
|
+
`)}import{graphql as DI}from"gql.tada";import Gh from"fs";import{checkSync as EI,lockSync as II}from"proper-lockfile";var AI="dev.pid",qh=15e3;function Kh(e){return It(e,AI)}function Qr(e){try{return EI(Kh(e),{realpath:!1,stale:qh})}catch{return!1}}var Yn=class extends Error{pid;cwd;constructor({cwd:t,pid:r}){super("dev-lock-held"),this.name="DevLockHeldError",this.pid=r,this.cwd=t}};function Jh({cwd:e,onCompromised:t}){Dt(e);let r=Kh(e),n=PI({cwd:e,onCompromised:t,path:r});return Gh.writeFileSync(r,String(process.pid)),()=>{try{n()}catch{}}}function PI({cwd:e,onCompromised:t,path:r}){try{return II(r,{realpath:!1,stale:qh,onCompromised:()=>{t()}})}catch(n){throw TI(n)?new Yn({cwd:e,pid:OI(r)}):n}}function TI(e){if(!(e instanceof Error)||!("code"in e))return!1;let{code:t}=e;return t==="ELOCKED"}function OI(e){try{let t=Gh.readFileSync(e,"utf8").trim(),r=Number.parseInt(t,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}}import NI from"fs";import Zl from"path";import{execFileSync as MI}from"child_process";function ot(e,t){return MI("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}var LI=["MERGE_HEAD","rebase-merge","rebase-apply","CHERRY_PICK_HEAD","REVERT_HEAD"];function To(e){let t=$I(e);return t==null?!1:LI.some(r=>NI.existsSync(Zl.join(t,r)))}function $I(e){try{let t=ot(["rev-parse","--git-dir"],e).trim();return t.length===0?null:Zl.isAbsolute(t)?t:Zl.resolve(e,t)}catch{return null}}var _I=DI(`
|
|
96
96
|
query DevSessionCheckHealth($projectId: String!, $cwd: String!) {
|
|
97
97
|
project(id: $projectId) {
|
|
98
98
|
id
|
|
@@ -101,143 +101,143 @@ ${S}`),m.pop(),`{${M}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
`);function
|
|
104
|
+
`);function Yh(e){switch(e.status){case"active":return e.gitMidOperation?"\u2713 Dev session: ripplo daemon is live (hooks auto-paused \u2014 git is mid-merge/rebase/cherry-pick; resumes when the operation completes or aborts)":"\u2713 Dev session: ripplo daemon is live for this directory";case"starting":return"! Dev session: `ripplo daemon` is running locally but hasn't registered with the server yet. Wait a few seconds and re-run `npx ripplo doctor`. If it persists, check the watch process output for auth/network errors.";case"missing":return"\u2717 Dev session: no active ripplo daemon. Start `npx ripplo daemon` as a background process (separate from your app's dev server). Without it, `ripplo run` will refuse to dispatch and scope/coverage hooks won't arm."}}async function Zh(e){let t=Qr(e),r=To(e),n=je(e).unwrapOr(void 0);return n==null?{gitMidOperation:r,status:t?"starting":"missing",type:"dev-session"}:(await D({config:n,document:_I,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null))?.project?.devSession!=null?{gitMidOperation:r,status:"active",type:"dev-session"}:{gitMidOperation:r,status:t?"starting":"missing",type:"dev-session"}}function Xh(e){switch(e.type){case"settings":return jI(e);case"env-files":return FI(e);case"token":return BI(e);case"dev-server":return VI(e);case"dev-session":return Yh(e);case"preconditions":return UI(e);case"webhook-verification":return WI(e);case"preconditions-validation":return HI(e);case"workflows":return zI(e);case"browser":return qI(e);case"engine-endpoint":return e.reachable?`\u2713 Engine endpoint: ${e.url} is reachable`:`\u2717 Engine endpoint: ${e.url} is not reachable`;case"adapter-enabled":return KI(e);case"lockfile":return JI(e);case"pre-commit-hook":return YI(e)}}function jI(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function FI(e){return e.missing.length===0?"\u2713 Env files: declared files present":`\u2717 Env files: declared in .ripplo/project.json but missing:
|
|
105
105
|
${e.missing.map(r=>` ${r}`).join(`
|
|
106
106
|
`)}
|
|
107
|
-
If you're in a git worktree, copy the env file from the main checkout (or symlink to a shared file outside the working tree).`}function
|
|
107
|
+
If you're in a git worktree, copy the env file from the main checkout (or symlink to a shared file outside the working tree).`}function BI(e){switch(e.status){case"valid":return`\u2713 Auth: Signed in as ${e.email??"unknown"}`;case"missing":return"\u2717 Auth: No token found. Run `ripplo auth login` to authenticate.\n (Claude Code: run this yourself as a background process \u2014 it's a device-code flow, the user only needs to approve in the browser.)";case"invalid":return"\u2717 Auth: Saved token rejected by server. Run `ripplo auth login` to re-authenticate.\n (Claude Code: run this yourself as a background process \u2014 it's a device-code flow, the user only needs to approve in the browser.)";case"unreachable":return`! Auth: Could not reach ${it()} to validate token.`}}function VI(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Make sure your dev server is running.`}function UI(e){return e.count===0?"! Entities: None defined":e.configured?e.endpointReachable===void 0?`! Entities: ${String(e.count)} defined (could not verify engine endpoint)`:`\u2713 Entities: ${String(e.count)} defined, engine configured`:`\u2717 Entities: ${String(e.count)} defined but RIPPLO_ENGINE_URL is not set in your env file`}function WI(e){return e.rejectsUnsigned?"\u2713 Webhook verification: Unsigned requests are correctly rejected":"\u2717 Webhook verification: Endpoint accepted an unsigned request \u2014 webhook signature verification may be missing or misconfigured."}function HI(e){if(!e.found)return"\u2717 Model: DSL failed to compile";if(e.valid)return"\u2713 Model: Valid";let t=e.errors.map(r=>` - ${r.path===""?"":r.path+": "}${r.message}`);return`\u2717 Model: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
|
|
108
108
|
${t.join(`
|
|
109
|
-
`)}`}function
|
|
109
|
+
`)}`}function zI(e){if(e.total===0)return"! Tests: No tests defined";if(e.invalidNames.length===0)return`\u2713 Tests: ${String(e.total)} valid`;let t=e.invalidWorkflows.map(r=>GI(r));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
|
|
110
110
|
${t.join(`
|
|
111
|
-
`)}`}function
|
|
111
|
+
`)}`}function GI(e){let t=e.errors.map(r=>" - "+(r.path===""?"":r.path+": ")+r.message);return" "+e.name+`:
|
|
112
112
|
`+t.join(`
|
|
113
|
-
`)}function FI(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function BI(e){switch(e.status){case"enabled":return`\u2713 Adapter: enabled at ${e.url}`;case"disabled":return"\u2717 Adapter: disabled (handler returned 404). Set ENABLE_RIPPLO_TESTING=true in your app's env (e.g. apps/<app>/.env.local for Next.js) and restart the dev server.";case"bad-secret":return"\u2717 Adapter: webhook signature rejected. RIPPLO_WEBHOOK_SECRET seen by your dev server does not match the one in your env file.";case"unreachable":return`\u2717 Adapter: ${e.url} could not be reached for signed probe.`;case"no-secret":return"\u2717 Adapter: RIPPLO_WEBHOOK_SECRET is not set in your env file (declared in .ripplo/project.json)."}}function VI(e){switch(e.status){case"match":return`\u2713 Lockfile: ${et} is up to date`;case"missing":return`\u2717 Lockfile: ${et} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${et} is out of date \u2014 run \`ripplo compile\` and commit it`}}function UI(e){return e.installed?"\u2713 Pre-commit hook: .git/hooks/pre-commit runs `ripplo compile --check`":"! Pre-commit hook: .git/hooks/pre-commit does not run `ripplo compile --check` \u2014 see the setup skill for the snippet"}import Aa from"fs";import yx from"path";import{chromium as pF}from"playwright";import WI from"fs";import HI from"path";async function Xh(e){let t=HI.join(e,".ripplo","index.ts");if(!WI.existsSync(t))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await we(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:Oe(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:Yr().match(n=>({appUrl:n.appUrl,engineUrl:n.engineUrl,errors:[],valid:!0,warnings:[]}),n=>({appUrl:void 0,engineUrl:void 0,errors:[{message:qe(n),path:""}],valid:!1,warnings:[]}))}async function Xl(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 Qh({appUrl:e,engineUrl:t}){let r=t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`;try{return(await fetch(`${r}/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}}function lr(e){let t=new URL(e,"https://ripplo.invalid"),r=[...t.searchParams.entries()].toSorted(([n],[i])=>n.localeCompare(i)).map(([n,i])=>`${n}=${i}`).join("&");return r.length===0?t.pathname:`${t.pathname}?${r}`}function en(e,t){return e==="url"?lr(t):t}function Ql(e,t,r){return en(e,String(t))===en(e,String(r))}function tm(e,t,r){return e!=="url"?Ql(e,t,r):em(String(t))===em(String(r))}function em(e){return new URL(e,"https://ripplo.invalid").pathname}function ec({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>zI({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...qI(r.singletons,n.singletons,e.singletons)]}function zI({actual:e,canon:t,entity:r,pre:n,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>GI({actual:e?.get(s),canon:t,entity:r,key:s,predicted:i?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function GI({actual:e,canon:t,entity:r,key:n,predicted:i,preHadKey:o,preRow:s}){if(i==null)return[{divergence:{entity:r,key:n,kind:"ghost-write"},pending:o}];if(e==null)return[{divergence:{entity:r,key:n,kind:"absent"},pending:!o}];let a=(c,u,d)=>im(t(r,c,u),t(r,c,d));return[...new Set([...Object.keys(i),...Object.keys(e)])].filter(c=>!a(c,i[c],e[c])).map(c=>({divergence:{entity:r,field:c,key:n,kind:"field-mismatch",snapshot:i[c],sut:e[c]},pending:s==null?e[c]===void 0:a(c,s[c],e[c])}))}function im(e,t){return rm(e)===rm(t)}function rm(e){return e==null?"\u2205":JSON.stringify(e)}function qI(e,t,r){return[...new Set([...Object.keys(t),...Object.keys(r)])].flatMap(i=>{let o=t[i],s=r[i];return o===void 0||s===void 0||nm(i,o,s)?[]:[{divergence:{kind:"singleton-mismatch",singleton:i,snapshot:o,sut:s},pending:e[i]!==void 0&&nm(i,e[i],s)}]})}function nm(e,t,r){let n=_t.safeParse(e);return n.success?tm(n.data,t,r):im(t,r)}function tc(e){let t=KI(e.entities),r=JI(e.singletons);return n=>YI(n,t,r)}function KI(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[om(t.name,r),n.consistency])))}function om(e,t){return`${e}.${t}`}function JI(e){return new Map(e.map(t=>[t.name,t.consistency]))}function YI(e,t,r){return e.kind==="singleton-mismatch"?ZI(e.singleton,r):e.kind==="ghost-write"||e.kind==="absent"?"strict":t.get(om(e.entity,e.field))??"strict"}function ZI(e,t){return _t.safeParse(e).success?t.get(e)??"eventual":t.get(e)??"strict"}function rc(e){let t=new Set(e.valueSpaces.filter(r=>r.generator==="date.iso").map(r=>r.name));return(r,n,i)=>{if(!t.has(`${r}.${n}`)||typeof i!="string")return i;let o=Date.parse(i);return Number.isNaN(o)?i:new Date(o).toISOString()}}function am(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function Oo(e,t){return{code:gm(t),kind:"engine-network",message:Xn(t),path:e}}function lm(e){return{kind:"client-mount-missing",mountKey:e}}function cm(e,t){return{kind:"engine-decode",message:Xn(t),path:e}}function um(e,t){return{entity:e,field:t,kind:"state-identity"}}function dm(e){return{as:e,kind:"setup-missing-row"}}function Zn(e){return{kind:"driver-launch",message:Xn(e)}}function pm(e,t){return{action:e,kind:"action-failed",message:Xn(t)}}function fm(e){return{kind:"check-failed",message:Xn(e)}}function hm(){return{kind:"aborted"}}var sm=300;function cr(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${XI(e.detail)}${QI(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"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 mm(e){throw new Error(cr(e))}function Mo(){}function XI(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=sm?t:`${t.slice(0,sm)}\u2026 [truncated]`}function QI(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 gm(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?gm(e.cause):void 0}function Xn(e){return e instanceof Error?e.message:String(e)}var ac=so(Sm(),1),YK=ac.default.configure,No=ac.default;function Me(e){return No(e)??""}function Lr(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function lc(e){return Lr(e,Me)}function vm(e){return Me(e)}var ei=class extends Error{name="AbortError";constructor(){super("aborted")}};function xm(e){return e instanceof Error&&e.name==="AbortError"}function dr(e){if(e.aborted)throw new ei}function cc(e,t){return t.aborted?Promise.reject(new ei):new Promise((r,n)=>{let i=()=>{clearTimeout(o),n(new ei)},o=setTimeout(()=>{t.removeEventListener("abort",i),r()},e);t.addEventListener("abort",i,{once:!0})})}function Am(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var aA=()=>[];async function dc({canon:e,classify:t,initialSnapshot:r,lawObligations:n,observe:i,onAssertion:o,onStep:s,steps:a},l){return Pm({acc:[],canon:e,classify:t,index:0,lawObligations:n??aA,observe:i,onAssertion:o,onStep:s,signal:l,snapshot:r,steps:a})}async function Pm({acc:e,canon:t,classify:r,index:n,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:c,steps:u}){dr(l);let d=u[n];if(d==null)return{finalModel:c,findings:e};let p=Date.now();if(!d.guard(c)){let h={kind:"illegal-transition",step:d.step};return uc(a,{endMs:Date.now(),findings:[h],index:n,startMs:p}),{finalModel:c,findings:[...e,h]}}return d.perform().match(()=>lA({acc:e,canon:t,classify:r,index:n,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:c,startMs:p,step:d,steps:u}),h=>{let f=Lo(h,d);return uc(a,{endMs:Date.now(),findings:[f],index:n,startMs:p}),Promise.resolve({finalModel:c,findings:[...e,f]})})}async function lA({acc:e,canon:t,classify:r,index:n,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:c,startMs:u,step:d,steps:p}){let h=d.effect(c),f=await mA({canon:t,classify:r,observe:o,pre:c,predicted:h,signal:l,step:d}),m=[...d.obligations,...i(c,f.snapshot)],g=[...await cA({obligations:m,onAssertion:s,signal:l,step:d}),...f.findings];return uc(a,{endMs:Date.now(),findings:g,index:n,startMs:u}),Pm({acc:[...e,...g],canon:t,classify:r,index:n+1,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:f.snapshot,steps:p})}async function cA({obligations:e,onAssertion:t,signal:r,step:n}){let i=[...new Map(e.map(s=>[vm(s.source),s])).values()],o=await Promise.all(i.map(async s=>({obligation:s,outcome:await uA(s,r)})));return o.forEach(s=>{dA(t,s.obligation,s.outcome,n)}),o.flatMap(s=>fA(s.obligation,s.outcome,n))}function uA(e,t){if(e.check.kind==="decided"){let r=e.check.passed?"passed":"failed";return Promise.resolve({kind:r})}return gA(e.budget,e.check.run,t)}function dA(e,t,r,n){e?.({outcome:pA(r),source:t.source,step:n.step})}function pA(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function fA(e,t,r){return t.kind==="error"?[Lo(t.error,r)]:t.kind==="failed"?[{budget:e.budget,kind:"obligation",source:e.source,step:r.step}]:[]}function Lo(e,t){return{error:e,kind:"driver-error",step:t.step}}function uc(e,t){e?.(t)}var ti={async:12e4,fast:5e3,slow:3e4},Tm={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:ti.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:ti.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:ti.slow}};function Om(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function km(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function hA(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function Cm({canon:e,pre:t,predicted:r,step:n},i){let o=n.verifyChanges==null?[]:n.verifyChanges(r,i),s=hA(r,i,n),a=o.map(l=>({divergence:l,pending:!0}));return{adopted:s,probed:[...a,...ec({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Mm(e,t){return{budget:t.settle,divergence:e.divergence,kind:"consistency",pending:e.pending,step:t.step}}function Rm(e,t,r){let n=e.probed.filter(i=>!i.pending&&r(i.divergence)==="strict");return n.length>0?{findings:n.map(i=>Mm(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Em(e,t,r){return{findings:[...e.probed.map(n=>Mm(n,t)),...r],snapshot:e.adopted}}async function mA({canon:e,classify:t,observe:r,pre:n,predicted:i,signal:o,step:s}){let a=Tm[s.settle],l=Date.now()+a.timeoutMs,c=await km(r);if(!c.ok)return{findings:[Lo(c.error,s)],snapshot:i};let u=Cm({canon:e,pre:n,predicted:i,step:s},c.observed),d=0;for(;Date.now()<l;){dr(o);let p=Rm(u,s,t);if(p!=null)return p;await cc(Om(a,d),o),d+=1;let h=await km(r);if(!h.ok)return Em(u,s,[Lo(h.error,s)]);u=Cm({canon:e,pre:n,predicted:i,step:s},h.observed)}return Rm(u,s,t)??Em(u,s,[])}async function gA(e,t,r){let n=Tm[e],i=Date.now()+n.timeoutMs,o=await Im(t),s=0;for(;o.kind==="pending"&&Date.now()<i;)dr(r),await cc(Om(n,s),r),s+=1,o=await Im(t);return o.kind==="pending"?{kind:"failed"}:o}function Im(e){return e().match(t=>t?{kind:"passed"}:{kind:"pending"},t=>({error:t,kind:"error"}))}import{z as yA}from"zod";var fc=yA.string().brand(),le=fc.parse("");function Vt(e){return fc.parse(e)}function At(e,t){return fc.parse(e.length===0?t:`${e}.${t}`)}function He(e){return Zr.safeParse(e).success}function pr(e){return typeof e=="object"&&e!==null&&"template"in e}function pc(e,t,r){let n=At(t,e.ref);if(!r.has(n))throw new Error(`unresolved binding ref "${n}"`);return r.get(n)??null}function $o(e,t,r){return bA(e).every(n=>r.has(At(t,n)))}function mt(e,t,r){return typeof e=="string"?e:He(e)?String(pc(e,t,r)):e.template.map(n=>typeof n=="string"?n:String(pc(n,t,r))).join("")}function gt(e,t,r){return e===null||typeof e=="number"||typeof e=="boolean"?e:He(e)?pc(e,t,r):mt(e,t,r)}function Nm(e,t){return gt(e,le,t)}function ri(e){return No(e)}function tn(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,gt(i,t,r)]))}function bA(e){return e==null||typeof e!="object"?[]:pr(e)?e.template.flatMap(t=>typeof t=="string"?[]:[t.ref]):[e.ref]}function fr(e){return typeof e=="object"&&e!==null&&"kind"in e}function $r(e){return Object.fromEntries(Object.entries(e).filter(t=>!fr(t[1])))}function Lm(e,t,r){return t.reduce((n,i)=>wA(n,i,r,e),e)}function $m(e,t){return Object.keys(t).length===0?e:{...e,singletons:{...e.singletons,...t}}}function wA(e,t,r,n){if(!SA(t,r))return e;if(t.assertion.kind==="created"){let o=tn(t.assertion.props,le,r);return vA(e,t.entity,ri(o),o)}if(t.assertion.kind==="deleted")return hc(e,t.entity,RA(t.key,r,n));let i=tn($r(t.assertion.props),le,r);return hc(e,t.entity,EA(t.key,i,r,n))}function SA(e,t){return("props"in e.assertion?[e.key,$r(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(i=>jm(i)||!He(i)||t.has(Vt(i.ref))))}function vA(e,t,r,n){let i=new Map([...e.entities.get(t)??[],[r,n]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function hc(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function ni(e,t,r,n){let i={env:n,key:r,snapshot:e};return[...(e.entities.get(t)??new Map).values()].filter(o=>_o(o,i))}function Dm(e,t,r,n,i){let o={env:n,key:r,snapshot:e};return hc(e,t,s=>new Map([...s].map(([a,l])=>[a,_o(l,o)?i(l):l])))}function _o(e,t){return Object.entries(t.key).every(([r,n])=>_m(e[r],n,t))}function _m(e,t,r){return jm(t)?xA(t,r).has(Do(e)):Do(e)===Do(CA(t,r.env))}function jm(e){return typeof e=="object"&&e!==null&&"kind"in e}function xA(e,t){let r=t.snapshot.entities.get(e.selection.entity);return r==null?new Set:new Set([...r.values()].filter(n=>kA(n,e.selection.where,t)).map(n=>Do(n[e.field])))}function kA(e,t,r){return Object.entries(t).every(([n,i])=>_m(e[n],i,r))}function Do(e){return e==null?"\u2205":e instanceof Date?e.toISOString():JSON.stringify(e)}function CA(e,t){return gt(e,le,t)}function RA(e,t,r){let n={env:t,key:e,snapshot:r};return i=>new Map([...i].filter(([,o])=>!_o(o,n)))}function EA(e,t,r,n){let i={env:r,key:e,snapshot:n};return o=>new Map([...o].map(([s,a])=>_o(a,i)?[s,{...a,...t}]:[s,a]))}function Vm(e){let t=e.predicates.filter(o=>zm(o)),r=t.filter(o=>o.assertion.kind==="created"),n=Hm(t);if(r.length===0&&n.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=r.reduce((u,d)=>NA(u,s,d,e.env),{env:e.env,snapshot:o}),l=n.reduce((u,d)=>MA(u,s,d,e.env),a.snapshot),c=i.reduce((u,d)=>AA(u,s,d),a.env);return IA($A(l,e.deferred,c),s,e.adopt)}}function IA(e,t,r){if(r.length===0)return e;let n=r.reduce((i,o)=>{let s=t.snapshot.singletons[o];return s===void 0?i:{...i,[o]:s}},e.singletons);return{...e,singletons:n}}function Um(e,t,r){return new Map([...e,...Object.entries(r).map(([n,i])=>[At(le,`${t}.${n}`),i])])}function AA(e,t,r){let n=ni(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:Um(e,r.assertion.as,n)}function Wm(e){let t=Hm(e.predicates.filter(r=>zm(r)));if(t.length!==0)return(r,n)=>t.flatMap(i=>PA(i,r,n,e.env))}function Hm(e){return e.filter(t=>t.assertion.kind==="updated"&&mc(t.assertion.props).length>0)}function mc(e){return Object.entries(e).filter(([,t])=>fr(t)).map(([t])=>t)}function zm(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function PA(e,t,r,n){let i=ni(t,e.entity,e.key,n).at(0),o=ni(r.snapshot,e.entity,e.key,n).at(0);if(i==null||o==null)return[];let s=ri(TA(e.key,n));return mc(e.assertion.props).flatMap(a=>Fm(i[a])===Fm(o[a])?[{entity:e.entity,field:a,key:s,kind:"expected-change",value:o[a]}]:[])}function TA(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!OA(n[1])));return tn(r,le,t)}function OA(e){return typeof e=="object"&&e!==null&&"kind"in e}function Fm(e){return e==null?"\u2205":JSON.stringify(e)}function MA(e,t,r,n){let i=mc(r.assertion.props),o=ni(t.snapshot,r.entity,r.key,n).at(0);return o==null?e:Dm(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function NA(e,t,r,n){if(r.assertion.kind!=="created")return e;let i=tn(r.assertion.props,le,n),o=ri(i),s=e.snapshot.entities.get(r.entity);if(s==null||!s.has(o))return e;let a=LA(t.snapshot.entities.get(r.entity),s,i);if(a==null)return e;let[l,c]=a,u=new Map(s);return u.delete(o),u.set(l,c),{env:Um(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function LA(e,t,r){if(e!=null)return[...e].find(([n,i])=>!t.has(n)&&Object.entries(r).every(([o,s])=>Bm(i[o])===Bm(s)))}function Bm(e){return e==null?"\u2205":JSON.stringify(e)}function $A(e,t,r){let n=t.reduce((i,o)=>{let s=DA(o.value,r);return s==null?i:{...i,[o.name]:en(o.name,s)}},e.singletons);return{...e,singletons:n}}function DA(e,t){try{return mt(e,le,t)}catch{return}}function jo(e,t){if(e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused")return{kind:e.kind,locator:ii(e.locator,t)};if(e.kind==="not"){let r=jo(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:ii(e.locator,t),value:mt(e.value,le,t)}:e.kind!=="browser"?null:{kind:"browser",name:e.name,value:mt(e.value,le,t)}}function oi(e,t){let r=e.expect.filter(l=>l.kind==="state"),n=WA(r),{adopt:i,conditional:o,deferred:s,immediate:a}=FA(e,t,n);return{action:HA(e.action,t),label:e.action.kind,obligations:e.expect.flatMap(l=>GA(l,t)),reconcile:Vm({adopt:i,deferred:s,env:t,predicates:r}),verifyChanges:Wm({adopt:i,deferred:s,env:t,predicates:r}),effect:l=>{let c=Lm(l,r,t),u=o.reduce((d,p)=>({...d,...gc(p,c,t)}),{});return $m(c,{...a,...u})}}}function ii(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:mt(e.name,le,t),role:e.role}:e.by==="inside"?{by:"inside",scope:ii(e.scope,t),target:ii(e.target,t)}:{by:"testId",value:mt(e.value,le,t)}}function gc(e,t,r){return e==null?{}:e.kind==="when"?yc(e.condition,t,r)?gc(e.consequence,t,r):gc(e.otherwise,t,r):jA(e,r)}function yc(e,t,r){if(!_A(e))throw new Error(`when() condition cannot be a "${e.kind}" predicate`);switch(e.kind){case"singleton":return t.singletons[e.singleton]===gt(e.assertion.value,le,r);case"count":return(t.entities.get(e.entity)?.size??0)===e.value;case"not":return!yc(e.predicate,t,r);case"and":return e.predicates.every(n=>yc(n,t,r))}}function _A(e){return e.kind==="singleton"||e.kind==="count"||e.kind==="not"||e.kind==="and"}function jA(e,t){if(e.kind!=="browser"&&e.kind!=="singleton")return{};let r=e.kind==="browser"?e.value:e.assertion.value;return $o(r,le,t)?Gm(e,t):{}}function FA(e,t,r){let n=e.action.kind==="goto"&&!e.expect.some(s=>s.kind==="browser"&&s.name==="url"),i=e.action.kind==="goto"&&!n?{url:lr(mt(e.action.url,le,t))}:{},o=n?["url"]:[];return e.expect.reduce((s,a)=>a.kind==="browser"&&BA(a.value,r)?{...s,deferred:[...s.deferred,{name:a.name,value:a.value}]}:a.kind==="browser"||a.kind==="singleton"?{...s,immediate:{...s.immediate,...Gm(a,t)}}:a.kind==="when"?{...s,conditional:[...s.conditional,a]}:s,{adopt:o,conditional:[],deferred:[],immediate:i})}function BA(e,t){return VA(e).some(r=>t.has(r.split(".")[0]??r))}function VA(e){return typeof e=="string"?[]:He(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function Gm(e,t){if(e.kind==="browser")return{[e.name]:UA(e,t)};if(e.kind==="singleton")return{[e.singleton]:gt(e.assertion.value,le,t)};throw new Error("when() consequence must be a url (browser) or singleton assertion")}function UA(e,t){return en(e.name,mt(e.value,le,t))}function WA(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function HA(e,t){return{files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:zA(e,t),url:e.kind==="goto"?mt(e.url,le,t):void 0,value:"value"in e?Nm(e.value,t):void 0}}function zA(e,t){if(!(!("locator"in e)||e.locator==null))return ii(e.locator,t)}function GA(e,t){if(e.kind==="browser"||e.kind==="singleton")return[];let r=jo(e,t),n="wait"in e?e.wait??"fast":"fast";return r==null?[]:[{budget:n,check:r}]}import{err as qA,ok as KA,okAsync as kJ,Result as JA}from"neverthrow";function bc(e,t,r){let n=e.tests.find(a=>a.name===t);if(n==null)throw new Error(`test "${t}" not found in lockfile`);let i=XA(e),o={env:new Map,generate:r.generate,indexed:i,overrides:new Map(Object.entries(r.params??{}).map(([a,l])=>[Vt(a),l]))};QA(n.params,le,o);let s=n.world.map(a=>eP(a,le,o));return r.materialize(s).map(a=>YA(iP(a,o.env,i),n,e))}function wc(e){return t=>{let r=t.map(n=>({as:n.as,entity:n.entity,fields:n.fields}));return e(r).andThen(n=>ZA(t,n))}}function qm(e,t){let r=Fo(t);return Object.fromEntries(Object.entries(e).filter(([n,i])=>r.includes(n)&&i!=null))}function Fo(e){return Object.entries(e.props).filter(([,t])=>t.stable).map(([t])=>t)}function YA(e,t,r){let n=Object.fromEntries(r.singletons.map(l=>[l.name,l.default])),i=Object.fromEntries(Object.entries(t.singletons).map(([l,c])=>[l,gt(c,le,e.env)])),o={...n,...i},s=new Set(r.singletons.filter(l=>l.source==="client").map(l=>l.name)),a=Object.fromEntries(Object.entries(o).filter(([l])=>s.has(l)));return{...e,clientState:a,snapshot:{...e.snapshot,singletons:o}}}function ZA(e,t){let r=new Map(t.map(n=>[n.as,n]));return JA.combine(e.map(n=>{let i=r.get(n.as);return i==null?qA(dm(n.as)):KA({as:n.as,entity:n.entity,row:i.row,session:i.session})}))}function XA(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function QA(e,t,r){Object.entries(e).forEach(([n,i])=>{let o=At(t,n),s=r.indexed.valueSpaces.get(i.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${i.valueSpace}" for param "${o}"`);let a=r.overrides.get(o)??i.example??r.generate.value({anchor:void 0,constraints:s.constraints,generator:s.generator,nullable:!1,seed:o,type:s.type,values:s.values,valueSpace:i.valueSpace});r.env.set(o,a)})}function eP(e,t,r){let n=r.indexed.models.get(e.entity);if(n==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let i=At(t,e.as),o=tP(e.set,t,r.env);return{as:i,entity:e.entity,fields:{...nP(n,o,i,r),...o},model:n,seedPrefix:i}}function tP(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,rP(i,t,r)]))}function rP(e,t,r){if(!He(e))return e;let n=At(t,e.ref);return r.get(n)??{ref:n}}function nP(e,t,r,n){return Object.fromEntries(Object.entries(e.props).filter(([i,o])=>!o.optional&&!e.identity.includes(i)&&!(i in t)).map(([i,o])=>[i,sP({field:i,generate:n.generate,model:e,seedPrefix:r,spec:o,valueSpaces:n.indexed.valueSpaces})]))}function iP(e,t,r){let n=new Map,i=e.flatMap(o=>{let s=r.models.get(o.entity);if(s==null)throw new Error(`model "${o.entity}" not found for setup "${o.as}"`);Object.entries(o.row).forEach(([l,c])=>t.set(At(Vt(o.as),l),c));let a=n.get(o.entity)??new Map;return a.set(aP(o.row,s),qm(o.row,s)),n.set(o.entity,a),o.session==null?[]:[o.session]});return{auth:oP(i),env:t,snapshot:{entities:lP(n),singletons:{}}}}function oP(e){if(e.length===0)return;let t=e.flatMap(r=>Object.entries(r.headers??{}));return{cookies:e.flatMap(r=>r.cookies),headers:t.length===0?void 0:Object.fromEntries(t),origins:e.flatMap(r=>r.origins)}}function sP({field:e,generate:t,model:r,seedPrefix:n,spec:i,valueSpaces:o}){let s=`${r.name}.${e}`;return t.value({anchor:void 0,constraints:o.get(s)?.constraints,generator:o.get(s)?.generator??"lorem.word",nullable:i.optional,seed:At(n,e),type:i.type,values:o.get(s)?.values,valueSpace:s})}function aP(e,t){return t.identity.map(r=>String(e[r])).join(":")}function lP(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function Ut(e){return`${e.test}#${String(e.index)}`}function rn(e){let t=e.tests.flatMap(r=>Bo(e,r.name));return Lr(t,r=>`${r.test}:${Me(r.steps)}`)}function Bo(e,t){let r=eg(e,t),n=Ym(r,e),i=Km(n,r.singletons),o=OP(r,TP(e));return cP(i,MP(r.steps),n).map(({chunk:a,guard:l},c)=>AP({chunk:a,guard:l,index:c,intent:r.intent,namespace:n.namespace,paramSpaceOf:o,testName:t}))}function Km(e,t){return{absences:EP(e),entities:IP(e),exclusives:e.exclusives,optionals:Qm(e.optionals,e),singletons:Object.fromEntries(Object.entries(t).filter(([,r])=>!He(r)&&!pr(r)))}}function Vo(e,t,r){return Object.values(e).flatMap(n=>He(n)?vc(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function cP(e,t,r){return t.reduce((n,i)=>({guard:uP(n.guard,i,r),guarded:[...n.guarded,{chunk:i,guard:xP(n.guard,i)}]}),{guard:e,guarded:[]}).guarded}function uP(e,t,r){let n=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>dP(i,o,r),e);return{...n,singletons:{...n.singletons,...wP(t)}}}function dP(e,t,r){return t.assertion.kind==="deleted"?pP(e,t,r):t.assertion.kind==="created"?mP(e,t.entity,t.assertion.as,t.assertion.props,r):yP(e,t,r)}function pP(e,t,r){let n=Vo(t.key,t.entity,r.namespace),i=e.entities.find(a=>a.alias===n),o=si(fP(t.key),t.entity,r),s=i==null?{entity:t.entity,...o}:{entity:i.entity,...hP(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function fP(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return Xm(r)?[]:[[t[0],r]]}))}function hP(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function mP(e,t,r,n,i){let o=si(n,t,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!gP(o,s)),entities:[...e.entities,{alias:r,entity:t,...o}]}}function gP(e,t){return Object.entries(t.literals).every(([n,i])=>e.literals[n]===i)&&t.relations.every(n=>e.relations.some(i=>i.field===n.field&&i.targetAlias===n.targetAlias&&i.targetField===n.targetField))}function yP(e,t,r){if(t.assertion.kind!=="updated")return e;let n=Vo(t.key,t.entity,r.namespace);if(n==null)return e;let i=si($r(t.assertion.props),t.entity,r),o=Object.entries(t.assertion.props).filter(([,a])=>fr(a)).map(([a])=>a),s=a=>a.alias===n?bP(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a)),optionals:e.optionals.map(a=>s(a))}}function bP(e,t,r){let n=Object.entries(e.literals).filter(([i])=>!r.includes(i)&&!(i in t.literals));return{...e,literals:{...Object.fromEntries(n),...t.literals},relations:[...e.relations.filter(i=>!t.relations.some(o=>o.field===i.field)),...t.relations]}}function wP(e){return e.reduce((t,r)=>({...t,...SP(r),...vP(r)}),{})}function SP(e){return e.action.kind==="goto"?{url:e.action.url}:{}}function vP(e){return Object.fromEntries(e.expect.flatMap(t=>t.kind==="browser"?[[t.name,t.value]]:t.kind==="singleton"?[[t.singleton,t.assertion.value]]:[]))}function xP(e,t){return t[0]?.action.kind!=="goto"?e:{...e,singletons:Object.fromEntries(Object.entries(e.singletons).filter(([r])=>r!=="url"))}}function Uo(e,t){let r=eg(e,t),n=Ym(r,e);return{guard:Km(n,r.singletons),namespace:n.namespace,stable:n.stable}}function Jm(e,t){return[...new Set(e)].flatMap(r=>vc(r,t))}function yt(e){return He(e)?[e.ref]:pr(e)?e.template.flatMap(t=>He(t)?[t.ref]:[]):[]}function hr(e){switch(e.kind){case"visible":case"disabled":case"enabled":case"focused":return mr(e.locator);case"value":case"text":return[...mr(e.locator),...yt(e.value)];case"singleton":return yt(e.assertion.value);case"browser":return yt(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values($r(e.assertion.props)).flatMap(t=>yt(t)),...Object.values(e.key).flatMap(t=>Zm(t))];case"not":return hr(e.predicate);case"when":return[...hr(e.condition),...hr(e.consequence),...e.otherwise==null?[]:hr(e.otherwise)];case"and":return e.predicates.flatMap(t=>hr(t));case"count":return[]}}function Ym(e,t){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map([...e.world,...e.maybe].map(r=>[r.as,r.entity])),optionals:e.maybe,setups:e.world,stable:kP(t)}}function kP(e){let t=new Map(e.entities.map(r=>[r.name,r]));return(r,n)=>t.get(r)?.props[n]?.stable===!0}function mr(e){return e.by==="inside"?[...mr(e.scope),...mr(e.target)]:e.by==="role"?e.name==null?[]:yt(e.name):yt(e.value)}function Zm(e){return Xm(e)?Object.values(e.selection.where).flatMap(t=>Zm(t)):yt(e)}function Xm(e){return typeof e=="object"&&e!==null&&"kind"in e}function CP(e){return e.kind==="goto"?yt(e.url):e.kind==="fill"||e.kind==="select"?[...mr(e.locator),...yt(e.value)]:e.kind==="press"?e.locator==null?[]:mr(e.locator):(e.kind==="upload",mr(e.locator))}function RP(e){return[...CP(e.action),...e.expect.flatMap(t=>hr(t))]}function EP(e){return e.absences.map(t=>({entity:t.entity,...si(t.where,t.entity,e)}))}function si(e,t,r){let n=Object.entries(e).filter(([s])=>r.stable(t,s)),i=Object.fromEntries(n.flatMap(([s,a])=>He(a)||pr(a)?[]:[[s,a]])),o=n.flatMap(s=>{let a=s[1];if(!He(a))return[];let l=vc(a.ref,r.namespace).at(0);return l==null?[]:[{entity:l.entity,field:s[0],targetAlias:l.aliasPath,targetField:l.field}]});return{literals:i,relations:o}}function Qm(e,t){return e.map(r=>({alias:r.as,entity:r.entity,...si(r.set,r.entity,t)}))}function IP(e){return Qm(e.setups,e)}function AP(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),r=t===-1?e.chunk:e.chunk.slice(0,t),n=e.chunk.slice(r.length),i=n.at(-1)??e.chunk.at(-1);if(i==null)throw new Error("empty transition chunk");let o=[...new Set(e.chunk.flatMap(s=>RP(s)))];return{effectStep:i,guard:e.guard,index:e.index,intent:e.intent,namespace:e.namespace,nav:r,paramSpaces:Object.fromEntries(o.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),steps:n,test:e.testName,wait:Am(n.flatMap(s=>PP(s)))}}function PP(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function vc(e,t){let r=e.lastIndexOf(".");if(r===-1)return[];let n=e.slice(0,r),i=t.get(n);return i==null?[]:[{aliasPath:n,entity:i,field:e.slice(r+1),ref:e}]}function eg(e,t){let r=e.tests.find(n=>n.name===t);if(r==null)throw new Error(`test "${t}" not found in lockfile`);return r}function TP(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function OP(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function MP(e){return Sc(e,0,[],[])}function Sc(e,t,r,n){let i=e[t];if(i==null)return r.length===0?n:[...n,r];let o=[...r,i];return NP(i)?Sc(e,t+1,[],[...n,o]):Sc(e,t+1,o,n)}function NP(e){return e.expect.some(t=>t.kind==="state")}function tg(e){return rg(e,new Map)}function LP(e,t){return e.reduce((r,n)=>r??t(n),null)}function rg(e,t){let r=e.variables.find(n=>!t.has(n));return r==null?t:LP(e.domain(r),n=>{let i=new Map([...t,[r,n]]);return e.consistent(i)?rg(e,i):null})}function Pt(e,t){let r=$P(e,t);if(r==null)return null;let n=VP(r);return UP(e.singletons,t,n)?n:null}function $P(e,t){let{absences:r,entities:n,exclusives:i,optionals:o}=e,s=new Map(n.map(c=>[c.alias,c])),a=tg({variables:n.map(c=>c.alias),consistent:c=>DP(c)&&_P(n,c)&&FP(r,c,t),domain:c=>og(s.get(c),t)});if(a==null)return null;let l=sg(o,a,t);return BP(i,[...n,...o],l,t)?l:null}function DP(e){let t=[...e.values()];return new Set(t).size===t.length}function _P(e,t){return e.every(r=>t.has(r.alias)?r.relations.every(n=>jP(r,n,t)):!0)}function jP(e,t,r){if(!r.has(t.targetAlias))return!0;let n=r.get(t.targetAlias)?.[t.targetField];return n==null?!0:r.get(e.alias)?.[t.field]===n}function FP(e,t,r){return e.every(n=>![...r.entities.get(n.entity)?.values()??[]].some(i=>ng(i,n,t)))}function ng(e,t,r){return ig(e,t)?t.relations.every(n=>{if(!r.has(n.targetAlias))return!1;let i=r.get(n.targetAlias)?.[n.targetField];return i!=null&&e[n.field]===i}):!1}function ig(e,t){return Object.entries(t.literals).every(([r,n])=>n===null?e[r]==null:e[r]===n)}function og(e,t){return e==null?[]:[...t.entities.get(e.entity)?.values()??[]].filter(r=>ig(r,e))}function sg(e,t,r){let n=e.reduce((i,o)=>{if(i.has(o.alias))return i;let s=new Set(i.values()),a=og(o,r).find(l=>!s.has(l)&&ng(l,o,i));return a==null?i:new Map([...i,[o.alias,a]])},t);return n.size===t.size?n:sg(e,n,r)}function BP(e,t,r,n){return e.every(i=>{let o=t.filter(a=>a.entity===i&&r.has(a.alias)).length;return(n.entities.get(i)?.size??0)===o})}function VP(e){return new Map([...e].flatMap(([t,r])=>Object.entries(r).flatMap(n=>{let i=n[1];return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[[Vt(`${t}.${n[0]}`),i]]:[]})))}function UP(e,t,r){return Object.entries(e).every(([n,i])=>{if(!$o(i,le,r))return!1;let o=gt(i,le,r),s=t.singletons[n],a=_t.safeParse(n);return a.success?Ql(a.data,o,s):s===o})}function Ho(e,t,r){let n=Pt(e.guard,t);return n==null?null:new Map([...n,...Object.entries(r).map(([i,o])=>[Vt(i),o])])}function zo(e,t){let r=oi(e.effectStep,t),n=zP(e,t),i=[...e.nav,...e.steps].map(o=>oi(o,t));return{effect:GP(r.effect,n),steps:i.map(o=>({action:o.action,effect:o.effect,obligations:o.obligations,reconcile:o.reconcile,verifyChanges:o.verifyChanges}))}}function xc(e,t,r){return Pt(e.guard,r)==null?!1:Wo(t(r))!==Wo(r)||qP(e)||WP(e)}function WP(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}var ag=new WeakMap;function Wo(e){let t=ag.get(e);if(t!=null)return t;let r=Me({entities:[...e.entities].map(([n,i])=>[n,[...i]]),singletons:HP(e.singletons)});return ag.set(e,r),r}function HP(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>t==="url"&&typeof r=="string"?[t,lr(r)]:[t,r]))}function zP(e,t){let r=e.nav.at(-1);return r==null?void 0:oi(r,t).action.url}function GP(e,t){if(t==null)return e;let r=lr(t);return n=>{let i=e(n);return{...i,singletons:{...i.singletons,url:r}}}}function qP(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>fr(r)))}function lg(e,t,r){let n=Ho(e,t.snapshot,r);if(n==null)return null;let i=KP(e,n);return i==null||!xc(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function cg(e,t,r){let n=Ho(e,t.snapshot,r);if(n==null)return"guard-unsatisfied";try{return zo(e,n),"no-effect"}catch{return"unresolvable"}}function KP(e,t){try{return zo(e,t)}catch{return null}}var JP={absences:[],entities:[],exclusives:[],optionals:[],singletons:{}};function ai(e){return{...JP,...e}}function kc(e){return YP(e).flatMap(t=>ZP(t))}function YP(e){return[...e.reduce((r,n)=>{let i=Me([n.when.singletons,n.consequence]);return new Map([...r,[i,[...r.get(i)??[],n]]])},new Map).values()]}function ZP(e){if(e.length<2)return[];let t=e.map(o=>new Set(o.when.entities.map(s=>ug(s)))),[r]=t;if(r==null)return[];let n=[...r].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||n.length===i.when.entities.length?[]:XP(i,n,eT(e))}function ug(e){return Me([e.entity,e.literals])}function XP(e,t,r){let n=e.when.entities.filter(s=>t.includes(ug(s))),i=new Set(n.map(s=>s.alias));if(![...e.refs].every(s=>i.has(s)))return[];let o=ai({entities:n.map(s=>QP(s,i)),optionals:e.when.optionals.filter(s=>i.has(s.alias)),singletons:e.when.singletons});return[{consequence:e.consequence,origin:{kind:"generalized",tests:r},refs:e.refs,when:o}]}function QP(e,t){return{...e,relations:e.relations.filter(r=>t.has(r.targetAlias))}}function eT(e){return[...new Set(e.flatMap(t=>t.origin==null?[]:t.origin.kind==="generalized"?t.origin.tests:[t.origin.test]))]}function Ec(e){return e.flatMap((t,r)=>e.slice(r+1).flatMap(n=>hg(t,n)))}function fg(e,t){return hg(e,t).length>0}function hg(e,t){let r=dg(e.when,t.when);return!r&&!dg(t.when,e.when)||!rT(e.consequence,t.consequence)?[]:[{a:e.consequence,b:t.consequence,when:r?t.when:e.when}]}function dg(e,t){return Cc(e.entities,t.entities)&&Cc(e.absences,t.absences)&&Cc(e.optionals,t.optionals)&&e.exclusives.every(r=>t.exclusives.includes(r))&&tT(e.singletons,t.singletons)}function Cc(e,t){let r=new Set(t.map(n=>Me(n)));return e.every(n=>r.has(Me(n)))}function tT(e,t){return Object.entries(e).every(([r,n])=>Me(t[r])===Me(n))}function rT(e,t){return e.kind==="not"?Rc(e.predicate,t):t.kind==="not"?Rc(e,t.predicate):nT(e,t)||iT(e,t)}function Rc(e,t){return e.kind===t.kind&&"locator"in e&&"locator"in t&&mg(e,t)}function mg(e,t){return"locator"in t&&Me(e.locator)===Me(t.locator)}function nT(e,t){let r=new Set([e.kind,t.kind]);return r.has("enabled")&&r.has("disabled")&&"locator"in e&&"locator"in t?mg(e,t):!1}function iT(e,t){let r=pg(e),n=pg(t);return r==null||n==null||e.kind!==t.kind?!1:Rc(e,t)&&Me(r)!==Me(n)}function pg(e){return e.kind==="value"||e.kind==="text"?e.value:null}function Ic(e,t){return e.flatMap(r=>{let n=oT(r),i=new Set(r.guard.absences.map(o=>o.entity));return t.flatMap(o=>sT(r,o,n,i))})}function oT(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function sT(e,t,r,n){let{source:i,target:o}=t.reference;return!r.has(o)||r.has(i)||n.has(i)?[]:[{invariant:t,source:i,target:o,transition:Ut(e)}]}function Pc(e){return Me({consequence:e.consequence,when:e.when})}function Tc(e){let t=[...aT(e),...yT(e)],r=kc(t).reduce((n,i)=>[...t,...n].some(s=>fg(i,s))?n:[...n,i],[]);return Lr([...t,...r],Pc)}function Oc(e){return e.kind==="not"?Oc(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="value"||e.kind==="text"}function Mc(e,t,r){if(Pt(e.when,t)!=null)return null;let n=Pt(e.when,r);return n==null?null:wT(e,n)}function aT(e){return Lr(e.tests.flatMap(t=>lT(e,t)),Pc)}function lT(e,t){let r=Uo(e,t.name);return t.steps.reduce((n,i)=>({guard:cT(n.guard,i,r),laws:[...n.laws,...gT(i,n.guard,r.namespace,{kind:"test",test:t.name})]}),{guard:r.guard,laws:[]}).laws}function cT(e,t,r){return t.expect.reduce((n,i)=>i.kind==="state"?uT(n,i,r):n,e)}function uT(e,t,r){if(t.assertion.kind==="created"){let o=dT(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,o]}}let n=Vo(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return hT(e,n);let i=$r(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===n?Ac(o,i,r):o),optionals:e.optionals.map(o=>o.alias===n?Ac(o,i,r):o)}}function dT(e,t,r,n){return Ac({alias:e,entity:t,literals:{},relations:[]},r,n)}function Ac(e,t,r){return Object.entries(t).reduce((n,[i,o])=>{if(pr(o)||!r.stable(e.entity,i))return n;if(He(o)){let s=pT(o.ref,i,r.namespace);return{...n,literals:fT(n.literals,i),relations:s==null?n.relations:[...gg(n.relations,i),s]}}return{...n,literals:{...n.literals,[i]:o},relations:gg(n.relations,i)}},e)}function pT(e,t,r){let n=e.lastIndexOf(".");if(n===-1)return;let i=e.slice(0,n),o=r.get(i);return o==null?void 0:{entity:o,field:t,targetAlias:i,targetField:e.slice(n+1)}}function fT(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function gg(e,t){return e.filter(r=>r.field!==t)}function hT(e,t){let r=[...e.entities,...e.optionals].find(i=>i.alias===t),n=mT(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,relations:r.relations}]}}function mT(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t),optionals:e.optionals.filter(r=>r.alias!==t)}}function gT(e,t,r,n){if(e.action.kind!=="goto")return[];let i=e.action.url;return e.expect.filter(o=>Oc(o)).map(o=>yg({consequence:o,guard:t,namespace:r,origin:n,url:i}))}function yg({consequence:e,guard:t,namespace:r,origin:n,url:i}){return{consequence:e,origin:n,refs:new Set(Jm([...yt(i),...hr(e)],r).map(o=>o.aliasPath)),when:{...t,singletons:{...t.singletons,url:i}}}}function yT(e){return Lr(rn(e).flatMap(t=>bT(t)),Pc)}function bT(e){let t=e.nav.at(-1),r=e.steps[0]?.action,n=r!=null&&"locator"in r?r.locator:void 0;return t==null||t.action.kind!=="goto"||n==null?[]:[yg({consequence:{kind:"enabled",locator:n,wait:void 0},guard:e.guard,namespace:e.namespace,origin:{intent:e.intent,kind:"trigger",test:e.test},url:t.action.url})]}function wT(e,t){try{let r=jo(e.consequence,t);return r==null?null:{check:r}}catch{return null}}function Nc(e){return lc(e.tests.flatMap(t=>ST(e,t.name)))}function Lc(e,t){return Pt(e.when,t)==null?!1:Pt(e.holds,t)==null}function ST(e,t){let r=Uo(e,t);return r.guard.entities.flatMap(n=>n.relations.flatMap(i=>vT(e,n,i,r.namespace)?CT(n,i,r.namespace):[]))}function vT(e,t,r,n){let i=n.get(r.targetAlias);return i!=null&&!xT(e,t.entity,r.field)&&kT(e,i,r.targetField)}function xT(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function kT(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function CT(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let i=bg(e.alias,e.entity),o=bg(t.targetAlias,n);return[{holds:ai({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:ai({entities:[i]})}]}function bg(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function $c(e,t,r){return t.steps.map(n=>({effect:n.effect,obligations:n.obligations.map(i=>({budget:i.budget,check:{kind:"poll",run:()=>r.evaluate(i.check)},source:{check:i.check,kind:"step"}})),reconcile:n.reconcile,settle:e.wait,step:{action:n.action,intent:e.intent,test:e.test},verifyChanges:n.verifyChanges,guard:()=>!0,perform:()=>r.perform(n.action)}))}async function wg(e,t){let{params:r,transition:n}=e.firing,i=lg(n,e.state,r);if(i==null){let s={intent:n.intent,kind:"unfireable",reason:cg(n,e.state,r),test:n.test};return{label:Ut(n),next:e.state,result:{finalModel:e.state.snapshot,findings:[s]}}}let o=await dc({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,lawObligations:ET(e.laws,e.invariants,e.driver),observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,steps:$c(e.firing.transition,i.resolved,e.driver)},t);return{label:Ut(e.firing.transition),next:{snapshot:o.finalModel},result:o}}function RT(e,t){return Lc(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},source:{invariant:e,kind:"invariant"}}]:[]}function ET(e,t,r){return(n,i)=>[...e.flatMap(o=>IT(o,n,i,r)),...t.flatMap(o=>RT(o,i))]}function IT(e,t,r,n){let i=Mc(e,t,r);return i==null?[]:[{budget:"fast",check:{kind:"poll",run:()=>n.evaluate(i.check)},source:{check:i.check,kind:"law",origin:e.origin}}]}function _c(e,t){return Dc({acc:{findings:[],fired:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function Dc({acc:e,index:t,params:r,signal:n,state:i,stepBase:o}){dr(n);let s=r.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=await wg({canon:r.canon,classify:r.classify,driver:r.driver,firing:s,invariants:r.invariants,laws:r.laws,onAssertion:r.onAssertion,state:i,onStep:d=>{l.push(d.index),r.onEvent({endMs:d.endMs,findings:d.findings,index:o+d.index,kind:"step",startMs:d.startMs})}},n);if(c==null)return Dc({acc:e,index:t+1,params:r,signal:n,state:i,stepBase:o});r.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"fired",startMs:a}),c.result.findings.forEach(d=>{r.onEvent({finding:d,kind:"finding"})});let u={findings:[...e.findings,...c.result.findings],fired:[...e.fired,c.label]};return Dc({acc:u,index:t+1,params:r,signal:n,state:c.next,stepBase:o+l.length})}var Fc={value:e=>AT(e)};function Bc(e,t){return{value:r=>e.value({...r,seed:`${t}:${r.seed}`})}}function Vc(e,t){return{value:r=>e.value({...r,anchor:t})}}function AT({anchor:e,constraints:t,generator:r,nullable:n,seed:i,type:o,values:s,valueSpace:a}){let l=jc(`${a}:${i}`);return n&&l%4===0?null:s!=null&&s.length>0?s[l%s.length]??s[0]??null:r==="date.iso"?PT({anchor:e,constraints:t,n:l,timeHash:jc(`${a}:${i}#tod`)}):o==="number"?TT(l,t):o==="boolean"?l%2===0:OT(r,l.toString(36))}var Go=864e5;function PT({anchor:e,constraints:t,n:r,timeHash:n}){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+r%o,a=Math.floor(i/Go)*Go;return new Date(a+s*Go+n%Go).toISOString()}function jc(e,t=0,r=7){return t>=e.length?r>>>0:jc(e,t+1,r*31+(e.codePointAt(t)??0)>>>0)}function TT(e,t){if(t?.kind!=="number"||t.min==null||t.max==null)throw new Error("number value space requires min and max constraints");let r=t.max-t.min+1;return r<=0?t.min:t.min+e%r}function OT(e,t){if(e==="internet.email")return`${t}@test.ripplo.ai`;if(e==="internet.url")return`https://${t}.example.com`;let r=e.split(".").at(-1);if(r==null)throw new Error(`generator "${e}" has no "."-suffix`);return`${r}-${t}`}import{ResultAsync as Wc}from"neverthrow";var li=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}};function Uc(e){return{read:t=>MT(t,e),seedScript:t=>`globalThis[${JSON.stringify(jl)}] = ${JSON.stringify(t)};`}}async function MT(e,t){let r={title:await e.title(),url:lr(e.url()),viewport:$T(e.viewportSize())};if(t.length===0)return r;let n=await e.evaluate(LT,{mountKey:ko,names:t,timeoutMs:NT});if(n.kind==="unmounted")throw new li(ko);return{...r,...n.values}}var NT=5e3;async function LT(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(n=>setTimeout(n,25));let r=Reflect.get(globalThis,e.mountKey);return r==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(n=>[n,r.readSingleton(n)??null]))}}function $T(e){return e==null?"":`${String(e.width)}x${String(e.height)}`}function zc(e,t,r){return{evaluate:n=>Wc.fromPromise(xg(DT(e,r,n),`check ${n.kind}`),Sg),observe:()=>t.read().andThen(n=>Wc.fromPromise(xg(kg(e,r,0),"observe"),Sg).map(i=>({snapshot:{...n,singletons:{...n.singletons,...i}}}))),perform:n=>Wc.fromPromise(Rg(e,n,0),i=>pm(n.kind,i))}}async function DT(e,t,r){try{return await Ag(e,t,r)}catch(n){if(Cg(n))return!1;throw n}}function Sg(e){return e instanceof li?lm(e.mountKey):fm(e)}var _T=[100,250,500];async function kg(e,t,r){try{return await t.read(e)}catch(n){let i=_T[r];if(i==null||!Cg(n))throw n;return await Ig(i),kg(e,t,r+1)}}function Cg(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 vg=35e3;function xg(e,t){let r,n=new Promise((i,o)=>{r=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(vg)}ms`))},vg)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}var jT=[250,750,2e3];async function Rg(e,t,r){try{await FT(e,t)}catch(n){let i=jT[r];if(i==null||!UT(n))throw n;await Ig(i),await Rg(e,t,r+1)}}async function FT(e,t){if(t.kind==="goto"){await e.goto(nn(t.url,t,"url"));return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(nn(t.key,t,"key"));return}await BT(Eg(e,t.locator),t)}function nn(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function BT(e,t){switch(t.kind){case"goto":throw new Error("goto must not be located");case"fill":return e.fill(String(nn(t.value,t,"value")));case"clear":return e.clear();case"click":return e.click();case"dblclick":return e.dblclick();case"check":return e.check();case"uncheck":return e.uncheck();case"hover":return e.hover();case"select":return e.selectOption(String(nn(t.value,t,"value")));case"upload":return e.setInputFiles(nn(t.files,t,"files"));case"press":return e.press(nn(t.key,t,"key"))}}function Eg(e,t){if(t==null)throw new Error("action requires a locator");return Hc(e,t)}function Hc(e,t){return t.by==="testId"?e.getByTestId(t.value):t.by==="inside"?Hc(Hc(e,t.scope),t.target):e.locator(VT(t.role,t.name))}function VT(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}function UT(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 Ig(e){return new Promise(t=>{setTimeout(t,e)})}async function Ag(e,t,r){if(r.kind==="browser")return WT(e,t,r.name,r.value);if(r.kind==="not")return!await Ag(e,t,r.inner);let n=Eg(e,r.locator);return r.kind==="visible"?n.isVisible():r.kind==="disabled"?n.isDisabled():r.kind==="enabled"?n.isEnabled():r.kind==="focused"?n.evaluate(i=>i===i.ownerDocument.activeElement):r.kind==="value"?await n.inputValue()===r.value:(await n.textContent()??"").includes(r.value)}async function WT(e,t,r,n){let o=(await t.read(e))[r];return typeof o=="string"&&o.includes(n)}import{chromium as Tg}from"playwright";async function Gc({baseUrl:e,browser:t,capture:r,clientState:n,engine:i,reader:o,session:s}){let a=await t.newContext({baseURL:e,reducedMotion:"reduce",storageState:s==null?void 0:{cookies:s.cookies,origins:s.origins}});s?.headers!=null&&await a.setExtraHTTPHeaders(s.headers),await a.addInitScript(i.seedScript(n));let l=await r.hub.attach(a,r.runId),c=await a.newPage();return l.onPage(c),{driver:HT(zc(c,o,i),l),emitAssertion:l.emitAssertion,close:()=>zT({context:a,handle:l})}}async function qc(e,t){let r=await Tg.launch({headless:!e});try{return await t(r)}finally{await r.close()}}function Og({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??=Tg.launch({headless:!e}),t},close:async()=>{let i=t;t=void 0,i!=null&&await i.then(o=>o.close()).catch(()=>{})}}}function HT(e,t){return{evaluate:e.evaluate,observe:e.observe,perform:r=>(t.emitAction(r),e.perform(r))}}async function zT({context:e,handle:t}){await Pg(t.finish()),await Pg(e.close())}var GT=15e3;async function Pg(e){let t,r=new Promise(n=>{t=setTimeout(n,GT)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as qT,ok as KT,Result as Kc}from"neverthrow";function Jc(e,t,r){return{read:()=>r.read(e.map(n=>n.name),t).andThen(n=>JT(e,n))}}function JT(e,t){return Kc.combine(e.map(r=>YT(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),singletons:t.singletons}))}function YT(e,t){let r=Fo(e);return Kc.combine(t.map(n=>ZT(n,e).map(i=>[i,XT(n,r)]))).map(n=>new Map(n))}function ZT(e,t){return Kc.combine(t.identity.map(r=>{let n=e[r];return n==null?qT(um(t.name,r)):KT(String(n))})).map(r=>r.join(":"))}function XT(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}var Ng=so(wl(),1);import QT from"crypto";import{err as eO,errAsync as Mg,ok as tO,ResultAsync as qo}from"neverthrow";var rO=3e4,nO=[250,750,2e3];function Yc({baseUrl:e,runId:t,secret:r},n){let i=new Ng.Webhook(r),o=(s,a,l)=>iO({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:Hl,signal:n}).map(l=>({entities:l.entities,singletons:l.singletons}))},setupWorld:s=>o("/setup",{entities:s,runId:t},{retry:"connection",schema:Wl,signal:n}).map(a=>a.rows),teardown:()=>o("/teardown",{runId:t},{retry:"connection",schema:zl,signal:void 0}).map(()=>{})}}function iO(e){return Lg(e.retry,()=>cO(e),0)}function Lg(e,t,r){return t().orElse(n=>{let i=nO[r];return i==null||!sO(n,e)?Mg(n):qo.fromSafePromise(lO(i)).andThen(()=>Lg(e,t,r+1))})}var oO=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function sO(e,t){return e.kind==="aborted"?!1:aO(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function aO(e){return e.kind==="engine-network"&&e.code!=null&&oO.has(e.code)}function lO(e){return new Promise(t=>{setTimeout(t,e)})}function cO({baseUrl:e,body:t,path:r,schema:n,signal:i,webhook:o}){let s=JSON.stringify(t);return qo.fromPromise(fetch(`${e}${r}`,{body:s,headers:{"Content-Type":"application/json",...uO(o,s)},method:"PUT",signal:dO(i)}),a=>Oo(r,a)).andThen(a=>pO(a,r)).andThen(a=>fO(n,a,r)).mapErr(a=>i?.aborted===!0?hm():a)}function uO(e,t){let r=`msg_${QT.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function dO(e){let t=AbortSignal.timeout(rO);return e==null?t:AbortSignal.any([e,t])}function pO(e,t){return e.ok?qo.fromPromise(e.json(),r=>Oo(t,r)):qo.fromPromise(e.text().catch(()=>""),r=>Oo(t,r)).andThen(r=>Mg(am(t,e.status,r)))}function fO(e,t,r){let n=e.safeParse(t);return n.success?tO(n.data):eO(cm(r,n.error))}var de=so(_g(),1),D={actual:e=>de.default.red(e),bad:e=>de.default.red(de.default.bold(e)),bold:e=>de.default.bold(e),dim:e=>de.default.dim(e),expected:e=>de.default.green(e),good:e=>de.default.green(de.default.bold(e)),heading:e=>de.default.bold(de.default.cyan(e)),path:e=>de.default.cyan(de.default.underline(e)),warn:e=>de.default.yellow(de.default.bold(e))},yO={assertion:de.default.yellow,consistency:de.default.magenta,driver:de.default.red,illegal:de.default.cyan,invariant:de.default.yellow,unfireable:de.default.red};function ci(e){return`${de.default.red(de.default.bold("\u2717"))} ${yO[e](de.default.bold(e.toUpperCase()))}`}var bO=de.default.red("\u2717"),KY=de.default.green("\u2713"),jg=de.default.dim("\u203A"),wO=8;function te(e,t,r){let n=r==null?"":` ${D.dim(r)}`;return` ${D.dim(e.padStart(wO))} ${t}${n}`}function sn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${sn(e.scope)} \u25B8 ${sn(e.target)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function Xc(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${sn(e.locator)}`:e.kind}function Yo(e){return e.kind==="not"?`not ${Yo(e.inner)}`:e.kind==="browser"?`${e.name}="${e.value}"`:e.kind==="value"||e.kind==="text"?`${e.kind} ${sn(e.locator)}="${e.value}"`:`${e.kind} ${sn(e.locator)}`}function Zo(e){let{field:t,source:r,target:n,targetField:i}=e.reference;return`${r}.${t} \u2192 ${n}.${i}`}function Bg(e){return`${e.intent} \u203A ${Xc(e.action)}`}function Vg(e){return e.kind==="invariant"?`invariant ${Zo(e.invariant)}`:`${e.kind} ${Yo(e.check)}`}function on(e){return e==null?"\u2205":JSON.stringify(e)}function Qc(e){return{label:Vg(e.source),step:Bg(e.step)}}function ui(e){return e.kind==="consistency"?xO(e):e.kind==="obligation"?AO(e.source,e.step,e.budget):e.kind==="illegal-transition"?Dr("illegal","guard was false before this step",e.step,[te("meaning",D.dim("the action fired from a state the model says is unreachable"),void 0)]):e.kind==="unfireable"?Dr("unfireable",`could not fire "${e.intent}"`,void 0,[te("reason",D.actual(vO(e.reason)),void 0),te("meaning",D.dim("a planned move was skipped \u2014 never silently drop it"),void 0)]):Dr("driver","the browser failed to run this step",e.step,[te("cause",D.actual(cr(e.error)),void 0),te("decide",D.dim("environment/infra failure \u2014 fix the run environment (daemon, dev server, ports); never weaken the model or app for a driver failure"),void 0)])}var SO={"guard-unsatisfied":"the guard isn't satisfied by the live state","no-effect":"the move has no observable effect from this state",unresolvable:"a step references a value the model can't resolve yet (e.g. a not-yet-created id)"};function vO(e){return SO[e]}function eu({debugDir:e,runId:t}){let r=`${e}/${t}`;return te("behavior",D.path(`${r}/behavior.jsonl`),void 0)}function tu(e){if(e.kind==="cascade-gap"){let{gap:n}=e,i=`${n.transition} deletes ${n.target} but leaves ${n.source} dangling`;return`${ci("invariant")} ${D.bold(i)}
|
|
114
|
-
${te("breaks",
|
|
115
|
-
${te("missing",
|
|
116
|
-
${te("when",
|
|
117
|
-
`)}function xO(e){return e.pending?Dr("consistency",RO(e.divergence),e.step,[...Fg(e.divergence),te("meaning",D.dim(`the write never landed within the ${EO(e.budget)} settle budget \u2014 the app still showed the pre-step value, not a wrong one`),void 0),te("fix",D.dim("declare wait: on the expectation (or a slower tier) if this write is legitimately slow"),void 0)]):Dr("consistency",IO(e.divergence),e.step,[...Fg(e.divergence),te("decide",D.dim(CO(e.divergence)),void 0)])}var kO={absent:"app bug if the write was promised; if it only happens from a different starting state, restrict this test's given and cover that state in its own test","expected-change":"app bug if this action should change it; if the change needs other preconditions, split that case into its own test with the right given","field-mismatch":"app bug if the model value is the promised behavior; if the app legitimately owns this value, mark the field stable: false or assert changed() instead","ghost-write":"declare the missing effect on the acting step (Entity.created/updated/deleted), or if this write belongs to a different flow, cover it in that flow's test","singleton-mismatch":"app bug if the model value is the promised behavior; otherwise correct the singleton's expected value at the step that sets it"};function CO(e){return kO[e.kind]}function RO(e){return e.kind==="field-mismatch"?`${e.entity}.${e.field} write never landed`:e.kind==="ghost-write"?`${e.entity} "${e.key}" delete never landed`:e.kind==="absent"?`${e.entity} "${e.key}" create never landed`:e.kind==="expected-change"?`${e.entity}.${e.field} never changed`:`${e.singleton} write never landed`}function Fg(e){if(e.kind==="field-mismatch")return[te("row",D.dim(`${e.entity} ${e.key}`),void 0),te("expected",D.expected(on(e.snapshot)),"model predicted this"),te("actual",D.actual(on(e.sut)),"app showed this")];if(e.kind==="singleton-mismatch")return[te("expected",D.expected(on(e.snapshot)),"model predicted this"),te("actual",D.actual(on(e.sut)),"app showed this")];if(e.kind==="expected-change")return[te("row",D.dim(`${e.entity} ${e.key}`),void 0),te("expected",D.expected("a different value"),"changed() asserted a change"),te("actual",D.actual(on(e.value)),"app left it unchanged")];let t=e.kind==="ghost-write"?"an app write the model never declared \u2014 unmodeled side effect":"the model expected this row but the app has none";return[te("meaning",D.dim(t),void 0)]}function EO(e){return`${String(ti[e]/1e3)}s "${e}"`}function IO(e){return e.kind==="field-mismatch"?`${e.entity}.${e.field} diverged`:e.kind==="ghost-write"?`${e.entity} "${e.key}" written but never modeled`:e.kind==="absent"?`${e.entity} "${e.key}" missing in the app`:e.kind==="expected-change"?`${e.entity}.${e.field} never changed`:`${e.singleton} diverged`}function AO(e,t,r){if(e.kind==="invariant")return Dr("invariant",`${Zo(e.invariant)} violated`,t,[te("meaning",D.dim("a referenced row went missing after this step"),void 0)]);let n=e.kind==="law"?"view law never held":"expectation never held",i=e.kind==="law"&&e.origin!=null?[PO(e.origin)]:[];return Dr("assertion",n,t,[te("check",D.warn(Yo(e.check)),void 0),...i,te("budget",D.dim(`${r} (polled until timeout)`),void 0),te("decide",D.dim("wrong locator/accessible name, UI regression, or the expectation only holds under a narrower given \u2014 confirm in behavior.jsonl before changing the test"),void 0)])}function PO(e){if(e.kind==="test")return te("law from",D.dim(`an assertion in test "${e.test}"`),void 0);if(e.kind==="trigger")return te("law from",D.dim(`the trigger of "${e.intent}" (test "${e.test}")`),void 0);let t=e.tests.map(r=>JSON.stringify(r)).join(", ");return te("law from",D.dim(`generalized across tests ${t}`),void 0)}import{err as oF,ok as sF,ResultAsync as aF}from"neverthrow";import Yw from"path";import TO from"path";import{z as di}from"zod";var OO=["unspecified","internal","server","client","producer","consumer"],MO=["unset","ok","error"];function Ug(e){return OO[e]??"unspecified"}function Wg(e){return MO[e]??"unset"}var nZ=di.looseObject({data:di.looseObject({source:di.number().optional()}).optional(),timestamp:di.number(),type:di.number()});function Hg({debugDir:e,runId:t,worker:r}){let n=TO.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:i=>r.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(NO(i.noticeIfNoRrweb)),runId:t}),emit:i=>{r.line({line:JSON.stringify(i),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{r.rrwebBatch({data:i,runId:t})}}}function an(e){return String(BigInt(Math.round(e))*1000000n)}function NO(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}import{existsSync as LO}from"fs";import{createRequire as $O}from"module";import{fileURLToPath as DO}from"url";import{Worker as _O}from"worker_threads";var jO=$O(import.meta.url);function zg(e){let t=new _O(FO(),{workerData:e});t.unref();let r=new Map,n={next:0};t.on("message",o=>{let s=r.get(o.seq);s!=null&&(r.delete(o.seq),s())});let i=o=>{t.postMessage(o)};return{close:({noticeLineIfNoRrweb:o,runId:s})=>{let a=n.next;return n.next+=1,new Promise(l=>{r.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 FO(){try{return jO.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>DO(new URL(r,import.meta.url))),t=e.find(r=>LO(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as BO}from"fs/promises";import{createRequire as VO}from"module";import{fileURLToPath as UO}from"url";var WO=VO(import.meta.url);function ru(e,t){try{return WO.resolve(e)}catch{return UO(new URL(`assets/${t}`,import.meta.url))}}var HO=ru("@ripplo/browser-trace/bundle","browser-trace.js");async function qg(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await zO())}var Gg;function zO(){return Gg??=BO(HO,{encoding:"utf8"}),Gg}import{createServer as GO}from"http";import{mkdir as qO,rm as KO,writeFile as JO}from"fs/promises";import YO from"path";import{z as re}from"zod";var ZO="otlp-port",Jg=re.object({key:re.string(),value:re.object({boolValue:re.boolean().optional(),doubleValue:re.number().optional(),intValue:re.union([re.string(),re.number()]).optional(),stringValue:re.string().optional()})}),XO=re.object({attributes:re.array(Jg).default([]),endTimeUnixNano:re.string(),kind:re.number().default(0),name:re.string(),parentSpanId:re.string().optional(),spanId:re.string(),startTimeUnixNano:re.string(),status:re.object({code:re.number(),message:re.string().optional()}).optional(),traceId:re.string()}),QO=re.object({resourceSpans:re.array(re.object({resource:re.object({attributes:re.array(Jg).default([])}).optional(),scopeSpans:re.array(re.object({spans:re.array(XO).default([])})).default([])})).default([])});async function pi({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:i,server:o}=await eM({onRrwebBatch:t,onSpan:r}),s=YO.join(e,ZO);return n&&(await qO(e,{recursive:!0}),await JO(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{n&&await KO(s,{force:!0}),await oM(o)}}}function eM(e){return new Promise((t,r)=>{let n=GO((i,o)=>{tM(i,o,e)});n.on("error",r),n.listen(0,()=>{let i=n.address();if(i==null||typeof i=="string"){r(new Error("otlp_receiver_no_port"));return}t({port:i.port,server:n})})})}function tM(e,t,r){let n=rM(e.url);if(n!=null){Kg(e).then(i=>{r.onRrwebBatch(n,i),Xo(t)}).catch(()=>{Xo(t)});return}Kg(e).then(i=>{nM(QO.parse(JSON.parse(i.toString("utf8"))),r.onSpan),Xo(t)}).catch(()=>{Xo(t)})}function rM(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Kg(e){return new Promise((t,r)=>{let n=[];e.on("data",i=>{n.push(i)}),e.on("end",()=>{t(Buffer.concat(n))}),e.on("error",r)})}function Xo(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function nM(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:iM(r.attributes),durationMs:Number((BigInt(r.endTimeUnixNano)-BigInt(r.startTimeUnixNano))/1000000n),kind:"span",name:r.name,parentSpanId:r.parentSpanId,source:"server",spanId:r.spanId,spanKind:Ug(r.kind),status:{code:Wg(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function iM(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function oM(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{readFile as A6}from"fs/promises";var sM=Object.defineProperty,aM=(e,t,r)=>t in e?sM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k=(e,t,r)=>aM(e,typeof t!="symbol"?t+"":t,r),Yg,lM=Object.defineProperty,cM=(e,t,r)=>t in e?lM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zg=(e,t,r)=>cM(e,typeof t!="symbol"?t+"":t,r),Fe=(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))(Fe||{}),Xg={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Qg={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Qo={},uM=()=>!!globalThis.Zone;function sd(e){if(Qo[e])return Qo[e];let t=globalThis[e],r=t.prototype,n=e in Xg?Xg[e]:void 0,i=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),o=e in Qg?Qg[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!uM())return Qo[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 c=l[e].prototype;return document.body.removeChild(a),c?Qo[e]=c:r}catch{return r}}var nu={};function Gt(e,t,r){var n;let i=`${e}.${String(r)}`;if(nu[i])return nu[i].call(t);let o=sd(e),s=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return s?(nu[i]=s,s.call(t)):t[r]}var iu={};function Yy(e,t,r){let n=`${e}.${String(r)}`;if(iu[n])return iu[n].bind(t);let o=sd(e)[r];return typeof o!="function"?t[r]:(iu[n]=o,o.bind(t))}function dM(e){return Gt("Node",e,"ownerDocument")}function pM(e){return Gt("Node",e,"childNodes")}function fM(e){return Gt("Node",e,"parentNode")}function hM(e){return Gt("Node",e,"parentElement")}function mM(e){return Gt("Node",e,"textContent")}function gM(e,t){return Yy("Node",e,"contains")(t)}function yM(e){return Yy("Node",e,"getRootNode")()}function bM(e){return!e||!("host"in e)?null:Gt("ShadowRoot",e,"host")}function wM(e){return e.styleSheets}function SM(e){return!e||!("shadowRoot"in e)?null:Gt("Element",e,"shadowRoot")}function vM(e,t){return Gt("Element",e,"querySelector")(t)}function xM(e,t){return Gt("Element",e,"querySelectorAll")(t)}function kM(){return sd("MutationObserver").constructor}function CM(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}var Ke={ownerDocument:dM,childNodes:pM,parentNode:fM,parentElement:hM,textContent:mM,contains:gM,getRootNode:yM,host:bM,styleSheets:wM,shadowRoot:SM,querySelector:vM,querySelectorAll:xM,mutationObserver:kM,patch:CM};function Zy(e){return e.nodeType===e.ELEMENT_NODE}function bi(e){let t=e&&"host"in e&&"mode"in e&&Ke.host(e)||null;return!!(t&&"shadowRoot"in t&&Ke.shadowRoot(t)===e)}function wi(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function RM(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 EM(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function yu(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,i=>Xy(i,r)).join("");return RM(n)}catch{return null}}function Xy(e,t){if(AM(e)){let r;try{r=yu(e.styleSheet)||EM(e)}catch{r=e.cssText}return e.styleSheet.href?Os(r,e.styleSheet.href):r}else{let r=e.cssText;return PM(e)&&e.selectorText.includes(":")&&(r=IM(r)),t?Os(r,t):r}}function IM(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function AM(e){return"styleSheet"in e}function PM(e){return"selectorText"in e}var As=class{constructor(){Zg(this,"idNodeMap",new Map),Zg(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.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 r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function TM(){return new As}function Ps({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"",a=n&&jr(n);return(t[r.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function jr(e){return e.toLowerCase()}var ey="__rrweb_original__";function OM(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let o=t.getImageData,s=ey in o?o[ey]:o;if(new Uint32Array(s.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function Ts(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?jr(t):null}function Qy(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function MM(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var NM=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,LM=/^(?:[a-z+]+:)?\/\//i,$M=/^www\..*/i,DM=/^(data:)([^,]*),(.*)/i;function Os(e,t){return(e||"").replace(NM,(r,n,i,o,s,a)=>{let l=i||s||a,c=n||o||"";if(!l)return r;if(LM.test(l)||$M.test(l))return`url(${c}${l}${c})`;if(DM.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${MM(t)+l}${c})`;let u=t.split("/"),d=l.split("/");u.pop();for(let p of d)p!=="."&&(p===".."?u.pop():u.push(p));return`url(${c}${u.join("/")}${c})`})}function es(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function _M(e,t,r=!1){let n=Array.from(t.childNodes),i=[],o=0;if(n.length>1&&e&&typeof e=="string"){let s=es(e,r),a=s.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let c=es(n[l].textContent,r),u=100,d=3;for(;d<c.length&&(c[d].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,d),1)!==-1);d++);for(;d<c.length;d++){let p=c.substring(0,d),h=s.split(p),f=-1;if(h.length===2)f=h[0].length;else if(h.length>2&&h[0]===""&&n[l-1].textContent!=="")f=s.indexOf(p,1);else if(h.length===1){if(p=p.substring(0,p.length-1),h=s.split(p),h.length<=1)return i.push(e),i;d=u+1}else d===c.length-1&&(f=s.indexOf(p));if(h.length>=2&&d>u){let m=n[l-1].textContent;if(m&&typeof m=="string"){let g=es(m).length;f=s.indexOf(p,g)}f===-1&&(f=h[0].length)}if(f!==-1){let m=Math.floor(f/a);for(;m>0&&m<e.length;){if(o+=1,o>50*n.length)return i.push(e),i;let g=es(e.substring(0,m),r);if(g.length===f){i.push(e.substring(0,m)),e=e.substring(m),s=s.substring(f);break}else g.length<f?m+=Math.max(1,Math.floor((f-g.length)/a)):m-=Math.max(1,Math.floor((g.length-f)*a))}break}}}}return i.push(e),i}function jM(e,t){return _M(e,t).join("/* rr_split */")}var FM=1,BM=new RegExp("[^a-z0-9-_:]"),vi=-2;function eb(){return FM++}function VM(e){if(e instanceof HTMLFormElement)return"form";let t=jr(e.tagName);return BM.test(t)?"div":t}var ln,ty,UM=/^[^ \t\n\r\u000c]+/,WM=/^[, \t\n\r\u000c]+/;function HM(e,t){if(t.trim()==="")return t;let r=0;function n(o){let s,a=o.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let i=[];for(;n(WM),!(r>=t.length);){let o=n(UM);if(o.slice(-1)===",")o=dn(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=dn(e,o);let a=!1;for(;;){let l=t.charAt(r);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return i.join(", ")}var ry=new WeakMap;function dn(e,t){return!t||t.trim()===""?t:ad(e,t)}function zM(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function ad(e,t){let r=ry.get(e);if(r||(r=e.createElement("a"),ry.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function tb(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?dn(e,n):r==="srcset"?HM(e,n):r==="style"?Os(n,ad(e)):t==="object"&&r==="data"?dn(e,n):n)}function rb(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function GM(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}if(r)return e.matches(r)}catch{}return!1}function Ms(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Ms(Ke.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}return r?Ms(Ke.parentNode(e),t,r):!1}function nb(e,t,r,n){let i;if(Zy(e)){if(i=e,!Ke.childNodes(i).length)return!1}else{if(Ke.parentElement(e)===null)return!1;i=Ke.parentElement(e)}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Ms(i,t,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function qM(e,t,r){let n=e.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function KM(e,t,r){let n=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function JM(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m=!1,cssCaptured:g=!1}=t,w=YM(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Fe.Document,childNodes:[],compatMode:e.compatMode}:{type:Fe.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Fe.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return XM(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m,rootId:w});case e.TEXT_NODE:return ZM(e,{doc:r,needsMask:s,maskTextFn:c,rootId:w,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:Fe.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:Fe.Comment,textContent:Ke.textContent(e)||"",rootId:w};default:return!1}}function YM(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function ZM(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=Ke.parentNode(e),a=s&&s.tagName,l="",c=a==="STYLE"?!0:void 0,u=a==="SCRIPT"?!0:void 0;return u?l="SCRIPT_PLACEHOLDER":o||(l=Ke.textContent(e),c&&l&&(l=Os(l,ad(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,Ke.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Fe.Text,textContent:l||"",rootId:i}}function XM(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:h}=t,f=GM(e,n,i),m=VM(e),g={},w=e.attributes.length;for(let y=0;y<w;y++){let v=e.attributes[y];rb(m,v.name,v.value)||(g[v.name]=tb(r,m,jr(v.name),v.value))}if(m==="link"&&o){let y=Array.from(r.styleSheets).find(C=>C.href===e.href),v=null;y&&(v=yu(y)),v&&(delete g.rel,delete g.href,g._cssText=v)}if(m==="style"&&e.sheet){let y=yu(e.sheet);y&&(e.childNodes.length>1&&(y=jM(y,e)),g._cssText=y)}if(["input","textarea","select"].includes(m)){let y=e.value,v=e.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&y?g.value=Ps({element:e,type:Ts(e),tagName:m,value:y,maskInputOptions:s,maskInputFn:a}):v&&(g.checked=v)}if(m==="option"&&(e.selected&&!s.select?g.selected=!0:delete g.selected),m==="dialog"&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&u){if(e.__context==="2d")OM(e)||(g.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let y=e.toDataURL(l.type,l.quality),v=r.createElement("canvas");v.width=e.width,v.height=e.height;let C=v.toDataURL(l.type,l.quality);y!==C&&(g.rr_dataURL=y)}}if(m==="img"&&c){ln||(ln=r.createElement("canvas"),ty=ln.getContext("2d"));let y=e,v=y.currentSrc||y.getAttribute("src")||"<unknown-src>",C=y.crossOrigin,M=()=>{y.removeEventListener("load",M);try{ln.width=y.naturalWidth,ln.height=y.naturalHeight,ty.drawImage(y,0,0),g.rr_dataURL=ln.toDataURL(l.type,l.quality)}catch(R){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?M():y.addEventListener("load",M);return}else console.warn(`Cannot inline img src=${v}! Error: ${R}`)}y.crossOrigin==="anonymous"&&(C?g.crossOrigin=C:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?M():y.addEventListener("load",M)}if(["audio","video"].includes(m)){let y=g;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),f){let{width:y,height:v}=e.getBoundingClientRect();g={class:g.class,rr_width:`${y}px`,rr_height:`${v}px`}}m==="iframe"&&!d(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let S;try{customElements.get(m)&&(S=!0)}catch{}return{type:Fe.Element,tagName:m,attributes:g,childNodes:[],isSVG:zM(e)||void 0,needBlock:f,rootId:h,isCustom:S}}function pe(e){return e==null?"":e.toLowerCase()}function ib(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 QM(e,t){if(t.comment&&e.type===Fe.Comment)return!0;if(e.type===Fe.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"&&Qy(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(pe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||pe(e.attributes.name)==="application-name"||pe(e.attributes.rel)==="icon"||pe(e.attributes.rel)==="apple-touch-icon"||pe(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&pe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(pe(e.attributes.property).match(/^(og|twitter|fb):/)||pe(e.attributes.name).match(/^(og|twitter):/)||pe(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(pe(e.attributes.name)==="robots"||pe(e.attributes.name)==="googlebot"||pe(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(pe(e.attributes.name)==="author"||pe(e.attributes.name)==="generator"||pe(e.attributes.name)==="framework"||pe(e.attributes.name)==="publisher"||pe(e.attributes.name)==="progid"||pe(e.attributes.property).match(/^article:/)||pe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(pe(e.attributes.name)==="google-site-verification"||pe(e.attributes.name)==="yandex-verification"||pe(e.attributes.name)==="csrf-token"||pe(e.attributes.name)==="p:domain_verify"||pe(e.attributes.name)==="verify-v1"||pe(e.attributes.name)==="verification"||pe(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function pn(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f={},inlineImages:m=!1,recordCanvas:g=!1,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:M=()=>!1,newlyAddedElement:R=!1,cssCaptured:E=!1}=t,{needsMask:x}=t,{preserveWhiteSpace:U=!0}=t;x||(x=nb(e,s,a,x===void 0));let X=JM(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:f,inlineImages:m,recordCanvas:g,keepIframeSrcFn:M,newlyAddedElement:R,cssCaptured:E});if(!X)return console.warn(e,"not serialized"),null;let Q;n.hasNode(e)?Q=n.getId(e):QM(X,h)||!U&&X.type===Fe.Text&&!X.textContent.replace(/^\s+|\s+$/gm,"").length?Q=vi:Q=eb();let F=Object.assign(X,{id:Q});if(n.add(e,F),Q===vi)return null;w&&w(e);let Ge=!l;if(F.type===Fe.Element){Ge=Ge&&!F.needBlock,delete F.needBlock;let _e=Ke.shadowRoot(e);_e&&wi(_e)&&(F.isShadowHost=!0)}if((F.type===Fe.Document||F.type===Fe.Element)&&Ge){h.headWhitespace&&F.type===Fe.Element&&F.tagName==="head"&&(U=!1);let _e={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M,cssCaptured:!1};if(!(F.type===Fe.Element&&F.tagName==="textarea"&&F.attributes.value!==void 0)){F.type===Fe.Element&&F.attributes._cssText!==void 0&&typeof F.attributes._cssText=="string"&&(_e.cssCaptured=!0);for(let Ar of Array.from(Ke.childNodes(e))){let Rt=pn(Ar,_e);Rt&&F.childNodes.push(Rt)}}let ct=null;if(Zy(e)&&(ct=Ke.shadowRoot(e)))for(let Ar of Array.from(Ke.childNodes(ct))){let Rt=pn(Ar,_e);Rt&&(wi(ct)&&(Rt.isShadow=!0),F.childNodes.push(Rt))}}let Ct=Ke.parentNode(e);return Ct&&bi(Ct)&&wi(Ct)&&(F.isShadow=!0),F.type===Fe.Element&&F.tagName==="iframe"&&qM(e,()=>{let _e=e.contentDocument;if(_e&&S){let ct=pn(_e,{doc:_e,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M});ct&&S(e,ct)}},y),F.type===Fe.Element&&F.tagName==="link"&&typeof F.attributes.rel=="string"&&(F.attributes.rel==="stylesheet"||F.attributes.rel==="preload"&&typeof F.attributes.href=="string"&&Qy(F.attributes.href)==="css")&&KM(e,()=>{if(v){let _e=pn(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M});_e&&v(e,_e)}},C),F}function e2(e,t){let{mirror:r=new As,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:h=!1,dataURLOptions:f,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:C=()=>!1}=t||{},M=u===!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}:u===!1?{password:!0}:u,R=ib(h);return pn(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:M,maskTextFn:d,maskInputFn:p,slimDOMOptions:R,dataURLOptions:f,inlineImages:l,recordCanvas:c,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:C,newlyAddedElement:!1})}var t2=/(max|min)-device-(width|height)/,SZ=new RegExp(t2.source,"g");function r2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n2(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var ld={exports:{}},ye=String,ob=function(){return{isColorSupported:!1,reset:ye,bold:ye,dim:ye,italic:ye,underline:ye,inverse:ye,hidden:ye,strikethrough:ye,black:ye,red:ye,green:ye,yellow:ye,blue:ye,magenta:ye,cyan:ye,white:ye,gray:ye,bgBlack:ye,bgRed:ye,bgGreen:ye,bgYellow:ye,bgBlue:ye,bgMagenta:ye,bgCyan:ye,bgWhite:ye}};ld.exports=ob();ld.exports.createColors=ob;var i2=ld.exports,o2={},s2=Object.freeze(Object.defineProperty({__proto__:null,default:o2},Symbol.toStringTag,{value:"Module"})),wt=n2(s2),ny=i2,iy=wt,bu=class sb extends Error{constructor(t,r,n,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,sb)}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 r=this.source;t==null&&(t=ny.isColorSupported),iy&&t&&(r=iy(r));let n=r.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),s=String(o).length,a,l;if(t){let{bold:c,gray:u,red:d}=ny.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(i,o).map((c,u)=>{let d=i+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let h=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
|
|
113
|
+
`)}function qI(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function KI(e){switch(e.status){case"enabled":return`\u2713 Adapter: enabled at ${e.url}`;case"disabled":return"\u2717 Adapter: disabled (handler returned 404). Set ENABLE_RIPPLO_TESTING=true in your app's env (e.g. apps/<app>/.env.local for Next.js) and restart the dev server.";case"bad-secret":return"\u2717 Adapter: webhook signature rejected. RIPPLO_WEBHOOK_SECRET seen by your dev server does not match the one in your env file.";case"unreachable":return`\u2717 Adapter: ${e.url} could not be reached for signed probe.`;case"no-secret":return"\u2717 Adapter: RIPPLO_WEBHOOK_SECRET is not set in your env file (declared in .ripplo/project.json)."}}function JI(e){switch(e.status){case"match":return`\u2713 Lockfile: ${et} is up to date`;case"missing":return`\u2717 Lockfile: ${et} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${et} is out of date \u2014 run \`ripplo compile\` and commit it`}}function YI(e){return e.installed?"\u2713 Pre-commit hook: .git/hooks/pre-commit runs `ripplo compile --check`":"! Pre-commit hook: .git/hooks/pre-commit does not run `ripplo compile --check` \u2014 see the setup skill for the snippet"}import Aa from"fs";import bx from"path";import{chromium as SF}from"playwright";import ZI from"fs";import XI from"path";async function Qh(e){let t=XI.join(e,".ripplo","index.ts");if(!ZI.existsSync(t))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await we(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:Oe(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:Yr().match(n=>({appUrl:n.appUrl,engineUrl:n.engineUrl,errors:[],valid:!0,warnings:[]}),n=>({appUrl:void 0,engineUrl:void 0,errors:[{message:qe(n),path:""}],valid:!1,warnings:[]}))}async function Xl(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 em({appUrl:e,engineUrl:t}){let r=t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`;try{return(await fetch(`${r}/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}}function lr(e){let t=new URL(e,"https://ripplo.invalid"),r=[...t.searchParams.entries()].toSorted(([n],[i])=>n.localeCompare(i)).map(([n,i])=>`${n}=${i}`).join("&");return r.length===0?t.pathname:`${t.pathname}?${r}`}function en(e,t){return e==="url"?lr(t):t}function Ql(e,t,r){return en(e,String(t))===en(e,String(r))}function rm(e,t,r){return e!=="url"?Ql(e,t,r):tm(String(t))===tm(String(r))}function tm(e){return new URL(e,"https://ripplo.invalid").pathname}function ec({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>QI({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...tA(r.singletons,n.singletons,e.singletons)]}function QI({actual:e,canon:t,entity:r,pre:n,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>eA({actual:e?.get(s),canon:t,entity:r,key:s,predicted:i?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function eA({actual:e,canon:t,entity:r,key:n,predicted:i,preHadKey:o,preRow:s}){if(i==null)return[{divergence:{entity:r,key:n,kind:"ghost-write"},pending:o}];if(e==null)return[{divergence:{entity:r,key:n,kind:"absent"},pending:!o}];let a=(c,u,d)=>om(t(r,c,u),t(r,c,d));return[...new Set([...Object.keys(i),...Object.keys(e)])].filter(c=>!a(c,i[c],e[c])).map(c=>({divergence:{entity:r,field:c,key:n,kind:"field-mismatch",snapshot:i[c],sut:e[c]},pending:s==null?e[c]===void 0:a(c,s[c],e[c])}))}function om(e,t){return nm(e)===nm(t)}function nm(e){return e==null?"\u2205":JSON.stringify(e)}function tA(e,t,r){return[...new Set([...Object.keys(t),...Object.keys(r)])].flatMap(i=>{let o=t[i],s=r[i];return o===void 0||s===void 0||im(i,o,s)?[]:[{divergence:{kind:"singleton-mismatch",singleton:i,snapshot:o,sut:s},pending:e[i]!==void 0&&im(i,e[i],s)}]})}function im(e,t,r){let n=jt.safeParse(e);return n.success?rm(n.data,t,r):om(t,r)}function tc(e){let t=rA(e.entities),r=nA(e.singletons);return n=>iA(n,t,r)}function rA(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[sm(t.name,r),n.consistency])))}function sm(e,t){return`${e}.${t}`}function nA(e){return new Map(e.map(t=>[t.name,t.consistency]))}function iA(e,t,r){return e.kind==="singleton-mismatch"?oA(e.singleton,r):e.kind==="ghost-write"||e.kind==="absent"?"strict":t.get(sm(e.entity,e.field))??"strict"}function oA(e,t){return jt.safeParse(e).success?t.get(e)??"eventual":t.get(e)??"strict"}function rc(e){let t=new Set(e.valueSpaces.filter(r=>r.generator==="date.iso").map(r=>r.name));return(r,n,i)=>{if(!t.has(`${r}.${n}`)||typeof i!="string")return i;let o=Date.parse(i);return Number.isNaN(o)?i:new Date(o).toISOString()}}function lm(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function Oo(e,t){return{code:ym(t),kind:"engine-network",message:Xn(t),path:e}}function cm(e){return{kind:"client-mount-missing",mountKey:e}}function um(e,t){return{kind:"engine-decode",message:Xn(t),path:e}}function dm(e,t){return{entity:e,field:t,kind:"state-identity"}}function pm(e){return{as:e,kind:"setup-missing-row"}}function Zn(e){return{kind:"driver-launch",message:Xn(e)}}function fm(e,t){return{action:e,kind:"action-failed",message:Xn(t)}}function hm(e){return{kind:"check-failed",message:Xn(e)}}function mm(){return{kind:"aborted"}}var am=300;function cr(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${sA(e.detail)}${aA(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"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 gm(e){throw new Error(cr(e))}function Mo(){}function sA(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=am?t:`${t.slice(0,am)}\u2026 [truncated]`}function aA(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 ym(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?ym(e.cause):void 0}function Xn(e){return e instanceof Error?e.message:String(e)}var ac=so(vm(),1),aJ=ac.default.configure,No=ac.default;function Me(e){return No(e)??""}function Lr(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function lc(e){return Lr(e,Me)}function xm(e){return Me(e)}var ei=class extends Error{name="AbortError";constructor(){super("aborted")}};function km(e){return e instanceof Error&&e.name==="AbortError"}function dr(e){if(e.aborted)throw new ei}function cc(e,t){return t.aborted?Promise.reject(new ei):new Promise((r,n)=>{let i=()=>{clearTimeout(o),n(new ei)},o=setTimeout(()=>{t.removeEventListener("abort",i),r()},e);t.addEventListener("abort",i,{once:!0})})}function Pm(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var mA=()=>[];async function dc({canon:e,classify:t,initialSnapshot:r,lawObligations:n,observe:i,onAssertion:o,onStep:s,steps:a},l){return Tm({acc:[],canon:e,classify:t,index:0,lawObligations:n??mA,observe:i,onAssertion:o,onStep:s,signal:l,snapshot:r,steps:a})}async function Tm({acc:e,canon:t,classify:r,index:n,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:c,steps:u}){dr(l);let d=u[n];if(d==null)return{finalModel:c,findings:e};let p=Date.now();if(!d.guard(c)){let h={kind:"illegal-transition",step:d.step};return uc(a,{endMs:Date.now(),findings:[h],index:n,startMs:p}),{finalModel:c,findings:[...e,h]}}return d.perform().match(()=>gA({acc:e,canon:t,classify:r,index:n,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:c,startMs:p,step:d,steps:u}),h=>{let f=Lo(h,d);return uc(a,{endMs:Date.now(),findings:[f],index:n,startMs:p}),Promise.resolve({finalModel:c,findings:[...e,f]})})}async function gA({acc:e,canon:t,classify:r,index:n,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:c,startMs:u,step:d,steps:p}){let h=d.effect(c),f=await kA({canon:t,classify:r,observe:o,pre:c,predicted:h,signal:l,step:d}),m=[...d.obligations,...i(c,f.snapshot)],g=[...await yA({obligations:m,onAssertion:s,signal:l,step:d}),...f.findings];return uc(a,{endMs:Date.now(),findings:g,index:n,startMs:u}),Tm({acc:[...e,...g],canon:t,classify:r,index:n+1,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:f.snapshot,steps:p})}async function yA({obligations:e,onAssertion:t,signal:r,step:n}){let i=[...new Map(e.map(s=>[xm(s.source),s])).values()],o=await Promise.all(i.map(async s=>({obligation:s,outcome:await bA(s,r)})));return o.forEach(s=>{wA(t,s.obligation,s.outcome,n)}),o.flatMap(s=>vA(s.obligation,s.outcome,n))}function bA(e,t){if(e.check.kind==="decided"){let r=e.check.passed?"passed":"failed";return Promise.resolve({kind:r})}return CA(e.budget,e.check.run,t)}function wA(e,t,r,n){e?.({outcome:SA(r),source:t.source,step:n.step})}function SA(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function vA(e,t,r){return t.kind==="error"?[Lo(t.error,r)]:t.kind==="failed"?[{budget:e.budget,kind:"obligation",source:e.source,step:r.step}]:[]}function Lo(e,t){return{error:e,kind:"driver-error",step:t.step}}function uc(e,t){e?.(t)}var ti={async:12e4,fast:5e3,slow:3e4},Om={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:ti.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:ti.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:ti.slow}};function Mm(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function Cm(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function xA(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function Rm({canon:e,pre:t,predicted:r,step:n},i){let o=n.verifyChanges==null?[]:n.verifyChanges(r,i),s=xA(r,i,n),a=o.map(l=>({divergence:l,pending:!0}));return{adopted:s,probed:[...a,...ec({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Nm(e,t){return{budget:t.settle,divergence:e.divergence,kind:"consistency",pending:e.pending,step:t.step}}function Em(e,t,r){let n=e.probed.filter(i=>!i.pending&&r(i.divergence)==="strict");return n.length>0?{findings:n.map(i=>Nm(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Im(e,t,r){return{findings:[...e.probed.map(n=>Nm(n,t)),...r],snapshot:e.adopted}}async function kA({canon:e,classify:t,observe:r,pre:n,predicted:i,signal:o,step:s}){let a=Om[s.settle],l=Date.now()+a.timeoutMs,c=await Cm(r);if(!c.ok)return{findings:[Lo(c.error,s)],snapshot:i};let u=Rm({canon:e,pre:n,predicted:i,step:s},c.observed),d=0;for(;Date.now()<l;){dr(o);let p=Em(u,s,t);if(p!=null)return p;await cc(Mm(a,d),o),d+=1;let h=await Cm(r);if(!h.ok)return Im(u,s,[Lo(h.error,s)]);u=Rm({canon:e,pre:n,predicted:i,step:s},h.observed)}return Em(u,s,t)??Im(u,s,[])}async function CA(e,t,r){let n=Om[e],i=Date.now()+n.timeoutMs,o=await Am(t),s=0;for(;o.kind==="pending"&&Date.now()<i;)dr(r),await cc(Mm(n,s),r),s+=1,o=await Am(t);return o.kind==="pending"?{kind:"failed"}:o}function Am(e){return e().match(t=>t?{kind:"passed"}:{kind:"pending"},t=>({error:t,kind:"error"}))}import{z as RA}from"zod";var fc=RA.string().brand(),le=fc.parse("");function Vt(e){return fc.parse(e)}function Pt(e,t){return fc.parse(e.length===0?t:`${e}.${t}`)}function He(e){return Zr.safeParse(e).success}function pr(e){return typeof e=="object"&&e!==null&&"template"in e}function pc(e,t,r){let n=Pt(t,e.ref);if(!r.has(n))throw new Error(`unresolved binding ref "${n}"`);return r.get(n)??null}function $o(e,t,r){return EA(e).every(n=>r.has(Pt(t,n)))}function gt(e,t,r){return typeof e=="string"?e:He(e)?String(pc(e,t,r)):e.template.map(n=>typeof n=="string"?n:String(pc(n,t,r))).join("")}function yt(e,t,r){return e===null||typeof e=="number"||typeof e=="boolean"?e:He(e)?pc(e,t,r):gt(e,t,r)}function Lm(e,t){return yt(e,le,t)}function ri(e){return No(e)}function tn(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,yt(i,t,r)]))}function EA(e){return e==null||typeof e!="object"?[]:pr(e)?e.template.flatMap(t=>typeof t=="string"?[]:[t.ref]):[e.ref]}function fr(e){return typeof e=="object"&&e!==null&&"kind"in e}function $r(e){return Object.fromEntries(Object.entries(e).filter(t=>!fr(t[1])))}function $m(e,t,r){return t.reduce((n,i)=>IA(n,i,r,e),e)}function Dm(e,t){return Object.keys(t).length===0?e:{...e,singletons:{...e.singletons,...t}}}function IA(e,t,r,n){if(!AA(t,r))return e;if(t.assertion.kind==="created"){let o=tn(t.assertion.props,le,r);return PA(e,t.entity,ri(o),o)}if(t.assertion.kind==="deleted")return hc(e,t.entity,NA(t.key,r,n));let i=tn($r(t.assertion.props),le,r);return hc(e,t.entity,LA(t.key,i,r,n))}function AA(e,t){return("props"in e.assertion?[e.key,$r(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(i=>Fm(i)||!He(i)||t.has(Vt(i.ref))))}function PA(e,t,r,n){let i=new Map([...e.entities.get(t)??[],[r,n]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function hc(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function ni(e,t,r,n){let i={env:n,key:r,snapshot:e};return[...(e.entities.get(t)??new Map).values()].filter(o=>_o(o,i))}function _m(e,t,r,n,i){let o={env:n,key:r,snapshot:e};return hc(e,t,s=>new Map([...s].map(([a,l])=>[a,_o(l,o)?i(l):l])))}function _o(e,t){return Object.entries(t.key).every(([r,n])=>jm(e[r],n,t))}function jm(e,t,r){return Fm(t)?TA(t,r).has(Do(e)):Do(e)===Do(MA(t,r.env))}function Fm(e){return typeof e=="object"&&e!==null&&"kind"in e}function TA(e,t){let r=t.snapshot.entities.get(e.selection.entity);return r==null?new Set:new Set([...r.values()].filter(n=>OA(n,e.selection.where,t)).map(n=>Do(n[e.field])))}function OA(e,t,r){return Object.entries(t).every(([n,i])=>jm(e[n],i,r))}function Do(e){return e==null?"\u2205":e instanceof Date?e.toISOString():JSON.stringify(e)}function MA(e,t){return yt(e,le,t)}function NA(e,t,r){let n={env:t,key:e,snapshot:r};return i=>new Map([...i].filter(([,o])=>!_o(o,n)))}function LA(e,t,r,n){let i={env:r,key:e,snapshot:n};return o=>new Map([...o].map(([s,a])=>_o(a,i)?[s,{...a,...t}]:[s,a]))}function Um(e){let t=e.predicates.filter(o=>Gm(o)),r=t.filter(o=>o.assertion.kind==="created"),n=zm(t);if(r.length===0&&n.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=r.reduce((u,d)=>VA(u,s,d,e.env),{env:e.env,snapshot:o}),l=n.reduce((u,d)=>BA(u,s,d,e.env),a.snapshot),c=i.reduce((u,d)=>DA(u,s,d),a.env);return $A(WA(l,e.deferred,c),s,e.adopt)}}function $A(e,t,r){if(r.length===0)return e;let n=r.reduce((i,o)=>{let s=t.snapshot.singletons[o];return s===void 0?i:{...i,[o]:s}},e.singletons);return{...e,singletons:n}}function Wm(e,t,r){return new Map([...e,...Object.entries(r).map(([n,i])=>[Pt(le,`${t}.${n}`),i])])}function DA(e,t,r){let n=ni(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:Wm(e,r.assertion.as,n)}function Hm(e){let t=zm(e.predicates.filter(r=>Gm(r)));if(t.length!==0)return(r,n)=>t.flatMap(i=>_A(i,r,n,e.env))}function zm(e){return e.filter(t=>t.assertion.kind==="updated"&&mc(t.assertion.props).length>0)}function mc(e){return Object.entries(e).filter(([,t])=>fr(t)).map(([t])=>t)}function Gm(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function _A(e,t,r,n){let i=ni(t,e.entity,e.key,n).at(0),o=ni(r.snapshot,e.entity,e.key,n).at(0);if(i==null||o==null)return[];let s=ri(jA(e.key,n));return mc(e.assertion.props).flatMap(a=>Bm(i[a])===Bm(o[a])?[{entity:e.entity,field:a,key:s,kind:"expected-change",value:o[a]}]:[])}function jA(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!FA(n[1])));return tn(r,le,t)}function FA(e){return typeof e=="object"&&e!==null&&"kind"in e}function Bm(e){return e==null?"\u2205":JSON.stringify(e)}function BA(e,t,r,n){let i=mc(r.assertion.props),o=ni(t.snapshot,r.entity,r.key,n).at(0);return o==null?e:_m(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function VA(e,t,r,n){if(r.assertion.kind!=="created")return e;let i=tn(r.assertion.props,le,n),o=ri(i),s=e.snapshot.entities.get(r.entity);if(s==null||!s.has(o))return e;let a=UA(t.snapshot.entities.get(r.entity),s,i);if(a==null)return e;let[l,c]=a,u=new Map(s);return u.delete(o),u.set(l,c),{env:Wm(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function UA(e,t,r){if(e!=null)return[...e].find(([n,i])=>!t.has(n)&&Object.entries(r).every(([o,s])=>Vm(i[o])===Vm(s)))}function Vm(e){return e==null?"\u2205":JSON.stringify(e)}function WA(e,t,r){let n=t.reduce((i,o)=>{let s=HA(o.value,r);return s==null?i:{...i,[o.name]:en(o.name,s)}},e.singletons);return{...e,singletons:n}}function HA(e,t){try{return gt(e,le,t)}catch{return}}function jo(e,t){if(e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused")return{kind:e.kind,locator:ii(e.locator,t)};if(e.kind==="not"){let r=jo(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:ii(e.locator,t),value:gt(e.value,le,t)}:e.kind!=="browser"?null:{kind:"browser",name:e.name,value:gt(e.value,le,t)}}function oi(e,t){let r=e.expect.filter(l=>l.kind==="state"),n=ZA(r),{adopt:i,conditional:o,deferred:s,immediate:a}=qA(e,t,n);return{action:XA(e.action,t),label:e.action.kind,obligations:e.expect.flatMap(l=>eP(l,t)),reconcile:Um({adopt:i,deferred:s,env:t,predicates:r}),verifyChanges:Hm({adopt:i,deferred:s,env:t,predicates:r}),effect:l=>{let c=$m(l,r,t),u=o.reduce((d,p)=>({...d,...gc(p,c,t)}),{});return Dm(c,{...a,...u})}}}function ii(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:gt(e.name,le,t),role:e.role}:e.by==="inside"?{by:"inside",scope:ii(e.scope,t),target:ii(e.target,t)}:{by:"testId",value:gt(e.value,le,t)}}function gc(e,t,r){return e==null?{}:e.kind==="when"?yc(e.condition,t,r)?gc(e.consequence,t,r):gc(e.otherwise,t,r):GA(e,r)}function yc(e,t,r){if(!zA(e))throw new Error(`when() condition cannot be a "${e.kind}" predicate`);switch(e.kind){case"singleton":return t.singletons[e.singleton]===yt(e.assertion.value,le,r);case"count":return(t.entities.get(e.entity)?.size??0)===e.value;case"not":return!yc(e.predicate,t,r);case"and":return e.predicates.every(n=>yc(n,t,r))}}function zA(e){return e.kind==="singleton"||e.kind==="count"||e.kind==="not"||e.kind==="and"}function GA(e,t){if(e.kind!=="browser"&&e.kind!=="singleton")return{};let r=e.kind==="browser"?e.value:e.assertion.value;return $o(r,le,t)?qm(e,t):{}}function qA(e,t,r){let n=e.action.kind==="goto"&&!e.expect.some(s=>s.kind==="browser"&&s.name==="url"),i=e.action.kind==="goto"&&!n?{url:lr(gt(e.action.url,le,t))}:{},o=n?["url"]:[];return e.expect.reduce((s,a)=>a.kind==="browser"&&KA(a.value,r)?{...s,deferred:[...s.deferred,{name:a.name,value:a.value}]}:a.kind==="browser"||a.kind==="singleton"?{...s,immediate:{...s.immediate,...qm(a,t)}}:a.kind==="when"?{...s,conditional:[...s.conditional,a]}:s,{adopt:o,conditional:[],deferred:[],immediate:i})}function KA(e,t){return JA(e).some(r=>t.has(r.split(".")[0]??r))}function JA(e){return typeof e=="string"?[]:He(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function qm(e,t){if(e.kind==="browser")return{[e.name]:YA(e,t)};if(e.kind==="singleton")return{[e.singleton]:yt(e.assertion.value,le,t)};throw new Error("when() consequence must be a url (browser) or singleton assertion")}function YA(e,t){return en(e.name,gt(e.value,le,t))}function ZA(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function XA(e,t){return{files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:QA(e,t),url:e.kind==="goto"?gt(e.url,le,t):void 0,value:"value"in e?Lm(e.value,t):void 0}}function QA(e,t){if(!(!("locator"in e)||e.locator==null))return ii(e.locator,t)}function eP(e,t){if(e.kind==="browser"||e.kind==="singleton")return[];let r=jo(e,t),n="wait"in e?e.wait??"fast":"fast";return r==null?[]:[{budget:n,check:r}]}import{err as tP,ok as rP,okAsync as LJ,Result as nP}from"neverthrow";function bc(e,t,r){let n=e.tests.find(a=>a.name===t);if(n==null)throw new Error(`test "${t}" not found in lockfile`);let i=sP(e),o={env:new Map,generate:r.generate,indexed:i,overrides:new Map(Object.entries(r.params??{}).map(([a,l])=>[Vt(a),l]))};aP(n.params,le,o);let s=n.world.map(a=>lP(a,le,o));return r.materialize(s).map(a=>iP(pP(a,o.env,i),n,e))}function wc(e){return t=>{let r=t.map(n=>({as:n.as,entity:n.entity,fields:n.fields}));return e(r).andThen(n=>oP(t,n))}}function Km(e,t){let r=Fo(t);return Object.fromEntries(Object.entries(e).filter(([n,i])=>r.includes(n)&&i!=null))}function Fo(e){return Object.entries(e.props).filter(([,t])=>t.stable).map(([t])=>t)}function iP(e,t,r){let n=Object.fromEntries(r.singletons.map(l=>[l.name,l.default])),i=Object.fromEntries(Object.entries(t.singletons).map(([l,c])=>[l,yt(c,le,e.env)])),o={...n,...i},s=new Set(r.singletons.filter(l=>l.source==="client").map(l=>l.name)),a=Object.fromEntries(Object.entries(o).filter(([l])=>s.has(l)));return{...e,clientState:a,snapshot:{...e.snapshot,singletons:o}}}function oP(e,t){let r=new Map(t.map(n=>[n.as,n]));return nP.combine(e.map(n=>{let i=r.get(n.as);return i==null?tP(pm(n.as)):rP({as:n.as,entity:n.entity,row:i.row,session:i.session})}))}function sP(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function aP(e,t,r){Object.entries(e).forEach(([n,i])=>{let o=Pt(t,n),s=r.indexed.valueSpaces.get(i.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${i.valueSpace}" for param "${o}"`);let a=r.overrides.get(o)??i.example??r.generate.value({anchor:void 0,constraints:s.constraints,generator:s.generator,nullable:!1,seed:o,type:s.type,values:s.values,valueSpace:i.valueSpace});r.env.set(o,a)})}function lP(e,t,r){let n=r.indexed.models.get(e.entity);if(n==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let i=Pt(t,e.as),o=cP(e.set,t,r.env);return{as:i,entity:e.entity,fields:{...dP(n,o,i,r),...o},model:n,seedPrefix:i}}function cP(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,uP(i,t,r)]))}function uP(e,t,r){if(!He(e))return e;let n=Pt(t,e.ref);return r.get(n)??{ref:n}}function dP(e,t,r,n){return Object.fromEntries(Object.entries(e.props).filter(([i,o])=>!o.optional&&!e.identity.includes(i)&&!(i in t)).map(([i,o])=>[i,hP({field:i,generate:n.generate,model:e,seedPrefix:r,spec:o,valueSpaces:n.indexed.valueSpaces})]))}function pP(e,t,r){let n=new Map,i=e.flatMap(o=>{let s=r.models.get(o.entity);if(s==null)throw new Error(`model "${o.entity}" not found for setup "${o.as}"`);Object.entries(o.row).forEach(([l,c])=>t.set(Pt(Vt(o.as),l),c));let a=n.get(o.entity)??new Map;return a.set(mP(o.row,s),Km(o.row,s)),n.set(o.entity,a),o.session==null?[]:[o.session]});return{auth:fP(i),env:t,snapshot:{entities:gP(n),singletons:{}}}}function fP(e){if(e.length===0)return;let t=e.flatMap(r=>Object.entries(r.headers??{}));return{cookies:e.flatMap(r=>r.cookies),headers:t.length===0?void 0:Object.fromEntries(t),origins:e.flatMap(r=>r.origins)}}function hP({field:e,generate:t,model:r,seedPrefix:n,spec:i,valueSpaces:o}){let s=`${r.name}.${e}`;return t.value({anchor:void 0,constraints:o.get(s)?.constraints,generator:o.get(s)?.generator??"lorem.word",nullable:i.optional,seed:Pt(n,e),type:i.type,values:o.get(s)?.values,valueSpace:s})}function mP(e,t){return t.identity.map(r=>String(e[r])).join(":")}function gP(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function Ut(e){return`${e.test}#${String(e.index)}`}function rn(e){let t=e.tests.flatMap(r=>Bo(e,r.name));return Lr(t,r=>`${r.test}:${Me(r.steps)}`)}function Bo(e,t){let r=tg(e,t),n=Zm(r,e),i=Jm(n,r.singletons),o=FP(r,jP(e));return yP(i,BP(r.steps),n).map(({chunk:a,guard:l},c)=>DP({chunk:a,guard:l,index:c,intent:r.intent,namespace:n.namespace,paramSpaceOf:o,testName:t}))}function Jm(e,t){return{absences:LP(e),entities:$P(e),exclusives:e.exclusives,optionals:eg(e.optionals,e),singletons:Object.fromEntries(Object.entries(t).filter(([,r])=>!He(r)&&!pr(r)))}}function Vo(e,t,r){return Object.values(e).flatMap(n=>He(n)?vc(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function yP(e,t,r){return t.reduce((n,i)=>({guard:bP(n.guard,i,r),guarded:[...n.guarded,{chunk:i,guard:TP(n.guard,i)}]}),{guard:e,guarded:[]}).guarded}function bP(e,t,r){let n=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>wP(i,o,r),e);return{...n,singletons:{...n.singletons,...IP(t)}}}function wP(e,t,r){return t.assertion.kind==="deleted"?SP(e,t,r):t.assertion.kind==="created"?kP(e,t.entity,t.assertion.as,t.assertion.props,r):RP(e,t,r)}function SP(e,t,r){let n=Vo(t.key,t.entity,r.namespace),i=e.entities.find(a=>a.alias===n),o=si(vP(t.key),t.entity,r),s=i==null?{entity:t.entity,...o}:{entity:i.entity,...xP(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function vP(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return Qm(r)?[]:[[t[0],r]]}))}function xP(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function kP(e,t,r,n,i){let o=si(n,t,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!CP(o,s)),entities:[...e.entities,{alias:r,entity:t,...o}]}}function CP(e,t){return Object.entries(t.literals).every(([n,i])=>e.literals[n]===i)&&t.relations.every(n=>e.relations.some(i=>i.field===n.field&&i.targetAlias===n.targetAlias&&i.targetField===n.targetField))}function RP(e,t,r){if(t.assertion.kind!=="updated")return e;let n=Vo(t.key,t.entity,r.namespace);if(n==null)return e;let i=si($r(t.assertion.props),t.entity,r),o=Object.entries(t.assertion.props).filter(([,a])=>fr(a)).map(([a])=>a),s=a=>a.alias===n?EP(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a)),optionals:e.optionals.map(a=>s(a))}}function EP(e,t,r){let n=Object.entries(e.literals).filter(([i])=>!r.includes(i)&&!(i in t.literals));return{...e,literals:{...Object.fromEntries(n),...t.literals},relations:[...e.relations.filter(i=>!t.relations.some(o=>o.field===i.field)),...t.relations]}}function IP(e){return e.reduce((t,r)=>({...t,...AP(r),...PP(r)}),{})}function AP(e){return e.action.kind==="goto"?{url:e.action.url}:{}}function PP(e){return Object.fromEntries(e.expect.flatMap(t=>t.kind==="browser"?[[t.name,t.value]]:t.kind==="singleton"?[[t.singleton,t.assertion.value]]:[]))}function TP(e,t){return t[0]?.action.kind!=="goto"?e:{...e,singletons:Object.fromEntries(Object.entries(e.singletons).filter(([r])=>r!=="url"))}}function Uo(e,t){let r=tg(e,t),n=Zm(r,e);return{guard:Jm(n,r.singletons),namespace:n.namespace,stable:n.stable}}function Ym(e,t){return[...new Set(e)].flatMap(r=>vc(r,t))}function bt(e){return He(e)?[e.ref]:pr(e)?e.template.flatMap(t=>He(t)?[t.ref]:[]):[]}function hr(e){switch(e.kind){case"visible":case"disabled":case"enabled":case"focused":return mr(e.locator);case"value":case"text":return[...mr(e.locator),...bt(e.value)];case"singleton":return bt(e.assertion.value);case"browser":return bt(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values($r(e.assertion.props)).flatMap(t=>bt(t)),...Object.values(e.key).flatMap(t=>Xm(t))];case"not":return hr(e.predicate);case"when":return[...hr(e.condition),...hr(e.consequence),...e.otherwise==null?[]:hr(e.otherwise)];case"and":return e.predicates.flatMap(t=>hr(t));case"count":return[]}}function Zm(e,t){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map([...e.world,...e.maybe].map(r=>[r.as,r.entity])),optionals:e.maybe,setups:e.world,stable:OP(t)}}function OP(e){let t=new Map(e.entities.map(r=>[r.name,r]));return(r,n)=>t.get(r)?.props[n]?.stable===!0}function mr(e){return e.by==="inside"?[...mr(e.scope),...mr(e.target)]:e.by==="role"?e.name==null?[]:bt(e.name):bt(e.value)}function Xm(e){return Qm(e)?Object.values(e.selection.where).flatMap(t=>Xm(t)):bt(e)}function Qm(e){return typeof e=="object"&&e!==null&&"kind"in e}function MP(e){return e.kind==="goto"?bt(e.url):e.kind==="fill"||e.kind==="select"?[...mr(e.locator),...bt(e.value)]:e.kind==="press"?e.locator==null?[]:mr(e.locator):(e.kind==="upload",mr(e.locator))}function NP(e){return[...MP(e.action),...e.expect.flatMap(t=>hr(t))]}function LP(e){return e.absences.map(t=>({entity:t.entity,...si(t.where,t.entity,e)}))}function si(e,t,r){let n=Object.entries(e).filter(([s])=>r.stable(t,s)),i=Object.fromEntries(n.flatMap(([s,a])=>He(a)||pr(a)?[]:[[s,a]])),o=n.flatMap(s=>{let a=s[1];if(!He(a))return[];let l=vc(a.ref,r.namespace).at(0);return l==null?[]:[{entity:l.entity,field:s[0],targetAlias:l.aliasPath,targetField:l.field}]});return{literals:i,relations:o}}function eg(e,t){return e.map(r=>({alias:r.as,entity:r.entity,...si(r.set,r.entity,t)}))}function $P(e){return eg(e.setups,e)}function DP(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),r=t===-1?e.chunk:e.chunk.slice(0,t),n=e.chunk.slice(r.length),i=n.at(-1)??e.chunk.at(-1);if(i==null)throw new Error("empty transition chunk");let o=[...new Set(e.chunk.flatMap(s=>NP(s)))];return{effectStep:i,guard:e.guard,index:e.index,intent:e.intent,namespace:e.namespace,nav:r,paramSpaces:Object.fromEntries(o.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),steps:n,test:e.testName,wait:Pm(n.flatMap(s=>_P(s)))}}function _P(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function vc(e,t){let r=e.lastIndexOf(".");if(r===-1)return[];let n=e.slice(0,r),i=t.get(n);return i==null?[]:[{aliasPath:n,entity:i,field:e.slice(r+1),ref:e}]}function tg(e,t){let r=e.tests.find(n=>n.name===t);if(r==null)throw new Error(`test "${t}" not found in lockfile`);return r}function jP(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function FP(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function BP(e){return Sc(e,0,[],[])}function Sc(e,t,r,n){let i=e[t];if(i==null)return r.length===0?n:[...n,r];let o=[...r,i];return VP(i)?Sc(e,t+1,[],[...n,o]):Sc(e,t+1,o,n)}function VP(e){return e.expect.some(t=>t.kind==="state")}function rg(e){return ng(e,new Map)}function UP(e,t){return e.reduce((r,n)=>r??t(n),null)}function ng(e,t){let r=e.variables.find(n=>!t.has(n));return r==null?t:UP(e.domain(r),n=>{let i=new Map([...t,[r,n]]);return e.consistent(i)?ng(e,i):null})}function Tt(e,t){let r=WP(e,t);if(r==null)return null;let n=JP(r);return YP(e.singletons,t,n)?n:null}function WP(e,t){let{absences:r,entities:n,exclusives:i,optionals:o}=e,s=new Map(n.map(c=>[c.alias,c])),a=rg({variables:n.map(c=>c.alias),consistent:c=>HP(c)&&zP(n,c)&&qP(r,c,t),domain:c=>sg(s.get(c),t)});if(a==null)return null;let l=ag(o,a,t);return KP(i,[...n,...o],l,t)?l:null}function HP(e){let t=[...e.values()];return new Set(t).size===t.length}function zP(e,t){return e.every(r=>t.has(r.alias)?r.relations.every(n=>GP(r,n,t)):!0)}function GP(e,t,r){if(!r.has(t.targetAlias))return!0;let n=r.get(t.targetAlias)?.[t.targetField];return n==null?!0:r.get(e.alias)?.[t.field]===n}function qP(e,t,r){return e.every(n=>![...r.entities.get(n.entity)?.values()??[]].some(i=>ig(i,n,t)))}function ig(e,t,r){return og(e,t)?t.relations.every(n=>{if(!r.has(n.targetAlias))return!1;let i=r.get(n.targetAlias)?.[n.targetField];return i!=null&&e[n.field]===i}):!1}function og(e,t){return Object.entries(t.literals).every(([r,n])=>n===null?e[r]==null:e[r]===n)}function sg(e,t){return e==null?[]:[...t.entities.get(e.entity)?.values()??[]].filter(r=>og(r,e))}function ag(e,t,r){let n=e.reduce((i,o)=>{if(i.has(o.alias))return i;let s=new Set(i.values()),a=sg(o,r).find(l=>!s.has(l)&&ig(l,o,i));return a==null?i:new Map([...i,[o.alias,a]])},t);return n.size===t.size?n:ag(e,n,r)}function KP(e,t,r,n){return e.every(i=>{let o=t.filter(a=>a.entity===i&&r.has(a.alias)).length;return(n.entities.get(i)?.size??0)===o})}function JP(e){return new Map([...e].flatMap(([t,r])=>Object.entries(r).flatMap(n=>{let i=n[1];return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[[Vt(`${t}.${n[0]}`),i]]:[]})))}function YP(e,t,r){return Object.entries(e).every(([n,i])=>{if(!$o(i,le,r))return!1;let o=yt(i,le,r),s=t.singletons[n],a=jt.safeParse(n);return a.success?Ql(a.data,o,s):s===o})}function Ho(e,t,r){let n=Tt(e.guard,t);return n==null?null:new Map([...n,...Object.entries(r).map(([i,o])=>[Vt(i),o])])}function zo(e,t){let r=oi(e.effectStep,t),n=QP(e,t),i=[...e.nav,...e.steps].map(o=>oi(o,t));return{effect:eT(r.effect,n),steps:i.map(o=>({action:o.action,effect:o.effect,obligations:o.obligations,reconcile:o.reconcile,verifyChanges:o.verifyChanges}))}}function xc(e,t,r){return Tt(e.guard,r)==null?!1:Wo(t(r))!==Wo(r)||tT(e)||ZP(e)}function ZP(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}var lg=new WeakMap;function Wo(e){let t=lg.get(e);if(t!=null)return t;let r=Me({entities:[...e.entities].map(([n,i])=>[n,[...i]]),singletons:XP(e.singletons)});return lg.set(e,r),r}function XP(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>t==="url"&&typeof r=="string"?[t,lr(r)]:[t,r]))}function QP(e,t){let r=e.nav.at(-1);return r==null?void 0:oi(r,t).action.url}function eT(e,t){if(t==null)return e;let r=lr(t);return n=>{let i=e(n);return{...i,singletons:{...i.singletons,url:r}}}}function tT(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>fr(r)))}function cg(e,t,r){let n=Ho(e,t.snapshot,r);if(n==null)return null;let i=rT(e,n);return i==null||!xc(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function ug(e,t,r){let n=Ho(e,t.snapshot,r);if(n==null)return"guard-unsatisfied";try{return zo(e,n),"no-effect"}catch{return"unresolvable"}}function rT(e,t){try{return zo(e,t)}catch{return null}}var nT={absences:[],entities:[],exclusives:[],optionals:[],singletons:{}};function ai(e){return{...nT,...e}}function kc(e){return iT(e).flatMap(t=>oT(t))}function iT(e){return[...e.reduce((r,n)=>{let i=Me([n.when.singletons,n.consequence]);return new Map([...r,[i,[...r.get(i)??[],n]]])},new Map).values()]}function oT(e){if(e.length<2)return[];let t=e.map(o=>new Set(o.when.entities.map(s=>dg(s)))),[r]=t;if(r==null)return[];let n=[...r].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||n.length===i.when.entities.length?[]:sT(i,n,lT(e))}function dg(e){return Me([e.entity,e.literals])}function sT(e,t,r){let n=e.when.entities.filter(s=>t.includes(dg(s))),i=new Set(n.map(s=>s.alias));if(![...e.refs].every(s=>i.has(s)))return[];let o=ai({entities:n.map(s=>aT(s,i)),optionals:e.when.optionals.filter(s=>i.has(s.alias)),singletons:e.when.singletons});return[{consequence:e.consequence,origin:{kind:"generalized",tests:r},refs:e.refs,when:o}]}function aT(e,t){return{...e,relations:e.relations.filter(r=>t.has(r.targetAlias))}}function lT(e){return[...new Set(e.flatMap(t=>t.origin==null?[]:t.origin.kind==="generalized"?t.origin.tests:[t.origin.test]))]}function Ec(e){return e.flatMap((t,r)=>e.slice(r+1).flatMap(n=>mg(t,n)))}function hg(e,t){return mg(e,t).length>0}function mg(e,t){let r=pg(e.when,t.when);return!r&&!pg(t.when,e.when)||!uT(e.consequence,t.consequence)?[]:[{a:e.consequence,b:t.consequence,when:r?t.when:e.when}]}function pg(e,t){return Cc(e.entities,t.entities)&&Cc(e.absences,t.absences)&&Cc(e.optionals,t.optionals)&&e.exclusives.every(r=>t.exclusives.includes(r))&&cT(e.singletons,t.singletons)}function Cc(e,t){let r=new Set(t.map(n=>Me(n)));return e.every(n=>r.has(Me(n)))}function cT(e,t){return Object.entries(e).every(([r,n])=>Me(t[r])===Me(n))}function uT(e,t){return e.kind==="not"?Rc(e.predicate,t):t.kind==="not"?Rc(e,t.predicate):dT(e,t)||pT(e,t)}function Rc(e,t){return e.kind===t.kind&&"locator"in e&&"locator"in t&&gg(e,t)}function gg(e,t){return"locator"in t&&Me(e.locator)===Me(t.locator)}function dT(e,t){let r=new Set([e.kind,t.kind]);return r.has("enabled")&&r.has("disabled")&&"locator"in e&&"locator"in t?gg(e,t):!1}function pT(e,t){let r=fg(e),n=fg(t);return r==null||n==null||e.kind!==t.kind?!1:Rc(e,t)&&Me(r)!==Me(n)}function fg(e){return e.kind==="value"||e.kind==="text"?e.value:null}function Ic(e,t){return e.flatMap(r=>{let n=fT(r),i=new Set(r.guard.absences.map(o=>o.entity));return t.flatMap(o=>hT(r,o,n,i))})}function fT(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function hT(e,t,r,n){let{source:i,target:o}=t.reference;return!r.has(o)||r.has(i)||n.has(i)?[]:[{invariant:t,source:i,target:o,transition:Ut(e)}]}function Pc(e){return Me({consequence:e.consequence,when:e.when})}function Tc(e){let t=[...mT(e),...RT(e)],r=kc(t).reduce((n,i)=>[...t,...n].some(s=>hg(i,s))?n:[...n,i],[]);return Lr([...t,...r],Pc)}function Oc(e){return e.kind==="not"?Oc(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="value"||e.kind==="text"}function Mc(e,t,r){if(Tt(e.when,t)!=null)return null;let n=Tt(e.when,r);return n==null?null:IT(e,n)}function mT(e){return Lr(e.tests.flatMap(t=>gT(e,t)),Pc)}function gT(e,t){let r=Uo(e,t.name);return t.steps.reduce((n,i)=>({guard:yT(n.guard,i,r),laws:[...n.laws,...CT(i,n.guard,r.namespace,{kind:"test",test:t.name})]}),{guard:r.guard,laws:[]}).laws}function yT(e,t,r){return t.expect.reduce((n,i)=>i.kind==="state"?bT(n,i,r):n,e)}function bT(e,t,r){if(t.assertion.kind==="created"){let o=wT(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,o]}}let n=Vo(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return xT(e,n);let i=$r(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===n?Ac(o,i,r):o),optionals:e.optionals.map(o=>o.alias===n?Ac(o,i,r):o)}}function wT(e,t,r,n){return Ac({alias:e,entity:t,literals:{},relations:[]},r,n)}function Ac(e,t,r){return Object.entries(t).reduce((n,[i,o])=>{if(pr(o)||!r.stable(e.entity,i))return n;if(He(o)){let s=ST(o.ref,i,r.namespace);return{...n,literals:vT(n.literals,i),relations:s==null?n.relations:[...yg(n.relations,i),s]}}return{...n,literals:{...n.literals,[i]:o},relations:yg(n.relations,i)}},e)}function ST(e,t,r){let n=e.lastIndexOf(".");if(n===-1)return;let i=e.slice(0,n),o=r.get(i);return o==null?void 0:{entity:o,field:t,targetAlias:i,targetField:e.slice(n+1)}}function vT(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function yg(e,t){return e.filter(r=>r.field!==t)}function xT(e,t){let r=[...e.entities,...e.optionals].find(i=>i.alias===t),n=kT(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,relations:r.relations}]}}function kT(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t),optionals:e.optionals.filter(r=>r.alias!==t)}}function CT(e,t,r,n){if(e.action.kind!=="goto")return[];let i=e.action.url;return e.expect.filter(o=>Oc(o)).map(o=>bg({consequence:o,guard:t,namespace:r,origin:n,url:i}))}function bg({consequence:e,guard:t,namespace:r,origin:n,url:i}){return{consequence:e,origin:n,refs:new Set(Ym([...bt(i),...hr(e)],r).map(o=>o.aliasPath)),when:{...t,singletons:{...t.singletons,url:i}}}}function RT(e){return Lr(rn(e).flatMap(t=>ET(t)),Pc)}function ET(e){let t=e.nav.at(-1),r=e.steps[0]?.action,n=r!=null&&"locator"in r?r.locator:void 0;return t==null||t.action.kind!=="goto"||n==null?[]:[bg({consequence:{kind:"enabled",locator:n,wait:void 0},guard:e.guard,namespace:e.namespace,origin:{intent:e.intent,kind:"trigger",test:e.test},url:t.action.url})]}function IT(e,t){try{let r=jo(e.consequence,t);return r==null?null:{check:r}}catch{return null}}function Nc(e){return lc(e.tests.flatMap(t=>AT(e,t.name)))}function Lc(e,t){return Tt(e.when,t)==null?!1:Tt(e.holds,t)==null}function AT(e,t){let r=Uo(e,t);return r.guard.entities.flatMap(n=>n.relations.flatMap(i=>PT(e,n,i,r.namespace)?MT(n,i,r.namespace):[]))}function PT(e,t,r,n){let i=n.get(r.targetAlias);return i!=null&&!TT(e,t.entity,r.field)&&OT(e,i,r.targetField)}function TT(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function OT(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function MT(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let i=wg(e.alias,e.entity),o=wg(t.targetAlias,n);return[{holds:ai({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:ai({entities:[i]})}]}function wg(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function $c(e,t,r){return t.steps.map(n=>({effect:n.effect,obligations:n.obligations.map(i=>({budget:i.budget,check:{kind:"poll",run:()=>r.evaluate(i.check)},source:{check:i.check,kind:"step"}})),reconcile:n.reconcile,settle:e.wait,step:{action:n.action,intent:e.intent,test:e.test},verifyChanges:n.verifyChanges,guard:()=>!0,perform:()=>r.perform(n.action)}))}async function Sg(e,t){let{params:r,transition:n}=e.firing,i=cg(n,e.state,r);if(i==null){let s={intent:n.intent,kind:"unfireable",reason:ug(n,e.state,r),test:n.test};return{label:Ut(n),next:e.state,result:{finalModel:e.state.snapshot,findings:[s]}}}let o=await dc({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,lawObligations:LT(e.laws,e.invariants,e.driver),observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,steps:$c(e.firing.transition,i.resolved,e.driver)},t);return{label:Ut(e.firing.transition),next:{snapshot:o.finalModel},result:o}}function NT(e,t){return Lc(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},source:{invariant:e,kind:"invariant"}}]:[]}function LT(e,t,r){return(n,i)=>[...e.flatMap(o=>$T(o,n,i,r)),...t.flatMap(o=>NT(o,i))]}function $T(e,t,r,n){let i=Mc(e,t,r);return i==null?[]:[{budget:"fast",check:{kind:"poll",run:()=>n.evaluate(i.check)},source:{check:i.check,kind:"law",origin:e.origin}}]}function _c(e,t){return Dc({acc:{findings:[],fired:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function Dc({acc:e,index:t,params:r,signal:n,state:i,stepBase:o}){dr(n);let s=r.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=await Sg({canon:r.canon,classify:r.classify,driver:r.driver,firing:s,invariants:r.invariants,laws:r.laws,onAssertion:r.onAssertion,state:i,onStep:d=>{l.push(d.index),r.onEvent({endMs:d.endMs,findings:d.findings,index:o+d.index,kind:"step",startMs:d.startMs})}},n);if(c==null)return Dc({acc:e,index:t+1,params:r,signal:n,state:i,stepBase:o});r.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"fired",startMs:a}),c.result.findings.forEach(d=>{r.onEvent({finding:d,kind:"finding"})});let u={findings:[...e.findings,...c.result.findings],fired:[...e.fired,c.label]};return Dc({acc:u,index:t+1,params:r,signal:n,state:c.next,stepBase:o+l.length})}var Fc={value:e=>DT(e)};function Bc(e,t){return{value:r=>e.value({...r,seed:`${t}:${r.seed}`})}}function Vc(e,t){return{value:r=>e.value({...r,anchor:t})}}function DT({anchor:e,constraints:t,generator:r,nullable:n,seed:i,type:o,values:s,valueSpace:a}){let l=jc(`${a}:${i}`);return n&&l%4===0?null:s!=null&&s.length>0?s[l%s.length]??s[0]??null:r==="date.iso"?_T({anchor:e,constraints:t,n:l,timeHash:jc(`${a}:${i}#tod`)}):o==="number"?jT(l,t):o==="boolean"?l%2===0:FT(r,l.toString(36))}var Go=864e5;function _T({anchor:e,constraints:t,n:r,timeHash:n}){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+r%o,a=Math.floor(i/Go)*Go;return new Date(a+s*Go+n%Go).toISOString()}function jc(e,t=0,r=7){return t>=e.length?r>>>0:jc(e,t+1,r*31+(e.codePointAt(t)??0)>>>0)}function jT(e,t){if(t?.kind!=="number"||t.min==null||t.max==null)throw new Error("number value space requires min and max constraints");let r=t.max-t.min+1;return r<=0?t.min:t.min+e%r}function FT(e,t){if(e==="internet.email")return`${t}@test.ripplo.ai`;if(e==="internet.url")return`https://${t}.example.com`;let r=e.split(".").at(-1);if(r==null)throw new Error(`generator "${e}" has no "."-suffix`);return`${r}-${t}`}import{ResultAsync as Wc}from"neverthrow";var li=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}};function Uc(e){return{read:t=>BT(t,e),seedScript:t=>`globalThis[${JSON.stringify(jl)}] = ${JSON.stringify(t)};`}}async function BT(e,t){let r={title:await e.title(),url:lr(e.url()),viewport:WT(e.viewportSize())};if(t.length===0)return r;let n=await e.evaluate(UT,{mountKey:ko,names:t,timeoutMs:VT});if(n.kind==="unmounted")throw new li(ko);return{...r,...n.values}}var VT=5e3;async function UT(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(n=>setTimeout(n,25));let r=Reflect.get(globalThis,e.mountKey);return r==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(n=>[n,r.readSingleton(n)??null]))}}function WT(e){return e==null?"":`${String(e.width)}x${String(e.height)}`}function zc(e,t,r){return{evaluate:n=>Wc.fromPromise(kg(HT(e,r,n),`check ${n.kind}`),vg),observe:()=>t.read().andThen(n=>Wc.fromPromise(kg(Cg(e,r,0),"observe"),vg).map(i=>({snapshot:{...n,singletons:{...n.singletons,...i}}}))),perform:n=>Wc.fromPromise(Eg(e,n,0),i=>fm(n.kind,i))}}async function HT(e,t,r){try{return await Pg(e,t,r)}catch(n){if(Rg(n))return!1;throw n}}function vg(e){return e instanceof li?cm(e.mountKey):hm(e)}var zT=[100,250,500];async function Cg(e,t,r){try{return await t.read(e)}catch(n){let i=zT[r];if(i==null||!Rg(n))throw n;return await Ag(i),Cg(e,t,r+1)}}function Rg(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 xg=35e3;function kg(e,t){let r,n=new Promise((i,o)=>{r=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(xg)}ms`))},xg)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}var GT=[250,750,2e3];async function Eg(e,t,r){try{await qT(e,t)}catch(n){let i=GT[r];if(i==null||!YT(n))throw n;await Ag(i),await Eg(e,t,r+1)}}async function qT(e,t){if(t.kind==="goto"){await e.goto(nn(t.url,t,"url"));return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(nn(t.key,t,"key"));return}await KT(Ig(e,t.locator),t)}function nn(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function KT(e,t){switch(t.kind){case"goto":throw new Error("goto must not be located");case"fill":return e.fill(String(nn(t.value,t,"value")));case"clear":return e.clear();case"click":return e.click();case"dblclick":return e.dblclick();case"check":return e.check();case"uncheck":return e.uncheck();case"hover":return e.hover();case"select":return e.selectOption(String(nn(t.value,t,"value")));case"upload":return e.setInputFiles(nn(t.files,t,"files"));case"press":return e.press(nn(t.key,t,"key"))}}function Ig(e,t){if(t==null)throw new Error("action requires a locator");return Hc(e,t)}function Hc(e,t){return t.by==="testId"?e.getByTestId(t.value):t.by==="inside"?Hc(Hc(e,t.scope),t.target):e.locator(JT(t.role,t.name))}function JT(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}function YT(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 Ag(e){return new Promise(t=>{setTimeout(t,e)})}async function Pg(e,t,r){if(r.kind==="browser")return ZT(e,t,r.name,r.value);if(r.kind==="not")return!await Pg(e,t,r.inner);let n=Ig(e,r.locator);return r.kind==="visible"?n.isVisible():r.kind==="disabled"?n.isDisabled():r.kind==="enabled"?n.isEnabled():r.kind==="focused"?n.evaluate(i=>i===i.ownerDocument.activeElement):r.kind==="value"?await n.inputValue()===r.value:(await n.textContent()??"").includes(r.value)}async function ZT(e,t,r,n){let o=(await t.read(e))[r];return typeof o=="string"&&o.includes(n)}import{chromium as Og}from"playwright";async function Gc({baseUrl:e,browser:t,capture:r,clientState:n,engine:i,reader:o,session:s}){let a=await t.newContext({baseURL:e,reducedMotion:"reduce",storageState:s==null?void 0:{cookies:s.cookies,origins:s.origins}});s?.headers!=null&&await a.setExtraHTTPHeaders(s.headers),await a.addInitScript(i.seedScript(n));let l=await r.hub.attach(a,r.runId),c=await a.newPage();return l.onPage(c),{driver:XT(zc(c,o,i),l),emitAssertion:l.emitAssertion,close:()=>QT({context:a,handle:l})}}async function qc(e,t){let r=await Og.launch({headless:!e});try{return await t(r)}finally{await r.close()}}function Mg({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??=Og.launch({headless:!e}),t},close:async()=>{let i=t;t=void 0,i!=null&&await i.then(o=>o.close()).catch(()=>{})}}}function XT(e,t){return{evaluate:e.evaluate,observe:e.observe,perform:r=>(t.emitAction(r),e.perform(r))}}async function QT({context:e,handle:t}){await Tg(t.finish()),await Tg(e.close())}var eO=15e3;async function Tg(e){let t,r=new Promise(n=>{t=setTimeout(n,eO)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as tO,ok as rO,Result as Kc}from"neverthrow";function Jc(e,t,r){return{read:()=>r.read(e.map(n=>n.name),t).andThen(n=>nO(e,n))}}function nO(e,t){return Kc.combine(e.map(r=>iO(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),singletons:t.singletons}))}function iO(e,t){let r=Fo(e);return Kc.combine(t.map(n=>oO(n,e).map(i=>[i,sO(n,r)]))).map(n=>new Map(n))}function oO(e,t){return Kc.combine(t.identity.map(r=>{let n=e[r];return n==null?tO(dm(t.name,r)):rO(String(n))})).map(r=>r.join(":"))}function sO(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}var Lg=so(wl(),1);import aO from"crypto";import{err as lO,errAsync as Ng,ok as cO,ResultAsync as qo}from"neverthrow";var uO=3e4,dO=[250,750,2e3];function Yc({baseUrl:e,runId:t,secret:r},n){let i=new Lg.Webhook(r),o=(s,a,l)=>pO({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:Hl,signal:n}).map(l=>({entities:l.entities,singletons:l.singletons}))},setupWorld:s=>o("/setup",{entities:s,runId:t},{retry:"connection",schema:Wl,signal:n}).map(a=>a.rows),teardown:()=>o("/teardown",{runId:t},{retry:"connection",schema:zl,signal:void 0}).map(()=>{})}}function pO(e){return $g(e.retry,()=>yO(e),0)}function $g(e,t,r){return t().orElse(n=>{let i=dO[r];return i==null||!hO(n,e)?Ng(n):qo.fromSafePromise(gO(i)).andThen(()=>$g(e,t,r+1))})}var fO=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function hO(e,t){return e.kind==="aborted"?!1:mO(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function mO(e){return e.kind==="engine-network"&&e.code!=null&&fO.has(e.code)}function gO(e){return new Promise(t=>{setTimeout(t,e)})}function yO({baseUrl:e,body:t,path:r,schema:n,signal:i,webhook:o}){let s=JSON.stringify(t);return qo.fromPromise(fetch(`${e}${r}`,{body:s,headers:{"Content-Type":"application/json",...bO(o,s)},method:"PUT",signal:wO(i)}),a=>Oo(r,a)).andThen(a=>SO(a,r)).andThen(a=>vO(n,a,r)).mapErr(a=>i?.aborted===!0?mm():a)}function bO(e,t){let r=`msg_${aO.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function wO(e){let t=AbortSignal.timeout(uO);return e==null?t:AbortSignal.any([e,t])}function SO(e,t){return e.ok?qo.fromPromise(e.json(),r=>Oo(t,r)):qo.fromPromise(e.text().catch(()=>""),r=>Oo(t,r)).andThen(r=>Ng(lm(t,e.status,r)))}function vO(e,t,r){let n=e.safeParse(t);return n.success?cO(n.data):lO(um(r,n.error))}var pe=so(jg(),1),_={actual:e=>pe.default.red(e),bad:e=>pe.default.red(pe.default.bold(e)),bold:e=>pe.default.bold(e),dim:e=>pe.default.dim(e),expected:e=>pe.default.green(e),good:e=>pe.default.green(pe.default.bold(e)),heading:e=>pe.default.bold(pe.default.cyan(e)),path:e=>pe.default.cyan(pe.default.underline(e)),warn:e=>pe.default.yellow(pe.default.bold(e))},RO={assertion:pe.default.yellow,consistency:pe.default.magenta,driver:pe.default.red,illegal:pe.default.cyan,invariant:pe.default.yellow,unfireable:pe.default.red};function ci(e){return`${pe.default.red(pe.default.bold("\u2717"))} ${RO[e](pe.default.bold(e.toUpperCase()))}`}var EO=pe.default.red("\u2717"),oZ=pe.default.green("\u2713"),Fg=pe.default.dim("\u203A"),IO=8;function te(e,t,r){let n=r==null?"":` ${_.dim(r)}`;return` ${_.dim(e.padStart(IO))} ${t}${n}`}function sn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${sn(e.scope)} \u25B8 ${sn(e.target)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function Xc(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${sn(e.locator)}`:e.kind}function Yo(e){return e.kind==="not"?`not ${Yo(e.inner)}`:e.kind==="browser"?`${e.name}="${e.value}"`:e.kind==="value"||e.kind==="text"?`${e.kind} ${sn(e.locator)}="${e.value}"`:`${e.kind} ${sn(e.locator)}`}function Zo(e){let{field:t,source:r,target:n,targetField:i}=e.reference;return`${r}.${t} \u2192 ${n}.${i}`}function Vg(e){return`${e.intent} \u203A ${Xc(e.action)}`}function Ug(e){return e.kind==="invariant"?`invariant ${Zo(e.invariant)}`:`${e.kind} ${Yo(e.check)}`}function on(e){return e==null?"\u2205":JSON.stringify(e)}function Qc(e){return{label:Ug(e.source),step:Vg(e.step)}}function ui(e){return e.kind==="consistency"?TO(e):e.kind==="obligation"?DO(e.source,e.step,e.budget):e.kind==="illegal-transition"?Dr("illegal","guard was false before this step",e.step,[te("meaning",_.dim("the action fired from a state the model says is unreachable"),void 0)]):e.kind==="unfireable"?Dr("unfireable",`could not fire "${e.intent}"`,void 0,[te("reason",_.actual(PO(e.reason)),void 0),te("meaning",_.dim("a planned move was skipped \u2014 never silently drop it"),void 0)]):Dr("driver","the browser failed to run this step",e.step,[te("cause",_.actual(cr(e.error)),void 0),te("decide",_.dim("environment/infra failure \u2014 fix the run environment (daemon, dev server, ports); never weaken the model or app for a driver failure"),void 0)])}var AO={"guard-unsatisfied":"the guard isn't satisfied by the live state","no-effect":"the move has no observable effect from this state",unresolvable:"a step references a value the model can't resolve yet (e.g. a not-yet-created id)"};function PO(e){return AO[e]}function eu({debugDir:e,runId:t}){let r=`${e}/${t}`;return te("behavior",_.path(`${r}/behavior.jsonl`),void 0)}function tu(e){if(e.kind==="cascade-gap"){let{gap:n}=e,i=`${n.transition} deletes ${n.target} but leaves ${n.source} dangling`;return`${ci("invariant")} ${_.bold(i)}
|
|
114
|
+
${te("breaks",_.dim(Zo(n.invariant)),void 0)}`}if(e.kind==="create-gap"){let{gap:n}=e,i=`${n.transition} creates ${n.entity} without setting required field(s)`;return`${ci("invariant")} ${_.bold(i)}
|
|
115
|
+
${te("missing",_.dim(n.missing.join(", ")),void 0)}`}let{conflict:t}=e,r=`view laws contradict: ${t.a.kind} vs ${t.b.kind}`;return`${ci("invariant")} ${_.bold(r)}
|
|
116
|
+
${te("when",_.dim(JSON.stringify(t.when.singletons)),void 0)}`}function Dr(e,t,r,n){let i=r==null?[]:[` ${r.intent} ${Fg} ${_.dim(Xc(r.action))}`];return[`${ci(e)} ${_.bold(t)}`,...i,...n].join(`
|
|
117
|
+
`)}function TO(e){return e.pending?Dr("consistency",NO(e.divergence),e.step,[...Bg(e.divergence),te("meaning",_.dim(`the write never landed within the ${LO(e.budget)} settle budget \u2014 the app still showed the pre-step value, not a wrong one`),void 0),te("fix",_.dim("declare wait: on the expectation (or a slower tier) if this write is legitimately slow"),void 0)]):Dr("consistency",$O(e.divergence),e.step,[...Bg(e.divergence),te("decide",_.dim(MO(e.divergence)),void 0)])}var OO={absent:"app bug if the write was promised; if it only happens from a different starting state, restrict this test's given and cover that state in its own test","expected-change":"app bug if this action should change it; if the change needs other preconditions, split that case into its own test with the right given","field-mismatch":"app bug if the model value is the promised behavior; if the app legitimately owns this value, mark the field stable: false or assert changed() instead","ghost-write":"declare the missing effect on the acting step (Entity.created/updated/deleted), or if this write belongs to a different flow, cover it in that flow's test","singleton-mismatch":"app bug if the model value is the promised behavior; otherwise correct the singleton's expected value at the step that sets it"};function MO(e){return OO[e.kind]}function NO(e){return e.kind==="field-mismatch"?`${e.entity}.${e.field} write never landed`:e.kind==="ghost-write"?`${e.entity} "${e.key}" delete never landed`:e.kind==="absent"?`${e.entity} "${e.key}" create never landed`:e.kind==="expected-change"?`${e.entity}.${e.field} never changed`:`${e.singleton} write never landed`}function Bg(e){if(e.kind==="field-mismatch")return[te("row",_.dim(`${e.entity} ${e.key}`),void 0),te("expected",_.expected(on(e.snapshot)),"model predicted this"),te("actual",_.actual(on(e.sut)),"app showed this")];if(e.kind==="singleton-mismatch")return[te("expected",_.expected(on(e.snapshot)),"model predicted this"),te("actual",_.actual(on(e.sut)),"app showed this")];if(e.kind==="expected-change")return[te("row",_.dim(`${e.entity} ${e.key}`),void 0),te("expected",_.expected("a different value"),"changed() asserted a change"),te("actual",_.actual(on(e.value)),"app left it unchanged")];let t=e.kind==="ghost-write"?"an app write the model never declared \u2014 unmodeled side effect":"the model expected this row but the app has none";return[te("meaning",_.dim(t),void 0)]}function LO(e){return`${String(ti[e]/1e3)}s "${e}"`}function $O(e){return e.kind==="field-mismatch"?`${e.entity}.${e.field} diverged`:e.kind==="ghost-write"?`${e.entity} "${e.key}" written but never modeled`:e.kind==="absent"?`${e.entity} "${e.key}" missing in the app`:e.kind==="expected-change"?`${e.entity}.${e.field} never changed`:`${e.singleton} diverged`}function DO(e,t,r){if(e.kind==="invariant")return Dr("invariant",`${Zo(e.invariant)} violated`,t,[te("meaning",_.dim("a referenced row went missing after this step"),void 0)]);let n=e.kind==="law"?"view law never held":"expectation never held",i=e.kind==="law"&&e.origin!=null?[_O(e.origin)]:[];return Dr("assertion",n,t,[te("check",_.warn(Yo(e.check)),void 0),...i,te("budget",_.dim(`${r} (polled until timeout)`),void 0),te("decide",_.dim("wrong locator/accessible name, UI regression, or the expectation only holds under a narrower given \u2014 confirm in behavior.jsonl before changing the test"),void 0)])}function _O(e){if(e.kind==="test")return te("law from",_.dim(`an assertion in test "${e.test}"`),void 0);if(e.kind==="trigger")return te("law from",_.dim(`the trigger of "${e.intent}" (test "${e.test}")`),void 0);let t=e.tests.map(r=>JSON.stringify(r)).join(", ");return te("law from",_.dim(`generalized across tests ${t}`),void 0)}import{err as fF,ok as hF,ResultAsync as mF}from"neverthrow";import Zw from"path";import jO from"path";import{z as di}from"zod";var FO=["unspecified","internal","server","client","producer","consumer"],BO=["unset","ok","error"];function Wg(e){return FO[e]??"unspecified"}function Hg(e){return BO[e]??"unset"}var hZ=di.looseObject({data:di.looseObject({source:di.number().optional()}).optional(),timestamp:di.number(),type:di.number()});function zg({debugDir:e,runId:t,worker:r}){let n=jO.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:i=>r.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(VO(i.noticeIfNoRrweb)),runId:t}),emit:i=>{r.line({line:JSON.stringify(i),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{r.rrwebBatch({data:i,runId:t})}}}function an(e){return String(BigInt(Math.round(e))*1000000n)}function VO(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}import{existsSync as UO}from"fs";import{createRequire as WO}from"module";import{fileURLToPath as HO}from"url";import{Worker as zO}from"worker_threads";var GO=WO(import.meta.url);function Gg(e){let t=new zO(qO(),{workerData:e});t.unref();let r=new Map,n={next:0};t.on("message",o=>{let s=r.get(o.seq);s!=null&&(r.delete(o.seq),s())});let i=o=>{t.postMessage(o)};return{close:({noticeLineIfNoRrweb:o,runId:s})=>{let a=n.next;return n.next+=1,new Promise(l=>{r.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 qO(){try{return GO.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>HO(new URL(r,import.meta.url))),t=e.find(r=>UO(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as KO}from"fs/promises";import{createRequire as JO}from"module";import{fileURLToPath as YO}from"url";var ZO=JO(import.meta.url);function ru(e,t){try{return ZO.resolve(e)}catch{return YO(new URL(`assets/${t}`,import.meta.url))}}var XO=ru("@ripplo/browser-trace/bundle","browser-trace.js");async function Kg(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await QO())}var qg;function QO(){return qg??=KO(XO,{encoding:"utf8"}),qg}import{createServer as eM}from"http";import{mkdir as tM,rm as rM,writeFile as nM}from"fs/promises";import iM from"path";import{z as re}from"zod";var oM="otlp-port",Yg=re.object({key:re.string(),value:re.object({boolValue:re.boolean().optional(),doubleValue:re.number().optional(),intValue:re.union([re.string(),re.number()]).optional(),stringValue:re.string().optional()})}),sM=re.object({attributes:re.array(Yg).default([]),endTimeUnixNano:re.string(),kind:re.number().default(0),name:re.string(),parentSpanId:re.string().optional(),spanId:re.string(),startTimeUnixNano:re.string(),status:re.object({code:re.number(),message:re.string().optional()}).optional(),traceId:re.string()}),aM=re.object({resourceSpans:re.array(re.object({resource:re.object({attributes:re.array(Yg).default([])}).optional(),scopeSpans:re.array(re.object({spans:re.array(sM).default([])})).default([])})).default([])});async function pi({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:i,server:o}=await lM({onRrwebBatch:t,onSpan:r}),s=iM.join(e,oM);return n&&(await tM(e,{recursive:!0}),await nM(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{n&&await rM(s,{force:!0}),await fM(o)}}}function lM(e){return new Promise((t,r)=>{let n=eM((i,o)=>{cM(i,o,e)});n.on("error",r),n.listen(0,()=>{let i=n.address();if(i==null||typeof i=="string"){r(new Error("otlp_receiver_no_port"));return}t({port:i.port,server:n})})})}function cM(e,t,r){let n=uM(e.url);if(n!=null){Jg(e).then(i=>{r.onRrwebBatch(n,i),Xo(t)}).catch(()=>{Xo(t)});return}Jg(e).then(i=>{dM(aM.parse(JSON.parse(i.toString("utf8"))),r.onSpan),Xo(t)}).catch(()=>{Xo(t)})}function uM(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Jg(e){return new Promise((t,r)=>{let n=[];e.on("data",i=>{n.push(i)}),e.on("end",()=>{t(Buffer.concat(n))}),e.on("error",r)})}function Xo(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function dM(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:pM(r.attributes),durationMs:Number((BigInt(r.endTimeUnixNano)-BigInt(r.startTimeUnixNano))/1000000n),kind:"span",name:r.name,parentSpanId:r.parentSpanId,source:"server",spanId:r.spanId,spanKind:Wg(r.kind),status:{code:Hg(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function pM(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function fM(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{readFile as D6}from"fs/promises";var hM=Object.defineProperty,mM=(e,t,r)=>t in e?hM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k=(e,t,r)=>mM(e,typeof t!="symbol"?t+"":t,r),Zg,gM=Object.defineProperty,yM=(e,t,r)=>t in e?gM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xg=(e,t,r)=>yM(e,typeof t!="symbol"?t+"":t,r),Fe=(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))(Fe||{}),Qg={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ey={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Qo={},bM=()=>!!globalThis.Zone;function sd(e){if(Qo[e])return Qo[e];let t=globalThis[e],r=t.prototype,n=e in Qg?Qg[e]:void 0,i=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),o=e in ey?ey[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!bM())return Qo[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 c=l[e].prototype;return document.body.removeChild(a),c?Qo[e]=c:r}catch{return r}}var nu={};function Gt(e,t,r){var n;let i=`${e}.${String(r)}`;if(nu[i])return nu[i].call(t);let o=sd(e),s=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return s?(nu[i]=s,s.call(t)):t[r]}var iu={};function Zy(e,t,r){let n=`${e}.${String(r)}`;if(iu[n])return iu[n].bind(t);let o=sd(e)[r];return typeof o!="function"?t[r]:(iu[n]=o,o.bind(t))}function wM(e){return Gt("Node",e,"ownerDocument")}function SM(e){return Gt("Node",e,"childNodes")}function vM(e){return Gt("Node",e,"parentNode")}function xM(e){return Gt("Node",e,"parentElement")}function kM(e){return Gt("Node",e,"textContent")}function CM(e,t){return Zy("Node",e,"contains")(t)}function RM(e){return Zy("Node",e,"getRootNode")()}function EM(e){return!e||!("host"in e)?null:Gt("ShadowRoot",e,"host")}function IM(e){return e.styleSheets}function AM(e){return!e||!("shadowRoot"in e)?null:Gt("Element",e,"shadowRoot")}function PM(e,t){return Gt("Element",e,"querySelector")(t)}function TM(e,t){return Gt("Element",e,"querySelectorAll")(t)}function OM(){return sd("MutationObserver").constructor}function MM(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}var Ke={ownerDocument:wM,childNodes:SM,parentNode:vM,parentElement:xM,textContent:kM,contains:CM,getRootNode:RM,host:EM,styleSheets:IM,shadowRoot:AM,querySelector:PM,querySelectorAll:TM,mutationObserver:OM,patch:MM};function Xy(e){return e.nodeType===e.ELEMENT_NODE}function bi(e){let t=e&&"host"in e&&"mode"in e&&Ke.host(e)||null;return!!(t&&"shadowRoot"in t&&Ke.shadowRoot(t)===e)}function wi(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function NM(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 LM(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function yu(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,i=>Qy(i,r)).join("");return NM(n)}catch{return null}}function Qy(e,t){if(DM(e)){let r;try{r=yu(e.styleSheet)||LM(e)}catch{r=e.cssText}return e.styleSheet.href?Os(r,e.styleSheet.href):r}else{let r=e.cssText;return _M(e)&&e.selectorText.includes(":")&&(r=$M(r)),t?Os(r,t):r}}function $M(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function DM(e){return"styleSheet"in e}function _M(e){return"selectorText"in e}var As=class{constructor(){Xg(this,"idNodeMap",new Map),Xg(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.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 r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function jM(){return new As}function Ps({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"",a=n&&jr(n);return(t[r.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function jr(e){return e.toLowerCase()}var ty="__rrweb_original__";function FM(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let o=t.getImageData,s=ty in o?o[ty]:o;if(new Uint32Array(s.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function Ts(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?jr(t):null}function eb(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function BM(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var VM=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,UM=/^(?:[a-z+]+:)?\/\//i,WM=/^www\..*/i,HM=/^(data:)([^,]*),(.*)/i;function Os(e,t){return(e||"").replace(VM,(r,n,i,o,s,a)=>{let l=i||s||a,c=n||o||"";if(!l)return r;if(UM.test(l)||WM.test(l))return`url(${c}${l}${c})`;if(HM.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${BM(t)+l}${c})`;let u=t.split("/"),d=l.split("/");u.pop();for(let p of d)p!=="."&&(p===".."?u.pop():u.push(p));return`url(${c}${u.join("/")}${c})`})}function es(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function zM(e,t,r=!1){let n=Array.from(t.childNodes),i=[],o=0;if(n.length>1&&e&&typeof e=="string"){let s=es(e,r),a=s.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let c=es(n[l].textContent,r),u=100,d=3;for(;d<c.length&&(c[d].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,d),1)!==-1);d++);for(;d<c.length;d++){let p=c.substring(0,d),h=s.split(p),f=-1;if(h.length===2)f=h[0].length;else if(h.length>2&&h[0]===""&&n[l-1].textContent!=="")f=s.indexOf(p,1);else if(h.length===1){if(p=p.substring(0,p.length-1),h=s.split(p),h.length<=1)return i.push(e),i;d=u+1}else d===c.length-1&&(f=s.indexOf(p));if(h.length>=2&&d>u){let m=n[l-1].textContent;if(m&&typeof m=="string"){let g=es(m).length;f=s.indexOf(p,g)}f===-1&&(f=h[0].length)}if(f!==-1){let m=Math.floor(f/a);for(;m>0&&m<e.length;){if(o+=1,o>50*n.length)return i.push(e),i;let g=es(e.substring(0,m),r);if(g.length===f){i.push(e.substring(0,m)),e=e.substring(m),s=s.substring(f);break}else g.length<f?m+=Math.max(1,Math.floor((f-g.length)/a)):m-=Math.max(1,Math.floor((g.length-f)*a))}break}}}}return i.push(e),i}function GM(e,t){return zM(e,t).join("/* rr_split */")}var qM=1,KM=new RegExp("[^a-z0-9-_:]"),vi=-2;function tb(){return qM++}function JM(e){if(e instanceof HTMLFormElement)return"form";let t=jr(e.tagName);return KM.test(t)?"div":t}var ln,ry,YM=/^[^ \t\n\r\u000c]+/,ZM=/^[, \t\n\r\u000c]+/;function XM(e,t){if(t.trim()==="")return t;let r=0;function n(o){let s,a=o.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let i=[];for(;n(ZM),!(r>=t.length);){let o=n(YM);if(o.slice(-1)===",")o=dn(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=dn(e,o);let a=!1;for(;;){let l=t.charAt(r);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return i.join(", ")}var ny=new WeakMap;function dn(e,t){return!t||t.trim()===""?t:ad(e,t)}function QM(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function ad(e,t){let r=ny.get(e);if(r||(r=e.createElement("a"),ny.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function rb(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?dn(e,n):r==="srcset"?XM(e,n):r==="style"?Os(n,ad(e)):t==="object"&&r==="data"?dn(e,n):n)}function nb(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function e2(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}if(r)return e.matches(r)}catch{}return!1}function Ms(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Ms(Ke.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}return r?Ms(Ke.parentNode(e),t,r):!1}function ib(e,t,r,n){let i;if(Xy(e)){if(i=e,!Ke.childNodes(i).length)return!1}else{if(Ke.parentElement(e)===null)return!1;i=Ke.parentElement(e)}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Ms(i,t,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function t2(e,t,r){let n=e.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function r2(e,t,r){let n=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function n2(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m=!1,cssCaptured:g=!1}=t,w=i2(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Fe.Document,childNodes:[],compatMode:e.compatMode}:{type:Fe.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Fe.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return s2(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m,rootId:w});case e.TEXT_NODE:return o2(e,{doc:r,needsMask:s,maskTextFn:c,rootId:w,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:Fe.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:Fe.Comment,textContent:Ke.textContent(e)||"",rootId:w};default:return!1}}function i2(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function o2(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=Ke.parentNode(e),a=s&&s.tagName,l="",c=a==="STYLE"?!0:void 0,u=a==="SCRIPT"?!0:void 0;return u?l="SCRIPT_PLACEHOLDER":o||(l=Ke.textContent(e),c&&l&&(l=Os(l,ad(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,Ke.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Fe.Text,textContent:l||"",rootId:i}}function s2(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:h}=t,f=e2(e,n,i),m=JM(e),g={},w=e.attributes.length;for(let y=0;y<w;y++){let v=e.attributes[y];nb(m,v.name,v.value)||(g[v.name]=rb(r,m,jr(v.name),v.value))}if(m==="link"&&o){let y=Array.from(r.styleSheets).find(C=>C.href===e.href),v=null;y&&(v=yu(y)),v&&(delete g.rel,delete g.href,g._cssText=v)}if(m==="style"&&e.sheet){let y=yu(e.sheet);y&&(e.childNodes.length>1&&(y=GM(y,e)),g._cssText=y)}if(["input","textarea","select"].includes(m)){let y=e.value,v=e.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&y?g.value=Ps({element:e,type:Ts(e),tagName:m,value:y,maskInputOptions:s,maskInputFn:a}):v&&(g.checked=v)}if(m==="option"&&(e.selected&&!s.select?g.selected=!0:delete g.selected),m==="dialog"&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&u){if(e.__context==="2d")FM(e)||(g.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let y=e.toDataURL(l.type,l.quality),v=r.createElement("canvas");v.width=e.width,v.height=e.height;let C=v.toDataURL(l.type,l.quality);y!==C&&(g.rr_dataURL=y)}}if(m==="img"&&c){ln||(ln=r.createElement("canvas"),ry=ln.getContext("2d"));let y=e,v=y.currentSrc||y.getAttribute("src")||"<unknown-src>",C=y.crossOrigin,M=()=>{y.removeEventListener("load",M);try{ln.width=y.naturalWidth,ln.height=y.naturalHeight,ry.drawImage(y,0,0),g.rr_dataURL=ln.toDataURL(l.type,l.quality)}catch(R){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?M():y.addEventListener("load",M);return}else console.warn(`Cannot inline img src=${v}! Error: ${R}`)}y.crossOrigin==="anonymous"&&(C?g.crossOrigin=C:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?M():y.addEventListener("load",M)}if(["audio","video"].includes(m)){let y=g;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),f){let{width:y,height:v}=e.getBoundingClientRect();g={class:g.class,rr_width:`${y}px`,rr_height:`${v}px`}}m==="iframe"&&!d(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let S;try{customElements.get(m)&&(S=!0)}catch{}return{type:Fe.Element,tagName:m,attributes:g,childNodes:[],isSVG:QM(e)||void 0,needBlock:f,rootId:h,isCustom:S}}function fe(e){return e==null?"":e.toLowerCase()}function ob(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 a2(e,t){if(t.comment&&e.type===Fe.Comment)return!0;if(e.type===Fe.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"&&eb(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(fe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||fe(e.attributes.name)==="application-name"||fe(e.attributes.rel)==="icon"||fe(e.attributes.rel)==="apple-touch-icon"||fe(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&fe(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(fe(e.attributes.property).match(/^(og|twitter|fb):/)||fe(e.attributes.name).match(/^(og|twitter):/)||fe(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(fe(e.attributes.name)==="robots"||fe(e.attributes.name)==="googlebot"||fe(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(fe(e.attributes.name)==="author"||fe(e.attributes.name)==="generator"||fe(e.attributes.name)==="framework"||fe(e.attributes.name)==="publisher"||fe(e.attributes.name)==="progid"||fe(e.attributes.property).match(/^article:/)||fe(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(fe(e.attributes.name)==="google-site-verification"||fe(e.attributes.name)==="yandex-verification"||fe(e.attributes.name)==="csrf-token"||fe(e.attributes.name)==="p:domain_verify"||fe(e.attributes.name)==="verify-v1"||fe(e.attributes.name)==="verification"||fe(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function pn(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f={},inlineImages:m=!1,recordCanvas:g=!1,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:M=()=>!1,newlyAddedElement:R=!1,cssCaptured:E=!1}=t,{needsMask:x}=t,{preserveWhiteSpace:U=!0}=t;x||(x=ib(e,s,a,x===void 0));let X=n2(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:f,inlineImages:m,recordCanvas:g,keepIframeSrcFn:M,newlyAddedElement:R,cssCaptured:E});if(!X)return console.warn(e,"not serialized"),null;let Q;n.hasNode(e)?Q=n.getId(e):a2(X,h)||!U&&X.type===Fe.Text&&!X.textContent.replace(/^\s+|\s+$/gm,"").length?Q=vi:Q=tb();let B=Object.assign(X,{id:Q});if(n.add(e,B),Q===vi)return null;w&&w(e);let Ge=!l;if(B.type===Fe.Element){Ge=Ge&&!B.needBlock,delete B.needBlock;let _e=Ke.shadowRoot(e);_e&&wi(_e)&&(B.isShadowHost=!0)}if((B.type===Fe.Document||B.type===Fe.Element)&&Ge){h.headWhitespace&&B.type===Fe.Element&&B.tagName==="head"&&(U=!1);let _e={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M,cssCaptured:!1};if(!(B.type===Fe.Element&&B.tagName==="textarea"&&B.attributes.value!==void 0)){B.type===Fe.Element&&B.attributes._cssText!==void 0&&typeof B.attributes._cssText=="string"&&(_e.cssCaptured=!0);for(let Ar of Array.from(Ke.childNodes(e))){let Et=pn(Ar,_e);Et&&B.childNodes.push(Et)}}let ct=null;if(Xy(e)&&(ct=Ke.shadowRoot(e)))for(let Ar of Array.from(Ke.childNodes(ct))){let Et=pn(Ar,_e);Et&&(wi(ct)&&(Et.isShadow=!0),B.childNodes.push(Et))}}let Rt=Ke.parentNode(e);return Rt&&bi(Rt)&&wi(Rt)&&(B.isShadow=!0),B.type===Fe.Element&&B.tagName==="iframe"&&t2(e,()=>{let _e=e.contentDocument;if(_e&&S){let ct=pn(_e,{doc:_e,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M});ct&&S(e,ct)}},y),B.type===Fe.Element&&B.tagName==="link"&&typeof B.attributes.rel=="string"&&(B.attributes.rel==="stylesheet"||B.attributes.rel==="preload"&&typeof B.attributes.href=="string"&&eb(B.attributes.href)==="css")&&r2(e,()=>{if(v){let _e=pn(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M});_e&&v(e,_e)}},C),B}function l2(e,t){let{mirror:r=new As,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:h=!1,dataURLOptions:f,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:C=()=>!1}=t||{},M=u===!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}:u===!1?{password:!0}:u,R=ob(h);return pn(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:M,maskTextFn:d,maskInputFn:p,slimDOMOptions:R,dataURLOptions:f,inlineImages:l,recordCanvas:c,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:C,newlyAddedElement:!1})}var c2=/(max|min)-device-(width|height)/,OZ=new RegExp(c2.source,"g");function u2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function d2(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var ld={exports:{}},ye=String,sb=function(){return{isColorSupported:!1,reset:ye,bold:ye,dim:ye,italic:ye,underline:ye,inverse:ye,hidden:ye,strikethrough:ye,black:ye,red:ye,green:ye,yellow:ye,blue:ye,magenta:ye,cyan:ye,white:ye,gray:ye,bgBlack:ye,bgRed:ye,bgGreen:ye,bgYellow:ye,bgBlue:ye,bgMagenta:ye,bgCyan:ye,bgWhite:ye}};ld.exports=sb();ld.exports.createColors=sb;var p2=ld.exports,f2={},h2=Object.freeze(Object.defineProperty({__proto__:null,default:f2},Symbol.toStringTag,{value:"Module"})),St=d2(h2),iy=p2,oy=St,bu=class ab extends Error{constructor(t,r,n,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,ab)}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 r=this.source;t==null&&(t=iy.isColorSupported),oy&&t&&(r=oy(r));let n=r.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),s=String(o).length,a,l;if(t){let{bold:c,gray:u,red:d}=iy.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(i,o).map((c,u)=>{let d=i+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let h=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
|
|
118
118
|
`+h+a("^")}return" "+l(p)+c}).join(`
|
|
119
119
|
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
|
120
120
|
|
|
121
121
|
`+t+`
|
|
122
|
-
`),this.name+": "+this.message+t}},cd=bu;bu.default=bu;var Oi={};Oi.isClean=Symbol("isClean");Oi.my=Symbol("my");var
|
|
122
|
+
`),this.name+": "+this.message+t}},cd=bu;bu.default=bu;var Oi={};Oi.isClean=Symbol("isClean");Oi.my=Symbol("my");var sy={after:`
|
|
123
123
|
`,beforeClose:`
|
|
124
124
|
`,beforeComment:`
|
|
125
125
|
`,beforeDecl:`
|
|
126
126
|
`,beforeOpen:" ",beforeRule:`
|
|
127
|
-
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function
|
|
128
|
-
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",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 r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=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,r!==i||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),i=t.prop+n+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),r&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],typeof i<"u"))return i;let o=t.parent;if(n==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return
|
|
127
|
+
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function m2(e){return e[0].toUpperCase()+e.slice(1)}var wu=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:i&&(n+=" "),t.nodes)this.block(t,n+i);else{let o=(t.raws.between||"")+(r?";":"");this.builder(n+i+o,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(n.includes(`
|
|
128
|
+
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",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 r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=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,r!==i||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),i=t.prop+n+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),r&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],typeof i<"u"))return i;let o=t.parent;if(n==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return sy[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+m2(n);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[r],typeof i<"u")return!1})}return typeof i>"u"&&(i=sy[n]),s.rawCache[n]=i,i}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
|
|
129
129
|
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(i=>{if(typeof i.raws.before<"u")return n=i.raws.before,n.includes(`
|
|
130
130
|
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return n=i.raws.before,n.includes(`
|
|
131
131
|
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
|
132
132
|
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let i=n.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof n.raws.before<"u"){let o=n.raws.before.split(`
|
|
133
|
-
`);return r=o[o.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],i=t.raws[r];return i&&i.value===n?i.raw:n}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,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},
|
|
134
|
-
`?(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 r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(r=this.positionInside(o,i),n=this.positionInside(o+t.word.length,i))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new
|
|
135
|
-
`);n=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)n[a]=s,s+=o[a].length+1;this[au]=n}r=n[n.length-1];let i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<n[s])o=s-1;else if(t>=n[s+1])i=s+1;else{i=s;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Eu(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=o.originalPositionFor({column:i,line:n}));let l;Ru(s.source)?l=rs(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||rs(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(
|
|
133
|
+
`);return r=o[o.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],i=t.raws[r];return i&&i.value===n?i.raw:n}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,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},lb=wu;wu.default=wu;var g2=lb;function Su(e,t){new g2(t).stringify(e)}var zs=Su;Su.default=Su;var{isClean:ts,my:y2}=Oi,b2=cd,w2=lb,S2=zs;function vu(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let i=e[n],o=typeof i;n==="parent"&&o==="object"?t&&(r[n]=t):n==="source"?r[n]=i:Array.isArray(i)?r[n]=i.map(s=>vu(s,r)):(o==="object"&&i!==null&&(i=vu(i)),r[n]=i)}return r}var xu=class{constructor(t={}){this.raws={},this[ts]=!1,this[y2]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];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 r=vu(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:i}=this.rangeBy(r);return this.source.input.error(t,{column:i.column,line:i.line},{column:n.column,line:n.line},r)}return new b2(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[ts]){this[ts]=!1;let t=this;for(;t=t.parent;)t[ts]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let i=r.indexOf(t.word);i!==-1&&(n=this.positionInside(i,r))}return n}positionInside(t,r){let n=r||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
|
|
134
|
+
`?(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 r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(r=this.positionInside(o,i),n=this.positionInside(o+t.word.length,i))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new w2().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let i of t)i===this?n=!0:n?(this.parent.insertAfter(r,i),r=i):this.parent.insertBefore(r,i);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},i=r==null;r=r||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))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=o,r.set(a.input,o),o++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return i&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=S2){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let i={node:this};for(let o in n)i[o]=n[o];return t.warn(r,i)}get proxyOf(){return this}},Gs=xu;xu.default=xu;var v2=Gs,ku=class extends v2{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]==="$"}},qs=ku;ku.default=ku;var x2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",k2=(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n},C2=(e=21)=>{let t="",r=e;for(;r--;)t+=x2[Math.random()*64|0];return t},R2={nanoid:C2,customAlphabet:k2},{SourceMapConsumer:ay,SourceMapGenerator:ly}=St,{existsSync:E2,readFileSync:I2}=St,{dirname:ou,join:A2}=St;function P2(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Cu=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,i=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=ou(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new ay(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^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(r.test(t)||n.test(t))return P2(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 r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),i=t.indexOf("*/",n);n>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,i)))}loadFile(t){if(this.root=ou(t),E2(t))return this.mapFile=t,I2(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let i=this.loadFile(n);if(!i)throw new Error("Unable to load previous source map: "+n.toString());return i}}else{if(r instanceof ay)return ly.fromSourceMap(r).toString();if(r instanceof ly)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=A2(ou(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},cb=Cu;Cu.default=Cu;var{SourceMapConsumer:T2,SourceMapGenerator:O2}=St,{fileURLToPath:cy,pathToFileURL:rs}=St,{isAbsolute:Ru,resolve:Eu}=St,{nanoid:M2}=R2,su=St,uy=cd,N2=cb,au=Symbol("fromOffsetCache"),L2=!!(T2&&O2),dy=!!(Eu&&Ru),Ns=class{constructor(t,r={}){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,r.from&&(!dy||/^\w+:\/\//.test(r.from)||Ru(r.from)?this.file=r.from:this.file=Eu(r.from)),dy&&L2){let n=new N2(this.css,r);if(n.text){this.map=n;let i=n.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,r,n,i={}){let o,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?o=new uy(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 uy(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(rs&&(o.input.url=rs(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let r,n;if(this[au])n=this[au];else{let o=this.css.split(`
|
|
135
|
+
`);n=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)n[a]=s,s+=o[a].length+1;this[au]=n}r=n[n.length-1];let i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<n[s])o=s-1;else if(t>=n[s+1])i=s+1;else{i=s;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Eu(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=o.originalPositionFor({column:i,line:n}));let l;Ru(s.source)?l=rs(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||rs(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(cy)c.file=cy(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=o.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},Ks=Ns;Ns.default=Ns;su&&su.registerInput&&su.registerInput(Ns);var{SourceMapConsumer:ub,SourceMapGenerator:xs}=St,{dirname:ks,relative:db,resolve:pb,sep:fb}=St,{pathToFileURL:py}=St,$2=Ks,D2=!!(ub&&xs),_2=!!(ks&&pb&&db&&fb),j2=class{constructor(t,r,n,i){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,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 r=`
|
|
136
136
|
`;this.css.includes(`\r
|
|
137
137
|
`)&&(r=`\r
|
|
138
|
-
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||ks(t.file),i;this.mapOpts.sourcesContent===!1?(i=new
|
|
139
|
-
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.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=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=r-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(r=>r.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 r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?ks(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=ks(db(n,this.mapOpts.annotation)));let i=ub(n,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 r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new I2(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let i=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(i,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,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 r=this.memoizedFileURLs.get(t);if(r)return r;if(dy){let n=dy(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;pb==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},fb=T2,O2=Gs,Iu=class extends O2{constructor(t){super(t),this.type="comment"}},Js=Iu;Iu.default=Iu;var{isClean:hb,my:mb}=Oi,gb=qs,yb=Js,M2=Gs,bb,ud,dd,wb;function Sb(e){return e.map(t=>(t.nodes&&(t.nodes=Sb(t.nodes)),delete t.source,t))}function vb(e){if(e[hb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)vb(t)}var Ht=class xb extends M2{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let i of n)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,i;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],i=t(this.proxyOf.nodes[n],n),i!==!1);)this.indexes[r]+=1;return delete this.indexes[r],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,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):r==="every"||r==="some"?n=>t[r]((i,...o)=>n(i.toProxy(),...o)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of i)this.proxyOf.nodes.splice(n+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],n<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),i=n===0?"prepend":!1,o=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let a of o)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Sb(bb(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 gb(t)]}else if(t.selector)t=[new ud(t)];else if(t.name)t=[new dd(t)];else if(t.text)t=[new yb(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[mb]||xb.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[hb]&&vb(i),typeof i.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(i.raws.before=r.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let i of n)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+n.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 r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(i=>{r.props&&!r.props.includes(i.prop)||r.fast&&!i.value.includes(r.fast)||(i.value=i.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let i;try{i=t(r,n)}catch(o){throw r.addToError(o)}return i!==!1&&r.walk&&(i=r.walk(t)),i})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,i)}):this.walk((n,i)=>{if(n.type==="atrule"&&n.name===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="atrule")return r(n,i)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,i)}):this.walk((n,i)=>{if(n.type==="decl"&&n.prop===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="decl")return r(n,i)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,i)}):this.walk((n,i)=>{if(n.type==="rule"&&n.selector===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="rule")return r(n,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]}};Ht.registerParse=e=>{bb=e};Ht.registerRule=e=>{ud=e};Ht.registerAtRule=e=>{dd=e};Ht.registerRoot=e=>{wb=e};var Fr=Ht;Ht.default=Ht;Ht.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,dd.prototype):e.type==="rule"?Object.setPrototypeOf(e,ud.prototype):e.type==="decl"?Object.setPrototypeOf(e,gb.prototype):e.type==="comment"?Object.setPrototypeOf(e,yb.prototype):e.type==="root"&&Object.setPrototypeOf(e,wb.prototype),e[mb]=!0,e.nodes&&e.nodes.forEach(t=>{Ht.rebuild(t)})};var N2=Fr,kb,Cb,xi=class extends N2{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new kb(new Cb,this,t).stringify()}};xi.registerLazyResult=e=>{kb=e};xi.registerProcessor=e=>{Cb=e};var pd=xi;xi.default=xi;var py={},Rb=function(t){py[t]||(py[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Au=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}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}},Eb=Au;Au.default=Au;var L2=Eb,Pu=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new L2(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},fd=Pu;Pu.default=Pu;var lu=39,fy=34,ns=92,hy=47,is=10,fi=32,os=12,ss=9,as=13,$2=91,D2=93,_2=40,j2=41,F2=123,B2=125,V2=59,U2=42,W2=58,H2=64,ls=/[\t\n\f\r "#'()/;[\\\]{}]/g,cs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,z2=/.[\r\n"'(/\\]/,my=/[\da-f]/i,G2=function(t,r={}){let n=t.css.valueOf(),i=r.ignoreErrors,o,s,a,l,c,u,d,p,h,f,m=n.length,g=0,w=[],S=[];function y(){return g}function v(E){throw t.error("Unclosed "+E,g)}function C(){return S.length===0&&g>=m}function M(E){if(S.length)return S.pop();if(g>=m)return;let x=E?E.ignoreUnclosed:!1;switch(o=n.charCodeAt(g),o){case is:case fi:case ss:case as:case os:{s=g;do s+=1,o=n.charCodeAt(s);while(o===fi||o===is||o===ss||o===as||o===os);f=["space",n.slice(g,s)],g=s-1;break}case $2:case D2:case F2:case B2:case W2:case V2:case j2:{let U=String.fromCharCode(o);f=[U,U,g];break}case _2:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==lu&&h!==fy&&h!==fi&&h!==is&&h!==ss&&h!==os&&h!==as){s=g;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(i||x){s=g;break}else v("bracket");for(d=s;n.charCodeAt(d-1)===ns;)d-=1,u=!u}while(u);f=["brackets",n.slice(g,s+1),g,s],g=s}else s=n.indexOf(")",g+1),l=n.slice(g,s+1),s===-1||z2.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case lu:case fy:{a=o===lu?"'":'"',s=g;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(i||x){s=g+1;break}else v("string");for(d=s;n.charCodeAt(d-1)===ns;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case H2:{ls.lastIndex=g+1,ls.test(n),ls.lastIndex===0?s=n.length-1:s=ls.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case ns:{for(s=g,c=!0;n.charCodeAt(s+1)===ns;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==hy&&o!==fi&&o!==is&&o!==ss&&o!==as&&o!==os&&(s+=1,my.test(n.charAt(s)))){for(;my.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===fi&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{o===hy&&n.charCodeAt(g+1)===U2?(s=n.indexOf("*/",g+2)+1,s===0&&(i||x?s=n.length:v("comment")),f=["comment",n.slice(g,s+1),g,s],g=s):(cs.lastIndex=g+1,cs.test(n),cs.lastIndex===0?s=n.length-1:s=cs.lastIndex-2,f=["word",n.slice(g,s+1),g,s],w.push(f),g=s);break}}return g++,f}function R(E){S.push(E)}return{back:R,endOfFile:C,nextToken:M,position:y}},Ib=Fr,Ls=class extends Ib{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)}},hd=Ls;Ls.default=Ls;Ib.registerAtRule(Ls);var Ab=Fr,Pb,Tb,hn=class extends Ab{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let i=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let o of i)o.raws.before=r.raws.before}return i}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new Pb(new Tb,this,t).stringify()}};hn.registerLazyResult=e=>{Pb=e};hn.registerProcessor=e=>{Tb=e};var Mi=hn;hn.default=hn;Ab.registerRoot(hn);var ki={comma(e){return ki.split(e,[","],!0)},space(e){let t=[" ",`
|
|
140
|
-
`," "];return ki.split(e,t)},split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(o=!0),o?(i!==""&&n.push(i.trim()),i="",o=!1):i+=u;return(r||i!=="")&&n.push(i.trim()),n}},
|
|
138
|
+
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||ks(t.file),i;this.mapOpts.sourcesContent===!1?(i=new ub(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),_2&&D2&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[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=xs.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new xs({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 xs({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(i.generated.line=t,i.generated.column=r-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=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),o=a.match(/\n/g),o?(t+=o.length,s=a.lastIndexOf(`
|
|
139
|
+
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.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=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=r-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(r=>r.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 r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?ks(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=ks(pb(n,this.mapOpts.annotation)));let i=db(n,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 r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new $2(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let i=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(i,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,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 r=this.memoizedFileURLs.get(t);if(r)return r;if(py){let n=py(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;fb==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},hb=j2,F2=Gs,Iu=class extends F2{constructor(t){super(t),this.type="comment"}},Js=Iu;Iu.default=Iu;var{isClean:mb,my:gb}=Oi,yb=qs,bb=Js,B2=Gs,wb,ud,dd,Sb;function vb(e){return e.map(t=>(t.nodes&&(t.nodes=vb(t.nodes)),delete t.source,t))}function xb(e){if(e[mb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)xb(t)}var Ht=class kb extends B2{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let i of n)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,i;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],i=t(this.proxyOf.nodes[n],n),i!==!1);)this.indexes[r]+=1;return delete this.indexes[r],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,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):r==="every"||r==="some"?n=>t[r]((i,...o)=>n(i.toProxy(),...o)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of i)this.proxyOf.nodes.splice(n+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],n<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),i=n===0?"prepend":!1,o=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let a of o)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=vb(wb(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 yb(t)]}else if(t.selector)t=[new ud(t)];else if(t.name)t=[new dd(t)];else if(t.text)t=[new bb(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[gb]||kb.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[mb]&&xb(i),typeof i.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(i.raws.before=r.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let i of n)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+n.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 r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(i=>{r.props&&!r.props.includes(i.prop)||r.fast&&!i.value.includes(r.fast)||(i.value=i.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let i;try{i=t(r,n)}catch(o){throw r.addToError(o)}return i!==!1&&r.walk&&(i=r.walk(t)),i})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,i)}):this.walk((n,i)=>{if(n.type==="atrule"&&n.name===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="atrule")return r(n,i)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,i)}):this.walk((n,i)=>{if(n.type==="decl"&&n.prop===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="decl")return r(n,i)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,i)}):this.walk((n,i)=>{if(n.type==="rule"&&n.selector===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="rule")return r(n,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]}};Ht.registerParse=e=>{wb=e};Ht.registerRule=e=>{ud=e};Ht.registerAtRule=e=>{dd=e};Ht.registerRoot=e=>{Sb=e};var Fr=Ht;Ht.default=Ht;Ht.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,dd.prototype):e.type==="rule"?Object.setPrototypeOf(e,ud.prototype):e.type==="decl"?Object.setPrototypeOf(e,yb.prototype):e.type==="comment"?Object.setPrototypeOf(e,bb.prototype):e.type==="root"&&Object.setPrototypeOf(e,Sb.prototype),e[gb]=!0,e.nodes&&e.nodes.forEach(t=>{Ht.rebuild(t)})};var V2=Fr,Cb,Rb,xi=class extends V2{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Cb(new Rb,this,t).stringify()}};xi.registerLazyResult=e=>{Cb=e};xi.registerProcessor=e=>{Rb=e};var pd=xi;xi.default=xi;var fy={},Eb=function(t){fy[t]||(fy[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Au=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}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}},Ib=Au;Au.default=Au;var U2=Ib,Pu=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new U2(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},fd=Pu;Pu.default=Pu;var lu=39,hy=34,ns=92,my=47,is=10,fi=32,os=12,ss=9,as=13,W2=91,H2=93,z2=40,G2=41,q2=123,K2=125,J2=59,Y2=42,Z2=58,X2=64,ls=/[\t\n\f\r "#'()/;[\\\]{}]/g,cs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Q2=/.[\r\n"'(/\\]/,gy=/[\da-f]/i,eN=function(t,r={}){let n=t.css.valueOf(),i=r.ignoreErrors,o,s,a,l,c,u,d,p,h,f,m=n.length,g=0,w=[],S=[];function y(){return g}function v(E){throw t.error("Unclosed "+E,g)}function C(){return S.length===0&&g>=m}function M(E){if(S.length)return S.pop();if(g>=m)return;let x=E?E.ignoreUnclosed:!1;switch(o=n.charCodeAt(g),o){case is:case fi:case ss:case as:case os:{s=g;do s+=1,o=n.charCodeAt(s);while(o===fi||o===is||o===ss||o===as||o===os);f=["space",n.slice(g,s)],g=s-1;break}case W2:case H2:case q2:case K2:case Z2:case J2:case G2:{let U=String.fromCharCode(o);f=[U,U,g];break}case z2:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==lu&&h!==hy&&h!==fi&&h!==is&&h!==ss&&h!==os&&h!==as){s=g;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(i||x){s=g;break}else v("bracket");for(d=s;n.charCodeAt(d-1)===ns;)d-=1,u=!u}while(u);f=["brackets",n.slice(g,s+1),g,s],g=s}else s=n.indexOf(")",g+1),l=n.slice(g,s+1),s===-1||Q2.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case lu:case hy:{a=o===lu?"'":'"',s=g;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(i||x){s=g+1;break}else v("string");for(d=s;n.charCodeAt(d-1)===ns;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case X2:{ls.lastIndex=g+1,ls.test(n),ls.lastIndex===0?s=n.length-1:s=ls.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case ns:{for(s=g,c=!0;n.charCodeAt(s+1)===ns;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==my&&o!==fi&&o!==is&&o!==ss&&o!==as&&o!==os&&(s+=1,gy.test(n.charAt(s)))){for(;gy.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===fi&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{o===my&&n.charCodeAt(g+1)===Y2?(s=n.indexOf("*/",g+2)+1,s===0&&(i||x?s=n.length:v("comment")),f=["comment",n.slice(g,s+1),g,s],g=s):(cs.lastIndex=g+1,cs.test(n),cs.lastIndex===0?s=n.length-1:s=cs.lastIndex-2,f=["word",n.slice(g,s+1),g,s],w.push(f),g=s);break}}return g++,f}function R(E){S.push(E)}return{back:R,endOfFile:C,nextToken:M,position:y}},Ab=Fr,Ls=class extends Ab{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)}},hd=Ls;Ls.default=Ls;Ab.registerAtRule(Ls);var Pb=Fr,Tb,Ob,hn=class extends Pb{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let i=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let o of i)o.raws.before=r.raws.before}return i}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new Tb(new Ob,this,t).stringify()}};hn.registerLazyResult=e=>{Tb=e};hn.registerProcessor=e=>{Ob=e};var Mi=hn;hn.default=hn;Pb.registerRoot(hn);var ki={comma(e){return ki.split(e,[","],!0)},space(e){let t=[" ",`
|
|
140
|
+
`," "];return ki.split(e,t)},split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(o=!0),o?(i!==""&&n.push(i.trim()),i="",o=!1):i+=u;return(r||i!=="")&&n.push(i.trim()),n}},Mb=ki;ki.default=ki;var Nb=Fr,tN=Mb,$s=class extends Nb{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return tN.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},md=$s;$s.default=$s;Nb.registerRule($s);var rN=qs,nN=eN,iN=Js,oN=hd,sN=Mi,yy=md,by={empty:!0,space:!0};function aN(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var lN=class{constructor(t){this.input=t,this.root=new sN,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 r=new oN;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,i,o,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(r.source.end=this.getPosition(i[3]||i[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,i;for(let o=r-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(n+=1,n===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let r=0,n,i,o;for(let[s,a]of t.entries()){if(n=a,i=n[0],i==="("&&(r+=1),i===")"&&(r-=1),r===0&&i===":")if(!o)this.doubleColon(n);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=n}return!1}comment(t){let r=new iN;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let i=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=i[2],r.raws.left=i[1],r.raws.right=i[3]}}createTokenizer(){this.tokenizer=nN(this.input)}decl(t,r){let n=new rN;this.init(n,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(i[3]||i[2]||aN(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){n.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),n.raws.between+=o[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.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 c=t.length-1;c>=0;c--){if(o=t[c],o[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(o[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let h=u[p][0];if(d.trim().indexOf("!")===0&&h!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new yy;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}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 r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")o||(o=c),s.push(n==="("?")":"]");else if(a&&i&&n==="{")o||(o=c),s.push("}");else if(s.length===0)if(n===";")if(i){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(i=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(o),r&&i){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="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,r,n,i){let o,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)o=n[p],s=o[0],s==="space"&&p===a-1&&!i?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!by[d]&&!by[u]?l.slice(-1)===","?c=!1:l+=o[1]:c=!1):l+=o[1];if(!c){let p=n.reduce((h,f)=>h+f[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new yy;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let i=r;i<t.length;i++)n+=t[i][1];return t.splice(r,t.length-r),n}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,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},cN=lN,uN=Fr,dN=cN,pN=Ks;function Ds(e,t){let r=new pN(e,t),n=new dN(r);try{n.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?i.message+=`
|
|
141
141
|
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?i.message+=`
|
|
142
142
|
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(i.message+=`
|
|
143
|
-
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return n.root}var gd=Ds;Ds.default=Ds;rN.registerParse(Ds);var{isClean:Tt,my:oN}=Oi,sN=fb,aN=zs,lN=Fr,cN=pd,uN=Rb,by=fd,dN=gd,pN=Mi,fN={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},hN={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},mN={Once:!0,postcssPlugin:!0,prepare:!0},mn=0;function hi(e){return typeof e=="object"&&typeof e.then=="function"}function Nb(e){let t=!1,r=fN[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,mn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,mn,r+"Exit"]:[r,r+"Exit"]}function wy(e){let t;return e.type==="document"?t=["Document",mn,"DocumentExit"]:e.type==="root"?t=["Root",mn,"RootExit"]:t=Nb(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Tu(e){return e[Tt]=!1,e.nodes&&e.nodes.forEach(t=>Tu(t)),e}var Ou={},gn=class Lb{constructor(t,r,n){this.stringified=!1,this.processed=!1;let i;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))i=Tu(r);else if(r instanceof Lb||r instanceof by)i=Tu(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let o=dN;n.syntax&&(o=n.syntax.parse),n.parser&&(o=n.parser),o.parse&&(o=o.parse);try{i=o(r,n)}catch(s){this.processed=!0,this.error=s}i&&!i[oN]&&lN.rebuild(i)}this.result=new by(t,i,n),this.helpers={...Ou,postcss:Ou,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,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let i=n.postcssPlugin,o=n.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=(r,n,i)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,i])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!hN[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!mN[n])if(typeof r[n]=="object")for(let i in r[n])i==="*"?t(r,n,r[n][i]):t(r,n+"-"+i.toLowerCase(),r[n][i]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(hi(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Tt];){t[Tt]=!0;let r=[wy(t)];for(;r.length>0;){let n=this.visitTick(r);if(hi(n))try{await n}catch(i){let o=r[r.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let i=t.nodes.map(o=>n(o,this.helpers));await Promise.all(i)}else await n(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 r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return hi(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=aN;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new sN(r,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 r=this.runOnRoot(t);if(hi(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Tt];)t[Tt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||uN("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,r)}toString(){return this.css}visitSync(t,r){for(let[n,i]of t){this.result.lastPlugin=n;let o;try{o=i(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(hi(o))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(i.length>0&&r.visitorIndex<i.length){let[s,a]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[Tt]){a[Tt]=!0,t.push(wy(a));return}r.iterator=0,delete n.indexes[s]}let o=r.events;for(;r.eventIndex<o.length;){let s=o[r.eventIndex];if(r.eventIndex+=1,s===mn){n.nodes&&n.nodes.length&&(n[Tt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[Tt]=!0;let r=Nb(t);for(let n of r)if(n===mn)t.nodes&&t.each(i=>{i[Tt]||this.walkSync(i)});else{let i=this.listeners[n];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"}};gn.registerPostcss=e=>{Ou=e};var $b=gn;gn.default=gn;pN.registerLazyResult(gn);cN.registerLazyResult(gn);var gN=fb,yN=zs,bN=Rb,wN=gd,SN=fd,Mu=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let i,o=yN;this.result=new SN(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new gN(o,i,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}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,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||bN("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,r)}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,r=wN;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},vN=Mu;Mu.default=Mu;var xN=vN,kN=$b,CN=pd,RN=Mi,Ci=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.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(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new xN(this,t,r):new kN(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},EN=Ci;Ci.default=Ci;RN.registerProcessor(Ci);CN.registerProcessor(Ci);var IN=qs,AN=lb,PN=Js,TN=hd,ON=Ks,MN=Mi,NN=md;function Ri(e,t){if(Array.isArray(e))return e.map(i=>Ri(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:ON.prototype};o.map&&(o.map={...o.map,__proto__:AN.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>Ri(i,t))),n.source){let{inputId:i,...o}=n.source;n.source=o,i!=null&&(n.source.input=t[i])}if(n.type==="root")return new MN(n);if(n.type==="decl")return new IN(n);if(n.type==="rule")return new NN(n);if(n.type==="comment")return new PN(n);if(n.type==="atrule")return new TN(n);throw new Error("Unknown node type: "+e.type)}var LN=Ri;Ri.default=Ri;var $N=cd,Db=qs,DN=$b,_N=Fr,yd=EN,jN=zs,FN=LN,_b=pd,BN=Eb,jb=Js,Fb=hd,VN=fd,UN=Ks,WN=gd,HN=Ob,Bb=md,Vb=Mi,zN=Gs;function ne(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new yd(e)}ne.plugin=function(t,r){let n=!1;function i(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
143
|
+
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return n.root}var gd=Ds;Ds.default=Ds;uN.registerParse(Ds);var{isClean:Ot,my:fN}=Oi,hN=hb,mN=zs,gN=Fr,yN=pd,bN=Eb,wy=fd,wN=gd,SN=Mi,vN={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},xN={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},kN={Once:!0,postcssPlugin:!0,prepare:!0},mn=0;function hi(e){return typeof e=="object"&&typeof e.then=="function"}function Lb(e){let t=!1,r=vN[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,mn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,mn,r+"Exit"]:[r,r+"Exit"]}function Sy(e){let t;return e.type==="document"?t=["Document",mn,"DocumentExit"]:e.type==="root"?t=["Root",mn,"RootExit"]:t=Lb(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Tu(e){return e[Ot]=!1,e.nodes&&e.nodes.forEach(t=>Tu(t)),e}var Ou={},gn=class $b{constructor(t,r,n){this.stringified=!1,this.processed=!1;let i;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))i=Tu(r);else if(r instanceof $b||r instanceof wy)i=Tu(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let o=wN;n.syntax&&(o=n.syntax.parse),n.parser&&(o=n.parser),o.parse&&(o=o.parse);try{i=o(r,n)}catch(s){this.processed=!0,this.error=s}i&&!i[fN]&&gN.rebuild(i)}this.result=new wy(t,i,n),this.helpers={...Ou,postcss:Ou,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,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let i=n.postcssPlugin,o=n.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=(r,n,i)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,i])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!xN[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!kN[n])if(typeof r[n]=="object")for(let i in r[n])i==="*"?t(r,n,r[n][i]):t(r,n+"-"+i.toLowerCase(),r[n][i]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(hi(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ot];){t[Ot]=!0;let r=[Sy(t)];for(;r.length>0;){let n=this.visitTick(r);if(hi(n))try{await n}catch(i){let o=r[r.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let i=t.nodes.map(o=>n(o,this.helpers));await Promise.all(i)}else await n(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 r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return hi(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=mN;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new hN(r,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 r=this.runOnRoot(t);if(hi(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ot];)t[Ot]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||bN("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,r)}toString(){return this.css}visitSync(t,r){for(let[n,i]of t){this.result.lastPlugin=n;let o;try{o=i(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(hi(o))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(i.length>0&&r.visitorIndex<i.length){let[s,a]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[Ot]){a[Ot]=!0,t.push(Sy(a));return}r.iterator=0,delete n.indexes[s]}let o=r.events;for(;r.eventIndex<o.length;){let s=o[r.eventIndex];if(r.eventIndex+=1,s===mn){n.nodes&&n.nodes.length&&(n[Ot]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[Ot]=!0;let r=Lb(t);for(let n of r)if(n===mn)t.nodes&&t.each(i=>{i[Ot]||this.walkSync(i)});else{let i=this.listeners[n];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"}};gn.registerPostcss=e=>{Ou=e};var Db=gn;gn.default=gn;SN.registerLazyResult(gn);yN.registerLazyResult(gn);var CN=hb,RN=zs,EN=Eb,IN=gd,AN=fd,Mu=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let i,o=RN;this.result=new AN(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new CN(o,i,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}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,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||EN("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,r)}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,r=IN;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},PN=Mu;Mu.default=Mu;var TN=PN,ON=Db,MN=pd,NN=Mi,Ci=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.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(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new TN(this,t,r):new ON(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},LN=Ci;Ci.default=Ci;NN.registerProcessor(Ci);MN.registerProcessor(Ci);var $N=qs,DN=cb,_N=Js,jN=hd,FN=Ks,BN=Mi,VN=md;function Ri(e,t){if(Array.isArray(e))return e.map(i=>Ri(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:FN.prototype};o.map&&(o.map={...o.map,__proto__:DN.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>Ri(i,t))),n.source){let{inputId:i,...o}=n.source;n.source=o,i!=null&&(n.source.input=t[i])}if(n.type==="root")return new BN(n);if(n.type==="decl")return new $N(n);if(n.type==="rule")return new VN(n);if(n.type==="comment")return new _N(n);if(n.type==="atrule")return new jN(n);throw new Error("Unknown node type: "+e.type)}var UN=Ri;Ri.default=Ri;var WN=cd,_b=qs,HN=Db,zN=Fr,yd=LN,GN=zs,qN=UN,jb=pd,KN=Ib,Fb=Js,Bb=hd,JN=fd,YN=Ks,ZN=gd,XN=Mb,Vb=md,Ub=Mi,QN=Gs;function ne(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new yd(e)}ne.plugin=function(t,r){let n=!1;function i(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
144
144
|
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:
|
|
145
|
-
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new yd().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=
|
|
145
|
+
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new yd().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=GN;ne.parse=ZN;ne.fromJSON=qN;ne.list=XN;ne.comment=e=>new Fb(e);ne.atRule=e=>new Bb(e);ne.decl=e=>new _b(e);ne.rule=e=>new Vb(e);ne.root=e=>new Ub(e);ne.document=e=>new jb(e);ne.CssSyntaxError=WN;ne.Declaration=_b;ne.Container=zN;ne.Processor=yd;ne.Document=jb;ne.Comment=Fb;ne.Warning=KN;ne.AtRule=Bb;ne.Result=JN;ne.Input=YN;ne.Rule=Vb;ne.Root=Ub;ne.Node=QN;HN.registerPostcss(ne);var eL=ne;ne.default=ne;var Se=u2(eL);Se.stringify;Se.fromJSON;Se.plugin;Se.parse;Se.list;Se.document;Se.comment;Se.atRule;Se.rule;Se.decl;Se.root;Se.CssSyntaxError;Se.Declaration;Se.Container;Se.Processor;Se.Document;Se.Comment;Se.Warning;Se.AtRule;Se.Result;Se.Input;Se.Rule;Se.Root;Se.Node;var tL=Object.defineProperty,rL=(e,t,r)=>t in e?tL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dt=(e,t,r)=>rL(e,typeof t!="symbol"?t+"":t,r);function nL(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function iL(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var bd={exports:{}},be=String,Wb=function(){return{isColorSupported:!1,reset:be,bold:be,dim:be,italic:be,underline:be,inverse:be,hidden:be,strikethrough:be,black:be,red:be,green:be,yellow:be,blue:be,magenta:be,cyan:be,white:be,gray:be,bgBlack:be,bgRed:be,bgGreen:be,bgYellow:be,bgBlue:be,bgMagenta:be,bgCyan:be,bgWhite:be}};bd.exports=Wb();bd.exports.createColors=Wb;var oL=bd.exports,sL={},aL=Object.freeze(Object.defineProperty({__proto__:null,default:sL},Symbol.toStringTag,{value:"Module"})),vt=iL(aL),vy=oL,xy=vt,Nu=class Hb extends Error{constructor(t,r,n,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Hb)}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 r=this.source;t==null&&(t=vy.isColorSupported),xy&&t&&(r=xy(r));let n=r.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,n.length),s=String(o).length,a,l;if(t){let{bold:c,gray:u,red:d}=vy.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(i,o).map((c,u)=>{let d=i+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let h=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
|
|
146
146
|
`+h+a("^")}return" "+l(p)+c}).join(`
|
|
147
147
|
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
|
148
148
|
|
|
149
149
|
`+t+`
|
|
150
|
-
`),this.name+": "+this.message+t}},wd=Nu;Nu.default=Nu;var Ni={};Ni.isClean=Symbol("isClean");Ni.my=Symbol("my");var
|
|
150
|
+
`),this.name+": "+this.message+t}},wd=Nu;Nu.default=Nu;var Ni={};Ni.isClean=Symbol("isClean");Ni.my=Symbol("my");var ky={after:`
|
|
151
151
|
`,beforeClose:`
|
|
152
152
|
`,beforeComment:`
|
|
153
153
|
`,beforeDecl:`
|
|
154
154
|
`,beforeOpen:" ",beforeRule:`
|
|
155
|
-
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function
|
|
156
|
-
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",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 r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=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,r!==i||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),i=t.prop+n+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),r&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],typeof i<"u"))return i;let o=t.parent;if(n==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return
|
|
155
|
+
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function lL(e){return e[0].toUpperCase()+e.slice(1)}var Lu=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,i=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:i&&(n+=" "),t.nodes)this.block(t,n+i);else{let o=(t.raws.between||"")+(r?";":"");this.builder(n+i+o,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(n.includes(`
|
|
156
|
+
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<o;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",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 r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=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,r!==i||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),i=t.prop+n+this.rawValue(t,"value");t.important&&(i+=t.raws.important||" !important"),r&&(i+=";"),this.builder(i,t)}document(t){this.body(t)}raw(t,r,n){let i;if(n||(n=r),r&&(i=t.raws[r],typeof i<"u"))return i;let o=t.parent;if(n==="before"&&(!o||o.type==="root"&&o.first===t||o&&o.type==="document"))return"";if(!o)return ky[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+lL(n);this[a]?i=this[a](s,t):s.walk(l=>{if(i=l.raws[r],typeof i<"u")return!1})}return typeof i>"u"&&(i=ky[n]),s.rawCache[n]=i,i}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
|
|
157
157
|
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(i=>{if(typeof i.raws.before<"u")return n=i.raws.before,n.includes(`
|
|
158
158
|
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return n=i.raws.before,n.includes(`
|
|
159
159
|
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
|
160
160
|
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let i=n.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof n.raws.before<"u"){let o=n.raws.before.split(`
|
|
161
|
-
`);return r=o[o.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],i=t.raws[r];return i&&i.value===n?i.raw:n}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,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},
|
|
162
|
-
`?(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 r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(r=this.positionInside(o,i),n=this.positionInside(o+t.word.length,i))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new
|
|
163
|
-
`);n=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)n[a]=s,s+=o[a].length+1;this[du]=n}r=n[n.length-1];let i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<n[s])o=s-1;else if(t>=n[s+1])i=s+1;else{i=s;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Vu(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=o.originalPositionFor({column:i,line:n}));let l;Bu(s.source)?l=ds(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||ds(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(
|
|
161
|
+
`);return r=o[o.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],i=t.raws[r];return i&&i.value===n?i.raw:n}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,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},zb=Lu;Lu.default=Lu;var cL=zb;function $u(e,t){new cL(t).stringify(e)}var Ys=$u;$u.default=$u;var{isClean:us,my:uL}=Ni,dL=wd,pL=zb,fL=Ys;function Du(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let i=e[n],o=typeof i;n==="parent"&&o==="object"?t&&(r[n]=t):n==="source"?r[n]=i:Array.isArray(i)?r[n]=i.map(s=>Du(s,r)):(o==="object"&&i!==null&&(i=Du(i)),r[n]=i)}return r}var _u=class{constructor(t={}){this.raws={},this[us]=!1,this[uL]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];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 r=Du(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:i}=this.rangeBy(r);return this.source.input.error(t,{column:i.column,line:i.line},{column:n.column,line:n.line},r)}return new dL(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[us]){this[us]=!1;let t=this;for(;t=t.parent;)t[us]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let i=r.indexOf(t.word);i!==-1&&(n=this.positionInside(i,r))}return n}positionInside(t,r){let n=r||this.toString(),i=this.source.start.column,o=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
|
|
162
|
+
`?(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 r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let i=this.toString(),o=i.indexOf(t.word);o!==-1&&(r=this.positionInside(o,i),n=this.positionInside(o+t.word.length,i))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new pL().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let i of t)i===this?n=!0:n?(this.parent.insertAfter(r,i),r=i):this.parent.insertBefore(r,i);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},i=r==null;r=r||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))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=o,r.set(a.input,o),o++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return i&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=fL){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let i={node:this};for(let o in n)i[o]=n[o];return t.warn(r,i)}get proxyOf(){return this}},Zs=_u;_u.default=_u;var hL=Zs,ju=class extends hL{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]==="$"}},Xs=ju;ju.default=ju;var mL="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",gL=(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n},yL=(e=21)=>{let t="",r=e;for(;r--;)t+=mL[Math.random()*64|0];return t},bL={nanoid:yL,customAlphabet:gL},{SourceMapConsumer:Cy,SourceMapGenerator:Ry}=vt,{existsSync:wL,readFileSync:SL}=vt,{dirname:cu,join:vL}=vt;function xL(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Fu=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,i=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=cu(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new Cy(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^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(r.test(t)||n.test(t))return xL(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 r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),i=t.indexOf("*/",n);n>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,i)))}loadFile(t){if(this.root=cu(t),wL(t))return this.mapFile=t,SL(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let i=this.loadFile(n);if(!i)throw new Error("Unable to load previous source map: "+n.toString());return i}}else{if(r instanceof Cy)return Ry.fromSourceMap(r).toString();if(r instanceof Ry)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=vL(cu(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Gb=Fu;Fu.default=Fu;var{SourceMapConsumer:kL,SourceMapGenerator:CL}=vt,{fileURLToPath:Ey,pathToFileURL:ds}=vt,{isAbsolute:Bu,resolve:Vu}=vt,{nanoid:RL}=bL,uu=vt,Iy=wd,EL=Gb,du=Symbol("fromOffsetCache"),IL=!!(kL&&CL),Ay=!!(Vu&&Bu),_s=class{constructor(t,r={}){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,r.from&&(!Ay||/^\w+:\/\//.test(r.from)||Bu(r.from)?this.file=r.from:this.file=Vu(r.from)),Ay&&IL){let n=new EL(this.css,r);if(n.text){this.map=n;let i=n.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+RL(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,i={}){let o,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?o=new Iy(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 Iy(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,i.plugin),o.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(ds&&(o.input.url=ds(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let r,n;if(this[du])n=this[du];else{let o=this.css.split(`
|
|
163
|
+
`);n=new Array(o.length);let s=0;for(let a=0,l=o.length;a<l;a++)n[a]=s,s+=o[a].length+1;this[du]=n}r=n[n.length-1];let i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,s;for(;i<o;)if(s=i+(o-i>>1),t<n[s])o=s-1;else if(t>=n[s+1])i=s+1;else{i=s;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Vu(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,i){if(!this.map)return!1;let o=this.map.consumer(),s=o.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=o.originalPositionFor({column:i,line:n}));let l;Bu(s.source)?l=ds(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||ds(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(Ey)c.file=Ey(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=o.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},Qs=_s;_s.default=_s;uu&&uu.registerInput&&uu.registerInput(_s);var{SourceMapConsumer:qb,SourceMapGenerator:Cs}=vt,{dirname:Rs,relative:Kb,resolve:Jb,sep:Yb}=vt,{pathToFileURL:Py}=vt,AL=Qs,PL=!!(qb&&Cs),TL=!!(Rs&&Jb&&Kb&&Yb),OL=class{constructor(t,r,n,i){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,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 r=`
|
|
164
164
|
`;this.css.includes(`\r
|
|
165
165
|
`)&&(r=`\r
|
|
166
|
-
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||Rs(t.file),i;this.mapOpts.sourcesContent===!1?(i=new
|
|
167
|
-
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.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=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=r-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(r=>r.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 r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?Rs(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Rs(Kb(n,this.mapOpts.annotation)));let i=qb(n,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 r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new SL(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let i=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(i,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,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 r=this.memoizedFileURLs.get(t);if(r)return r;if(Ay){let n=Ay(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;Jb==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Yb=kL,CL=Zs,Uu=class extends CL{constructor(t){super(t),this.type="comment"}},ea=Uu;Uu.default=Uu;var{isClean:Zb,my:Xb}=Ni,Qb=Xs,ew=ea,RL=Zs,tw,Sd,vd,rw;function nw(e){return e.map(t=>(t.nodes&&(t.nodes=nw(t.nodes)),delete t.source,t))}function iw(e){if(e[Zb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)iw(t)}var zt=class ow extends RL{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let i of n)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,i;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],i=t(this.proxyOf.nodes[n],n),i!==!1);)this.indexes[r]+=1;return delete this.indexes[r],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,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):r==="every"||r==="some"?n=>t[r]((i,...o)=>n(i.toProxy(),...o)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of i)this.proxyOf.nodes.splice(n+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],n<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),i=n===0?"prepend":!1,o=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let a of o)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=nw(tw(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 Qb(t)]}else if(t.selector)t=[new Sd(t)];else if(t.name)t=[new vd(t)];else if(t.text)t=[new ew(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Xb]||ow.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Zb]&&iw(i),typeof i.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(i.raws.before=r.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let i of n)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+n.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 r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(i=>{r.props&&!r.props.includes(i.prop)||r.fast&&!i.value.includes(r.fast)||(i.value=i.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let i;try{i=t(r,n)}catch(o){throw r.addToError(o)}return i!==!1&&r.walk&&(i=r.walk(t)),i})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,i)}):this.walk((n,i)=>{if(n.type==="atrule"&&n.name===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="atrule")return r(n,i)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,i)}):this.walk((n,i)=>{if(n.type==="decl"&&n.prop===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="decl")return r(n,i)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,i)}):this.walk((n,i)=>{if(n.type==="rule"&&n.selector===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="rule")return r(n,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]}};zt.registerParse=e=>{tw=e};zt.registerRule=e=>{Sd=e};zt.registerAtRule=e=>{vd=e};zt.registerRoot=e=>{rw=e};var Br=zt;zt.default=zt;zt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,vd.prototype):e.type==="rule"?Object.setPrototypeOf(e,Sd.prototype):e.type==="decl"?Object.setPrototypeOf(e,Qb.prototype):e.type==="comment"?Object.setPrototypeOf(e,ew.prototype):e.type==="root"&&Object.setPrototypeOf(e,rw.prototype),e[Xb]=!0,e.nodes&&e.nodes.forEach(t=>{zt.rebuild(t)})};var EL=Br,sw,aw,Ei=class extends EL{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new sw(new aw,this,t).stringify()}};Ei.registerLazyResult=e=>{sw=e};Ei.registerProcessor=e=>{aw=e};var xd=Ei;Ei.default=Ei;var Py={},lw=function(t){Py[t]||(Py[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Wu=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}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}},cw=Wu;Wu.default=Wu;var IL=cw,Hu=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new IL(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},kd=Hu;Hu.default=Hu;var pu=39,Ty=34,ps=92,Oy=47,fs=10,mi=32,hs=12,ms=9,gs=13,AL=91,PL=93,TL=40,OL=41,ML=123,NL=125,LL=59,$L=42,DL=58,_L=64,ys=/[\t\n\f\r "#'()/;[\\\]{}]/g,bs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,jL=/.[\r\n"'(/\\]/,My=/[\da-f]/i,FL=function(t,r={}){let n=t.css.valueOf(),i=r.ignoreErrors,o,s,a,l,c,u,d,p,h,f,m=n.length,g=0,w=[],S=[];function y(){return g}function v(E){throw t.error("Unclosed "+E,g)}function C(){return S.length===0&&g>=m}function M(E){if(S.length)return S.pop();if(g>=m)return;let x=E?E.ignoreUnclosed:!1;switch(o=n.charCodeAt(g),o){case fs:case mi:case ms:case gs:case hs:{s=g;do s+=1,o=n.charCodeAt(s);while(o===mi||o===fs||o===ms||o===gs||o===hs);f=["space",n.slice(g,s)],g=s-1;break}case AL:case PL:case ML:case NL:case DL:case LL:case OL:{let U=String.fromCharCode(o);f=[U,U,g];break}case TL:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==pu&&h!==Ty&&h!==mi&&h!==fs&&h!==ms&&h!==hs&&h!==gs){s=g;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(i||x){s=g;break}else v("bracket");for(d=s;n.charCodeAt(d-1)===ps;)d-=1,u=!u}while(u);f=["brackets",n.slice(g,s+1),g,s],g=s}else s=n.indexOf(")",g+1),l=n.slice(g,s+1),s===-1||jL.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case pu:case Ty:{a=o===pu?"'":'"',s=g;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(i||x){s=g+1;break}else v("string");for(d=s;n.charCodeAt(d-1)===ps;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case _L:{ys.lastIndex=g+1,ys.test(n),ys.lastIndex===0?s=n.length-1:s=ys.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case ps:{for(s=g,c=!0;n.charCodeAt(s+1)===ps;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==Oy&&o!==mi&&o!==fs&&o!==ms&&o!==gs&&o!==hs&&(s+=1,My.test(n.charAt(s)))){for(;My.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===mi&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{o===Oy&&n.charCodeAt(g+1)===$L?(s=n.indexOf("*/",g+2)+1,s===0&&(i||x?s=n.length:v("comment")),f=["comment",n.slice(g,s+1),g,s],g=s):(bs.lastIndex=g+1,bs.test(n),bs.lastIndex===0?s=n.length-1:s=bs.lastIndex-2,f=["word",n.slice(g,s+1),g,s],w.push(f),g=s);break}}return g++,f}function R(E){S.push(E)}return{back:R,endOfFile:C,nextToken:M,position:y}},uw=Br,js=class extends uw{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)}},Cd=js;js.default=js;uw.registerAtRule(js);var dw=Br,pw,fw,yn=class extends dw{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let i=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let o of i)o.raws.before=r.raws.before}return i}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new pw(new fw,this,t).stringify()}};yn.registerLazyResult=e=>{pw=e};yn.registerProcessor=e=>{fw=e};var Li=yn;yn.default=yn;dw.registerRoot(yn);var Ii={comma(e){return Ii.split(e,[","],!0)},space(e){let t=[" ",`
|
|
168
|
-
`," "];return Ii.split(e,t)},split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(o=!0),o?(i!==""&&n.push(i.trim()),i="",o=!1):i+=u;return(r||i!=="")&&n.push(i.trim()),n}},
|
|
166
|
+
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||Rs(t.file),i;this.mapOpts.sourcesContent===!1?(i=new qb(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),TL&&PL&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[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=Cs.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Cs({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 Cs({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(i.generated.line=t,i.generated.column=r-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=n,i.original.line=1,i.original.column=0,this.map.addMapping(i))),o=a.match(/\n/g),o?(t+=o.length,s=a.lastIndexOf(`
|
|
167
|
+
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.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=r-2,this.map.addMapping(i)):(i.source=n,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=r-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(r=>r.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 r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?Rs(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Rs(Jb(n,this.mapOpts.annotation)));let i=Kb(n,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 r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new AL(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let i=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(i,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,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 r=this.memoizedFileURLs.get(t);if(r)return r;if(Py){let n=Py(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;Yb==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Zb=OL,ML=Zs,Uu=class extends ML{constructor(t){super(t),this.type="comment"}},ea=Uu;Uu.default=Uu;var{isClean:Xb,my:Qb}=Ni,ew=Xs,tw=ea,NL=Zs,rw,Sd,vd,nw;function iw(e){return e.map(t=>(t.nodes&&(t.nodes=iw(t.nodes)),delete t.source,t))}function ow(e){if(e[Xb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)ow(t)}var zt=class sw extends NL{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let i of n)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,i;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],i=t(this.proxyOf.nodes[n],n),i!==!1);)this.indexes[r]+=1;return delete this.indexes[r],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,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(i=>typeof i=="function"?(o,s)=>i(o.toProxy(),s):i)):r==="every"||r==="some"?n=>t[r]((i,...o)=>n(i.toProxy(),...o)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),i=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of i)this.proxyOf.nodes.splice(n+1,0,s);let o;for(let s in this.indexes)o=this.indexes[s],n<o&&(this.indexes[s]=o+i.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),i=n===0?"prepend":!1,o=this.normalize(r,this.proxyOf.nodes[n],i).reverse();n=this.index(t);for(let a of o)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+o.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=iw(rw(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 ew(t)]}else if(t.selector)t=[new Sd(t)];else if(t.name)t=[new vd(t)];else if(t.text)t=[new tw(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Qb]||sw.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Xb]&&ow(i),typeof i.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(i.raws.before=r.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let i of n)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+n.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 r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(i=>{r.props&&!r.props.includes(i.prop)||r.fast&&!i.value.includes(r.fast)||(i.value=i.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let i;try{i=t(r,n)}catch(o){throw r.addToError(o)}return i!==!1&&r.walk&&(i=r.walk(t)),i})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,i)}):this.walk((n,i)=>{if(n.type==="atrule"&&n.name===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="atrule")return r(n,i)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,i)}):this.walk((n,i)=>{if(n.type==="decl"&&n.prop===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="decl")return r(n,i)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,i)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,i)}):this.walk((n,i)=>{if(n.type==="rule"&&n.selector===t)return r(n,i)}):(r=t,this.walk((n,i)=>{if(n.type==="rule")return r(n,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]}};zt.registerParse=e=>{rw=e};zt.registerRule=e=>{Sd=e};zt.registerAtRule=e=>{vd=e};zt.registerRoot=e=>{nw=e};var Br=zt;zt.default=zt;zt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,vd.prototype):e.type==="rule"?Object.setPrototypeOf(e,Sd.prototype):e.type==="decl"?Object.setPrototypeOf(e,ew.prototype):e.type==="comment"?Object.setPrototypeOf(e,tw.prototype):e.type==="root"&&Object.setPrototypeOf(e,nw.prototype),e[Qb]=!0,e.nodes&&e.nodes.forEach(t=>{zt.rebuild(t)})};var LL=Br,aw,lw,Ei=class extends LL{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new aw(new lw,this,t).stringify()}};Ei.registerLazyResult=e=>{aw=e};Ei.registerProcessor=e=>{lw=e};var xd=Ei;Ei.default=Ei;var Ty={},cw=function(t){Ty[t]||(Ty[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Wu=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}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}},uw=Wu;Wu.default=Wu;var $L=uw,Hu=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new $L(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},kd=Hu;Hu.default=Hu;var pu=39,Oy=34,ps=92,My=47,fs=10,mi=32,hs=12,ms=9,gs=13,DL=91,_L=93,jL=40,FL=41,BL=123,VL=125,UL=59,WL=42,HL=58,zL=64,ys=/[\t\n\f\r "#'()/;[\\\]{}]/g,bs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,GL=/.[\r\n"'(/\\]/,Ny=/[\da-f]/i,qL=function(t,r={}){let n=t.css.valueOf(),i=r.ignoreErrors,o,s,a,l,c,u,d,p,h,f,m=n.length,g=0,w=[],S=[];function y(){return g}function v(E){throw t.error("Unclosed "+E,g)}function C(){return S.length===0&&g>=m}function M(E){if(S.length)return S.pop();if(g>=m)return;let x=E?E.ignoreUnclosed:!1;switch(o=n.charCodeAt(g),o){case fs:case mi:case ms:case gs:case hs:{s=g;do s+=1,o=n.charCodeAt(s);while(o===mi||o===fs||o===ms||o===gs||o===hs);f=["space",n.slice(g,s)],g=s-1;break}case DL:case _L:case BL:case VL:case HL:case UL:case FL:{let U=String.fromCharCode(o);f=[U,U,g];break}case jL:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==pu&&h!==Oy&&h!==mi&&h!==fs&&h!==ms&&h!==hs&&h!==gs){s=g;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(i||x){s=g;break}else v("bracket");for(d=s;n.charCodeAt(d-1)===ps;)d-=1,u=!u}while(u);f=["brackets",n.slice(g,s+1),g,s],g=s}else s=n.indexOf(")",g+1),l=n.slice(g,s+1),s===-1||GL.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case pu:case Oy:{a=o===pu?"'":'"',s=g;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(i||x){s=g+1;break}else v("string");for(d=s;n.charCodeAt(d-1)===ps;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case zL:{ys.lastIndex=g+1,ys.test(n),ys.lastIndex===0?s=n.length-1:s=ys.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case ps:{for(s=g,c=!0;n.charCodeAt(s+1)===ps;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==My&&o!==mi&&o!==fs&&o!==ms&&o!==gs&&o!==hs&&(s+=1,Ny.test(n.charAt(s)))){for(;Ny.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===mi&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{o===My&&n.charCodeAt(g+1)===WL?(s=n.indexOf("*/",g+2)+1,s===0&&(i||x?s=n.length:v("comment")),f=["comment",n.slice(g,s+1),g,s],g=s):(bs.lastIndex=g+1,bs.test(n),bs.lastIndex===0?s=n.length-1:s=bs.lastIndex-2,f=["word",n.slice(g,s+1),g,s],w.push(f),g=s);break}}return g++,f}function R(E){S.push(E)}return{back:R,endOfFile:C,nextToken:M,position:y}},dw=Br,js=class extends dw{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)}},Cd=js;js.default=js;dw.registerAtRule(js);var pw=Br,fw,hw,yn=class extends pw{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let i=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let o of i)o.raws.before=r.raws.before}return i}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new fw(new hw,this,t).stringify()}};yn.registerLazyResult=e=>{fw=e};yn.registerProcessor=e=>{hw=e};var Li=yn;yn.default=yn;pw.registerRoot(yn);var Ii={comma(e){return Ii.split(e,[","],!0)},space(e){let t=[" ",`
|
|
168
|
+
`," "];return Ii.split(e,t)},split(e,t,r){let n=[],i="",o=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(o=!0),o?(i!==""&&n.push(i.trim()),i="",o=!1):i+=u;return(r||i!=="")&&n.push(i.trim()),n}},mw=Ii;Ii.default=Ii;var gw=Br,KL=mw,Fs=class extends gw{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return KL.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},Rd=Fs;Fs.default=Fs;gw.registerRule(Fs);var JL=Xs,YL=qL,ZL=ea,XL=Cd,QL=Li,Ly=Rd,$y={empty:!0,space:!0};function e$(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var t$=class{constructor(t){this.input=t,this.root=new QL,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 r=new XL;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,i,o,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(o=l.length-1,i=l[o];i&&i[0]==="space";)i=l[--o];i&&(r.source.end=this.getPosition(i[3]||i[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,i;for(let o=r-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(n+=1,n===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let r=0,n,i,o;for(let[s,a]of t.entries()){if(n=a,i=n[0],i==="("&&(r+=1),i===")"&&(r-=1),r===0&&i===":")if(!o)this.doubleColon(n);else{if(o[0]==="word"&&o[1]==="progid")continue;return s}o=n}return!1}comment(t){let r=new ZL;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let i=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=i[2],r.raws.left=i[1],r.raws.right=i[3]}}createTokenizer(){this.tokenizer=YL(this.input)}decl(t,r){let n=new JL;this.init(n,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(i[3]||i[2]||e$(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){n.raws.between+=o[1];break}else o[0]==="word"&&/\w/.test(o[1])&&this.unknownWord([o]),n.raws.between+=o[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.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 c=t.length-1;c>=0;c--){if(o=t[c],o[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(o[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let h=u[p][0];if(d.trim().indexOf("!")===0&&h!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new Ly;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}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 r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,i=!1,o=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")o||(o=c),s.push(n==="("?")":"]");else if(a&&i&&n==="{")o||(o=c),s.push("}");else if(s.length===0)if(n===";")if(i){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(i=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(o=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(o),r&&i){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="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,r,n,i){let o,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)o=n[p],s=o[0],s==="space"&&p===a-1&&!i?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!$y[d]&&!$y[u]?l.slice(-1)===","?c=!1:l+=o[1]:c=!1):l+=o[1];if(!c){let p=n.reduce((h,f)=>h+f[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new Ly;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let i=r;i<t.length;i++)n+=t[i][1];return t.splice(r,t.length-r),n}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,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},r$=t$,n$=Br,i$=r$,o$=Qs;function Bs(e,t){let r=new o$(e,t),n=new i$(r);try{n.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?i.message+=`
|
|
169
169
|
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?i.message+=`
|
|
170
170
|
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(i.message+=`
|
|
171
|
-
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return n.root}var Ed=Bs;Bs.default=Bs;JL.registerParse(Bs);var{isClean:Ot,my:XL}=Ni,QL=Yb,e$=Ys,t$=Br,r$=xd,n$=lw,$y=kd,i$=Ed,o$=Li,s$={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},a$={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},l$={Once:!0,postcssPlugin:!0,prepare:!0},bn=0;function gi(e){return typeof e=="object"&&typeof e.then=="function"}function gw(e){let t=!1,r=s$[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,bn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,bn,r+"Exit"]:[r,r+"Exit"]}function Dy(e){let t;return e.type==="document"?t=["Document",bn,"DocumentExit"]:e.type==="root"?t=["Root",bn,"RootExit"]:t=gw(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function zu(e){return e[Ot]=!1,e.nodes&&e.nodes.forEach(t=>zu(t)),e}var Gu={},wn=class yw{constructor(t,r,n){this.stringified=!1,this.processed=!1;let i;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))i=zu(r);else if(r instanceof yw||r instanceof $y)i=zu(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let o=i$;n.syntax&&(o=n.syntax.parse),n.parser&&(o=n.parser),o.parse&&(o=o.parse);try{i=o(r,n)}catch(s){this.processed=!0,this.error=s}i&&!i[XL]&&t$.rebuild(i)}this.result=new $y(t,i,n),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,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let i=n.postcssPlugin,o=n.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=(r,n,i)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,i])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!a$[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!l$[n])if(typeof r[n]=="object")for(let i in r[n])i==="*"?t(r,n,r[n][i]):t(r,n+"-"+i.toLowerCase(),r[n][i]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(gi(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ot];){t[Ot]=!0;let r=[Dy(t)];for(;r.length>0;){let n=this.visitTick(r);if(gi(n))try{await n}catch(i){let o=r[r.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let i=t.nodes.map(o=>n(o,this.helpers));await Promise.all(i)}else await n(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 r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return gi(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=e$;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new QL(r,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 r=this.runOnRoot(t);if(gi(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ot];)t[Ot]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||n$("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,r)}toString(){return this.css}visitSync(t,r){for(let[n,i]of t){this.result.lastPlugin=n;let o;try{o=i(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(gi(o))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(i.length>0&&r.visitorIndex<i.length){let[s,a]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[Ot]){a[Ot]=!0,t.push(Dy(a));return}r.iterator=0,delete n.indexes[s]}let o=r.events;for(;r.eventIndex<o.length;){let s=o[r.eventIndex];if(r.eventIndex+=1,s===bn){n.nodes&&n.nodes.length&&(n[Ot]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[Ot]=!0;let r=gw(t);for(let n of r)if(n===bn)t.nodes&&t.each(i=>{i[Ot]||this.walkSync(i)});else{let i=this.listeners[n];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"}};wn.registerPostcss=e=>{Gu=e};var bw=wn;wn.default=wn;o$.registerLazyResult(wn);r$.registerLazyResult(wn);var c$=Yb,u$=Ys,d$=lw,p$=Ed,f$=kd,qu=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let i,o=u$;this.result=new f$(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new c$(o,i,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}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,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||d$("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,r)}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,r=p$;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},h$=qu;qu.default=qu;var m$=h$,g$=bw,y$=xd,b$=Li,Ai=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.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(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new m$(this,t,r):new g$(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},w$=Ai;Ai.default=Ai;b$.registerProcessor(Ai);y$.registerProcessor(Ai);var S$=Xs,v$=zb,x$=ea,k$=Cd,C$=Qs,R$=Li,E$=Rd;function Pi(e,t){if(Array.isArray(e))return e.map(i=>Pi(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:C$.prototype};o.map&&(o.map={...o.map,__proto__:v$.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>Pi(i,t))),n.source){let{inputId:i,...o}=n.source;n.source=o,i!=null&&(n.source.input=t[i])}if(n.type==="root")return new R$(n);if(n.type==="decl")return new S$(n);if(n.type==="rule")return new E$(n);if(n.type==="comment")return new x$(n);if(n.type==="atrule")return new k$(n);throw new Error("Unknown node type: "+e.type)}var I$=Pi;Pi.default=Pi;var A$=wd,ww=Xs,P$=bw,T$=Br,Id=w$,O$=Ys,M$=I$,Sw=xd,N$=cw,vw=ea,xw=Cd,L$=kd,$$=Qs,D$=Ed,_$=hw,kw=Rd,Cw=Li,j$=Zs;function ie(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Id(e)}ie.plugin=function(t,r){let n=!1;function i(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
171
|
+
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return n.root}var Ed=Bs;Bs.default=Bs;n$.registerParse(Bs);var{isClean:Mt,my:s$}=Ni,a$=Zb,l$=Ys,c$=Br,u$=xd,d$=cw,Dy=kd,p$=Ed,f$=Li,h$={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},m$={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},g$={Once:!0,postcssPlugin:!0,prepare:!0},bn=0;function gi(e){return typeof e=="object"&&typeof e.then=="function"}function yw(e){let t=!1,r=h$[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,bn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,bn,r+"Exit"]:[r,r+"Exit"]}function _y(e){let t;return e.type==="document"?t=["Document",bn,"DocumentExit"]:e.type==="root"?t=["Root",bn,"RootExit"]:t=yw(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function zu(e){return e[Mt]=!1,e.nodes&&e.nodes.forEach(t=>zu(t)),e}var Gu={},wn=class bw{constructor(t,r,n){this.stringified=!1,this.processed=!1;let i;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))i=zu(r);else if(r instanceof bw||r instanceof Dy)i=zu(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let o=p$;n.syntax&&(o=n.syntax.parse),n.parser&&(o=n.parser),o.parse&&(o=o.parse);try{i=o(r,n)}catch(s){this.processed=!0,this.error=s}i&&!i[s$]&&c$.rebuild(i)}this.result=new Dy(t,i,n),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,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let i=n.postcssPlugin,o=n.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=(r,n,i)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,i])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!m$[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!g$[n])if(typeof r[n]=="object")for(let i in r[n])i==="*"?t(r,n,r[n][i]):t(r,n+"-"+i.toLowerCase(),r[n][i]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(gi(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Mt];){t[Mt]=!0;let r=[_y(t)];for(;r.length>0;){let n=this.visitTick(r);if(gi(n))try{await n}catch(i){let o=r[r.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let i=t.nodes.map(o=>n(o,this.helpers));await Promise.all(i)}else await n(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 r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return gi(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=l$;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new a$(r,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 r=this.runOnRoot(t);if(gi(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Mt];)t[Mt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||d$("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,r)}toString(){return this.css}visitSync(t,r){for(let[n,i]of t){this.result.lastPlugin=n;let o;try{o=i(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(gi(o))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:i}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(i.length>0&&r.visitorIndex<i.length){let[s,a]=i[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===i.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[Mt]){a[Mt]=!0,t.push(_y(a));return}r.iterator=0,delete n.indexes[s]}let o=r.events;for(;r.eventIndex<o.length;){let s=o[r.eventIndex];if(r.eventIndex+=1,s===bn){n.nodes&&n.nodes.length&&(n[Mt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[Mt]=!0;let r=yw(t);for(let n of r)if(n===bn)t.nodes&&t.each(i=>{i[Mt]||this.walkSync(i)});else{let i=this.listeners[n];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"}};wn.registerPostcss=e=>{Gu=e};var ww=wn;wn.default=wn;f$.registerLazyResult(wn);u$.registerLazyResult(wn);var y$=Zb,b$=Ys,w$=cw,S$=Ed,v$=kd,qu=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let i,o=b$;this.result=new v$(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new y$(o,i,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}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,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||w$("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,r)}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,r=S$;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},x$=qu;qu.default=qu;var k$=x$,C$=ww,R$=xd,E$=Li,Ai=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.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(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new k$(this,t,r):new C$(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},I$=Ai;Ai.default=Ai;E$.registerProcessor(Ai);R$.registerProcessor(Ai);var A$=Xs,P$=Gb,T$=ea,O$=Cd,M$=Qs,N$=Li,L$=Rd;function Pi(e,t){if(Array.isArray(e))return e.map(i=>Pi(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:M$.prototype};o.map&&(o.map={...o.map,__proto__:P$.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>Pi(i,t))),n.source){let{inputId:i,...o}=n.source;n.source=o,i!=null&&(n.source.input=t[i])}if(n.type==="root")return new N$(n);if(n.type==="decl")return new A$(n);if(n.type==="rule")return new L$(n);if(n.type==="comment")return new T$(n);if(n.type==="atrule")return new O$(n);throw new Error("Unknown node type: "+e.type)}var $$=Pi;Pi.default=Pi;var D$=wd,Sw=Xs,_$=ww,j$=Br,Id=I$,F$=Ys,B$=$$,vw=xd,V$=uw,xw=ea,kw=Cd,U$=kd,W$=Qs,H$=Ed,z$=mw,Cw=Rd,Rw=Li,G$=Zs;function ie(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Id(e)}ie.plugin=function(t,r){let n=!1;function i(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
172
172
|
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:
|
|
173
|
-
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new Id().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return ie([i(l)]).process(s,a)},i};ie.stringify=
|
|
173
|
+
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new Id().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return ie([i(l)]).process(s,a)},i};ie.stringify=F$;ie.parse=H$;ie.fromJSON=B$;ie.list=z$;ie.comment=e=>new xw(e);ie.atRule=e=>new kw(e);ie.decl=e=>new Sw(e);ie.rule=e=>new Cw(e);ie.root=e=>new Rw(e);ie.document=e=>new vw(e);ie.CssSyntaxError=D$;ie.Declaration=Sw;ie.Container=j$;ie.Processor=Id;ie.Document=vw;ie.Comment=xw;ie.Warning=V$;ie.AtRule=kw;ie.Result=U$;ie.Input=W$;ie.Rule=Cw;ie.Root=Rw;ie.Node=G$;_$.registerPostcss(ie);var q$=ie;ie.default=ie;var ve=nL(q$);ve.stringify;ve.fromJSON;ve.plugin;ve.parse;ve.list;ve.document;ve.comment;ve.atRule;ve.rule;ve.decl;ve.root;ve.CssSyntaxError;ve.Declaration;ve.Container;ve.Processor;ve.Document;ve.Comment;ve.Warning;ve.AtRule;ve.Result;ve.Input;ve.Rule;ve.Root;ve.Node;var Ku=class e{constructor(...t){dt(this,"parentElement",null),dt(this,"parentNode",null),dt(this,"ownerDocument"),dt(this,"firstChild",null),dt(this,"lastChild",null),dt(this,"previousSibling",null),dt(this,"nextSibling",null),dt(this,"ELEMENT_NODE",1),dt(this,"TEXT_NODE",3),dt(this,"nodeType"),dt(this,"nodeName"),dt(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.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,r){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 jy={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Fy={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ws={},K$=()=>!!globalThis.Zone;function Ad(e){if(ws[e])return ws[e];let t=globalThis[e],r=t.prototype,n=e in jy?jy[e]:void 0,i=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),o=e in Fy?Fy[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!K$())return ws[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 c=l[e].prototype;return document.body.removeChild(a),c?ws[e]=c:r}catch{return r}}var fu={};function qt(e,t,r){var n;let i=`${e}.${String(r)}`;if(fu[i])return fu[i].call(t);let o=Ad(e),s=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return s?(fu[i]=s,s.call(t)):t[r]}var hu={};function Ew(e,t,r){let n=`${e}.${String(r)}`;if(hu[n])return hu[n].bind(t);let o=Ad(e)[r];return typeof o!="function"?t[r]:(hu[n]=o,o.bind(t))}function J$(e){return qt("Node",e,"ownerDocument")}function Y$(e){return qt("Node",e,"childNodes")}function Z$(e){return qt("Node",e,"parentNode")}function X$(e){return qt("Node",e,"parentElement")}function Q$(e){return qt("Node",e,"textContent")}function e6(e,t){return Ew("Node",e,"contains")(t)}function t6(e){return Ew("Node",e,"getRootNode")()}function r6(e){return!e||!("host"in e)?null:qt("ShadowRoot",e,"host")}function n6(e){return e.styleSheets}function i6(e){return!e||!("shadowRoot"in e)?null:qt("Element",e,"shadowRoot")}function o6(e,t){return qt("Element",e,"querySelector")(t)}function s6(e,t){return qt("Element",e,"querySelectorAll")(t)}function Iw(){return Ad("MutationObserver").constructor}function Vr(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}var H={ownerDocument:J$,childNodes:Y$,parentNode:Z$,parentElement:X$,textContent:Q$,contains:e6,getRootNode:t6,host:r6,styleSheets:n6,shadowRoot:i6,querySelector:o6,querySelectorAll:s6,mutationObserver:Iw,patch:Vr};function Je(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var cn=`Please stop import mirror directly. Instead of that,\r
|
|
174
174
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
175
|
-
or you can use record.mirror to access the mirror instance during recording.`,Fy={map:{},getId(){return console.error(cn),-1},getNode(){return console.error(cn),null},removeNodeFromMap(){console.error(cn)},has(){return console.error(cn),!1},reset(){console.error(cn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Fy=new Proxy(Fy,{get(e,t,r){return t==="map"&&console.error(cn),Reflect.get(e,t,r)}}));function Ti(e,t,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,e.apply(l,o)},a))}}function ta(e,t,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>ta(e,t,o||{},!0)}var Vs=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Vs=()=>new Date().getTime());function Iw(e){var t,r,n,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=H.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=H.parentElement(o.body))==null?void 0:n.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function Aw(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Pw(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Tw(e){return e?e.nodeType===e.ELEMENT_NODE?e:H.parentElement(e):null}function Ye(e,t,r,n){if(!e)return!1;let i=Tw(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(Ms(i,t,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function Q$(e,t){return t.getId(e)!==-1}function mu(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===vi}function Ow(e,t){if(bi(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=H.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Ow(n,t):!0}function Ju(e){return!!e.changedTouches}function e6(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 Mw(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Nw(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Yu(e){return e?e instanceof Ku&&"shadowRoot"in e?!!e.shadowRoot:!!H.shadowRoot(e):!1}var Zu=class{constructor(){k(this,"id",1),k(this,"styleIDMap",new WeakMap),k(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}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 Lw(e){var t;let r=null;return"getRootNode"in e&&((t=H.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&H.host(H.getRootNode(e))&&(r=H.host(H.getRootNode(e))),r}function t6(e){let t=e,r;for(;r=Lw(t);)t=r;return t}function r6(e){let t=H.ownerDocument(e);if(!t)return!1;let r=t6(e);return H.contains(t,r)}function $w(e){let t=H.ownerDocument(e);return t?H.contains(t,e)||r6(e):!1}var q=(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))(q||{}),z=(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))(z||{}),tt=(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))(tt||{}),Wt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Wt||{}),Sn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Sn||{}),un=(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))(un||{});var Dw=(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))(Dw||{});function By(e){return"__ln"in e}var Xu=class{constructor(){k(this,"length",0),k(this,"head",null),k(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&By(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&By(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Vy=(e,t)=>`${e}@${t}`,Qu=class{constructor(){k(this,"frozen",!1),k(this,"locked",!1),k(this,"texts",[]),k(this,"attributes",[]),k(this,"attributeMap",new WeakMap),k(this,"removes",[]),k(this,"mapRemoves",[]),k(this,"movedMap",{}),k(this,"addedSet",new Set),k(this,"movedSet",new Set),k(this,"droppedSet",new Set),k(this,"removesSubTreeCache",new Set),k(this,"mutationCb"),k(this,"blockClass"),k(this,"blockSelector"),k(this,"maskTextClass"),k(this,"maskTextSelector"),k(this,"inlineStylesheet"),k(this,"maskInputOptions"),k(this,"maskTextFn"),k(this,"maskInputFn"),k(this,"keepIframeSrcFn"),k(this,"recordCanvas"),k(this,"inlineImages"),k(this,"slimDOMOptions"),k(this,"dataURLOptions"),k(this,"doc"),k(this,"mirror"),k(this,"iframeManager"),k(this,"stylesheetManager"),k(this,"shadowDomManager"),k(this,"canvasManager"),k(this,"processedNodeManager"),k(this,"unattachedDoc"),k(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),k(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new Xu,i=l=>{let c=l,u=vi;for(;u===vi;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},o=l=>{let c=H.parentNode(l);if(!c||!$w(l))return;let u=!1;if(l.nodeType===Node.TEXT_NODE){let f=c.tagName;if(f==="TEXTAREA")return;f==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let d=bi(c)?this.mirror.getId(Lw(l)):this.mirror.getId(c),p=i(l);if(d===-1||p===-1)return n.addNode(l);let h=pn(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:f=>{Mw(f,this.mirror)&&this.iframeManager.addIframe(f),Nw(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Yu(l)&&this.shadowDomManager.addShadowRoot(H.shadowRoot(l),this.doc)},onIframeLoad:(f,m)=>{this.iframeManager.attachIframe(f,m),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,m)=>{this.stylesheetManager.attachLinkElement(f,m)},cssCaptured:u});h&&(t.push({parentId:d,nextId:p,node:h}),r.add(h.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)Uy(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(H.parentNode(l))||o(l);for(let l of this.addedSet)!Wy(this.droppedSet,l)&&!Uy(this.removesSubTreeCache,l,this.mirror)||Wy(this.movedSet,l)?o(l):this.droppedSet.add(l);let s=null;for(;n.length;){let l=null;if(s){let c=this.mirror.getId(H.parentNode(s.value)),u=i(s.value);c!==-1&&u!==-1&&(l=s)}if(!l){let c=n.tail;for(;c;){let u=c;if(c=c.previous,u){let d=this.mirror.getId(H.parentNode(u.value));if(i(u.value)===-1)continue;if(d!==-1){l=u;break}else{let h=u.value,f=H.parentNode(h);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=H.host(f);if(this.mirror.getId(m)!==-1){l=u;break}}}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}s=l.previous,n.removeNode(l.value),o(l.value)}let a={texts:this.texts.map(l=>{let c=l.node,u=H.parentNode(c);return u&&u.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(u),{id:this.mirror.getId(c),value:l.value}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:c}=l;if(typeof c.style=="string"){let u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!r.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))}),k(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(H.childNodes(t),i=>H.textContent(i)||"").join("");r.attributes.value=Ps({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Ts(t),value:n,maskInputFn:this.maskInputFn})}),k(this,"processMutation",t=>{if(!mu(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=H.textContent(t.target);!Ye(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:nb(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Tw(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,i=t.target.getAttribute(n);if(n==="value"){let s=Ts(r);i=Ps({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(Ye(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)n="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!rb(r.tagName,n))if(o.attributes[n]=tb(this.doc,jr(r.tagName),jr(n),i),n==="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(r.style)){let l=r.style.getPropertyValue(a),c=r.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||c!==s.style.getPropertyPriority(a)?c===""?o.styleDiff[a]=l:o.styleDiff[a]=[l,c]:o._unchangedStyles[a]=[l,c]}for(let a of Array.from(s.style))r.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(Ye(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=bi(t.target)?this.mirror.getId(H.host(t.target)):this.mirror.getId(t.target);Ye(t.target,this.blockClass,this.blockSelector,!1)||mu(r,this.mirror,this.slimDOMOptions)||!Q$(r,this.mirror)||(this.addedSet.has(r)?(ed(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Ow(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Vy(n,i)]?ed(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:bi(t.target)&&wi(t.target)?!0:void 0}),n6(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),k(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(mu(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Vy(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Ye(t,this.blockClass,this.blockSelector,!1)||(H.childNodes(t).forEach(n=>this.genAdds(n)),Yu(t)&&H.childNodes(H.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,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(r=>{this[r]=t[r]})}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 ed(e,t){e.delete(t),H.childNodes(t).forEach(r=>ed(e,r))}function n6(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),H.childNodes(n).forEach(i=>r.push(i)))}}function Uy(e,t,r){return e.size===0?!1:i6(e,t)}function i6(e,t,r){let n=H.parentNode(t);return n?e.has(n):!1}function Wy(e,t){return e.size===0?!1:_w(e,t)}function _w(e,t){let r=H.parentNode(t);return r?e.has(r)?!0:_w(e,r):!1}var Si;function o6(e){Si=e}function s6(){Si=void 0}var Y=e=>Si?(...r)=>{try{return e(...r)}catch(n){if(Si&&Si(n)===!0)return;throw n}}:e,_r=[];function $i(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 jw(e,t){let r=new Qu;_r.push(r),r.init(e);let n=new(Ew())(Y(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function a6({mousemoveCb:e,sampling:t,doc:r,mirror:n}){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=Ti(Y(d=>{let p=Date.now()-a;e(s.map(h=>(h.timeOffset-=p,h)),d),s=[],a=null}),o),c=Y(Ti(Y(d=>{let p=$i(d),{clientX:h,clientY:f}=Ju(d)?d.changedTouches[0]:d;a||(a=Vs()),s.push({x:h,y:f,id:n.getId(p),timeOffset:Vs()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?z.Drag:d instanceof MouseEvent?z.MouseMove:z.TouchMove)}),i,{trailing:!1})),u=[Je("mousemove",c,r),Je("touchmove",c,r),Je("drag",c,r)];return Y(()=>{u.forEach(d=>d())})}function l6({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,c=u=>d=>{let p=$i(d);if(Ye(p,n,i,!0))return;let h=null,f=u;if("pointerType"in d){switch(d.pointerType){case"mouse":h=Wt.Mouse;break;case"touch":h=Wt.Touch;break;case"pen":h=Wt.Pen;break}h===Wt.Touch?tt[u]===tt.MouseDown?f="TouchStart":tt[u]===tt.MouseUp&&(f="TouchEnd"):Wt.Pen}else Ju(d)&&(h=Wt.Touch);h!==null?(l=h,(f.startsWith("Touch")&&h===Wt.Touch||f.startsWith("Mouse")&&h===Wt.Mouse)&&(h=null)):tt[u]===tt.Click&&(h=l,l=null);let m=Ju(d)?d.changedTouches[0]:d;if(!m)return;let g=r.getId(p),{clientX:w,clientY:S}=m;Y(e)({type:tt[f],id:g,x:w,y:S,...h!==null&&{pointerType:h}})};return Object.keys(tt).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=jr(u),p=c(u);if(window.PointerEvent)switch(tt[u]){case tt.MouseDown:case tt.MouseUp:d=d.replace("mouse","pointer");break;case tt.TouchStart:case tt.TouchEnd:return}a.push(Je(d,p,t))}),Y(()=>{a.forEach(u=>u())})}function Fw({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=Y(Ti(Y(a=>{let l=$i(a);if(!l||Ye(l,n,i,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let u=Iw(t.defaultView);e({id:c,x:u.left,y:u.top})}else e({id:c,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Je("scroll",s,t)}function c6({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=Y(Ti(Y(()=>{let o=Aw(),s=Pw();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return Je("resize",i,t)}var u6=["INPUT","TEXTAREA","SELECT"],Hy=new WeakMap;function d6({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(S){let y=$i(S),v=S.isTrusted,C=y&&y.tagName;if(y&&C==="OPTION"&&(y=H.parentElement(y)),!y||!C||u6.indexOf(C)<0||Ye(y,n,i,!0)||y.classList.contains(o)||s&&y.matches(s))return;let M=y.value,R=!1,E=Ts(y)||"";E==="radio"||E==="checkbox"?R=y.checked:(a[C.toLowerCase()]||a[E])&&(M=Ps({element:y,maskInputOptions:a,tagName:C,type:E,value:M,maskInputFn:l})),p(y,u?{text:M,isChecked:R,userTriggered:v}:{text:M,isChecked:R});let x=y.name;E==="radio"&&x&&R&&t.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(U=>{if(U!==y){let X=U.value;p(U,u?{text:X,isChecked:!R,userTriggered:!1}:{text:X,isChecked:!R})}})}function p(S,y){let v=Hy.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){Hy.set(S,y);let C=r.getId(S);Y(e)({...y,id:C})}}let f=(c.input==="last"?["change"]:["input","change"]).map(S=>Je(S,Y(d),t)),m=t.defaultView;if(!m)return()=>{f.forEach(S=>S())};let g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[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 g&&g.set&&f.push(...w.map(S=>ta(S[0],S[1],{set(){Y(d)({target:this,isTrusted:!1})}},!1,m))),Y(()=>{f.forEach(S=>S())})}function Us(e){let t=[];function r(n,i){if(Ss("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ss("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ss("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ss("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(e,t)}function gr(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function p6({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Y((u,d,p)=>{let[h,f]=p,{id:m,styleId:g}=gr(d,t,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:h,index:f}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let h=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[h,p])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Y((u,d,p)=>{let[h]=p,{id:f,styleId:m}=gr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,removes:[{index:h}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Y((u,d,p)=>{let[h]=p,{id:f,styleId:m}=gr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replace:h}),u.apply(d,p)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Y((u,d,p)=>{let[h]=p,{id:f,styleId:m}=gr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replaceSync:h}),u.apply(d,p)})}));let l={};vs("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(vs("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),vs("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),vs("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:Y((p,h,f)=>{let[m,g]=f,{id:w,styleId:S}=gr(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||S&&S!==-1)&&e({id:w,styleId:S,adds:[{rule:m,index:[...Us(h),g||0]}]}),p.apply(h,f)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:Y((p,h,f)=>{let[m]=f,{id:g,styleId:w}=gr(h.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||w&&w!==-1)&&e({id:g,styleId:w,removes:[{index:[...Us(h),m]}]}),p.apply(h,f)})})}),Y(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function Bw({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(H.host(r));let a=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(i=r.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(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return(c=l.get)==null?void 0:c.call(this)},set(c){var u;let d=(u=l.set)==null?void 0:u.call(this,c);if(s!==null&&s!==-1)try{t.adoptStyleSheets(c,s)}catch{}return d}}),Y(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function f6({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Y((a,l,c)=>{var u;let[d,p,h]=c;if(r.has(d))return o.apply(l,[d,p,h]);let{id:f,styleId:m}=gr((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,set:{property:d,value:p,priority:h},index:Us(l.parentRule)}),a.apply(l,c)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:Y((a,l,c)=>{var u;let[d]=c;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:h}=gr((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,remove:{property:d},index:Us(l.parentRule)}),a.apply(l,c)})}),Y(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function h6({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){let s=Y(l=>Ti(Y(c=>{let u=$i(c);if(!u||Ye(u,t,r,!0))return;let{currentTime:d,volume:p,muted:h,playbackRate:f,loop:m}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:h,playbackRate:f,loop:m})}),i.media||500)),a=[Je("play",s(un.Play),o),Je("pause",s(un.Pause),o),Je("seeked",s(un.Seeked),o),Je("volumechange",s(un.VolumeChange),o),Je("ratechange",s(un.RateChange),o)];return Y(()=>{a.forEach(l=>l())})}function m6({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(l,c,u){let d=new o(l,c,u);return i.set(d,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};let s=Vr(t.fonts,"add",function(a){return function(l){return setTimeout(Y(()=>{let c=i.get(l);c&&(e(c),i.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=o}),n.push(s),Y(()=>{n.forEach(a=>a())})}function g6(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e,s=!0,a=Y(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let c=[],u=l.rangeCount||0;for(let d=0;d<u;d++){let p=l.getRangeAt(d),{startContainer:h,startOffset:f,endContainer:m,endOffset:g}=p;Ye(h,n,i,!0)||Ye(m,n,i,!0)||c.push({start:r.getId(h),startOffset:f,end:r.getId(m),endOffset:g})}o({ranges:c})});return a(),Je("selectionchange",a)}function y6({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Vr(r.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 b6(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:h,customElementCb:f}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...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),c(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),u(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),d(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),p(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),f(...m)}}function w6(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};b6(e,t);let n;e.recordDOM&&(n=jw(e,e.doc));let i=a6(e),o=l6(e),s=Fw(e),a=c6(e,{win:r}),l=d6(e),c=h6(e),u=()=>{},d=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(u=p6(e,{win:r}),d=Bw(e,e.doc),p=f6(e,{win:r}),e.collectFonts&&(h=m6(e)));let f=g6(e),m=y6(e),g=[];for(let w of e.plugins)g.push(w.observer(w.callback,r,w.options));return Y(()=>{_r.forEach(w=>w.reset()),n?.disconnect(),i(),o(),s(),a(),l(),c(),u(),d(),p(),h(),f(),m(),g.forEach(w=>w())})}function Ss(e){return typeof window[e]<"u"}function vs(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Ws=class{constructor(t){k(this,"iframeIdToRemoteIdMap",new WeakMap),k(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,i){let o=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(r);return a||(a=this.generateIdFn(),o.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},td=class{constructor(t){k(this,"iframes",new WeakMap),k(this,"crossOriginIframeMap",new WeakMap),k(this,"crossOriginIframeMirror",new Ws(eb)),k(this,"crossOriginIframeStyleMirror"),k(this,"crossOriginIframeRootIdMap",new WeakMap),k(this,"mirror"),k(this,"mutationCb"),k(this,"wrappedEmit"),k(this,"loadListener"),k(this,"stylesheetManager"),k(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ws(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,r){var n,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.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 r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case q.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:q.IncrementalSnapshot,data:{source:z.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case q.Meta:case q.Load:case q.DomContentLoaded:return!1;case q.Plugin:return r;case q.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case q.IncrementalSnapshot:switch(r.data.source){case z.Mutation:return r.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)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case z.Drag:case z.TouchMove:case z.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case z.ViewportResize:return!1;case z.MediaInteraction:case z.MouseInteraction:case z.Scroll:case z.CanvasMutation:case z.Input:return this.replaceIds(r.data,t,["id"]),r;case z.StyleSheetRule:case z.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case z.Font:return r;case z.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case z.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==Dw.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},rd=class{constructor(t){k(this,"shadowDoms",new WeakSet),k(this,"mutationCb"),k(this,"scrollCb"),k(this,"bypassOptions"),k(this,"mirror"),k(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,r){if(!wi(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=jw({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Fw({...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(H.host(t))),this.restoreHandlers.push(Bw({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Vr(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=H.shadowRoot(this);return a&&$w(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S6=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(yi=0;yi<fn.length;yi++)S6[fn.charCodeAt(yi)]=yi;var yi,v6=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=fn[t[r]>>2],i+=fn[(t[r]&3)<<4|t[r+1]>>4],i+=fn[(t[r+1]&15)<<2|t[r+2]>>6],i+=fn[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var zy=new Map;function x6(e,t){let r=zy.get(e);return r||(r=new Map,zy.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Vw=(e,t,r)=>{if(!e||!(Ww(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=x6(r,n),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Es(e,t,r){if(e instanceof Array)return e.map(n=>Es(n,t,r));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 n=e.constructor.name,i=v6(e);return{rr_type:n,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Es(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return{rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return{rr_type:n,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Es(e.data,t,r),e.width,e.height]};if(Ww(e,t)||typeof e=="object"){let n=e.constructor.name,i=Vw(e,t,r);return{rr_type:n,index:i}}}}return e}var Uw=(e,t,r)=>e.map(n=>Es(n,t,r)),Ww=(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 k6(e,t,r,n){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Vr(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return Ye(this.canvas,r,n,!0)||setTimeout(()=>{let u=Uw(c,t,this);e(this.canvas,{type:Sn["2D"],property:s,args:u})},0),l.apply(this,c)}});i.push(a)}catch{let a=ta(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Sn["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function C6(e){return e==="experimental-webgl"?"webgl":e}function Gy(e,t,r,n){let i=[];try{let o=Vr(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!Ye(this,t,r,!0)){let c=C6(a);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(l[0]&&typeof l[0]=="object"){let u=l[0];u.preserveDrawingBuffer||(u.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 qy(e,t,r,n,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 c=Vr(e,l,function(u){return function(...d){let p=u.apply(this,d);if(Vw(p,o,this),"tagName"in this.canvas&&!Ye(this.canvas,n,i,!0)){let h=Uw(d,o,this),f={type:t,property:l,args:h};r(this.canvas,f)}return p}});s.push(c)}catch{let c=ta(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function R6(e,t,r,n){let i=[];return i.push(...qy(t.WebGLRenderingContext.prototype,Sn.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...qy(t.WebGL2RenderingContext.prototype,Sn.WebGL2,e,r,n,t)),()=>{i.forEach(o=>o())}}var Hw="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",E6=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Ky=typeof window<"u"&&window.Blob&&new Blob([E6(Hw)],{type:"text/javascript;charset=utf-8"});function I6(e){let t;try{if(t=Ky&&(window.URL||window.webkitURL).createObjectURL(Ky),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+Hw,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var nd=class{constructor(t){k(this,"pendingCanvasMutations",new Map),k(this,"rafStamps",{latestId:0,invokeId:null}),k(this,"mirror"),k(this,"mutationCb"),k(this,"resetObservers"),k(this,"frozen",!1),k(this,"locked",!1),k(this,"processMutation",(l,c)=>{(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(c)});let{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,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,r,n,i,o){let s=Gy(r,n,i,!0),a=new Map,l=new I6;l.onmessage=f=>{let{id:m}=f.data;if(a.set(m,!1),!("base64"in f.data))return;let{base64:g,type:w,width:S,height:y}=f.data;this.mutationCb({id:m,type:Sn["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:w}]},0,0]}]})};let c=1e3/t,u=0,d,p=()=>{let f=[];return r.document.querySelectorAll("canvas").forEach(m=>{Ye(m,n,i,!0)||f.push(m)}),f},h=f=>{if(u&&f-u<c){d=requestAnimationFrame(h);return}u=f,p().forEach(async m=>{var g;let w=this.mirror.getId(m);if(a.get(w)||m.width===0||m.height===0)return;if(a.set(w,!0),["webgl","webgl2"].includes(m.__context)){let y=m.getContext(m.__context);((g=y?.getContextAttributes())==null?void 0:g.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(m);l.postMessage({id:w,bitmap:S,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[S])}),d=requestAnimationFrame(h)};d=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Gy(t,r,n,!1),o=k6(this.processMutation.bind(this),t,r,n),s=R6(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(s=>{let{type:a,...l}=s;return l}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},id=class{constructor(t){k(this,"trackedLinkElements",new WeakSet),k(this,"mutationCb"),k(this,"adoptedStyleSheetCb"),k(this,"styleMirror",new Zu),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,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:Xy(a,o.href),index:l}))})),n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},od=class{constructor(){k(this,"nodeMap",new WeakMap),k(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},Ee,Is,gu,Hs=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Yg=e.contentWindow)==null?void 0:Yg.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var bt=TM();function Ur(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:h,maskInputFn:f,maskTextFn:m,hooks:g,packFn:w,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:C=!0,recordCanvas:M=!1,recordCrossOriginIframes:R=!1,recordAfter:E=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:x=!1,collectFonts:U=!1,inlineImages:X=!1,plugins:Q,keepIframeSrcFn:F=()=>!1,ignoreCSSAttributes:Ge=new Set([]),errorHandler:Ct}=e;o6(Ct);let _e=R?window.parent===window:!0,ct=!1;if(!_e)try{window.parent.document&&(ct=!1)}catch{ct=!0}if(_e&&!t)throw new Error("emit function is required");if(!_e&&!ct)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),bt.reset();let Ar=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}:p!==void 0?p:{password:!0},Rt=ib(h);e6();let Tf,ll=0,Of=ee=>{for(let ft of Q||[])ft.eventProcessor&&(ee=ft.eventProcessor(ee));return w&&!ct&&(ee=w(ee)),ee};Ee=(ee,ft)=>{var Ce;let Re=ee;if(Re.timestamp=Vs(),(Ce=_r[0])!=null&&Ce.isFrozen()&&Re.type!==q.FullSnapshot&&!(Re.type===q.IncrementalSnapshot&&Re.data.source===z.Mutation)&&_r.forEach(rt=>rt.unfreeze()),_e)t?.(Of(Re),ft);else if(ct){let rt={type:"rrweb",event:Of(Re),origin:window.location.origin,isCheckout:ft};window.parent.postMessage(rt,"*")}if(Re.type===q.FullSnapshot)Tf=Re,ll=0;else if(Re.type===q.IncrementalSnapshot){if(Re.data.source===z.Mutation&&Re.data.isAttachIframe)return;ll++;let rt=n&&ll>=n,se=r&&Re.timestamp-Tf.timestamp>r;(rt||se)&&Is(!0)}};let io=ee=>{Ee({type:q.IncrementalSnapshot,data:{source:z.Mutation,...ee}})},Mf=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.Scroll,...ee}}),Nf=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.CanvasMutation,...ee}}),yR=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.AdoptedStyleSheet,...ee}}),Pr=new id({mutationCb:io,adoptedStyleSheetCb:yR}),Tr=new td({mirror:bt,mutationCb:io,stylesheetManager:Pr,recordCrossOriginIframes:R,wrappedEmit:Ee});for(let ee of Q||[])ee.getMirror&&ee.getMirror({nodeMirror:bt,crossOriginIframeMirror:Tr.crossOriginIframeMirror,crossOriginIframeStyleMirror:Tr.crossOriginIframeStyleMirror});let cl=new od;gu=new nd({recordCanvas:M,mutationCb:Nf,win:window,blockClass:i,blockSelector:o,mirror:bt,sampling:S.canvas,dataURLOptions:y});let oo=new rd({mutationCb:io,scrollCb:Mf,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Ar,dataURLOptions:y,maskTextFn:m,maskInputFn:f,recordCanvas:M,inlineImages:X,sampling:S,slimDOMOptions:Rt,iframeManager:Tr,stylesheetManager:Pr,canvasManager:gu,keepIframeSrcFn:F,processedNodeManager:cl},mirror:bt});Is=(ee=!1)=>{if(!C)return;Ee({type:q.Meta,data:{href:window.location.href,width:Pw(),height:Aw()}},ee),Pr.reset(),oo.init(),_r.forEach(Ce=>Ce.lock());let ft=e2(document,{mirror:bt,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Ar,maskTextFn:m,maskInputFn:f,slimDOM:Rt,dataURLOptions:y,recordCanvas:M,inlineImages:X,onSerialize:Ce=>{Mw(Ce,bt)&&Tr.addIframe(Ce),Nw(Ce,bt)&&Pr.trackLinkElement(Ce),Yu(Ce)&&oo.addShadowRoot(H.shadowRoot(Ce),document)},onIframeLoad:(Ce,Re)=>{Tr.attachIframe(Ce,Re),oo.observeAttachShadow(Ce)},onStylesheetLoad:(Ce,Re)=>{Pr.attachLinkElement(Ce,Re)},keepIframeSrcFn:F});if(!ft)return console.warn("Failed to snapshot the document");Ee({type:q.FullSnapshot,data:{node:ft,initialOffset:Iw(window)}},ee),_r.forEach(Ce=>Ce.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Pr.adoptStyleSheets(document.adoptedStyleSheets,bt.getId(document))};try{let ee=[],ft=Re=>{var rt;return Y(w6)({mutationCb:io,mousemoveCb:(se,ul)=>Ee({type:q.IncrementalSnapshot,data:{source:ul,positions:se}}),mouseInteractionCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.MouseInteraction,...se}}),scrollCb:Mf,viewportResizeCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.ViewportResize,...se}}),inputCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.Input,...se}}),mediaInteractionCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.MediaInteraction,...se}}),styleSheetRuleCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.StyleSheetRule,...se}}),styleDeclarationCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.StyleDeclaration,...se}}),canvasMutationCb:Nf,fontCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.Font,...se}}),selectionCb:se=>{Ee({type:q.IncrementalSnapshot,data:{source:z.Selection,...se}})},customElementCb:se=>{Ee({type:q.IncrementalSnapshot,data:{source:z.CustomElement,...se}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:Ar,inlineStylesheet:u,sampling:S,recordDOM:C,recordCanvas:M,inlineImages:X,userTriggeredOnInput:x,collectFonts:U,doc:Re,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:F,blockSelector:o,slimDOMOptions:Rt,dataURLOptions:y,mirror:bt,iframeManager:Tr,stylesheetManager:Pr,shadowDomManager:oo,processedNodeManager:cl,canvasManager:gu,ignoreCSSAttributes:Ge,plugins:((rt=Q?.filter(se=>se.observer))==null?void 0:rt.map(se=>({observer:se.observer,options:se.options,callback:ul=>Ee({type:q.Plugin,data:{plugin:se.name,payload:ul}})})))||[]},g)};Tr.addLoadListener(Re=>{try{ee.push(ft(Re.contentDocument))}catch(rt){console.warn(rt)}});let Ce=()=>{Is(),ee.push(ft(document)),Hs=!0};return["interactive","complete"].includes(document.readyState)?Ce():(ee.push(Je("DOMContentLoaded",()=>{Ee({type:q.DomContentLoaded,data:{}}),E==="DOMContentLoaded"&&Ce()})),ee.push(Je("load",()=>{Ee({type:q.Load,data:{}}),E==="load"&&Ce()},window))),()=>{ee.forEach(Re=>{try{Re()}catch(rt){String(rt).toLowerCase().includes("cross-origin")||console.warn(rt)}}),cl.destroy(),Hs=!1,s6()}}catch(ee){console.warn(ee)}}Ur.addCustomEvent=(e,t)=>{if(!Hs)throw new Error("please add custom event after start recording");Ee({type:q.Custom,data:{tag:e,payload:t}})};Ur.freezePage=()=>{_r.forEach(e=>e.freeze())};Ur.takeFullSnapshot=e=>{if(!Hs)throw new Error("please take full snapshot after start recording");Is(e)};Ur.mirror=bt;var Jy;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Jy||(Jy={}));var QZ=5*1e3;var{addCustomEvent:eX}=Ur,{freezePage:tX}=Ur,{takeFullSnapshot:rX}=Ur;var qw="__ripploEmitRrwebEvent";function Kw(){return{eventTypes:zw(q),incrementalSources:zw(z)}}function zw(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var P6=ru("@ripplo/rrweb-bundle/bundle","rrweb.js"),Gw;function Jw(){return Gw??=A6(P6,{encoding:"utf8"}),Gw}async function Td({debugDir:e,writeOtlpPortFile:t}){let r=new Map,n=zg(Kw()),i=await pi({localDir:Yw.join(Yw.dirname(e),".local"),writePortFile:t,onRrwebBatch:(a,l)=>{r.get(a)?.emitRrwebBatch(l)},onSpan:a=>{let l=a.attributes["ripplo.run"];l!=null&&r.get(l)?.emit(a)}}),o=await Jw();return{attach:async(a,l)=>{let c=Hg({debugDir:e,runId:l,worker:n});r.set(l,c),await qg(a,l),await a.addInitScript(`globalThis.__ripploCapturePort = ${String(i.port)};`),await O6(a,c);let u=[];return{emitAction:d=>{L6(c,d)},emitAssertion:d=>{$6(c,d)},finish:()=>M6(c,{pages:u,registry:r,runId:l}),onPage:d=>{u.push(d),N6(c,o,d)}}},close:async()=>{await i.stop(),await n.terminate()},injectSpan:(a,l)=>{r.get(a)?.emit(l)}}}async function T6(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function O6(e,t){await e.exposeBinding(qw,(r,n)=>{let i=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}async function M6(e,t){await T6(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 N6(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("response",n=>{F6(e,n)}),r.on("console",n=>{e.emit({kind:"console",level:n.type(),source:"browser",text:n.text(),timeNanos:an(Date.now())})}),r.on("pageerror",n=>{e.emit({kind:"error",message:n.message,source:"browser",stack:n.stack,timeNanos:an(Date.now())})})}function L6(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:D6(t),timeNanos:an(Date.now()),value:_6(t)})}function $6(e,t){let r=Qc(t);e.emit({kind:"assertion",label:r.label,outcome:t.outcome,source:"test",step:r.step,timeNanos:an(Date.now())})}function D6(e){if(e.url!=null)return e.url;if(e.locator!=null)return Pd(e.locator)}function Pd(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Pd(e.scope)} \u25B8 ${Pd(e.target)}`:`${e.role} ${e.name??""}`.trim()}function _6(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var j6=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;function F6(e,t){let r=t.request(),n=r.resourceType();if(n!=="fetch"&&n!=="xhr"||j6.test(r.url()))return;let i=r.headers().traceparent?.split("-");e.emit({kind:"network",method:r.method(),resourceType:n,source:"browser",spanId:i?.[2],status:t.status(),timeNanos:an(Date.now()),traceId:i?.[1],url:t.url()})}import{err as fx,ok as af,ResultAsync as J5}from"neverthrow";function Di(e){return{invariants:Nc(e),laws:Tc(e)}}var Zw=Object.defineProperty,Xw=(e,t)=>{let r={};for(var n in e)Zw(r,n,{get:e[n],enumerable:!0});return t||Zw(r,Symbol.toStringTag,{value:"Module"}),r};var B6=class Qw{constructor(t){this.seed=t}clone(){return new Qw(this.seed)}next(){let t=Od(this.seed),r=Md(t),n=Od(t),i=Md(n);return this.seed=Od(n),Md(this.seed)+(i+(r<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function Od(e){return Math.imul(e,214013)+2531011&4294967295}function Md(e){return(e&-2147483649)>>16}function eS(e){return new B6(e)}var V6="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",U6=class rS{constructor(t,r){this.states=t,this.index=r}clone(){return new rS(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=ra(this.states,this.index),t}getState(){return[this.index,...this.states]}jump(){let t=this.states.slice(),r=this.index;this.index=ra(this.states,this.index);for(let n=19932;n>0;--n)V6.charCodeAt(n/6|0)-48&1<<n%6&&tS(this.states,this.index,t,r),this.index=ra(this.states,this.index);tS(this.states,this.index,t,r)}};function tS(e,t,r,n){let i=0;if(n>=t){for(;i<624-n;i++)e[i+t]^=r[i+n];for(;i<624-t;i++)e[i+t]^=r[i+n-624];for(;i<624;i++)e[i+t-624]^=r[i+n-624]}else{for(;i<624-t;i++)e[i+t]^=r[i+n];for(;i<624-n;i++)e[i+t-624]^=r[i+n];for(;i<624;i++)e[i+t-624]^=r[i+n-624]}}function ra(e,t){if(t<227){let r=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397]^r>>>1^-(r&1)&2567483615,t+1}else if(t<623){let r=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397-624]^r>>>1^-(r&1)&2567483615,t+1}else{let r=e[t]&2147483648|e[0]&2147483647;return e[t]=e[396]^r>>>1^-(r&1)&2567483615,0}}function W6(e){for(let t=0;t!==624;++t)ra(e,t)}function nS(e){let t=[e|0];for(let r=1;r!==624;++r){let n=t[r-1]^t[r-1]>>>30;t.push(Math.imul(1812433253,n)+r|0)}return W6(t),new U6(t,0)}var H6=class iS{constructor(t,r,n,i){this.s01=t,this.s00=r,this.s11=n,this.s10=i}clone(){return new iS(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00^this.s00<<23,r=this.s01^(this.s01<<23|this.s00>>>9),n=t^this.s10^(t>>>18|r<<14)^(this.s10>>>5|this.s11<<27),i=r^this.s11^r>>>18^this.s11>>>5,o=this.s00+this.s10|0;return this.s01=this.s11,this.s00=this.s10,this.s11=i,this.s10=n,o}jump(){let t=0,r=0,n=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,r^=this.s00,n^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=r,this.s11=n,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function Nd(e){return new H6(-1,~e,e|0,0)}var z6=class oS{constructor(t,r,n,i){this.s01=t,this.s00=r,this.s11=n,this.s10=i}clone(){return new oS(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00+this.s10|0,r=this.s10^this.s00,n=this.s11^this.s01,i=this.s00,o=this.s01;return this.s00=i<<24^o>>>8^r^r<<16,this.s01=o<<24^i>>>8^n^(n<<16|r>>>16),this.s10=n<<5^r>>>27,this.s11=r<<5^n>>>27,t}jump(){let t=0,r=0,n=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,r^=this.s00,n^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=r,this.s11=n,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function sS(e){return new z6(-1,~e,e|0,0)}function aS(e,t){for(let r=0;r!==t;++r)e.next()}var lS=BigInt,G6=4294967296n;function uS(e,t,r){let n=r-t+1n,i=G6,o=1;for(;i<n;)i<<=32n,++o;let s=cS(o,e);if(s<n)return s+t;if(s+n<i)return s%n+t;let a=i-i%n;for(;s>=a;)s=cS(o,e);return s%n+t}function cS(e,t){let r=lS(t.next()+2147483648);for(let n=1;n<e;++n){let i=t.next();r=(r<<32n)+lS(i+2147483648)}return r}function _i(e,t){let r=t>2?~~(4294967296/t)*t:4294967296,n=e.next()+2147483648;for(;n>=r;)n=e.next()+2147483648;return n%t}function Ld(e,t){if(t<0){let r=-t;e.sign=-1,e.data[0]=~~(r/4294967296),e.data[1]=r>>>0}else e.sign=1,e.data[0]=~~(t/4294967296),e.data[1]=t>>>0;return e}function q6(e,t,r){let n=t.data[1],i=t.data[0],o=t.sign,s=r.data[1],a=r.data[0],l=r.sign;if(e.sign=1,o===1&&l===-1){let m=n+s,g=i+a+(m>4294967295?1:0);return e.data[0]=g>>>0,e.data[1]=m>>>0,e}let c=n,u=i,d=s,p=a;o===-1&&(c=s,u=a,d=n,p=i);let h=0,f=c-d;return f<0&&(h=1,f=f>>>0),e.data[0]=u-p-h,e.data[1]=f,e}function K6(e,t,r){let n=r[0]+1;for(t[0]=_i(e,n),t[1]=_i(e,4294967296);t[0]>=r[0]&&(t[0]!==r[0]||t[1]>=r[1]);)t[0]=_i(e,n),t[1]=_i(e,4294967296);return t}var J6=Number.MAX_SAFE_INTEGER,Y6={sign:1,data:[0,0]},Z6={sign:1,data:[0,0]},dS={sign:1,data:[0,0]},$d=[0,0];function X6(e,t,r,n){let i=n<=J6?Ld(dS,n):q6(dS,Ld(Y6,r),Ld(Z6,t));return i.data[1]===4294967295?(i.data[0]+=1,i.data[1]=0):i.data[1]+=1,K6(e,$d,i.data),$d[0]*4294967296+$d[1]+t}function na(e,t,r){let n=r-t;return n<=4294967295?_i(e,n+1)+t:X6(e,t,r,n)}var pS=Symbol.for("fast-check/PreconditionFailure"),kr=class extends Error{constructor(e=!1){super(),this.interruptExecution=e,this.footprint=pS}static isFailure(e){return e!=null&&e.footprint===pS}};function Q6(e){if(!e)throw new kr}var e4=class{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}},t4=new e4;function r4(){return t4}function*n4(e,t){for(let r of e)yield t(r)}function*i4(e,t){for(let r of e)yield*t(r)}function*o4(e,t){for(let r of e)t(r)&&(yield r)}function*s4(e,t){for(let r=0;r<t;++r){let n=e.next();if(n.done)break;yield n.value}}function*a4(e,t){let r=e.next();for(;!r.done&&t(r.value);)yield r.value,r=e.next()}function*l4(e,t){for(let r=e.next();!r.done;r=e.next())yield r.value;for(let r of t)for(let n=r.next();!n.done;n=r.next())yield n.value}var c4=Symbol.iterator,V=class Kt{static nil(){return new Kt(r4())}static of(...t){return new Kt(t[c4]())}constructor(t){this.g=t}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(t){return new Kt(n4(this.g,t))}flatMap(t){return new Kt(i4(this.g,t))}dropWhile(t){let r=!1;function*n(i){(r||!t(i))&&(r=!0,yield i)}return this.flatMap(n)}drop(t){if(t<=0)return this;let r=0;function n(){return r++<t}return this.dropWhile(n)}takeWhile(t){return new Kt(a4(this.g,t))}take(t){return new Kt(s4(this.g,t))}filter(t){return new Kt(o4(this.g,t))}every(t){for(let r of this.g)if(!t(r))return!1;return!0}has(t){for(let r of this.g)if(t(r))return[!0,r];return[!1,null]}join(...t){return new Kt(l4(this.g,t))}getNthOrLast(t){let r=t,n=null;for(let i of this.g){if(r--===0)return i;n=i}return n}};function vr(e){return new V(e)}var Ve=Symbol.for("fast-check/cloneMethod");function Hr(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Ve in e&&typeof e[Ve]=="function"}function Rn(e){return Hr(e)?e[Ve]():e}var u4=Object.defineProperty,$=class{constructor(e,t,r){this.value_=e,this.context=t,this.hasToBeCloned=r!==void 0||Hr(e),this.readOnce=!1,this.value=e,this.hasToBeCloned&&u4(this,"value",{get:r!==void 0?r:this.getValue,enumerable:!1,configurable:!1})}getValue(){return this.hasToBeCloned?this.readOnce?this.value_[Ve]():(this.readOnce=!0,this.value_):this.value_}},he=class{filter(e){return new f4(this,e)}map(e,t){return new p4(this,e,t)}chain(e){return new d4(this,e)}},d4=class extends he{constructor(e,t){super(),this.arb=e,this.chainer=t}generate(e,t){let r=e.clone(),n=this.arb.generate(e,t);return this.valueChainer(n,e,r,t)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?(t.stoppedForOriginal?V.nil():this.arb.shrink(t.originalValue,t.originalContext).map(r=>this.valueChainer(r,t.clonedMrng.clone(),t.clonedMrng,t.originalBias))).join(t.chainedArbitrary.shrink(e,t.chainedContext).map(r=>{let n={...t,chainedContext:r.context,stoppedForOriginal:!0};return new $(r.value_,n)})):V.nil()}valueChainer(e,t,r,n){let i=this.chainer(e.value_),o=i.generate(t,n),s={originalBias:n,originalValue:e.value_,originalContext:e.context,stoppedForOriginal:!1,chainedArbitrary:i,chainedContext:o.context,clonedMrng:r};return new $(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}},p4=class extends he{constructor(e,t,r){super(),this.arb=e,this.mapper=t,this.unmapper=r,this.bindValueMapper=n=>this.valueMapper(n)}generate(e,t){let r=this.arb.generate(e,t);return this.valueMapper(r)}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 r=this.unmapper(e);return this.arb.shrink(r,void 0).map(this.bindValueMapper)}return V.nil()}mapperWithCloneIfNeeded(e){let t=e.value,r=this.mapper(t);return e.hasToBeCloned&&(typeof r=="object"&&r!==null||typeof r=="function")&&Object.isExtensible(r)&&!Hr(r)&&Object.defineProperty(r,Ve,{get:()=>()=>this.mapperWithCloneIfNeeded(e)[0]}),[r,t]}valueMapper(e){let[t,r]=this.mapperWithCloneIfNeeded(e);return new $(t,{originalValue:r,originalContext:e.context})}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalValue"in e&&"originalContext"in e}},f4=class extends he{constructor(e,t){super(),this.arb=e,this.refinement=t,this.bindRefinementOnValue=r=>this.refinementOnValue(r)}generate(e,t){for(;;){let r=this.arb.generate(e,t);if(this.refinementOnValue(r))return r}}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 p1(e){return typeof e=="object"&&e!==null&&"generate"in e&&"shrink"in e&&"canShrinkWithoutContext"in e}function f1(e){if(!p1(e))throw new Error("Unexpected value received: not an instance of Arbitrary")}var h1=Function.prototype.apply,Dd=Symbol("apply");function h4(e){try{return e.apply}catch{return}}function m4(e,t,r){let n=e;n[Dd]=h1;let i=n[Dd](t,r);return delete n[Dd],i}function K(e,t,r){return h4(e)===h1?e.apply(t,r):m4(e,t,r)}var m1=Array,O=BigInt,g4=BigInt64Array,y4=BigUint64Array,g1=Boolean,ba=Date,N=Error,y1=Float32Array,b1=Float64Array,b4=Int8Array,w4=Int16Array,S4=Int32Array,Yt=Number,Ze=String,En=Set,v4=Uint8Array,x4=Uint8ClampedArray,k4=Uint16Array,C4=Uint32Array,R4=encodeURIComponent,Zt=Map,da=Symbol,fS=Array.prototype.forEach,hS=Array.prototype.indexOf,mS=Array.prototype.join,gS=Array.prototype.map,yS=Array.prototype.flat,bS=Array.prototype.filter,wS=Array.prototype.push,SS=Array.prototype.pop,vS=Array.prototype.splice,xS=Array.prototype.slice,kS=Array.prototype.sort,CS=Array.prototype.every;function E4(e){try{return e.forEach}catch{return}}function I4(e){try{return e.indexOf}catch{return}}function A4(e){try{return e.join}catch{return}}function P4(e){try{return e.map}catch{return}}function T4(e){try{return e.flat}catch{return}}function O4(e){try{return e.filter}catch{return}}function M4(e){try{return e.push}catch{return}}function N4(e){try{return e.pop}catch{return}}function L4(e){try{return e.splice}catch{return}}function $4(e){try{return e.slice}catch{return}}function D4(e){try{return e.sort}catch{return}}function _4(e){try{return e.every}catch{return}}function w1(e,t){return E4(e)===fS?e.forEach(t):K(fS,e,[t])}function Jt(e,...t){return I4(e)===hS?e.indexOf(...t):K(hS,e,t)}function fe(e,...t){return A4(e)===mS?e.join(...t):K(mS,e,t)}function G(e,t){return P4(e)===gS?e.map(t):K(gS,e,[t])}function j4(e,t){return T4(e)===yS?([].flat(),e.flat(t)):K(yS,e,[t])}function F4(e,t){return O4(e)===bS?e.filter(t):K(bS,e,[t])}function L(e,...t){return M4(e)===wS?e.push(...t):K(wS,e,t)}function S1(e){return N4(e)===SS?e.pop():K(SS,e,[])}function v1(e,...t){return L4(e)===vS?e.splice(...t):K(vS,e,t)}function Ue(e,...t){return $4(e)===xS?e.slice(...t):K(xS,e,t)}function x1(e,...t){return D4(e)===kS?e.sort(...t):K(kS,e,t)}function k1(e,...t){return _4(e)===CS?e.every(...t):K(CS,e,t)}var RS=Date.prototype.getTime,ES=Date.prototype.toISOString;function B4(e){try{return e.getTime}catch{return}}function V4(e){try{return e.toISOString}catch{return}}function wa(e){return B4(e)===RS?e.getTime():K(RS,e,[])}function U4(e){return V4(e)===ES?e.toISOString():K(ES,e,[])}var IS=Set.prototype.add,AS=Set.prototype.has;function W4(e){try{return e.add}catch{return}}function H4(e){try{return e.has}catch{return}}function Ui(e,t){return W4(e)===IS?e.add(t):K(IS,e,[t])}function Sa(e,t){return H4(e)===AS?e.has(t):K(AS,e,[t])}var PS=WeakMap.prototype.set,TS=WeakMap.prototype.get;function z4(e){try{return e.set}catch{return}}function G4(e){try{return e.get}catch{return}}function q4(e,t,r){return z4(e)===PS?e.set(t,r):K(PS,e,[t,r])}function K4(e,t){return G4(e)===TS?e.get(t):K(TS,e,[t])}var OS=Map.prototype.set,MS=Map.prototype.get,NS=Map.prototype.has;function J4(e){try{return e.set}catch{return}}function Y4(e){try{return e.get}catch{return}}function Z4(e){try{return e.has}catch{return}}function vt(e,t,r){return J4(e)===OS?e.set(t,r):K(OS,e,[t,r])}function lt(e,t){return Y4(e)===MS?e.get(t):K(MS,e,[t])}function X4(e,t){return Z4(e)===NS?e.has(t):K(NS,e,[t])}var LS=String.prototype.split,$S=String.prototype.startsWith,DS=String.prototype.endsWith,_S=String.prototype.substring,jS=String.prototype.toLowerCase,FS=String.prototype.toUpperCase,BS=String.prototype.padStart,VS=String.prototype.charCodeAt,US=String.prototype.normalize,WS=String.prototype.replace;function Q4(e){try{return e.split}catch{return}}function e3(e){try{return e.startsWith}catch{return}}function t3(e){try{return e.endsWith}catch{return}}function r3(e){try{return e.substring}catch{return}}function n3(e){try{return e.toLowerCase}catch{return}}function i3(e){try{return e.toUpperCase}catch{return}}function o3(e){try{return e.padStart}catch{return}}function s3(e){try{return e.charCodeAt}catch{return}}function a3(e){try{return e.normalize}catch{return}}function l3(e){try{return e.replace}catch{return}}function Xe(e,...t){return Q4(e)===LS?e.split(...t):K(LS,e,t)}function c3(e,...t){return e3(e)===$S?e.startsWith(...t):K($S,e,t)}function u3(e,...t){return t3(e)===DS?e.endsWith(...t):K(DS,e,t)}function xe(e,...t){return r3(e)===_S?e.substring(...t):K(_S,e,t)}function ap(e){return n3(e)===jS?e.toLowerCase():K(jS,e,[])}function Np(e){return i3(e)===FS?e.toUpperCase():K(FS,e,[])}function d3(e,...t){return o3(e)===BS?e.padStart(...t):K(BS,e,t)}function In(e,t){return s3(e)===VS?e.charCodeAt(t):K(VS,e,[t])}function p3(e,t){return a3(e)===US?e.normalize(t):K(US,e,[t])}function f3(e,t,r){return l3(e)===WS?e.replace(t,r):K(WS,e,[t,r])}var HS=Number.prototype.toString;function h3(e){try{return e.toString}catch{return}}function Wi(e,...t){return h3(e)===HS?e.toString(...t):K(HS,e,t)}var m3=Object.prototype.hasOwnProperty,g3=Object.prototype.toString;function C1(e,t){return K(m3,e,[t])}function lp(e){return K(g3,e,[])}var y3=Error.prototype.toString;function b3(e){return K(y3,e,[])}var w3=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 Sr(e){return new w3(e)}var R1=Array.isArray,S3=Object.defineProperty;function E1(e,t){return S3(e,Ve,{value:()=>{let r=[];for(let n=0;n!==t.length;++n)L(r,t[n].value);return E1(r,t),r}})}function I1(e){let t=!1,r=[],n=[];for(let i=0;i!==e.length;++i){let o=e[i];t=t||o.hasToBeCloned,L(r,o.value),L(n,o.context)}return t&&E1(r,e),new $(r,n)}function A1(e,t,r){let n=[],i=R1(r)?r:[];for(let o=0;o!==e.length;++o)L(n,Sr(()=>e[o].shrink(t[o],i[o]).map(s=>{let a=G(t,(l,c)=>new $(Rn(l),i[c]));return[...Ue(a,0,o),s,...Ue(a,o+1)]}).map(I1)));return V.nil().join(...n)}var v3=class extends he{constructor(e){super(),this.arbs=e;for(let t=0;t!==e.length;++t){let r=e[t];if(r==null||r.generate===null||r.generate===void 0)throw new Error(`Invalid parameter encountered at index ${t}: expecting an Arbitrary`)}}generate(e,t){let r=[];for(let n=0;n!==this.arbs.length;++n)L(r,this.arbs[n].generate(e,t));return I1(r)}canShrinkWithoutContext(e){if(!R1(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 A1(this.arbs,e,t)}};function W(...e){return new v3(e)}var x3=Math.log;function P1(e){return 2+~~(x3(e+1)*.4342944819032518)}var Lp={};function k3(e){Lp=e}function xt(){return Lp}function C3(){Lp={}}var Hi=Symbol("UndefinedContextPlaceholder");function An(e){return e.context!==void 0?e:e.hasToBeCloned?new $(e.value_,Hi,()=>e.value):new $(e.value_,Hi)}var zS=()=>{},R3=class{constructor(e,t){this.arb=e,this.predicate=t;let{asyncBeforeEach:r,asyncAfterEach:n,beforeEach:i,afterEach:o}=xt()||{};if(r!==void 0&&i!==void 0)throw N(`Global "asyncBeforeEach" and "beforeEach" parameters can't be set at the same time when running async properties`);if(n!==void 0&&o!==void 0)throw N(`Global "asyncAfterEach" and "afterEach" parameters can't be set at the same time when running async properties`);this.beforeEachHook=r||i||zS,this.afterEachHook=n||o||zS}isAsync(){return!0}generate(e,t){return An(this.arb.generate(e,t!==void 0?P1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return V.nil();let t=e.context!==Hi?e.context:void 0;return this.arb.shrink(e.value_,t).map(An)}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 N("Property failed by returning false")}}catch(t){return kr.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}},T1=class extends he{constructor(e){super(),this.arb=e}generate(e,t){return An(this.arb.generate(e,t))}canShrinkWithoutContext(e){return!0}shrink(e,t){if(t===void 0&&!this.arb.canShrinkWithoutContext(e))return V.nil();let r=t!==Hi?t:void 0;return this.arb.shrink(e,r).map(An)}};function E3(...e){if(e.length<2)throw new Error("asyncProperty expects at least two parameters");let t=Ue(e,0,e.length-1),r=e[e.length-1];return w1(t,f1),new R3(W(...G(t,n=>new T1(n))),n=>r(...n))}var GS=()=>{},O1=class{constructor(e,t){this.arb=e,this.predicate=t;let{beforeEach:r=GS,afterEach:n=GS,asyncBeforeEach:i,asyncAfterEach:o}=xt()||{};if(i!==void 0)throw N(`"asyncBeforeEach" can't be set when running synchronous properties`);if(o!==void 0)throw N(`"asyncAfterEach" can't be set when running synchronous properties`);this.beforeEachHook=r,this.afterEachHook=n}isAsync(){return!1}generate(e,t){return An(this.arb.generate(e,t!==void 0?P1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return V.nil();let t=e.context!==Hi?e.context:void 0;return this.arb.shrink(e.value_,t).map(An)}runBeforeEach(){this.beforeEachHook()}runAfterEach(){this.afterEachHook()}run(e){try{let t=this.predicate(e);return t===void 0||t===!0?null:{error:new N("Property failed by returning false")}}catch(t){return kr.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 I3(...e){if(e.length<2)throw new Error("property expects at least two parameters");let t=Ue(e,0,e.length-1),r=e[e.length-1];return w1(t,f1),new O1(W(...G(t,n=>new T1(n))),n=>r(...n))}var A3=(function(e){return e[e.None=0]="None",e[e.Verbose=1]="Verbose",e[e.VeryVerbose=2]="VeryVerbose",e})({});function cp(e){return"unsafeNext"in e?e.unsafeJump===void 0?{clone:()=>cp(e),next:()=>e.unsafeNext(),getState:()=>e.getState()}:{clone:()=>cp(e),next:()=>e.unsafeNext(),jump:()=>e.unsafeJump(),getState:()=>e.getState()}:e}function M1(e){return"jump"in e&&typeof e.jump=="function"?e:{clone:()=>M1(e),next:()=>e.next(),jump:()=>aS(e,42),getState:()=>e.getState()}}function Ca(e){return M1(cp(e))}var P3=Date.now,T3=Math.min,O3=Math.random,M3=class{constructor(e){let t=e||{};this.seed=N3(t),this.randomType=L3(t),this.numRuns=$3(t),this.verbose=D3(t),this.maxSkipsPerRun=t.maxSkipsPerRun!==void 0?t.maxSkipsPerRun:100,this.timeout=jd(t.timeout),this.skipAllAfterTimeLimit=jd(t.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=jd(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:r=>{console.log(r)},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 _d(e){return t=>Ca(e(t))}function N3(e){if(e.seed===void 0)return P3()^O3()*4294967296;let t=e.seed|0;return e.seed===t?t:t^(e.seed-t)*4294967296}function L3(e){if(e.randomType===void 0)return Nd;if(typeof e.randomType=="string")switch(e.randomType){case"mersenne":return _d(nS);case"congruential":case"congruential32":return _d(eS);case"xorshift128plus":return Nd;case"xoroshiro128plus":return sS;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===Ca(t)?e.randomType:_d(e.randomType)}function $3(e){return e.numRuns!==void 0?e.numRuns:e.num_runs!==void 0?e.num_runs:100}function D3(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 jd(e){if(e!==void 0)return T3(e,2147483647)}function $p(e){return new M3(e)}function _3(e,t,r){let n=null;return{clear:()=>r(n),promise:new Promise(i=>{n=t(()=>{i(new kr(!0))},e)})}}var qS=class{constructor(e,t,r,n,i,o){this.property=e,this.getTime=t,this.interruptExecution=n,this.setTimeoutSafe=i,this.clearTimeoutSafe=o,this.skipAfterTime=this.getTime()+r}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 r=new kr(this.interruptExecution);return this.isAsync()?Promise.resolve(r):r}if(this.interruptExecution&&this.isAsync()){let r=_3(t,this.setTimeoutSafe,this.clearTimeoutSafe),n=Promise.race([this.property.run(e),r.promise]);return n.then(r.clear,r.clear),n}return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},j3=(e,t,r)=>{let n=null;return{clear:()=>r(n),promise:new Promise(i=>{n=t(()=>{i({error:new N(`Property timeout: exceeded limit of ${e} milliseconds`)})},e)})}},F3=class{constructor(e,t,r,n){this.property=e,this.timeMs=t,this.setTimeoutSafe=r,this.clearTimeoutSafe=n}isAsync(){return!0}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}async run(e){let t=j3(this.timeMs,this.setTimeoutSafe,this.clearTimeoutSafe),r=Promise.race([this.property.run(e),t.promise]);return r.then(t.clear,t.clear),r}runBeforeEach(){return Promise.resolve(this.property.runBeforeEach())}runAfterEach(){return Promise.resolve(this.property.runAfterEach())}},N1=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()}},KS=Array.from,JS=typeof Buffer<"u"?Buffer.isBuffer:void 0,vn=JSON.stringify,YS=Number.isNaN,B3=Object.keys,V3=Object.getOwnPropertySymbols,U3=Object.getOwnPropertyDescriptor,ZS=Object.getPrototypeOf,XS=Number.NEGATIVE_INFINITY,W3=Number.POSITIVE_INFINITY,kt=Symbol.for("fast-check/toStringMethod");function Dp(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&kt in e&&typeof e[kt]=="function"}var Xt=Symbol.for("fast-check/asyncToStringMethod");function _p(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Xt in e&&typeof e[Xt]=="function"}var H3=/^Symbol\((.*)\)$/;function z3(e){if(e.description!==void 0)return e.description;let t=H3.exec(Ze(e));return t&&t[1].length?t[1]:null}function QS(e){switch(e){case 0:return 1/e===XS?"-0":"0";case XS:return"Number.NEGATIVE_INFINITY";case W3:return"Number.POSITIVE_INFINITY";default:return e===e?Ze(e):"Number.NaN"}}function G3(e){let t=-1;for(let r in e){let n=Number(r);if(n!==t+1)return!0;t=n}return t+1!==e.length}function at(e,t,r){let n=[...t,e];if(typeof e=="object"&&Jt(t,e)!==-1)return"[cyclic]";if(_p(e)){let i=r(e);if(i.state==="fulfilled")return i.value}if(Dp(e))try{return e[kt]()}catch{}switch(lp(e)){case"[object Array]":{let i=e;if(i.length>=50&&G3(i)){let s=[];for(let a in i)YS(Number(a))||L(s,`${a}:${at(i[a],n,r)}`);return s.length!==0?`Object.assign(Array(${i.length}),{${fe(s,",")}})`:`Array(${i.length})`}let o=fe(G(i,s=>at(s,n,r)),",");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 YS(wa(i))?"new Date(NaN)":`new Date(${vn(U4(i))})`}case"[object Map]":return`new Map(${at(Array.from(e),n,r)})`;case"[object Null]":return"null";case"[object Number]":return typeof e=="number"?QS(e):`new Number(${QS(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"?`[${at(o,n,r)}]`:vn(o)}:${at(e[o],n,r)}`;return"{"+fe([...ZS(e)===null?["__proto__:null"]:[],...G(B3(e),i),...G(F4(V3(e),o=>{let s=U3(e,o);return s&&s.enumerable}),i)],",")+"}"}case"[object Set]":return`new Set(${at(Array.from(e),n,r)})`;case"[object String]":return typeof e=="string"?vn(e):`new String(${vn(e)})`;case"[object Symbol]":{let i=e;if(da.keyFor(i)!==void 0)return`Symbol.for(${vn(da.keyFor(i))})`;let o=z3(i);return o===null?"Symbol()":i===(o.startsWith("Symbol.")&&da[o.substring(7)])?o:`Symbol(${vn(o)})`}case"[object Promise]":{let i=r(e);switch(i.state){case"fulfilled":return`Promise.resolve(${at(i.value,n,r)})`;case"rejected":return`Promise.reject(${at(i.value,n,r)})`;case"pending":return"new Promise(() => {/*pending*/})";default:return"new Promise(() => {/*unknown*/})"}}case"[object Error]":if(e instanceof Error)return`new Error(${at(e.message,n,r)})`;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 JS=="function"&&JS(e))return`Buffer.from(${e.buffer.detached?"/*detached ArrayBuffer*/":at(KS(e.values()),n,r)})`;let i=ZS(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(${at(KS(s.values()),n,r)})`}break}}try{return e.toString()}catch{return lp(e)}}function Ae(e){return at(e,[],()=>({state:"unknown",value:void 0}))}function L1(e){let t=da(),r=[],n=new Zt;function i(){let l=null,c=()=>{l!==null&&clearTimeout(l)};return{delay:new Promise(u=>{l=setTimeout(()=>{l=null,u(t)},0)}),cancel:c}}let o={state:"unknown",value:void 0},s=function(c){let u=c;if(n.has(u))return n.get(u);let d=i(),p=Xt in c?Promise.resolve().then(()=>c[Xt]()):c;return p.catch(()=>{}),r.push(Promise.race([p,d.delay]).then(h=>{h===t?n.set(u,{state:"pending",value:void 0}):n.set(u,{state:"fulfilled",value:h}),d.cancel()},h=>{n.set(u,{state:"rejected",value:h}),d.cancel()})),n.set(u,o),o};function a(){let l=at(e,[],s);return r.length===0?l:Promise.all(r.splice(0)).then(a)}return a()}async function jp(e){return Promise.resolve(L1(e))}function ev(e){return e===null?new kr:e}function q3(...e){return e[1]?e[0].then(ev):ev(e[0])}function K3(e,t){return q3(e,t)}var tv=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=Ae(e);if(this.coveredCases.has(t)){let n=this.coveredCases.get(t);return this.skipRuns?K3(n,this.property.isAsync()):n}let r=this.property.run(e);return this.coveredCases.set(t,r),r}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},rv=Date.now,Fd=setTimeout,Bd=clearTimeout;function J3(e,t){let r=e;return e.isAsync()&&t.timeout!==void 0&&(r=new F3(r,t.timeout,Fd,Bd)),t.unbiased&&(r=new N1(r)),t.skipAllAfterTimeLimit!==void 0&&(r=new qS(r,rv,t.skipAllAfterTimeLimit,!1,Fd,Bd)),t.interruptAfterTimeLimit!==void 0&&(r=new qS(r,rv,t.interruptAfterTimeLimit,!0,Fd,Bd)),t.skipEqualValues&&(r=new tv(r,!0)),t.ignoreEqualValues&&(r=new tv(r,!1)),r}var Y3=(function(e){return e[e.Success=0]="Success",e[e.Skipped=-1]="Skipped",e[e.Failure=1]="Failure",e})({}),Z3=class $1{constructor(t,r){this.verbosity=t,this.interruptedAsFailure=r,this.rootExecutionTrees=[],this.currentLevelExecutionTrees=this.rootExecutionTrees,this.failure=null,this.numSkips=0,this.numSuccesses=0,this.interrupted=!1}appendExecutionTree(t,r){let n={status:t,value:r,children:[]};return this.currentLevelExecutionTrees.push(n),n}fail(t,r,n){if(this.verbosity>=1){let i=this.appendExecutionTree(1,t);this.currentLevelExecutionTrees=i.children}this.pathToFailure===void 0?this.pathToFailure=`${r}`:this.pathToFailure+=`:${r}`,this.value=t,this.failure=n}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?+Xe(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?Xe(this.pathToFailure,":").length-1:0}extractFailures(){if(this.isSuccess())return[];let t=[],r=this.rootExecutionTrees;for(;r.length>0&&r[r.length-1].status===1;){let n=r[r.length-1];t.push(n.value),r=n.children}return t}static mergePaths(t,r){if(t.length===0)return r;let n=t.split(":"),i=r.split(":"),o=+n[n.length-1]+ +i[0];return[...n.slice(0,n.length-1),`${o}`,...i.slice(1)].join(":")}toRunDetails(t,r,n,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:$1.mergePaths(r,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>n||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()}}},D1=class{constructor(e,t,r,n){this.sourceValues=e,this.shrink=t,this.runExecution=new Z3(r,n),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"&&!kr.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_)}},X3=class{constructor(e,t,r){this.initialValues=e,this.maxInitialIterations=t,this.remainingSkips=r}[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}},Q3=-2147483648,eD=2147483647,tD=Math.pow(2,27),rD=Math.pow(2,-53),Fp=class _1{constructor(t){this.internalRng=Ca(t.clone())}clone(){return new _1(this.internalRng)}next(t){return na(this.internalRng,0,(1<<t)-1)}nextBoolean(){return na(this.internalRng,0,1)===1}nextInt(t,r){return na(this.internalRng,t===void 0?Q3:t,r===void 0?eD:r)}nextBigInt(t,r){return uS(this.internalRng,t,r)}nextDouble(){let t=this.next(26),r=this.next(27);return(t*tD+r)*rD}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState=="function")return this.internalRng.getState()}};function nD(e,t,r){return t.jump(),e.generate(new Fp(t),r)}function*j1(e,t,r,n){for(let i=0;i!==n.length;++i)yield new $(n[i],void 0);for(let i=0,o=r(t);;++i)yield nD(e,o,i)}function iD(e,t,r){return()=>e.generate(new Fp(t),r)}function*F1(e,t,r,n){yield*G(n,s=>()=>new $(s,void 0));let i=0,o=Ca(r(t));for(;;)o.jump(),yield iD(e,o,i++)}function nv(e){return e()}function B1(e,t,r){let n=t,i=e.split(":").map(s=>+s);if(i.length===0)return n.map(nv);if(!i.every(s=>!Number.isNaN(s)))throw new Error(`Unable to replay, got invalid path=${e}`);let o=n.drop(i[0]).map(nv);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=r(a).drop(s)}return o}var oD=Object.assign;function sD(e){return e.length===1?`Hint: ${e[0]}`:e.map((t,r)=>`Hint (${r+1}): ${t}`).join(`
|
|
176
|
-
`)}function
|
|
175
|
+
or you can use record.mirror to access the mirror instance during recording.`,By={map:{},getId(){return console.error(cn),-1},getNode(){return console.error(cn),null},removeNodeFromMap(){console.error(cn)},has(){return console.error(cn),!1},reset(){console.error(cn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(By=new Proxy(By,{get(e,t,r){return t==="map"&&console.error(cn),Reflect.get(e,t,r)}}));function Ti(e,t,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,e.apply(l,o)},a))}}function ta(e,t,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>ta(e,t,o||{},!0)}var Vs=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Vs=()=>new Date().getTime());function Aw(e){var t,r,n,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=H.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=H.parentElement(o.body))==null?void 0:n.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function Pw(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Tw(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ow(e){return e?e.nodeType===e.ELEMENT_NODE?e:H.parentElement(e):null}function Ye(e,t,r,n){if(!e)return!1;let i=Ow(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(Ms(i,t,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function a6(e,t){return t.getId(e)!==-1}function mu(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===vi}function Mw(e,t){if(bi(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=H.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Mw(n,t):!0}function Ju(e){return!!e.changedTouches}function l6(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 Nw(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Lw(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Yu(e){return e?e instanceof Ku&&"shadowRoot"in e?!!e.shadowRoot:!!H.shadowRoot(e):!1}var Zu=class{constructor(){k(this,"id",1),k(this,"styleIDMap",new WeakMap),k(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}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 $w(e){var t;let r=null;return"getRootNode"in e&&((t=H.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&H.host(H.getRootNode(e))&&(r=H.host(H.getRootNode(e))),r}function c6(e){let t=e,r;for(;r=$w(t);)t=r;return t}function u6(e){let t=H.ownerDocument(e);if(!t)return!1;let r=c6(e);return H.contains(t,r)}function Dw(e){let t=H.ownerDocument(e);return t?H.contains(t,e)||u6(e):!1}var q=(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))(q||{}),z=(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))(z||{}),tt=(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))(tt||{}),Wt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Wt||{}),Sn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Sn||{}),un=(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))(un||{});var _w=(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))(_w||{});function Vy(e){return"__ln"in e}var Xu=class{constructor(){k(this,"length",0),k(this,"head",null),k(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&Vy(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&Vy(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Uy=(e,t)=>`${e}@${t}`,Qu=class{constructor(){k(this,"frozen",!1),k(this,"locked",!1),k(this,"texts",[]),k(this,"attributes",[]),k(this,"attributeMap",new WeakMap),k(this,"removes",[]),k(this,"mapRemoves",[]),k(this,"movedMap",{}),k(this,"addedSet",new Set),k(this,"movedSet",new Set),k(this,"droppedSet",new Set),k(this,"removesSubTreeCache",new Set),k(this,"mutationCb"),k(this,"blockClass"),k(this,"blockSelector"),k(this,"maskTextClass"),k(this,"maskTextSelector"),k(this,"inlineStylesheet"),k(this,"maskInputOptions"),k(this,"maskTextFn"),k(this,"maskInputFn"),k(this,"keepIframeSrcFn"),k(this,"recordCanvas"),k(this,"inlineImages"),k(this,"slimDOMOptions"),k(this,"dataURLOptions"),k(this,"doc"),k(this,"mirror"),k(this,"iframeManager"),k(this,"stylesheetManager"),k(this,"shadowDomManager"),k(this,"canvasManager"),k(this,"processedNodeManager"),k(this,"unattachedDoc"),k(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),k(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new Xu,i=l=>{let c=l,u=vi;for(;u===vi;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},o=l=>{let c=H.parentNode(l);if(!c||!Dw(l))return;let u=!1;if(l.nodeType===Node.TEXT_NODE){let f=c.tagName;if(f==="TEXTAREA")return;f==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let d=bi(c)?this.mirror.getId($w(l)):this.mirror.getId(c),p=i(l);if(d===-1||p===-1)return n.addNode(l);let h=pn(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:f=>{Nw(f,this.mirror)&&this.iframeManager.addIframe(f),Lw(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Yu(l)&&this.shadowDomManager.addShadowRoot(H.shadowRoot(l),this.doc)},onIframeLoad:(f,m)=>{this.iframeManager.attachIframe(f,m),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,m)=>{this.stylesheetManager.attachLinkElement(f,m)},cssCaptured:u});h&&(t.push({parentId:d,nextId:p,node:h}),r.add(h.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)Wy(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(H.parentNode(l))||o(l);for(let l of this.addedSet)!Hy(this.droppedSet,l)&&!Wy(this.removesSubTreeCache,l,this.mirror)||Hy(this.movedSet,l)?o(l):this.droppedSet.add(l);let s=null;for(;n.length;){let l=null;if(s){let c=this.mirror.getId(H.parentNode(s.value)),u=i(s.value);c!==-1&&u!==-1&&(l=s)}if(!l){let c=n.tail;for(;c;){let u=c;if(c=c.previous,u){let d=this.mirror.getId(H.parentNode(u.value));if(i(u.value)===-1)continue;if(d!==-1){l=u;break}else{let h=u.value,f=H.parentNode(h);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=H.host(f);if(this.mirror.getId(m)!==-1){l=u;break}}}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}s=l.previous,n.removeNode(l.value),o(l.value)}let a={texts:this.texts.map(l=>{let c=l.node,u=H.parentNode(c);return u&&u.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(u),{id:this.mirror.getId(c),value:l.value}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:c}=l;if(typeof c.style=="string"){let u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!r.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))}),k(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(H.childNodes(t),i=>H.textContent(i)||"").join("");r.attributes.value=Ps({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Ts(t),value:n,maskInputFn:this.maskInputFn})}),k(this,"processMutation",t=>{if(!mu(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=H.textContent(t.target);!Ye(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:ib(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Ow(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,i=t.target.getAttribute(n);if(n==="value"){let s=Ts(r);i=Ps({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(Ye(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)n="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!nb(r.tagName,n))if(o.attributes[n]=rb(this.doc,jr(r.tagName),jr(n),i),n==="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(r.style)){let l=r.style.getPropertyValue(a),c=r.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||c!==s.style.getPropertyPriority(a)?c===""?o.styleDiff[a]=l:o.styleDiff[a]=[l,c]:o._unchangedStyles[a]=[l,c]}for(let a of Array.from(s.style))r.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(Ye(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=bi(t.target)?this.mirror.getId(H.host(t.target)):this.mirror.getId(t.target);Ye(t.target,this.blockClass,this.blockSelector,!1)||mu(r,this.mirror,this.slimDOMOptions)||!a6(r,this.mirror)||(this.addedSet.has(r)?(ed(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Mw(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Uy(n,i)]?ed(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:bi(t.target)&&wi(t.target)?!0:void 0}),d6(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),k(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(mu(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Uy(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Ye(t,this.blockClass,this.blockSelector,!1)||(H.childNodes(t).forEach(n=>this.genAdds(n)),Yu(t)&&H.childNodes(H.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,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(r=>{this[r]=t[r]})}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 ed(e,t){e.delete(t),H.childNodes(t).forEach(r=>ed(e,r))}function d6(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),H.childNodes(n).forEach(i=>r.push(i)))}}function Wy(e,t,r){return e.size===0?!1:p6(e,t)}function p6(e,t,r){let n=H.parentNode(t);return n?e.has(n):!1}function Hy(e,t){return e.size===0?!1:jw(e,t)}function jw(e,t){let r=H.parentNode(t);return r?e.has(r)?!0:jw(e,r):!1}var Si;function f6(e){Si=e}function h6(){Si=void 0}var Y=e=>Si?(...r)=>{try{return e(...r)}catch(n){if(Si&&Si(n)===!0)return;throw n}}:e,_r=[];function $i(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 Fw(e,t){let r=new Qu;_r.push(r),r.init(e);let n=new(Iw())(Y(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function m6({mousemoveCb:e,sampling:t,doc:r,mirror:n}){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=Ti(Y(d=>{let p=Date.now()-a;e(s.map(h=>(h.timeOffset-=p,h)),d),s=[],a=null}),o),c=Y(Ti(Y(d=>{let p=$i(d),{clientX:h,clientY:f}=Ju(d)?d.changedTouches[0]:d;a||(a=Vs()),s.push({x:h,y:f,id:n.getId(p),timeOffset:Vs()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?z.Drag:d instanceof MouseEvent?z.MouseMove:z.TouchMove)}),i,{trailing:!1})),u=[Je("mousemove",c,r),Je("touchmove",c,r),Je("drag",c,r)];return Y(()=>{u.forEach(d=>d())})}function g6({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,c=u=>d=>{let p=$i(d);if(Ye(p,n,i,!0))return;let h=null,f=u;if("pointerType"in d){switch(d.pointerType){case"mouse":h=Wt.Mouse;break;case"touch":h=Wt.Touch;break;case"pen":h=Wt.Pen;break}h===Wt.Touch?tt[u]===tt.MouseDown?f="TouchStart":tt[u]===tt.MouseUp&&(f="TouchEnd"):Wt.Pen}else Ju(d)&&(h=Wt.Touch);h!==null?(l=h,(f.startsWith("Touch")&&h===Wt.Touch||f.startsWith("Mouse")&&h===Wt.Mouse)&&(h=null)):tt[u]===tt.Click&&(h=l,l=null);let m=Ju(d)?d.changedTouches[0]:d;if(!m)return;let g=r.getId(p),{clientX:w,clientY:S}=m;Y(e)({type:tt[f],id:g,x:w,y:S,...h!==null&&{pointerType:h}})};return Object.keys(tt).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=jr(u),p=c(u);if(window.PointerEvent)switch(tt[u]){case tt.MouseDown:case tt.MouseUp:d=d.replace("mouse","pointer");break;case tt.TouchStart:case tt.TouchEnd:return}a.push(Je(d,p,t))}),Y(()=>{a.forEach(u=>u())})}function Bw({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=Y(Ti(Y(a=>{let l=$i(a);if(!l||Ye(l,n,i,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let u=Aw(t.defaultView);e({id:c,x:u.left,y:u.top})}else e({id:c,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Je("scroll",s,t)}function y6({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=Y(Ti(Y(()=>{let o=Pw(),s=Tw();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return Je("resize",i,t)}var b6=["INPUT","TEXTAREA","SELECT"],zy=new WeakMap;function w6({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(S){let y=$i(S),v=S.isTrusted,C=y&&y.tagName;if(y&&C==="OPTION"&&(y=H.parentElement(y)),!y||!C||b6.indexOf(C)<0||Ye(y,n,i,!0)||y.classList.contains(o)||s&&y.matches(s))return;let M=y.value,R=!1,E=Ts(y)||"";E==="radio"||E==="checkbox"?R=y.checked:(a[C.toLowerCase()]||a[E])&&(M=Ps({element:y,maskInputOptions:a,tagName:C,type:E,value:M,maskInputFn:l})),p(y,u?{text:M,isChecked:R,userTriggered:v}:{text:M,isChecked:R});let x=y.name;E==="radio"&&x&&R&&t.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(U=>{if(U!==y){let X=U.value;p(U,u?{text:X,isChecked:!R,userTriggered:!1}:{text:X,isChecked:!R})}})}function p(S,y){let v=zy.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){zy.set(S,y);let C=r.getId(S);Y(e)({...y,id:C})}}let f=(c.input==="last"?["change"]:["input","change"]).map(S=>Je(S,Y(d),t)),m=t.defaultView;if(!m)return()=>{f.forEach(S=>S())};let g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[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 g&&g.set&&f.push(...w.map(S=>ta(S[0],S[1],{set(){Y(d)({target:this,isTrusted:!1})}},!1,m))),Y(()=>{f.forEach(S=>S())})}function Us(e){let t=[];function r(n,i){if(Ss("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ss("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ss("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ss("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(e,t)}function gr(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function S6({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Y((u,d,p)=>{let[h,f]=p,{id:m,styleId:g}=gr(d,t,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:h,index:f}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let h=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[h,p])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Y((u,d,p)=>{let[h]=p,{id:f,styleId:m}=gr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,removes:[{index:h}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Y((u,d,p)=>{let[h]=p,{id:f,styleId:m}=gr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replace:h}),u.apply(d,p)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Y((u,d,p)=>{let[h]=p,{id:f,styleId:m}=gr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replaceSync:h}),u.apply(d,p)})}));let l={};vs("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(vs("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),vs("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),vs("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:Y((p,h,f)=>{let[m,g]=f,{id:w,styleId:S}=gr(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||S&&S!==-1)&&e({id:w,styleId:S,adds:[{rule:m,index:[...Us(h),g||0]}]}),p.apply(h,f)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:Y((p,h,f)=>{let[m]=f,{id:g,styleId:w}=gr(h.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||w&&w!==-1)&&e({id:g,styleId:w,removes:[{index:[...Us(h),m]}]}),p.apply(h,f)})})}),Y(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function Vw({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(H.host(r));let a=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(i=r.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(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return(c=l.get)==null?void 0:c.call(this)},set(c){var u;let d=(u=l.set)==null?void 0:u.call(this,c);if(s!==null&&s!==-1)try{t.adoptStyleSheets(c,s)}catch{}return d}}),Y(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function v6({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Y((a,l,c)=>{var u;let[d,p,h]=c;if(r.has(d))return o.apply(l,[d,p,h]);let{id:f,styleId:m}=gr((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,set:{property:d,value:p,priority:h},index:Us(l.parentRule)}),a.apply(l,c)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:Y((a,l,c)=>{var u;let[d]=c;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:h}=gr((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,remove:{property:d},index:Us(l.parentRule)}),a.apply(l,c)})}),Y(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function x6({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){let s=Y(l=>Ti(Y(c=>{let u=$i(c);if(!u||Ye(u,t,r,!0))return;let{currentTime:d,volume:p,muted:h,playbackRate:f,loop:m}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:h,playbackRate:f,loop:m})}),i.media||500)),a=[Je("play",s(un.Play),o),Je("pause",s(un.Pause),o),Je("seeked",s(un.Seeked),o),Je("volumechange",s(un.VolumeChange),o),Je("ratechange",s(un.RateChange),o)];return Y(()=>{a.forEach(l=>l())})}function k6({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(l,c,u){let d=new o(l,c,u);return i.set(d,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};let s=Vr(t.fonts,"add",function(a){return function(l){return setTimeout(Y(()=>{let c=i.get(l);c&&(e(c),i.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=o}),n.push(s),Y(()=>{n.forEach(a=>a())})}function C6(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e,s=!0,a=Y(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let c=[],u=l.rangeCount||0;for(let d=0;d<u;d++){let p=l.getRangeAt(d),{startContainer:h,startOffset:f,endContainer:m,endOffset:g}=p;Ye(h,n,i,!0)||Ye(m,n,i,!0)||c.push({start:r.getId(h),startOffset:f,end:r.getId(m),endOffset:g})}o({ranges:c})});return a(),Je("selectionchange",a)}function R6({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Vr(r.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 E6(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:h,customElementCb:f}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...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),c(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),u(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),d(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),p(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),f(...m)}}function I6(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};E6(e,t);let n;e.recordDOM&&(n=Fw(e,e.doc));let i=m6(e),o=g6(e),s=Bw(e),a=y6(e,{win:r}),l=w6(e),c=x6(e),u=()=>{},d=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(u=S6(e,{win:r}),d=Vw(e,e.doc),p=v6(e,{win:r}),e.collectFonts&&(h=k6(e)));let f=C6(e),m=R6(e),g=[];for(let w of e.plugins)g.push(w.observer(w.callback,r,w.options));return Y(()=>{_r.forEach(w=>w.reset()),n?.disconnect(),i(),o(),s(),a(),l(),c(),u(),d(),p(),h(),f(),m(),g.forEach(w=>w())})}function Ss(e){return typeof window[e]<"u"}function vs(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Ws=class{constructor(t){k(this,"iframeIdToRemoteIdMap",new WeakMap),k(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,i){let o=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(r);return a||(a=this.generateIdFn(),o.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},td=class{constructor(t){k(this,"iframes",new WeakMap),k(this,"crossOriginIframeMap",new WeakMap),k(this,"crossOriginIframeMirror",new Ws(tb)),k(this,"crossOriginIframeStyleMirror"),k(this,"crossOriginIframeRootIdMap",new WeakMap),k(this,"mirror"),k(this,"mutationCb"),k(this,"wrappedEmit"),k(this,"loadListener"),k(this,"stylesheetManager"),k(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ws(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,r){var n,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.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 r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case q.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:q.IncrementalSnapshot,data:{source:z.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case q.Meta:case q.Load:case q.DomContentLoaded:return!1;case q.Plugin:return r;case q.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case q.IncrementalSnapshot:switch(r.data.source){case z.Mutation:return r.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)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case z.Drag:case z.TouchMove:case z.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case z.ViewportResize:return!1;case z.MediaInteraction:case z.MouseInteraction:case z.Scroll:case z.CanvasMutation:case z.Input:return this.replaceIds(r.data,t,["id"]),r;case z.StyleSheetRule:case z.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case z.Font:return r;case z.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case z.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==_w.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},rd=class{constructor(t){k(this,"shadowDoms",new WeakSet),k(this,"mutationCb"),k(this,"scrollCb"),k(this,"bypassOptions"),k(this,"mirror"),k(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,r){if(!wi(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=Fw({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Bw({...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(H.host(t))),this.restoreHandlers.push(Vw({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Vr(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=H.shadowRoot(this);return a&&Dw(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A6=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(yi=0;yi<fn.length;yi++)A6[fn.charCodeAt(yi)]=yi;var yi,P6=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=fn[t[r]>>2],i+=fn[(t[r]&3)<<4|t[r+1]>>4],i+=fn[(t[r+1]&15)<<2|t[r+2]>>6],i+=fn[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Gy=new Map;function T6(e,t){let r=Gy.get(e);return r||(r=new Map,Gy.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Uw=(e,t,r)=>{if(!e||!(Hw(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=T6(r,n),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Es(e,t,r){if(e instanceof Array)return e.map(n=>Es(n,t,r));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 n=e.constructor.name,i=P6(e);return{rr_type:n,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Es(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return{rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return{rr_type:n,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Es(e.data,t,r),e.width,e.height]};if(Hw(e,t)||typeof e=="object"){let n=e.constructor.name,i=Uw(e,t,r);return{rr_type:n,index:i}}}}return e}var Ww=(e,t,r)=>e.map(n=>Es(n,t,r)),Hw=(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 O6(e,t,r,n){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Vr(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return Ye(this.canvas,r,n,!0)||setTimeout(()=>{let u=Ww(c,t,this);e(this.canvas,{type:Sn["2D"],property:s,args:u})},0),l.apply(this,c)}});i.push(a)}catch{let a=ta(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Sn["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function M6(e){return e==="experimental-webgl"?"webgl":e}function qy(e,t,r,n){let i=[];try{let o=Vr(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!Ye(this,t,r,!0)){let c=M6(a);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(l[0]&&typeof l[0]=="object"){let u=l[0];u.preserveDrawingBuffer||(u.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 Ky(e,t,r,n,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 c=Vr(e,l,function(u){return function(...d){let p=u.apply(this,d);if(Uw(p,o,this),"tagName"in this.canvas&&!Ye(this.canvas,n,i,!0)){let h=Ww(d,o,this),f={type:t,property:l,args:h};r(this.canvas,f)}return p}});s.push(c)}catch{let c=ta(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function N6(e,t,r,n){let i=[];return i.push(...Ky(t.WebGLRenderingContext.prototype,Sn.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...Ky(t.WebGL2RenderingContext.prototype,Sn.WebGL2,e,r,n,t)),()=>{i.forEach(o=>o())}}var zw="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",L6=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Jy=typeof window<"u"&&window.Blob&&new Blob([L6(zw)],{type:"text/javascript;charset=utf-8"});function $6(e){let t;try{if(t=Jy&&(window.URL||window.webkitURL).createObjectURL(Jy),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+zw,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var nd=class{constructor(t){k(this,"pendingCanvasMutations",new Map),k(this,"rafStamps",{latestId:0,invokeId:null}),k(this,"mirror"),k(this,"mutationCb"),k(this,"resetObservers"),k(this,"frozen",!1),k(this,"locked",!1),k(this,"processMutation",(l,c)=>{(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(c)});let{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,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,r,n,i,o){let s=qy(r,n,i,!0),a=new Map,l=new $6;l.onmessage=f=>{let{id:m}=f.data;if(a.set(m,!1),!("base64"in f.data))return;let{base64:g,type:w,width:S,height:y}=f.data;this.mutationCb({id:m,type:Sn["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:w}]},0,0]}]})};let c=1e3/t,u=0,d,p=()=>{let f=[];return r.document.querySelectorAll("canvas").forEach(m=>{Ye(m,n,i,!0)||f.push(m)}),f},h=f=>{if(u&&f-u<c){d=requestAnimationFrame(h);return}u=f,p().forEach(async m=>{var g;let w=this.mirror.getId(m);if(a.get(w)||m.width===0||m.height===0)return;if(a.set(w,!0),["webgl","webgl2"].includes(m.__context)){let y=m.getContext(m.__context);((g=y?.getContextAttributes())==null?void 0:g.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(m);l.postMessage({id:w,bitmap:S,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[S])}),d=requestAnimationFrame(h)};d=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=qy(t,r,n,!1),o=O6(this.processMutation.bind(this),t,r,n),s=N6(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(s=>{let{type:a,...l}=s;return l}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},id=class{constructor(t){k(this,"trackedLinkElements",new WeakSet),k(this,"mutationCb"),k(this,"adoptedStyleSheetCb"),k(this,"styleMirror",new Zu),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,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:Qy(a,o.href),index:l}))})),n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},od=class{constructor(){k(this,"nodeMap",new WeakMap),k(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},Ee,Is,gu,Hs=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Zg=e.contentWindow)==null?void 0:Zg.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var wt=jM();function Ur(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:h,maskInputFn:f,maskTextFn:m,hooks:g,packFn:w,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:C=!0,recordCanvas:M=!1,recordCrossOriginIframes:R=!1,recordAfter:E=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:x=!1,collectFonts:U=!1,inlineImages:X=!1,plugins:Q,keepIframeSrcFn:B=()=>!1,ignoreCSSAttributes:Ge=new Set([]),errorHandler:Rt}=e;f6(Rt);let _e=R?window.parent===window:!0,ct=!1;if(!_e)try{window.parent.document&&(ct=!1)}catch{ct=!0}if(_e&&!t)throw new Error("emit function is required");if(!_e&&!ct)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),wt.reset();let Ar=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}:p!==void 0?p:{password:!0},Et=ob(h);l6();let Tf,ll=0,Of=ee=>{for(let ft of Q||[])ft.eventProcessor&&(ee=ft.eventProcessor(ee));return w&&!ct&&(ee=w(ee)),ee};Ee=(ee,ft)=>{var Ce;let Re=ee;if(Re.timestamp=Vs(),(Ce=_r[0])!=null&&Ce.isFrozen()&&Re.type!==q.FullSnapshot&&!(Re.type===q.IncrementalSnapshot&&Re.data.source===z.Mutation)&&_r.forEach(rt=>rt.unfreeze()),_e)t?.(Of(Re),ft);else if(ct){let rt={type:"rrweb",event:Of(Re),origin:window.location.origin,isCheckout:ft};window.parent.postMessage(rt,"*")}if(Re.type===q.FullSnapshot)Tf=Re,ll=0;else if(Re.type===q.IncrementalSnapshot){if(Re.data.source===z.Mutation&&Re.data.isAttachIframe)return;ll++;let rt=n&&ll>=n,se=r&&Re.timestamp-Tf.timestamp>r;(rt||se)&&Is(!0)}};let io=ee=>{Ee({type:q.IncrementalSnapshot,data:{source:z.Mutation,...ee}})},Mf=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.Scroll,...ee}}),Nf=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.CanvasMutation,...ee}}),SR=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.AdoptedStyleSheet,...ee}}),Pr=new id({mutationCb:io,adoptedStyleSheetCb:SR}),Tr=new td({mirror:wt,mutationCb:io,stylesheetManager:Pr,recordCrossOriginIframes:R,wrappedEmit:Ee});for(let ee of Q||[])ee.getMirror&&ee.getMirror({nodeMirror:wt,crossOriginIframeMirror:Tr.crossOriginIframeMirror,crossOriginIframeStyleMirror:Tr.crossOriginIframeStyleMirror});let cl=new od;gu=new nd({recordCanvas:M,mutationCb:Nf,win:window,blockClass:i,blockSelector:o,mirror:wt,sampling:S.canvas,dataURLOptions:y});let oo=new rd({mutationCb:io,scrollCb:Mf,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Ar,dataURLOptions:y,maskTextFn:m,maskInputFn:f,recordCanvas:M,inlineImages:X,sampling:S,slimDOMOptions:Et,iframeManager:Tr,stylesheetManager:Pr,canvasManager:gu,keepIframeSrcFn:B,processedNodeManager:cl},mirror:wt});Is=(ee=!1)=>{if(!C)return;Ee({type:q.Meta,data:{href:window.location.href,width:Tw(),height:Pw()}},ee),Pr.reset(),oo.init(),_r.forEach(Ce=>Ce.lock());let ft=l2(document,{mirror:wt,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Ar,maskTextFn:m,maskInputFn:f,slimDOM:Et,dataURLOptions:y,recordCanvas:M,inlineImages:X,onSerialize:Ce=>{Nw(Ce,wt)&&Tr.addIframe(Ce),Lw(Ce,wt)&&Pr.trackLinkElement(Ce),Yu(Ce)&&oo.addShadowRoot(H.shadowRoot(Ce),document)},onIframeLoad:(Ce,Re)=>{Tr.attachIframe(Ce,Re),oo.observeAttachShadow(Ce)},onStylesheetLoad:(Ce,Re)=>{Pr.attachLinkElement(Ce,Re)},keepIframeSrcFn:B});if(!ft)return console.warn("Failed to snapshot the document");Ee({type:q.FullSnapshot,data:{node:ft,initialOffset:Aw(window)}},ee),_r.forEach(Ce=>Ce.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Pr.adoptStyleSheets(document.adoptedStyleSheets,wt.getId(document))};try{let ee=[],ft=Re=>{var rt;return Y(I6)({mutationCb:io,mousemoveCb:(se,ul)=>Ee({type:q.IncrementalSnapshot,data:{source:ul,positions:se}}),mouseInteractionCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.MouseInteraction,...se}}),scrollCb:Mf,viewportResizeCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.ViewportResize,...se}}),inputCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.Input,...se}}),mediaInteractionCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.MediaInteraction,...se}}),styleSheetRuleCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.StyleSheetRule,...se}}),styleDeclarationCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.StyleDeclaration,...se}}),canvasMutationCb:Nf,fontCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.Font,...se}}),selectionCb:se=>{Ee({type:q.IncrementalSnapshot,data:{source:z.Selection,...se}})},customElementCb:se=>{Ee({type:q.IncrementalSnapshot,data:{source:z.CustomElement,...se}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:Ar,inlineStylesheet:u,sampling:S,recordDOM:C,recordCanvas:M,inlineImages:X,userTriggeredOnInput:x,collectFonts:U,doc:Re,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:B,blockSelector:o,slimDOMOptions:Et,dataURLOptions:y,mirror:wt,iframeManager:Tr,stylesheetManager:Pr,shadowDomManager:oo,processedNodeManager:cl,canvasManager:gu,ignoreCSSAttributes:Ge,plugins:((rt=Q?.filter(se=>se.observer))==null?void 0:rt.map(se=>({observer:se.observer,options:se.options,callback:ul=>Ee({type:q.Plugin,data:{plugin:se.name,payload:ul}})})))||[]},g)};Tr.addLoadListener(Re=>{try{ee.push(ft(Re.contentDocument))}catch(rt){console.warn(rt)}});let Ce=()=>{Is(),ee.push(ft(document)),Hs=!0};return["interactive","complete"].includes(document.readyState)?Ce():(ee.push(Je("DOMContentLoaded",()=>{Ee({type:q.DomContentLoaded,data:{}}),E==="DOMContentLoaded"&&Ce()})),ee.push(Je("load",()=>{Ee({type:q.Load,data:{}}),E==="load"&&Ce()},window))),()=>{ee.forEach(Re=>{try{Re()}catch(rt){String(rt).toLowerCase().includes("cross-origin")||console.warn(rt)}}),cl.destroy(),Hs=!1,h6()}}catch(ee){console.warn(ee)}}Ur.addCustomEvent=(e,t)=>{if(!Hs)throw new Error("please add custom event after start recording");Ee({type:q.Custom,data:{tag:e,payload:t}})};Ur.freezePage=()=>{_r.forEach(e=>e.freeze())};Ur.takeFullSnapshot=e=>{if(!Hs)throw new Error("please take full snapshot after start recording");Is(e)};Ur.mirror=wt;var Yy;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Yy||(Yy={}));var uX=5*1e3;var{addCustomEvent:dX}=Ur,{freezePage:pX}=Ur,{takeFullSnapshot:fX}=Ur;var Kw="__ripploEmitRrwebEvent";function Jw(){return{eventTypes:Gw(q),incrementalSources:Gw(z)}}function Gw(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var _6=ru("@ripplo/rrweb-bundle/bundle","rrweb.js"),qw;function Yw(){return qw??=D6(_6,{encoding:"utf8"}),qw}async function Td({debugDir:e,writeOtlpPortFile:t}){let r=new Map,n=Gg(Jw()),i=await pi({localDir:Zw.join(Zw.dirname(e),".local"),writePortFile:t,onRrwebBatch:(a,l)=>{r.get(a)?.emitRrwebBatch(l)},onSpan:a=>{let l=a.attributes["ripplo.run"];l!=null&&r.get(l)?.emit(a)}}),o=await Yw();return{attach:async(a,l)=>{let c=zg({debugDir:e,runId:l,worker:n});r.set(l,c),await Kg(a,l),await a.addInitScript(`globalThis.__ripploCapturePort = ${String(i.port)};`),await F6(a,c);let u=[];return{emitAction:d=>{U6(c,d)},emitAssertion:d=>{W6(c,d)},finish:()=>B6(c,{pages:u,registry:r,runId:l}),onPage:d=>{u.push(d),V6(c,o,d)}}},close:async()=>{await i.stop(),await n.terminate()},injectSpan:(a,l)=>{r.get(a)?.emit(l)}}}async function j6(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function F6(e,t){await e.exposeBinding(Kw,(r,n)=>{let i=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}async function B6(e,t){await j6(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 V6(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("response",n=>{q6(e,n)}),r.on("console",n=>{e.emit({kind:"console",level:n.type(),source:"browser",text:n.text(),timeNanos:an(Date.now())})}),r.on("pageerror",n=>{e.emit({kind:"error",message:n.message,source:"browser",stack:n.stack,timeNanos:an(Date.now())})})}function U6(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:H6(t),timeNanos:an(Date.now()),value:z6(t)})}function W6(e,t){let r=Qc(t);e.emit({kind:"assertion",label:r.label,outcome:t.outcome,source:"test",step:r.step,timeNanos:an(Date.now())})}function H6(e){if(e.url!=null)return e.url;if(e.locator!=null)return Pd(e.locator)}function Pd(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Pd(e.scope)} \u25B8 ${Pd(e.target)}`:`${e.role} ${e.name??""}`.trim()}function z6(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var G6=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;function q6(e,t){let r=t.request(),n=r.resourceType();if(n!=="fetch"&&n!=="xhr"||G6.test(r.url()))return;let i=r.headers().traceparent?.split("-");e.emit({kind:"network",method:r.method(),resourceType:n,source:"browser",spanId:i?.[2],status:t.status(),timeNanos:an(Date.now()),traceId:i?.[1],url:t.url()})}import{err as hx,ok as af,ResultAsync as nF}from"neverthrow";function Di(e){return{invariants:Nc(e),laws:Tc(e)}}var Xw=Object.defineProperty,Qw=(e,t)=>{let r={};for(var n in e)Xw(r,n,{get:e[n],enumerable:!0});return t||Xw(r,Symbol.toStringTag,{value:"Module"}),r};var K6=class eS{constructor(t){this.seed=t}clone(){return new eS(this.seed)}next(){let t=Od(this.seed),r=Md(t),n=Od(t),i=Md(n);return this.seed=Od(n),Md(this.seed)+(i+(r<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function Od(e){return Math.imul(e,214013)+2531011&4294967295}function Md(e){return(e&-2147483649)>>16}function tS(e){return new K6(e)}var J6="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",Y6=class nS{constructor(t,r){this.states=t,this.index=r}clone(){return new nS(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=ra(this.states,this.index),t}getState(){return[this.index,...this.states]}jump(){let t=this.states.slice(),r=this.index;this.index=ra(this.states,this.index);for(let n=19932;n>0;--n)J6.charCodeAt(n/6|0)-48&1<<n%6&&rS(this.states,this.index,t,r),this.index=ra(this.states,this.index);rS(this.states,this.index,t,r)}};function rS(e,t,r,n){let i=0;if(n>=t){for(;i<624-n;i++)e[i+t]^=r[i+n];for(;i<624-t;i++)e[i+t]^=r[i+n-624];for(;i<624;i++)e[i+t-624]^=r[i+n-624]}else{for(;i<624-t;i++)e[i+t]^=r[i+n];for(;i<624-n;i++)e[i+t-624]^=r[i+n];for(;i<624;i++)e[i+t-624]^=r[i+n-624]}}function ra(e,t){if(t<227){let r=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397]^r>>>1^-(r&1)&2567483615,t+1}else if(t<623){let r=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397-624]^r>>>1^-(r&1)&2567483615,t+1}else{let r=e[t]&2147483648|e[0]&2147483647;return e[t]=e[396]^r>>>1^-(r&1)&2567483615,0}}function Z6(e){for(let t=0;t!==624;++t)ra(e,t)}function iS(e){let t=[e|0];for(let r=1;r!==624;++r){let n=t[r-1]^t[r-1]>>>30;t.push(Math.imul(1812433253,n)+r|0)}return Z6(t),new Y6(t,0)}var X6=class oS{constructor(t,r,n,i){this.s01=t,this.s00=r,this.s11=n,this.s10=i}clone(){return new oS(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00^this.s00<<23,r=this.s01^(this.s01<<23|this.s00>>>9),n=t^this.s10^(t>>>18|r<<14)^(this.s10>>>5|this.s11<<27),i=r^this.s11^r>>>18^this.s11>>>5,o=this.s00+this.s10|0;return this.s01=this.s11,this.s00=this.s10,this.s11=i,this.s10=n,o}jump(){let t=0,r=0,n=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,r^=this.s00,n^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=r,this.s11=n,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function Nd(e){return new X6(-1,~e,e|0,0)}var Q6=class sS{constructor(t,r,n,i){this.s01=t,this.s00=r,this.s11=n,this.s10=i}clone(){return new sS(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00+this.s10|0,r=this.s10^this.s00,n=this.s11^this.s01,i=this.s00,o=this.s01;return this.s00=i<<24^o>>>8^r^r<<16,this.s01=o<<24^i>>>8^n^(n<<16|r>>>16),this.s10=n<<5^r>>>27,this.s11=r<<5^n>>>27,t}jump(){let t=0,r=0,n=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,r^=this.s00,n^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=r,this.s11=n,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function aS(e){return new Q6(-1,~e,e|0,0)}function lS(e,t){for(let r=0;r!==t;++r)e.next()}var cS=BigInt,e4=4294967296n;function dS(e,t,r){let n=r-t+1n,i=e4,o=1;for(;i<n;)i<<=32n,++o;let s=uS(o,e);if(s<n)return s+t;if(s+n<i)return s%n+t;let a=i-i%n;for(;s>=a;)s=uS(o,e);return s%n+t}function uS(e,t){let r=cS(t.next()+2147483648);for(let n=1;n<e;++n){let i=t.next();r=(r<<32n)+cS(i+2147483648)}return r}function _i(e,t){let r=t>2?~~(4294967296/t)*t:4294967296,n=e.next()+2147483648;for(;n>=r;)n=e.next()+2147483648;return n%t}function Ld(e,t){if(t<0){let r=-t;e.sign=-1,e.data[0]=~~(r/4294967296),e.data[1]=r>>>0}else e.sign=1,e.data[0]=~~(t/4294967296),e.data[1]=t>>>0;return e}function t4(e,t,r){let n=t.data[1],i=t.data[0],o=t.sign,s=r.data[1],a=r.data[0],l=r.sign;if(e.sign=1,o===1&&l===-1){let m=n+s,g=i+a+(m>4294967295?1:0);return e.data[0]=g>>>0,e.data[1]=m>>>0,e}let c=n,u=i,d=s,p=a;o===-1&&(c=s,u=a,d=n,p=i);let h=0,f=c-d;return f<0&&(h=1,f=f>>>0),e.data[0]=u-p-h,e.data[1]=f,e}function r4(e,t,r){let n=r[0]+1;for(t[0]=_i(e,n),t[1]=_i(e,4294967296);t[0]>=r[0]&&(t[0]!==r[0]||t[1]>=r[1]);)t[0]=_i(e,n),t[1]=_i(e,4294967296);return t}var n4=Number.MAX_SAFE_INTEGER,i4={sign:1,data:[0,0]},o4={sign:1,data:[0,0]},pS={sign:1,data:[0,0]},$d=[0,0];function s4(e,t,r,n){let i=n<=n4?Ld(pS,n):t4(pS,Ld(i4,r),Ld(o4,t));return i.data[1]===4294967295?(i.data[0]+=1,i.data[1]=0):i.data[1]+=1,r4(e,$d,i.data),$d[0]*4294967296+$d[1]+t}function na(e,t,r){let n=r-t;return n<=4294967295?_i(e,n+1)+t:s4(e,t,r,n)}var fS=Symbol.for("fast-check/PreconditionFailure"),kr=class extends Error{constructor(e=!1){super(),this.interruptExecution=e,this.footprint=fS}static isFailure(e){return e!=null&&e.footprint===fS}};function a4(e){if(!e)throw new kr}var l4=class{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}},c4=new l4;function u4(){return c4}function*d4(e,t){for(let r of e)yield t(r)}function*p4(e,t){for(let r of e)yield*t(r)}function*f4(e,t){for(let r of e)t(r)&&(yield r)}function*h4(e,t){for(let r=0;r<t;++r){let n=e.next();if(n.done)break;yield n.value}}function*m4(e,t){let r=e.next();for(;!r.done&&t(r.value);)yield r.value,r=e.next()}function*g4(e,t){for(let r=e.next();!r.done;r=e.next())yield r.value;for(let r of t)for(let n=r.next();!n.done;n=r.next())yield n.value}var y4=Symbol.iterator,V=class Kt{static nil(){return new Kt(u4())}static of(...t){return new Kt(t[y4]())}constructor(t){this.g=t}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(t){return new Kt(d4(this.g,t))}flatMap(t){return new Kt(p4(this.g,t))}dropWhile(t){let r=!1;function*n(i){(r||!t(i))&&(r=!0,yield i)}return this.flatMap(n)}drop(t){if(t<=0)return this;let r=0;function n(){return r++<t}return this.dropWhile(n)}takeWhile(t){return new Kt(m4(this.g,t))}take(t){return new Kt(h4(this.g,t))}filter(t){return new Kt(f4(this.g,t))}every(t){for(let r of this.g)if(!t(r))return!1;return!0}has(t){for(let r of this.g)if(t(r))return[!0,r];return[!1,null]}join(...t){return new Kt(g4(this.g,t))}getNthOrLast(t){let r=t,n=null;for(let i of this.g){if(r--===0)return i;n=i}return n}};function vr(e){return new V(e)}var Ve=Symbol.for("fast-check/cloneMethod");function Hr(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Ve in e&&typeof e[Ve]=="function"}function Rn(e){return Hr(e)?e[Ve]():e}var b4=Object.defineProperty,$=class{constructor(e,t,r){this.value_=e,this.context=t,this.hasToBeCloned=r!==void 0||Hr(e),this.readOnce=!1,this.value=e,this.hasToBeCloned&&b4(this,"value",{get:r!==void 0?r:this.getValue,enumerable:!1,configurable:!1})}getValue(){return this.hasToBeCloned?this.readOnce?this.value_[Ve]():(this.readOnce=!0,this.value_):this.value_}},me=class{filter(e){return new v4(this,e)}map(e,t){return new S4(this,e,t)}chain(e){return new w4(this,e)}},w4=class extends me{constructor(e,t){super(),this.arb=e,this.chainer=t}generate(e,t){let r=e.clone(),n=this.arb.generate(e,t);return this.valueChainer(n,e,r,t)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?(t.stoppedForOriginal?V.nil():this.arb.shrink(t.originalValue,t.originalContext).map(r=>this.valueChainer(r,t.clonedMrng.clone(),t.clonedMrng,t.originalBias))).join(t.chainedArbitrary.shrink(e,t.chainedContext).map(r=>{let n={...t,chainedContext:r.context,stoppedForOriginal:!0};return new $(r.value_,n)})):V.nil()}valueChainer(e,t,r,n){let i=this.chainer(e.value_),o=i.generate(t,n),s={originalBias:n,originalValue:e.value_,originalContext:e.context,stoppedForOriginal:!1,chainedArbitrary:i,chainedContext:o.context,clonedMrng:r};return new $(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}},S4=class extends me{constructor(e,t,r){super(),this.arb=e,this.mapper=t,this.unmapper=r,this.bindValueMapper=n=>this.valueMapper(n)}generate(e,t){let r=this.arb.generate(e,t);return this.valueMapper(r)}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 r=this.unmapper(e);return this.arb.shrink(r,void 0).map(this.bindValueMapper)}return V.nil()}mapperWithCloneIfNeeded(e){let t=e.value,r=this.mapper(t);return e.hasToBeCloned&&(typeof r=="object"&&r!==null||typeof r=="function")&&Object.isExtensible(r)&&!Hr(r)&&Object.defineProperty(r,Ve,{get:()=>()=>this.mapperWithCloneIfNeeded(e)[0]}),[r,t]}valueMapper(e){let[t,r]=this.mapperWithCloneIfNeeded(e);return new $(t,{originalValue:r,originalContext:e.context})}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalValue"in e&&"originalContext"in e}},v4=class extends me{constructor(e,t){super(),this.arb=e,this.refinement=t,this.bindRefinementOnValue=r=>this.refinementOnValue(r)}generate(e,t){for(;;){let r=this.arb.generate(e,t);if(this.refinementOnValue(r))return r}}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 f1(e){return typeof e=="object"&&e!==null&&"generate"in e&&"shrink"in e&&"canShrinkWithoutContext"in e}function h1(e){if(!f1(e))throw new Error("Unexpected value received: not an instance of Arbitrary")}var m1=Function.prototype.apply,Dd=Symbol("apply");function x4(e){try{return e.apply}catch{return}}function k4(e,t,r){let n=e;n[Dd]=m1;let i=n[Dd](t,r);return delete n[Dd],i}function K(e,t,r){return x4(e)===m1?e.apply(t,r):k4(e,t,r)}var g1=Array,O=BigInt,C4=BigInt64Array,R4=BigUint64Array,y1=Boolean,ba=Date,N=Error,b1=Float32Array,w1=Float64Array,E4=Int8Array,I4=Int16Array,A4=Int32Array,Yt=Number,Ze=String,En=Set,P4=Uint8Array,T4=Uint8ClampedArray,O4=Uint16Array,M4=Uint32Array,N4=encodeURIComponent,Zt=Map,da=Symbol,hS=Array.prototype.forEach,mS=Array.prototype.indexOf,gS=Array.prototype.join,yS=Array.prototype.map,bS=Array.prototype.flat,wS=Array.prototype.filter,SS=Array.prototype.push,vS=Array.prototype.pop,xS=Array.prototype.splice,kS=Array.prototype.slice,CS=Array.prototype.sort,RS=Array.prototype.every;function L4(e){try{return e.forEach}catch{return}}function $4(e){try{return e.indexOf}catch{return}}function D4(e){try{return e.join}catch{return}}function _4(e){try{return e.map}catch{return}}function j4(e){try{return e.flat}catch{return}}function F4(e){try{return e.filter}catch{return}}function B4(e){try{return e.push}catch{return}}function V4(e){try{return e.pop}catch{return}}function U4(e){try{return e.splice}catch{return}}function W4(e){try{return e.slice}catch{return}}function H4(e){try{return e.sort}catch{return}}function z4(e){try{return e.every}catch{return}}function S1(e,t){return L4(e)===hS?e.forEach(t):K(hS,e,[t])}function Jt(e,...t){return $4(e)===mS?e.indexOf(...t):K(mS,e,t)}function he(e,...t){return D4(e)===gS?e.join(...t):K(gS,e,t)}function G(e,t){return _4(e)===yS?e.map(t):K(yS,e,[t])}function G4(e,t){return j4(e)===bS?([].flat(),e.flat(t)):K(bS,e,[t])}function q4(e,t){return F4(e)===wS?e.filter(t):K(wS,e,[t])}function L(e,...t){return B4(e)===SS?e.push(...t):K(SS,e,t)}function v1(e){return V4(e)===vS?e.pop():K(vS,e,[])}function x1(e,...t){return U4(e)===xS?e.splice(...t):K(xS,e,t)}function Ue(e,...t){return W4(e)===kS?e.slice(...t):K(kS,e,t)}function k1(e,...t){return H4(e)===CS?e.sort(...t):K(CS,e,t)}function C1(e,...t){return z4(e)===RS?e.every(...t):K(RS,e,t)}var ES=Date.prototype.getTime,IS=Date.prototype.toISOString;function K4(e){try{return e.getTime}catch{return}}function J4(e){try{return e.toISOString}catch{return}}function wa(e){return K4(e)===ES?e.getTime():K(ES,e,[])}function Y4(e){return J4(e)===IS?e.toISOString():K(IS,e,[])}var AS=Set.prototype.add,PS=Set.prototype.has;function Z4(e){try{return e.add}catch{return}}function X4(e){try{return e.has}catch{return}}function Ui(e,t){return Z4(e)===AS?e.add(t):K(AS,e,[t])}function Sa(e,t){return X4(e)===PS?e.has(t):K(PS,e,[t])}var TS=WeakMap.prototype.set,OS=WeakMap.prototype.get;function Q4(e){try{return e.set}catch{return}}function e3(e){try{return e.get}catch{return}}function t3(e,t,r){return Q4(e)===TS?e.set(t,r):K(TS,e,[t,r])}function r3(e,t){return e3(e)===OS?e.get(t):K(OS,e,[t])}var MS=Map.prototype.set,NS=Map.prototype.get,LS=Map.prototype.has;function n3(e){try{return e.set}catch{return}}function i3(e){try{return e.get}catch{return}}function o3(e){try{return e.has}catch{return}}function xt(e,t,r){return n3(e)===MS?e.set(t,r):K(MS,e,[t,r])}function lt(e,t){return i3(e)===NS?e.get(t):K(NS,e,[t])}function s3(e,t){return o3(e)===LS?e.has(t):K(LS,e,[t])}var $S=String.prototype.split,DS=String.prototype.startsWith,_S=String.prototype.endsWith,jS=String.prototype.substring,FS=String.prototype.toLowerCase,BS=String.prototype.toUpperCase,VS=String.prototype.padStart,US=String.prototype.charCodeAt,WS=String.prototype.normalize,HS=String.prototype.replace;function a3(e){try{return e.split}catch{return}}function l3(e){try{return e.startsWith}catch{return}}function c3(e){try{return e.endsWith}catch{return}}function u3(e){try{return e.substring}catch{return}}function d3(e){try{return e.toLowerCase}catch{return}}function p3(e){try{return e.toUpperCase}catch{return}}function f3(e){try{return e.padStart}catch{return}}function h3(e){try{return e.charCodeAt}catch{return}}function m3(e){try{return e.normalize}catch{return}}function g3(e){try{return e.replace}catch{return}}function Xe(e,...t){return a3(e)===$S?e.split(...t):K($S,e,t)}function y3(e,...t){return l3(e)===DS?e.startsWith(...t):K(DS,e,t)}function b3(e,...t){return c3(e)===_S?e.endsWith(...t):K(_S,e,t)}function xe(e,...t){return u3(e)===jS?e.substring(...t):K(jS,e,t)}function ap(e){return d3(e)===FS?e.toLowerCase():K(FS,e,[])}function Np(e){return p3(e)===BS?e.toUpperCase():K(BS,e,[])}function w3(e,...t){return f3(e)===VS?e.padStart(...t):K(VS,e,t)}function In(e,t){return h3(e)===US?e.charCodeAt(t):K(US,e,[t])}function S3(e,t){return m3(e)===WS?e.normalize(t):K(WS,e,[t])}function v3(e,t,r){return g3(e)===HS?e.replace(t,r):K(HS,e,[t,r])}var zS=Number.prototype.toString;function x3(e){try{return e.toString}catch{return}}function Wi(e,...t){return x3(e)===zS?e.toString(...t):K(zS,e,t)}var k3=Object.prototype.hasOwnProperty,C3=Object.prototype.toString;function R1(e,t){return K(k3,e,[t])}function lp(e){return K(C3,e,[])}var R3=Error.prototype.toString;function E3(e){return K(R3,e,[])}var I3=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 Sr(e){return new I3(e)}var E1=Array.isArray,A3=Object.defineProperty;function I1(e,t){return A3(e,Ve,{value:()=>{let r=[];for(let n=0;n!==t.length;++n)L(r,t[n].value);return I1(r,t),r}})}function A1(e){let t=!1,r=[],n=[];for(let i=0;i!==e.length;++i){let o=e[i];t=t||o.hasToBeCloned,L(r,o.value),L(n,o.context)}return t&&I1(r,e),new $(r,n)}function P1(e,t,r){let n=[],i=E1(r)?r:[];for(let o=0;o!==e.length;++o)L(n,Sr(()=>e[o].shrink(t[o],i[o]).map(s=>{let a=G(t,(l,c)=>new $(Rn(l),i[c]));return[...Ue(a,0,o),s,...Ue(a,o+1)]}).map(A1)));return V.nil().join(...n)}var P3=class extends me{constructor(e){super(),this.arbs=e;for(let t=0;t!==e.length;++t){let r=e[t];if(r==null||r.generate===null||r.generate===void 0)throw new Error(`Invalid parameter encountered at index ${t}: expecting an Arbitrary`)}}generate(e,t){let r=[];for(let n=0;n!==this.arbs.length;++n)L(r,this.arbs[n].generate(e,t));return A1(r)}canShrinkWithoutContext(e){if(!E1(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 P1(this.arbs,e,t)}};function W(...e){return new P3(e)}var T3=Math.log;function T1(e){return 2+~~(T3(e+1)*.4342944819032518)}var Lp={};function O3(e){Lp=e}function kt(){return Lp}function M3(){Lp={}}var Hi=Symbol("UndefinedContextPlaceholder");function An(e){return e.context!==void 0?e:e.hasToBeCloned?new $(e.value_,Hi,()=>e.value):new $(e.value_,Hi)}var GS=()=>{},N3=class{constructor(e,t){this.arb=e,this.predicate=t;let{asyncBeforeEach:r,asyncAfterEach:n,beforeEach:i,afterEach:o}=kt()||{};if(r!==void 0&&i!==void 0)throw N(`Global "asyncBeforeEach" and "beforeEach" parameters can't be set at the same time when running async properties`);if(n!==void 0&&o!==void 0)throw N(`Global "asyncAfterEach" and "afterEach" parameters can't be set at the same time when running async properties`);this.beforeEachHook=r||i||GS,this.afterEachHook=n||o||GS}isAsync(){return!0}generate(e,t){return An(this.arb.generate(e,t!==void 0?T1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return V.nil();let t=e.context!==Hi?e.context:void 0;return this.arb.shrink(e.value_,t).map(An)}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 N("Property failed by returning false")}}catch(t){return kr.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}},O1=class extends me{constructor(e){super(),this.arb=e}generate(e,t){return An(this.arb.generate(e,t))}canShrinkWithoutContext(e){return!0}shrink(e,t){if(t===void 0&&!this.arb.canShrinkWithoutContext(e))return V.nil();let r=t!==Hi?t:void 0;return this.arb.shrink(e,r).map(An)}};function L3(...e){if(e.length<2)throw new Error("asyncProperty expects at least two parameters");let t=Ue(e,0,e.length-1),r=e[e.length-1];return S1(t,h1),new N3(W(...G(t,n=>new O1(n))),n=>r(...n))}var qS=()=>{},M1=class{constructor(e,t){this.arb=e,this.predicate=t;let{beforeEach:r=qS,afterEach:n=qS,asyncBeforeEach:i,asyncAfterEach:o}=kt()||{};if(i!==void 0)throw N(`"asyncBeforeEach" can't be set when running synchronous properties`);if(o!==void 0)throw N(`"asyncAfterEach" can't be set when running synchronous properties`);this.beforeEachHook=r,this.afterEachHook=n}isAsync(){return!1}generate(e,t){return An(this.arb.generate(e,t!==void 0?T1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return V.nil();let t=e.context!==Hi?e.context:void 0;return this.arb.shrink(e.value_,t).map(An)}runBeforeEach(){this.beforeEachHook()}runAfterEach(){this.afterEachHook()}run(e){try{let t=this.predicate(e);return t===void 0||t===!0?null:{error:new N("Property failed by returning false")}}catch(t){return kr.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 $3(...e){if(e.length<2)throw new Error("property expects at least two parameters");let t=Ue(e,0,e.length-1),r=e[e.length-1];return S1(t,h1),new M1(W(...G(t,n=>new O1(n))),n=>r(...n))}var D3=(function(e){return e[e.None=0]="None",e[e.Verbose=1]="Verbose",e[e.VeryVerbose=2]="VeryVerbose",e})({});function cp(e){return"unsafeNext"in e?e.unsafeJump===void 0?{clone:()=>cp(e),next:()=>e.unsafeNext(),getState:()=>e.getState()}:{clone:()=>cp(e),next:()=>e.unsafeNext(),jump:()=>e.unsafeJump(),getState:()=>e.getState()}:e}function N1(e){return"jump"in e&&typeof e.jump=="function"?e:{clone:()=>N1(e),next:()=>e.next(),jump:()=>lS(e,42),getState:()=>e.getState()}}function Ca(e){return N1(cp(e))}var _3=Date.now,j3=Math.min,F3=Math.random,B3=class{constructor(e){let t=e||{};this.seed=V3(t),this.randomType=U3(t),this.numRuns=W3(t),this.verbose=H3(t),this.maxSkipsPerRun=t.maxSkipsPerRun!==void 0?t.maxSkipsPerRun:100,this.timeout=jd(t.timeout),this.skipAllAfterTimeLimit=jd(t.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=jd(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:r=>{console.log(r)},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 _d(e){return t=>Ca(e(t))}function V3(e){if(e.seed===void 0)return _3()^F3()*4294967296;let t=e.seed|0;return e.seed===t?t:t^(e.seed-t)*4294967296}function U3(e){if(e.randomType===void 0)return Nd;if(typeof e.randomType=="string")switch(e.randomType){case"mersenne":return _d(iS);case"congruential":case"congruential32":return _d(tS);case"xorshift128plus":return Nd;case"xoroshiro128plus":return aS;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===Ca(t)?e.randomType:_d(e.randomType)}function W3(e){return e.numRuns!==void 0?e.numRuns:e.num_runs!==void 0?e.num_runs:100}function H3(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 jd(e){if(e!==void 0)return j3(e,2147483647)}function $p(e){return new B3(e)}function z3(e,t,r){let n=null;return{clear:()=>r(n),promise:new Promise(i=>{n=t(()=>{i(new kr(!0))},e)})}}var KS=class{constructor(e,t,r,n,i,o){this.property=e,this.getTime=t,this.interruptExecution=n,this.setTimeoutSafe=i,this.clearTimeoutSafe=o,this.skipAfterTime=this.getTime()+r}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 r=new kr(this.interruptExecution);return this.isAsync()?Promise.resolve(r):r}if(this.interruptExecution&&this.isAsync()){let r=z3(t,this.setTimeoutSafe,this.clearTimeoutSafe),n=Promise.race([this.property.run(e),r.promise]);return n.then(r.clear,r.clear),n}return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},G3=(e,t,r)=>{let n=null;return{clear:()=>r(n),promise:new Promise(i=>{n=t(()=>{i({error:new N(`Property timeout: exceeded limit of ${e} milliseconds`)})},e)})}},q3=class{constructor(e,t,r,n){this.property=e,this.timeMs=t,this.setTimeoutSafe=r,this.clearTimeoutSafe=n}isAsync(){return!0}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}async run(e){let t=G3(this.timeMs,this.setTimeoutSafe,this.clearTimeoutSafe),r=Promise.race([this.property.run(e),t.promise]);return r.then(t.clear,t.clear),r}runBeforeEach(){return Promise.resolve(this.property.runBeforeEach())}runAfterEach(){return Promise.resolve(this.property.runAfterEach())}},L1=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()}},JS=Array.from,YS=typeof Buffer<"u"?Buffer.isBuffer:void 0,vn=JSON.stringify,ZS=Number.isNaN,K3=Object.keys,J3=Object.getOwnPropertySymbols,Y3=Object.getOwnPropertyDescriptor,XS=Object.getPrototypeOf,QS=Number.NEGATIVE_INFINITY,Z3=Number.POSITIVE_INFINITY,Ct=Symbol.for("fast-check/toStringMethod");function Dp(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Ct in e&&typeof e[Ct]=="function"}var Xt=Symbol.for("fast-check/asyncToStringMethod");function _p(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Xt in e&&typeof e[Xt]=="function"}var X3=/^Symbol\((.*)\)$/;function Q3(e){if(e.description!==void 0)return e.description;let t=X3.exec(Ze(e));return t&&t[1].length?t[1]:null}function ev(e){switch(e){case 0:return 1/e===QS?"-0":"0";case QS:return"Number.NEGATIVE_INFINITY";case Z3:return"Number.POSITIVE_INFINITY";default:return e===e?Ze(e):"Number.NaN"}}function eD(e){let t=-1;for(let r in e){let n=Number(r);if(n!==t+1)return!0;t=n}return t+1!==e.length}function at(e,t,r){let n=[...t,e];if(typeof e=="object"&&Jt(t,e)!==-1)return"[cyclic]";if(_p(e)){let i=r(e);if(i.state==="fulfilled")return i.value}if(Dp(e))try{return e[Ct]()}catch{}switch(lp(e)){case"[object Array]":{let i=e;if(i.length>=50&&eD(i)){let s=[];for(let a in i)ZS(Number(a))||L(s,`${a}:${at(i[a],n,r)}`);return s.length!==0?`Object.assign(Array(${i.length}),{${he(s,",")}})`:`Array(${i.length})`}let o=he(G(i,s=>at(s,n,r)),",");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 ZS(wa(i))?"new Date(NaN)":`new Date(${vn(Y4(i))})`}case"[object Map]":return`new Map(${at(Array.from(e),n,r)})`;case"[object Null]":return"null";case"[object Number]":return typeof e=="number"?ev(e):`new Number(${ev(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"?`[${at(o,n,r)}]`:vn(o)}:${at(e[o],n,r)}`;return"{"+he([...XS(e)===null?["__proto__:null"]:[],...G(K3(e),i),...G(q4(J3(e),o=>{let s=Y3(e,o);return s&&s.enumerable}),i)],",")+"}"}case"[object Set]":return`new Set(${at(Array.from(e),n,r)})`;case"[object String]":return typeof e=="string"?vn(e):`new String(${vn(e)})`;case"[object Symbol]":{let i=e;if(da.keyFor(i)!==void 0)return`Symbol.for(${vn(da.keyFor(i))})`;let o=Q3(i);return o===null?"Symbol()":i===(o.startsWith("Symbol.")&&da[o.substring(7)])?o:`Symbol(${vn(o)})`}case"[object Promise]":{let i=r(e);switch(i.state){case"fulfilled":return`Promise.resolve(${at(i.value,n,r)})`;case"rejected":return`Promise.reject(${at(i.value,n,r)})`;case"pending":return"new Promise(() => {/*pending*/})";default:return"new Promise(() => {/*unknown*/})"}}case"[object Error]":if(e instanceof Error)return`new Error(${at(e.message,n,r)})`;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 YS=="function"&&YS(e))return`Buffer.from(${e.buffer.detached?"/*detached ArrayBuffer*/":at(JS(e.values()),n,r)})`;let i=XS(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(${at(JS(s.values()),n,r)})`}break}}try{return e.toString()}catch{return lp(e)}}function Ae(e){return at(e,[],()=>({state:"unknown",value:void 0}))}function $1(e){let t=da(),r=[],n=new Zt;function i(){let l=null,c=()=>{l!==null&&clearTimeout(l)};return{delay:new Promise(u=>{l=setTimeout(()=>{l=null,u(t)},0)}),cancel:c}}let o={state:"unknown",value:void 0},s=function(c){let u=c;if(n.has(u))return n.get(u);let d=i(),p=Xt in c?Promise.resolve().then(()=>c[Xt]()):c;return p.catch(()=>{}),r.push(Promise.race([p,d.delay]).then(h=>{h===t?n.set(u,{state:"pending",value:void 0}):n.set(u,{state:"fulfilled",value:h}),d.cancel()},h=>{n.set(u,{state:"rejected",value:h}),d.cancel()})),n.set(u,o),o};function a(){let l=at(e,[],s);return r.length===0?l:Promise.all(r.splice(0)).then(a)}return a()}async function jp(e){return Promise.resolve($1(e))}function tv(e){return e===null?new kr:e}function tD(...e){return e[1]?e[0].then(tv):tv(e[0])}function rD(e,t){return tD(e,t)}var rv=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=Ae(e);if(this.coveredCases.has(t)){let n=this.coveredCases.get(t);return this.skipRuns?rD(n,this.property.isAsync()):n}let r=this.property.run(e);return this.coveredCases.set(t,r),r}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},nv=Date.now,Fd=setTimeout,Bd=clearTimeout;function nD(e,t){let r=e;return e.isAsync()&&t.timeout!==void 0&&(r=new q3(r,t.timeout,Fd,Bd)),t.unbiased&&(r=new L1(r)),t.skipAllAfterTimeLimit!==void 0&&(r=new KS(r,nv,t.skipAllAfterTimeLimit,!1,Fd,Bd)),t.interruptAfterTimeLimit!==void 0&&(r=new KS(r,nv,t.interruptAfterTimeLimit,!0,Fd,Bd)),t.skipEqualValues&&(r=new rv(r,!0)),t.ignoreEqualValues&&(r=new rv(r,!1)),r}var iD=(function(e){return e[e.Success=0]="Success",e[e.Skipped=-1]="Skipped",e[e.Failure=1]="Failure",e})({}),oD=class D1{constructor(t,r){this.verbosity=t,this.interruptedAsFailure=r,this.rootExecutionTrees=[],this.currentLevelExecutionTrees=this.rootExecutionTrees,this.failure=null,this.numSkips=0,this.numSuccesses=0,this.interrupted=!1}appendExecutionTree(t,r){let n={status:t,value:r,children:[]};return this.currentLevelExecutionTrees.push(n),n}fail(t,r,n){if(this.verbosity>=1){let i=this.appendExecutionTree(1,t);this.currentLevelExecutionTrees=i.children}this.pathToFailure===void 0?this.pathToFailure=`${r}`:this.pathToFailure+=`:${r}`,this.value=t,this.failure=n}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?+Xe(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?Xe(this.pathToFailure,":").length-1:0}extractFailures(){if(this.isSuccess())return[];let t=[],r=this.rootExecutionTrees;for(;r.length>0&&r[r.length-1].status===1;){let n=r[r.length-1];t.push(n.value),r=n.children}return t}static mergePaths(t,r){if(t.length===0)return r;let n=t.split(":"),i=r.split(":"),o=+n[n.length-1]+ +i[0];return[...n.slice(0,n.length-1),`${o}`,...i.slice(1)].join(":")}toRunDetails(t,r,n,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:D1.mergePaths(r,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>n||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()}}},_1=class{constructor(e,t,r,n){this.sourceValues=e,this.shrink=t,this.runExecution=new oD(r,n),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"&&!kr.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_)}},sD=class{constructor(e,t,r){this.initialValues=e,this.maxInitialIterations=t,this.remainingSkips=r}[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}},aD=-2147483648,lD=2147483647,cD=Math.pow(2,27),uD=Math.pow(2,-53),Fp=class j1{constructor(t){this.internalRng=Ca(t.clone())}clone(){return new j1(this.internalRng)}next(t){return na(this.internalRng,0,(1<<t)-1)}nextBoolean(){return na(this.internalRng,0,1)===1}nextInt(t,r){return na(this.internalRng,t===void 0?aD:t,r===void 0?lD:r)}nextBigInt(t,r){return dS(this.internalRng,t,r)}nextDouble(){let t=this.next(26),r=this.next(27);return(t*cD+r)*uD}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState=="function")return this.internalRng.getState()}};function dD(e,t,r){return t.jump(),e.generate(new Fp(t),r)}function*F1(e,t,r,n){for(let i=0;i!==n.length;++i)yield new $(n[i],void 0);for(let i=0,o=r(t);;++i)yield dD(e,o,i)}function pD(e,t,r){return()=>e.generate(new Fp(t),r)}function*B1(e,t,r,n){yield*G(n,s=>()=>new $(s,void 0));let i=0,o=Ca(r(t));for(;;)o.jump(),yield pD(e,o,i++)}function iv(e){return e()}function V1(e,t,r){let n=t,i=e.split(":").map(s=>+s);if(i.length===0)return n.map(iv);if(!i.every(s=>!Number.isNaN(s)))throw new Error(`Unable to replay, got invalid path=${e}`);let o=n.drop(i[0]).map(iv);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=r(a).drop(s)}return o}var fD=Object.assign;function hD(e){return e.length===1?`Hint: ${e[0]}`:e.map((t,r)=>`Hint (${r+1}): ${t}`).join(`
|
|
176
|
+
`)}function mD(e,t){return`Encountered failures were:
|
|
177
177
|
- ${e.map(t).join(`
|
|
178
178
|
- `)}`}function Bp(e,t){let r=[],n=[];for(let i=e.length-1;i>=0;--i)n.push({depth:1,tree:e[i]});for(;n.length!==0;){let i=n.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):"";r.push(`${l}${a} ${t(o.value)}`);for(let c=o.children.length-1;c>=0;--c)n.push({depth:s+1,tree:o.children[c]})}return`Execution summary:
|
|
179
179
|
${r.join(`
|
|
180
|
-
`)}`}function
|
|
180
|
+
`)}`}function gD(e,t){let r=`Failed to run property, too many pre-condition failures encountered
|
|
181
181
|
{ seed: ${e.seed} }
|
|
182
182
|
|
|
183
183
|
Ran ${e.numRuns} time(s)
|
|
184
|
-
Skipped ${e.numSkips} time(s)`,n=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?n=Bp(e.executionSummary,t):L(i,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:r,details:n,hints:i}}function
|
|
185
|
-
Got ${
|
|
184
|
+
Skipped ${e.numSkips} time(s)`,n=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?n=Bp(e.executionSummary,t):L(i,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:r,details:n,hints:i}}function yD(e){if(e instanceof N&&e.stack!==void 0)return e.stack;try{return Ze(e)}catch{}if(e instanceof N)try{return E3(e)}catch{}if(e!==null&&typeof e=="object")try{return lp(e)}catch{}return"Failed to serialize errorInstance"}function bD(e,t){let r=e.runConfiguration.includeErrorInReport?`
|
|
185
|
+
Got ${v3(yD(e.errorInstance),/^Error: /,"error: ")}`:"",n=`Property failed after ${e.numRuns} tests
|
|
186
186
|
{ seed: ${e.seed}, path: "${e.counterexamplePath}", endOnFailure: true }
|
|
187
187
|
Counterexample: ${t(e.counterexample)}
|
|
188
|
-
Shrunk ${e.numShrinks} time(s)${r}`,i=null,o=[];return e.verbose>=2?i=Bp(e.executionSummary,t):e.verbose===1?i=
|
|
189
|
-
{ seed: ${e.seed} }`,n=null,i=[];return e.verbose>=2?n=Bp(e.executionSummary,t):L(i,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:r,details:n,hints:i}}function up(e,t){if(!e.failed)return;let{message:r,details:n,hints:i}=e.counterexamplePath===null?e.interrupted?
|
|
188
|
+
Shrunk ${e.numShrinks} time(s)${r}`,i=null,o=[];return e.verbose>=2?i=Bp(e.executionSummary,t):e.verbose===1?i=mD(e.failures,t):L(o,"Enable verbose mode in order to have the list of all failing values encountered during the run"),{message:n,details:i,hints:o}}function wD(e,t){let r=`Property interrupted after ${e.numRuns} tests
|
|
189
|
+
{ seed: ${e.seed} }`,n=null,i=[];return e.verbose>=2?n=Bp(e.executionSummary,t):L(i,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:r,details:n,hints:i}}function up(e,t){if(!e.failed)return;let{message:r,details:n,hints:i}=e.counterexamplePath===null?e.interrupted?wD(e,t):gD(e,t):bD(e,t),o=r;return n!==null&&(o+=`
|
|
190
190
|
|
|
191
191
|
${n}`),i.length>0&&(o+=`
|
|
192
192
|
|
|
193
|
-
${sD(i)}`),o}function V1(e){return up(e,Ae)}async function U1(e){let t=[];function r(s){let a=L1(s);return typeof a=="string"?a:(t.push(Promise.all([s,a])),"\u2026")}let n=up(e,r);if(t.length===0)return n;let i=new Zt(await Promise.all(t));function o(s){let a=lt(i,s);return a!==void 0?a:Ae(s)}return up(e,o)}function W1(e,t){if(t.runConfiguration.includeErrorInReport)throw new N(e);let r=new N(e,{cause:t.errorInstance});return"cause"in r||oD(r,{cause:t.errorInstance}),r}function pD(e){if(e.failed)throw W1(V1(e),e)}async function fD(e){if(e.failed)throw W1(await U1(e),e)}function hD(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):pD(e)}async function mD(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):fD(e)}function gD(e,t,r,n,i){let o=new D1(r,t,n,i);for(let s of o){e.runBeforeEach();let a=e.run(s);e.runAfterEach(),o.handleResult(a)}return o.runExecution}async function yD(e,t,r,n,i){let o=new D1(r,t,n,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 H1(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 r=$p({...xt(),...t});if(r.reporter!==void 0&&r.asyncReporter!==void 0)throw new Error("Invalid parameters encountered, reporter and asyncReporter cannot be specified together");if(r.asyncReporter!==void 0&&!e.isAsync())throw new Error("Invalid parameters encountered, only asyncProperty can be used when asyncReporter specified");let n=J3(e,r),i=r.path.length===0||r.path.indexOf(":")===-1?r.numRuns:-1,o=r.numRuns*r.maxSkipsPerRun,s=(...c)=>n.shrink(...c),a=new X3(r.path.length===0?j1(n,r.seed,r.randomType,r.examples):B1(r.path,vr(F1(n,r.seed,r.randomType,r.examples)),s),i,o),l=r.endOnFailure?V.nil:s;return n.isAsync()?yD(n,l,a,r.verbose,r.markInterruptAsFailure).then(c=>c.toRunDetails(r.seed,r.path,o,r)):gD(n,l,a,r.verbose,r.markInterruptAsFailure).toRunDetails(r.seed,r.path,o,r)}function bD(e,t){let r=H1(e,t);if(e.isAsync())return r.then(mD);hD(r)}function wD(e,t){let r=Object.prototype.hasOwnProperty.call(e,"isAsync")?e:new O1(e,()=>!0);return t.unbiased===!0?new N1(r):r}function z1(e,t){let r=$p(typeof t=="number"?{...xt(),numRuns:t}:{...xt(),...t}),n=wD(e,r),i=n.shrink.bind(n);return(r.path.length===0?vr(j1(n,r.seed,r.randomType,r.examples)):B1(r.path,vr(F1(n,r.seed,r.randomType,r.examples)),i)).take(r.numRuns).map(o=>o.value_)}function SD(e,t){return[...z1(e,t)]}function vD(e){return(Math.round(e*100)/100).toFixed(2)}function xD(e,t,r){let n=$p(typeof r=="number"?{...xt(),numRuns:r}:{...xt(),...r}),i={};for(let l of z1(e,r)){let c=t(l),u=Array.isArray(c)?c:[c];for(let d of u)i[d]=(i[d]||0)+1}let o=Object.entries(i).sort((l,c)=>c[1]-l[1]).map(l=>[l[0],`${vD(l[1]*100/n.numRuns)}%`]),s=o.map(l=>l[0].length).reduce((l,c)=>Math.max(l,c),0),a=o.map(l=>l[1].length).reduce((l,c)=>Math.max(l,c),0);for(let l of o)n.logger(`${l[0].padEnd(s,".")}..${l[1].padStart(a,".")}`)}var kD=Object.assign;function dp(e,t,r,n){let i=r(),o=e.clone(),s={mrng:e.clone(),biasFactor:t,history:[]},a=c=>{let u=i[s.history.length];if(u!==void 0&&u.arb===c){let p=u.value;return L(s.history,{arb:c,value:p,context:u.context,mrng:u.mrng}),o=u.mrng.clone(),p}let d=c.generate(o,t);return L(s.history,{arb:c,value:d.value_,context:d.context,mrng:o.clone()}),d.value},l=(c,...u)=>a(n(c,u));return new $(kD(l,{values(){return G(s.history,c=>c.value)},[Ve](){return dp(e,t,r,n).value},[kt](){return Ae(G(s.history,c=>c.value))}}),s)}var Vd=Array.isArray,iv=Object.keys,CD=Object.is;function RD(e){let t=new Zt;return function(n,i){let o=lt(t,n);if(o===void 0){let l=n(...i);return vt(t,n,[{args:i,value:l}]),l}let s=o;for(let l of s)if(e(i,l.args))return l.value;let a=n(...i);return L(s,{args:i,value:a}),a}}function G1(e,t){if(e!==null&&typeof e=="object"&&t!==null&&typeof t=="object"){if(Vd(e)){if(!Vd(t)||e.length!==t.length)return!1}else if(Vd(t))return!1;if(iv(e).length!==iv(t).length)return!1;for(let r in e)if(!(r in t)||!G1(e[r],t[r]))return!1;return!0}else return CD(e,t)}var ED=class extends he{constructor(...e){super(...e),this.arbitraryCache=RD(G1)}generate(e,t){return dp(e,t,()=>[],this.arbitraryCache)}canShrinkWithoutContext(e){return!1}shrink(e,t){if(t===void 0)return V.nil();let r=t,n=r.mrng,i=r.biasFactor,o=r.history;return A1(o.map(s=>s.arb),o.map(s=>s.value),o.map(s=>s.context)).map(s=>{function a(){let l=s.value,c=s.context;return G(o,(u,d)=>({arb:u.arb,value:l[d],context:c[d],mrng:u.mrng}))}return dp(n,i,a,this.arbitraryCache)})}};function ID(){return new ED}var AD=Math.floor,ov=Math.log;function PD(e){return AD(ov(e)/ov(2))}function TD(e){return e===O(0)?O(0):O(Ze(e).length)}function q1(e,t,r){if(e===t)return[{min:e,max:t}];if(e<0&&t>0){let s=r(-e),a=r(t);return[{min:-s,max:a},{min:t-a,max:t},{min:e,max:e+s}]}let n=r(t-e),i={min:e,max:e+n},o={min:t-n,max:t};return e<0?[o,i]:[i,o]}var OD=Math.ceil,MD=Math.floor;function sv(e){return MD(e/2)}function av(e){return OD(e/2)}function lv(e,t,r){let n=e-t;function*i(){let s=r?void 0:t,a=r?n:sv(n);for(let l=a;l>0;l=sv(l)){let c=l===n?t:e-l;yield new $(c,s),s=c}}function*o(){let s=r?void 0:t,a=r?n:av(n);for(let l=a;l<0;l=av(l)){let c=l===n?t:e-l;yield new $(c,s),s=c}}return n>0?vr(i()):vr(o())}var cv=Math.sign,ND=Number.isInteger,LD=Object.is,Pn=class K1 extends he{constructor(t,r){super(),this.min=t,this.max=r}generate(t,r){let n=this.computeGenerateRange(t,r);return new $(t.nextInt(n.min,n.max),void 0)}canShrinkWithoutContext(t){return typeof t=="number"&&ND(t)&&!LD(t,-0)&&this.min<=t&&t<=this.max}shrink(t,r){return K1.isValidContext(t,r)?this.isLastChanceTry(t,r)?V.of(new $(r,void 0)):lv(t,r,!1):lv(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?0:this.min<0?this.max:this.min}computeGenerateRange(t,r){if(r===void 0||t.nextInt(1,r)!==1)return{min:this.min,max:this.max};let n=q1(this.min,this.max,PD);if(n.length===1)return n[0];let i=t.nextInt(-2*(n.length-1),n.length-2);return i<0?n[0]:n[i+1]}isLastChanceTry(t,r){return t>0?t===r+1&&t>this.min:t<0?t===r-1&&t<this.max:!1}static isValidContext(t,r){if(r===void 0)return!1;if(typeof r!="number")throw new Error("Invalid context type passed to IntegerArbitrary (#1)");if(r!==0&&cv(t)!==cv(r))throw new Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}},uv=Number.isInteger;function $D(e){return{min:e.min!==void 0?e.min:-2147483648,max:e.max!==void 0?e.max:2147483647}}function oe(e={}){let t=$D(e);if(t.min>t.max)throw new Error("fc.integer maximum value should be equal or greater than the minimum one");if(!uv(t.min))throw new Error("fc.integer minimum value should be an integer");if(!uv(t.max))throw new Error("fc.integer maximum value should be an integer");return new Pn(t.min,t.max)}var dv=new Map;function Vp(e){if(e===void 0)return{depth:0};if(typeof e!="string")return e;let t=lt(dv,e);if(t!==void 0)return t;let r={depth:0};return vt(dv,e,r),r}function Up(){return{depth:0}}var DD=class{constructor(e,t,r){this.arb=e,this.mrng=t,this.biasFactor=r}attemptExact(){}next(){return this.arb.generate(this.mrng,this.biasFactor)}},_D=Math.min,jD=Math.max,FD=class{constructor(e,t,r,n){this.arb=e,this.mrng=t,this.slices=r,this.biasFactor=n,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 r=0;r!==this.slices.length;++r)this.slices[r].length===e&&L(t,r);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 $(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 $(e[0],void 0);let t=this.mrng.nextInt(0,e.length-1),r=this.mrng.nextInt(0,e.length-1);return this.nextIndexInSlice=_D(t,r),this.lastIndexInSlice=jD(t,r),new $(e[this.nextIndexInSlice++],void 0)}};function pv(e,t,r,n){return n===void 0||r.length===0||t.nextInt(1,n)!==1?new DD(e,t,n):new FD(e,t,r,n)}var BD=Math.floor,fv=Math.log,hv=Math.max,VD=Array.isArray;function Ud(e,t){return e===t?e:e+BD(fv(t-e)/fv(2))}var J1=class Y1 extends he{constructor(t,r,n,i,o,s,a){super(),this.arb=t,this.minLength=r,this.maxGeneratedLength=n,this.maxLength=i,this.setBuilder=s,this.customSlices=a,this.lengthArb=oe({min:r,max:n}),this.depthContext=Vp(o)}preFilter(t){if(this.setBuilder===void 0)return t;let r=this.setBuilder();for(let n=0;n!==t.length;++n)r.tryAdd(t[n]);return r.getData()}static makeItCloneable(t,r){return t[Ve]=()=>{let n=[];for(let i=0;i!==r.length;++i)L(n,r[i].value);return this.makeItCloneable(n,r),n},t}generateNItemsNoDuplicates(t,r,n,i){let o=0,s=t(),a=pv(this.arb,n,this.customSlices,i);for(;s.size()<r&&o<this.maxGeneratedLength;){let l=a.next();s.tryAdd(l)?o=0:o+=1}return s.getData()}safeGenerateNItemsNoDuplicates(t,r,n,i){let o=hv(0,r-Ud(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=o;try{return this.generateNItemsNoDuplicates(t,r,n,i)}finally{this.depthContext.depth-=o}}generateNItems(t,r,n){let i=[],o=pv(this.arb,r,this.customSlices,n);o.attemptExact(t);for(let s=0;s!==t;++s)L(i,o.next());return i}safeGenerateNItems(t,r,n){let i=hv(0,t-Ud(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=i;try{return this.generateNItems(t,r,n)}finally{this.depthContext.depth-=i}}wrapper(t,r,n,i){let o=r?this.preFilter(t):t,s=!1,a=[],l=[];for(let c=0;c!==o.length;++c){let u=o[c];s=s||u.hasToBeCloned,L(a,u.value),L(l,u.context)}return s&&Y1.makeItCloneable(a,o),new $(a,{shrunkOnce:r,lengthContext:t.length===o.length&&n!==void 0?n:void 0,itemsContexts:l,startIndex:i})}generate(t,r){let n=this.applyBias(t,r),i=n.size,o=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,i,t,n.biasFactorItems):this.safeGenerateNItems(i,t,n.biasFactorItems);return this.wrapper(o,!1,void 0,0)}applyBias(t,r){if(r===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:r};if(t.nextInt(1,r)!==1)return{size:this.lengthArb.generate(t,void 0).value};if(t.nextInt(1,r)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(t,void 0).value,biasFactorItems:r};let n=Ud(this.minLength,this.maxGeneratedLength);return{size:oe({min:this.minLength,max:n}).generate(t,void 0).value,biasFactorItems:r}}canShrinkWithoutContext(t){if(!VD(t)||this.minLength>t.length||t.length>this.maxLength)return!1;for(let r=0;r!==t.length;++r)if(!(r in t)||!this.arb.canShrinkWithoutContext(t[r]))return!1;return this.preFilter(G(t,r=>new $(r,void 0))).length===t.length}shrinkItemByItem(t,r,n){let i=[];for(let o=r.startIndex;o<n;++o)L(i,Sr(()=>this.arb.shrink(t[o],r.itemsContexts[o]).map(s=>{let a=G(Ue(t,0,o),(c,u)=>new $(Rn(c),r.itemsContexts[u])),l=G(Ue(t,o+1),(c,u)=>new $(Rn(c),r.itemsContexts[u+o+1]));return[[...a,s,...l],void 0,o]})));return V.nil().join(...i)}shrinkImpl(t,r){if(t.length===0)return V.nil();let n=r!==void 0?r:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(t.length,n.lengthContext).drop(n.shrunkOnce&&n.lengthContext===void 0&&t.length>this.minLength+1?1:0).map(i=>{let o=t.length-i.value;return[G(Ue(t,o),(s,a)=>new $(Rn(s),n.itemsContexts[a+o])),i.context,0]}).join(Sr(()=>t.length>this.minLength?this.shrinkItemByItem(t,n,1):this.shrinkItemByItem(t,n,t.length))).join(t.length>this.minLength?Sr(()=>{let i={shrunkOnce:!1,lengthContext:void 0,itemsContexts:Ue(n.itemsContexts,1),startIndex:0};return this.shrinkImpl(Ue(t,1),i).filter(o=>this.minLength<=o[0].length+1).map(o=>[[new $(Rn(t[0]),n.itemsContexts[0]),...o[0]],void 0,0])}):V.nil())}shrink(t,r){return this.shrinkImpl(t,r).map(n=>this.wrapper(n[0],!0,n[1],n[2]))}},UD=Math.floor,WD=Math.min,zr=2147483647,xn=["xsmall","small","medium","large","xlarge"],HD=["-4","-3","-2","-1","=","+1","+2","+3","+4"],Wp="small";function zD(e,t){switch(t){case"xsmall":return UD(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 qi(e,t){let r=Jt(HD,e);if(r===-1)return e;let n=Jt(xn,t);if(n===-1)throw new Error(`Unable to offset size based on the unknown defaulted one: ${t}`);let i=n+r-4;return i<0?xn[0]:i>=xn.length?xn[xn.length-1]:xn[i]}function zi(e,t,r,n){let{baseSize:i=Wp,defaultSizeToMaxWhenMaxSpecified:o}=xt()||{},s=e!==void 0?e:n&&o?"max":i;return s==="max"?r:WD(zD(t,qi(s,i)),r)}function GD(e,t){if(typeof e=="number")return 1/e;let{baseSize:r=Wp,defaultSizeToMaxWhenMaxSpecified:n}=xt()||{},i=e!==void 0?e:t&&n?"max":r;if(i==="max")return 0;switch(qi(i,r)){case"xsmall":return 1;case"small":return .5;case"medium":return .25;case"large":return .125;case"xlarge":return .0625}}function Hp(e){let{baseSize:t=Wp}=xt()||{};return e===void 0?t:qi(e,t)}function ce(e,t={}){let r=t.size,n=t.minLength||0,i=t.maxLength,o=t.depthIdentifier,s=i!==void 0?i:zr;return new J1(e,n,zi(r,n,s,i!==void 0),s,o,void 0,t.experimentalCustomSlices||[])}function ia(e){return e/O(2)}function mv(e,t,r){let n=e-t;function*i(){let s=r?void 0:t,a=r?n:ia(n);for(let l=a;l>0;l=ia(l)){let c=e-l;yield new $(c,s),s=c}}function*o(){let s=r?void 0:t,a=r?n:ia(n);for(let l=a;l<0;l=ia(l)){let c=e-l;yield new $(c,s),s=c}}return n>0?vr(i()):vr(o())}var qD=class Z1 extends he{constructor(t,r){super(),this.min=t,this.max=r}generate(t,r){let n=this.computeGenerateRange(t,r);return new $(t.nextBigInt(n.min,n.max),void 0)}computeGenerateRange(t,r){if(r===void 0||t.nextInt(1,r)!==1)return{min:this.min,max:this.max};let n=q1(this.min,this.max,TD);if(n.length===1)return n[0];let i=t.nextInt(-2*(n.length-1),n.length-2);return i<0?n[0]:n[i+1]}canShrinkWithoutContext(t){return typeof t=="bigint"&&this.min<=t&&t<=this.max}shrink(t,r){return Z1.isValidContext(t,r)?this.isLastChanceTry(t,r)?V.of(new $(r,void 0)):mv(t,r,!1):mv(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?O(0):this.min<0?this.max:this.min}isLastChanceTry(t,r){return t>0?t===r+O(1)&&t>this.min:t<0?t===r-O(1)&&t<this.max:!1}static isValidContext(t,r){if(r===void 0)return!1;if(typeof r!="bigint")throw new Error("Invalid context type passed to BigIntArbitrary (#1)");let n=t>0&&r<0||t<0&&r>0;if(r!==O(0)&&n)throw new Error("Invalid context value passed to BigIntArbitrary (#2)");return!0}};function KD(e){let r=O(-1)<<O(255),n=(O(1)<<O(255))-O(1),i=e.min,o=e.max;return{min:i!==void 0?i:r-(o!==void 0&&o<O(0)?o*o:O(0)),max:o!==void 0?o:n+(i!==void 0&&i>O(0)?i*i:O(0))}}function JD(e){return e[0]===void 0?{}:e[1]===void 0?e[0]:{min:e[0],max:e[1]}}function xr(...e){let t=KD(JD(e));if(t.min>t.max)throw new Error("fc.bigInt expects max to be greater than or equal to min");return new qD(t.min,t.max)}var YD=Object.getPrototypeOf,ji=class extends he{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 va(e){return YD(e)===ji.prototype&&e.generate===ji.prototype.generate&&e.canShrinkWithoutContext===ji.prototype.canShrinkWithoutContext&&e.shrink===ji.prototype.shrink?e:new ji(e)}function ZD(e){return e===1}function XD(e){if(typeof e!="boolean")throw new Error("Unsupported input type");return e===!0?1:0}function Ki(){return va(oe({min:0,max:1}).map(ZD,XD))}var Vi=Object.is,QD=class{constructor(e){this.values=e,this.fastValues=new En(this.values);let t=!1,r=!1;if(Sa(this.fastValues,0))for(let n=0;n!==this.values.length;++n){let i=this.values[n];t=t||Vi(i,-0),r=r||Vi(i,0)}this.hasMinusZero=t,this.hasPlusZero=r}has(e){return e===0?Vi(e,0)?this.hasPlusZero:this.hasMinusZero:Sa(this.fastValues,e)}},X1=class extends he{constructor(e){super(),this.values=e}generate(e,t){let r=this.values.length===1?0:e.nextInt(0,this.values.length-1),n=this.values[r];return Hr(n)?new $(n,r,()=>n[Ve]()):new $(n,r)}canShrinkWithoutContext(e){return this.values.length===1?Vi(this.values[0],e):(this.fastValues===void 0&&(this.fastValues=new QD(this.values)),this.fastValues.has(e))}shrink(e,t){return t===0||Vi(e,this.values[0])?V.nil():V.of(new $(this.values[0],0))}};function Nt(...e){if(e.length===0)throw new Error("fc.constantFrom expects at least one parameter");return new X1(e)}function e_(e){return!e||!e.withBigInt?Nt(!1,null,void 0,0,"",NaN):Nt(!1,null,void 0,0,"",NaN,O(0))}function Ie(e){return new X1([e])}var t_=class Q1{constructor(){this.receivedLogs=[]}log(t){this.receivedLogs.push(t)}size(){return this.receivedLogs.length}toString(){return JSON.stringify({logs:this.receivedLogs})}[Ve](){return new Q1}};function r_(){return Ie(new t_)}var n_=NaN,i_=Number.isNaN;function e0(e){return new ba(e)}function t0(e){if(!(e instanceof ba)||e.constructor!==ba)throw new N("Not a valid value for date unmapper");return wa(e)}function o_(e){return t=>t===e?new ba(n_):e0(t)}function s_(e){return t=>{let r=t0(t);return i_(r)?e:r}}var gv=Number.isNaN;function r0(e={}){let t=e.min!==void 0?wa(e.min):-864e13,r=e.max!==void 0?wa(e.max):864e13,n=e.noInvalidDate;if(gv(t))throw new Error("fc.date min must be valid instance of Date");if(gv(r))throw new Error("fc.date max must be valid instance of Date");if(t>r)throw new Error("fc.date max must be greater or equal to min");if(n)return oe({min:t,max:r}).map(e0,t0);let i=r+1;return oe({min:t,max:r+1}).map(o_(i),s_(i))}var a_=class extends he{constructor(e,t){super(),this.startArb=e,this.chainer=t}generate(e,t){let r=[],n=e.clone(),i=this.startArb.generate(e,t);for(r.push({arbitrary:this.startArb,value:i.value_,context:i.context,clonedMrng:n});;){let s=this.chainer(i.value_);if(s===void 0)break;let a=e.clone();i=s.generate(e,t),r.push({arbitrary:s,value:i.value_,context:i.context,clonedMrng:a})}let o={biasFactor:t,entries:r,currentShrinkLevel:0};return new $(i.value_,o)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?new V(this.shrinkIterator(t)):V.nil()}*shrinkIterator(e){let{entries:t,currentShrinkLevel:r,biasFactor:n}=e;for(let i=r;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 c=a,u=o.clonedMrng.clone();for(;;){let h=this.chainer(c.value_);if(h===void 0)break;let f=u.clone(),m=h.generate(u,n);l.push({arbitrary:h,value:m.value_,context:m.context,clonedMrng:f}),c=m}let d=l[l.length-1],p={biasFactor:n,entries:l,currentShrinkLevel:i};yield new $(d.value,p)}}}isSafeContext(e){return e!=null&&typeof e=="object"&&"biasFactor"in e&&"entries"in e&&"currentShrinkLevel"in e}};function l_(e,t){return new a_(e,t)}var c_=Symbol.iterator,u_=Array.isArray,d_=Object.is,p_=class n0 extends he{constructor(t,r){super(),this.arb=t,this.numValues=r}generate(t,r){let n=[];if(this.numValues<=0)return this.wrapper(n);for(let i=0;i!==this.numValues-1;++i)L(n,this.arb.generate(t.clone(),r));return L(n,this.arb.generate(t,r)),this.wrapper(n)}canShrinkWithoutContext(t){if(!u_(t)||t.length!==this.numValues)return!1;if(t.length===0)return!0;for(let r=1;r<t.length;++r)if(!d_(t[0],t[r]))return!1;return this.arb.canShrinkWithoutContext(t[0])}shrink(t,r){return t.length===0?V.nil():new V(this.shrinkImpl(t,r!==void 0?r:[])).map(n=>this.wrapper(n))}*shrinkImpl(t,r){let n=G(t,(o,s)=>this.arb.shrink(o,r[s])[c_]()),i=G(n,o=>o.next());for(;!i[0].done;)yield G(i,o=>o.value),i=G(n,o=>o.next())}static makeItCloneable(t,r){return t[Ve]=()=>{let n=[];for(let i=0;i!==r.length;++i)L(n,r[i].value);return this.makeItCloneable(n,r),n},t}wrapper(t){let r=!1,n=[],i=[];for(let o=0;o!==t.length;++o){let s=t[o];r=r||s.hasToBeCloned,L(n,s.value),L(i,s.context)}return r&&n0.makeItCloneable(n,t),new $(n,i)}};function f_(e,t){return new p_(e,t)}var yv=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 L(this.data,e),!0}size(){return this.data.length}getData(){return this.data}},h_=Number.isNaN,m_=class{constructor(e){this.selector=e,this.selectedItemsExceptNaN=new En,this.data=[]}tryAdd(e){let t=this.selector(e);if(h_(t))return L(this.data,e),!0;let r=this.selectedItemsExceptNaN.size;return Ui(this.selectedItemsExceptNaN,t),r!==this.selectedItemsExceptNaN.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},g_=Object.is,y_=class{constructor(e){this.selector=e,this.selectedItemsExceptMinusZero=new En,this.data=[],this.hasMinusZero=!1}tryAdd(e){let t=this.selector(e);if(g_(t,-0))return this.hasMinusZero?!1:(L(this.data,e),this.hasMinusZero=!0,!0);let r=this.selectedItemsExceptMinusZero.size;return Ui(this.selectedItemsExceptMinusZero,t),r!==this.selectedItemsExceptMinusZero.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},b_=class{constructor(e){this.selector=e,this.selectedItems=new En,this.data=[]}tryAdd(e){let t=this.selector(e),r=this.selectedItems.size;return Ui(this.selectedItems,t),r!==this.selectedItems.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}};function w_(e){if(typeof e.comparator=="function"){if(e.selector===void 0){let a=e.comparator,l=(c,u)=>a(c.value_,u.value_);return()=>new yv(l)}let n=e.comparator,i=e.selector,o=a=>i(a.value_),s=(a,l)=>n(o(a),o(l));return()=>new yv(s)}let t=e.selector||(n=>n),r=n=>t(n.value_);switch(e.comparator){case"IsStrictlyEqual":return()=>new m_(r);case"SameValueZero":return()=>new b_(r);case"SameValue":case void 0:return()=>new y_(r)}}function Gr(e,t={}){let r=t.minLength!==void 0?t.minLength:0,n=t.maxLength!==void 0?t.maxLength:zr,i=zi(t.size,r,n,t.maxLength!==void 0),o=t.depthIdentifier,s=new J1(e,r,i,n,o,w_(t),[]);return r===0?s:s.filter(a=>a.length>=r)}var S_=Object.create,v_=Object.defineProperty,x_=Object.getOwnPropertyDescriptor,bv=Object.getPrototypeOf,k_=Object.prototype,C_=Reflect.ownKeys;function R_(e){let t=e[1]?S_(null):{};for(let r of e[0])v_(t,r[0],{enumerable:!0,configurable:!0,writable:!0,value:r[1]});return t}function E_(e){return e!==void 0&&!!e.configurable&&!!e.enumerable&&!!e.writable&&e.get===void 0&&e.set===void 0}function I_(e){if(typeof e!="object"||e===null)throw new N("Incompatible instance received: should be a non-null object");let t=bv(e)===null,r=bv(e)===k_;if(!t&&!r)throw new N("Incompatible instance received: should be of exact type Object");let n=G(C_(e),i=>[i,x_(e,i)]);if(!k1(n,([,i])=>E_(i)))throw new N("Incompatible instance received: should contain only c/e/w properties without get/set");return[G(n,([i,o])=>[i,o.value]),t]}function A_(e){return e[0]}function zp(e,t,r={}){let n=!!r.noNullPrototype;return W(Gr(W(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:A_,depthIdentifier:r.depthIdentifier}),n?Ie(!1):Ki()).map(R_,I_)}var P_=Number.POSITIVE_INFINITY,T_=Number.MAX_SAFE_INTEGER,O_=Number.isInteger,M_=Math.floor,N_=Math.pow,L_=Math.min,pp=class i0 extends he{static from(t,r,n){if(t.length===0)throw new Error(`${n} 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(`${n} expects arbitraries to be specified`);let s=t[o].weight;if(i+=s,!O_(s))throw new Error(`${n} expects weights to be integer values`);if(s<0)throw new Error(`${n} expects weights to be superior or equal to 0`)}if(i<=0)throw new Error(`${n} expects the sum of weights to be strictly superior to 0`);return new i0(t,{depthBias:GD(r.depthSize,r.maxDepth!==void 0),maxDepth:r.maxDepth!==void 0?r.maxDepth:P_,withCrossShrink:!!r.withCrossShrink},Vp(r.depthIdentifier))}constructor(t,r,n){super(),this.warbs=t,this.constraints=r,this.context=n;let i=0;this.cumulatedWeights=[];for(let o=0;o!==t.length;++o)i+=t[o].weight,L(this.cumulatedWeights,i);this.totalWeight=i}generate(t,r){if(this.mustGenerateFirst())return this.safeGenerateForIndex(t,0,r);let n=t.nextInt(this.computeNegDepthBenefit(),this.totalWeight-1);for(let i=0;i!==this.cumulatedWeights.length;++i)if(n<this.cumulatedWeights[i])return this.safeGenerateForIndex(t,i,r);throw new Error("Unable to generate from fc.frequency")}canShrinkWithoutContext(t){return this.canShrinkWithoutContextIndex(t)!==-1}shrink(t,r){if(r!==void 0){let i=r,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 V.of(l).join(a)}return a}let n=this.canShrinkWithoutContextIndex(t);return n===-1?V.nil():this.defaultShrinkForFirst(n).join(this.warbs[n].arbitrary.shrink(t,void 0).map(i=>this.mapIntoValue(n,i,null,void 0)))}defaultShrinkForFirst(t){++this.context.depth;try{if(!this.mustFallbackToFirstInShrink(t)||this.warbs[0].fallbackValue===void 0)return V.nil()}finally{--this.context.depth}let r=new $(this.warbs[0].fallbackValue.default,void 0);return V.of(this.mapIntoValue(0,r,null,void 0))}canShrinkWithoutContextIndex(t){if(this.mustGenerateFirst())return this.warbs[0].arbitrary.canShrinkWithoutContext(t)?0:-1;try{++this.context.depth;for(let r=0;r!==this.warbs.length;++r){let n=this.warbs[r];if(n.weight!==0&&n.arbitrary.canShrinkWithoutContext(t))return r}return-1}finally{--this.context.depth}}mapIntoValue(t,r,n,i){let o={selectedIndex:t,originalBias:i,originalContext:r.context,clonedMrngForFallbackFirst:n};return new $(r.value,o)}safeGenerateForIndex(t,r,n){++this.context.depth;try{let i=this.warbs[r].arbitrary.generate(t,n),o=this.mustFallbackToFirstInShrink(r)?t.clone():null;return this.mapIntoValue(r,i,o,n)}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 r=M_(N_(1+t,this.context.depth))-1;return-L_(this.totalWeight*r,T_)||0}};function $_(e){return e!=null&&typeof e=="object"&&!("generate"in e)&&!("arbitrary"in e)&&!("weight"in e)}function wv(e){return p1(e)?{arbitrary:e,weight:1}:e}function Be(...e){let t=e[0];if($_(t)){let n=G(Ue(e,1),wv);return pp.from(n,t,"fc.oneof")}let r=G(e,wv);return pp.from(r,{},"fc.oneof")}var D_=Number.isInteger;function wr(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(!D_(t))throw new Error("fc.nat maximum value should be an integer");return new Pn(0,t)}var __=Object.is;function j_(e){let t=0,r=[];for(let n of e){let i=t;t=i+n.num;let o=t-1;r.push({from:i,to:o,entry:n})}return r}function F_(e,t){let r=0,n=e.length;for(;n-r>1;){let i=~~((r+n)/2);t<e[i].from?n=i:r=i}return e[r]}function B_(e){let t=j_(e);return function(n){let i=F_(t,n);return i.entry.build(n-i.from)}}function V_(e){let t={mapping:new Zt,negativeZeroIndex:void 0},r=0;for(let n=0;n!==e.length;++n){let i=e[n];for(let o=0;o!==i.num;++o){let s=i.build(o);s===0&&1/s===Yt.NEGATIVE_INFINITY?t.negativeZeroIndex=r:vt(t.mapping,s,r),++r}}return t}function U_(e){let t=null;return function(n){t===null&&(t=V_(e));let i=__(n,-0)?t.negativeZeroIndex:lt(t.mapping,n);if(i===void 0)throw new N("Unknown value encountered cannot be built using this mapToConstant");return i}}function W_(e){if(e.length===0)throw new N("fc.mapToConstant expects at least one option");let t=0;for(let r=0;r!==e.length;++r){if(e[r].num<0)throw new N("fc.mapToConstant expects all options to have a number of entries greater or equal to zero");t+=e[r].num}if(t===0)throw new N("fc.mapToConstant expects at least one choice among options");return t}function Tn(...e){return wr({max:W_(e)-1}).map(B_(e),U_(e))}function o0(e,t,r,n){if(t.length===0)return r>0?void 0:[];if(n<=0)return;let i=[{endIndexChunks:0,nextStartIndex:1,chunks:[]}];for(;i.length>0;){let o=S1(i);for(let s=o.nextStartIndex;s<=t.length;++s){let a=xe(t,o.endIndexChunks,s);if(e.canShrinkWithoutContext(a)){let l=[...o.chunks,a];if(s===t.length){if(l.length<r)break;return l}L(i,{endIndexChunks:o.endIndexChunks,nextStartIndex:s+1,chunks:o.chunks}),l.length<n&&L(i,{endIndexChunks:s,nextStartIndex:s+1,chunks:l});break}}}}function H_(e){return fe(e,"")}function s0(e){return e.minLength!==void 0?e.minLength:0}function a0(e){return e.maxLength!==void 0?e.maxLength:zr}function z_(e,t){return s0(t)<=e.length&&e.length<=a0(t)}function G_(e,t){return function(n){if(typeof n!="string")throw new N("Unsupported value");let i=o0(e,n,s0(t),a0(t));if(i===void 0)throw new N("Unable to unmap received string");return i}}var l0=["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","apply","arguments","bind","call","caller","length","name","prototype","key","ref"];function q_(e,t,r){let n;try{n=r(e)}catch{return}for(let i of n)if(!t.canShrinkWithoutContext(i))return;return n}function K_(e,t){let r=[];for(let n of l0){let i=q_(n,e,t);i!==void 0&&L(r,i)}return r}var Sv=new WeakMap;function J_(e){let t=[];for(let r of l0){let n=o0(e,r,0,zr);n!==void 0&&L(t,n)}return t}function Y_(e,t){let r=K4(Sv,e);r===void 0&&(r=J_(e),q4(Sv,e,r));let n=[];for(let i of r)z_(i,t)&&L(n,i);return n}var Z_=[[0,127]],X_=[[0,55295],[57344,1114111]],Q_=[[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]],ej=[[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]],vv=String.fromCodePoint,tj=Math.min,rj=Math.max;function fp(e){if(e.length===1){let r=vv(e[0]);return{num:1,build:()=>r}}let t=e[0];return{num:e[1]-e[0]+1,build:r=>vv(t+r)}}function xv(e,t){let r=[],n=0,i=0;for(;n<e.length&&i<t.length;){let o=e[n],s=o[0],a=o.length===1?o[0]:o[1],l=t[i],c=l[0],u=l.length===1?l[0]:l[1];if(a<c)n+=1;else if(u<s)i+=1;else{let d=rj(s,c),p=tj(a,u);if(r.length>=1){let h=r[r.length-1];(h.length===1?h[0]:h[1])+1===d&&(d=h[0],S1(r))}L(r,d===p?[d]:[d,p]),a<=p&&(n+=1),u<=p&&(i+=1)}}return r}var kv=Object.create(null);function nj(e){switch(e){case"full":return X_;case"ascii":return Z_}}function ij(e,t){let r=`${e}:${t}`,n=kv[r];if(n!==void 0)return n;let i=nj(t),o=e==="binary"?i:xv(i,Q_),s=[];for(let l of o)L(s,fp(l));if(e==="grapheme"){let l=xv(i,ej);for(let c of l){let u=fp(c);L(s,{num:u.num,build:d=>p3(u.build(d),"NFD")})}}let a=Tn(...s);return kv[r]=a,a}function Fi(e,t){return ij(e,t)}function oj(e){if(typeof e.unit=="object")return e.unit;switch(e.unit){case"grapheme":return Fi("grapheme","full");case"grapheme-composite":return Fi("composite","full");case"grapheme-ascii":case void 0:return Fi("grapheme","ascii");case"binary":return Fi("binary","full");case"binary-ascii":return Fi("binary","ascii")}}function Le(e={}){let t=oj(e),r=G_(t,e),n=Y_(t,e);return ce(t,{...e,experimentalCustomSlices:n}).map(H_,r)}var c0=Map,Gp=String.fromCharCode,qp={num:26,build:e=>Gp(e+97)},sj={num:26,build:e=>Gp(e+65)},u0={num:10,build:e=>Gp(e+48)};function aj(e){let t=R4(e);return e!==t?t:`%${Wi(In(e,0),16)}`}function lj(e){if(typeof e!="string")throw new Error("Unsupported");return decodeURIComponent(e)}var cj=()=>Le({unit:"binary",minLength:1,maxLength:1}).map(aj,lj),Wd;function uj(){return Wd===void 0&&(Wd=Tn(qp)),Wd}var oa;function hp(e){oa===void 0&&(oa=new c0);let t=lt(oa,e);return t===void 0&&(t=Tn(qp,u0,{num:e.length,build:r=>e[r]}),vt(oa,e,t)),t}function dj(e){return Tn(qp,sj,u0,{num:e.length,build:t=>e[t]})}var sa;function Kp(e){sa===void 0&&(sa=new c0);let t=lt(sa,e);return t===void 0&&(t=Be({weight:10,arbitrary:dj(e)},{weight:1,arbitrary:cj()}),vt(sa,e,t)),t}function Qt(e,t={}){let r=t.freq===void 0?6:t.freq,n=C1(t,"nil")?t.nil:null,i=[{arbitrary:Ie(n),weight:1,fallbackValue:{default:n}},{arbitrary:e,weight:r-1}],o={withCrossShrink:!0,depthSize:t.depthSize,maxDepth:t.maxDepth,depthIdentifier:t.depthIdentifier};return pp.from(i,o,"fc.option")}function pj(e){return e.length>63?!1:e.length<4||e[0]!=="x"||e[1]!=="n"||e[2]!=="-"||e[3]!=="-"}var d0=Symbol("adapted-value");function fj(e,t){let r=t(e.value_);return r.adapted?new $(r.value,d0):e}var hj=class extends he{constructor(e,t){super(),this.sourceArb=e,this.adapter=t,this.adaptValue=r=>fj(r,t)}generate(e,t){let r=this.sourceArb.generate(e,t);return this.adaptValue(r)}canShrinkWithoutContext(e){return this.sourceArb.canShrinkWithoutContext(e)&&!this.adapter(e).adapted}shrink(e,t){return t===d0?this.sourceArb.canShrinkWithoutContext(e)?this.sourceArb.shrink(e,void 0).map(this.adaptValue):V.nil():this.sourceArb.shrink(e,t).map(this.adaptValue)}};function p0(e,t){return new hj(e,t)}function mj([e,t]){return t===null?e:`${e}${t[0]}${t[1]}`}function gj(e){if(typeof e!="string"||e.length===0)throw new Error("Unsupported");return e.length===1?[e[0],null]:[e[0],[xe(e,1,e.length-1),e[e.length-1]]]}function yj(e){let t=hp("");return W(t,Qt(W(Le({unit:hp("-"),size:e,maxLength:61}),t))).map(mj,gj).filter(pj)}function bj(e){return`${fe(e[0],".")}.${e[1]}`}function wj(e){if(typeof e!="string")throw new Error("Unsupported type");let t=e.lastIndexOf(".");return[Xe(xe(e,0,t),"."),xe(e,t+1)]}function Sj(e){let[t,r]=e,n=r.length;for(let i=0;i!==t.length;++i)if(n+=1+t[i].length,n>255)return{adapted:!0,value:[Ue(t,0,i),r]};return{adapted:!1,value:e}}function Jp(e={}){let t=Hp(e.size),r=qi("-1",t),n=Le({unit:uj(),minLength:2,maxLength:63,size:r});return p0(W(ce(yj(t),{size:r,minLength:1,maxLength:127}),n),Sj).map(bj,wj)}function vj(e){let t=e[0].length;for(let r=1;r!==e.length;++r)if(t+=1+e[r].length,t>64)return{adapted:!0,value:Ue(e,0,r)};return{adapted:!1,value:e}}function xj(e){return fe(e,".")}function kj(e){if(typeof e!="string")throw new Error("Unsupported");return Xe(e,".")}function Cj(e){return`${e[0]}@${e[1]}`}function Rj(e){if(typeof e!="string")throw new Error("Unsupported");return Xe(e,"@",2)}function Ej(e={}){return W(p0(ce(Le({unit:hp("!#$%&'*+-/=?^_`{|}~"),minLength:1,maxLength:64,size:e.size}),{minLength:1,maxLength:32,size:e.size}),vj).map(xj,kj),Jp({size:e.size})).map(Cj,Rj)}var Ij=Yt.NEGATIVE_INFINITY,mp=Yt.POSITIVE_INFINITY,f0=Yt.EPSILON,Yp=O(2146435072)*O(4294967296),Aj=-Yp-O(1),Cv=4503599627370496,Pj=O(0xfffffffffffff),Rv=O("9007199254740992"),gp=new Float64Array(1),Ev=new Uint32Array(gp.buffer,gp.byteOffset);function Tj(e){return gp[0]=e,[Ev[1],Ev[0]]}function Oj(e){let{0:t,1:r}=Tj(e),n=t>>>31,i=t>>>20&2047,o=(t&1048575)*4294967296+r,s=i===0?-1022:i-1023,a=i===0?0:1;return a+=o*f0,a*=n===0?1:-1,{exponent:s,significand:a}}function Iv(e,t){return e===-1022?O(t*Cv):O((t-1)*Cv)+(O(e+1023)<<O(52))}function Zp(e){if(e===mp)return Yp;if(e===Ij)return Aj;let t=Oj(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===mp?Iv(r,n):-Iv(r,-n)-O(1)}function yp(e){if(e<0)return-yp(-e-O(1));if(e===Yp)return mp;if(e<Rv)return Yt(e)*2**-1074;let t=e-Rv,r=-1021+Yt(t>>O(52));return(1+Yt(t&Pj)*f0)*2**r}var Av=Number.isInteger,Pv=Object.is,Hd=Number.NEGATIVE_INFINITY,zd=Number.POSITIVE_INFINITY;function h0(e,t,r,n){let{noDefaultInfinity:i=!1,minExcluded:o=!1,maxExcluded:s=!1,min:a=i?-t:Hd,max:l=i?t:zd}=e,c=o?a<-r?-n:Math.max(a,-r):a===Hd?Math.max(a,-n):Math.max(a,-r),u=s?l>r?n:Math.min(l,r):l===zd?Math.min(l,n):Math.min(l,r);return{noDefaultInfinity:!1,minExcluded:o||(a!==Hd||o)&&Av(c),maxExcluded:s||(l!==zd||s)&&Av(u),min:Pv(c,-0)?0:c,max:Pv(u,0)?-0:u,noNaN:e.noNaN||!1}}var m0=Number.NEGATIVE_INFINITY,g0=Number.POSITIVE_INFINITY,Mj=Number.MAX_VALUE,Nj=45035996273704955e-1,bp=4503599627370496;function Lj(e){return h0(e,Mj,Nj,bp)}function $j(e){return e===4503599627370496?g0:e===-4503599627370496?m0:e}function Dj(e){if(typeof e!="number")throw new Error("Unsupported type");return e===g0?bp:e===m0?-bp:e}var _j=Number.isInteger,y0=Number.isNaN,jj=Number.NEGATIVE_INFINITY,Fj=Number.POSITIVE_INFINITY,Tv=Number.MAX_VALUE,Bj=NaN;function Ov(e,t){if(y0(e))throw new Error("fc.double constraints."+t+" must be a 64-bit float");return Zp(e)}function Vj(e){if(typeof e!="number")throw new Error("Unsupported type");return Zp(e)}function Uj(e){return!_j(e)}function Mv(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:i=!1,min:o=t?-Tv:jj,max:s=t?Tv:Fj}=e,a=Ov(o,"min"),l=n?a+O(1):a,c=Ov(s,"max"),u=i?c-O(1):c;if(u<l)throw new Error("fc.double constraints.min must be smaller or equal to constraints.max");if(r)return xr({min:l,max:u}).map(yp,Vj);let d=u>O(0),p=d?l:l-O(1),h=d?u+O(1):u;return xr({min:p,max:h}).map(f=>u<f||f<l?Bj:yp(f),f=>{if(typeof f!="number")throw new Error("Unsupported type");return y0(f)?u!==h?h:p:Zp(f)})}function Ra(e={}){return e.noInteger?Mv(Lj(e)).map($j,Dj).filter(Uj):Mv(e)}var Wj=Number.NEGATIVE_INFINITY,wp=Number.POSITIVE_INFINITY,Hj=Math.imul,Sp=2**127*(1+(2**23-1)/2**23),b0=2139095040,zj=-2139095041,vp=new Float32Array(1),Gj=new Uint32Array(vp.buffer,vp.byteOffset);function qj(e){return vp[0]=e,Gj[0]}function Kj(e){let t=qj(e),r=t>>>31,n=t>>>23&255,i=t&8388607,o=n===0?-126:n-127,s=n===0?0:1;return s+=i/2**23,s*=r===0?1:-1,{exponent:o,significand:s}}function Nv(e,t){return e===-126?t*8388608:Hj(e+127,8388608)+(t-1)*8388608}function Xp(e){if(e===wp)return b0;if(e===Wj)return zj;let t=Kj(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===wp?Nv(r,n):-Nv(r,-n)-1}function xp(e){if(e<0)return-xp(-e-1);if(e===b0)return wp;if(e<16777216)return e*2**-149;let t=e-16777216,r=-125+(t>>23);return(1+(t&8388607)/8388608)*2**r}var w0=Number.NEGATIVE_INFINITY,S0=Number.POSITIVE_INFINITY,Jj=Sp,Yj=83886075e-1,kp=8388608;function Zj(e){return h0(e,Jj,Yj,kp)}function Xj(e){return e===8388608?S0:e===-8388608?w0:e}function Qj(e){if(typeof e!="number")throw new Error("Unsupported type");return e===S0?kp:e===w0?-kp:e}var e8=Number.isInteger,v0=Number.isNaN,t8=Math.fround,r8=Number.NEGATIVE_INFINITY,n8=Number.POSITIVE_INFINITY,i8=NaN;function Lv(e,t){let r="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(v0(e)||t8(e)!==e)throw new Error(r);return Xp(e)}function o8(e){if(typeof e!="number")throw new Error("Unsupported type");return Xp(e)}function s8(e){return!e8(e)}function $v(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:i=!1,min:o=t?-Sp:r8,max:s=t?Sp:n8}=e,a=Lv(o,"min"),l=n?a+1:a,c=Lv(s,"max"),u=i?c-1:c;if(l>u)throw new Error("fc.float constraints.min must be smaller or equal to constraints.max");if(r)return oe({min:l,max:u}).map(xp,o8);let d=u>0?l:l-1,p=u>0?u+1:u;return oe({min:d,max:p}).map(h=>h>u||h<l?i8:xp(h),h=>{if(typeof h!="number")throw new Error("Unsupported type");return v0(h)?u!==p?p:d:Xp(h)})}function x0(e={}){return e.noInteger?$v(Zj(e)).map(Xj,Qj).filter(s8):$v(e)}function a8(e){return e.replace(/([$`\\])/g,"\\$1").replace(/\r/g,"\\r")}function k0(e){return e.replace(/\*\//g,"*\\/")}var st=[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 xa(e){let t=4294967295;for(let r=0;r<e.length;++r){let n=In(e,r);if(n<128)t=st[t&255^n]^t>>8;else if(n<2048)t=st[t&255^(192|n>>6&31)]^t>>8,t=st[t&255^(128|n&63)]^t>>8;else if(n>=55296&&n<57344){let i=In(e,++r);if(n>=56320||i<56320||i>57343||Number.isNaN(i))r-=1,t=st[t&255^239]^t>>8,t=st[t&255^191]^t>>8,t=st[t&255^189]^t>>8;else{let o=(n&1023)+64,s=i&1023;t=st[t&255^(240|o>>8&7)]^t>>8,t=st[t&255^(128|o>>2&63)]^t>>8,t=st[t&255^(128|s>>6&15|(o&3)<<4)]^t>>8,t=st[t&255^(128|s&63)]^t>>8}}else t=st[t&255^(224|n>>12&15)]^t>>8,t=st[t&255^(128|n>>6&63)]^t>>8,t=st[t&255^(128|n&63)]^t>>8}return(t|0)+2147483648}var l8=Object.getPrototypeOf,Bi=class extends he{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 V.nil()}};function ka(e){return l8(e)===Bi.prototype&&e.generate===Bi.prototype.generate&&e.canShrinkWithoutContext===Bi.prototype.canShrinkWithoutContext&&e.shrink===Bi.prototype.shrink?e:new Bi(e)}var c8=Object.assign,u8=Object.keys;function C0(e){return W(ka(oe()),ka(oe({min:1,max:4294967295}))).map(([t,r])=>{let n=()=>{let i={};return c8((s,a)=>{let l=Ae(s),c=Ae(a),u=e(xa(`${t}${l}`)%r,xa(`${t}${c}`)%r);return i[`[${l},${c}]`]=u,u},{toString:()=>{let s=u8(i).sort().map(a=>`${a} => ${Ae(i[a])}`).map(a=>`/* ${k0(a)} */`);return`function(a, b) {
|
|
193
|
+
${hD(i)}`),o}function U1(e){return up(e,Ae)}async function W1(e){let t=[];function r(s){let a=$1(s);return typeof a=="string"?a:(t.push(Promise.all([s,a])),"\u2026")}let n=up(e,r);if(t.length===0)return n;let i=new Zt(await Promise.all(t));function o(s){let a=lt(i,s);return a!==void 0?a:Ae(s)}return up(e,o)}function H1(e,t){if(t.runConfiguration.includeErrorInReport)throw new N(e);let r=new N(e,{cause:t.errorInstance});return"cause"in r||fD(r,{cause:t.errorInstance}),r}function SD(e){if(e.failed)throw H1(U1(e),e)}async function vD(e){if(e.failed)throw H1(await W1(e),e)}function xD(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):SD(e)}async function kD(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):vD(e)}function CD(e,t,r,n,i){let o=new _1(r,t,n,i);for(let s of o){e.runBeforeEach();let a=e.run(s);e.runAfterEach(),o.handleResult(a)}return o.runExecution}async function RD(e,t,r,n,i){let o=new _1(r,t,n,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 z1(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 r=$p({...kt(),...t});if(r.reporter!==void 0&&r.asyncReporter!==void 0)throw new Error("Invalid parameters encountered, reporter and asyncReporter cannot be specified together");if(r.asyncReporter!==void 0&&!e.isAsync())throw new Error("Invalid parameters encountered, only asyncProperty can be used when asyncReporter specified");let n=nD(e,r),i=r.path.length===0||r.path.indexOf(":")===-1?r.numRuns:-1,o=r.numRuns*r.maxSkipsPerRun,s=(...c)=>n.shrink(...c),a=new sD(r.path.length===0?F1(n,r.seed,r.randomType,r.examples):V1(r.path,vr(B1(n,r.seed,r.randomType,r.examples)),s),i,o),l=r.endOnFailure?V.nil:s;return n.isAsync()?RD(n,l,a,r.verbose,r.markInterruptAsFailure).then(c=>c.toRunDetails(r.seed,r.path,o,r)):CD(n,l,a,r.verbose,r.markInterruptAsFailure).toRunDetails(r.seed,r.path,o,r)}function ED(e,t){let r=z1(e,t);if(e.isAsync())return r.then(kD);xD(r)}function ID(e,t){let r=Object.prototype.hasOwnProperty.call(e,"isAsync")?e:new M1(e,()=>!0);return t.unbiased===!0?new L1(r):r}function G1(e,t){let r=$p(typeof t=="number"?{...kt(),numRuns:t}:{...kt(),...t}),n=ID(e,r),i=n.shrink.bind(n);return(r.path.length===0?vr(F1(n,r.seed,r.randomType,r.examples)):V1(r.path,vr(B1(n,r.seed,r.randomType,r.examples)),i)).take(r.numRuns).map(o=>o.value_)}function AD(e,t){return[...G1(e,t)]}function PD(e){return(Math.round(e*100)/100).toFixed(2)}function TD(e,t,r){let n=$p(typeof r=="number"?{...kt(),numRuns:r}:{...kt(),...r}),i={};for(let l of G1(e,r)){let c=t(l),u=Array.isArray(c)?c:[c];for(let d of u)i[d]=(i[d]||0)+1}let o=Object.entries(i).sort((l,c)=>c[1]-l[1]).map(l=>[l[0],`${PD(l[1]*100/n.numRuns)}%`]),s=o.map(l=>l[0].length).reduce((l,c)=>Math.max(l,c),0),a=o.map(l=>l[1].length).reduce((l,c)=>Math.max(l,c),0);for(let l of o)n.logger(`${l[0].padEnd(s,".")}..${l[1].padStart(a,".")}`)}var OD=Object.assign;function dp(e,t,r,n){let i=r(),o=e.clone(),s={mrng:e.clone(),biasFactor:t,history:[]},a=c=>{let u=i[s.history.length];if(u!==void 0&&u.arb===c){let p=u.value;return L(s.history,{arb:c,value:p,context:u.context,mrng:u.mrng}),o=u.mrng.clone(),p}let d=c.generate(o,t);return L(s.history,{arb:c,value:d.value_,context:d.context,mrng:o.clone()}),d.value},l=(c,...u)=>a(n(c,u));return new $(OD(l,{values(){return G(s.history,c=>c.value)},[Ve](){return dp(e,t,r,n).value},[Ct](){return Ae(G(s.history,c=>c.value))}}),s)}var Vd=Array.isArray,ov=Object.keys,MD=Object.is;function ND(e){let t=new Zt;return function(n,i){let o=lt(t,n);if(o===void 0){let l=n(...i);return xt(t,n,[{args:i,value:l}]),l}let s=o;for(let l of s)if(e(i,l.args))return l.value;let a=n(...i);return L(s,{args:i,value:a}),a}}function q1(e,t){if(e!==null&&typeof e=="object"&&t!==null&&typeof t=="object"){if(Vd(e)){if(!Vd(t)||e.length!==t.length)return!1}else if(Vd(t))return!1;if(ov(e).length!==ov(t).length)return!1;for(let r in e)if(!(r in t)||!q1(e[r],t[r]))return!1;return!0}else return MD(e,t)}var LD=class extends me{constructor(...e){super(...e),this.arbitraryCache=ND(q1)}generate(e,t){return dp(e,t,()=>[],this.arbitraryCache)}canShrinkWithoutContext(e){return!1}shrink(e,t){if(t===void 0)return V.nil();let r=t,n=r.mrng,i=r.biasFactor,o=r.history;return P1(o.map(s=>s.arb),o.map(s=>s.value),o.map(s=>s.context)).map(s=>{function a(){let l=s.value,c=s.context;return G(o,(u,d)=>({arb:u.arb,value:l[d],context:c[d],mrng:u.mrng}))}return dp(n,i,a,this.arbitraryCache)})}};function $D(){return new LD}var DD=Math.floor,sv=Math.log;function _D(e){return DD(sv(e)/sv(2))}function jD(e){return e===O(0)?O(0):O(Ze(e).length)}function K1(e,t,r){if(e===t)return[{min:e,max:t}];if(e<0&&t>0){let s=r(-e),a=r(t);return[{min:-s,max:a},{min:t-a,max:t},{min:e,max:e+s}]}let n=r(t-e),i={min:e,max:e+n},o={min:t-n,max:t};return e<0?[o,i]:[i,o]}var FD=Math.ceil,BD=Math.floor;function av(e){return BD(e/2)}function lv(e){return FD(e/2)}function cv(e,t,r){let n=e-t;function*i(){let s=r?void 0:t,a=r?n:av(n);for(let l=a;l>0;l=av(l)){let c=l===n?t:e-l;yield new $(c,s),s=c}}function*o(){let s=r?void 0:t,a=r?n:lv(n);for(let l=a;l<0;l=lv(l)){let c=l===n?t:e-l;yield new $(c,s),s=c}}return n>0?vr(i()):vr(o())}var uv=Math.sign,VD=Number.isInteger,UD=Object.is,Pn=class J1 extends me{constructor(t,r){super(),this.min=t,this.max=r}generate(t,r){let n=this.computeGenerateRange(t,r);return new $(t.nextInt(n.min,n.max),void 0)}canShrinkWithoutContext(t){return typeof t=="number"&&VD(t)&&!UD(t,-0)&&this.min<=t&&t<=this.max}shrink(t,r){return J1.isValidContext(t,r)?this.isLastChanceTry(t,r)?V.of(new $(r,void 0)):cv(t,r,!1):cv(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?0:this.min<0?this.max:this.min}computeGenerateRange(t,r){if(r===void 0||t.nextInt(1,r)!==1)return{min:this.min,max:this.max};let n=K1(this.min,this.max,_D);if(n.length===1)return n[0];let i=t.nextInt(-2*(n.length-1),n.length-2);return i<0?n[0]:n[i+1]}isLastChanceTry(t,r){return t>0?t===r+1&&t>this.min:t<0?t===r-1&&t<this.max:!1}static isValidContext(t,r){if(r===void 0)return!1;if(typeof r!="number")throw new Error("Invalid context type passed to IntegerArbitrary (#1)");if(r!==0&&uv(t)!==uv(r))throw new Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}},dv=Number.isInteger;function WD(e){return{min:e.min!==void 0?e.min:-2147483648,max:e.max!==void 0?e.max:2147483647}}function oe(e={}){let t=WD(e);if(t.min>t.max)throw new Error("fc.integer maximum value should be equal or greater than the minimum one");if(!dv(t.min))throw new Error("fc.integer minimum value should be an integer");if(!dv(t.max))throw new Error("fc.integer maximum value should be an integer");return new Pn(t.min,t.max)}var pv=new Map;function Vp(e){if(e===void 0)return{depth:0};if(typeof e!="string")return e;let t=lt(pv,e);if(t!==void 0)return t;let r={depth:0};return xt(pv,e,r),r}function Up(){return{depth:0}}var HD=class{constructor(e,t,r){this.arb=e,this.mrng=t,this.biasFactor=r}attemptExact(){}next(){return this.arb.generate(this.mrng,this.biasFactor)}},zD=Math.min,GD=Math.max,qD=class{constructor(e,t,r,n){this.arb=e,this.mrng=t,this.slices=r,this.biasFactor=n,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 r=0;r!==this.slices.length;++r)this.slices[r].length===e&&L(t,r);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 $(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 $(e[0],void 0);let t=this.mrng.nextInt(0,e.length-1),r=this.mrng.nextInt(0,e.length-1);return this.nextIndexInSlice=zD(t,r),this.lastIndexInSlice=GD(t,r),new $(e[this.nextIndexInSlice++],void 0)}};function fv(e,t,r,n){return n===void 0||r.length===0||t.nextInt(1,n)!==1?new HD(e,t,n):new qD(e,t,r,n)}var KD=Math.floor,hv=Math.log,mv=Math.max,JD=Array.isArray;function Ud(e,t){return e===t?e:e+KD(hv(t-e)/hv(2))}var Y1=class Z1 extends me{constructor(t,r,n,i,o,s,a){super(),this.arb=t,this.minLength=r,this.maxGeneratedLength=n,this.maxLength=i,this.setBuilder=s,this.customSlices=a,this.lengthArb=oe({min:r,max:n}),this.depthContext=Vp(o)}preFilter(t){if(this.setBuilder===void 0)return t;let r=this.setBuilder();for(let n=0;n!==t.length;++n)r.tryAdd(t[n]);return r.getData()}static makeItCloneable(t,r){return t[Ve]=()=>{let n=[];for(let i=0;i!==r.length;++i)L(n,r[i].value);return this.makeItCloneable(n,r),n},t}generateNItemsNoDuplicates(t,r,n,i){let o=0,s=t(),a=fv(this.arb,n,this.customSlices,i);for(;s.size()<r&&o<this.maxGeneratedLength;){let l=a.next();s.tryAdd(l)?o=0:o+=1}return s.getData()}safeGenerateNItemsNoDuplicates(t,r,n,i){let o=mv(0,r-Ud(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=o;try{return this.generateNItemsNoDuplicates(t,r,n,i)}finally{this.depthContext.depth-=o}}generateNItems(t,r,n){let i=[],o=fv(this.arb,r,this.customSlices,n);o.attemptExact(t);for(let s=0;s!==t;++s)L(i,o.next());return i}safeGenerateNItems(t,r,n){let i=mv(0,t-Ud(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=i;try{return this.generateNItems(t,r,n)}finally{this.depthContext.depth-=i}}wrapper(t,r,n,i){let o=r?this.preFilter(t):t,s=!1,a=[],l=[];for(let c=0;c!==o.length;++c){let u=o[c];s=s||u.hasToBeCloned,L(a,u.value),L(l,u.context)}return s&&Z1.makeItCloneable(a,o),new $(a,{shrunkOnce:r,lengthContext:t.length===o.length&&n!==void 0?n:void 0,itemsContexts:l,startIndex:i})}generate(t,r){let n=this.applyBias(t,r),i=n.size,o=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,i,t,n.biasFactorItems):this.safeGenerateNItems(i,t,n.biasFactorItems);return this.wrapper(o,!1,void 0,0)}applyBias(t,r){if(r===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:r};if(t.nextInt(1,r)!==1)return{size:this.lengthArb.generate(t,void 0).value};if(t.nextInt(1,r)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(t,void 0).value,biasFactorItems:r};let n=Ud(this.minLength,this.maxGeneratedLength);return{size:oe({min:this.minLength,max:n}).generate(t,void 0).value,biasFactorItems:r}}canShrinkWithoutContext(t){if(!JD(t)||this.minLength>t.length||t.length>this.maxLength)return!1;for(let r=0;r!==t.length;++r)if(!(r in t)||!this.arb.canShrinkWithoutContext(t[r]))return!1;return this.preFilter(G(t,r=>new $(r,void 0))).length===t.length}shrinkItemByItem(t,r,n){let i=[];for(let o=r.startIndex;o<n;++o)L(i,Sr(()=>this.arb.shrink(t[o],r.itemsContexts[o]).map(s=>{let a=G(Ue(t,0,o),(c,u)=>new $(Rn(c),r.itemsContexts[u])),l=G(Ue(t,o+1),(c,u)=>new $(Rn(c),r.itemsContexts[u+o+1]));return[[...a,s,...l],void 0,o]})));return V.nil().join(...i)}shrinkImpl(t,r){if(t.length===0)return V.nil();let n=r!==void 0?r:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(t.length,n.lengthContext).drop(n.shrunkOnce&&n.lengthContext===void 0&&t.length>this.minLength+1?1:0).map(i=>{let o=t.length-i.value;return[G(Ue(t,o),(s,a)=>new $(Rn(s),n.itemsContexts[a+o])),i.context,0]}).join(Sr(()=>t.length>this.minLength?this.shrinkItemByItem(t,n,1):this.shrinkItemByItem(t,n,t.length))).join(t.length>this.minLength?Sr(()=>{let i={shrunkOnce:!1,lengthContext:void 0,itemsContexts:Ue(n.itemsContexts,1),startIndex:0};return this.shrinkImpl(Ue(t,1),i).filter(o=>this.minLength<=o[0].length+1).map(o=>[[new $(Rn(t[0]),n.itemsContexts[0]),...o[0]],void 0,0])}):V.nil())}shrink(t,r){return this.shrinkImpl(t,r).map(n=>this.wrapper(n[0],!0,n[1],n[2]))}},YD=Math.floor,ZD=Math.min,zr=2147483647,xn=["xsmall","small","medium","large","xlarge"],XD=["-4","-3","-2","-1","=","+1","+2","+3","+4"],Wp="small";function QD(e,t){switch(t){case"xsmall":return YD(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 qi(e,t){let r=Jt(XD,e);if(r===-1)return e;let n=Jt(xn,t);if(n===-1)throw new Error(`Unable to offset size based on the unknown defaulted one: ${t}`);let i=n+r-4;return i<0?xn[0]:i>=xn.length?xn[xn.length-1]:xn[i]}function zi(e,t,r,n){let{baseSize:i=Wp,defaultSizeToMaxWhenMaxSpecified:o}=kt()||{},s=e!==void 0?e:n&&o?"max":i;return s==="max"?r:ZD(QD(t,qi(s,i)),r)}function e_(e,t){if(typeof e=="number")return 1/e;let{baseSize:r=Wp,defaultSizeToMaxWhenMaxSpecified:n}=kt()||{},i=e!==void 0?e:t&&n?"max":r;if(i==="max")return 0;switch(qi(i,r)){case"xsmall":return 1;case"small":return .5;case"medium":return .25;case"large":return .125;case"xlarge":return .0625}}function Hp(e){let{baseSize:t=Wp}=kt()||{};return e===void 0?t:qi(e,t)}function ce(e,t={}){let r=t.size,n=t.minLength||0,i=t.maxLength,o=t.depthIdentifier,s=i!==void 0?i:zr;return new Y1(e,n,zi(r,n,s,i!==void 0),s,o,void 0,t.experimentalCustomSlices||[])}function ia(e){return e/O(2)}function gv(e,t,r){let n=e-t;function*i(){let s=r?void 0:t,a=r?n:ia(n);for(let l=a;l>0;l=ia(l)){let c=e-l;yield new $(c,s),s=c}}function*o(){let s=r?void 0:t,a=r?n:ia(n);for(let l=a;l<0;l=ia(l)){let c=e-l;yield new $(c,s),s=c}}return n>0?vr(i()):vr(o())}var t_=class X1 extends me{constructor(t,r){super(),this.min=t,this.max=r}generate(t,r){let n=this.computeGenerateRange(t,r);return new $(t.nextBigInt(n.min,n.max),void 0)}computeGenerateRange(t,r){if(r===void 0||t.nextInt(1,r)!==1)return{min:this.min,max:this.max};let n=K1(this.min,this.max,jD);if(n.length===1)return n[0];let i=t.nextInt(-2*(n.length-1),n.length-2);return i<0?n[0]:n[i+1]}canShrinkWithoutContext(t){return typeof t=="bigint"&&this.min<=t&&t<=this.max}shrink(t,r){return X1.isValidContext(t,r)?this.isLastChanceTry(t,r)?V.of(new $(r,void 0)):gv(t,r,!1):gv(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?O(0):this.min<0?this.max:this.min}isLastChanceTry(t,r){return t>0?t===r+O(1)&&t>this.min:t<0?t===r-O(1)&&t<this.max:!1}static isValidContext(t,r){if(r===void 0)return!1;if(typeof r!="bigint")throw new Error("Invalid context type passed to BigIntArbitrary (#1)");let n=t>0&&r<0||t<0&&r>0;if(r!==O(0)&&n)throw new Error("Invalid context value passed to BigIntArbitrary (#2)");return!0}};function r_(e){let r=O(-1)<<O(255),n=(O(1)<<O(255))-O(1),i=e.min,o=e.max;return{min:i!==void 0?i:r-(o!==void 0&&o<O(0)?o*o:O(0)),max:o!==void 0?o:n+(i!==void 0&&i>O(0)?i*i:O(0))}}function n_(e){return e[0]===void 0?{}:e[1]===void 0?e[0]:{min:e[0],max:e[1]}}function xr(...e){let t=r_(n_(e));if(t.min>t.max)throw new Error("fc.bigInt expects max to be greater than or equal to min");return new t_(t.min,t.max)}var i_=Object.getPrototypeOf,ji=class extends me{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 va(e){return i_(e)===ji.prototype&&e.generate===ji.prototype.generate&&e.canShrinkWithoutContext===ji.prototype.canShrinkWithoutContext&&e.shrink===ji.prototype.shrink?e:new ji(e)}function o_(e){return e===1}function s_(e){if(typeof e!="boolean")throw new Error("Unsupported input type");return e===!0?1:0}function Ki(){return va(oe({min:0,max:1}).map(o_,s_))}var Vi=Object.is,a_=class{constructor(e){this.values=e,this.fastValues=new En(this.values);let t=!1,r=!1;if(Sa(this.fastValues,0))for(let n=0;n!==this.values.length;++n){let i=this.values[n];t=t||Vi(i,-0),r=r||Vi(i,0)}this.hasMinusZero=t,this.hasPlusZero=r}has(e){return e===0?Vi(e,0)?this.hasPlusZero:this.hasMinusZero:Sa(this.fastValues,e)}},Q1=class extends me{constructor(e){super(),this.values=e}generate(e,t){let r=this.values.length===1?0:e.nextInt(0,this.values.length-1),n=this.values[r];return Hr(n)?new $(n,r,()=>n[Ve]()):new $(n,r)}canShrinkWithoutContext(e){return this.values.length===1?Vi(this.values[0],e):(this.fastValues===void 0&&(this.fastValues=new a_(this.values)),this.fastValues.has(e))}shrink(e,t){return t===0||Vi(e,this.values[0])?V.nil():V.of(new $(this.values[0],0))}};function Lt(...e){if(e.length===0)throw new Error("fc.constantFrom expects at least one parameter");return new Q1(e)}function l_(e){return!e||!e.withBigInt?Lt(!1,null,void 0,0,"",NaN):Lt(!1,null,void 0,0,"",NaN,O(0))}function Ie(e){return new Q1([e])}var c_=class e0{constructor(){this.receivedLogs=[]}log(t){this.receivedLogs.push(t)}size(){return this.receivedLogs.length}toString(){return JSON.stringify({logs:this.receivedLogs})}[Ve](){return new e0}};function u_(){return Ie(new c_)}var d_=NaN,p_=Number.isNaN;function t0(e){return new ba(e)}function r0(e){if(!(e instanceof ba)||e.constructor!==ba)throw new N("Not a valid value for date unmapper");return wa(e)}function f_(e){return t=>t===e?new ba(d_):t0(t)}function h_(e){return t=>{let r=r0(t);return p_(r)?e:r}}var yv=Number.isNaN;function n0(e={}){let t=e.min!==void 0?wa(e.min):-864e13,r=e.max!==void 0?wa(e.max):864e13,n=e.noInvalidDate;if(yv(t))throw new Error("fc.date min must be valid instance of Date");if(yv(r))throw new Error("fc.date max must be valid instance of Date");if(t>r)throw new Error("fc.date max must be greater or equal to min");if(n)return oe({min:t,max:r}).map(t0,r0);let i=r+1;return oe({min:t,max:r+1}).map(f_(i),h_(i))}var m_=class extends me{constructor(e,t){super(),this.startArb=e,this.chainer=t}generate(e,t){let r=[],n=e.clone(),i=this.startArb.generate(e,t);for(r.push({arbitrary:this.startArb,value:i.value_,context:i.context,clonedMrng:n});;){let s=this.chainer(i.value_);if(s===void 0)break;let a=e.clone();i=s.generate(e,t),r.push({arbitrary:s,value:i.value_,context:i.context,clonedMrng:a})}let o={biasFactor:t,entries:r,currentShrinkLevel:0};return new $(i.value_,o)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?new V(this.shrinkIterator(t)):V.nil()}*shrinkIterator(e){let{entries:t,currentShrinkLevel:r,biasFactor:n}=e;for(let i=r;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 c=a,u=o.clonedMrng.clone();for(;;){let h=this.chainer(c.value_);if(h===void 0)break;let f=u.clone(),m=h.generate(u,n);l.push({arbitrary:h,value:m.value_,context:m.context,clonedMrng:f}),c=m}let d=l[l.length-1],p={biasFactor:n,entries:l,currentShrinkLevel:i};yield new $(d.value,p)}}}isSafeContext(e){return e!=null&&typeof e=="object"&&"biasFactor"in e&&"entries"in e&&"currentShrinkLevel"in e}};function g_(e,t){return new m_(e,t)}var y_=Symbol.iterator,b_=Array.isArray,w_=Object.is,S_=class i0 extends me{constructor(t,r){super(),this.arb=t,this.numValues=r}generate(t,r){let n=[];if(this.numValues<=0)return this.wrapper(n);for(let i=0;i!==this.numValues-1;++i)L(n,this.arb.generate(t.clone(),r));return L(n,this.arb.generate(t,r)),this.wrapper(n)}canShrinkWithoutContext(t){if(!b_(t)||t.length!==this.numValues)return!1;if(t.length===0)return!0;for(let r=1;r<t.length;++r)if(!w_(t[0],t[r]))return!1;return this.arb.canShrinkWithoutContext(t[0])}shrink(t,r){return t.length===0?V.nil():new V(this.shrinkImpl(t,r!==void 0?r:[])).map(n=>this.wrapper(n))}*shrinkImpl(t,r){let n=G(t,(o,s)=>this.arb.shrink(o,r[s])[y_]()),i=G(n,o=>o.next());for(;!i[0].done;)yield G(i,o=>o.value),i=G(n,o=>o.next())}static makeItCloneable(t,r){return t[Ve]=()=>{let n=[];for(let i=0;i!==r.length;++i)L(n,r[i].value);return this.makeItCloneable(n,r),n},t}wrapper(t){let r=!1,n=[],i=[];for(let o=0;o!==t.length;++o){let s=t[o];r=r||s.hasToBeCloned,L(n,s.value),L(i,s.context)}return r&&i0.makeItCloneable(n,t),new $(n,i)}};function v_(e,t){return new S_(e,t)}var bv=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 L(this.data,e),!0}size(){return this.data.length}getData(){return this.data}},x_=Number.isNaN,k_=class{constructor(e){this.selector=e,this.selectedItemsExceptNaN=new En,this.data=[]}tryAdd(e){let t=this.selector(e);if(x_(t))return L(this.data,e),!0;let r=this.selectedItemsExceptNaN.size;return Ui(this.selectedItemsExceptNaN,t),r!==this.selectedItemsExceptNaN.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},C_=Object.is,R_=class{constructor(e){this.selector=e,this.selectedItemsExceptMinusZero=new En,this.data=[],this.hasMinusZero=!1}tryAdd(e){let t=this.selector(e);if(C_(t,-0))return this.hasMinusZero?!1:(L(this.data,e),this.hasMinusZero=!0,!0);let r=this.selectedItemsExceptMinusZero.size;return Ui(this.selectedItemsExceptMinusZero,t),r!==this.selectedItemsExceptMinusZero.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},E_=class{constructor(e){this.selector=e,this.selectedItems=new En,this.data=[]}tryAdd(e){let t=this.selector(e),r=this.selectedItems.size;return Ui(this.selectedItems,t),r!==this.selectedItems.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}};function I_(e){if(typeof e.comparator=="function"){if(e.selector===void 0){let a=e.comparator,l=(c,u)=>a(c.value_,u.value_);return()=>new bv(l)}let n=e.comparator,i=e.selector,o=a=>i(a.value_),s=(a,l)=>n(o(a),o(l));return()=>new bv(s)}let t=e.selector||(n=>n),r=n=>t(n.value_);switch(e.comparator){case"IsStrictlyEqual":return()=>new k_(r);case"SameValueZero":return()=>new E_(r);case"SameValue":case void 0:return()=>new R_(r)}}function Gr(e,t={}){let r=t.minLength!==void 0?t.minLength:0,n=t.maxLength!==void 0?t.maxLength:zr,i=zi(t.size,r,n,t.maxLength!==void 0),o=t.depthIdentifier,s=new Y1(e,r,i,n,o,I_(t),[]);return r===0?s:s.filter(a=>a.length>=r)}var A_=Object.create,P_=Object.defineProperty,T_=Object.getOwnPropertyDescriptor,wv=Object.getPrototypeOf,O_=Object.prototype,M_=Reflect.ownKeys;function N_(e){let t=e[1]?A_(null):{};for(let r of e[0])P_(t,r[0],{enumerable:!0,configurable:!0,writable:!0,value:r[1]});return t}function L_(e){return e!==void 0&&!!e.configurable&&!!e.enumerable&&!!e.writable&&e.get===void 0&&e.set===void 0}function $_(e){if(typeof e!="object"||e===null)throw new N("Incompatible instance received: should be a non-null object");let t=wv(e)===null,r=wv(e)===O_;if(!t&&!r)throw new N("Incompatible instance received: should be of exact type Object");let n=G(M_(e),i=>[i,T_(e,i)]);if(!C1(n,([,i])=>L_(i)))throw new N("Incompatible instance received: should contain only c/e/w properties without get/set");return[G(n,([i,o])=>[i,o.value]),t]}function D_(e){return e[0]}function zp(e,t,r={}){let n=!!r.noNullPrototype;return W(Gr(W(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:D_,depthIdentifier:r.depthIdentifier}),n?Ie(!1):Ki()).map(N_,$_)}var __=Number.POSITIVE_INFINITY,j_=Number.MAX_SAFE_INTEGER,F_=Number.isInteger,B_=Math.floor,V_=Math.pow,U_=Math.min,pp=class o0 extends me{static from(t,r,n){if(t.length===0)throw new Error(`${n} 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(`${n} expects arbitraries to be specified`);let s=t[o].weight;if(i+=s,!F_(s))throw new Error(`${n} expects weights to be integer values`);if(s<0)throw new Error(`${n} expects weights to be superior or equal to 0`)}if(i<=0)throw new Error(`${n} expects the sum of weights to be strictly superior to 0`);return new o0(t,{depthBias:e_(r.depthSize,r.maxDepth!==void 0),maxDepth:r.maxDepth!==void 0?r.maxDepth:__,withCrossShrink:!!r.withCrossShrink},Vp(r.depthIdentifier))}constructor(t,r,n){super(),this.warbs=t,this.constraints=r,this.context=n;let i=0;this.cumulatedWeights=[];for(let o=0;o!==t.length;++o)i+=t[o].weight,L(this.cumulatedWeights,i);this.totalWeight=i}generate(t,r){if(this.mustGenerateFirst())return this.safeGenerateForIndex(t,0,r);let n=t.nextInt(this.computeNegDepthBenefit(),this.totalWeight-1);for(let i=0;i!==this.cumulatedWeights.length;++i)if(n<this.cumulatedWeights[i])return this.safeGenerateForIndex(t,i,r);throw new Error("Unable to generate from fc.frequency")}canShrinkWithoutContext(t){return this.canShrinkWithoutContextIndex(t)!==-1}shrink(t,r){if(r!==void 0){let i=r,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 V.of(l).join(a)}return a}let n=this.canShrinkWithoutContextIndex(t);return n===-1?V.nil():this.defaultShrinkForFirst(n).join(this.warbs[n].arbitrary.shrink(t,void 0).map(i=>this.mapIntoValue(n,i,null,void 0)))}defaultShrinkForFirst(t){++this.context.depth;try{if(!this.mustFallbackToFirstInShrink(t)||this.warbs[0].fallbackValue===void 0)return V.nil()}finally{--this.context.depth}let r=new $(this.warbs[0].fallbackValue.default,void 0);return V.of(this.mapIntoValue(0,r,null,void 0))}canShrinkWithoutContextIndex(t){if(this.mustGenerateFirst())return this.warbs[0].arbitrary.canShrinkWithoutContext(t)?0:-1;try{++this.context.depth;for(let r=0;r!==this.warbs.length;++r){let n=this.warbs[r];if(n.weight!==0&&n.arbitrary.canShrinkWithoutContext(t))return r}return-1}finally{--this.context.depth}}mapIntoValue(t,r,n,i){let o={selectedIndex:t,originalBias:i,originalContext:r.context,clonedMrngForFallbackFirst:n};return new $(r.value,o)}safeGenerateForIndex(t,r,n){++this.context.depth;try{let i=this.warbs[r].arbitrary.generate(t,n),o=this.mustFallbackToFirstInShrink(r)?t.clone():null;return this.mapIntoValue(r,i,o,n)}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 r=B_(V_(1+t,this.context.depth))-1;return-U_(this.totalWeight*r,j_)||0}};function W_(e){return e!=null&&typeof e=="object"&&!("generate"in e)&&!("arbitrary"in e)&&!("weight"in e)}function Sv(e){return f1(e)?{arbitrary:e,weight:1}:e}function Be(...e){let t=e[0];if(W_(t)){let n=G(Ue(e,1),Sv);return pp.from(n,t,"fc.oneof")}let r=G(e,Sv);return pp.from(r,{},"fc.oneof")}var H_=Number.isInteger;function wr(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(!H_(t))throw new Error("fc.nat maximum value should be an integer");return new Pn(0,t)}var z_=Object.is;function G_(e){let t=0,r=[];for(let n of e){let i=t;t=i+n.num;let o=t-1;r.push({from:i,to:o,entry:n})}return r}function q_(e,t){let r=0,n=e.length;for(;n-r>1;){let i=~~((r+n)/2);t<e[i].from?n=i:r=i}return e[r]}function K_(e){let t=G_(e);return function(n){let i=q_(t,n);return i.entry.build(n-i.from)}}function J_(e){let t={mapping:new Zt,negativeZeroIndex:void 0},r=0;for(let n=0;n!==e.length;++n){let i=e[n];for(let o=0;o!==i.num;++o){let s=i.build(o);s===0&&1/s===Yt.NEGATIVE_INFINITY?t.negativeZeroIndex=r:xt(t.mapping,s,r),++r}}return t}function Y_(e){let t=null;return function(n){t===null&&(t=J_(e));let i=z_(n,-0)?t.negativeZeroIndex:lt(t.mapping,n);if(i===void 0)throw new N("Unknown value encountered cannot be built using this mapToConstant");return i}}function Z_(e){if(e.length===0)throw new N("fc.mapToConstant expects at least one option");let t=0;for(let r=0;r!==e.length;++r){if(e[r].num<0)throw new N("fc.mapToConstant expects all options to have a number of entries greater or equal to zero");t+=e[r].num}if(t===0)throw new N("fc.mapToConstant expects at least one choice among options");return t}function Tn(...e){return wr({max:Z_(e)-1}).map(K_(e),Y_(e))}function s0(e,t,r,n){if(t.length===0)return r>0?void 0:[];if(n<=0)return;let i=[{endIndexChunks:0,nextStartIndex:1,chunks:[]}];for(;i.length>0;){let o=v1(i);for(let s=o.nextStartIndex;s<=t.length;++s){let a=xe(t,o.endIndexChunks,s);if(e.canShrinkWithoutContext(a)){let l=[...o.chunks,a];if(s===t.length){if(l.length<r)break;return l}L(i,{endIndexChunks:o.endIndexChunks,nextStartIndex:s+1,chunks:o.chunks}),l.length<n&&L(i,{endIndexChunks:s,nextStartIndex:s+1,chunks:l});break}}}}function X_(e){return he(e,"")}function a0(e){return e.minLength!==void 0?e.minLength:0}function l0(e){return e.maxLength!==void 0?e.maxLength:zr}function Q_(e,t){return a0(t)<=e.length&&e.length<=l0(t)}function ej(e,t){return function(n){if(typeof n!="string")throw new N("Unsupported value");let i=s0(e,n,a0(t),l0(t));if(i===void 0)throw new N("Unable to unmap received string");return i}}var c0=["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","apply","arguments","bind","call","caller","length","name","prototype","key","ref"];function tj(e,t,r){let n;try{n=r(e)}catch{return}for(let i of n)if(!t.canShrinkWithoutContext(i))return;return n}function rj(e,t){let r=[];for(let n of c0){let i=tj(n,e,t);i!==void 0&&L(r,i)}return r}var vv=new WeakMap;function nj(e){let t=[];for(let r of c0){let n=s0(e,r,0,zr);n!==void 0&&L(t,n)}return t}function ij(e,t){let r=r3(vv,e);r===void 0&&(r=nj(e),t3(vv,e,r));let n=[];for(let i of r)Q_(i,t)&&L(n,i);return n}var oj=[[0,127]],sj=[[0,55295],[57344,1114111]],aj=[[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]],lj=[[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]],xv=String.fromCodePoint,cj=Math.min,uj=Math.max;function fp(e){if(e.length===1){let r=xv(e[0]);return{num:1,build:()=>r}}let t=e[0];return{num:e[1]-e[0]+1,build:r=>xv(t+r)}}function kv(e,t){let r=[],n=0,i=0;for(;n<e.length&&i<t.length;){let o=e[n],s=o[0],a=o.length===1?o[0]:o[1],l=t[i],c=l[0],u=l.length===1?l[0]:l[1];if(a<c)n+=1;else if(u<s)i+=1;else{let d=uj(s,c),p=cj(a,u);if(r.length>=1){let h=r[r.length-1];(h.length===1?h[0]:h[1])+1===d&&(d=h[0],v1(r))}L(r,d===p?[d]:[d,p]),a<=p&&(n+=1),u<=p&&(i+=1)}}return r}var Cv=Object.create(null);function dj(e){switch(e){case"full":return sj;case"ascii":return oj}}function pj(e,t){let r=`${e}:${t}`,n=Cv[r];if(n!==void 0)return n;let i=dj(t),o=e==="binary"?i:kv(i,aj),s=[];for(let l of o)L(s,fp(l));if(e==="grapheme"){let l=kv(i,lj);for(let c of l){let u=fp(c);L(s,{num:u.num,build:d=>S3(u.build(d),"NFD")})}}let a=Tn(...s);return Cv[r]=a,a}function Fi(e,t){return pj(e,t)}function fj(e){if(typeof e.unit=="object")return e.unit;switch(e.unit){case"grapheme":return Fi("grapheme","full");case"grapheme-composite":return Fi("composite","full");case"grapheme-ascii":case void 0:return Fi("grapheme","ascii");case"binary":return Fi("binary","full");case"binary-ascii":return Fi("binary","ascii")}}function Le(e={}){let t=fj(e),r=ej(t,e),n=ij(t,e);return ce(t,{...e,experimentalCustomSlices:n}).map(X_,r)}var u0=Map,Gp=String.fromCharCode,qp={num:26,build:e=>Gp(e+97)},hj={num:26,build:e=>Gp(e+65)},d0={num:10,build:e=>Gp(e+48)};function mj(e){let t=N4(e);return e!==t?t:`%${Wi(In(e,0),16)}`}function gj(e){if(typeof e!="string")throw new Error("Unsupported");return decodeURIComponent(e)}var yj=()=>Le({unit:"binary",minLength:1,maxLength:1}).map(mj,gj),Wd;function bj(){return Wd===void 0&&(Wd=Tn(qp)),Wd}var oa;function hp(e){oa===void 0&&(oa=new u0);let t=lt(oa,e);return t===void 0&&(t=Tn(qp,d0,{num:e.length,build:r=>e[r]}),xt(oa,e,t)),t}function wj(e){return Tn(qp,hj,d0,{num:e.length,build:t=>e[t]})}var sa;function Kp(e){sa===void 0&&(sa=new u0);let t=lt(sa,e);return t===void 0&&(t=Be({weight:10,arbitrary:wj(e)},{weight:1,arbitrary:yj()}),xt(sa,e,t)),t}function Qt(e,t={}){let r=t.freq===void 0?6:t.freq,n=R1(t,"nil")?t.nil:null,i=[{arbitrary:Ie(n),weight:1,fallbackValue:{default:n}},{arbitrary:e,weight:r-1}],o={withCrossShrink:!0,depthSize:t.depthSize,maxDepth:t.maxDepth,depthIdentifier:t.depthIdentifier};return pp.from(i,o,"fc.option")}function Sj(e){return e.length>63?!1:e.length<4||e[0]!=="x"||e[1]!=="n"||e[2]!=="-"||e[3]!=="-"}var p0=Symbol("adapted-value");function vj(e,t){let r=t(e.value_);return r.adapted?new $(r.value,p0):e}var xj=class extends me{constructor(e,t){super(),this.sourceArb=e,this.adapter=t,this.adaptValue=r=>vj(r,t)}generate(e,t){let r=this.sourceArb.generate(e,t);return this.adaptValue(r)}canShrinkWithoutContext(e){return this.sourceArb.canShrinkWithoutContext(e)&&!this.adapter(e).adapted}shrink(e,t){return t===p0?this.sourceArb.canShrinkWithoutContext(e)?this.sourceArb.shrink(e,void 0).map(this.adaptValue):V.nil():this.sourceArb.shrink(e,t).map(this.adaptValue)}};function f0(e,t){return new xj(e,t)}function kj([e,t]){return t===null?e:`${e}${t[0]}${t[1]}`}function Cj(e){if(typeof e!="string"||e.length===0)throw new Error("Unsupported");return e.length===1?[e[0],null]:[e[0],[xe(e,1,e.length-1),e[e.length-1]]]}function Rj(e){let t=hp("");return W(t,Qt(W(Le({unit:hp("-"),size:e,maxLength:61}),t))).map(kj,Cj).filter(Sj)}function Ej(e){return`${he(e[0],".")}.${e[1]}`}function Ij(e){if(typeof e!="string")throw new Error("Unsupported type");let t=e.lastIndexOf(".");return[Xe(xe(e,0,t),"."),xe(e,t+1)]}function Aj(e){let[t,r]=e,n=r.length;for(let i=0;i!==t.length;++i)if(n+=1+t[i].length,n>255)return{adapted:!0,value:[Ue(t,0,i),r]};return{adapted:!1,value:e}}function Jp(e={}){let t=Hp(e.size),r=qi("-1",t),n=Le({unit:bj(),minLength:2,maxLength:63,size:r});return f0(W(ce(Rj(t),{size:r,minLength:1,maxLength:127}),n),Aj).map(Ej,Ij)}function Pj(e){let t=e[0].length;for(let r=1;r!==e.length;++r)if(t+=1+e[r].length,t>64)return{adapted:!0,value:Ue(e,0,r)};return{adapted:!1,value:e}}function Tj(e){return he(e,".")}function Oj(e){if(typeof e!="string")throw new Error("Unsupported");return Xe(e,".")}function Mj(e){return`${e[0]}@${e[1]}`}function Nj(e){if(typeof e!="string")throw new Error("Unsupported");return Xe(e,"@",2)}function Lj(e={}){return W(f0(ce(Le({unit:hp("!#$%&'*+-/=?^_`{|}~"),minLength:1,maxLength:64,size:e.size}),{minLength:1,maxLength:32,size:e.size}),Pj).map(Tj,Oj),Jp({size:e.size})).map(Mj,Nj)}var $j=Yt.NEGATIVE_INFINITY,mp=Yt.POSITIVE_INFINITY,h0=Yt.EPSILON,Yp=O(2146435072)*O(4294967296),Dj=-Yp-O(1),Rv=4503599627370496,_j=O(0xfffffffffffff),Ev=O("9007199254740992"),gp=new Float64Array(1),Iv=new Uint32Array(gp.buffer,gp.byteOffset);function jj(e){return gp[0]=e,[Iv[1],Iv[0]]}function Fj(e){let{0:t,1:r}=jj(e),n=t>>>31,i=t>>>20&2047,o=(t&1048575)*4294967296+r,s=i===0?-1022:i-1023,a=i===0?0:1;return a+=o*h0,a*=n===0?1:-1,{exponent:s,significand:a}}function Av(e,t){return e===-1022?O(t*Rv):O((t-1)*Rv)+(O(e+1023)<<O(52))}function Zp(e){if(e===mp)return Yp;if(e===$j)return Dj;let t=Fj(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===mp?Av(r,n):-Av(r,-n)-O(1)}function yp(e){if(e<0)return-yp(-e-O(1));if(e===Yp)return mp;if(e<Ev)return Yt(e)*2**-1074;let t=e-Ev,r=-1021+Yt(t>>O(52));return(1+Yt(t&_j)*h0)*2**r}var Pv=Number.isInteger,Tv=Object.is,Hd=Number.NEGATIVE_INFINITY,zd=Number.POSITIVE_INFINITY;function m0(e,t,r,n){let{noDefaultInfinity:i=!1,minExcluded:o=!1,maxExcluded:s=!1,min:a=i?-t:Hd,max:l=i?t:zd}=e,c=o?a<-r?-n:Math.max(a,-r):a===Hd?Math.max(a,-n):Math.max(a,-r),u=s?l>r?n:Math.min(l,r):l===zd?Math.min(l,n):Math.min(l,r);return{noDefaultInfinity:!1,minExcluded:o||(a!==Hd||o)&&Pv(c),maxExcluded:s||(l!==zd||s)&&Pv(u),min:Tv(c,-0)?0:c,max:Tv(u,0)?-0:u,noNaN:e.noNaN||!1}}var g0=Number.NEGATIVE_INFINITY,y0=Number.POSITIVE_INFINITY,Bj=Number.MAX_VALUE,Vj=45035996273704955e-1,bp=4503599627370496;function Uj(e){return m0(e,Bj,Vj,bp)}function Wj(e){return e===4503599627370496?y0:e===-4503599627370496?g0:e}function Hj(e){if(typeof e!="number")throw new Error("Unsupported type");return e===y0?bp:e===g0?-bp:e}var zj=Number.isInteger,b0=Number.isNaN,Gj=Number.NEGATIVE_INFINITY,qj=Number.POSITIVE_INFINITY,Ov=Number.MAX_VALUE,Kj=NaN;function Mv(e,t){if(b0(e))throw new Error("fc.double constraints."+t+" must be a 64-bit float");return Zp(e)}function Jj(e){if(typeof e!="number")throw new Error("Unsupported type");return Zp(e)}function Yj(e){return!zj(e)}function Nv(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:i=!1,min:o=t?-Ov:Gj,max:s=t?Ov:qj}=e,a=Mv(o,"min"),l=n?a+O(1):a,c=Mv(s,"max"),u=i?c-O(1):c;if(u<l)throw new Error("fc.double constraints.min must be smaller or equal to constraints.max");if(r)return xr({min:l,max:u}).map(yp,Jj);let d=u>O(0),p=d?l:l-O(1),h=d?u+O(1):u;return xr({min:p,max:h}).map(f=>u<f||f<l?Kj:yp(f),f=>{if(typeof f!="number")throw new Error("Unsupported type");return b0(f)?u!==h?h:p:Zp(f)})}function Ra(e={}){return e.noInteger?Nv(Uj(e)).map(Wj,Hj).filter(Yj):Nv(e)}var Zj=Number.NEGATIVE_INFINITY,wp=Number.POSITIVE_INFINITY,Xj=Math.imul,Sp=2**127*(1+(2**23-1)/2**23),w0=2139095040,Qj=-2139095041,vp=new Float32Array(1),e8=new Uint32Array(vp.buffer,vp.byteOffset);function t8(e){return vp[0]=e,e8[0]}function r8(e){let t=t8(e),r=t>>>31,n=t>>>23&255,i=t&8388607,o=n===0?-126:n-127,s=n===0?0:1;return s+=i/2**23,s*=r===0?1:-1,{exponent:o,significand:s}}function Lv(e,t){return e===-126?t*8388608:Xj(e+127,8388608)+(t-1)*8388608}function Xp(e){if(e===wp)return w0;if(e===Zj)return Qj;let t=r8(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===wp?Lv(r,n):-Lv(r,-n)-1}function xp(e){if(e<0)return-xp(-e-1);if(e===w0)return wp;if(e<16777216)return e*2**-149;let t=e-16777216,r=-125+(t>>23);return(1+(t&8388607)/8388608)*2**r}var S0=Number.NEGATIVE_INFINITY,v0=Number.POSITIVE_INFINITY,n8=Sp,i8=83886075e-1,kp=8388608;function o8(e){return m0(e,n8,i8,kp)}function s8(e){return e===8388608?v0:e===-8388608?S0:e}function a8(e){if(typeof e!="number")throw new Error("Unsupported type");return e===v0?kp:e===S0?-kp:e}var l8=Number.isInteger,x0=Number.isNaN,c8=Math.fround,u8=Number.NEGATIVE_INFINITY,d8=Number.POSITIVE_INFINITY,p8=NaN;function $v(e,t){let r="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(x0(e)||c8(e)!==e)throw new Error(r);return Xp(e)}function f8(e){if(typeof e!="number")throw new Error("Unsupported type");return Xp(e)}function h8(e){return!l8(e)}function Dv(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:i=!1,min:o=t?-Sp:u8,max:s=t?Sp:d8}=e,a=$v(o,"min"),l=n?a+1:a,c=$v(s,"max"),u=i?c-1:c;if(l>u)throw new Error("fc.float constraints.min must be smaller or equal to constraints.max");if(r)return oe({min:l,max:u}).map(xp,f8);let d=u>0?l:l-1,p=u>0?u+1:u;return oe({min:d,max:p}).map(h=>h>u||h<l?p8:xp(h),h=>{if(typeof h!="number")throw new Error("Unsupported type");return x0(h)?u!==p?p:d:Xp(h)})}function k0(e={}){return e.noInteger?Dv(o8(e)).map(s8,a8).filter(h8):Dv(e)}function m8(e){return e.replace(/([$`\\])/g,"\\$1").replace(/\r/g,"\\r")}function C0(e){return e.replace(/\*\//g,"*\\/")}var st=[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 xa(e){let t=4294967295;for(let r=0;r<e.length;++r){let n=In(e,r);if(n<128)t=st[t&255^n]^t>>8;else if(n<2048)t=st[t&255^(192|n>>6&31)]^t>>8,t=st[t&255^(128|n&63)]^t>>8;else if(n>=55296&&n<57344){let i=In(e,++r);if(n>=56320||i<56320||i>57343||Number.isNaN(i))r-=1,t=st[t&255^239]^t>>8,t=st[t&255^191]^t>>8,t=st[t&255^189]^t>>8;else{let o=(n&1023)+64,s=i&1023;t=st[t&255^(240|o>>8&7)]^t>>8,t=st[t&255^(128|o>>2&63)]^t>>8,t=st[t&255^(128|s>>6&15|(o&3)<<4)]^t>>8,t=st[t&255^(128|s&63)]^t>>8}}else t=st[t&255^(224|n>>12&15)]^t>>8,t=st[t&255^(128|n>>6&63)]^t>>8,t=st[t&255^(128|n&63)]^t>>8}return(t|0)+2147483648}var g8=Object.getPrototypeOf,Bi=class extends me{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 V.nil()}};function ka(e){return g8(e)===Bi.prototype&&e.generate===Bi.prototype.generate&&e.canShrinkWithoutContext===Bi.prototype.canShrinkWithoutContext&&e.shrink===Bi.prototype.shrink?e:new Bi(e)}var y8=Object.assign,b8=Object.keys;function R0(e){return W(ka(oe()),ka(oe({min:1,max:4294967295}))).map(([t,r])=>{let n=()=>{let i={};return y8((s,a)=>{let l=Ae(s),c=Ae(a),u=e(xa(`${t}${l}`)%r,xa(`${t}${c}`)%r);return i[`[${l},${c}]`]=u,u},{toString:()=>{let s=b8(i).sort().map(a=>`${a} => ${Ae(i[a])}`).map(a=>`/* ${C0(a)} */`);return`function(a, b) {
|
|
194
194
|
// With hash and stringify coming from fast-check${s.length!==0?`
|
|
195
|
-
${
|
|
195
|
+
${he(s,`
|
|
196
196
|
`)}`:""}
|
|
197
197
|
const cmp = ${e};
|
|
198
198
|
const hA = hash('${t}' + stringify(a)) % ${r};
|
|
199
199
|
const hB = hash('${t}' + stringify(b)) % ${r};
|
|
200
200
|
return cmp(hA, hB);
|
|
201
|
-
}`},[Ve]:n})};return n()})}var
|
|
201
|
+
}`},[Ve]:n})};return n()})}var w8=Object.assign;function S8(){return R0(w8((e,t)=>e<t,{toString(){return"(hA, hB) => hA < hB"}}))}var v8=Object.assign;function x8(){return R0(v8((e,t)=>e-t,{toString(){return"(hA, hB) => hA - hB"}}))}var k8=Object.defineProperties,C8=Object.keys;function R8(e){return W(ce(e,{minLength:1}),ka(oe())).map(([t,r])=>{let n=()=>{let i={},o=(...a)=>{let l=Ae(a),c=t[xa(`${r}${l}`)%t.length];return i[l]=c,Hr(c)?c[Ve]():c};function s(a){let l=G(G(k1(C8(i)),c=>`${c} => ${Ae(i[c])}`),c=>`/* ${C0(c)} */`);return`function(...args) {
|
|
202
202
|
// With hash and stringify coming from fast-check${l.length!==0?`
|
|
203
203
|
${l.join(`
|
|
204
204
|
`)}`:""}
|
|
205
205
|
const outs = ${a};
|
|
206
206
|
return outs[hash('${r}' + stringify(args)) % outs.length];
|
|
207
|
-
}`}return m8(o,{toString:{value:()=>s(Ae(t))},[kt]:{value:()=>s(Ae(t))},[Xt]:{value:async()=>s(await jp(t))},[Ve]:{value:n,configurable:!0}})};return n()})}var b8=Number.MIN_SAFE_INTEGER,w8=Number.MAX_SAFE_INTEGER;function R0(){return new Pn(b8,w8)}var S8=Number.MAX_SAFE_INTEGER;function v8(){return new Pn(0,S8)}var x8=Number.parseInt;function k8(e){let[t,r]=e;switch(t){case"oct":return`0${Wi(r,8)}`;case"hex":return`0x${Wi(r,16)}`;default:return`${r}`}}function pa(e,t){let r=x8(e,t);if(Wi(r,t)!==e)throw new Error("Invalid value");return r}function C8(e){if(typeof e!="string")throw new Error("Invalid type");return e.length>=2&&e[0]==="0"?e[1]==="x"?["hex",pa(xe(e,2),16)]:["oct",pa(xe(e,1),8)]:["dec",pa(e,10)]}function R8(e){return fe(e,".")}function E8(e){if(typeof e!="string")throw new Error("Invalid type");return G(Xe(e,"."),t=>pa(t,10))}function Qp(){return W(wr(255),wr(255),wr(255),wr(255)).map(R8,E8)}function Mt(e){return W(Nt("dec","oct","hex"),wr(e)).map(k8,C8)}function Gd(e){return fe(e,".")}function qd(e){if(typeof e!="string")throw new Error("Invalid type");return Xe(e,".")}function E0(){return Be(W(Mt(255),Mt(255),Mt(255),Mt(255)).map(Gd,qd),W(Mt(255),Mt(255),Mt(65535)).map(Gd,qd),W(Mt(255),Mt(16777215)).map(Gd,qd),Mt(4294967295))}function ef(e){return e.length===0?[]:Xe(e,":")}function tf(e){let t=Xe(e,":");return t.length>=2&&t[t.length-1].length<=4?[Ue(t,0,t.length-2),`${t[t.length-2]}:${t[t.length-1]}`]:[Ue(t,0,t.length-1),t[t.length-1]]}function I8(e){return`${fe(e[0],":")}:${e[1]}`}function A8(e){if(typeof e!="string")throw new Error("Invalid type");return tf(e)}function P8(e){return`::${fe(e[0],":")}:${e[1]}`}function T8(e){if(typeof e!="string")throw new Error("Invalid type");if(!c3(e,"::"))throw new Error("Invalid value");return tf(xe(e,2))}function fa(e){return`${fe(e[0],":")}::${fe(e[1],":")}:${e[2]}`}function ha(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Xe(e,"::",2),[n,i]=tf(r);return[ef(t),n,i]}function O8(e){return fa([e[0],[e[1]],e[2]])}function M8(e){let t=ha(e);return[t[0],fe(t[1],":"),t[2]]}function Dv(e){return`${fe(e[0],":")}::${e[1]}`}function _v(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Xe(e,"::",2);return[ef(t),r]}function N8(e){return`${fe(e[0],":")}::`}function L8(e){if(typeof e!="string")throw new Error("Invalid type");if(!u3(e,"::"))throw new Error("Invalid value");return[ef(xe(e,0,e.length-2))]}function $8([e,t]){return`${e}:${t}`}function D8(e){if(typeof e!="string")throw new N("Invalid type");if(!e.includes(":"))throw new N("Invalid value");return e.split(":",2)}var _8="0123456789abcdef",Kd;function j8(){return Kd===void 0&&(Kd=oe({min:0,max:15}).map(e=>_8[e],e=>{if(typeof e!="string")throw new N("Not a string");if(e.length!==1)throw new N("Invalid length");let t=In(e,0);if(t<=57)return t-48;if(t<97)throw new N("Invalid character");return t-87})),Kd}function I0(){let e=Le({unit:j8(),minLength:1,maxLength:4,size:"max"}),t=Be(W(e,e).map($8,D8),Qp());return Be(W(ce(e,{minLength:6,maxLength:6,size:"max"}),t).map(I8,A8),W(ce(e,{minLength:5,maxLength:5,size:"max"}),t).map(P8,T8),W(ce(e,{minLength:0,maxLength:1,size:"max"}),ce(e,{minLength:4,maxLength:4,size:"max"}),t).map(fa,ha),W(ce(e,{minLength:0,maxLength:2,size:"max"}),ce(e,{minLength:3,maxLength:3,size:"max"}),t).map(fa,ha),W(ce(e,{minLength:0,maxLength:3,size:"max"}),ce(e,{minLength:2,maxLength:2,size:"max"}),t).map(fa,ha),W(ce(e,{minLength:0,maxLength:4,size:"max"}),e,t).map(O8,M8),W(ce(e,{minLength:0,maxLength:5,size:"max"}),t).map(Dv,_v),W(ce(e,{minLength:0,maxLength:6,size:"max"}),e).map(Dv,_v),W(ce(e,{minLength:0,maxLength:7,size:"max"})).map(N8,L8))}var F8=class extends he{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)}},B8=Object.getOwnPropertyNames;function V8(){let e=new Zt;return r=>{let n=lt(e,r);return n!==void 0||(n=new F8(String(r)),vt(e,r,n)),n}}function A0(e){let t=V8(),r=e(t),n=B8(r);for(let i of n){let o=t(i);o.underlying=r[i]}return r}function U8(e,t){for(let r of e){let n=t[r]||{};if(n.maxLength===void 0||n.maxLength>0)return!0}return!1}function W8(e,t){if(e.length===0)return Ie([]);if(!U8(e,t))throw new N("Contraints on pool must accept at least one entity, maxLength cannot sum to 0");return W(...e.map(r=>ce(Ie(r),t[r]))).map(r=>j4(r)).filter(r=>r.length>0)}var jv=Object.assign,ma=Object.create,P0=Object.defineProperty,Fv=Object.getPrototypeOf,H8=Object.prototype;function z8(e){return P0(ma(null),kt,{configurable:!1,enumerable:!1,writable:!1,value:()=>e})}function Bv(e,t){return z8(`<${Ze(e)}#${t}>`)}function G8(e,t){let r=ma(H8);for(let n in e){let i=e[n],o=[];for(let s of i){let a=jv(ma(Fv(s)),s);o.push(a)}r[n]=o}for(let n in t){let i=t[n];for(let o=0;o!==i.length;++o){let s=i[o],a=r[n][o];for(let l in s){let c=s[l];a[l]=c.index===void 0?void 0:typeof c.index=="number"?r[c.type][c.index]:G(c.index,u=>r[c.type][u])}P0(a,kt,{configurable:!1,enumerable:!1,writable:!1,value:()=>{let l=e[n][o],c=jv(ma(Fv(l)),l);for(let u in s){let d=s[u];c[u]=d.index===void 0?void 0:typeof d.index=="number"?Bv(d.type,d.index):G(d.index,p=>Bv(d.type,p))}return Ae(c)}})}}return r}function q8(e){let t=0,r=new Zt;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=lt(r,a.type);if(l===void 0&&(l=new Zt,vt(r,a.type,l)),X4(l,a.forwardRelationship))throw new N(`Cannot declare multiple inverse relationships for the same forward relationship ${Ze(a.forwardRelationship)} on type ${Ze(a.type)}`);vt(l,a.forwardRelationship,{type:i,property:s}),t+=1}}let n=new Zt;if(t===0)return n;for(let i in e){let o=e[i],s=lt(r,i);if(s!==void 0)for(let a in o){let l=o[a];if(l.arity==="inverse")continue;let c=lt(s,a);if(c!==void 0){if(c.type!==l.type)throw new N(`Inverse relationship ${Ze(c.property)} on type ${Ze(c.type)} references forward relationship ${Ze(a)} but types do not match`);vt(n,l,c)}}}if(n.size!==t)throw new N("Some inverse relationships could not be matched with their corresponding forward relationships");return n}var Vv=Object.create;function K8(e,t,r){switch(e){case"exclusive":return Ie(r);case"successor":return va(oe({min:t!==void 0?t+1:0,max:r}));case"any":return va(oe({min:0,max:r}))}}function J8(e,t,r,n,i,o,s){let a=K8(t,r,n);switch(e){case"0-1":return Qt(a,{nil:void 0,depthIdentifier:i}).generate(o,s).value;case"1":return a.generate(o,s).value;case"many":{let l=0,c=Qt(Gr(a,{depthIdentifier:i,selector:d=>d===n?d+ ++l:d,minLength:1}),{nil:[],depthIdentifier:i}).generate(o,s).value,u=0;return G(c,d=>d===n?d+u++:d)}}}var Y8=class extends he{constructor(e,t){super(),this.relations=e,this.defaultEntities=t;let r=new En,n=new En;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(Sa(r,a.type))throw new N(`Cannot mix exclusive with other strategies for type ${Ze(a.type)}`);Ui(n,a.type)}else{if(Sa(n,a.type))throw new N(`Cannot mix exclusive with other strategies for type ${Ze(a.type)}`);Ui(r,a.type)}if(a.strategy==="successor"&&a.type!==i)throw new N("Cannot mix types for the strategy successor");if(a.strategy==="successor"&&a.arity==="1")throw new N("Cannot use an arity of 1 for the strategy successor")}}}this.inversedRelations=q8(e)}createEmptyLinksInstanceFor(e){let t=Vv(null),r=this.relations[e];for(let n in r){let i=r[n];i.arity==="inverse"&&(t[n]={type:i.type,index:[]})}return t}generate(e,t){let r=Vv(null);for(let o in this.relations)r[o]=[];let n=[];for(let o of this.defaultEntities)L(n,{type:o,indexInType:r[o].length,depth:0}),L(r[o],this.createEmptyLinksInstanceFor(o));let i=-1;for(;++i<n.length;){let o=n[i],s=this.relations[o.type],a=r[o.type][o.indexInType],l=Up();l.depth=o.depth;for(let c in s){let u=s[c];if(u.arity==="inverse")continue;let d=u.type,p=r[d],h=p.length,f=J8(u.arity,u.strategy||"any",d===o.type?o.indexInType:void 0,p.length,l,e,t);a[c]={type:d,index:f};let m=f===void 0?[]:typeof f=="number"?[f]:f;for(let g of m){g>=h&&(L(n,{type:d,indexInType:g,depth:o.depth+1}),L(p,this.createEmptyLinksInstanceFor(d)));let w=lt(this.inversedRelations,u);if(w!==void 0){let S=p[g][w.property].index;L(S,o.indexInType)}}}}return n.length=0,new $(r,void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return V.nil()}};function Z8(e,t){return new Y8(e,t)}var X8=Object.keys,Q8=Object.getOwnPropertySymbols,e7=Object.getOwnPropertyDescriptor;function t7(e){let t=X8(e),r=Q8(e);for(let n=0;n!==r.length;++n){let i=r[n],o=e7(e,i);o&&o.enumerable&&t.push(i)}return t}var r7=Object.create,n7=Object.defineProperty,i7=Object.getOwnPropertyDescriptor,o7=Object.getOwnPropertyNames,s7=Object.getOwnPropertySymbols;function a7(e,t){return function(n){let i=n[1]?r7(null):{};for(let o=0;o!==e.length;++o){let s=n[0][o];s!==t&&n7(i,e[o],{value:s,configurable:!0,enumerable:!0,writable:!0})}return i}}function l7(e,t){return function(n){if(typeof n!="object"||n===null)throw new Error("Incompatible instance received: should be a non-null object");let i=Object.getPrototypeOf(n)===null,o="constructor"in n&&n.constructor===Object;if(!i&&!o)throw new Error("Incompatible instance received: should be of exact type Object");let s=0,a=[];for(let u=0;u!==e.length;++u){let d=i7(n,e[u]);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,L(a,d.value)}else L(a,t)}let l=o7(n).length,c=s7(n).length;if(s!==l+c)throw new Error("Incompatible instance received: should not contain extra properties");return[a,i]}}var Jd=Symbol("no-key");function Yd(e,t,r){let n=t7(e),i=[];for(let o=0;o!==n.length;++o){let s=n[o],a=e[s];t===void 0||Jt(t,s)!==-1?L(i,a):L(i,Qt(a,{nil:Jd}))}return W(W(...i),r?Ie(!1):Ki()).map(a7(n,Jd),l7(n,Jd))}function Cp(e,t){let r=t!==void 0&&!!t.noNullPrototype;if(t===void 0||!("requiredKeys"in t&&t.requiredKeys!==void 0))return Yd(e,void 0,r);let n=("requiredKeys"in t?t.requiredKeys:void 0)||[];for(let i=0;i!==n.length;++i){let o=Object.getOwnPropertyDescriptor(e,n[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 Yd(e,n,r)}var c7=Object.create;function u7(e,t,r,n){let i=c7(null);for(let o in e){let s=e[o],a=Cp(s,n),l=t(o),c=r(o),u={minLength:l,maxLength:l};i[o]=c!==void 0?Gr(a,{...u,selector:c}):ce(a,u)}return Cp(i)}var Uv=Object.create,d7=Object.keys;function p7(e,t,r={}){let n=d7(e),i=r.initialPoolConstraints||Uv(null),o=r.unicityConstraints||Uv(null),s={noNullPrototype:r.noNullPrototype};return W8(n,i).chain(a=>Z8(t,a).chain(l=>u7(e,c=>l[c].length,c=>o[c],s).map(c=>G8(c,l))))}function f7(e){return fe(G(e,t=>t[t.length-1]===","?xe(t,0,t.length-1):t)," ")}function h7(e){return function(r){if(typeof r!="string")throw new Error("Unsupported type");let n=[];for(let i of Xe(r," "))if(e.canShrinkWithoutContext(i))L(n,i);else if(e.canShrinkWithoutContext(i+","))L(n,i+",");else throw new Error("Unsupported word");return n}}function m7(e){let t=fe(e," ");return t[t.length-1]===","&&(t=xe(t,0,t.length-1)),Np(t[0])+xe(t,1)+"."}function g7(e){return function(r){if(typeof r!="string")throw new Error("Unsupported type");if(r.length<2||r[r.length-1]!=="."||r[r.length-2]===","||Np(ap(r[0]))!==r[0])throw new Error("Unsupported value");let n=ap(r[0])+xe(r,1,r.length-1),i=[],o=Xe(n," ");for(let s=0;s!==o.length;++s){let a=o[s];if(e.canShrinkWithoutContext(a))L(i,a);else if(s===o.length-1&&e.canShrinkWithoutContext(a+","))L(i,a+",");else throw new Error("Unsupported word")}return i}}function y7(e){return fe(e," ")}function b7(e){if(typeof e!="string")throw new Error("Unsupported type");let t=Xe(e,". ");for(let r=0;r<t.length-1;++r)t[r]+=".";return t}var b=(e,t)=>({arbitrary:Ie(e),weight:t});function w7(){return Be(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 S7(e={}){let{maxCount:t,mode:r="words",size:n}=e;if(t!==void 0&&t<1)throw new Error("lorem has to produce at least one word/sentence");let i=w7();return r==="sentences"?ce(ce(i,{minLength:1,size:"small"}).map(m7,g7(i)),{minLength:1,maxLength:t,size:n}).map(y7,b7):ce(i,{minLength:1,maxLength:t,size:n}).map(f7,h7(i))}function v7(e){return new Map(e)}function x7(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 k7(e){return e[0]}function Rp(e,t,r={}){return Gr(W(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:k7,depthIdentifier:r.depthIdentifier,comparator:"SameValueZero"}).map(v7,x7)}var aa=10;function C7(e){let t={};return(r=>{let n=r!==void 0?r:aa;if(!C1(t,n)){let i=aa;aa=n-1,t[n]=e(n),aa=i}return t[n]})}function R7(e){let t=0;for(;e>O(0);)e&O(1)&&++t,e>>=O(1);return t}function E7(e,t){let r=(O(1)<<O(t))-O(1),n=e&r,i=R7(e-n),o=n;for(let s=O(1);s<=r&&i!==0;s<<=O(1))o&s||(o|=s,--i);return o}function la(e,t){let r=[];for(let n=e.length-1;n!==-1;--n)t(e[n])!==e[n]&&L(r,n);return r}function I7(e,t,r){let n=O(0);for(let i=0,o=O(1);i!==r.length;++i,o<<=O(1))e[r[i]]!==t[r[i]]&&(n|=o);return n}function Zd(e,t,r,n){for(let i=0,o=O(1);i!==r.length;++i,o<<=O(1))t&o&&(e[r[i]]=n(e[r[i]]))}var A7=class extends he{constructor(e,t,r){super(),this.stringArb=e,this.toggleCase=t,this.untoggleAll=r}buildContextFor(e,t){return{rawString:e.value,rawStringContext:e.context,flags:t.value,flagsContext:t.context}}generate(e,t){let r=this.stringArb.generate(e,t),n=[...r.value],i=la(n,this.toggleCase),o=xr(O(0),(O(1)<<O(i.length))-O(1)).generate(e,void 0);return Zd(n,o.value,i,this.toggleCase),new $(fe(n,""),this.buildContextFor(r,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 r;if(t!==void 0)r=t;else if(this.untoggleAll!==void 0){let o=this.untoggleAll(e),s=[...e],a=[...o];r={rawString:o,rawStringContext:void 0,flags:I7(a,s,la(a,this.toggleCase)),flagsContext:void 0}}else r={rawString:e,rawStringContext:void 0,flags:O(0),flagsContext:void 0};let n=r.rawString,i=r.flags;return this.stringArb.shrink(n,r.rawStringContext).map(o=>{let s=[...o.value],a=la(s,this.toggleCase),l=E7(i,a.length);return Zd(s,l,a,this.toggleCase),new $(fe(s,""),this.buildContextFor(o,new $(l,void 0)))}).join(Sr(()=>{let o=[...n],s=la(o,this.toggleCase);return xr(O(0),(O(1)<<O(s.length))-O(1)).shrink(i,r.flagsContext).map(a=>{let l=Ue(o);return Zd(l,a.value,s,this.toggleCase),new $(fe(l,""),this.buildContextFor(new $(n,r.rawStringContext),a))})}))}};function P7(e){let t=Np(e);return t!==e?t:ap(e)}function T7(e,t){return new A7(e,t&&t.toggleCase||P7,t&&t.untoggleAll)}function O7(e){return y1.from(e)}function M7(e){if(!(e instanceof y1))throw new Error("Unexpected type");return[...e]}function T0(e={}){return ce(x0(e),e).map(O7,M7)}function N7(e){return b1.from(e)}function L7(e){if(!(e instanceof b1))throw new Error("Unexpected type");return[...e]}function O0(e={}){return ce(Ra(e),e).map(N7,L7)}function er(e,t,r,n,i){let o=n.name,{min:s=t,max:a=r,...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>r)throw new Error(`Invalid max value passed to ${o}: max must be lower than or equal to ${r}`);return ce(i({min:s,max:a}),l).map(c=>n.from(c),c=>{if(!(c instanceof n))throw new Error("Invalid type");return[...c]})}function M0(e={}){return er(e,-32768,32767,w4,oe)}function N0(e={}){return er(e,-2147483648,2147483647,S4,oe)}function L0(e={}){return er(e,-128,127,b4,oe)}function $0(e={}){return er(e,0,65535,k4,oe)}function D0(e={}){return er(e,0,4294967295,C4,oe)}function _0(e={}){return er(e,0,255,v4,oe)}function j0(e={}){return er(e,0,255,x4,oe)}function $7(e){return e!==void 0}function Wv(e){return e.hasToBeCloned?new $(e.value_,{generatorContext:e.context},()=>e.value):new $(e.value_,{generatorContext:e.context})}function Hv(e){return e.hasToBeCloned?new $(e.value_,{shrinkerContext:e.context},()=>e.value):new $(e.value_,{shrinkerContext:e.context})}var D7=class extends he{constructor(e,t){super(),this.generatorArbitrary=e,this.shrinkerArbitrary=t}generate(e,t){return Wv(this.generatorArbitrary.generate(e,t))}canShrinkWithoutContext(e){return this.shrinkerArbitrary.canShrinkWithoutContext(e)}shrink(e,t){return $7(t)?"generatorContext"in t?this.generatorArbitrary.shrink(e,t.generatorContext).map(Wv):this.shrinkerArbitrary.shrink(e,t.shrinkerContext).map(Hv):this.shrinkerArbitrary.shrink(e,void 0).map(Hv)}};function Ep(e,t,r){let n=oe({min:e,max:t});return t===r?n:new D7(n,oe({min:e,max:r}))}var _7=Math.min,Ip=Math.max,zv=m1.isArray,j7=Object.entries;function F7(e){let t=-1;for(let r=0;r!==e.length;++r)t=Ip(t,e[r][0]);return t}function B7(e,t){let r=m1(e);for(let n=0;n!==t.length;++n){let i=t[n];i[0]<e&&(r[i[0]]=i[1])}return r}function F0(e,t={}){let{size:r,minNumElements:n=0,maxLength:i=zr,maxNumElements:o=i,noTrailingHole:s,depthIdentifier:a}=t,l=zi(r,zi(r,n,o,t.maxNumElements!==void 0),i,t.maxLength!==void 0);if(n>i)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal length of the array");if(n>o)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal number of non-holes");let c=_7(o,i),u=t.maxNumElements!==void 0||r!==void 0?r:"=",d=Gr(W(Ep(0,Ip(l-1,0),Ip(i-1,0)),e),{size:u,minLength:n,maxLength:c,selector:p=>p[0],depthIdentifier:a}).map(p=>B7(F7(p)+1,p),p=>{if(!zv(p))throw new Error("Not supported entry type");if(s&&p.length!==0&&!(p.length-1 in p))throw new Error("No trailing hole");return G(j7(p),h=>[Number(h[0]),h[1]])});return s||i===n?d:W(d,Ep(n,l,i)).map(p=>{let h=p[0],f=p[1];if(h.length>=f)return h;let m=Ue(h);return m.length=f,m},p=>{if(!zv(p))throw new Error("Not supported entry type");return[p,p.length]})}function V7(e){return new Set(e)}function U7(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 B0(e,t={}){return Gr(e,{minLength:t.minLength,maxLength:t.maxLength,size:t.size,depthIdentifier:t.depthIdentifier,comparator:"SameValueZero"}).map(V7,U7)}function W7(e,t,r,n,i,o){return zp(e,t,{maxKeys:r,noNullPrototype:!o,size:n,depthIdentifier:i})}function H7(e){return Be(L0(e),_0(e),j0(e),M0(e),$0(e),N0(e),D0(e),T0(e),O0(e))}function V0(e){let t=e.values,r=e.depthSize,n=Up(),i=e.maxDepth,o=e.maxKeys,s=e.size,a=Be(...t,...e.withBigInt?[xr()]:[],...e.withDate?[r0()]:[]);return A0(l=>({anything:Be({maxDepth:i,depthSize:r,depthIdentifier:n},a,l("array"),l("object"),...e.withMap?[l("map")]:[],...e.withSet?[l("set")]:[],...e.withObjectString?[l("anything").map(c=>Ae(c))]:[],...e.withTypedArray?[H7({maxLength:o,size:s})]:[],...e.withSparseArray?[F0(l("anything"),{maxNumElements:o,size:s,depthIdentifier:n})]:[]),keys:e.withObjectString?Be({arbitrary:e.key,weight:10},{arbitrary:l("anything").map(c=>Ae(c)),weight:1}):e.key,array:ce(l("anything"),{maxLength:o,size:s,depthIdentifier:n}),set:B0(l("anything"),{maxLength:o,size:s,depthIdentifier:n}),map:Be(Rp(l("keys"),l("anything"),{maxKeys:o,size:s,depthIdentifier:n}),Rp(l("anything"),l("anything"),{maxKeys:o,size:s,depthIdentifier:n})),object:W7(l("keys"),l("anything"),o,s,n,e.withNullPrototype)})).anything}function z7(e){switch(typeof e){case"boolean":return new g1(e);case"number":return new Yt(e);case"string":return new Ze(e);default:return e}}function G7(e){return typeof e!="object"||e===null||!("constructor"in e)?e:e.constructor===g1||e.constructor===Yt||e.constructor===Ze?e.valueOf():e}function q7(e){return e.map(z7,G7)}function K7(e,t){return[Ki(),R0(),Ra(),t(e),Be(t(e),Ie(null),Ie(void 0))]}function J7(e){return e.map(t=>q7(t))}function Y7(e,t){return t?J7(e).concat(e):e}function U0(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:Le(t),values:Y7(e.values!==void 0?e.values:K7(t,Le),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 Z7(e){return zp(e.key,V0(e),{maxKeys:e.maxKeys,noNullPrototype:!e.withNullPrototype,size:e.size})}function X7(e){return Z7(U0(e))}function Q7(e,t){let{depthSize:r,maxDepth:n}=t;return{key:e,values:[Ki(),Ra({noDefaultInfinity:!0,noNaN:!0}),e,Ie(null)],depthSize:r,maxDepth:n}}function W0(e){return V0(U0(e))}function H0(e={}){let t=e.noUnicodeString===void 0||e.noUnicodeString===!0;return W0(Q7("stringUnit"in e?Le({unit:e.stringUnit}):t?Le():Le({unit:"binary"}),e))}var e9=JSON.stringify,t9=JSON.parse;function r9(e){if(typeof e!="string")throw new N("Cannot unmap the passed value");return t9(e)}function n9(e={}){return H0(e).map(e9,r9)}var i9=Object.defineProperties;function Xd(e,t){return`Stream(${t!==void 0?`${fe(t,",")}\u2026`:`${e} emitted`})`}var o9=class extends he{constructor(e,t){super(),this.arb=e,this.history=t}generate(e,t){let r=t!==void 0&&e.nextInt(1,t)===1?t:void 0,n=()=>{let i=this.history?[]:null,o=0,s=function*(a,l){for(;;){let c=a.generate(l,r).value;o++,i!==null&&L(i,c),yield c}};return i9(new V(s(this.arb,e.clone())),{toString:{value:()=>Xd(o,i!==null?i.map(Ae):void 0)},[kt]:{value:()=>Xd(o,i!==null?i.map(Ae):void 0)},[Xt]:{value:async()=>Xd(o,i!==null?await Promise.all(i.map(jp)):void 0)},[Ve]:{value:n,enumerable:!0}})};return new $(n(),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return V.nil()}};function s9(e,t){return new o9(e,t!==void 0&&typeof t=="object"&&"noHistory"in t?!t.noHistory:!0)}function a9(e){return fe(e,"")}function Gv(e){if(typeof e!="string")throw new Error("Cannot unmap the passed value");return[...e]}function l9(e){switch(e.length%4){case 0:return e;case 3:return`${e}=`;case 2:return`${e}==`;default:return xe(e,1)}}function c9(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 xe(e,0,t)}var Qd=String.fromCharCode;function u9(e){return e<26?Qd(e+65):e<52?Qd(e+97-26):e<62?Qd(e+48-52):e===62?"+":"/"}function d9(e){if(typeof e!="string"||e.length!==1)throw new N("Invalid entry");let t=In(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 p9(){return oe({min:0,max:63}).map(u9,d9)}function f9(e={}){let{minLength:t=0,maxLength:r=zr,size:n}=e,i=t+3-(t+3)%4,o=r-r%4,s=e.maxLength===void 0&&n===void 0?"=":n;if(i>o)throw new N("Minimal length should be inferior or equal to maximal length");if(i%4!==0)throw new N("Minimal length of base64 strings must be a multiple of 4");if(o%4!==0)throw new N("Maximal length of base64 strings must be a multiple of 4");let a=p9();return ce(a,{minLength:i,maxLength:o,size:s,experimentalCustomSlices:K_(a,Gv)}).map(a9,Gv).map(l9,c9)}var qv=Object.is;function h9(e,t){let r=new Zt,n=0;for(let i of e)qv(i,-0)?++n:vt(r,i,(lt(r,i)||0)+1);for(let i=0;i!==t.length;++i){if(!(i in t))return!1;let o=t[i];if(qv(o,-0)){if(n===0)return!1;--n}else{let s=lt(r,o)||0;if(s===0)return!1;vt(r,o,s-1)}}return!0}var m9=Math.floor,Kv=Math.log,g9=Array.isArray,z0=class extends he{constructor(e,t,r,n){if(super(),this.originalArray=e,this.isOrdered=t,this.minLength=r,this.maxLength=n,r<0||r>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(n<0||n>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(r>n)throw new Error("fc.*{s|S}ubarrayOf expects the minimal length to be inferior or equal to the maximal length");this.lengthArb=new Pn(r,n),this.biasedLengthArb=r!==n?new Pn(r,r+m9(Kv(n-r)/Kv(2))):this.lengthArb}generate(e,t){let r=(t!==void 0&&e.nextInt(1,t)===1?this.biasedLengthArb:this.lengthArb).generate(e,void 0),n=r.value,i=G(this.originalArray,(s,a)=>a),o=[];for(let s=0;s!==n;++s){let a=e.nextInt(0,i.length-1);L(o,i[a]),v1(i,a,1)}return this.isOrdered&&x1(o,(s,a)=>s-a),new $(G(o,s=>this.originalArray[s]),r.context)}canShrinkWithoutContext(e){return!g9(e)||!this.lengthArb.canShrinkWithoutContext(e.length)?!1:h9(this.originalArray,e)}shrink(e,t){return e.length===0?V.nil():this.lengthArb.shrink(e.length,t).map(r=>new $(Ue(e,e.length-r.value),r.context)).join(e.length>this.minLength?Sr(()=>this.shrink(Ue(e,1),void 0).filter(r=>this.minLength<=r.value.length+1).map(r=>new $([e[0],...r.value],void 0))):V.nil())}};function y9(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new z0(e,!0,r,n)}function b9(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new z0(e,!1,r,n)}var w9={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"},S9={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 v9(e){return e<10?Ze(e):w9[e]}function Jv(e,t){let r="";for(;e.length+r.length<t;)r+="0";return r+e}function Yv(e){let t="";for(let r=e;r!==0;){let n=r>>5;t=v9(r-(n<<5))+t,r=n}return t}function x9(e,t){let r=~~(e/1073741824),n=e&1073741823;return Jv(Yv(r),t-6)+Jv(Yv(n),6)}function G0(e){return function(r){return x9(r,e)}}function ep(e){if(typeof e!="string")throw new N("Unsupported type");let t=0,r=1;for(let n=e.length-1;n>=0;--n){let i=S9[e[n]];if(i===void 0)throw new N("Unsupported type");t+=i*r,r*=32}return t}var k9=G0(10),Zv=G0(8);function C9(e){return k9(e[0])+Zv(e[1])+Zv(e[2])}function R9(e){if(typeof e!="string"||e.length!==26)throw new Error("Unsupported type");return[ep(e.slice(0,10)),ep(e.slice(10,18)),ep(e.slice(18))]}function E9(){return W(oe({min:0,max:0xffffffffffff}),oe({min:0,max:0xffffffffff}),oe({min:0,max:0xffffffffff})).map(C9,R9)}function q0(e){return d3(Wi(e,16),8,"0")}function I9(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!==q0(t))throw new Error("Unsupported value: invalid content");return t}function tp(e,t){return oe({min:e,max:t}).map(q0,I9)}function A9(e){return`${e[0]}-${xe(e[1],4)}-${xe(e[1],0,4)}-${xe(e[2],0,4)}-${xe(e[2],4)}${e[3]}`}var P9=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/;function T9(e){if(typeof e!="string")throw new Error("Unsupported type");let t=P9.exec(e);if(t===null)throw new Error("Unsupported type");return[t[1],t[3]+t[2],t[4]+xe(t[5],0,4),xe(t[5],4)]}var Xv="0123456789abcdef";function O9(e){let t={},r={};for(let o=0;o!==e.length;++o){let s=Xv[o],a=Xv[e[o]];t[s]=a,r[a]=s}function n(o){return t[o[0]]+xe(o,1)}function i(o){if(typeof o!="string")throw new N("Cannot produce non-string values");let s=r[o[0]];if(s===void 0)throw new N("Cannot produce strings not starting by the version in hexa code");return s+xe(o,1)}return{versionsApplierMapper:n,versionsApplierUnmapper:i}}function M9(e){let t={};for(let r of e){if(t[r])throw new N(`Version ${r} has been requested at least twice for uuid`);if(t[r]=!0,r<1||r>15)throw new N(`Version must be a value in [1-15] for uuid, but received ${r}`);if(~~r!==r)throw new N(`Version must be an integer value for uuid, but received ${r}`)}if(e.length===0)throw new N("Must provide at least one version for uuid")}function N9(e={}){let t=tp(0,4294967295),r=e.version!==void 0?typeof e.version=="number"?[e.version]:e.version:[1,2,3,4,5,6,7,8];M9(r);let{versionsApplierMapper:n,versionsApplierUnmapper:i}=O9(r);return W(t,tp(0,268435456*r.length-1).map(n,i),tp(2147483648,3221225471),t).map(A9,T9)}function L9(e){return Le({unit:Kp("-._~!$&'()*+,;=:"),size:e})}function $9([e,t,r]){return(e===null?"":`${e}@`)+t+(r===null?"":`:${r}`)}function D9(e){if(typeof e!="string")throw new Error("Unsupported");let t=e.indexOf("@"),r=t!==-1?e.substring(0,t):null,n=/:(\d+)$/.exec(e),i=n!==null?Number(n[1]):null;return[r,n!==null?e.substring(t+1,e.length-n[1].length-1):e.substring(t+1),i]}function _9(e){return`[${e}]`}function j9(e){if(typeof e!="string"||e[0]!=="["||e[e.length-1]!=="]")throw new Error("Unsupported");return e.substring(1,e.length-1)}function K0(e){let t=e||{},r=t.size,n=[Jp({size:r}),...t.withIPv4===!0?[Qp()]:[],...t.withIPv6===!0?[I0().map(_9,j9)]:[],...t.withIPv4Extended===!0?[E0()]:[]];return W(t.withUserInfo===!0?Qt(L9(r)):Ie(null),Be(...n),t.withPort===!0?Qt(wr(65535)):Ie(null)).map($9,D9)}function J0(e){return Le({unit:Kp("-._~!$&'()*+,;=:@/?"),size:e})}function Y0(e={}){return J0(e.size)}function Z0(e={}){return Le({unit:Kp("-._~!$&'()*+,;=:@"),size:e.size})}function F9(e){return fe(G(e,t=>`/${t}`),"")}function B9(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 v1(Xe(e,"/"),1)}function V9(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 rp(e,t){return ce(Z0({size:e}),{size:t}).map(F9,B9)}function U9(e){let[t,r]=V9(e);return t===r?rp(t,r):Be(rp(t,r),rp(r,t))}function X0(e){return U9(Hp((e||{}).size))}function Q0(e={}){return J0(e.size)}function W9(e){let[t,r,n]=e;return`${t}://${r}${n}${e[3]===null?"":`?${e[3]}`}${e[4]===null?"":`#${e[4]}`}`}var H9=/^([[A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)([^?#]*)(\?[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?(#[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?$/;function z9(e){if(typeof e!="string")throw new Error("Incompatible value received: type");let t=H9.exec(e);if(t===null)throw new Error("Incompatible value received");let r=t[1],n=t[2],i=t[3],o=t[4],s=t[5];return[r,n,i,o!==void 0?o.substring(1):null,s!==void 0?s.substring(1):null]}function G9(e){let t=e||{},r=Hp(t.size),n=t.authoritySettings!==void 0&&t.authoritySettings.size!==void 0?qi(t.authoritySettings.size,r):r,i={...t.authoritySettings,size:n};return W(Nt(...t.validSchemes||["http","https"]),K0(i),X0({size:r}),t.withQueryParameters===!0?Qt(Q0({size:r})):Ie(null),t.withFragments===!0?Qt(Y0({size:r})):Ie(null)).map(W9,z9)}var q9=class ex{constructor(t,r){this.commands=t,this.metadataForReplay=r,this[Ve]=function(){return new ex(this.commands.map(n=>n.clone()),this.metadataForReplay)}}[Symbol.iterator](){return this.commands[Symbol.iterator]()}toString(){let t=this.commands.filter(n=>n.hasRan).map(n=>n.toString()).join(","),r=this.metadataForReplay();return r.length!==0?`${t} /*${r}*/`:t}},K9=class Ap{constructor(t){if(this.cmd=t,this.hasRan=!1,Dp(t)){let r=t[kt];this[kt]=function(){return r.call(t)}}if(_p(t)){let r=t[Xt];this[Xt]=function(){return r.call(t)}}}check(t){return this.cmd.check(t)}run(t,r){return this.hasRan=!0,this.cmd.run(t,r)}clone(){return Hr(this.cmd)?new Ap(this.cmd[Ve]()):new Ap(this.cmd)}toString(){return this.cmd.toString()}},Qv=class{static parse(e){let[t,r]=e.split(":"),n=this.parseCounts(t),i=this.parseChanges(r);return this.parseOccurences(n,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,r)=>(t.length===0||t[t.length-1].count===64||t[t.length-1].value!==r?t.push({value:r,count:1}):t[t.length-1].count+=1,t),[])}static parseOccurences(e,t){let r=[];for(let n=0;n!==e.length;++n){let i=e[n],o=t[n];for(let s=0;s!==i;++s)r.push(o)}return r}static stringifyChanges(e){let t="";for(let r=0;r<e.length;r+=6){let n=e.slice(r,r+6).reduceRight((i,o)=>(i<<1)+(o.value?1:0),0);t+=this.intToB64(n)}return t}static parseChanges(e){let t=e.split("").map(n=>this.b64ToInt(n)),r=[];for(let n=0;n!==t.length;++n){let i=t[n];for(let o=0;o!==6;++o,i>>=1)r.push(i%2===1)}return r}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)}},J9=class extends he{constructor(e,t,r,n,i){super(),this.sourceReplayPath=n,this.disableReplayLog=i,this.oneCommandArb=Be(...e).map(o=>new K9(o)),this.lengthArb=Ep(0,t,r),this.replayPath=[],this.replayPathPosition=0}metadataForReplay(){return this.disableReplayLog?"":`replayPath=${JSON.stringify(Qv.stringify(this.replayPath))}`}buildValueFor(e,t){let r=e.map(i=>i.value_),n={shrunkOnce:t,items:e};return new $(new q9(r,()=>this.metadataForReplay()),n)}generate(e){let t=this.lengthArb.generate(e,void 0).value,r=Array(t);for(let n=0;n!==t;++n)r[n]=this.oneCommandArb.generate(e,void 0);return this.replayPathPosition=0,this.buildValueFor(r,!1)}canShrinkWithoutContext(e){return!1}filterOnExecution(e){let t=[];for(let r of e)r.value_.hasRan?(this.replayPath.push(!0),t.push(r)):this.replayPath.push(!1);return t}filterOnReplay(e){return e.filter((t,r)=>{let n=this.replayPath[this.replayPathPosition+r];if(n===void 0)throw new Error("Too short replayPath");if(!n&&t.value_.hasRan)throw new Error("Mismatch between replayPath and real execution");return n})}filterForShrinkImpl(e){this.replayPathPosition===0&&(this.replayPath=this.sourceReplayPath!==null?Qv.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 V.nil();let r=t,n=r.shrunkOnce,i=r.items,o=this.filterForShrinkImpl(i);if(o.length===0)return V.nil();let s=n?V.nil():new V([[]][Symbol.iterator]()),a=[];for(let l=0;l!==o.length;++l)a.push(Sr(()=>{let c=o.slice(0,l);return this.lengthArb.shrink(o.length-1-l,void 0).map(u=>c.concat(o.slice(o.length-(u.value+1))))}));for(let l=0;l!==o.length;++l)a.push(Sr(()=>this.oneCommandArb.shrink(o[l].value_,o[l].context).map(c=>o.slice(0,l).concat([c],o.slice(l+1)))));return s.join(...a).map(l=>this.buildValueFor(l.map(c=>new $(c.value_.clone(),c.context)),!0))}};function Y9(e,t={}){let{size:r,maxCommands:n=zr,disableReplayLog:i=!1,replayPath:o=null}=t;return new J9(e,zi(r,0,n,t.maxCommands!==void 0),n,o,i)}var Z9=class{constructor(e,t){this.s=e,this.cmd=t}async check(e){let t=null,r=!1;if((await this.s.scheduleSequence([{label:`check@${this.cmd.toString()}`,builder:async()=>{try{r=await Promise.resolve(this.cmd.check(e))}catch(n){throw t=n,n}}}]).task).faulty)throw t;return r}async run(e,t){let r=null;if((await this.s.scheduleSequence([{label:`run@${this.cmd.toString()}`,builder:async()=>{try{await this.cmd.run(e,t)}catch(n){throw r=n,n}}}]).task).faulty)throw r}},X9=function*(e,t){for(let r of t)yield new Z9(e,r)},tx=(e,t,r,n,i)=>e.then(o=>{let{model:s,real:a}=o,l=r;for(let c of t)l=i(l,()=>n(c,s,a));return l}),Q9=(e,t)=>tx({then:o=>{o(e())}},t,void 0,(o,s,a)=>{o.check(s)&&o.run(s,a)},(o,s)=>s()),e5=e=>typeof e.then=="function",rx=async(e,t,r=Promise.resolve())=>await tx({then:s=>{let a=e();return e5(a)?a.then(s):s(a)}},t,r,async(s,a,l)=>{await s.check(a)&&await s.run(a,l)},(s,a)=>s.then(a));function t5(e,t){Q9(e,t)}async function r5(e,t){await rx(e,t)}async function n5(e,t,r){let n=rx(t,X9(e,r),e.schedule(Promise.resolve(),"startModel"));await e.waitFor(n),await e.waitAll()}var ca=e=>e(),nx=class Pp{constructor(t,r){this.act=t,this.taskSelector=r,this.lastTaskId=0,this.sourceTaskSelector=r.clone(),this.scheduledTasks=[],this.triggeredTasks=[],this.scheduledWatchers=[],this[Ve]=function(){return new Pp(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 ${a8(t.outputValue)}`:""}`}log(t,r,n,i,o,s){this.triggeredTasks.push({status:o,schedulingType:t,taskId:r,label:n,metadata:i,outputValue:s!==void 0?Ae(s):void 0})}scheduleInternal(t,r,n,i,o,s){let a=++this.lastTaskId,l,c=new Promise((u,d)=>{l=()=>{let p=Promise.resolve(s!==void 0?n.then(()=>s()):n);return p.then(h=>{this.log(t,a,r,i,"resolved",h),u(h)},h=>{this.log(t,a,r,i,"rejected",h),d(h)}),p}});return this.scheduledTasks.push({original:n,trigger:l,schedulingType:t,taskId:a,label:r,metadata:i,customAct:o}),this.scheduledWatchers.length!==0&&this.scheduledWatchers[0](),c}schedule(t,r,n,i){return this.scheduleInternal("promise",r||"",t,n,i||ca)}scheduleFunction(t,r){return(...n)=>this.scheduleInternal("function",`${t.name}(${n.map(Ae).join(",")})`,t(...n),void 0,r||ca)}scheduleSequence(t,r){let n={done:!1,faulty:!1},i={then:u=>u()},o=()=>{},s=new Promise(u=>{o=()=>u({done:n.done,faulty:n.faulty})}),a=()=>{n.faulty=!0,o()},l=()=>{n.done=!0,o()},c=(u,d)=>{if(u>=t.length){d.then(l,a);return}d.then(()=>{let p=t[u],[h,f,m]=typeof p=="function"?[p,p.name,void 0]:[p.builder,p.label,p.metadata],g=this.scheduleInternal("sequence",f,i,m,r||ca,()=>h());c(u+1,g)},a)};return c(0,i),Object.assign(n,{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),[r]=this.scheduledTasks.splice(t,1);return r.customAct(()=>r.trigger().catch(n=>{}))}waitOne(t){let r=t||ca;return this.act(()=>r(()=>this.internalWaitOne()))}async waitAll(t){for(;this.scheduledTasks.length>0;)await this.waitOne(t)}async internalWaitFor(t,r){let n=!1,i=r.customAct,o=r.onWaitStart,s=r.onWaitIdle,a=r.launchAwaiterOnInit,l,c,u=0,d=null,p=null,h=async()=>{for(u=50,u=50;!n&&u>0;--u)await Promise.resolve();if(!n&&this.scheduledTasks.length>0)return o!==void 0&&o(),p=this.waitOne(i),p.then(()=>(p=null,h()),w=>{throw p=null,n=!0,c(w),w});!n&&s!==void 0&&s(),d=null},f=()=>{if(d!==null){u=51;return}d=h().catch(()=>{})},m=()=>{let w=this.scheduledWatchers.indexOf(f);w!==-1&&this.scheduledWatchers.splice(w,1),w===0&&this.scheduledWatchers.length!==0&&this.scheduledWatchers[0]()},g=new Promise((w,S)=>{l=y=>{m(),w(y)},c=y=>{m(),S(y)}});return t.then(w=>{n=!0,p===null?l(w):p.then(()=>l(w),S=>c(S))},w=>{n=!0,p===null?c(w):p.then(()=>c(w),()=>c(w))}),(this.scheduledTasks.length>0||a)&&this.scheduledWatchers.length===0&&f(),this.scheduledWatchers.push(f),g}waitNext(t,r){let n,i=t,o=i<=0?Promise.resolve():new Promise(s=>{n=()=>{--i<=0&&s()}});return this.internalWaitFor(o,{customAct:r,onWaitStart:n,onWaitIdle:void 0,launchAwaiterOnInit:!1})}waitIdle(t){let r,n=new Promise(i=>r=i);return this.internalWaitFor(n,{customAct:t,onWaitStart:void 0,onWaitIdle:r,launchAwaiterOnInit:!0})}waitFor(t,r){return this.internalWaitFor(t,{customAct:r,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(Pp.buildLog).map(t=>`-> ${t}`).join(`
|
|
208
|
-
`)+"`"}};function ix(e){let t=0;return{clone:()=>ix(e),nextTaskIndex:r=>{if(e.length<=t)throw new Error("Invalid schedulerFor defined: too many tasks have been scheduled");let n=r.findIndex(i=>i.taskId===e[t]);if(n===-1)throw new Error("Invalid schedulerFor defined: unable to find next task");return++t,n}}}function e1(e,t){return new nx(e,ix(t))}function ox(e){let t=e.clone();return{clone:()=>ox(t),nextTaskIndex:r=>e.nextInt(0,r.length-1)}}var i5=class extends he{constructor(e){super(),this.act=e}generate(e,t){return new $(new nx(this.act,ox(e.clone())),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return V.nil()}};function o5(e){let{act:t=r=>r()}=e||{};return new i5(t)}function s5(e,t){let{act:r=n=>n()}=Array.isArray(e)?t||{}:e||{};return Array.isArray(e)?e1(r,e):function(n,...i){return e1(r,i)}}function a5(e={}){return er(e,O("-9223372036854775808"),O("9223372036854775807"),g4,xr)}function l5(e={}){return er(e,O(0),O("18446744073709551615"),y4,xr)}function c5(e,t){return t}var np=Math.floor,u5=Math.min;function pt(e,t){switch(e.type){case"Char":return{astNode:e,minLength:1};case"Repetition":switch(e.quantifier.kind){case"*":{let r=pt(e.expression,t);return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:t},expression:r.astNode},minLength:0}}case"+":{let r=pt(e.expression,t),n=r.minLength>1?r.minLength:1;return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:1,to:np(t/n)},expression:r.astNode},minLength:r.minLength}}case"?":{let r=pt(e.expression,t);return t<r.minLength?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:0},expression:r.astNode},minLength:0}:{astNode:{...e,expression:r.astNode},minLength:0}}case"Range":{let r=e.quantifier.from>1?np(t/e.quantifier.from):t,n=pt(e.expression,r),i=n.minLength>1?n.minLength:1;return e.quantifier.to===void 0||e.quantifier.to*i>t?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",to:np(t/i)},expression:n.astNode},minLength:e.quantifier.from*n.minLength}:{astNode:{...e,expression:n.astNode},minLength:e.quantifier.from*n.minLength}}default:return c5(e.quantifier,{astNode:e,minLength:0})}case"Quantifier":return{astNode:e,minLength:0};case"Alternative":{let r=0,n=[];for(let o=0;o!==e.expressions.length;++o){let s=t-r,a=pt(e.expressions[o],s);r+=a.minLength,L(n,{value:a,allowance:s})}let i=[];for(let o=0;o!==n.length;++o){let s=n[o].value,a=n[o].allowance,l=t-r+s.minLength;L(i,(l!==a?pt(s.astNode,l):s).astNode)}return{astNode:{...e,expressions:i},minLength:r}}case"CharacterClass":return{astNode:e,minLength:1};case"ClassRange":return{astNode:e,minLength:1};case"Group":{let r=pt(e.expression,t);return{astNode:{...e,expression:r.astNode},minLength:r.minLength}}case"Disjunction":{if(e.left===null){if(e.right===null)return{astNode:e,minLength:0};let i=pt(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=pt(e.left,t),o=i.minLength>t?null:i.astNode;return{astNode:{...e,left:o,right:null},minLength:0}}let r=pt(e.left,t),n=pt(e.right,t);return r.minLength>t?n:n.minLength>t?r:{astNode:{...e,left:r.astNode,right:n.astNode},minLength:u5(r.minLength,n.minLength)}}case"Assertion":return{astNode:e,minLength:0};case"Backreference":return{astNode:e,minLength:0};case"UnicodeProperty":return{astNode:e,minLength:1}}}function d5(e,t){return pt(e,t).astNode}function p5(e){return new Error(`Unsupported AST node! Received: ${Ae(e)}`)}function ga(e,t,r){if(!t&&!r)return e;let n={hasStart:!1,hasEnd:!1},i=sx(e,t,r,n),o=t&&!n.hasStart,s=r&&!n.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 sx(e,t,r,n){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 n.hasStart=!0,n.hasEnd=!0,{...e,expressions:e.expressions.map((i,o)=>ga(i,t&&o===0,r&&o===e.expressions.length-1))};case"CharacterClass":return e;case"ClassRange":return e;case"Group":return{...e,expression:sx(e.expression,t,r,n)};case"Disjunction":return n.hasStart=!0,n.hasEnd=!0,{...e,left:e.left!==null?ga(e.left,t,r):null,right:e.right!==null?ga(e.right,t,r):null};case"Assertion":if(e.kind==="^"||e.kind==="Lookahead")return n.hasStart=!0,e;if(e.kind==="$"||e.kind==="Lookbehind")return n.hasEnd=!0,e;throw new Error(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":return e;case"UnicodeProperty":return e;default:throw p5(e)}}function f5(e){return ga(e,!0,!0)}function t1(e,t){return e[t]>="\uD800"&&e[t]<="\uDBFF"&&e[t+1]>="\uDC00"&&e[t+1]<="\uDFFF"?2:1}function Ne(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"}function Tp(e){return e>="0"&&e<="9"}function ax(e,t){for(let r=t;r!==e.length;++r){let n=e[r];if(n==="\\")r+=1;else if(n==="]")return r}throw new Error("Missing closing ']'")}function h5(e,t){let r=0;for(let n=t;n!==e.length;++n){let i=e[n];if(i==="\\")n+=1;else if(i===")"){if(r===0)return n;r-=1}else i==="["?n=ax(e,n):i==="("&&(r+=1)}throw new Error("Missing closing ')'")}function m5(e,t){let r=!1;for(let n=t;n!==e.length;++n){let i=e[n];if(!Tp(i)){if(t===n)return-1;if(i===","){if(r)return-1;r=!0}else return i==="}"?n:-1}}return-1}function g5(e,t,r,n){switch(e[t]){case"[":return n===1?t+1:ax(e,t+1)+1;case"{":{if(n===1)return t+1;let i=m5(e,t+1);return i===-1?t+1:i+1}case"(":return n===1?t+1:h5(e,t+1)+1;case"]":case"}":case")":return t+1;case"\\":{let i=e[t+1];switch(i){case"x":if(Ne(e[t+2])&&Ne(e[t+3]))return t+4;throw new Error(`Unexpected token '${e.substring(t,t+4)}' found`);case"u":if(e[t+2]==="{"){if(!r)return t+2;if(e[t+4]==="}"){if(Ne(e[t+3]))return t+5;throw new Error(`Unexpected token '${e.substring(t,t+5)}' found`)}if(e[t+5]==="}"){if(Ne(e[t+3])&&Ne(e[t+4]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`)}if(e[t+6]==="}"){if(Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5]))return t+7;throw new Error(`Unexpected token '${e.substring(t,t+7)}' found`)}if(e[t+7]==="}"){if(Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5])&&Ne(e[t+6]))return t+8;throw new Error(`Unexpected token '${e.substring(t,t+8)}' found`)}if(e[t+8]==="}"&&Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5])&&Ne(e[t+6])&&Ne(e[t+7]))return t+9;throw new Error(`Unexpected token '${e.substring(t,t+9)}' found`)}if(Ne(e[t+2])&&Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`);case"p":case"P":{if(!r)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(!r)return t+2;throw new Error("Invalid \\k definition")}return o+1}default:if(Tp(i)){let o=r?e.length:Math.min(t+4,e.length),s=t+2;for(;s<o&&Tp(e[s]);++s);return s}return t+(r?t1(e,t+1):1)+1}}default:return t+(r?t1(e,t):1)}}function ua(e,t,r,n){let i=g5(e,t,r,n);return e.substring(t,i)}var r1={gc:"General_Category",sc:"Script",scx:"Script_Extensions"},Ea={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"},Gi=nf(Ea),rf={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"},Op=nf(rf),lx={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"},n1=nf(lx);function nf(e){let t={};for(let r of Object.keys(e)){let n=e[r];if(Array.isArray(n))for(let i=0;i!==n.length;++i)t[n[i]]=r;else t[n]=r}return t}function y5(e){return e in rf||e in Op}function b5(e){return e in Ea||e in Gi}function i1(e){if(e in r1)return r1[e];if(e in Gi)return Gi[e];if(e in Ea||e==="General_Category"||e==="Script"||e==="Script_Extensions")return e;throw new Error(`Unknown Unicode property name: ${e}`)}function o1(e){if(e in Op)return Op[e];if(e in n1)return n1[e];if(e in Gi)return Gi[e];if(e in rf||e in lx||e in Ea)return e;throw new Error(`Unknown Unicode property value: ${e}`)}function w5(e,t){let r=e.indexOf("=");if(r!==-1){let n=e.substring(0,r),i=e.substring(r+1);return{type:"UnicodeProperty",name:n,value:i,negative:t,shorthand:!1,binary:!1,canonicalName:i1(n),canonicalValue:o1(i)}}if(y5(e))return{type:"UnicodeProperty",name:"General_Category",value:e,negative:t,shorthand:!0,binary:!1,canonicalName:"General_Category",canonicalValue:o1(e)};if(b5(e)){let n=i1(e);return{type:"UnicodeProperty",name:e,value:e,negative:t,shorthand:!1,binary:!0,canonicalName:n,canonicalValue:n}}throw new Error(`Invalid Unicode property: ${e}`)}var ip=String.fromCodePoint;function op(e){let t=e.pop();if(t===void 0)throw new Error("Unable to extract token preceeding the currently parsed one");return t}function cx(e){return e>="0"&&e<="9"}function ya(e,t){return{type:"Char",kind:"simple",symbol:e,value:e,codePoint:e.codePointAt(0)||-1,escaped:t}}function kn(e,t){return{type:"Char",kind:"meta",symbol:t,value:e,codePoint:t.codePointAt(0)||-1}}function yr(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 sp(e){if(e[0]==="\\"){let t=e[1];switch(t){case"x":{let r=e.substring(2),n=Number.parseInt(r,16);return{type:"Char",kind:"hex",symbol:ip(n),value:e,codePoint:n}}case"u":{if(e==="\\u")return ya("u",!0);let r=e[2]==="{"?e.substring(3,e.length-1):e.substring(2),n=Number.parseInt(r,16);return{type:"Char",kind:"unicode",symbol:ip(n),value:e,codePoint:n}}case"0":return kn(e,"\0");case"n":return kn(e,`
|
|
209
|
-
`);case"f":return kn(e,"\f");case"r":return kn(e,"\r");case"t":return kn(e," ");case"v":return kn(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(
|
|
207
|
+
}`}return k8(o,{toString:{value:()=>s(Ae(t))},[Ct]:{value:()=>s(Ae(t))},[Xt]:{value:async()=>s(await jp(t))},[Ve]:{value:n,configurable:!0}})};return n()})}var E8=Number.MIN_SAFE_INTEGER,I8=Number.MAX_SAFE_INTEGER;function E0(){return new Pn(E8,I8)}var A8=Number.MAX_SAFE_INTEGER;function P8(){return new Pn(0,A8)}var T8=Number.parseInt;function O8(e){let[t,r]=e;switch(t){case"oct":return`0${Wi(r,8)}`;case"hex":return`0x${Wi(r,16)}`;default:return`${r}`}}function pa(e,t){let r=T8(e,t);if(Wi(r,t)!==e)throw new Error("Invalid value");return r}function M8(e){if(typeof e!="string")throw new Error("Invalid type");return e.length>=2&&e[0]==="0"?e[1]==="x"?["hex",pa(xe(e,2),16)]:["oct",pa(xe(e,1),8)]:["dec",pa(e,10)]}function N8(e){return he(e,".")}function L8(e){if(typeof e!="string")throw new Error("Invalid type");return G(Xe(e,"."),t=>pa(t,10))}function Qp(){return W(wr(255),wr(255),wr(255),wr(255)).map(N8,L8)}function Nt(e){return W(Lt("dec","oct","hex"),wr(e)).map(O8,M8)}function Gd(e){return he(e,".")}function qd(e){if(typeof e!="string")throw new Error("Invalid type");return Xe(e,".")}function I0(){return Be(W(Nt(255),Nt(255),Nt(255),Nt(255)).map(Gd,qd),W(Nt(255),Nt(255),Nt(65535)).map(Gd,qd),W(Nt(255),Nt(16777215)).map(Gd,qd),Nt(4294967295))}function ef(e){return e.length===0?[]:Xe(e,":")}function tf(e){let t=Xe(e,":");return t.length>=2&&t[t.length-1].length<=4?[Ue(t,0,t.length-2),`${t[t.length-2]}:${t[t.length-1]}`]:[Ue(t,0,t.length-1),t[t.length-1]]}function $8(e){return`${he(e[0],":")}:${e[1]}`}function D8(e){if(typeof e!="string")throw new Error("Invalid type");return tf(e)}function _8(e){return`::${he(e[0],":")}:${e[1]}`}function j8(e){if(typeof e!="string")throw new Error("Invalid type");if(!y3(e,"::"))throw new Error("Invalid value");return tf(xe(e,2))}function fa(e){return`${he(e[0],":")}::${he(e[1],":")}:${e[2]}`}function ha(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Xe(e,"::",2),[n,i]=tf(r);return[ef(t),n,i]}function F8(e){return fa([e[0],[e[1]],e[2]])}function B8(e){let t=ha(e);return[t[0],he(t[1],":"),t[2]]}function _v(e){return`${he(e[0],":")}::${e[1]}`}function jv(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Xe(e,"::",2);return[ef(t),r]}function V8(e){return`${he(e[0],":")}::`}function U8(e){if(typeof e!="string")throw new Error("Invalid type");if(!b3(e,"::"))throw new Error("Invalid value");return[ef(xe(e,0,e.length-2))]}function W8([e,t]){return`${e}:${t}`}function H8(e){if(typeof e!="string")throw new N("Invalid type");if(!e.includes(":"))throw new N("Invalid value");return e.split(":",2)}var z8="0123456789abcdef",Kd;function G8(){return Kd===void 0&&(Kd=oe({min:0,max:15}).map(e=>z8[e],e=>{if(typeof e!="string")throw new N("Not a string");if(e.length!==1)throw new N("Invalid length");let t=In(e,0);if(t<=57)return t-48;if(t<97)throw new N("Invalid character");return t-87})),Kd}function A0(){let e=Le({unit:G8(),minLength:1,maxLength:4,size:"max"}),t=Be(W(e,e).map(W8,H8),Qp());return Be(W(ce(e,{minLength:6,maxLength:6,size:"max"}),t).map($8,D8),W(ce(e,{minLength:5,maxLength:5,size:"max"}),t).map(_8,j8),W(ce(e,{minLength:0,maxLength:1,size:"max"}),ce(e,{minLength:4,maxLength:4,size:"max"}),t).map(fa,ha),W(ce(e,{minLength:0,maxLength:2,size:"max"}),ce(e,{minLength:3,maxLength:3,size:"max"}),t).map(fa,ha),W(ce(e,{minLength:0,maxLength:3,size:"max"}),ce(e,{minLength:2,maxLength:2,size:"max"}),t).map(fa,ha),W(ce(e,{minLength:0,maxLength:4,size:"max"}),e,t).map(F8,B8),W(ce(e,{minLength:0,maxLength:5,size:"max"}),t).map(_v,jv),W(ce(e,{minLength:0,maxLength:6,size:"max"}),e).map(_v,jv),W(ce(e,{minLength:0,maxLength:7,size:"max"})).map(V8,U8))}var q8=class extends me{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)}},K8=Object.getOwnPropertyNames;function J8(){let e=new Zt;return r=>{let n=lt(e,r);return n!==void 0||(n=new q8(String(r)),xt(e,r,n)),n}}function P0(e){let t=J8(),r=e(t),n=K8(r);for(let i of n){let o=t(i);o.underlying=r[i]}return r}function Y8(e,t){for(let r of e){let n=t[r]||{};if(n.maxLength===void 0||n.maxLength>0)return!0}return!1}function Z8(e,t){if(e.length===0)return Ie([]);if(!Y8(e,t))throw new N("Contraints on pool must accept at least one entity, maxLength cannot sum to 0");return W(...e.map(r=>ce(Ie(r),t[r]))).map(r=>G4(r)).filter(r=>r.length>0)}var Fv=Object.assign,ma=Object.create,T0=Object.defineProperty,Bv=Object.getPrototypeOf,X8=Object.prototype;function Q8(e){return T0(ma(null),Ct,{configurable:!1,enumerable:!1,writable:!1,value:()=>e})}function Vv(e,t){return Q8(`<${Ze(e)}#${t}>`)}function e7(e,t){let r=ma(X8);for(let n in e){let i=e[n],o=[];for(let s of i){let a=Fv(ma(Bv(s)),s);o.push(a)}r[n]=o}for(let n in t){let i=t[n];for(let o=0;o!==i.length;++o){let s=i[o],a=r[n][o];for(let l in s){let c=s[l];a[l]=c.index===void 0?void 0:typeof c.index=="number"?r[c.type][c.index]:G(c.index,u=>r[c.type][u])}T0(a,Ct,{configurable:!1,enumerable:!1,writable:!1,value:()=>{let l=e[n][o],c=Fv(ma(Bv(l)),l);for(let u in s){let d=s[u];c[u]=d.index===void 0?void 0:typeof d.index=="number"?Vv(d.type,d.index):G(d.index,p=>Vv(d.type,p))}return Ae(c)}})}}return r}function t7(e){let t=0,r=new Zt;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=lt(r,a.type);if(l===void 0&&(l=new Zt,xt(r,a.type,l)),s3(l,a.forwardRelationship))throw new N(`Cannot declare multiple inverse relationships for the same forward relationship ${Ze(a.forwardRelationship)} on type ${Ze(a.type)}`);xt(l,a.forwardRelationship,{type:i,property:s}),t+=1}}let n=new Zt;if(t===0)return n;for(let i in e){let o=e[i],s=lt(r,i);if(s!==void 0)for(let a in o){let l=o[a];if(l.arity==="inverse")continue;let c=lt(s,a);if(c!==void 0){if(c.type!==l.type)throw new N(`Inverse relationship ${Ze(c.property)} on type ${Ze(c.type)} references forward relationship ${Ze(a)} but types do not match`);xt(n,l,c)}}}if(n.size!==t)throw new N("Some inverse relationships could not be matched with their corresponding forward relationships");return n}var Uv=Object.create;function r7(e,t,r){switch(e){case"exclusive":return Ie(r);case"successor":return va(oe({min:t!==void 0?t+1:0,max:r}));case"any":return va(oe({min:0,max:r}))}}function n7(e,t,r,n,i,o,s){let a=r7(t,r,n);switch(e){case"0-1":return Qt(a,{nil:void 0,depthIdentifier:i}).generate(o,s).value;case"1":return a.generate(o,s).value;case"many":{let l=0,c=Qt(Gr(a,{depthIdentifier:i,selector:d=>d===n?d+ ++l:d,minLength:1}),{nil:[],depthIdentifier:i}).generate(o,s).value,u=0;return G(c,d=>d===n?d+u++:d)}}}var i7=class extends me{constructor(e,t){super(),this.relations=e,this.defaultEntities=t;let r=new En,n=new En;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(Sa(r,a.type))throw new N(`Cannot mix exclusive with other strategies for type ${Ze(a.type)}`);Ui(n,a.type)}else{if(Sa(n,a.type))throw new N(`Cannot mix exclusive with other strategies for type ${Ze(a.type)}`);Ui(r,a.type)}if(a.strategy==="successor"&&a.type!==i)throw new N("Cannot mix types for the strategy successor");if(a.strategy==="successor"&&a.arity==="1")throw new N("Cannot use an arity of 1 for the strategy successor")}}}this.inversedRelations=t7(e)}createEmptyLinksInstanceFor(e){let t=Uv(null),r=this.relations[e];for(let n in r){let i=r[n];i.arity==="inverse"&&(t[n]={type:i.type,index:[]})}return t}generate(e,t){let r=Uv(null);for(let o in this.relations)r[o]=[];let n=[];for(let o of this.defaultEntities)L(n,{type:o,indexInType:r[o].length,depth:0}),L(r[o],this.createEmptyLinksInstanceFor(o));let i=-1;for(;++i<n.length;){let o=n[i],s=this.relations[o.type],a=r[o.type][o.indexInType],l=Up();l.depth=o.depth;for(let c in s){let u=s[c];if(u.arity==="inverse")continue;let d=u.type,p=r[d],h=p.length,f=n7(u.arity,u.strategy||"any",d===o.type?o.indexInType:void 0,p.length,l,e,t);a[c]={type:d,index:f};let m=f===void 0?[]:typeof f=="number"?[f]:f;for(let g of m){g>=h&&(L(n,{type:d,indexInType:g,depth:o.depth+1}),L(p,this.createEmptyLinksInstanceFor(d)));let w=lt(this.inversedRelations,u);if(w!==void 0){let S=p[g][w.property].index;L(S,o.indexInType)}}}}return n.length=0,new $(r,void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return V.nil()}};function o7(e,t){return new i7(e,t)}var s7=Object.keys,a7=Object.getOwnPropertySymbols,l7=Object.getOwnPropertyDescriptor;function c7(e){let t=s7(e),r=a7(e);for(let n=0;n!==r.length;++n){let i=r[n],o=l7(e,i);o&&o.enumerable&&t.push(i)}return t}var u7=Object.create,d7=Object.defineProperty,p7=Object.getOwnPropertyDescriptor,f7=Object.getOwnPropertyNames,h7=Object.getOwnPropertySymbols;function m7(e,t){return function(n){let i=n[1]?u7(null):{};for(let o=0;o!==e.length;++o){let s=n[0][o];s!==t&&d7(i,e[o],{value:s,configurable:!0,enumerable:!0,writable:!0})}return i}}function g7(e,t){return function(n){if(typeof n!="object"||n===null)throw new Error("Incompatible instance received: should be a non-null object");let i=Object.getPrototypeOf(n)===null,o="constructor"in n&&n.constructor===Object;if(!i&&!o)throw new Error("Incompatible instance received: should be of exact type Object");let s=0,a=[];for(let u=0;u!==e.length;++u){let d=p7(n,e[u]);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,L(a,d.value)}else L(a,t)}let l=f7(n).length,c=h7(n).length;if(s!==l+c)throw new Error("Incompatible instance received: should not contain extra properties");return[a,i]}}var Jd=Symbol("no-key");function Yd(e,t,r){let n=c7(e),i=[];for(let o=0;o!==n.length;++o){let s=n[o],a=e[s];t===void 0||Jt(t,s)!==-1?L(i,a):L(i,Qt(a,{nil:Jd}))}return W(W(...i),r?Ie(!1):Ki()).map(m7(n,Jd),g7(n,Jd))}function Cp(e,t){let r=t!==void 0&&!!t.noNullPrototype;if(t===void 0||!("requiredKeys"in t&&t.requiredKeys!==void 0))return Yd(e,void 0,r);let n=("requiredKeys"in t?t.requiredKeys:void 0)||[];for(let i=0;i!==n.length;++i){let o=Object.getOwnPropertyDescriptor(e,n[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 Yd(e,n,r)}var y7=Object.create;function b7(e,t,r,n){let i=y7(null);for(let o in e){let s=e[o],a=Cp(s,n),l=t(o),c=r(o),u={minLength:l,maxLength:l};i[o]=c!==void 0?Gr(a,{...u,selector:c}):ce(a,u)}return Cp(i)}var Wv=Object.create,w7=Object.keys;function S7(e,t,r={}){let n=w7(e),i=r.initialPoolConstraints||Wv(null),o=r.unicityConstraints||Wv(null),s={noNullPrototype:r.noNullPrototype};return Z8(n,i).chain(a=>o7(t,a).chain(l=>b7(e,c=>l[c].length,c=>o[c],s).map(c=>e7(c,l))))}function v7(e){return he(G(e,t=>t[t.length-1]===","?xe(t,0,t.length-1):t)," ")}function x7(e){return function(r){if(typeof r!="string")throw new Error("Unsupported type");let n=[];for(let i of Xe(r," "))if(e.canShrinkWithoutContext(i))L(n,i);else if(e.canShrinkWithoutContext(i+","))L(n,i+",");else throw new Error("Unsupported word");return n}}function k7(e){let t=he(e," ");return t[t.length-1]===","&&(t=xe(t,0,t.length-1)),Np(t[0])+xe(t,1)+"."}function C7(e){return function(r){if(typeof r!="string")throw new Error("Unsupported type");if(r.length<2||r[r.length-1]!=="."||r[r.length-2]===","||Np(ap(r[0]))!==r[0])throw new Error("Unsupported value");let n=ap(r[0])+xe(r,1,r.length-1),i=[],o=Xe(n," ");for(let s=0;s!==o.length;++s){let a=o[s];if(e.canShrinkWithoutContext(a))L(i,a);else if(s===o.length-1&&e.canShrinkWithoutContext(a+","))L(i,a+",");else throw new Error("Unsupported word")}return i}}function R7(e){return he(e," ")}function E7(e){if(typeof e!="string")throw new Error("Unsupported type");let t=Xe(e,". ");for(let r=0;r<t.length-1;++r)t[r]+=".";return t}var b=(e,t)=>({arbitrary:Ie(e),weight:t});function I7(){return Be(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 A7(e={}){let{maxCount:t,mode:r="words",size:n}=e;if(t!==void 0&&t<1)throw new Error("lorem has to produce at least one word/sentence");let i=I7();return r==="sentences"?ce(ce(i,{minLength:1,size:"small"}).map(k7,C7(i)),{minLength:1,maxLength:t,size:n}).map(R7,E7):ce(i,{minLength:1,maxLength:t,size:n}).map(v7,x7(i))}function P7(e){return new Map(e)}function T7(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 O7(e){return e[0]}function Rp(e,t,r={}){return Gr(W(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:O7,depthIdentifier:r.depthIdentifier,comparator:"SameValueZero"}).map(P7,T7)}var aa=10;function M7(e){let t={};return(r=>{let n=r!==void 0?r:aa;if(!R1(t,n)){let i=aa;aa=n-1,t[n]=e(n),aa=i}return t[n]})}function N7(e){let t=0;for(;e>O(0);)e&O(1)&&++t,e>>=O(1);return t}function L7(e,t){let r=(O(1)<<O(t))-O(1),n=e&r,i=N7(e-n),o=n;for(let s=O(1);s<=r&&i!==0;s<<=O(1))o&s||(o|=s,--i);return o}function la(e,t){let r=[];for(let n=e.length-1;n!==-1;--n)t(e[n])!==e[n]&&L(r,n);return r}function $7(e,t,r){let n=O(0);for(let i=0,o=O(1);i!==r.length;++i,o<<=O(1))e[r[i]]!==t[r[i]]&&(n|=o);return n}function Zd(e,t,r,n){for(let i=0,o=O(1);i!==r.length;++i,o<<=O(1))t&o&&(e[r[i]]=n(e[r[i]]))}var D7=class extends me{constructor(e,t,r){super(),this.stringArb=e,this.toggleCase=t,this.untoggleAll=r}buildContextFor(e,t){return{rawString:e.value,rawStringContext:e.context,flags:t.value,flagsContext:t.context}}generate(e,t){let r=this.stringArb.generate(e,t),n=[...r.value],i=la(n,this.toggleCase),o=xr(O(0),(O(1)<<O(i.length))-O(1)).generate(e,void 0);return Zd(n,o.value,i,this.toggleCase),new $(he(n,""),this.buildContextFor(r,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 r;if(t!==void 0)r=t;else if(this.untoggleAll!==void 0){let o=this.untoggleAll(e),s=[...e],a=[...o];r={rawString:o,rawStringContext:void 0,flags:$7(a,s,la(a,this.toggleCase)),flagsContext:void 0}}else r={rawString:e,rawStringContext:void 0,flags:O(0),flagsContext:void 0};let n=r.rawString,i=r.flags;return this.stringArb.shrink(n,r.rawStringContext).map(o=>{let s=[...o.value],a=la(s,this.toggleCase),l=L7(i,a.length);return Zd(s,l,a,this.toggleCase),new $(he(s,""),this.buildContextFor(o,new $(l,void 0)))}).join(Sr(()=>{let o=[...n],s=la(o,this.toggleCase);return xr(O(0),(O(1)<<O(s.length))-O(1)).shrink(i,r.flagsContext).map(a=>{let l=Ue(o);return Zd(l,a.value,s,this.toggleCase),new $(he(l,""),this.buildContextFor(new $(n,r.rawStringContext),a))})}))}};function _7(e){let t=Np(e);return t!==e?t:ap(e)}function j7(e,t){return new D7(e,t&&t.toggleCase||_7,t&&t.untoggleAll)}function F7(e){return b1.from(e)}function B7(e){if(!(e instanceof b1))throw new Error("Unexpected type");return[...e]}function O0(e={}){return ce(k0(e),e).map(F7,B7)}function V7(e){return w1.from(e)}function U7(e){if(!(e instanceof w1))throw new Error("Unexpected type");return[...e]}function M0(e={}){return ce(Ra(e),e).map(V7,U7)}function er(e,t,r,n,i){let o=n.name,{min:s=t,max:a=r,...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>r)throw new Error(`Invalid max value passed to ${o}: max must be lower than or equal to ${r}`);return ce(i({min:s,max:a}),l).map(c=>n.from(c),c=>{if(!(c instanceof n))throw new Error("Invalid type");return[...c]})}function N0(e={}){return er(e,-32768,32767,I4,oe)}function L0(e={}){return er(e,-2147483648,2147483647,A4,oe)}function $0(e={}){return er(e,-128,127,E4,oe)}function D0(e={}){return er(e,0,65535,O4,oe)}function _0(e={}){return er(e,0,4294967295,M4,oe)}function j0(e={}){return er(e,0,255,P4,oe)}function F0(e={}){return er(e,0,255,T4,oe)}function W7(e){return e!==void 0}function Hv(e){return e.hasToBeCloned?new $(e.value_,{generatorContext:e.context},()=>e.value):new $(e.value_,{generatorContext:e.context})}function zv(e){return e.hasToBeCloned?new $(e.value_,{shrinkerContext:e.context},()=>e.value):new $(e.value_,{shrinkerContext:e.context})}var H7=class extends me{constructor(e,t){super(),this.generatorArbitrary=e,this.shrinkerArbitrary=t}generate(e,t){return Hv(this.generatorArbitrary.generate(e,t))}canShrinkWithoutContext(e){return this.shrinkerArbitrary.canShrinkWithoutContext(e)}shrink(e,t){return W7(t)?"generatorContext"in t?this.generatorArbitrary.shrink(e,t.generatorContext).map(Hv):this.shrinkerArbitrary.shrink(e,t.shrinkerContext).map(zv):this.shrinkerArbitrary.shrink(e,void 0).map(zv)}};function Ep(e,t,r){let n=oe({min:e,max:t});return t===r?n:new H7(n,oe({min:e,max:r}))}var z7=Math.min,Ip=Math.max,Gv=g1.isArray,G7=Object.entries;function q7(e){let t=-1;for(let r=0;r!==e.length;++r)t=Ip(t,e[r][0]);return t}function K7(e,t){let r=g1(e);for(let n=0;n!==t.length;++n){let i=t[n];i[0]<e&&(r[i[0]]=i[1])}return r}function B0(e,t={}){let{size:r,minNumElements:n=0,maxLength:i=zr,maxNumElements:o=i,noTrailingHole:s,depthIdentifier:a}=t,l=zi(r,zi(r,n,o,t.maxNumElements!==void 0),i,t.maxLength!==void 0);if(n>i)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal length of the array");if(n>o)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal number of non-holes");let c=z7(o,i),u=t.maxNumElements!==void 0||r!==void 0?r:"=",d=Gr(W(Ep(0,Ip(l-1,0),Ip(i-1,0)),e),{size:u,minLength:n,maxLength:c,selector:p=>p[0],depthIdentifier:a}).map(p=>K7(q7(p)+1,p),p=>{if(!Gv(p))throw new Error("Not supported entry type");if(s&&p.length!==0&&!(p.length-1 in p))throw new Error("No trailing hole");return G(G7(p),h=>[Number(h[0]),h[1]])});return s||i===n?d:W(d,Ep(n,l,i)).map(p=>{let h=p[0],f=p[1];if(h.length>=f)return h;let m=Ue(h);return m.length=f,m},p=>{if(!Gv(p))throw new Error("Not supported entry type");return[p,p.length]})}function J7(e){return new Set(e)}function Y7(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 V0(e,t={}){return Gr(e,{minLength:t.minLength,maxLength:t.maxLength,size:t.size,depthIdentifier:t.depthIdentifier,comparator:"SameValueZero"}).map(J7,Y7)}function Z7(e,t,r,n,i,o){return zp(e,t,{maxKeys:r,noNullPrototype:!o,size:n,depthIdentifier:i})}function X7(e){return Be($0(e),j0(e),F0(e),N0(e),D0(e),L0(e),_0(e),O0(e),M0(e))}function U0(e){let t=e.values,r=e.depthSize,n=Up(),i=e.maxDepth,o=e.maxKeys,s=e.size,a=Be(...t,...e.withBigInt?[xr()]:[],...e.withDate?[n0()]:[]);return P0(l=>({anything:Be({maxDepth:i,depthSize:r,depthIdentifier:n},a,l("array"),l("object"),...e.withMap?[l("map")]:[],...e.withSet?[l("set")]:[],...e.withObjectString?[l("anything").map(c=>Ae(c))]:[],...e.withTypedArray?[X7({maxLength:o,size:s})]:[],...e.withSparseArray?[B0(l("anything"),{maxNumElements:o,size:s,depthIdentifier:n})]:[]),keys:e.withObjectString?Be({arbitrary:e.key,weight:10},{arbitrary:l("anything").map(c=>Ae(c)),weight:1}):e.key,array:ce(l("anything"),{maxLength:o,size:s,depthIdentifier:n}),set:V0(l("anything"),{maxLength:o,size:s,depthIdentifier:n}),map:Be(Rp(l("keys"),l("anything"),{maxKeys:o,size:s,depthIdentifier:n}),Rp(l("anything"),l("anything"),{maxKeys:o,size:s,depthIdentifier:n})),object:Z7(l("keys"),l("anything"),o,s,n,e.withNullPrototype)})).anything}function Q7(e){switch(typeof e){case"boolean":return new y1(e);case"number":return new Yt(e);case"string":return new Ze(e);default:return e}}function e9(e){return typeof e!="object"||e===null||!("constructor"in e)?e:e.constructor===y1||e.constructor===Yt||e.constructor===Ze?e.valueOf():e}function t9(e){return e.map(Q7,e9)}function r9(e,t){return[Ki(),E0(),Ra(),t(e),Be(t(e),Ie(null),Ie(void 0))]}function n9(e){return e.map(t=>t9(t))}function i9(e,t){return t?n9(e).concat(e):e}function W0(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:Le(t),values:i9(e.values!==void 0?e.values:r9(t,Le),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 o9(e){return zp(e.key,U0(e),{maxKeys:e.maxKeys,noNullPrototype:!e.withNullPrototype,size:e.size})}function s9(e){return o9(W0(e))}function a9(e,t){let{depthSize:r,maxDepth:n}=t;return{key:e,values:[Ki(),Ra({noDefaultInfinity:!0,noNaN:!0}),e,Ie(null)],depthSize:r,maxDepth:n}}function H0(e){return U0(W0(e))}function z0(e={}){let t=e.noUnicodeString===void 0||e.noUnicodeString===!0;return H0(a9("stringUnit"in e?Le({unit:e.stringUnit}):t?Le():Le({unit:"binary"}),e))}var l9=JSON.stringify,c9=JSON.parse;function u9(e){if(typeof e!="string")throw new N("Cannot unmap the passed value");return c9(e)}function d9(e={}){return z0(e).map(l9,u9)}var p9=Object.defineProperties;function Xd(e,t){return`Stream(${t!==void 0?`${he(t,",")}\u2026`:`${e} emitted`})`}var f9=class extends me{constructor(e,t){super(),this.arb=e,this.history=t}generate(e,t){let r=t!==void 0&&e.nextInt(1,t)===1?t:void 0,n=()=>{let i=this.history?[]:null,o=0,s=function*(a,l){for(;;){let c=a.generate(l,r).value;o++,i!==null&&L(i,c),yield c}};return p9(new V(s(this.arb,e.clone())),{toString:{value:()=>Xd(o,i!==null?i.map(Ae):void 0)},[Ct]:{value:()=>Xd(o,i!==null?i.map(Ae):void 0)},[Xt]:{value:async()=>Xd(o,i!==null?await Promise.all(i.map(jp)):void 0)},[Ve]:{value:n,enumerable:!0}})};return new $(n(),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return V.nil()}};function h9(e,t){return new f9(e,t!==void 0&&typeof t=="object"&&"noHistory"in t?!t.noHistory:!0)}function m9(e){return he(e,"")}function qv(e){if(typeof e!="string")throw new Error("Cannot unmap the passed value");return[...e]}function g9(e){switch(e.length%4){case 0:return e;case 3:return`${e}=`;case 2:return`${e}==`;default:return xe(e,1)}}function y9(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 xe(e,0,t)}var Qd=String.fromCharCode;function b9(e){return e<26?Qd(e+65):e<52?Qd(e+97-26):e<62?Qd(e+48-52):e===62?"+":"/"}function w9(e){if(typeof e!="string"||e.length!==1)throw new N("Invalid entry");let t=In(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 S9(){return oe({min:0,max:63}).map(b9,w9)}function v9(e={}){let{minLength:t=0,maxLength:r=zr,size:n}=e,i=t+3-(t+3)%4,o=r-r%4,s=e.maxLength===void 0&&n===void 0?"=":n;if(i>o)throw new N("Minimal length should be inferior or equal to maximal length");if(i%4!==0)throw new N("Minimal length of base64 strings must be a multiple of 4");if(o%4!==0)throw new N("Maximal length of base64 strings must be a multiple of 4");let a=S9();return ce(a,{minLength:i,maxLength:o,size:s,experimentalCustomSlices:rj(a,qv)}).map(m9,qv).map(g9,y9)}var Kv=Object.is;function x9(e,t){let r=new Zt,n=0;for(let i of e)Kv(i,-0)?++n:xt(r,i,(lt(r,i)||0)+1);for(let i=0;i!==t.length;++i){if(!(i in t))return!1;let o=t[i];if(Kv(o,-0)){if(n===0)return!1;--n}else{let s=lt(r,o)||0;if(s===0)return!1;xt(r,o,s-1)}}return!0}var k9=Math.floor,Jv=Math.log,C9=Array.isArray,G0=class extends me{constructor(e,t,r,n){if(super(),this.originalArray=e,this.isOrdered=t,this.minLength=r,this.maxLength=n,r<0||r>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(n<0||n>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(r>n)throw new Error("fc.*{s|S}ubarrayOf expects the minimal length to be inferior or equal to the maximal length");this.lengthArb=new Pn(r,n),this.biasedLengthArb=r!==n?new Pn(r,r+k9(Jv(n-r)/Jv(2))):this.lengthArb}generate(e,t){let r=(t!==void 0&&e.nextInt(1,t)===1?this.biasedLengthArb:this.lengthArb).generate(e,void 0),n=r.value,i=G(this.originalArray,(s,a)=>a),o=[];for(let s=0;s!==n;++s){let a=e.nextInt(0,i.length-1);L(o,i[a]),x1(i,a,1)}return this.isOrdered&&k1(o,(s,a)=>s-a),new $(G(o,s=>this.originalArray[s]),r.context)}canShrinkWithoutContext(e){return!C9(e)||!this.lengthArb.canShrinkWithoutContext(e.length)?!1:x9(this.originalArray,e)}shrink(e,t){return e.length===0?V.nil():this.lengthArb.shrink(e.length,t).map(r=>new $(Ue(e,e.length-r.value),r.context)).join(e.length>this.minLength?Sr(()=>this.shrink(Ue(e,1),void 0).filter(r=>this.minLength<=r.value.length+1).map(r=>new $([e[0],...r.value],void 0))):V.nil())}};function R9(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new G0(e,!0,r,n)}function E9(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new G0(e,!1,r,n)}var I9={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"},A9={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 P9(e){return e<10?Ze(e):I9[e]}function Yv(e,t){let r="";for(;e.length+r.length<t;)r+="0";return r+e}function Zv(e){let t="";for(let r=e;r!==0;){let n=r>>5;t=P9(r-(n<<5))+t,r=n}return t}function T9(e,t){let r=~~(e/1073741824),n=e&1073741823;return Yv(Zv(r),t-6)+Yv(Zv(n),6)}function q0(e){return function(r){return T9(r,e)}}function ep(e){if(typeof e!="string")throw new N("Unsupported type");let t=0,r=1;for(let n=e.length-1;n>=0;--n){let i=A9[e[n]];if(i===void 0)throw new N("Unsupported type");t+=i*r,r*=32}return t}var O9=q0(10),Xv=q0(8);function M9(e){return O9(e[0])+Xv(e[1])+Xv(e[2])}function N9(e){if(typeof e!="string"||e.length!==26)throw new Error("Unsupported type");return[ep(e.slice(0,10)),ep(e.slice(10,18)),ep(e.slice(18))]}function L9(){return W(oe({min:0,max:0xffffffffffff}),oe({min:0,max:0xffffffffff}),oe({min:0,max:0xffffffffff})).map(M9,N9)}function K0(e){return w3(Wi(e,16),8,"0")}function $9(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!==K0(t))throw new Error("Unsupported value: invalid content");return t}function tp(e,t){return oe({min:e,max:t}).map(K0,$9)}function D9(e){return`${e[0]}-${xe(e[1],4)}-${xe(e[1],0,4)}-${xe(e[2],0,4)}-${xe(e[2],4)}${e[3]}`}var _9=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/;function j9(e){if(typeof e!="string")throw new Error("Unsupported type");let t=_9.exec(e);if(t===null)throw new Error("Unsupported type");return[t[1],t[3]+t[2],t[4]+xe(t[5],0,4),xe(t[5],4)]}var Qv="0123456789abcdef";function F9(e){let t={},r={};for(let o=0;o!==e.length;++o){let s=Qv[o],a=Qv[e[o]];t[s]=a,r[a]=s}function n(o){return t[o[0]]+xe(o,1)}function i(o){if(typeof o!="string")throw new N("Cannot produce non-string values");let s=r[o[0]];if(s===void 0)throw new N("Cannot produce strings not starting by the version in hexa code");return s+xe(o,1)}return{versionsApplierMapper:n,versionsApplierUnmapper:i}}function B9(e){let t={};for(let r of e){if(t[r])throw new N(`Version ${r} has been requested at least twice for uuid`);if(t[r]=!0,r<1||r>15)throw new N(`Version must be a value in [1-15] for uuid, but received ${r}`);if(~~r!==r)throw new N(`Version must be an integer value for uuid, but received ${r}`)}if(e.length===0)throw new N("Must provide at least one version for uuid")}function V9(e={}){let t=tp(0,4294967295),r=e.version!==void 0?typeof e.version=="number"?[e.version]:e.version:[1,2,3,4,5,6,7,8];B9(r);let{versionsApplierMapper:n,versionsApplierUnmapper:i}=F9(r);return W(t,tp(0,268435456*r.length-1).map(n,i),tp(2147483648,3221225471),t).map(D9,j9)}function U9(e){return Le({unit:Kp("-._~!$&'()*+,;=:"),size:e})}function W9([e,t,r]){return(e===null?"":`${e}@`)+t+(r===null?"":`:${r}`)}function H9(e){if(typeof e!="string")throw new Error("Unsupported");let t=e.indexOf("@"),r=t!==-1?e.substring(0,t):null,n=/:(\d+)$/.exec(e),i=n!==null?Number(n[1]):null;return[r,n!==null?e.substring(t+1,e.length-n[1].length-1):e.substring(t+1),i]}function z9(e){return`[${e}]`}function G9(e){if(typeof e!="string"||e[0]!=="["||e[e.length-1]!=="]")throw new Error("Unsupported");return e.substring(1,e.length-1)}function J0(e){let t=e||{},r=t.size,n=[Jp({size:r}),...t.withIPv4===!0?[Qp()]:[],...t.withIPv6===!0?[A0().map(z9,G9)]:[],...t.withIPv4Extended===!0?[I0()]:[]];return W(t.withUserInfo===!0?Qt(U9(r)):Ie(null),Be(...n),t.withPort===!0?Qt(wr(65535)):Ie(null)).map(W9,H9)}function Y0(e){return Le({unit:Kp("-._~!$&'()*+,;=:@/?"),size:e})}function Z0(e={}){return Y0(e.size)}function X0(e={}){return Le({unit:Kp("-._~!$&'()*+,;=:@"),size:e.size})}function q9(e){return he(G(e,t=>`/${t}`),"")}function K9(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 x1(Xe(e,"/"),1)}function J9(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 rp(e,t){return ce(X0({size:e}),{size:t}).map(q9,K9)}function Y9(e){let[t,r]=J9(e);return t===r?rp(t,r):Be(rp(t,r),rp(r,t))}function Q0(e){return Y9(Hp((e||{}).size))}function ex(e={}){return Y0(e.size)}function Z9(e){let[t,r,n]=e;return`${t}://${r}${n}${e[3]===null?"":`?${e[3]}`}${e[4]===null?"":`#${e[4]}`}`}var X9=/^([[A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)([^?#]*)(\?[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?(#[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?$/;function Q9(e){if(typeof e!="string")throw new Error("Incompatible value received: type");let t=X9.exec(e);if(t===null)throw new Error("Incompatible value received");let r=t[1],n=t[2],i=t[3],o=t[4],s=t[5];return[r,n,i,o!==void 0?o.substring(1):null,s!==void 0?s.substring(1):null]}function e5(e){let t=e||{},r=Hp(t.size),n=t.authoritySettings!==void 0&&t.authoritySettings.size!==void 0?qi(t.authoritySettings.size,r):r,i={...t.authoritySettings,size:n};return W(Lt(...t.validSchemes||["http","https"]),J0(i),Q0({size:r}),t.withQueryParameters===!0?Qt(ex({size:r})):Ie(null),t.withFragments===!0?Qt(Z0({size:r})):Ie(null)).map(Z9,Q9)}var t5=class tx{constructor(t,r){this.commands=t,this.metadataForReplay=r,this[Ve]=function(){return new tx(this.commands.map(n=>n.clone()),this.metadataForReplay)}}[Symbol.iterator](){return this.commands[Symbol.iterator]()}toString(){let t=this.commands.filter(n=>n.hasRan).map(n=>n.toString()).join(","),r=this.metadataForReplay();return r.length!==0?`${t} /*${r}*/`:t}},r5=class Ap{constructor(t){if(this.cmd=t,this.hasRan=!1,Dp(t)){let r=t[Ct];this[Ct]=function(){return r.call(t)}}if(_p(t)){let r=t[Xt];this[Xt]=function(){return r.call(t)}}}check(t){return this.cmd.check(t)}run(t,r){return this.hasRan=!0,this.cmd.run(t,r)}clone(){return Hr(this.cmd)?new Ap(this.cmd[Ve]()):new Ap(this.cmd)}toString(){return this.cmd.toString()}},e1=class{static parse(e){let[t,r]=e.split(":"),n=this.parseCounts(t),i=this.parseChanges(r);return this.parseOccurences(n,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,r)=>(t.length===0||t[t.length-1].count===64||t[t.length-1].value!==r?t.push({value:r,count:1}):t[t.length-1].count+=1,t),[])}static parseOccurences(e,t){let r=[];for(let n=0;n!==e.length;++n){let i=e[n],o=t[n];for(let s=0;s!==i;++s)r.push(o)}return r}static stringifyChanges(e){let t="";for(let r=0;r<e.length;r+=6){let n=e.slice(r,r+6).reduceRight((i,o)=>(i<<1)+(o.value?1:0),0);t+=this.intToB64(n)}return t}static parseChanges(e){let t=e.split("").map(n=>this.b64ToInt(n)),r=[];for(let n=0;n!==t.length;++n){let i=t[n];for(let o=0;o!==6;++o,i>>=1)r.push(i%2===1)}return r}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)}},n5=class extends me{constructor(e,t,r,n,i){super(),this.sourceReplayPath=n,this.disableReplayLog=i,this.oneCommandArb=Be(...e).map(o=>new r5(o)),this.lengthArb=Ep(0,t,r),this.replayPath=[],this.replayPathPosition=0}metadataForReplay(){return this.disableReplayLog?"":`replayPath=${JSON.stringify(e1.stringify(this.replayPath))}`}buildValueFor(e,t){let r=e.map(i=>i.value_),n={shrunkOnce:t,items:e};return new $(new t5(r,()=>this.metadataForReplay()),n)}generate(e){let t=this.lengthArb.generate(e,void 0).value,r=Array(t);for(let n=0;n!==t;++n)r[n]=this.oneCommandArb.generate(e,void 0);return this.replayPathPosition=0,this.buildValueFor(r,!1)}canShrinkWithoutContext(e){return!1}filterOnExecution(e){let t=[];for(let r of e)r.value_.hasRan?(this.replayPath.push(!0),t.push(r)):this.replayPath.push(!1);return t}filterOnReplay(e){return e.filter((t,r)=>{let n=this.replayPath[this.replayPathPosition+r];if(n===void 0)throw new Error("Too short replayPath");if(!n&&t.value_.hasRan)throw new Error("Mismatch between replayPath and real execution");return n})}filterForShrinkImpl(e){this.replayPathPosition===0&&(this.replayPath=this.sourceReplayPath!==null?e1.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 V.nil();let r=t,n=r.shrunkOnce,i=r.items,o=this.filterForShrinkImpl(i);if(o.length===0)return V.nil();let s=n?V.nil():new V([[]][Symbol.iterator]()),a=[];for(let l=0;l!==o.length;++l)a.push(Sr(()=>{let c=o.slice(0,l);return this.lengthArb.shrink(o.length-1-l,void 0).map(u=>c.concat(o.slice(o.length-(u.value+1))))}));for(let l=0;l!==o.length;++l)a.push(Sr(()=>this.oneCommandArb.shrink(o[l].value_,o[l].context).map(c=>o.slice(0,l).concat([c],o.slice(l+1)))));return s.join(...a).map(l=>this.buildValueFor(l.map(c=>new $(c.value_.clone(),c.context)),!0))}};function i5(e,t={}){let{size:r,maxCommands:n=zr,disableReplayLog:i=!1,replayPath:o=null}=t;return new n5(e,zi(r,0,n,t.maxCommands!==void 0),n,o,i)}var o5=class{constructor(e,t){this.s=e,this.cmd=t}async check(e){let t=null,r=!1;if((await this.s.scheduleSequence([{label:`check@${this.cmd.toString()}`,builder:async()=>{try{r=await Promise.resolve(this.cmd.check(e))}catch(n){throw t=n,n}}}]).task).faulty)throw t;return r}async run(e,t){let r=null;if((await this.s.scheduleSequence([{label:`run@${this.cmd.toString()}`,builder:async()=>{try{await this.cmd.run(e,t)}catch(n){throw r=n,n}}}]).task).faulty)throw r}},s5=function*(e,t){for(let r of t)yield new o5(e,r)},rx=(e,t,r,n,i)=>e.then(o=>{let{model:s,real:a}=o,l=r;for(let c of t)l=i(l,()=>n(c,s,a));return l}),a5=(e,t)=>rx({then:o=>{o(e())}},t,void 0,(o,s,a)=>{o.check(s)&&o.run(s,a)},(o,s)=>s()),l5=e=>typeof e.then=="function",nx=async(e,t,r=Promise.resolve())=>await rx({then:s=>{let a=e();return l5(a)?a.then(s):s(a)}},t,r,async(s,a,l)=>{await s.check(a)&&await s.run(a,l)},(s,a)=>s.then(a));function c5(e,t){a5(e,t)}async function u5(e,t){await nx(e,t)}async function d5(e,t,r){let n=nx(t,s5(e,r),e.schedule(Promise.resolve(),"startModel"));await e.waitFor(n),await e.waitAll()}var ca=e=>e(),ix=class Pp{constructor(t,r){this.act=t,this.taskSelector=r,this.lastTaskId=0,this.sourceTaskSelector=r.clone(),this.scheduledTasks=[],this.triggeredTasks=[],this.scheduledWatchers=[],this[Ve]=function(){return new Pp(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 ${m8(t.outputValue)}`:""}`}log(t,r,n,i,o,s){this.triggeredTasks.push({status:o,schedulingType:t,taskId:r,label:n,metadata:i,outputValue:s!==void 0?Ae(s):void 0})}scheduleInternal(t,r,n,i,o,s){let a=++this.lastTaskId,l,c=new Promise((u,d)=>{l=()=>{let p=Promise.resolve(s!==void 0?n.then(()=>s()):n);return p.then(h=>{this.log(t,a,r,i,"resolved",h),u(h)},h=>{this.log(t,a,r,i,"rejected",h),d(h)}),p}});return this.scheduledTasks.push({original:n,trigger:l,schedulingType:t,taskId:a,label:r,metadata:i,customAct:o}),this.scheduledWatchers.length!==0&&this.scheduledWatchers[0](),c}schedule(t,r,n,i){return this.scheduleInternal("promise",r||"",t,n,i||ca)}scheduleFunction(t,r){return(...n)=>this.scheduleInternal("function",`${t.name}(${n.map(Ae).join(",")})`,t(...n),void 0,r||ca)}scheduleSequence(t,r){let n={done:!1,faulty:!1},i={then:u=>u()},o=()=>{},s=new Promise(u=>{o=()=>u({done:n.done,faulty:n.faulty})}),a=()=>{n.faulty=!0,o()},l=()=>{n.done=!0,o()},c=(u,d)=>{if(u>=t.length){d.then(l,a);return}d.then(()=>{let p=t[u],[h,f,m]=typeof p=="function"?[p,p.name,void 0]:[p.builder,p.label,p.metadata],g=this.scheduleInternal("sequence",f,i,m,r||ca,()=>h());c(u+1,g)},a)};return c(0,i),Object.assign(n,{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),[r]=this.scheduledTasks.splice(t,1);return r.customAct(()=>r.trigger().catch(n=>{}))}waitOne(t){let r=t||ca;return this.act(()=>r(()=>this.internalWaitOne()))}async waitAll(t){for(;this.scheduledTasks.length>0;)await this.waitOne(t)}async internalWaitFor(t,r){let n=!1,i=r.customAct,o=r.onWaitStart,s=r.onWaitIdle,a=r.launchAwaiterOnInit,l,c,u=0,d=null,p=null,h=async()=>{for(u=50,u=50;!n&&u>0;--u)await Promise.resolve();if(!n&&this.scheduledTasks.length>0)return o!==void 0&&o(),p=this.waitOne(i),p.then(()=>(p=null,h()),w=>{throw p=null,n=!0,c(w),w});!n&&s!==void 0&&s(),d=null},f=()=>{if(d!==null){u=51;return}d=h().catch(()=>{})},m=()=>{let w=this.scheduledWatchers.indexOf(f);w!==-1&&this.scheduledWatchers.splice(w,1),w===0&&this.scheduledWatchers.length!==0&&this.scheduledWatchers[0]()},g=new Promise((w,S)=>{l=y=>{m(),w(y)},c=y=>{m(),S(y)}});return t.then(w=>{n=!0,p===null?l(w):p.then(()=>l(w),S=>c(S))},w=>{n=!0,p===null?c(w):p.then(()=>c(w),()=>c(w))}),(this.scheduledTasks.length>0||a)&&this.scheduledWatchers.length===0&&f(),this.scheduledWatchers.push(f),g}waitNext(t,r){let n,i=t,o=i<=0?Promise.resolve():new Promise(s=>{n=()=>{--i<=0&&s()}});return this.internalWaitFor(o,{customAct:r,onWaitStart:n,onWaitIdle:void 0,launchAwaiterOnInit:!1})}waitIdle(t){let r,n=new Promise(i=>r=i);return this.internalWaitFor(n,{customAct:t,onWaitStart:void 0,onWaitIdle:r,launchAwaiterOnInit:!0})}waitFor(t,r){return this.internalWaitFor(t,{customAct:r,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(Pp.buildLog).map(t=>`-> ${t}`).join(`
|
|
208
|
+
`)+"`"}};function ox(e){let t=0;return{clone:()=>ox(e),nextTaskIndex:r=>{if(e.length<=t)throw new Error("Invalid schedulerFor defined: too many tasks have been scheduled");let n=r.findIndex(i=>i.taskId===e[t]);if(n===-1)throw new Error("Invalid schedulerFor defined: unable to find next task");return++t,n}}}function t1(e,t){return new ix(e,ox(t))}function sx(e){let t=e.clone();return{clone:()=>sx(t),nextTaskIndex:r=>e.nextInt(0,r.length-1)}}var p5=class extends me{constructor(e){super(),this.act=e}generate(e,t){return new $(new ix(this.act,sx(e.clone())),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return V.nil()}};function f5(e){let{act:t=r=>r()}=e||{};return new p5(t)}function h5(e,t){let{act:r=n=>n()}=Array.isArray(e)?t||{}:e||{};return Array.isArray(e)?t1(r,e):function(n,...i){return t1(r,i)}}function m5(e={}){return er(e,O("-9223372036854775808"),O("9223372036854775807"),C4,xr)}function g5(e={}){return er(e,O(0),O("18446744073709551615"),R4,xr)}function y5(e,t){return t}var np=Math.floor,b5=Math.min;function pt(e,t){switch(e.type){case"Char":return{astNode:e,minLength:1};case"Repetition":switch(e.quantifier.kind){case"*":{let r=pt(e.expression,t);return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:t},expression:r.astNode},minLength:0}}case"+":{let r=pt(e.expression,t),n=r.minLength>1?r.minLength:1;return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:1,to:np(t/n)},expression:r.astNode},minLength:r.minLength}}case"?":{let r=pt(e.expression,t);return t<r.minLength?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:0},expression:r.astNode},minLength:0}:{astNode:{...e,expression:r.astNode},minLength:0}}case"Range":{let r=e.quantifier.from>1?np(t/e.quantifier.from):t,n=pt(e.expression,r),i=n.minLength>1?n.minLength:1;return e.quantifier.to===void 0||e.quantifier.to*i>t?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",to:np(t/i)},expression:n.astNode},minLength:e.quantifier.from*n.minLength}:{astNode:{...e,expression:n.astNode},minLength:e.quantifier.from*n.minLength}}default:return y5(e.quantifier,{astNode:e,minLength:0})}case"Quantifier":return{astNode:e,minLength:0};case"Alternative":{let r=0,n=[];for(let o=0;o!==e.expressions.length;++o){let s=t-r,a=pt(e.expressions[o],s);r+=a.minLength,L(n,{value:a,allowance:s})}let i=[];for(let o=0;o!==n.length;++o){let s=n[o].value,a=n[o].allowance,l=t-r+s.minLength;L(i,(l!==a?pt(s.astNode,l):s).astNode)}return{astNode:{...e,expressions:i},minLength:r}}case"CharacterClass":return{astNode:e,minLength:1};case"ClassRange":return{astNode:e,minLength:1};case"Group":{let r=pt(e.expression,t);return{astNode:{...e,expression:r.astNode},minLength:r.minLength}}case"Disjunction":{if(e.left===null){if(e.right===null)return{astNode:e,minLength:0};let i=pt(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=pt(e.left,t),o=i.minLength>t?null:i.astNode;return{astNode:{...e,left:o,right:null},minLength:0}}let r=pt(e.left,t),n=pt(e.right,t);return r.minLength>t?n:n.minLength>t?r:{astNode:{...e,left:r.astNode,right:n.astNode},minLength:b5(r.minLength,n.minLength)}}case"Assertion":return{astNode:e,minLength:0};case"Backreference":return{astNode:e,minLength:0};case"UnicodeProperty":return{astNode:e,minLength:1}}}function w5(e,t){return pt(e,t).astNode}function S5(e){return new Error(`Unsupported AST node! Received: ${Ae(e)}`)}function ga(e,t,r){if(!t&&!r)return e;let n={hasStart:!1,hasEnd:!1},i=ax(e,t,r,n),o=t&&!n.hasStart,s=r&&!n.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 ax(e,t,r,n){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 n.hasStart=!0,n.hasEnd=!0,{...e,expressions:e.expressions.map((i,o)=>ga(i,t&&o===0,r&&o===e.expressions.length-1))};case"CharacterClass":return e;case"ClassRange":return e;case"Group":return{...e,expression:ax(e.expression,t,r,n)};case"Disjunction":return n.hasStart=!0,n.hasEnd=!0,{...e,left:e.left!==null?ga(e.left,t,r):null,right:e.right!==null?ga(e.right,t,r):null};case"Assertion":if(e.kind==="^"||e.kind==="Lookahead")return n.hasStart=!0,e;if(e.kind==="$"||e.kind==="Lookbehind")return n.hasEnd=!0,e;throw new Error(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":return e;case"UnicodeProperty":return e;default:throw S5(e)}}function v5(e){return ga(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 Ne(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"}function Tp(e){return e>="0"&&e<="9"}function lx(e,t){for(let r=t;r!==e.length;++r){let n=e[r];if(n==="\\")r+=1;else if(n==="]")return r}throw new Error("Missing closing ']'")}function x5(e,t){let r=0;for(let n=t;n!==e.length;++n){let i=e[n];if(i==="\\")n+=1;else if(i===")"){if(r===0)return n;r-=1}else i==="["?n=lx(e,n):i==="("&&(r+=1)}throw new Error("Missing closing ')'")}function k5(e,t){let r=!1;for(let n=t;n!==e.length;++n){let i=e[n];if(!Tp(i)){if(t===n)return-1;if(i===","){if(r)return-1;r=!0}else return i==="}"?n:-1}}return-1}function C5(e,t,r,n){switch(e[t]){case"[":return n===1?t+1:lx(e,t+1)+1;case"{":{if(n===1)return t+1;let i=k5(e,t+1);return i===-1?t+1:i+1}case"(":return n===1?t+1:x5(e,t+1)+1;case"]":case"}":case")":return t+1;case"\\":{let i=e[t+1];switch(i){case"x":if(Ne(e[t+2])&&Ne(e[t+3]))return t+4;throw new Error(`Unexpected token '${e.substring(t,t+4)}' found`);case"u":if(e[t+2]==="{"){if(!r)return t+2;if(e[t+4]==="}"){if(Ne(e[t+3]))return t+5;throw new Error(`Unexpected token '${e.substring(t,t+5)}' found`)}if(e[t+5]==="}"){if(Ne(e[t+3])&&Ne(e[t+4]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`)}if(e[t+6]==="}"){if(Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5]))return t+7;throw new Error(`Unexpected token '${e.substring(t,t+7)}' found`)}if(e[t+7]==="}"){if(Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5])&&Ne(e[t+6]))return t+8;throw new Error(`Unexpected token '${e.substring(t,t+8)}' found`)}if(e[t+8]==="}"&&Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5])&&Ne(e[t+6])&&Ne(e[t+7]))return t+9;throw new Error(`Unexpected token '${e.substring(t,t+9)}' found`)}if(Ne(e[t+2])&&Ne(e[t+3])&&Ne(e[t+4])&&Ne(e[t+5]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`);case"p":case"P":{if(!r)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(!r)return t+2;throw new Error("Invalid \\k definition")}return o+1}default:if(Tp(i)){let o=r?e.length:Math.min(t+4,e.length),s=t+2;for(;s<o&&Tp(e[s]);++s);return s}return t+(r?r1(e,t+1):1)+1}}default:return t+(r?r1(e,t):1)}}function ua(e,t,r,n){let i=C5(e,t,r,n);return e.substring(t,i)}var n1={gc:"General_Category",sc:"Script",scx:"Script_Extensions"},Ea={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"},Gi=nf(Ea),rf={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"},Op=nf(rf),cx={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"},i1=nf(cx);function nf(e){let t={};for(let r of Object.keys(e)){let n=e[r];if(Array.isArray(n))for(let i=0;i!==n.length;++i)t[n[i]]=r;else t[n]=r}return t}function R5(e){return e in rf||e in Op}function E5(e){return e in Ea||e in Gi}function o1(e){if(e in n1)return n1[e];if(e in Gi)return Gi[e];if(e in Ea||e==="General_Category"||e==="Script"||e==="Script_Extensions")return e;throw new Error(`Unknown Unicode property name: ${e}`)}function s1(e){if(e in Op)return Op[e];if(e in i1)return i1[e];if(e in Gi)return Gi[e];if(e in rf||e in cx||e in Ea)return e;throw new Error(`Unknown Unicode property value: ${e}`)}function I5(e,t){let r=e.indexOf("=");if(r!==-1){let n=e.substring(0,r),i=e.substring(r+1);return{type:"UnicodeProperty",name:n,value:i,negative:t,shorthand:!1,binary:!1,canonicalName:o1(n),canonicalValue:s1(i)}}if(R5(e))return{type:"UnicodeProperty",name:"General_Category",value:e,negative:t,shorthand:!0,binary:!1,canonicalName:"General_Category",canonicalValue:s1(e)};if(E5(e)){let n=o1(e);return{type:"UnicodeProperty",name:e,value:e,negative:t,shorthand:!1,binary:!0,canonicalName:n,canonicalValue:n}}throw new Error(`Invalid Unicode property: ${e}`)}var ip=String.fromCodePoint;function op(e){let t=e.pop();if(t===void 0)throw new Error("Unable to extract token preceeding the currently parsed one");return t}function ux(e){return e>="0"&&e<="9"}function ya(e,t){return{type:"Char",kind:"simple",symbol:e,value:e,codePoint:e.codePointAt(0)||-1,escaped:t}}function kn(e,t){return{type:"Char",kind:"meta",symbol:t,value:e,codePoint:t.codePointAt(0)||-1}}function yr(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 sp(e){if(e[0]==="\\"){let t=e[1];switch(t){case"x":{let r=e.substring(2),n=Number.parseInt(r,16);return{type:"Char",kind:"hex",symbol:ip(n),value:e,codePoint:n}}case"u":{if(e==="\\u")return ya("u",!0);let r=e[2]==="{"?e.substring(3,e.length-1):e.substring(2),n=Number.parseInt(r,16);return{type:"Char",kind:"unicode",symbol:ip(n),value:e,codePoint:n}}case"0":return kn(e,"\0");case"n":return kn(e,`
|
|
209
|
+
`);case"f":return kn(e,"\f");case"r":return kn(e,"\r");case"t":return kn(e," ");case"v":return kn(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(ux(t)){let r=e.substring(1),n=Number(r);return{type:"Char",kind:"decimal",symbol:ip(n),value:e,codePoint:n}}if(e.length>2&&(t==="p"||t==="P")){let r=t==="P";return I5(e.substring(3,e.length-1),r)}return ya(e.substring(1),!0)}}return ya(e)}function Cn(e,t,r,n){let i=null;for(let o=0,s=ua(t,o,r,0);o!==t.length;o+=s.length,s=ua(t,o,r,0)){let a=s[0];switch(a){case"|":i===null&&(i=[]),i.push(yr(e.splice(0),!0)||null);break;case".":e.push({type:"Char",kind:"meta",symbol:s,value:s,codePoint:NaN});break;case"*":case"+":{let l=op(e);e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:a,greedy:!0}});break}case"?":{let l=op(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(ya(s));break}let l=op(e),c=s.substring(1,s.length-1).split(","),u=Number(c[0]),d=c.length===1?u:c[1].length!==0?Number(c[1]):void 0;e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:"Range",greedy:!0,from:u,to:d}});break}case"[":{let l=s.substring(1,s.length-1),c=[],u,d=!1;for(let p=0,h=ua(l,p,r,1);p!==l.length;p+=h.length,h=ua(l,p,r,1)){if(p===0&&h==="^"){u=!0;continue}let f=sp(h);if(h==="-")c.push(f),d=!0;else{let m=c.length>=2?c[c.length-2]:void 0;d&&m!==void 0&&m.type==="Char"&&f.type==="Char"?(c.pop(),c.pop(),c.push({type:"ClassRange",from:m,to:f})):c.push(f),d=!1}}e.push({type:"CharacterClass",expressions:c,negative:u});break}case"(":{let l=s.substring(1,s.length-1),c=[];if(l[0]==="?")if(l[1]===":")Cn(c,l.substring(2),r,n),e.push({type:"Group",capturing:!1,expression:yr(c)});else if(l[1]==="="||l[1]==="!")Cn(c,l.substring(2),r,n),e.push({type:"Assertion",kind:"Lookahead",negative:l[1]==="!"?!0:void 0,assertion:yr(c)});else if(l[1]==="<"&&(l[2]==="="||l[2]==="!"))Cn(c,l.substring(3),r,n),e.push({type:"Assertion",kind:"Lookbehind",negative:l[2]==="!"?!0:void 0,assertion:yr(c)});else{let u=l.split(">");if(u.length<2||u[0][1]!=="<")throw new Error(`Unsupported regex content found at ${JSON.stringify(s)}`);let d=++n.lastIndex,p=u[0].substring(2);n.named.set(p,d),Cn(c,u.slice(1).join(">"),r,n),e.push({type:"Group",capturing:!0,nameRaw:p,name:p,number:d,expression:yr(c)})}else{let u=++n.lastIndex;Cn(c,l,r,n),e.push({type:"Group",capturing:!0,number:u,expression:yr(c)})}break}default:if(s==="^")e.push({type:"Assertion",kind:s});else if(s==="$")e.push({type:"Assertion",kind:s});else if(s[0]==="\\"&&ux(s[1])){let l=Number(s.substring(1));r||l<=n.lastIndex?e.push({type:"Backreference",kind:"number",number:l,reference:l}):e.push(sp(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:n.named.get(l)||0,referenceRaw:l,reference:l})}else e.push(sp(s));break}}if(i!==null){i.push(yr(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 A5(e){let t=Jt([...e.flags],"u")!==-1,r=e.source,n=[];return Cn(n,r,t,{lastIndex:0,named:new Map}),yr(n)}var P5=String.fromCodePoint;function T5(e){return e.binary||e.shorthand?e.canonicalValue:`${e.canonicalName}=${e.canonicalValue}`}function a1(e,t,r,n){let i=-1;for(let o=t;o<=r;++o)if(e.test(P5(o)))i===-1&&(i=o);else if(i!==-1){let s=o-1;n.push(i===s?[s]:[i,s]),i=-1}i!==-1&&n.push(i===r?[r]:[i,r])}function O5(e,t){let r=new RegExp(`^\\${t?"P":"p"}{${e}}$`,"u"),n=[];return a1(r,0,55295,n),a1(r,57344,1114111,n),n}var l1=new Map;function M5(e,t){let r=`${t?"P":"p"}:${e}`,n=l1.get(r);if(n!==void 0)return n;let i=O5(e,t);return l1.set(r,i),i}function N5(e){return Tn(...G(M5(T5(e),e.negative),t=>fp(t)))}var L5=String.fromCodePoint,c1=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],u1=[..."0123456789"],d1=[...` \r
|
|
210
210
|
\v\f`],Mp=[...`\r
|
|
211
|
-
`],ux=[...""],I5=[...Mp,...ux],Wr=()=>Le({unit:"grapheme-ascii",minLength:1,maxLength:1});function d1(e){return new N(`Unsupported AST node! Received: ${Ae(e)}`)}function br(e,t,r){switch(e.type){case"Char":if(e.kind==="meta")switch(e.value){case"\\w":return Nt(...l1);case"\\W":return Wr().filter(n=>Jt(l1,n)===-1);case"\\d":return Nt(...c1);case"\\D":return Wr().filter(n=>Jt(c1,n)===-1);case"\\s":return Nt(...u1);case"\\S":return Wr().filter(n=>Jt(u1,n)===-1);case"\\b":case"\\B":throw new N(`Meta character ${e.value} not implemented yet!`);case".":{let n=r.dotAll?ux:I5;return Wr().filter(i=>Jt(n,i)===-1)}}if(e.symbol===void 0)throw new N(`Unexpected undefined symbol received for non-meta Char! Received: ${Ae(e)}`);return Ie(e.symbol);case"Repetition":{let n=br(e.expression,t,r);switch(e.quantifier.kind){case"*":return Le({...t,unit:n});case"+":return Le({...t,minLength:1,unit:n});case"?":return Le({...t,minLength:0,maxLength:1,unit:n});case"Range":return Le({...t,minLength:e.quantifier.from,maxLength:e.quantifier.to,unit:n});default:throw d1(e.quantifier)}}case"Quantifier":throw new N("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return W(...G(e.expressions,n=>br(n,t,r))).map(n=>fe(n,""));case"CharacterClass":if(e.negative){let n=G(e.expressions,i=>br(i,t,r));return Wr().filter(i=>k1(n,o=>!o.canShrinkWithoutContext(i)))}return Be(...G(e.expressions,n=>br(n,t,r)));case"ClassRange":{let n=e.from.codePoint,i=e.to.codePoint;return oe({min:n,max:i}).map(o=>E5(o),o=>{if(typeof o!="string")throw new N("Invalid type");if([...o].length!==1)throw new N("Invalid length");return In(o,0)})}case"Group":return br(e.expression,t,r);case"Disjunction":return Be(e.left!==null?br(e.left,t,r):Ie(""),e.right!==null?br(e.right,t,r):Ie(""));case"Assertion":if(e.kind==="^"||e.kind==="$")return r.multiline?e.kind==="^"?Be(Ie(""),W(Le({unit:Wr()}),Nt(...Mp)).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new N("Invalid type");return[xe(n,0,n.length-1),n[n.length-1]]})):Be(Ie(""),W(Nt(...Mp),Le({unit:Wr()})).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new N("Invalid type");return[n[0],xe(n,1)]})):Ie("");throw new N(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":throw new N("Backreference nodes not implemented yet!");case"UnicodeProperty":return R5(e);default:throw d1(e)}}function A5(e,t={}){for(let a of e.flags)if(a!=="d"&&a!=="g"&&a!=="m"&&a!=="s"&&a!=="u")throw new N(`Unable to use "stringMatching" against a regex using the flag ${a}`);let r=t.maxLength,n={size:t.size,maxLength:r},i={multiline:e.multiline,dotAll:e.dotAll},o=f5(S5(e));r!==void 0&&(o=d5(o,r));let s=br(o,n,i);return r!==void 0?s.filter(a=>[...a].length<=r):s}function P5(e){let t=[];for(let r=0;r!==e.length;++r)t.push(e[r].next());return t}function T5(e,t){for(let r=0;r!==e.length;++r)t[r]=e[r].next()}function O5(e){for(let t=0;t!==e.length;++t)if(e[t].done)return!0;return!1}function*M5(...e){let t=P5(e);for(;!O5(t);)yield t.map(r=>r.value),T5(e,t)}function*N5(e){let t=e;for(;;)yield t,++t}var L5=class extends he{constructor(e,t){super(),this.arb=e,this.maxShrinks=t}generate(e,t){let r=this.arb.generate(e,t);return this.valueMapper(r,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,r){let n=this.maxShrinks-r;return n<=0?V.nil():new V(M5(this.arb.shrink(e,t),N5(r+1))).take(n).map(i=>this.valueMapper(i[0],i[1]))}valueMapper(e,t){let r={originalContext:e.context,length:t};return new $(e.value,r)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalContext"in e&&"length"in e}};function $5(e,t){return new L5(e,t)}var D5=Xw({Arbitrary:()=>he,ExecutionStatus:()=>Y3,PreconditionFailure:()=>kr,Random:()=>Fp,Stream:()=>V,Value:()=>$,VerbosityLevel:()=>A3,__commitHash:()=>F5,__type:()=>_5,__version:()=>j5,anything:()=>W0,array:()=>ce,assert:()=>bD,asyncDefaultReportMessage:()=>U1,asyncModelRun:()=>r5,asyncProperty:()=>E3,asyncStringify:()=>jp,asyncToStringMethod:()=>Xt,base64String:()=>f9,bigInt:()=>xr,bigInt64Array:()=>a5,bigUint64Array:()=>l5,boolean:()=>Ki,chainUntil:()=>l_,check:()=>H1,clone:()=>f_,cloneIfNeeded:()=>Rn,cloneMethod:()=>Ve,commands:()=>Y9,compareBooleanFunc:()=>p8,compareFunc:()=>h8,configureGlobal:()=>k3,constant:()=>Ie,constantFrom:()=>Nt,context:()=>r_,createDepthIdentifier:()=>Up,date:()=>r0,defaultReportMessage:()=>V1,dictionary:()=>zp,domain:()=>Jp,double:()=>Ra,emailAddress:()=>Ej,entityGraph:()=>p7,falsy:()=>e_,float:()=>x0,float32Array:()=>T0,float64Array:()=>O0,func:()=>y8,gen:()=>ID,getDepthContextFor:()=>Vp,hasAsyncToStringMethod:()=>_p,hasCloneMethod:()=>Hr,hasToStringMethod:()=>Dp,hash:()=>xa,infiniteStream:()=>s9,int16Array:()=>M0,int32Array:()=>N0,int8Array:()=>L0,integer:()=>oe,ipV4:()=>Qp,ipV4Extended:()=>E0,ipV6:()=>I0,json:()=>n9,jsonValue:()=>H0,letrec:()=>A0,limitShrink:()=>$5,lorem:()=>S7,map:()=>Rp,mapToConstant:()=>Tn,maxSafeInteger:()=>R0,maxSafeNat:()=>v8,memo:()=>C7,mixedCase:()=>T7,modelRun:()=>t5,nat:()=>wr,noBias:()=>va,noShrink:()=>ka,object:()=>X7,oneof:()=>Be,option:()=>Qt,pre:()=>Q6,property:()=>I3,readConfigureGlobal:()=>xt,record:()=>Cp,resetConfigureGlobal:()=>C3,sample:()=>SD,scheduledModelRun:()=>n5,scheduler:()=>o5,schedulerFor:()=>s5,set:()=>B0,shuffledSubarray:()=>b9,sparseArray:()=>F0,statistics:()=>xD,stream:()=>vr,string:()=>Le,stringMatching:()=>A5,stringify:()=>Ae,subarray:()=>y9,toStringMethod:()=>kt,tuple:()=>W,uint16Array:()=>$0,uint32Array:()=>D0,uint8Array:()=>_0,uint8ClampedArray:()=>j0,ulid:()=>E9,uniqueArray:()=>Gr,uuid:()=>N9,webAuthority:()=>K0,webFragments:()=>Y0,webPath:()=>X0,webQueryParameters:()=>Q0,webSegment:()=>Z0,webUrl:()=>G9}),_5="module",j5="4.8.0",F5="c0da76fbcf6470339ad7bb2f0dfcebee06ede56c",ze=D5;function dx(e){return e?.values!=null&&e.values.length>0?ze.constantFrom(...e.values):B5(e)}function B5(e){if(e?.type==="number")return ze.integer();if(e?.type==="boolean")return ze.boolean();let t=e?.generator==null?void 0:U5[e.generator];if(t!=null)return t;let r=e?.constraints?.kind==="string"?e.constraints:void 0;return ze.string({maxLength:r?.maxLength,minLength:r?.minLength??1}).filter(n=>n.trim().length>0&&n===n.trim())}var V5="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],On=e=>ze.array(ze.constantFrom(...V5),{maxLength:e,minLength:1}).map(t=>t.join("")),of=(e,t)=>ze.array(On(10),{maxLength:t,minLength:1}).map(r=>r.join(e)),U5={"company.name":of(" ",3),"date.iso":W5(),"internet.email":H5(),"internet.url":z5(),"lorem.slug":of("-",3),"lorem.word":On(10),"person.fullName":of(" ",2)};function W5(){return ze.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 H5(){return ze.tuple(On(12),On(10),ze.constantFrom("com","dev","io","org","ai")).map(([e,t,r])=>`${e}@${t}.${r}`)}function z5(){return ze.tuple(ze.constantFrom("http","https"),On(12),ze.constantFrom("app","com","dev","io","org"),ze.array(On(8),{maxLength:3})).map(([e,t,r,n])=>{let i=n.length===0?"":`/${n.join("/")}`;return`${e}://${t}.${r}${i}`})}var px=new WeakMap;function sf(e){let t=px.get(e);if(t!=null)return t;let r=Object.fromEntries(Object.entries(e.paramSpaces).map(([n,i])=>[n,K5(i)]));return px.set(e,r),r}var q5=24301;function K5(e){let[t]=ze.sample(dx(e),{numRuns:1,seed:q5});if(t==null)throw new Error("arbitrary produced no sample");return t}function Ji(e){return{aborted:!0,findings:[],fired:[],teardown:e}}function lf(e,t){return new J5(Y5(e,t))}async function Y5({browser:e,hub:t,request:r},n){if(n.aborted)return af(Ji("skipped"));let i=rF({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),o=async s=>{try{return af(await X5({browser:e,established:s,hub:t,request:r,signal:n}))}catch(a){return fx(Zn(a))}};return tF(i,r).match(o,s=>Z5(s,i.teardown))}async function Z5(e,t){return e.kind!=="aborted"?fx(e):af(Ji(await hx(t)))}function hx(e){return e().match(()=>"done",()=>"failed")}async function X5(e){let t=await Q5(e);if(t.kind==="completed")return await e.established.teardown().match(Mo,mm),{aborted:!1,...t.result};let r=await hx(e.established.teardown);if(t.kind==="aborted")return Ji(r);throw t.error}async function Q5({browser:e,established:t,hub:r,request:n,signal:i}){try{dr(i);let{close:o,driver:s,emitAssertion:a}=await Gc({baseUrl:n.options.baseUrl,browser:e,capture:{hub:r,runId:n.runId},clientState:t.clientState,engine:Uc(iF(n.lockfile)),reader:t.reader,session:t.auth});try{return{kind:"completed",result:await _c({canon:rc(n.lockfile),classify:tc(n.lockfile),driver:s,initialState:{snapshot:t.snapshot},onAssertion:a,onEvent:n.onEvent??Mo,sequence:eF(n.lockfile,n.testName,n.params),...Di(n.lockfile)},i)}}finally{await o()}}catch(o){return xm(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function eF(e,t,r){return Bo(e,t).map(n=>({params:{...sf(n),...r},transition:n}))}function tF(e,t){return bc(t.lockfile,t.testName,{generate:Vc(Bc(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params}).map(r=>({auth:r.auth,clientState:r.clientState,reader:e.reader,snapshot:r.snapshot,teardown:e.teardown}))}function rF({lockfile:e,options:t,runId:r,signal:n}){let i=Yc({baseUrl:t.engineUrl,runId:r,secret:t.secret},n);return{materialize:wc(i.setupWorld),reader:Jc(e.entities,nF(e),i.query),teardown:i.teardown}}function nF(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function iF(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}function cf({debugDir:e,headed:t,writeOtlpPortFile:r}){let n=Og({headed:t}),i,o,s=async()=>(i??=Td({debugDir:e,writeOtlpPortFile:r}),o=await i,o),a=async(c,u)=>{if(u.aborted)return sF(Ji("skipped"));try{let d=await s();return c.options.headed&&!t?await qc(!0,async p=>lf({browser:p,hub:d,request:c},u)):await lf({browser:await n.acquire(),hub:d,request:c},u)}catch(d){return oF(Zn(d))}};return{close:async()=>{await n.close();let c=i;i=void 0,o=void 0,c!=null&&await c.then(u=>u.close()).catch(()=>{})},injectSpan:(c,u)=>{o?.injectSpan(c,u)},runOnce:(c,u)=>new aF(a(c,u))}}function Cr(e){let t=rn(e),r=Di(e);return[...Ic(t,r.invariants).map(n=>({gap:n,kind:"cascade-gap"})),...Ec(r.laws).map(n=>({conflict:n,kind:"law-conflict"}))]}function mx(e){return`${D.good("OK")} \u2014 no static model violations (${String(e)} tests)`}function Rr(e){return[`${D.bad("FAIL")} \u2014 ${String(e.length)} static model violation(s):`,...e.map(t=>tu(t))].join(`
|
|
211
|
+
`],dx=[...""],$5=[...Mp,...dx],Wr=()=>Le({unit:"grapheme-ascii",minLength:1,maxLength:1});function p1(e){return new N(`Unsupported AST node! Received: ${Ae(e)}`)}function br(e,t,r){switch(e.type){case"Char":if(e.kind==="meta")switch(e.value){case"\\w":return Lt(...c1);case"\\W":return Wr().filter(n=>Jt(c1,n)===-1);case"\\d":return Lt(...u1);case"\\D":return Wr().filter(n=>Jt(u1,n)===-1);case"\\s":return Lt(...d1);case"\\S":return Wr().filter(n=>Jt(d1,n)===-1);case"\\b":case"\\B":throw new N(`Meta character ${e.value} not implemented yet!`);case".":{let n=r.dotAll?dx:$5;return Wr().filter(i=>Jt(n,i)===-1)}}if(e.symbol===void 0)throw new N(`Unexpected undefined symbol received for non-meta Char! Received: ${Ae(e)}`);return Ie(e.symbol);case"Repetition":{let n=br(e.expression,t,r);switch(e.quantifier.kind){case"*":return Le({...t,unit:n});case"+":return Le({...t,minLength:1,unit:n});case"?":return Le({...t,minLength:0,maxLength:1,unit:n});case"Range":return Le({...t,minLength:e.quantifier.from,maxLength:e.quantifier.to,unit:n});default:throw p1(e.quantifier)}}case"Quantifier":throw new N("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return W(...G(e.expressions,n=>br(n,t,r))).map(n=>he(n,""));case"CharacterClass":if(e.negative){let n=G(e.expressions,i=>br(i,t,r));return Wr().filter(i=>C1(n,o=>!o.canShrinkWithoutContext(i)))}return Be(...G(e.expressions,n=>br(n,t,r)));case"ClassRange":{let n=e.from.codePoint,i=e.to.codePoint;return oe({min:n,max:i}).map(o=>L5(o),o=>{if(typeof o!="string")throw new N("Invalid type");if([...o].length!==1)throw new N("Invalid length");return In(o,0)})}case"Group":return br(e.expression,t,r);case"Disjunction":return Be(e.left!==null?br(e.left,t,r):Ie(""),e.right!==null?br(e.right,t,r):Ie(""));case"Assertion":if(e.kind==="^"||e.kind==="$")return r.multiline?e.kind==="^"?Be(Ie(""),W(Le({unit:Wr()}),Lt(...Mp)).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new N("Invalid type");return[xe(n,0,n.length-1),n[n.length-1]]})):Be(Ie(""),W(Lt(...Mp),Le({unit:Wr()})).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new N("Invalid type");return[n[0],xe(n,1)]})):Ie("");throw new N(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":throw new N("Backreference nodes not implemented yet!");case"UnicodeProperty":return N5(e);default:throw p1(e)}}function D5(e,t={}){for(let a of e.flags)if(a!=="d"&&a!=="g"&&a!=="m"&&a!=="s"&&a!=="u")throw new N(`Unable to use "stringMatching" against a regex using the flag ${a}`);let r=t.maxLength,n={size:t.size,maxLength:r},i={multiline:e.multiline,dotAll:e.dotAll},o=v5(A5(e));r!==void 0&&(o=w5(o,r));let s=br(o,n,i);return r!==void 0?s.filter(a=>[...a].length<=r):s}function _5(e){let t=[];for(let r=0;r!==e.length;++r)t.push(e[r].next());return t}function j5(e,t){for(let r=0;r!==e.length;++r)t[r]=e[r].next()}function F5(e){for(let t=0;t!==e.length;++t)if(e[t].done)return!0;return!1}function*B5(...e){let t=_5(e);for(;!F5(t);)yield t.map(r=>r.value),j5(e,t)}function*V5(e){let t=e;for(;;)yield t,++t}var U5=class extends me{constructor(e,t){super(),this.arb=e,this.maxShrinks=t}generate(e,t){let r=this.arb.generate(e,t);return this.valueMapper(r,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,r){let n=this.maxShrinks-r;return n<=0?V.nil():new V(B5(this.arb.shrink(e,t),V5(r+1))).take(n).map(i=>this.valueMapper(i[0],i[1]))}valueMapper(e,t){let r={originalContext:e.context,length:t};return new $(e.value,r)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalContext"in e&&"length"in e}};function W5(e,t){return new U5(e,t)}var H5=Qw({Arbitrary:()=>me,ExecutionStatus:()=>iD,PreconditionFailure:()=>kr,Random:()=>Fp,Stream:()=>V,Value:()=>$,VerbosityLevel:()=>D3,__commitHash:()=>q5,__type:()=>z5,__version:()=>G5,anything:()=>H0,array:()=>ce,assert:()=>ED,asyncDefaultReportMessage:()=>W1,asyncModelRun:()=>u5,asyncProperty:()=>L3,asyncStringify:()=>jp,asyncToStringMethod:()=>Xt,base64String:()=>v9,bigInt:()=>xr,bigInt64Array:()=>m5,bigUint64Array:()=>g5,boolean:()=>Ki,chainUntil:()=>g_,check:()=>z1,clone:()=>v_,cloneIfNeeded:()=>Rn,cloneMethod:()=>Ve,commands:()=>i5,compareBooleanFunc:()=>S8,compareFunc:()=>x8,configureGlobal:()=>O3,constant:()=>Ie,constantFrom:()=>Lt,context:()=>u_,createDepthIdentifier:()=>Up,date:()=>n0,defaultReportMessage:()=>U1,dictionary:()=>zp,domain:()=>Jp,double:()=>Ra,emailAddress:()=>Lj,entityGraph:()=>S7,falsy:()=>l_,float:()=>k0,float32Array:()=>O0,float64Array:()=>M0,func:()=>R8,gen:()=>$D,getDepthContextFor:()=>Vp,hasAsyncToStringMethod:()=>_p,hasCloneMethod:()=>Hr,hasToStringMethod:()=>Dp,hash:()=>xa,infiniteStream:()=>h9,int16Array:()=>N0,int32Array:()=>L0,int8Array:()=>$0,integer:()=>oe,ipV4:()=>Qp,ipV4Extended:()=>I0,ipV6:()=>A0,json:()=>d9,jsonValue:()=>z0,letrec:()=>P0,limitShrink:()=>W5,lorem:()=>A7,map:()=>Rp,mapToConstant:()=>Tn,maxSafeInteger:()=>E0,maxSafeNat:()=>P8,memo:()=>M7,mixedCase:()=>j7,modelRun:()=>c5,nat:()=>wr,noBias:()=>va,noShrink:()=>ka,object:()=>s9,oneof:()=>Be,option:()=>Qt,pre:()=>a4,property:()=>$3,readConfigureGlobal:()=>kt,record:()=>Cp,resetConfigureGlobal:()=>M3,sample:()=>AD,scheduledModelRun:()=>d5,scheduler:()=>f5,schedulerFor:()=>h5,set:()=>V0,shuffledSubarray:()=>E9,sparseArray:()=>B0,statistics:()=>TD,stream:()=>vr,string:()=>Le,stringMatching:()=>D5,stringify:()=>Ae,subarray:()=>R9,toStringMethod:()=>Ct,tuple:()=>W,uint16Array:()=>D0,uint32Array:()=>_0,uint8Array:()=>j0,uint8ClampedArray:()=>F0,ulid:()=>L9,uniqueArray:()=>Gr,uuid:()=>V9,webAuthority:()=>J0,webFragments:()=>Z0,webPath:()=>Q0,webQueryParameters:()=>ex,webSegment:()=>X0,webUrl:()=>e5}),z5="module",G5="4.8.0",q5="c0da76fbcf6470339ad7bb2f0dfcebee06ede56c",ze=H5;function px(e){return e?.values!=null&&e.values.length>0?ze.constantFrom(...e.values):K5(e)}function K5(e){if(e?.type==="number")return ze.integer();if(e?.type==="boolean")return ze.boolean();let t=e?.generator==null?void 0:Y5[e.generator];if(t!=null)return t;let r=e?.constraints?.kind==="string"?e.constraints:void 0;return ze.string({maxLength:r?.maxLength,minLength:r?.minLength??1}).filter(n=>n.trim().length>0&&n===n.trim())}var J5="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],On=e=>ze.array(ze.constantFrom(...J5),{maxLength:e,minLength:1}).map(t=>t.join("")),of=(e,t)=>ze.array(On(10),{maxLength:t,minLength:1}).map(r=>r.join(e)),Y5={"company.name":of(" ",3),"date.iso":Z5(),"internet.email":X5(),"internet.url":Q5(),"lorem.slug":of("-",3),"lorem.word":On(10),"person.fullName":of(" ",2)};function Z5(){return ze.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 X5(){return ze.tuple(On(12),On(10),ze.constantFrom("com","dev","io","org","ai")).map(([e,t,r])=>`${e}@${t}.${r}`)}function Q5(){return ze.tuple(ze.constantFrom("http","https"),On(12),ze.constantFrom("app","com","dev","io","org"),ze.array(On(8),{maxLength:3})).map(([e,t,r,n])=>{let i=n.length===0?"":`/${n.join("/")}`;return`${e}://${t}.${r}${i}`})}var fx=new WeakMap;function sf(e){let t=fx.get(e);if(t!=null)return t;let r=Object.fromEntries(Object.entries(e.paramSpaces).map(([n,i])=>[n,rF(i)]));return fx.set(e,r),r}var tF=24301;function rF(e){let[t]=ze.sample(px(e),{numRuns:1,seed:tF});if(t==null)throw new Error("arbitrary produced no sample");return t}function Ji(e){return{aborted:!0,findings:[],fired:[],teardown:e}}function lf(e,t){return new nF(iF(e,t))}async function iF({browser:e,hub:t,request:r},n){if(n.aborted)return af(Ji("skipped"));let i=uF({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),o=async s=>{try{return af(await sF({browser:e,established:s,hub:t,request:r,signal:n}))}catch(a){return hx(Zn(a))}};return cF(i,r).match(o,s=>oF(s,i.teardown))}async function oF(e,t){return e.kind!=="aborted"?hx(e):af(Ji(await mx(t)))}function mx(e){return e().match(()=>"done",()=>"failed")}async function sF(e){let t=await aF(e);if(t.kind==="completed")return await e.established.teardown().match(Mo,gm),{aborted:!1,...t.result};let r=await mx(e.established.teardown);if(t.kind==="aborted")return Ji(r);throw t.error}async function aF({browser:e,established:t,hub:r,request:n,signal:i}){try{dr(i);let{close:o,driver:s,emitAssertion:a}=await Gc({baseUrl:n.options.baseUrl,browser:e,capture:{hub:r,runId:n.runId},clientState:t.clientState,engine:Uc(pF(n.lockfile)),reader:t.reader,session:t.auth});try{return{kind:"completed",result:await _c({canon:rc(n.lockfile),classify:tc(n.lockfile),driver:s,initialState:{snapshot:t.snapshot},onAssertion:a,onEvent:n.onEvent??Mo,sequence:lF(n.lockfile,n.testName,n.params),...Di(n.lockfile)},i)}}finally{await o()}}catch(o){return km(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function lF(e,t,r){return Bo(e,t).map(n=>({params:{...sf(n),...r},transition:n}))}function cF(e,t){return bc(t.lockfile,t.testName,{generate:Vc(Bc(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params}).map(r=>({auth:r.auth,clientState:r.clientState,reader:e.reader,snapshot:r.snapshot,teardown:e.teardown}))}function uF({lockfile:e,options:t,runId:r,signal:n}){let i=Yc({baseUrl:t.engineUrl,runId:r,secret:t.secret},n);return{materialize:wc(i.setupWorld),reader:Jc(e.entities,dF(e),i.query),teardown:i.teardown}}function dF(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function pF(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}function cf({debugDir:e,headed:t,writeOtlpPortFile:r}){let n=Mg({headed:t}),i,o,s=async()=>(i??=Td({debugDir:e,writeOtlpPortFile:r}),o=await i,o),a=async(c,u)=>{if(u.aborted)return hF(Ji("skipped"));try{let d=await s();return c.options.headed&&!t?await qc(!0,async p=>lf({browser:p,hub:d,request:c},u)):await lf({browser:await n.acquire(),hub:d,request:c},u)}catch(d){return fF(Zn(d))}};return{close:async()=>{await n.close();let c=i;i=void 0,o=void 0,c!=null&&await c.then(u=>u.close()).catch(()=>{})},injectSpan:(c,u)=>{o?.injectSpan(c,u)},runOnce:(c,u)=>new mF(a(c,u))}}function Cr(e){let t=rn(e),r=Di(e);return[...Ic(t,r.invariants).map(n=>({gap:n,kind:"cascade-gap"})),...Ec(r.laws).map(n=>({conflict:n,kind:"law-conflict"}))]}function gx(e){return`${_.good("OK")} \u2014 no static model violations (${String(e)} tests)`}function Rr(e){return[`${_.bad("FAIL")} \u2014 ${String(e.length)} static model violation(s):`,...e.map(t=>tu(t))].join(`
|
|
212
212
|
|
|
213
|
-
`)}function Ia(e){return[`${
|
|
214
|
-
`)}function
|
|
213
|
+
`)}function Ia(e){return[`${_.warn("WARN")} \u2014 ${String(e.length)} model coverage gap(s) (not blocking):`,...e.map(t=>` ${gF(t)}`),`Coverage gaps mean the model can't catch regressions there. Stub the missing flows. ${F("explore")}`].join(`
|
|
214
|
+
`)}function gF(e){return e.kind==="entity-never-given"?`${e.entity} \u2014 declared but no implemented test seeds it; no flow exercises this state`:`${e.entity} \u2014 seeded but never asserted created/updated/deleted; mutations to it ship unchecked`}import{graphql as yF}from"gql.tada";var bF=yF(`
|
|
215
215
|
query DoctorAuthViewer {
|
|
216
216
|
currentUser {
|
|
217
217
|
name
|
|
218
218
|
email
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
`),
|
|
221
|
+
`),wF="Failed to connect to Ripplo server";async function yx({serverUrl:e,token:t}){try{let r=await D({config:ar({serverUrl:e,token:t}),document:bF,variables:void 0});return r.currentUser==null?{kind:"invalid"}:{email:r.currentUser.email,kind:"valid"}}catch(r){return(r instanceof Error?r.message:String(r)).startsWith(wF)?{kind:"unreachable"}:{kind:"invalid"}}}function wx(e){switch(e.type){case"settings":return!e.valid;case"env-files":return e.missing.length>0;case"token":return e.status==="missing"||e.status==="invalid";case"dev-server":return!e.reachable;case"dev-session":return e.status!=="active";case"preconditions":return e.count>0&&!e.configured;case"engine-endpoint":return!e.reachable;case"adapter-enabled":return e.status!=="enabled";case"webhook-verification":return!e.rejectsUnsigned;case"preconditions-validation":return!e.valid;case"workflows":return e.invalidNames.length>0;case"browser":return!e.installed;case"lockfile":return e.status!=="match";case"pre-commit-hook":return!e.installed}}async function Sx(e){let t=await vF(e),r={missing:Il(e),type:"env-files"},n=await xF(),i=kF(),o=await we(e),s=CF(o),a=RF(o),l=await EF(e,o),c=AF(e),u=await PF(t,o);return[t,r,n,...u,s,a,l,c,i]}async function vF(e){let t=await Qh(e);return t.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:t.errors.map(n=>n.path).filter(n=>n.length>0),type:"settings",valid:!1}}async function xF(){let e=ut();if(e==null||e.length===0)return{email:void 0,status:"missing",type:"token"};let t=await yx({serverUrl:it(),token:e});return t.kind==="valid"?{email:t.email,status:"valid",type:"token"}:{email:void 0,status:t.kind,type:"token"}}function kF(){let e=SF.executablePath();return{installed:Aa.existsSync(e),type:"browser"}}function CF(e){if(e.isErr())return{errorCount:1,errors:[{message:Oe(e.error),path:".ripplo/"}],found:!1,type:"preconditions-validation",valid:!1};let t=Cr(e.value);return{errorCount:t.length,errors:t.length===0?[]:[{message:Rr(t),path:""}],found:!0,type:"preconditions-validation",valid:t.length===0}}function RF(e){if(e.isErr())return{invalidNames:[],invalidWorkflows:[],total:0,type:"workflows",valid:0};let t=e.value.tests.length;return{invalidNames:[],invalidWorkflows:[],total:t,type:"workflows",valid:t}}async function EF(e,t){if(t.isErr())return{status:"missing",type:"lockfile"};let r=Bt(ht,t.value),n=await Aa.promises.readFile(bx.join(e,et),"utf8").catch(()=>null);return{status:IF(n,r),type:"lockfile"}}function IF(e,t){return e==null?"missing":e===t?"match":"stale"}function AF(e){let t=bx.join(e,".git","hooks","pre-commit");return Aa.existsSync(t)?{installed:Aa.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function PF(e,t){if(!e.valid||t.isErr())return[];let r=Yr().map(a=>({appUrl:a.appUrl,engineUrl:a.engineUrl,webhookSecret:a.webhookSecret})).unwrapOr(void 0);if(r==null)return[];let n=[],i=await Xl(r.appUrl)==null;n.push({appUrl:r.appUrl,reachable:i,type:"dev-server"});let o=await Zh(process.cwd());n.push(o);let s=await TF(r,t);return n.push(...s),n}async function TF(e,t){let r=t.isOk()?t.value.entities.length:0,n=e.engineUrl.length>0,i={configured:n,count:r,endpointReachable:void 0,type:"preconditions"};if(r===0||!n)return[i];let o=MF(e.appUrl,e.engineUrl);if(o==null)return[i];let s=await Xl(o)==null,a=[];if(a.push({configured:!0,count:r,endpointReachable:s,type:"preconditions"}),vx(e.engineUrl)&&a.push({reachable:s,type:"engine-endpoint",url:o}),!s)return a;let l=await em({appUrl:e.appUrl,engineUrl:e.engineUrl});a.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await OF({engineUrl:o,webhookSecret:e.webhookSecret});return a.push({status:c,type:"adapter-enabled",url:o}),a}async function OF({engineUrl:e,webhookSecret:t}){if(t.length===0)return"no-secret";let r=JSON.stringify({});try{let n=await fetch(`${e}/setup`,{body:r,headers:{"Content-Type":"application/json",...Sl({body:r,secret:t})},method:"PUT",signal:AbortSignal.timeout(5e3)});return n.status===404?"disabled":n.status===401||n.status===403?"bad-secret":"enabled"}catch{return"unreachable"}}function vx(e){return e.startsWith("http://")||e.startsWith("https://")}function MF(e,t){return vx(t)?t:`${e}${t}`}async function xx(){let e=process.cwd(),t=await Sx(e),r=t.map(i=>Xh(i));process.stdout.write(r.join(`
|
|
222
222
|
`)+`
|
|
223
|
-
`);let n=t.some(i=>
|
|
223
|
+
`);let n=t.some(i=>wx(i));process.exit(n?1:0)}import Pa from"fs";import{graphql as LF}from"gql.tada";import NF from"fs";function Er(e){return It(e,"hooks-paused")}function De(e){return NF.existsSync(Er(e))||To(e)?!1:Qr(e)}var $F=LF(`
|
|
224
224
|
mutation CliSetHooksPaused($projectId: String!, $paused: Boolean!) {
|
|
225
225
|
setHooksPaused(projectId: $projectId, paused: $paused) {
|
|
226
226
|
id
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
`);async function
|
|
230
|
-
`);return}Pa.unlinkSync(t),await
|
|
231
|
-
`)}async function
|
|
232
|
-
`)})}import Ln from"fs";import $n from"path";import{input as
|
|
233
|
-
`)[0]??r.message:String(r);return
|
|
229
|
+
`);async function kx(){process.stdin.isTTY||(process.stderr.write("`ripplo hooks pause` must be invoked interactively from a terminal \u2014 refusing non-TTY invocation. Bypassing the gate is a human decision, not an agent decision.\n"),process.exit(1));let e=process.cwd();Dt(e);let t=Er(e);if(Pa.existsSync(t)){process.stdout.write("Hooks already paused. Run `ripplo hooks resume` to re-enable.\n");return}Pa.writeFileSync(t,""),await Rx(e,!0),process.stdout.write("Hooks paused. Pre-edit gates and stop enforcement are off until you run `ripplo hooks resume`.\n")}async function Cx(){let e=process.cwd(),t=Er(e);if(!Pa.existsSync(t)){process.stdout.write(`Hooks already active.
|
|
230
|
+
`);return}Pa.unlinkSync(t),await Rx(e,!1),process.stdout.write(`Hooks resumed.
|
|
231
|
+
`)}async function Rx(e,t){let r=je(e).unwrapOr(void 0);r!=null&&await D({config:r,document:$F,variables:{paused:t,projectId:r.projectId}}).catch(n=>{process.stderr.write(`Warning: could not push hook-pause state to the server (${n instanceof Error?n.message:String(n)}) \u2014 the dashboard may show stale hook status.
|
|
232
|
+
`)})}import Ln from"fs";import $n from"path";import{input as Tx,select as Ox}from"@inquirer/prompts";import{graphql as dB}from"gql.tada";import{exec as jF,execFile as FF}from"child_process";import{err as BF,ok as Ex}from"neverthrow";import ke from"fs";import{createRequire as VF}from"module";import ge from"path";import{promisify as Ax}from"util";import{chromium as UF}from"playwright";import{writeFile as DF}from"fs/promises";import _F from"path";async function Mn(e){let t=await we(e);return t.isOk()&&await DF(_F.join(e,et),Bt(ht,t.value)),t}function tr(e){return e.tests.filter(t=>t.stub).map(t=>t.name)}var WF=["@ripplo/testing","@ripplo/instrument"],Ix=".ripplo/ripplo.lock linguist-generated=true",HF=[".ripplo/debug/",".ripplo/.local/"],zF=Ax(jF),GF=Ax(FF);async function Px({cwd:e,onStep:t}){t("Scaffolding project files..."),nB({cwd:e}),t("Updating .gitignore..."),iB(e),t("Marking ripplo.lock as generated..."),YF(e),t("Installing dependencies...");let r=await KF(e),n=[];if(r.ok||n.push({manualCommand:r.cmd,message:`Couldn't auto-install dev dependencies (${r.reason}). Run the command below, then run \`ripplo lint\` to compile the lockfile.`}),r.ok){t("Compiling initial lockfile...");let o=await JF(e);o!=null&&n.push({manualCommand:void 0,message:o})}return t("Setting up browser..."),(await qF()).map(()=>n)}async function qF(){let e=UF.executablePath();if(ke.existsSync(e))return Ex(void 0);j.info("Chromium not found. Installing via Playwright...");let t=VF(import.meta.url),r=ge.dirname(t.resolve("playwright/package.json")),n=ge.join(r,"cli.js");return await GF(process.execPath,[n,"install","chromium"]),ke.existsSync(e)?Ex(void 0):BF({kind:"playwright-install-failed"})}async function KF(e){let t=ZF({cwd:e,pm:rB(e)});j.info("Installing dependencies: %s",t);try{return await zF(t,{cwd:e}),{ok:!0}}catch(r){let n=r instanceof Error?r.message.split(`
|
|
233
|
+
`)[0]??r.message:String(r);return j.warn("Install failed (%s): %s",t,n),{cmd:t,ok:!1,reason:n}}}async function JF(e){try{await Mn(e);return}catch(t){return`Couldn't compile initial lockfile: ${t instanceof Error?t.message:String(t)}.`}}function YF(e){let t=ge.join(e,".gitattributes"),r=ke.existsSync(t)?ke.readFileSync(t,"utf8"):"";if(r.includes(Ix))return;let n=r.length===0||r.endsWith(`
|
|
234
234
|
`)?"":`
|
|
235
|
-
`;ke.writeFileSync(t,`${r}${n}${
|
|
236
|
-
`)}function
|
|
235
|
+
`;ke.writeFileSync(t,`${r}${n}${Ix}
|
|
236
|
+
`)}function ZF({cwd:e,pm:t}){let r=WF.join(" ");return t==="pnpm"?XF(e)?`pnpm add -wD ${r}`:`pnpm add -D ${r}`:t==="yarn"?QF({cwd:e,deps:r}):t==="bun"?`bun add -d ${r}`:`npm install -D ${r}`}function XF(e){return ke.existsSync(ge.join(e,"pnpm-workspace.yaml"))||ke.existsSync(ge.join(e,"pnpm-workspace.yml"))}function QF({cwd:e,deps:t}){return eB(e)?`yarn add -D ${t}`:tB(e)?`yarn add -WD ${t}`:`yarn add -D ${t}`}function eB(e){if(ke.existsSync(ge.join(e,".yarnrc.yml"))||ke.existsSync(ge.join(e,".pnp.cjs"))||ke.existsSync(ge.join(e,".pnp.js")))return!0;let t=ge.join(e,"package.json");if(!ke.existsSync(t))return!1;try{let r=JSON.parse(ke.readFileSync(t,"utf8"));if(r==null||typeof r!="object"||!("packageManager"in r))return!1;let n=r.packageManager;if(typeof n!="string")return!1;let i=/^yarn@(\d+)/.exec(n);return i!=null&&Number(i[1])>=2}catch{return!1}}function tB(e){let t=ge.join(e,"package.json");if(!ke.existsSync(t))return!1;try{let r=JSON.parse(ke.readFileSync(t,"utf8"));if(r==null||typeof r!="object"||!("workspaces"in r))return!1;let n=r.workspaces;return Array.isArray(n)||n!=null&&typeof n=="object"}catch{return!1}}function rB(e){return ke.existsSync(ge.join(e,"pnpm-lock.yaml"))?"pnpm":ke.existsSync(ge.join(e,"yarn.lock"))?"yarn":ke.existsSync(ge.join(e,"bun.lockb"))||ke.existsSync(ge.join(e,"bun.lock"))?"bun":"npm"}function nB({cwd:e}){let t=ge.join(e,".ripplo"),r=ge.join(t,"entities"),n=ge.join(t,"singletons"),i=ge.join(t,"worlds"),o=ge.join(t,"tests");[r,n,i,o].forEach(s=>{ke.mkdirSync(s,{recursive:!0})}),Nn(ge.join(t,"index.ts"),oB),Nn(ge.join(r,"index.ts"),sB),Nn(ge.join(n,"index.ts"),aB),Nn(ge.join(i,"index.ts"),lB),Nn(ge.join(o,"index.ts"),cB),Nn(ge.join(t,"tsconfig.json"),uB)}function Nn(e,t){ke.existsSync(e)||ke.writeFileSync(e,t)}function iB(e){let t=ge.join(e,".gitignore");if(!ke.existsSync(t))return;let r=ke.readFileSync(t,"utf8"),n=HF.filter(o=>!r.includes(o));if(n.length===0)return;let i=r.endsWith(`
|
|
237
237
|
`)?"":`
|
|
238
238
|
`;ke.writeFileSync(t,r+i+n.join(`
|
|
239
239
|
`)+`
|
|
240
|
-
`)}var
|
|
240
|
+
`)}var oB=`import { createRipplo } from "@ripplo/testing";
|
|
241
241
|
import { entities } from "./entities/index";
|
|
242
242
|
import { singletons } from "./singletons/index";
|
|
243
243
|
import { tests } from "./tests/index";
|
|
@@ -247,7 +247,7 @@ export default createRipplo({
|
|
|
247
247
|
singletons,
|
|
248
248
|
tests,
|
|
249
249
|
});
|
|
250
|
-
`,
|
|
250
|
+
`,sB=`// Model the app's state as entities. Each entity gets a \`seed\`/\`read\` impl in your
|
|
251
251
|
// app's engine funnel (createEngine). See /ripplo:create "Adding an entity".
|
|
252
252
|
//
|
|
253
253
|
// Example:
|
|
@@ -263,7 +263,7 @@ export default createRipplo({
|
|
|
263
263
|
// export const entities = [Project] as const;
|
|
264
264
|
|
|
265
265
|
export const entities = [] as const;
|
|
266
|
-
`,
|
|
266
|
+
`,aB=`// Client/global state (e.g. localStorage flags) modeled as singletons.
|
|
267
267
|
//
|
|
268
268
|
// Example:
|
|
269
269
|
// import { singleton, v } from "@ripplo/testing";
|
|
@@ -278,7 +278,7 @@ export const entities = [] as const;
|
|
|
278
278
|
// export const singletons = [onboardingDismissed];
|
|
279
279
|
|
|
280
280
|
export const singletons = [];
|
|
281
|
-
`,
|
|
281
|
+
`,lB=`// Pure builder functions returning a flat record of entity handles \u2014 the starting state
|
|
282
282
|
// for tests. Compose from other worlds. See /ripplo:create "Adding a world".
|
|
283
283
|
//
|
|
284
284
|
// Example:
|
|
@@ -290,7 +290,7 @@ export const singletons = [];
|
|
|
290
290
|
// const project = Project.of({ name: arbitrary(Project.field.name), ownerId: me.id });
|
|
291
291
|
// return { me, project };
|
|
292
292
|
// };
|
|
293
|
-
`,
|
|
293
|
+
`,cB=`// Each test file under ./tests exports a test. Import them here and add to the \`tests\`
|
|
294
294
|
// array \u2014 that's what createRipplo({ ..., tests }) receives. Stub with \`test("Intent")\`
|
|
295
295
|
// (no body); implement later with \`test("Intent", () => ({ given, steps }))\`.
|
|
296
296
|
//
|
|
@@ -299,7 +299,7 @@ export const singletons = [];
|
|
|
299
299
|
// export const tests = [createProject] as const;
|
|
300
300
|
|
|
301
301
|
export const tests = [] as const;
|
|
302
|
-
`,
|
|
302
|
+
`,uB=`{
|
|
303
303
|
"compilerOptions": {
|
|
304
304
|
"strict": true,
|
|
305
305
|
"noUncheckedIndexedAccess": true,
|
|
@@ -315,58 +315,90 @@ export const tests = [] as const;
|
|
|
315
315
|
"include": ["*.ts", "entities/**/*.ts", "singletons/**/*.ts", "worlds/**/*.ts", "tests/**/*.ts"],
|
|
316
316
|
"exclude": ["node_modules"]
|
|
317
317
|
}
|
|
318
|
-
`;var
|
|
318
|
+
`;var pB=dB(`
|
|
319
319
|
query InitProjects {
|
|
320
320
|
projects {
|
|
321
321
|
id
|
|
322
322
|
name
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
`),uf=["../.env.local","../.env"];async function
|
|
326
|
-
`),process.exit(1));let i=await
|
|
325
|
+
`),uf=["../.env.local","../.env"];async function Mx(e=mB()){let t=process.cwd(),r=ut();r==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let n=it();fB(t)&&(process.stdout.write(`\`.ripplo/index.ts\` already exists at ${t}. Delete it first if you want to re-init.
|
|
326
|
+
`),process.exit(1));let i=await hB({serverUrl:n,token:r});i.length===0&&(process.stdout.write("No projects found. Create one in the dashboard first, then re-run `ripplo init`.\n"),process.exit(1));let o=await yB(i,e.projectId),s=await bB(t,e.envFile),a=await SB(e.appUrl),l=gB(a,e.engineUrl),c=$n.resolve($n.join(t,".ripplo"),s);eh({cwd:t,envFiles:[s],projectId:o}),xB({appUrl:a,engineUrl:l,filePath:c});let d=(await Px({cwd:t,onStep:p=>{process.stdout.write(` ${p}
|
|
327
327
|
`)}})).match(p=>p,p=>{process.stderr.write(`${qe(p)}
|
|
328
328
|
`),process.exit(1)});if(d.length>0){process.stdout.write(`Done with warnings:
|
|
329
329
|
`),d.forEach(p=>{process.stdout.write(` - ${p.message}
|
|
330
330
|
`),p.manualCommand!=null&&process.stdout.write(` run: ${p.manualCommand}
|
|
331
|
-
`)});return}process.stdout.write("Ready. Start `npx ripplo daemon` as a background process (or run `/ripplo:start` in Claude Code), then write tests in `.ripplo/tests/`.\n")}function
|
|
332
|
-
`),process.exit(1)}return t}return`${e.replace(/\/$/,"")}/ripplo`}async function
|
|
331
|
+
`)});return}process.stdout.write("Ready. Start `npx ripplo daemon` as a background process (or run `/ripplo:start` in Claude Code), then write tests in `.ripplo/tests/`.\n")}function fB(e){return Ln.existsSync($n.join(e,".ripplo","index.ts"))}async function hB({serverUrl:e,token:t}){return((await D({config:ar({serverUrl:e,token:t}),document:pB,variables:void 0})).projects??[]).map(n=>({id:n.id,name:n.name}))}function mB(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function gB(e,t){if(t!=null){try{new URL(t)}catch{process.stdout.write(`--engine-url is not a valid URL: ${t}
|
|
332
|
+
`),process.exit(1)}return t}return`${e.replace(/\/$/,"")}/ripplo`}async function yB(e,t){if(t!=null){let r=e.find(n=>n.id===t);return r==null&&(process.stdout.write(`Unknown project id: ${t}
|
|
333
333
|
`),process.exit(1)),process.stdout.write(`Using project: ${r.name} (${r.id})
|
|
334
334
|
`),r.id}if(e.length===1){let r=e[0];if(r==null)throw new Error("unreachable");return process.stdout.write(`Using project: ${r.name} (${r.id})
|
|
335
|
-
`),r.id}return
|
|
336
|
-
`),process.exit(1)),t):
|
|
337
|
-
`),process.exit(1)}return e}return
|
|
335
|
+
`),r.id}return Ox({choices:e.map(r=>({name:r.name,value:r.id})),message:"Select a project"})}async function bB(e,t){return t!=null?(t.trim().length===0&&(process.stdout.write(`--env must not be empty
|
|
336
|
+
`),process.exit(1)),t):wB(e)}async function wB(e){let t=$n.join(e,".ripplo"),r=uf.find(i=>Ln.existsSync($n.resolve(t,i))),n=await Ox({choices:[...uf.map(i=>({name:r===i?`${i} (detected)`:i,value:i})),{name:"custom path",value:"__custom__"}],default:r??uf[0],message:"Which env file should ripplo write RIPPLO_APP_URL, RIPPLO_ENGINE_URL, RIPPLO_WEBHOOK_SECRET, and ENABLE_RIPPLO_TESTING to?"});return n!=="__custom__"?n:Tx({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:i=>i.trim().length>0?!0:"required"})}async function SB(e){if(e!=null){try{new URL(e)}catch{process.stdout.write(`--app-url is not a valid URL: ${e}
|
|
337
|
+
`),process.exit(1)}return e}return vB()}async function vB(){return Tx({default:"http://localhost:3000",message:"Where does your dev server run? (RIPPLO_APP_URL)",validate:e=>{try{return new URL(e),!0}catch{return"must be a valid URL"}}})}function xB({appUrl:e,engineUrl:t,filePath:r}){Ln.mkdirSync($n.dirname(r),{recursive:!0});let n=Ln.existsSync(r)?Ln.readFileSync(r,"utf8"):"",i=[];if(/^RIPPLO_APP_URL=/m.test(n)||i.push(`RIPPLO_APP_URL=${e}`),/^RIPPLO_ENGINE_URL=/m.test(n)||i.push(`RIPPLO_ENGINE_URL=${t}`),/^RIPPLO_WEBHOOK_SECRET=/m.test(n)||i.push(`RIPPLO_WEBHOOK_SECRET=${vl()}`),/^ENABLE_RIPPLO_TESTING=/m.test(n)||i.push("ENABLE_RIPPLO_TESTING=true"),i.length===0)return;let o=n.length===0||n.endsWith(`
|
|
338
338
|
`)?"":`
|
|
339
339
|
`;Ln.writeFileSync(r,`${n}${o}${i.join(`
|
|
340
340
|
`)}
|
|
341
|
-
`)}function Ta(e){let t=e.tests.filter(i=>!i.stub);if(t.length===0)return[];let r=new Set(t.flatMap(i=>
|
|
342
|
-
`),process.stdout.write(`${
|
|
341
|
+
`)}function Ta(e){let t=e.tests.filter(i=>!i.stub);if(t.length===0)return[];let r=new Set(t.flatMap(i=>kB(i))),n=new Set(t.flatMap(i=>CB(i)));return[...e.entities.filter(i=>!r.has(i.name)).map(i=>({entity:i.name,kind:"entity-never-given"})),...e.entities.filter(i=>r.has(i.name)&&!n.has(i.name)).map(i=>({entity:i.name,kind:"entity-never-mutated"}))]}function kB(e){return[...e.world,...e.maybe].map(t=>t.entity)}function CB(e){return e.steps.flatMap(t=>t.expect.flatMap(r=>Yi(r)))}function Yi(e){return e.kind==="state"?[e.entity]:e.kind==="not"?Yi(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>Yi(t)):e.kind==="when"?[...Yi(e.condition),...Yi(e.consequence)]:[]}async function Nx(){let e=process.cwd(),r=(await we(e)).match(i=>i,i=>RB(Oe(i))),n=Cr(r);if(n.length===0){let i=Ta(r);i.length>0&&process.stdout.write(`${Ia(i)}
|
|
342
|
+
`),process.stdout.write(`${gx(r.tests.length)}
|
|
343
343
|
`);return}process.stderr.write(`${Rr(n)}
|
|
344
|
-
`),process.exit(1)}function
|
|
345
|
-
`),process.exit(1)}import{graphql as
|
|
344
|
+
`),process.exit(1)}function RB(e){process.stderr.write(`${e}
|
|
345
|
+
`),process.exit(1)}import{graphql as EB}from"gql.tada";var IB=EB(`
|
|
346
346
|
query ProjectsList {
|
|
347
347
|
projects {
|
|
348
348
|
id
|
|
349
349
|
name
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
`);async function
|
|
353
|
-
`)}import
|
|
354
|
-
|
|
355
|
-
$
|
|
356
|
-
|
|
352
|
+
`);async function Lx(){let e=ut();e==null&&(process.stderr.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let t=it(),n=((await D({config:ar({serverUrl:t,token:e}),document:IB,variables:void 0})).projects??[]).map(i=>({id:i.id,name:i.name}));process.stdout.write(`${JSON.stringify({projects:n},null,2)}
|
|
353
|
+
`)}import{graphql as AB}from"gql.tada";function $x({id:e,kind:t,title:r}){return`Caught bug reported (${t}): "${r}" [${e}]`}var PB=AB(`
|
|
354
|
+
mutation ReportCaughtBug(
|
|
355
|
+
$projectId: String!
|
|
356
|
+
$kind: CaughtBugKind!
|
|
357
|
+
$title: String!
|
|
358
|
+
$rootCause: String!
|
|
359
|
+
$surfacedBy: String!
|
|
360
|
+
$runId: String
|
|
361
|
+
$workflowSlug: String
|
|
362
|
+
) {
|
|
363
|
+
reportCaughtBug(
|
|
364
|
+
projectId: $projectId
|
|
365
|
+
kind: $kind
|
|
366
|
+
title: $title
|
|
367
|
+
rootCause: $rootCause
|
|
368
|
+
surfacedBy: $surfacedBy
|
|
369
|
+
runId: $runId
|
|
370
|
+
workflowSlug: $workflowSlug
|
|
371
|
+
) {
|
|
372
|
+
__typename
|
|
373
|
+
... on CaughtBug {
|
|
374
|
+
id
|
|
375
|
+
kind
|
|
376
|
+
title
|
|
377
|
+
}
|
|
378
|
+
... on WorkflowNotFoundError {
|
|
379
|
+
message
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
`);async function Dx(e){let t=mt(),n=(await D({config:t,document:PB,variables:{kind:e.kind,projectId:t.projectId,rootCause:e.rootCause,runId:e.runId??null,surfacedBy:e.surfacedBy,title:e.title,workflowSlug:e.testId==null?null:de(e.testId)}})).reportCaughtBug;if(n?.__typename!=="CaughtBug"){let i=n?.__typename==="WorkflowNotFoundError"?n.message:null;process.stderr.write(`${i??"reportCaughtBug failed"}
|
|
384
|
+
`),process.exit(1)}process.stdout.write(`${$x({id:n.id,kind:e.kind,title:e.title})}
|
|
385
|
+
`)}import YB from"path";import{CancellationTokenSource as ZB}from"vscode-jsonrpc/node";import{spawn as jB}from"child_process";import zx from"fs";import FB from"net";import{setTimeout as qx}from"timers/promises";import{err as ff,ok as hf}from"neverthrow";import{ResponseError as BB}from"vscode-jsonrpc/node";import{createMessageConnection as TB,NotificationType as _x,RequestType as OB,RequestType0 as jx,SocketMessageReader as MB,SocketMessageWriter as NB}from"vscode-jsonrpc/node";import{z as A}from"zod";var LB="daemon.sock",$B="daemon.log";function Zi(e){return It(e,LB)}function df(e){return It(e,$B)}function Oa(e){return TB(new MB(e),new NB(e))}var Fx=A.object({all:A.boolean(),headed:A.boolean(),tests:A.array(A.string())}),Bx=A.object({jobId:A.string(),total:A.number()}),DB=A.enum(["holder","standby","off"]),Vx=A.object({active:A.number(),explorer:DB,exploring:A.number(),queued:A.number()}),pf=A.discriminatedUnion("kind",[A.object({kind:A.literal("pass")}),A.object({findingLines:A.array(A.string()),kind:A.literal("findings")}),A.object({detail:A.string(),kind:A.literal("error")}),A.object({detail:A.string(),kind:A.literal("dispatch-error")})]),_B=A.discriminatedUnion("kind",[A.object({kind:A.literal("test-started"),runId:A.string(),testName:A.string()}),A.object({kind:A.literal("test-outcome"),outcome:pf,runId:A.string(),testName:A.string()})]),Ux=A.object({event:_B,jobId:A.string()}),Wx=A.object({failed:A.number(),jobId:A.string(),passed:A.number()}),Hx=A.discriminatedUnion("code",[A.object({code:A.literal("compile-failed"),detail:A.string(),diagnostics:A.array(A.string()).default([])}),A.object({code:A.literal("selection-conflicting-flags")}),A.object({code:A.literal("selection-nothing-selected")}),A.object({code:A.literal("selection-unknown-ids"),known:A.array(A.string()),unknown:A.array(A.string())}),A.object({code:A.literal("scope-failed"),detail:A.string()}),A.object({code:A.literal("sync-failed"),detail:A.string()}),A.object({code:A.literal("bad-message")})]),Ma=new OB("ripplo/enqueue"),Na=new jx("ripplo/status"),La=new jx("ripplo/shutdownIfIdle"),$a=new _x("ripplo/jobEvent"),Da=new _x("ripplo/jobDone");var Kx=12e4,VB=300,Gx=5e3;async function Jx({cliEntry:e,cwd:t}){let r=Zi(t),n=await _a(r);if(n!=null)return hf(mf(n,!1));let i=zB({cliEntry:e,cwd:t});if(i!=null)return ff(i);let o=await GB(r);return o==null?ff({deadlineMs:Kx,kind:"connect-timeout",logPath:df(t)}):hf(mf(o,!0))}async function Yx({connection:e,onEvent:t,request:r,token:n}){let i=await WB({connection:e,onEvent:t,request:r,token:n});return i.kind==="transport"?ff(i.error):hf(i)}async function Zx(e){try{await e.rpc.sendRequest(La)}catch{}}async function Xx(e){let t=await _a(Zi(e));if(t==null)return{kind:"not-running"};let r=mf(t,!1),n=await Promise.race([UB(r),qx(Gx).then(()=>null)]);return t.destroy(),n==null?{kind:"unresponsive",timeoutMs:Gx}:{kind:"running",status:n}}async function UB(e){try{let t=await e.rpc.sendRequest(Na),r=Vx.safeParse(t);return r.success?r.data:null}catch{return null}}function WB({connection:e,onEvent:t,request:r,token:n}){let{rpc:i}=e;return new Promise(o=>{let s=a=>{o(a)};i.onNotification($a,a=>{let l=Ux.safeParse(a);if(!l.success){s({error:{kind:"bad-frame"},kind:"transport"});return}t(l.data.event)}),i.onNotification(Da,a=>{let l=Wx.safeParse(a);if(!l.success){s({error:{kind:"bad-frame"},kind:"transport"});return}s({failed:l.data.failed,kind:"done",passed:l.data.passed})}),i.onClose(()=>{s({error:{kind:"connection-lost"},kind:"transport"})}),i.sendRequest(Ma,r,n).then(a=>{Bx.safeParse(a).success||s({error:{kind:"bad-frame"},kind:"transport"})}).catch(a=>{s(HB(a))})})}function HB(e){if(e instanceof BB){let t=Hx.safeParse(e.data);return t.success?{error:t.data,kind:"daemon-error"}:{error:{kind:"bad-frame"},kind:"transport"}}return{error:{kind:"connection-lost"},kind:"transport"}}function mf(e,t){let r=Oa(e);return r.listen(),{rpc:r,socket:e,spawned:t}}function _a(e){return new Promise(t=>{let r=FB.connect(e);r.once("connect",()=>{t(r)}),r.once("error",()=>{t(null)})})}function zB({cliEntry:e,cwd:t}){try{Dt(t);let r=zx.openSync(df(t),"a");return jB(process.execPath,[e,"daemon"],{cwd:t,detached:!0,stdio:["ignore",r,r]}).unref(),zx.closeSync(r),null}catch(r){return{kind:"spawn-failed",message:r instanceof Error?r.message:String(r)}}}async function GB(e){let t=Date.now()+Kx,r=await _a(e);for(;r==null&&Date.now()<t;)await qx(VB),r=await _a(e);return r}import qB from"fuse.js";function gf(e){switch(e.kind){case"conflicting-flags":return"Pass either --all or test ids, not both.";case"nothing-selected":return`No tests selected \u2014 scope is empty and no .ripplo/tests files are dirty. Pass test ids, add tests to scope (${F("scope")}), or use --all.`;case"unknown-ids":{let t=e.known.map(i=>de(i)),r=e.unknown.flatMap(i=>KB(i,t)),n=r.length>0?[`Did you mean: ${[...new Set(r)].join(", ")}`]:[];return[`Unknown test id(s): ${e.unknown.join(", ")}`,...n,"The test id is the slug shown in run output and scope listings (the quoted intent string also works). All known ids:",...t.map(i=>` ${i}`)].join(`
|
|
386
|
+
`)}}}function Qx({failed:e,passed:t}){let r=e>0?`
|
|
387
|
+
${F("debug")}`:"";return`${String(t)} passed, ${String(e)} failed (${String(t+e)} total)${r}`}function ek({debugDir:e,event:t}){if(t.kind==="test-started")return`${_.dim("RUN ")} ${t.testName}`;switch(t.outcome.kind){case"pass":return`${_.good("PASS")} ${t.testName}`;case"findings":return[`${_.bad("FAIL")} ${t.testName} \u2014 ${String(t.outcome.findingLines.length)} finding(s)`,...t.outcome.findingLines,eu({debugDir:e,runId:t.runId})].join(`
|
|
388
|
+
`);case"error":return`${_.bad("ERROR")} ${t.testName} \u2014 ${t.outcome.detail}`;case"dispatch-error":return`${_.bad("ERROR")} ${t.testName} \u2014 failed to dispatch (${t.outcome.detail})`}}function tk(e){switch(e.code){case"compile-failed":{let t=e.diagnostics.length===0?[]:["",...e.diagnostics];return[`Compilation failed in the daemon (${e.detail}). Run \`npx ripplo compile\` for the full output.`,...t].join(`
|
|
357
389
|
`)}case"selection-conflicting-flags":return gf({kind:"conflicting-flags"});case"selection-nothing-selected":return gf({kind:"nothing-selected"});case"selection-unknown-ids":return gf({kind:"unknown-ids",known:e.known,unknown:e.unknown});case"scope-failed":return`Could not resolve the dev-session scope: ${e.detail}
|
|
358
|
-
Verify the dev session is live (\`npx ripplo doctor\`, ${
|
|
390
|
+
Verify the dev session is live (\`npx ripplo doctor\`, ${F("start")}), or pass test ids / --all explicitly.`;case"sync-failed":{let t=/401|unauthor/i.test(e.detail)?"\nLooks like an auth failure \u2014 run `npx ripplo auth login` and retry.":"";return`Sync to the Ripplo server failed: ${e.detail}${t}`}case"bad-message":return"Daemon rejected the request (protocol mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function ja(e){switch(e.kind){case"spawn-failed":return`Failed to start \`ripplo daemon\`: ${JB(e.message)}`;case"connect-timeout":return[`Daemon did not come up within ${String(Math.round(e.deadlineMs/1e3))}s.`,`Check ${e.logPath} for startup errors (tail it: \`tail -50 ${e.logPath}\`).`,"Common causes: a stale socket (`rm .ripplo/.local/daemon.sock`), another daemon holding the dev lock, or the Ripplo server being unreachable."].join(`
|
|
359
391
|
`);case"connection-lost":return["Connection to the daemon was lost before the run finished \u2014 the daemon likely crashed or was killed.","Check .ripplo/.local/daemon.log, then restart with `npx ripplo daemon` (or rerun \u2014 `ripplo run` auto-starts it)."].join(`
|
|
360
|
-
`);case"bad-frame":return"Received a malformed frame from the daemon (version mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function
|
|
361
|
-
`)}})).match(p=>p,p=>Fa(ja(p)));await
|
|
392
|
+
`);case"bad-frame":return"Received a malformed frame from the daemon (version mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function KB(e,t){return new qB(t,{includeScore:!0,threshold:.5}).search(de(e)).slice(0,3).map(n=>n.item)}function JB(e){return e.includes("ENOENT")?`${e} \u2014 the node executable or CLI entry was not found on PATH.`:e.includes("EACCES")?`${e} \u2014 permission denied executing the CLI entry.`:e}async function rk({all:e,headed:t,ids:r,keepAlive:n}){let i=process.cwd(),o=process.argv[1];o==null&&Fa(ja({kind:"spawn-failed",message:"process.argv[1] missing"}));let a=(await Jx({cliEntry:o,cwd:i})).match(p=>p,p=>Fa(ja(p))),l=new ZB;process.once("SIGINT",()=>{l.cancel(),a.socket.destroy(),process.exit(130)});let c=YB.join(i,".ripplo","debug"),d=(await Yx({connection:a,request:{all:e,headed:t,tests:[...r]},token:l.token,onEvent:p=>{let h=ek({debugDir:c,event:p});h!=null&&process.stdout.write(`${h}
|
|
393
|
+
`)}})).match(p=>p,p=>Fa(ja(p)));await XB({connection:a,keepAlive:n,result:d})}async function XB({connection:e,keepAlive:t,result:r}){e.spawned&&!t&&await Zx(e),await new Promise(n=>{e.socket.end(n)}),r.kind==="daemon-error"&&Fa(tk(r.error)),process.stdout.write(`${Qx(r)}
|
|
362
394
|
`),process.exit(r.failed>0?1:0)}function Fa(e){process.stderr.write(`${e}
|
|
363
|
-
`),process.exit(1)}import
|
|
395
|
+
`),process.exit(1)}import gU from"path";import{err as Za,ok as kf}from"neverthrow";import{randomUUID as kV}from"crypto";import{CancellationTokenSource as CV,ResponseError as RV}from"vscode-jsonrpc/node";import{graphql as fk}from"gql.tada";import QB from"p-queue";var eV=4,tV={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},Ba=new QB({concurrency:eV}),rr={headedActive:0,interactiveActive:0,interactiveQueued:0},nk={current:null};function Va({headed:e,task:t,workClass:r}){let n=tV[r];return r==="p3-explore"?Ba.add(t,{priority:n}):(rr.interactiveQueued+=1,yf(),Ba.add(()=>rV({headed:e,task:t}),{priority:n}))}function Ua(e){!Number.isFinite(e)||e<1||(Ba.concurrency=Math.floor(e))}function Xi(){return{active:rr.interactiveActive,headedActive:rr.headedActive,poolSize:Ba.concurrency,queued:rr.interactiveQueued}}function bf(e){nk.current=e}async function rV({headed:e,task:t}){rr.interactiveQueued-=1,rr.interactiveActive+=1,rr.headedActive+=e?1:0,yf();try{return await t()}finally{rr.interactiveActive-=1,rr.headedActive-=e?1:0,yf()}}function yf(){nk.current?.()}import{err as wf,ok as ik}from"neverthrow";function ok({all:e,ids:t,lockfile:r}){let n=r.tests.map(a=>a.name);if(e&&t.length>0)return wf({kind:"conflicting-flags"});if(e)return ik(r.tests.filter(a=>!a.stub).map(a=>a.name));if(t.length===0)return wf({kind:"nothing-selected"});let i=new Map(n.map(a=>[de(a),a])),o=t.map(a=>({id:a,name:n.includes(a)?a:i.get(de(a))})),s=o.filter(a=>a.name==null).map(a=>a.id);return s.length>0?wf({kind:"unknown-ids",known:n,unknown:s}):ik(o.flatMap(a=>a.name==null?[]:[a.name]))}import{err as Sf,ok as ak}from"neverthrow";import{graphql as lk}from"gql.tada";async function ck({config:e,cwd:t,lockfile:r}){await iV({config:e,cwd:t,lockfile:r});let n=await sV(e);if(n.isErr())return Sf(n.error);let i=new Map(r.tests.filter(s=>!s.stub).map(s=>[de(s.name),s.name])),o=[...new Set(n.value)].flatMap(s=>{let a=i.get(s);return a==null?[]:[a]});return o.length===0?Sf({kind:"scope-empty"}):ak(o)}var nV=lk(`
|
|
364
396
|
mutation AddDirtyTestsToScope($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
365
397
|
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
366
398
|
__typename
|
|
367
399
|
}
|
|
368
400
|
}
|
|
369
|
-
`);async function
|
|
401
|
+
`);async function iV({config:e,cwd:t,lockfile:r}){let n=new Set(aV(t)),i=r.tests.filter(o=>o.sourcePath!=null&&n.has(o.sourcePath)).map(o=>de(o.name));i.length!==0&&await D({config:e,document:nV,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:i}}).catch(o=>{j.warn({err:o},"auto-scope of dirty tests failed")})}var oV=lk(`
|
|
370
402
|
query ScopeSelection($projectId: String!, $cwd: String!) {
|
|
371
403
|
project(id: $projectId) {
|
|
372
404
|
id
|
|
@@ -382,8 +414,8 @@ Verify the dev session is live (\`npx ripplo doctor\`, ${j("start")}), or pass t
|
|
|
382
414
|
}
|
|
383
415
|
}
|
|
384
416
|
}
|
|
385
|
-
`);async function
|
|
386
|
-
`).map(t=>t.slice(3).trim()).filter(t=>t.startsWith(
|
|
417
|
+
`);async function sV(e){try{let r=(await D({config:e,document:oV,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return ak(r.flatMap(n=>n.workflow==null?[]:[n.workflow.slug]))}catch(t){return Sf({detail:t instanceof Error?t.message:String(t),kind:"scope-fetch-failed"})}}var sk=".ripplo/tests/";function aV(e){try{return ot(["status","--porcelain","--",".ripplo/tests"],e).split(`
|
|
418
|
+
`).map(t=>t.slice(3).trim()).filter(t=>t.startsWith(sk)&&t.endsWith(".ts")).map(t=>t.slice(sk.length)).filter(t=>t!=="index.ts"&&!t.endsWith("/index.ts"))}catch{return[]}}import cV from"crypto";import{graphql as uV}from"gql.tada";import{err as dV,ok as pV}from"neverthrow";import vf from"fs";import xf from"path";function Wa(e){try{let t=lV(e);if(t==null)return;let r=xf.join(t,"HEAD"),n=vf.readFileSync(r,"utf8").trim(),i="ref: refs/heads/";return n.startsWith(i)?n.slice(i.length):n.length===0?void 0:n.slice(0,7)}catch{return}}function lV(e){let t=xf.join(e,".git");if(vf.statSync(t).isDirectory())return t;let n=vf.readFileSync(t,"utf8").trim(),i="gitdir:";if(!n.startsWith(i))return;let o=n.slice(i.length).trim();if(o.length!==0)return xf.resolve(e,o)}var fV=uV(`
|
|
387
419
|
mutation SyncDevSession(
|
|
388
420
|
$projectId: String!
|
|
389
421
|
$cwd: String!
|
|
@@ -402,7 +434,7 @@ Verify the dev session is live (\`npx ripplo doctor\`, ${j("start")}), or pass t
|
|
|
402
434
|
hooksPaused
|
|
403
435
|
}
|
|
404
436
|
}
|
|
405
|
-
`);async function Qi(e,t){let r=await we(e);if(r.isErr())return
|
|
437
|
+
`);async function Qi(e,t){let r=await we(e);if(r.isErr())return dV({error:r.error,kind:"compilation-failed"});let n=await Ir({config:t,cwd:e,lockfile:r.value});return pV({devSessionId:n.devSessionId,lockfile:r.value})}async function Ir(e){let t=hV(e.lockfile);return xV({config:e.config,cwd:e.cwd,payload:t})}function hV(e){let t=mV(e);return{preconditions:e.entities.map(r=>({depends:t.get(r.name)??[],description:r.description??"",name:r.name,returns:r.identity})),workflows:e.tests.map(r=>({expectedOutcome:r.intent,name:r.name,preconditions:wV(SV(r),t),requiresKeys:r.world.map(n=>({namespace:n.as,preconditionName:n.entity})),slug:de(r.name),sourcePath:r.sourcePath??null,spec:JSON.stringify({steps:r.steps.map((n,i)=>zn(n,i)),stub:r.stub})}))}}function mV(e){let t=e.tests.reduce((r,n)=>gV(r,n),new Map);return new Map([...t].map(([r,n])=>[r,[...n]]))}function gV(e,t){let r=[...t.world,...t.maybe],n=new Map(r.map(i=>[i.as,i.entity]));return r.reduce((i,o)=>{let s=yV(o,n),a=i.get(o.entity)??new Set;return new Map([...i,[o.entity,new Set([...a,...s])]])},e)}function yV(e,t){return Object.values(e.set).flatMap(r=>bV(r)).map(r=>t.get(r)).filter(r=>r!=null&&r!==e.entity)}function bV(e){return e==null||typeof e!="object"?[]:"ref"in e?[uk(e.ref)]:e.template.filter(t=>typeof t!="string").map(t=>uk(t.ref))}function uk(e){let[t]=e.split(".");return t??e}function wV(e,t){let r=(n,i)=>n.has(i)?n:(t.get(i)??[]).reduce((o,s)=>r(o,s),new Set([...n,i]));return[...e.reduce((n,i)=>r(n,i),new Set)]}function SV(e){return[...new Set(e.world.map(t=>t.entity))]}function vV(e){return cV.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function xV({config:e,cwd:t,payload:r}){let n=vV(r),i=Wa(t),o=await D({config:e,document:fV,variables:{branch:i??null,cwd:t,preconditions:r.preconditions.map(s=>({depends:[...s.depends],description:s.description,name:s.name,returns:[...s.returns]})),projectId:e.projectId,workflows:r.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:s.spec??null}))}});if(o.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:o.syncDevSession.id,hash:n,hooksPaused:o.syncDevSession.hooksPaused}}var EV=12e4,IV=-32099;function Ha(e){let t=new AbortController;return e.isCancellationRequested?(t.abort(),t.signal):(e.onCancellationRequested(()=>{t.abort()}),t.signal)}function hk(e){let t={...e,expectations:new Map,jobs:new Map};return{claim:r=>NV(t,r),handleConnection:r=>{AV(t,r)},idle:()=>mk(t)}}function AV(e,t){let r=Oa(t);r.onRequest(Ma,(n,i)=>PV({connection:r,ctx:e,params:n,token:i})),r.onRequest(Na,()=>{let n=Xi();return{active:n.active,queued:n.queued,...e.explorationStatus()}}),r.onRequest(La,()=>{let n=mk(e);return n&&e.onShutdownRequest(),n}),r.onClose(()=>{TV(e,r)}),r.onError(n=>{j.warn({err:n},"ipc connection error")}),t.on("error",n=>{j.warn({err:n},"ipc socket error")}),r.listen()}function mk(e){let t=Xi();return e.jobs.size===0&&t.active===0&&t.queued===0}async function PV({connection:e,ctx:t,params:r,token:n}){let i=Fx.safeParse(r);if(!i.success)throw dk({code:"bad-message"});await t.ready;let o=await $V({config:t.config,cwd:t.cwd,message:i.data});if(o.kind==="error")throw dk(o.error);let s=kV(),a=new CV;return n.onCancellationRequested(()=>{gk(t,s)}),t.jobs.set(s,{cancellation:a,connection:e,failed:0,passed:0,total:o.testNames.length}),HV({ctx:t,headed:i.data.headed,jobId:s,testNames:o.testNames,token:a.token,workflowIdsBySlug:o.workflowIdsBySlug}).catch(l=>{j.error({err:l},"ipc dispatch failed")}),{jobId:s,total:o.testNames.length}}function dk(e){return new RV(IV,e.code,e)}function gk(e,t){let r=e.jobs.get(t);r!=null&&(r.cancellation.cancel(),e.jobs.delete(t),e.expectations.forEach((n,i)=>{n.filter(o=>o.jobId===t).forEach(o=>{clearTimeout(o.timer)}),e.expectations.set(i,n.filter(o=>o.jobId!==t))}))}function TV(e,t){[...e.jobs.entries()].filter(([,r])=>r.connection===t).forEach(([r])=>{gk(e,r)})}function eo(e,t,r){let n=e.jobs.get(t);n!=null&&(pk(()=>n.connection.sendNotification($a,{event:r,jobId:t})),r.kind==="test-outcome"&&(r.outcome.kind==="pass"?n.passed+=1:n.failed+=1,n.passed+n.failed>=n.total&&(pk(()=>n.connection.sendNotification(Da,{failed:n.failed,jobId:t,passed:n.passed})),e.jobs.delete(t))))}function pk(e){e().catch(t=>{j.warn({err:t},"ipc notification failed")})}function yk(e,t){let n=e.expectations.get(t)?.shift();return n==null?null:(clearTimeout(n.timer),n)}function OV(e,t){let{headed:r,jobId:n,slug:i,testName:o}=t,s=setTimeout(()=>{MV({ctx:e,jobId:n,slug:i,testName:o,timer:s})},EV);e.expectations.set(i,[...e.expectations.get(i)??[],{headed:r,jobId:n,testName:o,timer:s}])}function MV({ctx:e,jobId:t,slug:r,testName:n,timer:i}){let o=e.expectations.get(r)??[],s=o.findIndex(a=>a.timer===i);s!==-1&&(e.expectations.set(r,o.toSpliced(s,1)),eo(e,t,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-error"},runId:"",testName:n}))}function NV(e,t){let r=yk(e,t);if(r==null)return null;let n=e.jobs.get(r.jobId);return n==null?null:{headed:r.headed,token:n.cancellation.token,finished:(i,o)=>{eo(e,r.jobId,{kind:"test-outcome",outcome:o,runId:i,testName:r.testName})},started:i=>{eo(e,r.jobId,{kind:"test-started",runId:i,testName:r.testName})}}}function LV(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 $V({config:e,cwd:t,message:r}){return(await Ch(t)).match(i=>DV({config:e,cwd:t,lockfile:i,message:r}),i=>Promise.resolve({error:{code:"compile-failed",detail:i.kind,diagnostics:[...LV(i)]},kind:"error"}))}async function DV({config:e,cwd:t,lockfile:r,message:n}){let i=await _V({config:e,cwd:t,lockfile:r});return i!=null?{error:{code:"sync-failed",detail:i},kind:"error"}:(await jV({config:e,cwd:t,lockfile:r,message:n})).match(async s=>({kind:"ready",testNames:s,workflowIdsBySlug:await UV(e,t)}),s=>Promise.resolve({error:s,kind:"error"}))}async function _V(e){try{return await Ir(e),null}catch(t){return t instanceof Error?t.message:String(t)}}async function jV({config:e,cwd:t,lockfile:r,message:n}){return!n.all&&n.tests.length===0?(await ck({config:e,cwd:t,lockfile:r})).mapErr(FV):ok({all:n.all,ids:n.tests,lockfile:r}).mapErr(BV)}function FV(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function BV(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 VV=fk(`
|
|
406
438
|
query DaemonWorkflows($projectId: String!, $cwd: String!) {
|
|
407
439
|
project(id: $projectId) {
|
|
408
440
|
id
|
|
@@ -415,7 +447,7 @@ Verify the dev session is live (\`npx ripplo doctor\`, ${j("start")}), or pass t
|
|
|
415
447
|
}
|
|
416
448
|
}
|
|
417
449
|
}
|
|
418
|
-
`);async function
|
|
450
|
+
`);async function UV(e,t){let n=(await D({config:e,document:VV,variables:{cwd:t,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(n.map(i=>[i.slug,i.id]))}var WV=fk(`
|
|
419
451
|
mutation DaemonCreateRun($workflowId: String!) {
|
|
420
452
|
createRun(workflowId: $workflowId, executor: local) {
|
|
421
453
|
__typename
|
|
@@ -424,74 +456,74 @@ Verify the dev session is live (\`npx ripplo doctor\`, ${j("start")}), or pass t
|
|
|
424
456
|
}
|
|
425
457
|
}
|
|
426
458
|
}
|
|
427
|
-
`);async function
|
|
428
|
-
`).filter(o=>o.length>0).map(o=>
|
|
429
|
-
`),i=await
|
|
459
|
+
`);async function HV(e){await e.testNames.reduce((t,r)=>t.then(()=>zV(e,r)),Promise.resolve())}async function zV(e,t){let{ctx:r,headed:n,jobId:i,token:o,workflowIdsBySlug:s}=e;if(o.isCancellationRequested)return;let a=de(t),l=s.get(a);if(l==null){eo(r,i,{kind:"test-outcome",outcome:{detail:"workflow-not-found",kind:"dispatch-error"},runId:"",testName:t});return}OV(r,{headed:n,jobId:i,slug:a,testName:t});let c=await GV(r.config,l);c!=null&&(yk(r,a),eo(r,i,{kind:"test-outcome",outcome:{detail:c,kind:"dispatch-error"},runId:"",testName:t}))}async function GV(e,t){try{let n=(await D({config:e,document:WV,variables:{workflowId:t}})).createRun;return n==null?"create-run-null":n.__typename==="Run"?null:n.__typename}catch(r){return r instanceof Error?r.message:String(r)}}import{gzip as qV}from"zlib";import{promisify as KV}from"util";import{existsSync as JV,readFileSync as YV}from"fs";import wk from"path";import{graphql as to}from"gql.tada";function bk(e){return[e.kind,e.target,e.value].filter(t=>t.length>0).join(" ")}async function Sk({config:e,cwd:t,headed:r,lockfile:n,runId:i,session:o,signal:s,test:a}){if(!await sU(e,i))return{kind:"dispatch-failed",reason:"already-claimed",runId:i};let c=wk.join(t,".ripplo","debug"),u=[];return(await o.runOnce({lockfile:n,options:{baseUrl:e.appUrl,engineUrl:e.engineUrl,generate:Fc,headed:r,secret:e.webhookSecret},params:void 0,runId:i,testName:a.name,onEvent:p=>{u.push(p)}},s)).match(async p=>{await ZV({config:e,debugDir:c,events:u,runId:i,test:a,total:p.fired.length});let h=vk(u).flatMap(f=>f.findings);return h.length>0?{findings:h,kind:"findings",runId:i}:{kind:"pass",runId:i}},async p=>(await ro(e,i,cr(p)),{error:p,kind:"error",runId:i}))}async function ZV({config:e,debugDir:t,events:r,runId:n,test:i}){let o=vk(r),s=XV(t,n);await Promise.all([tU({config:e,origin:s?.origin??0,records:o,runId:n,test:i}),s==null?Promise.resolve():iU(e,n,s)]),await oU(e,n,o)}function vk(e){return e.flatMap(t=>t.kind==="step"?[{endMs:t.endMs,findings:t.findings,index:t.index,startMs:t.startMs}]:[])}function XV(e,t){let r=wk.join(e,t,"behavior.jsonl");if(!JV(r))return null;let n=YV(r,"utf8").split(`
|
|
460
|
+
`).filter(o=>o.length>0).map(o=>QV(o)).flatMap(o=>eU(o)?[o.event]:[]),i=n[0];return i==null?null:{events:n,origin:i.timestamp}}function QV(e){return JSON.parse(e)}function eU(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}async function tU({config:e,origin:t,records:r,runId:n,test:i}){let o=r.map(s=>rU({origin:t,record:s,test:i}));await D({config:e,document:lU,variables:{items:[{runId:n,steps:o}]}})}function rU({origin:e,record:t,test:r}){let n=r.steps[t.index],i=n==null?null:zn(n,t.index);return{assertions:t.findings.map(o=>({description:ui(o),detail:null,status:"failed"})),detail:null,duration:Math.max(0,t.endMs-t.startMs),nodeType:i?.kind??"step",recordingEndMs:Math.max(0,t.endMs-e),recordingStartMs:Math.max(0,t.startMs-e),rrwebIds:[],snapshotTimestamp:Math.max(0,t.endMs-e),status:t.findings.length>0?"failed":"passed",stepIndex:t.index,title:i==null?`step ${String(t.index)}`:bk(i),url:""}}var nU=KV(qV);async function ro(e,t,r){await D({config:e,document:dU,variables:{reason:r,runId:t}}).catch(n=>{j.error(n,"failRun submission failed")})}async function iU(e,t,r){let n=r.events.map(s=>JSON.stringify(s)).join(`
|
|
461
|
+
`),i=await nU(Buffer.from(n,"utf8")),o=r.events.at(-1);await D({config:e,document:cU,variables:{input:{bodyBase64:i.toString("base64"),chunkIndex:0,endTimestamp:Math.max(0,(o?.timestamp??r.origin)-r.origin),eventCount:r.events.length,runId:t,startTimestamp:0}}})}async function oU(e,t,r){let n=r.filter(s=>s.findings.length>0).length,i=r.length-n,o=r.reduce((s,a)=>s+Math.max(0,a.endMs-a.startMs),0);await D({config:e,document:uU,variables:{items:[{duration:o,failCount:n,passCount:i,runId:t,status:n>0?"failed":"passed",summary:null,warnCount:0}]}})}async function sU(e,t){return((await D({config:e,document:aU,variables:{runIds:[t]}})).startRunsBatch??[]).some(n=>n.id===t)}var aU=to(`
|
|
430
462
|
mutation StartRunsBatch($runIds: [String!]!) {
|
|
431
463
|
startRunsBatch(runIds: $runIds) {
|
|
432
464
|
id
|
|
433
465
|
}
|
|
434
466
|
}
|
|
435
|
-
`),
|
|
467
|
+
`),lU=to(`
|
|
436
468
|
mutation SubmitRunStepsBatch($items: [SubmitRunStepsItem!]!) {
|
|
437
469
|
submitRunStepsBatch(items: $items)
|
|
438
470
|
}
|
|
439
|
-
`),
|
|
471
|
+
`),cU=to(`
|
|
440
472
|
mutation SubmitRunRecordingChunk($input: SubmitRunRecordingChunkInput!) {
|
|
441
473
|
submitRunRecordingChunk(input: $input)
|
|
442
474
|
}
|
|
443
|
-
`),
|
|
475
|
+
`),uU=to(`
|
|
444
476
|
mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
|
|
445
477
|
completeRunsBatch(items: $items) {
|
|
446
478
|
id
|
|
447
479
|
status
|
|
448
480
|
}
|
|
449
481
|
}
|
|
450
|
-
`),
|
|
482
|
+
`),dU=to(`
|
|
451
483
|
mutation FailRun($runId: String!, $reason: String!) {
|
|
452
484
|
failRun(runId: $runId, reason: $reason)
|
|
453
485
|
}
|
|
454
|
-
`);import{createMessageConnection as
|
|
455
|
-
`)}function
|
|
456
|
-
`).filter(r=>r.length>0).map(r=>
|
|
486
|
+
`);import{createMessageConnection as xk,IPCMessageReader as kk,IPCMessageWriter as Ck,NotificationType as pU,NotificationType0 as Rk,RequestType as Ek}from"vscode-jsonrpc/node";import{z as Z}from"zod";var Ik=Z.object({headed:Z.boolean(),lockfileFingerprint:Z.string(),runId:Z.string().min(1),workflowSlug:Z.string().min(1)}),Ak=Z.object({fingerprint:Z.string()}),nie=Z.object({lockfileJson:Z.string().optional(),unavailable:Z.string().optional()}),fU=Z.enum(["unspecified","internal","server","client","producer","consumer"]),hU=Z.enum(["unset","ok","error"]),mU=Z.object({attributes:Z.record(Z.string(),Z.string()),durationMs:Z.number(),kind:Z.literal("span"),name:Z.string(),parentSpanId:Z.union([Z.string(),Z.undefined()]),source:Z.literal("server"),spanId:Z.string(),spanKind:fU,status:Z.object({code:hU,message:Z.union([Z.string(),Z.undefined()])}),timeNanos:Z.string(),traceId:Z.string()}),Pk=Z.object({runId:Z.string().min(1),span:mU}),Tk=Z.object({outcome:pf,serverNotified:Z.boolean()}),za=new Rk("worker/ready"),Ga=new Ek("worker/run"),qa=new Ek("worker/lockfile"),Ka=new pU("worker/span"),Ja=new Rk("worker/shutdown");function Ok(e){let t=xk(new kk(e),new Ck(e));return t.listen(),t}function Mk(){let e=xk(new kk(process),new Ck(process));return e.listen(),e}function Nk(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 Lk({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(`
|
|
487
|
+
`)}function $k(e){return`ripplo daemon: ready as local executor for session ${e} (sync happens on each \`ripplo run\`; Ctrl-C to stop)`}function Dk({cwd:e,pid:t}){return`ripplo daemon: another daemon is already running for this project${t==null?"":` (pid ${String(t)})`} (cwd ${e}).`}function _k(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project; shutting down."}function jk(e){if(e.kind==="not-running")return"daemon: not running";if(e.kind==="unresponsive")return`daemon: running but did not reply within ${String(e.timeoutMs/1e3)}s \u2014 likely busy executing runs (event loop saturated); retry when the batch drains`;let{status:t}=e,r=`${String(t.active)} active, ${String(t.queued)} queued`,n=`explorer: ${t.explorer}, ${String(t.exploring)} exploring`;return`daemon: running (${r}; ${n})`}function Fk(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:e.findings.map(t=>ui(t)),kind:"findings"};case"error":return{detail:cr(e.error),kind:"error"};case"dispatch-failed":return{detail:e.reason,kind:"dispatch-error"}}}async function Bk(){let e=process.cwd(),t=j.child({worker:process.pid}),r=Mk(),n=cf({debugDir:gU.join(e,".ripplo","debug"),headed:!1,writeOtlpPortFile:!1}),i={entry:void 0},o=s=>{n.close().catch(()=>{}).then(()=>{process.exit(s)})};process.on("disconnect",()=>{o(1)}),process.on("unhandledRejection",s=>{t.error({err:s},"worker unhandled rejection")}),process.on("uncaughtException",s=>{t.error({err:s},"worker uncaught exception"),o(1)}),r.onRequest(Ga,async(s,a)=>{let l=Ik.safeParse(s);if(!l.success)return Ya("bad-run-assign");let c=l.data;Jr(e);let u=je(e).match(m=>m,m=>m.kind);if(typeof u=="string")return Ya(`config:${u}`);let d=await yU(c.lockfileFingerprint,i,r);if(d.isErr())return Ya(`lockfile-unavailable:${d.error}`);let p=d.value,h=p.tests.find(m=>de(m.name)===c.workflowSlug);if(h==null)return Ya(`no-test:${c.workflowSlug}`);let f=await Sk({config:u,cwd:e,headed:c.headed,lockfile:p,runId:c.runId,session:n,signal:Ha(a),test:h});return{outcome:Fk(f),serverNotified:!0}}),r.onNotification(Ka,s=>{let a=Pk.safeParse(s);a.success&&n.injectSpan(a.data.runId,a.data.span)}),r.onNotification(Ja,()=>{o(0)}),r.sendNotification(za),await new Promise(()=>{})}function Ya(e){return{outcome:{detail:e,kind:"error"},serverNotified:!1}}async function yU(e,t,r){return t.entry!=null&&t.entry.fingerprint===e?kf(t.entry.lockfile):(await bU(r,e)).andThen(i=>i.unavailable!=null?Za(i.unavailable):i.lockfileJson==null?Za("empty-reply"):wU(i.lockfileJson).map(o=>(t.entry={fingerprint:e,lockfile:o},o)))}async function bU(e,t){try{return kf(await e.sendRequest(qa,{fingerprint:t}))}catch(r){return Za(`transport:${r instanceof Error?r.message:"unknown"}`)}}function wU(e){try{return kf(_l(ht,e))}catch(t){return Za(`worker-decode-failed:${t instanceof Error?t.message.slice(0,200):"unknown"}`)}}async function Vk(){await Bk()}import{createRequire as SU}from"module";import{existsSync as vU}from"fs";import{readFile as Wk,writeFile as xU}from"fs/promises";import{fileURLToPath as kU}from"url";import Cf from"path";import{chromium as CU}from"playwright";import{err as no,ok as RU}from"neverthrow";import{z as $t}from"zod";var EU={height:800,width:1280};async function Hk({cwd:e,moment:t,runId:r}){let n=Cf.join(e,".ripplo","debug",r),i=Cf.join(n,"behavior.jsonl");if(!vU(i))return no({kind:"run-not-found",runId:r});let o=await AU(i),s=o[0],a=o.at(-1);if(s==null||a==null)return no({kind:"no-rrweb-events",runId:r});let l=a.timestamp-s.timestamp,c=t.kind==="offset"?t.offsetMs:t.at-s.timestamp;if(c<0||c>l)return no({durationMs:l,firstTimestamp:s.timestamp,kind:"moment-out-of-range",lastTimestamp:a.timestamp,moment:t});let u=Cf.join(n,`snapshot-${String(Math.round(c))}ms.png`);return(await LU({events:o,offsetMs:c,pngPath:u})).map(()=>({durationMs:l,offsetMs:c,pngPath:u}))}var IU=$t.object({event:$t.looseObject({timestamp:$t.number(),type:$t.number()}),kind:$t.literal("rrweb")});async function AU(e){return(await Wk(e,"utf8")).split(`
|
|
488
|
+
`).filter(r=>r.length>0).map(r=>PU(r)).map(r=>IU.safeParse(r)).flatMap(r=>r.success?[r.data.event]:[])}function PU(e){try{return JSON.parse(e)}catch{return null}}var TU=$t.object({data:$t.looseObject({height:$t.number(),width:$t.number()}),type:$t.literal(4)});function OU(e){let t=e.flatMap(r=>{let n=TU.safeParse(r);return n.success?[n.data]:[]})[0];return t==null?EU:{height:t.data.height,width:t.data.width}}var MU=`<!doctype html><html><head><style>
|
|
457
489
|
html, body { margin: 0; padding: 0; }
|
|
458
490
|
.replayer-wrapper { position: relative; }
|
|
459
491
|
.replayer-mouse, .replayer-mouse-tail { display: none; }
|
|
460
492
|
iframe { border: none; }
|
|
461
|
-
</style></head><body></body></html>`,
|
|
493
|
+
</style></head><body></body></html>`,NU="*, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; }";async function LU({events:e,offsetMs:t,pngPath:r}){let n=await CU.launch({headless:!0}).catch(()=>null);if(n==null)return no({detail:"chromium launch",kind:"browser-failed"});try{let i=await $U({browser:n,events:e,offsetMs:t});return await xU(r,i),RU(void 0)}catch(i){return no({detail:i instanceof Error?i.message:String(i),kind:"browser-failed"})}finally{await n.close()}}async function $U({browser:e,events:t,offsetMs:r}){let n=OU(t),i=await e.newPage({viewport:n});await i.setContent(MU),await i.addScriptTag({content:await jU()}),await i.evaluate(DU({events:t,offsetMs:r})),await i.evaluate(_U());let o=i.locator(".replayer-wrapper iframe").first();return(await o.count()>0?o:i).screenshot({type:"png"})}function DU({events:e,offsetMs:t}){return`(() => {
|
|
462
494
|
const replayer = new globalThis.__RipploReplayer(${JSON.stringify(e)}, {
|
|
463
|
-
insertStyleRules: [${JSON.stringify(
|
|
495
|
+
insertStyleRules: [${JSON.stringify(NU)}],
|
|
464
496
|
mouseTail: false,
|
|
465
497
|
root: document.body,
|
|
466
498
|
showWarning: false,
|
|
467
499
|
});
|
|
468
500
|
replayer.pause(${String(t)});
|
|
469
|
-
})()`}function
|
|
501
|
+
})()`}function _U(){return`(async () => {
|
|
470
502
|
const doc = document.querySelector(".replayer-wrapper iframe")?.contentDocument;
|
|
471
503
|
if (doc?.fonts != null) {
|
|
472
504
|
await doc.fonts.ready;
|
|
473
505
|
}
|
|
474
506
|
await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
|
475
|
-
})()`}var
|
|
476
|
-
`)}function
|
|
477
|
-
`),process.exit(1)),(await
|
|
478
|
-
`)},o=>{process.stderr.write(`${
|
|
479
|
-
`),process.exit(1)})}function
|
|
507
|
+
})()`}var Uk;function jU(){return Uk??=Wk(FU(),"utf8"),Uk}function FU(){let e=SU(import.meta.url);try{return e.resolve("@ripplo/rrweb-bundle/replay")}catch{return kU(new URL("assets/rrweb-replay.js",import.meta.url))}}function zk(e){return[`${_.good("OK")} \u2014 rendered the page at ${String(Math.round(e.offsetMs))}ms into the recording (duration ${String(Math.round(e.durationMs))}ms)`,e.pngPath,"Read the PNG above to see the page state. Layout and text are faithful; URL-referenced images may be blank if the dev server is down."].join(`
|
|
508
|
+
`)}function Gk(e){return`${_.bad("FAIL")} \u2014 ${BU(e)}`}function qk(){return`${_.bad("FAIL")} \u2014 pass exactly one of --at <epoch-ms from behavior.jsonl> or --offset <ms from the start of the recording>.`}function BU(e){switch(e.kind){case"run-not-found":return`no debug artifacts for run ${e.runId} (.ripplo/debug/${e.runId}/behavior.jsonl missing). ${F("debug")}`;case"no-rrweb-events":return`run ${e.runId} has a behavior.jsonl but no rrweb events \u2014 nothing to replay.`;case"moment-out-of-range":return`${e.moment.kind==="offset"?"--offset":"--at"} is outside the recording, which spans ${String(e.firstTimestamp)}\u2013${String(e.lastTimestamp)} (duration ${String(e.durationMs)}ms). Pass --at <epoch-ms from behavior.jsonl> or --offset <0\u2013${String(e.durationMs)}>.`;case"browser-failed":return`replay browser failed (${e.detail}). Is chromium installed? Try \`npx playwright install chromium\`.`}}async function Kk({at:e,offset:t,runId:r}){let n=VU({at:e,offset:t});n==null&&(process.stderr.write(`${qk()}
|
|
509
|
+
`),process.exit(1)),(await Hk({cwd:process.cwd(),moment:n,runId:r})).match(o=>{process.stdout.write(`${zk(o)}
|
|
510
|
+
`)},o=>{process.stderr.write(`${Gk(o)}
|
|
511
|
+
`),process.exit(1)})}function VU({at:e,offset:t}){if(e!=null&&t==null)return{at:e,kind:"absolute"};if(t!=null&&e==null)return{kind:"offset",offsetMs:t}}async function Jk(){let e=mt();try{let r=(await Qi(e.cwd,e)).match(o=>o,o=>{process.stderr.write(`${qe(o)}
|
|
480
512
|
`),process.exit(1)}),n=r.lockfile.tests.length,i=r.lockfile.entities.length;process.stdout.write(`synced ${String(n)} tests, ${String(i)} entities to dev session ${r.devSessionId}
|
|
481
513
|
`)}catch(t){let r=t instanceof Error?t.message:String(t);process.stderr.write(`ripplo sync failed: ${r}
|
|
482
|
-
`),process.stderr.write(`${
|
|
483
|
-
`),process.exit(1)}}import
|
|
514
|
+
`),process.stderr.write(`${F("setup","verify auth + server reachability")}
|
|
515
|
+
`),process.exit(1)}}import SW from"path";import{createClient as vW}from"graphql-sse";import xW,{AbortError as kW}from"p-retry";import{graphql as el}from"gql.tada";import{print as CW}from"graphql";import UU from"fs";import Qk from"net";import{err as eC,ok as WU}from"neverthrow";async function tC({cwd:e,onConnection:t}){Dt(e);let r=Zi(e),n=await Yk({onConnection:t,socketPath:r});return n.isOk()||n.error.kind!=="stale-candidate"?n.map(Zk(r)).mapErr(Xk(r)):await HU(r)?eC({kind:"already-running",socketPath:r}):(rC(r),(await Yk({onConnection:t,socketPath:r})).map(Zk(r)).mapErr(Xk(r)))}function HU(e){return new Promise(t=>{let r=Qk.connect(e);r.once("connect",()=>{r.destroy(),t(!0)}),r.once("error",()=>{t(!1)})})}async function Yk(e){let t=await zU(e);return t.kind==="listening"?WU(t.server):eC(t.error)}function zU({onConnection:e,socketPath:t}){return new Promise(r=>{let n=Qk.createServer(e);n.once("error",i=>{r({error:i.code==="EADDRINUSE"?{kind:"stale-candidate"}:{kind:"listen-failed",message:i.message},kind:"failed"})}),n.listen(t,()=>{r({kind:"listening",server:n})})})}function Zk(e){return t=>({socketPath:e,close:()=>{t.close(),rC(e)}})}function rC(e){UU.rmSync(e,{force:!0})}function Xk(e){return t=>t.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:t.message}}import GU from"fs";import{lockSync as qU}from"proper-lockfile";var KU="explorer.lock",JU=15e3,YU=15e3;function ZU(){return At(KU)}function nC({onChange:e}){let t={release:null,stopped:!1},r=()=>{t.release=null,t.stopped||e(!1)},n=()=>{if(t.stopped||t.release!=null)return;let o=XU(r);o!=null&&(t.release=o,e(!0))};n();let i=setInterval(n,YU);return{holder:()=>t.release!=null,stop:()=>{t.stopped=!0,clearInterval(i),t.release?.(),t.release=null}}}function XU(e){try{Un();let t=ZU(),r=qU(t,{onCompromised:e,realpath:!1,stale:JU});return GU.writeFileSync(t,String(process.pid)),()=>{try{r()}catch{}}}catch{return null}}function QU(e){let{backoffActive:t,explorerHolder:r,headedActive:n,interactiveActive:i,interactiveQueued:o}=e,{explorationActive:s,poolSize:a}=e;if(!r||n||o>0)return{abortCount:s,refillCount:0};if(t)return{abortCount:0,refillCount:0};let l=Math.min(a-1,a-i)-s;return{abortCount:0,refillCount:Math.max(0,l)}}function sC(e){let t={active:new Map,backoffUntil:0,cancelBackoffTimer:null,holder:!1,prevInteractiveActive:e.probe().interactiveActive,stopped:!1};return{explorationActive:()=>t.active.size,explorerHolder:()=>t.holder,notifyQueueChange:()=>{eW(t,e)},setExplorerHolder:r=>{t.holder=r,Xa(t,e)},stop:()=>{t.stopped=!0,t.cancelBackoffTimer?.(),t.cancelBackoffTimer=null,aC(t,t.active.size)}}}function eW(e,t){let r=t.probe();r.interactiveActive<e.prevInteractiveActive&&tW(e,t),e.prevInteractiveActive=r.interactiveActive,Xa(e,t)}function tW(e,t){e.backoffUntil=t.now()+3e4,e.cancelBackoffTimer?.(),e.cancelBackoffTimer=t.setTimer(()=>{e.cancelBackoffTimer=null,Xa(e,t)},3e4)}function Xa(e,t){if(e.stopped)return;let r=t.probe(),n=QU({backoffActive:t.now()<e.backoffUntil,explorationActive:e.active.size,explorerHolder:e.holder&&t.exploreEnabled,headedActive:r.headedActive>0,interactiveActive:r.interactiveActive,interactiveQueued:r.interactiveQueued,poolSize:r.poolSize});aC(e,n.abortCount),lC({count:n.refillCount,params:t,state:e})}function aC(e,t){[...e.active.values()].slice(0,t).forEach(({controller:r})=>{r.abort()})}function lC({count:e,params:t,state:r}){if(e<=0)return;let n=rW(t.sources);n!=null&&(nW({params:t,pulled:n,state:r}),lC({count:e-1,params:t,state:r}))}function rW(e){return e.reduce((t,r)=>{if(t!=null)return t;let n=r.next();return n==null?null:{job:n,source:r}},null)}function nW({params:e,pulled:t,state:r}){let{job:n,source:i}=t,o=new AbortController;r.active.set(n.id,{controller:o,job:n,source:i}),e.execute({job:n,priority:i.priority,signal:o.signal}).then(()=>{oC({job:n,outcome:iC(o.signal,null),params:e,source:i,state:r})}).catch(s=>{oC({job:n,outcome:iC(o.signal,{error:s}),params:e,source:i,state:r})})}function iC(e,t){return e.aborted?{kind:"aborted"}:t==null?{kind:"completed"}:{error:t.error,kind:"error"}}function oC({job:e,outcome:t,params:r,source:n,state:i}){i.active.delete(e.id),n.onResult(e,t),Xa(i,r)}function Rf(e){return{priority:e,next:()=>null,onResult:()=>{}}}function cC(){return{priority:"p3",next:()=>null,onResult:()=>{}}}function uC({explore:e}){let t=sC({exploreEnabled:e,now:Date.now,probe:iW,setTimer:oW,sources:[Rf("p0"),Rf("p1"),cC()],execute:({job:n,priority:i,signal:o})=>Va({headed:!1,workClass:sW(i),task:()=>n.run(o)})});bf(()=>{t.notifyQueueChange()});let r=e?nC({onChange:n=>{t.setExplorerHolder(n)}}):null;return{status:()=>({explorer:aW({explore:e,holder:t.explorerHolder()}),exploring:t.explorationActive()}),stop:()=>{r?.stop(),t.stop(),bf(null)}}}function iW(){let e=Xi();return{headedActive:e.headedActive,interactiveActive:e.active,interactiveQueued:e.queued,poolSize:e.poolSize}}function oW(e,t){let r=setTimeout(e,t);return()=>{clearTimeout(r)}}function sW(e){switch(e){case"p0":return"p0-ui";case"p1":return"p1-cli";case"p2":return"p2-cover";case"p3":return"p3-explore"}}function aW({explore:e,holder:t}){return e?t?"holder":"standby":"off"}async function dC({config:e,cwd:t,headed:r,pool:n,runId:i,signal:o,workClass:s,workflowSlug:a}){let{fingerprint:l,result:c}=await Kn(t);if(c.isErr())return await ro(e,i,`lockfile:${c.error.kind}`),{detail:`lockfile:${c.error.kind}`,kind:"dispatch-error"};if(c.value.tests.find(p=>de(p.name)===a)==null)return await ro(e,i,`no-test:${a}`),{detail:`no-test:${a}`,kind:"dispatch-error"};let d=await Va({headed:r,workClass:s,task:()=>n.execute({headed:r,lockfileFingerprint:l,runId:i,workflowSlug:a},o)});return!d.serverNotified&&d.outcome.kind==="error"&&await ro(e,i,d.outcome.detail),d.outcome}import{fork as lW}from"child_process";import pC from"os";import{CancellationTokenSource as cW,ResponseError as uW}from"vscode-jsonrpc/node";function hC(e,t){return()=>{let r=lW(e,["run-worker"],{cwd:t,stdio:["ignore","inherit","inherit","ipc"]});return{connection:Ok(r),kill:()=>{r.kill("SIGKILL")},onExit:n=>{r.once("exit",n)}}}}function mC(e){let t={closed:!1,lockfileProvider:e.lockfileProvider,nextId:0,size:e.initialSize,spawn:e.spawn,waiters:[],workers:[]};return{close:async()=>{t.closed=!0,await Promise.all([...t.workers].map(r=>Ef(r,t)))},execute:(r,n)=>fW(r,n,t),routeSpan:(r,n)=>{let i=t.workers.find(o=>o.runId===r);i?.worker.connection.sendNotification(Ka,{runId:r,span:n})},setSize:r=>{yW(r,t)}}}var dW=1e4,pW=-32800;async function fW(e,t,r){let n=await hW(r);if(n.runId=e.runId,!n.alive)return fC(n,r),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let i=new cW,o=()=>{i.cancel()};t.aborted&&i.cancel(),t.addEventListener("abort",o,{once:!0});try{let s=await n.worker.connection.sendRequest(Ga,e,i.token),a=Tk.safeParse(s);return a.success?a.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(s){return gW(s,n)}finally{t.removeEventListener("abort",o),i.dispose(),fC(n,r)}}async function hW(e){let t=e.workers.find(r=>r.alive&&r.runId===void 0);if(t!=null)return t.runId="pending",t;if(e.workers.length<e.size){let r=mW(e);return r.runId="pending",await r.ready,r}return new Promise(r=>{e.waiters.push(n=>{n.runId="pending",r(n)})})}function mW(e){let t=e.spawn(),r={resolve:()=>{}},n={alive:!0,id:e.nextId,ready:new Promise(i=>{r.resolve=i,t.connection.onNotification(za,i)}),runId:void 0,worker:t};return e.nextId+=1,t.connection.onRequest(qa,async i=>{let o=Ak.safeParse(i);return o.success?e.lockfileProvider(o.data.fingerprint):{unavailable:"bad-lockfile-request"}}),t.onExit(()=>{n.alive=!1,e.workers=e.workers.filter(i=>i!==n),t.connection.dispose(),r.resolve()}),e.workers.push(n),n}function fC(e,t){if(e.runId=void 0,!e.alive||t.closed)return;if(t.workers.length>t.size){Ef(e,t);return}let r=t.waiters.shift();r?.(e)}async function Ef(e,t){if(t.workers=t.workers.filter(i=>i!==e),!e.alive)return;let r=new Promise(i=>{e.worker.onExit(i)});await e.worker.connection.sendNotification(Ja).catch(()=>{});let n=setTimeout(()=>{e.worker.kill()},dW);await r,clearTimeout(n)}function gW(e,t){return e instanceof uW&&e.code===pW?{outcome:{detail:"aborted",kind:"error"},serverNotified:!1}:t.alive?{outcome:{detail:e instanceof Error?e.message:String(e),kind:"error"},serverNotified:!1}:{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1}}function yW(e,t){t.size=e,e>pC.availableParallelism()&&j.warn({cores:pC.availableParallelism(),size:e},"worker pool size exceeds available cores");let r=t.workers.filter(i=>i.alive&&i.runId===void 0),n=t.workers.length-e;r.slice(0,Math.max(0,n)).forEach(i=>{Ef(i,t)})}import Qa from"fs";import{graphql as gC}from"gql.tada";import{print as yC}from"graphql";var bW=gC(`
|
|
484
516
|
subscription HooksPausedWatch($projectId: String!) {
|
|
485
517
|
hooksPausedRequested(projectId: $projectId) {
|
|
486
518
|
paused
|
|
487
519
|
projectId
|
|
488
520
|
}
|
|
489
521
|
}
|
|
490
|
-
`),
|
|
522
|
+
`),wW=gC(`
|
|
491
523
|
subscription WatchLocalConcurrencyChanged {
|
|
492
524
|
myMaxLocalConcurrentRunsChanged
|
|
493
525
|
}
|
|
494
|
-
`);function
|
|
526
|
+
`);function bC({pool:e,sseClient:t}){return t.subscribe({query:yC(wW)},{complete:()=>{},error:r=>{j.error(r,"localConcurrency subscription error")},next:r=>{let n=r.data?.myMaxLocalConcurrentRunsChanged;n!=null&&(Ua(n),e.setSize(n))}})}function wC({cwd:e,projectId:t,sseClient:r}){return r.subscribe({query:yC(bW),variables:{projectId:t}},{complete:()=>{},error:n=>{j.error(n,"hooksPaused subscription error")},next:n=>{let i=n.data?.hooksPausedRequested?.paused;i!=null&&If({cwd:e,paused:i})}})}function If({cwd:e,paused:t}){let r=Er(e);if(t&&!Qa.existsSync(r)){Qa.writeFileSync(r,"");return}!t&&Qa.existsSync(r)&&Qa.unlinkSync(r)}var RW=6e4,SC=100,EW=15e3,IW=el(`
|
|
495
527
|
subscription RunRequestedWatch($devSessionId: String!) {
|
|
496
528
|
runRequested(devSessionId: $devSessionId) {
|
|
497
529
|
runId
|
|
@@ -499,7 +531,7 @@ iframe { border: none; }
|
|
|
499
531
|
workflowSlug
|
|
500
532
|
}
|
|
501
533
|
}
|
|
502
|
-
`),
|
|
534
|
+
`),AW=el(`
|
|
503
535
|
mutation HeartbeatDevSessionWatch($id: String!) {
|
|
504
536
|
heartbeatDevSession(id: $id) {
|
|
505
537
|
__typename
|
|
@@ -511,14 +543,14 @@ iframe { border: none; }
|
|
|
511
543
|
}
|
|
512
544
|
}
|
|
513
545
|
}
|
|
514
|
-
`),
|
|
546
|
+
`),PW=el(`
|
|
515
547
|
query WatchLocalConcurrency {
|
|
516
548
|
currentUser {
|
|
517
549
|
id
|
|
518
550
|
maxLocalConcurrentRuns
|
|
519
551
|
}
|
|
520
552
|
}
|
|
521
|
-
`),
|
|
553
|
+
`),TW=el(`
|
|
522
554
|
mutation EndDevSessionWatch($projectId: String!, $cwd: String!) {
|
|
523
555
|
endDevSession(projectId: $projectId, cwd: $cwd) {
|
|
524
556
|
__typename
|
|
@@ -530,16 +562,16 @@ iframe { border: none; }
|
|
|
530
562
|
}
|
|
531
563
|
}
|
|
532
564
|
}
|
|
533
|
-
`);async function
|
|
534
|
-
`),process.exit(1));let u=c.value,d=await
|
|
535
|
-
`);let M=async()=>{v(),C(),i.stop(),l.close(),w.stop(),S(),y(),await m.close(),await g.stop().catch(()=>{}),await Promise.race([
|
|
536
|
-
`),Jr(t);let
|
|
537
|
-
`),process.exit(1)),t}}function
|
|
538
|
-
`),process.exit(1)}function
|
|
539
|
-
`),r(),process.exit(1)})}function
|
|
540
|
-
`),process.exit(1)})}function
|
|
541
|
-
`),process.exit(1)),
|
|
542
|
-
`)}import{graphql as
|
|
565
|
+
`);async function vC({explore:e}){VW();let t=jW(process.cwd()),r=t.cwd,n=LW(r),i=uC({explore:e}),o={handler:()=>{}},s=DW(),a=hk({config:t,cwd:r,explorationStatus:i.status,ready:s.promise,onShutdownRequest:()=>{o.handler()}}),l=await _W({cwd:r,ipc:a,releasePid:n}),c=await we(r);c.isErr()&&(process.stderr.write(`ripplo: ${Oe(c.error)}
|
|
566
|
+
`),process.exit(1));let u=c.value,d=await xC(()=>Ir({config:t,cwd:r,lockfile:u}),{config:t,label:"initial sync"}),p=await WW(t);If({cwd:r,paused:d.hooksPaused});let h=Wa(r);h!=null&&j.info("watching branch %s in %s",h,r);let f=vW({headers:{Authorization:`Bearer ${t.token}`},retryAttempts:1/0,url:`${t.ripploServerUrl}/graphql`}),m=mC({initialSize:p,spawn:hC(HW(),r),lockfileProvider:async E=>{let x=await Kn(r);return x.result.isErr()?{unavailable:`daemon-load-failed:${x.result.error.kind}`}:x.fingerprint!==E?{unavailable:"fingerprint-mismatch"}:{lockfileJson:Bt(ht,x.result.value)}}}),g=await pi({localDir:SW.join(r,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:E=>{let x=E.attributes["ripplo.run"];x!=null&&m.routeSpan(x,E)}}),w=NW({claim:a.claim,config:t,cwd:r,initialId:d.devSessionId,pool:m,sseClient:f}),S=wC({cwd:r,projectId:t.projectId,sseClient:f}),y=bC({pool:m,sseClient:f}),v=MW({config:t,session:w}),C=BW();s.resolve(),process.stdout.write(`${$k(d.devSessionId)}
|
|
567
|
+
`);let M=async()=>{v(),C(),i.stop(),l.close(),w.stop(),S(),y(),await m.close(),await g.stop().catch(()=>{}),await Promise.race([D({config:t,document:TW,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>{}),new Promise(E=>setTimeout(E,3e3))]),n()},R=()=>{M().finally(()=>process.exit(0))};o.handler=R,process.on("SIGINT",R),process.on("SIGTERM",R),process.on("SIGHUP",R),process.on("SIGBREAK",R),await new Promise(()=>{})}function OW({claim:e,cwd:t,devSessionId:r,onSubscriptionDead:n,pool:i,sseClient:o}){let s=new Set;return o.subscribe({query:CW(IW),variables:{devSessionId:r}},{complete:()=>{},error:a=>{j.warn("runRequested SSE failed: %s; re-registering session",a instanceof Error?a.message:String(a)),n()},next:a=>{let l=a.data?.runRequested;if(l==null)return;if(s.has(l.runId)){j.warn({runId:l.runId,workflowSlug:l.workflowSlug},"duplicate runRequested event; skipping dispatch");return}s.add(l.runId),process.stdout.write(`ripplo: run ${l.workflowSlug}
|
|
568
|
+
`),Jr(t);let c=je(t).match(d=>d,d=>{j.error({failure:d,runId:l.runId},"failed to load env for run dispatch; skipping")});if(c==null){s.delete(l.runId);return}let u=e(l.workflowSlug);u?.started(l.runId),dC({config:c,cwd:t,headed:u?.headed??!1,pool:i,runId:l.runId,signal:u==null?new AbortController().signal:Ha(u.token),workClass:u==null?"p0-ui":"p1-cli",workflowSlug:l.workflowSlug}).then(d=>{u?.finished(l.runId,d)}).catch(d=>{j.error({err:d,runId:l.runId,workflowSlug:l.workflowSlug},"run execution failed; daemon continuing"),u?.finished(l.runId,{detail:d instanceof Error?d.message:String(d),kind:"error"})}).finally(()=>{s.delete(l.runId)})}},{connecting:a=>{a&&j.warn("runRequested SSE reconnecting")}})}function MW({config:e,session:t}){let r=async()=>{try{let i=await D({config:e,document:AW,variables:{id:t.getId()}});i.heartbeatDevSession?.__typename==="DevSessionEndedError"&&(j.warn("dev session ended server-side (%s); re-registering",i.heartbeatDevSession.message),await t.reregister())}catch(i){j.warn("heartbeat failed: %s",i instanceof Error?i.message:String(i))}},n=setInterval(()=>{r()},EW);return()=>{clearInterval(n)}}function NW({claim:e,config:t,cwd:r,initialId:n,pool:i,sseClient:o}){let s=n,a=null,l=()=>{p()},c=()=>OW({claim:e,cwd:r,devSessionId:s,onSubscriptionDead:l,pool:i,sseClient:o}),u=c(),d=async()=>{let h=await we(r);if(h.isErr()){j.error("re-register: compile failed: %s",Oe(h.error));return}let f=await xC(()=>Ir({config:t,cwd:r,lockfile:h.value}),{config:t,label:"re-register sync"});u(),s=f.devSessionId,u=c(),j.info("re-registered dev session as %s",s)},p=()=>(a!=null||(a=d().finally(()=>{a=null})),a);return{reregister:p,getId:()=>s,stop:()=>{u()}}}function LW(e){try{return Jh({cwd:e,onCompromised:$W})}catch(t){throw t instanceof Yn&&(process.stderr.write(`${Dk({cwd:t.cwd,pid:t.pid})}
|
|
569
|
+
`),process.exit(1)),t}}function $W(){j.error("daemon lock compromised; shutting down"),process.stderr.write(`${_k()}
|
|
570
|
+
`),process.exit(1)}function DW(){let e={handler:()=>{}};return{promise:new Promise(r=>{e.handler=r}),resolve:()=>{e.handler()}}}async function _W({cwd:e,ipc:t,releasePid:r}){return(await tC({cwd:e,onConnection:t.handleConnection})).match(i=>i,i=>{process.stderr.write(`${Nk(i)}
|
|
571
|
+
`),r(),process.exit(1)})}function jW(e){return je(e).match(t=>t,t=>{process.stderr.write(`${qe(t)}
|
|
572
|
+
`),process.exit(1)})}function xC(e,{config:t,label:r}){let n=t.ripploServerUrl.includes("localhost")||t.ripploServerUrl.includes("127.0.0.1");return xW(async()=>{try{return await e()}catch(i){let o=i instanceof Error?i.message:String(i);throw Bn(i)==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${Lk({projectId:t.projectId,serverUrl:t.ripploServerUrl})}
|
|
573
|
+
`),process.exit(1)),FW(o)?i:(j.error("%s failed: %s",r,o),new kW(o))}},{factor:2,maxTimeout:n?2e3:1e4,minTimeout:n?100:1e3,retries:1/0,onFailedAttempt:({attemptNumber:i,error:o})=>{j.warn("%s attempt %d failed; retrying: %s",r,i,o.message)}})}function FW(e){return e.includes("status 502")||e.includes("ECONNREFUSED")||e.includes("Failed to connect")||e.includes("fetch failed")}function BW(){lo({maxRuns:SC});let e=setInterval(()=>{lo({maxRuns:SC})},RW);return()=>{clearInterval(e)}}function VW(){process.on("unhandledRejection",e=>{j.error({err:e},"unhandledRejection in watch; continuing")}),process.on("uncaughtException",e=>{j.error({err:e},"uncaughtException in watch; continuing")})}var UW=4;async function WW(e){try{let r=(await D({config:e,document:PW,variables:void 0})).currentUser?.maxLocalConcurrentRuns;if(r!=null)return Ua(r),r}catch(t){j.warn({err:t},"failed to fetch local concurrency setting; using default")}return UW}function HW(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}async function kC({explore:e}){await vC({explore:e})}import{graphql as tl}from"gql.tada";function CC(){return"No scope items added \u2014 the matched tests are already in scope (check `ripplo scope status`)."}function RC(e){return[`No test found for: ${e.join(", ")}`,"Pass a test id (kebab-case slug of the test name) or the exact intent string.","List known tests with `ripplo status`; stub a new one first via the testing DSL.",F("create")].join(`
|
|
574
|
+
`)}import{graphql as zW}from"gql.tada";var EC=zW(`
|
|
543
575
|
query ScopeStatus($projectId: String!, $cwd: String!) {
|
|
544
576
|
project(id: $projectId) {
|
|
545
577
|
id
|
|
@@ -559,7 +591,7 @@ iframe { border: none; }
|
|
|
559
591
|
}
|
|
560
592
|
}
|
|
561
593
|
}
|
|
562
|
-
`);var
|
|
594
|
+
`);var GW=tl(`
|
|
563
595
|
query ScopeWorkflowBySlug($projectId: String!, $cwd: String!, $slug: String!) {
|
|
564
596
|
project(id: $projectId) {
|
|
565
597
|
id
|
|
@@ -572,7 +604,7 @@ iframe { border: none; }
|
|
|
572
604
|
}
|
|
573
605
|
}
|
|
574
606
|
}
|
|
575
|
-
`),
|
|
607
|
+
`),qW=tl(`
|
|
576
608
|
mutation ScopeAddDirtyTests($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
577
609
|
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
578
610
|
__typename
|
|
@@ -594,38 +626,38 @@ iframe { border: none; }
|
|
|
594
626
|
}
|
|
595
627
|
}
|
|
596
628
|
}
|
|
597
|
-
`),
|
|
629
|
+
`),KW=tl(`
|
|
598
630
|
mutation ScopeLink($id: ID!, $workflowId: String!) {
|
|
599
631
|
linkScopeItem(id: $id, workflowId: $workflowId) {
|
|
600
632
|
id
|
|
601
633
|
}
|
|
602
634
|
}
|
|
603
|
-
`),
|
|
635
|
+
`),JW=tl(`
|
|
604
636
|
mutation ScopeRemoveMany($ids: [ID!]!) {
|
|
605
637
|
removeScopeItems(ids: $ids)
|
|
606
638
|
}
|
|
607
|
-
`);async function
|
|
639
|
+
`);async function IC(e){let t=mt();await Jn(t);let n=(await D({config:t,document:EC,variables:{cwd:t.cwd,projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(n,null,2)}
|
|
608
640
|
`);return}if(n.length===0){process.stdout.write("No scope items. Add via `ripplo scope add <test-ids..>` (variadic) or from the dashboard.\n");return}n.forEach(i=>{let o=i.workflow;if(o==null){process.stdout.write(` [intent] (${i.id}) ${i.label??""}
|
|
609
641
|
`);return}let s=o.spec==null?"stub":"implemented";process.stdout.write(` [${s}] (${i.id}) ${o.slug} \u2014 ${o.name}
|
|
610
|
-
`)})}async function
|
|
611
|
-
`),process.exit(1)});let i=(await
|
|
612
|
-
`),process.exit(1)),i?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${
|
|
613
|
-
`),process.exit(1));let o=i?.__typename==="MutationAddDirtyTestsToScopeSuccess"?i.data:[];if(o.length===0){process.stdout.write(`${
|
|
642
|
+
`)})}async function AC({testIds:e}){let t=mt();await Jn(t),(await Qi(t.cwd,t)).match(()=>{},a=>{process.stderr.write(`${qe(a)}
|
|
643
|
+
`),process.exit(1)});let i=(await D({config:t,document:qW,variables:{cwd:t.cwd,projectId:t.projectId,workflowSlugs:e.map(a=>de(a))}})).addDirtyTestsToScope;i?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${i.message}
|
|
644
|
+
`),process.exit(1)),i?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${RC(i.slugs)}
|
|
645
|
+
`),process.exit(1));let o=i?.__typename==="MutationAddDirtyTestsToScopeSuccess"?i.data:[];if(o.length===0){process.stdout.write(`${CC()}
|
|
614
646
|
`);return}let s=o.map(a=>a.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${String(o.length)} scope item(s): ${s}
|
|
615
|
-
`)}async function
|
|
616
|
-
`),process.exit(1)});let i=await
|
|
617
|
-
`)}async function
|
|
618
|
-
`)}async function
|
|
619
|
-
`),process.stderr.write(`${
|
|
620
|
-
`),process.exit(1)),n.id}async function
|
|
621
|
-
`),process.exit(1));let n=tr(r.value),i=await
|
|
622
|
-
`),process.stdout.write(`${
|
|
647
|
+
`)}async function PC({id:e,testId:t}){let r=mt();await Jn(r),(await Qi(r.cwd,r)).match(()=>{},o=>{process.stderr.write(`${qe(o)}
|
|
648
|
+
`),process.exit(1)});let i=await YW({cfg:r,slug:t});await D({config:r,document:KW,variables:{id:e,workflowId:i}}),process.stdout.write(`Linked scope item ${e} to ${t}
|
|
649
|
+
`)}async function TC({ids:e}){let t=mt();await Jn(t);let n=(await D({config:t,document:JW,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${String(n)} scope item(s)
|
|
650
|
+
`)}async function YW({cfg:e,slug:t}){let n=(await D({config:e,document:GW,variables:{cwd:e.cwd,projectId:e.projectId,slug:t}})).project?.devSession?.workflows?.[0];return n==null&&(process.stderr.write(`No workflow found with id "${t}". Create a stub first via the testing DSL.
|
|
651
|
+
`),process.stderr.write(`${F("create")}
|
|
652
|
+
`),process.exit(1)),n.id}async function OC(e){let t=process.cwd(),r=await we(t);r.isErr()&&(process.stderr.write(`${Oe(r.error)}
|
|
653
|
+
`),process.exit(1));let n=tr(r.value),i=await Xx(t);if(e.format==="summary"){n.length>0&&process.stdout.write(`stub tests: ${n.join(", ")}
|
|
654
|
+
`),process.stdout.write(`${jk(i)}
|
|
623
655
|
`);return}let o={daemon:i.kind==="running"?{active:i.status.active,explorer:i.status.explorer,exploring:i.status.exploring,queued:i.status.queued,running:!0}:{running:i.kind==="unresponsive",state:i.kind},tests:n.map(s=>({id:s,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
|
|
624
|
-
`)}import rl from"fs";import
|
|
625
|
-
`),hookEventName:"UserPromptSubmit"}}});import
|
|
626
|
-
`).filter(t=>t.length>0)}function
|
|
627
|
-
`).filter(t=>t.length>0)}function
|
|
628
|
-
`).filter(n=>n.length>0).filter(n=>
|
|
656
|
+
`)}import rl from"fs";import XW from"os";import MC from"path";import{z as ZW}from"zod";function ue(e,t){let r=ZW.custom(n=>typeof n=="object"&&n!==null&&"hook_event_name"in n&&n.hook_event_name===e);return{event:e,run:async n=>await t(r.parse(n))??void 0}}var NC=ue("PreToolUse",e=>{if(e.tool_name!=="ExitPlanMode"||!De(e.cwd))return;let t=QW();if(t==null)return{hookSpecificOutput:{additionalContext:`Ripplo plan gate: no plan file found \u2014 the "Tests to implement" requirement was not checked. Before implementing, stub a .ripplo/tests/ test per affected flow. ${F("explore")}`,hookEventName:"PreToolUse"}};let r=rl.readFileSync(t,"utf8");if(!/\.ripplo\/tests|Tests to implement|No e2e coverage needed/.test(r))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Plan must cite ripplo test stubs. Add a "Tests to implement" section listing .ripplo/tests/<id>.ts per affected flow, OR add "No e2e coverage needed: <reason>" if this plan touches no user-facing behavior. ${F("explore")}`}}});function QW(){let e=MC.join(XW.homedir(),".claude","plans");return rl.existsSync(e)?rl.readdirSync(e).filter(r=>r.endsWith(".md")).map(r=>MC.join(e,r)).map(r=>({full:r,mtime:rl.statSync(r).mtimeMs})).sort((r,n)=>n.mtime-r.mtime)[0]?.full??null:null}var LC=ue("UserPromptSubmit",async e=>{if(e.permission_mode!=="plan"||!ae(e.cwd)||!De(e.cwd))return;let t=await we(e.cwd);if(t.isErr())return;let r=tr(t.value),n=['Plan must include "Tests to implement" with a .ripplo/tests/ file per affected flow (ExitPlanMode blocks otherwise). Stub each with `test("Intent")` (no body).'];return r.length>0&&n.push(`Existing stubs: ${r.join(", ")}`),{hookSpecificOutput:{additionalContext:n.join(`
|
|
657
|
+
`),hookEventName:"UserPromptSubmit"}}});import pH from"path";import WC from"picomatch";import{z as HC}from"zod";import{mkdirSync as iH,readFileSync as oH,writeFileSync as sH}from"fs";import aH from"path";import{z as We}from"zod";import{createHash as Ose}from"crypto";import nl from"picomatch";function eH(e){return ot(["diff","--name-only","HEAD"],e).split(`
|
|
658
|
+
`).filter(t=>t.length>0)}function $C({cwd:e,ignoreGlobs:t,watchGlobs:r}){let n=nl([...r]),i=nl([...t]);return eH(e).filter(o=>n(o)&&!i(o))}function tH(e){return ot(["ls-files","--others","--exclude-standard"],e).split(`
|
|
659
|
+
`).filter(t=>t.length>0)}function DC({cwd:e,ignoreGlobs:t,watchGlobs:r}){let n=nl([...r]),i=nl([...t]);return tH(e).filter(o=>n(o)&&!i(o))}var rH=["**/src/**","**/app/**","**/apps/**","**/pages/**","**/routes/**","**/components/**","**/server/**","**/api/**","**/backend/**","**/features/**","**/modules/**","**/views/**","**/ui/**","**/hooks/**","**/contexts/**","**/providers/**","**/controllers/**","**/handlers/**","**/resolvers/**","**/services/**","**/middleware/**","**/lib/**"],nH=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md","**/.next/**","**/.turbo/**","**/.vercel/**","**/.svelte-kit/**","**/.nuxt/**","**/.astro/**","**/coverage/**","**/storybook-static/**","**/*.stories.*","**/*.story.*","**/cli/**","**/scripts/**","**/tools/**","**/__tests__/**","**/__mocks__/**","**/__fixtures__/**","**/*.config.*","**/*.setup.*","**/public/**","**/static/**","**/assets/**","**/migrations/**","**/prisma/migrations/**"];function Dn(){return{ignorePaths:nH,watchPaths:rH}}var lH=We.object({label:We.string().nullable(),slug:We.string().nullable(),status:We.enum(["intent","stub","implemented"])}),cH=We.object({intent:We.string(),name:We.string(),sourcePath:We.string().nullable(),stub:We.boolean()}),uH=We.object({changedAppFiles:We.array(We.string()).readonly(),scope:We.object({available:We.boolean(),items:We.array(lH).readonly()}),tests:We.array(cH).readonly().default([]),untrackedAppFiles:We.array(We.string()).readonly()});function _C({cwd:e,scope:t}){let r=FC(e);VC(e,{...UC(e),scope:t,tests:r?.tests??[]})}function jC({cwd:e,tests:t}){let r=FC(e);VC(e,{...UC(e),scope:r?.scope??{available:!1,items:[]},tests:t??r?.tests??[]})}function FC(e){let t=uH.safeParse(dH(BC(e)));return t.success?t.data:null}function dH(e){try{return JSON.parse(oH(e,"utf8"))}catch{return null}}function BC(e){return It(e,"coverage-context.json")}function VC(e,t){let r=BC(e);iH(aH.dirname(r),{recursive:!0}),sH(r,JSON.stringify(t,null,2))}function UC(e){let{ignorePaths:t,watchPaths:r}=Dn(),n={cwd:e,ignoreGlobs:t,watchGlobs:r};return{changedAppFiles:$C(n),untrackedAppFiles:DC(n)}}var fH=HC.looseObject({file_path:HC.string()}),zC=ue("PostToolUse",async e=>{let t=fH.safeParse(e.tool_input);if(!t.success)return;let r=t.data.file_path,{cwd:n}=e;if(!ae(n)||!De(n))return;let i=pH.relative(n,r);if(i.startsWith(".."))return;let{ignorePaths:o,watchPaths:s}=Dn(),a=WC([...s]),l=WC([...o]);if(!a(i)||l(i))return;let c=await we(n);if(jC({cwd:n,tests:c.isOk()?c.value.tests.map(d=>({intent:d.intent,name:d.name,sourcePath:d.sourcePath??null,stub:d.stub})):void 0}),c.isErr())return;let u=tr(c.value);if(u.length!==0)return{hookSpecificOutput:{additionalContext:`Reminder: stub tests still unimplemented \u2014 ${u.join(", ")}. Implement with \`test("Intent", () => ({ given, steps }))\`.`,hookEventName:"PostToolUse"}}});import{createHash as kH}from"crypto";import{z as YC}from"zod";import{createHash as hH}from"crypto";import{mkdirSync as mH,readFileSync as GC,writeFileSync as gH}from"fs";import Af from"path";var yH=[".ts",".tsx",".js",".jsx"];function il(e){let t=hH("sha256");return t.update(ot(["rev-parse","HEAD"],e)),t.update("\0"),t.update(ot(["diff","HEAD"],e)),t.update("\0"),ot(["ls-files","--others","--exclude-standard"],e).split(`
|
|
660
|
+
`).filter(n=>n.length>0).filter(n=>yH.some(i=>n.endsWith(i))).toSorted((n,i)=>n.localeCompare(i)).forEach(n=>{t.update(n),t.update("\0"),t.update(bH(Af.join(e,n))),t.update("\0")}),t.digest("hex")}function _n(e,t){try{return GC(qC(e,t),"utf8").trim()}catch{return null}}function jn(e,t,r){let n=qC(e,t);mH(Af.dirname(n),{recursive:!0}),gH(n,r)}function bH(e){try{return GC(e)}catch{return Buffer.alloc(0)}}function qC(e,t){return Af.join(e,".ripplo",".local",`${t}.hash`)}import{graphql as wH}from"gql.tada";var SH=wH(`
|
|
629
661
|
mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
|
|
630
662
|
addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
|
|
631
663
|
__typename
|
|
@@ -636,11 +668,11 @@ iframe { border: none; }
|
|
|
636
668
|
}
|
|
637
669
|
}
|
|
638
670
|
}
|
|
639
|
-
`);async function
|
|
640
|
-
`).map(r=>r.slice(3).trim()).filter(r=>r.startsWith(
|
|
641
|
-
${
|
|
642
|
-
${
|
|
643
|
-
`),hookEventName:"PostToolUse"}}}function
|
|
671
|
+
`);async function JC({cwd:e,lockfile:t}){if(!De(e))return{addedSlugs:[]};let r=xH(e);if(r.length===0)return{addedSlugs:[]};let n=new Set(r),i=t.tests.filter(l=>l.sourcePath!=null&&n.has(l.sourcePath)).map(l=>de(l.name));if(i.length===0)return{addedSlugs:[]};let o=je(e).unwrapOr(void 0);return o==null?{addedSlugs:[]}:await Ir({config:o,cwd:e,lockfile:t}).catch(l=>(j.warn("auto-sync failed: %s",l instanceof Error?l.message:String(l)),null))==null?{addedSlugs:[]}:{addedSlugs:await vH({cfg:o,slugs:i})?i:[]}}async function vH({cfg:e,slugs:t}){let n=(await D({config:e,document:SH,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...t]}}).catch(i=>(j.warn("auto-scope failed: %s",i instanceof Error?i.message:String(i)),null)))?.addDirtyTestsToScope;return n?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:n.data.length>0}var KC=".ripplo/tests/";function xH(e){let t;try{t=ot(["status","--porcelain","--",".ripplo/tests"],e)}catch{return[]}return t.split(`
|
|
672
|
+
`).map(r=>r.slice(3).trim()).filter(r=>r.startsWith(KC)&&r.endsWith(".ts")).map(r=>r.slice(KC.length)).filter(r=>r!=="index.ts"&&!r.endsWith("/index.ts"))}var CH=YC.looseObject({file_path:YC.string()}),ZC=ue("PostToolUse",async e=>{let t=CH.safeParse(e.tool_input);if(!t.success||!/\/\.ripplo\/.*\.ts$/.test(t.data.file_path))return;let{cwd:r}=e;if(!ae(r))return;if(!De(r))return{hookSpecificOutput:{additionalContext:"Ripplo hooks are paused \u2014 DSL lint and lockfile sync did not run for this edit. Resume with `npx ripplo hooks resume` when ready.",hookEventName:"PostToolUse"}};let n=await Mn(r);if(n.isErr())return{decision:"block",reason:`${Oe(n.error)}
|
|
673
|
+
${F("create","DSL authoring + lint rules")}`};let i=Cr(n.value);if(i.length>0)return{decision:"block",reason:`${Rr(i)}
|
|
674
|
+
${F("create")}`};let{addedSlugs:o}=await JC({cwd:r,lockfile:n.value});return RH([...o.length>0?[`Auto-scoped ${o.join(", ")} (dirty tests).`]:[],...EH(r,n.value)])});function RH(e){if(e.length!==0)return{hookSpecificOutput:{additionalContext:e.join(`
|
|
675
|
+
`),hookEventName:"PostToolUse"}}}function EH(e,t){let r=Ta(t),n=kH("sha256").update(JSON.stringify(r)).digest("hex");return _n(e,"coverage-warn")===n?[]:(jn(e,"coverage-warn",n),r.length===0?[]:[Ia(r)])}import{z as XC}from"zod";var IH=XC.looseObject({command:XC.string()}),AH=/\bripplo\s+hooks\s+pause\b/,QC=ue("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=IH.safeParse(e.tool_input);if(!t.success||!AH.test(t.data.command))return;let{cwd:r}=e;if(ae(r))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"`ripplo hooks pause` is a human-only escape hatch \u2014 agents can't bypass Ripplo guardrails on their own. If the daemon genuinely can't start (auth, server down, intentional offline work), surface the blocker to the user and ask them to run `npx ripplo hooks pause` themselves from their terminal."}}});import{parse as NH}from"shell-quote";import{z as tR}from"zod";import{existsSync as PH,mkdirSync as TH,rmSync as Mae,writeFileSync as OH}from"fs";import Pf from"path";function ol(e,t,r){let n=eR(e,t,r);TH(Pf.dirname(n),{recursive:!0}),OH(n,"")}function sl(e,t,r){return PH(eR(e,t,r))}function eR(e,t,r){return Pf.join(MH(e,t),r)}function MH(e,t){return Pf.join(e,".ripplo",".local","skills-loaded",t)}var LH=tR.looseObject({command:tR.string()}),$H="debug",DH=new Set(["tail","head","less","more","wc","sort","uniq","awk","sed","grep"]),nR=ue("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=LH.safeParse(e.tool_input);if(!t.success)return;let r=_H(t.data.command);if(!jH(r))return;let{cwd:n}=e;if(!ae(n)||!De(n))return;if(!sl(n,e.session_id,$H))return rR("Running `ripplo run` requires the `/ripplo:debug` skill loaded first. Load `/ripplo:debug` then retry \u2014 it carries the artifact-read order and the no-grep-piping guidance for run failures.");let o=BH(r);if(o!=null)return rR(`Don't pipe \`ripplo run\` through \`${o}\` \u2014 buffering filters hold all stdout until EOF, hiding live progress; if you kill the pipeline mid-run the run is orphaned on the server. Redirect to a file instead: \`ripplo run <id> > /tmp/run.log 2>&1\` and Read the file, or use \`run_in_background: true\`.`)});function _H(e){try{return NH(e)}catch{return[]}}function jH(e){return e.some((t,r)=>t==="ripplo"&&e[r+1]==="run")}function FH(e){return typeof e=="object"&&"op"in e&&e.op==="|"}function BH(e){let t=e.find((r,n)=>{let i=e[n-1];return i!=null&&FH(i)&&typeof r=="string"&&DH.has(r)});return typeof t=="string"?t:null}function rR(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}import VH from"path";import{z as iR}from"zod";var UH=new Set(["Edit","Write","NotebookEdit"]),WH=iR.looseObject({file_path:iR.string()}),HH="create",oR=ue("PreToolUse",e=>{if(!UH.has(e.tool_name))return;let t=WH.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!ae(r)||!De(r))return;let n=VH.relative(r,t.data.file_path);if(!(n.startsWith("..")||n!==".ripplo"&&!n.startsWith(".ripplo/"))&&!sl(r,e.session_id,HH))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Editing \`.ripplo/\` files (${n}) requires the \`/ripplo:create\` skill loaded first. Load \`/ripplo:create\` then retry \u2014 it carries the DSL builder shape, lint rules, and the parallelization guidance you'll need.`}}});import zH from"path";import sR from"picomatch";import{graphql as GH}from"gql.tada";import{z as aR}from"zod";var qH=new Set(["Edit","Write","NotebookEdit"]),KH=aR.looseObject({file_path:aR.string()}),JH=GH(`
|
|
644
676
|
query PreEditScopeGate($projectId: String!, $cwd: String!) {
|
|
645
677
|
project(id: $projectId) {
|
|
646
678
|
id
|
|
@@ -652,9 +684,9 @@ ${j("create")}`};let{addedSlugs:o}=await GC({cwd:r,lockfile:n.value});return mH(
|
|
|
652
684
|
}
|
|
653
685
|
}
|
|
654
686
|
}
|
|
655
|
-
`),
|
|
687
|
+
`),lR=ue("PreToolUse",async e=>{if(!qH.has(e.tool_name))return;let t=KH.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!ae(r)||!De(r))return;let n=zH.relative(r,t.data.file_path);if(n.startsWith("..")||n===".ripplo"||n.startsWith(".ripplo/")||!YH(n))return;let i=await ZH(r);return i.populated?i.degradedReason!=null?{hookSpecificOutput:{additionalContext:`Scope check skipped (${i.degradedReason}) \u2014 edit allowed through, but the scope guardrail isn't enforcing on this edit.`,hookEventName:"PreToolUse"}}:void 0:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Scope empty; edit touches app code (${n}). Stub a test or \`scope add\` an existing one before proceeding \u2014 or acknowledge "no user-facing behavior" if pure refactor. Hook re-fires until scope is populated (or hooks paused via the web UI). ${Eh(["scope","create"])}`}}});function YH(e){let{ignorePaths:t,watchPaths:r}=Dn(),n=sR([...r]),i=sR([...t]);return n(e)&&!i(e)}async function ZH(e){let t=je(e).unwrapOr(void 0);if(t==null)return{degradedReason:"no project config \u2014 `ripplo init` not run here",populated:!0};let r=await D({config:t,document:JH,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>null);return r==null?{degradedReason:"server unreachable",populated:!0}:{degradedReason:null,populated:(r.project?.devSession?.scopeItems??[]).length>0}}import XH from"fs";import QH from"path";import{z as cR}from"zod";var ez=new Set(["Edit","Write","NotebookEdit"]),tz=cR.looseObject({file_path:cR.string()}),uR=ue("PreToolUse",async e=>{if(!ez.has(e.tool_name))return;let t=rz(e);if(t==null)return;let{cwd:r}=e;if(XH.existsSync(Er(r))||Qr(r))return;let n=await we(r);return n.isErr()?{hookSpecificOutput:{additionalContext:`\`ripplo daemon\` isn't running and the DSL is currently failing to compile, so the daemon gate is letting this edit through \u2014 fix the compile error before relying on dev-mode guardrails. Compile error:
|
|
656
688
|
${Oe(n.error)}
|
|
657
|
-
${
|
|
689
|
+
${F("create","DSL authoring + lint rules")}`,hookEventName:"PreToolUse"}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`\`ripplo daemon\` is not running, so this edit to \`${t}\` won't sync to the server and dev-mode guardrails won't fire. Run \`/ripplo:start\` (or spawn \`npx ripplo daemon\` directly via Bash with run_in_background), then retry. The app's dev server also needs to be running \u2014 \`npx ripplo doctor\` reports both. If the daemon can't start (auth, server down, intentional offline work), the user can run \`npx ripplo hooks pause\` to bypass this gate; \`npx ripplo hooks resume\` re-enables it. ${F("start")}`}}});function rz(e){let t=tz.safeParse(e.tool_input);if(!t.success||!ae(e.cwd))return null;let r=QH.relative(e.cwd,t.data.file_path);return r.startsWith("..")||r!==".ripplo"&&!r.startsWith(".ripplo/")?null:r}import{graphql as nz}from"gql.tada";var iz=nz(`
|
|
658
690
|
query ScopeReminder($projectId: String!, $cwd: String!) {
|
|
659
691
|
project(id: $projectId) {
|
|
660
692
|
id
|
|
@@ -671,9 +703,9 @@ ${j("create","DSL authoring + lint rules")}`,hookEventName:"PreToolUse"}}:{hookS
|
|
|
671
703
|
}
|
|
672
704
|
}
|
|
673
705
|
}
|
|
674
|
-
`),
|
|
706
|
+
`),dR=ue("UserPromptSubmit",async e=>{let{cwd:t}=e;if(!ae(t)||!De(t))return;let r=il(t);if(_n(t,"scope-reminder")===r)return;let n=je(t).unwrapOr(void 0);if(n==null)return;let i=await D({config:n,document:iz,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null);jn(t,"scope-reminder",r);let o=i?.project?.devSession?.scopeItems??[];return _C({cwd:t,scope:{available:i!=null,items:o.map(a=>oz(a))}}),i==null?{hookSpecificOutput:{additionalContext:`RIPPLO SCOPE: unknown \u2014 server unreachable, scope guardrails are not enforcing. Check the dev session (\`npx ripplo doctor\`). ${F("start")}`,hookEventName:"UserPromptSubmit"}}:{hookSpecificOutput:{additionalContext:o.length===0?`RIPPLO SCOPE: empty. ${F("scope")}`:`RIPPLO SCOPE (${String(o.length)}):
|
|
675
707
|
${o.map(a=>{let l=a.workflow;return l==null?` [intent] (${a.id}) ${a.label??""}`:` [${l.spec==null?"stub":"implemented"}] (${a.id}) ${l.slug}`}).join(`
|
|
676
|
-
`)}`,hookEventName:"UserPromptSubmit"}}});function
|
|
708
|
+
`)}`,hookEventName:"UserPromptSubmit"}}});function oz(e){let t=e.workflow;return t==null?{label:e.label,slug:null,status:"intent"}:{label:e.label,slug:t.slug,status:t.spec==null?"stub":"implemented"}}var sz="# Ripplo \u2014 always-on session context\n\nEvery user-facing change in this repo ships with a deterministic, backend-aware test that proves it works end-to-end.\n\n## Load the right skill before acting \u2014 this is critical\n\nThe skills below carry the procedural detail you need to do Ripplo work correctly: entity/world modeling, parallel-isolation in engine impls, oracle-based backend assertions, scope discipline, artifact-read order on failures, parallelization patterns. **None of that is reproduced in this preamble** \u2014 only the always-on guardrails are. If you act on a Ripplo task without loading the matching skill, you will skip rules that exist to prevent specific past failure modes (cross-run data leakage, \"passing\" tests that never asserted backend state, etc.).\n\nMatch the task to a skill from the triage table; if unsure between two, load both. If completely unsure, load `/ripplo:explore` or `/ripplo:create`. Loading is cheap; acting under-informed is not.\n\n## Skill triage\n\n- Load `/ripplo:setup` skill for instructions on initializing Ripplo in a project; `ripplo doctor` reports the engine endpoint missing.\n- Load `/ripplo:explore` skill for instructions on planning/stubbing test coverage for a new project or new feature area.\n- Load `/ripplo:scope` skill for instructions on managing the working set of tests this session is responsible for.\n- Load `/ripplo:create` skill for instructions on authoring a single test spec for a user flow.\n- Load `/ripplo:run` skill for instructions on executing existing tests.\n- Load `/ripplo:debug` skill for instructions on a failed run; read artifacts in `.ripplo/debug/<runId>/` before re-running.\n\n## Universal rules\n\n- **Two background processes must be running before feature work.** (1) The app's dev server, so the app is reachable; (2) `npx ripplo daemon` (run `/ripplo:start` to spawn it, or invoke it directly via Bash with `run_in_background`), so the dev session is live. Without the daemon, dev-mode hooks don't arm (`ripplo run` will auto-start one if absent). Without the dev server, runs fail when they try to hit the app. `npx ripplo doctor` reports both.\n- **Two funnels.** Definitions \u2192 `createRipplo({ entities, singletons, tests })` in `.ripplo/index.ts`. Implementations \u2192 `createEngine(ripplo, { entities: impls, singletons })` in your app server's `test/engine.ts` \u2014 one `seed`/`read` impl per entity. Never call either elsewhere. TS enforces exhaustiveness across both.\n- **\"Done\" = app code delivers the behavior AND a passing test proves it.** Both halves. Shipping without a test isn't done; writing a test against broken UI/API isn't done.\n- **Scope is your job.** For any non-trivial change, enumerate every flow it could affect and either `scope add` existing tests or stub new ones with `test(\"Intent\")` (no body). Don't wait to be told.\n- **`scope remove` is never for size/effort.** Valid only when an item is genuinely out of scope (wrong flow, duplicate, user said \"not this session,\" feature cut). \"Too many stubs\" \u2192 parallelize with subagents. Don't present \"implement vs. remove\" as a neutral A/B.\n- **Stub gates are not a question.** When `stop-enforce` blocks on unimplemented stubs, implement them \u2014 don't ask the user \"implement or defer?\", don't propose pausing hooks as option B. The fix isn't done until the test is. New scaffolding (entity, world, engine impl) is in-scope work, not follow-up.\n- **Backend assertions are mandatory on mutations.** Every mutation step carries an `Entity.created/updated/deleted` in its `.expect(...)` \u2014 the oracle checks observed-vs-model. A UI-only check on a mutation ships the bug as green.\n- **Never weaken a test to make it pass.** No `contains`/regex for exact text, no removed assertions, no fabricated locators. App lacks an accessible name \u2192 add one to the app, don't fall back to `testId()`. App bug \u2192 report with evidence.\n- **Artifacts first, re-run last.** Failed runs write `.ripplo/debug/<runId>/behavior.jsonl` \u2014 a causal stream of actions, assertions, rrweb DOM, console, network, and server spans \u2014 and the run output renders the oracle's findings. Read them. Never pipe `ripplo run` through `grep`/`tail`/`head`. Form a hypothesis citing an event, make ONE change, re-run once.\n- **`.ripplo/ripplo.lock` is committed, never hand-edited.** `ripplo lint` / `ripplo compile` regenerates it. Pre-commit runs `ripplo compile --check`.\n- **Scratch files live in `.ripplo/.local/`.** Never loose in `.ripplo/`.\n- **Worktrees are self-contained.** Each worktree has its own `.ripplo/` checkout, DevSession, scope, and debug artifacts. Auth and projectId are shared globally. Env files (typically gitignored) won't carry over to a fresh worktree \u2014 copy from main or point at a shared file. **If sibling worktrees run dev servers on different ports, the worktree's env file MUST update both `RIPPLO_APP_URL` and `RIPPLO_ENGINE_URL` to match the port that worktree's dev server is bound to** (e.g. main on `:3000`, this worktree on `:3001` \u2192 set `RIPPLO_APP_URL=http://localhost:3001` and `RIPPLO_ENGINE_URL=http://localhost:3001/ripplo` in the worktree's env file). Mismatched ports = `npx ripplo daemon` talks to the wrong server, runs silently fail or hit the sibling worktree's app.\n- **DSL locators are semantic.** Use `role`/`button`/`textbox`/`heading`/`link`; `testId` only when no ARIA role exists.\n- **New backend state?** Add an `entity(...)` in `.ripplo/entities/` and a `seed`/`read` impl in your app's engine funnel (TS flags the missing impl).\n\n## Key files\n\n- `.ripplo/index.ts` \u2014 `createRipplo` call.\n- `.ripplo/{entities,singletons,worlds,tests}/index.ts` \u2014 registry aggregators.\n- `.ripplo/project.json` \u2014 project id + env-file pointers.\n- `<app>/src/test/engine.ts` \u2014 single impl funnel via `createEngine`.\n- `/ripplo:create` skill \u2014 DSL reference (entities, worlds, tests, oracle); full primitive catalog at `node_modules/@ripplo/testing/DSL.md`.\n",pR=ue("SessionStart",e=>{if(ae(e.cwd))return{hookSpecificOutput:{additionalContext:sz,hookEventName:"SessionStart"}}});import{execFileSync as az}from"child_process";import fR from"process";import{graphql as lz}from"gql.tada";import{z as al}from"zod";var cz=lz(`
|
|
677
709
|
query ScopeEnforce($projectId: String!, $cwd: String!) {
|
|
678
710
|
project(id: $projectId) {
|
|
679
711
|
id
|
|
@@ -692,36 +724,36 @@ ${o.map(a=>{let l=a.workflow;return l==null?` [intent] (${a.id}) ${a.label??""}
|
|
|
692
724
|
}
|
|
693
725
|
}
|
|
694
726
|
}
|
|
695
|
-
`),
|
|
727
|
+
`),mR=ue("Stop",async e=>{let{cwd:t}=e;if(!ae(t)||!De(t))return;let r=il(t),n=_n(t,"stop-enforce")===r;if(n&&!e.stop_hook_active)return;let i=await uz(t);if(jn(t,"stop-enforce",r),i.length!==0)return n&&e.stop_hook_active?{continue:!1,stopReason:`Stop-enforce: same repo state across consecutive stop attempts; agent appears stuck. Errors:
|
|
696
728
|
${i.join(`
|
|
697
729
|
|
|
698
730
|
`)}`}:{decision:"block",reason:i.join(`
|
|
699
731
|
|
|
700
|
-
`)}});async function
|
|
732
|
+
`)}});async function uz(e){let t=await Mn(e);if(t.isErr())return[`--- Compilation failed ---
|
|
701
733
|
${Oe(t.error)}
|
|
702
|
-
${
|
|
734
|
+
${F("create")}`];let r=t.value,n=await fz(e,r),i=dz(r),o=pz(r),s=n.runnableSlugs.length>0?mz(e):null;return[i,o,s,n.error].filter(a=>a!=null)}function dz(e){let t=Cr(e);return t.length===0?null:`--- Ripplo Lint ---
|
|
703
735
|
${Rr(t)}
|
|
704
|
-
${
|
|
736
|
+
${F("create")}`}function pz(e){let t=tr(e);return t.length===0?null:`--- Unimplemented stubs ---
|
|
705
737
|
${t.join(", ")}
|
|
706
738
|
Implement the stub now with \`test("Intent", () => ({ given, steps }))\`. Do not ask the user "implement or defer?" \u2014 that framing is forbidden by /ripplo:create. New scaffolding (entity, world, engine impl) is in-scope, not follow-up.
|
|
707
|
-
${
|
|
708
|
-
No project config \u2014 \`ripplo init\` hasn't run here, so scope/stub done-checks are not enforcing. ${
|
|
709
|
-
Ripplo server unreachable \u2014 scope/stub done-checks are not enforcing. Verify the dev session is live (\`npx ripplo doctor\`, ${
|
|
739
|
+
${F("create")}`}async function fz(e,t){let r=new Set(tr(t).map(d=>de(d))),n=new Set(t.tests.map(d=>de(d.name))),i=(d,p)=>n.has(d)?r.has(d):hz(p),o=je(e).unwrapOr(void 0);if(o==null)return{error:`--- Testing Scope (NOT CHECKED) ---
|
|
740
|
+
No project config \u2014 \`ripplo init\` hasn't run here, so scope/stub done-checks are not enforcing. ${F("setup")}`,runnableSlugs:[]};let s=await D({config:o,document:cz,variables:{cwd:o.cwd,projectId:o.projectId}}).catch(()=>null);if(s==null)return{error:`--- Testing Scope (NOT CHECKED) ---
|
|
741
|
+
Ripplo server unreachable \u2014 scope/stub done-checks are not enforcing. Verify the dev session is live (\`npx ripplo doctor\`, ${F("start")}) before declaring work done.`,runnableSlugs:[]};let a=s.project?.devSession?.scopeItems??[],l=a.flatMap(d=>{let p=d.workflow;return p==null?[` [intent] ${d.label??"(no label)"} \u2014 write a test for this flow`]:i(p.slug,p.spec)?[` [stub] ${p.slug} \u2014 implement \`${p.name}\``]:[]}),c=a.flatMap(d=>d.workflow!=null&&!i(d.workflow.slug,d.workflow.spec)?[d.workflow.slug]:[]);return{error:l.length===0?null:`--- Testing Scope ---
|
|
710
742
|
${l.join(`
|
|
711
743
|
`)}
|
|
712
|
-
${
|
|
744
|
+
${F("create")}`,runnableSlugs:c}}function hz(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"stub")===!0}function mz(e){let t=yz(["run"],e);if(t.code===0)return null;let r=t.output.split(`
|
|
713
745
|
`).filter(n=>/FAILED/.test(n)).join(`
|
|
714
746
|
`);if(r.length===0){let n=t.output.split(`
|
|
715
747
|
`).filter(Boolean).slice(-15).join(`
|
|
716
748
|
`);return`--- Ripplo Run Could Not Execute ---
|
|
717
749
|
\`ripplo run\` exited ${String(t.code)} without test results \u2014 the scoped tests were NOT verified. Output tail:
|
|
718
750
|
${n}
|
|
719
|
-
Fix the run environment (daemon, dev server, auth \u2014 \`npx ripplo doctor\`) and re-run before declaring work done. ${
|
|
751
|
+
Fix the run environment (daemon, dev server, auth \u2014 \`npx ripplo doctor\`) and re-run before declaring work done. ${F("start")}`}return`--- Ripplo Run Failures (scope) ---
|
|
720
752
|
${r}
|
|
721
|
-
Artifacts: .ripplo/debug/<runId>/. ${
|
|
722
|
-
`),process.exit(1));let r=await
|
|
723
|
-
`),process.exit(1)});function
|
|
724
|
-
`))}export{
|
|
753
|
+
Artifacts: .ripplo/debug/<runId>/. ${F("debug")}`}var gz=al.object({status:al.number().nullish(),stderr:al.unknown().optional(),stdout:al.unknown().optional()});function hR(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function yz(e,t){let r=fR.argv[1];if(r==null)return{code:1,output:""};try{return{code:0,output:az(fR.execPath,[r,...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(n){let i=gz.safeParse(n);if(!i.success)return{code:1,output:""};let o=`${hR(i.data.stdout)}${hR(i.data.stderr)}`;return{code:i.data.status??1,output:o}}}import{z as gR}from"zod";var bz=gR.looseObject({skill:gR.string()}),yR=ue("PostToolUse",e=>{if(e.tool_name!=="Skill")return;let t=bz.safeParse(e.tool_input);if(!t.success)return;let r=/^ripplo:(.+)$/.exec(t.data.skill);if(r==null)return;let n=r[1];n!=null&&ae(e.cwd)&&ol(e.cwd,e.session_id,n)});var wz=/(?:^|\s)\/ripplo:([a-z][a-z0-9-]*)\b/gi,bR=ue("UserPromptSubmit",e=>{ae(e.cwd)&&[...e.prompt.matchAll(wz)].map(t=>t[1]).filter(t=>t!=null).forEach(t=>{ol(e.cwd,e.session_id,t)})});Mz();Jr(process.cwd());gl();var wR={"exit-plan-gate":NC,"plan-reminder":LC,"post-edit-flag-stubs":zC,"post-edit-lint":ZC,"pre-bash-hooks-pause-gate":QC,"pre-bash-run-gate":nR,"pre-edit-ripplo-skill-gate":oR,"pre-edit-scope-gate":lR,"pre-edit-watch-gate":uR,"scope-reminder":dR,"session-preamble":pR,"stop-enforce":mR,"track-skill-load":yR,"track-skill-prompt":bR};async function xz(){await Sz(vz(process.argv)).scriptName("ripplo").version(ih()).command("daemon","Run the long-lived local executor (IPC socket + run subscription)",e=>e.option("explore",{default:!0,describe:"Background exploration (disable with --no-explore)",type:"boolean"}),e=>kC({explore:e.explore})).command("concurrency [value]","Show or set max local concurrent runs (daemon applies live)",e=>e.positional("value",{type:"number"}),e=>zh({value:e.value})).command("auth <subcommand>","Manage authentication",Oz).command("projects <subcommand>","Inspect Ripplo projects",Tz).command("hooks <subcommand>","Pause or resume Ripplo hooks",Pz).command("init","Scaffold .ripplo/ in this project",e=>e.option("project",{type:"string"}).option("env",{type:"string"}).option("app-url",{type:"string"}).option("engine-url",{type:"string"}),e=>Mx({appUrl:e["app-url"],engineUrl:e["engine-url"],envFile:e.env,projectId:e.project})).command("run [ids..]","Run tests locally via the daemon (auto-starts it if absent)",Iz,e=>rk({all:e.all,headed:e.headed,ids:e.ids,keepAlive:e["keep-alive"]})).command(Ez()).command(Rz()).command("lint","Static model analysis (cascade gaps + law conflicts; no live app)",()=>{},()=>Nx()).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>Jk()).command("compile","Compile the DSL and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>Vh({check:e.check})).command("doctor","Check project health",()=>{},()=>xx()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>OC({format:e.format})).command("scope <subcommand>","Manage testing scope",Az).command("run-worker",!1,()=>{},()=>Vk()).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(wR),demandOption:!0,type:"string"}),e=>kz(e.name)).strict().help().parse()}async function kz(e){let t=wR[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
|
|
754
|
+
`),process.exit(1));let r=await Cz(),n=r.trim()===""?{}:JSON.parse(r),i=await t.run(n);i!=null&&process.stdout.write(JSON.stringify(i))}function Cz(){return new Promise((e,t)=>{if(process.stdin.isTTY){e("");return}let r=[];process.stdin.on("data",n=>r.push(n)),process.stdin.on("end",()=>{e(Buffer.concat(r).toString("utf8"))}),process.stdin.on("error",t)})}xz().catch(e=>{process.stderr.write(`${Oh(e)}
|
|
755
|
+
`),process.exit(1)});function Rz(){return{command:"report-bug",describe:"Report a critical application bug caught while building or testing",builder:e=>e.option("kind",{choices:["new_feature_bug","regression","latent_bug"],demandOption:!0,describe:"new_feature_bug: broke the new thing being built; regression: broke previously working behavior; latent_bug: pre-existing bug exposed by new test coverage"}).option("title",{demandOption:!0,describe:"Short bug name",type:"string"}).option("root-cause",{demandOption:!0,describe:"What was actually wrong",type:"string"}).option("surfaced-by",{demandOption:!0,describe:"How the test/run exposed it (cite evidence)",type:"string"}).option("run",{describe:"Run id where it surfaced",type:"string"}).option("test",{describe:"Test id that surfaced it",type:"string"}),handler:e=>Dx({kind:e.kind,rootCause:e["root-cause"],runId:e.run,surfacedBy:e["surfaced-by"],testId:e.test,title:e.title})}}function Ez(){return{command:"snapshot <runId>",describe:"Render a PNG of the page at a point in a run's rrweb recording",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}).option("at",{describe:"Moment to render: epoch-ms timestamp exactly as found in behavior.jsonl",type:"number"}).option("offset",{describe:"Moment to render: ms from the start of the recording (alternative to --at)",type:"number"}).conflicts("at","offset"),handler:e=>Kk({at:e.at,offset:e.offset,runId:e.runId})}}function Iz(e){let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to run",type:"string"}).option("all",{default:!1,describe:"Run every test in the suite (expensive)",type:"boolean"}).option("headed",{default:!1,describe:"Run with a visible browser window",type:"boolean"}).option("keep-alive",{default:!1,describe:"Leave an auto-started daemon running after the batch",type:"boolean"})}function Az(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>IC({format:t.format})).command("add <test-ids..>","Bind one or more existing tests (stubs or implemented) to scope as agent intent",t=>{let r=[];return t.positional("test-ids",{array:!0,default:r,demandOption:!0,describe:"Slugs of existing workflows",type:"string"})},t=>AC({testIds:t["test-ids"]})).command("link <id> <test-id>","Link an existing scope item to a test",t=>t.positional("id",{demandOption:!0,describe:"Scope item id",type:"string"}).positional("test-id",{demandOption:!0,describe:"Slug of the workflow to link",type:"string"}),t=>PC({id:t.id,testId:t["test-id"]})).command("remove <ids..>","Remove one or more scope items by id",t=>{let r=[];return t.positional("ids",{array:!0,default:r,demandOption:!0,describe:"Scope item ids",type:"string"})},t=>TC({ids:t.ids})).demandCommand(1)}function Pz(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>kx()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>Cx()).demandCommand(1)}function Tz(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>Lx()).demandCommand(1)}function Oz(e){return e.command("login","Authenticate via device flow",()=>{},()=>jh()).command("status","Show authentication status",()=>{},()=>Fh()).command("logout","Remove the saved token",()=>{},()=>{Bh()}).demandCommand(1)}function Mz(){let e=process.cwd(),t=dl(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
|
|
756
|
+
`))}export{xz as main};
|
|
725
757
|
/*! Bundled license information:
|
|
726
758
|
|
|
727
759
|
rrweb/dist/rrweb.js:
|