ripplo 0.6.1 → 0.7.0

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 CHANGED
@@ -1,296 +1,71 @@
1
1
  #!/usr/bin/env node
2
- var ja=Object.create;var vt=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Da=Object.getOwnPropertyNames;var Oa=Object.getPrototypeOf,La=Object.prototype.hasOwnProperty;var _a=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Ua=(e,r)=>{for(var t in r)vt(e,t,{get:r[t],enumerable:!0})},bt=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Da(r))!La.call(e,o)&&o!==t&&vt(e,o,{get:()=>r[o],enumerable:!(n=Na(r,o))||n.enumerable});return e},St=(e,r,t)=>(bt(e,r,"default"),t&&bt(t,r,"default")),kt=(e,r,t)=>(t=e!=null?ja(Oa(e)):{},bt(r||!e||!e.__esModule?vt(t,"default",{value:e,enumerable:!0}):t,e));var $r=_a((Tv,Po)=>{"use strict";var Ql=(function(){function e(t,n){if(typeof t!="function")throw new TypeError("DataLoader must be constructed with a function which accepts "+("Array<key> and returns Promise<Array<value>>, but got: "+t+"."));this._batchLoadFn=t,this._maxBatchSize=tc(n),this._batchScheduleFn=nc(n),this._cacheKeyFn=oc(n),this._cacheMap=ic(n),this._batch=null,this.name=sc(n)}var r=e.prototype;return r.load=function(n){if(n==null)throw new TypeError("The loader.load() function must be called with a value, "+("but got: "+String(n)+"."));var o=ec(this),i=this._cacheMap,s;if(i){s=this._cacheKeyFn(n);var a=i.get(s);if(a){var l=o.cacheHits||(o.cacheHits=[]);return new Promise(function(u){l.push(function(){u(a)})})}}o.keys.push(n);var c=new Promise(function(u,m){o.callbacks.push({resolve:u,reject:m})});return i&&i.set(s,c),c},r.loadMany=function(n){if(!ko(n))throw new TypeError("The loader.loadMany() function must be called with Array<key> "+("but got: "+n+"."));for(var o=[],i=0;i<n.length;i++)o.push(this.load(n[i]).catch(function(s){return s}));return Promise.all(o)},r.clear=function(n){var o=this._cacheMap;if(o){var i=this._cacheKeyFn(n);o.delete(i)}return this},r.clearAll=function(){var n=this._cacheMap;return n&&n.clear(),this},r.prime=function(n,o){var i=this._cacheMap;if(i){var s=this._cacheKeyFn(n);if(i.get(s)===void 0){var a;o instanceof Error?(a=Promise.reject(o),a.catch(function(){})):a=Promise.resolve(o),i.set(s,a)}}return this},e})(),Zl=typeof process=="object"&&typeof process.nextTick=="function"?function(e){Vt||(Vt=Promise.resolve()),Vt.then(function(){process.nextTick(e)})}:typeof setImmediate=="function"?function(e){setImmediate(e)}:function(e){setTimeout(e)},Vt;function ec(e){var r=e._batch;if(r!==null&&!r.hasDispatched&&r.keys.length<e._maxBatchSize)return r;var t={hasDispatched:!1,keys:[],callbacks:[]};return e._batch=t,e._batchScheduleFn(function(){rc(e,t)}),t}function rc(e,r){if(r.hasDispatched=!0,r.keys.length===0){Mt(r);return}var t;try{t=e._batchLoadFn(r.keys)}catch(n){return Ft(e,r,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function "+("errored synchronously: "+String(n)+".")))}if(!t||typeof t.then!="function")return Ft(e,r,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise: "+String(t)+".")));t.then(function(n){if(!ko(n))throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise of an Array: "+String(n)+"."));if(n.length!==r.keys.length)throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys."+(`
3
-
4
- Keys:
5
- `+String(r.keys))+(`
6
-
7
- Values:
8
- `+String(n)));Mt(r);for(var o=0;o<r.callbacks.length;o++){var i=n[o];i instanceof Error?r.callbacks[o].reject(i):r.callbacks[o].resolve(i)}}).catch(function(n){Ft(e,r,n)})}function Ft(e,r,t){Mt(r);for(var n=0;n<r.keys.length;n++)e.clear(r.keys[n]),r.callbacks[n].reject(t)}function Mt(e){if(e.cacheHits)for(var r=0;r<e.cacheHits.length;r++)e.cacheHits[r]()}function tc(e){var r=!e||e.batch!==!1;if(!r)return 1;var t=e&&e.maxBatchSize;if(t===void 0)return 1/0;if(typeof t!="number"||t<1)throw new TypeError("maxBatchSize must be a positive number: "+t);return t}function nc(e){var r=e&&e.batchScheduleFn;if(r===void 0)return Zl;if(typeof r!="function")throw new TypeError("batchScheduleFn must be a function: "+r);return r}function oc(e){var r=e&&e.cacheKeyFn;if(r===void 0)return function(t){return t};if(typeof r!="function")throw new TypeError("cacheKeyFn must be a function: "+r);return r}function ic(e){var r=!e||e.cache!==!1;if(!r)return null;var t=e&&e.cacheMap;if(t===void 0)return new Map;if(t!==null){var n=["get","set","delete","clear"],o=n.filter(function(i){return t&&typeof t[i]!="function"});if(o.length!==0)throw new TypeError("Custom cacheMap missing methods: "+o.join(", "))}return t}function sc(e){return e&&e.name?e.name:null}function ko(e){return typeof e=="object"&&e!==null&&typeof e.length=="number"&&(e.length===0||e.length>0&&Object.prototype.hasOwnProperty.call(e,e.length-1))}Po.exports=Ql});import{execFileSync as Va}from"child_process";import Fa from"fs";import Er from"path";function Pt(e){let r=Ha(e);return r??Wn(e)}function Wn(e){let r=Er.dirname(e);return Ma(Er.join(e,".ripplo"))?e:r===e?null:Wn(r)}function Ma(e){try{return Fa.statSync(e).isDirectory()}catch{return!1}}function Ha(e){let r=Ba(["rev-parse","--show-toplevel"],e);if(r==null)return null;let t=r.trim();return t.length===0?null:Er.isAbsolute(t)?t:Er.resolve(e,t)}function Ba(e,r){try{return Va("git",e,{cwd:r,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}import pl from"path";import{AsyncLocalStorage as Wa}from"async_hooks";import qa from"path";var za=new Wa;function qn(){let e=za.getStore();return e!=null?e.fixturesDir:qa.join(process.cwd(),".ripplo","fixtures")}async function me(e,r,t){let n,o=new Promise((i,s)=>{n=setTimeout(()=>{s(new Error(`${t} timed out after ${String(r)}ms`))},r)});try{return await Promise.race([e,o])}finally{n!=null&&clearTimeout(n)}}var zn=5e3;async function se({awaitPromise:e,expression:r,label:t,session:n,timeoutMs:o}){let i=await me(n.send("Runtime.evaluate",{awaitPromise:e,expression:r,returnByValue:!0}),o??zn,t??"evaluateOnSession");if(i.exceptionDetails==null)return i.result.value}async function Ga({fn:e,label:r,page:t,timeoutMs:n}){let o=n??zn,i=await me(t.context().newCDPSession(t),o,`${r} (newCDPSession)`);try{return await me(e(i),o,r)}finally{await i.detach().catch(()=>{})}}async function sr({awaitPromise:e,expression:r,label:t,page:n,timeoutMs:o}){return Ga({label:t??"evaluateViaCdp",page:n,timeoutMs:o,fn:async i=>{let s=await i.send("Runtime.evaluate",{awaitPromise:e,expression:r,returnByValue:!0});if(s.exceptionDetails==null)return s.result.value}})}var Ka=Object.prototype.toString,Le=Array.isArray||function(r){return Ka.call(r)==="[object Array]"};function xt(e){return typeof e=="function"}function Ja(e){return Le(e)?"array":typeof e}function Rt(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Gn(e,r){return e!=null&&typeof e=="object"&&r in e}function Xa(e,r){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(r)}var Ya=RegExp.prototype.test;function Qa(e,r){return Ya.call(e,r)}var Za=/\S/;function el(e){return!Qa(Za,e)}var rl={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function tl(e){return String(e).replace(/[&<>"'`=\/]/g,function(t){return rl[t]})}var nl=/\s*/,ol=/\s+/,Kn=/\s*=/,il=/\s*\}/,sl=/#|\^|\/|>|\{|&|=|!/;function al(e,r){if(!e)return[];var t=!1,n=[],o=[],i=[],s=!1,a=!1,l="",c=0;function u(){if(s&&!a)for(;i.length;)delete o[i.pop()];else i=[];s=!1,a=!1}var m,y,R;function E(z){if(typeof z=="string"&&(z=z.split(ol,2)),!Le(z)||z.length!==2)throw new Error("Invalid tags: "+z);m=new RegExp(Rt(z[0])+"\\s*"),y=new RegExp("\\s*"+Rt(z[1])),R=new RegExp("\\s*"+Rt("}"+z[1]))}E(r||te.tags);for(var g=new lr(e),O,P,H,Te,De,pe;!g.eos();){if(O=g.pos,H=g.scanUntil(m),H)for(var L=0,J=H.length;L<J;++L)Te=H.charAt(L),el(Te)?(i.push(o.length),l+=Te):(a=!0,t=!0,l+=" "),o.push(["text",Te,O,O+1]),O+=1,Te===`
9
- `&&(u(),l="",c=0,t=!1);if(!g.scan(m))break;if(s=!0,P=g.scan(sl)||"name",g.scan(nl),P==="="?(H=g.scanUntil(Kn),g.scan(Kn),g.scanUntil(y)):P==="{"?(H=g.scanUntil(R),g.scan(il),g.scanUntil(y),P="&"):H=g.scanUntil(y),!g.scan(y))throw new Error("Unclosed tag at "+g.pos);if(P==">"?De=[P,H,O,g.pos,l,c,t]:De=[P,H,O,g.pos],c++,o.push(De),P==="#"||P==="^")n.push(De);else if(P==="/"){if(pe=n.pop(),!pe)throw new Error('Unopened section "'+H+'" at '+O);if(pe[1]!==H)throw new Error('Unclosed section "'+pe[1]+'" at '+O)}else P==="name"||P==="{"||P==="&"?a=!0:P==="="&&E(H)}if(u(),pe=n.pop(),pe)throw new Error('Unclosed section "'+pe[1]+'" at '+g.pos);return cl(ll(o))}function ll(e){for(var r=[],t,n,o=0,i=e.length;o<i;++o)t=e[o],t&&(t[0]==="text"&&n&&n[0]==="text"?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}function cl(e){for(var r=[],t=r,n=[],o,i,s=0,a=e.length;s<a;++s)switch(o=e[s],o[0]){case"#":case"^":t.push(o),n.push(o),t=o[4]=[];break;case"/":i=n.pop(),i[5]=o[2],t=n.length>0?n[n.length-1][4]:r;break;default:t.push(o)}return r}function lr(e){this.string=e,this.tail=e,this.pos=0}lr.prototype.eos=function(){return this.tail===""};lr.prototype.scan=function(r){var t=this.tail.match(r);if(!t||t.index!==0)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};lr.prototype.scanUntil=function(r){var t=this.tail.search(r),n;switch(t){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=n.length,n};function Oe(e,r){this.view=e,this.cache={".":this.view},this.parent=r}Oe.prototype.push=function(r){return new Oe(r,this)};Oe.prototype.lookup=function(r){var t=this.cache,n;if(t.hasOwnProperty(r))n=t[r];else{for(var o=this,i,s,a,l=!1;o;){if(r.indexOf(".")>0)for(i=o.view,s=r.split("."),a=0;i!=null&&a<s.length;)a===s.length-1&&(l=Gn(i,s[a])||Xa(i,s[a])),i=i[s[a++]];else i=o.view[r],l=Gn(o.view,r);if(l){n=i;break}o=o.parent}t[r]=n}return xt(n)&&(n=n.call(this.view)),n};function X(){this.templateCache={_cache:{},set:function(r,t){this._cache[r]=t},get:function(r){return this._cache[r]},clear:function(){this._cache={}}}}X.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};X.prototype.parse=function(r,t){var n=this.templateCache,o=r+":"+(t||te.tags).join(":"),i=typeof n<"u",s=i?n.get(o):void 0;return s==null&&(s=al(r,t),i&&n.set(o,s)),s};X.prototype.render=function(r,t,n,o){var i=this.getConfigTags(o),s=this.parse(r,i),a=t instanceof Oe?t:new Oe(t,void 0);return this.renderTokens(s,a,n,r,o)};X.prototype.renderTokens=function(r,t,n,o,i){for(var s="",a,l,c,u=0,m=r.length;u<m;++u)c=void 0,a=r[u],l=a[0],l==="#"?c=this.renderSection(a,t,n,o,i):l==="^"?c=this.renderInverted(a,t,n,o,i):l===">"?c=this.renderPartial(a,t,n,i):l==="&"?c=this.unescapedValue(a,t):l==="name"?c=this.escapedValue(a,t,i):l==="text"&&(c=this.rawValue(a)),c!==void 0&&(s+=c);return s};X.prototype.renderSection=function(r,t,n,o,i){var s=this,a="",l=t.lookup(r[1]);function c(y){return s.render(y,t,n,i)}if(l){if(Le(l))for(var u=0,m=l.length;u<m;++u)a+=this.renderTokens(r[4],t.push(l[u]),n,o,i);else if(typeof l=="object"||typeof l=="string"||typeof l=="number")a+=this.renderTokens(r[4],t.push(l),n,o,i);else if(xt(l)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");l=l.call(t.view,o.slice(r[3],r[5]),c),l!=null&&(a+=l)}else a+=this.renderTokens(r[4],t,n,o,i);return a}};X.prototype.renderInverted=function(r,t,n,o,i){var s=t.lookup(r[1]);if(!s||Le(s)&&s.length===0)return this.renderTokens(r[4],t,n,o,i)};X.prototype.indentPartial=function(r,t,n){for(var o=t.replace(/[^ \t]/g,""),i=r.split(`
10
- `),s=0;s<i.length;s++)i[s].length&&(s>0||!n)&&(i[s]=o+i[s]);return i.join(`
11
- `)};X.prototype.renderPartial=function(r,t,n,o){if(n){var i=this.getConfigTags(o),s=xt(n)?n(r[1]):n[r[1]];if(s!=null){var a=r[6],l=r[5],c=r[4],u=s;l==0&&c&&(u=this.indentPartial(s,c,a));var m=this.parse(u,i);return this.renderTokens(m,t,n,u,o)}}};X.prototype.unescapedValue=function(r,t){var n=t.lookup(r[1]);if(n!=null)return n};X.prototype.escapedValue=function(r,t,n){var o=this.getConfigEscape(n)||te.escape,i=t.lookup(r[1]);if(i!=null)return typeof i=="number"&&o===te.escape?String(i):o(i)};X.prototype.rawValue=function(r){return r[1]};X.prototype.getConfigTags=function(r){return Le(r)?r:r&&typeof r=="object"?r.tags:void 0};X.prototype.getConfigEscape=function(r){if(r&&typeof r=="object"&&!Le(r))return r.escape};var te={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){ar.templateCache=e},get templateCache(){return ar.templateCache}},ar=new X;te.clearCache=function(){return ar.clearCache()};te.parse=function(r,t){return ar.parse(r,t)};te.render=function(r,t,n,o){if(typeof r!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ja(r)+'" was given as the first argument for mustache#render(template, view, partials)');return ar.render(r,t,n,o)};te.escape=tl;te.Scanner=lr;te.Context=Oe;te.Writer=X;var Jn=te;function Et({defs:e}){return e==null?{}:Object.fromEntries(Object.entries(e).map(([r,t])=>[r,dl({def:t,name:r})]))}var ul={boolean:!1,number:0,string:""};function dl({def:e,name:r}){if(e.type==="env"){let t=process.env[e.key];if(t==null)throw new Error(`Environment variable "${e.key}" not set for variable "${r}"`);return t}return e.default??ul[e.type]??""}function Cr({ref:e,variables:r}){if(e.type==="static")return e.value;let t=r[e.name];if(t==null||typeof t=="object")throw new Error(`Variable "${e.name}" is not defined`);return t}function Y({ref:e,variables:r}){let t=String(Cr({ref:e,variables:r}));return Ir({raw:t,variables:r})}function Ar({ref:e,variables:r}){let t=Cr({ref:e,variables:r});return typeof t=="string"?Ir({raw:t,variables:r}):t}function Ir({raw:e,variables:r}){return Jn.render(e,r,{},{escape:t=>t})}function Ct({ref:e,variables:r}){let t=Cr({ref:e,variables:r});if(typeof t=="number")return t;let n=Number(t);if(Number.isNaN(n))throw new TypeError(`Cannot convert "${String(t)}" to number`);return n}function _e({name:e,store:r,value:t}){return{...r,[e]:t}}function V({locator:e,page:r,variables:t}){switch(e.by){case"testId":return r.getByTestId(Xn(e.value,t));case"role":return r.getByRole(e.role,{exact:!0,name:e.name==null?void 0:Xn(e.name,t)})}}function Xn(e,r){return r==null?e:Ir({raw:e,variables:r})}async function Yn({node:e,page:r,timeout:t}){await V({locator:e.source,page:r,variables:void 0}).dragTo(V({locator:e.target,page:r,variables:void 0}),{timeout:t})}async function Qn({node:e,page:r,timeout:t}){await V({locator:e.locator,page:r,variables:void 0}).click({button:"right",timeout:t})}function Zn({node:e,page:r,variables:t}){return r.once("dialog",async n=>{e.action==="accept"?await n.accept(e.promptText??void 0):await n.dismiss()}),{variables:t}}async function eo({node:e,page:r,variables:t}){if(e.action==="write"){if(e.value==null)throw new Error("clipboard write requires a value");let o=Y({ref:e.value,variables:t}),i=JSON.stringify(o);return await sr({awaitPromise:!0,expression:`navigator.clipboard.writeText(${i})`,label:"clipboard.writeText",page:r,timeoutMs:void 0}),{variables:t}}if(e.variable==null)throw new Error("clipboard read requires a variable name to store the result");let n=await sr({awaitPromise:!0,expression:"navigator.clipboard.readText()",label:"clipboard.readText",page:r,timeoutMs:void 0})??"";return{variables:_e({name:e.variable,store:t,value:n})}}async function ro({node:e,page:r}){let t=r.context();e.state==="granted"?await t.grantPermissions([e.permission]):await t.clearPermissions()}async function At({node:e,page:r,timeout:t,variables:n}){switch(e.type){case"click":return await V({locator:e.locator,page:r,variables:n}).click({modifiers:e.modifier==null?void 0:[e.modifier],timeout:t}),{variables:n};case"check":case"uncheck":case"clear":case"dblclick":case"focus":case"hover":case"scrollIntoView":return fl({node:e,page:r,timeout:t,variables:n});case"rightClick":return await Qn({node:e,page:r,timeout:t}),{variables:n};case"goto":{let o=Y({ref:e.url,variables:n});return await r.goto(o,{timeout:t,waitUntil:"domcontentloaded"}),await r.waitForLoadState("load",{timeout:t}),await r.waitForFunction("document.body != null && document.body.childElementCount > 0 && (document.body.textContent?.trim().length ?? 0) > 0",void 0,{timeout:t}),await sr({awaitPromise:!0,expression:"new Promise((resolve) => { requestAnimationFrame(() => requestAnimationFrame(() => resolve(undefined))); })",label:"goto raf-settle",page:r,timeoutMs:void 0}),{variables:n}}case"fill":return yl({node:e,page:r,timeout:t,variables:n});case"select":return hl({node:e,page:r,timeout:t,variables:n});case"type":return wl({node:e,page:r,timeout:t,variables:n});case"press":return await gl({node:e,page:r,timeout:t}),{variables:n};case"drag":return await Yn({node:e,page:r,timeout:t}),{variables:n};case"upload":return bl({node:e,page:r,timeout:t,variables:n});case"extractText":return Sl({node:e,page:r,timeout:t,variables:n});case"setVariable":{let o=Ar({ref:e.value,variables:n});return{variables:_e({name:e.variable,store:n,value:o})}}case"fail":throw new Error(e.message);case"setViewport":return await r.setViewportSize({height:e.height,width:e.width}),{variables:n};case"handleDialog":return Zn({node:e,page:r,variables:n});case"clipboard":return eo({node:e,page:r,variables:n});case"setPermission":return await ro({node:e,page:r}),{variables:n}}}var ml={check:"check",clear:"clear",click:"click",dblclick:"dblclick",focus:"focus",hover:"hover",scrollIntoView:"scrollIntoViewIfNeeded",uncheck:"uncheck"};async function fl({node:e,page:r,timeout:t,variables:n}){return await V({locator:e.locator,page:r,variables:n})[ml[e.type]]({timeout:t}),{variables:n}}async function gl({node:e,page:r,timeout:t}){e.locator==null?await r.keyboard.press(e.key):await V({locator:e.locator,page:r,variables:void 0}).press(e.key,{timeout:t})}async function yl({node:e,page:r,timeout:t,variables:n}){let o=Y({ref:e.value,variables:n});return await V({locator:e.locator,page:r,variables:n}).fill(o,{timeout:t}),{variables:n}}async function hl({node:e,page:r,timeout:t,variables:n}){let o=Y({ref:e.value,variables:n});return await V({locator:e.locator,page:r,variables:n}).selectOption(o,{timeout:t}),{variables:n}}async function wl({node:e,page:r,timeout:t,variables:n}){let o=Y({ref:e.value,variables:n});return await V({locator:e.locator,page:r,variables:n}).pressSequentially(o,{timeout:t}),{variables:n}}async function bl({node:e,page:r,timeout:t,variables:n}){let o=e.files.map(i=>vl(i));return await V({locator:e.locator,page:r,variables:n}).setInputFiles(o,{timeout:t}),{variables:n}}function vl(e){return pl.join(qn(),e)}async function Sl({node:e,page:r,timeout:t,variables:n}){let o=await V({locator:e.locator,page:r,variables:n}).textContent({timeout:t});if(o==null)throw new Error("extractText: element had no text content");return{variables:_e({name:e.variable,store:n,value:o})}}var G={};Ua(G,{default:()=>kl});St(G,Qb);import*as Qb from"playwright/test";import{default as kl}from"playwright/test";async function It({expected:e,locator:r,operator:t,timeout:n}){return await cr({expected:e,operator:t,timeout:n,read:async()=>await r.textContent()??""}),ur({expected:e,label:"Text",operator:t,read:async()=>await r.textContent()??""})}async function Tt({expected:e,operator:r,page:t,timeout:n}){return await cr({expected:e,operator:r,timeout:n,read:()=>Promise.resolve(t.url())}),ur({expected:e,label:"URL",operator:r,read:()=>Promise.resolve(t.url())})}async function to({expected:e,operator:r,page:t,timeout:n}){return await cr({expected:e,operator:r,timeout:n,read:()=>t.title()}),ur({expected:e,label:"Title",operator:r,read:()=>t.title()})}async function $t({expected:e,locator:r,operator:t,timeout:n}){await G.expect.poll(async()=>fo({actual:await r.count(),expected:e,operator:t}),{timeout:n}).toBe(!0).catch(()=>{});let o=await r.count();return mo({actual:o,expected:e,label:"Count",operator:t})}async function jt({expected:e,locator:r,operator:t,timeout:n}){return await cr({expected:e,operator:t,timeout:n,read:()=>r.inputValue()}),ur({expected:e,label:"Value",operator:t,read:()=>r.inputValue()})}async function Nt({locator:e,timeout:r}){return we({description:"Element is visible",failureDetail:"Element not visible",run:()=>(0,G.expect)(e).toBeVisible({timeout:r})})}async function Dt({locator:e,timeout:r}){return we({description:"Element is not visible",failureDetail:"Element still visible",run:()=>(0,G.expect)(e).toBeHidden({timeout:r})})}async function no({attribute:e,expected:r,locator:t,operator:n,timeout:o}){return await cr({expected:r,operator:n,timeout:o,read:async()=>await t.getAttribute(e)??""}),ur({expected:r,label:`Attribute "${e}"`,operator:n,read:async()=>await t.getAttribute(e)??""})}async function oo({locator:e,timeout:r}){return we({description:"Element is enabled",failureDetail:"Element is disabled or not found",run:()=>(0,G.expect)(e).toBeEnabled({timeout:r})})}async function io({locator:e,timeout:r}){return we({description:"Element is disabled",failureDetail:"Element is enabled or not found",run:()=>(0,G.expect)(e).toBeDisabled({timeout:r})})}async function so({locator:e,timeout:r}){return we({description:"Element is checked",failureDetail:"Element is not checked",run:()=>(0,G.expect)(e).toBeChecked({timeout:r})})}async function ao({locator:e,timeout:r}){return we({description:"Element is not checked",failureDetail:"Element is checked",run:()=>(0,G.expect)(e).not.toBeChecked({timeout:r})})}async function lo({locator:e,timeout:r}){return we({description:"Element is focused",failureDetail:"Element is not focused",run:()=>(0,G.expect)(e).toBeFocused({timeout:r})})}async function co({locator:e,timeout:r}){return we({description:"Element is not focused",failureDetail:"Element is focused",run:()=>(0,G.expect)(e).not.toBeFocused({timeout:r})})}async function we({description:e,failureDetail:r,run:t}){try{return await t(),{description:e,detail:void 0,status:"passed"}}catch{return{description:e,detail:r,status:"failed"}}}async function cr({expected:e,operator:r,read:t,timeout:n}){await G.expect.poll(async()=>{let o=await t().catch(()=>"");return po({actual:o,expected:e,operator:r})},{timeout:n}).toBe(!0).catch(()=>{})}async function ur({expected:e,label:r,operator:t,read:n}){try{let o=await n();return uo({actual:o,expected:e,label:r,operator:t})}catch(o){let i=`${r} ${t} "${e}"`,s=o instanceof Error?o.message:String(o);return{description:i,detail:`Read failed: ${Pl(s)}`,status:"failed"}}}function Pl(e){let r=e.indexOf(`
12
- `);return r===-1?e:e.slice(0,r)}function uo(e){let r=`${e.label} ${e.operator} "${e.expected}"`,t=po(e),n=t?void 0:`Got: "${e.actual}"`;return{description:r,detail:n,status:t?"passed":"failed"}}function po({actual:e,expected:r,operator:t}){return t==="equals"?e===r:t==="notEquals"?e!==r:t==="contains"?e.includes(r):t==="startsWith"?e.startsWith(r):t==="endsWith"?e.endsWith(r):new RegExp(r).test(e)}function mo(e){let r=`${e.label} ${e.operator} ${String(e.expected)}`,t=fo(e),n=t?void 0:`Got: ${String(e.actual)}`;return{description:r,detail:n,status:t?"passed":"failed"}}function fo({actual:e,expected:r,operator:t}){return t==="equals"?e===r:t==="notEquals"?e!==r:t==="greaterThan"?e>r:t==="greaterThanOrEqual"?e>=r:t==="lessThan"?e<r:e<=r}import{execFile as xl}from"child_process";import{createRequire as El}from"module";import go from"fs";import yo from"path";import{chromium as ho}from"playwright";import nv from"fs";import iv from"path";import Rl from"pino";var f=Rl({level:process.env.LOG_LEVEL??"info",transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}});async function Ue({headed:e}){process.env.PW_TEST_SCREENSHOT_NO_FONTS_READY="1";try{return await ho.launch({headless:!e})}catch(r){throw Cl(r)?new Error(`Playwright browsers are not installed. Run:
13
-
14
- npx playwright install chromium
15
- `):r}}async function Ot(){let e=ho.executablePath();if(go.existsSync(e))return;f.info("Chromium not found. Installing via Playwright...");let r=El(import.meta.url),t=yo.dirname(r.resolve("playwright/package.json")),n=yo.join(t,"cli.js");if(await new Promise((o,i)=>{xl(process.execPath,[n,"install","chromium"],s=>{if(s!=null){i(new Error(`Playwright install failed: ${s.message}`));return}o()})}),!go.existsSync(e))throw new Error(`Playwright browser installation failed. Try running manually:
16
-
17
- npx playwright install chromium
18
- `);f.info("\u2713 Chromium installed")}function Cl(e){return e instanceof Error?e.message.includes("Executable doesn't exist"):!1}import{readdir as Nl,rm as Dl,stat as Ol}from"fs/promises";import bv from"os";import vo from"path";import{graphql as Ll}from"gql.tada";import{print as Al}from"graphql";var Il=15e3,Ve=class extends Error{errors;constructor(r){super(r.map(t=>t.message).join(", ")),this.name="GqlRequestError",this.errors=r}};async function h(e){let r=Al(e.document),t=JSON.stringify({query:r,variables:e.variables}),n=`${e.config.ripploServerUrl}/graphql`,o;try{o=await fetch(n,{body:t,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(Il)})}catch(s){let a=s instanceof Error?s.message:String(s);throw new Error(`Failed to connect to Ripplo server at ${e.config.ripploServerUrl}. Check the server is running and reachable. Details: ${a}`)}let i=await Tl({res:o,url:n});if(!$l(i))throw new Error("Invalid GraphQL response");if(jl(i))throw new Ve(i.errors);if(i.data==null)throw new Error("No data returned from server");return i.data}async function Tl({res:e,url:r}){let t=await e.text();if(t.length===0)throw new Error(`Empty response from Ripplo server at ${r} (status ${String(e.status)}). The server may have restarted or the request was rejected before a body was sent.`);try{return JSON.parse(t)}catch{throw new Error(`Non-JSON response from Ripplo server at ${r} (status ${String(e.status)}): ${t.slice(0,200)}`)}}function $l(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function jl(e){return Array.isArray(e.errors)&&e.errors.length>0}var wo=vo.join(process.cwd(),".ripplo","debug"),bo=360*60*1e3,Rv=Ll(`
19
- mutation RevokeCurrentCliToken {
20
- revokeCurrentCliToken
21
- }
22
- `);async function Tr({maxRuns:e}){try{let t=(await Nl(wo,{withFileTypes:!0})).filter(c=>c.isDirectory()),n=Date.now(),o=await Promise.all(t.map(async c=>{let u=vo.join(wo,c.name),m=await Ol(u);return{dirPath:u,mtime:m.mtimeMs}})),i=o.filter(c=>n-c.mtime>bo),a=o.filter(c=>n-c.mtime<=bo).toSorted((c,u)=>u.mtime-c.mtime).slice(e),l=[...i,...a];if(l.length===0)return;await Promise.allSettled(l.map(c=>Dl(c.dirPath,{force:!0,recursive:!0}))),f.debug("Pruned %d old debug run(s)",l.length)}catch{f.warn("Debug run pruning failed, ignoring")}}var _l=15e3,Ul=2,Vl=250,Fl=3e4,Lt=new Map;function _t({appUrl:e}){let r=Date.now(),t=Lt.get(e);if(t!=null&&t.expiresAt>r)return t.promise;let n=Ml(e).catch(o=>{throw Lt.delete(e),o});return Lt.set(e,{expiresAt:r+Fl,promise:n}),n}async function Ml(e){let r=null,t=0;for(;t<=Ul;){t>0&&await Bl(Vl);let o=await Hl(e,t);if(o==null)return;r=o,t+=1}let n=r instanceof Error?r.message:String(r);throw f.debug("App URL unreachable after retries: %s",n),new Error([`Could not reach your dev server at ${e}.`,"","Troubleshooting:",` 1. Make sure your app is running at ${e}`," 2. Check RIPPLO_APP_URL in the env file declared in .ripplo/project.json"," 3. If you're in a git worktree, RIPPLO_APP_URL and RIPPLO_ENGINE_URL must point at this worktree's dev server port (not main's)"].join(`
23
- `))}async function Hl(e,r){let t=performance.now();try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(_l)}),f.debug("App URL reachability check ok (attempt %d, %dms)",r+1,Math.round(performance.now()-t)),null}catch(n){return f.debug("App URL reachability check attempt %d failed after %dms: %s",r+1,Math.round(performance.now()-t),n instanceof Error?n.message:String(n)),n}}function Bl(e){return new Promise(r=>setTimeout(r,e))}import{Agent as Wl,RetryAgent as ql,setGlobalDispatcher as zl}from"undici";var Gl=1500,Kl=4e3,Jl=3,Xl=50,Yl=100,So=!1;function Ut(){if(So)return;So=!0;let e=new Wl({connections:Yl,keepAliveMaxTimeout:Kl,keepAliveTimeout:Gl}),r=new ql(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:Jl,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:Xl});zl(r)}var ri=kt($r(),1);import{z as _d}from"zod";import{z as jr}from"zod";var ac=jr.object({__codec:jr.string().min(1),data:jr.unknown(),version:jr.number().int().positive()}),Nr=class extends Error{codec;currentVersion;gotVersion;constructor(r){super(`Unsupported ${r.codec} version ${String(r.gotVersion)} (current ${String(r.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=r.codec,this.currentVersion=r.currentVersion,this.gotVersion=r.gotVersion}},Dr=class extends Error{constructor(r){super(`Codec mismatch: expected "${r.expected}", got "${r.got}"`),this.name="CodecMismatchError"}};function Or(e){return Ro({legacy:void 0,migrators:[],name:e,schemas:[]})}function Ro(e){return{initial:r=>Ht(r,{...e,schemas:[r]}),legacy:r=>Ro({...e,legacy:r})}}function Ht(e,r){return{build:()=>lc(e,r),legacy:t=>Ht(e,{...r,legacy:t}),upgrade:(t,n)=>{let o=n;return Ht(t,{...r,migrators:[...r.migrators,o],schemas:[...r.schemas,t]})}}}function lc(e,r){let t=r.schemas.length;return{currentVersion:t,name:r.name,decode:n=>cc(e,r,n),encode:n=>({__codec:r.name,data:n,version:t})}}function cc(e,r,t){let{data:n,version:o}=uc(r,t),i=xo(r,n,o);return e.parse(i)}function uc(e,r){let t=ac.safeParse(r);if(t.success){if(t.data.__codec!==e.name)throw new Dr({expected:e.name,got:t.data.__codec});return{data:t.data.data,version:t.data.version}}if(e.legacy!=null&&e.legacy.detect(r))return{data:r,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function xo(e,r,t){let n=e.schemas.length;if(t>n)throw new Nr({codec:e.name,currentVersion:n,gotVersion:t});if(t===n)return r;let o=e.schemas[t-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(t)}; cannot migrate.`);let i=o.parse(r),s=e.migrators[t-1];if(s==null)throw new Error(`Codec "${e.name}" missing migrator v${String(t)} \u2192 v${String(t+1)}.`);return xo(e,s(i),t+1)}import{z as Io}from"zod";import{z as Fe}from"zod";var Bt=Fe.object({depends:Fe.array(Fe.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:Fe.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Fe.array(Fe.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name.");import{z as d}from"zod";import{z as be}from"zod";var dc=be.object({by:be.literal("testId"),value:be.string().min(1)}),pc=be.object({by:be.literal("role"),name:be.string().optional(),role:be.string().min(1)}),C=be.discriminatedUnion("by",[dc,pc]);import{z as Eo}from"zod";var ve=Eo.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),Lr=Eo.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]);import{z as N}from"zod";var mc=N.object({type:N.literal("static"),value:N.union([N.string(),N.number(),N.boolean()])}),_r=N.object({name:N.string().min(1),type:N.literal("variable")}),Ur=N.discriminatedUnion("type",[mc,_r]),Q=N.discriminatedUnion("type",[N.object({type:N.literal("static"),value:N.string()}),_r]),Vr=N.discriminatedUnion("type",[N.object({type:N.literal("static"),value:N.number().int().nonnegative()}),_r]),Wt=N.discriminatedUnion("type",[N.object({type:N.literal("static"),value:N.union([N.string(),N.number(),N.boolean()])}),_r]);import{z as Z}from"zod";var Fr=Z.discriminatedUnion("type",[Z.object({default:Z.string().optional(),type:Z.literal("string")}),Z.object({default:Z.number().optional(),type:Z.literal("number")}),Z.object({default:Z.boolean().optional(),type:Z.literal("boolean")}),Z.object({key:Z.string().min(1),type:Z.literal("env")})]);var v={id:d.string().min(1).max(200),label:d.string().max(500).optional(),next:d.string().max(200).optional(),uiOnly:d.boolean().optional()},Co=500,fc=d.object({...v,type:d.literal("goto"),url:Q}),gc=d.object({...v,locator:C,modifier:d.enum(["Alt","Control","Meta","Shift"]).optional(),type:d.literal("click")}),yc=d.object({...v,locator:C,type:d.literal("fill"),value:Q}),hc=d.object({...v,locator:C,type:d.literal("select"),value:Q}),wc=d.object({...v,locator:C,type:d.literal("hover")}),bc=d.object({...v,key:d.string().min(1),locator:C.optional(),type:d.literal("press")}),vc=d.object({...v,locator:C,type:d.literal("check")}),Sc=d.object({...v,locator:C,type:d.literal("uncheck")}),kc=d.object({...v,height:d.number().int().positive(),type:d.literal("setViewport"),width:d.number().int().positive()}),Pc=d.object({...v,message:d.string().min(1),type:d.literal("fail")}),Rc=d.object({...v,type:d.literal("setVariable"),value:Ur,variable:d.string().min(1)}),xc=d.object({...v,locator:C,type:d.literal("extractText"),variable:d.string().min(1)}),Ec=d.object({...v,files:d.array(d.string()).min(1),locator:C,type:d.literal("upload")}),Cc=d.object({...v,locator:C,type:d.literal("dblclick")}),Ac=d.object({...v,source:C,target:C,type:d.literal("drag")}),Ic=d.object({...v,locator:C,type:d.literal("scrollIntoView")}),Tc=d.object({...v,locator:C,type:d.literal("type"),value:Q}),$c=d.object({...v,locator:C,type:d.literal("focus")}),jc=d.object({...v,locator:C,type:d.literal("clear")}),Nc=d.object({...v,locator:C,type:d.literal("rightClick")}),Dc=d.object({...v,action:d.enum(["accept","dismiss"]),promptText:d.string().optional(),type:d.literal("handleDialog")}),Oc=d.object({...v,action:d.enum(["read","write"]),type:d.literal("clipboard"),value:Q.optional(),variable:d.string().min(1).optional()}),Lc=d.object({...v,permission:d.string().min(1),state:d.enum(["granted","prompt"]),type:d.literal("setPermission")}),_c=d.object({...v,locator:C,type:d.literal("assertVisible")}),Uc=d.object({...v,locator:C,type:d.literal("assertNotVisible")}),Vc=d.object({...v,expected:Q,locator:C,operator:ve,type:d.literal("assertText")}),Fc=d.object({...v,expected:Q,operator:ve,type:d.literal("assertUrl")}),Mc=d.object({...v,expected:Vr,locator:C,operator:Lr,type:d.literal("assertCount")}),Hc=d.object({...v,expected:Q,locator:C,operator:ve,type:d.literal("assertValue")}),Bc=d.object({...v,attribute:d.string().min(1),expected:Q,locator:C,operator:ve,type:d.literal("assertAttribute")}),Wc=d.object({...v,locator:C,type:d.literal("assertEnabled")}),qc=d.object({...v,locator:C,type:d.literal("assertDisabled")}),zc=d.object({...v,expected:Q,operator:ve,type:d.literal("assertTitle")}),Gc=d.object({...v,locator:C,type:d.literal("assertChecked")}),Kc=d.object({...v,locator:C,type:d.literal("assertNotChecked")}),Jc=d.object({...v,locator:C,type:d.literal("assertFocused")}),Xc=d.object({...v,locator:C,type:d.literal("assertNotFocused")}),Yc=d.object({...v,budget:d.enum(["fast","slow","async"]),observer:d.string().min(1).max(200),params:d.record(d.string().max(200),Wt),type:d.literal("assertObserver")}),Ao=d.discriminatedUnion("type",[fc,gc,yc,hc,wc,bc,vc,Sc,_c,Uc,Vc,Fc,Mc,Hc,Bc,Wc,qc,kc,Pc,Rc,xc,Ec,Cc,Ac,Ic,Tc,$c,jc,Nc,Dc,Oc,Lc,zc,Gc,Kc,Jc,Xc,Yc]),Mr=d.object({entryNode:d.string().min(1).max(200),nodes:d.record(d.string().max(200),Ao).refine(e=>Object.keys(e).length<=Co,`Workflow has more than ${String(Co)} nodes`),uiOnly:d.boolean().optional(),variableNamespaces:d.record(d.string().max(200),d.string().max(500)).optional(),variables:d.record(d.string().max(200),Fr).optional()});var Qc=Io.record(Io.string().max(200),Bt),Zc={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},eu={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},qt=Or("workflow-spec").legacy(Zc).initial(Mr).build(),ru=Or("precondition-map").legacy(eu).initial(Qc).build();import{z as zt}from"zod";var To=["fast","slow","async"],tu=zt.object({budget:zt.enum(To).describe("Polling budget tier: fast | slow | async"),description:zt.string().min(1).describe("Human-readable description of what this observer checks")}).describe("A named backend state observer. Tests assert against it with assert.backend(observer, params). Implementation lives on the user's server.");function Hr(e){return e.label??`${e.type} (${e.id})`}import{graphql as ti,readFragment as Ud}from"gql.tada";function jo(){let e,r=!1;function t(o){e=o,r&&$o(o)}async function n(){r||(r=!0,e!=null&&await $o(e))}return{attachContext:t,fire:n,fired:()=>r}}async function $o(e){await e.close().catch(r=>{let t=r instanceof Error?r.message:String(r);f.warn("Failed to close browser context during abort: %s",t)})}import{mkdir as Gt,writeFile as q}from"fs/promises";import B from"path";import{z as ne}from"zod";async function j({fn:e,label:r}){let t=performance.now(),n=await e();return f.debug("%s: %dms",r,Math.round(performance.now()-t)),n}async function Do({cdpSession:e,context:r,page:t,runId:n,stepIndex:o,stepResult:i}){try{let s=B.join(process.cwd(),".ripplo","debug",n,"steps",String(o));await Gt(s,{recursive:!0});let a={assertions:i.assertions,detail:i.detail,duration:i.duration,nodeId:i.nodeId,nodeType:i.nodeType,rrwebIds:i.rrwebIds,snapshotTimestamp:i.snapshotTimestamp,status:i.status,stepIndex:i.stepIndex,title:i.title,url:i.url};await Promise.all([q(B.join(s,"info.json"),JSON.stringify(a,null,2)),iu(au({cdpSession:e,context:r,page:t,stepDir:s}),nu,`capturePageState step ${String(o)}`)])}catch(s){let a=s instanceof Error?s.message:String(s);f.warn("Failed to write step debug data for step %d: %s",o,a)}}var nu=15e3,ou=50;async function iu(e,r,t){let n,o=new Promise((i,s)=>{n=setTimeout(()=>{s(new Error(`${t} timed out after ${String(r)}ms`))},r)});try{return await Promise.race([e,o])}finally{n!=null&&clearTimeout(n)}}function su(e){return e.replaceAll(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"<script>/* stripped */</script>").replaceAll(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"<style>/* stripped */</style>")}async function au({cdpSession:e,context:r,stepDir:t}){let[n,o,i,s,a]=await Promise.all([j({label:"captureDom",fn:()=>uu(e)}),j({label:"captureAxTree",fn:()=>mu(e)}),j({label:"captureStorage",fn:()=>bu({cdpSession:e,context:r})}),j({label:"captureScreenshot",fn:()=>hu(e)}),j({label:"captureRrwebElements",fn:()=>cu(e)})]);await j({label:"writeStepFiles",fn:()=>Promise.all([q(B.join(t,"dom.html"),su(n)),q(B.join(t,"accessibility-tree.full.json"),JSON.stringify(o)),q(B.join(t,"accessibility-tree.json"),fu(o)),q(B.join(t,"storage.json"),JSON.stringify(i,null,2)),q(B.join(t,"rrweb-elements.ndjson"),a),q(B.join(t,"screenshot.png"),s)]).then(()=>{})})}var lu=`
24
- (function () {
25
- try {
26
- var rrweb = window.rrweb || globalThis.rrweb;
27
- var mirror = rrweb && rrweb.record && rrweb.record.mirror;
28
- if (!mirror || typeof mirror.getIds !== 'function') {
29
- return JSON.stringify({ __ripploError: 'rrweb mirror unavailable', hasRrweb: !!rrweb });
30
- }
31
- var SKIP_TAGS = {
32
- HTML: 1, HEAD: 1, META: 1, LINK: 1, SCRIPT: 1, STYLE: 1,
33
- NOSCRIPT: 1, TEMPLATE: 1, TITLE: 1, BASE: 1,
34
- SVG: 1, PATH: 1, G: 1, USE: 1, DEFS: 1, CIRCLE: 1, RECT: 1,
35
- POLYLINE: 1, POLYGON: 1, LINE: 1, ELLIPSE: 1, MASK: 1,
36
- CLIPPATH: 1, LINEARGRADIENT: 1, RADIALGRADIENT: 1, STOP: 1,
37
- SYMBOL: 1, FILTER: 1, FEGAUSSIANBLUR: 1, FEMERGE: 1, FEMERGENODE: 1,
38
- };
39
- var ATTR_KEEP = [
40
- 'id', 'role', 'aria-label', 'aria-labelledby',
41
- 'name', 'placeholder', 'alt', 'title', 'type', 'value', 'href',
42
- 'data-testid',
43
- ];
44
- var INTERACTIVE_TAGS = {
45
- A: 1, BUTTON: 1, INPUT: 1, TEXTAREA: 1, SELECT: 1, LABEL: 1,
46
- SUMMARY: 1, OPTION: 1, DETAILS: 1,
47
- H1: 1, H2: 1, H3: 1, H4: 1, H5: 1, H6: 1,
48
- IMG: 1, NAV: 1, MAIN: 1, ASIDE: 1, HEADER: 1, FOOTER: 1,
49
- SECTION: 1, ARTICLE: 1, FORM: 1,
50
- };
51
- var ids = mirror.getIds();
52
- var out = [];
53
- for (var j = 0; j < ids.length; j++) {
54
- var id = ids[j];
55
- var node = mirror.getNode(id);
56
- if (!node || node.nodeType !== 1) continue;
57
- var tagU = node.tagName || '';
58
- if (!tagU || SKIP_TAGS[tagU]) continue;
59
- var attrs = {};
60
- for (var a = 0; a < ATTR_KEEP.length; a++) {
61
- var key = ATTR_KEEP[a];
62
- var val = node.getAttribute ? node.getAttribute(key) : null;
63
- if (val != null && val !== '') attrs[key] = String(val);
64
- }
65
- var ownText = '';
66
- var children = node.childNodes;
67
- if (children && children.length) {
68
- for (var c = 0; c < children.length; c++) {
69
- var ch = children[c];
70
- if (ch && ch.nodeType === 3) {
71
- var t = (ch.nodeValue || '').replace(/\\s+/g, ' ').trim();
72
- if (t) ownText = ownText ? (ownText + ' ' + t) : t;
73
- }
74
- }
75
- if (ownText.length > 200) ownText = ownText.slice(0, 200);
76
- }
77
- var entry = { rrwebId: id, tag: tagU.toLowerCase() };
78
- if (Object.keys(attrs).length > 0) entry.attrs = attrs;
79
- if (ownText) entry.text = ownText;
80
- out.push(JSON.stringify(entry));
81
- }
82
- return out.join('\\n');
83
- } catch (err) {
84
- return JSON.stringify({ __ripploError: String(err && err.message ? err.message : err) });
85
- }
86
- })()
87
- `;async function cu(e){return await se({awaitPromise:!1,expression:lu,label:"captureRrwebElements",session:e,timeoutMs:void 0})??""}async function uu(e){return await se({awaitPromise:!1,expression:"document.documentElement.outerHTML",label:"captureDom",session:e,timeoutMs:void 0})??"(unable to capture DOM)"}var Br=ne.object({value:ne.unknown()}).partial(),du=ne.object({childIds:ne.array(ne.string()),description:Br,ignored:ne.boolean(),name:Br,nodeId:ne.string(),parentId:ne.string(),properties:ne.array(ne.unknown()),role:Br,value:Br}).partial(),pu=ne.object({nodes:ne.array(du)});async function mu(e){let r=await e.send("Accessibility.getFullAXTree"),t=pu.safeParse(r);return t.success?t.data:{nodes:[]}}function fu(e){return e.nodes.filter(r=>r.ignored!==!0).map(r=>gu(r)).toSorted(yu).map(r=>JSON.stringify(r)).join(`
88
- `)}function gu(e){let r=e.description?.value,t=e.value?.value;return{childIds:e.childIds??[],name:e.name?.value??"",nodeId:e.nodeId,parentId:e.parentId,properties:e.properties??[],role:e.role?.value??"",...r==null?{}:{description:r},...t==null?{}:{value:t}}}function yu(e,r){return No(e.nodeId)-No(r.nodeId)}function No(e){if(e==null)return Number.MAX_SAFE_INTEGER;let r=Number.parseInt(e,10);return Number.isFinite(r)?r:Number.MAX_SAFE_INTEGER}async function hu(e){let r=await e.send("Page.captureScreenshot",{format:"png",optimizeForSpeed:!0});return Buffer.from(r.data,"base64")}var wu=`(() => {
89
- function dump(s) {
90
- var out = {};
91
- for (var i = 0; i < s.length; i++) {
92
- var k = s.key(i);
93
- if (k != null) out[k] = s.getItem(k) || "";
94
- }
95
- return out;
96
- }
97
- return { localStorage: dump(localStorage), sessionStorage: dump(sessionStorage) };
98
- })()`;async function bu({cdpSession:e,context:r}){let[t,n]=await Promise.all([se({awaitPromise:!1,expression:wu,label:"captureStorage",session:e,timeoutMs:void 0}),r.cookies().catch(()=>[])]);return{cookies:n,localStorage:t?.localStorage??{},sessionStorage:t?.sessionStorage??{}}}async function Oo({pageEvents:e,runId:r,steps:t,summary:n}){try{let o=B.join(process.cwd(),".ripplo","debug",r);await Gt(o,{recursive:!0});let i=e.capturePerf(),s=Promise.race([e.drain(),new Promise(a=>setTimeout(a,ou))]);await Promise.all([q(B.join(o,"summary.txt"),Ru({steps:t,summary:n})),q(B.join(o,"manifest.md"),xu({steps:t,summary:n})),q(B.join(o,"console.log"),vu(e.consoleEntries)),q(B.join(o,"page-errors.log"),Su(e.pageErrors)),q(B.join(o,"events.jsonl"),Pu(e.lifecycle)),s.then(()=>q(B.join(o,"network.jsonl"),ku(e.network))),i.then(a=>q(B.join(o,"perf.json"),a==null?"":JSON.stringify(a,null,2)))]),f.info("Debug artifacts written to .ripplo/debug/%s/",r)}catch(o){let i=o instanceof Error?o.message:String(o);f.warn("Failed to write run debug summary: %s",i)}}function vu(e){return e.map(r=>{let t=r.url==null||r.url.length===0?"":` (${r.url})`;return`[${new Date(r.timestamp).toISOString()}] ${r.type.toUpperCase()}${t} ${r.text}`}).join(`
99
- `)}function Su(e){return e.map(r=>{let t=r.stack==null?"":`
100
- ${r.stack}`;return`[${new Date(r.timestamp).toISOString()}] ${r.message}${t}`}).join(`
101
-
102
- `)}function ku(e){return e.map(r=>JSON.stringify(r)).join(`
103
- `)}function Pu(e){return e.map(r=>JSON.stringify(r)).join(`
104
- `)}function Ru({steps:e,summary:r}){return[`Run ID: ${r.runId}`,`Workflow: ${r.workflowName}`,`Status: ${r.status}`,`Duration: ${String(r.duration)}ms`,`Passed: ${String(r.passCount)}`,`Failed: ${String(r.failCount)}`,"","Steps:",...e.map(n=>` [${String(n.stepIndex)}] ${n.status==="passed"?"\u2713":"\u2717"} ${n.title} (${String(n.duration)}ms) \u2014 ${n.detail??"ok"}`)].join(`
105
- `)}function xu({steps:e,summary:r}){return[`# Run ${r.runId} \u2014 ${r.workflowName}`,"",`Status: **${r.status}** \xB7 ${String(r.passCount)} passed \xB7 ${String(r.failCount)} failed \xB7 ${String(r.duration)}ms`,"","Start here:","- `summary.txt` \u2014 high-level run summary (read first).","- `error.txt` \u2014 present only when the run failed; the failure reason + stack.","- `console.log` \u2014 page console messages captured during the run.","- `page-errors.log` \u2014 uncaught page errors captured during the run.","- `network.jsonl` \u2014 one network response/failure per line, including request/response headers and bodies when available.","- `events.jsonl` \u2014 page lifecycle events (crash, dialog, navigation, popup, download, worker).","- `perf.json` \u2014 Performance API snapshot (navigation, paint, resource entries, memory).","","## Per-step artifacts","","Each `steps/<N>/` directory contains:","","- `info.json` \u2014 step metadata (title, type, duration, assertions).",'- `accessibility-tree.json` \u2014 **compact NDJSON** of the AX tree at snapshot time. One node per line, ignored nodes dropped, provenance arrays stripped. Read directly; line-oriented grep works (e.g. `grep \'"role":"button"\'`).',"- `accessibility-tree.full.json` \u2014 full Chrome DevTools AX tree. Large; slice with `sed`/`grep` if the compact view isn't enough.","- `dom.html` \u2014 full `document.documentElement.outerHTML` at snapshot time. Large; slice with `sed`/`grep`.","- `rrweb-elements.ndjson` \u2014 one JSON object per element with an rrweb mirror id, taken from the live rrweb snapshot. Line-greppable. Fields: `{ rrwebId, tag, attrs?, text? }`. `attrs` only includes referenceable attributes (id, class, role, aria-label, aria-labelledby, name, placeholder, alt, title, type, value, href, data-testid); `text` is the element's *own* text (direct text-node children only), trimmed and capped. Structural tags (html/head/script/style/meta/etc.) are skipped. **Only rrwebId values found in this file are accepted by anchored review comments \u2014 never fabricate one.**","- `screenshot.png` \u2014 PNG, readable as an image (focus rings, contrast, visible state).","- `storage.json` \u2014 cookies + localStorage + sessionStorage.","","## Slicing recipes for large files","","```","wc -c steps/*/dom.html # check sizes","sed -n '1500,1700p' steps/3/dom.html # read a line range","grep -n 'aria-label' steps/3/dom.html | head # locate then narrow",`grep '"role":"navigation"' steps/*/accessibility-tree.json`,"```","","## Steps","",...e.flatMap(t=>[`### steps/${String(t.stepIndex)} \u2014 "${t.title}" (${t.nodeType}, ${t.status}, ${String(t.duration)}ms)`,t.detail==null?"":`> ${t.detail}`,""])].join(`
106
- `)}async function Lo({error:e,runId:r,stack:t,workflowName:n}){try{let o=B.join(process.cwd(),".ripplo","debug",r);await Gt(o,{recursive:!0});let i=t==null?e:`${e}
107
-
108
- ${t}`,s=[`Run ID: ${r}`,`Workflow: ${n}`,"Status: failed","",`Error: ${e}`,"",t==null?"":`Stack trace:
109
- ${t}`].join(`
110
- `),a=[`# Run ${r} \u2014 ${n}`,"","Status: **failed**","","Run aborted before normal completion. Read:","- `error.txt` \u2014 failure reason + stack trace.","- `summary.txt` \u2014 high-level run summary.","- `steps/<N>/info.json` \u2014 per-step metadata for any steps that started before the abort.","","Per-step screenshots / DOM / accessibility-tree may be partial or missing.",""].join(`
111
- `);await Promise.all([q(B.join(o,"error.txt"),i),q(B.join(o,"summary.txt"),s),q(B.join(o,"manifest.md"),a)]),f.info("Debug error artifacts written to .ripplo/debug/%s/",r)}catch(o){let i=o instanceof Error?o.message:String(o);f.warn("Failed to write error debug artifacts: %s",i)}}import{readFileSync as Eu}from"fs";import{createRequire as Cu}from"module";import _o from"path";import{gzipSync as Au}from"zlib";var Iu=Cu(import.meta.url),Tu=Iu.resolve("rrweb"),$u=_o.join(_o.dirname(Tu),"rrweb.umd.min.cjs"),ju=Eu($u,"utf8"),Nu=[";(function() {"," try {"," if (window.__ripploRrwebLoaded) return;"," window.__ripploRrwebLoaded = true;"," window.__ripploRrwebBuffer = [];"," window.__ripploRrwebDrain = function() {"," var out = window.__ripploRrwebBuffer;"," window.__ripploRrwebBuffer = [];"," return out;"," };"," var r = window.rrweb;"," if (r == null || r.record == null) {"," console.warn('[ripplo] rrweb global not found');"," return;"," }"," function startRecording() {"," if (window.__ripploRrwebStartedAt != null) return;"," window.__ripploRrwebStartedAt = Date.now();"," var stop = r.record({"," emit: function(event) { window.__ripploRrwebBuffer.push(event); },"," recordCanvas: false,"," recordCrossOriginIframes: false,"," });"," window.__ripploRrwebStop = stop;"," window.__ripploRrwebMirror = r.record.mirror;"," }"," window.__ripploRrwebStart = startRecording;"," // Auto-start on every bootstrap run so agent-driven tests (which don't"," // emit a 'first step' signal before navigating) capture from the start."," startRecording();"," } catch (err) {"," console.error('[ripplo] rrweb bootstrap failed', err && err.message ? err.message : err);"," }","})();"].join(`
112
- `),Du=ju+`
113
- `+Nu;async function Uo({cdpSession:e,page:r}){let t,n=0;async function o(){await r.addScriptTag({content:Du})}await o(),r.on("load",()=>{o().catch(c=>{let u=c instanceof Error?c.message:String(c);f.warn("rrweb re-injection on navigation failed: %s",u)})});async function i(){await se({awaitPromise:!1,expression:"globalThis.__ripploRrwebStart && globalThis.__ripploRrwebStart()",label:"rrweb start",session:e,timeoutMs:void 0});let c=await se({awaitPromise:!1,expression:"globalThis.__ripploRrwebStartedAt",label:"rrweb startedAt",session:e,timeoutMs:void 0});typeof c=="number"&&(t??=c)}function s(){if(t!=null)return Date.now()-t}async function a(){let c=await se({awaitPromise:!1,expression:"globalThis.__ripploRrwebDrain ? globalThis.__ripploRrwebDrain() : []",label:"rrweb drain",session:e,timeoutMs:void 0})??[],u=c[0],m=c.at(-1);if(u==null||m==null)return;t??=u.timestamp;let y=t,R=c.map(O=>JSON.stringify(O)).join(`
114
- `),g={body:Au(Buffer.from(R,"utf8")),chunkIndex:n,endTimestamp:m.timestamp-y,eventCount:c.length,startTimestamp:u.timestamp-y};return n+=1,g}async function l(){await se({awaitPromise:!1,expression:"globalThis.__ripploRrwebStop && globalThis.__ripploRrwebStop()",label:"rrweb stop",session:e,timeoutMs:void 0})}return{currentOffsetMs:s,detach:l,start:i,takeChunk:a}}function Bo({cdpSession:e,page:r}){let t=[],n=[],o=[],i=[],s=[];return Ou(r,t,n),Lu(r,i),_u(r,o,s),{consoleEntries:t,lifecycle:i,network:o,pageErrors:n,capturePerf:()=>Mu(e),drain:async()=>{await Promise.allSettled(s)}}}function Ou(e,r,t){e.on("console",n=>{r.push({text:n.text(),timestamp:Date.now(),type:n.type(),url:n.location().url})}),e.on("pageerror",n=>{t.push({message:n.message,stack:n.stack,timestamp:Date.now()})})}function Lu(e,r){e.on("crash",()=>{r.push({detail:"page crashed",kind:"crash",timestamp:Date.now()})}),e.on("dialog",t=>{r.push({detail:`${t.type()}: ${t.message()}`,kind:"dialog",timestamp:Date.now()})}),e.on("framenavigated",t=>{t===e.mainFrame()&&r.push({detail:t.url(),kind:"navigation",timestamp:Date.now()})}),e.on("popup",t=>{r.push({detail:t.url(),kind:"popup",timestamp:Date.now()})}),e.on("download",t=>{r.push({detail:t.url(),kind:"download",timestamp:Date.now()})}),e.on("worker",t=>{r.push({detail:t.url(),kind:"worker",timestamp:Date.now()})})}function _u(e,r,t){e.on("response",n=>{let o=n.request();if(!Vo.has(o.resourceType()))return;let i=Fo(o,n),s=r.push(i)-1;t.push(Uu({idx:s,network:r,req:o,res:n}))}),e.on("requestfailed",n=>{Vo.has(n.resourceType())&&r.push({...Fo(n),failure:n.failure()?.errorText})})}var Vo=new Set(["fetch","xhr"]);function Fo(e,r){return{failure:void 0,method:e.method(),requestBody:e.postData()??void 0,requestHeaders:void 0,resourceType:e.resourceType(),responseBody:void 0,responseBodyError:void 0,responseHeaders:void 0,status:r?.status(),statusText:r?.statusText(),timestamp:Date.now(),url:e.url()}}async function Uu({idx:e,network:r,req:t,res:n}){let[o,i,s]=await Promise.all([Mo(t.allHeaders()),Mo(n.allHeaders()),Vu(n)]),a=r[e];a!=null&&(r[e]={...a,requestHeaders:o,responseBody:s.text,responseBodyError:s.error,responseHeaders:i})}async function Mo(e){try{return await e}catch{return}}var Ho=1500;async function Vu(e){try{return{error:void 0,text:(await Promise.race([e.body(),new Promise((t,n)=>setTimeout(()=>{n(new Error(`body read timed out after ${String(Ho)}ms`))},Ho))])).toString("utf8")}}catch(r){return{error:r instanceof Error?r.message:String(r),text:void 0}}}var Fu=`(() => {
115
- const toJSON = (e) => e.toJSON();
116
- const m = performance.memory;
117
- const memory = m == null ? null : {
118
- jsHeapSizeLimit: m.jsHeapSizeLimit,
119
- totalJSHeapSize: m.totalJSHeapSize,
120
- usedJSHeapSize: m.usedJSHeapSize,
121
- };
122
- return {
123
- memory,
124
- navigation: performance.getEntriesByType("navigation").map(toJSON),
125
- paint: performance.getEntriesByType("paint").map(toJSON),
126
- resource: performance.getEntriesByType("resource").map(toJSON),
127
- };
128
- })()`;async function Mu(e){try{return await se({awaitPromise:!1,expression:Fu,label:"capturePerf",session:e,timeoutMs:void 0})}catch(r){let t=r instanceof Error?r.message:String(r);f.warn("capturePerf failed: %s",t);return}}import{z as oe}from"zod";import Wo from"crypto";import{Webhook as Hu}from"standardwebhooks";function Se({body:e,secret:r}){let t=new Hu(r),n=`msg_${Wo.randomUUID()}`,o=new Date,i=t.sign(n,o,e),s=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":i,"webhook-timestamp":String(s)}}function Kt(){return`whsec_${Wo.randomBytes(24).toString("base64")}`}var Bu=15e4,Wu={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:12e4},fast:{backoffMs:[100,250,500,1e3],timeoutMs:5e3},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:3e4}},qu=oe.discriminatedUnion("kind",[oe.object({kind:oe.literal("pass")}),oe.object({kind:oe.literal("retry"),reason:oe.string()}),oe.object({kind:oe.literal("fail"),reason:oe.string()})]),zu=oe.object({error:oe.string().optional(),outcome:qu.optional(),success:oe.boolean()});async function qo({apiUrl:e,budget:r,observer:t,params:n,webhookSecret:o}){let i=Wu[r],s=performance.now(),a={lastReason:void 0,pollCount:0};for(;performance.now()-s<i.timeoutMs;){a.pollCount+=1;let l=await Ku({apiUrl:e,observer:t,params:n,webhookSecret:o}),c=Gu({observer:t,outcome:l,start:s,state:a});if(c!=null)return c;let u=i.timeoutMs-(performance.now()-s);if(u<=0)break;let m=Math.min(Ju({backoff:i.backoffMs,pollCount:a.pollCount}),u);await Xu(m)}return{description:`observer "${t}"`,detail:`budget "${r}" exhausted after ${String(a.pollCount)} poll(s) (${zo(s)}); last: ${a.lastReason??"no retry reason"}
129
- \u2192 /ripplo:debug \u2014 check .ripplo/debug/<runId>/ artifacts`,status:"failed"}}function Gu({observer:e,outcome:r,start:t,state:n}){return r.kind==="transport-error"?{description:`observer "${e}"`,detail:`transport error after ${String(n.pollCount)} poll(s): ${r.reason}
130
- Load \`/ripplo:setup\` skill for instructions on engine endpoint + webhook secret wiring.`,status:"failed"}:r.kind==="pass"?{description:`observer "${e}"`,detail:n.pollCount>1?`passed after ${String(n.pollCount)} polls (${zo(t)})`:void 0,status:"passed"}:r.kind==="fail"?{description:`observer "${e}"`,detail:`failed (invariant): ${r.reason} (after ${String(n.pollCount)} poll(s)) \u2014 ctx.fail stops polling immediately and is reserved for invariant violations (wrong shape, contradictory/forbidden state). For transient conditions like "not yet committed", "status not yet X", or "row not found", use ctx.retry(reason) so the runtime keeps polling until the budget expires.
131
- Load \`/ripplo:create\` skill for instructions.`,status:"failed"}:(n.lastReason=r.reason,null)}async function Ku({apiUrl:e,observer:r,params:t,webhookSecret:n}){let o=JSON.stringify({observer:r,params:t});try{let i=await fetch(`${e}/execute-observer`,{body:o,headers:{"Content-Type":"application/json",...Se({body:o,secret:n})},method:"PUT",signal:AbortSignal.timeout(Bu)});if(!i.ok){let l=await i.text().catch(()=>"");return{kind:"transport-error",reason:`status ${String(i.status)}: ${l.slice(0,200)}`}}let s=await i.json(),a=zu.safeParse(s);return a.success?!a.data.success||a.data.outcome==null?{kind:"transport-error",reason:a.data.error??"engine reported failure without outcome"}:a.data.outcome:{kind:"transport-error",reason:`invalid response shape: ${a.error.message}`}}catch(i){let s=i instanceof Error?i.message:String(i);return f.error("observer request failed: %s",s),{kind:"transport-error",reason:s}}}function Ju({backoff:e,pollCount:r}){let t=Math.min(r-1,e.length-1);return e[t]??1e3}function zo(e){return`${String(Math.round(performance.now()-e))}ms`}async function Xu(e){return new Promise(r=>setTimeout(r,e))}async function Go(e,r){try{let t=await e.elementHandle({timeout:r});if(t==null)return[];try{let n=await Jo(t);return n==null?[]:[n]}finally{await t.dispose().catch(()=>{})}}catch{return[]}}async function Ko(e){try{let r=await e.all(),n=(await Promise.all(r.map(o=>o.elementHandle({timeout:100}).catch(()=>null)))).filter(o=>o!=null);try{return(await Promise.all(n.map(i=>Jo(i)))).filter(i=>i!=null)}finally{await Promise.all(n.map(o=>o.dispose().catch(()=>{})))}}catch{return[]}}async function Jo(e){try{return await e.evaluate(t=>{let n=globalThis.__ripploRrwebMirror;if(n==null)return null;let o=n.getId(t);return typeof o=="number"&&o>0?o:null})}catch(r){let t=r instanceof Error?r.message:String(r);return f.debug("rrweb mirror lookup failed: %s",t),null}}var Wr=15e3;async function Jt({failFast:e,getRecordingOffsetMs:r,observerTransport:t,onStep:n,page:o,spec:i,variables:s}){let a=performance.now();return Qu({currentId:i.entryNode,failFast:e,getRecordingOffsetMs:r,observerTransport:t,onStep:n,page:o,runStartTime:a,spec:i,variables:s})}function Yu({onStep:e,steps:r,target:t}){r.forEach(n=>{let o={...n,stepIndex:t.length};t.push(o),e?.(o)})}async function Qu({currentId:e,failFast:r,getRecordingOffsetMs:t,observerTransport:n,onStep:o,page:i,runStartTime:s,spec:a,variables:l}){let c=[],u=l,m=e;for(;m!=null;){let y=a.nodes[m];if(y==null)throw new Error(`Node "${m}" not found in spec`);let R=m,E=Hr(y);f.info("Executing node: %s [%s]",E,y.type);let g=await Zu({getRecordingOffsetMs:t,node:y,nodeId:R,observerTransport:n,page:i,runStartTime:s,variables:u});if(Yu({onStep:o,steps:[g],target:c}),u=g.variables,r&&g.status==="failed")break;m=y.next}return{steps:c,variables:u}}async function Zu({getRecordingOffsetMs:e,node:r,nodeId:t,observerTransport:n,page:o,runStartTime:i,variables:s}){let a=performance.now(),l=e?.(),c=Hr(r),u=Wr,m="locator"in r?r.locator:void 0,y=Xo(r),R=await id({isAction:y,locator:m,page:o,timeout:u,variables:s});try{let E=await ed({node:r,observerTransport:n,page:o,timeout:u,variables:s}),g=Math.round(performance.now()-a),O=E.assertions.some(H=>H.status==="failed");R=await sd({failed:O,isAction:y,locator:m,page:o,preActionIds:R,variables:s});let P=e?.();return{assertions:E.assertions,detail:void 0,duration:g,nodeId:t,nodeType:r.type,recordingEndMs:P,recordingStartMs:l,rrwebIds:R,snapshotTimestamp:Math.round(performance.now()-i),status:O?"failed":"passed",stepIndex:0,title:c,url:o.url(),variables:E.variables}}catch(E){let g=Math.round(performance.now()-a),O=E instanceof Error?E.message:String(E),P=e?.();return{assertions:[],detail:O,duration:g,nodeId:t,nodeType:r.type,recordingEndMs:P,recordingStartMs:l,rrwebIds:R,snapshotTimestamp:Math.round(performance.now()-i),status:"failed",stepIndex:0,title:c,url:o.url(),variables:s}}}async function ed({node:e,observerTransport:r,page:t,timeout:n,variables:o}){if(Xo(e)){let s=await At({node:e,page:t,timeout:n,variables:o});return{assertions:[],variables:s.variables}}return{assertions:await td({node:e,observerTransport:r,page:t,timeout:n,variables:o}),variables:o}}function Xo(e){return["goto","click","dblclick","fill","select","hover","press","check","uncheck","clear","rightClick","handleDialog","clipboard","setPermission","setViewport","fail","setVariable","extractText","upload","drag","scrollIntoView","type","focus"].includes(e.type)}function rd(e){return e.type.startsWith("assert")}async function td({node:e,observerTransport:r,page:t,timeout:n,variables:o}){if(!rd(e))throw new Error(`Unknown node type: ${e.type}`);let i=e;switch(i.type){case"assertVisible":case"assertNotVisible":case"assertEnabled":case"assertDisabled":case"assertChecked":case"assertNotChecked":case"assertFocused":case"assertNotFocused":return od({assertNode:i,page:t,timeout:n,variables:o});case"assertText":{let s=Y({ref:i.expected,variables:o});return[await It({expected:s,locator:V({locator:i.locator,page:t,variables:o}),operator:i.operator,timeout:n})]}case"assertUrl":{let s=Y({ref:i.expected,variables:o});return[await Tt({expected:s,operator:i.operator,page:t,timeout:n})]}case"assertTitle":{let s=Y({ref:i.expected,variables:o});return[await to({expected:s,operator:i.operator,page:t,timeout:n})]}case"assertCount":{let s=Ct({ref:i.expected,variables:o});return[await $t({expected:s,locator:V({locator:i.locator,page:t,variables:o}),operator:i.operator,timeout:n})]}case"assertValue":{let s=Y({ref:i.expected,variables:o});return[await jt({expected:s,locator:V({locator:i.locator,page:t,variables:o}),operator:i.operator,timeout:n})]}case"assertAttribute":{let s=Y({ref:i.expected,variables:o});return[await no({attribute:i.attribute,expected:s,locator:V({locator:i.locator,page:t,variables:o}),operator:i.operator,timeout:n})]}case"assertObserver":{if(r==null)return[{description:`observer "${i.observer}"`,detail:"observer transport not configured \u2014 set engineUrl + webhookSecret in ripplo.config",status:"failed"}];let s={};return Object.entries(i.params).forEach(([a,l])=>{s[a]=Ar({ref:l,variables:o})}),[await qo({apiUrl:r.apiUrl,budget:i.budget,observer:i.observer,params:s,webhookSecret:r.webhookSecret})]}}}var nd={assertChecked:so,assertDisabled:io,assertEnabled:oo,assertFocused:lo,assertNotChecked:ao,assertNotFocused:co,assertNotVisible:Dt,assertVisible:Nt};async function od({assertNode:e,page:r,timeout:t,variables:n}){let o=nd[e.type];return[await o({locator:V({locator:e.locator,page:r,variables:n}),timeout:t})]}async function id({isAction:e,locator:r,page:t,timeout:n,variables:o}){return r==null||!e?[]:Go(V({locator:r,page:t,variables:o}),n)}async function sd({failed:e,isAction:r,locator:t,page:n,preActionIds:o,variables:i}){return t==null||r||e?o:Ko(V({locator:t,page:n,variables:i}))}var ad=5e3,ld=2e3;async function Xt({abort:e,baseUrl:r,browser:t,cookies:n,extraVariables:o,observerTransport:i,onRecordingChunk:s,onStep:a,runId:l,spec:c}){let u=await t.newContext({baseURL:r});e.attachContext(u),u.setDefaultTimeout(Wr),u.setDefaultNavigationTimeout(Wr),n.length>0&&await u.addCookies(n);let m=await u.newPage(),y=await u.newCDPSession(m),R=Bo({cdpSession:y,page:m}),E=await Uo({cdpSession:y,page:m});async function g(){let L=await E.takeChunk();L!=null&&s?.(L)}let O=setInterval(()=>{g().catch(L=>{let J=L instanceof Error?L.message:String(L);f.warn("rrweb chunk flush failed: %s",J)})},2e3),P=[],H=!1;function Te(L){a?.(L),H||(H=!0,E.start().catch(J=>{let z=J instanceof Error?J.message:String(J);f.warn("rrweb recorder start failed: %s",z)})),g().catch(J=>{let z=J instanceof Error?J.message:String(J);f.warn("rrweb step-boundary flush failed: %s",z)}),P.push(Do({cdpSession:y,context:u,page:m,runId:l,stepIndex:L.stepIndex,stepResult:L}))}let De=ud(o,c.variableNamespaces),pe={...Et({defs:c.variables}),...De};try{let L=await Jt({failFast:!0,getRecordingOffsetMs:E.currentOffsetMs,observerTransport:i,onStep:Te,page:m,spec:c,variables:pe});clearInterval(O);let J=L.steps.filter(ir=>ir.status==="passed").length,z=L.steps.filter(ir=>ir.status==="failed").length,Ta={duration:L.steps.reduce((ir,$a)=>ir+$a.duration,0),failCount:z,passCount:J,runId:l,status:z>0?"failed":"passed",workflowName:""};return await cd({debugCaptures:P,flushRecording:g,pageEvents:R,recorder:E,runId:l,steps:L.steps,summary:Ta}),L.steps}finally{clearInterval(O),await j({label:"cdpSession.detach",fn:()=>y.detach().catch(()=>{})}),await j({label:"context.close",fn:()=>me(u.close(),ld,"context.close").catch(L=>{let J=L instanceof Error?L.message:String(L);f.warn("Context close failed: %s",J)})})}}async function cd({debugCaptures:e,flushRecording:r,pageEvents:t,recorder:n,runId:o,steps:i,summary:s}){await j({label:"post-run cleanup",fn:()=>me(Promise.allSettled([j({label:"debugCaptures",fn:()=>Promise.allSettled(e)}),j({label:"writeRunDebugSummary",fn:()=>Oo({pageEvents:t,runId:o,steps:i,summary:s})}),j({label:"recorder detach+flush",fn:()=>n.detach().then(r).catch(a=>{let l=a instanceof Error?a.message:String(a);f.warn("Recorder detach failed: %s",l)})})]),ad,"post-run cleanup").catch(a=>{let l=a instanceof Error?a.message:String(a);f.warn("Post-run cleanup did not finish in budget: %s",l)})})}function ud(e,r){if(e==null||r==null)return{};let t=new Map;Object.entries(r).forEach(([o,i])=>{t.set(i,o)});let n={};return Object.entries(e).forEach(([o,i])=>{let s=t.get(o);s!=null&&(n[s]={...n[s],...i})}),n}var Zt=kt($r(),1);import{z as S}from"zod";var dd=S.union([S.string(),S.number(),S.boolean()]),pd=S.record(S.string(),S.record(S.string(),dd)),md=S.object({domain:S.string().optional(),expires:S.number().optional(),httpOnly:S.boolean().optional(),name:S.string(),path:S.string().optional(),sameSite:S.enum(["lax","none","strict"]).optional(),secure:S.boolean().optional(),value:S.string()}),fd=S.discriminatedUnion("ok",[S.object({cookies:S.array(md),data:pd,executed:S.array(S.string()),ok:S.literal(!0),runId:S.string()}),S.object({error:S.string(),ok:S.literal(!1),runId:S.string()})]),gd=S.object({results:S.array(fd)}),yd=S.object({results:S.array(S.object({error:S.string().optional(),ok:S.boolean(),runId:S.string()}))}),Yo=3e4;async function en({apiUrl:e,data:r,executed:t,runId:n,webhookSecret:o}){if(t.length!==0)try{await vd({apiUrl:e,webhookSecret:o}).load({data:r,preconditions:t,runId:n})}catch(i){let s=i instanceof Error?i.message:String(i);f.error("Teardown request failed: %s",s)}}async function qr({engineBaseUrl:e,preconditionNames:r,runId:t,webhookSecret:n}){let o=e.length===0?void 0:e;return o==null||r.length===0?{apiUrl:o,cookies:[],data:{},executed:[]}:hd({apiUrl:o,preconditionNames:r,runId:t,webhookSecret:n})}async function hd({apiUrl:e,preconditionNames:r,runId:t,webhookSecret:n}){return{...await wd({apiUrl:e,webhookSecret:n}).load({preconditionNames:r,runId:t}),apiUrl:e}}function rn(){Yt.clear(),Qt.clear()}var Yt=new Map;function wd({apiUrl:e,webhookSecret:r}){let t=`${e}::${r}`,n=Yt.get(t);if(n!=null)return n;let o=new Zt.default(i=>bd({apiUrl:e,keys:i,webhookSecret:r}),{cache:!1,batchScheduleFn:i=>{setTimeout(i,100)},cacheKeyFn:i=>i.runId});return Yt.set(t,o),o}async function bd({apiUrl:e,keys:r,webhookSecret:t}){let n=performance.now(),o=JSON.stringify({batch:r.map(u=>({preconditions:[...u.preconditionNames],runId:u.runId}))}),i=await fetch(`${e}/execute-preconditions`,{body:o,headers:{"Content-Type":"application/json",...Se({body:o,secret:t})},method:"PUT",signal:AbortSignal.timeout(Yo)});if(!i.ok){let u=await Pd(i),m=new Error(`execute-preconditions returned ${String(i.status)}: ${u}`);return r.map(()=>m)}let s=await i.json(),a=gd.safeParse(s);if(!a.success){let u=new Error(`execute-preconditions response has invalid shape: ${a.error.message}`);return r.map(()=>u)}let l=new URL(e).hostname,c=new Map(a.data.results.map(u=>[u.runId,u]));return f.debug({batchSize:r.length,elapsedMs:Math.round(performance.now()-n),op:"execute-preconditions"},"batched op flushed"),r.map(u=>{let m=c.get(u.runId);return m==null?new Error(`execute-preconditions response missing runId ${u.runId}`):m.ok?(f.info("Preconditions resolved: %s",m.executed.join(", ")),{cookies:m.cookies.map(y=>Ed({cookie:y,domain:l})),data:m.data,executed:m.executed}):new Error(`Precondition batch failed: ${m.error}`)})}var Qt=new Map;function vd({apiUrl:e,webhookSecret:r}){let t=`${e}::${r}`,n=Qt.get(t);if(n!=null)return n;let o=new Zt.default(i=>Sd({apiUrl:e,keys:i,webhookSecret:r}),{cache:!1,batchScheduleFn:i=>{setTimeout(i,100)},cacheKeyFn:i=>i.runId});return Qt.set(t,o),o}async function Sd({apiUrl:e,keys:r,webhookSecret:t}){let n=JSON.stringify({batch:r.map(l=>({data:l.data,preconditions:[...l.preconditions],runId:l.runId}))}),o=await fetch(`${e}/teardown-preconditions`,{body:n,headers:{"Content-Type":"application/json",...Se({body:n,secret:t})},method:"PUT",signal:AbortSignal.timeout(Yo)});if(!o.ok){let l=new Error(`teardown-preconditions returned ${String(o.status)}`);return r.map(()=>l)}let i=await o.json(),s=yd.safeParse(i);if(!s.success){let l=new Error(`teardown-preconditions response has invalid shape: ${s.error.message}`);return r.map(()=>l)}let a=new Map(s.data.results.map(l=>[l.runId,l]));return r.map(l=>{let c=a.get(l.runId);if(c==null)return new Error(`teardown-preconditions response missing runId ${l.runId}`);if(!c.ok)return new Error(`Teardown failed: ${c.error??"unknown error"}`)})}var kd=S.object({error:S.string()});async function Pd(e){let r=await e.text().catch(()=>"");if(r.length===0)return"no body";let t=Rd(r),n=t==null?null:kd.safeParse(t);return n!=null&&n.success?n.data.error:r.slice(0,500)}function Rd(e){try{return JSON.parse(e)}catch{return null}}var xd={lax:"Lax",none:"None",strict:"Strict"};function Ed({cookie:e,domain:r}){let t={domain:e.domain??r,httpOnly:e.httpOnly??!1,name:e.name,path:e.path??"/",secure:e.secure??!1,value:e.value};return e.sameSite!=null&&(t.sameSite=xd[e.sameSite]??"Lax"),e.expires!=null&&(t.expires=e.expires),t}var dr=kt($r(),1);import{graphql as Me}from"gql.tada";async function nn({config:e,runId:r}){let t=Cd(e);await t.start.load(r);let n=[];function o(c){return n.push(c.catch(()=>{})),c}function i(c){o(t.steps.load({runId:r,step:c})).catch(u=>{f.error(u,"submitRunSteps failed")})}function s(c){o(Td({chunk:c,config:e,runId:r})).catch(u=>{f.error(u,"submitRunRecordingChunk failed")})}async function a(){for(;n.length>0;){let c=n.splice(0);await Promise.all(c)}}async function l({flush:c,statusOverride:u,steps:m,summary:y}){c&&await j({label:"flushSteps",fn:()=>a()});let R=m.filter(P=>P.status==="passed").length,E=m.filter(P=>P.status==="failed").length,g=m.reduce((P,H)=>P+H.duration,0),O=u??(E>0?"failed":"passed");await j({label:"completeRun",fn:()=>t.complete.load({duration:g,failCount:E,passCount:R,runId:r,status:O,summary:y??null,warnCount:0})})}return{complete:l,enqueueRecordingChunk:s,enqueueStep:i,flushSteps:a,runId:r}}async function on({config:e,reason:r,runId:t}){await h({config:e,document:jd,variables:{reason:r,runId:t}})}var Qo=new Map,tn=new Set;async function sn(){await Promise.allSettled(tn)}function Zo(e){tn.add(e),e.finally(()=>{tn.delete(e)})}function Cd(e){let r=`${e.ripploServerUrl}::${e.token}`,t=Qo.get(r);if(t!=null)return t;let n={artifactsUploaded:new dr.default(async o=>(await zr({config:e,document:$d,opName:"markRunArtifactsUploadedBatch",size:o.length,variables:{runIds:[...o]}}),o.map(()=>!0)),{cache:!1}),complete:new dr.default(async o=>(await zr({config:e,document:Ld,opName:"completeRunsBatch",size:o.length,variables:{items:[...o]}}),o.map(()=>!0)),{cache:!1}),start:new dr.default(async o=>(await zr({config:e,document:Nd,opName:"startRunsBatch",size:o.length,variables:{runIds:[...o]}}),o.map(()=>!0)),{cache:!1,batchScheduleFn:o=>{setTimeout(o,100)}}),steps:new dr.default(async o=>(await zr({config:e,document:Dd,opName:"submitRunStepsBatch",size:o.length,variables:{items:Ad(o)}}),o.map(()=>!0)),{cache:!1,batchScheduleFn:o=>{setTimeout(o,100)}})};return Qo.set(r,n),n}async function zr({config:e,document:r,opName:t,size:n,variables:o}){let i=performance.now();await h({config:e,document:r,variables:o}),f.debug({batchSize:n,elapsedMs:Math.round(performance.now()-i),op:t},"batched op flushed")}function Ad(e){let r=new Map;return e.forEach(({runId:t,step:n})=>{let o=Id(n),i=r.get(t);if(i==null){r.set(t,[o]);return}i.push(o)}),[...r.entries()].map(([t,n])=>({runId:t,steps:n}))}function Id(e){return{assertions:e.assertions.map(r=>({description:r.description,detail:r.detail??null,status:r.status})),detail:e.detail??null,duration:e.duration,nodeType:e.nodeType,recordingEndMs:e.recordingEndMs??null,recordingStartMs:e.recordingStartMs??null,rrwebIds:[...e.rrwebIds],snapshotTimestamp:e.snapshotTimestamp,status:e.status,stepIndex:e.stepIndex,title:e.title,url:e.url}}async function Td({chunk:e,config:r,runId:t}){await h({config:r,document:Od,variables:{input:{bodyBase64:e.body.toString("base64"),chunkIndex:e.chunkIndex,endTimestamp:e.endTimestamp,eventCount:e.eventCount,runId:t,startTimestamp:e.startTimestamp}}})}var $d=Me(`
132
- mutation MarkRunArtifactsUploadedBatchCLI($runIds: [String!]!) {
133
- markRunArtifactsUploadedBatch(runIds: $runIds)
134
- }
135
- `),jd=Me(`
136
- mutation FailRunCLI($runId: String!, $reason: String!) {
137
- failRun(runId: $runId, reason: $reason)
138
- }
139
- `),Nd=Me(`
140
- mutation StartRunsBatchCLI($runIds: [String!]!) {
141
- startRunsBatch(runIds: $runIds) {
142
- id
143
- }
144
- }
145
- `),Dd=Me(`
146
- mutation SubmitRunStepsBatchCLI($items: [SubmitRunStepsItem!]!) {
147
- submitRunStepsBatch(items: $items)
148
- }
149
- `),Od=Me(`
150
- mutation SubmitRunRecordingChunkCLI($input: SubmitRunRecordingChunkInput!) {
151
- submitRunRecordingChunk(input: $input)
152
- }
153
- `),Ld=Me(`
154
- mutation CompleteRunsBatchCLI($items: [CompleteRunItem!]!) {
155
- completeRunsBatch(items: $items) {
156
- id
157
- status
158
- }
159
- }
160
- `);var Vd=12e4,Fd=15e3,ni=ti(`
161
- fragment WorkflowRun on Workflow {
162
- id
163
- slug
164
- name
165
- spec
166
- preconditions
167
- requiresKeys {
168
- namespace
169
- preconditionName
170
- }
171
- }
172
- `),Md=ti(`
173
- query RunsByIdsWorkflowSpec($ids: [String!]!) {
174
- runsByIds(ids: $ids) {
175
- id
176
- workflow {
177
- ...WorkflowRun
178
- project {
179
- id
180
- engineBaseUrl
181
- }
182
- }
183
- }
184
- }
185
- `,[ni]);async function an({baseUrl:e,browser:r,config:t,headed:n,preconditionNames:o,runId:i,webhookSecret:s}){let a="unknown",l,c,u=!1,m=jo(),y=performance.now();try{u=r==null,c=Hd({externalBrowser:r,headed:n});let R=o==null?void 0:qr({engineBaseUrl:t.engineUrl,preconditionNames:o,runId:i,webhookSecret:s}),[{engineBaseUrl:E,workflow:g},O]=await Promise.all([j({label:"Run context resolved",fn:()=>Jd({config:t,runId:i})}),j({label:"Streaming run started",fn:()=>nn({config:t,runId:i})}),_t({appUrl:e})]);a=g.name,l=O;let P=Xd(g.spec);f.info("Executing workflow: %s",g.name),await Zd(Wd({abort:m,baseUrl:e,browserPromise:c,engineBaseUrl:E,preconditionPromise:R,runId:i,specData:P,streaming:l,webhookSecret:s,workflow:g}),Qd(),m)}catch(R){throw ep(R)?R:(await me(Bd({browserPromise:c,config:t,error:R,ownsBrowser:u,runId:i,streaming:l,workflowName:a}),Fd,"post-deadline cleanup").catch(E=>{let g=E instanceof Error?E.message:String(E);f.warn("Post-deadline cleanup did not finish in budget: %s",g)}),new Gr(R))}finally{f.debug({elapsedMs:Math.round(performance.now()-y),runId:i},"run finished (totalMs=%d)",Math.round(performance.now()-y))}}var Gr=class extends Error{cause;constructor(r){let t=r instanceof Error?r.message:String(r);super(t),this.name="RunReportedError",this.cause=r}};function Hd({externalBrowser:e,headed:r}){return e!=null?Promise.resolve(e):j({label:"Browser launched",fn:()=>Ue({headed:r})})}async function Bd({browserPromise:e,config:r,error:t,ownsBrowser:n,runId:o,streaming:i,workflowName:s}){let a=t instanceof Error?t.message:String(t),l=t instanceof Error?t.stack:void 0;await Lo({error:a,runId:o,stack:l,workflowName:s}),i==null?await on({config:r,reason:a,runId:o}).catch(()=>{}):await i.complete({flush:!1,statusOverride:"failed",steps:[],summary:a}).catch(()=>{}),n&&e!=null&&await(await e.catch(()=>{}))?.close()}async function Wd({abort:e,baseUrl:r,browserPromise:t,engineBaseUrl:n,preconditionPromise:o,runId:i,specData:s,streaming:a,webhookSecret:l,workflow:c}){let u=o??qr({engineBaseUrl:n,preconditionNames:c.preconditions,runId:i,webhookSecret:l}),[m,y]=await Promise.all([u,t]);await qd({abort:e,baseUrl:r,browser:y,preconditionResult:m,runId:i,specData:s,streaming:a,webhookSecret:l})}async function qd({abort:e,baseUrl:r,browser:t,preconditionResult:n,runId:o,specData:i,streaming:s,webhookSecret:a}){let l=await j({label:"Spec executed",fn:()=>Xt({abort:e,baseUrl:r,browser:t,cookies:n.cookies,extraVariables:n.data,observerTransport:n.apiUrl==null?void 0:{apiUrl:n.apiUrl,webhookSecret:a},onRecordingChunk:s.enqueueRecordingChunk,onStep:s.enqueueStep,runId:o,spec:i})});Kd({preconditionResult:n,runId:o,webhookSecret:a}).catch(y=>{let R=y instanceof Error?y.message:String(y);f.warn("Precondition teardown failed: %s",R)});let c=s.complete({flush:!0,statusOverride:void 0,steps:l,summary:zd(l)}).catch(y=>{let R=y instanceof Error?y.message:String(y);f.warn("streaming.complete failed: %s",R)});Zo(c);let u=l.filter(y=>y.status==="passed").length,m=l.filter(y=>y.status==="failed").length;f.info("Run complete: %d passed, %d failed",u,m)}function zd(e){let r=e.find(o=>o.status==="failed");if(r==null)return;let n=r.assertions.find(o=>o.status==="failed")?.detail??r.detail;return n==null||n.length===0?r.title:`${r.title} \u2014 ${Gd(n)}`}function Gd(e){return e.split(`
186
- `,1)[0]??e}async function Kd({preconditionResult:e,runId:r,webhookSecret:t}){e.apiUrl!=null&&await en({apiUrl:e.apiUrl,data:e.data,executed:e.executed,runId:r,webhookSecret:t})}async function Jd({config:e,runId:r}){let t=await rp(e).load(r);if(t.workflow==null)throw new Error(`Run ${r} not found`);let n=Ud(ni,t.workflow),o=t.workflow.project?.engineBaseUrl??"";return{engineBaseUrl:e.engineUrl.length>0?e.engineUrl:o,workflow:n}}function Xd(e){if(e==null)throw new Error("Workflow has no spec");return qt.decode(e)}var Yd=_d.coerce.number().int().positive().catch(Vd);function Qd(){return Yd.parse(process.env.RIPPLO_RUN_TIMEOUT_MS)}async function Zd(e,r,t){let n,o=new Promise((i,s)=>{n=setTimeout(()=>{t.fire(),s(new Error(`Run timed out after ${String(r)}ms`))},r)});try{await Promise.race([e,o])}finally{n!=null&&clearTimeout(n)}}function ep(e){return e instanceof Ve?e.errors.some(r=>r.extensions?.code==="THROTTLED"):!1}var ei=new Map;function rp(e){let r=`${e.ripploServerUrl}::${e.token}`,t=ei.get(r);if(t!=null)return t;let n=new ri.default(async o=>{let i=performance.now(),s=await h({config:e,document:Md,variables:{ids:[...o]}}),a=new Map(s.runsByIds?.map(l=>[l.id,l])??[]);return f.debug({batchSize:o.length,elapsedMs:Math.round(performance.now()-i),op:"runsByIds"},"batched op flushed"),o.map(l=>a.get(l)??new Error(`Run ${l} not found`))},{cache:!1,batchScheduleFn:o=>{setTimeout(o,100)}});return ei.set(r,n),n}import gr from"fs";import je from"fs";import tp from"os";import pr from"path";var np=".local",op=".ripplo";function ln(e){return pr.join(e,".ripplo",np)}function mr(e){let r=ln(e);je.existsSync(r)||je.mkdirSync(r,{recursive:!0});let t=pr.join(r,".gitignore");return je.existsSync(t)||je.writeFileSync(t,`*
187
- `),r}function fr(e,r){return pr.join(ln(e),r)}function cn(){return pr.join(tp.homedir(),op)}function un(){let e=cn();return je.existsSync(e)?je.chmodSync(e,448):je.mkdirSync(e,{mode:448,recursive:!0}),e}function ke(e){return pr.join(cn(),e)}function ie(){let e=process.env.RIPPLO_TOKEN;if(e!=null&&e.trim().length>0)return e.trim();let r=ke("token");if(!gr.existsSync(r))return null;let t=gr.readFileSync(r,"utf8").trim();return t.length===0?null:t}function dn(e){un(),gr.writeFileSync(ke("token"),e+`
188
- `,{mode:384})}function pn(){let e=ke("token");return gr.existsSync(e)?(gr.unlinkSync(e),!0):!1}import{graphql as yr}from"gql.tada";var Zk=yr(`
189
- query AgentReviewContextWorker($reviewId: String!) {
190
- agentReview(id: $reviewId) {
191
- id
192
- runId
193
- agentProfile {
194
- id
195
- name
196
- description
197
- output
198
- successCriteria
199
- }
200
- }
201
- }
202
- `);var eP=yr(`
203
- mutation StartAgentReviewWorker($reviewId: String!) {
204
- startAgentReview(reviewId: $reviewId)
205
- }
206
- `);var rP=yr(`
207
- mutation CompleteAgentReviewWorker(
208
- $reviewId: String!
209
- $markdown: String!
210
- $shortSummary: String!
211
- $comments: [AgentReviewCommentInput!]!
212
- ) {
213
- completeAgentReview(
214
- reviewId: $reviewId
215
- markdown: $markdown
216
- shortSummary: $shortSummary
217
- comments: $comments
218
- )
219
- }
220
- `);var tP=yr(`
221
- mutation UpdateAgentReviewProgressWorker($reviewId: String!, $text: String!) {
222
- updateAgentReviewProgress(reviewId: $reviewId, text: $text)
223
- }
224
- `);var nP=yr(`
225
- mutation FailAgentReviewWorker($reviewId: String!, $reason: String!) {
226
- failAgentReview(reviewId: $reviewId, reason: $reason)
227
- }
228
- `);import si from"fs";import Xr from"path";import{config as ap}from"dotenv";import{z as Jr}from"zod";import hr from"fs";import fn from"path";import{z as Kr}from"zod";var oi=fn.join(".ripplo","project.json"),mn=[".env",".env.local"],ip=Kr.object({envFiles:Kr.array(Kr.string().min(1)).optional(),projectId:Kr.string().min(1)});function gn(e){return fn.join(e,oi)}function yn(e){let r=gn(e);if(!hr.existsSync(r))throw new Error(`ripplo: missing ${oi}. Run \`ripplo init\` to create it.`);let t=JSON.parse(hr.readFileSync(r,"utf8")),n=ip.parse(t);return{envFiles:n.envFiles??mn,projectId:n.projectId}}function hn(e){let r=gn(e);if(hr.existsSync(r))try{return yn(e)}catch{return}}function ii({cwd:e,envFiles:r,projectId:t}){let n=gn(e);hr.mkdirSync(fn.dirname(n),{recursive:!0});let o={projectId:t};r!=null&&!sp(r)&&(o.envFiles=[...r]),hr.writeFileSync(n,JSON.stringify(o,null,2)+`
229
- `)}function sp(e){return e.length!==mn.length?!1:e.every((r,t)=>r===mn[t])}function Yr(e){let t=hn(e)?.envFiles??[".env",".env.local"],n=Xr.join(e,".ripplo");t.forEach(o=>{let i=Xr.resolve(n,o);si.existsSync(i)&&ap({override:!0,path:i,quiet:!0})}),wn=void 0}var lp=Jr.object({RIPPLO_APP_URL:Jr.url(),RIPPLO_ENGINE_URL:Jr.url(),RIPPLO_WEBHOOK_SECRET:Jr.string().min(1)}),wn;function He(){return wn??=cp(),wn}function cp(){let e=lp.safeParse(process.env);if(!e.success){let t=e.error.issues.map(s=>` ${s.path.join(".")}: ${s.message}`).join(`
230
- `),n=bn(process.cwd()),o=n.map(s=>` ${s}`).join(`
231
- `),i=n.length>0?`
232
-
233
- Declared env file(s) not found at this path:
234
- ${o}
235
- 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).`:"";throw new Error(`ripplo: env config invalid:
236
- ${t}
237
-
238
- Add missing values to the env file(s) declared in .ripplo/project.json.${i}`)}let r=e.data;return{appUrl:r.RIPPLO_APP_URL,engineUrl:r.RIPPLO_ENGINE_URL,webhookSecret:r.RIPPLO_WEBHOOK_SECRET}}function bn(e){let t=hn(e)?.envFiles??[],n=Xr.join(e,".ripplo");return t.map(o=>Xr.resolve(n,o)).filter(o=>!si.existsSync(o))}import gb from"yargs";import{hideBin as yb}from"yargs/helpers";import{graphql as Rp}from"gql.tada";import{exec as fp}from"child_process";import{createAuthClient as up}from"better-auth/client";import{deviceAuthorizationClient as dp}from"better-auth/client/plugins";function ai({baseURL:e}){return up({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[dp()]})}import{z as vn}from"zod";var pp="https://ripplo.ai";function ee(){return Qr().RIPPLO_SERVER_URL}function ci(){return Qr().RIPPLO_PROJECT_ID}var mp=vn.object({RIPPLO_PROJECT_ID:vn.string().min(1).optional(),RIPPLO_SERVER_URL:vn.string().min(1).default(pp)}),li;function Qr(){return li??=mp.parse(process.env),li}var gp=5e3,ui="ripplo-cli";async function di({onDeviceCode:e,url:r}){let t=r??Qr().RIPPLO_SERVER_URL,n=ai({baseURL:t}),o=await n.device.code({client_id:ui});if(o.error!=null)throw new Error(`Failed to request device code: ${o.error.error_description}`);let{device_code:i,user_code:s,verification_uri_complete:a}=o.data;e({userCode:s,verificationUrl:a}),Sp(a);let l=await yp({authClient:n,deviceCode:i});return dn(l),l}async function yp({authClient:e,deviceCode:r}){for(;;){await bp(gp);let t=await e.device.token({client_id:ui,device_code:r,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(t.data?.access_token!=null)return t.data.access_token;if(t.error==null)continue;if(!wp(t.error.error))throw new Error(`Authorization failed: ${t.error.error_description}`)}}var hp=new Set(["authorization_pending","slow_down"]);function wp(e){return hp.has(e)}function bp(e){return new Promise(r=>{setTimeout(r,e)})}function vp(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function Sp(e){let r=vp();fp(`${r} "${e}"`,()=>{})}function Pe({serverUrl:e,token:r}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:r,webhookSecret:""}}import kp from"fs";import Pp from"path";function A(e){return kp.existsSync(Pp.join(e,".ripplo"))}var xp=Rp(`
2
+ var qC=Object.create;var Af=Object.defineProperty;var KC=Object.getOwnPropertyDescriptor;var YC=Object.getOwnPropertyNames;var JC=Object.getPrototypeOf,ZC=Object.prototype.hasOwnProperty;var zr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var XC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YC(t))!ZC.call(e,i)&&i!==r&&Af(e,i,{get:()=>t[i],enumerable:!(n=KC(t,i))||n.enumerable});return e};var ro=(e,t,r)=>(r=e!=null?qC(JC(e)):{},XC(t||!e||!e.__esModule?Af(r,"default",{value:e,enumerable:!0}):r,e));var $f=zr(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.timingSafeEqual=void 0;function Lf(e,t=""){if(!e)throw new Error(t)}function CR(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)),Lf(e instanceof DataView),Lf(t instanceof DataView);let r=e.byteLength,n=0,i=-1;for(;++i<r;)n|=e.getUint8(i)^t.getUint8(i);return n===0}oo.timingSafeEqual=CR});var jf=zr(rt=>{"use strict";var RR=rt&&rt.__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(rt,"__esModule",{value:!0});var $e=256,fl=(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})();rt.Coder=fl;var Bn=new fl;function ER(e){return Bn.encode(e)}rt.encode=ER;function IR(e){return Bn.decode(e)}rt.decode=IR;var Df=(function(e){RR(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})(fl);rt.URLSafeCoder=Df;var _f=new Df;function AR(e){return _f.encode(e)}rt.encodeURLSafe=AR;function PR(e){return _f.decode(e)}rt.decodeURLSafe=PR;rt.encodedLength=function(e){return Bn.encodedLength(e)};rt.maxDecodedLength=function(e){return Bn.maxDecodedLength(e)};rt.decodedLength=function(e){return Bn.decodedLength(e)}});var Vf=zr((Ff,so)=>{"use strict";(function(e,t){var r={};t(r);var n=r.default;for(var i in r)n[i]=r[i];typeof so=="object"&&typeof so.exports=="object"?so.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(Ff,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 ml=zr(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.Webhook=Gr.WebhookVerificationError=void 0;var TR=$f(),Bf=jf(),OR=Vf(),Uf=300,hl=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},er=class e extends hl{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};Gr.WebhookVerificationError=er;var ao=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=Bf.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 er("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,TR.timingSafeEqual)(d.encode(f),d.encode(c)))return JSON.parse(t.toString())}throw new er("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,${Bf.encode(OR.hmac(this.key,s))}`}verifyTimestamp(t){let r=Math.floor(Date.now()/1e3),n=parseInt(t,10);if(isNaN(n))throw new er("Invalid Signature Headers");if(r-n>Uf)throw new er("Message timestamp too old");if(n>r+Uf)throw new er("Message timestamp too new");return new Date(n*1e3)}};Gr.Webhook=ao;ao.prefix="whsec_"});var hm=zr((rc,fm)=>{"use strict";var{hasOwnProperty:Jn}=Object.prototype,Or=tc();Or.configure=tc;Or.stringify=Or;Or.default=Or;rc.stringify=Or;rc.configure=tc;fm.exports=Or;var PI=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function lr(e){return e.length<5e3&&!PI.test(e)?`"${e}"`:JSON.stringify(e)}function Ql(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 TI=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function ec(e){return TI.call(e)!==void 0&&e.length!==0}function dm(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 OI(e){if(Jn.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 MI(e){let t;if(Jn.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 NI(e,t){let r;if(Jn.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 pm(e,t){let r;if(Jn.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 Tr(e){return e===1?"1 item":`${e} items`}function LI(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function $I(e){if(Jn.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 tc(e){e={...e};let t=$I(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=OI(e),n=NI(e,"bigint"),i=MI(e),o=typeof i=="function"?i:void 0,s=pm(e,"maximumDepth"),a=pm(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 lr(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
+ ${S}`,C=`,
4
+ ${S}`);let Q=Math.min(y.length,a),j=0;for(;j<Q-1;j++){let xt=l(String(j),y,m,g,w,S);v+=xt!==void 0?xt:"null",v+=C}let ze=l(String(j),y,m,g,w,S);if(v+=ze!==void 0?ze:"null",y.length-1>a){let xt=y.length-a-1;v+=`${C}"... ${Tr(xt)} not stringified"`}return w!==""&&(v+=`
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&&!ec(y)&&(R=Ql(R,o)),m.push(y);for(let Q=0;Q<X;Q++){let j=R[Q],ze=l(j,y,m,g,w,S);ze!==void 0&&(v+=`${U}${lr(j)}:${x}${ze}`,U=C)}if(E>a){let Q=E-a;v+=`${U}"...":${x}"${Tr(Q)} not stringified"`,U=C}return w!==""&&U.length>1&&(v=`
7
+ ${S}${v}
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 lr(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
+ ${S}`,C=`,
10
+ ${S}`);let E=Math.min(f.length,a),x=0;for(;x<E-1;x++){let X=c(String(x),f[x],m,g,w,S);v+=X!==void 0?X:"null",v+=C}let U=c(String(x),f[x],m,g,w,S);if(v+=U!==void 0?U:"null",f.length-1>a){let X=f.length-a-1;v+=`${C}"... ${Tr(X)} not stringified"`}return w!==""&&(v+=`
11
+ ${y}`),m.pop(),`[${v}]`}m.push(f);let M="";w!==""&&(S+=w,C=`,
12
+ ${S}`,M=" ");let R="";for(let E of g){let x=c(E,f[E],m,g,w,S);x!==void 0&&(v+=`${R}${lr(E)}:${M}${x}`,R=C)}return w!==""&&R.length>1&&(v=`
13
+ ${S}${v}
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 lr(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
+ ${w}`,U=`,
16
+ ${w}`,X=Math.min(f.length,a),Q=0;for(;Q<X-1;Q++){let ze=u(String(Q),f[Q],m,g,w);x+=ze!==void 0?ze:"null",x+=U}let j=u(String(Q),f[Q],m,g,w);if(x+=j!==void 0?j:"null",f.length-1>a){let ze=f.length-a-1;x+=`${U}"... ${Tr(ze)} not stringified"`}return x+=`
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);ec(f)&&(M+=dm(f,C,a),y=y.slice(f.length),E-=f.length,R=C),i&&(y=Ql(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}${lr(U)}: ${X}`,R=C)}if(v>a){let x=v-a;M+=`${R}"...": "${Tr(x)} not stringified"`,R=C}return R!==""&&(M=`
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 lr(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+=`,"... ${Tr(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&&ec(f)&&(g+=dm(f,",",a),S=S.slice(f.length),C-=f.length,v=","),i&&(S=Ql(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}${lr(R)}:${E}`,v=",")}if(y>a){let M=y-a;g+=`${v}"...":"${Tr(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,[],LI(f),g,"")}if(g.length!==0)return u("",h,[],g,"")}return d("",h,[])}return p}});var Og=zr(($Y,qc)=>{"use strict";var zo=process||{},Pg=zo.argv||[],Ho=zo.env||{},WT=!(Ho.NO_COLOR||Pg.includes("--no-color"))&&(!!Ho.FORCE_COLOR||Pg.includes("--color")||zo.platform==="win32"||(zo.stdout||{}).isTTY&&Ho.TERM!=="dumb"||!!Ho.CI),HT=(e,t,r=e)=>n=>{let i=""+n,o=i.indexOf(t,e.length);return~o?e+zT(i,t,r,o)+t:e+i+t},zT=(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)},Tg=(e=WT)=>{let t=e?HT:()=>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")}};qc.exports=Tg();qc.exports.createColors=Tg});import{execFileSync as QC}from"child_process";import eR from"fs";import no from"path";function al(e){let t=rR(e);return t??Pf(e)}function Pf(e){let t=no.dirname(e);return tR(no.join(e,".ripplo"))?e:t===e?null:Pf(t)}function tR(e){try{return eR.statSync(e).isDirectory()}catch{return!1}}function rR(e){let t=nR(["rev-parse","--show-toplevel"],e);if(t==null)return null;let r=t.trim();return r.length===0?null:no.isAbsolute(r)?r:no.resolve(e,r)}function nR(e,t){try{return QC("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}import{readdir as oR,rm as sR,stat as aR}from"fs/promises";import Mf from"path";import iR from"pino";var F=iR({level:process.env.LOG_LEVEL??"info",transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}});var Tf=Mf.join(process.cwd(),".ripplo","debug"),Of=360*60*1e3;async function io({maxRuns:e}){try{let r=(await oR(Tf,{withFileTypes:!0})).filter(c=>c.isDirectory()),n=Date.now(),i=await Promise.all(r.map(async c=>{let u=Mf.join(Tf,c.name),d=await aR(u);return{dirPath:u,mtime:d.mtimeMs}})),o=i.filter(c=>n-c.mtime>Of),a=i.filter(c=>n-c.mtime<=Of).toSorted((c,u)=>u.mtime-c.mtime).slice(e),l=[...o,...a];if(l.length===0)return;await Promise.allSettled(l.map(c=>sR(c.dirPath,{force:!0,recursive:!0}))),F.debug("Pruned %d old debug run(s)",l.length)}catch{F.warn("Debug run pruning failed, ignoring")}}import{print as lR}from"graphql";var cR=15e3,Dn=class extends Error{errors;constructor(t){super(t.map(r=>r.message).join(", ")),this.name="GqlRequestError",this.errors=t}};function _n(e){if(e instanceof Dn)return e.errors[0]?.extensions?.code}async function D(e){let t=lR(e.document),r=JSON.stringify({query:t,variables:e.variables}),n=`${e.config.ripploServerUrl}/graphql`,i;try{i=await fetch(n,{body:r,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST",signal:AbortSignal.timeout(cR)})}catch(s){let a=s instanceof Error?s.message:String(s);throw new Error(`Failed to connect to Ripplo server at ${e.config.ripploServerUrl}. Check the server is running and reachable. Details: ${a}`)}let o=await uR({res:i,url:n});if(!dR(o))throw new Error("Invalid GraphQL response");if(pR(o))throw new Dn(o.errors);if(o.data==null)throw new Error("No data returned from server");return o.data}async function uR({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 dR(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function pR(e){return Array.isArray(e.errors)&&e.errors.length>0}import Vn from"fs";import Pr from"fs";import fR from"os";import jn from"path";var hR=".local",mR=".ripplo";function ll(e){return jn.join(e,".ripplo",hR)}function Ot(e){let t=ll(e);Pr.existsSync(t)||Pr.mkdirSync(t,{recursive:!0});let r=jn.join(t,".gitignore");return Pr.existsSync(r)||Pr.writeFileSync(r,`*
21
+ `),t}function Qt(e,t){return jn.join(ll(e),t)}function cl(){return jn.join(fR.homedir(),mR)}function Fn(){let e=cl();return Pr.existsSync(e)?Pr.chmodSync(e,448):Pr.mkdirSync(e,{mode:448,recursive:!0}),e}function Ct(e){return jn.join(cl(),e)}function lt(){let e=process.env.RIPPLO_TOKEN;if(e!=null&&e.trim().length>0)return e.trim();let t=Ct("token");if(!Vn.existsSync(t))return null;let r=Vn.readFileSync(t,"utf8").trim();return r.length===0?null:r}function ul(e){Fn(),Vn.writeFileSync(Ct("token"),e+`
22
+ `,{mode:384})}function dl(){let e=Ct("token");return Vn.existsSync(e)?(Vn.unlinkSync(e),!0):!1}import{Agent as gR,RetryAgent as yR,setGlobalDispatcher as bR}from"undici";var wR=1500,SR=4e3,vR=3,xR=50,kR=100,Nf=!1;function pl(){if(Nf)return;Nf=!0;let e=new gR({connections:kR,keepAliveMaxTimeout:SR,keepAliveTimeout:wR}),t=new yR(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:vR,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:xR});bR(t)}var Hf=ro(ml(),1);import Wf from"crypto";function gl({body:e,secret:t}){let r=new Hf.Webhook(t),n=`msg_${Wf.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 yl(){return`whsec_${Wf.randomBytes(24).toString("base64")}`}import Kf from"fs";import fo from"path";import{config as DR}from"dotenv";import{z as uo}from"zod";import{err as _R,ok as Yf}from"neverthrow";import co from"fs";import Sl from"path";import{err as bl,ok as zf}from"neverthrow";import{z as lo}from"zod";var MR=Sl.join(".ripplo","project.json"),wl=[".env",".env.local"],NR=lo.object({envFiles:lo.array(lo.string().min(1)).optional(),projectId:lo.string().min(1)});function Gf(e){return Sl.join(e,MR)}function vl(e){let t=Gf(e);return co.existsSync(t)?LR(t).andThen(r=>{let n=NR.safeParse(r);return n.success?zf({envFiles:n.data.envFiles??wl,projectId:n.data.projectId}):bl({issues:n.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`),kind:"project-file-invalid",path:t})}):bl({kind:"project-file-missing",path:t})}function xl(e){return vl(e).match(t=>t,()=>{})}function LR(e){try{return zf(JSON.parse(co.readFileSync(e,"utf8")))}catch(t){return bl({issues:[t instanceof Error?t.message:String(t)],kind:"project-file-invalid",path:e})}}function qf({cwd:e,envFiles:t,projectId:r}){let n=Gf(e);co.mkdirSync(Sl.dirname(n),{recursive:!0});let i={projectId:r};t!=null&&!$R(t)&&(i.envFiles=[...t]),co.writeFileSync(n,JSON.stringify(i,null,2)+`
23
+ `)}function $R(e){return e.length!==wl.length?!1:e.every((t,r)=>t===wl[r])}function qr(e){let r=xl(e)?.envFiles??[".env",".env.local"],n=fo.join(e,".ripplo");r.forEach(i=>{let o=fo.resolve(n,i);Kf.existsSync(o)&&DR({override:!0,path:o,quiet:!0})}),po=void 0}var jR=uo.object({RIPPLO_APP_URL:uo.url(),RIPPLO_ENGINE_URL:uo.url(),RIPPLO_WEBHOOK_SECRET:uo.string().min(1)}),po;function Kr(){return po!=null?Yf(po):FR().map(e=>(po=e,e))}function kl(e){let r=xl(e)?.envFiles??[],n=fo.join(e,".ripplo");return r.map(i=>fo.resolve(n,i)).filter(i=>!Kf.existsSync(i))}function FR(){let e=jR.safeParse(process.env);if(!e.success)return _R({issues:e.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"env-invalid",missingEnvFiles:kl(process.cwd())});let t=e.data;return Yf({appUrl:t.RIPPLO_APP_URL,engineUrl:t.RIPPLO_ENGINE_URL,webhookSecret:t.RIPPLO_WEBHOOK_SECRET})}import QW from"yargs";import{hideBin as eH}from"yargs/helpers";import{readFileSync as VR}from"fs";import{z as Jf}from"zod";var BR=Jf.object({version:Jf.string()});function Zf(){let e=VR(new URL("../package.json",import.meta.url),"utf8");return BR.parse(JSON.parse(e)).version}var ho=class extends Error{failure;constructor(t){super(t.kind),this.name="CliError",this.failure=t}};import Ul from"fs";import ko from"path";import{createJiti as dE}from"jiti";import{err as Co,ok as gh}from"neverthrow";import{z as I}from"zod";var Cl=I.enum(["fast","slow","async"]),Yr=I.object({ref:I.string().min(1)}),tr=I.union([I.string(),I.number(),I.boolean()]),Rl=I.object({template:I.array(I.union([I.string(),Yr])).min(1)}),Xe=I.union([Yr,tr,Rl,I.null()]),Xf=I.object({kind:I.literal("changed")}),El=I.union([Xe,Xf]),Mt=I.union([I.string(),Yr,Rl]),UR=I.object({by:I.literal("role"),name:I.union([Mt,I.undefined()]).optional().transform(e=>e),role:I.string().min(1)}),WR=I.object({by:I.literal("testId"),value:Mt}),HR=I.object({by:I.literal("inside"),scope:I.lazy(()=>Pe),target:I.lazy(()=>Pe)}),Pe=I.discriminatedUnion("by",[UR,WR,HR]),mo=I.enum(["string","number","boolean"]),Il=I.enum(["strict","eventual"]),zR=I.object({kind:I.literal("string"),maxLength:I.number().int().positive().optional(),minLength:I.number().int().nonnegative().optional(),pattern:I.string().optional()}),GR=I.object({kind:I.literal("number"),max:I.number().int().optional(),min:I.number().int().optional()}),qR=I.object({kind:I.literal("datetime"),maxOffsetDays:I.number().int(),minOffsetDays:I.number().int()}),Qf=I.discriminatedUnion("kind",[zR,GR,qR]),eh=I.enum(["company.name","date.iso","internet.email","internet.url","person.fullName","lorem.slug","lorem.word"]),Al=I.object({constraints:Qf.optional(),generator:eh,name:I.string().min(1),type:mo,values:I.array(tr).min(1).optional()}),th=I.object({consistency:Il.default("strict"),optional:I.boolean(),stable:I.boolean(),type:mo,valueSpace:I.string().min(1).optional()}),Pl=I.enum(["backend","client"]),Tl=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),th),source:Pl.default("backend")}),Ol=I.object({consistency:Il.default("strict"),default:tr,description:I.string().optional(),name:I.string().min(1),source:Pl.default("backend"),type:mo,valueSpace:I.string().min(1).optional()}),Nt=I.enum(["url","title","viewport"]);import{z as P}from"zod";var KR=P.discriminatedUnion("kind",[P.object({as:P.string().min(1),kind:P.literal("created"),props:P.record(P.string().min(1),Xe)}),P.object({as:P.string().min(1),kind:P.literal("updated"),props:P.record(P.string().min(1),El)}),P.object({kind:P.literal("deleted")})]),YR=P.object({kind:P.literal("is"),value:Xe}),rh=P.lazy(()=>P.union([Xe,ZR])),JR=P.object({entity:P.string().min(1),where:P.record(P.string().min(1),rh)}),ZR=P.object({field:P.string().min(1),kind:P.literal("within"),selection:JR}),Lt=P.union([Cl,P.undefined()]).optional().transform(e=>e),rr=P.lazy(()=>P.discriminatedUnion("kind",[P.object({kind:P.literal("visible"),locator:Pe,wait:Lt}),P.object({kind:P.literal("disabled"),locator:Pe,wait:Lt}),P.object({kind:P.literal("enabled"),locator:Pe,wait:Lt}),P.object({kind:P.literal("focused"),locator:Pe,wait:Lt}),P.object({kind:P.literal("value"),locator:Pe,value:Mt,wait:Lt}),P.object({kind:P.literal("text"),locator:Pe,value:Mt,wait:Lt}),P.object({assertion:YR,kind:P.literal("singleton"),singleton:P.string().min(1),wait:Lt}),P.object({kind:P.literal("browser"),name:Nt,value:Mt,wait:Lt}),P.object({assertion:KR,entity:P.string().min(1),key:P.record(P.string().min(1),rh),kind:P.literal("state"),wait:Lt}),P.object({kind:P.literal("not"),predicate:rr}),P.object({kind:P.literal("and"),predicates:P.array(rr)}),P.object({entity:P.string().min(1),kind:P.literal("count"),value:P.number().int().nonnegative()}),P.object({condition:rr,consequence:rr,kind:P.literal("when"),otherwise:P.union([rr,P.undefined()]).optional().transform(e=>e)})]));import{z as go}from"zod";var XR=go.object({__codec:go.string().min(1),data:go.unknown(),version:go.number().int().positive()}),yo=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}},bo=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}};function Ml({name:e,schema:t}){return{currentVersion:1,name:e,decode:r=>QR({name:e,raw:r,schema:t}),encode:r=>({__codec:e,data:r,version:1})}}function $t(e,t){return JSON.stringify(e.encode(t))}function Nl(e,t){let r=JSON.parse(t);return e.decode(r)}function QR({name:e,raw:t,schema:r}){let n=XR.parse(t);if(n.__codec!==e)throw new bo({expected:e,got:n.__codec});if(n.version!==1)throw new yo({codec:e,currentVersion:1,gotVersion:n.version});return r.parse(n.data)}var wo="__ripplo__",Ll="__ripplo_seed__";import{z as A}from"zod";var nh=A.discriminatedUnion("kind",[A.object({kind:A.literal("goto"),url:Mt}),A.object({kind:A.literal("fill"),locator:Pe,value:Xe}),A.object({kind:A.literal("clear"),locator:Pe}),A.object({kind:A.literal("click"),locator:Pe}),A.object({kind:A.literal("dblclick"),locator:Pe}),A.object({kind:A.literal("select"),locator:Pe,value:Xe}),A.object({kind:A.literal("check"),locator:Pe}),A.object({kind:A.literal("uncheck"),locator:Pe}),A.object({kind:A.literal("hover"),locator:Pe}),A.object({files:A.array(A.string().min(1)).min(1),kind:A.literal("upload"),locator:Pe}),A.object({key:A.string().min(1),kind:A.literal("press"),locator:Pe.optional()})]),ih=A.object({action:nh,expect:A.array(rr).default([])}),oh=A.object({example:tr.optional(),valueSpace:A.string().min(1)}),$l=A.object({as:A.string().min(1),entity:A.string().min(1),set:A.record(A.string().min(1),Xe)}),sh=A.object({entity:A.string().min(1),where:A.record(A.string().min(1),Xe)}),ah=A.object({absent:A.array(sh).default([]),exclusive:A.array(A.string().min(1)).default([]),intent:A.string().min(1),maybe:A.array($l).default([]),name:A.string().min(1),params:A.record(A.string().min(1),oh),singletons:A.record(A.string().min(1),Xe).default({}),sourcePath:A.string().min(1).optional(),steps:A.array(ih).default([]),stub:A.boolean().default(!1),world:A.array($l).default([])}),lh=A.object({sha256:A.string().regex(/^[0-9a-f]{64}$/u),size:A.number().int().nonnegative()}),So=A.object({entities:A.array(Tl),fixtures:A.record(A.string().min(1),lh).default({}),singletons:A.array(Ol).default([]),tests:A.array(ah),valueSpaces:A.array(Al)}),pt=Ml({name:"ripplo-lockfile",schema:So});import{z as nr}from"zod";var ch=nr.object({index:nr.number().int().nonnegative(),kind:nr.string(),target:nr.string(),value:nr.string()}),eE=nr.object({steps:nr.array(ch),stub:nr.boolean().default(!1)});function Un(e,t){return{index:t,kind:e.action.kind,target:tE(e.action),value:rE(e.action)}}function Re(e){return e.toLowerCase().replaceAll(/[^a-z0-9]/g,"-").split("-").filter(t=>t.length>0).join("-")}function tE(e){return e.kind==="goto"?vo(e.url):e.kind==="press"&&e.locator==null?"":xo(e.locator)}function vo(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:e.template.map(t=>typeof t=="string"?t:`{${t.ref}}`).join("")}function xo(e){return e.by==="testId"?`testId=${vo(e.value)}`:e.by==="inside"?`${xo(e.scope)} \u25B8 ${xo(e.target)}`:`${e.role} ${e.name==null?"":vo(e.name)}`.trim()}function rE(e){return e.kind==="fill"||e.kind==="select"?nE(e.value):e.kind==="press"?e.key:""}function nE(e){return e==null?"":typeof e!="object"?String(e):vo(e)}import{z as Te}from"zod";var uh=Te.enum(["Strict","Lax","None"]),dh=Te.object({domain:Te.string().min(1),expires:Te.number(),httpOnly:Te.boolean(),name:Te.string().min(1),path:Te.string().min(1),sameSite:uh,secure:Te.boolean(),value:Te.string()}),ph=Te.object({localStorage:Te.array(Te.object({name:Te.string().min(1),value:Te.string()})),origin:Te.string().min(1)}),Dl=Te.object({cookies:Te.array(dh),headers:Te.record(Te.string().min(1),Te.string()).optional(),origins:Te.array(ph)});import{z as Y}from"zod";var _l=Y.union([tr,Y.null()]),jl=Y.record(Y.string().min(1),_l),fh=Y.object({as:Y.string().min(1),entity:Y.string().min(1),fields:Y.record(Y.string().min(1),Xe)}),iE=Y.object({entities:Y.array(fh),runId:Y.string().min(1),singletons:Y.record(Y.string().min(1),_l).default({})}),hh=Y.object({as:Y.string().min(1),row:jl,session:Dl.optional()}),Fl=Y.object({rows:Y.array(hh)}),oE=Y.object({entities:Y.array(Y.string().min(1)),runId:Y.string().min(1),singletons:Y.array(Y.string().min(1)).default([])}),Vl=Y.object({entities:Y.record(Y.string().min(1),Y.array(jl)),singletons:Y.record(Y.string().min(1),_l).default({})}),sE=Y.object({runId:Y.string().min(1)}),Bl=Y.object({ok:Y.literal(!0)});import aE from"fs";import Wn from"path";import Jr from"typescript";function mh(e){let t=Wn.join(e,"index.ts"),r=uE(e);aE.mkdirSync(Wn.dirname(r.tsBuildInfoFile??""),{recursive:!0});let n=Jr.createIncrementalCompilerHost(r),i=Jr.createIncrementalProgram({host:n,options:r,rootNames:[t]}),o=[...i.getSyntacticDiagnostics(),...i.getSemanticDiagnostics()];i.emit();let s=o.filter(c=>lE(c,e));if(s.length===0)return{diagnostics:[],ok:!0};let a={getCanonicalFileName:c=>c,getCurrentDirectory:()=>Wn.dirname(e),getNewLine:()=>`
24
+ `};return{diagnostics:Jr.formatDiagnosticsWithColorAndContext(s,a).split(`
25
+ `).filter(c=>c.length>0),ok:!1}}function lE(e,t){let r=e.file?.fileName;return r==null?!0:r.startsWith(t)}var cE=Wn.join(".local","tsbuildinfo");function uE(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:Jr.ModuleKind.Preserve,moduleResolution:Jr.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:Jr.ScriptTarget.ES2022,tsBuildInfoFile:Wn.join(e,cE)}}var Qe=".ripplo/ripplo.lock",Hn;async function yh(e){let{result:t}=await zn(e);return t}async function zn(e){let t=fE(ko.join(e,".ripplo"));if(Hn!=null&&Hn.fingerprint===t&&Hn.result.isOk())return{fingerprint:t,result:Hn.result};let r=await be(e);return Hn={fingerprint:t,result:r},{fingerprint:t,result:r}}async function be(e){let t=ko.join(e,".ripplo"),r=ko.join(t,"index.ts"),n=mh(t);return n.ok?(await hE(r)).andThen(o=>gE({entryPath:r,exported:o})):Co({diagnostics:n.diagnostics,kind:"typecheck-failed"})}var pE=new Set([".local","debug","node_modules"]);function fE(e){return bh(e).toSorted((t,r)=>t.localeCompare(r)).join("|")}function bh(e){return(Ul.existsSync(e)?Ul.readdirSync(e,{withFileTypes:!0}):[]).flatMap(r=>{if(pE.has(r.name))return[];let n=ko.join(e,r.name);if(r.isDirectory())return bh(n);let i=Ul.statSync(n);return[`${n}:${String(i.mtimeMs)}:${String(i.size)}`]})}async function hE(e){try{let r=await dE(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 gh(n)}catch(t){return Co({kind:"load-threw",message:mE(t)})}}function mE(e){return e instanceof Error?e.message:String(e)}function gE({entryPath:e,exported:t}){if(t==null||typeof t!="object"||!("lockfile"in t))return Co({entryPath:e,kind:"not-ripplo"});let r=So.safeParse(Reflect.get(t,"lockfile"));return r.success?gh(r.data):Co({issues:r.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`),kind:"invalid-lockfile"})}function V(e,t){return t==null?`Load \`/ripplo:${e}\` skill for instructions.`:`Load \`/ripplo:${e}\` skill for instructions on ${t}.`}function wh(e){return e.length===1?V(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)}`,V("create","DSL authoring + lint rules")].join(`
26
+ `)}function vh(){return`${Qe} is up to date`}function xh(e){return[`${Qe} is ${e==="missing"?"missing":"out of date"} \u2014 run \`ripplo compile\` and commit the result`,V("setup")].join(`
27
+ `)}function kh(){return`wrote ${Qe}`}function yE(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...Sh(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?):",...Sh(e.issues),"Regenerate with `npx ripplo compile` \u2014 never hand-edit the lockfile."].join(`
29
+ `);case"load-threw":return[`.ripplo/index.ts threw while loading: ${e.message}`,"Usually a bad import or a top-level throw in .ripplo/ \u2014 run `npx ripplo compile` for the stack."].join(`
30
+ `)}}function Sh(e,t=8){return e.length<=t?e:[...e.slice(0,t),`\u2026 and ${String(e.length-t)} more`]}function Ch(e){return e instanceof ho?Ge(e.failure):e instanceof Error?e.message:String(e)}function Ge(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).",V("setup")].join(`
31
+ `);case"project-file-invalid":return[`${e.path} is invalid:`,...e.issues.map(t=>` ${t}`),"Fix the file by hand or re-run `npx ripplo init`."].join(`
32
+ `);case"not-authenticated":return["Not 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 bE(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
+ `);case"gitdir-unrecognized":return`Unrecognized .git file at ${e.marker} \u2014 expected a directory or a "gitdir:" pointer (worktree). Is the repo corrupted?`;case"gitdir-empty":return`Empty gitdir pointer at ${e.marker} \u2014 the worktree's .git file points nowhere. Re-create the worktree.`;case"oauth-device-code-failed":return[`Could not start sign-in (device-code request failed): ${e.description}`,"Is the Ripplo server reachable? Check RIPPLO_SERVER_URL and retry."].join(`
35
+ `);case"oauth-authorization-failed":return[`Sign-in failed (${e.code}): ${e.description}`,e.code==="expired_token"?"The approval window expired \u2014 run `ripplo auth login` again.":"Run `ripplo auth login` to retry."].join(`
36
+ `);case"compilation-failed":return Oe(e.error)}}function bE(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 LE}from"gql.tada";import{exec as kE}from"child_process";import{createAuthClient as wE}from"better-auth/client";import{deviceAuthorizationClient as SE}from"better-auth/client/plugins";function Rh({baseURL:e}){return wE({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[SE()]})}import{err as Ah,ok as CE}from"neverthrow";import{z as Wl}from"zod";var vE="https://ripplo.ai";function nt(){return Ro().RIPPLO_SERVER_URL}function Ih(){return Ro().RIPPLO_PROJECT_ID}var xE=Wl.object({RIPPLO_PROJECT_ID:Wl.string().min(1).optional(),RIPPLO_SERVER_URL:Wl.string().min(1).default(vE)}),Eh;function Ro(){return Eh??=xE.parse(process.env),Eh}var RE=5e3,Ph="ripplo-cli";async function Th({onDeviceCode:e,url:t}){let r=t??Ro().RIPPLO_SERVER_URL,n=Rh({baseURL:r}),i=await n.device.code({client_id:Ph});if(i.error!=null)return Ah({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}),OE(a),(await EE({authClient:n,deviceCode:o})).map(c=>(ul(c),c))}async function EE({authClient:e,deviceCode:t}){for(;;){await PE(RE);let r=await e.device.token({client_id:Ph,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(r.data?.access_token!=null)return CE(r.data.access_token);if(r.error==null)continue;if(!AE(r.error.error))return Ah({code:r.error.error,description:r.error.error_description,kind:"oauth-authorization-failed"})}}var IE=new Set(["authorization_pending","slow_down"]);function AE(e){return IE.has(e)}function PE(e){return new Promise(t=>{setTimeout(t,e)})}function TE(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function OE(e){let t=TE();kE(`${t} "${e}"`,()=>{})}function ir({serverUrl:e,token:t}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:t,webhookSecret:""}}import ME from"fs";import NE from"path";function ae(e){return ME.existsSync(NE.join(e,".ripplo"))}var $E=LE(`
239
38
  query AuthViewer {
240
39
  currentUser {
241
40
  name
242
41
  email
243
42
  }
244
43
  }
245
- `);async function pi(){let e=ee(),r=ie();if(r!=null){let s=await Sn({serverUrl:e,token:r});if(s!=null){process.stdout.write(`Already signed in as ${s.email}. Run \`ripplo auth logout\` to switch.
246
- `);return}process.stdout.write(`Your saved session expired \u2014 let's sign you back in.
247
-
248
- `)}let t=await di({url:e,onDeviceCode:s=>{process.stdout.write(`Opening your browser to finish sign-in.
249
- `),process.stdout.write(`If it didn't open, visit: ${s.verificationUrl}
250
- `),process.stdout.write(`Verification code: ${s.userCode}
44
+ `);async function Oh(){let e=nt(),t=lt();if(t!=null&&await DE(e,t))return;let n=(await Th({url:e,onDeviceCode:a=>{process.stdout.write(`Opening your browser to finish sign-in.
45
+ `),process.stdout.write(`If it didn't open, visit: ${a.verificationUrl}
46
+ `),process.stdout.write(`Verification code: ${a.userCode}
251
47
 
252
48
  `),process.stdout.write(`Waiting for you to approve...
253
- `)}}),n=await Sn({serverUrl:e,token:t}),o=A(process.cwd()),i=o?"Welcome back":"Welcome to Ripplo";process.stdout.write(`
254
- `),process.stdout.write(n==null?`${i}.
255
- `:`${i}, ${Ep(n)}.
256
- `),process.stdout.write(`Session saved to ${ke("token")}.
257
- `),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"))}function Ep(e){let r=e.name.trim().split(/\s+/)[0];return r!=null&&r.length>0?r:e.email}async function Sn({serverUrl:e,token:r}){try{let n=(await h({config:Pe({serverUrl:e,token:r}),document:xp,variables:void 0})).currentUser;return n==null?null:{email:n.email,name:n.name}}catch{return null}}async function mi(){let e=ie();e==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login`.\n"),process.exit(1));let r=ee(),t=await Sn({serverUrl:r,token:e});t==null&&(process.stdout.write("Token rejected. 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.)
258
- `),process.exit(1)),process.stdout.write(`Authenticated as ${t.name} <${t.email}> (${r})
259
- `)}function fi(){if(!pn()){process.stdout.write(`No token to remove.
260
- `);return}process.stdout.write(`Removed ${ke("token")}
261
- `)}import{createHash as Cp}from"crypto";import wr from"fs/promises";import We from"path";import{z as Zr}from"zod";import{z as gi}from"zod";import{z as Be}from"zod";import{z as p}from"zod";import{z as Re}from"zod";import{z as Si}from"zod";import{z as D}from"zod";import{z as re}from"zod";import{z as kn}from"zod";import{z as T}from"zod";var Ap=Zr.object({__codec:Zr.string().min(1),data:Zr.unknown(),version:Zr.number().int().positive()}),Ip=class extends Error{codec;currentVersion;gotVersion;constructor(e){super(`Unsupported ${e.codec} version ${String(e.gotVersion)} (current ${String(e.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=e.codec,this.currentVersion=e.currentVersion,this.gotVersion=e.gotVersion}},Tp=class extends Error{constructor(e){super(`Codec mismatch: expected "${e.expected}", got "${e.got}"`),this.name="CodecMismatchError"}};function xn(e){return bi({legacy:void 0,migrators:[],name:e,schemas:[]})}function $p(e,r){let t=JSON.parse(r);return e.decode(t)}function bi(e){return{initial:r=>Pn(r,{...e,schemas:[r]}),legacy:r=>bi({...e,legacy:r})}}function Pn(e,r){return{build:()=>jp(e,r),legacy:t=>Pn(e,{...r,legacy:t}),upgrade:(t,n)=>{let o=n;return Pn(t,{...r,migrators:[...r.migrators,o],schemas:[...r.schemas,t]})}}}function jp(e,r){let t=r.schemas.length;return{currentVersion:t,name:r.name,decode:n=>Np(e,r,n),encode:n=>({__codec:r.name,data:n,version:t})}}function Np(e,r,t){let{data:n,version:o}=Dp(r,t),i=vi(r,n,o);return e.parse(i)}function Dp(e,r){let t=Ap.safeParse(r);if(t.success){if(t.data.__codec!==e.name)throw new Tp({expected:e.name,got:t.data.__codec});return{data:t.data.data,version:t.data.version}}if(e.legacy!=null&&e.legacy.detect(r))return{data:r,version:e.legacy.assumedVersion};throw new Error(`Cannot decode "${e.name}": value is not a codec envelope and no legacy detector matched.`)}function vi(e,r,t){let n=e.schemas.length;if(t>n)throw new Ip({codec:e.name,currentVersion:n,gotVersion:t});if(t===n)return r;let o=e.schemas[t-1];if(o==null)throw new Error(`Codec "${e.name}" missing schema for v${String(t)}; cannot migrate.`);let i=o.parse(r),s=e.migrators[t-1];if(s==null)throw new Error(`Codec "${e.name}" missing migrator v${String(t)} \u2192 v${String(t+1)}.`);return vi(e,s(i),t+1)}var En=Be.object({depends:Be.array(Be.string().min(1)).optional().describe("Names of other preconditions that must be satisfied first. Resolved via topological sort; cycles are rejected at validation time."),description:Be.string().min(1).describe("Human-readable description of what this precondition ensures"),returns:Be.array(Be.string().min(1)).optional().describe("Keys that the execute response's data field will contain. e.g. ['projectId', 'workflowId']. These are used for route param interpolation ({{projectId}}) and workflow variables. Declared here so generated types are strongly typed per precondition.")}).describe("A named precondition declared at the graph level. States reference these by name."),Op=Re.object({by:Re.literal("testId"),value:Re.string().min(1)}),Lp=Re.object({by:Re.literal("role"),name:Re.string().optional(),role:Re.string().min(1)}),$=Re.discriminatedUnion("by",[Op,Lp]),br=Si.enum(["equals","notEquals","contains","startsWith","endsWith","matches"]),_p=Si.enum(["equals","notEquals","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual"]),Up=D.object({type:D.literal("static"),value:D.union([D.string(),D.number(),D.boolean()])}),et=D.object({name:D.string().min(1),type:D.literal("variable")}),Vp=D.discriminatedUnion("type",[Up,et]),ae=D.discriminatedUnion("type",[D.object({type:D.literal("static"),value:D.string()}),et]),Fp=D.discriminatedUnion("type",[D.object({type:D.literal("static"),value:D.number().int().nonnegative()}),et]),Mp=D.discriminatedUnion("type",[D.object({type:D.literal("static"),value:D.union([D.string(),D.number(),D.boolean()])}),et]),Hp=re.discriminatedUnion("type",[re.object({default:re.string().optional(),type:re.literal("string")}),re.object({default:re.number().optional(),type:re.literal("number")}),re.object({default:re.boolean().optional(),type:re.literal("boolean")}),re.object({key:re.string().min(1),type:re.literal("env")})]),k={id:p.string().min(1).max(200),label:p.string().max(500).optional(),next:p.string().max(200).optional(),uiOnly:p.boolean().optional()},yi=500,Bp=p.object({...k,type:p.literal("goto"),url:ae}),Wp=p.object({...k,locator:$,modifier:p.enum(["Alt","Control","Meta","Shift"]).optional(),type:p.literal("click")}),qp=p.object({...k,locator:$,type:p.literal("fill"),value:ae}),zp=p.object({...k,locator:$,type:p.literal("select"),value:ae}),Gp=p.object({...k,locator:$,type:p.literal("hover")}),Kp=p.object({...k,key:p.string().min(1),locator:$.optional(),type:p.literal("press")}),Jp=p.object({...k,locator:$,type:p.literal("check")}),Xp=p.object({...k,locator:$,type:p.literal("uncheck")}),Yp=p.object({...k,height:p.number().int().positive(),type:p.literal("setViewport"),width:p.number().int().positive()}),Qp=p.object({...k,message:p.string().min(1),type:p.literal("fail")}),Zp=p.object({...k,type:p.literal("setVariable"),value:Vp,variable:p.string().min(1)}),em=p.object({...k,locator:$,type:p.literal("extractText"),variable:p.string().min(1)}),rm=p.object({...k,files:p.array(p.string()).min(1),locator:$,type:p.literal("upload")}),tm=p.object({...k,locator:$,type:p.literal("dblclick")}),nm=p.object({...k,source:$,target:$,type:p.literal("drag")}),om=p.object({...k,locator:$,type:p.literal("scrollIntoView")}),im=p.object({...k,locator:$,type:p.literal("type"),value:ae}),sm=p.object({...k,locator:$,type:p.literal("focus")}),am=p.object({...k,locator:$,type:p.literal("clear")}),lm=p.object({...k,locator:$,type:p.literal("rightClick")}),cm=p.object({...k,action:p.enum(["accept","dismiss"]),promptText:p.string().optional(),type:p.literal("handleDialog")}),um=p.object({...k,action:p.enum(["read","write"]),type:p.literal("clipboard"),value:ae.optional(),variable:p.string().min(1).optional()}),dm=p.object({...k,permission:p.string().min(1),state:p.enum(["granted","prompt"]),type:p.literal("setPermission")}),pm=p.object({...k,locator:$,type:p.literal("assertVisible")}),mm=p.object({...k,locator:$,type:p.literal("assertNotVisible")}),fm=p.object({...k,expected:ae,locator:$,operator:br,type:p.literal("assertText")}),gm=p.object({...k,expected:ae,operator:br,type:p.literal("assertUrl")}),ym=p.object({...k,expected:Fp,locator:$,operator:_p,type:p.literal("assertCount")}),hm=p.object({...k,expected:ae,locator:$,operator:br,type:p.literal("assertValue")}),wm=p.object({...k,attribute:p.string().min(1),expected:ae,locator:$,operator:br,type:p.literal("assertAttribute")}),bm=p.object({...k,locator:$,type:p.literal("assertEnabled")}),vm=p.object({...k,locator:$,type:p.literal("assertDisabled")}),Sm=p.object({...k,expected:ae,operator:br,type:p.literal("assertTitle")}),km=p.object({...k,locator:$,type:p.literal("assertChecked")}),Pm=p.object({...k,locator:$,type:p.literal("assertNotChecked")}),Rm=p.object({...k,locator:$,type:p.literal("assertFocused")}),xm=p.object({...k,locator:$,type:p.literal("assertNotFocused")}),Em=p.object({...k,budget:p.enum(["fast","slow","async"]),observer:p.string().min(1).max(200),params:p.record(p.string().max(200),Mp),type:p.literal("assertObserver")}),Cm=p.discriminatedUnion("type",[Bp,Wp,qp,zp,Gp,Kp,Jp,Xp,pm,mm,fm,gm,ym,hm,wm,bm,vm,Yp,Qp,Zp,em,rm,tm,nm,om,im,sm,am,lm,cm,um,dm,Sm,km,Pm,Rm,xm,Em]),ki=p.object({entryNode:p.string().min(1).max(200),nodes:p.record(p.string().max(200),Cm).refine(e=>Object.keys(e).length<=yi,`Workflow has more than ${String(yi)} nodes`),uiOnly:p.boolean().optional(),variableNamespaces:p.record(p.string().max(200),p.string().max(500)).optional(),variables:p.record(p.string().max(200),Hp).optional()}),Am=gi.record(gi.string().max(200),En),Im={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&"entryNode"in e&&"nodes"in e},Tm={assumedVersion:1,detect:e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("__codec"in e)},jR=xn("workflow-spec").legacy(Im).initial(ki).build(),NR=xn("precondition-map").legacy(Tm).initial(Am).build(),$m=["fast","slow","async"],Pi=kn.object({budget:kn.enum($m).describe("Polling budget tier: fast | slow | async"),description:kn.string().min(1).describe("Human-readable description of what this observer checks")}).describe("A named backend state observer. Tests assert against it with assert.backend(observer, params). Implementation lives on the user's server."),le=".ripplo/ripplo.lock",jm=".ripplo/fixtures",Ri=5e3,Nm=T.record(T.string().max(200),T.string().max(200)),xi=T.object({coverage:T.array(T.string().max(500)).max(2e3).default([]),expectedOutcome:T.string().max(2e3),name:T.string().max(200),preconditions:T.array(T.string().max(200)).max(1e3),requiresKeys:Nm,slug:T.string().max(200),sourcePath:T.string().max(500).optional(),spec:ki}),Dm=T.object({sha256:T.string().regex(/^[0-9a-f]{64}$/u),size:T.number().int().nonnegative()}),Om=T.record(T.string().min(1).max(500),Dm),Lm=T.object({observers:T.record(T.string().max(200),Pi),preconditions:T.record(T.string().max(200),En),tests:T.array(xi).max(Ri)}),_m=T.object({fixtures:Om,observers:T.record(T.string().max(200),Pi),preconditions:T.record(T.string().max(200),En),tests:T.array(xi).max(Ri)}),Ei=xn("ripplo-lockfile").initial(Lm).upgrade(_m,e=>({...e,fixtures:{}})).build();function Ci(e){return{fixtures:{...e.fixtures},observers:e.observers,preconditions:e.preconditions,tests:e.tests.filter(r=>r.implemented).map(r=>({coverage:[...r.coverage],expectedOutcome:r.expectedOutcome,name:r.name,preconditions:[...r.preconditions],requiresKeys:{...r.requiresKeys},slug:r.slug,sourcePath:r.sourcePath,spec:r.spec}))}}function Rn(e){let r=Ei.encode(e);return`${JSON.stringify(r,Mm(r),2)}
262
- `}async function rt({cwd:e}){let r=We.join(e,le),t=await Fm(r);return t==null?null:$p(Ei,t)}var hi=10*1024*1024,wi=50*1024*1024;async function ce({cwd:e,result:r}){let t=await Ai({cwd:e,result:r}),n=Ci(t),o=We.join(e,le);await wr.mkdir(We.dirname(o),{recursive:!0}),await wr.writeFile(o,Rn(n),"utf8")}async function Ai({cwd:e,result:r}){let t=Vm(r);if(t.size===0)return{...r,fixtures:{}};let n=We.join(e,jm),o=[...t].toSorted((a,l)=>a.localeCompare(l)),i=await Promise.all(o.map(async a=>{let l=await Um({fixturesRoot:n,name:a});if(l.size>hi)throw new Error(`Fixture "${a}" is ${String(l.size)} bytes; exceeds per-file limit of ${String(hi)} bytes`);return[a,l]}));if(i.reduce((a,[,l])=>a+l.size,0)>wi)throw new Error(`Total fixtures size exceeds limit of ${String(wi)} bytes`);return{...r,fixtures:Object.fromEntries(i)}}async function Um({fixturesRoot:e,name:r}){let t=r;if(typeof t!="string"||t.length===0)throw new Error(`Internal error: upload step produced a non-string fixture name (got ${t===null?"null":typeof t}). This usually means a test passed a non-Fixture value to upload() \u2014 wrap the filename with fixture("file.png").`);if(r.includes("..")||We.isAbsolute(r))throw new Error(`Invalid fixture name "${r}": must be a path under .ripplo/fixtures/`);let n=We.join(e,r),o=await wr.lstat(n).catch(a=>{throw Ii(a)&&a.code==="ENOENT"?new Error(`Fixture "${r}" not found at ${n}`):a});if(o.isSymbolicLink())throw new Error(`Fixture "${r}" is a symlink; symlinks are not allowed`);if(!o.isFile())throw new Error(`Fixture "${r}" is not a regular file`);let i=await wr.readFile(n);return{sha256:Cp("sha256").update(i).digest("hex"),size:i.byteLength}}function Vm(e){let r=new Set;return e.tests.forEach(t=>{Object.entries(t.spec.nodes).forEach(([n,o])=>{o.type==="upload"&&o.files.forEach((i,s)=>{let a=i;if(typeof a!="string"||a.length===0)throw new Error(`Test "${t.slug}" step "${n}" upload files[${String(s)}] is not a non-empty string (got ${a===null?"null":typeof a}). Wrap filenames with fixture(): upload(loc, fixture("file.png")).`);r.add(a)})})}),r}async function tt({compiled:e,cwd:r,existing:t}){if(t==null)return"missing";let n=await Ai({cwd:r,result:e}),o=Rn(Ci(n)),i=Rn(t);return o===i?"match":"stale"}async function Fm(e){try{return await wr.readFile(e,"utf8")}catch(r){if(Ii(r)&&r.code==="ENOENT")return null;throw r}}function Ii(e){return e instanceof Error&&"code"in e}function Mm(e){return function(t,n){return n===e||!Hm(n)?n:Object.fromEntries(Object.entries(n).toSorted(([o],[i])=>o.localeCompare(i)))}}function Hm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}import vr from"fs";import it from"path";var Cn=["**/src/**","**/app/**","**/apps/**","**/pages/**","**/routes/**","**/components/**","**/server/**","**/api/**","**/backend/**","**/features/**","**/modules/**","**/views/**","**/ui/**","**/hooks/**","**/contexts/**","**/providers/**","**/controllers/**","**/handlers/**","**/resolvers/**","**/services/**","**/middleware/**","**/lib/**"],xe=["**/*.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/**","**/scripts/**"];function Ti(e){return e.data}function $i(e){return{as(r){return{data:{label:r,node:e}}}}}function nt(e){let r=e.getPreconditions(),t=e.getObservers(),n=e.getTests();Bm(n);let o={};r.forEach(a=>{o[a.name]={depends:[...a.dependsOn],description:a.description,returns:[...a.returns]}});let i={};t.forEach(a=>{i[a.name]={budget:a.budget,description:a.description}});let s=n.map(a=>Wm(a,r));return{fixtures:{},observers:i,preconditions:o,tests:s}}function Bm(e){let r=new Map;e.forEach(t=>{let n=r.get(t.id);if(n!=null)throw new Error(`Duplicate test id "${t.id}" used by "${n}" and "${t.name}"`);r.set(t.id,t.name)})}function Wm(e,r){let t=e.id,{accessedKeys:n,vars:o}=zm(e.requiresKeys),i=e.startsAtFn==null?void 0:e.startsAtFn(o),s=e.stepsFn==null?[]:e.stepsFn(o),a=i==null?s:[qm(i),...s],l=Gm(a,n,e.requiresKeys,e.uiOnly),c=[];Object.keys(e.requiresKeys).length>0&&n.size===0&&e.implemented&&c.push("Test requires preconditions but never references their data \u2014 destructure and use precondition data in steps()");let m=Jm(e.requires,r);return{additionalChecks:[],coverage:e.coverage,description:e.description,expectedOutcome:e.expectedOutcome,implemented:e.implemented,name:e.name,preconditions:m,requiresKeys:{...e.requiresKeys},slug:t,sourcePath:e.sourcePath,spec:l,warnings:c}}function qm(e){return $i({type:"goto",url:{type:"static",value:e}}).as(`navigate to ${e}`)}function zm(e){let r=new Set,t={};return Object.keys(e).forEach(n=>{t[n]=new Proxy({},{get(o,i){if(typeof i=="string"){let s=`${n}.${i}`;return r.add(s),`{{${s}}}`}}})}),{accessedKeys:r,vars:t}}function Gm(e,r,t,n){let o={};e.forEach((a,l)=>{let c=`step-${String(l)}`,u=l<e.length-1?`step-${String(l+1)}`:void 0;o[c]=Km(a,c,u)});let i={};r.forEach(a=>{i[a]={default:`test-${a}`,type:"string"}});let s={...t};return{entryNode:"step-0",nodes:o,uiOnly:n,variableNamespaces:s,variables:i}}function Km(e,r,t){let{label:n,node:o}=Ti(e);return{...o,id:r,label:n,next:t}}function Jm(e,r){let t=new Map(r.map(s=>[s.name,s])),n=[],o=new Set;function i(s){o.has(s)||(o.add(s),t.get(s)?.dependsOn.forEach(a=>{i(a)}),n.push(s))}return e.forEach(s=>{i(s)}),n}import{Webhook as WR,WebhookVerificationError as qR}from"standardwebhooks";import{z as _}from"zod";var ji=_.union([_.string(),_.number(),_.boolean()]),Xm=_.record(_.string(),_.record(_.string(),ji)),GR=_.object({batch:_.array(_.object({preconditions:_.array(_.string().min(1)),runId:_.string().min(1)})).min(1)}),KR=_.object({batch:_.array(_.object({data:Xm,preconditions:_.array(_.string().min(1)),runId:_.string().min(1)})).min(1)}),JR=_.object({observer:_.string().min(1).max(200),params:_.record(_.string().max(200),ji)});function qe(e){let r=[];return e.tests.forEach(t=>{let n=Ym(t),o=i=>{r.push({...i,test:t.slug})};Sf.forEach(i=>{i(n,t,o)})}),{diagnostics:r}}function Ym(e){let r=[],t=e.spec.entryNode,n=new Set;for(;t!=null&&!n.has(t);){n.add(t);let o=e.spec.nodes[t];if(o==null)break;r.push(o),t=o.next}return r}function Qm(e,r,t){e.forEach(n=>{n.type==="assertText"&&"operator"in n&&n.operator!=="equals"&&t({message:`${n.type} uses operator "${n.operator}" \u2014 only "equals" is allowed for determinism`,rule:"exact-text-match",step:n.label??n.id})})}function Zm(e,r,t){Object.keys(r.spec.variables??{}).length>0&&e.forEach(o=>{if(o.type==="fill"&&Di(o.value)){let i=o.value.value;!Oi(i)&&af(i)&&t({message:`fill() uses hardcoded value "${i}" \u2014 consider using precondition data via {{namespace.key}}`,rule:"no-hardcoded-data",step:o.label??o.id})}})}function ef(e,r,t){if(Object.keys(r.spec.variables??{}).length===0)return;e.some(i=>JSON.stringify(i).includes("{{"))||t({message:"Test requires preconditions but steps() never references precondition data \u2014 destructure and use it",rule:"prefer-precondition-data",step:void 0})}function rf(e,r,t){e.forEach(n=>{(n.label==null||n.label.length===0)&&t({message:`Step "${n.id}" lacks .as("...") label \u2014 every step must be labeled`,rule:"missing-label",step:n.id})})}function tf(e,r,t){let n=new Map;e.forEach(o=>{if(o.label==null)return;let i=n.get(o.label);i==null?n.set(o.label,o.id):t({message:`Duplicate label "${o.label}" \u2014 also used by ${i}`,rule:"no-duplicate-labels",step:o.label})})}function nf(e,r,t){let n=0;e.forEach((o,i)=>{if(!(i===0&&o.type==="goto")){if(ze(o)){n=0;return}n++,n===3&&t({message:"3+ consecutive actions without an assertion \u2014 add verification between actions",rule:"assert-after-action",step:o.label??o.id})}})}function of(e,r,t){if(e.length===0)return;let n=e.at(-1);n!=null&&!ze(n)&&t({message:"Last step is an action, not an assertion \u2014 expectedOutcome should be verified by assertions at the end",rule:"assert-matches-outcome",step:n.label??n.id})}function sf(e,r,t){r.implemented&&e.length===0&&t({message:"Test has zero steps",rule:"no-empty-steps",step:void 0})}function Di(e){return!(typeof e!="object"||e==null||!("type"in e)||e.type!=="static"||!("value"in e)||typeof e.value!="string")}function Oi(e){return e.includes("{{")}function af(e){return e.includes("@")||/\b[a-f0-9]{8,}\b/.test(e)||/^(test|ripplo|example|sample|demo)/i.test(e)}function ze(e){return e.type.startsWith("assert")}var lf=new Set(["assertText","assertValue","assertCount","assertUrl","assertNotVisible","assertChecked","assertNotChecked","assertAttribute","assertDisabled","assertEnabled"]);function cf(e){return lf.has(e.type)}function uf(e,r,t){!r.implemented||e.length===0||e.some(n=>ze(n))||t({message:"Test has zero assertion steps \u2014 cannot verify expectedOutcome. Add assert.* steps.",rule:"no-assertions",step:void 0})}function df(e,r,t){if(!r.implemented||e.length<=3)return;let n=e.filter(i=>ze(i)).length;if(n===0)return;let o=n/e.length;if(o<.15){let i=Math.round(o*100);t({message:`Only ${String(n)}/${String(e.length)} steps are assertions (${String(i)}%) \u2014 add more verification between actions`,rule:"low-assertion-ratio",step:void 0})}}function An(e){if(!("locator"in e)||e.locator==null)return;let r=e.locator;return r.by==="role"?`role:${r.role}:${r.name??""}`:`testId:${r.value}`}function pf(e,r,t){e.forEach((n,o)=>{if(n.type!=="click")return;let i=An(n);if(i==null)return;let s=e.slice(o+1,o+4);s.find(c=>c.type==="assertVisible"&&An(c)===i)==null||s.some(c=>cf(c)||ze(c)&&An(c)!==i)||t({message:`click "${n.label??n.id}" is followed only by assert.visible on the same locator \u2014 verifies nothing about the click's effect`,rule:"tautological-post-click-assert",step:n.label??n.id})})}var mf=new Set(["the","is","a","an","and","or","of","to","in","on","at","for","that","this","with","be","are","was","were","it","its","as","by","from","after","before","should","will","can","still","but","not","no","so","if","then","than","user","users","page","view","shows","show","see","click","clicks","clicked","clickable","visible","appears","appear","displayed","stays","remains"]);function In(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(r=>r.length>=3&&!mf.has(r))}function ff(e){let r=e.label==null?[]:In(e.label);if(!("locator"in e)||e.locator==null)return r;let t=e.locator,n=t.by==="role"?t.name??"":t.value;return[...r,...In(n)]}function gf(e,r,t){if(!r.implemented||e.length===0)return;let n=new Set(In(r.expectedOutcome));if(n.size===0)return;let o=e.filter(s=>ze(s));if(o.length===0)return;o.some(s=>ff(s).some(a=>n.has(a)))||t({message:`No assertion references any keyword from expectedOutcome (${[...n].join(", ")}) \u2014 the outcome may not actually be verified`,rule:"expected-outcome-keyword-coverage",step:void 0})}var yf=/save|submit|create|delete|remove|send|invite|update|confirm|publish|apply|pay|subscribe|upgrade|cancel|archive|rename/i;function Ni(e){if(e.type==="upload")return!0;if(e.type!=="click")return!1;let r=e.locator,t=r.by==="role"?r.name??"":r.value;return yf.test(t)}function hf(e,r,t){!r.implemented||r.spec.uiOnly===!0||e.forEach((n,o)=>{if(!Ni(n)||"uiOnly"in n&&n.uiOnly===!0)return;let i=e.slice(o+1),s=i.findIndex(u=>Ni(u)),a=s===-1?i.length:s;i.slice(0,a).some(u=>u.type==="assertObserver")||t({message:`"${n.label??n.id}" looks like it mutates backend state but no assert.backend(...) observer verifies it \u2014 the test can pass while the server is broken. You need to add an observer that checks the persisted result (see .ripplo/observers/ for examples). Only if this action truly does NOT change any server state (pure client-side interaction, presentation toggle, etc.) should you fall back to marking the step { uiOnly: true } to silence this rule.`,rule:"mutation-without-observer-coverage",step:n.label??n.id})})}function wf(e,r,t){Object.keys(r.spec.variables??{}).length!==0&&e.forEach(o=>{if(o.type!=="assertObserver")return;let i=Object.entries(o.params);i.length===0||i.some(([,a])=>Di(a)&&Oi(a.value))||t({message:`assert.backend "${o.label??o.id}" passes only hardcoded params while the test defines precondition variables \u2014 observer assertions should reference {{namespace.key}} so they match the actual precondition data`,rule:"observer-params-reference-variables",step:o.label??o.id})})}function bf(e,r,t){e.forEach(n=>{n.type==="upload"&&n.files.forEach(o=>{if(o.length===0){t({message:`upload "${n.label??n.id}" references an empty fixture name`,rule:"upload-fixture-name",step:n.label??n.id});return}(o.includes("..")||o.startsWith("/"))&&t({message:`upload "${n.label??n.id}" references "${o}" \u2014 fixture names must be relative paths under .ripplo/fixtures/, no ".." or absolute paths`,rule:"upload-fixture-name",step:n.label??n.id})})})}function vf(e,r,t){let n=new Set(Object.keys(r.spec.variables??{})),o=/\{\{([^{}]+?)\}\}/g;e.forEach(i=>{let a=[...JSON.stringify(i).matchAll(o)],l=[...new Set(a.map(m=>m[1]).filter(m=>m!=null&&!n.has(m)))];if(l.length===0)return;let c=l.map(m=>`{{${m}}}`).join(", "),u=[...new Set(l.map(m=>m.split(".")[0]??m))].join(", ");t({message:`"${i.label??i.id}" contains literal template string(s) ${c} \u2014 destructure the proxy in .steps(({ ${u} }) => \u2026) and pass the proxy value (e.g. \`${l[0]??""}\`) directly. Writing the template as a string bypasses type-checking and silently accepts typos.`,rule:"no-literal-template-strings",step:i.label??i.id})})}var Sf=[Qm,Zm,vf,ef,rf,tf,nf,of,sf,uf,df,pf,gf,hf,wf,bf];import zf from"picomatch";import{execFileSync as kf,spawnSync as Pf}from"child_process";function K(e,r){return kf("git",[...e],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function Li(e,r){let t=Pf("git",["show",e],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(t.status===0)return t.stdout;if(t.status===128)return null;throw new Error(`git show ${e} failed (${String(t.status)}): ${t.stderr}`)}import b from"typescript";import*as _i from"remeda";var Ui=[["onClick","click"],["onContextMenu","click"],["onKeyDown","click"],["onKeyPress","click"],["onKeyUp","click"],["onSelect","click"],["onOpenChange","click"],["onPress","click"],["onActivate","click"],["onToggle","click"],["onOpen","click"],["onClose","click"],["onDismiss","click"],["onConfirm","click"],["onCancel","click"],["onApply","click"],["onClear","click"],["onSubmit","submit"],["onReset","submit"],["onDrop","drag"],["onDragEnd","drag"],["onDragEnter","drag"],["onDragLeave","drag"],["onDragOver","drag"],["onDragStart","drag"],["onValueChange","select"],["onSelectionChange","select"],["onChange","input"],["onCheckedChange","input"],["onInput","input"]],Rf=new Map([["button","click"],["link","navigate"],["textbox","input"],["searchbox","input"],["combobox","select"],["listbox","select"]]),xf=[[/(?:^|[a-z])Button$/,"click"],[/(?:^|[a-z])(?:Link|NavLink|Anchor)$/,"navigate"],[/(?:^|[a-z])(?:Textarea|TextArea|Input|Field|SearchBox)$/,"input"],[/(?:^|[a-z])(?:Select|Combobox|ComboBox|Dropdown)$/,"select"],[/(?:^|[a-z])Form$/,"submit"]];function ot({filePath:e,source:r}){let t=b.createSourceFile(e,r,b.ScriptTarget.Latest,!0,b.ScriptKind.TSX);return t.statements.flatMap(n=>Ef({filePath:e,sf:t,stmt:n}))}function Ef({filePath:e,sf:r,stmt:t}){let n=Af(t);if(n==null||Cf(n))return[];let o=Vi(t,r).map(i=>({id:`${e}#${n}.${i.kind}[${i.label}]`,line:i.line}));return _i.uniqueBy(o,i=>i.id)}function Cf(e){return e.endsWith("Fragment")||e.endsWith("Skeleton")||/^use[A-Z]/.test(e)||/^[A-Z][A-Z0-9_]*$/.test(e)}function Af(e){if(b.isExportAssignment(e))return If(e.expression);if(!Tf(e))return null;if(b.isFunctionDeclaration(e)||b.isClassDeclaration(e))return e.name?.text??null;if(b.isVariableStatement(e)){let r=e.declarationList.declarations[0];return r!=null&&b.isIdentifier(r.name)?r.name.text:null}return null}function If(e){return b.isIdentifier(e)?e.text:(b.isFunctionExpression(e)||b.isClassExpression(e))&&e.name!=null?e.name.text:"default"}function Tf(e){if(!b.canHaveModifiers(e))return!1;let r=b.getModifiers(e);return r!=null&&r.some(t=>t.kind===b.SyntaxKind.ExportKeyword)}function Vi(e,r){let t=$f(e,r),n=e.getChildren(r).flatMap(o=>Vi(o,r));return t==null?n:[t,...n]}function $f(e,r){let t=jf(e);if(t==null)return null;let n=Nf(t);if(n==null)return null;let o=Uf(t,n);return o==null?null:{kind:n,label:o,line:qf(r,e.getStart(r))}}function jf(e){return b.isJsxSelfClosingElement(e)&&b.isIdentifier(e.tagName)?{attrs:e.attributes,children:[],tag:e.tagName.text}:b.isJsxElement(e)&&b.isIdentifier(e.openingElement.tagName)?{attrs:e.openingElement.attributes,children:e.children,tag:e.openingElement.tagName.text}:null}function Nf({attrs:e,tag:r}){let t=ue(e,"role");return t!=null?Rf.get(t)??null:Of(r,e)??Lf(r)??_f(e)}var Df=new Map([["button",()=>"click"],["a",e=>ue(e,"href")==null?null:"navigate"],["input",e=>ue(e,"type")==="file"?"upload":"input"],["textarea",()=>"input"],["select",()=>"select"],["form",()=>"submit"]]);function Of(e,r){return Df.get(e)?.(r)??null}function Lf(e){return/^[A-Z]/.test(e)?xf.find(([r])=>r.test(e))?.[1]??null:null}function _f(e){return Ui.find(([r])=>Mf(e,r))?.[1]??null}function Uf({attrs:e,children:r,tag:t},n){return n==="navigate"?ue(e,"href")??ue(e,"to"):ue(e,"aria-label")??ue(e,"label")??ue(e,"title")??ue(e,"name")??ue(e,"placeholder")??(Vf(t)?void 0:Wf(r))??Ff(e,n)}function Vf(e){return e==="input"||e==="textarea"||e==="select"}function Ff(e,r){let t=Ui.find(([,o])=>o===r)?.[0];if(t==null)return;let n=Hf(e,t);if(n!=null){if(b.isIdentifier(n))return n.text;if(b.isArrowFunction(n)||b.isFunctionExpression(n))return Fi(n.body)}}function Fi(e){if(b.isCallExpression(e)){let r=e.expression;return b.isIdentifier(r)?r.text:b.isPropertyAccessExpression(r)?r.name.text:void 0}return b.forEachChild(e,Fi)}function Mf(e,r){return e.properties.some(t=>b.isJsxAttribute(t)&&b.isIdentifier(t.name)&&t.name.text===r)}function Mi(e,r){return e.properties.find(t=>b.isJsxAttribute(t)&&b.isIdentifier(t.name)&&t.name.text===r)}function ue(e,r){let t=Mi(e,r);return t==null?void 0:Bf(t.initializer)}function Hf(e,r){let t=Mi(e,r);if(!(t?.initializer==null||!b.isJsxExpression(t.initializer)))return t.initializer.expression}function Bf(e){if(e==null)return"";if(b.isStringLiteral(e))return e.text;if(b.isJsxExpression(e))return Bi(e.expression)}function Wf(e){let r=e.flatMap(t=>Hi(t)).join(" ").trim();return r.length===0?void 0:r}function Hi(e){if(b.isJsxText(e)){let r=e.text.trim();return r.length===0?[]:[r]}if(b.isJsxExpression(e)){let r=Bi(e.expression);return r==null?[]:[r]}return b.isJsxElement(e)?e.children.flatMap(r=>Hi(r)):[]}function Bi(e){if(e!=null){if(b.isStringLiteral(e)||b.isNoSubstitutionTemplateLiteral(e))return e.text;if(b.isCallExpression(e)&&e.arguments.length===1){let r=e.arguments[0];if(r!=null&&(b.isStringLiteral(r)||b.isNoSubstitutionTemplateLiteral(r)))return r.text}}}function qf(e,r){return e.getLineAndCharacterOfPosition(r).line+1}var Gf=it.join(".ripplo","coverage.d.ts");function Ge({cwd:e}){Kf({cwd:e,ignorePaths:xe})}function Kf({cwd:e,ignorePaths:r}){let t=Ke({cwd:e,ignorePaths:r});Yf({content:Xf(t),cwd:e})}function Ke({cwd:e,ignorePaths:r}){let n=Jf({cwd:e,ignorePaths:r}).flatMap(o=>Tn({cwd:e,file:o}));return[...new Set(n)].sort((o,i)=>o.localeCompare(i))}function Jf({cwd:e,ignorePaths:r}){let t=K(["ls-files","--cached","--others","--exclude-standard","-z"],e),n=zf([...r]);return t.split("\0").filter(o=>o.length>0&&/\.(tsx|jsx)$/.test(o)).filter(o=>!n(o)).filter(o=>vr.existsSync(it.join(e,o)))}function Tn({cwd:e,file:r}){let t=vr.readFileSync(it.join(e,r),"utf8");return ot({filePath:r,source:t}).map(n=>n.id)}function Xf(e){let r=`// GENERATED \u2014 do not edit
263
- import "@ripplo/testing";
49
+ `)}})).match(a=>a,a=>{process.stderr.write(`${Ge(a)}
50
+ `),process.exit(1)}),i=await Hl({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}, ${_E(i.viewer)}.
52
+ `:`${s}.
53
+ `),process.stdout.write(`Session saved to ${Ct("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 DE(e,t){let r=await Hl({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
+ `),!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
+ `),process.exit(1)),process.stdout.write(`Your saved session expired \u2014 let's sign you back in.
264
57
 
265
- declare module "@ripplo/testing" {
266
- interface CoverageRegistry {
267
- `,t=e.map(o=>` ${JSON.stringify(o)}: true;`).join(`
268
- `);return e.length===0?`${r} }
269
- }
270
- `:`${r}${t}
271
- }
272
- }
273
- `}function Yf({content:e,cwd:r}){let t=it.join(r,Gf);vr.existsSync(t)&&vr.readFileSync(t,"utf8")===e||vr.writeFileSync(t,e)}import{readdir as tg,stat as ng}from"fs/promises";import kr from"path";import{createJiti as og}from"jiti";import Qf from"fs";import Sr from"path";import Je from"typescript";function Wi(e){let r=Sr.join(e,"index.ts"),t=rg(e);Qf.mkdirSync(Sr.dirname(t.tsBuildInfoFile??""),{recursive:!0});let n=Je.createIncrementalCompilerHost(t),o=Je.createIncrementalProgram({host:n,options:t,rootNames:[r]}),i=[...o.getSyntacticDiagnostics(),...o.getSemanticDiagnostics()];o.emit();let s=i.filter(c=>Zf(c,e));if(s.length===0)return{diagnostics:[],ok:!0};let a={getCanonicalFileName:c=>c,getCurrentDirectory:()=>Sr.dirname(e),getNewLine:()=>`
274
- `};return{diagnostics:Je.formatDiagnosticsWithColorAndContext(s,a).split(`
275
- `).filter(c=>c.length>0),ok:!1}}function Zf(e,r){let t=e.file?.fileName;return t==null?!0:t.startsWith(r)}var eg=Sr.join(".local","tsbuildinfo");function rg(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:Je.ModuleKind.Preserve,moduleResolution:Je.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:Je.ScriptTarget.ES2022,tsBuildInfoFile:Sr.join(e,eg)}}var ig=["getObservers","getPreconditions","getTests","getUnimplemented"];function sg(e){return e==null||typeof e!="object"?!1:ig.every(r=>typeof Reflect.get(e,r)=="function")}function ag(e){return e===null?"null":Array.isArray(e)?"array":typeof e}var lg=new Set(["debug",".local"]),qi=new Map;async function x(e){let r=kr.join(e,".ripplo","index.ts"),t=kr.join(e,".ripplo"),n=await ug(t),o=qi.get(e);if(o!=null&&o.fingerprint===n)return o.result;let i=await cg(r,t);return qi.set(e,{fingerprint:n,result:i}),i}async function cg(e,r){let t=Wi(r);if(!t.ok)return{error:["TypeScript errors in .ripplo/:",...t.diagnostics].join(`
276
- `),ok:!1};try{let o=await og(import.meta.url,{fsCache:!1,moduleCache:!1,sourceMaps:!0}).import(e),i=o!=null&&typeof o=="object"&&"default"in o?Reflect.get(o,"default"):o;return sg(i)?{builder:i,ok:!0,result:nt(i)}:{error:`${e} must default-export a RipploBuilder (got ${ag(i)})`,ok:!1}}catch(n){return{error:pg(n,r),ok:!1}}}async function ug(e){let r=[];return await zi(e,e,r),r.sort((t,n)=>t.localeCompare(n)),r.join(`
277
- `)}async function zi(e,r,t){let n=await tg(r,{withFileTypes:!0}).catch(()=>[]);await Promise.all(n.map(async o=>{if(o.isDirectory()){if(lg.has(o.name))return;await zi(e,kr.join(r,o.name),t);return}let i=kr.join(r,o.name),s=await ng(i).catch(()=>{});s!=null&&t.push(`${kr.relative(e,i)}:${String(s.mtimeMs)}:${String(s.size)}`)}))}var dg=/\(?([^\s()]{1,500}\.ts):(\d{1,10}):(\d{1,10})\)?$/;function pg(e,r){if(!(e instanceof Error))return String(e);let t=mg(e.stack,r);return t==null?e.message:`${t} \u2014 ${e.message}`}function mg(e,r){if(e==null)return;let n=e.split(`
278
- `).map(a=>dg.exec(a)).find(a=>a!=null&&a[1]!=null&&a[2]!=null&&a[3]!=null&&a[1].startsWith(r));if(n==null)return;let[,o,i,s]=n;return`${o??""}:${i??""}:${s??""}`}function w(e,r){return r==null?`Load \`/ripplo:${e}\` skill for instructions.`:`Load \`/ripplo:${e}\` skill for instructions on ${r}.`}function Gi(e){return e.length===1?w(e[0]):`REQUIRED before proceeding: load ${e.map(t=>`\`/ripplo:${t}\``).join(" AND ")} skills (load every one \u2014 each carries rules the others don't).`}function $n(e){process.stderr.write(`Compilation failed: ${e}
279
- `),process.stderr.write(`${w("create","DSL authoring + lint rules")}
280
- `),process.exit(1)}function Ki(e){return e instanceof Error?e.message:String(e)}async function Ji(e){let r=process.cwd(),t=await x(r);if(t.ok||$n(t.error),e.check){let n=await rt({cwd:r}),o=await tt({compiled:t.result,cwd:r,existing:n}).catch(s=>$n(Ki(s)));if(o==="match"){process.stdout.write(`${le} is up to date
281
- `);return}let i=o==="missing"?"missing":"out of date";process.stderr.write(`${le} is ${i} \u2014 run \`ripplo compile\` and commit the result
282
- `),process.stderr.write(`${w("setup")}
283
- `),process.exit(1)}try{await ce({cwd:r,result:t.result})}catch(n){$n(Ki(n))}Ge({cwd:r}),process.stdout.write(`wrote ${le}
284
- `)}import fe from"process";import fg from"fs";import gg from"path";import yg from"picomatch";function Xi({compileResult:e,cwd:r,ignorePaths:t}){let n=new Set(Ke({cwd:r,ignorePaths:t})),o=Zi(e),i=hg({cwd:r,ignorePaths:t});return Qi({acknowledged:o,allStatements:n,unacked:i})}function Yi({compileResult:e,cwd:r,ignorePaths:t}){let n=new Set(Ke({cwd:r,ignorePaths:t})),o=Zi(e);return Qi({acknowledged:o,allStatements:n,unacked:n})}function Qi({acknowledged:e,allStatements:r,unacked:t}){let n=[...t].filter(i=>!e.has(i)).map(i=>({id:i,kind:"unacknowledged"})),o=[...e].filter(i=>!r.has(i)).map(i=>({id:i,kind:"stale"}));return[...n,...o]}function Zi(e){return new Set(e.tests.flatMap(r=>r.coverage))}function hg({cwd:e,ignorePaths:r}){let t=wg({cwd:e,ignorePaths:r}),n=new Set(t.flatMap(i=>bg({cwd:e,file:i}))),o=new Set(t.flatMap(i=>vg({cwd:e,file:i})?Tn({cwd:e,file:i}):[]));return new Set([...o].filter(i=>!n.has(i)))}function wg({cwd:e,ignorePaths:r}){let t=K(["diff","--name-only","HEAD","-z"],e),n=K(["ls-files","--others","--exclude-standard","-z"],e),o=yg([...r]);return[...new Set([...t.split("\0"),...n.split("\0")])].filter(i=>i.length>0&&/\.(tsx|jsx)$/.test(i)).filter(i=>!o(i))}function bg({cwd:e,file:r}){let t=Li(`HEAD:${r}`,e);return t==null?[]:ot({filePath:r,source:t}).map(n=>n.id)}function vg({cwd:e,file:r}){return fg.existsSync(gg.join(e,r))}async function es(){let e=fe.cwd(),r=await x(e);r.ok||(fe.stderr.write(`Compilation failed: ${r.error}
285
- `),fe.exit(1));let t=Ke({cwd:e,ignorePaths:xe}),n=Yi({compileResult:r.result,cwd:e,ignorePaths:xe}),o=n.filter(a=>a.kind==="unacknowledged"),i=n.filter(a=>a.kind==="stale"),s=t.length-o.length;fe.stdout.write(`Coverage: ${String(s)}/${String(t.length)} statements acknowledged
286
- `),o.length>0&&(fe.stdout.write(`
287
- Unacknowledged (${String(o.length)}):
288
- `),o.forEach(a=>fe.stdout.write(` ${a.id}
289
- `))),i.length>0&&(fe.stdout.write(`
290
- Stale claims (${String(i.length)}):
291
- `),i.forEach(a=>fe.stdout.write(` ${a.id}
292
- `))),n.length>0&&fe.exit(1)}import{graphql as Ag}from"gql.tada";import rs from"fs";import jn from"path";function ts(e){let r=rs.realpathSync(e),t=r,n=jn.dirname(t);for(;n!==t;){if(rs.existsSync(jn.join(t,".git")))return t;t=n,n=jn.dirname(t)}return r}function W(e){let r=yn(e),t=He(),n=ie();if(n==null)throw new Error("ripplo: not authenticated. Run `ripplo auth login`.");return{appUrl:t.appUrl,cwd:ts(e),engineUrl:t.engineUrl,projectId:ci()??r.projectId,ripploServerUrl:ee(),token:n,webhookSecret:t.webhookSecret}}import ge from"fs";var Sg="dev.pid";function os(e){return fr(e,Sg)}function Ye(e){let r=os(e);if(!ge.existsSync(r))return!1;let t=ge.readFileSync(r,"utf8").trim(),n=Number.parseInt(t,10);if(!Number.isFinite(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch{return!1}}var Xe=class extends Error{pid;cwd;constructor({cwd:r,pid:t}){super(`ripplo watch already running (pid ${String(t)})`),this.name="DevLockHeldError",this.pid=t,this.cwd=r}};function is(e){mr(e);let r=os(e);kg({cwd:e,path:r});let t=!1;return()=>{if(!t){t=!0;try{let n=ge.readFileSync(r,"utf8").trim();Number.parseInt(n,10)===process.pid&&ge.unlinkSync(r)}catch{}}}}function kg({cwd:e,path:r}){let t=()=>{try{let o=ge.openSync(r,"wx");return ge.writeSync(o,String(process.pid)),ge.closeSync(o),"ok"}catch(o){if(!Pg(o))throw o;let i=ns(r);if(i!=null&&Rg(i))throw new Xe({cwd:e,pid:i});return ge.unlinkSync(r),"retry"}};if(t()==="ok"||t()==="ok")return;let n=ns(r);throw n!=null?new Xe({cwd:e,pid:n}):new Error("failed to acquire dev lock")}function Pg(e){if(!(e instanceof Error)||!("code"in e))return!1;let{code:r}=e;return r==="EEXIST"}function ns(e){try{let r=ge.readFileSync(e,"utf8").trim(),t=Number.parseInt(r,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}}function Rg(e){try{return process.kill(e,0),!0}catch{return!1}}import xg from"fs";import Nn from"path";var Eg=["MERGE_HEAD","rebase-merge","rebase-apply","CHERRY_PICK_HEAD","REVERT_HEAD"];function st(e){let r=Cg(e);return r==null?!1:Eg.some(t=>xg.existsSync(Nn.join(r,t)))}function Cg(e){try{let r=K(["rev-parse","--git-dir"],e).trim();return r.length===0?null:Nn.isAbsolute(r)?r:Nn.resolve(e,r)}catch{return null}}var Ig=Ag(`
293
- query DevSessionCheckHealth($projectId: String!, $cwd: String!) {
58
+ `),!1)}async function Mh(){let e=lt();e==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login`.\n"),process.exit(1));let t=nt(),r=await Hl({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
+ `),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
+ `),process.exit(1)),process.stdout.write(`Authenticated as ${r.viewer.name} <${r.viewer.email}> (${t})
61
+ `)}function Nh(){if(!dl()){process.stdout.write(`No token to remove.
62
+ `);return}process.stdout.write(`Removed ${Ct("token")}
63
+ `)}async function Hl({serverUrl:e,token:t}){try{let n=(await D({config:ir({serverUrl:e,token:t}),document:$E,variables:void 0})).currentUser;return n==null?{kind:"rejected"}:{kind:"ok",viewer:{email:n.email,name:n.name}}}catch(r){return _n(r)==="UNAUTHENTICATED"?{kind:"rejected"}:{kind:"unreachable",message:r instanceof Error?r.message:String(r)}}}function _E(e){let t=e.name.trim().split(/\s+/)[0];return t!=null&&t.length>0?t:e.email}import{readFile as jE,writeFile as FE}from"fs/promises";import VE from"path";async function Lh(e){let t=process.cwd(),r=await be(t);r.isErr()&&(process.stderr.write(`${Oe(r.error)}
64
+ `),process.exit(1));let n=$t(pt,r.value),i=VE.join(t,Qe);if(e.check){let o=await jE(i,"utf8").catch(()=>null);if(o===n){process.stdout.write(`${vh()}
65
+ `);return}process.stderr.write(`${xh(o==null?"missing":"stale")}
66
+ `),process.exit(1)}await FE(i,n),process.stdout.write(`${kh()}
67
+ `)}import{graphql as _h}from"gql.tada";function zl(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 WE}from"gql.tada";import{err as BE,ok as UE}from"neverthrow";import $h from"fs";import Gl from"path";function Dh(e){let t=$h.realpathSync(e),r=t,n=Gl.dirname(r);for(;n!==r;){if($h.existsSync(Gl.join(r,".git")))return r;r=n,n=Gl.dirname(r)}return t}function je(e){return vl(e).andThen(t=>Kr().andThen(r=>{let n=lt();return n==null?BE({kind:"not-authenticated"}):UE({appUrl:r.appUrl,cwd:Dh(e),engineUrl:r.engineUrl,projectId:Ih()??t.projectId,ripploServerUrl:nt(),token:n,webhookSecret:r.webhookSecret})}))}var HE=WE(`
68
+ query DevSessionCheckPreflight($projectId: String!, $cwd: String!) {
294
69
  project(id: $projectId) {
295
70
  id
296
71
  devSession(cwd: $cwd) {
@@ -298,207 +73,233 @@ Stale claims (${String(i.length)}):
298
73
  }
299
74
  }
300
75
  }
301
- `);function ss(e){switch(e.status){case"active":return e.gitMidOperation?"\u2713 Dev session: ripplo watch is live (hooks auto-paused \u2014 git is mid-merge/rebase/cherry-pick; resumes when the operation completes or aborts)":"\u2713 Dev session: ripplo watch is live for this directory";case"starting":return"! Dev session: `ripplo watch` 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 watch. Start `npx ripplo watch` 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 as(e){let r=Ye(e),t=st(e),n;try{n=W(e)}catch{return{gitMidOperation:t,status:r?"starting":"missing",type:"dev-session"}}return(await h({config:n,document:Ig,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null))?.project?.devSession!=null?{gitMidOperation:t,status:"active",type:"dev-session"}:{gitMidOperation:t,status:r?"starting":"missing",type:"dev-session"}}function ls(e){switch(e.type){case"settings":return Ng(e);case"env-files":return Dg(e);case"token":return Og(e);case"dev-server":return Lg(e);case"dev-session":return ss(e);case"preconditions":return Vg(e);case"webhook-verification":return _g(e);case"preconditions-validation":return Fg(e);case"workflows":return Mg(e);case"browser":return Ug(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 Tg(e);case"lockfile":return $g(e);case"pre-commit-hook":return jg(e)}}function Tg(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 $g(e){switch(e.status){case"match":return`\u2713 Lockfile: ${le} is up to date`;case"missing":return`\u2717 Lockfile: ${le} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${le} is out of date \u2014 run \`ripplo compile\` and commit it`}}function jg(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"}function Ng(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function Dg(e){return e.missing.length===0?"\u2713 Env files: declared files present":`\u2717 Env files: declared in .ripplo/project.json but missing:
302
- ${e.missing.map(t=>` ${t}`).join(`
303
- `)}
304
- 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 Og(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 ${ee()} to validate token.`}}function Lg(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 _g(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 Ug(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function Vg(e){return e.count===0?"! Preconditions: None defined":e.configured?e.endpointReachable===void 0?`! Preconditions: ${String(e.count)} defined (could not verify endpoint)`:`\u2713 Preconditions: ${String(e.count)} defined, endpoint configured`:`\u2717 Preconditions: ${String(e.count)} defined but RIPPLO_ENGINE_URL is not set in your env file`}function Fg(e){if(!e.found)return"\u2717 State graph: DSL compilation failed";if(e.valid)return"\u2713 State graph: Valid";let r=e.errors.map(t=>` - ${t.path===""?"":t.path+": "}${t.message}`);return`\u2717 State graph: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
305
- ${r.join(`
306
- `)}`}function Mg(e){if(e.total===0)return"! Tests: No tests defined";if(e.invalidNames.length===0)return`\u2713 Tests: ${String(e.total)} valid`;let r=e.invalidWorkflows.map(t=>Hg(t));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
307
- ${r.join(`
308
- `)}`}function Hg(e){let r=e.errors.map(t=>" - "+(t.path===""?"":t.path+": ")+t.message);return" "+e.name+`:
309
- `+r.join(`
310
- `)}import On from"fs";import Kg from"path";import{chromium as Jg}from"playwright";import Bg from"fs";import Wg from"path";async function cs(e){let r=Wg.join(e,".ripplo","index.ts");if(!Bg.existsSync(r))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let t=await x(e);if(!t.ok)return{appUrl:void 0,engineUrl:void 0,errors:[{message:t.error,path:".ripplo/"}],valid:!1,warnings:[]};try{let n=He();return{appUrl:n.appUrl,engineUrl:n.engineUrl,errors:[],valid:!0,warnings:[]}}catch(n){return{appUrl:void 0,engineUrl:void 0,errors:[{message:n instanceof Error?n.message:String(n),path:""}],valid:!1,warnings:[]}}}async function Dn(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 us({appUrl:e,engineUrl:r}){let t=r.startsWith("http://")||r.startsWith("https://")?r:`${e}${r}`;try{return(await fetch(`${t}/execute-preconditions`,{body:JSON.stringify({preconditions:[]}),headers:{"Content-Type":"application/json"},method:"PUT",signal:AbortSignal.timeout(5e3)})).ok?"Engine endpoint accepted an unsigned request \u2014 webhook signature verification may be missing.":void 0}catch{return}}import{graphql as qg}from"gql.tada";var zg=qg(`
311
- query DoctorAuthViewer {
312
- currentUser {
313
- name
314
- email
315
- }
316
- }
317
- `),Gg="Failed to connect to Ripplo server";async function ds({serverUrl:e,token:r}){try{let t=await h({config:Pe({serverUrl:e,token:r}),document:zg,variables:void 0});return t.currentUser==null?{kind:"invalid"}:{email:t.currentUser.email,kind:"valid"}}catch(t){return(t instanceof Error?t.message:String(t)).startsWith(Gg)?{kind:"unreachable"}:{kind:"invalid"}}}function ps(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 ms(e){let r=await Qg(e),t={missing:bn(e),type:"env-files"},n=await Zg(),o=ey(),i=await x(e),s=ry(i),a=oy(i),l=await Xg(e,i),c=Yg(e),u=await iy(r,i);return[r,t,n,...u,s,a,l,c,o]}async function Xg(e,r){if(!r.ok)return{status:"missing",type:"lockfile"};let t=await rt({cwd:e});return{status:await tt({compiled:r.result,cwd:e,existing:t}),type:"lockfile"}}function Yg(e){let r=Kg.join(e,".git","hooks","pre-commit");return On.existsSync(r)?{installed:On.readFileSync(r,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function Qg(e){let r=await cs(e);return r.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:r.errors.map(n=>n.path).filter(n=>n.length>0),type:"settings",valid:!1}}async function Zg(){let e=ie();if(e==null||e.length===0)return{email:void 0,status:"missing",type:"token"};let r=await ds({serverUrl:ee(),token:e});return r.kind==="valid"?{email:r.email,status:"valid",type:"token"}:{email:void 0,status:r.kind,type:"token"}}function ey(){let e=Jg.executablePath();return{installed:On.existsSync(e),type:"browser"}}function ry(e){if(!e.ok)return{errorCount:1,errors:[{message:e.error,path:""}],found:!1,type:"preconditions-validation",valid:!1};let r=ty(e.result.preconditions,e.result.tests);return{errorCount:r.length,errors:r,found:!0,type:"preconditions-validation",valid:r.length===0}}function ty(e,r){let t=[],n=new Set(Object.keys(e));return Object.entries(e).forEach(([o,i])=>{(i.depends??[]).forEach(s=>{n.has(s)||t.push({message:`Depends on non-existent precondition "${s}"`,path:`preconditions.${o}.depends`})})}),r.forEach(o=>{Object.entries(o.requiresKeys).forEach(([i,s])=>{n.has(s)||t.push({message:`Test "${o.slug}" requires non-existent precondition "${s}" (as ${i})`,path:`tests.${o.slug}.requiresKeys.${i}`})})}),ny(e).forEach(o=>{t.push({message:o,path:"preconditions"})}),t}function ny(e){let r=new Set,t=new Set,n=[];function o(i){if(t.has(i)){n.push(`Precondition "${i}" has a circular dependency`);return}r.has(i)||(r.add(i),t.add(i),(e[i]?.depends??[]).forEach(s=>{o(s)}),t.delete(i))}return Object.keys(e).forEach(i=>{o(i)}),n}function oy(e){if(!e.ok)return{invalidNames:[],invalidWorkflows:[],total:0,type:"workflows",valid:0};let r=e.result.tests.length;return{invalidNames:[],invalidWorkflows:[],total:r,type:"workflows",valid:r}}async function iy(e,r){if(!e.valid||!r.ok)return[];let t;try{let a=He();t={appUrl:a.appUrl,engineUrl:a.engineUrl,webhookSecret:a.webhookSecret}}catch{return[]}let n=[],o=await Dn(t.appUrl)==null;n.push({appUrl:t.appUrl,reachable:o,type:"dev-server"});let i=await as(process.cwd());n.push(i);let s=await sy(t,r);return n.push(...s),n}async function sy(e,r){let t=r.ok?Object.keys(r.result.preconditions).length:0,n=e.engineUrl.length>0,o={configured:n,count:t,endpointReachable:void 0,type:"preconditions"};if(t===0||!n)return[o];let i=ly(e.appUrl,e.engineUrl);if(i==null)return[o];let s=await Dn(i)==null,a=[];if(a.push({configured:!0,count:t,endpointReachable:s,type:"preconditions"}),fs(e.engineUrl)&&a.push({reachable:s,type:"engine-endpoint",url:i}),!s)return a;let l=await us({appUrl:e.appUrl,engineUrl:e.engineUrl});a.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await ay({engineUrl:i,webhookSecret:e.webhookSecret});return a.push({status:c,type:"adapter-enabled",url:i}),a}async function ay({engineUrl:e,webhookSecret:r}){if(r.length===0)return"no-secret";let t=JSON.stringify({preconditions:[]});try{let n=await fetch(`${e}/execute-preconditions`,{body:t,headers:{"Content-Type":"application/json",...Se({body:t,secret:r})},method:"PUT",signal:AbortSignal.timeout(5e3)});return n.status===404?"disabled":n.status===401||n.status===403?"bad-secret":"enabled"}catch{return"unreachable"}}function fs(e){return e.startsWith("http://")||e.startsWith("https://")}function ly(e,r){return fs(r)?r:`${e}${r}`}async function gs(){let e=process.cwd(),r=await ms(e),t=r.map(o=>ls(o));process.stdout.write(t.join(`
318
- `)+`
319
- `);let n=r.some(o=>ps(o));process.exit(n?1:0)}import uy from"crypto";import{graphql as dy}from"gql.tada";import Ln from"fs";import _n from"path";function at(e){try{let r=_n.join(cy(e),"HEAD"),t=Ln.readFileSync(r,"utf8").trim(),n="ref: refs/heads/";return t.startsWith(n)?t.slice(n.length):t.length===0?void 0:t.slice(0,7)}catch{return}}function cy(e){let r=_n.join(e,".git");if(Ln.statSync(r).isDirectory())return r;let n=Ln.readFileSync(r,"utf8").trim(),o="gitdir:";if(!n.startsWith(o))throw new Error(`unrecognized .git file at ${r}`);let i=n.slice(o.length).trim();if(i.length===0)throw new Error(`empty gitdir pointer at ${r}`);return _n.resolve(e,i)}var py=dy(`
320
- mutation SyncDevSession(
321
- $projectId: String!
322
- $cwd: String!
323
- $branch: String
324
- $preconditions: [SyncDevPreconditionInput!]!
325
- $workflows: [SyncDevWorkflowInput!]!
326
- ) {
327
- syncDevSession(
328
- projectId: $projectId
329
- cwd: $cwd
330
- branch: $branch
331
- preconditions: $preconditions
332
- workflows: $workflows
333
- ) {
76
+ `);function Dt(){return je(process.cwd()).match(e=>e,e=>{process.stderr.write(`${Ge(e)}
77
+ `),process.stderr.write(`${V("setup")}
78
+ `),process.exit(1)})}async function Gn(e){(await D({config:e,document:HE,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(`${V("setup")}
79
+ `),process.exit(1))}var zE=_h(`
80
+ mutation CliUpdateMaxLocalConcurrentRuns($value: Int!) {
81
+ updateMaxLocalConcurrentRuns(value: $value) {
334
82
  id
335
- hooksPaused
83
+ maxLocalConcurrentRuns
336
84
  }
337
85
  }
338
- `);async function Qe(e){let r=my(e.compiled);return gy({config:e.config,cwd:e.cwd,payload:r})}async function ye(e,r){let t=await x(e);if(!t.ok)throw new Error(`DSL compilation failed: ${t.error}`);let n=await Qe({compiled:t.result,config:r,cwd:e});return{compiled:t.result,devSessionId:n.devSessionId}}function my(e){return{preconditions:Object.entries(e.preconditions).map(([r,t])=>({depends:[...t.depends??[]],description:t.description,name:r,returns:[...t.returns??[]]})),workflows:e.tests.map(r=>({expectedOutcome:r.expectedOutcome,name:r.name,preconditions:[...r.preconditions],requiresKeys:Object.entries(r.requiresKeys).map(([t,n])=>({namespace:t,preconditionName:n})),slug:r.slug,sourcePath:r.sourcePath??null,spec:r.implemented?JSON.stringify(r.spec):null}))}}function fy(e){return uy.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function gy({config:e,cwd:r,payload:t}){let n=fy(t),o=at(r),i=await h({config:e,document:py,variables:{branch:o??null,cwd:r,preconditions:t.preconditions.map(s=>({depends:[...s.depends],description:s.description,name:s.name,returns:[...s.returns]})),projectId:e.projectId,workflows:t.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(i.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:i.syncDevSession.id,hash:n,hooksPaused:i.syncDevSession.hooksPaused}}import{graphql as Pr,readFragment as vy}from"gql.tada";import{createHash as ys}from"crypto";import{mkdirSync as yy,readFileSync as Un,writeFileSync as hy}from"fs";import lt from"path";var wy=[".ts",".tsx",".js",".jsx"];function Ee(e){let r=ys("sha256");return r.update(K(["rev-parse","HEAD"],e)),r.update("\0"),r.update(K(["diff","HEAD"],e)),r.update("\0"),K(["ls-files","--others","--exclude-standard"],e).split(`
339
- `).filter(n=>n.length>0).filter(n=>wy.some(o=>n.endsWith(o))).toSorted((n,o)=>n.localeCompare(o)).forEach(n=>{r.update(n),r.update("\0"),r.update(by(lt.join(e,n))),r.update("\0")}),r.digest("hex")}function hs(e){let r=lt.join(e,".ripplo","ripplo.lock");try{let t=Un(r);return ys("sha256").update(t).digest("hex")}catch{return null}}function Ze(e,r){try{return Un(ws(e,r),"utf8").trim()}catch{return null}}function er(e,r,t){let n=ws(e,r);yy(lt.dirname(n),{recursive:!0}),hy(n,t)}function ws(e,r){return lt.join(e,".ripplo",".local",`${r}.hash`)}function by(e){try{return Un(e)}catch{return Buffer.alloc(0)}}import bs from"figures";var Ne={cross:bs.cross,tick:bs.tick};var Ss=Pr(`
340
- fragment WorkflowIdMCP on Workflow {
341
- id
342
- slug
343
- }
344
- `),Sy=Pr(`
345
- query ProjectWorkflowIdsMCP($projectId: String!, $cwd: String!) {
346
- project(id: $projectId) {
347
- id
348
- devSession(cwd: $cwd) {
349
- id
350
- workflows {
351
- ...WorkflowIdMCP
352
- }
353
- }
354
- }
355
- }
356
- `,[Ss]),ky=Pr(`
357
- mutation SetProjectViewCLI($projectId: String!, $devSessionId: String!) {
358
- setProjectView(projectId: $projectId, devSessionId: $devSessionId) {
86
+ `),GE=_h(`
87
+ query CliMaxLocalConcurrentRuns {
88
+ currentUser {
359
89
  id
90
+ maxLocalConcurrentRuns
360
91
  }
361
92
  }
362
- `),Py=Pr(`
363
- mutation CreateRunMCP($workflowId: String!, $lockfileHash: String, $repoHash: String) {
364
- createRun(workflowId: $workflowId, lockfileHash: $lockfileHash, repoHash: $repoHash) {
365
- __typename
366
- ... on Run {
367
- id
368
- status
369
- }
370
- ... on DevModeActiveError {
371
- message
372
- }
373
- ... on RepoNotLinkedError {
374
- message
375
- }
376
- ... on WorkflowSpecMissingError {
377
- message
378
- }
379
- ... on LimitExceededError {
380
- code
381
- message
382
- }
383
- }
384
- }
385
- `),Ry=Pr(`
386
- query RunStatusMCP($id: String!) {
387
- run(id: $id) {
93
+ `);async function jh({value:e}){let t=Dt();if(e==null){let n=await D({config:t,document:GE,variables:{}});process.stdout.write(`${zl(n.currentUser?.maxLocalConcurrentRuns)}
94
+ `);return}let r=await D({config:t,document:zE,variables:{value:e}});process.stdout.write(`${zl(r.updateMaxLocalConcurrentRuns?.maxLocalConcurrentRuns)}
95
+ `)}import{graphql as nI}from"gql.tada";import Fh from"fs";import{checkSync as qE,lockSync as KE}from"proper-lockfile";var YE="dev.pid",Vh=15e3;function Bh(e){return Qt(e,YE)}function Zr(e){try{return qE(Bh(e),{realpath:!1,stale:Vh})}catch{return!1}}var qn=class extends Error{pid;cwd;constructor({cwd:t,pid:r}){super("dev-lock-held"),this.name="DevLockHeldError",this.pid=r,this.cwd=t}};function Uh({cwd:e,onCompromised:t}){Ot(e);let r=Bh(e),n=JE({cwd:e,onCompromised:t,path:r});return Fh.writeFileSync(r,String(process.pid)),()=>{try{n()}catch{}}}function JE({cwd:e,onCompromised:t,path:r}){try{return KE(r,{realpath:!1,stale:Vh,onCompromised:()=>{t()}})}catch(n){throw ZE(n)?new qn({cwd:e,pid:XE(r)}):n}}function ZE(e){if(!(e instanceof Error)||!("code"in e))return!1;let{code:t}=e;return t==="ELOCKED"}function XE(e){try{let t=Fh.readFileSync(e,"utf8").trim(),r=Number.parseInt(t,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}}import eI from"fs";import ql from"path";import{execFileSync as QE}from"child_process";function or(e,t){return QE("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}var tI=["MERGE_HEAD","rebase-merge","rebase-apply","CHERRY_PICK_HEAD","REVERT_HEAD"];function Eo(e){let t=rI(e);return t==null?!1:tI.some(r=>eI.existsSync(ql.join(t,r)))}function rI(e){try{let t=or(["rev-parse","--git-dir"],e).trim();return t.length===0?null:ql.isAbsolute(t)?t:ql.resolve(e,t)}catch{return null}}var iI=nI(`
96
+ query DevSessionCheckHealth($projectId: String!, $cwd: String!) {
97
+ project(id: $projectId) {
388
98
  id
389
- status
390
- duration
391
- passCount
392
- failCount
393
- warnCount
394
- summary
395
- caughtKind
396
- workflow {
397
- slug
398
- }
399
- traceEntries {
400
- title
401
- status
402
- detail
403
- duration
404
- assertions {
405
- description
406
- status
407
- detail
408
- }
99
+ devSession(cwd: $cwd) {
100
+ id
409
101
  }
410
102
  }
411
103
  }
412
- `);async function ct({config:e,ids:r,presynced:t}){let n=await xy({config:e,ids:r,presynced:t}),o=await Promise.all(n.map(async a=>{try{let l=await Ty({config:e,workflowId:a.workflowId});return{entry:a,ok:!0,runId:l}}catch(l){let c=l instanceof Error?l.message:String(l);return{entry:a,message:c,ok:!1}}})),i=await Promise.all(o.map(async a=>{if(!a.ok)return{id:a.entry.id,runId:"",summary:`ERROR creating run: ${a.message}
413
- ${w("setup","check auth + config")}`};let{entry:l,runId:c}=a;try{let u=await Ny({config:e,runId:c}),m=Iy({config:e,id:l.id,runId:c}),y=`.ripplo/debug/${c}/`;return{id:l.id,runId:c,summary:`View run: ${m}
414
- Debug artifacts: ${y}
415
- ${w("debug","read summary.txt, accessibility-tree, network.jsonl before guessing")}
104
+ `);function Wh(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 Hh(e){let t=Zr(e),r=Eo(e),n=je(e).unwrapOr(void 0);return n==null?{gitMidOperation:r,status:t?"starting":"missing",type:"dev-session"}:(await D({config:n,document:iI,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 zh(e){switch(e.type){case"settings":return oI(e);case"env-files":return sI(e);case"token":return aI(e);case"dev-server":return lI(e);case"dev-session":return Wh(e);case"preconditions":return cI(e);case"webhook-verification":return uI(e);case"preconditions-validation":return dI(e);case"workflows":return pI(e);case"browser":return hI(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 mI(e);case"lockfile":return gI(e);case"pre-commit-hook":return yI(e)}}function oI(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function sI(e){return e.missing.length===0?"\u2713 Env files: declared files present":`\u2717 Env files: declared in .ripplo/project.json but missing:
105
+ ${e.missing.map(r=>` ${r}`).join(`
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 aI(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 ${nt()} to validate token.`}}function lI(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 cI(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 uI(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 dI(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
+ ${t.join(`
109
+ `)}`}function pI(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=>fI(r));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
110
+ ${t.join(`
111
+ `)}`}function fI(e){let t=e.errors.map(r=>" - "+(r.path===""?"":r.path+": ")+r.message);return" "+e.name+`:
112
+ `+t.join(`
113
+ `)}function hI(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function mI(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 gI(e){switch(e.status){case"match":return`\u2713 Lockfile: ${Qe} is up to date`;case"missing":return`\u2717 Lockfile: ${Qe} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${Qe} 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 Ca from"fs";import dx from"path";import{chromium as B5}from"playwright";import bI from"fs";import wI from"path";async function Gh(e){let t=wI.join(e,".ripplo","index.ts");if(!bI.existsSync(t))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await be(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:Oe(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:Kr().match(n=>({appUrl:n.appUrl,engineUrl:n.engineUrl,errors:[],valid:!0,warnings:[]}),n=>({appUrl:void 0,engineUrl:void 0,errors:[{message:Ge(n),path:""}],valid:!1,warnings:[]}))}async function Kl(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 sr(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 Xr(e,t){return e==="url"?sr(t):t}function Yl(e,t,r){return Xr(e,String(t))===Xr(e,String(r))}function Yh(e,t,r){return e!=="url"?Yl(e,t,r):Kh(String(t))===Kh(String(r))}function Kh(e){return new URL(e,"https://ripplo.invalid").pathname}function Jl({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>SI({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...xI(r.singletons,n.singletons,e.singletons)]}function SI({actual:e,canon:t,entity:r,pre:n,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>vI({actual:e?.get(s),canon:t,entity:r,key:s,predicted:i?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function vI({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)=>Xh(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 Xh(e,t){return Jh(e)===Jh(t)}function Jh(e){return e==null?"\u2205":JSON.stringify(e)}function xI(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||Zh(i,o,s)?[]:[{divergence:{kind:"singleton-mismatch",singleton:i,snapshot:o,sut:s},pending:e[i]!==void 0&&Zh(i,e[i],s)}]})}function Zh(e,t,r){let n=Nt.safeParse(e);return n.success?Yh(n.data,t,r):Xh(t,r)}function Zl(e){let t=kI(e.entities),r=CI(e.singletons);return n=>RI(n,t,r)}function kI(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[Qh(t.name,r),n.consistency])))}function Qh(e,t){return`${e}.${t}`}function CI(e){return new Map(e.map(t=>[t.name,t.consistency]))}function RI(e,t,r){return e.kind==="singleton-mismatch"?EI(e.singleton,r):e.kind==="ghost-write"||e.kind==="absent"?"strict":t.get(Qh(e.entity,e.field))??"strict"}function EI(e,t){return Nt.safeParse(e).success?t.get(e)??"eventual":t.get(e)??"strict"}function Xl(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 tm(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function Io(e,t){return{code:um(t),kind:"engine-network",message:Yn(t),path:e}}function rm(e){return{kind:"client-mount-missing",mountKey:e}}function nm(e,t){return{kind:"engine-decode",message:Yn(t),path:e}}function im(e,t){return{entity:e,field:t,kind:"state-identity"}}function om(e){return{as:e,kind:"setup-missing-row"}}function Kn(e){return{kind:"driver-launch",message:Yn(e)}}function sm(e,t){return{action:e,kind:"action-failed",message:Yn(t)}}function am(e){return{kind:"check-failed",message:Yn(e)}}function lm(){return{kind:"aborted"}}var em=300;function ar(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${II(e.detail)}${AI(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 cm(e){throw new Error(ar(e))}function Ao(){}function II(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=em?t:`${t.slice(0,em)}\u2026 [truncated]`}function AI(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 um(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?um(e.cause):void 0}function Yn(e){return e instanceof Error?e.message:String(e)}var nc=ro(hm(),1),jq=nc.default.configure,Po=nc.default;function Me(e){return Po(e)??""}function Mr(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function ic(e){return Mr(e,Me)}function mm(e){return Me(e)}var Zn=class extends Error{name="AbortError";constructor(){super("aborted")}};function gm(e){return e instanceof Error&&e.name==="AbortError"}function cr(e){if(e.aborted)throw new Zn}function oc(e,t){return t.aborted?Promise.reject(new Zn):new Promise((r,n)=>{let i=()=>{clearTimeout(o),n(new Zn)},o=setTimeout(()=>{t.removeEventListener("abort",i),r()},e);t.addEventListener("abort",i,{once:!0})})}function xm(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var DI=()=>[];async function ac({canon:e,classify:t,initialSnapshot:r,lawObligations:n,observe:i,onAssertion:o,onStep:s,steps:a},l){return km({acc:[],canon:e,classify:t,index:0,lawObligations:n??DI,observe:i,onAssertion:o,onStep:s,signal:l,snapshot:r,steps:a})}async function km({acc:e,canon:t,classify:r,index:n,lawObligations:i,observe:o,onAssertion:s,onStep:a,signal:l,snapshot:c,steps:u}){cr(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 sc(a,{endMs:Date.now(),findings:[h],index:n,startMs:p}),{finalModel:c,findings:[...e,h]}}return d.perform().match(()=>_I({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=To(h,d);return sc(a,{endMs:Date.now(),findings:[f],index:n,startMs:p}),Promise.resolve({finalModel:c,findings:[...e,f]})})}async function _I({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 HI({canon:t,classify:r,observe:o,pre:c,predicted:h,signal:l,step:d}),m=[...d.obligations,...i(c,f.snapshot)],g=[...await jI({obligations:m,onAssertion:s,signal:l,step:d}),...f.findings];return sc(a,{endMs:Date.now(),findings:g,index:n,startMs:u}),km({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 jI({obligations:e,onAssertion:t,signal:r,step:n}){let i=[...new Map(e.map(s=>[mm(s.source),s])).values()],o=await Promise.all(i.map(async s=>({obligation:s,outcome:await FI(s,r)})));return o.forEach(s=>{VI(t,s.obligation,s.outcome,n)}),o.flatMap(s=>UI(s.obligation,s.outcome,n))}function FI(e,t){if(e.check.kind==="decided"){let r=e.check.passed?"passed":"failed";return Promise.resolve({kind:r})}return zI(e.budget,e.check.run,t)}function VI(e,t,r,n){e?.({outcome:BI(r),source:t.source,step:n.step})}function BI(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function UI(e,t,r){return t.kind==="error"?[To(t.error,r)]:t.kind==="failed"?[{budget:e.budget,kind:"obligation",source:e.source,step:r.step}]:[]}function To(e,t){return{error:e,kind:"driver-error",step:t.step}}function sc(e,t){e?.(t)}var Xn={async:12e4,fast:5e3,slow:3e4},Cm={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:Xn.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:Xn.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:Xn.slow}};function Rm(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function ym(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function WI(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function bm({canon:e,pre:t,predicted:r,step:n},i){let o=n.verifyChanges==null?[]:n.verifyChanges(r,i),s=WI(r,i,n),a=o.map(l=>({divergence:l,pending:!0}));return{adopted:s,probed:[...a,...Jl({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Em(e,t){return{budget:t.settle,divergence:e.divergence,kind:"consistency",pending:e.pending,step:t.step}}function wm(e,t,r){let n=e.probed.filter(i=>!i.pending&&r(i.divergence)==="strict");return n.length>0?{findings:n.map(i=>Em(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Sm(e,t,r){return{findings:[...e.probed.map(n=>Em(n,t)),...r],snapshot:e.adopted}}async function HI({canon:e,classify:t,observe:r,pre:n,predicted:i,signal:o,step:s}){let a=Cm[s.settle],l=Date.now()+a.timeoutMs,c=await ym(r);if(!c.ok)return{findings:[To(c.error,s)],snapshot:i};let u=bm({canon:e,pre:n,predicted:i,step:s},c.observed),d=0;for(;Date.now()<l;){cr(o);let p=wm(u,s,t);if(p!=null)return p;await oc(Rm(a,d),o),d+=1;let h=await ym(r);if(!h.ok)return Sm(u,s,[To(h.error,s)]);u=bm({canon:e,pre:n,predicted:i,step:s},h.observed)}return wm(u,s,t)??Sm(u,s,[])}async function zI(e,t,r){let n=Cm[e],i=Date.now()+n.timeoutMs,o=await vm(t),s=0;for(;o.kind==="pending"&&Date.now()<i;)cr(r),await oc(Rm(n,s),r),s+=1,o=await vm(t);return o.kind==="pending"?{kind:"failed"}:o}function vm(e){return e().match(t=>t?{kind:"passed"}:{kind:"pending"},t=>({error:t,kind:"error"}))}import{z as GI}from"zod";var cc=GI.string().brand(),le=cc.parse("");function _t(e){return cc.parse(e)}function Rt(e,t){return cc.parse(e.length===0?t:`${e}.${t}`)}function We(e){return Yr.safeParse(e).success}function ur(e){return typeof e=="object"&&e!==null&&"template"in e}function lc(e,t,r){let n=Rt(t,e.ref);if(!r.has(n))throw new Error(`unresolved binding ref "${n}"`);return r.get(n)??null}function Oo(e,t,r){return qI(e).every(n=>r.has(Rt(t,n)))}function ft(e,t,r){return typeof e=="string"?e:We(e)?String(lc(e,t,r)):e.template.map(n=>typeof n=="string"?n:String(lc(n,t,r))).join("")}function ht(e,t,r){return e===null||typeof e=="number"||typeof e=="boolean"?e:We(e)?lc(e,t,r):ft(e,t,r)}function Im(e,t){return ht(e,le,t)}function Qn(e){return Po(e)}function Qr(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,ht(i,t,r)]))}function qI(e){return e==null||typeof e!="object"?[]:ur(e)?e.template.flatMap(t=>typeof t=="string"?[]:[t.ref]):[e.ref]}function dr(e){return typeof e=="object"&&e!==null&&"kind"in e}function Nr(e){return Object.fromEntries(Object.entries(e).filter(t=>!dr(t[1])))}function Am(e,t,r){return t.reduce((n,i)=>KI(n,i,r,e),e)}function Pm(e,t){return Object.keys(t).length===0?e:{...e,singletons:{...e.singletons,...t}}}function KI(e,t,r,n){if(!YI(t,r))return e;if(t.assertion.kind==="created"){let o=Qr(t.assertion.props,le,r);return JI(e,t.entity,Qn(o),o)}if(t.assertion.kind==="deleted")return uc(e,t.entity,eA(t.key,r,n));let i=Qr(Nr(t.assertion.props),le,r);return uc(e,t.entity,tA(t.key,i,r,n))}function YI(e,t){return("props"in e.assertion?[e.key,Nr(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(i=>Mm(i)||!We(i)||t.has(_t(i.ref))))}function JI(e,t,r,n){let i=new Map([...e.entities.get(t)??[],[r,n]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function uc(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function ei(e,t,r,n){let i={env:n,key:r,snapshot:e};return[...(e.entities.get(t)??new Map).values()].filter(o=>No(o,i))}function Tm(e,t,r,n,i){let o={env:n,key:r,snapshot:e};return uc(e,t,s=>new Map([...s].map(([a,l])=>[a,No(l,o)?i(l):l])))}function No(e,t){return Object.entries(t.key).every(([r,n])=>Om(e[r],n,t))}function Om(e,t,r){return Mm(t)?ZI(t,r).has(Mo(e)):Mo(e)===Mo(QI(t,r.env))}function Mm(e){return typeof e=="object"&&e!==null&&"kind"in e}function ZI(e,t){let r=t.snapshot.entities.get(e.selection.entity);return r==null?new Set:new Set([...r.values()].filter(n=>XI(n,e.selection.where,t)).map(n=>Mo(n[e.field])))}function XI(e,t,r){return Object.entries(t).every(([n,i])=>Om(e[n],i,r))}function Mo(e){return e==null?"\u2205":e instanceof Date?e.toISOString():JSON.stringify(e)}function QI(e,t){return ht(e,le,t)}function eA(e,t,r){let n={env:t,key:e,snapshot:r};return i=>new Map([...i].filter(([,o])=>!No(o,n)))}function tA(e,t,r,n){let i={env:r,key:e,snapshot:n};return o=>new Map([...o].map(([s,a])=>No(a,i)?[s,{...a,...t}]:[s,a]))}function $m(e){let t=e.predicates.filter(o=>Fm(o)),r=t.filter(o=>o.assertion.kind==="created"),n=jm(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)=>lA(u,s,d,e.env),{env:e.env,snapshot:o}),l=n.reduce((u,d)=>aA(u,s,d,e.env),a.snapshot),c=i.reduce((u,d)=>nA(u,s,d),a.env);return rA(uA(l,e.deferred,c),s,e.adopt)}}function rA(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 Dm(e,t,r){return new Map([...e,...Object.entries(r).map(([n,i])=>[Rt(le,`${t}.${n}`),i])])}function nA(e,t,r){let n=ei(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:Dm(e,r.assertion.as,n)}function _m(e){let t=jm(e.predicates.filter(r=>Fm(r)));if(t.length!==0)return(r,n)=>t.flatMap(i=>iA(i,r,n,e.env))}function jm(e){return e.filter(t=>t.assertion.kind==="updated"&&dc(t.assertion.props).length>0)}function dc(e){return Object.entries(e).filter(([,t])=>dr(t)).map(([t])=>t)}function Fm(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function iA(e,t,r,n){let i=ei(t,e.entity,e.key,n).at(0),o=ei(r.snapshot,e.entity,e.key,n).at(0);if(i==null||o==null)return[];let s=Qn(oA(e.key,n));return dc(e.assertion.props).flatMap(a=>Nm(i[a])===Nm(o[a])?[{entity:e.entity,field:a,key:s,kind:"expected-change",value:o[a]}]:[])}function oA(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!sA(n[1])));return Qr(r,le,t)}function sA(e){return typeof e=="object"&&e!==null&&"kind"in e}function Nm(e){return e==null?"\u2205":JSON.stringify(e)}function aA(e,t,r,n){let i=dc(r.assertion.props),o=ei(t.snapshot,r.entity,r.key,n).at(0);return o==null?e:Tm(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function lA(e,t,r,n){if(r.assertion.kind!=="created")return e;let i=Qr(r.assertion.props,le,n),o=Qn(i),s=e.snapshot.entities.get(r.entity);if(s==null||!s.has(o))return e;let a=cA(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:Dm(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function cA(e,t,r){if(e!=null)return[...e].find(([n,i])=>!t.has(n)&&Object.entries(r).every(([o,s])=>Lm(i[o])===Lm(s)))}function Lm(e){return e==null?"\u2205":JSON.stringify(e)}function uA(e,t,r){let n=t.reduce((i,o)=>{let s=dA(o.value,r);return s==null?i:{...i,[o.name]:Xr(o.name,s)}},e.singletons);return{...e,singletons:n}}function dA(e,t){try{return ft(e,le,t)}catch{return}}function Lo(e,t){if(e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused")return{kind:e.kind,locator:ti(e.locator,t)};if(e.kind==="not"){let r=Lo(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:ti(e.locator,t),value:ft(e.value,le,t)}:e.kind!=="browser"?null:{kind:"browser",name:e.name,value:ft(e.value,le,t)}}function ri(e,t){let r=e.expect.filter(l=>l.kind==="state"),n=bA(r),{adopt:i,conditional:o,deferred:s,immediate:a}=hA(e,t,n);return{action:wA(e.action,t),label:e.action.kind,obligations:e.expect.flatMap(l=>vA(l,t)),reconcile:$m({adopt:i,deferred:s,env:t,predicates:r}),verifyChanges:_m({adopt:i,deferred:s,env:t,predicates:r}),effect:l=>{let c=Am(l,r,t),u=o.reduce((d,p)=>({...d,...pc(p,c,t)}),{});return Pm(c,{...a,...u})}}}function ti(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:ft(e.name,le,t),role:e.role}:e.by==="inside"?{by:"inside",scope:ti(e.scope,t),target:ti(e.target,t)}:{by:"testId",value:ft(e.value,le,t)}}function pc(e,t,r){return e==null?{}:e.kind==="when"?fc(e.condition,t,r)?pc(e.consequence,t,r):pc(e.otherwise,t,r):fA(e,r)}function fc(e,t,r){if(!pA(e))throw new Error(`when() condition cannot be a "${e.kind}" predicate`);switch(e.kind){case"singleton":return t.singletons[e.singleton]===ht(e.assertion.value,le,r);case"count":return(t.entities.get(e.entity)?.size??0)===e.value;case"not":return!fc(e.predicate,t,r);case"and":return e.predicates.every(n=>fc(n,t,r))}}function pA(e){return e.kind==="singleton"||e.kind==="count"||e.kind==="not"||e.kind==="and"}function fA(e,t){if(e.kind!=="browser"&&e.kind!=="singleton")return{};let r=e.kind==="browser"?e.value:e.assertion.value;return Oo(r,le,t)?Vm(e,t):{}}function hA(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:sr(ft(e.action.url,le,t))}:{},o=n?["url"]:[];return e.expect.reduce((s,a)=>a.kind==="browser"&&mA(a.value,r)?{...s,deferred:[...s.deferred,{name:a.name,value:a.value}]}:a.kind==="browser"||a.kind==="singleton"?{...s,immediate:{...s.immediate,...Vm(a,t)}}:a.kind==="when"?{...s,conditional:[...s.conditional,a]}:s,{adopt:o,conditional:[],deferred:[],immediate:i})}function mA(e,t){return gA(e).some(r=>t.has(r.split(".")[0]??r))}function gA(e){return typeof e=="string"?[]:We(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function Vm(e,t){if(e.kind==="browser")return{[e.name]:yA(e,t)};if(e.kind==="singleton")return{[e.singleton]:ht(e.assertion.value,le,t)};throw new Error("when() consequence must be a url (browser) or singleton assertion")}function yA(e,t){return Xr(e.name,ft(e.value,le,t))}function bA(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function wA(e,t){return{files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:SA(e,t),url:e.kind==="goto"?ft(e.url,le,t):void 0,value:"value"in e?Im(e.value,t):void 0}}function SA(e,t){if(!(!("locator"in e)||e.locator==null))return ti(e.locator,t)}function vA(e,t){if(e.kind==="browser"||e.kind==="singleton")return[];let r=Lo(e,t),n="wait"in e?e.wait??"fast":"fast";return r==null?[]:[{budget:n,check:r}]}import{err as xA,ok as kA,okAsync as dK,Result as CA}from"neverthrow";function hc(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=IA(e),o={env:new Map,generate:r.generate,indexed:i,overrides:new Map(Object.entries(r.params??{}).map(([a,l])=>[_t(a),l]))};AA(n.params,le,o);let s=n.world.map(a=>PA(a,le,o));return r.materialize(s).map(a=>RA(NA(a,o.env,i),n,e))}function mc(e){return t=>{let r=t.map(n=>({as:n.as,entity:n.entity,fields:n.fields}));return e(r).andThen(n=>EA(t,n))}}function Bm(e,t){let r=$o(t);return Object.fromEntries(Object.entries(e).filter(([n,i])=>r.includes(n)&&i!=null))}function $o(e){return Object.entries(e.props).filter(([,t])=>t.stable).map(([t])=>t)}function RA(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,ht(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 EA(e,t){let r=new Map(t.map(n=>[n.as,n]));return CA.combine(e.map(n=>{let i=r.get(n.as);return i==null?xA(om(n.as)):kA({as:n.as,entity:n.entity,row:i.row,session:i.session})}))}function IA(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function AA(e,t,r){Object.entries(e).forEach(([n,i])=>{let o=Rt(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 PA(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=Rt(t,e.as),o=TA(e.set,t,r.env);return{as:i,entity:e.entity,fields:{...MA(n,o,i,r),...o},model:n,seedPrefix:i}}function TA(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,i])=>[n,OA(i,t,r)]))}function OA(e,t,r){if(!We(e))return e;let n=Rt(t,e.ref);return r.get(n)??{ref:n}}function MA(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,$A({field:i,generate:n.generate,model:e,seedPrefix:r,spec:o,valueSpaces:n.indexed.valueSpaces})]))}function NA(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(Rt(_t(o.as),l),c));let a=n.get(o.entity)??new Map;return a.set(DA(o.row,s),Bm(o.row,s)),n.set(o.entity,a),o.session==null?[]:[o.session]});return{auth:LA(i),env:t,snapshot:{entities:_A(n),singletons:{}}}}function LA(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 $A({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:Rt(n,e),type:i.type,values:o.get(s)?.values,valueSpace:s})}function DA(e,t){return t.identity.map(r=>String(e[r])).join(":")}function _A(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function jt(e){return`${e.test}#${String(e.index)}`}function en(e){let t=e.tests.flatMap(r=>Do(e,r.name));return Mr(t,r=>`${r.test}:${Me(r.steps)}`)}function Do(e,t){let r=Km(e,t),n=Hm(r,e),i=Um(n,r.singletons),o=sP(r,oP(e));return jA(i,aP(r.steps),n).map(({chunk:a,guard:l},c)=>nP({chunk:a,guard:l,index:c,intent:r.intent,namespace:n.namespace,paramSpaceOf:o,testName:t}))}function Um(e,t){return{absences:tP(e),entities:rP(e),exclusives:e.exclusives,optionals:qm(e.optionals,e),singletons:Object.fromEntries(Object.entries(t).filter(([,r])=>!We(r)&&!ur(r)))}}function _o(e,t,r){return Object.values(e).flatMap(n=>We(n)?yc(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function jA(e,t,r){return t.reduce((n,i)=>({guard:FA(n.guard,i,r),guarded:[...n.guarded,{chunk:i,guard:ZA(n.guard,i)}]}),{guard:e,guarded:[]}).guarded}function FA(e,t,r){let n=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>VA(i,o,r),e);return{...n,singletons:{...n.singletons,...KA(t)}}}function VA(e,t,r){return t.assertion.kind==="deleted"?BA(e,t,r):t.assertion.kind==="created"?HA(e,t.entity,t.assertion.as,t.assertion.props,r):GA(e,t,r)}function BA(e,t,r){let n=_o(t.key,t.entity,r.namespace),i=e.entities.find(a=>a.alias===n),o=ni(UA(t.key),t.entity,r),s=i==null?{entity:t.entity,...o}:{entity:i.entity,...WA(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function UA(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return Gm(r)?[]:[[t[0],r]]}))}function WA(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function HA(e,t,r,n,i){let o=ni(n,t,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!zA(o,s)),entities:[...e.entities,{alias:r,entity:t,...o}]}}function zA(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 GA(e,t,r){if(t.assertion.kind!=="updated")return e;let n=_o(t.key,t.entity,r.namespace);if(n==null)return e;let i=ni(Nr(t.assertion.props),t.entity,r),o=Object.entries(t.assertion.props).filter(([,a])=>dr(a)).map(([a])=>a),s=a=>a.alias===n?qA(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a)),optionals:e.optionals.map(a=>s(a))}}function qA(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 KA(e){return e.reduce((t,r)=>({...t,...YA(r),...JA(r)}),{})}function YA(e){return e.action.kind==="goto"?{url:e.action.url}:{}}function JA(e){return Object.fromEntries(e.expect.flatMap(t=>t.kind==="browser"?[[t.name,t.value]]:t.kind==="singleton"?[[t.singleton,t.assertion.value]]:[]))}function ZA(e,t){return t[0]?.action.kind!=="goto"?e:{...e,singletons:Object.fromEntries(Object.entries(e.singletons).filter(([r])=>r!=="url"))}}function jo(e,t){let r=Km(e,t),n=Hm(r,e);return{guard:Um(n,r.singletons),namespace:n.namespace,stable:n.stable}}function Wm(e,t){return[...new Set(e)].flatMap(r=>yc(r,t))}function mt(e){return We(e)?[e.ref]:ur(e)?e.template.flatMap(t=>We(t)?[t.ref]:[]):[]}function pr(e){switch(e.kind){case"visible":case"disabled":case"enabled":case"focused":return fr(e.locator);case"value":case"text":return[...fr(e.locator),...mt(e.value)];case"singleton":return mt(e.assertion.value);case"browser":return mt(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(Nr(e.assertion.props)).flatMap(t=>mt(t)),...Object.values(e.key).flatMap(t=>zm(t))];case"not":return pr(e.predicate);case"when":return[...pr(e.condition),...pr(e.consequence),...e.otherwise==null?[]:pr(e.otherwise)];case"and":return e.predicates.flatMap(t=>pr(t));case"count":return[]}}function Hm(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:XA(t)}}function XA(e){let t=new Map(e.entities.map(r=>[r.name,r]));return(r,n)=>t.get(r)?.props[n]?.stable===!0}function fr(e){return e.by==="inside"?[...fr(e.scope),...fr(e.target)]:e.by==="role"?e.name==null?[]:mt(e.name):mt(e.value)}function zm(e){return Gm(e)?Object.values(e.selection.where).flatMap(t=>zm(t)):mt(e)}function Gm(e){return typeof e=="object"&&e!==null&&"kind"in e}function QA(e){return e.kind==="goto"?mt(e.url):e.kind==="fill"||e.kind==="select"?[...fr(e.locator),...mt(e.value)]:e.kind==="press"?e.locator==null?[]:fr(e.locator):(e.kind==="upload",fr(e.locator))}function eP(e){return[...QA(e.action),...e.expect.flatMap(t=>pr(t))]}function tP(e){return e.absences.map(t=>({entity:t.entity,...ni(t.where,t.entity,e)}))}function ni(e,t,r){let n=Object.entries(e).filter(([s])=>r.stable(t,s)),i=Object.fromEntries(n.flatMap(([s,a])=>We(a)||ur(a)?[]:[[s,a]])),o=n.flatMap(s=>{let a=s[1];if(!We(a))return[];let l=yc(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,...ni(r.set,r.entity,t)}))}function rP(e){return qm(e.setups,e)}function nP(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=>eP(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:xm(n.flatMap(s=>iP(s)))}}function iP(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function yc(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 Km(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 oP(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function sP(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function aP(e){return gc(e,0,[],[])}function gc(e,t,r,n){let i=e[t];if(i==null)return r.length===0?n:[...n,r];let o=[...r,i];return lP(i)?gc(e,t+1,[],[...n,o]):gc(e,t+1,o,n)}function lP(e){return e.expect.some(t=>t.kind==="state")}function Ym(e){return Jm(e,new Map)}function cP(e,t){return e.reduce((r,n)=>r??t(n),null)}function Jm(e,t){let r=e.variables.find(n=>!t.has(n));return r==null?t:cP(e.domain(r),n=>{let i=new Map([...t,[r,n]]);return e.consistent(i)?Jm(e,i):null})}function Et(e,t){let r=uP(e,t);if(r==null)return null;let n=gP(r);return yP(e.singletons,t,n)?n:null}function uP(e,t){let{absences:r,entities:n,exclusives:i,optionals:o}=e,s=new Map(n.map(c=>[c.alias,c])),a=Ym({variables:n.map(c=>c.alias),consistent:c=>dP(c)&&pP(n,c)&&hP(r,c,t),domain:c=>Qm(s.get(c),t)});if(a==null)return null;let l=eg(o,a,t);return mP(i,[...n,...o],l,t)?l:null}function dP(e){let t=[...e.values()];return new Set(t).size===t.length}function pP(e,t){return e.every(r=>t.has(r.alias)?r.relations.every(n=>fP(r,n,t)):!0)}function fP(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 hP(e,t,r){return e.every(n=>![...r.entities.get(n.entity)?.values()??[]].some(i=>Zm(i,n,t)))}function Zm(e,t,r){return Xm(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 Xm(e,t){return Object.entries(t.literals).every(([r,n])=>n===null?e[r]==null:e[r]===n)}function Qm(e,t){return e==null?[]:[...t.entities.get(e.entity)?.values()??[]].filter(r=>Xm(r,e))}function eg(e,t,r){let n=e.reduce((i,o)=>{if(i.has(o.alias))return i;let s=new Set(i.values()),a=Qm(o,r).find(l=>!s.has(l)&&Zm(l,o,i));return a==null?i:new Map([...i,[o.alias,a]])},t);return n.size===t.size?n:eg(e,n,r)}function mP(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 gP(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"?[[_t(`${t}.${n[0]}`),i]]:[]})))}function yP(e,t,r){return Object.entries(e).every(([n,i])=>{if(!Oo(i,le,r))return!1;let o=ht(i,le,r),s=t.singletons[n],a=Nt.safeParse(n);return a.success?Yl(a.data,o,s):s===o})}function Vo(e,t,r){let n=Et(e.guard,t);return n==null?null:new Map([...n,...Object.entries(r).map(([i,o])=>[_t(i),o])])}function Bo(e,t){let r=ri(e.effectStep,t),n=SP(e,t),i=[...e.nav,...e.steps].map(o=>ri(o,t));return{effect:vP(r.effect,n),steps:i.map(o=>({action:o.action,effect:o.effect,obligations:o.obligations,reconcile:o.reconcile,verifyChanges:o.verifyChanges}))}}function bc(e,t,r){return Et(e.guard,r)==null?!1:Fo(t(r))!==Fo(r)||xP(e)||bP(e)}function bP(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}var tg=new WeakMap;function Fo(e){let t=tg.get(e);if(t!=null)return t;let r=Me({entities:[...e.entities].map(([n,i])=>[n,[...i]]),singletons:wP(e.singletons)});return tg.set(e,r),r}function wP(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>t==="url"&&typeof r=="string"?[t,sr(r)]:[t,r]))}function SP(e,t){let r=e.nav.at(-1);return r==null?void 0:ri(r,t).action.url}function vP(e,t){if(t==null)return e;let r=sr(t);return n=>{let i=e(n);return{...i,singletons:{...i.singletons,url:r}}}}function xP(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>dr(r)))}function rg(e,t,r){let n=Vo(e,t.snapshot,r);if(n==null)return null;let i=kP(e,n);return i==null||!bc(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function ng(e,t,r){let n=Vo(e,t.snapshot,r);if(n==null)return"guard-unsatisfied";try{return Bo(e,n),"no-effect"}catch{return"unresolvable"}}function kP(e,t){try{return Bo(e,t)}catch{return null}}var CP={absences:[],entities:[],exclusives:[],optionals:[],singletons:{}};function ii(e){return{...CP,...e}}function wc(e){return RP(e).flatMap(t=>EP(t))}function RP(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 EP(e){if(e.length<2)return[];let t=e.map(o=>new Set(o.when.entities.map(s=>ig(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?[]:IP(i,n,PP(e))}function ig(e){return Me([e.entity,e.literals])}function IP(e,t,r){let n=e.when.entities.filter(s=>t.includes(ig(s))),i=new Set(n.map(s=>s.alias));if(![...e.refs].every(s=>i.has(s)))return[];let o=ii({entities:n.map(s=>AP(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 AP(e,t){return{...e,relations:e.relations.filter(r=>t.has(r.targetAlias))}}function PP(e){return[...new Set(e.flatMap(t=>t.origin==null?[]:t.origin.kind==="generalized"?t.origin.tests:[t.origin.test]))]}function xc(e){return e.flatMap((t,r)=>e.slice(r+1).flatMap(n=>lg(t,n)))}function ag(e,t){return lg(e,t).length>0}function lg(e,t){let r=og(e.when,t.when);return!r&&!og(t.when,e.when)||!OP(e.consequence,t.consequence)?[]:[{a:e.consequence,b:t.consequence,when:r?t.when:e.when}]}function og(e,t){return Sc(e.entities,t.entities)&&Sc(e.absences,t.absences)&&Sc(e.optionals,t.optionals)&&e.exclusives.every(r=>t.exclusives.includes(r))&&TP(e.singletons,t.singletons)}function Sc(e,t){let r=new Set(t.map(n=>Me(n)));return e.every(n=>r.has(Me(n)))}function TP(e,t){return Object.entries(e).every(([r,n])=>Me(t[r])===Me(n))}function OP(e,t){return e.kind==="not"?vc(e.predicate,t):t.kind==="not"?vc(e,t.predicate):MP(e,t)||NP(e,t)}function vc(e,t){return e.kind===t.kind&&"locator"in e&&"locator"in t&&cg(e,t)}function cg(e,t){return"locator"in t&&Me(e.locator)===Me(t.locator)}function MP(e,t){let r=new Set([e.kind,t.kind]);return r.has("enabled")&&r.has("disabled")&&"locator"in e&&"locator"in t?cg(e,t):!1}function NP(e,t){let r=sg(e),n=sg(t);return r==null||n==null||e.kind!==t.kind?!1:vc(e,t)&&Me(r)!==Me(n)}function sg(e){return e.kind==="value"||e.kind==="text"?e.value:null}function kc(e,t){return e.flatMap(r=>{let n=LP(r),i=new Set(r.guard.absences.map(o=>o.entity));return t.flatMap(o=>$P(r,o,n,i))})}function LP(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function $P(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:jt(e)}]}function Rc(e){return Me({consequence:e.consequence,when:e.when})}function Ec(e){let t=[...DP(e),...GP(e)],r=wc(t).reduce((n,i)=>[...t,...n].some(s=>ag(i,s))?n:[...n,i],[]);return Mr([...t,...r],Rc)}function Ic(e){return e.kind==="not"?Ic(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="value"||e.kind==="text"}function Ac(e,t,r){if(Et(e.when,t)!=null)return null;let n=Et(e.when,r);return n==null?null:KP(e,n)}function DP(e){return Mr(e.tests.flatMap(t=>_P(e,t)),Rc)}function _P(e,t){let r=jo(e,t.name);return t.steps.reduce((n,i)=>({guard:jP(n.guard,i,r),laws:[...n.laws,...zP(i,n.guard,r.namespace,{kind:"test",test:t.name})]}),{guard:r.guard,laws:[]}).laws}function jP(e,t,r){return t.expect.reduce((n,i)=>i.kind==="state"?FP(n,i,r):n,e)}function FP(e,t,r){if(t.assertion.kind==="created"){let o=VP(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,o]}}let n=_o(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return WP(e,n);let i=Nr(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===n?Cc(o,i,r):o),optionals:e.optionals.map(o=>o.alias===n?Cc(o,i,r):o)}}function VP(e,t,r,n){return Cc({alias:e,entity:t,literals:{},relations:[]},r,n)}function Cc(e,t,r){return Object.entries(t).reduce((n,[i,o])=>{if(ur(o)||!r.stable(e.entity,i))return n;if(We(o)){let s=BP(o.ref,i,r.namespace);return{...n,literals:UP(n.literals,i),relations:s==null?n.relations:[...ug(n.relations,i),s]}}return{...n,literals:{...n.literals,[i]:o},relations:ug(n.relations,i)}},e)}function BP(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 UP(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function ug(e,t){return e.filter(r=>r.field!==t)}function WP(e,t){let r=[...e.entities,...e.optionals].find(i=>i.alias===t),n=HP(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,relations:r.relations}]}}function HP(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t),optionals:e.optionals.filter(r=>r.alias!==t)}}function zP(e,t,r,n){if(e.action.kind!=="goto")return[];let i=e.action.url;return e.expect.filter(o=>Ic(o)).map(o=>dg({consequence:o,guard:t,namespace:r,origin:n,url:i}))}function dg({consequence:e,guard:t,namespace:r,origin:n,url:i}){return{consequence:e,origin:n,refs:new Set(Wm([...mt(i),...pr(e)],r).map(o=>o.aliasPath)),when:{...t,singletons:{...t.singletons,url:i}}}}function GP(e){return Mr(en(e).flatMap(t=>qP(t)),Rc)}function qP(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?[]:[dg({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 KP(e,t){try{let r=Lo(e.consequence,t);return r==null?null:{check:r}}catch{return null}}function Pc(e){return ic(e.tests.flatMap(t=>YP(e,t.name)))}function Tc(e,t){return Et(e.when,t)==null?!1:Et(e.holds,t)==null}function YP(e,t){let r=jo(e,t);return r.guard.entities.flatMap(n=>n.relations.flatMap(i=>JP(e,n,i,r.namespace)?QP(n,i,r.namespace):[]))}function JP(e,t,r,n){let i=n.get(r.targetAlias);return i!=null&&!ZP(e,t.entity,r.field)&&XP(e,i,r.targetField)}function ZP(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function XP(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function QP(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let i=pg(e.alias,e.entity),o=pg(t.targetAlias,n);return[{holds:ii({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:ii({entities:[i]})}]}function pg(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function Oc(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 fg(e,t){let{params:r,transition:n}=e.firing,i=rg(n,e.state,r);if(i==null){let s={intent:n.intent,kind:"unfireable",reason:ng(n,e.state,r),test:n.test};return{label:jt(n),next:e.state,result:{finalModel:e.state.snapshot,findings:[s]}}}let o=await ac({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,lawObligations:tT(e.laws,e.invariants,e.driver),observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,steps:Oc(e.firing.transition,i.resolved,e.driver)},t);return{label:jt(e.firing.transition),next:{snapshot:o.finalModel},result:o}}function eT(e,t){return Tc(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},source:{invariant:e,kind:"invariant"}}]:[]}function tT(e,t,r){return(n,i)=>[...e.flatMap(o=>rT(o,n,i,r)),...t.flatMap(o=>eT(o,i))]}function rT(e,t,r,n){let i=Ac(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 Nc(e,t){return Mc({acc:{findings:[],fired:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function Mc({acc:e,index:t,params:r,signal:n,state:i,stepBase:o}){cr(n);let s=r.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=await fg({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 Mc({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 Mc({acc:u,index:t+1,params:r,signal:n,state:c.next,stepBase:o+l.length})}var $c={value:e=>nT(e)};function Dc(e,t){return{value:r=>e.value({...r,seed:`${t}:${r.seed}`})}}function _c(e,t){return{value:r=>e.value({...r,anchor:t})}}function nT({anchor:e,constraints:t,generator:r,nullable:n,seed:i,type:o,values:s,valueSpace:a}){let l=Lc(`${a}:${i}`);return n&&l%4===0?null:s!=null&&s.length>0?s[l%s.length]??s[0]??null:r==="date.iso"?iT({anchor:e,constraints:t,n:l,timeHash:Lc(`${a}:${i}#tod`)}):o==="number"?oT(l,t):o==="boolean"?l%2===0:sT(r,l.toString(36))}var Uo=864e5;function iT({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/Uo)*Uo;return new Date(a+s*Uo+n%Uo).toISOString()}function Lc(e,t=0,r=7){return t>=e.length?r>>>0:Lc(e,t+1,r*31+(e.codePointAt(t)??0)>>>0)}function oT(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 sT(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 Fc}from"neverthrow";var oi=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}};function jc(e){return{read:t=>aT(t,e),seedScript:t=>`globalThis[${JSON.stringify(Ll)}] = ${JSON.stringify(t)};`}}async function aT(e,t){let r={title:await e.title(),url:sr(e.url()),viewport:uT(e.viewportSize())};if(t.length===0)return r;let n=await e.evaluate(cT,{mountKey:wo,names:t,timeoutMs:lT});if(n.kind==="unmounted")throw new oi(wo);return{...r,...n.values}}var lT=5e3;async function cT(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 uT(e){return e==null?"":`${String(e.width)}x${String(e.height)}`}function Bc(e,t,r){return{evaluate:n=>Fc.fromPromise(gg(dT(e,r,n),`check ${n.kind}`),hg),observe:()=>t.read().andThen(n=>Fc.fromPromise(gg(yg(e,r,0),"observe"),hg).map(i=>({snapshot:{...n,singletons:{...n.singletons,...i}}}))),perform:n=>Fc.fromPromise(wg(e,n,0),i=>sm(n.kind,i))}}async function dT(e,t,r){try{return await xg(e,t,r)}catch(n){if(bg(n))return!1;throw n}}function hg(e){return e instanceof oi?rm(e.mountKey):am(e)}var pT=[100,250,500];async function yg(e,t,r){try{return await t.read(e)}catch(n){let i=pT[r];if(i==null||!bg(n))throw n;return await vg(i),yg(e,t,r+1)}}function bg(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 mg=35e3;function gg(e,t){let r,n=new Promise((i,o)=>{r=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(mg)}ms`))},mg)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}var fT=[250,750,2e3];async function wg(e,t,r){try{await hT(e,t)}catch(n){let i=fT[r];if(i==null||!yT(n))throw n;await vg(i),await wg(e,t,r+1)}}async function hT(e,t){if(t.kind==="goto"){await e.goto(tn(t.url,t,"url"));return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(tn(t.key,t,"key"));return}await mT(Sg(e,t.locator),t)}function tn(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function mT(e,t){switch(t.kind){case"goto":throw new Error("goto must not be located");case"fill":return e.fill(String(tn(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(tn(t.value,t,"value")));case"upload":return e.setInputFiles(tn(t.files,t,"files"));case"press":return e.press(tn(t.key,t,"key"))}}function Sg(e,t){if(t==null)throw new Error("action requires a locator");return Vc(e,t)}function Vc(e,t){return t.by==="testId"?e.getByTestId(t.value):t.by==="inside"?Vc(Vc(e,t.scope),t.target):e.locator(gT(t.role,t.name))}function gT(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 vg(e){return new Promise(t=>{setTimeout(t,e)})}async function xg(e,t,r){if(r.kind==="browser")return bT(e,t,r.name,r.value);if(r.kind==="not")return!await xg(e,t,r.inner);let n=Sg(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 bT(e,t,r,n){let o=(await t.read(e))[r];return typeof o=="string"&&o.includes(n)}import{chromium as Cg}from"playwright";async function Uc({baseUrl:e,browser:t,capture:r,clientState:n,engine:i,reader:o,session:s}){let a=await t.newContext({baseURL:e,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:wT(Bc(c,o,i),l),emitAssertion:l.emitAssertion,close:()=>ST({context:a,handle:l})}}async function Wc(e,t){let r=await Cg.launch({headless:!e});try{return await t(r)}finally{await r.close()}}function Rg({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??=Cg.launch({headless:!e}),t},close:async()=>{let i=t;t=void 0,i!=null&&await i.then(o=>o.close()).catch(()=>{})}}}function wT(e,t){return{evaluate:e.evaluate,observe:e.observe,perform:r=>(t.emitAction(r),e.perform(r))}}async function ST({context:e,handle:t}){await kg(t.finish()),await kg(e.close())}var vT=15e3;async function kg(e){let t,r=new Promise(n=>{t=setTimeout(n,vT)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as xT,ok as kT,Result as Hc}from"neverthrow";function zc(e,t,r){return{read:()=>r.read(e.map(n=>n.name),t).andThen(n=>CT(e,n))}}function CT(e,t){return Hc.combine(e.map(r=>RT(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),singletons:t.singletons}))}function RT(e,t){let r=$o(e);return Hc.combine(t.map(n=>ET(n,e).map(i=>[i,IT(n,r)]))).map(n=>new Map(n))}function ET(e,t){return Hc.combine(t.identity.map(r=>{let n=e[r];return n==null?xT(im(t.name,r)):kT(String(n))})).map(r=>r.join(":"))}function IT(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}var Ig=ro(ml(),1);import AT from"crypto";import{err as PT,errAsync as Eg,ok as TT,ResultAsync as Wo}from"neverthrow";var OT=3e4,MT=[250,750,2e3];function Gc({baseUrl:e,runId:t,secret:r},n){let i=new Ig.Webhook(r),o=(s,a,l)=>NT({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:Vl,signal:n}).map(l=>({entities:l.entities,singletons:l.singletons}))},setupWorld:s=>o("/setup",{entities:s,runId:t},{retry:"connection",schema:Fl,signal:n}).map(a=>a.rows),teardown:()=>o("/teardown",{runId:t},{retry:"connection",schema:Bl,signal:void 0}).map(()=>{})}}function NT(e){return Ag(e.retry,()=>jT(e),0)}function Ag(e,t,r){return t().orElse(n=>{let i=MT[r];return i==null||!$T(n,e)?Eg(n):Wo.fromSafePromise(_T(i)).andThen(()=>Ag(e,t,r+1))})}var LT=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function $T(e,t){return e.kind==="aborted"?!1:DT(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function DT(e){return e.kind==="engine-network"&&e.code!=null&&LT.has(e.code)}function _T(e){return new Promise(t=>{setTimeout(t,e)})}function jT({baseUrl:e,body:t,path:r,schema:n,signal:i,webhook:o}){let s=JSON.stringify(t);return Wo.fromPromise(fetch(`${e}${r}`,{body:s,headers:{"Content-Type":"application/json",...FT(o,s)},method:"PUT",signal:VT(i)}),a=>Io(r,a)).andThen(a=>BT(a,r)).andThen(a=>UT(n,a,r)).mapErr(a=>i?.aborted===!0?lm():a)}function FT(e,t){let r=`msg_${AT.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function VT(e){let t=AbortSignal.timeout(OT);return e==null?t:AbortSignal.any([e,t])}function BT(e,t){return e.ok?Wo.fromPromise(e.json(),r=>Io(t,r)):Wo.fromPromise(e.text().catch(()=>""),r=>Io(t,r)).andThen(r=>Eg(tm(t,e.status,r)))}function UT(e,t,r){let n=e.safeParse(t);return n.success?TT(n.data):PT(nm(r,n.error))}var de=ro(Og(),1),_={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))},GT={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 si(e){return`${de.default.red(de.default.bold("\u2717"))} ${GT[e](de.default.bold(e.toUpperCase()))}`}var qT=de.default.red("\u2717"),DY=de.default.green("\u2713"),Mg=de.default.dim("\u203A"),KT=8;function te(e,t,r){let n=r==null?"":` ${_.dim(r)}`;return` ${_.dim(e.padStart(KT))} ${t}${n}`}function nn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${nn(e.scope)} \u25B8 ${nn(e.target)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function Kc(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${nn(e.locator)}`:e.kind}function Go(e){return e.kind==="not"?`not ${Go(e.inner)}`:e.kind==="browser"?`${e.name}="${e.value}"`:e.kind==="value"||e.kind==="text"?`${e.kind} ${nn(e.locator)}="${e.value}"`:`${e.kind} ${nn(e.locator)}`}function qo(e){let{field:t,source:r,target:n,targetField:i}=e.reference;return`${r}.${t} \u2192 ${n}.${i}`}function Lg(e){return`${e.intent} \u203A ${Kc(e.action)}`}function $g(e){return e.kind==="invariant"?`invariant ${qo(e.invariant)}`:`${e.kind} ${Go(e.check)}`}function rn(e){return e==null?"\u2205":JSON.stringify(e)}function Yc(e){return{label:$g(e.source),step:Lg(e.step)}}function ai(e){return e.kind==="consistency"?ZT(e):e.kind==="obligation"?nO(e.source,e.step,e.budget):e.kind==="illegal-transition"?Lr("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"?Lr("unfireable",`could not fire "${e.intent}"`,void 0,[te("reason",_.actual(JT(e.reason)),void 0),te("meaning",_.dim("a planned move was skipped \u2014 never silently drop it"),void 0)]):Lr("driver","the browser failed to run this step",e.step,[te("cause",_.actual(ar(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 YT={"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 JT(e){return YT[e]}function Jc({debugDir:e,runId:t}){let r=`${e}/${t}`;return te("behavior",_.path(`${r}/behavior.jsonl`),void 0)}function Zc(e){if(e.kind==="cascade-gap"){let{gap:n}=e,i=`${n.transition} deletes ${n.target} but leaves ${n.source} dangling`;return`${si("invariant")} ${_.bold(i)}
114
+ ${te("breaks",_.dim(qo(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`${si("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`${si("invariant")} ${_.bold(r)}
116
+ ${te("when",_.dim(JSON.stringify(t.when.singletons)),void 0)}`}function Lr(e,t,r,n){let i=r==null?[]:[` ${r.intent} ${Mg} ${_.dim(Kc(r.action))}`];return[`${si(e)} ${_.bold(t)}`,...i,...n].join(`
117
+ `)}function ZT(e){return e.pending?Lr("consistency",eO(e.divergence),e.step,[...Ng(e.divergence),te("meaning",_.dim(`the write never landed within the ${tO(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)]):Lr("consistency",rO(e.divergence),e.step,[...Ng(e.divergence),te("decide",_.dim(QT(e.divergence)),void 0)])}var XT={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 QT(e){return XT[e.kind]}function eO(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 Ng(e){if(e.kind==="field-mismatch")return[te("row",_.dim(`${e.entity} ${e.key}`),void 0),te("expected",_.expected(rn(e.snapshot)),"model predicted this"),te("actual",_.actual(rn(e.sut)),"app showed this")];if(e.kind==="singleton-mismatch")return[te("expected",_.expected(rn(e.snapshot)),"model predicted this"),te("actual",_.actual(rn(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(rn(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 tO(e){return`${String(Xn[e]/1e3)}s "${e}"`}function rO(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 nO(e,t,r){if(e.kind==="invariant")return Lr("invariant",`${qo(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?[iO(e.origin)]:[];return Lr("assertion",n,t,[te("check",_.warn(Go(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 iO(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 L5,ok as $5,ResultAsync as D5}from"neverthrow";import Hw from"path";import oO from"path";import{z as li}from"zod";var sO=["unspecified","internal","server","client","producer","consumer"],aO=["unset","ok","error"];function Dg(e){return sO[e]??"unspecified"}function _g(e){return aO[e]??"unset"}var zY=li.looseObject({data:li.looseObject({source:li.number().optional()}).optional(),timestamp:li.number(),type:li.number()});function jg({debugDir:e,runId:t,worker:r}){let n=oO.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:i=>r.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(lO(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 on(e){return String(BigInt(Math.round(e))*1000000n)}function lO(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}import{existsSync as cO}from"fs";import{createRequire as uO}from"module";import{fileURLToPath as dO}from"url";import{Worker as pO}from"worker_threads";var fO=uO(import.meta.url);function Fg(e){let t=new pO(hO(),{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 hO(){try{return fO.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=>cO(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as mO}from"fs/promises";import{createRequire as gO}from"module";import{fileURLToPath as yO}from"url";var bO=gO(import.meta.url);function Xc(e,t){try{return bO.resolve(e)}catch{return yO(new URL(`assets/${t}`,import.meta.url))}}var wO=Xc("@ripplo/browser-trace/bundle","browser-trace.js");async function Bg(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await SO())}var Vg;function SO(){return Vg??=mO(wO,{encoding:"utf8"}),Vg}import{createServer as vO}from"http";import{mkdir as xO,rm as kO,writeFile as CO}from"fs/promises";import RO from"path";import{z as re}from"zod";var EO="otlp-port",Wg=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()})}),IO=re.object({attributes:re.array(Wg).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()}),AO=re.object({resourceSpans:re.array(re.object({resource:re.object({attributes:re.array(Wg).default([])}).optional(),scopeSpans:re.array(re.object({spans:re.array(IO).default([])})).default([])})).default([])});async function ci({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:i,server:o}=await PO({onRrwebBatch:t,onSpan:r}),s=RO.join(e,EO);return n&&(await xO(e,{recursive:!0}),await CO(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{n&&await kO(s,{force:!0}),await LO(o)}}}function PO(e){return new Promise((t,r)=>{let n=vO((i,o)=>{TO(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 TO(e,t,r){let n=OO(e.url);if(n!=null){Ug(e).then(i=>{r.onRrwebBatch(n,i),Ko(t)}).catch(()=>{Ko(t)});return}Ug(e).then(i=>{MO(AO.parse(JSON.parse(i.toString("utf8"))),r.onSpan),Ko(t)}).catch(()=>{Ko(t)})}function OO(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Ug(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 Ko(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function MO(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:NO(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:Dg(r.kind),status:{code:_g(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function NO(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function LO(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{readFile as n$}from"fs/promises";var $O=Object.defineProperty,DO=(e,t,r)=>t in e?$O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k=(e,t,r)=>DO(e,typeof t!="symbol"?t+"":t,r),Hg,_O=Object.defineProperty,jO=(e,t,r)=>t in e?_O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zg=(e,t,r)=>jO(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||{}),Gg={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},qg={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Yo={},FO=()=>!!globalThis.Zone;function rd(e){if(Yo[e])return Yo[e];let t=globalThis[e],r=t.prototype,n=e in Gg?Gg[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&&!FO())return Yo[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?Yo[e]=c:r}catch{return r}}var Qc={};function Ut(e,t,r){var n;let i=`${e}.${String(r)}`;if(Qc[i])return Qc[i].call(t);let o=rd(e),s=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return s?(Qc[i]=s,s.call(t)):t[r]}var eu={};function Hy(e,t,r){let n=`${e}.${String(r)}`;if(eu[n])return eu[n].bind(t);let o=rd(e)[r];return typeof o!="function"?t[r]:(eu[n]=o,o.bind(t))}function VO(e){return Ut("Node",e,"ownerDocument")}function BO(e){return Ut("Node",e,"childNodes")}function UO(e){return Ut("Node",e,"parentNode")}function WO(e){return Ut("Node",e,"parentElement")}function HO(e){return Ut("Node",e,"textContent")}function zO(e,t){return Hy("Node",e,"contains")(t)}function GO(e){return Hy("Node",e,"getRootNode")()}function qO(e){return!e||!("host"in e)?null:Ut("ShadowRoot",e,"host")}function KO(e){return e.styleSheets}function YO(e){return!e||!("shadowRoot"in e)?null:Ut("Element",e,"shadowRoot")}function JO(e,t){return Ut("Element",e,"querySelector")(t)}function ZO(e,t){return Ut("Element",e,"querySelectorAll")(t)}function XO(){return rd("MutationObserver").constructor}function QO(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 qe={ownerDocument:VO,childNodes:BO,parentNode:UO,parentElement:WO,textContent:HO,contains:zO,getRootNode:GO,host:qO,styleSheets:KO,shadowRoot:YO,querySelector:JO,querySelectorAll:ZO,mutationObserver:XO,patch:QO};function zy(e){return e.nodeType===e.ELEMENT_NODE}function mi(e){let t=e&&"host"in e&&"mode"in e&&qe.host(e)||null;return!!(t&&"shadowRoot"in t&&qe.shadowRoot(t)===e)}function gi(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function eM(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 tM(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 fu(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=>Gy(i,r)).join("");return eM(n)}catch{return null}}function Gy(e,t){if(nM(e)){let r;try{r=fu(e.styleSheet)||tM(e)}catch{r=e.cssText}return e.styleSheet.href?Is(r,e.styleSheet.href):r}else{let r=e.cssText;return iM(e)&&e.selectorText.includes(":")&&(r=rM(r)),t?Is(r,t):r}}function rM(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function nM(e){return"styleSheet"in e}function iM(e){return"selectorText"in e}var Cs=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 oM(){return new Cs}function Rs({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"",a=n&&Dr(n);return(t[r.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function Dr(e){return e.toLowerCase()}var Kg="__rrweb_original__";function sM(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=Kg in o?o[Kg]: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 Es(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Dr(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 aM(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var lM=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,cM=/^(?:[a-z+]+:)?\/\//i,uM=/^www\..*/i,dM=/^(data:)([^,]*),(.*)/i;function Is(e,t){return(e||"").replace(lM,(r,n,i,o,s,a)=>{let l=i||s||a,c=n||o||"";if(!l)return r;if(cM.test(l)||uM.test(l))return`url(${c}${l}${c})`;if(dM.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${aM(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 Jo(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function pM(e,t,r=!1){let n=Array.from(t.childNodes),i=[],o=0;if(n.length>1&&e&&typeof e=="string"){let s=Jo(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=Jo(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=Jo(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=Jo(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 fM(e,t){return pM(e,t).join("/* rr_split */")}var hM=1,mM=new RegExp("[^a-z0-9-_:]"),bi=-2;function Ky(){return hM++}function gM(e){if(e instanceof HTMLFormElement)return"form";let t=Dr(e.tagName);return mM.test(t)?"div":t}var sn,Yg,yM=/^[^ \t\n\r\u000c]+/,bM=/^[, \t\n\r\u000c]+/;function wM(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(bM),!(r>=t.length);){let o=n(yM);if(o.slice(-1)===",")o=cn(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=cn(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 Jg=new WeakMap;function cn(e,t){return!t||t.trim()===""?t:nd(e,t)}function SM(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function nd(e,t){let r=Jg.get(e);if(r||(r=e.createElement("a"),Jg.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Yy(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)?cn(e,n):r==="srcset"?wM(e,n):r==="style"?Is(n,nd(e)):t==="object"&&r==="data"?cn(e,n):n)}function Jy(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function vM(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 As(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?As(qe.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?As(qe.parentNode(e),t,r):!1}function Zy(e,t,r,n){let i;if(zy(e)){if(i=e,!qe.childNodes(i).length)return!1}else{if(qe.parentElement(e)===null)return!1;i=qe.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(As(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 xM(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 CM(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=RM(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 IM(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 EM(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:qe.textContent(e)||"",rootId:w};default:return!1}}function RM(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function EM(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=qe.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=qe.textContent(e),c&&l&&(l=Is(l,nd(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,qe.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Fe.Text,textContent:l||"",rootId:i}}function IM(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=vM(e,n,i),m=gM(e),g={},w=e.attributes.length;for(let y=0;y<w;y++){let v=e.attributes[y];Jy(m,v.name,v.value)||(g[v.name]=Yy(r,m,Dr(v.name),v.value))}if(m==="link"&&o){let y=Array.from(r.styleSheets).find(C=>C.href===e.href),v=null;y&&(v=fu(y)),v&&(delete g.rel,delete g.href,g._cssText=v)}if(m==="style"&&e.sheet){let y=fu(e.sheet);y&&(e.childNodes.length>1&&(y=fM(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=Rs({element:e,type:Es(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")sM(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){sn||(sn=r.createElement("canvas"),Yg=sn.getContext("2d"));let y=e,v=y.currentSrc||y.getAttribute("src")||"<unknown-src>",C=y.crossOrigin,M=()=>{y.removeEventListener("load",M);try{sn.width=y.naturalWidth,sn.height=y.naturalHeight,Yg.drawImage(y,0,0),g.rr_dataURL=sn.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:SM(e)||void 0,needBlock:f,rootId:h,isCustom:S}}function pe(e){return e==null?"":e.toLowerCase()}function Xy(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 AM(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 un(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=Zy(e,s,a,x===void 0));let X=CM(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):AM(X,h)||!U&&X.type===Fe.Text&&!X.textContent.replace(/^\s+|\s+$/gm,"").length?Q=bi:Q=Ky();let j=Object.assign(X,{id:Q});if(n.add(e,j),Q===bi)return null;w&&w(e);let ze=!l;if(j.type===Fe.Element){ze=ze&&!j.needBlock,delete j.needBlock;let _e=qe.shadowRoot(e);_e&&gi(_e)&&(j.isShadowHost=!0)}if((j.type===Fe.Document||j.type===Fe.Element)&&ze){h.headWhitespace&&j.type===Fe.Element&&j.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(!(j.type===Fe.Element&&j.tagName==="textarea"&&j.attributes.value!==void 0)){j.type===Fe.Element&&j.attributes._cssText!==void 0&&typeof j.attributes._cssText=="string"&&(_e.cssCaptured=!0);for(let Er of Array.from(qe.childNodes(e))){let kt=un(Er,_e);kt&&j.childNodes.push(kt)}}let at=null;if(zy(e)&&(at=qe.shadowRoot(e)))for(let Er of Array.from(qe.childNodes(at))){let kt=un(Er,_e);kt&&(gi(at)&&(kt.isShadow=!0),j.childNodes.push(kt))}}let xt=qe.parentNode(e);return xt&&mi(xt)&&gi(xt)&&(j.isShadow=!0),j.type===Fe.Element&&j.tagName==="iframe"&&xM(e,()=>{let _e=e.contentDocument;if(_e&&S){let at=un(_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});at&&S(e,at)}},y),j.type===Fe.Element&&j.tagName==="link"&&typeof j.attributes.rel=="string"&&(j.attributes.rel==="stylesheet"||j.attributes.rel==="preload"&&typeof j.attributes.href=="string"&&qy(j.attributes.href)==="css")&&kM(e,()=>{if(v){let _e=un(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),j}function PM(e,t){let{mirror:r=new Cs,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=Xy(h);return un(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 TM=/(max|min)-device-(width|height)/,lJ=new RegExp(TM.source,"g");function OM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function MM(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 id={exports:{}},ge=String,Qy=function(){return{isColorSupported:!1,reset:ge,bold:ge,dim:ge,italic:ge,underline:ge,inverse:ge,hidden:ge,strikethrough:ge,black:ge,red:ge,green:ge,yellow:ge,blue:ge,magenta:ge,cyan:ge,white:ge,gray:ge,bgBlack:ge,bgRed:ge,bgGreen:ge,bgYellow:ge,bgBlue:ge,bgMagenta:ge,bgCyan:ge,bgWhite:ge}};id.exports=Qy();id.exports.createColors=Qy;var NM=id.exports,LM={},$M=Object.freeze(Object.defineProperty({__proto__:null,default:LM},Symbol.toStringTag,{value:"Module"})),yt=MM($M),Zg=NM,Xg=yt,hu=class eb 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,eb)}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=Zg.isColorSupported),Xg&&t&&(r=Xg(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}=Zg.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
+ `+h+a("^")}return" "+l(p)+c}).join(`
119
+ `)}toString(){let t=this.showSourceCode();return t&&(t=`
416
120
 
417
- ${u}`}}catch(u){let m=u instanceof Error?u.message:String(u);return{id:l.id,runId:c,summary:`ERROR polling run ${c}: ${m}
418
- ${w("debug")}`}}})),s=i.map(a=>`**${a.id}:**
419
- ${a.summary}`).join(`
121
+ `+t+`
122
+ `),this.name+": "+this.message+t}},od=hu;hu.default=hu;var Ai={};Ai.isClean=Symbol("isClean");Ai.my=Symbol("my");var Qg={after:`
123
+ `,beforeClose:`
124
+ `,beforeComment:`
125
+ `,beforeDecl:`
126
+ `,beforeOpen:" ",beforeRule:`
127
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function DM(e){return e[0].toUpperCase()+e.slice(1)}var mu=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 Qg[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"+DM(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=Qg[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
+ `)&&(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
+ `)&&(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
+ `)&&(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
+ `)&&(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)}},tb=mu;mu.default=mu;var _M=tb;function gu(e,t){new _M(t).stringify(e)}var Bs=gu;gu.default=gu;var{isClean:Zo,my:jM}=Ai,FM=od,VM=tb,BM=Bs;function yu(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=>yu(s,r)):(o==="object"&&i!==null&&(i=yu(i)),r[n]=i)}return r}var bu=class{constructor(t={}){this.raws={},this[Zo]=!1,this[jM]=!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=yu(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 FM(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[Zo]){this[Zo]=!1;let t=this;for(;t=t.parent;)t[Zo]=!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 VM().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=BM){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}},Us=bu;bu.default=bu;var UM=Us,wu=class extends UM{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]==="$"}},Ws=wu;wu.default=wu;var WM="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",HM=(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n},zM=(e=21)=>{let t="",r=e;for(;r--;)t+=WM[Math.random()*64|0];return t},GM={nanoid:zM,customAlphabet:HM},{SourceMapConsumer:ey,SourceMapGenerator:ty}=yt,{existsSync:qM,readFileSync:KM}=yt,{dirname:tu,join:YM}=yt;function JM(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Su=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=tu(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new ey(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 JM(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=tu(t),qM(t))return this.mapFile=t,KM(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 ey)return ty.fromSourceMap(r).toString();if(r instanceof ty)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=YM(tu(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)}},rb=Su;Su.default=Su;var{SourceMapConsumer:ZM,SourceMapGenerator:XM}=yt,{fileURLToPath:ry,pathToFileURL:Xo}=yt,{isAbsolute:vu,resolve:xu}=yt,{nanoid:QM}=GM,ru=yt,ny=od,e2=rb,nu=Symbol("fromOffsetCache"),t2=!!(ZM&&XM),iy=!!(xu&&vu),Ps=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&&(!iy||/^\w+:\/\//.test(r.from)||vu(r.from)?this.file=r.from:this.file=xu(r.from)),iy&&t2){let n=new e2(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 "+QM(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 ny(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 ny(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&&(Xo&&(o.input.url=Xo(this.file).toString()),o.input.file=this.file),o}fromOffset(t){let r,n;if(this[nu])n=this[nu];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[nu]=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:xu(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;vu(s.source)?l=Xo(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||Xo(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(ry)c.file=ry(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}},Hs=Ps;Ps.default=Ps;ru&&ru.registerInput&&ru.registerInput(Ps);var{SourceMapConsumer:nb,SourceMapGenerator:bs}=yt,{dirname:ws,relative:ib,resolve:ob,sep:sb}=yt,{pathToFileURL:oy}=yt,r2=Hs,n2=!!(nb&&bs),i2=!!(ws&&ob&&ib&&sb),o2=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
+ `;this.css.includes(`\r
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||ws(t.file),i;this.mapOpts.sourcesContent===!1?(i=new nb(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(),i2&&n2&&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=bs.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new bs({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 bs({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?ws(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=ws(ob(n,this.mapOpts.annotation)));let i=ib(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 r2(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(oy){let n=oy(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;sb==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},ab=o2,s2=Us,ku=class extends s2{constructor(t){super(t),this.type="comment"}},zs=ku;ku.default=ku;var{isClean:lb,my:cb}=Ai,ub=Ws,db=zs,a2=Us,pb,sd,ad,fb;function hb(e){return e.map(t=>(t.nodes&&(t.nodes=hb(t.nodes)),delete t.source,t))}function mb(e){if(e[lb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)mb(t)}var Vt=class gb extends a2{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=hb(pb(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 ub(t)]}else if(t.selector)t=[new sd(t)];else if(t.name)t=[new ad(t)];else if(t.text)t=[new db(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[cb]||gb.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[lb]&&mb(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]}};Vt.registerParse=e=>{pb=e};Vt.registerRule=e=>{sd=e};Vt.registerAtRule=e=>{ad=e};Vt.registerRoot=e=>{fb=e};var _r=Vt;Vt.default=Vt;Vt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,ad.prototype):e.type==="rule"?Object.setPrototypeOf(e,sd.prototype):e.type==="decl"?Object.setPrototypeOf(e,ub.prototype):e.type==="comment"?Object.setPrototypeOf(e,db.prototype):e.type==="root"&&Object.setPrototypeOf(e,fb.prototype),e[cb]=!0,e.nodes&&e.nodes.forEach(t=>{Vt.rebuild(t)})};var l2=_r,yb,bb,wi=class extends l2{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new yb(new bb,this,t).stringify()}};wi.registerLazyResult=e=>{yb=e};wi.registerProcessor=e=>{bb=e};var ld=wi;wi.default=wi;var sy={},wb=function(t){sy[t]||(sy[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Cu=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}},Sb=Cu;Cu.default=Cu;var c2=Sb,Ru=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 c2(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},cd=Ru;Ru.default=Ru;var iu=39,ay=34,Qo=92,ly=47,es=10,ui=32,ts=12,rs=9,ns=13,u2=91,d2=93,p2=40,f2=41,h2=123,m2=125,g2=59,y2=42,b2=58,w2=64,is=/[\t\n\f\r "#'()/;[\\\]{}]/g,os=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,S2=/.[\r\n"'(/\\]/,cy=/[\da-f]/i,v2=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 es:case ui:case rs:case ns:case ts:{s=g;do s+=1,o=n.charCodeAt(s);while(o===ui||o===es||o===rs||o===ns||o===ts);f=["space",n.slice(g,s)],g=s-1;break}case u2:case d2:case h2:case m2:case b2:case g2:case f2:{let U=String.fromCharCode(o);f=[U,U,g];break}case p2:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==iu&&h!==ay&&h!==ui&&h!==es&&h!==rs&&h!==ts&&h!==ns){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)===Qo;)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||S2.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case iu:case ay:{a=o===iu?"'":'"',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)===Qo;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case w2:{is.lastIndex=g+1,is.test(n),is.lastIndex===0?s=n.length-1:s=is.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case Qo:{for(s=g,c=!0;n.charCodeAt(s+1)===Qo;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==ly&&o!==ui&&o!==es&&o!==rs&&o!==ns&&o!==ts&&(s+=1,cy.test(n.charAt(s)))){for(;cy.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===ui&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{o===ly&&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):(os.lastIndex=g+1,os.test(n),os.lastIndex===0?s=n.length-1:s=os.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}},vb=_r,Ts=class extends vb{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)}},ud=Ts;Ts.default=Ts;vb.registerAtRule(Ts);var xb=_r,kb,Cb,pn=class extends xb{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 kb(new Cb,this,t).stringify()}};pn.registerLazyResult=e=>{kb=e};pn.registerProcessor=e=>{Cb=e};var Pi=pn;pn.default=pn;xb.registerRoot(pn);var Si={comma(e){return Si.split(e,[","],!0)},space(e){let t=[" ",`
140
+ `," "];return Si.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}},Rb=Si;Si.default=Si;var Eb=_r,x2=Rb,Os=class extends Eb{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return x2.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)}},dd=Os;Os.default=Os;Eb.registerRule(Os);var k2=Ws,C2=v2,R2=zs,E2=ud,I2=Pi,uy=dd,dy={empty:!0,space:!0};function A2(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var P2=class{constructor(t){this.input=t,this.root=new I2,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 E2;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 R2;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=C2(this.input)}decl(t,r){let n=new k2;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]||A2(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 uy;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",!dy[d]&&!dy[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 uy;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})}},T2=P2,O2=_r,M2=T2,N2=Hs;function Ms(e,t){let r=new N2(e,t),n=new M2(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
+ 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
+ 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 pd=Ms;Ms.default=Ms;O2.registerParse(Ms);var{isClean:It,my:L2}=Ai,$2=ab,D2=Bs,_2=_r,j2=ld,F2=wb,py=cd,V2=pd,B2=Pi,U2={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},W2={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},H2={Once:!0,postcssPlugin:!0,prepare:!0},fn=0;function di(e){return typeof e=="object"&&typeof e.then=="function"}function Ib(e){let t=!1,r=U2[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,fn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,fn,r+"Exit"]:[r,r+"Exit"]}function fy(e){let t;return e.type==="document"?t=["Document",fn,"DocumentExit"]:e.type==="root"?t=["Root",fn,"RootExit"]:t=Ib(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Eu(e){return e[It]=!1,e.nodes&&e.nodes.forEach(t=>Eu(t)),e}var Iu={},hn=class Ab{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=Eu(r);else if(r instanceof Ab||r instanceof py)i=Eu(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=V2;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[L2]&&_2.rebuild(i)}this.result=new py(t,i,n),this.helpers={...Iu,postcss:Iu,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(!W2[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!H2[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(di(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[It];){t[It]=!0;let r=[fy(t)];for(;r.length>0;){let n=this.visitTick(r);if(di(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 di(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=D2;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new $2(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(di(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[It];)t[It]=!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||F2("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(di(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[It]){a[It]=!0,t.push(fy(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===fn){n.nodes&&n.nodes.length&&(n[It]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[It]=!0;let r=Ib(t);for(let n of r)if(n===fn)t.nodes&&t.each(i=>{i[It]||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"}};hn.registerPostcss=e=>{Iu=e};var Pb=hn;hn.default=hn;B2.registerLazyResult(hn);j2.registerLazyResult(hn);var z2=ab,G2=Bs,q2=wb,K2=pd,Y2=cd,Au=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=G2;this.result=new Y2(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new z2(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||q2("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=K2;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"}},J2=Au;Au.default=Au;var Z2=J2,X2=Pb,Q2=ld,eN=Pi,vi=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 Z2(this,t,r):new X2(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},tN=vi;vi.default=vi;eN.registerProcessor(vi);Q2.registerProcessor(vi);var rN=Ws,nN=rb,iN=zs,oN=ud,sN=Hs,aN=Pi,lN=dd;function xi(e,t){if(Array.isArray(e))return e.map(i=>xi(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:sN.prototype};o.map&&(o.map={...o.map,__proto__:nN.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>xi(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 aN(n);if(n.type==="decl")return new rN(n);if(n.type==="rule")return new lN(n);if(n.type==="comment")return new iN(n);if(n.type==="atrule")return new oN(n);throw new Error("Unknown node type: "+e.type)}var cN=xi;xi.default=xi;var uN=od,Tb=Ws,dN=Pb,pN=_r,fd=tN,fN=Bs,hN=cN,Ob=ld,mN=Sb,Mb=zs,Nb=ud,gN=cd,yN=Hs,bN=pd,wN=Rb,Lb=dd,$b=Pi,SN=Us;function ne(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new fd(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
+ 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 fd().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=fN;ne.parse=bN;ne.fromJSON=hN;ne.list=wN;ne.comment=e=>new Mb(e);ne.atRule=e=>new Nb(e);ne.decl=e=>new Tb(e);ne.rule=e=>new Lb(e);ne.root=e=>new $b(e);ne.document=e=>new Ob(e);ne.CssSyntaxError=uN;ne.Declaration=Tb;ne.Container=pN;ne.Processor=fd;ne.Document=Ob;ne.Comment=Mb;ne.Warning=mN;ne.AtRule=Nb;ne.Result=gN;ne.Input=yN;ne.Rule=Lb;ne.Root=$b;ne.Node=SN;dN.registerPostcss(ne);var vN=ne;ne.default=ne;var we=OM(vN);we.stringify;we.fromJSON;we.plugin;we.parse;we.list;we.document;we.comment;we.atRule;we.rule;we.decl;we.root;we.CssSyntaxError;we.Declaration;we.Container;we.Processor;we.Document;we.Comment;we.Warning;we.AtRule;we.Result;we.Input;we.Rule;we.Root;we.Node;var xN=Object.defineProperty,kN=(e,t,r)=>t in e?xN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ct=(e,t,r)=>kN(e,typeof t!="symbol"?t+"":t,r);function CN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function RN(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 hd={exports:{}},ye=String,Db=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}};hd.exports=Db();hd.exports.createColors=Db;var EN=hd.exports,IN={},AN=Object.freeze(Object.defineProperty({__proto__:null,default:IN},Symbol.toStringTag,{value:"Module"})),bt=RN(AN),hy=EN,my=bt,Pu=class _b 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,_b)}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=hy.isColorSupported),my&&t&&(r=my(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}=hy.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
+ `+h+a("^")}return" "+l(p)+c}).join(`
147
+ `)}toString(){let t=this.showSourceCode();return t&&(t=`
420
148
 
421
- ---
149
+ `+t+`
150
+ `),this.name+": "+this.message+t}},md=Pu;Pu.default=Pu;var Ti={};Ti.isClean=Symbol("isClean");Ti.my=Symbol("my");var gy={after:`
151
+ `,beforeClose:`
152
+ `,beforeComment:`
153
+ `,beforeDecl:`
154
+ `,beforeOpen:" ",beforeRule:`
155
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function PN(e){return e[0].toUpperCase()+e.slice(1)}var Tu=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 gy[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"+PN(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=gy[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
+ `)&&(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
+ `)&&(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
+ `)&&(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
+ `)&&(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)}},jb=Tu;Tu.default=Tu;var TN=jb;function Ou(e,t){new TN(t).stringify(e)}var Gs=Ou;Ou.default=Ou;var{isClean:ss,my:ON}=Ti,MN=md,NN=jb,LN=Gs;function Mu(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=>Mu(s,r)):(o==="object"&&i!==null&&(i=Mu(i)),r[n]=i)}return r}var Nu=class{constructor(t={}){this.raws={},this[ss]=!1,this[ON]=!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=Mu(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 MN(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[ss]){this[ss]=!1;let t=this;for(;t=t.parent;)t[ss]=!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 NN().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=LN){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}},qs=Nu;Nu.default=Nu;var $N=qs,Lu=class extends $N{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]==="$"}},Ks=Lu;Lu.default=Lu;var DN="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",_N=(e,t=21)=>(r=t)=>{let n="",i=r;for(;i--;)n+=e[Math.random()*e.length|0];return n},jN=(e=21)=>{let t="",r=e;for(;r--;)t+=DN[Math.random()*64|0];return t},FN={nanoid:jN,customAlphabet:_N},{SourceMapConsumer:yy,SourceMapGenerator:by}=bt,{existsSync:VN,readFileSync:BN}=bt,{dirname:ou,join:UN}=bt;function WN(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var $u=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 yy(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 WN(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),VN(t))return this.mapFile=t,BN(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 yy)return by.fromSourceMap(r).toString();if(r instanceof by)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=UN(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)}},Fb=$u;$u.default=$u;var{SourceMapConsumer:HN,SourceMapGenerator:zN}=bt,{fileURLToPath:wy,pathToFileURL:as}=bt,{isAbsolute:Du,resolve:_u}=bt,{nanoid:GN}=FN,su=bt,Sy=md,qN=Fb,au=Symbol("fromOffsetCache"),KN=!!(HN&&zN),vy=!!(_u&&Du),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&&(!vy||/^\w+:\/\//.test(r.from)||Du(r.from)?this.file=r.from:this.file=_u(r.from)),vy&&KN){let n=new qN(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 "+GN(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 Sy(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 Sy(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&&(as&&(o.input.url=as(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(`
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[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:_u(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;Du(s.source)?l=as(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||as(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(wy)c.file=wy(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}},Ys=Ns;Ns.default=Ns;su&&su.registerInput&&su.registerInput(Ns);var{SourceMapConsumer:Vb,SourceMapGenerator:Ss}=bt,{dirname:vs,relative:Bb,resolve:Ub,sep:Wb}=bt,{pathToFileURL:xy}=bt,YN=Ys,JN=!!(Vb&&Ss),ZN=!!(vs&&Ub&&Bb&&Wb),XN=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
+ `;this.css.includes(`\r
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||vs(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Vb(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(),ZN&&JN&&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=Ss.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Ss({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 Ss({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?vs(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=vs(Ub(n,this.mapOpts.annotation)));let i=Bb(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 YN(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(xy){let n=xy(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;Wb==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Hb=XN,QN=qs,ju=class extends QN{constructor(t){super(t),this.type="comment"}},Js=ju;ju.default=ju;var{isClean:zb,my:Gb}=Ti,qb=Ks,Kb=Js,eL=qs,Yb,gd,yd,Jb;function Zb(e){return e.map(t=>(t.nodes&&(t.nodes=Zb(t.nodes)),delete t.source,t))}function Xb(e){if(e[zb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Xb(t)}var Bt=class Qb extends eL{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=Zb(Yb(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 gd(t)];else if(t.name)t=[new yd(t)];else if(t.text)t=[new Kb(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[Gb]||Qb.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[zb]&&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]}};Bt.registerParse=e=>{Yb=e};Bt.registerRule=e=>{gd=e};Bt.registerAtRule=e=>{yd=e};Bt.registerRoot=e=>{Jb=e};var jr=Bt;Bt.default=Bt;Bt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,yd.prototype):e.type==="rule"?Object.setPrototypeOf(e,gd.prototype):e.type==="decl"?Object.setPrototypeOf(e,qb.prototype):e.type==="comment"?Object.setPrototypeOf(e,Kb.prototype):e.type==="root"&&Object.setPrototypeOf(e,Jb.prototype),e[Gb]=!0,e.nodes&&e.nodes.forEach(t=>{Bt.rebuild(t)})};var tL=jr,ew,tw,ki=class extends tL{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new ew(new tw,this,t).stringify()}};ki.registerLazyResult=e=>{ew=e};ki.registerProcessor=e=>{tw=e};var bd=ki;ki.default=ki;var ky={},rw=function(t){ky[t]||(ky[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Fu=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}},nw=Fu;Fu.default=Fu;var rL=nw,Vu=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 rL(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},wd=Vu;Vu.default=Vu;var lu=39,Cy=34,ls=92,Ry=47,cs=10,pi=32,us=12,ds=9,ps=13,nL=91,iL=93,oL=40,sL=41,aL=123,lL=125,cL=59,uL=42,dL=58,pL=64,fs=/[\t\n\f\r "#'()/;[\\\]{}]/g,hs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,fL=/.[\r\n"'(/\\]/,Ey=/[\da-f]/i,hL=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 cs:case pi:case ds:case ps:case us:{s=g;do s+=1,o=n.charCodeAt(s);while(o===pi||o===cs||o===ds||o===ps||o===us);f=["space",n.slice(g,s)],g=s-1;break}case nL:case iL:case aL:case lL:case dL:case cL:case sL:{let U=String.fromCharCode(o);f=[U,U,g];break}case oL:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==lu&&h!==Cy&&h!==pi&&h!==cs&&h!==ds&&h!==us&&h!==ps){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)===ls;)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||fL.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case lu:case Cy:{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)===ls;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case pL:{fs.lastIndex=g+1,fs.test(n),fs.lastIndex===0?s=n.length-1:s=fs.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case ls:{for(s=g,c=!0;n.charCodeAt(s+1)===ls;)s+=1,c=!c;if(o=n.charCodeAt(s+1),c&&o!==Ry&&o!==pi&&o!==cs&&o!==ds&&o!==ps&&o!==us&&(s+=1,Ey.test(n.charAt(s)))){for(;Ey.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===pi&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{o===Ry&&n.charCodeAt(g+1)===uL?(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):(hs.lastIndex=g+1,hs.test(n),hs.lastIndex===0?s=n.length-1:s=hs.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}},iw=jr,Ls=class extends iw{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)}},Sd=Ls;Ls.default=Ls;iw.registerAtRule(Ls);var ow=jr,sw,aw,mn=class extends ow{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 sw(new aw,this,t).stringify()}};mn.registerLazyResult=e=>{sw=e};mn.registerProcessor=e=>{aw=e};var Oi=mn;mn.default=mn;ow.registerRoot(mn);var Ci={comma(e){return Ci.split(e,[","],!0)},space(e){let t=[" ",`
168
+ `," "];return Ci.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}},lw=Ci;Ci.default=Ci;var cw=jr,mL=lw,$s=class extends cw{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return mL.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)}},vd=$s;$s.default=$s;cw.registerRule($s);var gL=Ks,yL=hL,bL=Js,wL=Sd,SL=Oi,Iy=vd,Ay={empty:!0,space:!0};function vL(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var xL=class{constructor(t){this.input=t,this.root=new SL,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 wL;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 bL;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 gL;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]||vL(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 Iy;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",!Ay[d]&&!Ay[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 Iy;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})}},kL=xL,CL=jr,RL=kL,EL=Ys;function Ds(e,t){let r=new EL(e,t),n=new RL(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
+ 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
+ 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 xd=Ds;Ds.default=Ds;CL.registerParse(Ds);var{isClean:At,my:IL}=Ti,AL=Hb,PL=Gs,TL=jr,OL=bd,ML=rw,Py=wd,NL=xd,LL=Oi,$L={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},DL={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},gn=0;function fi(e){return typeof e=="object"&&typeof e.then=="function"}function uw(e){let t=!1,r=$L[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,gn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,gn,r+"Exit"]:[r,r+"Exit"]}function Ty(e){let t;return e.type==="document"?t=["Document",gn,"DocumentExit"]:e.type==="root"?t=["Root",gn,"RootExit"]:t=uw(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Bu(e){return e[At]=!1,e.nodes&&e.nodes.forEach(t=>Bu(t)),e}var Uu={},yn=class dw{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=Bu(r);else if(r instanceof dw||r instanceof Py)i=Bu(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=NL;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[IL]&&TL.rebuild(i)}this.result=new Py(t,i,n),this.helpers={...Uu,postcss:Uu,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(!DL[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(fi(n))try{await n}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[At];){t[At]=!0;let r=[Ty(t)];for(;r.length>0;){let n=this.visitTick(r);if(fi(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 fi(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=PL;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let i=new AL(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(fi(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[At];)t[At]=!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||ML("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(fi(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[At]){a[At]=!0,t.push(Ty(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===gn){n.nodes&&n.nodes.length&&(n[At]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[At]=!0;let r=uw(t);for(let n of r)if(n===gn)t.nodes&&t.each(i=>{i[At]||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"}};yn.registerPostcss=e=>{Uu=e};var pw=yn;yn.default=yn;LL.registerLazyResult(yn);OL.registerLazyResult(yn);var jL=Hb,FL=Gs,VL=rw,BL=xd,UL=wd,Wu=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=FL;this.result=new UL(this._processor,i,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new jL(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||VL("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=BL;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"}},WL=Wu;Wu.default=Wu;var HL=WL,zL=pw,GL=bd,qL=Oi,Ri=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 HL(this,t,r):new zL(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},KL=Ri;Ri.default=Ri;qL.registerProcessor(Ri);GL.registerProcessor(Ri);var YL=Ks,JL=Fb,ZL=Js,XL=Sd,QL=Ys,e6=Oi,t6=vd;function Ei(e,t){if(Array.isArray(e))return e.map(i=>Ei(i));let{inputs:r,...n}=e;if(r){t=[];for(let i of r){let o={...i,__proto__:QL.prototype};o.map&&(o.map={...o.map,__proto__:JL.prototype}),t.push(o)}}if(n.nodes&&(n.nodes=e.nodes.map(i=>Ei(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 e6(n);if(n.type==="decl")return new YL(n);if(n.type==="rule")return new t6(n);if(n.type==="comment")return new ZL(n);if(n.type==="atrule")return new XL(n);throw new Error("Unknown node type: "+e.type)}var r6=Ei;Ei.default=Ei;var n6=md,fw=Ks,i6=pw,o6=jr,kd=KL,s6=Gs,a6=r6,hw=bd,l6=nw,mw=Js,gw=Sd,c6=wd,u6=Ys,d6=xd,p6=lw,yw=vd,bw=Oi,f6=qs;function ie(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new kd(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
+ 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 kd().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=s6;ie.parse=d6;ie.fromJSON=a6;ie.list=p6;ie.comment=e=>new mw(e);ie.atRule=e=>new gw(e);ie.decl=e=>new fw(e);ie.rule=e=>new yw(e);ie.root=e=>new bw(e);ie.document=e=>new hw(e);ie.CssSyntaxError=n6;ie.Declaration=fw;ie.Container=o6;ie.Processor=kd;ie.Document=hw;ie.Comment=mw;ie.Warning=l6;ie.AtRule=gw;ie.Result=c6;ie.Input=u6;ie.Rule=yw;ie.Root=bw;ie.Node=f6;i6.registerPostcss(ie);var h6=ie;ie.default=ie;var Se=CN(h6);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 Hu=class e{constructor(...t){ct(this,"parentElement",null),ct(this,"parentNode",null),ct(this,"ownerDocument"),ct(this,"firstChild",null),ct(this,"lastChild",null),ct(this,"previousSibling",null),ct(this,"nextSibling",null),ct(this,"ELEMENT_NODE",1),ct(this,"TEXT_NODE",3),ct(this,"nodeType"),ct(this,"nodeName"),ct(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 Oy={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},My={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ms={},m6=()=>!!globalThis.Zone;function Cd(e){if(ms[e])return ms[e];let t=globalThis[e],r=t.prototype,n=e in Oy?Oy[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 My?My[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&&!m6())return ms[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?ms[e]=c:r}catch{return r}}var cu={};function Wt(e,t,r){var n;let i=`${e}.${String(r)}`;if(cu[i])return cu[i].call(t);let o=Cd(e),s=(n=Object.getOwnPropertyDescriptor(o,r))==null?void 0:n.get;return s?(cu[i]=s,s.call(t)):t[r]}var uu={};function ww(e,t,r){let n=`${e}.${String(r)}`;if(uu[n])return uu[n].bind(t);let o=Cd(e)[r];return typeof o!="function"?t[r]:(uu[n]=o,o.bind(t))}function g6(e){return Wt("Node",e,"ownerDocument")}function y6(e){return Wt("Node",e,"childNodes")}function b6(e){return Wt("Node",e,"parentNode")}function w6(e){return Wt("Node",e,"parentElement")}function S6(e){return Wt("Node",e,"textContent")}function v6(e,t){return ww("Node",e,"contains")(t)}function x6(e){return ww("Node",e,"getRootNode")()}function k6(e){return!e||!("host"in e)?null:Wt("ShadowRoot",e,"host")}function C6(e){return e.styleSheets}function R6(e){return!e||!("shadowRoot"in e)?null:Wt("Element",e,"shadowRoot")}function E6(e,t){return Wt("Element",e,"querySelector")(t)}function I6(e,t){return Wt("Element",e,"querySelectorAll")(t)}function Sw(){return Cd("MutationObserver").constructor}function Fr(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:g6,childNodes:y6,parentNode:b6,parentElement:w6,textContent:S6,contains:v6,getRootNode:x6,host:k6,styleSheets:C6,shadowRoot:R6,querySelector:E6,querySelectorAll:I6,mutationObserver:Sw,patch:Fr};function Ke(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var an=`Please stop import mirror directly. Instead of that,\r
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.`,Ny={map:{},getId(){return console.error(an),-1},getNode(){return console.error(an),null},removeNodeFromMap(){console.error(an)},has(){return console.error(an),!1},reset(){console.error(an)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ny=new Proxy(Ny,{get(e,t,r){return t==="map"&&console.error(an),Reflect.get(e,t,r)}}));function Ii(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 Zs(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)}}),()=>Zs(e,t,o||{},!0)}var _s=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(_s=()=>new Date().getTime());function vw(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 xw(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function kw(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Cw(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=Cw(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(As(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 du(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===bi}function Rw(e,t){if(mi(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?Rw(n,t):!0}function zu(e){return!!e.changedTouches}function P6(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 Ew(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Iw(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Gu(e){return e?e instanceof Hu&&"shadowRoot"in e?!!e.shadowRoot:!!H.shadowRoot(e):!1}var qu=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 Aw(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=Aw(t);)t=r;return t}function O6(e){let t=H.ownerDocument(e);if(!t)return!1;let r=T6(e);return H.contains(t,r)}function Pw(e){let t=H.ownerDocument(e);return t?H.contains(t,e)||O6(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||{}),et=(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))(et||{}),Ft=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ft||{}),bn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(bn||{}),ln=(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))(ln||{});var Tw=(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))(Tw||{});function Ly(e){return"__ln"in e}var Ku=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&&Ly(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&&Ly(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--)}},$y=(e,t)=>`${e}@${t}`,Yu=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 Ku,i=l=>{let c=l,u=bi;for(;u===bi;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},o=l=>{let c=H.parentNode(l);if(!c||!Pw(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=mi(c)?this.mirror.getId(Aw(l)):this.mirror.getId(c),p=i(l);if(d===-1||p===-1)return n.addNode(l);let h=un(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=>{Ew(f,this.mirror)&&this.iframeManager.addIframe(f),Iw(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Gu(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)Dy(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(H.parentNode(l))||o(l);for(let l of this.addedSet)!_y(this.droppedSet,l)&&!Dy(this.removesSubTreeCache,l,this.mirror)||_y(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=Rs({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Es(t),value:n,maskInputFn:this.maskInputFn})}),k(this,"processMutation",t=>{if(!du(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:Zy(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Cw(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=Es(r);i=Rs({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"),!Jy(r.tagName,n))if(o.attributes[n]=Yy(this.doc,Dr(r.tagName),Dr(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=mi(t.target)?this.mirror.getId(H.host(t.target)):this.mirror.getId(t.target);Ye(t.target,this.blockClass,this.blockSelector,!1)||du(r,this.mirror,this.slimDOMOptions)||!A6(r,this.mirror)||(this.addedSet.has(r)?(Ju(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Rw(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[$y(n,i)]?Ju(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:mi(t.target)&&gi(t.target)?!0:void 0}),M6(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(du(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[$y(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)),Gu(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 Ju(e,t){e.delete(t),H.childNodes(t).forEach(r=>Ju(e,r))}function M6(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 Dy(e,t,r){return e.size===0?!1:N6(e,t)}function N6(e,t,r){let n=H.parentNode(t);return n?e.has(n):!1}function _y(e,t){return e.size===0?!1:Ow(e,t)}function Ow(e,t){let r=H.parentNode(t);return r?e.has(r)?!0:Ow(e,r):!1}var yi;function L6(e){yi=e}function $6(){yi=void 0}var J=e=>yi?(...r)=>{try{return e(...r)}catch(n){if(yi&&yi(n)===!0)return;throw n}}:e,$r=[];function Mi(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 Mw(e,t){let r=new Yu;$r.push(r),r.init(e);let n=new(Sw())(J(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function D6({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=Ii(J(d=>{let p=Date.now()-a;e(s.map(h=>(h.timeOffset-=p,h)),d),s=[],a=null}),o),c=J(Ii(J(d=>{let p=Mi(d),{clientX:h,clientY:f}=zu(d)?d.changedTouches[0]:d;a||(a=_s()),s.push({x:h,y:f,id:n.getId(p),timeOffset:_s()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?z.Drag:d instanceof MouseEvent?z.MouseMove:z.TouchMove)}),i,{trailing:!1})),u=[Ke("mousemove",c,r),Ke("touchmove",c,r),Ke("drag",c,r)];return J(()=>{u.forEach(d=>d())})}function _6({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=Mi(d);if(Ye(p,n,i,!0))return;let h=null,f=u;if("pointerType"in d){switch(d.pointerType){case"mouse":h=Ft.Mouse;break;case"touch":h=Ft.Touch;break;case"pen":h=Ft.Pen;break}h===Ft.Touch?et[u]===et.MouseDown?f="TouchStart":et[u]===et.MouseUp&&(f="TouchEnd"):Ft.Pen}else zu(d)&&(h=Ft.Touch);h!==null?(l=h,(f.startsWith("Touch")&&h===Ft.Touch||f.startsWith("Mouse")&&h===Ft.Mouse)&&(h=null)):et[u]===et.Click&&(h=l,l=null);let m=zu(d)?d.changedTouches[0]:d;if(!m)return;let g=r.getId(p),{clientX:w,clientY:S}=m;J(e)({type:et[f],id:g,x:w,y:S,...h!==null&&{pointerType:h}})};return Object.keys(et).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=Dr(u),p=c(u);if(window.PointerEvent)switch(et[u]){case et.MouseDown:case et.MouseUp:d=d.replace("mouse","pointer");break;case et.TouchStart:case et.TouchEnd:return}a.push(Ke(d,p,t))}),J(()=>{a.forEach(u=>u())})}function Nw({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=J(Ii(J(a=>{let l=Mi(a);if(!l||Ye(l,n,i,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let u=vw(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 Ke("scroll",s,t)}function j6({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=J(Ii(J(()=>{let o=xw(),s=kw();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return Ke("resize",i,t)}var F6=["INPUT","TEXTAREA","SELECT"],jy=new WeakMap;function V6({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=Mi(S),v=S.isTrusted,C=y&&y.tagName;if(y&&C==="OPTION"&&(y=H.parentElement(y)),!y||!C||F6.indexOf(C)<0||Ye(y,n,i,!0)||y.classList.contains(o)||s&&y.matches(s))return;let M=y.value,R=!1,E=Es(y)||"";E==="radio"||E==="checkbox"?R=y.checked:(a[C.toLowerCase()]||a[E])&&(M=Rs({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=jy.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){jy.set(S,y);let C=r.getId(S);J(e)({...y,id:C})}}let f=(c.input==="last"?["change"]:["input","change"]).map(S=>Ke(S,J(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=>Zs(S[0],S[1],{set(){J(d)({target:this,isTrusted:!1})}},!1,m))),J(()=>{f.forEach(S=>S())})}function js(e){let t=[];function r(n,i){if(gs("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||gs("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||gs("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||gs("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 hr(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function B6({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:J((u,d,p)=>{let[h,f]=p,{id:m,styleId:g}=hr(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:J((u,d,p)=>{let[h]=p,{id:f,styleId:m}=hr(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:J((u,d,p)=>{let[h]=p,{id:f,styleId:m}=hr(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:J((u,d,p)=>{let[h]=p,{id:f,styleId:m}=hr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replaceSync:h}),u.apply(d,p)})}));let l={};ys("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(ys("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),ys("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),ys("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:J((p,h,f)=>{let[m,g]=f,{id:w,styleId:S}=hr(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||S&&S!==-1)&&e({id:w,styleId:S,adds:[{rule:m,index:[...js(h),g||0]}]}),p.apply(h,f)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:J((p,h,f)=>{let[m]=f,{id:g,styleId:w}=hr(h.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||w&&w!==-1)&&e({id:g,styleId:w,removes:[{index:[...js(h),m]}]}),p.apply(h,f)})})}),J(()=>{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 Lw({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}}),J(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function U6({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:J((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}=hr((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:js(l.parentRule)}),a.apply(l,c)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:J((a,l,c)=>{var u;let[d]=c;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:h}=hr((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:js(l.parentRule)}),a.apply(l,c)})}),J(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function W6({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){let s=J(l=>Ii(J(c=>{let u=Mi(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=[Ke("play",s(ln.Play),o),Ke("pause",s(ln.Pause),o),Ke("seeked",s(ln.Seeked),o),Ke("volumechange",s(ln.VolumeChange),o),Ke("ratechange",s(ln.RateChange),o)];return J(()=>{a.forEach(l=>l())})}function H6({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=Fr(t.fonts,"add",function(a){return function(l){return setTimeout(J(()=>{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),J(()=>{n.forEach(a=>a())})}function z6(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e,s=!0,a=J(()=>{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(),Ke("selectionchange",a)}function G6({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Fr(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 q6(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 K6(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};q6(e,t);let n;e.recordDOM&&(n=Mw(e,e.doc));let i=D6(e),o=_6(e),s=Nw(e),a=j6(e,{win:r}),l=V6(e),c=W6(e),u=()=>{},d=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(u=B6(e,{win:r}),d=Lw(e,e.doc),p=U6(e,{win:r}),e.collectFonts&&(h=H6(e)));let f=z6(e),m=G6(e),g=[];for(let w of e.plugins)g.push(w.observer(w.callback,r,w.options));return J(()=>{$r.forEach(w=>w.reset()),n?.disconnect(),i(),o(),s(),a(),l(),c(),u(),d(),p(),h(),f(),m(),g.forEach(w=>w())})}function gs(e){return typeof window[e]<"u"}function ys(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Fs=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}},Zu=class{constructor(t){k(this,"iframes",new WeakMap),k(this,"crossOriginIframeMap",new WeakMap),k(this,"crossOriginIframeMirror",new Fs(Ky)),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 Fs(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!==Tw.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},Xu=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(!gi(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=Mw({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Nw({...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(Lw({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(Fr(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=H.shadowRoot(this);return a&&Pw(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},dn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Y6=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(hi=0;hi<dn.length;hi++)Y6[dn.charCodeAt(hi)]=hi;var hi,J6=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=dn[t[r]>>2],i+=dn[(t[r]&3)<<4|t[r+1]>>4],i+=dn[(t[r+1]&15)<<2|t[r+2]>>6],i+=dn[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 Fy=new Map;function Z6(e,t){let r=Fy.get(e);return r||(r=new Map,Fy.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var $w=(e,t,r)=>{if(!e||!(_w(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=Z6(r,n),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function xs(e,t,r){if(e instanceof Array)return e.map(n=>xs(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=J6(e);return{rr_type:n,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[xs(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:[xs(e.data,t,r),e.width,e.height]};if(_w(e,t)||typeof e=="object"){let n=e.constructor.name,i=$w(e,t,r);return{rr_type:n,index:i}}}}return e}var Dw=(e,t,r)=>e.map(n=>xs(n,t,r)),_w=(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 X6(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=Fr(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return Ye(this.canvas,r,n,!0)||setTimeout(()=>{let u=Dw(c,t,this);e(this.canvas,{type:bn["2D"],property:s,args:u})},0),l.apply(this,c)}});i.push(a)}catch{let a=Zs(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:bn["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function Q6(e){return e==="experimental-webgl"?"webgl":e}function Vy(e,t,r,n){let i=[];try{let o=Fr(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!Ye(this,t,r,!0)){let c=Q6(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 By(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=Fr(e,l,function(u){return function(...d){let p=u.apply(this,d);if($w(p,o,this),"tagName"in this.canvas&&!Ye(this.canvas,n,i,!0)){let h=Dw(d,o,this),f={type:t,property:l,args:h};r(this.canvas,f)}return p}});s.push(c)}catch{let c=Zs(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function e$(e,t,r,n){let i=[];return i.push(...By(t.WebGLRenderingContext.prototype,bn.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...By(t.WebGL2RenderingContext.prototype,bn.WebGL2,e,r,n,t)),()=>{i.forEach(o=>o())}}var jw="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",t$=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Uy=typeof window<"u"&&window.Blob&&new Blob([t$(jw)],{type:"text/javascript;charset=utf-8"});function r$(e){let t;try{if(t=Uy&&(window.URL||window.webkitURL).createObjectURL(Uy),!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,"+jw,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Qu=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=Vy(r,n,i,!0),a=new Map,l=new r$;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:bn["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=Vy(t,r,n,!1),o=X6(this.processMutation.bind(this),t,r,n),s=e$(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)}},ed=class{constructor(t){k(this,"trackedLinkElements",new WeakSet),k(this,"mutationCb"),k(this,"adoptedStyleSheetCb"),k(this,"styleMirror",new qu),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:Gy(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){}},td=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,ks,pu,Vs=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Hg=e.contentWindow)==null?void 0:Hg.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var gt=oM();function Vr(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:j=()=>!1,ignoreCSSAttributes:ze=new Set([]),errorHandler:xt}=e;L6(xt);let _e=R?window.parent===window:!0,at=!1;if(!_e)try{window.parent.document&&(at=!1)}catch{at=!0}if(_e&&!t)throw new Error("emit function is required");if(!_e&&!at)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),gt.reset();let Er=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},kt=Xy(h);P6();let Cf,il=0,Rf=ee=>{for(let dt of Q||[])dt.eventProcessor&&(ee=dt.eventProcessor(ee));return w&&!at&&(ee=w(ee)),ee};Ee=(ee,dt)=>{var ke;let Ce=ee;if(Ce.timestamp=_s(),(ke=$r[0])!=null&&ke.isFrozen()&&Ce.type!==q.FullSnapshot&&!(Ce.type===q.IncrementalSnapshot&&Ce.data.source===z.Mutation)&&$r.forEach(tt=>tt.unfreeze()),_e)t?.(Rf(Ce),dt);else if(at){let tt={type:"rrweb",event:Rf(Ce),origin:window.location.origin,isCheckout:dt};window.parent.postMessage(tt,"*")}if(Ce.type===q.FullSnapshot)Cf=Ce,il=0;else if(Ce.type===q.IncrementalSnapshot){if(Ce.data.source===z.Mutation&&Ce.data.isAttachIframe)return;il++;let tt=n&&il>=n,se=r&&Ce.timestamp-Cf.timestamp>r;(tt||se)&&ks(!0)}};let eo=ee=>{Ee({type:q.IncrementalSnapshot,data:{source:z.Mutation,...ee}})},Ef=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.Scroll,...ee}}),If=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.CanvasMutation,...ee}}),GC=ee=>Ee({type:q.IncrementalSnapshot,data:{source:z.AdoptedStyleSheet,...ee}}),Ir=new ed({mutationCb:eo,adoptedStyleSheetCb:GC}),Ar=new Zu({mirror:gt,mutationCb:eo,stylesheetManager:Ir,recordCrossOriginIframes:R,wrappedEmit:Ee});for(let ee of Q||[])ee.getMirror&&ee.getMirror({nodeMirror:gt,crossOriginIframeMirror:Ar.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ar.crossOriginIframeStyleMirror});let ol=new td;pu=new Qu({recordCanvas:M,mutationCb:If,win:window,blockClass:i,blockSelector:o,mirror:gt,sampling:S.canvas,dataURLOptions:y});let to=new Xu({mutationCb:eo,scrollCb:Ef,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Er,dataURLOptions:y,maskTextFn:m,maskInputFn:f,recordCanvas:M,inlineImages:X,sampling:S,slimDOMOptions:kt,iframeManager:Ar,stylesheetManager:Ir,canvasManager:pu,keepIframeSrcFn:j,processedNodeManager:ol},mirror:gt});ks=(ee=!1)=>{if(!C)return;Ee({type:q.Meta,data:{href:window.location.href,width:kw(),height:xw()}},ee),Ir.reset(),to.init(),$r.forEach(ke=>ke.lock());let dt=PM(document,{mirror:gt,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Er,maskTextFn:m,maskInputFn:f,slimDOM:kt,dataURLOptions:y,recordCanvas:M,inlineImages:X,onSerialize:ke=>{Ew(ke,gt)&&Ar.addIframe(ke),Iw(ke,gt)&&Ir.trackLinkElement(ke),Gu(ke)&&to.addShadowRoot(H.shadowRoot(ke),document)},onIframeLoad:(ke,Ce)=>{Ar.attachIframe(ke,Ce),to.observeAttachShadow(ke)},onStylesheetLoad:(ke,Ce)=>{Ir.attachLinkElement(ke,Ce)},keepIframeSrcFn:j});if(!dt)return console.warn("Failed to snapshot the document");Ee({type:q.FullSnapshot,data:{node:dt,initialOffset:vw(window)}},ee),$r.forEach(ke=>ke.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ir.adoptStyleSheets(document.adoptedStyleSheets,gt.getId(document))};try{let ee=[],dt=Ce=>{var tt;return J(K6)({mutationCb:eo,mousemoveCb:(se,sl)=>Ee({type:q.IncrementalSnapshot,data:{source:sl,positions:se}}),mouseInteractionCb:se=>Ee({type:q.IncrementalSnapshot,data:{source:z.MouseInteraction,...se}}),scrollCb:Ef,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:If,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:Er,inlineStylesheet:u,sampling:S,recordDOM:C,recordCanvas:M,inlineImages:X,userTriggeredOnInput:x,collectFonts:U,doc:Ce,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:j,blockSelector:o,slimDOMOptions:kt,dataURLOptions:y,mirror:gt,iframeManager:Ar,stylesheetManager:Ir,shadowDomManager:to,processedNodeManager:ol,canvasManager:pu,ignoreCSSAttributes:ze,plugins:((tt=Q?.filter(se=>se.observer))==null?void 0:tt.map(se=>({observer:se.observer,options:se.options,callback:sl=>Ee({type:q.Plugin,data:{plugin:se.name,payload:sl}})})))||[]},g)};Ar.addLoadListener(Ce=>{try{ee.push(dt(Ce.contentDocument))}catch(tt){console.warn(tt)}});let ke=()=>{ks(),ee.push(dt(document)),Vs=!0};return["interactive","complete"].includes(document.readyState)?ke():(ee.push(Ke("DOMContentLoaded",()=>{Ee({type:q.DomContentLoaded,data:{}}),E==="DOMContentLoaded"&&ke()})),ee.push(Ke("load",()=>{Ee({type:q.Load,data:{}}),E==="load"&&ke()},window))),()=>{ee.forEach(Ce=>{try{Ce()}catch(tt){String(tt).toLowerCase().includes("cross-origin")||console.warn(tt)}}),ol.destroy(),Vs=!1,$6()}}catch(ee){console.warn(ee)}}Vr.addCustomEvent=(e,t)=>{if(!Vs)throw new Error("please add custom event after start recording");Ee({type:q.Custom,data:{tag:e,payload:t}})};Vr.freezePage=()=>{$r.forEach(e=>e.freeze())};Vr.takeFullSnapshot=e=>{if(!Vs)throw new Error("please take full snapshot after start recording");ks(e)};Vr.mirror=gt;var Wy;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Wy||(Wy={}));var BJ=5*1e3;var{addCustomEvent:UJ}=Vr,{freezePage:WJ}=Vr,{takeFullSnapshot:HJ}=Vr;var Bw="__ripploEmitRrwebEvent";function Uw(){return{eventTypes:Fw(q),incrementalSources:Fw(z)}}function Fw(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var i$=Xc("@ripplo/rrweb-bundle/bundle","rrweb.js"),Vw;function Ww(){return Vw??=n$(i$,{encoding:"utf8"}),Vw}async function Ed({debugDir:e,writeOtlpPortFile:t}){let r=new Map,n=Fg(Uw()),i=await ci({localDir:Hw.join(Hw.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 Ww();return{attach:async(a,l)=>{let c=jg({debugDir:e,runId:l,worker:n});r.set(l,c),await Bg(a,l),await a.addInitScript(`globalThis.__ripploCapturePort = ${String(i.port)};`),await s$(a,c);let u=[];return{emitAction:d=>{c$(c,d)},emitAssertion:d=>{u$(c,d)},finish:()=>a$(c,{pages:u,registry:r,runId:l}),onPage:d=>{u.push(d),l$(c,o,d)}}},close:async()=>{await i.stop(),await n.terminate()},injectSpan:(a,l)=>{r.get(a)?.emit(l)}}}async function o$(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function s$(e,t){await e.exposeBinding(Bw,(r,n)=>{let i=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}async function a$(e,t){await o$(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 l$(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("response",n=>{h$(e,n)}),r.on("console",n=>{e.emit({kind:"console",level:n.type(),source:"browser",text:n.text(),timeNanos:on(Date.now())})}),r.on("pageerror",n=>{e.emit({kind:"error",message:n.message,source:"browser",stack:n.stack,timeNanos:on(Date.now())})})}function c$(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:d$(t),timeNanos:on(Date.now()),value:p$(t)})}function u$(e,t){let r=Yc(t);e.emit({kind:"assertion",label:r.label,outcome:t.outcome,source:"test",step:r.step,timeNanos:on(Date.now())})}function d$(e){if(e.url!=null)return e.url;if(e.locator!=null)return Rd(e.locator)}function Rd(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Rd(e.scope)} \u25B8 ${Rd(e.target)}`:`${e.role} ${e.name??""}`.trim()}function p$(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var f$=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;function h$(e,t){let r=t.request(),n=r.resourceType();if(n!=="fetch"&&n!=="xhr"||f$.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:on(Date.now()),traceId:i?.[1],url:t.url()})}import{err as ax,ok as rf,ResultAsync as C5}from"neverthrow";function Ni(e){return{invariants:Pc(e),laws:Ec(e)}}var zw=Object.defineProperty,Gw=(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 m$=class qw{constructor(t){this.seed=t}clone(){return new qw(this.seed)}next(){let t=Id(this.seed),r=Ad(t),n=Id(t),i=Ad(n);return this.seed=Id(n),Ad(this.seed)+(i+(r<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function Id(e){return Math.imul(e,214013)+2531011&4294967295}function Ad(e){return(e&-2147483649)>>16}function Kw(e){return new m$(e)}var g$="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",y$=class Jw{constructor(t,r){this.states=t,this.index=r}clone(){return new Jw(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=Xs(this.states,this.index),t}getState(){return[this.index,...this.states]}jump(){let t=this.states.slice(),r=this.index;this.index=Xs(this.states,this.index);for(let n=19932;n>0;--n)g$.charCodeAt(n/6|0)-48&1<<n%6&&Yw(this.states,this.index,t,r),this.index=Xs(this.states,this.index);Yw(this.states,this.index,t,r)}};function Yw(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 Xs(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 b$(e){for(let t=0;t!==624;++t)Xs(e,t)}function Zw(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 b$(t),new y$(t,0)}var w$=class Xw{constructor(t,r,n,i){this.s01=t,this.s00=r,this.s11=n,this.s10=i}clone(){return new Xw(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 Pd(e){return new w$(-1,~e,e|0,0)}var S$=class Qw{constructor(t,r,n,i){this.s01=t,this.s00=r,this.s11=n,this.s10=i}clone(){return new Qw(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 eS(e){return new S$(-1,~e,e|0,0)}function tS(e,t){for(let r=0;r!==t;++r)e.next()}var rS=BigInt,v$=4294967296n;function iS(e,t,r){let n=r-t+1n,i=v$,o=1;for(;i<n;)i<<=32n,++o;let s=nS(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=nS(o,e);return s%n+t}function nS(e,t){let r=rS(t.next()+2147483648);for(let n=1;n<e;++n){let i=t.next();r=(r<<32n)+rS(i+2147483648)}return r}function Li(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 Td(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 x$(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 k$(e,t,r){let n=r[0]+1;for(t[0]=Li(e,n),t[1]=Li(e,4294967296);t[0]>=r[0]&&(t[0]!==r[0]||t[1]>=r[1]);)t[0]=Li(e,n),t[1]=Li(e,4294967296);return t}var C$=Number.MAX_SAFE_INTEGER,R$={sign:1,data:[0,0]},E$={sign:1,data:[0,0]},oS={sign:1,data:[0,0]},Od=[0,0];function I$(e,t,r,n){let i=n<=C$?Td(oS,n):x$(oS,Td(R$,r),Td(E$,t));return i.data[1]===4294967295?(i.data[0]+=1,i.data[1]=0):i.data[1]+=1,k$(e,Od,i.data),Od[0]*4294967296+Od[1]+t}function Qs(e,t,r){let n=r-t;return n<=4294967295?Li(e,n+1)+t:I$(e,t,r,n)}var sS=Symbol.for("fast-check/PreconditionFailure"),vr=class extends Error{constructor(e=!1){super(),this.interruptExecution=e,this.footprint=sS}static isFailure(e){return e!=null&&e.footprint===sS}};function A$(e){if(!e)throw new vr}var P$=class{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}},T$=new P$;function O$(){return T$}function*M$(e,t){for(let r of e)yield t(r)}function*N$(e,t){for(let r of e)yield*t(r)}function*L$(e,t){for(let r of e)t(r)&&(yield r)}function*$$(e,t){for(let r=0;r<t;++r){let n=e.next();if(n.done)break;yield n.value}}function*D$(e,t){let r=e.next();for(;!r.done&&t(r.value);)yield r.value,r=e.next()}function*_$(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 j$=Symbol.iterator,B=class Ht{static nil(){return new Ht(O$())}static of(...t){return new Ht(t[j$]())}constructor(t){this.g=t}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(t){return new Ht(M$(this.g,t))}flatMap(t){return new Ht(N$(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 Ht(D$(this.g,t))}take(t){return new Ht($$(this.g,t))}filter(t){return new Ht(L$(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 Ht(_$(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 wr(e){return new B(e)}var Be=Symbol.for("fast-check/cloneMethod");function Ur(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Be in e&&typeof e[Be]=="function"}function kn(e){return Ur(e)?e[Be]():e}var F$=Object.defineProperty,$=class{constructor(e,t,r){this.value_=e,this.context=t,this.hasToBeCloned=r!==void 0||Ur(e),this.readOnce=!1,this.value=e,this.hasToBeCloned&&F$(this,"value",{get:r!==void 0?r:this.getValue,enumerable:!1,configurable:!1})}getValue(){return this.hasToBeCloned?this.readOnce?this.value_[Be]():(this.readOnce=!0,this.value_):this.value_}},he=class{filter(e){return new U$(this,e)}map(e,t){return new B$(this,e,t)}chain(e){return new V$(this,e)}},V$=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?B.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)})):B.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}},B$=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 B.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)&&!Ur(r)&&Object.defineProperty(r,Be,{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}},U$=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 s1(e){return typeof e=="object"&&e!==null&&"generate"in e&&"shrink"in e&&"canShrinkWithoutContext"in e}function a1(e){if(!s1(e))throw new Error("Unexpected value received: not an instance of Arbitrary")}var l1=Function.prototype.apply,Md=Symbol("apply");function W$(e){try{return e.apply}catch{return}}function H$(e,t,r){let n=e;n[Md]=l1;let i=n[Md](t,r);return delete n[Md],i}function K(e,t,r){return W$(e)===l1?e.apply(t,r):H$(e,t,r)}var c1=Array,O=BigInt,z$=BigInt64Array,G$=BigUint64Array,u1=Boolean,ha=Date,N=Error,d1=Float32Array,p1=Float64Array,q$=Int8Array,K$=Int16Array,Y$=Int32Array,Gt=Number,Je=String,Cn=Set,J$=Uint8Array,Z$=Uint8ClampedArray,X$=Uint16Array,Q$=Uint32Array,e4=encodeURIComponent,qt=Map,aa=Symbol,aS=Array.prototype.forEach,lS=Array.prototype.indexOf,cS=Array.prototype.join,uS=Array.prototype.map,dS=Array.prototype.flat,pS=Array.prototype.filter,fS=Array.prototype.push,hS=Array.prototype.pop,mS=Array.prototype.splice,gS=Array.prototype.slice,yS=Array.prototype.sort,bS=Array.prototype.every;function t4(e){try{return e.forEach}catch{return}}function r4(e){try{return e.indexOf}catch{return}}function n4(e){try{return e.join}catch{return}}function i4(e){try{return e.map}catch{return}}function o4(e){try{return e.flat}catch{return}}function s4(e){try{return e.filter}catch{return}}function a4(e){try{return e.push}catch{return}}function l4(e){try{return e.pop}catch{return}}function c4(e){try{return e.splice}catch{return}}function u4(e){try{return e.slice}catch{return}}function d4(e){try{return e.sort}catch{return}}function p4(e){try{return e.every}catch{return}}function f1(e,t){return t4(e)===aS?e.forEach(t):K(aS,e,[t])}function zt(e,...t){return r4(e)===lS?e.indexOf(...t):K(lS,e,t)}function fe(e,...t){return n4(e)===cS?e.join(...t):K(cS,e,t)}function G(e,t){return i4(e)===uS?e.map(t):K(uS,e,[t])}function f4(e,t){return o4(e)===dS?([].flat(),e.flat(t)):K(dS,e,[t])}function h4(e,t){return s4(e)===pS?e.filter(t):K(pS,e,[t])}function L(e,...t){return a4(e)===fS?e.push(...t):K(fS,e,t)}function h1(e){return l4(e)===hS?e.pop():K(hS,e,[])}function m1(e,...t){return c4(e)===mS?e.splice(...t):K(mS,e,t)}function Ue(e,...t){return u4(e)===gS?e.slice(...t):K(gS,e,t)}function g1(e,...t){return d4(e)===yS?e.sort(...t):K(yS,e,t)}function y1(e,...t){return p4(e)===bS?e.every(...t):K(bS,e,t)}var wS=Date.prototype.getTime,SS=Date.prototype.toISOString;function m4(e){try{return e.getTime}catch{return}}function g4(e){try{return e.toISOString}catch{return}}function ma(e){return m4(e)===wS?e.getTime():K(wS,e,[])}function y4(e){return g4(e)===SS?e.toISOString():K(SS,e,[])}var vS=Set.prototype.add,xS=Set.prototype.has;function b4(e){try{return e.add}catch{return}}function w4(e){try{return e.has}catch{return}}function Fi(e,t){return b4(e)===vS?e.add(t):K(vS,e,[t])}function ga(e,t){return w4(e)===xS?e.has(t):K(xS,e,[t])}var kS=WeakMap.prototype.set,CS=WeakMap.prototype.get;function S4(e){try{return e.set}catch{return}}function v4(e){try{return e.get}catch{return}}function x4(e,t,r){return S4(e)===kS?e.set(t,r):K(kS,e,[t,r])}function k4(e,t){return v4(e)===CS?e.get(t):K(CS,e,[t])}var RS=Map.prototype.set,ES=Map.prototype.get,IS=Map.prototype.has;function C4(e){try{return e.set}catch{return}}function R4(e){try{return e.get}catch{return}}function E4(e){try{return e.has}catch{return}}function wt(e,t,r){return C4(e)===RS?e.set(t,r):K(RS,e,[t,r])}function st(e,t){return R4(e)===ES?e.get(t):K(ES,e,[t])}function I4(e,t){return E4(e)===IS?e.has(t):K(IS,e,[t])}var AS=String.prototype.split,PS=String.prototype.startsWith,TS=String.prototype.endsWith,OS=String.prototype.substring,MS=String.prototype.toLowerCase,NS=String.prototype.toUpperCase,LS=String.prototype.padStart,$S=String.prototype.charCodeAt,DS=String.prototype.normalize,_S=String.prototype.replace;function A4(e){try{return e.split}catch{return}}function P4(e){try{return e.startsWith}catch{return}}function T4(e){try{return e.endsWith}catch{return}}function O4(e){try{return e.substring}catch{return}}function M4(e){try{return e.toLowerCase}catch{return}}function N4(e){try{return e.toUpperCase}catch{return}}function L4(e){try{return e.padStart}catch{return}}function $4(e){try{return e.charCodeAt}catch{return}}function D4(e){try{return e.normalize}catch{return}}function _4(e){try{return e.replace}catch{return}}function Ze(e,...t){return A4(e)===AS?e.split(...t):K(AS,e,t)}function j4(e,...t){return P4(e)===PS?e.startsWith(...t):K(PS,e,t)}function F4(e,...t){return T4(e)===TS?e.endsWith(...t):K(TS,e,t)}function ve(e,...t){return O4(e)===OS?e.substring(...t):K(OS,e,t)}function np(e){return M4(e)===MS?e.toLowerCase():K(MS,e,[])}function Pp(e){return N4(e)===NS?e.toUpperCase():K(NS,e,[])}function V4(e,...t){return L4(e)===LS?e.padStart(...t):K(LS,e,t)}function Rn(e,t){return $4(e)===$S?e.charCodeAt(t):K($S,e,[t])}function B4(e,t){return D4(e)===DS?e.normalize(t):K(DS,e,[t])}function U4(e,t,r){return _4(e)===_S?e.replace(t,r):K(_S,e,[t,r])}var jS=Number.prototype.toString;function W4(e){try{return e.toString}catch{return}}function Vi(e,...t){return W4(e)===jS?e.toString(...t):K(jS,e,t)}var H4=Object.prototype.hasOwnProperty,z4=Object.prototype.toString;function b1(e,t){return K(H4,e,[t])}function ip(e){return K(z4,e,[])}var G4=Error.prototype.toString;function q4(e){return K(G4,e,[])}var K4=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 br(e){return new K4(e)}var w1=Array.isArray,Y4=Object.defineProperty;function S1(e,t){return Y4(e,Be,{value:()=>{let r=[];for(let n=0;n!==t.length;++n)L(r,t[n].value);return S1(r,t),r}})}function v1(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&&S1(r,e),new $(r,n)}function x1(e,t,r){let n=[],i=w1(r)?r:[];for(let o=0;o!==e.length;++o)L(n,br(()=>e[o].shrink(t[o],i[o]).map(s=>{let a=G(t,(l,c)=>new $(kn(l),i[c]));return[...Ue(a,0,o),s,...Ue(a,o+1)]}).map(v1)));return B.nil().join(...n)}var J4=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 v1(r)}canShrinkWithoutContext(e){if(!w1(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 x1(this.arbs,e,t)}};function W(...e){return new J4(e)}var Z4=Math.log;function k1(e){return 2+~~(Z4(e+1)*.4342944819032518)}var Tp={};function X4(e){Tp=e}function St(){return Tp}function Q4(){Tp={}}var Bi=Symbol("UndefinedContextPlaceholder");function En(e){return e.context!==void 0?e:e.hasToBeCloned?new $(e.value_,Bi,()=>e.value):new $(e.value_,Bi)}var FS=()=>{},e3=class{constructor(e,t){this.arb=e,this.predicate=t;let{asyncBeforeEach:r,asyncAfterEach:n,beforeEach:i,afterEach:o}=St()||{};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||FS,this.afterEachHook=n||o||FS}isAsync(){return!0}generate(e,t){return En(this.arb.generate(e,t!==void 0?k1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return B.nil();let t=e.context!==Bi?e.context:void 0;return this.arb.shrink(e.value_,t).map(En)}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 vr.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}},C1=class extends he{constructor(e){super(),this.arb=e}generate(e,t){return En(this.arb.generate(e,t))}canShrinkWithoutContext(e){return!0}shrink(e,t){if(t===void 0&&!this.arb.canShrinkWithoutContext(e))return B.nil();let r=t!==Bi?t:void 0;return this.arb.shrink(e,r).map(En)}};function t3(...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 f1(t,a1),new e3(W(...G(t,n=>new C1(n))),n=>r(...n))}var VS=()=>{},R1=class{constructor(e,t){this.arb=e,this.predicate=t;let{beforeEach:r=VS,afterEach:n=VS,asyncBeforeEach:i,asyncAfterEach:o}=St()||{};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 En(this.arb.generate(e,t!==void 0?k1(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return B.nil();let t=e.context!==Bi?e.context:void 0;return this.arb.shrink(e.value_,t).map(En)}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 vr.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 r3(...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 f1(t,a1),new R1(W(...G(t,n=>new C1(n))),n=>r(...n))}var n3=(function(e){return e[e.None=0]="None",e[e.Verbose=1]="Verbose",e[e.VeryVerbose=2]="VeryVerbose",e})({});function op(e){return"unsafeNext"in e?e.unsafeJump===void 0?{clone:()=>op(e),next:()=>e.unsafeNext(),getState:()=>e.getState()}:{clone:()=>op(e),next:()=>e.unsafeNext(),jump:()=>e.unsafeJump(),getState:()=>e.getState()}:e}function E1(e){return"jump"in e&&typeof e.jump=="function"?e:{clone:()=>E1(e),next:()=>e.next(),jump:()=>tS(e,42),getState:()=>e.getState()}}function Sa(e){return E1(op(e))}var i3=Date.now,o3=Math.min,s3=Math.random,a3=class{constructor(e){let t=e||{};this.seed=l3(t),this.randomType=c3(t),this.numRuns=u3(t),this.verbose=d3(t),this.maxSkipsPerRun=t.maxSkipsPerRun!==void 0?t.maxSkipsPerRun:100,this.timeout=Ld(t.timeout),this.skipAllAfterTimeLimit=Ld(t.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=Ld(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 Nd(e){return t=>Sa(e(t))}function l3(e){if(e.seed===void 0)return i3()^s3()*4294967296;let t=e.seed|0;return e.seed===t?t:t^(e.seed-t)*4294967296}function c3(e){if(e.randomType===void 0)return Pd;if(typeof e.randomType=="string")switch(e.randomType){case"mersenne":return Nd(Zw);case"congruential":case"congruential32":return Nd(Kw);case"xorshift128plus":return Pd;case"xoroshiro128plus":return eS;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===Sa(t)?e.randomType:Nd(e.randomType)}function u3(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 Ld(e){if(e!==void 0)return o3(e,2147483647)}function Op(e){return new a3(e)}function p3(e,t,r){let n=null;return{clear:()=>r(n),promise:new Promise(i=>{n=t(()=>{i(new vr(!0))},e)})}}var BS=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 vr(this.interruptExecution);return this.isAsync()?Promise.resolve(r):r}if(this.interruptExecution&&this.isAsync()){let r=p3(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()}},f3=(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)})}},h3=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=f3(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())}},I1=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()}},US=Array.from,WS=typeof Buffer<"u"?Buffer.isBuffer:void 0,wn=JSON.stringify,HS=Number.isNaN,m3=Object.keys,g3=Object.getOwnPropertySymbols,y3=Object.getOwnPropertyDescriptor,zS=Object.getPrototypeOf,GS=Number.NEGATIVE_INFINITY,b3=Number.POSITIVE_INFINITY,vt=Symbol.for("fast-check/toStringMethod");function Mp(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&vt in e&&typeof e[vt]=="function"}var Kt=Symbol.for("fast-check/asyncToStringMethod");function Np(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Kt in e&&typeof e[Kt]=="function"}var w3=/^Symbol\((.*)\)$/;function S3(e){if(e.description!==void 0)return e.description;let t=w3.exec(Je(e));return t&&t[1].length?t[1]:null}function qS(e){switch(e){case 0:return 1/e===GS?"-0":"0";case GS:return"Number.NEGATIVE_INFINITY";case b3:return"Number.POSITIVE_INFINITY";default:return e===e?Je(e):"Number.NaN"}}function v3(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 ot(e,t,r){let n=[...t,e];if(typeof e=="object"&&zt(t,e)!==-1)return"[cyclic]";if(Np(e)){let i=r(e);if(i.state==="fulfilled")return i.value}if(Mp(e))try{return e[vt]()}catch{}switch(ip(e)){case"[object Array]":{let i=e;if(i.length>=50&&v3(i)){let s=[];for(let a in i)HS(Number(a))||L(s,`${a}:${ot(i[a],n,r)}`);return s.length!==0?`Object.assign(Array(${i.length}),{${fe(s,",")}})`:`Array(${i.length})`}let o=fe(G(i,s=>ot(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 HS(ma(i))?"new Date(NaN)":`new Date(${wn(y4(i))})`}case"[object Map]":return`new Map(${ot(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"?`[${ot(o,n,r)}]`:wn(o)}:${ot(e[o],n,r)}`;return"{"+fe([...zS(e)===null?["__proto__:null"]:[],...G(m3(e),i),...G(h4(g3(e),o=>{let s=y3(e,o);return s&&s.enumerable}),i)],",")+"}"}case"[object Set]":return`new Set(${ot(Array.from(e),n,r)})`;case"[object String]":return typeof e=="string"?wn(e):`new String(${wn(e)})`;case"[object Symbol]":{let i=e;if(aa.keyFor(i)!==void 0)return`Symbol.for(${wn(aa.keyFor(i))})`;let o=S3(i);return o===null?"Symbol()":i===(o.startsWith("Symbol.")&&aa[o.substring(7)])?o:`Symbol(${wn(o)})`}case"[object Promise]":{let i=r(e);switch(i.state){case"fulfilled":return`Promise.resolve(${ot(i.value,n,r)})`;case"rejected":return`Promise.reject(${ot(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(${ot(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 WS=="function"&&WS(e))return`Buffer.from(${e.buffer.detached?"/*detached ArrayBuffer*/":ot(US(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(${ot(US(s.values()),n,r)})`}break}}try{return e.toString()}catch{return ip(e)}}function Ae(e){return ot(e,[],()=>({state:"unknown",value:void 0}))}function A1(e){let t=aa(),r=[],n=new qt;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=Kt in c?Promise.resolve().then(()=>c[Kt]()):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=ot(e,[],s);return r.length===0?l:Promise.all(r.splice(0)).then(a)}return a()}async function Lp(e){return Promise.resolve(A1(e))}function KS(e){return e===null?new vr:e}function x3(...e){return e[1]?e[0].then(KS):KS(e[0])}function k3(e,t){return x3(e,t)}var YS=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()}},JS=Date.now,$d=setTimeout,Dd=clearTimeout;function C3(e,t){let r=e;return e.isAsync()&&t.timeout!==void 0&&(r=new h3(r,t.timeout,$d,Dd)),t.unbiased&&(r=new I1(r)),t.skipAllAfterTimeLimit!==void 0&&(r=new BS(r,JS,t.skipAllAfterTimeLimit,!1,$d,Dd)),t.interruptAfterTimeLimit!==void 0&&(r=new BS(r,JS,t.interruptAfterTimeLimit,!0,$d,Dd)),t.skipEqualValues&&(r=new YS(r,!0)),t.ignoreEqualValues&&(r=new YS(r,!1)),r}var R3=(function(e){return e[e.Success=0]="Success",e[e.Skipped=-1]="Skipped",e[e.Failure=1]="Failure",e})({}),E3=class P1{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?+Ze(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?Ze(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:P1.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()}}},T1=class{constructor(e,t,r,n){this.sourceValues=e,this.shrink=t,this.runExecution=new E3(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"&&!vr.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_)}},I3=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}},A3=-2147483648,P3=2147483647,T3=Math.pow(2,27),O3=Math.pow(2,-53),$p=class O1{constructor(t){this.internalRng=Sa(t.clone())}clone(){return new O1(this.internalRng)}next(t){return Qs(this.internalRng,0,(1<<t)-1)}nextBoolean(){return Qs(this.internalRng,0,1)===1}nextInt(t,r){return Qs(this.internalRng,t===void 0?A3:t,r===void 0?P3:r)}nextBigInt(t,r){return iS(this.internalRng,t,r)}nextDouble(){let t=this.next(26),r=this.next(27);return(t*T3+r)*O3}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState=="function")return this.internalRng.getState()}};function M3(e,t,r){return t.jump(),e.generate(new $p(t),r)}function*M1(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 M3(e,o,i)}function N3(e,t,r){return()=>e.generate(new $p(t),r)}function*N1(e,t,r,n){yield*G(n,s=>()=>new $(s,void 0));let i=0,o=Sa(r(t));for(;;)o.jump(),yield N3(e,o,i++)}function ZS(e){return e()}function L1(e,t,r){let n=t,i=e.split(":").map(s=>+s);if(i.length===0)return n.map(ZS);if(!i.every(s=>!Number.isNaN(s)))throw new Error(`Unable to replay, got invalid path=${e}`);let o=n.drop(i[0]).map(ZS);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 L3=Object.assign;function $3(e){return e.length===1?`Hint: ${e[0]}`:e.map((t,r)=>`Hint (${r+1}): ${t}`).join(`
176
+ `)}function D3(e,t){return`Encountered failures were:
177
+ - ${e.map(t).join(`
178
+ - `)}`}function Dp(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
+ ${r.join(`
180
+ `)}`}function _3(e,t){let r=`Failed to run property, too many pre-condition failures encountered
181
+ { seed: ${e.seed} }
422
182
 
423
- `);return{results:i,summary:s}}async function xy({config:e,ids:r,presynced:t}){let n=t??await ye(e.cwd,e),o=await h({config:e,document:Sy,variables:{cwd:e.cwd,projectId:e.projectId}});if(o.project==null)throw new Error("Project not found");let i=o.project.devSession;if(i==null)throw new Error("No active dev session. Start one by running `ripplo` (or `npx ripplo`) in your terminal, then try again.");await h({config:e,document:ky,variables:{devSessionId:i.id,projectId:e.projectId}});let s=(i.workflows??[]).map(l=>vy(Ss,l));if(r.length===0)return s.map(l=>({id:l.slug,workflowId:l.id}));let a=n.compiled.tests.map(l=>l.slug);return r.map(l=>{let c=s.find(u=>u.slug===l);if(c==null)throw new Error(Ey({compiledSlugs:a,slug:l}));return{id:l,workflowId:c.id}})}function Ey({compiledSlugs:e,slug:r}){if(e.includes(r))return`Test "${r}" was synced from .ripplo/ but the server didn't return it. This is likely a server-state bug \u2014 check the server logs for the SyncDevSession mutation.`;let t=Cy({compiledSlugs:e,limit:3,slug:r}),n=t.length>0?`
424
- Did you mean: ${t.join(", ")}?`:"";return`Test "${r}" is not registered in this dev session.${n}
425
- Tests must be exported from .ripplo/tests/index.ts. (ripplo run already syncs on demand \u2014 restarting the dev server will not help.)`}function Cy({compiledSlugs:e,limit:r,slug:t}){let n=new Set(t.split("-"));return e.map(i=>({candidate:i,score:Ay(n,i)})).filter(i=>i.score>0).toSorted((i,s)=>s.score-i.score).slice(0,r).map(i=>i.candidate)}function Ay(e,r){return r.split("-").filter(t=>e.has(t)).length}function Iy({config:e,id:r,runId:t}){let n=e.ripploServerUrl.replace(/:3000\b/,":3001"),o=new URL(n.endsWith("/")?n:`${n}/`);return new URL(`projects/${e.projectId}/workflows/${r}/runs/${t}`,o).toString()}async function Ty({config:e,workflowId:r}){let n=(await h({config:e,document:Py,variables:{lockfileHash:hs(e.cwd),repoHash:$y(e.cwd),workflowId:r}})).createRun;if(n==null)throw new Error("Failed to create run");if(n.__typename!=="Run")throw new Error(`Cannot create run: ${n.message}`);return n.id}function $y(e){try{return Ee(e)}catch{return null}}var jy=2e3,vs=150;async function Ny({config:e,runId:r}){let t=0;for(;t<vs;){await Ly(jy),t+=1;let o=(await h({config:e,document:Ry,variables:{id:r}})).run;if(o==null)throw new Error(`Run ${r} not found`);if(!(o.status==="pending"||o.status==="running"))return Dy({run:o,runId:r})}return`Run ${r} timed out after polling ${String(vs)} times.`}function Dy({run:e,runId:r}){let t=[`Run ${r}: ${e.status.toUpperCase()}`],n=Oy(e);return n!=null&&t.push(n),t.push(` ${e.status}: ${String(e.passCount)} passed, ${String(e.failCount)} failed (${String(e.duration??0)}ms)`),e.summary!=null&&t.push(` Summary: ${e.summary}`),e.traceEntries.forEach(o=>{let i=o.status==="passed"?Ne.tick:Ne.cross,s=o.detail==null?"":` \u2014 ${o.detail}`;t.push(` ${i} ${o.title} (${String(o.duration??0)}ms)${s}`),o.assertions.forEach(a=>{let l=a.status==="passed"?Ne.tick:Ne.cross,c=a.detail==null?"":` \u2014 ${a.detail}`;t.push(` ${l} ${a.description}${c}`)})}),t.join(`
426
- `)}function Oy(e){if(e.caughtKind==null)return null;let r=e.workflow?.slug??"workflow";return e.caughtKind==="new_test"?` ${Ne.tick} ripplo caught a bug \u2014 new test "${r}" surfaced an issue in your app code`:` ${Ne.tick} ripplo caught a regression in "${r}"`}function Ly(e){return new Promise(r=>{setTimeout(r,e)})}import{graphql as _y}from"gql.tada";var Uy=_y(`
427
- query DevSessionCheckPreflight($projectId: String!, $cwd: String!) {
428
- project(id: $projectId) {
429
- id
430
- devSession(cwd: $cwd) {
431
- id
432
- }
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=Dp(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 j3(e){if(e instanceof N&&e.stack!==void 0)return e.stack;try{return Je(e)}catch{}if(e instanceof N)try{return q4(e)}catch{}if(e!==null&&typeof e=="object")try{return ip(e)}catch{}return"Failed to serialize errorInstance"}function F3(e,t){let r=e.runConfiguration.includeErrorInReport?`
185
+ Got ${U4(j3(e.errorInstance),/^Error: /,"error: ")}`:"",n=`Property failed after ${e.numRuns} tests
186
+ { seed: ${e.seed}, path: "${e.counterexamplePath}", endOnFailure: true }
187
+ Counterexample: ${t(e.counterexample)}
188
+ Shrunk ${e.numShrinks} time(s)${r}`,i=null,o=[];return e.verbose>=2?i=Dp(e.executionSummary,t):e.verbose===1?i=D3(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 V3(e,t){let r=`Property interrupted after ${e.numRuns} tests
189
+ { seed: ${e.seed} }`,n=null,i=[];return e.verbose>=2?n=Dp(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 sp(e,t){if(!e.failed)return;let{message:r,details:n,hints:i}=e.counterexamplePath===null?e.interrupted?V3(e,t):_3(e,t):F3(e,t),o=r;return n!==null&&(o+=`
190
+
191
+ ${n}`),i.length>0&&(o+=`
192
+
193
+ ${$3(i)}`),o}function $1(e){return sp(e,Ae)}async function D1(e){let t=[];function r(s){let a=A1(s);return typeof a=="string"?a:(t.push(Promise.all([s,a])),"\u2026")}let n=sp(e,r);if(t.length===0)return n;let i=new qt(await Promise.all(t));function o(s){let a=st(i,s);return a!==void 0?a:Ae(s)}return sp(e,o)}function _1(e,t){if(t.runConfiguration.includeErrorInReport)throw new N(e);let r=new N(e,{cause:t.errorInstance});return"cause"in r||L3(r,{cause:t.errorInstance}),r}function B3(e){if(e.failed)throw _1($1(e),e)}async function U3(e){if(e.failed)throw _1(await D1(e),e)}function W3(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):B3(e)}async function H3(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):U3(e)}function z3(e,t,r,n,i){let o=new T1(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 G3(e,t,r,n,i){let o=new T1(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 j1(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=Op({...St(),...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=C3(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 I3(r.path.length===0?M1(n,r.seed,r.randomType,r.examples):L1(r.path,wr(N1(n,r.seed,r.randomType,r.examples)),s),i,o),l=r.endOnFailure?B.nil:s;return n.isAsync()?G3(n,l,a,r.verbose,r.markInterruptAsFailure).then(c=>c.toRunDetails(r.seed,r.path,o,r)):z3(n,l,a,r.verbose,r.markInterruptAsFailure).toRunDetails(r.seed,r.path,o,r)}function q3(e,t){let r=j1(e,t);if(e.isAsync())return r.then(H3);W3(r)}function K3(e,t){let r=Object.prototype.hasOwnProperty.call(e,"isAsync")?e:new R1(e,()=>!0);return t.unbiased===!0?new I1(r):r}function F1(e,t){let r=Op(typeof t=="number"?{...St(),numRuns:t}:{...St(),...t}),n=K3(e,r),i=n.shrink.bind(n);return(r.path.length===0?wr(M1(n,r.seed,r.randomType,r.examples)):L1(r.path,wr(N1(n,r.seed,r.randomType,r.examples)),i)).take(r.numRuns).map(o=>o.value_)}function Y3(e,t){return[...F1(e,t)]}function J3(e){return(Math.round(e*100)/100).toFixed(2)}function Z3(e,t,r){let n=Op(typeof r=="number"?{...St(),numRuns:r}:{...St(),...r}),i={};for(let l of F1(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],`${J3(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 X3=Object.assign;function ap(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 $(X3(l,{values(){return G(s.history,c=>c.value)},[Be](){return ap(e,t,r,n).value},[vt](){return Ae(G(s.history,c=>c.value))}}),s)}var _d=Array.isArray,XS=Object.keys,Q3=Object.is;function eD(e){let t=new qt;return function(n,i){let o=st(t,n);if(o===void 0){let l=n(...i);return wt(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 V1(e,t){if(e!==null&&typeof e=="object"&&t!==null&&typeof t=="object"){if(_d(e)){if(!_d(t)||e.length!==t.length)return!1}else if(_d(t))return!1;if(XS(e).length!==XS(t).length)return!1;for(let r in e)if(!(r in t)||!V1(e[r],t[r]))return!1;return!0}else return Q3(e,t)}var tD=class extends he{constructor(...e){super(...e),this.arbitraryCache=eD(V1)}generate(e,t){return ap(e,t,()=>[],this.arbitraryCache)}canShrinkWithoutContext(e){return!1}shrink(e,t){if(t===void 0)return B.nil();let r=t,n=r.mrng,i=r.biasFactor,o=r.history;return x1(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 ap(n,i,a,this.arbitraryCache)})}};function rD(){return new tD}var nD=Math.floor,QS=Math.log;function iD(e){return nD(QS(e)/QS(2))}function oD(e){return e===O(0)?O(0):O(Je(e).length)}function B1(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 sD=Math.ceil,aD=Math.floor;function ev(e){return aD(e/2)}function tv(e){return sD(e/2)}function rv(e,t,r){let n=e-t;function*i(){let s=r?void 0:t,a=r?n:ev(n);for(let l=a;l>0;l=ev(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:tv(n);for(let l=a;l<0;l=tv(l)){let c=l===n?t:e-l;yield new $(c,s),s=c}}return n>0?wr(i()):wr(o())}var nv=Math.sign,lD=Number.isInteger,cD=Object.is,In=class U1 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"&&lD(t)&&!cD(t,-0)&&this.min<=t&&t<=this.max}shrink(t,r){return U1.isValidContext(t,r)?this.isLastChanceTry(t,r)?B.of(new $(r,void 0)):rv(t,r,!1):rv(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=B1(this.min,this.max,iD);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&&nv(t)!==nv(r))throw new Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}},iv=Number.isInteger;function uD(e){return{min:e.min!==void 0?e.min:-2147483648,max:e.max!==void 0?e.max:2147483647}}function oe(e={}){let t=uD(e);if(t.min>t.max)throw new Error("fc.integer maximum value should be equal or greater than the minimum one");if(!iv(t.min))throw new Error("fc.integer minimum value should be an integer");if(!iv(t.max))throw new Error("fc.integer maximum value should be an integer");return new In(t.min,t.max)}var ov=new Map;function _p(e){if(e===void 0)return{depth:0};if(typeof e!="string")return e;let t=st(ov,e);if(t!==void 0)return t;let r={depth:0};return wt(ov,e,r),r}function jp(){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)}},pD=Math.min,fD=Math.max,hD=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=pD(t,r),this.lastIndexInSlice=fD(t,r),new $(e[this.nextIndexInSlice++],void 0)}};function sv(e,t,r,n){return n===void 0||r.length===0||t.nextInt(1,n)!==1?new dD(e,t,n):new hD(e,t,r,n)}var mD=Math.floor,av=Math.log,lv=Math.max,gD=Array.isArray;function jd(e,t){return e===t?e:e+mD(av(t-e)/av(2))}var W1=class H1 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=_p(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[Be]=()=>{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=sv(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=lv(0,r-jd(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=sv(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=lv(0,t-jd(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&&H1.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=jd(this.minLength,this.maxGeneratedLength);return{size:oe({min:this.minLength,max:n}).generate(t,void 0).value,biasFactorItems:r}}canShrinkWithoutContext(t){if(!gD(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,br(()=>this.arb.shrink(t[o],r.itemsContexts[o]).map(s=>{let a=G(Ue(t,0,o),(c,u)=>new $(kn(c),r.itemsContexts[u])),l=G(Ue(t,o+1),(c,u)=>new $(kn(c),r.itemsContexts[u+o+1]));return[[...a,s,...l],void 0,o]})));return B.nil().join(...i)}shrinkImpl(t,r){if(t.length===0)return B.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 $(kn(s),n.itemsContexts[a+o])),i.context,0]}).join(br(()=>t.length>this.minLength?this.shrinkItemByItem(t,n,1):this.shrinkItemByItem(t,n,t.length))).join(t.length>this.minLength?br(()=>{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 $(kn(t[0]),n.itemsContexts[0]),...o[0]],void 0,0])}):B.nil())}shrink(t,r){return this.shrinkImpl(t,r).map(n=>this.wrapper(n[0],!0,n[1],n[2]))}},yD=Math.floor,bD=Math.min,Wr=2147483647,Sn=["xsmall","small","medium","large","xlarge"],wD=["-4","-3","-2","-1","=","+1","+2","+3","+4"],Fp="small";function SD(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 Hi(e,t){let r=zt(wD,e);if(r===-1)return e;let n=zt(Sn,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?Sn[0]:i>=Sn.length?Sn[Sn.length-1]:Sn[i]}function Ui(e,t,r,n){let{baseSize:i=Fp,defaultSizeToMaxWhenMaxSpecified:o}=St()||{},s=e!==void 0?e:n&&o?"max":i;return s==="max"?r:bD(SD(t,Hi(s,i)),r)}function vD(e,t){if(typeof e=="number")return 1/e;let{baseSize:r=Fp,defaultSizeToMaxWhenMaxSpecified:n}=St()||{},i=e!==void 0?e:t&&n?"max":r;if(i==="max")return 0;switch(Hi(i,r)){case"xsmall":return 1;case"small":return .5;case"medium":return .25;case"large":return .125;case"xlarge":return .0625}}function Vp(e){let{baseSize:t=Fp}=St()||{};return e===void 0?t:Hi(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:Wr;return new W1(e,n,Ui(r,n,s,i!==void 0),s,o,void 0,t.experimentalCustomSlices||[])}function ea(e){return e/O(2)}function cv(e,t,r){let n=e-t;function*i(){let s=r?void 0:t,a=r?n:ea(n);for(let l=a;l>0;l=ea(l)){let c=e-l;yield new $(c,s),s=c}}function*o(){let s=r?void 0:t,a=r?n:ea(n);for(let l=a;l<0;l=ea(l)){let c=e-l;yield new $(c,s),s=c}}return n>0?wr(i()):wr(o())}var xD=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=B1(this.min,this.max,oD);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)?B.of(new $(r,void 0)):cv(t,r,!1):cv(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 CD(e){return e[0]===void 0?{}:e[1]===void 0?e[0]:{min:e[0],max:e[1]}}function Sr(...e){let t=kD(CD(e));if(t.min>t.max)throw new Error("fc.bigInt expects max to be greater than or equal to min");return new xD(t.min,t.max)}var RD=Object.getPrototypeOf,$i=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 ya(e){return RD(e)===$i.prototype&&e.generate===$i.prototype.generate&&e.canShrinkWithoutContext===$i.prototype.canShrinkWithoutContext&&e.shrink===$i.prototype.shrink?e:new $i(e)}function ED(e){return e===1}function ID(e){if(typeof e!="boolean")throw new Error("Unsupported input type");return e===!0?1:0}function zi(){return ya(oe({min:0,max:1}).map(ED,ID))}var ji=Object.is,AD=class{constructor(e){this.values=e,this.fastValues=new Cn(this.values);let t=!1,r=!1;if(ga(this.fastValues,0))for(let n=0;n!==this.values.length;++n){let i=this.values[n];t=t||ji(i,-0),r=r||ji(i,0)}this.hasMinusZero=t,this.hasPlusZero=r}has(e){return e===0?ji(e,0)?this.hasPlusZero:this.hasMinusZero:ga(this.fastValues,e)}},G1=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 Ur(n)?new $(n,r,()=>n[Be]()):new $(n,r)}canShrinkWithoutContext(e){return this.values.length===1?ji(this.values[0],e):(this.fastValues===void 0&&(this.fastValues=new AD(this.values)),this.fastValues.has(e))}shrink(e,t){return t===0||ji(e,this.values[0])?B.nil():B.of(new $(this.values[0],0))}};function Tt(...e){if(e.length===0)throw new Error("fc.constantFrom expects at least one parameter");return new G1(e)}function PD(e){return!e||!e.withBigInt?Tt(!1,null,void 0,0,"",NaN):Tt(!1,null,void 0,0,"",NaN,O(0))}function Ie(e){return new G1([e])}var TD=class q1{constructor(){this.receivedLogs=[]}log(t){this.receivedLogs.push(t)}size(){return this.receivedLogs.length}toString(){return JSON.stringify({logs:this.receivedLogs})}[Be](){return new q1}};function OD(){return Ie(new TD)}var MD=NaN,ND=Number.isNaN;function K1(e){return new ha(e)}function Y1(e){if(!(e instanceof ha)||e.constructor!==ha)throw new N("Not a valid value for date unmapper");return ma(e)}function LD(e){return t=>t===e?new ha(MD):K1(t)}function $D(e){return t=>{let r=Y1(t);return ND(r)?e:r}}var uv=Number.isNaN;function J1(e={}){let t=e.min!==void 0?ma(e.min):-864e13,r=e.max!==void 0?ma(e.max):864e13,n=e.noInvalidDate;if(uv(t))throw new Error("fc.date min must be valid instance of Date");if(uv(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(K1,Y1);let i=r+1;return oe({min:t,max:r+1}).map(LD(i),$D(i))}var DD=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 B(this.shrinkIterator(t)):B.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 _D(e,t){return new DD(e,t)}var jD=Symbol.iterator,FD=Array.isArray,VD=Object.is,BD=class Z1 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(!FD(t)||t.length!==this.numValues)return!1;if(t.length===0)return!0;for(let r=1;r<t.length;++r)if(!VD(t[0],t[r]))return!1;return this.arb.canShrinkWithoutContext(t[0])}shrink(t,r){return t.length===0?B.nil():new B(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])[jD]()),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[Be]=()=>{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&&Z1.makeItCloneable(n,t),new $(n,i)}};function UD(e,t){return new BD(e,t)}var dv=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}},WD=Number.isNaN,HD=class{constructor(e){this.selector=e,this.selectedItemsExceptNaN=new Cn,this.data=[]}tryAdd(e){let t=this.selector(e);if(WD(t))return L(this.data,e),!0;let r=this.selectedItemsExceptNaN.size;return Fi(this.selectedItemsExceptNaN,t),r!==this.selectedItemsExceptNaN.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},zD=Object.is,GD=class{constructor(e){this.selector=e,this.selectedItemsExceptMinusZero=new Cn,this.data=[],this.hasMinusZero=!1}tryAdd(e){let t=this.selector(e);if(zD(t,-0))return this.hasMinusZero?!1:(L(this.data,e),this.hasMinusZero=!0,!0);let r=this.selectedItemsExceptMinusZero.size;return Fi(this.selectedItemsExceptMinusZero,t),r!==this.selectedItemsExceptMinusZero.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},qD=class{constructor(e){this.selector=e,this.selectedItems=new Cn,this.data=[]}tryAdd(e){let t=this.selector(e),r=this.selectedItems.size;return Fi(this.selectedItems,t),r!==this.selectedItems.size?(L(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}};function KD(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 dv(l)}let n=e.comparator,i=e.selector,o=a=>i(a.value_),s=(a,l)=>n(o(a),o(l));return()=>new dv(s)}let t=e.selector||(n=>n),r=n=>t(n.value_);switch(e.comparator){case"IsStrictlyEqual":return()=>new HD(r);case"SameValueZero":return()=>new qD(r);case"SameValue":case void 0:return()=>new GD(r)}}function Hr(e,t={}){let r=t.minLength!==void 0?t.minLength:0,n=t.maxLength!==void 0?t.maxLength:Wr,i=Ui(t.size,r,n,t.maxLength!==void 0),o=t.depthIdentifier,s=new W1(e,r,i,n,o,KD(t),[]);return r===0?s:s.filter(a=>a.length>=r)}var YD=Object.create,JD=Object.defineProperty,ZD=Object.getOwnPropertyDescriptor,pv=Object.getPrototypeOf,XD=Object.prototype,QD=Reflect.ownKeys;function e_(e){let t=e[1]?YD(null):{};for(let r of e[0])JD(t,r[0],{enumerable:!0,configurable:!0,writable:!0,value:r[1]});return t}function t_(e){return e!==void 0&&!!e.configurable&&!!e.enumerable&&!!e.writable&&e.get===void 0&&e.set===void 0}function r_(e){if(typeof e!="object"||e===null)throw new N("Incompatible instance received: should be a non-null object");let t=pv(e)===null,r=pv(e)===XD;if(!t&&!r)throw new N("Incompatible instance received: should be of exact type Object");let n=G(QD(e),i=>[i,ZD(e,i)]);if(!y1(n,([,i])=>t_(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 n_(e){return e[0]}function Bp(e,t,r={}){let n=!!r.noNullPrototype;return W(Hr(W(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:n_,depthIdentifier:r.depthIdentifier}),n?Ie(!1):zi()).map(e_,r_)}var i_=Number.POSITIVE_INFINITY,o_=Number.MAX_SAFE_INTEGER,s_=Number.isInteger,a_=Math.floor,l_=Math.pow,c_=Math.min,lp=class X1 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,!s_(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 X1(t,{depthBias:vD(r.depthSize,r.maxDepth!==void 0),maxDepth:r.maxDepth!==void 0?r.maxDepth:i_,withCrossShrink:!!r.withCrossShrink},_p(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 B.of(l).join(a)}return a}let n=this.canShrinkWithoutContextIndex(t);return n===-1?B.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 B.nil()}finally{--this.context.depth}let r=new $(this.warbs[0].fallbackValue.default,void 0);return B.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=a_(l_(1+t,this.context.depth))-1;return-c_(this.totalWeight*r,o_)||0}};function u_(e){return e!=null&&typeof e=="object"&&!("generate"in e)&&!("arbitrary"in e)&&!("weight"in e)}function fv(e){return s1(e)?{arbitrary:e,weight:1}:e}function Ve(...e){let t=e[0];if(u_(t)){let n=G(Ue(e,1),fv);return lp.from(n,t,"fc.oneof")}let r=G(e,fv);return lp.from(r,{},"fc.oneof")}var d_=Number.isInteger;function yr(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 In(0,t)}var p_=Object.is;function f_(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 h_(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 m_(e){let t=f_(e);return function(n){let i=h_(t,n);return i.entry.build(n-i.from)}}function g_(e){let t={mapping:new qt,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===Gt.NEGATIVE_INFINITY?t.negativeZeroIndex=r:wt(t.mapping,s,r),++r}}return t}function y_(e){let t=null;return function(n){t===null&&(t=g_(e));let i=p_(n,-0)?t.negativeZeroIndex:st(t.mapping,n);if(i===void 0)throw new N("Unknown value encountered cannot be built using this mapToConstant");return i}}function b_(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 An(...e){return yr({max:b_(e)-1}).map(m_(e),y_(e))}function Q1(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=h1(i);for(let s=o.nextStartIndex;s<=t.length;++s){let a=ve(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 w_(e){return fe(e,"")}function e0(e){return e.minLength!==void 0?e.minLength:0}function t0(e){return e.maxLength!==void 0?e.maxLength:Wr}function S_(e,t){return e0(t)<=e.length&&e.length<=t0(t)}function v_(e,t){return function(n){if(typeof n!="string")throw new N("Unsupported value");let i=Q1(e,n,e0(t),t0(t));if(i===void 0)throw new N("Unable to unmap received string");return i}}var r0=["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","apply","arguments","bind","call","caller","length","name","prototype","key","ref"];function x_(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 r0){let i=x_(n,e,t);i!==void 0&&L(r,i)}return r}var hv=new WeakMap;function C_(e){let t=[];for(let r of r0){let n=Q1(e,r,0,Wr);n!==void 0&&L(t,n)}return t}function R_(e,t){let r=k4(hv,e);r===void 0&&(r=C_(e),x4(hv,e,r));let n=[];for(let i of r)S_(i,t)&&L(n,i);return n}var E_=[[0,127]],I_=[[0,55295],[57344,1114111]],A_=[[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]],P_=[[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]],mv=String.fromCodePoint,T_=Math.min,O_=Math.max;function cp(e){if(e.length===1){let r=mv(e[0]);return{num:1,build:()=>r}}let t=e[0];return{num:e[1]-e[0]+1,build:r=>mv(t+r)}}function gv(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=O_(s,c),p=T_(a,u);if(r.length>=1){let h=r[r.length-1];(h.length===1?h[0]:h[1])+1===d&&(d=h[0],h1(r))}L(r,d===p?[d]:[d,p]),a<=p&&(n+=1),u<=p&&(i+=1)}}return r}var yv=Object.create(null);function M_(e){switch(e){case"full":return I_;case"ascii":return E_}}function N_(e,t){let r=`${e}:${t}`,n=yv[r];if(n!==void 0)return n;let i=M_(t),o=e==="binary"?i:gv(i,A_),s=[];for(let l of o)L(s,cp(l));if(e==="grapheme"){let l=gv(i,P_);for(let c of l){let u=cp(c);L(s,{num:u.num,build:d=>B4(u.build(d),"NFD")})}}let a=An(...s);return yv[r]=a,a}function Di(e,t){return N_(e,t)}function L_(e){if(typeof e.unit=="object")return e.unit;switch(e.unit){case"grapheme":return Di("grapheme","full");case"grapheme-composite":return Di("composite","full");case"grapheme-ascii":case void 0:return Di("grapheme","ascii");case"binary":return Di("binary","full");case"binary-ascii":return Di("binary","ascii")}}function Le(e={}){let t=L_(e),r=v_(t,e),n=R_(t,e);return ce(t,{...e,experimentalCustomSlices:n}).map(w_,r)}var n0=Map,Up=String.fromCharCode,Wp={num:26,build:e=>Up(e+97)},$_={num:26,build:e=>Up(e+65)},i0={num:10,build:e=>Up(e+48)};function D_(e){let t=e4(e);return e!==t?t:`%${Vi(Rn(e,0),16)}`}function __(e){if(typeof e!="string")throw new Error("Unsupported");return decodeURIComponent(e)}var j_=()=>Le({unit:"binary",minLength:1,maxLength:1}).map(D_,__),Fd;function F_(){return Fd===void 0&&(Fd=An(Wp)),Fd}var ta;function up(e){ta===void 0&&(ta=new n0);let t=st(ta,e);return t===void 0&&(t=An(Wp,i0,{num:e.length,build:r=>e[r]}),wt(ta,e,t)),t}function V_(e){return An(Wp,$_,i0,{num:e.length,build:t=>e[t]})}var ra;function Hp(e){ra===void 0&&(ra=new n0);let t=st(ra,e);return t===void 0&&(t=Ve({weight:10,arbitrary:V_(e)},{weight:1,arbitrary:j_()}),wt(ra,e,t)),t}function Yt(e,t={}){let r=t.freq===void 0?6:t.freq,n=b1(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 lp.from(i,o,"fc.option")}function B_(e){return e.length>63?!1:e.length<4||e[0]!=="x"||e[1]!=="n"||e[2]!=="-"||e[3]!=="-"}var o0=Symbol("adapted-value");function U_(e,t){let r=t(e.value_);return r.adapted?new $(r.value,o0):e}var W_=class extends he{constructor(e,t){super(),this.sourceArb=e,this.adapter=t,this.adaptValue=r=>U_(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===o0?this.sourceArb.canShrinkWithoutContext(e)?this.sourceArb.shrink(e,void 0).map(this.adaptValue):B.nil():this.sourceArb.shrink(e,t).map(this.adaptValue)}};function s0(e,t){return new W_(e,t)}function H_([e,t]){return t===null?e:`${e}${t[0]}${t[1]}`}function z_(e){if(typeof e!="string"||e.length===0)throw new Error("Unsupported");return e.length===1?[e[0],null]:[e[0],[ve(e,1,e.length-1),e[e.length-1]]]}function G_(e){let t=up("");return W(t,Yt(W(Le({unit:up("-"),size:e,maxLength:61}),t))).map(H_,z_).filter(B_)}function q_(e){return`${fe(e[0],".")}.${e[1]}`}function K_(e){if(typeof e!="string")throw new Error("Unsupported type");let t=e.lastIndexOf(".");return[Ze(ve(e,0,t),"."),ve(e,t+1)]}function Y_(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 zp(e={}){let t=Vp(e.size),r=Hi("-1",t),n=Le({unit:F_(),minLength:2,maxLength:63,size:r});return s0(W(ce(G_(t),{size:r,minLength:1,maxLength:127}),n),Y_).map(q_,K_)}function J_(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 Z_(e){return fe(e,".")}function X_(e){if(typeof e!="string")throw new Error("Unsupported");return Ze(e,".")}function Q_(e){return`${e[0]}@${e[1]}`}function ej(e){if(typeof e!="string")throw new Error("Unsupported");return Ze(e,"@",2)}function tj(e={}){return W(s0(ce(Le({unit:up("!#$%&'*+-/=?^_`{|}~"),minLength:1,maxLength:64,size:e.size}),{minLength:1,maxLength:32,size:e.size}),J_).map(Z_,X_),zp({size:e.size})).map(Q_,ej)}var rj=Gt.NEGATIVE_INFINITY,dp=Gt.POSITIVE_INFINITY,a0=Gt.EPSILON,Gp=O(2146435072)*O(4294967296),nj=-Gp-O(1),bv=4503599627370496,ij=O(0xfffffffffffff),wv=O("9007199254740992"),pp=new Float64Array(1),Sv=new Uint32Array(pp.buffer,pp.byteOffset);function oj(e){return pp[0]=e,[Sv[1],Sv[0]]}function sj(e){let{0:t,1:r}=oj(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*a0,a*=n===0?1:-1,{exponent:s,significand:a}}function vv(e,t){return e===-1022?O(t*bv):O((t-1)*bv)+(O(e+1023)<<O(52))}function qp(e){if(e===dp)return Gp;if(e===rj)return nj;let t=sj(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===dp?vv(r,n):-vv(r,-n)-O(1)}function fp(e){if(e<0)return-fp(-e-O(1));if(e===Gp)return dp;if(e<wv)return Gt(e)*2**-1074;let t=e-wv,r=-1021+Gt(t>>O(52));return(1+Gt(t&ij)*a0)*2**r}var xv=Number.isInteger,kv=Object.is,Vd=Number.NEGATIVE_INFINITY,Bd=Number.POSITIVE_INFINITY;function l0(e,t,r,n){let{noDefaultInfinity:i=!1,minExcluded:o=!1,maxExcluded:s=!1,min:a=i?-t:Vd,max:l=i?t:Bd}=e,c=o?a<-r?-n:Math.max(a,-r):a===Vd?Math.max(a,-n):Math.max(a,-r),u=s?l>r?n:Math.min(l,r):l===Bd?Math.min(l,n):Math.min(l,r);return{noDefaultInfinity:!1,minExcluded:o||(a!==Vd||o)&&xv(c),maxExcluded:s||(l!==Bd||s)&&xv(u),min:kv(c,-0)?0:c,max:kv(u,0)?-0:u,noNaN:e.noNaN||!1}}var c0=Number.NEGATIVE_INFINITY,u0=Number.POSITIVE_INFINITY,aj=Number.MAX_VALUE,lj=45035996273704955e-1,hp=4503599627370496;function cj(e){return l0(e,aj,lj,hp)}function uj(e){return e===4503599627370496?u0:e===-4503599627370496?c0:e}function dj(e){if(typeof e!="number")throw new Error("Unsupported type");return e===u0?hp:e===c0?-hp:e}var pj=Number.isInteger,d0=Number.isNaN,fj=Number.NEGATIVE_INFINITY,hj=Number.POSITIVE_INFINITY,Cv=Number.MAX_VALUE,mj=NaN;function Rv(e,t){if(d0(e))throw new Error("fc.double constraints."+t+" must be a 64-bit float");return qp(e)}function gj(e){if(typeof e!="number")throw new Error("Unsupported type");return qp(e)}function yj(e){return!pj(e)}function Ev(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:i=!1,min:o=t?-Cv:fj,max:s=t?Cv:hj}=e,a=Rv(o,"min"),l=n?a+O(1):a,c=Rv(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 Sr({min:l,max:u}).map(fp,gj);let d=u>O(0),p=d?l:l-O(1),h=d?u+O(1):u;return Sr({min:p,max:h}).map(f=>u<f||f<l?mj:fp(f),f=>{if(typeof f!="number")throw new Error("Unsupported type");return d0(f)?u!==h?h:p:qp(f)})}function va(e={}){return e.noInteger?Ev(cj(e)).map(uj,dj).filter(yj):Ev(e)}var bj=Number.NEGATIVE_INFINITY,mp=Number.POSITIVE_INFINITY,wj=Math.imul,gp=2**127*(1+(2**23-1)/2**23),p0=2139095040,Sj=-2139095041,yp=new Float32Array(1),vj=new Uint32Array(yp.buffer,yp.byteOffset);function xj(e){return yp[0]=e,vj[0]}function kj(e){let t=xj(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 Iv(e,t){return e===-126?t*8388608:wj(e+127,8388608)+(t-1)*8388608}function Kp(e){if(e===mp)return p0;if(e===bj)return Sj;let t=kj(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===mp?Iv(r,n):-Iv(r,-n)-1}function bp(e){if(e<0)return-bp(-e-1);if(e===p0)return mp;if(e<16777216)return e*2**-149;let t=e-16777216,r=-125+(t>>23);return(1+(t&8388607)/8388608)*2**r}var f0=Number.NEGATIVE_INFINITY,h0=Number.POSITIVE_INFINITY,Cj=gp,Rj=83886075e-1,wp=8388608;function Ej(e){return l0(e,Cj,Rj,wp)}function Ij(e){return e===8388608?h0:e===-8388608?f0:e}function Aj(e){if(typeof e!="number")throw new Error("Unsupported type");return e===h0?wp:e===f0?-wp:e}var Pj=Number.isInteger,m0=Number.isNaN,Tj=Math.fround,Oj=Number.NEGATIVE_INFINITY,Mj=Number.POSITIVE_INFINITY,Nj=NaN;function Av(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(m0(e)||Tj(e)!==e)throw new Error(r);return Kp(e)}function Lj(e){if(typeof e!="number")throw new Error("Unsupported type");return Kp(e)}function $j(e){return!Pj(e)}function Pv(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:i=!1,min:o=t?-gp:Oj,max:s=t?gp:Mj}=e,a=Av(o,"min"),l=n?a+1:a,c=Av(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(bp,Lj);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?Nj:bp(h),h=>{if(typeof h!="number")throw new Error("Unsupported type");return m0(h)?u!==p?p:d:Kp(h)})}function g0(e={}){return e.noInteger?Pv(Ej(e)).map(Ij,Aj).filter($j):Pv(e)}function Dj(e){return e.replace(/([$`\\])/g,"\\$1").replace(/\r/g,"\\r")}function y0(e){return e.replace(/\*\//g,"*\\/")}var it=[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 ba(e){let t=4294967295;for(let r=0;r<e.length;++r){let n=Rn(e,r);if(n<128)t=it[t&255^n]^t>>8;else if(n<2048)t=it[t&255^(192|n>>6&31)]^t>>8,t=it[t&255^(128|n&63)]^t>>8;else if(n>=55296&&n<57344){let i=Rn(e,++r);if(n>=56320||i<56320||i>57343||Number.isNaN(i))r-=1,t=it[t&255^239]^t>>8,t=it[t&255^191]^t>>8,t=it[t&255^189]^t>>8;else{let o=(n&1023)+64,s=i&1023;t=it[t&255^(240|o>>8&7)]^t>>8,t=it[t&255^(128|o>>2&63)]^t>>8,t=it[t&255^(128|s>>6&15|(o&3)<<4)]^t>>8,t=it[t&255^(128|s&63)]^t>>8}}else t=it[t&255^(224|n>>12&15)]^t>>8,t=it[t&255^(128|n>>6&63)]^t>>8,t=it[t&255^(128|n&63)]^t>>8}return(t|0)+2147483648}var _j=Object.getPrototypeOf,_i=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 B.nil()}};function wa(e){return _j(e)===_i.prototype&&e.generate===_i.prototype.generate&&e.canShrinkWithoutContext===_i.prototype.canShrinkWithoutContext&&e.shrink===_i.prototype.shrink?e:new _i(e)}var jj=Object.assign,Fj=Object.keys;function b0(e){return W(wa(oe()),wa(oe({min:1,max:4294967295}))).map(([t,r])=>{let n=()=>{let i={};return jj((s,a)=>{let l=Ae(s),c=Ae(a),u=e(ba(`${t}${l}`)%r,ba(`${t}${c}`)%r);return i[`[${l},${c}]`]=u,u},{toString:()=>{let s=Fj(i).sort().map(a=>`${a} => ${Ae(i[a])}`).map(a=>`/* ${y0(a)} */`);return`function(a, b) {
194
+ // With hash and stringify coming from fast-check${s.length!==0?`
195
+ ${fe(s,`
196
+ `)}`:""}
197
+ const cmp = ${e};
198
+ const hA = hash('${t}' + stringify(a)) % ${r};
199
+ const hB = hash('${t}' + stringify(b)) % ${r};
200
+ return cmp(hA, hB);
201
+ }`},[Be]:n})};return n()})}var Vj=Object.assign;function Bj(){return b0(Vj((e,t)=>e<t,{toString(){return"(hA, hB) => hA < hB"}}))}var Uj=Object.assign;function Wj(){return b0(Uj((e,t)=>e-t,{toString(){return"(hA, hB) => hA - hB"}}))}var Hj=Object.defineProperties,zj=Object.keys;function Gj(e){return W(ce(e,{minLength:1}),wa(oe())).map(([t,r])=>{let n=()=>{let i={},o=(...a)=>{let l=Ae(a),c=t[ba(`${r}${l}`)%t.length];return i[l]=c,Ur(c)?c[Be]():c};function s(a){let l=G(G(g1(zj(i)),c=>`${c} => ${Ae(i[c])}`),c=>`/* ${y0(c)} */`);return`function(...args) {
202
+ // With hash and stringify coming from fast-check${l.length!==0?`
203
+ ${l.join(`
204
+ `)}`:""}
205
+ const outs = ${a};
206
+ return outs[hash('${r}' + stringify(args)) % outs.length];
207
+ }`}return Hj(o,{toString:{value:()=>s(Ae(t))},[vt]:{value:()=>s(Ae(t))},[Kt]:{value:async()=>s(await Lp(t))},[Be]:{value:n,configurable:!0}})};return n()})}var qj=Number.MIN_SAFE_INTEGER,Kj=Number.MAX_SAFE_INTEGER;function w0(){return new In(qj,Kj)}var Yj=Number.MAX_SAFE_INTEGER;function Jj(){return new In(0,Yj)}var Zj=Number.parseInt;function Xj(e){let[t,r]=e;switch(t){case"oct":return`0${Vi(r,8)}`;case"hex":return`0x${Vi(r,16)}`;default:return`${r}`}}function la(e,t){let r=Zj(e,t);if(Vi(r,t)!==e)throw new Error("Invalid value");return r}function Qj(e){if(typeof e!="string")throw new Error("Invalid type");return e.length>=2&&e[0]==="0"?e[1]==="x"?["hex",la(ve(e,2),16)]:["oct",la(ve(e,1),8)]:["dec",la(e,10)]}function e8(e){return fe(e,".")}function t8(e){if(typeof e!="string")throw new Error("Invalid type");return G(Ze(e,"."),t=>la(t,10))}function Yp(){return W(yr(255),yr(255),yr(255),yr(255)).map(e8,t8)}function Pt(e){return W(Tt("dec","oct","hex"),yr(e)).map(Xj,Qj)}function Ud(e){return fe(e,".")}function Wd(e){if(typeof e!="string")throw new Error("Invalid type");return Ze(e,".")}function S0(){return Ve(W(Pt(255),Pt(255),Pt(255),Pt(255)).map(Ud,Wd),W(Pt(255),Pt(255),Pt(65535)).map(Ud,Wd),W(Pt(255),Pt(16777215)).map(Ud,Wd),Pt(4294967295))}function Jp(e){return e.length===0?[]:Ze(e,":")}function Zp(e){let t=Ze(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 r8(e){return`${fe(e[0],":")}:${e[1]}`}function n8(e){if(typeof e!="string")throw new Error("Invalid type");return Zp(e)}function i8(e){return`::${fe(e[0],":")}:${e[1]}`}function o8(e){if(typeof e!="string")throw new Error("Invalid type");if(!j4(e,"::"))throw new Error("Invalid value");return Zp(ve(e,2))}function ca(e){return`${fe(e[0],":")}::${fe(e[1],":")}:${e[2]}`}function ua(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Ze(e,"::",2),[n,i]=Zp(r);return[Jp(t),n,i]}function s8(e){return ca([e[0],[e[1]],e[2]])}function a8(e){let t=ua(e);return[t[0],fe(t[1],":"),t[2]]}function Tv(e){return`${fe(e[0],":")}::${e[1]}`}function Ov(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Ze(e,"::",2);return[Jp(t),r]}function l8(e){return`${fe(e[0],":")}::`}function c8(e){if(typeof e!="string")throw new Error("Invalid type");if(!F4(e,"::"))throw new Error("Invalid value");return[Jp(ve(e,0,e.length-2))]}function u8([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 p8="0123456789abcdef",Hd;function f8(){return Hd===void 0&&(Hd=oe({min:0,max:15}).map(e=>p8[e],e=>{if(typeof e!="string")throw new N("Not a string");if(e.length!==1)throw new N("Invalid length");let t=Rn(e,0);if(t<=57)return t-48;if(t<97)throw new N("Invalid character");return t-87})),Hd}function v0(){let e=Le({unit:f8(),minLength:1,maxLength:4,size:"max"}),t=Ve(W(e,e).map(u8,d8),Yp());return Ve(W(ce(e,{minLength:6,maxLength:6,size:"max"}),t).map(r8,n8),W(ce(e,{minLength:5,maxLength:5,size:"max"}),t).map(i8,o8),W(ce(e,{minLength:0,maxLength:1,size:"max"}),ce(e,{minLength:4,maxLength:4,size:"max"}),t).map(ca,ua),W(ce(e,{minLength:0,maxLength:2,size:"max"}),ce(e,{minLength:3,maxLength:3,size:"max"}),t).map(ca,ua),W(ce(e,{minLength:0,maxLength:3,size:"max"}),ce(e,{minLength:2,maxLength:2,size:"max"}),t).map(ca,ua),W(ce(e,{minLength:0,maxLength:4,size:"max"}),e,t).map(s8,a8),W(ce(e,{minLength:0,maxLength:5,size:"max"}),t).map(Tv,Ov),W(ce(e,{minLength:0,maxLength:6,size:"max"}),e).map(Tv,Ov),W(ce(e,{minLength:0,maxLength:7,size:"max"})).map(l8,c8))}var h8=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)}},m8=Object.getOwnPropertyNames;function g8(){let e=new qt;return r=>{let n=st(e,r);return n!==void 0||(n=new h8(String(r)),wt(e,r,n)),n}}function x0(e){let t=g8(),r=e(t),n=m8(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 b8(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=>f4(r)).filter(r=>r.length>0)}var Mv=Object.assign,da=Object.create,k0=Object.defineProperty,Nv=Object.getPrototypeOf,w8=Object.prototype;function S8(e){return k0(da(null),vt,{configurable:!1,enumerable:!1,writable:!1,value:()=>e})}function Lv(e,t){return S8(`<${Je(e)}#${t}>`)}function v8(e,t){let r=da(w8);for(let n in e){let i=e[n],o=[];for(let s of i){let a=Mv(da(Nv(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])}k0(a,vt,{configurable:!1,enumerable:!1,writable:!1,value:()=>{let l=e[n][o],c=Mv(da(Nv(l)),l);for(let u in s){let d=s[u];c[u]=d.index===void 0?void 0:typeof d.index=="number"?Lv(d.type,d.index):G(d.index,p=>Lv(d.type,p))}return Ae(c)}})}}return r}function x8(e){let t=0,r=new qt;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=st(r,a.type);if(l===void 0&&(l=new qt,wt(r,a.type,l)),I4(l,a.forwardRelationship))throw new N(`Cannot declare multiple inverse relationships for the same forward relationship ${Je(a.forwardRelationship)} on type ${Je(a.type)}`);wt(l,a.forwardRelationship,{type:i,property:s}),t+=1}}let n=new qt;if(t===0)return n;for(let i in e){let o=e[i],s=st(r,i);if(s!==void 0)for(let a in o){let l=o[a];if(l.arity==="inverse")continue;let c=st(s,a);if(c!==void 0){if(c.type!==l.type)throw new N(`Inverse relationship ${Je(c.property)} on type ${Je(c.type)} references forward relationship ${Je(a)} but types do not match`);wt(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 $v=Object.create;function k8(e,t,r){switch(e){case"exclusive":return Ie(r);case"successor":return ya(oe({min:t!==void 0?t+1:0,max:r}));case"any":return ya(oe({min:0,max:r}))}}function C8(e,t,r,n,i,o,s){let a=k8(t,r,n);switch(e){case"0-1":return Yt(a,{nil:void 0,depthIdentifier:i}).generate(o,s).value;case"1":return a.generate(o,s).value;case"many":{let l=0,c=Yt(Hr(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 R8=class extends he{constructor(e,t){super(),this.relations=e,this.defaultEntities=t;let r=new Cn,n=new Cn;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(ga(r,a.type))throw new N(`Cannot mix exclusive with other strategies for type ${Je(a.type)}`);Fi(n,a.type)}else{if(ga(n,a.type))throw new N(`Cannot mix exclusive with other strategies for type ${Je(a.type)}`);Fi(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=x8(e)}createEmptyLinksInstanceFor(e){let t=$v(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=$v(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=jp();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=C8(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=st(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 B.nil()}};function E8(e,t){return new R8(e,t)}var I8=Object.keys,A8=Object.getOwnPropertySymbols,P8=Object.getOwnPropertyDescriptor;function T8(e){let t=I8(e),r=A8(e);for(let n=0;n!==r.length;++n){let i=r[n],o=P8(e,i);o&&o.enumerable&&t.push(i)}return t}var O8=Object.create,M8=Object.defineProperty,N8=Object.getOwnPropertyDescriptor,L8=Object.getOwnPropertyNames,$8=Object.getOwnPropertySymbols;function D8(e,t){return function(n){let i=n[1]?O8(null):{};for(let o=0;o!==e.length;++o){let s=n[0][o];s!==t&&M8(i,e[o],{value:s,configurable:!0,enumerable:!0,writable:!0})}return i}}function _8(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=N8(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=L8(n).length,c=$8(n).length;if(s!==l+c)throw new Error("Incompatible instance received: should not contain extra properties");return[a,i]}}var zd=Symbol("no-key");function Gd(e,t,r){let n=T8(e),i=[];for(let o=0;o!==n.length;++o){let s=n[o],a=e[s];t===void 0||zt(t,s)!==-1?L(i,a):L(i,Yt(a,{nil:zd}))}return W(W(...i),r?Ie(!1):zi()).map(D8(n,zd),_8(n,zd))}function Sp(e,t){let r=t!==void 0&&!!t.noNullPrototype;if(t===void 0||!("requiredKeys"in t&&t.requiredKeys!==void 0))return Gd(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 Gd(e,n,r)}var j8=Object.create;function F8(e,t,r,n){let i=j8(null);for(let o in e){let s=e[o],a=Sp(s,n),l=t(o),c=r(o),u={minLength:l,maxLength:l};i[o]=c!==void 0?Hr(a,{...u,selector:c}):ce(a,u)}return Sp(i)}var Dv=Object.create,V8=Object.keys;function B8(e,t,r={}){let n=V8(e),i=r.initialPoolConstraints||Dv(null),o=r.unicityConstraints||Dv(null),s={noNullPrototype:r.noNullPrototype};return b8(n,i).chain(a=>E8(t,a).chain(l=>F8(e,c=>l[c].length,c=>o[c],s).map(c=>v8(c,l))))}function U8(e){return fe(G(e,t=>t[t.length-1]===","?ve(t,0,t.length-1):t)," ")}function W8(e){return function(r){if(typeof r!="string")throw new Error("Unsupported type");let n=[];for(let i of Ze(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 H8(e){let t=fe(e," ");return t[t.length-1]===","&&(t=ve(t,0,t.length-1)),Pp(t[0])+ve(t,1)+"."}function z8(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]===","||Pp(np(r[0]))!==r[0])throw new Error("Unsupported value");let n=np(r[0])+ve(r,1,r.length-1),i=[],o=Ze(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 G8(e){return fe(e," ")}function q8(e){if(typeof e!="string")throw new Error("Unsupported type");let t=Ze(e,". ");for(let r=0;r<t.length-1;++r)t[r]+=".";return t}var b=(e,t)=>({arbitrary:Ie(e),weight:t});function K8(){return Ve(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 Y8(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=K8();return r==="sentences"?ce(ce(i,{minLength:1,size:"small"}).map(H8,z8(i)),{minLength:1,maxLength:t,size:n}).map(G8,q8):ce(i,{minLength:1,maxLength:t,size:n}).map(U8,W8(i))}function J8(e){return new Map(e)}function Z8(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 X8(e){return e[0]}function vp(e,t,r={}){return Hr(W(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:X8,depthIdentifier:r.depthIdentifier,comparator:"SameValueZero"}).map(J8,Z8)}var na=10;function Q8(e){let t={};return(r=>{let n=r!==void 0?r:na;if(!b1(t,n)){let i=na;na=n-1,t[n]=e(n),na=i}return t[n]})}function e7(e){let t=0;for(;e>O(0);)e&O(1)&&++t,e>>=O(1);return t}function t7(e,t){let r=(O(1)<<O(t))-O(1),n=e&r,i=e7(e-n),o=n;for(let s=O(1);s<=r&&i!==0;s<<=O(1))o&s||(o|=s,--i);return o}function ia(e,t){let r=[];for(let n=e.length-1;n!==-1;--n)t(e[n])!==e[n]&&L(r,n);return r}function r7(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 qd(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 n7=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=ia(n,this.toggleCase),o=Sr(O(0),(O(1)<<O(i.length))-O(1)).generate(e,void 0);return qd(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:r7(a,s,ia(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=ia(s,this.toggleCase),l=t7(i,a.length);return qd(s,l,a,this.toggleCase),new $(fe(s,""),this.buildContextFor(o,new $(l,void 0)))}).join(br(()=>{let o=[...n],s=ia(o,this.toggleCase);return Sr(O(0),(O(1)<<O(s.length))-O(1)).shrink(i,r.flagsContext).map(a=>{let l=Ue(o);return qd(l,a.value,s,this.toggleCase),new $(fe(l,""),this.buildContextFor(new $(n,r.rawStringContext),a))})}))}};function i7(e){let t=Pp(e);return t!==e?t:np(e)}function o7(e,t){return new n7(e,t&&t.toggleCase||i7,t&&t.untoggleAll)}function s7(e){return d1.from(e)}function a7(e){if(!(e instanceof d1))throw new Error("Unexpected type");return[...e]}function C0(e={}){return ce(g0(e),e).map(s7,a7)}function l7(e){return p1.from(e)}function c7(e){if(!(e instanceof p1))throw new Error("Unexpected type");return[...e]}function R0(e={}){return ce(va(e),e).map(l7,c7)}function Jt(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 E0(e={}){return Jt(e,-32768,32767,K$,oe)}function I0(e={}){return Jt(e,-2147483648,2147483647,Y$,oe)}function A0(e={}){return Jt(e,-128,127,q$,oe)}function P0(e={}){return Jt(e,0,65535,X$,oe)}function T0(e={}){return Jt(e,0,4294967295,Q$,oe)}function O0(e={}){return Jt(e,0,255,J$,oe)}function M0(e={}){return Jt(e,0,255,Z$,oe)}function u7(e){return e!==void 0}function _v(e){return e.hasToBeCloned?new $(e.value_,{generatorContext:e.context},()=>e.value):new $(e.value_,{generatorContext:e.context})}function jv(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 _v(this.generatorArbitrary.generate(e,t))}canShrinkWithoutContext(e){return this.shrinkerArbitrary.canShrinkWithoutContext(e)}shrink(e,t){return u7(t)?"generatorContext"in t?this.generatorArbitrary.shrink(e,t.generatorContext).map(_v):this.shrinkerArbitrary.shrink(e,t.shrinkerContext).map(jv):this.shrinkerArbitrary.shrink(e,void 0).map(jv)}};function xp(e,t,r){let n=oe({min:e,max:t});return t===r?n:new d7(n,oe({min:e,max:r}))}var p7=Math.min,kp=Math.max,Fv=c1.isArray,f7=Object.entries;function h7(e){let t=-1;for(let r=0;r!==e.length;++r)t=kp(t,e[r][0]);return t}function m7(e,t){let r=c1(e);for(let n=0;n!==t.length;++n){let i=t[n];i[0]<e&&(r[i[0]]=i[1])}return r}function N0(e,t={}){let{size:r,minNumElements:n=0,maxLength:i=Wr,maxNumElements:o=i,noTrailingHole:s,depthIdentifier:a}=t,l=Ui(r,Ui(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=p7(o,i),u=t.maxNumElements!==void 0||r!==void 0?r:"=",d=Hr(W(xp(0,kp(l-1,0),kp(i-1,0)),e),{size:u,minLength:n,maxLength:c,selector:p=>p[0],depthIdentifier:a}).map(p=>m7(h7(p)+1,p),p=>{if(!Fv(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(f7(p),h=>[Number(h[0]),h[1]])});return s||i===n?d:W(d,xp(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(!Fv(p))throw new Error("Not supported entry type");return[p,p.length]})}function g7(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 L0(e,t={}){return Hr(e,{minLength:t.minLength,maxLength:t.maxLength,size:t.size,depthIdentifier:t.depthIdentifier,comparator:"SameValueZero"}).map(g7,y7)}function b7(e,t,r,n,i,o){return Bp(e,t,{maxKeys:r,noNullPrototype:!o,size:n,depthIdentifier:i})}function w7(e){return Ve(A0(e),O0(e),M0(e),E0(e),P0(e),I0(e),T0(e),C0(e),R0(e))}function $0(e){let t=e.values,r=e.depthSize,n=jp(),i=e.maxDepth,o=e.maxKeys,s=e.size,a=Ve(...t,...e.withBigInt?[Sr()]:[],...e.withDate?[J1()]:[]);return x0(l=>({anything:Ve({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?[w7({maxLength:o,size:s})]:[],...e.withSparseArray?[N0(l("anything"),{maxNumElements:o,size:s,depthIdentifier:n})]:[]),keys:e.withObjectString?Ve({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:L0(l("anything"),{maxLength:o,size:s,depthIdentifier:n}),map:Ve(vp(l("keys"),l("anything"),{maxKeys:o,size:s,depthIdentifier:n}),vp(l("anything"),l("anything"),{maxKeys:o,size:s,depthIdentifier:n})),object:b7(l("keys"),l("anything"),o,s,n,e.withNullPrototype)})).anything}function S7(e){switch(typeof e){case"boolean":return new u1(e);case"number":return new Gt(e);case"string":return new Je(e);default:return e}}function v7(e){return typeof e!="object"||e===null||!("constructor"in e)?e:e.constructor===u1||e.constructor===Gt||e.constructor===Je?e.valueOf():e}function x7(e){return e.map(S7,v7)}function k7(e,t){return[zi(),w0(),va(),t(e),Ve(t(e),Ie(null),Ie(void 0))]}function C7(e){return e.map(t=>x7(t))}function R7(e,t){return t?C7(e).concat(e):e}function D0(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:R7(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 E7(e){return Bp(e.key,$0(e),{maxKeys:e.maxKeys,noNullPrototype:!e.withNullPrototype,size:e.size})}function I7(e){return E7(D0(e))}function A7(e,t){let{depthSize:r,maxDepth:n}=t;return{key:e,values:[zi(),va({noDefaultInfinity:!0,noNaN:!0}),e,Ie(null)],depthSize:r,maxDepth:n}}function _0(e){return $0(D0(e))}function j0(e={}){let t=e.noUnicodeString===void 0||e.noUnicodeString===!0;return _0(A7("stringUnit"in e?Le({unit:e.stringUnit}):t?Le():Le({unit:"binary"}),e))}var P7=JSON.stringify,T7=JSON.parse;function O7(e){if(typeof e!="string")throw new N("Cannot unmap the passed value");return T7(e)}function M7(e={}){return j0(e).map(P7,O7)}var N7=Object.defineProperties;function Kd(e,t){return`Stream(${t!==void 0?`${fe(t,",")}\u2026`:`${e} emitted`})`}var L7=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 N7(new B(s(this.arb,e.clone())),{toString:{value:()=>Kd(o,i!==null?i.map(Ae):void 0)},[vt]:{value:()=>Kd(o,i!==null?i.map(Ae):void 0)},[Kt]:{value:async()=>Kd(o,i!==null?await Promise.all(i.map(Lp)):void 0)},[Be]:{value:n,enumerable:!0}})};return new $(n(),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return B.nil()}};function $7(e,t){return new L7(e,t!==void 0&&typeof t=="object"&&"noHistory"in t?!t.noHistory:!0)}function D7(e){return fe(e,"")}function Vv(e){if(typeof e!="string")throw new Error("Cannot unmap the passed value");return[...e]}function _7(e){switch(e.length%4){case 0:return e;case 3:return`${e}=`;case 2:return`${e}==`;default:return ve(e,1)}}function j7(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 ve(e,0,t)}var Yd=String.fromCharCode;function F7(e){return e<26?Yd(e+65):e<52?Yd(e+97-26):e<62?Yd(e+48-52):e===62?"+":"/"}function V7(e){if(typeof e!="string"||e.length!==1)throw new N("Invalid entry");let t=Rn(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 B7(){return oe({min:0,max:63}).map(F7,V7)}function U7(e={}){let{minLength:t=0,maxLength:r=Wr,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=B7();return ce(a,{minLength:i,maxLength:o,size:s,experimentalCustomSlices:k_(a,Vv)}).map(D7,Vv).map(_7,j7)}var Bv=Object.is;function W7(e,t){let r=new qt,n=0;for(let i of e)Bv(i,-0)?++n:wt(r,i,(st(r,i)||0)+1);for(let i=0;i!==t.length;++i){if(!(i in t))return!1;let o=t[i];if(Bv(o,-0)){if(n===0)return!1;--n}else{let s=st(r,o)||0;if(s===0)return!1;wt(r,o,s-1)}}return!0}var H7=Math.floor,Uv=Math.log,z7=Array.isArray,F0=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 In(r,n),this.biasedLengthArb=r!==n?new In(r,r+H7(Uv(n-r)/Uv(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]),m1(i,a,1)}return this.isOrdered&&g1(o,(s,a)=>s-a),new $(G(o,s=>this.originalArray[s]),r.context)}canShrinkWithoutContext(e){return!z7(e)||!this.lengthArb.canShrinkWithoutContext(e.length)?!1:W7(this.originalArray,e)}shrink(e,t){return e.length===0?B.nil():this.lengthArb.shrink(e.length,t).map(r=>new $(Ue(e,e.length-r.value),r.context)).join(e.length>this.minLength?br(()=>this.shrink(Ue(e,1),void 0).filter(r=>this.minLength<=r.value.length+1).map(r=>new $([e[0],...r.value],void 0))):B.nil())}};function G7(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new F0(e,!0,r,n)}function q7(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new F0(e,!1,r,n)}var K7={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"},Y7={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 J7(e){return e<10?Je(e):K7[e]}function Wv(e,t){let r="";for(;e.length+r.length<t;)r+="0";return r+e}function Hv(e){let t="";for(let r=e;r!==0;){let n=r>>5;t=J7(r-(n<<5))+t,r=n}return t}function Z7(e,t){let r=~~(e/1073741824),n=e&1073741823;return Wv(Hv(r),t-6)+Wv(Hv(n),6)}function V0(e){return function(r){return Z7(r,e)}}function Jd(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=Y7[e[n]];if(i===void 0)throw new N("Unsupported type");t+=i*r,r*=32}return t}var X7=V0(10),zv=V0(8);function Q7(e){return X7(e[0])+zv(e[1])+zv(e[2])}function e9(e){if(typeof e!="string"||e.length!==26)throw new Error("Unsupported type");return[Jd(e.slice(0,10)),Jd(e.slice(10,18)),Jd(e.slice(18))]}function t9(){return W(oe({min:0,max:0xffffffffffff}),oe({min:0,max:0xffffffffff}),oe({min:0,max:0xffffffffff})).map(Q7,e9)}function B0(e){return V4(Vi(e,16),8,"0")}function r9(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!==B0(t))throw new Error("Unsupported value: invalid content");return t}function Zd(e,t){return oe({min:e,max:t}).map(B0,r9)}function n9(e){return`${e[0]}-${ve(e[1],4)}-${ve(e[1],0,4)}-${ve(e[2],0,4)}-${ve(e[2],4)}${e[3]}`}var i9=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/;function o9(e){if(typeof e!="string")throw new Error("Unsupported type");let t=i9.exec(e);if(t===null)throw new Error("Unsupported type");return[t[1],t[3]+t[2],t[4]+ve(t[5],0,4),ve(t[5],4)]}var Gv="0123456789abcdef";function s9(e){let t={},r={};for(let o=0;o!==e.length;++o){let s=Gv[o],a=Gv[e[o]];t[s]=a,r[a]=s}function n(o){return t[o[0]]+ve(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+ve(o,1)}return{versionsApplierMapper:n,versionsApplierUnmapper:i}}function a9(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 l9(e={}){let t=Zd(0,4294967295),r=e.version!==void 0?typeof e.version=="number"?[e.version]:e.version:[1,2,3,4,5,6,7,8];a9(r);let{versionsApplierMapper:n,versionsApplierUnmapper:i}=s9(r);return W(t,Zd(0,268435456*r.length-1).map(n,i),Zd(2147483648,3221225471),t).map(n9,o9)}function c9(e){return Le({unit:Hp("-._~!$&'()*+,;=:"),size:e})}function u9([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 p9(e){return`[${e}]`}function f9(e){if(typeof e!="string"||e[0]!=="["||e[e.length-1]!=="]")throw new Error("Unsupported");return e.substring(1,e.length-1)}function U0(e){let t=e||{},r=t.size,n=[zp({size:r}),...t.withIPv4===!0?[Yp()]:[],...t.withIPv6===!0?[v0().map(p9,f9)]:[],...t.withIPv4Extended===!0?[S0()]:[]];return W(t.withUserInfo===!0?Yt(c9(r)):Ie(null),Ve(...n),t.withPort===!0?Yt(yr(65535)):Ie(null)).map(u9,d9)}function W0(e){return Le({unit:Hp("-._~!$&'()*+,;=:@/?"),size:e})}function H0(e={}){return W0(e.size)}function z0(e={}){return Le({unit:Hp("-._~!$&'()*+,;=:@"),size:e.size})}function h9(e){return fe(G(e,t=>`/${t}`),"")}function m9(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 m1(Ze(e,"/"),1)}function g9(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 Xd(e,t){return ce(z0({size:e}),{size:t}).map(h9,m9)}function y9(e){let[t,r]=g9(e);return t===r?Xd(t,r):Ve(Xd(t,r),Xd(r,t))}function G0(e){return y9(Vp((e||{}).size))}function q0(e={}){return W0(e.size)}function b9(e){let[t,r,n]=e;return`${t}://${r}${n}${e[3]===null?"":`?${e[3]}`}${e[4]===null?"":`#${e[4]}`}`}var w9=/^([[A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)([^?#]*)(\?[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?(#[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?$/;function S9(e){if(typeof e!="string")throw new Error("Incompatible value received: type");let t=w9.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 v9(e){let t=e||{},r=Vp(t.size),n=t.authoritySettings!==void 0&&t.authoritySettings.size!==void 0?Hi(t.authoritySettings.size,r):r,i={...t.authoritySettings,size:n};return W(Tt(...t.validSchemes||["http","https"]),U0(i),G0({size:r}),t.withQueryParameters===!0?Yt(q0({size:r})):Ie(null),t.withFragments===!0?Yt(H0({size:r})):Ie(null)).map(b9,S9)}var x9=class K0{constructor(t,r){this.commands=t,this.metadataForReplay=r,this[Be]=function(){return new K0(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 Cp{constructor(t){if(this.cmd=t,this.hasRan=!1,Mp(t)){let r=t[vt];this[vt]=function(){return r.call(t)}}if(Np(t)){let r=t[Kt];this[Kt]=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 Ur(this.cmd)?new Cp(this.cmd[Be]()):new Cp(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)}},C9=class extends he{constructor(e,t,r,n,i){super(),this.sourceReplayPath=n,this.disableReplayLog=i,this.oneCommandArb=Ve(...e).map(o=>new k9(o)),this.lengthArb=xp(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 x9(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 B.nil();let r=t,n=r.shrunkOnce,i=r.items,o=this.filterForShrinkImpl(i);if(o.length===0)return B.nil();let s=n?B.nil():new B([[]][Symbol.iterator]()),a=[];for(let l=0;l!==o.length;++l)a.push(br(()=>{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(br(()=>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 R9(e,t={}){let{size:r,maxCommands:n=Wr,disableReplayLog:i=!1,replayPath:o=null}=t;return new C9(e,Ui(r,0,n,t.maxCommands!==void 0),n,o,i)}var E9=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}},I9=function*(e,t){for(let r of t)yield new E9(e,r)},Y0=(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}),A9=(e,t)=>Y0({then:o=>{o(e())}},t,void 0,(o,s,a)=>{o.check(s)&&o.run(s,a)},(o,s)=>s()),P9=e=>typeof e.then=="function",J0=async(e,t,r=Promise.resolve())=>await Y0({then:s=>{let a=e();return P9(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 T9(e,t){A9(e,t)}async function O9(e,t){await J0(e,t)}async function M9(e,t,r){let n=J0(t,I9(e,r),e.schedule(Promise.resolve(),"startModel"));await e.waitFor(n),await e.waitAll()}var oa=e=>e(),Z0=class Rp{constructor(t,r){this.act=t,this.taskSelector=r,this.lastTaskId=0,this.sourceTaskSelector=r.clone(),this.scheduledTasks=[],this.triggeredTasks=[],this.scheduledWatchers=[],this[Be]=function(){return new Rp(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 ${Dj(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||oa)}scheduleFunction(t,r){return(...n)=>this.scheduleInternal("function",`${t.name}(${n.map(Ae).join(",")})`,t(...n),void 0,r||oa)}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||oa,()=>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||oa;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(Rp.buildLog).map(t=>`-> ${t}`).join(`
208
+ `)+"`"}};function X0(e){let t=0;return{clone:()=>X0(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 Kv(e,t){return new Z0(e,X0(t))}function Q0(e){let t=e.clone();return{clone:()=>Q0(t),nextTaskIndex:r=>e.nextInt(0,r.length-1)}}var N9=class extends he{constructor(e){super(),this.act=e}generate(e,t){return new $(new Z0(this.act,Q0(e.clone())),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return B.nil()}};function L9(e){let{act:t=r=>r()}=e||{};return new N9(t)}function $9(e,t){let{act:r=n=>n()}=Array.isArray(e)?t||{}:e||{};return Array.isArray(e)?Kv(r,e):function(n,...i){return Kv(r,i)}}function D9(e={}){return Jt(e,O("-9223372036854775808"),O("9223372036854775807"),z$,Sr)}function _9(e={}){return Jt(e,O(0),O("18446744073709551615"),G$,Sr)}function j9(e,t){return t}var Qd=Math.floor,F9=Math.min;function ut(e,t){switch(e.type){case"Char":return{astNode:e,minLength:1};case"Repetition":switch(e.quantifier.kind){case"*":{let r=ut(e.expression,t);return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:t},expression:r.astNode},minLength:0}}case"+":{let r=ut(e.expression,t),n=r.minLength>1?r.minLength:1;return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:1,to:Qd(t/n)},expression:r.astNode},minLength:r.minLength}}case"?":{let r=ut(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?Qd(t/e.quantifier.from):t,n=ut(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:Qd(t/i)},expression:n.astNode},minLength:e.quantifier.from*n.minLength}:{astNode:{...e,expression:n.astNode},minLength:e.quantifier.from*n.minLength}}default:return j9(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=ut(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?ut(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=ut(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=ut(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=ut(e.left,t),o=i.minLength>t?null:i.astNode;return{astNode:{...e,left:o,right:null},minLength:0}}let r=ut(e.left,t),n=ut(e.right,t);return r.minLength>t?n:n.minLength>t?r:{astNode:{...e,left:r.astNode,right:n.astNode},minLength:F9(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 V9(e,t){return ut(e,t).astNode}function B9(e){return new Error(`Unsupported AST node! Received: ${Ae(e)}`)}function pa(e,t,r){if(!t&&!r)return e;let n={hasStart:!1,hasEnd:!1},i=ex(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 ex(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)=>pa(i,t&&o===0,r&&o===e.expressions.length-1))};case"CharacterClass":return e;case"ClassRange":return e;case"Group":return{...e,expression:ex(e.expression,t,r,n)};case"Disjunction":return n.hasStart=!0,n.hasEnd=!0,{...e,left:e.left!==null?pa(e.left,t,r):null,right:e.right!==null?pa(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 B9(e)}}function U9(e){return pa(e,!0,!0)}function Yv(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 Ep(e){return e>="0"&&e<="9"}function tx(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 W9(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=tx(e,n):i==="("&&(r+=1)}throw new Error("Missing closing ')'")}function H9(e,t){let r=!1;for(let n=t;n!==e.length;++n){let i=e[n];if(!Ep(i)){if(t===n)return-1;if(i===","){if(r)return-1;r=!0}else return i==="}"?n:-1}}return-1}function z9(e,t,r,n){switch(e[t]){case"[":return n===1?t+1:tx(e,t+1)+1;case"{":{if(n===1)return t+1;let i=H9(e,t+1);return i===-1?t+1:i+1}case"(":return n===1?t+1:W9(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(Ep(i)){let o=r?e.length:Math.min(t+4,e.length),s=t+2;for(;s<o&&Ep(e[s]);++s);return s}return t+(r?Yv(e,t+1):1)+1}}default:return t+(r?Yv(e,t):1)}}function sa(e,t,r,n){let i=z9(e,t,r,n);return e.substring(t,i)}var Jv={gc:"General_Category",sc:"Script",scx:"Script_Extensions"},xa={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"},Wi=Qp(xa),Xp={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"},Ip=Qp(Xp),rx={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"},Zv=Qp(rx);function Qp(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 G9(e){return e in Xp||e in Ip}function q9(e){return e in xa||e in Wi}function Xv(e){if(e in Jv)return Jv[e];if(e in Wi)return Wi[e];if(e in xa||e==="General_Category"||e==="Script"||e==="Script_Extensions")return e;throw new Error(`Unknown Unicode property name: ${e}`)}function Qv(e){if(e in Ip)return Ip[e];if(e in Zv)return Zv[e];if(e in Wi)return Wi[e];if(e in Xp||e in rx||e in xa)return e;throw new Error(`Unknown Unicode property value: ${e}`)}function K9(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:Xv(n),canonicalValue:Qv(i)}}if(G9(e))return{type:"UnicodeProperty",name:"General_Category",value:e,negative:t,shorthand:!0,binary:!1,canonicalName:"General_Category",canonicalValue:Qv(e)};if(q9(e)){let n=Xv(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 ep=String.fromCodePoint;function tp(e){let t=e.pop();if(t===void 0)throw new Error("Unable to extract token preceeding the currently parsed one");return t}function nx(e){return e>="0"&&e<="9"}function fa(e,t){return{type:"Char",kind:"simple",symbol:e,value:e,codePoint:e.codePointAt(0)||-1,escaped:t}}function vn(e,t){return{type:"Char",kind:"meta",symbol:t,value:e,codePoint:t.codePointAt(0)||-1}}function mr(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 rp(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:ep(n),value:e,codePoint:n}}case"u":{if(e==="\\u")return fa("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:ep(n),value:e,codePoint:n}}case"0":return vn(e,"\0");case"n":return vn(e,`
209
+ `);case"f":return vn(e,"\f");case"r":return vn(e,"\r");case"t":return vn(e," ");case"v":return vn(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(nx(t)){let r=e.substring(1),n=Number(r);return{type:"Char",kind:"decimal",symbol:ep(n),value:e,codePoint:n}}if(e.length>2&&(t==="p"||t==="P")){let r=t==="P";return K9(e.substring(3,e.length-1),r)}return fa(e.substring(1),!0)}}return fa(e)}function xn(e,t,r,n){let i=null;for(let o=0,s=sa(t,o,r,0);o!==t.length;o+=s.length,s=sa(t,o,r,0)){let a=s[0];switch(a){case"|":i===null&&(i=[]),i.push(mr(e.splice(0),!0)||null);break;case".":e.push({type:"Char",kind:"meta",symbol:s,value:s,codePoint:NaN});break;case"*":case"+":{let l=tp(e);e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:a,greedy:!0}});break}case"?":{let l=tp(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(fa(s));break}let l=tp(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=sa(l,p,r,1);p!==l.length;p+=h.length,h=sa(l,p,r,1)){if(p===0&&h==="^"){u=!0;continue}let f=rp(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]===":")xn(c,l.substring(2),r,n),e.push({type:"Group",capturing:!1,expression:mr(c)});else if(l[1]==="="||l[1]==="!")xn(c,l.substring(2),r,n),e.push({type:"Assertion",kind:"Lookahead",negative:l[1]==="!"?!0:void 0,assertion:mr(c)});else if(l[1]==="<"&&(l[2]==="="||l[2]==="!"))xn(c,l.substring(3),r,n),e.push({type:"Assertion",kind:"Lookbehind",negative:l[2]==="!"?!0:void 0,assertion:mr(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),xn(c,u.slice(1).join(">"),r,n),e.push({type:"Group",capturing:!0,nameRaw:p,name:p,number:d,expression:mr(c)})}else{let u=++n.lastIndex;xn(c,l,r,n),e.push({type:"Group",capturing:!0,number:u,expression:mr(c)})}break}default:if(s==="^")e.push({type:"Assertion",kind:s});else if(s==="$")e.push({type:"Assertion",kind:s});else if(s[0]==="\\"&&nx(s[1])){let l=Number(s.substring(1));r||l<=n.lastIndex?e.push({type:"Backreference",kind:"number",number:l,reference:l}):e.push(rp(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(rp(s));break}}if(i!==null){i.push(mr(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 Y9(e){let t=zt([...e.flags],"u")!==-1,r=e.source,n=[];return xn(n,r,t,{lastIndex:0,named:new Map}),mr(n)}var J9=String.fromCodePoint;function Z9(e){return e.binary||e.shorthand?e.canonicalValue:`${e.canonicalName}=${e.canonicalValue}`}function e1(e,t,r,n){let i=-1;for(let o=t;o<=r;++o)if(e.test(J9(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 X9(e,t){let r=new RegExp(`^\\${t?"P":"p"}{${e}}$`,"u"),n=[];return e1(r,0,55295,n),e1(r,57344,1114111,n),n}var t1=new Map;function Q9(e,t){let r=`${t?"P":"p"}:${e}`,n=t1.get(r);if(n!==void 0)return n;let i=X9(e,t);return t1.set(r,i),i}function e5(e){return An(...G(Q9(Z9(e),e.negative),t=>cp(t)))}var t5=String.fromCodePoint,r1=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],n1=[..."0123456789"],i1=[...` \r
210
+ \v\f`],Ap=[...`\r
211
+ `],ix=[...""],r5=[...Ap,...ix],Br=()=>Le({unit:"grapheme-ascii",minLength:1,maxLength:1});function o1(e){return new N(`Unsupported AST node! Received: ${Ae(e)}`)}function gr(e,t,r){switch(e.type){case"Char":if(e.kind==="meta")switch(e.value){case"\\w":return Tt(...r1);case"\\W":return Br().filter(n=>zt(r1,n)===-1);case"\\d":return Tt(...n1);case"\\D":return Br().filter(n=>zt(n1,n)===-1);case"\\s":return Tt(...i1);case"\\S":return Br().filter(n=>zt(i1,n)===-1);case"\\b":case"\\B":throw new N(`Meta character ${e.value} not implemented yet!`);case".":{let n=r.dotAll?ix:r5;return Br().filter(i=>zt(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=gr(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 o1(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=>gr(n,t,r))).map(n=>fe(n,""));case"CharacterClass":if(e.negative){let n=G(e.expressions,i=>gr(i,t,r));return Br().filter(i=>y1(n,o=>!o.canShrinkWithoutContext(i)))}return Ve(...G(e.expressions,n=>gr(n,t,r)));case"ClassRange":{let n=e.from.codePoint,i=e.to.codePoint;return oe({min:n,max:i}).map(o=>t5(o),o=>{if(typeof o!="string")throw new N("Invalid type");if([...o].length!==1)throw new N("Invalid length");return Rn(o,0)})}case"Group":return gr(e.expression,t,r);case"Disjunction":return Ve(e.left!==null?gr(e.left,t,r):Ie(""),e.right!==null?gr(e.right,t,r):Ie(""));case"Assertion":if(e.kind==="^"||e.kind==="$")return r.multiline?e.kind==="^"?Ve(Ie(""),W(Le({unit:Br()}),Tt(...Ap)).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new N("Invalid type");return[ve(n,0,n.length-1),n[n.length-1]]})):Ve(Ie(""),W(Tt(...Ap),Le({unit:Br()})).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new N("Invalid type");return[n[0],ve(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 e5(e);default:throw o1(e)}}function n5(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=U9(Y9(e));r!==void 0&&(o=V9(o,r));let s=gr(o,n,i);return r!==void 0?s.filter(a=>[...a].length<=r):s}function i5(e){let t=[];for(let r=0;r!==e.length;++r)t.push(e[r].next());return t}function o5(e,t){for(let r=0;r!==e.length;++r)t[r]=e[r].next()}function s5(e){for(let t=0;t!==e.length;++t)if(e[t].done)return!0;return!1}function*a5(...e){let t=i5(e);for(;!s5(t);)yield t.map(r=>r.value),o5(e,t)}function*l5(e){let t=e;for(;;)yield t,++t}var c5=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?B.nil():new B(a5(this.arb.shrink(e,t),l5(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 u5(e,t){return new c5(e,t)}var d5=Gw({Arbitrary:()=>he,ExecutionStatus:()=>R3,PreconditionFailure:()=>vr,Random:()=>$p,Stream:()=>B,Value:()=>$,VerbosityLevel:()=>n3,__commitHash:()=>h5,__type:()=>p5,__version:()=>f5,anything:()=>_0,array:()=>ce,assert:()=>q3,asyncDefaultReportMessage:()=>D1,asyncModelRun:()=>O9,asyncProperty:()=>t3,asyncStringify:()=>Lp,asyncToStringMethod:()=>Kt,base64String:()=>U7,bigInt:()=>Sr,bigInt64Array:()=>D9,bigUint64Array:()=>_9,boolean:()=>zi,chainUntil:()=>_D,check:()=>j1,clone:()=>UD,cloneIfNeeded:()=>kn,cloneMethod:()=>Be,commands:()=>R9,compareBooleanFunc:()=>Bj,compareFunc:()=>Wj,configureGlobal:()=>X4,constant:()=>Ie,constantFrom:()=>Tt,context:()=>OD,createDepthIdentifier:()=>jp,date:()=>J1,defaultReportMessage:()=>$1,dictionary:()=>Bp,domain:()=>zp,double:()=>va,emailAddress:()=>tj,entityGraph:()=>B8,falsy:()=>PD,float:()=>g0,float32Array:()=>C0,float64Array:()=>R0,func:()=>Gj,gen:()=>rD,getDepthContextFor:()=>_p,hasAsyncToStringMethod:()=>Np,hasCloneMethod:()=>Ur,hasToStringMethod:()=>Mp,hash:()=>ba,infiniteStream:()=>$7,int16Array:()=>E0,int32Array:()=>I0,int8Array:()=>A0,integer:()=>oe,ipV4:()=>Yp,ipV4Extended:()=>S0,ipV6:()=>v0,json:()=>M7,jsonValue:()=>j0,letrec:()=>x0,limitShrink:()=>u5,lorem:()=>Y8,map:()=>vp,mapToConstant:()=>An,maxSafeInteger:()=>w0,maxSafeNat:()=>Jj,memo:()=>Q8,mixedCase:()=>o7,modelRun:()=>T9,nat:()=>yr,noBias:()=>ya,noShrink:()=>wa,object:()=>I7,oneof:()=>Ve,option:()=>Yt,pre:()=>A$,property:()=>r3,readConfigureGlobal:()=>St,record:()=>Sp,resetConfigureGlobal:()=>Q4,sample:()=>Y3,scheduledModelRun:()=>M9,scheduler:()=>L9,schedulerFor:()=>$9,set:()=>L0,shuffledSubarray:()=>q7,sparseArray:()=>N0,statistics:()=>Z3,stream:()=>wr,string:()=>Le,stringMatching:()=>n5,stringify:()=>Ae,subarray:()=>G7,toStringMethod:()=>vt,tuple:()=>W,uint16Array:()=>P0,uint32Array:()=>T0,uint8Array:()=>O0,uint8ClampedArray:()=>M0,ulid:()=>t9,uniqueArray:()=>Hr,uuid:()=>l9,webAuthority:()=>U0,webFragments:()=>H0,webPath:()=>G0,webQueryParameters:()=>q0,webSegment:()=>z0,webUrl:()=>v9}),p5="module",f5="4.8.0",h5="c0da76fbcf6470339ad7bb2f0dfcebee06ede56c",He=d5;function ox(e){return e?.values!=null&&e.values.length>0?He.constantFrom(...e.values):m5(e)}function m5(e){if(e?.type==="number")return He.integer();if(e?.type==="boolean")return He.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 He.string({maxLength:r?.maxLength,minLength:r?.minLength??1}).filter(n=>n.trim().length>0&&n===n.trim())}var g5="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],Pn=e=>He.array(He.constantFrom(...g5),{maxLength:e,minLength:1}).map(t=>t.join("")),ef=(e,t)=>He.array(Pn(10),{maxLength:t,minLength:1}).map(r=>r.join(e)),y5={"company.name":ef(" ",3),"date.iso":b5(),"internet.email":w5(),"internet.url":S5(),"lorem.slug":ef("-",3),"lorem.word":Pn(10),"person.fullName":ef(" ",2)};function b5(){return He.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 w5(){return He.tuple(Pn(12),Pn(10),He.constantFrom("com","dev","io","org","ai")).map(([e,t,r])=>`${e}@${t}.${r}`)}function S5(){return He.tuple(He.constantFrom("http","https"),Pn(12),He.constantFrom("app","com","dev","io","org"),He.array(Pn(8),{maxLength:3})).map(([e,t,r,n])=>{let i=n.length===0?"":`/${n.join("/")}`;return`${e}://${t}.${r}${i}`})}var sx=new WeakMap;function tf(e){let t=sx.get(e);if(t!=null)return t;let r=Object.fromEntries(Object.entries(e.paramSpaces).map(([n,i])=>[n,k5(i)]));return sx.set(e,r),r}var x5=24301;function k5(e){let[t]=He.sample(ox(e),{numRuns:1,seed:x5});if(t==null)throw new Error("arbitrary produced no sample");return t}function Gi(e){return{aborted:!0,findings:[],fired:[],teardown:e}}function nf(e,t){return new C5(R5(e,t))}async function R5({browser:e,hub:t,request:r},n){if(n.aborted)return rf(Gi("skipped"));let i=O5({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),o=async s=>{try{return rf(await I5({browser:e,established:s,hub:t,request:r,signal:n}))}catch(a){return ax(Kn(a))}};return T5(i,r).match(o,s=>E5(s,i.teardown))}async function E5(e,t){return e.kind!=="aborted"?ax(e):rf(Gi(await lx(t)))}function lx(e){return e().match(()=>"done",()=>"failed")}async function I5(e){let t=await A5(e);if(t.kind==="completed")return await e.established.teardown().match(Ao,cm),{aborted:!1,...t.result};let r=await lx(e.established.teardown);if(t.kind==="aborted")return Gi(r);throw t.error}async function A5({browser:e,established:t,hub:r,request:n,signal:i}){try{cr(i);let{close:o,driver:s,emitAssertion:a}=await Uc({baseUrl:n.options.baseUrl,browser:e,capture:{hub:r,runId:n.runId},clientState:t.clientState,engine:jc(N5(n.lockfile)),reader:t.reader,session:t.auth});try{return{kind:"completed",result:await Nc({canon:Xl(n.lockfile),classify:Zl(n.lockfile),driver:s,initialState:{snapshot:t.snapshot},onAssertion:a,onEvent:n.onEvent??Ao,sequence:P5(n.lockfile,n.testName,n.params),...Ni(n.lockfile)},i)}}finally{await o()}}catch(o){return gm(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function P5(e,t,r){return Do(e,t).map(n=>({params:{...tf(n),...r},transition:n}))}function T5(e,t){return hc(t.lockfile,t.testName,{generate:_c(Dc(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 O5({lockfile:e,options:t,runId:r,signal:n}){let i=Gc({baseUrl:t.engineUrl,runId:r,secret:t.secret},n);return{materialize:mc(i.setupWorld),reader:zc(e.entities,M5(e),i.query),teardown:i.teardown}}function M5(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function N5(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}function of({debugDir:e,headed:t,writeOtlpPortFile:r}){let n=Rg({headed:t}),i,o,s=async()=>(i??=Ed({debugDir:e,writeOtlpPortFile:r}),o=await i,o),a=async(c,u)=>{if(u.aborted)return $5(Gi("skipped"));try{let d=await s();return c.options.headed&&!t?await Wc(!0,async p=>nf({browser:p,hub:d,request:c},u)):await nf({browser:await n.acquire(),hub:d,request:c},u)}catch(d){return L5(Kn(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 D5(a(c,u))}}function xr(e){let t=en(e),r=Ni(e);return[...kc(t,r.invariants).map(n=>({gap:n,kind:"cascade-gap"})),...xc(r.laws).map(n=>({conflict:n,kind:"law-conflict"}))]}function cx(e){return`${_.good("OK")} \u2014 no static model violations (${String(e)} tests)`}function kr(e){return[`${_.bad("FAIL")} \u2014 ${String(e.length)} static model violation(s):`,...e.map(t=>Zc(t))].join(`
212
+
213
+ `)}function ka(e){return[`${_.warn("WARN")} \u2014 ${String(e.length)} model coverage gap(s) (not blocking):`,...e.map(t=>` ${_5(t)}`),`Coverage gaps mean the model can't catch regressions there. Stub the missing flows. ${V("explore")}`].join(`
214
+ `)}function _5(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 j5}from"gql.tada";var F5=j5(`
215
+ query DoctorAuthViewer {
216
+ currentUser {
217
+ name
218
+ email
433
219
  }
434
220
  }
435
- `);function de(){try{return W(process.cwd())}catch(e){let r=e instanceof Error?e.message:String(e);process.stderr.write(`${r}
436
- `),process.stderr.write(`${w("setup")}
437
- `),process.exit(1)}}async function he(e){(await h({config:e,document:Uy,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession==null&&(process.stderr.write("No active dev session. Start `npx ripplo watch` 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(`${w("setup")}
438
- `),process.exit(1))}async function ks({id:e,runs:r}){let t=de();await he(t),process.stdout.write(`flake-detect "${e}" x${String(r)}...
439
- `);let n=await ye(t.cwd,t),o=await Promise.allSettled(Array.from({length:r},()=>ct({config:t,ids:[e],presynced:n}))),i=0,s=0,a=new Map;o.forEach(c=>{if(c.status==="rejected"){s++;let m=c.reason instanceof Error?c.reason.message:"unknown error";a.set(m,(a.get(m)??0)+1);return}let u=c.value.results[0];if(u==null){s++;return}if(u.summary.includes("FAILED")||u.summary.includes("ERROR")){s++;let m=u.summary.split(`
440
- `).find(y=>y.includes("FAILED")||y.includes("ERROR"))??"unknown failure";a.set(m,(a.get(m)??0)+1)}else i++});let l=r>0?s/r*100:0;process.stdout.write(`${String(i)} passed / ${String(s)} failed (${l.toFixed(1)}% flake)
441
- `),a.size>0&&a.forEach((c,u)=>{process.stdout.write(` ${String(c)}x: ${u}
442
- `)}),s>0&&process.stderr.write(`${w("flake-detect","parallel safety + race conditions")}
443
- `),process.exit(s>0?1:0)}import ut from"fs";import{graphql as Fy}from"gql.tada";import Vy from"fs";function Ce(e){return fr(e,"hooks-paused")}function F(e){return Vy.existsSync(Ce(e))||st(e)?!1:Ye(e)}var My=Fy(`
221
+ `),V5="Failed to connect to Ripplo server";async function ux({serverUrl:e,token:t}){try{let r=await D({config:ir({serverUrl:e,token:t}),document:F5,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(V5)?{kind:"unreachable"}:{kind:"invalid"}}}function px(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 fx(e){let t=await U5(e),r={missing:kl(e),type:"env-files"},n=await W5(),i=H5(),o=await be(e),s=z5(o),a=G5(o),l=await q5(e,o),c=Y5(e),u=await J5(t,o);return[t,r,n,...u,s,a,l,c,i]}async function U5(e){let t=await Gh(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 W5(){let e=lt();if(e==null||e.length===0)return{email:void 0,status:"missing",type:"token"};let t=await ux({serverUrl:nt(),token:e});return t.kind==="valid"?{email:t.email,status:"valid",type:"token"}:{email:void 0,status:t.kind,type:"token"}}function H5(){let e=B5.executablePath();return{installed:Ca.existsSync(e),type:"browser"}}function z5(e){if(e.isErr())return{errorCount:1,errors:[{message:Oe(e.error),path:".ripplo/"}],found:!1,type:"preconditions-validation",valid:!1};let t=xr(e.value);return{errorCount:t.length,errors:t.length===0?[]:[{message:kr(t),path:""}],found:!0,type:"preconditions-validation",valid:t.length===0}}function G5(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 q5(e,t){if(t.isErr())return{status:"missing",type:"lockfile"};let r=$t(pt,t.value),n=await Ca.promises.readFile(dx.join(e,Qe),"utf8").catch(()=>null);return{status:K5(n,r),type:"lockfile"}}function K5(e,t){return e==null?"missing":e===t?"match":"stale"}function Y5(e){let t=dx.join(e,".git","hooks","pre-commit");return Ca.existsSync(t)?{installed:Ca.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function J5(e,t){if(!e.valid||t.isErr())return[];let r=Kr().map(a=>({appUrl:a.appUrl,engineUrl:a.engineUrl,webhookSecret:a.webhookSecret})).unwrapOr(void 0);if(r==null)return[];let n=[],i=await Kl(r.appUrl)==null;n.push({appUrl:r.appUrl,reachable:i,type:"dev-server"});let o=await Hh(process.cwd());n.push(o);let s=await Z5(r,t);return n.push(...s),n}async function Z5(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=Q5(e.appUrl,e.engineUrl);if(o==null)return[i];let s=await Kl(o)==null,a=[];if(a.push({configured:!0,count:r,endpointReachable:s,type:"preconditions"}),hx(e.engineUrl)&&a.push({reachable:s,type:"engine-endpoint",url:o}),!s)return a;let l=await qh({appUrl:e.appUrl,engineUrl:e.engineUrl});a.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await X5({engineUrl:o,webhookSecret:e.webhookSecret});return a.push({status:c,type:"adapter-enabled",url:o}),a}async function X5({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",...gl({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 hx(e){return e.startsWith("http://")||e.startsWith("https://")}function Q5(e,t){return hx(t)?t:`${e}${t}`}async function mx(){let e=process.cwd(),t=await fx(e),r=t.map(i=>zh(i));process.stdout.write(r.join(`
222
+ `)+`
223
+ `);let n=t.some(i=>px(i));process.exit(n?1:0)}import Ra from"fs";import{graphql as tF}from"gql.tada";import eF from"fs";function Cr(e){return Qt(e,"hooks-paused")}function De(e){return eF.existsSync(Cr(e))||Eo(e)?!1:Zr(e)}var rF=tF(`
444
224
  mutation CliSetHooksPaused($projectId: String!, $paused: Boolean!) {
445
225
  setHooksPaused(projectId: $projectId, paused: $paused) {
446
226
  id
447
227
  }
448
228
  }
449
- `);async function Ps(){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();mr(e);let r=Ce(e);if(ut.existsSync(r)){process.stdout.write("Hooks already paused. Run `ripplo hooks resume` to re-enable.\n");return}ut.writeFileSync(r,""),await xs(e,!0),process.stdout.write("Hooks paused. Pre-edit gates and stop enforcement are off until you run `ripplo hooks resume`.\n")}async function Rs(){let e=process.cwd(),r=Ce(e);if(!ut.existsSync(r)){process.stdout.write(`Hooks already active.
450
- `);return}ut.unlinkSync(r),await xs(e,!1),process.stdout.write(`Hooks resumed.
451
- `)}async function xs(e,r){let t;try{t=W(e)}catch{return}await h({config:t,document:My,variables:{paused:r,projectId:t.projectId}}).catch(()=>null)}import rr from"fs";import tr from"path";import{input as As,select as Is}from"@inquirer/prompts";import{graphql as ch}from"gql.tada";import{exec as Hy}from"child_process";import U from"fs";import M from"path";import{promisify as By}from"util";var Wy=["@ripplo/testing"],Es=".ripplo/ripplo.lock linguist-generated=true",qy=[".ripplo/debug/",".ripplo/.local/"],zy=By(Hy);async function Cs({cwd:e,onStep:r}){r("Scaffolding project files..."),th({cwd:e}),r("Updating .gitignore..."),nh(e),r("Marking ripplo.lock as generated..."),Jy(e),r("Installing dependencies...");let t=await Gy(e),n=[];if(t.ok||n.push({manualCommand:t.cmd,message:`Couldn't auto-install dev dependencies (${t.reason}). Run the command below, then run \`ripplo lint\` to compile the lockfile.`}),t.ok){r("Compiling initial lockfile...");let o=await Ky(e);o!=null&&n.push({manualCommand:void 0,message:o})}return r("Setting up browser..."),await Ot(),n}async function Gy(e){let r=Xy({cwd:e,pm:rh(e)});f.info("Installing dependencies: %s",r);try{return await zy(r,{cwd:e}),{ok:!0}}catch(t){let n=t instanceof Error?t.message.split(`
452
- `)[0]??t.message:String(t);return f.warn("Install failed (%s): %s",r,n),{cmd:r,ok:!1,reason:n}}}async function Ky(e){try{let r=await x(e);if(!r.ok)return;await ce({cwd:e,result:r.result});return}catch(r){return`Couldn't compile initial lockfile: ${r instanceof Error?r.message:String(r)}.`}}function Jy(e){let r=M.join(e,".gitattributes"),t=U.existsSync(r)?U.readFileSync(r,"utf8"):"";if(t.includes(Es))return;let n=t.length===0||t.endsWith(`
229
+ `);async function gx(){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();Ot(e);let t=Cr(e);if(Ra.existsSync(t)){process.stdout.write("Hooks already paused. Run `ripplo hooks resume` to re-enable.\n");return}Ra.writeFileSync(t,""),await bx(e,!0),process.stdout.write("Hooks paused. Pre-edit gates and stop enforcement are off until you run `ripplo hooks resume`.\n")}async function yx(){let e=process.cwd(),t=Cr(e);if(!Ra.existsSync(t)){process.stdout.write(`Hooks already active.
230
+ `);return}Ra.unlinkSync(t),await bx(e,!1),process.stdout.write(`Hooks resumed.
231
+ `)}async function bx(e,t){let r=je(e).unwrapOr(void 0);r!=null&&await D({config:r,document:rF,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 Mn from"fs";import Nn from"path";import{input as kx,select as Cx}from"@inquirer/prompts";import{graphql as MF}from"gql.tada";import{exec as oF,execFile as sF}from"child_process";import{err as aF,ok as wx}from"neverthrow";import xe from"fs";import{createRequire as lF}from"module";import me from"path";import{promisify as vx}from"util";import{chromium as cF}from"playwright";import{writeFile as nF}from"fs/promises";import iF from"path";async function Tn(e){let t=await be(e);return t.isOk()&&await nF(iF.join(e,Qe),$t(pt,t.value)),t}function Zt(e){return e.tests.filter(t=>t.stub).map(t=>t.name)}var uF=["@ripplo/testing","@ripplo/instrument"],Sx=".ripplo/ripplo.lock linguist-generated=true",dF=[".ripplo/debug/",".ripplo/.local/"],pF=vx(oF),fF=vx(sF);async function xx({cwd:e,onStep:t}){t("Scaffolding project files..."),CF({cwd:e}),t("Updating .gitignore..."),RF(e),t("Marking ripplo.lock as generated..."),yF(e),t("Installing dependencies...");let r=await mF(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 gF(e);o!=null&&n.push({manualCommand:void 0,message:o})}return t("Setting up browser..."),(await hF()).map(()=>n)}async function hF(){let e=cF.executablePath();if(xe.existsSync(e))return wx(void 0);F.info("Chromium not found. Installing via Playwright...");let t=lF(import.meta.url),r=me.dirname(t.resolve("playwright/package.json")),n=me.join(r,"cli.js");return await fF(process.execPath,[n,"install","chromium"]),xe.existsSync(e)?wx(void 0):aF({kind:"playwright-install-failed"})}async function mF(e){let t=bF({cwd:e,pm:kF(e)});F.info("Installing dependencies: %s",t);try{return await pF(t,{cwd:e}),{ok:!0}}catch(r){let n=r instanceof Error?r.message.split(`
233
+ `)[0]??r.message:String(r);return F.warn("Install failed (%s): %s",t,n),{cmd:t,ok:!1,reason:n}}}async function gF(e){try{await Tn(e);return}catch(t){return`Couldn't compile initial lockfile: ${t instanceof Error?t.message:String(t)}.`}}function yF(e){let t=me.join(e,".gitattributes"),r=xe.existsSync(t)?xe.readFileSync(t,"utf8"):"";if(r.includes(Sx))return;let n=r.length===0||r.endsWith(`
453
234
  `)?"":`
454
- `;U.writeFileSync(r,`${t}${n}${Es}
455
- `)}function Xy({cwd:e,pm:r}){let t=Wy.join(" ");return r==="pnpm"?Zy(e)?`pnpm add -wD ${t}`:`pnpm add -D ${t}`:r==="yarn"?Yy({cwd:e,deps:t}):r==="bun"?`bun add -d ${t}`:`npm install -D ${t}`}function Yy({cwd:e,deps:r}){return Qy(e)?`yarn add -D ${r}`:eh(e)?`yarn add -WD ${r}`:`yarn add -D ${r}`}function Qy(e){if(U.existsSync(M.join(e,".yarnrc.yml"))||U.existsSync(M.join(e,".pnp.cjs"))||U.existsSync(M.join(e,".pnp.js")))return!0;let r=M.join(e,"package.json");if(!U.existsSync(r))return!1;try{let t=JSON.parse(U.readFileSync(r,"utf8"));if(t==null||typeof t!="object"||!("packageManager"in t))return!1;let n=t.packageManager;if(typeof n!="string")return!1;let o=/^yarn@(\d+)/.exec(n);return o!=null&&Number(o[1])>=2}catch{return!1}}function Zy(e){return U.existsSync(M.join(e,"pnpm-workspace.yaml"))||U.existsSync(M.join(e,"pnpm-workspace.yml"))}function eh(e){let r=M.join(e,"package.json");if(!U.existsSync(r))return!1;try{let t=JSON.parse(U.readFileSync(r,"utf8"));if(t==null||typeof t!="object"||!("workspaces"in t))return!1;let n=t.workspaces;return Array.isArray(n)||n!=null&&typeof n=="object"}catch{return!1}}function rh(e){return U.existsSync(M.join(e,"pnpm-lock.yaml"))?"pnpm":U.existsSync(M.join(e,"yarn.lock"))?"yarn":U.existsSync(M.join(e,"bun.lockb"))||U.existsSync(M.join(e,"bun.lock"))?"bun":"npm"}function th({cwd:e}){let r=M.join(e,".ripplo"),t=M.join(r,"tests"),n=M.join(r,"preconditions"),o=M.join(r,"observers");U.mkdirSync(t,{recursive:!0}),U.mkdirSync(n,{recursive:!0}),U.mkdirSync(o,{recursive:!0}),Rr(M.join(r,"index.ts"),oh),Rr(M.join(n,"index.ts"),ih),Rr(M.join(o,"index.ts"),sh),Rr(M.join(t,"index.ts"),ah),Rr(M.join(r,"tsconfig.json"),lh)}function Rr(e,r){U.existsSync(e)||U.writeFileSync(e,r)}function nh(e){let r=M.join(e,".gitignore");if(!U.existsSync(r))return;let t=U.readFileSync(r,"utf8"),n=qy.filter(i=>!t.includes(i));if(n.length===0)return;let o=t.endsWith(`
235
+ `;xe.writeFileSync(t,`${r}${n}${Sx}
236
+ `)}function bF({cwd:e,pm:t}){let r=uF.join(" ");return t==="pnpm"?wF(e)?`pnpm add -wD ${r}`:`pnpm add -D ${r}`:t==="yarn"?SF({cwd:e,deps:r}):t==="bun"?`bun add -d ${r}`:`npm install -D ${r}`}function wF(e){return xe.existsSync(me.join(e,"pnpm-workspace.yaml"))||xe.existsSync(me.join(e,"pnpm-workspace.yml"))}function SF({cwd:e,deps:t}){return vF(e)?`yarn add -D ${t}`:xF(e)?`yarn add -WD ${t}`:`yarn add -D ${t}`}function vF(e){if(xe.existsSync(me.join(e,".yarnrc.yml"))||xe.existsSync(me.join(e,".pnp.cjs"))||xe.existsSync(me.join(e,".pnp.js")))return!0;let t=me.join(e,"package.json");if(!xe.existsSync(t))return!1;try{let r=JSON.parse(xe.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 xF(e){let t=me.join(e,"package.json");if(!xe.existsSync(t))return!1;try{let r=JSON.parse(xe.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 kF(e){return xe.existsSync(me.join(e,"pnpm-lock.yaml"))?"pnpm":xe.existsSync(me.join(e,"yarn.lock"))?"yarn":xe.existsSync(me.join(e,"bun.lockb"))||xe.existsSync(me.join(e,"bun.lock"))?"bun":"npm"}function CF({cwd:e}){let t=me.join(e,".ripplo"),r=me.join(t,"entities"),n=me.join(t,"singletons"),i=me.join(t,"worlds"),o=me.join(t,"tests");[r,n,i,o].forEach(s=>{xe.mkdirSync(s,{recursive:!0})}),On(me.join(t,"index.ts"),EF),On(me.join(r,"index.ts"),IF),On(me.join(n,"index.ts"),AF),On(me.join(i,"index.ts"),PF),On(me.join(o,"index.ts"),TF),On(me.join(t,"tsconfig.json"),OF)}function On(e,t){xe.existsSync(e)||xe.writeFileSync(e,t)}function RF(e){let t=me.join(e,".gitignore");if(!xe.existsSync(t))return;let r=xe.readFileSync(t,"utf8"),n=dF.filter(o=>!r.includes(o));if(n.length===0)return;let i=r.endsWith(`
456
237
  `)?"":`
457
- `;U.writeFileSync(r,t+o+n.join(`
238
+ `;xe.writeFileSync(t,r+i+n.join(`
458
239
  `)+`
459
- `)}var oh=`import { createRipplo } from "@ripplo/testing";
460
- import { preconditions } from "./preconditions/index";
461
- import { observers } from "./observers/index";
240
+ `)}var EF=`import { createRipplo } from "@ripplo/testing";
241
+ import { entities } from "./entities/index";
242
+ import { singletons } from "./singletons/index";
462
243
  import { tests } from "./tests/index";
463
244
 
464
- export { preconditions, observers, tests };
465
- export default createRipplo({ preconditions, observers, tests });
466
- `,ih=`// Declare preconditions with \`precondition(name)\` from @ripplo/testing and collect them
467
- // in the \`preconditions\` registry below. Every handle in this registry must be implemented
468
- // in your app server's \`createEngine(ripplo, { preconditions: {...}, observers: {...} })\` call.
245
+ export default createRipplo({
246
+ entities,
247
+ singletons,
248
+ tests,
249
+ });
250
+ `,IF=`// Model the app's state as entities. Each entity gets a \`seed\`/\`read\` impl in your
251
+ // app's engine funnel (createEngine). See /ripplo:create "Adding an entity".
469
252
  //
470
253
  // Example:
471
- // import { precondition } from "@ripplo/testing";
254
+ // import { entity, field, id, v } from "@ripplo/testing";
472
255
  //
473
- // export const authLoggedIn = precondition("auth:logged-in")
474
- // .description("Authenticated test user")
475
- // .contract<{ userId: string }>();
256
+ // export const Project = entity("project", {
257
+ // description: "A project owned by a user",
258
+ // fields: { name: field({ value: v.slug() }), ownerId: field({ value: v.id() }) },
259
+ // identity: { id: id() },
260
+ // source: "backend",
261
+ // });
476
262
  //
477
- // export const preconditions = { authLoggedIn };
263
+ // export const entities = [Project] as const;
478
264
 
479
- export const preconditions = {};
480
- `,sh=`// Declare observers with \`observer(name)\` from @ripplo/testing and collect them in
481
- // the \`observers\` registry below. Use them in tests via \`assert.backend(handle, params)\`.
265
+ export const entities = [] as const;
266
+ `,AF=`// Client/global state (e.g. localStorage flags) modeled as singletons.
482
267
  //
483
268
  // Example:
484
- // import { observer } from "@ripplo/testing";
269
+ // import { singleton, v } from "@ripplo/testing";
485
270
  //
486
- // export const orgNameIs = observer("org:name-is")
487
- // .input<{ orgId: string; expectedName: string }>()
488
- // .contract();
271
+ // export const onboardingDismissed = singleton("onboardingDismissed", {
272
+ // default: false,
273
+ // description: "user dismissed the onboarding flow",
274
+ // source: "client",
275
+ // value: v.boolean(),
276
+ // });
489
277
  //
490
- // export const observers = { orgNameIs };
278
+ // export const singletons = [onboardingDismissed];
491
279
 
492
- export const observers = {};
493
- `,ah=`// Each test file under ./tests exports a TestDefinition. Import them here and add them
494
- // to the \`tests\` array \u2014 that's what \`createRipplo({ ..., tests })\` receives.
280
+ export const singletons = [];
281
+ `,PF=`// Pure builder functions returning a flat record of entity handles \u2014 the starting state
282
+ // for tests. Compose from other worlds. See /ripplo:create "Adding a world".
283
+ //
284
+ // Example:
285
+ // import { arbitrary } from "@ripplo/testing";
286
+ // import { Project, User } from "../entities/index";
287
+ //
288
+ // export const ownedProject = () => {
289
+ // const me = User.of({ email: arbitrary(User.field.email) });
290
+ // const project = Project.of({ name: arbitrary(Project.field.name), ownerId: me.id });
291
+ // return { me, project };
292
+ // };
293
+ `,TF=`// Each test file under ./tests exports a test. Import them here and add to the \`tests\`
294
+ // array \u2014 that's what createRipplo({ ..., tests }) receives. Stub with \`test("Intent")\`
295
+ // (no body); implement later with \`test("Intent", () => ({ given, steps }))\`.
495
296
  //
496
297
  // Example:
497
- // import { myTest } from "./my-test";
498
- // export const tests = [myTest] as const;
298
+ // import { createProject } from "./create-project";
299
+ // export const tests = [createProject] as const;
499
300
 
500
301
  export const tests = [] as const;
501
- `,lh=`{
302
+ `,OF=`{
502
303
  "compilerOptions": {
503
304
  "strict": true,
504
305
  "noUncheckedIndexedAccess": true,
@@ -511,115 +312,146 @@ export const tests = [] as const;
511
312
  "isolatedModules": true,
512
313
  "lib": ["ES2023"]
513
314
  },
514
- "include": ["*.ts", "coverage.d.ts", "observers/**/*.ts", "preconditions/**/*.ts", "tests/**/*.ts"],
315
+ "include": ["*.ts", "entities/**/*.ts", "singletons/**/*.ts", "worlds/**/*.ts", "tests/**/*.ts"],
515
316
  "exclude": ["node_modules"]
516
317
  }
517
- `;var uh=ch(`
318
+ `;var NF=MF(`
518
319
  query InitProjects {
519
320
  projects {
520
321
  id
521
322
  name
522
323
  }
523
324
  }
524
- `),Vn=["../.env.local","../.env"];async function Ts(e=mh()){let r=process.cwd(),t=ie();t==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let n=ee();dh(r)&&(process.stdout.write(`\`.ripplo/index.ts\` already exists at ${r}. Delete it first if you want to re-init.
525
- `),process.exit(1));let o=await ph({serverUrl:n,token:t});o.length===0&&(process.stdout.write("No projects found. Create one in the dashboard first, then re-run `ripplo init`.\n"),process.exit(1));let i=await gh(o,e.projectId),s=await yh(r,e.envFile),a=await hh(e.appUrl),l=fh(a,e.engineUrl),c=tr.resolve(tr.join(r,".ripplo"),s);ii({cwd:r,envFiles:[s],projectId:i}),vh({appUrl:a,engineUrl:l,filePath:c});let u=await Cs({cwd:r,onStep:m=>{process.stdout.write(` ${m}
526
- `)}});if(u.length>0){process.stdout.write(`Done with warnings:
527
- `),u.forEach(m=>{process.stdout.write(` - ${m.message}
528
- `),m.manualCommand!=null&&process.stdout.write(` run: ${m.manualCommand}
529
- `)});return}process.stdout.write("Ready. Start `npx ripplo watch` as a background process (or run `/ripplo:start` in Claude Code), then write tests in `.ripplo/tests/`.\n")}function dh(e){return rr.existsSync(tr.join(e,".ripplo","index.ts"))}async function ph({serverUrl:e,token:r}){return((await h({config:Pe({serverUrl:e,token:r}),document:uh,variables:void 0})).projects??[]).map(n=>({id:n.id,name:n.name}))}function mh(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function fh(e,r){if(r!=null){try{new URL(r)}catch{process.stdout.write(`--engine-url is not a valid URL: ${r}
530
- `),process.exit(1)}return r}return`${e.replace(/\/$/,"")}/ripplo`}async function gh(e,r){if(r!=null){let t=e.find(n=>n.id===r);return t==null&&(process.stdout.write(`Unknown project id: ${r}
531
- `),process.exit(1)),process.stdout.write(`Using project: ${t.name} (${t.id})
532
- `),t.id}if(e.length===1){let t=e[0];if(t==null)throw new Error("unreachable");return process.stdout.write(`Using project: ${t.name} (${t.id})
533
- `),t.id}return Is({choices:e.map(t=>({name:t.name,value:t.id})),message:"Select a project"})}async function yh(e,r){return r!=null?(r.trim().length===0&&(process.stdout.write(`--env must not be empty
534
- `),process.exit(1)),r):wh(e)}async function hh(e){if(e!=null){try{new URL(e)}catch{process.stdout.write(`--app-url is not a valid URL: ${e}
535
- `),process.exit(1)}return e}return bh()}async function wh(e){let r=tr.join(e,".ripplo"),t=Vn.find(o=>rr.existsSync(tr.resolve(r,o))),n=await Is({choices:[...Vn.map(o=>({name:t===o?`${o} (detected)`:o,value:o})),{name:"custom path",value:"__custom__"}],default:t??Vn[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:As({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:o=>o.trim().length>0?!0:"required"})}async function bh(){return As({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 vh({appUrl:e,engineUrl:r,filePath:t}){rr.mkdirSync(tr.dirname(t),{recursive:!0});let n=rr.existsSync(t)?rr.readFileSync(t,"utf8"):"",o=[];if(/^RIPPLO_APP_URL=/m.test(n)||o.push(`RIPPLO_APP_URL=${e}`),/^RIPPLO_ENGINE_URL=/m.test(n)||o.push(`RIPPLO_ENGINE_URL=${r}`),/^RIPPLO_WEBHOOK_SECRET=/m.test(n)||o.push(`RIPPLO_WEBHOOK_SECRET=${Kt()}`),/^ENABLE_RIPPLO_TESTING=/m.test(n)||o.push("ENABLE_RIPPLO_TESTING=true"),o.length===0)return;let i=n.length===0||n.endsWith(`
325
+ `),sf=["../.env.local","../.env"];async function Rx(e=DF()){let t=process.cwd(),r=lt();r==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let n=nt();LF(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 $F({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 jF(i,e.projectId),s=await FF(t,e.envFile),a=await BF(e.appUrl),l=_F(a,e.engineUrl),c=Nn.resolve(Nn.join(t,".ripplo"),s);qf({cwd:t,envFiles:[s],projectId:o}),WF({appUrl:a,engineUrl:l,filePath:c});let d=(await xx({cwd:t,onStep:p=>{process.stdout.write(` ${p}
327
+ `)}})).match(p=>p,p=>{process.stderr.write(`${Ge(p)}
328
+ `),process.exit(1)});if(d.length>0){process.stdout.write(`Done with warnings:
329
+ `),d.forEach(p=>{process.stdout.write(` - ${p.message}
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 LF(e){return Mn.existsSync(Nn.join(e,".ripplo","index.ts"))}async function $F({serverUrl:e,token:t}){return((await D({config:ir({serverUrl:e,token:t}),document:NF,variables:void 0})).projects??[]).map(n=>({id:n.id,name:n.name}))}function DF(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function _F(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 jF(e,t){if(t!=null){let r=e.find(n=>n.id===t);return r==null&&(process.stdout.write(`Unknown project id: ${t}
333
+ `),process.exit(1)),process.stdout.write(`Using project: ${r.name} (${r.id})
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 Cx({choices:e.map(r=>({name:r.name,value:r.id})),message:"Select a project"})}async function FF(e,t){return t!=null?(t.trim().length===0&&(process.stdout.write(`--env must not be empty
336
+ `),process.exit(1)),t):VF(e)}async function VF(e){let t=Nn.join(e,".ripplo"),r=sf.find(i=>Mn.existsSync(Nn.resolve(t,i))),n=await Cx({choices:[...sf.map(i=>({name:r===i?`${i} (detected)`:i,value:i})),{name:"custom path",value:"__custom__"}],default:r??sf[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:kx({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:i=>i.trim().length>0?!0:"required"})}async function BF(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 UF()}async function UF(){return kx({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 WF({appUrl:e,engineUrl:t,filePath:r}){Mn.mkdirSync(Nn.dirname(r),{recursive:!0});let n=Mn.existsSync(r)?Mn.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=${yl()}`),/^ENABLE_RIPPLO_TESTING=/m.test(n)||i.push("ENABLE_RIPPLO_TESTING=true"),i.length===0)return;let o=n.length===0||n.endsWith(`
536
338
  `)?"":`
537
- `;rr.writeFileSync(t,`${n}${i}${o.join(`
339
+ `;Mn.writeFileSync(r,`${n}${o}${i.join(`
538
340
  `)}
539
- `)}import Fn from"fs";import js from"path";import*as Ds from"remeda";import{graphql as Sh}from"gql.tada";var kh=Sh(`
540
- mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
541
- addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
542
- __typename
543
- ... on MutationAddDirtyTestsToScopeSuccess {
544
- data {
545
- id
546
- }
547
- }
548
- }
549
- }
550
- `);async function nr({compileResult:e,cwd:r}){if(!F(r))return{addedSlugs:[]};let t=Rh(r);if(t.length===0)return{addedSlugs:[]};let n=new Set(t),o=e.result.tests.filter(l=>l.sourcePath!=null&&n.has(l.sourcePath)).map(l=>l.slug);if(o.length===0)return{addedSlugs:[]};let i;try{i=W(r)}catch{return{addedSlugs:[]}}return await Qe({compiled:e.result,config:i,cwd:r}).catch(l=>(f.warn("auto-sync failed: %s",l instanceof Error?l.message:String(l)),null))==null?{addedSlugs:[]}:{addedSlugs:await Ph({cfg:i,slugs:o})?o:[]}}async function Ph({cfg:e,slugs:r}){let n=(await h({config:e,document:kh,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...r]}}).catch(o=>(f.warn("auto-scope failed: %s",o instanceof Error?o.message:String(o)),null)))?.addDirtyTestsToScope;return n?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:n.data.length>0}var $s=".ripplo/tests/";function Rh(e){let r;try{r=K(["status","--porcelain","--",".ripplo/tests"],e)}catch{return[]}return r.split(`
551
- `).map(t=>t.slice(3).trim()).filter(t=>t.startsWith($s)&&t.endsWith(".ts")).map(t=>t.slice($s.length)).filter(t=>t!=="index.ts"&&!t.endsWith("/index.ts"))}function Ns(e){process.stderr.write(`Compilation failed: ${e}
552
- `),process.stderr.write(`${w("create","DSL authoring + lint rules")}
553
- `),process.exit(1)}async function Os(e){let{ids:r,requireImplemented:t}=e,n=process.cwd(),o=await x(n);o.ok||Ns(o.error),await ce({cwd:n,result:o.result}).catch(g=>{Ns(g instanceof Error?g.message:String(g))});let i=qe(o.result),s=r.length===0?i.diagnostics:i.diagnostics.filter(g=>r.includes(g.test)),a=Ds.groupBy(s,g=>g.test);Object.entries(a).forEach(([g,O])=>{process.stderr.write(`
554
- ${g}
555
- `),O.forEach(P=>{let H=P.step==null?"":` at "${P.step}"`;process.stderr.write(` [${P.rule}]${H}
556
- `),process.stderr.write(` ${P.message}
557
- `)})});let l=new Set(o.builder.getUnimplemented().tests),c=t.filter(g=>l.has(g));c.length>0&&(process.stderr.write(`
558
- not-implemented
559
- `),c.forEach(g=>{process.stderr.write(` ${g} is still marked .notImplemented()
560
- `)}));let u=Ah(n);u.length>0&&(process.stderr.write(`
561
- preconditions
562
- `),u.forEach(g=>{process.stderr.write(` [hardcoded-identifier] ${g.file}
563
- `),process.stderr.write(` ${g.message}
564
- `)}));let m=s.length+c.length+u.length;m>0&&(process.stderr.write(`
565
- ${String(m)} error(s)
566
- `),xh({diagnostics:s,hardcodeWarnings:u,stillStubbed:c}),process.exit(1));let y=o.result.tests.length,R=r.length===0?"all tests":`${String(r.length)} test(s)`;process.stdout.write(`\u2713 ripplo lint: ${R} passed (${String(y)} compiled, lockfile written)
567
- `);let{addedSlugs:E}=await nr({compileResult:o,cwd:n});E.length>0&&process.stdout.write(`\u2713 Auto-scoped ${E.join(", ")} (dirty tests).
568
- `)}function xh({diagnostics:e,hardcodeWarnings:r,stillStubbed:t}){let n=new Set;(e.length>0||t.length>0)&&n.add("create"),r.length>0&&n.add("explore"),n.forEach(o=>process.stderr.write(`${w(o)}
569
- `))}var Eh=/['"`][\w.+-]+@[\w.-]+\.[a-z]{2,}['"`]/i,Ch=/['"`][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"`]/i;function Ah(e){let r=js.join(e,".ripplo","preconditions");return Fn.existsSync(r)?Fn.readdirSync(r).filter(n=>n.endsWith(".ts")).flatMap(n=>Ih(js.join(r,n))):[]}function Ih(e){let r=Fn.readFileSync(e,"utf8"),t=r.includes("ctx.uniqueEmail")||r.includes("ctx.uniqueId"),n=[],o=Eh.exec(r);o!=null&&!t&&n.push({file:e,message:`hardcoded email literal ${o[0]} \u2014 use ctx.uniqueEmail() so parallel runs don't collide`});let i=Ch.exec(r);return i!=null&&!t&&n.push({file:e,message:`hardcoded UUID-like literal ${i[0]} \u2014 use ctx.uniqueId() so parallel runs don't collide`}),n}import{graphql as Th}from"gql.tada";var $h=Th(`
341
+ `)}function Ea(e){let t=e.tests.filter(i=>!i.stub);if(t.length===0)return[];let r=new Set(t.flatMap(i=>HF(i))),n=new Set(t.flatMap(i=>zF(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 HF(e){return[...e.world,...e.maybe].map(t=>t.entity)}function zF(e){return e.steps.flatMap(t=>t.expect.flatMap(r=>qi(r)))}function qi(e){return e.kind==="state"?[e.entity]:e.kind==="not"?qi(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>qi(t)):e.kind==="when"?[...qi(e.condition),...qi(e.consequence)]:[]}async function Ex(){let e=process.cwd(),r=(await be(e)).match(i=>i,i=>GF(Oe(i))),n=xr(r);if(n.length===0){let i=Ea(r);i.length>0&&process.stdout.write(`${ka(i)}
342
+ `),process.stdout.write(`${cx(r.tests.length)}
343
+ `);return}process.stderr.write(`${kr(n)}
344
+ `),process.exit(1)}function GF(e){process.stderr.write(`${e}
345
+ `),process.exit(1)}import{graphql as qF}from"gql.tada";var KF=qF(`
570
346
  query ProjectsList {
571
347
  projects {
572
348
  id
573
349
  name
574
350
  }
575
351
  }
576
- `);async function Ls(){let e=ie();e==null&&(process.stderr.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let r=ee(),n=((await h({config:Pe({serverUrl:r,token:e}),document:$h,variables:void 0})).projects??[]).map(o=>({id:o.id,name:o.name}));process.stdout.write(`${JSON.stringify({projects:n},null,2)}
577
- `)}import{graphql as jh}from"gql.tada";var dt=jh(`
578
- query ScopeStatus($projectId: String!, $cwd: String!) {
352
+ `);async function Ix(){let e=lt();e==null&&(process.stderr.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let t=nt(),n=((await D({config:ir({serverUrl:t,token:e}),document:KF,variables:void 0})).projects??[]).map(i=>({id:i.id,name:i.name}));process.stdout.write(`${JSON.stringify({projects:n},null,2)}
353
+ `)}import mV from"path";import{CancellationTokenSource as gV}from"vscode-jsonrpc/node";import{spawn as nV}from"child_process";import Dx from"fs";import iV from"net";import{setTimeout as jx}from"timers/promises";import{err as cf,ok as uf}from"neverthrow";import{ResponseError as oV}from"vscode-jsonrpc/node";import{createMessageConnection as YF,NotificationType as Ax,RequestType as JF,RequestType0 as Px,SocketMessageReader as ZF,SocketMessageWriter as XF}from"vscode-jsonrpc/node";import{z as T}from"zod";var QF="daemon.sock",eV="daemon.log";function Ki(e){return Qt(e,QF)}function af(e){return Qt(e,eV)}function Ia(e){return YF(new ZF(e),new XF(e))}var Tx=T.object({all:T.boolean(),headed:T.boolean(),tests:T.array(T.string())}),Ox=T.object({jobId:T.string(),total:T.number()}),tV=T.enum(["holder","standby","off"]),Mx=T.object({active:T.number(),explorer:tV,exploring:T.number(),queued:T.number()}),lf=T.discriminatedUnion("kind",[T.object({kind:T.literal("pass")}),T.object({findingLines:T.array(T.string()),kind:T.literal("findings")}),T.object({detail:T.string(),kind:T.literal("error")}),T.object({detail:T.string(),kind:T.literal("dispatch-error")})]),rV=T.discriminatedUnion("kind",[T.object({kind:T.literal("test-started"),runId:T.string(),testName:T.string()}),T.object({kind:T.literal("test-outcome"),outcome:lf,runId:T.string(),testName:T.string()})]),Nx=T.object({event:rV,jobId:T.string()}),Lx=T.object({failed:T.number(),jobId:T.string(),passed:T.number()}),$x=T.discriminatedUnion("code",[T.object({code:T.literal("compile-failed"),detail:T.string(),diagnostics:T.array(T.string()).default([])}),T.object({code:T.literal("selection-conflicting-flags")}),T.object({code:T.literal("selection-nothing-selected")}),T.object({code:T.literal("selection-unknown-ids"),known:T.array(T.string()),unknown:T.array(T.string())}),T.object({code:T.literal("sync-failed"),detail:T.string()}),T.object({code:T.literal("bad-message")})]),Aa=new JF("ripplo/enqueue"),Pa=new Px("ripplo/status"),Ta=new Px("ripplo/shutdownIfIdle"),Oa=new Ax("ripplo/jobEvent"),Ma=new Ax("ripplo/jobDone");var Fx=12e4,sV=300,_x=5e3;async function Vx({cliEntry:e,cwd:t}){let r=Ki(t),n=await Na(r);if(n!=null)return uf(df(n,!1));let i=uV({cliEntry:e,cwd:t});if(i!=null)return cf(i);let o=await dV(r);return o==null?cf({deadlineMs:Fx,kind:"connect-timeout",logPath:af(t)}):uf(df(o,!0))}async function Bx({connection:e,onEvent:t,request:r,token:n}){let i=await lV({connection:e,onEvent:t,request:r,token:n});return i.kind==="transport"?cf(i.error):uf(i)}async function Ux(e){try{await e.rpc.sendRequest(Ta)}catch{}}async function Wx(e){let t=await Na(Ki(e));if(t==null)return{kind:"not-running"};let r=df(t,!1),n=await Promise.race([aV(r),jx(_x).then(()=>null)]);return t.destroy(),n==null?{kind:"unresponsive",timeoutMs:_x}:{kind:"running",status:n}}async function aV(e){try{let t=await e.rpc.sendRequest(Pa),r=Mx.safeParse(t);return r.success?r.data:null}catch{return null}}function lV({connection:e,onEvent:t,request:r,token:n}){let{rpc:i}=e;return new Promise(o=>{let s=a=>{o(a)};i.onNotification(Oa,a=>{let l=Nx.safeParse(a);if(!l.success){s({error:{kind:"bad-frame"},kind:"transport"});return}t(l.data.event)}),i.onNotification(Ma,a=>{let l=Lx.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(Aa,r,n).then(a=>{Ox.safeParse(a).success||s({error:{kind:"bad-frame"},kind:"transport"})}).catch(a=>{s(cV(a))})})}function cV(e){if(e instanceof oV){let t=$x.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 df(e,t){let r=Ia(e);return r.listen(),{rpc:r,socket:e,spawned:t}}function Na(e){return new Promise(t=>{let r=iV.connect(e);r.once("connect",()=>{t(r)}),r.once("error",()=>{t(null)})})}function uV({cliEntry:e,cwd:t}){try{Ot(t);let r=Dx.openSync(af(t),"a");return nV(process.execPath,[e,"daemon"],{cwd:t,detached:!0,stdio:["ignore",r,r]}).unref(),Dx.closeSync(r),null}catch(r){return{kind:"spawn-failed",message:r instanceof Error?r.message:String(r)}}}async function dV(e){let t=Date.now()+Fx,r=await Na(e);for(;r==null&&Date.now()<t;)await jx(sV),r=await Na(e);return r}import pV from"fuse.js";function pf(e){switch(e.kind){case"conflicting-flags":return"Pass either --all or test ids, not both.";case"nothing-selected":return"No tests selected \u2014 pass test ids or --all.";case"unknown-ids":{let t=e.known.map(i=>Re(i)),r=e.unknown.flatMap(i=>fV(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(`
354
+ `)}}}function Hx({failed:e,passed:t}){let r=e>0?`
355
+ ${V("debug")}`:"";return`${String(t)} passed, ${String(e)} failed (${String(t+e)} total)${r}`}function zx({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,Jc({debugDir:e,runId:t.runId})].join(`
356
+ `);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 Gx(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
+ `)}case"selection-conflicting-flags":return pf({kind:"conflicting-flags"});case"selection-nothing-selected":return pf({kind:"nothing-selected"});case"selection-unknown-ids":return pf({kind:"unknown-ids",known:e.known,unknown:e.unknown});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 La(e){switch(e.kind){case"spawn-failed":return`Failed to start \`ripplo daemon\`: ${hV(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(`
358
+ `);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(`
359
+ `);case"bad-frame":return"Received a malformed frame from the daemon (version mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function fV(e,t){return new pV(t,{includeScore:!0,threshold:.5}).search(Re(e)).slice(0,3).map(n=>n.item)}function hV(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 qx({all:e,headed:t,ids:r,keepAlive:n}){let i=process.cwd(),o=process.argv[1];o==null&&$a(La({kind:"spawn-failed",message:"process.argv[1] missing"}));let a=(await Vx({cliEntry:o,cwd:i})).match(p=>p,p=>$a(La(p))),l=new gV;process.once("SIGINT",()=>{l.cancel(),a.socket.destroy(),process.exit(130)});let c=mV.join(i,".ripplo","debug"),d=(await Bx({connection:a,request:{all:e,headed:t,tests:[...r]},token:l.token,onEvent:p=>{let h=zx({debugDir:c,event:p});h!=null&&process.stdout.write(`${h}
360
+ `)}})).match(p=>p,p=>$a(La(p)));await yV({connection:a,keepAlive:n,result:d})}async function yV({connection:e,keepAlive:t,result:r}){e.spawned&&!t&&await Ux(e),await new Promise(n=>{e.socket.end(n)}),r.kind==="daemon-error"&&$a(Gx(r.error)),process.stdout.write(`${Hx(r)}
361
+ `),process.exit(r.failed>0?1:0)}function $a(e){process.stderr.write(`${e}
362
+ `),process.exit(1)}import AB from"path";import{err as qa,ok as bf}from"neverthrow";import{randomUUID as _V}from"crypto";import{CancellationTokenSource as jV,ResponseError as FV}from"vscode-jsonrpc/node";import{graphql as ek}from"gql.tada";import bV from"p-queue";var wV=4,SV={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},Da=new bV({concurrency:wV}),Xt={headedActive:0,interactiveActive:0,interactiveQueued:0},Kx={current:null};function _a({headed:e,task:t,workClass:r}){let n=SV[r];return r==="p3-explore"?Da.add(t,{priority:n}):(Xt.interactiveQueued+=1,ff(),Da.add(()=>vV({headed:e,task:t}),{priority:n}))}function ja(e){!Number.isFinite(e)||e<1||(Da.concurrency=Math.floor(e))}function Yi(){return{active:Xt.interactiveActive,headedActive:Xt.headedActive,poolSize:Da.concurrency,queued:Xt.interactiveQueued}}function hf(e){Kx.current=e}async function vV({headed:e,task:t}){Xt.interactiveQueued-=1,Xt.interactiveActive+=1,Xt.headedActive+=e?1:0,ff();try{return await t()}finally{Xt.interactiveActive-=1,Xt.headedActive-=e?1:0,ff()}}function ff(){Kx.current?.()}import{err as mf,ok as Yx}from"neverthrow";function Jx({all:e,ids:t,lockfile:r}){let n=r.tests.map(a=>a.name);if(e&&t.length>0)return mf({kind:"conflicting-flags"});if(e)return Yx(r.tests.filter(a=>!a.stub).map(a=>a.name));if(t.length===0)return mf({kind:"nothing-selected"});let i=new Map(n.map(a=>[Re(a),a])),o=t.map(a=>({id:a,name:n.includes(a)?a:i.get(Re(a))})),s=o.filter(a=>a.name==null).map(a=>a.id);return s.length>0?mf({kind:"unknown-ids",known:n,unknown:s}):Yx(o.flatMap(a=>a.name==null?[]:[a.name]))}import kV from"crypto";import{graphql as CV}from"gql.tada";import{err as RV,ok as EV}from"neverthrow";import gf from"fs";import yf from"path";function Fa(e){try{let t=xV(e);if(t==null)return;let r=yf.join(t,"HEAD"),n=gf.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 xV(e){let t=yf.join(e,".git");if(gf.statSync(t).isDirectory())return t;let n=gf.readFileSync(t,"utf8").trim(),i="gitdir:";if(!n.startsWith(i))return;let o=n.slice(i.length).trim();if(o.length!==0)return yf.resolve(e,o)}var IV=CV(`
363
+ mutation SyncDevSession(
364
+ $projectId: String!
365
+ $cwd: String!
366
+ $branch: String
367
+ $preconditions: [SyncDevPreconditionInput!]!
368
+ $workflows: [SyncDevWorkflowInput!]!
369
+ ) {
370
+ syncDevSession(
371
+ projectId: $projectId
372
+ cwd: $cwd
373
+ branch: $branch
374
+ preconditions: $preconditions
375
+ workflows: $workflows
376
+ ) {
377
+ id
378
+ hooksPaused
379
+ }
380
+ }
381
+ `);async function Ji(e,t){let r=await be(e);if(r.isErr())return RV({error:r.error,kind:"compilation-failed"});let n=await Rr({config:t,cwd:e,lockfile:r.value});return EV({devSessionId:n.devSessionId,lockfile:r.value})}async function Rr(e){let t=AV(e.lockfile);return DV({config:e.config,cwd:e.cwd,payload:t})}function AV(e){let t=PV(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:NV(LV(r),t),requiresKeys:r.world.map(n=>({namespace:n.as,preconditionName:n.entity})),slug:Re(r.name),sourcePath:r.sourcePath??null,spec:JSON.stringify({steps:r.steps.map((n,i)=>Un(n,i)),stub:r.stub})}))}}function PV(e){let t=e.tests.reduce((r,n)=>TV(r,n),new Map);return new Map([...t].map(([r,n])=>[r,[...n]]))}function TV(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=OV(o,n),a=i.get(o.entity)??new Set;return new Map([...i,[o.entity,new Set([...a,...s])]])},e)}function OV(e,t){return Object.values(e.set).flatMap(r=>MV(r)).map(r=>t.get(r)).filter(r=>r!=null&&r!==e.entity)}function MV(e){return e==null||typeof e!="object"?[]:"ref"in e?[Zx(e.ref)]:e.template.filter(t=>typeof t!="string").map(t=>Zx(t.ref))}function Zx(e){let[t]=e.split(".");return t??e}function NV(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 LV(e){return[...new Set(e.world.map(t=>t.entity))]}function $V(e){return kV.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function DV({config:e,cwd:t,payload:r}){let n=$V(r),i=Fa(t),o=await D({config:e,document:IV,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 VV=12e4,BV=-32099;function Va(e){let t=new AbortController;return e.isCancellationRequested?(t.abort(),t.signal):(e.onCancellationRequested(()=>{t.abort()}),t.signal)}function tk(e){let t={...e,expectations:new Map,jobs:new Map};return{claim:r=>qV(t,r),handleConnection:r=>{UV(t,r)},idle:()=>rk(t)}}function UV(e,t){let r=Ia(t);r.onRequest(Aa,(n,i)=>WV({connection:r,ctx:e,params:n,token:i})),r.onRequest(Pa,()=>{let n=Yi();return{active:n.active,queued:n.queued,...e.explorationStatus()}}),r.onRequest(Ta,()=>{let n=rk(e);return n&&e.onShutdownRequest(),n}),r.onClose(()=>{HV(e,r)}),r.onError(n=>{F.warn({err:n},"ipc connection error")}),t.on("error",n=>{F.warn({err:n},"ipc socket error")}),r.listen()}function rk(e){let t=Yi();return e.jobs.size===0&&t.active===0&&t.queued===0}async function WV({connection:e,ctx:t,params:r,token:n}){let i=Tx.safeParse(r);if(!i.success)throw Xx({code:"bad-message"});await t.ready;let o=await YV({config:t.config,cwd:t.cwd,message:i.data});if(o.kind==="error")throw Xx(o.error);let s=_V(),a=new jV;return n.onCancellationRequested(()=>{nk(t,s)}),t.jobs.set(s,{cancellation:a,connection:e,failed:0,passed:0,total:o.testNames.length}),rB({ctx:t,headed:i.data.headed,jobId:s,testNames:o.testNames,token:a.token,workflowIdsBySlug:o.workflowIdsBySlug}).catch(l=>{F.error({err:l},"ipc dispatch failed")}),{jobId:s,total:o.testNames.length}}function Xx(e){return new FV(BV,e.code,e)}function nk(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 HV(e,t){[...e.jobs.entries()].filter(([,r])=>r.connection===t).forEach(([r])=>{nk(e,r)})}function Zi(e,t,r){let n=e.jobs.get(t);n!=null&&(Qx(()=>n.connection.sendNotification(Oa,{event:r,jobId:t})),r.kind==="test-outcome"&&(r.outcome.kind==="pass"?n.passed+=1:n.failed+=1,n.passed+n.failed>=n.total&&(Qx(()=>n.connection.sendNotification(Ma,{failed:n.failed,jobId:t,passed:n.passed})),e.jobs.delete(t))))}function Qx(e){e().catch(t=>{F.warn({err:t},"ipc notification failed")})}function ik(e,t){let n=e.expectations.get(t)?.shift();return n==null?null:(clearTimeout(n.timer),n)}function zV(e,t){let{headed:r,jobId:n,slug:i,testName:o}=t,s=setTimeout(()=>{GV({ctx:e,jobId:n,slug:i,testName:o,timer:s})},VV);e.expectations.set(i,[...e.expectations.get(i)??[],{headed:r,jobId:n,testName:o,timer:s}])}function GV({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)),Zi(e,t,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-error"},runId:"",testName:n}))}function qV(e,t){let r=ik(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)=>{Zi(e,r.jobId,{kind:"test-outcome",outcome:o,runId:i,testName:r.testName})},started:i=>{Zi(e,r.jobId,{kind:"test-started",runId:i,testName:r.testName})}}}function KV(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 YV({config:e,cwd:t,message:r}){return(await yh(t)).match(i=>JV({config:e,cwd:t,lockfile:i,message:r}),i=>Promise.resolve({error:{code:"compile-failed",detail:i.kind,diagnostics:[...KV(i)]},kind:"error"}))}async function JV({config:e,cwd:t,lockfile:r,message:n}){let i=await ZV({config:e,cwd:t,lockfile:r});return i!=null?{error:{code:"sync-failed",detail:i},kind:"error"}:Jx({all:n.all,ids:n.tests,lockfile:r}).match(async o=>({kind:"ready",testNames:o,workflowIdsBySlug:await eB(e,t)}),o=>Promise.resolve({error:XV(o),kind:"error"}))}async function ZV(e){try{return await Rr(e),null}catch(t){return t instanceof Error?t.message:String(t)}}function XV(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 QV=ek(`
382
+ query DaemonWorkflows($projectId: String!, $cwd: String!) {
579
383
  project(id: $projectId) {
580
384
  id
581
385
  devSession(cwd: $cwd) {
582
386
  id
583
- scopeItems {
387
+ workflows {
584
388
  id
585
- label
586
- source
587
- workflow {
588
- id
589
- slug
590
- name
591
- spec
592
- }
389
+ slug
593
390
  }
594
391
  }
595
392
  }
596
393
  }
597
- `);async function _s({all:e,ids:r}){e&&r.length>0&&(process.stderr.write(`Pass either --all or test ids, not both.
598
- `),process.exit(1));let t=de();await he(t);let n=await Nh({all:e,cwd:t.cwd,ids:r});n==null&&process.exit(1);let{results:o,summary:i}=await ct({config:t,ids:n,presynced:void 0});process.stdout.write(`${i}
599
- `);let s=o.filter(l=>l.summary.includes("FAILED")||l.summary.includes("ERROR")),a=s.map(l=>l.runId).filter(l=>l.length>0);if(a.length>0){let l=a.map(c=>`.ripplo/debug/${c}/`).join(", ");process.stderr.write(`Artifacts in ${l} \u2014 read before re-running.
600
- `),process.stderr.write(`${w("debug")}
601
- `)}process.exit(s.length>0?1:0)}async function Nh({all:e,cwd:r,ids:t}){return t.length>0?t:e?[]:Dh(r)}async function Dh(e){let r=de(),t=await x(e);if(t.ok){let{addedSlugs:a}=await nr({compileResult:t,cwd:e});a.length>0&&process.stdout.write(`Auto-scoped ${a.join(", ")} (dirty tests).
602
- `)}let o=(await h({config:r,document:dt,variables:{cwd:r.cwd,projectId:r.projectId}})).project?.devSession?.scopeItems??[],i=o.flatMap(a=>a.workflow!=null&&a.workflow.spec!=null?[a.workflow.slug]:[]),s=o.flatMap(a=>a.workflow==null?[`[intent] ${a.label??"(no label)"}`]:a.workflow.spec==null?[`[stub] ${a.workflow.slug}`]:[]);return s.length>0&&process.stdout.write(`Skipped non-runnable scope items: ${s.join(", ")}
603
- `),i.length===0?(process.stderr.write("No runnable tests in scope. Add tests with `ripplo scope add <id>`, or run the full suite with `ripplo run --all`.\n"),process.stderr.write(`${w("scope")}
604
- `),null):i}async function Us(){let e=process.cwd(),r=W(e);try{let t=await ye(r.cwd,r),n=t.compiled.tests.length,o=Object.keys(t.compiled.preconditions).length;process.stdout.write(`synced ${String(n)} tests, ${String(o)} preconditions to dev session ${t.devSessionId}
605
- `)}catch(t){let n=t instanceof Error?t.message:String(t);process.stderr.write(`ripplo sync failed: ${n}
606
- `),process.stderr.write(`${w("setup","verify auth + server reachability")}
607
- `),process.exit(1)}}import pt from"fs";import{createClient as Fh}from"graphql-sse";import Mh,{AbortError as Hh}from"p-retry";import{graphql as or}from"gql.tada";import{print as Hn}from"graphql";import Oh from"p-limit";var Lh=4,Vs=Oh(Lh),xr=new Set;function Mn(e){!Number.isFinite(e)||e<1||(Vs.concurrency=Math.floor(e),f.debug({concurrency:e},"Local executor concurrency set to %d",e))}var Ae;async function Fs(e){if(!xr.has(e.runId)){xr.add(e.runId),f.debug({inflight:xr.size,runId:e.runId},"run dispatched (inflight=%d)",xr.size);try{await Vs(()=>Uh(e))}finally{xr.delete(e.runId)}}}async function Ms(){if(Ae==null)return;let e=await Ae.catch(()=>{});Ae=void 0,e!=null&&e.isConnected()&&await e.close().catch(()=>{})}async function _h(){Ae??=Ue({headed:!1});let e=Ae,r=await e;return r.isConnected()?r:(Ae===e&&(Ae=Ue({headed:!1})),Ae)}async function Uh({config:e,cwd:r,runId:t,workflowSlug:n}){try{let o=await j({label:"getSharedBrowser",fn:()=>_h()}),i=await j({label:"resolvePreconditionNames",fn:async()=>{if(!(r==null||n==null))return Vh({cwd:r,workflowSlug:n})}});await an({baseUrl:e.appUrl,browser:o,config:e,headed:!1,preconditionNames:i,runId:t,webhookSecret:e.webhookSecret})}catch(o){f.error(o,"Runner error")}}async function Vh({cwd:e,workflowSlug:r}){let t=await x(e);if(!t.ok)return;let n=t.result.tests.find(o=>o.slug===r);if(n!=null)return n.preconditions}var Bh=6e4,Hs=100,Wh=15e3,qh=or(`
608
- subscription RunRequestedWatch($devSessionId: String!) {
609
- runRequested(devSessionId: $devSessionId) {
610
- runId
611
- workflowId
612
- workflowSlug
394
+ `);async function eB(e,t){let n=(await D({config:e,document:QV,variables:{cwd:t,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(n.map(i=>[i.slug,i.id]))}var tB=ek(`
395
+ mutation DaemonCreateRun($workflowId: String!) {
396
+ createRun(workflowId: $workflowId, executor: local) {
397
+ __typename
398
+ ... on Run {
399
+ id
400
+ }
401
+ }
402
+ }
403
+ `);async function rB(e){await e.testNames.reduce((t,r)=>t.then(()=>nB(e,r)),Promise.resolve())}async function nB(e,t){let{ctx:r,headed:n,jobId:i,token:o,workflowIdsBySlug:s}=e;if(o.isCancellationRequested)return;let a=Re(t),l=s.get(a);if(l==null){Zi(r,i,{kind:"test-outcome",outcome:{detail:"workflow-not-found",kind:"dispatch-error"},runId:"",testName:t});return}zV(r,{headed:n,jobId:i,slug:a,testName:t});let c=await iB(r.config,l);c!=null&&(ik(r,a),Zi(r,i,{kind:"test-outcome",outcome:{detail:c,kind:"dispatch-error"},runId:"",testName:t}))}async function iB(e,t){try{let n=(await D({config:e,document:tB,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 oB}from"zlib";import{promisify as sB}from"util";import{existsSync as aB,readFileSync as lB}from"fs";import sk from"path";import{graphql as Xi}from"gql.tada";function ok(e){return[e.kind,e.target,e.value].filter(t=>t.length>0).join(" ")}async function ak({config:e,cwd:t,headed:r,lockfile:n,runId:i,session:o,signal:s,test:a}){await bB(e,i);let l=sk.join(t,".ripplo","debug"),c=[];return(await o.runOnce({lockfile:n,options:{baseUrl:e.appUrl,engineUrl:e.engineUrl,generate:$c,headed:r,secret:e.webhookSecret},params:void 0,runId:i,testName:a.name,onEvent:d=>{c.push(d)}},s)).match(async d=>{await cB({config:e,debugDir:l,events:c,runId:i,test:a,total:d.fired.length});let p=lk(c).flatMap(h=>h.findings);return p.length>0?{findings:p,kind:"findings",runId:i}:{kind:"pass",runId:i}},async d=>(await Qi(e,i,ar(d)),{error:d,kind:"error",runId:i}))}async function cB({config:e,debugDir:t,events:r,runId:n,test:i}){let o=lk(r),s=uB(t,n);await Promise.all([fB({config:e,origin:s?.origin??0,records:o,runId:n,test:i}),s==null?Promise.resolve():gB(e,n,s)]),await yB(e,n,o)}function lk(e){return e.flatMap(t=>t.kind==="step"?[{endMs:t.endMs,findings:t.findings,index:t.index,startMs:t.startMs}]:[])}function uB(e,t){let r=sk.join(e,t,"behavior.jsonl");if(!aB(r))return null;let n=lB(r,"utf8").split(`
404
+ `).filter(o=>o.length>0).map(o=>dB(o)).flatMap(o=>pB(o)?[o.event]:[]),i=n[0];return i==null?null:{events:n,origin:i.timestamp}}function dB(e){return JSON.parse(e)}function pB(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}async function fB({config:e,origin:t,records:r,runId:n,test:i}){let o=r.map(s=>hB({origin:t,record:s,test:i}));await D({config:e,document:SB,variables:{items:[{runId:n,steps:o}]}})}function hB({origin:e,record:t,test:r}){let n=r.steps[t.index],i=n==null?null:Un(n,t.index);return{assertions:t.findings.map(o=>({description:ai(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)}`:ok(i),url:""}}var mB=sB(oB);async function Qi(e,t,r){await D({config:e,document:kB,variables:{reason:r,runId:t}}).catch(n=>{F.error(n,"failRun submission failed")})}async function gB(e,t,r){let n=r.events.map(s=>JSON.stringify(s)).join(`
405
+ `),i=await mB(Buffer.from(n,"utf8")),o=r.events.at(-1);await D({config:e,document:vB,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 yB(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:xB,variables:{items:[{duration:o,failCount:n,passCount:i,runId:t,status:n>0?"failed":"passed",summary:null,warnCount:0}]}})}async function bB(e,t){await D({config:e,document:wB,variables:{runIds:[t]}})}var wB=Xi(`
406
+ mutation StartRunsBatch($runIds: [String!]!) {
407
+ startRunsBatch(runIds: $runIds) {
408
+ id
613
409
  }
614
410
  }
615
- `),zh=or(`
411
+ `),SB=Xi(`
412
+ mutation SubmitRunStepsBatch($items: [SubmitRunStepsItem!]!) {
413
+ submitRunStepsBatch(items: $items)
414
+ }
415
+ `),vB=Xi(`
416
+ mutation SubmitRunRecordingChunk($input: SubmitRunRecordingChunkInput!) {
417
+ submitRunRecordingChunk(input: $input)
418
+ }
419
+ `),xB=Xi(`
420
+ mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
421
+ completeRunsBatch(items: $items) {
422
+ id
423
+ status
424
+ }
425
+ }
426
+ `),kB=Xi(`
427
+ mutation FailRun($runId: String!, $reason: String!) {
428
+ failRun(runId: $runId, reason: $reason)
429
+ }
430
+ `);import{createMessageConnection as ck,IPCMessageReader as uk,IPCMessageWriter as dk,NotificationType as CB,NotificationType0 as pk,RequestType as fk}from"vscode-jsonrpc/node";import{z as Z}from"zod";var hk=Z.object({headed:Z.boolean(),lockfileFingerprint:Z.string(),runId:Z.string().min(1),workflowSlug:Z.string().min(1)}),mk=Z.object({fingerprint:Z.string()}),Sre=Z.object({lockfileJson:Z.string().optional(),unavailable:Z.string().optional()}),RB=Z.enum(["unspecified","internal","server","client","producer","consumer"]),EB=Z.enum(["unset","ok","error"]),IB=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:RB,status:Z.object({code:EB,message:Z.union([Z.string(),Z.undefined()])}),timeNanos:Z.string(),traceId:Z.string()}),gk=Z.object({runId:Z.string().min(1),span:IB}),yk=Z.object({outcome:lf,serverNotified:Z.boolean()}),Ba=new pk("worker/ready"),Ua=new fk("worker/run"),Wa=new fk("worker/lockfile"),Ha=new CB("worker/span"),za=new pk("worker/shutdown");function bk(e){let t=ck(new uk(e),new dk(e));return t.listen(),t}function wk(){let e=ck(new uk(process),new dk(process));return e.listen(),e}function Sk(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 vk({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(`
431
+ `)}function xk(e){return`ripplo daemon: ready as local executor for session ${e} (sync happens on each \`ripplo run\`; Ctrl-C to stop)`}function kk({cwd:e,pid:t}){return`ripplo daemon: another daemon is already running for this project${t==null?"":` (pid ${String(t)})`} (cwd ${e}).`}function Ck(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project; shutting down."}function Rk(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 Ek(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:e.findings.map(t=>ai(t)),kind:"findings"};case"error":return{detail:ar(e.error),kind:"error"};case"dispatch-failed":return{detail:e.reason,kind:"dispatch-error"}}}async function Ik(){let e=process.cwd(),t=F.child({worker:process.pid}),r=wk(),n=of({debugDir:AB.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(Ua,async(s,a)=>{let l=hk.safeParse(s);if(!l.success)return Ga("bad-run-assign");let c=l.data;qr(e);let u=je(e).match(m=>m,m=>m.kind);if(typeof u=="string")return Ga(`config:${u}`);let d=await PB(c.lockfileFingerprint,i,r);if(d.isErr())return Ga(`lockfile-unavailable:${d.error}`);let p=d.value,h=p.tests.find(m=>Re(m.name)===c.workflowSlug);if(h==null)return Ga(`no-test:${c.workflowSlug}`);let f=await ak({config:u,cwd:e,headed:c.headed,lockfile:p,runId:c.runId,session:n,signal:Va(a),test:h});return{outcome:Ek(f),serverNotified:!0}}),r.onNotification(Ha,s=>{let a=gk.safeParse(s);a.success&&n.injectSpan(a.data.runId,a.data.span)}),r.onNotification(za,()=>{o(0)}),r.sendNotification(Ba),await new Promise(()=>{})}function Ga(e){return{outcome:{detail:e,kind:"error"},serverNotified:!1}}async function PB(e,t,r){return t.entry!=null&&t.entry.fingerprint===e?bf(t.entry.lockfile):(await TB(r,e)).andThen(i=>i.unavailable!=null?qa(i.unavailable):i.lockfileJson==null?qa("empty-reply"):OB(i.lockfileJson).map(o=>(t.entry={fingerprint:e,lockfile:o},o)))}async function TB(e,t){try{return bf(await e.sendRequest(Wa,{fingerprint:t}))}catch(r){return qa(`transport:${r instanceof Error?r.message:"unknown"}`)}}function OB(e){try{return bf(Nl(pt,e))}catch(t){return qa(`worker-decode-failed:${t instanceof Error?t.message.slice(0,200):"unknown"}`)}}async function Ak(){await Ik()}async function Pk(){let e=Dt();try{let r=(await Ji(e.cwd,e)).match(o=>o,o=>{process.stderr.write(`${Ge(o)}
432
+ `),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}
433
+ `)}catch(t){let r=t instanceof Error?t.message:String(t);process.stderr.write(`ripplo sync failed: ${r}
434
+ `),process.stderr.write(`${V("setup","verify auth + server reachability")}
435
+ `),process.exit(1)}}import uU from"path";import{createClient as dU}from"graphql-sse";import pU,{AbortError as fU}from"p-retry";import{graphql as Ja}from"gql.tada";import{print as hU}from"graphql";import MB from"fs";import Nk from"net";import{err as Lk,ok as NB}from"neverthrow";async function $k({cwd:e,onConnection:t}){Ot(e);let r=Ki(e),n=await Tk({onConnection:t,socketPath:r});return n.isOk()||n.error.kind!=="stale-candidate"?n.map(Ok(r)).mapErr(Mk(r)):await LB(r)?Lk({kind:"already-running",socketPath:r}):(Dk(r),(await Tk({onConnection:t,socketPath:r})).map(Ok(r)).mapErr(Mk(r)))}function LB(e){return new Promise(t=>{let r=Nk.connect(e);r.once("connect",()=>{r.destroy(),t(!0)}),r.once("error",()=>{t(!1)})})}async function Tk(e){let t=await $B(e);return t.kind==="listening"?NB(t.server):Lk(t.error)}function $B({onConnection:e,socketPath:t}){return new Promise(r=>{let n=Nk.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 Ok(e){return t=>({socketPath:e,close:()=>{t.close(),Dk(e)}})}function Dk(e){MB.rmSync(e,{force:!0})}function Mk(e){return t=>t.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:t.message}}import DB from"fs";import{lockSync as _B}from"proper-lockfile";var jB="explorer.lock",FB=15e3,VB=15e3;function BB(){return Ct(jB)}function _k({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=UB(r);o!=null&&(t.release=o,e(!0))};n();let i=setInterval(n,VB);return{holder:()=>t.release!=null,stop:()=>{t.stopped=!0,clearInterval(i),t.release?.(),t.release=null}}}function UB(e){try{Fn();let t=BB(),r=_B(t,{onCompromised:e,realpath:!1,stale:FB});return DB.writeFileSync(t,String(process.pid)),()=>{try{r()}catch{}}}catch{return null}}function WB(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 Vk(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:()=>{HB(t,e)},setExplorerHolder:r=>{t.holder=r,Ka(t,e)},stop:()=>{t.stopped=!0,t.cancelBackoffTimer?.(),t.cancelBackoffTimer=null,Bk(t,t.active.size)}}}function HB(e,t){let r=t.probe();r.interactiveActive<e.prevInteractiveActive&&zB(e,t),e.prevInteractiveActive=r.interactiveActive,Ka(e,t)}function zB(e,t){e.backoffUntil=t.now()+3e4,e.cancelBackoffTimer?.(),e.cancelBackoffTimer=t.setTimer(()=>{e.cancelBackoffTimer=null,Ka(e,t)},3e4)}function Ka(e,t){if(e.stopped)return;let r=t.probe(),n=WB({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});Bk(e,n.abortCount),Uk({count:n.refillCount,params:t,state:e})}function Bk(e,t){[...e.active.values()].slice(0,t).forEach(({controller:r})=>{r.abort()})}function Uk({count:e,params:t,state:r}){if(e<=0)return;let n=GB(t.sources);n!=null&&(qB({params:t,pulled:n,state:r}),Uk({count:e-1,params:t,state:r}))}function GB(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 qB({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(()=>{Fk({job:n,outcome:jk(o.signal,null),params:e,source:i,state:r})}).catch(s=>{Fk({job:n,outcome:jk(o.signal,{error:s}),params:e,source:i,state:r})})}function jk(e,t){return e.aborted?{kind:"aborted"}:t==null?{kind:"completed"}:{error:t.error,kind:"error"}}function Fk({job:e,outcome:t,params:r,source:n,state:i}){i.active.delete(e.id),n.onResult(e,t),Ka(i,r)}function wf(e){return{priority:e,next:()=>null,onResult:()=>{}}}function Wk(){return{priority:"p3",next:()=>null,onResult:()=>{}}}function Hk({explore:e}){let t=Vk({exploreEnabled:e,now:Date.now,probe:KB,setTimer:YB,sources:[wf("p0"),wf("p1"),Wk()],execute:({job:n,priority:i,signal:o})=>_a({headed:!1,workClass:JB(i),task:()=>n.run(o)})});hf(()=>{t.notifyQueueChange()});let r=e?_k({onChange:n=>{t.setExplorerHolder(n)}}):null;return{status:()=>({explorer:ZB({explore:e,holder:t.explorerHolder()}),exploring:t.explorationActive()}),stop:()=>{r?.stop(),t.stop(),hf(null)}}}function KB(){let e=Yi();return{headedActive:e.headedActive,interactiveActive:e.active,interactiveQueued:e.queued,poolSize:e.poolSize}}function YB(e,t){let r=setTimeout(e,t);return()=>{clearTimeout(r)}}function JB(e){switch(e){case"p0":return"p0-ui";case"p1":return"p1-cli";case"p2":return"p2-cover";case"p3":return"p3-explore"}}function ZB({explore:e,holder:t}){return e?t?"holder":"standby":"off"}async function zk({config:e,cwd:t,headed:r,pool:n,runId:i,signal:o,workClass:s,workflowSlug:a}){let{fingerprint:l,result:c}=await zn(t);if(c.isErr())return await Qi(e,i,`lockfile:${c.error.kind}`),{detail:`lockfile:${c.error.kind}`,kind:"dispatch-error"};if(c.value.tests.find(p=>Re(p.name)===a)==null)return await Qi(e,i,`no-test:${a}`),{detail:`no-test:${a}`,kind:"dispatch-error"};let d=await _a({headed:r,workClass:s,task:()=>n.execute({headed:r,lockfileFingerprint:l,runId:i,workflowSlug:a},o)});return!d.serverNotified&&d.outcome.kind==="error"&&await Qi(e,i,d.outcome.detail),d.outcome}import{fork as XB}from"child_process";import Gk from"os";import{CancellationTokenSource as QB,ResponseError as eU}from"vscode-jsonrpc/node";function Kk(e,t){return()=>{let r=XB(e,["run-worker"],{cwd:t,stdio:["ignore","inherit","inherit","ipc"]});return{connection:bk(r),kill:()=>{r.kill("SIGKILL")},onExit:n=>{r.once("exit",n)}}}}function Yk(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=>Sf(r,t)))},execute:(r,n)=>nU(r,n,t),routeSpan:(r,n)=>{let i=t.workers.find(o=>o.runId===r);i?.worker.connection.sendNotification(Ha,{runId:r,span:n})},setSize:r=>{aU(r,t)}}}var tU=1e4,rU=-32800;async function nU(e,t,r){let n=await iU(r);if(n.runId=e.runId,!n.alive)return qk(n,r),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let i=new QB,o=()=>{i.cancel()};t.aborted&&i.cancel(),t.addEventListener("abort",o,{once:!0});try{let s=await n.worker.connection.sendRequest(Ua,e,i.token),a=yk.safeParse(s);return a.success?a.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(s){return sU(s,n)}finally{t.removeEventListener("abort",o),i.dispose(),qk(n,r)}}async function iU(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=oU(e);return r.runId="pending",await r.ready,r}return new Promise(r=>{e.waiters.push(n=>{n.runId="pending",r(n)})})}function oU(e){let t=e.spawn(),r={resolve:()=>{}},n={alive:!0,id:e.nextId,ready:new Promise(i=>{r.resolve=i,t.connection.onNotification(Ba,i)}),runId:void 0,worker:t};return e.nextId+=1,t.connection.onRequest(Wa,async i=>{let o=mk.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 qk(e,t){if(e.runId=void 0,!e.alive||t.closed)return;if(t.workers.length>t.size){Sf(e,t);return}let r=t.waiters.shift();r?.(e)}async function Sf(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(za).catch(()=>{});let n=setTimeout(()=>{e.worker.kill()},tU);await r,clearTimeout(n)}function sU(e,t){return e instanceof eU&&e.code===rU?{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 aU(e,t){t.size=e,e>Gk.availableParallelism()&&F.warn({cores:Gk.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=>{Sf(i,t)})}import Ya from"fs";import{graphql as Jk}from"gql.tada";import{print as Zk}from"graphql";var lU=Jk(`
616
436
  subscription HooksPausedWatch($projectId: String!) {
617
437
  hooksPausedRequested(projectId: $projectId) {
618
438
  paused
619
439
  projectId
620
440
  }
621
441
  }
622
- `),Gh=or(`
442
+ `),cU=Jk(`
443
+ subscription WatchLocalConcurrencyChanged {
444
+ myMaxLocalConcurrentRunsChanged
445
+ }
446
+ `);function Xk({pool:e,sseClient:t}){return t.subscribe({query:Zk(cU)},{complete:()=>{},error:r=>{F.error(r,"localConcurrency subscription error")},next:r=>{let n=r.data?.myMaxLocalConcurrentRunsChanged;n!=null&&(ja(n),e.setSize(n))}})}function Qk({cwd:e,projectId:t,sseClient:r}){return r.subscribe({query:Zk(lU),variables:{projectId:t}},{complete:()=>{},error:n=>{F.error(n,"hooksPaused subscription error")},next:n=>{let i=n.data?.hooksPausedRequested?.paused;i!=null&&vf({cwd:e,paused:i})}})}function vf({cwd:e,paused:t}){let r=Cr(e);if(t&&!Ya.existsSync(r)){Ya.writeFileSync(r,"");return}!t&&Ya.existsSync(r)&&Ya.unlinkSync(r)}var mU=6e4,eC=100,gU=15e3,yU=Ja(`
447
+ subscription RunRequestedWatch($devSessionId: String!) {
448
+ runRequested(devSessionId: $devSessionId) {
449
+ runId
450
+ workflowId
451
+ workflowSlug
452
+ }
453
+ }
454
+ `),bU=Ja(`
623
455
  mutation HeartbeatDevSessionWatch($id: String!) {
624
456
  heartbeatDevSession(id: $id) {
625
457
  __typename
@@ -631,18 +463,14 @@ ${String(m)} error(s)
631
463
  }
632
464
  }
633
465
  }
634
- `),Kh=or(`
466
+ `),wU=Ja(`
635
467
  query WatchLocalConcurrency {
636
468
  currentUser {
637
469
  id
638
470
  maxLocalConcurrentRuns
639
471
  }
640
472
  }
641
- `),Jh=or(`
642
- subscription WatchLocalConcurrencyChanged {
643
- myMaxLocalConcurrentRunsChanged
644
- }
645
- `),Xh=or(`
473
+ `),SU=Ja(`
646
474
  mutation EndDevSessionWatch($projectId: String!, $cwd: String!) {
647
475
  endDevSession(projectId: $projectId, cwd: $cwd) {
648
476
  __typename
@@ -654,12 +482,36 @@ ${String(m)} error(s)
654
482
  }
655
483
  }
656
484
  }
657
- `);async function Bs(){sw();let e=nw(process.cwd()),r=e.cwd,t=tw(r),n=await x(r);n.ok||(process.stderr.write(`ripplo: DSL compilation failed: ${n.error}
658
- `),process.exit(1));let o=await qs(()=>Qe({compiled:n.result,config:e,cwd:r}),{config:e,label:"initial sync"});await aw(e),Ws({cwd:r,paused:o.hooksPaused});let i=at(r);i!=null&&f.info("watching branch %s in %s",i,r);let s=Fh({headers:{Authorization:`Bearer ${e.token}`},retryAttempts:1/0,url:`${e.ripploServerUrl}/graphql`}),a=rw({config:e,cwd:r,initialId:o.devSessionId,sseClient:s}),l=Zh({cwd:r,projectId:e.projectId,sseClient:s}),c=Qh({sseClient:s}),u=ew({config:e,session:a}),m=iw();process.stdout.write(`ripplo watch: ready as local executor for session ${o.devSessionId} (sync happens on each \`ripplo run\`; Ctrl-C to stop)
659
- `);let y=async()=>{u(),m(),a.stop(),l(),c(),await Promise.race([h({config:e,document:Xh,variables:{cwd:e.cwd,projectId:e.projectId}}).catch(()=>{}),new Promise(E=>setTimeout(E,3e3))]),await sn(),await Ms(),rn(),t()},R=()=>{y().finally(()=>process.exit(0))};process.on("SIGINT",R),process.on("SIGTERM",R),process.on("SIGHUP",R),process.on("SIGBREAK",R),await new Promise(()=>{})}function Yh({cwd:e,devSessionId:r,onReconnecting:t,sseClient:n}){return n.subscribe({query:Hn(qh),variables:{devSessionId:r}},{complete:()=>{},error:o=>{f.warn("runRequested SSE retries exhausted: %s",o instanceof Error?o.message:String(o))},next:o=>{let i=o.data?.runRequested;if(i==null)return;process.stdout.write(`ripplo: run ${i.workflowSlug}
660
- `);let s;try{Yr(e),s=W(e)}catch(a){f.error({err:a,runId:i.runId},"failed to load env for run dispatch; skipping");return}Fs({config:s,cwd:e,runId:i.runId,workflowId:i.workflowId,workflowSlug:i.workflowSlug}).catch(a=>{f.error({err:a,runId:i.runId,workflowSlug:i.workflowSlug},"run execution failed; watch continuing")})}},{connecting:o=>{o&&t()}})}function Ws({cwd:e,paused:r}){let t=Ce(e);if(r&&!pt.existsSync(t)){pt.writeFileSync(t,"");return}!r&&pt.existsSync(t)&&pt.unlinkSync(t)}function Qh({sseClient:e}){return e.subscribe({query:Hn(Jh)},{complete:()=>{},error:r=>{f.error(r,"localConcurrency subscription error")},next:r=>{let t=r.data?.myMaxLocalConcurrentRunsChanged;t!=null&&Mn(t)}})}function Zh({cwd:e,projectId:r,sseClient:t}){return t.subscribe({query:Hn(zh),variables:{projectId:r}},{complete:()=>{},error:n=>{f.error(n,"hooksPaused subscription error")},next:n=>{let o=n.data?.hooksPausedRequested?.paused;o!=null&&Ws({cwd:e,paused:o})}})}function ew({config:e,session:r}){let t=async()=>{try{let o=await h({config:e,document:Gh,variables:{id:r.getId()}});o.heartbeatDevSession?.__typename==="DevSessionEndedError"&&(f.warn("dev session ended server-side (%s); re-registering",o.heartbeatDevSession.message),await r.reregister())}catch(o){f.warn("heartbeat failed: %s",o instanceof Error?o.message:String(o))}},n=setInterval(()=>{t()},Wh);return()=>{clearInterval(n)}}function rw({config:e,cwd:r,initialId:t,sseClient:n}){let o=t,i=null,s=()=>{f.warn("runRequested SSE reconnecting; re-registering session"),u()},a=()=>Yh({cwd:r,devSessionId:o,onReconnecting:s,sseClient:n}),l=a(),c=async()=>{let m=await x(r);if(!m.ok){f.error("re-register: DSL compile failed: %s",m.error);return}let y=await qs(()=>Qe({compiled:m.result,config:e,cwd:r}),{config:e,label:"re-register sync"});l(),o=y.devSessionId,l=a(),f.info("re-registered dev session as %s",o)},u=()=>(i!=null||(i=c().finally(()=>{i=null})),i);return{reregister:u,getId:()=>o,stop:()=>{l()}}}function tw(e){try{return is(e)}catch(r){throw r instanceof Xe&&(process.stderr.write(`ripplo watch: another watcher is already running for this project (pid ${String(r.pid)}, cwd ${r.cwd}).
661
- `),process.exit(1)),r}}function nw(e){try{return W(e)}catch(r){let t=r instanceof Error?r.message:String(r);process.stderr.write(`${t}
662
- `),process.exit(1)}}function qs(e,{config:r,label:t}){let n=r.ripploServerUrl.includes("localhost")||r.ripploServerUrl.includes("127.0.0.1");return Mh(async()=>{try{return await e()}catch(o){let i=o instanceof Error?o.message:String(o);throw ow(i)?o:(f.error("%s failed: %s",t,i),new Hh(i))}},{factor:2,maxTimeout:n?2e3:1e4,minTimeout:n?100:1e3,retries:1/0,onFailedAttempt:({attemptNumber:o,error:i})=>{f.warn("%s attempt %d failed; retrying: %s",t,o,i.message)}})}function ow(e){return e.includes("status 502")||e.includes("ECONNREFUSED")||e.includes("Failed to connect")||e.includes("fetch failed")}function iw(){Tr({maxRuns:Hs});let e=setInterval(()=>{Tr({maxRuns:Hs})},Bh);return()=>{clearInterval(e)}}function sw(){process.on("unhandledRejection",e=>{f.error({err:e},"unhandledRejection in watch; continuing")}),process.on("uncaughtException",e=>{f.error({err:e},"uncaughtException in watch; continuing")})}async function aw(e){try{let t=(await h({config:e,document:Kh,variables:void 0})).currentUser?.maxLocalConcurrentRuns;t!=null&&Mn(t)}catch(r){f.warn({err:r},"failed to fetch local concurrency setting; using default")}}import{graphql as mt}from"gql.tada";var lw=mt(`
485
+ `);async function tC({explore:e}){OU();let t=AU(process.cwd()),r=t.cwd,n=CU(r),i=Hk({explore:e}),o={handler:()=>{}},s=EU(),a=tk({config:t,cwd:r,explorationStatus:i.status,ready:s.promise,onShutdownRequest:()=>{o.handler()}}),l=await IU({cwd:r,ipc:a,releasePid:n}),c=await be(r);c.isErr()&&(process.stderr.write(`ripplo: ${Oe(c.error)}
486
+ `),process.exit(1));let u=c.value,d=await rC(()=>Rr({config:t,cwd:r,lockfile:u}),{config:t,label:"initial sync"}),p=await NU(t);vf({cwd:r,paused:d.hooksPaused});let h=Fa(r);h!=null&&F.info("watching branch %s in %s",h,r);let f=dU({headers:{Authorization:`Bearer ${t.token}`},retryAttempts:1/0,url:`${t.ripploServerUrl}/graphql`}),m=Yk({initialSize:p,spawn:Kk(LU(),r),lockfileProvider:async E=>{let x=await zn(r);return x.result.isErr()?{unavailable:`daemon-load-failed:${x.result.error.kind}`}:x.fingerprint!==E?{unavailable:"fingerprint-mismatch"}:{lockfileJson:$t(pt,x.result.value)}}}),g=await ci({localDir:uU.join(r,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:E=>{let x=E.attributes["ripplo.run"];x!=null&&m.routeSpan(x,E)}}),w=kU({claim:a.claim,config:t,cwd:r,initialId:d.devSessionId,pool:m,sseClient:f}),S=Qk({cwd:r,projectId:t.projectId,sseClient:f}),y=Xk({pool:m,sseClient:f}),v=xU({config:t,session:w}),C=TU();s.resolve(),process.stdout.write(`${xk(d.devSessionId)}
487
+ `);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:SU,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 vU({claim:e,cwd:t,devSessionId:r,onReconnecting:n,pool:i,sseClient:o}){return o.subscribe({query:hU(yU),variables:{devSessionId:r}},{complete:()=>{},error:s=>{F.warn("runRequested SSE retries exhausted: %s",s instanceof Error?s.message:String(s))},next:s=>{let a=s.data?.runRequested;if(a==null)return;process.stdout.write(`ripplo: run ${a.workflowSlug}
488
+ `),qr(t);let l=je(t).match(u=>u,u=>{F.error({failure:u,runId:a.runId},"failed to load env for run dispatch; skipping")});if(l==null)return;let c=e(a.workflowSlug);c?.started(a.runId),zk({config:l,cwd:t,headed:c?.headed??!1,pool:i,runId:a.runId,signal:c==null?new AbortController().signal:Va(c.token),workClass:c==null?"p0-ui":"p1-cli",workflowSlug:a.workflowSlug}).then(u=>{c?.finished(a.runId,u)}).catch(u=>{F.error({err:u,runId:a.runId,workflowSlug:a.workflowSlug},"run execution failed; daemon continuing"),c?.finished(a.runId,{detail:u instanceof Error?u.message:String(u),kind:"error"})})}},{connecting:s=>{s&&n()}})}function xU({config:e,session:t}){let r=async()=>{try{let i=await D({config:e,document:bU,variables:{id:t.getId()}});i.heartbeatDevSession?.__typename==="DevSessionEndedError"&&(F.warn("dev session ended server-side (%s); re-registering",i.heartbeatDevSession.message),await t.reregister())}catch(i){F.warn("heartbeat failed: %s",i instanceof Error?i.message:String(i))}},n=setInterval(()=>{r()},gU);return()=>{clearInterval(n)}}function kU({claim:e,config:t,cwd:r,initialId:n,pool:i,sseClient:o}){let s=n,a=null,l=()=>{F.warn("runRequested SSE reconnecting; re-registering session"),p()},c=()=>vU({claim:e,cwd:r,devSessionId:s,onReconnecting:l,pool:i,sseClient:o}),u=c(),d=async()=>{let h=await be(r);if(h.isErr()){F.error("re-register: compile failed: %s",Oe(h.error));return}let f=await rC(()=>Rr({config:t,cwd:r,lockfile:h.value}),{config:t,label:"re-register sync"});u(),s=f.devSessionId,u=c(),F.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 CU(e){try{return Uh({cwd:e,onCompromised:RU})}catch(t){throw t instanceof qn&&(process.stderr.write(`${kk({cwd:t.cwd,pid:t.pid})}
489
+ `),process.exit(1)),t}}function RU(){F.error("daemon lock compromised; shutting down"),process.stderr.write(`${Ck()}
490
+ `),process.exit(1)}function EU(){let e={handler:()=>{}};return{promise:new Promise(r=>{e.handler=r}),resolve:()=>{e.handler()}}}async function IU({cwd:e,ipc:t,releasePid:r}){return(await $k({cwd:e,onConnection:t.handleConnection})).match(i=>i,i=>{process.stderr.write(`${Sk(i)}
491
+ `),r(),process.exit(1)})}function AU(e){return je(e).match(t=>t,t=>{process.stderr.write(`${Ge(t)}
492
+ `),process.exit(1)})}function rC(e,{config:t,label:r}){let n=t.ripploServerUrl.includes("localhost")||t.ripploServerUrl.includes("127.0.0.1");return pU(async()=>{try{return await e()}catch(i){let o=i instanceof Error?i.message:String(i);throw _n(i)==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${vk({projectId:t.projectId,serverUrl:t.ripploServerUrl})}
493
+ `),process.exit(1)),PU(o)?i:(F.error("%s failed: %s",r,o),new fU(o))}},{factor:2,maxTimeout:n?2e3:1e4,minTimeout:n?100:1e3,retries:1/0,onFailedAttempt:({attemptNumber:i,error:o})=>{F.warn("%s attempt %d failed; retrying: %s",r,i,o.message)}})}function PU(e){return e.includes("status 502")||e.includes("ECONNREFUSED")||e.includes("Failed to connect")||e.includes("fetch failed")}function TU(){io({maxRuns:eC});let e=setInterval(()=>{io({maxRuns:eC})},mU);return()=>{clearInterval(e)}}function OU(){process.on("unhandledRejection",e=>{F.error({err:e},"unhandledRejection in watch; continuing")}),process.on("uncaughtException",e=>{F.error({err:e},"uncaughtException in watch; continuing")})}var MU=4;async function NU(e){try{let r=(await D({config:e,document:wU,variables:void 0})).currentUser?.maxLocalConcurrentRuns;if(r!=null)return ja(r),r}catch(t){F.warn({err:t},"failed to fetch local concurrency setting; using default")}return MU}function LU(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}async function nC({explore:e}){await tC({explore:e})}import{graphql as Za}from"gql.tada";function iC(){return"No scope items added \u2014 the matched tests are already in scope (check `ripplo scope status`)."}function oC(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.",V("create")].join(`
494
+ `)}import{graphql as $U}from"gql.tada";var sC=$U(`
495
+ query ScopeStatus($projectId: String!, $cwd: String!) {
496
+ project(id: $projectId) {
497
+ id
498
+ devSession(cwd: $cwd) {
499
+ id
500
+ scopeItems {
501
+ id
502
+ label
503
+ source
504
+ workflow {
505
+ id
506
+ slug
507
+ name
508
+ spec
509
+ }
510
+ }
511
+ }
512
+ }
513
+ }
514
+ `);var DU=Za(`
663
515
  query ScopeWorkflowBySlug($projectId: String!, $cwd: String!, $slug: String!) {
664
516
  project(id: $projectId) {
665
517
  id
@@ -672,7 +524,7 @@ ${String(m)} error(s)
672
524
  }
673
525
  }
674
526
  }
675
- `),cw=mt(`
527
+ `),_U=Za(`
676
528
  mutation ScopeAddDirtyTests($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
677
529
  addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
678
530
  __typename
@@ -688,38 +540,57 @@ ${String(m)} error(s)
688
540
  ... on NoActiveDevSessionError {
689
541
  message
690
542
  }
543
+ ... on UnknownWorkflowSlugsError {
544
+ message
545
+ slugs
546
+ }
691
547
  }
692
548
  }
693
- `),uw=mt(`
549
+ `),jU=Za(`
694
550
  mutation ScopeLink($id: ID!, $workflowId: String!) {
695
551
  linkScopeItem(id: $id, workflowId: $workflowId) {
696
552
  id
697
553
  }
698
554
  }
699
- `),dw=mt(`
555
+ `),FU=Za(`
700
556
  mutation ScopeRemoveMany($ids: [ID!]!) {
701
557
  removeScopeItems(ids: $ids)
702
558
  }
703
- `);async function zs(e){let r=de();await he(r);let n=(await h({config:r,document:dt,variables:{cwd:r.cwd,projectId:r.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(n,null,2)}
704
- `);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(o=>{let i=o.workflow;if(i==null){process.stdout.write(` [intent] (${o.id}) ${o.label??""}
705
- `);return}let s=i.spec==null?"stub":"implemented";process.stdout.write(` [${s}] (${o.id}) ${i.slug} \u2014 ${i.name}
706
- `)})}async function Gs({testIds:e}){let r=de();await he(r),await ye(r.cwd,r);let n=(await h({config:r,document:cw,variables:{cwd:r.cwd,projectId:r.projectId,workflowSlugs:[...e]}})).addDirtyTestsToScope;n?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${n.message}
707
- `),process.exit(1));let o=n?.__typename==="MutationAddDirtyTestsToScopeSuccess"?n.data:[];if(o.length===0){process.stdout.write(`No scope items added.
708
- `);return}let i=o.map(s=>s.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${String(o.length)} scope item(s): ${i}
709
- `)}async function Ks({id:e,testId:r}){let t=de();await he(t),await ye(t.cwd,t);let n=await pw({cfg:t,slug:r});await h({config:t,document:uw,variables:{id:e,workflowId:n}}),process.stdout.write(`Linked scope item ${e} to ${r}
710
- `)}async function Js({ids:e}){let r=de();await he(r);let n=(await h({config:r,document:dw,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${String(n)} scope item(s)
711
- `)}async function pw({cfg:e,slug:r}){let n=(await h({config:e,document:lw,variables:{cwd:e.cwd,projectId:e.projectId,slug:r}})).project?.devSession?.workflows?.[0];return n==null&&(process.stderr.write(`No workflow found with id "${r}". Create a stub first via the testing DSL.
712
- `),process.stderr.write(`${w("create")}
713
- `),process.exit(1)),n.id}async function Xs(e){let r=process.cwd(),t=await x(r);t.ok||(process.stderr.write(`Compilation failed: ${t.error}
714
- `),process.exit(1));let{tests:n}=t.builder.getUnimplemented();if(e.format==="summary"){n.length>0&&process.stdout.write(`tests: ${n.join(", ")}
715
- `);return}let o={tests:n.map(i=>({id:i,implemented:!1}))};process.stdout.write(`${JSON.stringify(o,null,2)}
716
- `)}import{z as mw}from"zod";function I(e,r){let t=mw.custom(n=>typeof n=="object"&&n!==null&&"hook_event_name"in n&&n.hook_event_name===e);return{event:e,run:async n=>await r(t.parse(n))??void 0}}import{createHash as RI}from"crypto";import Ys from"picomatch";function fw(e){return K(["diff","--name-only","HEAD"],e).split(`
717
- `).filter(r=>r.length>0)}function Qs({cwd:e,ignoreGlobs:r,watchGlobs:t}){let n=Ys([...t]),o=Ys([...r]);return fw(e).filter(i=>n(i)&&!o(i))}function ft(e,...r){return K(["diff","--name-only","HEAD","--",...r],e).split(`
718
- `).filter(t=>t.length>0)}function Ie(){return{ignorePaths:xe,watchPaths:Cn}}var Zs=I("UserPromptSubmit",e=>{let{cwd:r}=e;if(!A(r)||!F(r))return;let t=Ee(r);if(Ze(r,"coverage-nudge")===t)return;let{ignorePaths:n,watchPaths:o}=Ie(),i=Qs({cwd:r,ignoreGlobs:n,watchGlobs:o});if(er(r,"coverage-nudge",t),!(i.length===0||ft(r,".ripplo/tests",".ripplo/preconditions",".ripplo/observers").length>0))return{hookSpecificOutput:{additionalContext:`SCOPE DRIFT: ${String(i.length)} app file(s) changed without .ripplo/tests updates. ${w("scope")}`,hookEventName:"UserPromptSubmit"}}});import gt from"fs";import gw from"os";import ea from"path";var ra=I("PreToolUse",e=>{if(e.tool_name!=="ExitPlanMode"||!F(e.cwd))return;let r=yw();if(r==null)return;let t=gt.readFileSync(r,"utf8");if(!/\.ripplo\/tests|Tests to implement|No e2e coverage needed/.test(t))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. ${w("explore")}`}}});function yw(){let e=ea.join(gw.homedir(),".claude","plans");return gt.existsSync(e)?gt.readdirSync(e).filter(t=>t.endsWith(".md")).map(t=>ea.join(e,t)).map(t=>({full:t,mtime:gt.statSync(t).mtimeMs})).sort((t,n)=>n.mtime-t.mtime)[0]?.full??null:null}var ta=I("UserPromptSubmit",async e=>{if(e.permission_mode!=="plan"||!A(e.cwd)||!F(e.cwd))return;let r=await x(e.cwd);if(!r.ok)return;let{tests:t}=r.builder.getUnimplemented(),n=['Plan must include "Tests to implement" with .ripplo/tests/<id>.ts per affected flow (ExitPlanMode blocks otherwise).'];return t.length>0&&n.push(`Existing stubs: ${t.join(", ")}`),{hookSpecificOutput:{additionalContext:n.join(`
719
- `),hookEventName:"UserPromptSubmit"}}});import hw from"path";import na from"picomatch";import{z as oa}from"zod";var ww=oa.looseObject({file_path:oa.string()}),ia=I("PostToolUse",async e=>{let r=ww.safeParse(e.tool_input);if(!r.success)return;let t=r.data.file_path,{cwd:n}=e;if(!A(n)||!F(n))return;let o=hw.relative(n,t);if(o.startsWith(".."))return;let{ignorePaths:i,watchPaths:s}=Ie(),a=na([...s]),l=na([...i]);if(!a(o)||l(o))return;let c=await x(n);if(!c.ok)return;let{tests:u}=c.builder.getUnimplemented();if(u.length!==0)return{hookSpecificOutput:{additionalContext:`Reminder: .notImplemented() stubs still present \u2014 tests: ${u.join(", ")}`,hookEventName:"PostToolUse"}}});import{z as sa}from"zod";var bw=sa.looseObject({file_path:sa.string()}),aa=I("PostToolUse",async e=>{let r=bw.safeParse(e.tool_input);if(!r.success)return;let t=r.data.file_path;if(!/\/\.ripplo\/.*\.ts$/.test(t))return;let{cwd:n}=e;if(!A(n))return;if(!F(n))return{hookSpecificOutput:{additionalContext:"Ripplo hooks are paused \u2014 DSL lint, lockfile sync, and coverage codegen did not run for this edit. Resume with `npx ripplo hooks resume` when ready.",hookEventName:"PostToolUse"}};let o=await x(n);return o.ok?(await ce({cwd:n,result:o.result}),Ge({cwd:n}),await vw({compileResult:o,cwd:n})):{decision:"block",reason:`Compilation failed: ${o.error}
720
- ${w("create","DSL authoring + lint rules")}`}});async function vw({compileResult:e,cwd:r}){let{diagnostics:t}=qe(e.result);if(t.length>0)return{decision:"block",reason:`${t.map(i=>{let s=i.step==null?"":` at "${i.step}"`;return` [${i.rule}]${s} ${i.test}: ${i.message}`}).join(`
721
- `)}
722
- ${w("create")}`};let{addedSlugs:n}=await nr({compileResult:e,cwd:r});if(n.length!==0)return{hookSpecificOutput:{additionalContext:`Auto-scoped ${n.join(", ")} (dirty tests).`,hookEventName:"PostToolUse"}}}import{z as la}from"zod";var Sw=la.looseObject({command:la.string()}),kw=/\bripplo\s+hooks\s+pause\b/,ca=I("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let r=Sw.safeParse(e.tool_input);if(!r.success||!kw.test(r.data.command))return;let{cwd:t}=e;if(A(t))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 watch 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 Cw}from"shell-quote";import{z as da}from"zod";import{existsSync as Pw,mkdirSync as Rw,rmSync as ST,writeFileSync as xw}from"fs";import Bn from"path";function yt(e,r,t){let n=ua(e,r,t);Rw(Bn.dirname(n),{recursive:!0}),xw(n,"")}function ht(e,r,t){return Pw(ua(e,r,t))}function Ew(e,r){return Bn.join(e,".ripplo",".local","skills-loaded",r)}function ua(e,r,t){return Bn.join(Ew(e,r),t)}var Aw=da.looseObject({command:da.string()}),Iw="debug",Tw=new Set(["tail","head","less","more","wc","sort","uniq","awk","sed","grep"]),ma=I("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let r=Aw.safeParse(e.tool_input);if(!r.success)return;let t=$w(r.data.command);if(!jw(t))return;let{cwd:n}=e;if(!A(n)||!F(n))return;if(!ht(n,e.session_id,Iw))return pa("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 i=Dw(t);if(i!=null)return pa(`Don't pipe \`ripplo run\` through \`${i}\` \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 $w(e){try{return Cw(e)}catch{return[]}}function jw(e){return e.some((r,t)=>r==="ripplo"&&e[t+1]==="run")}function Nw(e){return typeof e=="object"&&"op"in e&&e.op==="|"}function Dw(e){let r=e.find((t,n)=>{let o=e[n-1];return o!=null&&Nw(o)&&typeof t=="string"&&Tw.has(t)});return typeof r=="string"?r:null}function pa(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}import Ow from"path";import{z as fa}from"zod";var Lw=new Set(["Edit","Write","NotebookEdit"]),_w=fa.looseObject({file_path:fa.string()}),Uw="create",ga=I("PreToolUse",e=>{if(!Lw.has(e.tool_name))return;let r=_w.safeParse(e.tool_input);if(!r.success)return;let{cwd:t}=e;if(!A(t)||!F(t))return;let n=Ow.relative(t,r.data.file_path);if(!(n.startsWith("..")||n!==".ripplo"&&!n.startsWith(".ripplo/"))&&!ht(t,e.session_id,Uw))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 Vw from"path";import ya from"picomatch";import{graphql as Fw}from"gql.tada";import{z as ha}from"zod";var Mw=new Set(["Edit","Write","NotebookEdit"]),Hw=ha.looseObject({file_path:ha.string()}),Bw=Fw(`
559
+ `);async function aC(e){let t=Dt();await Gn(t);let n=(await D({config:t,document:sC,variables:{cwd:t.cwd,projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(n,null,2)}
560
+ `);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??""}
561
+ `);return}let s=o.spec==null?"stub":"implemented";process.stdout.write(` [${s}] (${i.id}) ${o.slug} \u2014 ${o.name}
562
+ `)})}async function lC({testIds:e}){let t=Dt();await Gn(t),(await Ji(t.cwd,t)).match(()=>{},a=>{process.stderr.write(`${Ge(a)}
563
+ `),process.exit(1)});let i=(await D({config:t,document:_U,variables:{cwd:t.cwd,projectId:t.projectId,workflowSlugs:e.map(a=>Re(a))}})).addDirtyTestsToScope;i?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${i.message}
564
+ `),process.exit(1)),i?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${oC(i.slugs)}
565
+ `),process.exit(1));let o=i?.__typename==="MutationAddDirtyTestsToScopeSuccess"?i.data:[];if(o.length===0){process.stdout.write(`${iC()}
566
+ `);return}let s=o.map(a=>a.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${String(o.length)} scope item(s): ${s}
567
+ `)}async function cC({id:e,testId:t}){let r=Dt();await Gn(r),(await Ji(r.cwd,r)).match(()=>{},o=>{process.stderr.write(`${Ge(o)}
568
+ `),process.exit(1)});let i=await VU({cfg:r,slug:t});await D({config:r,document:jU,variables:{id:e,workflowId:i}}),process.stdout.write(`Linked scope item ${e} to ${t}
569
+ `)}async function uC({ids:e}){let t=Dt();await Gn(t);let n=(await D({config:t,document:FU,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${String(n)} scope item(s)
570
+ `)}async function VU({cfg:e,slug:t}){let n=(await D({config:e,document:DU,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.
571
+ `),process.stderr.write(`${V("create")}
572
+ `),process.exit(1)),n.id}async function dC(e){let t=process.cwd(),r=await be(t);r.isErr()&&(process.stderr.write(`${Oe(r.error)}
573
+ `),process.exit(1));let n=Zt(r.value),i=await Wx(t);if(e.format==="summary"){n.length>0&&process.stdout.write(`stub tests: ${n.join(", ")}
574
+ `),process.stdout.write(`${Rk(i)}
575
+ `);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)}
576
+ `)}import Xa from"fs";import UU from"os";import pC from"path";import{z as BU}from"zod";function ue(e,t){let r=BU.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 fC=ue("PreToolUse",e=>{if(e.tool_name!=="ExitPlanMode"||!De(e.cwd))return;let t=WU();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. ${V("explore")}`,hookEventName:"PreToolUse"}};let r=Xa.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. ${V("explore")}`}}});function WU(){let e=pC.join(UU.homedir(),".claude","plans");return Xa.existsSync(e)?Xa.readdirSync(e).filter(r=>r.endsWith(".md")).map(r=>pC.join(e,r)).map(r=>({full:r,mtime:Xa.statSync(r).mtimeMs})).sort((r,n)=>n.mtime-r.mtime)[0]?.full??null:null}var hC=ue("UserPromptSubmit",async e=>{if(e.permission_mode!=="plan"||!ae(e.cwd)||!De(e.cwd))return;let t=await be(e.cwd);if(t.isErr())return;let r=Zt(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(`
577
+ `),hookEventName:"UserPromptSubmit"}}});import GU from"path";import mC from"picomatch";import{z as gC}from"zod";var HU=["**/src/**","**/app/**","**/apps/**","**/pages/**","**/routes/**","**/components/**","**/server/**","**/api/**","**/backend/**","**/features/**","**/modules/**","**/views/**","**/ui/**","**/hooks/**","**/contexts/**","**/providers/**","**/controllers/**","**/handlers/**","**/resolvers/**","**/services/**","**/middleware/**","**/lib/**"],zU=["**/*.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 Qa(){return{ignorePaths:zU,watchPaths:HU}}var qU=gC.looseObject({file_path:gC.string()}),yC=ue("PostToolUse",async e=>{let t=qU.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=GU.relative(n,r);if(i.startsWith(".."))return;let{ignorePaths:o,watchPaths:s}=Qa(),a=mC([...s]),l=mC([...o]);if(!a(i)||l(i))return;let c=await be(n);if(c.isErr())return;let u=Zt(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 nW}from"crypto";import{z as xC}from"zod";import{createHash as KU}from"crypto";import{mkdirSync as YU,readFileSync as bC,writeFileSync as JU}from"fs";import xf from"path";var ZU=[".ts",".tsx",".js",".jsx"];function el(e){let t=KU("sha256");return t.update(or(["rev-parse","HEAD"],e)),t.update("\0"),t.update(or(["diff","HEAD"],e)),t.update("\0"),or(["ls-files","--others","--exclude-standard"],e).split(`
578
+ `).filter(n=>n.length>0).filter(n=>ZU.some(i=>n.endsWith(i))).toSorted((n,i)=>n.localeCompare(i)).forEach(n=>{t.update(n),t.update("\0"),t.update(XU(xf.join(e,n))),t.update("\0")}),t.digest("hex")}function Ln(e,t){try{return bC(wC(e,t),"utf8").trim()}catch{return null}}function $n(e,t,r){let n=wC(e,t);YU(xf.dirname(n),{recursive:!0}),JU(n,r)}function XU(e){try{return bC(e)}catch{return Buffer.alloc(0)}}function wC(e,t){return xf.join(e,".ripplo",".local",`${t}.hash`)}import{graphql as QU}from"gql.tada";var eW=QU(`
579
+ mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
580
+ addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
581
+ __typename
582
+ ... on MutationAddDirtyTestsToScopeSuccess {
583
+ data {
584
+ id
585
+ }
586
+ }
587
+ }
588
+ }
589
+ `);async function vC({cwd:e,lockfile:t}){if(!De(e))return{addedSlugs:[]};let r=rW(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=>Re(l.name));if(i.length===0)return{addedSlugs:[]};let o=je(e).unwrapOr(void 0);return o==null?{addedSlugs:[]}:await Rr({config:o,cwd:e,lockfile:t}).catch(l=>(F.warn("auto-sync failed: %s",l instanceof Error?l.message:String(l)),null))==null?{addedSlugs:[]}:{addedSlugs:await tW({cfg:o,slugs:i})?i:[]}}async function tW({cfg:e,slugs:t}){let n=(await D({config:e,document:eW,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...t]}}).catch(i=>(F.warn("auto-scope failed: %s",i instanceof Error?i.message:String(i)),null)))?.addDirtyTestsToScope;return n?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:n.data.length>0}var SC=".ripplo/tests/";function rW(e){let t;try{t=or(["status","--porcelain","--",".ripplo/tests"],e)}catch{return[]}return t.split(`
590
+ `).map(r=>r.slice(3).trim()).filter(r=>r.startsWith(SC)&&r.endsWith(".ts")).map(r=>r.slice(SC.length)).filter(r=>r!=="index.ts"&&!r.endsWith("/index.ts"))}var iW=xC.looseObject({file_path:xC.string()}),kC=ue("PostToolUse",async e=>{let t=iW.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 Tn(r);if(n.isErr())return{decision:"block",reason:`${Oe(n.error)}
591
+ ${V("create","DSL authoring + lint rules")}`};let i=xr(n.value);if(i.length>0)return{decision:"block",reason:`${kr(i)}
592
+ ${V("create")}`};let{addedSlugs:o}=await vC({cwd:r,lockfile:n.value});return oW([...o.length>0?[`Auto-scoped ${o.join(", ")} (dirty tests).`]:[],...sW(r,n.value)])});function oW(e){if(e.length!==0)return{hookSpecificOutput:{additionalContext:e.join(`
593
+ `),hookEventName:"PostToolUse"}}}function sW(e,t){let r=Ea(t),n=nW("sha256").update(JSON.stringify(r)).digest("hex");return Ln(e,"coverage-warn")===n?[]:($n(e,"coverage-warn",n),r.length===0?[]:[ka(r)])}import{z as CC}from"zod";var aW=CC.looseObject({command:CC.string()}),lW=/\bripplo\s+hooks\s+pause\b/,RC=ue("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=aW.safeParse(e.tool_input);if(!t.success||!lW.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 fW}from"shell-quote";import{z as IC}from"zod";import{existsSync as cW,mkdirSync as uW,rmSync as voe,writeFileSync as dW}from"fs";import kf from"path";function tl(e,t,r){let n=EC(e,t,r);uW(kf.dirname(n),{recursive:!0}),dW(n,"")}function rl(e,t,r){return cW(EC(e,t,r))}function EC(e,t,r){return kf.join(pW(e,t),r)}function pW(e,t){return kf.join(e,".ripplo",".local","skills-loaded",t)}var hW=IC.looseObject({command:IC.string()}),mW="debug",gW=new Set(["tail","head","less","more","wc","sort","uniq","awk","sed","grep"]),PC=ue("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=hW.safeParse(e.tool_input);if(!t.success)return;let r=yW(t.data.command);if(!bW(r))return;let{cwd:n}=e;if(!ae(n)||!De(n))return;if(!rl(n,e.session_id,mW))return AC("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=SW(r);if(o!=null)return AC(`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 yW(e){try{return fW(e)}catch{return[]}}function bW(e){return e.some((t,r)=>t==="ripplo"&&e[r+1]==="run")}function wW(e){return typeof e=="object"&&"op"in e&&e.op==="|"}function SW(e){let t=e.find((r,n)=>{let i=e[n-1];return i!=null&&wW(i)&&typeof r=="string"&&gW.has(r)});return typeof t=="string"?t:null}function AC(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}import vW from"path";import{z as TC}from"zod";var xW=new Set(["Edit","Write","NotebookEdit"]),kW=TC.looseObject({file_path:TC.string()}),CW="create",OC=ue("PreToolUse",e=>{if(!xW.has(e.tool_name))return;let t=kW.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!ae(r)||!De(r))return;let n=vW.relative(r,t.data.file_path);if(!(n.startsWith("..")||n!==".ripplo"&&!n.startsWith(".ripplo/"))&&!rl(r,e.session_id,CW))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 RW from"path";import MC from"picomatch";import{graphql as EW}from"gql.tada";import{z as NC}from"zod";var IW=new Set(["Edit","Write","NotebookEdit"]),AW=NC.looseObject({file_path:NC.string()}),PW=EW(`
723
594
  query PreEditScopeGate($projectId: String!, $cwd: String!) {
724
595
  project(id: $projectId) {
725
596
  id
@@ -731,9 +602,9 @@ ${w("create")}`};let{addedSlugs:n}=await nr({compileResult:e,cwd:r});if(n.length
731
602
  }
732
603
  }
733
604
  }
734
- `),wa=I("PreToolUse",async e=>{if(!Mw.has(e.tool_name))return;let r=Hw.safeParse(e.tool_input);if(!r.success)return;let{cwd:t}=e;if(!A(t)||!F(t))return;let n=Vw.relative(t,r.data.file_path);if(n.startsWith("..")||n===".ripplo"||n.startsWith(".ripplo/")||!Ww(n))return;let o=await qw(t);return o.populated?o.degradedReason!=null?{hookSpecificOutput:{additionalContext:`Scope check skipped (${o.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). ${Gi(["scope","create"])}`}}});function Ww(e){let{ignorePaths:r,watchPaths:t}=Ie(),n=ya([...t]),o=ya([...r]);return n(e)&&!o(e)}async function qw(e){let r;try{r=W(e)}catch{return{degradedReason:"no project config \u2014 `ripplo init` not run here",populated:!0}}let t=await h({config:r,document:Bw,variables:{cwd:r.cwd,projectId:r.projectId}}).catch(()=>null);return t==null?{degradedReason:"server unreachable",populated:!0}:{degradedReason:null,populated:(t.project?.devSession?.scopeItems??[]).length>0}}import zw from"fs";import Gw from"path";import{z as ba}from"zod";var Kw=new Set(["Edit","Write","NotebookEdit"]),Jw=ba.looseObject({file_path:ba.string()}),va=I("PreToolUse",async e=>{if(!Kw.has(e.tool_name))return;let r=Xw(e);if(r==null)return;let{cwd:t}=e;if(zw.existsSync(Ce(t))||Ye(t))return;let n=await x(t);return n.ok?{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`\`ripplo watch\` is not running, so this edit to \`${r}\` won't sync to the server and dev-mode guardrails won't fire. Run \`/ripplo:start\` (or spawn \`npx ripplo watch\` 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 watch 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. ${w("start")}`}}:{hookSpecificOutput:{additionalContext:`\`ripplo watch\` isn't running and the DSL is currently failing to compile, so the watch gate is letting this edit through \u2014 fix the compile error before relying on dev-mode guardrails. Compile error:
735
- ${n.error}
736
- ${w("create","DSL authoring + lint rules")}`,hookEventName:"PreToolUse"}}});function Xw(e){let r=Jw.safeParse(e.tool_input);if(!r.success||!A(e.cwd))return null;let t=Gw.relative(e.cwd,r.data.file_path);return t.startsWith("..")||t!==".ripplo"&&!t.startsWith(".ripplo/")?null:t}import{graphql as Yw}from"gql.tada";var Qw=Yw(`
605
+ `),LC=ue("PreToolUse",async e=>{if(!IW.has(e.tool_name))return;let t=AW.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!ae(r)||!De(r))return;let n=RW.relative(r,t.data.file_path);if(n.startsWith("..")||n===".ripplo"||n.startsWith(".ripplo/")||!TW(n))return;let i=await OW(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). ${wh(["scope","create"])}`}}});function TW(e){let{ignorePaths:t,watchPaths:r}=Qa(),n=MC([...r]),i=MC([...t]);return n(e)&&!i(e)}async function OW(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:PW,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 MW from"fs";import NW from"path";import{z as $C}from"zod";var LW=new Set(["Edit","Write","NotebookEdit"]),$W=$C.looseObject({file_path:$C.string()}),DC=ue("PreToolUse",async e=>{if(!LW.has(e.tool_name))return;let t=DW(e);if(t==null)return;let{cwd:r}=e;if(MW.existsSync(Cr(r))||Zr(r))return;let n=await be(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:
606
+ ${Oe(n.error)}
607
+ ${V("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. ${V("start")}`}}});function DW(e){let t=$W.safeParse(e.tool_input);if(!t.success||!ae(e.cwd))return null;let r=NW.relative(e.cwd,t.data.file_path);return r.startsWith("..")||r!==".ripplo"&&!r.startsWith(".ripplo/")?null:r}import{graphql as _W}from"gql.tada";var jW=_W(`
737
608
  query ScopeReminder($projectId: String!, $cwd: String!) {
738
609
  project(id: $projectId) {
739
610
  id
@@ -750,9 +621,9 @@ ${w("create","DSL authoring + lint rules")}`,hookEventName:"PreToolUse"}}});func
750
621
  }
751
622
  }
752
623
  }
753
- `),Sa=I("UserPromptSubmit",async e=>{let{cwd:r}=e;if(!A(r)||!F(r))return;let t=Ee(r);if(Ze(r,"scope-reminder")===t)return;let n;try{n=W(r)}catch{return}let o=await h({config:n,document:Qw,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null);if(o==null)return;er(r,"scope-reminder",t);let i=o.project?.devSession?.scopeItems??[];return{hookSpecificOutput:{additionalContext:i.length===0?`RIPPLO SCOPE: empty. ${w("scope")}`:`RIPPLO SCOPE (${String(i.length)}):
754
- ${i.map(a=>{let l=a.workflow;return l==null?` [intent] (${a.id}) ${a.label??""}`:` [${l.spec==null?"stub":"implemented"}] (${a.id}) ${l.slug}`}).join(`
755
- `)}`,hookEventName:"UserPromptSubmit"}}});var Zw="# 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: precondition isolation, observer budget tiers, coverage IDs, 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, cleared coverage gates without proof, 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- Load `/ripplo:flake-detect` skill for instructions on intermittent failures; parallelizes N runs (only use with evidence of flake).\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 watch` (run `/ripplo:start` to spawn it, or invoke it directly via Bash with `run_in_background`), so the dev session is live. Without watch, scope/coverage hooks don't arm and `ripplo run` refuses to dispatch. Without the dev server, runs fail when they try to hit the app. `npx ripplo doctor` reports both.\n- **Two funnels.** Definitions \u2192 `createRipplo({ preconditions, observers, tests })` in `.ripplo/index.ts`. Implementations \u2192 `createEngine(ripplo, { preconditions, observers })` in your app server's `test/engine.ts`. 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 `.notImplemented()` tests. 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 `.notImplemented()` 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 (precondition, observer, engine impl) is in-scope work, not follow-up.\n- **`uiOnly: true` is not a stub.** Observer wiring is in-scope for mutation flows; don't use it to silence observer lint.\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 produce DOM, a11y tree, console, network, screenshots under `.ripplo/debug/<runId>/`. Read them. Never pipe `ripplo run` through `grep`/`tail`/`head`. Form a hypothesis citing an artifact line, 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 watch` (whether started via `/ripplo:start` or manually) talks to the wrong server, runs silently fail or hit the sibling worktree's app.\n- **DSL locators are semantic.** No `css` / `placeholder` / `waitFor` / `group`.\n- **New backend assertion?** Declare in `.ripplo/observers/index.ts`, implement in your app server's `engine.ts` (TS flags the missing impl).\n\n## Key files\n\n- `.ripplo/index.ts` \u2014 `createRipplo` call.\n- `.ripplo/{preconditions,observers,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- `packages/testing/README.md` (or the npm page for `@ripplo/testing`) \u2014 DSL reference.\n",ka=I("SessionStart",e=>{if(A(e.cwd))return{hookSpecificOutput:{additionalContext:Zw,hookEventName:"SessionStart"}}});import{execFileSync as eb}from"child_process";import rb from"path";import Pa from"process";import{graphql as tb}from"gql.tada";import{z as wt}from"zod";var nb=tb(`
624
+ `),_C=ue("UserPromptSubmit",async e=>{let{cwd:t}=e;if(!ae(t)||!De(t))return;let r=el(t);if(Ln(t,"scope-reminder")===r)return;let n=je(t).unwrapOr(void 0);if(n==null)return;let i=await D({config:n,document:jW,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null);if($n(t,"scope-reminder",r),i==null)return{hookSpecificOutput:{additionalContext:`RIPPLO SCOPE: unknown \u2014 server unreachable, scope guardrails are not enforcing. Check the dev session (\`npx ripplo doctor\`). ${V("start")}`,hookEventName:"UserPromptSubmit"}};let o=i.project?.devSession?.scopeItems??[];return{hookSpecificOutput:{additionalContext:o.length===0?`RIPPLO SCOPE: empty. ${V("scope")}`:`RIPPLO SCOPE (${String(o.length)}):
625
+ ${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(`
626
+ `)}`,hookEventName:"UserPromptSubmit"}}});var FW="# 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",jC=ue("SessionStart",e=>{if(ae(e.cwd))return{hookSpecificOutput:{additionalContext:FW,hookEventName:"SessionStart"}}});import{execFileSync as VW}from"child_process";import FC from"process";import{graphql as BW}from"gql.tada";import{z as nl}from"zod";var UW=BW(`
756
627
  query ScopeEnforce($projectId: String!, $cwd: String!) {
757
628
  project(id: $projectId) {
758
629
  id
@@ -771,43 +642,51 @@ ${i.map(a=>{let l=a.workflow;return l==null?` [intent] (${a.id}) ${a.label??""}
771
642
  }
772
643
  }
773
644
  }
774
- `),xa=I("Stop",async e=>{let{cwd:r}=e;if(!A(r)||!F(r))return;let t=Ee(r),n=Ze(r,"stop-enforce")===t;if(n&&!e.stop_hook_active)return;let o=ob(r),i=await ib(r,o);if(er(r,"stop-enforce",t),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:
645
+ `),BC=ue("Stop",async e=>{let{cwd:t}=e;if(!ae(t)||!De(t))return;let r=el(t),n=Ln(t,"stop-enforce")===r;if(n&&!e.stop_hook_active)return;let i=await WW(t);if($n(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:
775
646
  ${i.join(`
776
647
 
777
648
  `)}`}:{decision:"block",reason:i.join(`
778
649
 
779
- `)}});function ob(e){return ft(e,".ripplo/tests").filter(r=>r.endsWith(".ts")).map(r=>rb.basename(r,".ts")).filter(r=>r!=="index")}async function ib(e,r){let t=await x(e);if(!t.ok)return[`--- Compilation failed ---
780
- ${t.error}
781
- ${w("create")}`];await ce({cwd:e,result:t.result}),Ge({cwd:e});let n=await ab(e),o=lb(t,r),i=cb(t),s=sb(e,t),l=r.length>0||n.hasRunnable?ub(e):null;return[o,i,s,l,n.error].filter(c=>c!=null)}function sb(e,r){let{ignorePaths:t}=Ie(),n=Xi({compileResult:r.result,cwd:e,ignorePaths:t});if(n.length===0)return null;let o=n.filter(a=>a.kind==="unacknowledged"),i=n.filter(a=>a.kind==="stale"),s=[];if(o.length>0){let a=o.map(l=>` ${l.id}`).join(`
782
- `);s.push(`Unacknowledged interactions (add to a test's .coverage(...)):
783
- ${a}`)}if(i.length>0){let a=i.map(l=>` ${l.id}`).join(`
784
- `);s.push(`Stale .coverage(...) claims (id no longer exists in source):
785
- ${a}`)}return`--- Exhaustiveness ---
786
- ${s.join(`
787
-
788
- `)}
789
- ${w("create")}`}async function ab(e){let r;try{r=W(e)}catch{return{error:null,hasRunnable:!1}}let n=(await h({config:r,document:nb,variables:{cwd:r.cwd,projectId:r.projectId}}).catch(()=>null))?.project?.devSession?.scopeItems??[],o=n.flatMap(a=>{let l=a.workflow;return l==null?[` [intent] ${a.label??"(no label)"} \u2014 stub a test for this flow`]:l.spec==null?[` [stub] ${l.slug} \u2014 implement \`${l.name}\``]:[]}),i=n.some(a=>a.workflow?.spec!=null);return{error:o.length===0?null:`--- Testing Scope ---
790
- ${o.join(`
791
- `)}
792
- ${w("create")}`,hasRunnable:i}}function lb(e,r){let{diagnostics:t}=qe(e.result),n=new Set(e.builder.getUnimplemented().tests),o=r.filter(a=>n.has(a));if(t.length===0&&o.length===0)return null;let i=t.map(a=>{let l=a.step==null?"":` at "${a.step}"`;return` [${a.rule}]${l} ${a.test}: ${a.message}`}),s=o.map(a=>` [not-implemented] ${a} is still marked .notImplemented()`);return`--- Ripplo Lint ---
793
- ${[...i,...s].join(`
650
+ `)}});async function WW(e){let t=await Tn(e);if(t.isErr())return[`--- Compilation failed ---
651
+ ${Oe(t.error)}
652
+ ${V("create")}`];let r=t.value,n=await GW(e,r),i=HW(r),o=zW(r),s=n.hasRunnable?KW(e):null;return[i,o,s,n.error].filter(a=>a!=null)}function HW(e){let t=xr(e);return t.length===0?null:`--- Ripplo Lint ---
653
+ ${kr(t)}
654
+ ${V("create")}`}function zW(e){let t=Zt(e);return t.length===0?null:`--- Unimplemented stubs ---
655
+ ${t.join(", ")}
656
+ 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.
657
+ ${V("create")}`}async function GW(e,t){let r=new Set(Zt(t).map(d=>Re(d))),n=new Set(t.tests.map(d=>Re(d.name))),i=(d,p)=>n.has(d)?r.has(d):qW(p),o=je(e).unwrapOr(void 0);if(o==null)return{error:`--- Testing Scope (NOT CHECKED) ---
658
+ No project config \u2014 \`ripplo init\` hasn't run here, so scope/stub done-checks are not enforcing. ${V("setup")}`,hasRunnable:!1};let s=await D({config:o,document:UW,variables:{cwd:o.cwd,projectId:o.projectId}}).catch(()=>null);if(s==null)return{error:`--- Testing Scope (NOT CHECKED) ---
659
+ Ripplo server unreachable \u2014 scope/stub done-checks are not enforcing. Verify the dev session is live (\`npx ripplo doctor\`, ${V("start")}) before declaring work done.`,hasRunnable:!1};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.some(d=>d.workflow!=null&&!i(d.workflow.slug,d.workflow.spec));return{error:l.length===0?null:`--- Testing Scope ---
660
+ ${l.join(`
794
661
  `)}
795
- ${w("create")}`}function cb(e){let{tests:r}=e.builder.getUnimplemented();return r.length===0?null:`--- Unimplemented stubs ---
796
- ${r.join(", ")}
797
- Implement the stub now. Do not ask the user "implement or defer?" \u2014 that framing is forbidden by /ripplo:create. New scaffolding (precondition, observer, engine impl) is in-scope, not follow-up.
798
- ${w("create")}`}function ub(e){let r=pb(["run"],e);if(r.code===0)return null;let t=r.output.split(`
662
+ ${V("create")}`,hasRunnable:c}}function qW(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"stub")===!0}function KW(e){let t=JW(["run"],e);if(t.code===0)return null;let r=t.output.split(`
799
663
  `).filter(n=>/FAILED/.test(n)).join(`
800
- `);return t.length===0?null:`--- Ripplo Run Failures (scope) ---
801
- ${t}
802
- Artifacts: .ripplo/debug/<runId>/. ${w("debug")}`}var db=wt.object({status:wt.number().nullish(),stderr:wt.unknown().optional(),stdout:wt.unknown().optional()});function Ra(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function pb(e,r){let t=Pa.argv[1];if(t==null)return{code:1,output:""};try{return{code:0,output:eb(Pa.execPath,[t,...e],{cwd:r,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(n){let o=db.safeParse(n);if(!o.success)return{code:1,output:""};let i=`${Ra(o.data.stdout)}${Ra(o.data.stderr)}`;return{code:o.data.status??1,output:i}}}import{z as Ea}from"zod";var mb=Ea.looseObject({skill:Ea.string()}),Ca=I("PostToolUse",e=>{if(e.tool_name!=="Skill")return;let r=mb.safeParse(e.tool_input);if(!r.success)return;let t=/^ripplo:(.+)$/.exec(r.data.skill);if(t==null)return;let n=t[1];n!=null&&A(e.cwd)&&yt(e.cwd,e.session_id,n)});var fb=/(?:^|\s)\/ripplo:([a-z][a-z0-9-]*)\b/gi,Aa=I("UserPromptSubmit",e=>{A(e.cwd)&&[...e.prompt.matchAll(fb)].map(r=>r[1]).filter(r=>r!=null).forEach(r=>{yt(e.cwd,e.session_id,r)})});Rb();Yr(process.cwd());Ut();var Ia={"coverage-nudge":Zs,"exit-plan-gate":ra,"plan-reminder":ta,"post-edit-flag-stubs":ia,"post-edit-lint":aa,"pre-bash-hooks-pause-gate":ca,"pre-bash-run-gate":ma,"pre-edit-ripplo-skill-gate":ga,"pre-edit-scope-gate":wa,"pre-edit-watch-gate":va,"scope-reminder":Sa,"session-preamble":ka,"stop-enforce":xa,"track-skill-load":Ca,"track-skill-prompt":Aa};async function hb(){await gb(yb(process.argv)).scriptName("ripplo").version("0.6.1").command("watch","Watch for run requests and execute locally",()=>{},()=>Bs()).command("auth <subcommand>","Manage authentication",Pb).command("projects <subcommand>","Inspect Ripplo projects",kb).command("hooks <subcommand>","Pause or resume Ripplo hooks",Sb).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=>Ts({appUrl:e["app-url"],engineUrl:e["engine-url"],envFile:e.env,projectId:e.project})).command("run [ids..]","Run tests (defaults to scope; auto-adds dirty tests)",e=>{let r=[];return e.positional("ids",{array:!0,default:r,describe:"Test ids to run (defaults to dev-session scope)",type:"string"}).option("all",{default:!1,describe:"Run every test in the dev session (expensive)",type:"boolean"})},e=>_s({all:e.all,ids:e.ids})).command("lint [ids..]","Compile and lint tests (all or specific ids)",e=>{let r=[];return e.positional("ids",{array:!0,default:r,describe:"Test ids to lint (all if omitted)",type:"string"}).option("require-implemented",{array:!0,default:r,describe:"Test ids that must not be .notImplemented() \u2014 fails if any still are",type:"string"})},e=>Os({ids:e.ids,requireImplemented:e["require-implemented"]})).command("flake-detect <id>","Run N times to detect flakiness",e=>e.positional("id",{demandOption:!0,type:"string"}).option("runs",{default:10,type:"number"}),e=>ks({id:e.id,runs:e.runs})).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>Us()).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=>Ji({check:e.check})).command("cover","Audit all coverage statements",()=>{},()=>es()).command("doctor","Check project health",()=>{},()=>gs()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Xs({format:e.format})).command("scope <subcommand>","Manage testing scope",vb).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(Ia),demandOption:!0,type:"string"}),e=>wb(e.name)).strict().help().parse()}async function wb(e){let r=Ia[e];r==null&&(process.stderr.write(`Unknown hook: ${e}
803
- `),process.exit(1));let t=await bb(),n=t.trim()===""?{}:JSON.parse(t),o=await r.run(n);o!=null&&process.stdout.write(JSON.stringify(o))}function bb(){return new Promise((e,r)=>{if(process.stdin.isTTY){e("");return}let t=[];process.stdin.on("data",n=>t.push(n)),process.stdin.on("end",()=>{e(Buffer.concat(t).toString("utf8"))}),process.stdin.on("error",r)})}hb().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
804
- `),process.exit(1)});function vb(e){return e.command("status","Print the current scope",r=>r.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),r=>zs({format:r.format})).command("add <test-ids..>","Bind one or more existing tests (stubs or implemented) to scope as agent intent",r=>{let t=[];return r.positional("test-ids",{array:!0,default:t,demandOption:!0,describe:"Slugs of existing workflows",type:"string"})},r=>Gs({testIds:r["test-ids"]})).command("link <id> <test-id>","Link an existing scope item to a test",r=>r.positional("id",{demandOption:!0,describe:"Scope item id",type:"string"}).positional("test-id",{demandOption:!0,describe:"Slug of the workflow to link",type:"string"}),r=>Ks({id:r.id,testId:r["test-id"]})).command("remove <ids..>","Remove one or more scope items by id",r=>{let t=[];return r.positional("ids",{array:!0,default:t,demandOption:!0,describe:"Scope item ids",type:"string"})},r=>Js({ids:r.ids})).demandCommand(1)}function Sb(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>Ps()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>Rs()).demandCommand(1)}function kb(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>Ls()).demandCommand(1)}function Pb(e){return e.command("login","Authenticate via device flow",()=>{},()=>pi()).command("status","Show authentication status",()=>{},()=>mi()).command("logout","Remove the saved token",()=>{},()=>{fi()}).demandCommand(1)}function Rb(){let e=process.cwd(),r=Pt(e);r!=null&&r!==e&&(process.chdir(r),process.stderr.write(`ripplo: resolved .ripplo/ at ${r}
805
- `))}export{hb as main};
664
+ `);if(r.length===0){let n=t.output.split(`
665
+ `).filter(Boolean).slice(-15).join(`
666
+ `);return`--- Ripplo Run Could Not Execute ---
667
+ \`ripplo run\` exited ${String(t.code)} without test results \u2014 the scoped tests were NOT verified. Output tail:
668
+ ${n}
669
+ Fix the run environment (daemon, dev server, auth \u2014 \`npx ripplo doctor\`) and re-run before declaring work done. ${V("start")}`}return`--- Ripplo Run Failures (scope) ---
670
+ ${r}
671
+ Artifacts: .ripplo/debug/<runId>/. ${V("debug")}`}var YW=nl.object({status:nl.number().nullish(),stderr:nl.unknown().optional(),stdout:nl.unknown().optional()});function VC(e){return e instanceof Buffer?e.toString("utf8"):typeof e=="string"?e:""}function JW(e,t){let r=FC.argv[1];if(r==null)return{code:1,output:""};try{return{code:0,output:VW(FC.execPath,[r,...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}}catch(n){let i=YW.safeParse(n);if(!i.success)return{code:1,output:""};let o=`${VC(i.data.stdout)}${VC(i.data.stderr)}`;return{code:i.data.status??1,output:o}}}import{z as UC}from"zod";var ZW=UC.looseObject({skill:UC.string()}),WC=ue("PostToolUse",e=>{if(e.tool_name!=="Skill")return;let t=ZW.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)&&tl(e.cwd,e.session_id,n)});var XW=/(?:^|\s)\/ripplo:([a-z][a-z0-9-]*)\b/gi,HC=ue("UserPromptSubmit",e=>{ae(e.cwd)&&[...e.prompt.matchAll(XW)].map(t=>t[1]).filter(t=>t!=null).forEach(t=>{tl(e.cwd,e.session_id,t)})});cH();qr(process.cwd());pl();var zC={"exit-plan-gate":fC,"plan-reminder":hC,"post-edit-flag-stubs":yC,"post-edit-lint":kC,"pre-bash-hooks-pause-gate":RC,"pre-bash-run-gate":PC,"pre-edit-ripplo-skill-gate":OC,"pre-edit-scope-gate":LC,"pre-edit-watch-gate":DC,"scope-reminder":_C,"session-preamble":jC,"stop-enforce":BC,"track-skill-load":WC,"track-skill-prompt":HC};async function tH(){await QW(eH(process.argv)).scriptName("ripplo").version(Zf()).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=>nC({explore:e.explore})).command("concurrency [value]","Show or set max local concurrent runs (daemon applies live)",e=>e.positional("value",{type:"number"}),e=>jh({value:e.value})).command("auth <subcommand>","Manage authentication",lH).command("projects <subcommand>","Inspect Ripplo projects",aH).command("hooks <subcommand>","Pause or resume Ripplo hooks",sH).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=>Rx({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)",iH,e=>qx({all:e.all,headed:e.headed,ids:e.ids,keepAlive:e["keep-alive"]})).command("lint","Static model analysis (cascade gaps + law conflicts; no live app)",()=>{},()=>Ex()).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>Pk()).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=>Lh({check:e.check})).command("doctor","Check project health",()=>{},()=>mx()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>dC({format:e.format})).command("scope <subcommand>","Manage testing scope",oH).command("run-worker",!1,()=>{},()=>Ak()).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(zC),demandOption:!0,type:"string"}),e=>rH(e.name)).strict().help().parse()}async function rH(e){let t=zC[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
672
+ `),process.exit(1));let r=await nH(),n=r.trim()===""?{}:JSON.parse(r),i=await t.run(n);i!=null&&process.stdout.write(JSON.stringify(i))}function nH(){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)})}tH().catch(e=>{process.stderr.write(`${Ch(e)}
673
+ `),process.exit(1)});function iH(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 oH(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>aC({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=>lC({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=>cC({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=>uC({ids:t.ids})).demandCommand(1)}function sH(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>gx()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>yx()).demandCommand(1)}function aH(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>Ix()).demandCommand(1)}function lH(e){return e.command("login","Authenticate via device flow",()=>{},()=>Oh()).command("status","Show authentication status",()=>{},()=>Mh()).command("logout","Remove the saved token",()=>{},()=>{Nh()}).demandCommand(1)}function cH(){let e=process.cwd(),t=al(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
674
+ `))}export{tH as main};
806
675
  /*! Bundled license information:
807
676
 
808
- mustache/mustache.mjs:
809
- (*!
810
- * mustache.js - Logic-less {{mustache}} templates with JavaScript
811
- * http://github.com/janl/mustache.js
812
- *)
677
+ rrweb/dist/rrweb.js:
678
+ (*! *****************************************************************************
679
+ Copyright (c) Microsoft Corporation.
680
+
681
+ Permission to use, copy, modify, and/or distribute this software for any
682
+ purpose with or without fee is hereby granted.
683
+
684
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
685
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
686
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
687
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
688
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
689
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
690
+ PERFORMANCE OF THIS SOFTWARE.
691
+ ***************************************************************************** *)
813
692
  */