@checksum-ai/runtime 2.0.11 → 2.0.12-alpha
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/.env +1 -1
- package/cli.js +3 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
- package/pw-report-template.html +20 -20
- package/test-run-monitor.js +66 -66
- package/vtg-pw-bridge-runner.js +1 -1
package/vtg-pw-bridge-runner.js
CHANGED
|
@@ -630,7 +630,7 @@ Result: ${JSON.stringify(C)}`);else w=C;let k;s7e(t)&&(k=t.id),!k&&aQn(f)&&(k=f.
|
|
|
630
630
|
`+c),i.push(o+"m+"+ZVt.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=UEa()+t+" "+i[0]}e(jEa,"formatArgs");function UEa(){return RR.inspectOpts.hideDate?"":new Date().toISOString()+" "}e(UEa,"getDate");function qEa(...i){return process.stderr.write(XVt.formatWithOptions(RR.inspectOpts,...i)+`
|
|
631
631
|
`)}e(qEa,"log");function QEa(i){i?process.env.DEBUG=i:delete process.env.DEBUG}e(QEa,"save");function $Ea(){return process.env.DEBUG}e($Ea,"load");function VEa(i){i.inspectOpts={};let t=Object.keys(RR.inspectOpts);for(let r=0;r<t.length;r++)i.inspectOpts[t[r]]=RR.inspectOpts[t[r]]}e(VEa,"init");ZVt.exports=OVr()(RR);var{formatters:GJn}=ZVt.exports;GJn.o=function(i){return this.inspectOpts.colors=this.useColors,XVt.inspect(i,this.inspectOpts).split(`
|
|
632
632
|
`).map(t=>t.trim()).join(" ")};GJn.O=function(i){return this.inspectOpts.colors=this.useColors,XVt.inspect(i,this.inspectOpts)}});var YJn=Er((hIs,BVr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?BVr.exports=HJn():BVr.exports=KJn()});var UVr={};sz(UVr,{Decoder:()=>MVr,Encoder:()=>LVr,PacketType:()=>OE,protocol:()=>tWn});function XJn(i){return Object.prototype.toString.call(i)==="[object Object]"}var ZJn,eWn,RVr,zEa,tWn,OE,qVr,LVr,ezt,MVr,QVr,jVr,tzt=zt(()=>{ZJn=kf(uFe(),1);JJn();PVr();eWn=kf(YJn(),1),RVr=(0,eWn.default)("socket.io-parser"),zEa=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],tWn=5;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(OE||(OE={}));qVr=class qVr{constructor(t){this.replacer=t}encode(t){return RVr("encoding packet %j",t),(t.type===OE.EVENT||t.type===OE.ACK)&&D_t(t)?this.encodeAsBinary({type:t.type===OE.EVENT?OE.BINARY_EVENT:OE.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===OE.BINARY_EVENT||t.type===OE.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),RVr("encoded %j as %s",t,r),r}encodeAsBinary(t){let r=VJn(t),a=this.encodeAsString(r.packet),o=r.buffers;return o.unshift(a),o}};e(qVr,"Encoder");LVr=qVr;e(XJn,"isObject");ezt=class ezt extends ZJn.Emitter{constructor(t){super(),this.reviver=t}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);let a=r.type===OE.BINARY_EVENT;a||r.type===OE.BINARY_ACK?(r.type=a?OE.EVENT:OE.ACK,this.reconstructor=new jVr(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(T_t(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0,a={type:Number(t.charAt(0))};if(OE[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===OE.BINARY_EVENT||a.type===OE.BINARY_ACK){let c=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);let f=t.substring(c,r);if(f!=Number(f)||t.charAt(r)!=="-")throw new Error("Illegal attachments");a.attachments=Number(f)}if(t.charAt(r+1)==="/"){let c=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););a.nsp=t.substring(c,r)}else a.nsp="/";let o=t.charAt(r+1);if(o!==""&&Number(o)==o){let c=r+1;for(;++r;){let f=t.charAt(r);if(f==null||Number(f)!=f){--r;break}if(r===t.length)break}a.id=Number(t.substring(c,r+1))}if(t.charAt(++r)){let c=this.tryParse(t.substr(r));if(ezt.isPayloadValid(a.type,c))a.data=c;else throw new Error("invalid payload")}return RVr("decoded %s as %j",t,a),a}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case OE.CONNECT:return XJn(r);case OE.DISCONNECT:return r===void 0;case OE.CONNECT_ERROR:return typeof r=="string"||XJn(r);case OE.EVENT:case OE.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&zEa.indexOf(r[0])===-1);case OE.ACK:case OE.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}};e(ezt,"Decoder");MVr=ezt,QVr=class QVr{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let r=zJn(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};e(QVr,"BinaryReconstructor");jVr=QVr});function EZ(i,t,r){return i.on(t,r),e(function(){i.off(t,r)},"subDestroy")}var $Vr=zt(()=>{e(EZ,"on")});var rWn,nWn,cO,JEa,VVr,lWe,zVr=zt(()=>{tzt();$Vr();rWn=kf(uFe(),1),nWn=kf(S_t(),1),cO=(0,nWn.default)("socket.io-client:socket"),JEa=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),VVr=class VVr extends rWn.Emitter{constructor(t,r,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=r,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[EZ(t,"open",this.onopen.bind(this)),EZ(t,"packet",this.onpacket.bind(this)),EZ(t,"error",this.onerror.bind(this)),EZ(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...r){var a,o,c;if(JEa.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;let f={type:OE.EVENT,data:r};if(f.options={},f.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){let w=this.ids++;cO("emitting packet with ack id %d",w);let T=r.pop();this._registerAckCallback(w,T),f.id=w}let _=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,b=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!_?cO("discard packet as the transport is not currently writable"):b?(this.notifyOutgoingListeners(f),this.packet(f)):this.sendBuffer.push(f),this.flags={},this}_registerAckCallback(t,r){var a;let o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[t]=r;return}let c=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let _=0;_<this.sendBuffer.length;_++)this.sendBuffer[_].id===t&&(cO("removing packet with ack id %d from the buffer",t),this.sendBuffer.splice(_,1));cO("event with ack id %d has timed out after %d ms",t,o),r.call(this,new Error("operation has timed out"))},o),f=e((..._)=>{this.io.clearTimeoutFn(c),r.apply(this,_)},"fn");f.withError=!0,this.acks[t]=f}emitWithAck(t,...r){return new Promise((a,o)=>{let c=e((f,_)=>f?o(f):a(_),"fn");c.withError=!0,r.push(c),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());let a={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...c)=>a!==this._queue[0]?void 0:(o!==null?a.tryCount>this._opts.retries&&(cO("packet [%d] is discarded after %d tries",a.id,a.tryCount),this._queue.shift(),r&&r(o)):(cO("packet [%d] was successfully sent",a.id),this._queue.shift(),r&&r(null,...c)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(t=!1){if(cO("draining queue"),!this.connected||this._queue.length===0)return;let r=this._queue[0];if(r.pending&&!t){cO("packet [%d] has already been sent and is waiting for an ack",r.id);return}r.pending=!0,r.tryCount++,cO("sending packet [%d] (try n\xB0%d)",r.id,r.tryCount),this.flags=r.flags,this.emit.apply(this,r.args)}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){cO("transport is open - connecting"),typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:OE.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){cO("close (%s)",t),this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(a=>String(a.id)===t)){let a=this.acks[t];delete this.acks[t],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case OE.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case OE.EVENT:case OE.BINARY_EVENT:this.onevent(t);break;case OE.ACK:case OE.BINARY_ACK:this.onack(t);break;case OE.DISCONNECT:this.ondisconnect();break;case OE.CONNECT_ERROR:this.destroy();let a=new Error(t.data.message);a.data=t.data.data,this.emitReserved("connect_error",a);break}}onevent(t){let r=t.data||[];cO("emitting event %j",r),t.id!=null&&(cO("attaching ack callback to event"),r.push(this.ack(t.id))),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let r=this._anyListeners.slice();for(let a of r)a.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let r=this,a=!1;return function(...o){a||(a=!0,cO("sending ack %j",o),r.packet({type:OE.ACK,id:t,data:o}))}}onack(t){let r=this.acks[t.id];if(typeof r!="function"){cO("bad ack %s",t.id);return}delete this.acks[t.id],cO("calling ack %s with %j",t.id,t.data),r.withError&&t.data.unshift(null),r.apply(this,t.data)}onconnect(t,r){cO("socket connected with id %s",t),this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){cO("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(cO("performing disconnect (%s)",this.nsp),this.packet({type:OE.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let r=this._anyListeners;for(let a=0;a<r.length;a++)if(t===r[a])return r.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let r=this._anyOutgoingListeners;for(let a=0;a<r.length;a++)if(t===r[a])return r.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let r=this._anyOutgoingListeners.slice();for(let a of r)a.apply(this,t.data)}}};e(VVr,"Socket");lWe=VVr});function vFe(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}var iWn=zt(()=>{e(vFe,"Backoff");vFe.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*i);i=Math.floor(t*10)&1?i+r:i-r}return Math.min(i,this.max)|0};vFe.prototype.reset=function(){this.attempts=0};vFe.prototype.setMin=function(i){this.ms=i};vFe.prototype.setMax=function(i){this.max=i};vFe.prototype.setJitter=function(i){this.jitter=i}});var aWn,sWn,Dj,JVr,pWe,oWn=zt(()=>{WVt();zVr();tzt();$Vr();iWn();aWn=kf(uFe(),1),sWn=kf(S_t(),1),Dj=(0,sWn.default)("socket.io-client:manager"),JVr=class JVr extends aWn.Emitter{constructor(t,r){var a;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,xbe(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((a=r.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new vFe({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;let o=r.parser||UVr;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(Dj("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;Dj("opening %s",this.uri),this.engine=new cWe(this.uri,this.opts);let r=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;let o=EZ(r,"open",function(){a.onopen(),t&&t()}),c=e(_=>{Dj("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",_),t?t(_):this.maybeReconnectOnOpen()},"onError"),f=EZ(r,"error",c);if(this._timeout!==!1){let _=this._timeout;Dj("connect attempt will timeout after %d",_);let b=this.setTimeoutFn(()=>{Dj("connect attempt timed out after %d",_),o(),c(new Error("timeout")),r.close()},_);this.opts.autoUnref&&b.unref(),this.subs.push(()=>{this.clearTimeoutFn(b)})}return this.subs.push(o),this.subs.push(f),this}connect(t){return this.open(t)}onopen(){Dj("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(EZ(t,"ping",this.onping.bind(this)),EZ(t,"data",this.ondata.bind(this)),EZ(t,"error",this.onerror.bind(this)),EZ(t,"close",this.onclose.bind(this)),EZ(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){bbe(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){Dj("error",t),this.emitReserved("error",t)}socket(t,r){let a=this.nsps[t];return a?this._autoConnect&&!a.active&&a.connect():(a=new lWe(this,t,r),this.nsps[t]=a),a}_destroy(t){let r=Object.keys(this.nsps);for(let a of r)if(this.nsps[a].active){Dj("socket %s is still active, skipping close",a);return}this._close()}_packet(t){Dj("writing packet %j",t);let r=this.encoder.encode(t);for(let a=0;a<r.length;a++)this.engine.write(r[a],t.options)}cleanup(){Dj("cleanup"),this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){Dj("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,r){var a;Dj("closed due to %s",t),this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)Dj("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let r=this.backoff.duration();Dj("will wait %dms before reconnect attempt",r),this._reconnecting=!0;let a=this.setTimeoutFn(()=>{t.skipReconnect||(Dj("attempting reconnect"),this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(Dj("reconnect attempt error"),t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):(Dj("reconnect success"),t.onreconnect())}))},r);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};e(JVr,"Manager");pWe=JVr});function I_t(i,t){typeof i=="object"&&(t=i,i=void 0),t=t||{};let r=qJn(i,t.path||"/socket.io"),a=r.source,o=r.id,c=r.path,f=k_t[o]&&c in k_t[o].nsps,_=t.forceNew||t["force new connection"]||t.multiplex===!1||f,b;return _?(uWn("ignoring socket cache for %s",a),b=new pWe(a,t)):(k_t[o]||(uWn("new io instance for %s",a),k_t[o]=new pWe(a,t)),b=k_t[o]),r.query&&!t.query&&(t.query=r.queryKey),b.socket(r.path,t)}var cWn,uWn,k_t,lWn=zt(()=>{QJn();oWn();zVr();cWn=kf(S_t(),1);tzt();WVt();uWn=(0,cWn.default)("socket.io-client"),k_t={};e(I_t,"lookup");Object.assign(I_t,{Manager:pWe,Socket:lWe,io:I_t,connect:I_t})});var pWn=zt(()=>{"use strict"});var rzt,WVr,nzt,fWn=zt(()=>{"use strict";lWn();pWn();rzt={URL:"http://localhost:3000",NAMESPACE:"auto-recovery",RECONNECTION_ATTEMPTS:5,RECONNECTION_DELAY:1e3},WVr=class WVr{constructor(t={}){this.socket=null;this.connectionState="disconnected";this.connectionPromise=null;this.resolution=null;this.options=t,this.url=t.url||rzt.URL,this.namespace=t.namespace||rzt.NAMESPACE,this.initializationPromise=this.createInitializationPromise()}createInitializationPromise(){return new Promise((t,r)=>{this.resolveInitialization=a=>t(a),this.rejectInitialization=a=>r(a)}).then(t=>(this.resolution=t,this.log("\u2705 Client initialization successful"),t),t=>{throw this.resolution=t,this.logError("\u274C Client initialization failed:",t),t}).finally(()=>{this.disconnect()})}defineHandlers(t){return t}async startSession(t,r,a){try{if(await this.connect(),this.emit(t,r,o=>{this.resolveInitialization(o)}),a&&a>0){let o=new Promise((c,f)=>{setTimeout(()=>{f(new Error(`Session initialization timed out after ${a}ms`))},a)});return Promise.race([this.initializationPromise,o])}return this.initializationPromise}catch(o){throw this.logError("\u274C Failed to start session:",o),this.rejectInitialization(o),o}}isConnected(){var t;return((t=this.socket)==null?void 0:t.connected)||!1}getConnectionState(){return this.connectionState}success(t){return{success:!0,data:t}}error(t){return{success:!1,error:t}}log(t,...r){this.options.verbose&&console.log(`[${this.namespace}] ${t}`,...r)}logError(t,...r){this.options.verbose&&console.error(`[${this.namespace}] ${t}`,...r)}async connect(){var t;if(this.connectionPromise)return this.connectionPromise;if(this.connectionState==="connected"&&((t=this.socket)!=null&&t.connected))return Promise.resolve();this.connectionState="connecting",this.connectionPromise=this.establishConnection();try{await this.connectionPromise,this.connectionState="connected"}catch(r){throw this.connectionState="disconnected",this.connectionPromise=null,r}return this.connectionPromise}establishConnection(){return new Promise((t,r)=>{let a=!1;try{let o=`${this.url}/${this.namespace}`;this.log(`\u{1F517} Connecting to socket at: ${o}`),this.socket=I_t(o,{autoConnect:!0,reconnection:!0,reconnectionAttempts:rzt.RECONNECTION_ATTEMPTS,reconnectionDelay:rzt.RECONNECTION_DELAY,...this.options.path&&{path:this.options.path}}),this.setupConnectionHandlers(t,r,a)}catch(o){this.logError("\u274C Failed to create socket connection:",o),a||r(o)}})}setupConnectionHandlers(t,r,a){if(!this.socket)return;let o={resolve:t,reject:r,connectionResolved:a};this.socket.on("connect",()=>this.handleConnect(o)),this.socket.on("reconnect",()=>this.handleReconnect()),this.socket.on("connect_error",c=>this.handleConnectError(c,o)),this.socket.on("disconnect",c=>this.handleDisconnect(c,o)),this.socket.io.on("reconnect_attempt",c=>this.handleReconnectAttempt(c)),this.socket.io.on("reconnect_error",c=>this.handleReconnectError(c)),this.socket.io.on("reconnect_failed",()=>this.handleReconnectFailed(o))}handleConnect(t){this.log("\u2705 Connected to socket"),this.connectionState="connected",this.setupEventHandlers(),t.connectionResolved||(t.connectionResolved=!0,t.resolve())}handleReconnect(){this.log("\u2705 Reconnected to socket"),this.connectionState="connected"}handleConnectError(t,r){var a;this.logError("\u274C Connection error:",t),this.connectionState="disconnected",!r.connectionResolved&&((a=this.socket)==null?void 0:a.disconnected)!==!1&&(r.connectionResolved=!0,r.reject(t))}handleDisconnect(t,r){this.log("\u{1F50C} Disconnected from socket:",t),this.connectionState="disconnected";let a=new Error(`Socket disconnected: ${t}`),o=!1;this.resolution===null&&t==="io server disconnect"&&(this.rejectInitialization(a),o=!0),!r.connectionResolved&&(t==="io server disconnect"||t==="transport close")&&(r.connectionResolved=!0,r.reject(a)),!o&&this.resolution===null&&this.connectionState==="disconnected"&&this.rejectInitialization(a)}handleReconnectAttempt(t){this.log(`\u{1F504} Reconnection attempt #${t}`),this.connectionState="reconnecting"}handleReconnectError(t){this.logError("\u274C Reconnection attempt failed:",t)}handleReconnectFailed(t){this.logError("\u274C All reconnection attempts failed"),this.connectionState="disconnected",this.resolution===null&&this.rejectInitialization("All reconnection attempts failed"),t.connectionResolved||(t.connectionResolved=!0,t.reject(new Error("All reconnection attempts failed")))}setupEventHandlers(){if(!this.socket){this.logError("\u274C Cannot setup event handlers: socket is null");return}this.log("\u2705 Setting up event handlers"),this.socket.on("__call",this.handleGatewayCall.bind(this))}async handleGatewayCall(t,r){this.log(`\u{1F4E5} Gateway called method: ${t.key} with args:`,t.args);try{let a=this.validateGatewayCall(t);if(a){r(a);return}let o=this.handlers[t.key];if(!o){let f=`No handler registered for method: ${t.key}`;this.logError(`\u274C ${f}`),r(this.error(f));return}let c=await o(...t.args);r(this.success(c))}catch(a){this.logError("\u274C Error handling gateway call:",a),r(this.error(a.message||"Unknown error occurred"))}}validateGatewayCall(t){return t.key?Array.isArray(t.args)?null:(this.logError("\u274C Received call with invalid args"),this.error("Args must be an array")):(this.logError("\u274C Received call with undefined key"),this.error("Key is undefined"))}emit(t,r,a){if(!this.socket){this.logError("\u274C Cannot emit: socket is null");return}this.log(`\u{1F4E4} Emitting event: ${t}`),this.socket.emit(t,r,o=>{a(o)})}disconnect(){this.connectionState!=="shutting_down"&&(this.connectionState="shutting_down",this.log("\u{1F50C} Initiating disconnect"),this.socket&&(this.socket.disconnect(),this.socket=null),this.connectionPromise=null,this.connectionState="disconnected",this.log("\u2705 Disconnected successfully"))}};e(WVr,"AbstractClient");nzt=WVr});var dWn,mWn,_Wn,hWn,gWn,yWn,azt,izt,vWn=zt(()=>{"use strict";QVn();VVn();cie();fWn();Rme();P8();azt=class azt extends(yWn=nzt,gWn=Sj.names.getState,hWn=Sj.names.invokeCode,_Wn=Sj.names.final_result,mWn=Sj.names.wait,dWn=Sj.names.getElementScreenshot,yWn){constructor(r,a){super({verbose:i_.testRun.autoRecovery.verboseConsoleLog,url:a.config.apiURL,namespace:"auto-recovery",path:"/auto-recovery/socket.io"});this.utils=r;this.initData=a;this.stepsThoughts=[];this.handlers=this.defineHandlers({callLangChainTool:e(async(r,a)=>{if(!this[r])throw new Error(`Tool ${r} not found`);return a.thought&&this.stepsThoughts.push(a.thought),await this[r].invoke(a)},"callLangChainTool"),getStatus:e(async r=>({sessionId:r,status:"active",data:{message:"Status retrieved successfully"}}),"getStatus")});this[gWn]=_7e.buildTool(Sj,Sj.names.getState,async r=>this.getStateHandler(r));this[hWn]=_7e.buildTool(Sj,Sj.names.invokeCode,async r=>this.invokeCodeHandler(r));this[_Wn]=_7e.buildTool(Sj,Sj.names.final_result,async r=>this.finalResultHandler(r));this[mWn]=_7e.buildTool(Sj,Sj.names.wait,async r=>this.waitHandler(r));this[dWn]=_7e.buildTool(Sj,Sj.names.getElementScreenshot,async r=>this.getElementScreenshotHandler(r))}async init(){let r={...this.initData,version:Sj.version};return await this.startSession("initialize",r).catch(a=>{this.utils.analytics.ARError({error:a.message});let o="Auto-Recovery attempt finished unsuccessfully";return this.utils.createChecksumStep({title:o,withError:!0}),this.utils.addAutoRecoveryErrorToReport(o,!1),{finalThought:o,stepsThoughts:[],result:"failed"}})}static async build(r){let a=await r.buildFallbackData();return new azt(r,a)}async invokeCodeHandler(r){let a;return await this.utils.runConditionallyWithinStep(!0,r.thought||"Invoke Code",async()=>{try{let o=await this.utils.invokeCode(r.code);this.utils.createChecksumStep({title:"Code Invoked Successfully"}),a={success:!0,invokeCodeResult:`invokeCodeResult: ${o}`,appState:(await this.utils.buildFallbackData()).applicationState}}catch(o){a={success:!1,invokeCodeResult:`Error while invoking code: ${o}`,appState:(await this.utils.buildFallbackData()).applicationState}}}),a}async getStateHandler(r){return this.utils.createChecksumStep({title:r.thought}),this.utils.analytics.ARGetState(r.thought),{success:!0,appState:(await this.utils.buildFallbackData()).applicationState}}finalResultHandler(r){let a=r.result==="pass",o=this.initData.type==="assertion"?a?"soft_assertion":"hard_assertion":a?"finish":"failed";this.utils.analytics.ARFinalResult({finalThought:r.thought,result:o,stepsThoughts:this.stepsThoughts});let c={finalThought:r.thought,result:o,stepsThoughts:this.stepsThoughts};this.utils.addAutoRecoveryErrorToReport(r.thought,a),this.resolveInitialization(c)}async getElementScreenshotHandler(r){return{success:!0,screenshot:await this.utils.getScreenshotForElement(r.checksumId)}}async waitHandler(r){await new Promise(o=>setTimeout(o,r.time||5e3));let a=await this.utils.buildFallbackData();return{success:!0,waitResult:`waited for ${r.time} seconds, the current HTML of the application after the wait is: ${a.applicationState.reducedHTML}`}}};e(azt,"AutoRecoveryAgent");izt=azt});var HVr,szt,bWn=zt(()=>{"use strict";zLr();m0t();HVr=class HVr{constructor(t,r){this.sessionId=null;if(!s_e.getCurrentTestInfo())throw new Error("TestRunAnalytics must be initialized with testInfo before RecoveryAnalytics can be used");let o=s_e.getCurrentInstance();if(!o)throw new Error("TestRunAnalytics instance not found. Make sure TestRunAnalytics is initialized before creating RecoveryAnalytics");let c=o.getTestSuiteRunInfo();this.analytics=Kme.createFromConfig(c,s_e.isolatedMode,!0),this.fallbackId=t,this.fallbackType=r}updateToSessionId(t){this.sessionId!==t&&(this.sessionId=t)}get tableName(){return"fallbacks"}get metadata(){return{...this.analytics.metadata,fallbackType:this.fallbackType,sessionId:this.sessionId||"unknown",fallbackId:this.fallbackId}}event(t){this.analytics.trackEventWithTable(t,this.metadata,this.tableName)}setFallbackType(t){this.fallbackType=t}aiFallbackStart(t){this.event({event:"AI Fallback Start",metadata:this.metadata,...t})}aiFallbackConfig(t){this.event({event:"AI Fallback Config",metadata:this.metadata,...t})}aiFallbackIterationResponse(t){this.event({event:"AI Fallback Iteration Response",metadata:this.metadata,...t})}aiFallbackAssertion(t){this.event({event:"AI Fallback Assertion Execution",metadata:this.metadata,...t})}aiFallbackChangeVariable(t){this.event({event:"AI Fallback Change Variable",metadata:this.metadata,...t})}aiFallbackSummary(t){this.event({event:"AI Fallback Summary",metadata:this.metadata,fallbackType:this.fallbackType,...t})}aiFallbackActionExecution(t){this.event({event:"AI Fallback Action Execution",metadata:this.metadata,...t})}aiFallbackActionExecutionFailure(t){this.event({event:"AI Fallback Action Execution Failure",metadata:this.metadata,...t})}aiFallbackEnd(t){this.event({event:"AI Fallback End",metadata:this.metadata,...t})}ARStart(){this.event({event:"Auto-Recovery Start",metadata:this.metadata})}ARConfig(t){this.event({event:"Auto-Recovery Config",metadata:this.metadata,...t})}ARGetState(t){this.event({event:"Auto-Recovery State",metadata:this.metadata,thought:t})}ARInvokeCode(t,r){this.event({event:"Auto-Recovery Invoke Code",metadata:this.metadata,thought:t,code:r})}ARFinalResult(t){this.event({event:"Auto-Recovery Final Result",metadata:this.metadata,...t})}autoRecoveryDisconnect(t){this.event({event:"Auto-Recovery Disconnect",metadata:this.metadata,...t})}ARFinish(t){this.event({event:"Auto-Recovery Finish",metadata:this.metadata,...t})}ARError(t){this.event({event:"Auto-Recovery Error",metadata:this.metadata,...t})}};e(HVr,"RecoveryAnalytics");szt=HVr});var xWn=zt(()=>{"use strict"});var AWn,EWn,bFe,ozt,CWn=zt(()=>{"use strict";VLr();AWn=require("fs"),EWn=kf(require("path"));bWn();xWn();bFe=class bFe{constructor({page:t,evaluateWithChecksum:r,checksumPage:a,pageInteractor:o,arConfig:c,sessionId:f,runtimeFallbackData:_,fallbackData:b,variableStore:C}){this.reducedHtmlTimeoutMs=3e4;this.page=t,this.evaluateWithChecksum=r,this.checksumPage=a,this.pageInteractor=o,this.arConfig=c,this.sessionId=f,this.runtimeFallbackData=_,this.fallbackData=b,this.variableStore=C,this._analytics=new szt(this.sessionId,b.type)}static async start(t){return new bFe({...t})}getMatcherResultFileData(t){let r=t.matcherResult;if((r==null?void 0:r.name)!=="toHaveScreenshot")return;let a=e((_,b=!0)=>{if(!_)return"";try{return(0,AWn.readFileSync)(_,b?"base64":"utf-8")}catch{return""}},"readFileSafe"),o=a(r==null?void 0:r.actual),c=a(r==null?void 0:r.diff),f=a(r==null?void 0:r.expected);if(!f)throw new Error("No expected file found for 'toHaveScreenshot'");return{...r,actual:o,diff:c,expected:f}}async getSelectionDataForChecksumId(t){return await this.evaluateWithChecksum(async a=>{let{selector:o,locator:c,clickOffset:f,parentFramesSelectors:_,invalid:b,rrwebId:C}=await window.checksum.testGenerator.getSelectorForChecksumId(a),w=await window.checksum.testGenerator.getElementForChecksumId(a),T=w instanceof HTMLOptionElement&&w.value?w.value:void 0;return{selector:o,locator:c,clickOffset:f,selectOptionValue:T,parentFramesSelectors:_,invalid:b,rrwebId:C}},t)}async getReducedHtml(t=bFe.currentChecksumId){if(this.pageInteractor.getCurrentURL()==="about:blank")return{reducedHTML:"Error: Page is about:blank. Cannot get reduced HTML - either wait or navigate to a valid page before continuing.",currentChecksumId:t};let{reducedHTML:r,currentChecksumId:a}=await this.pageInteractor.getCurrentReducedHTML({stopFlashingElementsDetection:!0,assignChecksumIdsToAllElements:!0,initialChecksumId:t});return bFe.currentChecksumId=a,{reducedHTML:r,currentChecksumId:a}}async getApplicationState(){let{reducedHTML:t}=await this.getReducedHtml();return{reducedHTML:t,screenshot:await this.getPageScreenshot()}}async buildFallbackData(){let t=new Promise((o,c)=>setTimeout(()=>c(new Error(`getReducedHtml timeout after ${this.reducedHtmlTimeoutMs/1e3} seconds`)),this.reducedHtmlTimeoutMs)),{reducedHTML:r,currentChecksumId:a}=await Promise.race([this.getReducedHtml(),t]);return{storyInfo:this.runtimeFallbackData.storyInfo,testIdentification:this.runtimeFallbackData.testIdentification,fallbackConfig:this.runtimeFallbackData.fallbackConfig,thoughts:this.runtimeFallbackData.thoughts,errorData:{error:{name:this.fallbackData.error.name,message:this.fallbackData.error.message,stack:this.fallbackData.error.stack},errorFileContent:await this.getErrorFileContent(this.fallbackData.error)},applicationState:{reducedHTML:r,screenshot:await this.getPageScreenshot()},stepData:{matcher:this.getMatcherResultFileData(this.fallbackData.error)},currentChecksumId:a,failingStepThought:this.runtimeFallbackData.thoughts.failing,type:this.fallbackData.type,config:this.runtimeFallbackData.config,sessionId:this.sessionId,variableStore:this.variableStore.reduce((o,c)=>(o[`variablesStore.${c.name}`]=c.value,o),{}),arConfig:this.arConfig}}async scrollToElement(t){t&&await this.pageInteractor.scrollElementIntoViewByChecksumId(t)}async getPageScreenshot(t=this.arConfig){try{return this.checksumPage.wrapInternalSteps(async()=>{var a;return(await this.page.screenshot({fullPage:!0,type:((a=t.modelConfig)==null?void 0:a.provider)==="anthropic"?"jpeg":"png"})).toString("base64")})}catch{return}}async getErrorFileContent(t){try{let r=EWn.default.dirname(this.runtimeFallbackData.testIdentification.testFileName);return Gze.toRecord(t,r)}catch{throw new Error("Error while getting error file content for AI fallback")}}async wait(){await this.page.waitForTimeout(5e3)}async preprocessCode(t){var R;let r=t,a=t,o=[],c=t.match(/getByChecksumId\([^)]+\)\.([a-zA-Z]+)\(([^)]*)\)/),f=c==null?void 0:c[1],_=c==null?void 0:c[2],b=/(?:page\.)?getByChecksumId\(['"]([^'"]+)['"]\)/,C=(R=t.match(b))==null?void 0:R[1];if(!C)throw new Error("Checksum ID not found in the code");let w=await this.getSelectionDataForChecksumId(C);if(!(w!=null&&w.locator)||w.invalid)throw new Error(`Locator or selector not found for checksumId: ${C}`);a=a.replace(b,w.locator);let T=/variables?Store\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g,k=null;for(;(k=T.exec(t))!==null;){let B=k[1],U=this.variableStore.find(W=>W.name===B);U&&(o.push(U),a=a.replace(k[0],`"${U.value}"`))}return{originalCode:r,modifiedCode:a,usedVariables:o,checksumId:C,locator:w.locator,method:f,methodArgs:_}}async invokeCode(t){try{let r=await this.preprocessCode(t),{modifiedCode:a}=r,o=new Function("page",`return (async () => { return page.${a}; })()`),c;return await this.step(a,async()=>c=await o(this.page),!1,{box:!0,noLocation:!0,obtainStep:e(f=>{this.checksumPage.addAutoRecoveryStepId(f.stepId)},"obtainStep")}),{success:!0,result:c}}catch(r){throw console.log("Error while invoking code",r.message),r}}addAutoRecoveryErrorToReport(t,r){let a=this.runtimeFallbackData.thoughts.failing,o=r?`\u2705 "${a}" auto-recovered`:`\u274C "${a}" failed`;this.checksumPage.addPwAnnotation({type:o,description:t.replace(/^"(.*)"$/,"$1")}),r&&this.checksumPage.addErrorMessage(this.fallbackData.error,`${o}:
|
|
633
|
-
${t}`)}get createChecksumStep(){return t=>this.checksumPage.createChecksumStep(t)}get step(){return this.checksumPage.step.bind(this.checksumPage)}get runConditionallyWithinStep(){return(t,r,a)=>this.checksumPage.runConditionallyWithinStep(t,r,a)}async getScreenshotForElement(t){var r;try{let a=await this.getSelectionDataForChecksumId(t);if(!a)throw new Error(`Locator not found for checksumId: ${t}`);let o=((r=this.arConfig.modelConfig)==null?void 0:r.provider)==="anthropic"?"jpeg":"png";return(await this.page.locator(a.selector).screenshot({type:o})).toString("base64")}catch{throw new Error(`Failed to get screenshot for element: ${t}`)}}get analytics(){return this._analytics}};e(bFe,"AutoRecoveryRuntimeIteratorUtils"),bFe.currentChecksumId="0";ozt=bFe});var Tbe,GVr,wWn=zt(()=>{"use strict";Rme();imt();vWn();CWn();N9e();Tbe=class Tbe extends ebe{init(t){var r;return this.initializationData=t,(r=this.initializationData.fallbackConfig).arMode??(r.arMode="fast"),this}canResolve(t){return!0}get failingThought(){return this.initializationData.thoughts.failing}getRecoveryAttemptTitle(){switch(this.initializationData.type){case"action":return`Checksum Auto-Recovery: trying to achieve action "${this.failingThought}"...`;case"assertion":return`Checksum Auto-Recovery: trying to verify assertion "${this.failingThought}"...`}}static async registerSession(t){let r=t.config.apiURL,a=t.config.apiKey;return await(await fetch(`${r}${Tbe.API_BASE_ROUTE}/register-auto-recovery-session`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:a},body:JSON.stringify({appName:t.testIdentification.testFileName,fallbackData:t})})).json()}async prepareSession(t){let r=await Tbe.registerSession(this.initializationData);this.utils=new ozt({page:this.page,evaluateWithChecksum:this.evaluateWithChecksum,checksumPage:this.checksumPage,pageInteractor:this.pageInteractor,arConfig:r.arConfig,sessionId:r.sessionId,runtimeFallbackData:this.initializationData,fallbackData:t,variableStore:this.variables});try{this.agent=await izt.build(this.utils)}catch(a){let o=a instanceof Error?a.message:String(a),c=a instanceof Error?a.stack:void 0;throw new Error(`Failed to prepare ARFallback: ${o}`)}}async resolve(t){let r=null,a=new Promise((c,f)=>{r=setTimeout(()=>{r=null,this.utils.analytics.ARError({error:`Auto-recovery timed out after ${Tbe.TIMEOUT_MS/1e3} seconds`});let _="Auto-Recovery attempt finished unsuccessfully";this.utils.createChecksumStep({title:_,withError:!0}),this.utils.addAutoRecoveryErrorToReport(_,!1),f(new Error(_))},Tbe.TIMEOUT_MS)}),o=Date.now();await this.prepareSession(t),this.utils.analytics.ARStart();try{let c=await Promise.race([this.agent.init(),a]);return r!==null&&(clearTimeout(r),r=null),this.utils.analytics.ARFinish({duration:Date.now()-o}),{fbResult:c.result,thought:c.finalThought,stepsThoughts:c.stepsThoughts,steps:[]}}catch(c){throw r!==null&&(clearTimeout(r),r=null),this.utils.analytics.ARFinish({duration:Date.now()-o}),c}}};e(Tbe,"ARFallback"),Tbe.API_BASE_ROUTE="/auto-recovery",Tbe.TIMEOUT_MS=12e4;GVr=Tbe});var SWn=zt(()=>{"use strict"});var HEa,EPs,DWn=zt(()=>{"use strict";lD();OFn();cie();N9e();_4e();VLt();Rme();JBr();HEa=kf(RLr());sLn();qLr();P8();XLn();ZLn();eMn();tMn();rMn();nMn();_ie();NMr();wWn();y$r();SWn();EPs=1e3*30});function GEa(i,t){return t}function KEa(i,t){return i.filter(r=>r!==void 0)}function kWn(i){return typeof i!="object"||i===null?0:Array.isArray(i)?2:ZEa(i)?1:i instanceof Set?3:i instanceof Map?4:5}function YEa(i){let t=new Set;for(let r of i)for(let a of[...Object.keys(r),...Object.getOwnPropertySymbols(r)])t.add(a);return t}function XEa(i,t){return typeof i=="object"&&Object.prototype.propertyIsEnumerable.call(i,t)}function PWn(i){var a;let t=0,r=(a=i[0])==null?void 0:a[Symbol.iterator]();return{[Symbol.iterator](){return{next(){var o;do{if(r===void 0)return{done:!0,value:void 0};let c=r.next();if(c.done===!0){t+=1,r=(o=i[t])==null?void 0:o[Symbol.iterator]();continue}return{done:!1,value:c.value}}while(!0)}}}}}function ZEa(i){if(!IWn.includes(Object.prototype.toString.call(i)))return!1;let{constructor:t}=i;if(t===void 0)return!0;let r=t.prototype;return!(r===null||typeof r!="object"||!IWn.includes(Object.prototype.toString.call(r))||!r.hasOwnProperty("isPrototypeOf"))}function eCa(i,t,r){let a={};for(let o of YEa(i)){let c=[];for(let b of i)XEa(b,o)&&c.push(b[o]);if(c.length===0)continue;let f=t.metaDataUpdater(r,{key:o,parents:i}),_=FWn(c,t,f);_!==b7e.skip&&(o==="__proto__"?Object.defineProperty(a,o,{value:_,configurable:!0,enumerable:!0,writable:!0}):a[o]=_)}return a}function tCa(i){return i.flat()}function rCa(i){return new Set(PWn(i))}function nCa(i){return new Map(PWn(i))}function iCa(i){return i.at(-1)}function czt(...i){return aCa({})(...i)}function aCa(i,t){let r=sCa(i,a);function a(...o){return FWn(o,r,t)}return e(a,"customizedDeepmerge"),a}function sCa(i,t){return{defaultMergeFunctions:uzt,mergeFunctions:{...uzt,...Object.fromEntries(Object.entries(i).filter(([r,a])=>Object.hasOwn(uzt,r)).map(([r,a])=>a===!1?[r,uzt.mergeOthers]:[r,a]))},metaDataUpdater:i.metaDataUpdater??GEa,deepmerge:t,useImplicitDefaultMerging:i.enableImplicitDefaultMerging??!1,filterValues:i.filterValues===!1?void 0:i.filterValues??KEa,actions:b7e}}function FWn(i,t,r){var c;let a=((c=t.filterValues)==null?void 0:c.call(t,i,r))??i;if(a.length===0)return;if(a.length===1)return XVr(a,t,r);let o=kWn(a[0]);if(o!==0&&o!==5){for(let f=1;f<a.length;f++)if(kWn(a[f])!==o)return XVr(a,t,r)}switch(o){case 1:return oCa(a,t,r);case 2:return uCa(a,t,r);case 3:return cCa(a,t,r);case 4:return lCa(a,t,r);default:return XVr(a,t,r)}}function oCa(i,t,r){let a=t.mergeFunctions.mergeRecords(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(i,t,r):a}function uCa(i,t,r){let a=t.mergeFunctions.mergeArrays(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(i):a}function cCa(i,t,r){let a=t.mergeFunctions.mergeSets(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(i):a}function lCa(i,t,r){let a=t.mergeFunctions.mergeMaps(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(i):a}function XVr(i,t,r){let a=t.mergeFunctions.mergeOthers(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(i):a}var b7e,TPs,TWn,IWn,uzt,ZVr=zt(()=>{b7e={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},TPs={defaultMerge:b7e.defaultMerge};e(GEa,"defaultMetaDataUpdater");e(KEa,"defaultFilterValues");(function(i){i[i.NOT=0]="NOT",i[i.RECORD=1]="RECORD",i[i.ARRAY=2]="ARRAY",i[i.SET=3]="SET",i[i.MAP=4]="MAP",i[i.OTHER=5]="OTHER"})(TWn||(TWn={}));e(kWn,"getObjectType");e(YEa,"getKeys");e(XEa,"objectHasProperty");e(PWn,"getIterableOfIterables");IWn=["[object Object]","[object Module]"];e(ZEa,"isRecord");e(eCa,"mergeRecords$1");e(tCa,"mergeArrays$1");e(rCa,"mergeSets$1");e(nCa,"mergeMaps$1");e(iCa,"mergeOthers$1");uzt={mergeRecords:eCa,mergeArrays:tCa,mergeSets:rCa,mergeMaps:nCa,mergeOthers:iCa};e(czt,"deepmerge");e(aCa,"deepmergeCustom");e(sCa,"getUtils");e(FWn,"mergeUnknowns");e(oCa,"mergeRecords");e(uCa,"mergeArrays");e(cCa,"mergeSets");e(lCa,"mergeMaps");e(XVr,"mergeOthers")});function wS(...i){pCa&&console.log(...i)}async function JLn(i,t,r,a=6e4){if(!(t in i))return i;let o=e(()=>i[t](...r),"executor");return a===null?o():_T(o(),a,"Execution timeout")}function ezr(i,{role:t,environment:r}={},a=!1){var _,b;let o;if(r&&(o=(_=i.environments)==null?void 0:_.find(({name:C})=>r===C)),o||(o=(b=i.environments)==null?void 0:b.find(({default:C})=>C)),!o)throw new Error("Environment not found. Please make sure your environments are properly defined in the checksum.config.ts file.");let c=o.users,f;if(c&&(t!==void 0&&(f=c.find(C=>C.role===t)),f||(f=c.find(C=>C.default))),!f)throw new Error(`User not found. Please make sure the users array for the "${o.name}" environment is properly defined in the checksum.config.ts file.`);if(r&&o.name!==r){if(a)throw new Error(`Could not find environment with name "${r}" in config file`);console.warn(`Could not find environment with name "${r}" in config file, trying to use default environment`)}if(t&&f.role!==t){if(a)throw new Error(`Could not find user with role "${t}" for environment "${r}" in config file`);console.warn(`Could not find user with role "${t}" for environment "${r}" in config file, trying to login with environment's default user`)}return{environment:o,user:f}}function fCa(i){let t=`${i??m4e()}/login.ts`;if(!(0,lzt.existsSync)(t))throw console.warn(`Could not locate the login.ts file. Please make sure your login file exists at ${t}`),new Error("Could not find login.ts file");try{return require(t).default}catch(r){throw console.warn("Error loading login.ts file",r),r}}async function dCa(i,t,{environment:r,user:a,config:o}){try{let c=e(()=>t(i,{environment:r,user:a,config:o}),"performLogin");"checksumAI"in i?await i.checksumAI(`Log in${a!=null&&a.role?` using ${a.role} role`:""}${r!=null&&r.name?` in ${r.name} environment`:""}`,c):await c()}catch(c){throw console.warn(`The login method threw an exception, please check the login.ts file for the following error:
|
|
633
|
+
${t}`)}get createChecksumStep(){return t=>this.checksumPage.createChecksumStep(t)}get step(){return this.checksumPage.step.bind(this.checksumPage)}get runConditionallyWithinStep(){return(t,r,a)=>this.checksumPage.runConditionallyWithinStep(t,r,a)}async getScreenshotForElement(t){var r;try{let a=await this.getSelectionDataForChecksumId(t);if(!a)throw new Error(`Locator not found for checksumId: ${t}`);let o=((r=this.arConfig.modelConfig)==null?void 0:r.provider)==="anthropic"?"jpeg":"png";return(await this.page.locator(a.selector).screenshot({type:o})).toString("base64")}catch{throw new Error(`Failed to get screenshot for element: ${t}`)}}get analytics(){return this._analytics}};e(bFe,"AutoRecoveryRuntimeIteratorUtils"),bFe.currentChecksumId="0";ozt=bFe});var Tbe,GVr,wWn=zt(()=>{"use strict";Rme();imt();vWn();CWn();N9e();Tbe=class Tbe extends ebe{init(t){var r;return this.initializationData=t,(r=this.initializationData.fallbackConfig).arMode??(r.arMode="fast"),this}canResolve(t){return!0}get failingThought(){return this.initializationData.thoughts.failing}getRecoveryAttemptTitle(){switch(this.initializationData.type){case"action":return`Checksum Auto-Recovery: trying to achieve action "${this.failingThought}"...`;case"assertion":return`Checksum Auto-Recovery: trying to verify assertion "${this.failingThought}"...`}}static async registerSession(t){let r=t.config.apiURL,a=t.config.apiKey;return await(await fetch(`${r}${Tbe.API_BASE_ROUTE}/register-auto-recovery-session`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:a},body:JSON.stringify({appName:t.testIdentification.testFileName,fallbackData:t})})).json()}async prepareSession(t){let r=await Tbe.registerSession(this.initializationData);this.utils=new ozt({page:this.page,evaluateWithChecksum:this.evaluateWithChecksum,checksumPage:this.checksumPage,pageInteractor:this.pageInteractor,arConfig:r.arConfig,sessionId:r.sessionId,runtimeFallbackData:this.initializationData,fallbackData:t,variableStore:this.variables});try{this.agent=await izt.build(this.utils)}catch(a){let o=a instanceof Error?a.message:String(a),c=a instanceof Error?a.stack:void 0;throw new Error(`Failed to prepare ARFallback: ${o}`)}}async resolve(t){let r=null,a=new Promise((c,f)=>{r=setTimeout(()=>{r=null,this.utils.analytics.ARError({error:`Auto-recovery timed out after ${Tbe.TIMEOUT_MS/1e3} seconds`});let _="Auto-Recovery attempt finished unsuccessfully";this.utils.createChecksumStep({title:_,withError:!0}),this.utils.addAutoRecoveryErrorToReport(_,!1),f(new Error(_))},Tbe.TIMEOUT_MS)}),o=Date.now();await this.prepareSession(t),this.utils.analytics.ARStart();try{let c=await Promise.race([this.agent.init(),a]);return r!==null&&(clearTimeout(r),r=null),this.utils.analytics.ARFinish({duration:Date.now()-o}),{fbResult:c.result,thought:c.finalThought,stepsThoughts:c.stepsThoughts,steps:[]}}catch(c){throw r!==null&&(clearTimeout(r),r=null),this.utils.analytics.ARFinish({duration:Date.now()-o}),c}}};e(Tbe,"ARFallback"),Tbe.API_BASE_ROUTE="/auto-recovery",Tbe.TIMEOUT_MS=12e4;GVr=Tbe});var SWn=zt(()=>{"use strict"});var HEa,EPs,DWn=zt(()=>{"use strict";lD();OFn();cie();N9e();_4e();VLt();Rme();JBr();HEa=kf(RLr());sLn();qLr();P8();XLn();ZLn();eMn();tMn();rMn();nMn();_ie();NMr();wWn();y$r();SWn();EPs=1e3*30});function GEa(i,t){return t}function KEa(i,t){return i.filter(r=>r!==void 0)}function kWn(i){return typeof i!="object"||i===null?0:Array.isArray(i)?2:ZEa(i)?1:i instanceof Set?3:i instanceof Map?4:5}function YEa(i){let t=new Set;for(let r of i)for(let a of[...Object.keys(r),...Object.getOwnPropertySymbols(r)])t.add(a);return t}function XEa(i,t){return typeof i=="object"&&Object.prototype.propertyIsEnumerable.call(i,t)}function PWn(i){var a;let t=0,r=(a=i[0])==null?void 0:a[Symbol.iterator]();return{[Symbol.iterator](){return{next(){var o;do{if(r===void 0)return{done:!0,value:void 0};let c=r.next();if(c.done===!0){t+=1,r=(o=i[t])==null?void 0:o[Symbol.iterator]();continue}return{done:!1,value:c.value}}while(!0)}}}}}function ZEa(i){if(!IWn.includes(Object.prototype.toString.call(i)))return!1;let{constructor:t}=i;if(t===void 0)return!0;let r=t.prototype;return!(r===null||typeof r!="object"||!IWn.includes(Object.prototype.toString.call(r))||!r.hasOwnProperty("isPrototypeOf"))}function eCa(i,t,r){let a={};for(let o of YEa(i)){let c=[];for(let b of i)XEa(b,o)&&c.push(b[o]);if(c.length===0)continue;let f=t.metaDataUpdater(r,{key:o,parents:i}),_=FWn(c,t,f);_!==b7e.skip&&(o==="__proto__"?Object.defineProperty(a,o,{value:_,configurable:!0,enumerable:!0,writable:!0}):a[o]=_)}return a}function tCa(i){return i.flat()}function rCa(i){return new Set(PWn(i))}function nCa(i){return new Map(PWn(i))}function iCa(i){return i.at(-1)}function czt(...i){return aCa({})(...i)}function aCa(i,t){let r=sCa(i,a);function a(...o){return FWn(o,r,t)}return e(a,"customizedDeepmerge"),a}function sCa(i,t){return{defaultMergeFunctions:uzt,mergeFunctions:{...uzt,...Object.fromEntries(Object.entries(i).filter(([r,a])=>Object.hasOwn(uzt,r)).map(([r,a])=>a===!1?[r,uzt.mergeOthers]:[r,a]))},metaDataUpdater:i.metaDataUpdater??GEa,deepmerge:t,useImplicitDefaultMerging:i.enableImplicitDefaultMerging??!1,filterValues:i.filterValues===!1?void 0:i.filterValues??KEa,actions:b7e}}function FWn(i,t,r){var c;let a=((c=t.filterValues)==null?void 0:c.call(t,i,r))??i;if(a.length===0)return;if(a.length===1)return XVr(a,t,r);let o=kWn(a[0]);if(o!==0&&o!==5){for(let f=1;f<a.length;f++)if(kWn(a[f])!==o)return XVr(a,t,r)}switch(o){case 1:return oCa(a,t,r);case 2:return uCa(a,t,r);case 3:return cCa(a,t,r);case 4:return lCa(a,t,r);default:return XVr(a,t,r)}}function oCa(i,t,r){let a=t.mergeFunctions.mergeRecords(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(i,t,r):a}function uCa(i,t,r){let a=t.mergeFunctions.mergeArrays(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(i):a}function cCa(i,t,r){let a=t.mergeFunctions.mergeSets(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(i):a}function lCa(i,t,r){let a=t.mergeFunctions.mergeMaps(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(i):a}function XVr(i,t,r){let a=t.mergeFunctions.mergeOthers(i,t,r);return a===b7e.defaultMerge||t.useImplicitDefaultMerging&&a===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(i):a}var b7e,TPs,TWn,IWn,uzt,ZVr=zt(()=>{b7e={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},TPs={defaultMerge:b7e.defaultMerge};e(GEa,"defaultMetaDataUpdater");e(KEa,"defaultFilterValues");(function(i){i[i.NOT=0]="NOT",i[i.RECORD=1]="RECORD",i[i.ARRAY=2]="ARRAY",i[i.SET=3]="SET",i[i.MAP=4]="MAP",i[i.OTHER=5]="OTHER"})(TWn||(TWn={}));e(kWn,"getObjectType");e(YEa,"getKeys");e(XEa,"objectHasProperty");e(PWn,"getIterableOfIterables");IWn=["[object Object]","[object Module]"];e(ZEa,"isRecord");e(eCa,"mergeRecords$1");e(tCa,"mergeArrays$1");e(rCa,"mergeSets$1");e(nCa,"mergeMaps$1");e(iCa,"mergeOthers$1");uzt={mergeRecords:eCa,mergeArrays:tCa,mergeSets:rCa,mergeMaps:nCa,mergeOthers:iCa};e(czt,"deepmerge");e(aCa,"deepmergeCustom");e(sCa,"getUtils");e(FWn,"mergeUnknowns");e(oCa,"mergeRecords");e(uCa,"mergeArrays");e(cCa,"mergeSets");e(lCa,"mergeMaps");e(XVr,"mergeOthers")});function wS(...i){pCa&&console.log(...i)}async function JLn(i,t,r,a=6e4){if(!(t in i))return i;let o=e(()=>i[t](...r),"executor");return a===null?o():_T(o(),a,"Execution timeout")}function ezr(i,{role:t,environment:r}={},a=!1){var _,b;let o;if(r&&(o=(_=i.environments)==null?void 0:_.find(({name:C})=>r===C)),o||(o=(b=i.environments)==null?void 0:b.find(({default:C})=>C)),!o)throw new Error("Environment not found. Please make sure your environments are properly defined in the checksum.config.ts file.");let c=o.users,f;if(c&&(t!==void 0&&(f=c.find(C=>C.role===t)),f||(f=c.find(C=>C.default))),!f)throw new Error(`User not found. Please make sure the users array for the "${o.name}" environment is properly defined in the checksum.config.ts file.`);if(r&&o.name!==r){if(a)throw new Error(`Could not find environment with name "${r}" in config file`);console.warn(`Could not find environment with name "${r}" in config file, trying to use default environment`)}if(t&&f.role!==t){if(a)throw new Error(`Could not find user with role "${t}" for environment "${r}" in config file`);console.warn(`Could not find user with role "${t}" for environment "${r}" in config file, trying to login with environment's default user`)}return{environment:o,user:f}}function fCa(i){let t=`${i??m4e()}/login.ts`;if(!(0,lzt.existsSync)(t))throw console.warn(`Could not locate the login.ts file. Please make sure your login file exists at ${t}`),new Error("Could not find login.ts file");try{return require(t).default}catch(r){throw console.warn("Error loading login.ts file",r),r}}async function dCa(i,t,{environment:r,user:a,config:o}){try{let c=e(()=>t(i,{environment:r,user:a,config:o}),"performLogin");"checksumAI"in i?await i.checksumAI(`Log in${a!=null&&a.role?` using ${a.role} role`:""}${r!=null&&r.name?` in ${r.name} environment`:""}`,c,{skipAutoRecovery:!0}):await c()}catch(c){throw console.warn(`The login method threw an exception, please check the login.ts file for the following error:
|
|
634
634
|
`,c),c}}function KVr(i){let{config:t,folder:r,throwIfAuthFailed:a}=i,o=fCa(r);return async(c,{role:f,environment:_}={})=>{let{environment:b,user:C}=ezr(t,{role:f,environment:_},i.throwIfEnvInfoInvalid);if(a&&!C)throw new Error("Could not find user credentials matching the provided role and/or environment");await dCa(c,o,{environment:b,user:C,config:t})}}function lMn(){if(fWe)return fWe;try{let i=(0,lzt.existsSync)(`${m4e()}/checksum.config.ts`)?"checksum.config.ts":(0,lzt.existsSync)(`${m4e()}/checksum.config.tmp.ts`)?"checksum.config.tmp.ts":void 0;if(i)return NWn(require(`${m4e()}/${i}`).default)}catch{console.warn("Could not find checksum config file, will run with defaults")}return NWn()}function NWn(i={}){var r,a,o,c;let t={apiKey:void 0,runMode:"normal",apiURL:"https://api.checksum.ai",options:{useChecksumSelectors:!0,useChecksumAI:{actions:!0,assertions:!1,skipTestsWithKnownBugs:!0},newAssertionsEnabled:!0,useMockData:!1,printLogs:!1,hideReports:process.env.AUTHORIZE_REPORTS==="true"}};return((a=(r=i.options)==null?void 0:r.useChecksumAI)==null?void 0:a.visualComparison)===void 0&&((c=(o=i.options)==null?void 0:o.useChecksumAI)!=null&&c.assertions)&&(i.options.useChecksumAI.visualComparison=!0),fWe=czt(t,i),i_.testRun.disableAutoRecovery&&(fWe.options.useChecksumAI={actions:!1,assertions:!1,visualComparison:!1}),i_.testRun.disableHostReports&&(fWe.options.hostReports=!1),fWe}function YVr(i){let t=e(r=>{r.on("dialog",a=>{})},"makeDialogHandler");i.context().pages().forEach(t),i.context().on("page",r=>{t(r)})}var lzt,pCa,fWe,amt,_ie=zt(()=>{"use strict";DWn();lD();_4e();lzt=require("fs");P8();ZVr();pCa=!1;e(wS,"log");e(JLn,"executePlaywrightMethodWithTimeout");e(ezr,"resolveEnvironment");e(fCa,"requireLogin");e(dCa,"proceedWithLogin");e(KVr,"makeUnboundLogin");e(lMn,"loadChecksumConfig");e(NWn,"getChecksumConfig");e(YVr,"preventDialogAutoDismissal");amt="Checksum failed connecting to the server"});var lzr,gzt,VWn=zt(()=>{"use strict";lzr=class lzr{constructor(t,r){this.config=t;this.baseURL=t.apiURL+r}getBaseURL(){return this.baseURL}get(t){let r=`${this.baseURL}/${t}`;return fetch(r,{method:"GET",headers:{ChecksumAppCode:this.config.apiKey}})}put(t,r){return fetch(`${this.baseURL}/${t}`,{method:"PUT",headers:{"Content-Type":"application/json",ChecksumAppCode:this.config.apiKey},body:r?JSON.stringify(r):void 0})}post(t,r){return fetch(`${this.baseURL}/${t}`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:this.config.apiKey},body:r?JSON.stringify(r):void 0})}delete(t){return fetch(`${this.baseURL}/${t}`,{method:"DELETE",headers:{ChecksumAppCode:this.config.apiKey}})}putFile(t,r){return fetch(t,{method:"PUT",headers:{"Content-Type":r.type},body:r})}};e(lzr,"RuntimeAPIService");gzt=lzr});var pzr,yzt,zWn=zt(()=>{"use strict";VWn();pzr=class pzr extends gzt{constructor(r){super(r,"/client-api/runtime");this.config=r}};e(pzr,"VtgCloudAPIService");yzt=pzr});var fzr=Er((cNs,JWn)=>{function CCa(i){r.debug=r,r.default=r,r.coerce=b,r.disable=f,r.enable=o,r.enabled=_,r.humanize=fFe(),r.destroy=C,Object.keys(i).forEach(w=>{r[w]=i[w]}),r.names=[],r.skips=[],r.formatters={};function t(w){let T=0;for(let k=0;k<w.length;k++)T=(T<<5)-T+w.charCodeAt(k),T|=0;return r.colors[Math.abs(T)%r.colors.length]}e(t,"selectColor"),r.selectColor=t;function r(w){let T,k=null,R,B;function U(...W){if(!U.enabled)return;let X=U,ne=Number(new Date),ce=ne-(T||ne);X.diff=ce,X.prev=T,X.curr=ne,T=ne,W[0]=r.coerce(W[0]),typeof W[0]!="string"&&W.unshift("%O");let fe=0;W[0]=W[0].replace(/%([a-zA-Z%])/g,(De,Fe)=>{if(De==="%%")return"%";fe++;let ke=r.formatters[Fe];if(typeof ke=="function"){let Oe=W[fe];De=ke.call(X,Oe),W.splice(fe,1),fe--}return De}),r.formatArgs.call(X,W),(X.log||r.log).apply(X,W)}return e(U,"debug"),U.namespace=w,U.useColors=r.useColors(),U.color=r.selectColor(w),U.extend=a,U.destroy=r.destroy,Object.defineProperty(U,"enabled",{enumerable:!0,configurable:!1,get:e(()=>k!==null?k:(R!==r.namespaces&&(R=r.namespaces,B=r.enabled(w)),B),"get"),set:e(W=>{k=W},"set")}),typeof r.init=="function"&&r.init(U),U}e(r,"createDebug");function a(w,T){let k=r(this.namespace+(typeof T>"u"?":":T)+w);return k.log=this.log,k}e(a,"extend");function o(w){r.save(w),r.namespaces=w,r.names=[],r.skips=[];let T=(typeof w=="string"?w:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let k of T)k[0]==="-"?r.skips.push(k.slice(1)):r.names.push(k)}e(o,"enable");function c(w,T){let k=0,R=0,B=-1,U=0;for(;k<w.length;)if(R<T.length&&(T[R]===w[k]||T[R]==="*"))T[R]==="*"?(B=R,U=k,R++):(k++,R++);else if(B!==-1)R=B+1,U++,k=U;else return!1;for(;R<T.length&&T[R]==="*";)R++;return R===T.length}e(c,"matchesTemplate");function f(){let w=[...r.names,...r.skips.map(T=>"-"+T)].join(",");return r.enable(""),w}e(f,"disable");function _(w){for(let T of r.skips)if(c(w,T))return!1;for(let T of r.names)if(c(w,T))return!0;return!1}e(_,"enabled");function b(w){return w instanceof Error?w.stack||w.message:w}e(b,"coerce");function C(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e(C,"destroy"),r.enable(r.load()),r}e(CCa,"setup");JWn.exports=CCa});var WWn=Er((cG,vzt)=>{cG.formatArgs=SCa;cG.save=DCa;cG.load=TCa;cG.useColors=wCa;cG.storage=kCa();cG.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();cG.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function wCa(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e(wCa,"useColors");function SCa(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+vzt.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;i.splice(1,0,t,"color: inherit");let r=0,a=0;i[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(a=r))}),i.splice(a,0,t)}e(SCa,"formatArgs");cG.log=console.debug||console.log||(()=>{});function DCa(i){try{i?cG.storage.setItem("debug",i):cG.storage.removeItem("debug")}catch{}}e(DCa,"save");function TCa(){let i;try{i=cG.storage.getItem("debug")||cG.storage.getItem("DEBUG")}catch{}return!i&&typeof process<"u"&&"env"in process&&(i=process.env.DEBUG),i}e(TCa,"load");function kCa(){try{return localStorage}catch{}}e(kCa,"localstorage");vzt.exports=fzr()(cG);var{formatters:ICa}=vzt.exports;ICa.j=function(i){try{return JSON.stringify(i)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var GWn=Er((LR,xzt)=>{var PCa=require("tty"),bzt=require("util");LR.init=MCa;LR.log=BCa;LR.formatArgs=NCa;LR.save=RCa;LR.load=LCa;LR.useColors=FCa;LR.destroy=bzt.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");LR.colors=[6,2,3,4,5,1];try{let i=p_t();i&&(i.stderr||i).level>=2&&(LR.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}LR.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,c)=>c.toUpperCase()),a=process.env[t];return/^(yes|on|true|enabled)$/i.test(a)?a=!0:/^(no|off|false|disabled)$/i.test(a)?a=!1:a==="null"?a=null:a=Number(a),i[r]=a,i},{});function FCa(){return"colors"in LR.inspectOpts?!!LR.inspectOpts.colors:PCa.isatty(process.stderr.fd)}e(FCa,"useColors");function NCa(i){let{namespace:t,useColors:r}=this;if(r){let a=this.color,o="\x1B[3"+(a<8?a:"8;5;"+a),c=` ${o};1m${t} \x1B[0m`;i[0]=c+i[0].split(`
|
|
635
635
|
`).join(`
|
|
636
636
|
`+c),i.push(o+"m+"+xzt.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=OCa()+t+" "+i[0]}e(NCa,"formatArgs");function OCa(){return LR.inspectOpts.hideDate?"":new Date().toISOString()+" "}e(OCa,"getDate");function BCa(...i){return process.stderr.write(bzt.formatWithOptions(LR.inspectOpts,...i)+`
|