@remotex-labs/xjet 1.0.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/shared.js ADDED
@@ -0,0 +1,74 @@
1
+ var yi=Object.create;var Me=Object.defineProperty;var gi=Object.getOwnPropertyDescriptor;var it=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ie=t=>{throw TypeError(t)};var vi=(t,e,r)=>e in t?Me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e)=>Me(t,"name",{value:e,configurable:!0});var nt=t=>[,,,yi(t?.[it("metadata")]??null)],st=["class","method","getter","setter","accessor","field","value","get","set"],re=t=>t!==void 0&&typeof t!="function"?ie("Function expected"):t,bi=(t,e,r,i,n)=>({kind:st[t],name:e,metadata:i,addInitializer:s=>r._?ie("Already initialized"):n.push(re(s||null))}),xi=(t,e)=>vi(e,it("metadata"),t[3]),ot=(t,e,r,i)=>{for(var n=0,s=t[e>>1],a=s&&s.length;n<a;n++)e&1?s[n].call(r):i=s[n].call(r,i);return i},at=(t,e,r,i,n,s)=>{var a,c,u,p,y,f=e&7,T=!!(e&8),g=!!(e&16),b=f>3?t.length+1:f?T?1:2:0,ee=st[f+5],te=f>3&&(t[b-1]=[]),Le=t[b]||(t[b]=[]),L=f&&(!g&&!T&&(n=n.prototype),f<5&&(f>3||!g)&&gi(f<4?n:{get[r](){return tt(this,s)},set[r](I){return rt(this,s,I)}},r));f?g&&f<4&&o(s,(f>2?"set ":f>1?"get ":"")+r):o(n,r);for(var Oe=i.length-1;Oe>=0;Oe--)p=bi(f,r,u={},t[3],Le),f&&(p.static=T,p.private=g,y=p.access={has:g?I=>Ei(n,I):I=>r in I},f^3&&(y.get=g?I=>(f^1?tt:Ti)(I,n,f^4?s:L.get):I=>I[r]),f>2&&(y.set=g?(I,je)=>rt(I,n,je,f^4?s:L.set):(I,je)=>I[r]=je)),c=(0,i[Oe])(f?f<4?g?s:L[ee]:f>4?void 0:{get:L.get,set:L.set}:n,p),u._=1,f^4||c===void 0?re(c)&&(f>4?te.unshift(c):f?g?s=c:L[ee]=c:n=c):typeof c!="object"||c===null?ie("Object expected"):(re(a=c.get)&&(L.get=a),re(a=c.set)&&(L.set=a),re(a=c.init)&&te.unshift(a));return f||xi(t,n),L&&Me(n,r,L),g?f^4?s:L:n};var Be=(t,e,r)=>e.has(t)||ie("Cannot "+r),Ei=(t,e)=>Object(e)!==e?ie('Cannot use the "in" operator on this value'):t.has(e),tt=(t,e,r)=>(Be(t,e,"read from private field"),r?r.call(t):e.get(t));var rt=(t,e,r,i)=>(Be(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Ti=(t,e,r)=>(Be(t,e,"access private method"),r);var ki={dim:[2,22],bold:[1,22],reset:[0,0],hidden:[8,28],inverse:[7,27]},wi={red:[31,39],gray:[90,39],blue:[34,39],cyan:[36,39],black:[30,39],white:[37,39],green:[32,39],yellow:[33,39],magenta:[35,39],redBright:[91,39],blueBright:[94,39],cyanBright:[96,39],whiteBright:[97,39],greenBright:[92,39],blackBright:[90,39],yellowBright:[93,39],magentaBright:[95,39],darkGray:["38;5;238",39],lightGray:["38;5;252",39],lightCyan:["38;5;81",39],lightCoral:["38;5;203",39],oliveGreen:["38;5;149",39],deepOrange:["38;5;166",39],brightPink:["38;5;197",39],lightOrange:["38;5;215",39],burntOrange:["38;5;208",39],lightYellow:["38;5;230",39],canaryYellow:["38;5;227",39],lightGoldenrodYellow:["38;5;221",39]},Si={bgRed:[41,49],bgBlue:[44,49],bgCyan:[46,49],bgGray:[100,49],bgBlack:[40,49],bgGreen:[42,49],bgWhite:[47,49],bgYellow:[43,49],bgMagenta:[45,49],bgRedBright:[101,49],bgBlueBright:[104,49],bgCyanBright:[106,49],bgBlackBright:[100,49],bgWhiteBright:[107,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgMagentaBright:[105,49]},ct={...ki,...wi,...Si},fe="\x1B[",de="m";function lt(t,e){if(globalThis.NO_COLOR)return e;let r=t.length;if(r===0)return e;if(r===1)return`${fe}${t[0][0]}${de}${e}${fe}${t[0][1]}${de}`;let i=new Array(r),n=new Array(r);for(let s=0;s<r;s++)n[s]=`${fe}${t[s][0]}${de}`,i[r-s-1]=`${fe}${t[s][1]}${de}`;return n.concat(e,i).join("")}o(lt,"I");function me(t,e,r,i){if(typeof e!="number"||typeof r!="number"||typeof i!="number")throw new Error(`RGB values must be numbers, received: r=${typeof e}, g=${typeof r}, b=${typeof i}`);let n=t==="fg"?38:48,s=t==="fg"?39:49;return[`${n};2;${e};${r};${i}`,s]}o(me,"y");function ut(t){let e=t.replace(/^#/,"").toLowerCase();if(!/^([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(e))throw new Error(`Invalid hex color format: "${t}". Expected 3 or 6 hex digits.`);if(e.length===3){let s=parseInt(e[0]+e[0],16),a=parseInt(e[1]+e[1],16),c=parseInt(e[2]+e[2],16);return[s,a,c]}let r=parseInt(e.slice(0,2),16),i=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16);return[r,i,n]}o(ut,"_");function Y(t=[]){let e=o((...i)=>{if(Array.isArray(i[0])&&"raw"in i[0]){let[n,...s]=i,a=n.reduce((c,u,p)=>c+u+(p<s.length?String(s[p]??""):""),"");return lt(t,a)}return lt(t,i.join(" "))},"e"),r={rgb:o((i,n,s)=>Y([...t,me("fg",i,n,s)]),"rgb"),bgRgb:o((i,n,s)=>Y([...t,me("bg",i,n,s)]),"bgRgb"),hex:o(i=>Y([...t,me("fg",...ut(i))]),"hex"),bgHex:o(i=>Y([...t,me("bg",...ut(i))]),"bgHex")};return new Proxy(e,{get(i,n){if(typeof n!="string")throw new Error(`Invalid property: ${String(n)}`);return n in ct?Y([...t,ct[n]]):n in r?r[n]:Reflect.get(i,n)}})}o(Y,"m");var P=Y();var $i=Object.defineProperty,l=o((t,e)=>$i(t,"name",{value:e,configurable:!0}),"o");function vt(t,e){return e!=null&&(e.constructor===t||typeof e=="function")}o(vt,"nt");l(vt,"isA");function ve(t,e){return t==null||typeof t!="object"&&typeof t!="function"?!1:e in t||Object.prototype.hasOwnProperty.call(t,e)}o(ve,"X");l(ve,"hasKey");function A(t){return!!t&&ve(t,"expectedLabel")&&vt(Function,t.matches)}o(A,"b");l(A,"isAsymmetric");function ze(t,e){let r=A(t),i=A(e);if(!(r&&i)){if(r)return t.matches(e);if(i)return e.matches(t)}}o(ze,"ce");l(ze,"asymmetricMatch");function bt(t,e,r=!0){if(Array.isArray(t)&&Array.isArray(e))return r&&t.length!==e.length?!1:t.every((s,a)=>x(s,e[a],r));let i=Object.keys(t),n=Object.keys(e);if(r&&i.length!==n.length)return!1;for(let s of i)if(!ve(e,s)||!x(t[s],e[s],r))return!1;return!0}o(bt,"it");l(bt,"deepEquals");function x(t,e,r=!0){if(t===e||Object.is(t,e))return!0;if(t===null||e===null)return!1;let i=ze(t,e);return i!==void 0?i:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():t instanceof RegExp&&e instanceof RegExp?t.source===e.source&&t.flags===e.flags:globalThis.URL&&t instanceof globalThis.URL&&e instanceof globalThis.URL?t.href===e.href:typeof t=="object"&&typeof e=="object"?bt(t,e,r):!1}o(x,"g");l(x,"equals");function xt(t){let e={};for(let r of Object.keys(t)){let i=t[r];i&&(e[r]=i)}return e.name=t.name,e.stack=t.stack,e.message=t.message,e}o(xt,"de");l(xt,"serializesError");function X(t){return t!=null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}o(X,"me");l(X,"isPromise");var Et=" ";function Tt(t){return typeof t=="string"?t.includes(`
2
+ `)?null:`"${t}"`:typeof t=="number"?`${Number.isFinite(t)?t:t.toString()}`:typeof t=="boolean"?`${t}`:typeof t=="symbol"?`${t.toString()}`:typeof t=="bigint"?`${t}n`:typeof t=="function"?`[Function: ${t.name||"anonymous"}]`:t===null?"null":t===void 0?"undefined":A(t)?t.expectedLabel??t.constructor.name:t instanceof Date?`[Date: ${t.toISOString()}]`:t instanceof RegExp?t.toString():t instanceof Error?`[${t.name}: ${t.message}]`:t instanceof Promise?"[Promise <pending>]":t instanceof ArrayBuffer?`ArrayBuffer { byteLength: ${t.byteLength} }`:t instanceof DataView?`DataView { byteLength: ${t.byteLength}, byteOffset: ${t.byteOffset} }`:null}o(Tt,"st");l(Tt,"serializePrimitive");function kt(t){return t===null?"null":t===void 0?"undefined":typeof t=="object"?Object.prototype.toString.call(t):JSON.stringify(t)}o(kt,"ot");l(kt,"serializeMapKey");function ne(t,e,r,i,n=""){if(t.length===0)return;if(t.length<2){let a=`${n}${r}${t[t.length-1]}`;e.push(i?a:`${a},`);return}e.push(`${n}${r}${t[0]}`);for(let a=1;a<t.length-1;a++)e.push(n+t[a]);let s=`${n}${t[t.length-1]}`;e.push(i?s:`${s},`)}o(ne,"Q");l(ne,"appendLines");function wt(t,e,r,i){if(t.size===0){e.push("Map {}");return}e.push("Map {");let n=Array.from(t.entries());n.forEach(([s,a],c)=>{let u=kt(s),p=[];Z(a,p,r,i),ne(p,e,`${u} => `,c===n.length-1,r)}),e.push("}")}o(wt,"ct");l(wt,"serializeMap");function St(t,e,r,i){if(t.length===0){e.push("[]");return}e.push("["),t.forEach((n,s)=>{let a=[];Z(n,a,r,i),ne(a,e,"",s===t.length-1,r)}),e.push("]")}o(St,"at");l(St,"serializeArray");function $t(t,e,r,i){if(t.size===0){e.push("Set {}");return}e.push("Set {");let n=Array.from(t);n.forEach((s,a)=>{let c=[];Z(s,c,r,i),ne(c,e,"",a===n.length-1,r)}),e.push("}")}o($t,"ut");l($t,"serializeSet");function At(t,e,r){let i=Array.from(t);if(i.length===0){e.push("Buffer {}");return}e.push("Buffer {");for(let n=0;n<i.length;n++){let s=i[n],a=n===i.length-1?"":",";e.push(`${r}${s}${a}`)}e.push("}")}o(At,"ht");l(At,"serializeBuffer");function Ct(t,e,r){let i=Object.prototype.toString.call(t).slice(8,-1),n=Array.from(t);if(n.length===0){e.push(`${i} []`);return}e.push(`${i} [`);for(let s=0;s<n.length;s++){let a=n[s],c=s===n.length-1?"":",";e.push(`${r}${a}${c}`)}e.push("]")}o(Ct,"pt");l(Ct,"serializeTypedArray");function Pe(t,e,r,i){let n=t.constructor&&t.constructor!==Object?t.constructor.name:"Object",s=Object.entries(t);if(s.length===0){e.push(`${n} {}`);return}e.push(`${n} {`),s.forEach(([a,c],u)=>{let p=[];Z(c,p,r,i),ne(p,e,`${String(a)}: `,u===s.length-1,r)}),e.push("}")}o(Pe,"ye");l(Pe,"serializeObject");function Z(t,e,r=Et,i){let n=Tt(t);if(n!==null){e.push(n);return}if(typeof t=="string"){let s=t.split(`
3
+ `);e.push('String "');for(let a of s)e.push(`${r}${a}`);e.push('"');return}if(typeof t=="object"&&t!==null){if(i.has(t)){e.push("[Circular]");return}i.add(t),t instanceof Map?wt(t,e,r,i):Array.isArray(t)?St(t,e,r,i):t instanceof Set?$t(t,e,r,i):t instanceof Buffer?At(t,e,r):ArrayBuffer.isView(t)&&!(t instanceof DataView)?Ct(t,e,r):Pe(t,e,r,i);return}Pe(t,e,r,i)}o(Z,"B");l(Z,"serializeValue");function H(t){if(t&&typeof t=="object"){if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let e={};for(let[r,i]of Object.entries(t))i!==void 0&&(e[r]=i);return e.name=t?.name??e.name,e.message=t?.message??e.message,e.stack=t?.stack??e.stack,e}return t}o(H,"ae");l(H,"serializeError");function k(t,e=Et){let r=[];return Z(t,r,e,new WeakSet),r}o(k,"v");l(k,"serialize");var Ai=(t=>(t[t.DELETE=-1]="DELETE",t[t.EQUAL=0]="EQUAL",t[t.INSERT=1]="INSERT",t))(Ai||{});function It(){let t=0;for(;this.aStart+t<this.aEnd&&this.bStart+t<this.bEnd&&this.isMatch(this.aStart+t,this.bStart+t);)t++;return t}o(It,"lt");l(It,"countCommonForward");function Rt(){let t=0;for(;this.aEnd-1-t>=this.aStart&&this.bEnd-1-t>=this.bStart&&this.isMatch(this.aEnd-1-t,this.bEnd-1-t);)t++;return t}o(Rt,"ft");l(Rt,"countCommonBackward");function Lt(t,e,r){let i=this.aEnd-this.aStart,n=this.bEnd-this.bStart,s=[];for(let a=r;a>0;a--){let c=t[a-1],u=i-n,p,y=c[u-1+e],f=c[u+1+e];u===-a||u!==a&&y<f?p=u+1:p=u-1;let T=p+e,g=c[T],b=g-p;for(;i>g&&n>b;)--i,--n,s.push([1,this.aStart+i,this.bStart+n]);i===g?s.push([0,this.aStart+g,this.bStart+b]):s.push([0,this.aStart+g,this.bStart+b]),i=g,n=b}for(let a of s.reverse())this.foundSubsequence(...a)}o(Lt,"dt");l(Lt,"backtrackFlat");function Ot(){let t=this.aEnd-this.aStart,e=this.bEnd-this.bStart,r=t+e,i=0,n=new Array(2*r+1).fill(0),s=[];for(let a=0;a<=r;a++){let c=new Array(2*r+1);s[a]=c;for(let u=-a;u<=a;u+=2){let p=u+r,y;u===-a||u!==a&&n[u-1+r]<n[u+1+r]?y=n[u+1+r]:y=n[u-1+r]+1;let f=y-u;for(;y<t&&f<e&&this.isMatch(this.aStart+y,this.bStart+f);)y++,f++;if(n[p]=y,c[p]=y,y>=t&&f>=e)return i=a,Lt.call(this,s,r,i)}}}o(Ot,"mt");l(Ot,"findMiddleSnake");function jt(){let t=It.call(this),e=this.aStart+t>=this.aEnd&&this.bStart+t>=this.bEnd;if(t>0&&(this.foundSubsequence(t,this.aStart,this.bStart),e))return;this.aStart+=t,this.bStart+=t;let r=Rt.call(this);this.aEnd-=r,this.bEnd-=r,(this.aStart<this.aEnd||this.bStart<this.bEnd)&&Ot.call(this),r>0&&this.foundSubsequence(r,this.aEnd,this.bEnd)}o(jt,"yt");l(jt,"diffSequence");function Fe(t,e,r,i){let n={aStart:0,bStart:0,aEnd:t,bEnd:e,isMatch:r,foundSubsequence:i};jt.call(n)}o(Fe,"ve");l(Fe,"createDiff");function De(t,e){let r=0,i=0,n="",s="",a=[];function c(u,p){let y=a[a.length-1];y&&y[0]===u?y[1]+=p:a.push([u,p])}return o(c,"a"),l(c,"pushDiff"),Fe(t.length,e.length,(u,p)=>t[u]===e[p],(u,p,y)=>{r!==p&&(s+=t.slice(r,p)),i!==y&&(n+=e.slice(i,y)),u>0&&(s&&(c(-1,s),s=""),n&&(c(1,n),n=""),c(0,e.slice(y,y+u))),r=p+u,i=y+u}),r!==t.length&&(s+=t.slice(r)),i!==e.length&&(n+=e.slice(i)),s&&a.push([-1,s]),n&&a.push([1,n]),a}o(De,"G");l(De,"diffStringsRaw");function He(t,e){let r=0,i=0,n=[];for(Fe(t.length,e.length,(s,a)=>{let c=t[s].trimEnd().endsWith(","),u=e[a].trimEnd().endsWith(",");return c&&!u?e[a]+=",":!c&&u&&(t[s]+=","),t[s]===e[a]},(s,a,c)=>{for(;r!==a;r+=1)n.push([-1,t[r]]);for(;i!==c;i+=1)n.push([1,e[i]]);for(;s!==0;s-=1,r+=1,i+=1)n.push([0,e[i]])});r!==t.length;r+=1)n.push([-1,t[r]]);for(;i!==e.length;i+=1)n.push([1,e[i]]);return n}o(He,"Z");l(He,"diffLinesRaw");function _e(t){let e=[],r=[],i=[],n=l(()=>{e.length&&(i.push([-1,e.join("")]),e=[]),r.length&&(i.push([1,r.join("")]),r=[])},"flushBuffers");for(let s=0;s<t.length;s++){let[a,c]=t[s];if(a===0){if(c.length<=1){let u=s>0?t[s-1][0]:null,p=s+1<t.length?t[s+1][0]:null,y=l(f=>f===-1||f===1,"isEdit");if(y(u)&&y(p)){for(let f of c)e.push(f),r.push(f);continue}}n(),i.push([0,c])}else if(a===-1)for(let u of c)e.push(u);else if(a===1)for(let u of c)r.push(u);else n(),i.push([a,c])}return n(),i}o(_e,"_");l(_e,"cleanupSemantic");var M=P.dim,Ci=P.lightOrange,h=P.lightCoral,m=P.oliveGreen,Mt=P.cyan,N=P.inverse,An=P.whiteBright;function O(t){return t===null?"null":t===!0?"true":t===!1?"false":t&&typeof t=="object"?t.constructor?.name??"Object":typeof t}o(O,"k");l(O,"getType");function Bt(t,e,r=!0){let i="",n="",s=De(t||" ",e||" ");r&&(s=_e(s));for(let[a,c]of s)a===0?(i+=c,n+=c):a===-1?i+=N(c):a===1&&(n+=N(c));return[i,n]}o(Bt,"gt");l(Bt,"normalizeStrings");function Pt(t,e){let r=[...t],i=[...e],n=Math.max(t.length,e.length);for(let s=0;s<n;s++)[r[s],i[s]]=se(t[s],e[s]);return[r,i]}o(Pt,"vt");l(Pt,"normalizeArrays");function Nt(t,e){let r={...t},i={...e},n=new Set([...Object.keys(t),...Object.keys(e)]);for(let s of n)s in t&&s in e&&([r[s],i[s]]=se(t[s],e[s]));return[r,i]}o(Nt,"Et");l(Nt,"normalizeObjects");function se(t,e,r=!0){if(t===e)return[t,e];let i=typeof t,n=typeof e;return ze(t,e)===!0?(A(t)&&(t=e),A(e)&&(e=t),[t,e]):i==="string"&&n==="string"?Bt(t,e,r):!t||!e||i!=="object"||n!=="object"?[t,e]:Array.isArray(t)&&Array.isArray(e)?Pt(t,e):Nt(t,e)}o(se,"ee");l(se,"normalizeAsymmetric");function zt(t,e,r,i=!0){let n=t.split(`
4
+ `),s=e.split(`
5
+ `);r.push(Mt(`
6
+ @@ -1,${n.length} +1,${s.length} @@
7
+ `));let a=Math.max(n.length,s.length);for(let c=0;c<a;c++){let u=n[c],p=s[c];if(u===p){u&&r.push(M(` ${u}`));continue}let y=[],f=[];if(u!==void 0&&p!==void 0){let T=De(u||" ",p||" ");i&&(T=_e(T));for(let[g,b]of T)g===0?(y.push(b),f.push(b)):g===-1?y.push(N(b)):g===1&&f.push(N(b))}u===void 0&&f.push(p),!p===void 0&&y.push(u),y.length>0&&r.push(m(`- ${y.join("")}`)),f.length>0&&r.push(h(`+ ${f.join("")}`))}return r.join(`
8
+ `)}o(zt,"bt");l(zt,"diffStrings");function ge(t,e){let r=[];[t,e]=se(t,e,!0);let i=k(t,""),n=k(e,""),s=He(i,n);for(let[a,c]of s){let u=c,p="";u.endsWith(",")&&(u=u.slice(0,-1),p=","),a===0?r.push(M(u)+p):a===1&&r.push(h(u)+p)}return r}o(ge,"te");l(ge,"diffArgs");function be(t,e,r=!0){let i=O(t),n=O(e),s=[];if(i!==n&&(s.push("Expected type: "+m(i)),s.push("Received type: "+h(n))),i==="string"&&n==="string")return zt(t,e,s,r);let[a,c]=se(t,e,r),u=k(a),p=k(c);s.push(Mt(`
9
+ @@ -1,${u.length} +1,${p.length} @@
10
+ `));let y=He(u,p);for(let[f,T]of y)f===0?s.push(M(` ${T}`)):f===-1?s.push(m(`- ${T}`)):f===1&&s.push(h(`+ ${T}`));return s.join(`
11
+ `)}o(be,"D");l(be,"diffComponent");var Ke=class extends Error{static{o(this,"C")}static{l(this,"xJetBaseError")}constructor(t,e="xJetError"){super(t),Object.setPrototypeOf(this,new.target.prototype),this.name=e,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return xt(this)}};function xe(t){let{comment:e,assertionChain:r,expectedLabels:i=[],receivedLabeled:n="received"}=t;if(!r.length)throw new Error('Expected non-empty matcher chain (e.g., ["toEqual"]). Received an empty array.');let s=[M("expect("),h(n),M(")"),".",r.join(".")];return i.length>0?(s.push("("),s.push(i.map(a=>m(a)).join(", ")),s.push(")")):s.push("()"),e&&s.push(M(" // "+e)),s.join("")}o(xe,"O");l(xe,"composeStatement");var _=class extends Ke{static{o(this,"w")}static{l(this,"xJetTypeError")}constructor(t){let e=[`${xe(t)}
12
+ `,`Matcher error: ${t.message}
13
+ `];t.expected&&(t.expected.type&&e.push(`Expected has type: ${t.expected.type}`),e.push(`Expected has value: ${m(k(t.expected.value).join(`
14
+ `))}`)),t.received&&(t.received.type&&e.push(`Received has type: ${t.received.type}`),e.push(`Received has value: ${h(k(t.received.value).join(`
15
+ `))}`)),super(e.join(`
16
+ `),"xJetTypeError")}},Ii=class extends Ke{static{o(this,"re")}static{l(this,"xJetExpectError")}matcherResult;constructor(t){let e=[`${xe(t)}
17
+ `];t.info&&e.push(...t.info),super(e.join(`
18
+ `),"xJetExpectError"),t.assertion&&(this.matcherResult=t.assertion,this.matcherResult.message=this.message)}};function w(t,e,r,i=[]){let n=O(t);if(!e.includes(n)&&!e.includes(typeof t))throw new _({expectedLabels:i,assertionChain:this.assertionChain,message:`${(r==="Received"?h:m)(r)} value must be a ${e.join(" or ")}`,[r==="Expected"?"expected":"received"]:{value:t,type:n}})}o(w,"E");l(w,"ensureType");function Ue(t,e,r=[]){if(t==null)throw new _({expectedLabels:r,assertionChain:this.assertionChain,message:`${(e==="Received"?h:m)(e)} value must not be null nor undefined`,[e==="Expected"?"expected":"received"]:{value:t}})}o(Ue,"he");l(Ue,"ensureNotNullish");function d(t){return k(t,"").join(" ")}o(d,"l");l(d,"serializeOneLine");function v(t){let{pass:e}=t;if(!(e&&this.notModifier||!e&&!this.notModifier))return;let r=[],i={pass:e,name:this.macherName,received:this.received,expected:t.expected};throw this.notModifier?t.handleNot?.call(this,r):t.handleInfo?.call(this,r),new Ii({info:r,assertion:i,...t,assertionChain:this.assertionChain})}o(v,"y");l(v,"handleFailure");function B(t){v.call(this,{...t,handleNot(e){e.push(`Expected: not ${m(d(this.received))}`)},handleInfo(e){t.note&&e.push(M(t.note),""),e.push(be(t.expected,this.received,!0))}})}o(B,"M");l(B,"handleDiffFailure");function Ft(t,e){let r=" ".repeat(e.length);v.call(this,{...t,handleNot(i){i.push(`Expected: not ${e} ${m(d(t.expected))}`),i.push(`Received: ${r} ${h(d(this.received))}`)},handleInfo(i){i.push(`Expected: ${e} ${m(d(t.expected))}`),i.push(`Received: ${r} ${h(d(this.received))}`)}})}o(Ft,"be");l(Ft,"handleComparisonFailure");function Ne(t){let e=t,r=e!=null&&typeof e.message=="string",i=r&&typeof e.name=="string"&&typeof e.stack=="string";return{isError:i,value:t,message:String(r?e.message:t),hasMessage:i?!0:r,serializedError:H(t)}}o(Ne,"xe");l(Ne,"getThrown");function oe(t,e,r,i=!1){return[l(n=>{n.push(`Expected ${t}: not ${m(e)}`),r?.hasMessage?n.push(`Received message: ${h(d(i?r.message:N(r.message)))}
19
+ `):n.push(`Received value: ${h(d(r?.value))}`)},"handleNot"),l(n=>{n.push(`Expected ${t}: ${m(e)}`),r?.hasMessage?(i&&n.push(`Received name: ${h(d(r.value?.name))}`),n.push(`Received message: ${h(d(r.message))}
20
+ `)):n.push(`Received value: ${h(d(r?.value))}`)},"handleInfo")]}o(oe,"ne");l(oe,"buildInfo");function Dt(t,e){let r=e!=null&&e.value instanceof t,[i,n]=oe("constructor",t.name,e);return[r,i,n]}o(Dt,"xt");l(Dt,"toThrowExpectedClass");function Ht(t,e){let r=e!=null&&e.message.includes(t),[i,n]=oe("substring",`"${t}"`,e);return[r,i,n]}o(Ht,"St");l(Ht,"toThrowExpectedString");function _t(t,e){let r=e!=null&&t.test(e.message),[i,n]=oe("pattern",d(t),e);return[r,i,n]}o(_t,"Tt");l(_t,"toThrowExpectedRegExp");function Kt(t,e){let r=e!=null&&t.matches(e.value),[i,n]=oe("asymmetric",d(t),e,!0);return[r,i,n]}o(Kt,"wt");l(Kt,"toThrowExpectedAsymmetric");function Ut(t,e){return[e!=null&&x(H(t),e.serializedError),l(r=>{r.push(`Expected: not ${m(d(e.serializedError))}`)},"handleNot"),l(r=>{r.push(be(t,e.serializedError,!0))},"handleInfo")]}o(Ut,"$t");l(Ut,"toThrowExpectedObject");function Jt(t){let e=null,r=t?["expected"]:[];if(this.rejectsModifier)e=Ne(this.received);else if(typeof this.received=="function")try{this.received()}catch(a){e=Ne(a)}else w.call(this,this.received,["function"],"Received",r);let i=!1,n,s;t?typeof t=="function"?[i,n,s]=Dt.call(this,t,e):typeof t=="string"?[i,n,s]=Ht.call(this,t,e):t instanceof RegExp?[i,n,s]=_t.call(this,t,e):A(t)?[i,n,s]=Kt.call(this,t,e):e!==null&&typeof t=="object"?[i,n,s]=Ut.call(this,t,e):w.call(this,t,["string","function","RegExp","object"],"Expected",r):(i=e!=null,n=l(a=>{e?.hasMessage?(a.push(`Error name: ${h(e.value?.name)}`),a.push(`Error message: ${h(d(e.message))}
21
+ `)):a.push(`Error value: ${h(d(e?.value))}`)},"handleNot")),v.call(Object.assign({},this,{received:e?.serializedError}),{pass:i,expected:t,expectedLabels:r,handleNot(a){n?.call(this,a)},handleInfo(a){e?s?.call(this,a):a.push(`${h("Received")} function did not throw`)}})}o(Jt,"Se");l(Jt,"toThrow");function Vt(t){let e=["length"];if(w.call(this,t,["number","bigint"],"Expected",e),!Object.hasOwn(this.received,"length")||!Number.isSafeInteger(this.received.length))throw new _({expectedLabels:e,message:`${h("received")} value must have a length property whose value must be a number`,received:{value:this.received,type:O(this.received)},assertionChain:this.assertionChain});let r=this.received,i=r.length==t;v.call(this,{pass:i,expectedLabels:e,handleNot(n){n.push(`Expected length: not ${m(d(t))}`),n.push(`Received string: ${h(d(r))}`)},handleInfo(n){n.push(`Expected length: ${m(d(t))}`),n.push(`Received length: ${h(d(r.length))}`),n.push(`Received string: ${h(d(r))}`)}})}o(Vt,"Te");l(Vt,"toHaveLength");function Wt(t){let e=["expected"];w.call(this,this.received,["string"],"Received",e),w.call(this,t,["string","RegExp"],"Expected",e);let r=this.received,i=typeof t=="string"?r.includes(t):new RegExp(t).test(r);v.call(this,{pass:i,expectedLabels:e,handleNot(n){n.push(`Expected: not ${m(d(r))}`)},handleInfo(n){t instanceof RegExp?(n.push(`Expected pattern: ${m(d(t))}`),n.push(`Received string: ${h(d(r))}`)):n.push(be(t,r,!0))}})}o(Wt,"we");l(Wt,"toMatch");function ae(t,e,r=[]){if(w.call(this,t,["number","bigint"],e,r),t<0)throw new _({expectedLabels:r,assertionChain:this.assertionChain,message:`${(e==="Received"?h:m)(e)} value must be positive number`,[e==="Received"?"received":"expected"]:{value:t,type:O(t)}})}o(ae,"z");l(ae,"ensurePositiveNumber");function ce(t,e){let r=this.received,i=["Expected"];w.call(this,t,["number","bigint"],"Expected",i),w.call(this,r,["number","bigint"],"Received",i);let n;switch(e){case">":n=r>t;break;case">=":n=r>=t;break;case"<":n=r<t;break;case"<=":n=r<=t;break;default:n=!1}Ft.call(this,{pass:n,expectedLabels:i,expected:t},e)}o(ce,"F");l(ce,"handleNumericComparison");function qt(t,e=2){let r=["expected","precision"];w.call(this,t,["number"],"Expected",r),w.call(this,this.received,["number"],"Received",r);let i=this.received,n=Math.abs(t-i),s=Math.pow(10,-e)/2,a=e<20?s.toFixed(e+1):s.toString(),c=this.notModifier?" ":" ",u=this.notModifier?"not < ":"< ",p=n<s,y=[`Expected precision: ${c}${m(e.toString())}`,`Expected difference: ${u}${m(a)}`,`Received difference: ${c}${h(n.toString())}`];v.call(this,{pass:p,expectedLabels:r,handleNot(f){f.push(`Expected: not ${m(d(t))}`),f.push(`Received: ${h(d(i))}
22
+ `),f.push(...y)},handleInfo(f){f.push(`Expected: ${m(d(t))}`),f.push(`Received: ${h(d(i))}
23
+ `),f.push(...y)}})}o(qt,"$e");l(qt,"toBeCloseTo");function Yt(t){ce.call(this,t,">")}o(Yt,"ke");l(Yt,"toBeGreaterThan");function Gt(t){ce.call(this,t,">=")}o(Gt,"Ae");l(Gt,"toBeGreaterThanOrEqual");function Xt(t){ce.call(this,t,"<")}o(Xt,"Re");l(Xt,"toBeLessThan");function Zt(t){ce.call(this,t,"<=")}o(Zt,"Me");l(Zt,"toBeLessThanOrEqual");function j(t=[]){if(!this.received?.xJetMock||!this.received?.mock)throw new _({expectedLabels:t,assertionChain:this.assertionChain,message:`${h("Received")} value must be a mock or spy function`,received:{value:this.received}})}o(j,"I");l(j,"ensureMock");function F(t){return k(t,"").slice(1,-1).map(e=>m(e.replace(",",""))).join(", ")}o(F,"L");l(F,"serializeCallArgs");function Je(t,e,r,i="->",n=!1,s=3){if(!e?.length)return"";let a=0,c=-1,u=e.length;r&&r>=1&&r<=u&&(c=r-1,a=Math.max(0,Math.min(c-1,u-(s-1))));let p=Math.min(a+s,u),y=String(p).length,f=" ".repeat(i.length+1),T=new Array(p-a);for(let g=a;g<p;g++){let b=e[g],ee=String(g+1).padStart(y," "),te=g===c?`${i} `:f;if(n&&Array.isArray(b)&&b.length<1){T[g-a]=`${te}${ee}: called with 0 arguments`;continue}let Le=n?ge(t,b).slice(1,-1):ge(t,b);T[g-a]=`${te}${ee}: ${Le.join(" ")}`}return T.join(`
24
+ `)}o(Je,"Ie");l(Je,"serializeList");function Qt(t,e,r=[],i=3){if(!e?.length||!r.length)return"";let n=e.length,s=String(n).length+3,a=[];for(let c=0;c<r.length;c++){let u=r[c]-1;if(u<0||u>=n)continue;let p=ge(t,e[u]).slice(1,-1);if(a.push(`${String(u+1).padStart(s," ")}: ${p.join(" ")}`),a.length>=i)break}return a.join(`
25
+ `)}o(Qt,"Ce");l(Qt,"serializeHighlightedCalls");function D(t,e,r,i){return Je(t,e,r,i,!0)}o(D,"N");l(D,"serializeCallList");function G(t,e,r,i){return Je(t,e,r,i,!1)}o(G,"P");l(G,"serializeReturnList");function er(){j.call(this);let t=this.received.mock.calls,e=this.received.mock.calls.length;v.call(this,{pass:e>0,receivedLabeled:this.received.name,handleNot(r){r.push(`Expected calls: ${m("0")}`),r.push(`Received calls: ${h(e.toString())}
26
+ `),r.push(D([],t))},handleInfo(r){r.push(`Expected calls: >= ${m("1")}`),r.push(`Received calls: ${h(e.toString())}
27
+ `)}})}o(er,"je");l(er,"toHaveBeenCalled");function tr(t){let e=["expected"];j.call(this,e),ae.call(this,t,"expected",e);let r=this.received.mock.calls.length;v.call(this,{expected:t,pass:r==t,expectedLabels:e,receivedLabeled:this.received.name,handleNot(i){i.push(`Expected calls: != ${m(t.toString())}`)},handleInfo(i){i.push(`Expected calls: ${m(t.toString())}`),i.push(`Received calls: ${h(r.toString())}
28
+ `)}})}o(tr,"Le");l(tr,"toHaveBeenCalledTimes");function rr(...t){let e=["...args"];j.call(this,e);let r=this.received.mock.calls,i=this.received.mock.calls.length,n=[];r.forEach((a,c)=>{a.length===t.length&&x(t,a)&&n.push(c+1)});let s=n.length>0;v.call(this,{pass:s,expectedLabels:e,expected:t,receivedLabeled:this.received.name,handleNot(a){a.push(`Expected: not ${F(t)}`),a.push(`Received:
29
+
30
+ ${Qt(t,r,n)}
31
+ `),a.push(`Calls: ${h(i.toString())}`)},handleInfo(a){a.push(`Expected: ${F(t)}`),a.push(`Received:
32
+
33
+ ${D(t,r)}
34
+ `),a.push(`Calls: ${h(i.toString())}`)}})}o(rr,"Ne");l(rr,"toHaveBeenCalledWith");function ir(...t){let e=["...args"];j.call(this,e);let r=this.received.mock.calls,i=r.length,n=this.received.mock.calls.at(-1),s=n!==void 0&&x(t,n);v.call(this,{pass:s,expectedLabels:e,expected:t,receivedLabeled:this.received.name,handleNot(a){a.push(`Expected: not ${F(t)}`),a.push(`Received:
35
+
36
+ ${D(t,r,r.length)}
37
+ `),a.push(`Calls: ${h(i.toString())}`)},handleInfo(a){a.push(`Expected: ${F(t)}`),a.push(`Received:
38
+
39
+ ${D(t,r,r.length)}
40
+ `),a.push(`Calls: ${h(i.toString())}`)}})}o(ir,"De");l(ir,"toHaveBeenLastCalledWith");function nr(t,...e){let r=["nthCall","...args"];j.call(this,r),ae.call(this,t,"nthCall",r);let i=this.received.mock.calls,n=i.length,s=this.received.mock.calls.at(t-1),a=s!==void 0&&x(e,s);v.call(this,{pass:a,expectedLabels:r,expected:e,receivedLabeled:this.received.name,handleNot(c){c.push(`nthCall: ${t}`),c.push(`Expected: not ${F(e)}`),c.push(`Received:
41
+
42
+ ${D(e,i,t)}
43
+ `),c.push(`Calls: ${h(n.toString())}`)},handleInfo(c){c.push(`nthCall: ${t}`),c.push(`Expected: ${F(e)}`),c.push(`Received:
44
+
45
+ ${D(e,i,t)}
46
+ `),c.push(`Calls: ${h(n.toString())}`)}})}o(nr,"Oe");l(nr,"toHaveBeenNthCalledWith");function sr(){j.call(this);let t=[],e=this.received.mock.calls.length,r=this.received.mock.results.reduce((i,n)=>n.type==="return"?(t.push(n.value),i+1):i,0);v.call(this,{pass:r>0,receivedLabeled:this.received.name,handleNot(i){i.push(`Expected returns: ${m("0")}`),i.push(`Received returns: ${h(r.toString())}
47
+ `),i.push(G(void 0,t)),i.push(`
48
+ Calls: ${h(e.toString())}`)},handleInfo(i){i.push(`Expected returns: >= ${m("1")}`),i.push(`Received returns: ${h(r.toString())}`),i.push(`Calls: ${h(e.toString())}`)}})}o(sr,"Pe");l(sr,"toHaveReturned");function or(t){let e=["expected"];j.call(this,e),ae.call(this,t,"expected",e);let r=this.received.mock.calls.length,i=this.received.mock.results.reduce((n,s)=>s.type==="return"?n+1:n,0);v.call(this,{expectedLabels:e,pass:i==t,expected:t,receivedLabeled:this.received.name,handleNot(n){n.push(`Expected returns: != ${m(t.toString())}`),n.push(`Calls: ${h(r.toString())}`)},handleInfo(n){n.push(`Expected returns: ${m(t.toString())}`),n.push(`Received returns: ${h(i.toString())}`),n.push(`Calls: ${h(r.toString())}`)}})}o(or,"Be");l(or,"toHaveReturnedTimes");function ar(t){let e=["expected"];j.call(this,e);let r=[],i=this.received.mock.calls.length,n=this.received.mock.results.reduce((c,u)=>u.type==="return"?(r.push(u.value),c+1):c,0),s=r.at(-1),a=r.length>0&&x(t,s);v.call(this,{pass:a,expectedLabels:e,expected:t,receivedLabeled:this.received.name,handleNot(c){c.push(`Expected returns: not ${m(d(t))}`),c.push(`Received returns:
49
+ `),c.push(G(t,r,n)),c.push(`
50
+ Calls: ${h(i.toString())}`)},handleInfo(c){c.push(`Expected returns: ${m(d(t))}`),r.length>0&&(c.push(`Received returns:
51
+ `),c.push(G(t,r,n))),c.push(`
52
+ Returns: ${h(n.toString())}`),c.push(`Calls: ${h(i.toString())}`)}})}o(ar,"ze");l(ar,"toHaveLastReturnedWith");function cr(t,e){let r=["nthCall","expected"];j.call(this,r),ae.call(this,t,"nthCall",r);let i=[],n=this.received.mock.calls.length,s=this.received.mock.results.reduce((u,p)=>p.type==="return"?(i.push(p.value),u+1):u,0),a=i.at(t-1),c=t<=i.length&&x(e,a);v.call(this,{pass:c,expectedLabels:r,expected:e,receivedLabeled:this.received.name,handleNot(u){u.push(`nthCall: ${t}`),u.push(`Expected returns: not ${m(d(e))}`),u.push(`Received returns:
53
+ `),u.push(G(e,i,t)),u.push(`
54
+ Returns: ${h(s.toString())}`),u.push(`Calls: ${h(n.toString())}`)},handleInfo(u){u.push(`nthCall: ${t}`),u.push(`Expected returns: ${m(d(e))}`),u.push(`Received returns:
55
+ `),u.push(G(e,i,t)),u.push(`
56
+ Returns: ${h(s.toString())}`),u.push(`Calls: ${h(n.toString())}`)}})}o(cr,"Fe");l(cr,"toHaveNthReturnedWith");function lr(t){let e=A(t)?t.matches(this.received):Object.is(this.received,t),r=!e&&x(this.received,t)?'If it should pass with deep equality, replace "toBe" with "toEqual"':void 0;B.call(this,{note:r,pass:e,expected:t,comment:"Object.is equality",expectedLabels:["expected"]})}o(lr,"He");l(lr,"toBe");function ur(t){let e=x(this.received,t);B.call(this,{pass:e,expected:t,comment:"deep equality",expectedLabels:["expected"]})}o(ur,"qe");l(ur,"toEqual");function hr(){let t=this.received===null;B.call(this,{pass:t,expected:null})}o(hr,"Ve");l(hr,"toBeNull");function pr(){let t=this.received===void 0;B.call(this,{pass:t,expected:void 0})}o(pr,"We");l(pr,"toBeUndefined");function fr(){let t=Number.isNaN(this.received);B.call(this,{pass:t,expected:NaN})}o(fr,"Je");l(fr,"toBeNaN");function dr(){let t=!!this.received;B.call(this,{pass:t,expected:!0})}o(dr,"Ke");l(dr,"toBeTruthy");function mr(){let t=!this.received;B.call(this,{pass:t,expected:!1})}o(mr,"Ue");l(mr,"toBeFalsy");function yr(){let t=this.received!==void 0;v.call(this,{pass:t,expected:void 0,handleNot(e){e.push(`Expected: ${m(d(void 0))}`)},handleInfo(e){e.push(`Received: ${h(d(this.received))}`)}})}o(yr,"Xe");l(yr,"toBeDefined");function gr(t,e){let r=["path","value"];Ue.call(this,this.received,"Received",r),w.call(this,t,["string","Array"],"Expected path",r);let i=!0,n=this.received,s=[],a=typeof t=="string"?t.split(".").filter(Boolean):t;for(let c of a){if(!n||!Object.hasOwn(n,c)){i=!1;break}s.push(c),n=n[c]}i&&e!==void 0&&(i=x(n,e)),v.call(this,{pass:i,expectedLabels:r,handleNot(c){c.push(`Expected: not ${m(d(a))}
57
+ `),e?c.push(`Expected value: ${m(d(e))}`):c.push(`Received value: ${h(d(n))}`)},handleInfo(c){c.push(`Expected path: ${m(d(a))}`),Object.is(s.join(""),a.join(""))||c.push(`Received path: ${h(d(s))}`),c.push(""),e&&c.push(`Expected value: ${m(d(e))}`),c.push(`Received value: ${h(d(n))}`)}})}o(gr,"Qe");l(gr,"toHaveProperty");function vr(t){let e=["expected"];w.call(this,t,["function"],"Received",e);let r=this.received,i=r instanceof t;v.call(this,{pass:i,expectedLabels:e,handleNot(n){n.push(`Expected constructor: not ${m(t.name)}
58
+ `)},handleInfo(n){n.push(`Expected constructor: ${m(t.name)}`),r!==null&&typeof r=="object"&&Object.getPrototypeOf(r)!==null&&"constructor"in r?n.push(`Received constructor: ${h(r.constructor.name)}`):(n.push(`
59
+ Received value has no prototype`),n.push(`Received value: ${h(d(r))}`))}})}o(vr,"Ye");l(vr,"toBeInstanceOf");function br(t){let e=["expected"];w.call(this,this.received,["string","Array"],"Received",e);let r=this.received,i=O(r);if(typeof r=="string"&&typeof t!="string")throw new _({expectedLabels:e,message:`${m("expected")} value must be a string if ${h("received")} value is a string`,expected:{value:t,type:O(t)},received:{value:r,type:i},assertionChain:this.assertionChain});let n=r.indexOf(t)!==-1;v.call(this,{pass:n,expectedLabels:e,comment:"indexOf",handleNot(s){i==="string"?(s.push(`Expected substring: not ${m(d(t))}`),s.push(`Received string: ${h(d(r)).replace(String(t),N(String(t)))}`)):(s.push(`Expected value: not ${m(d(t))}`),s.push(`Received array: ${h(d(r)).replace(d(t),N(d(t)))}`))},handleInfo(s){i==="string"?(s.push(`Expected substring: ${m(k(t,"").join(`
60
+ `))}`),s.push(`Received string: ${h(k(i,"").join(`
61
+ `))}`)):([...r].findIndex(a=>x(a,t))!==-1&&s.push(M(`Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher.
62
+ You probably need to use \`${Ci("toContainEqual")}\` instead.
63
+ `)),s.push(`Expected value: ${m(d(t))}`),s.push(`Received array: ${h(d(i))}`))}})}o(br,"Ge");l(br,"toContain");function xr(t){let e=["expected"];w.call(this,this.received,["string","Array"],"Received",e);let r=this.received,i=O(r),n=[...r].findIndex(s=>x(s,t))!==-1;v.call(this,{pass:n,expectedLabels:e,comment:"deep equality",handleNot(s){s.push(`Expected value: not ${m(d(t))}`),s.push(`Received array: ${h(d(r)).replace(d(t),N(d(t)))}`)},handleInfo(s){i==="string"&&typeof t=="string"&&r.indexOf(t)!==-1&&s.push(M("Looks like you wanted to test for string equality with the stricter `toContainEqual` matcher. You probably need to use `toContain` instead.\n")),s.push(`Expected: ${m(d(t))}`),s.push(`Received: ${h(d(r))}`)}})}o(xr,"Ze");l(xr,"toContainEqual");function Er(t){let e=["expected"];Ue.call(this,this.received,"Received",e),w.call(this,this.received,["object"],"Received",e),w.call(this,t,["object"],"Expected",e);let r=this.received,i=x(t,r,!1);B.call(this,{pass:i,expected:t,expectedLabels:e})}o(Er,"_e");l(Er,"toMatchObject");var ht={toThrow:Jt,toMatch:Wt,toHaveLength:Vt,toContain:br,toMatchObject:Er,toHaveProperty:gr,toBeInstanceOf:vr,toContainEqual:xr,toBe:lr,toEqual:ur,toBeNaN:fr,toBeNull:hr,toBeFalsy:mr,toBeTruthy:dr,toBeDefined:yr,toBeUndefined:pr,toBeCloseTo:qt,toBeLessThan:Xt,toBeGreaterThan:Yt,toBeLessThanOrEqual:Zt,toBeGreaterThanOrEqual:Gt,toHaveReturned:sr,toHaveBeenCalled:er,toHaveReturnedTimes:or,toHaveBeenCalledWith:rr,toHaveBeenCalledTimes:tr,toHaveNthReturnedWith:cr,toHaveLastReturnedWith:ar,toHaveBeenNthCalledWith:nr,toHaveBeenLastCalledWith:ir},z=class{static{o(this,"T")}constructor(t,e=!1){this.name=t,this.isInverse=e}static{l(this,"AbstractPattern")}applyInverse(t){return this.isInverse?!t:t}},Ri=class ye extends z{static{o(this,"e")}constructor(e){super(`Any<${e.name}>`),this.expected=e}static{l(this,"AnyPattern")}static TYPE_CHECKS={String:l(e=>typeof e=="string"||e instanceof String,"String"),Number:l(e=>typeof e=="number"||e instanceof Number,"Number"),Function:l(e=>typeof e=="function"||e instanceof Function,"Function"),Boolean:l(e=>typeof e=="boolean"||e instanceof Boolean,"Boolean"),BigInt:l(e=>typeof e=="bigint"||e instanceof BigInt,"BigInt"),Symbol:l(e=>typeof e=="symbol"||e instanceof Symbol,"Symbol"),Object:l(e=>typeof e=="object","Object"),Array:Array.isArray};static create(e){if(e===void 0)throw new TypeError("any() expects to be passed a constructor function. Please pass one or use anything() to match any object.");return new ye(e)}get expectedLabel(){return`Any<${this.expected.name}>`}matches(e){return this.expected.name in ye.TYPE_CHECKS?ye.TYPE_CHECKS[this.expected.name](e):e instanceof this.expected}},pt=class Tr extends z{static{o(this,"e")}constructor(e,r){super("ArrayOf",e),this.expected=r}static{l(this,"ArrayOfPattern")}static create(e,r){if(r===void 0)throw new TypeError("arrayOf() expects a matcher or value.");return new Tr(e,r)}get expectedLabel(){return`${this.isInverse?"Not ":""}ArrayOf( ${this.describe(this.expected)} )`}matches(e){if(!Array.isArray(e))return this.applyInverse(!1);let r=e.every(i=>this.matchElement(i,this.expected));return this.applyInverse(r)}matchElement(e,r){return A(r)?r.matches(e):x(e,r)}describe(e){return A(e)?e.expectedLabel:typeof e=="string"?`"${e}"`:k(e,"").join(" ")}},ft=class kr extends z{static{o(this,"e")}constructor(e,r,i=2){super("CloseTo",e),this.expected=r,this.precision=i}static{l(this,"CloseToPattern")}static create(e,r,i){return new kr(e,r,i)}get expectedLabel(){let e=this.isInverse?"Not ":"",r=this.precision!==1?"s":"";return`${e}CloseTo(${this.expected}, ${this.precision} digit${r})`}matches(e){let r=this.expected;return typeof e!="number"||typeof r!="number"?this.applyInverse(!1):this.applyInverse(Math.abs(e-r)<Math.pow(10,-this.precision)/2)}},Li=class wr extends z{static{o(this,"e")}static{l(this,"AnythingPattern")}constructor(){super("Anything")}static create(){return new wr}get expectedLabel(){return"Anything"}matches(e){return e!=null}},dt=class Sr extends z{static{o(this,"e")}constructor(e,r){super("StringMatching",e),this.expected=r}static{l(this,"StringMatchingPattern")}static create(e,r){let i=typeof r;if(r==null)throw new TypeError("stringMatching() expects a string or RegExp.");if(i!=="string"&&!(r instanceof RegExp))throw new TypeError("stringMatching() expects a string or RegExp.");return new Sr(e,r)}get expectedLabel(){let e=this.isInverse?"Not ":"";return typeof this.expected=="string"?`${e}stringMatching("${this.expected}")`:`${e}stringMatching(${this.expected.toString()})`}matches(e){if(typeof e!="string")return this.applyInverse(!1);let r;return typeof this.expected=="string"?r=e.includes(this.expected):r=this.expected.test(e),this.applyInverse(r)}},mt=class $r extends z{static{o(this,"e")}constructor(e,r){super("ArrayContaining",e),this.expected=r}static{l(this,"ArrayContainingPattern")}static create(e,r){if(!Array.isArray(r))throw new TypeError("arrayContaining() expects an array.");return new $r(e,r)}get expectedLabel(){return`${this.isInverse?"Not ":""}ArrayContaining(${this.describe(this.expected)})`}matches(e){if(!Array.isArray(e))return this.applyInverse(!1);let r=this.expected.every(i=>e.some(n=>this.matchElement(n,i)));return this.applyInverse(r)}matchElement(e,r){return A(r)?r.matches(e):x(e,r)}describe(e){return A(e)?e.expectedLabel:k(e,"").join(" ")}},yt=class Ar extends z{static{o(this,"e")}constructor(e,r){super("ObjectContaining",e),this.expected=r}static{l(this,"ObjectContainingPattern")}static create(e,r){if(typeof r!="object"||r===null||Array.isArray(r))throw new TypeError("objectContaining() expects a plain object.");return new Ar(e,r)}get expectedLabel(){return`${this.isInverse?"Not ":""}ObjectContaining(${this.describe(this.expected)})`}matches(e){if(typeof e!="object"||e===null)return this.applyInverse(!1);let r=Object.keys(this.expected).every(i=>ve(e,i)?this.matchElement(e[i],this.expected[i]):!1);return this.applyInverse(r)}matchElement(e,r){return A(r)?r.matches(e):x(e,r)}describe(e){return A(e)?e.expectedLabel:k(e,"").join(" ")}},gt=class Cr extends z{static{o(this,"e")}constructor(e,r){super("StringContaining",e),this.expected=r}static{l(this,"StringContainingPattern")}static create(e,r){if(typeof r!="string")throw new TypeError("stringContaining() expects a string.");return new Cr(e,r)}get expectedLabel(){return`${this.isInverse?"Not ":""}stringContaining("${this.expected}")`}matches(e){return typeof e!="string"?this.applyInverse(!1):this.applyInverse(e.includes(this.expected))}},Oi={any:Ri.create,anything:Li.create,closeTo:ft.create.bind(null,!1),arrayOf:pt.create.bind(null,!1),stringMatching:dt.create.bind(null,!1),arrayContaining:mt.create.bind(null,!1),objectContaining:yt.create.bind(null,!1),stringContaining:gt.create.bind(null,!1),not:{closeTo:ft.create.bind(null,!0),arrayOf:pt.create.bind(null,!0),stringMatching:dt.create.bind(null,!0),arrayContaining:mt.create.bind(null,!0),objectContaining:yt.create.bind(null,!1),stringContaining:gt.create.bind(null,!0)}},ji=class extends Ke{static{o(this,"oe")}static{l(this,"xJetPromiseError")}constructor(t){let e=[`${xe(t)}
64
+ `,`Matcher error: ${t.message}`,`${t.promiseKind} to value: ${h(k(t.received,"").join(" "))}`];super(e.join(`
65
+ `),"xJetPromiseError")}},Ir=class{static{o(this,"U")}constructor(t){this.received=t}static{l(this,"MatcherService")}macherName="";promise;notModifier=!1;assertionChain=[];rejectsModifier=!1;resolvesModifier=!1;get not(){return this.notModifier=!0,this}get rejects(){if(this.resolvesModifier)throw new Error('Cannot use "rejects" modifier after "resolved" modifier.');return this.rejectsModifier=!0,this}get resolves(){if(this.rejectsModifier)throw new Error('Cannot use "resolved" modifier after "rejects" modifier.');return this.resolvesModifier=!0,this}invoke(t,e,r){return this.macherName=t,this.rejectsModifier||this.resolvesModifier?(this.pushToChain(t),this.promise=this.resolvesModifier?"resolves":"rejects",this.invokeAsync(e,r)):(this.pushToChain(t),e.call(this,...r))}async invokeAsync(t,e){let r=!1,i=typeof this.received=="function"?this.received():this.received;if(!X(i))throw new _({message:`${h("received")} value must be a promise or a function returning a promise`,assertionChain:this.assertionChain,received:{type:O(i),value:i}});try{this.received=await i,r=!0}catch(n){this.resolvesModifier&&this.throwPromiseError("Rejected",n),this.received=n}return r&&this.rejectsModifier&&this.throwPromiseError("Resolved",this.received),t.call(this,...e)}pushToChain(t){this.promise&&this.assertionChain.push(this.promise),this.notModifier&&this.assertionChain.push("not"),this.assertionChain.push(t)}throwPromiseError(t,e){let r=t==="Resolved"?"resolved":"rejected",i=t==="Resolved"?"rejected":"resolved";throw new ji({message:`${h("received")} promise ${r} instead of ${i}`,received:e,promiseKind:t,assertionChain:this.assertionChain})}};for(let t of Object.keys(ht)){let e=Ir.prototype,r=ht[t];Object.defineProperty(e,t,{value:l(function(...i){return this.invoke(t,r,i)},"value")}),Object.defineProperty(e[t],"name",{value:t})}var Mi=l((t,...e)=>{if(e.length>0)throw new Error(`Expect takes at most one argument. Received ${e.length+1} arguments instead.`);return new Ir(t)},"coreExpect"),Rr=Object.assign(Mi,Oi);var Bi="xJet.mock()",C=class t extends Function{static{o(this,"MockState")}static mocks=[];name;isMock=!0;xJetMock=!0;state;restore;queuedImplementations=[];implementation;originalImplementation;constructor(e,r,i){return super(),this.name=i??Bi,this.state=this.initState(),this.implementation=e,this.restore=r||(()=>{this.implementation=e}),this.originalImplementation=e||(()=>{}),new Proxy(this,{apply:this.invokeFunction,construct:this.invokeClass})}getMockName(){return this.name}get mock(){return this.state}get original(){return this.originalImplementation}mockClear(){return this.state=this.initState(),this}mockReset(){return this.mockClear(),this.queuedImplementations=[],this}mockRestore(){this.restore(),this.mockReset();let e=t.mocks.indexOf(this);return e!==-1&&t.mocks.splice(e,1),this}getMockImplementation(){return this.implementation}getNextImplementation(){return this.queuedImplementations.length?this.queuedImplementations.shift():this.implementation}mockImplementation(e){return this.implementation=e,this}mockImplementationOnce(e){return this.queuedImplementations.push(e),this}mockReturnValue(e){return this.mockImplementation(()=>e),this}mockResolvedValue(e){return this.mockImplementation(()=>Promise.resolve(e)),this}mockResolvedValueOnce(e){return this.mockImplementationOnce(()=>Promise.resolve(e)),this}mockReturnValueOnce(e){return this.mockImplementationOnce(()=>e),this}mockRejectedValue(e){return this.mockImplementation(()=>Promise.reject(e)),this}mockRejectedValueOnce(e){return this.mockImplementationOnce(()=>Promise.reject(e)),this}[Symbol.for("nodejs.util.inspect.custom")](){return`<Mock Constructor ${this.name}>`}initState(){return{calls:[],results:[],lastCall:void 0,contexts:[],instances:[],invocationCallOrder:[]}}invoke(e,r){let i=e,n=this.getNextImplementation(),s=r;typeof n=="function"&&(n.__boundArgs&&s.unshift(...n.__boundArgs),n.__boundThis&&(i=n.__boundThis)),this.state.calls.push(s),this.state.contexts.push(i),this.state.invocationCallOrder.push(this.state.invocationCallOrder.length+1);let a,c=this.state.results.push({value:void 0,type:"incomplete"})-1;if(n)try{a={type:"return",value:n.call(void 0,...r)}}catch(u){a={value:u,type:"throw"}}else a={type:"return",value:void 0};return this.state.lastCall=r,this.state.results[c]=a,a.value}invokeFunction(e,r,i){return e.state.instances.push(r),e.invoke.call(e,r,i)}invokeClass(e,r,i){let n=e.invoke.call(e,i,r),s=typeof n=="object"&&n!==null&&n.constructor;return e.state.instances.push(s?n:i),typeof n=="object"?n:i}};var Ve=new Map,Lr=new Map;function Or(t){return function(e){Lr.set(e,t||{})}}o(Or,"Injectable");function S(t,...e){if(Ve.has(t))return Ve.get(t);let r=Lr.get(t);if(!r)throw new Error(`Cannot inject ${t.name} \u2013 not marked @Injectable`);let i=r.factory?r.factory(...e):new t(...e);return r?.scope==="singleton"&&Ve.set(t,i),i}o(S,"inject");function Br(t,e,r){let i=`${e}${r}`,n=t[i];if(!r)throw new Error(`Invalid type(${r}) parameter`);if(!(i in t))throw new Error(`Method "${i.toString()}" does not exist on Buffer`);return n.bind(t)}o(Br,"b");function Pr(t,e){return Br(t,"read",e)}o(Pr,"h");function Nr(t,e){return Br(t,"write",e)}o(Nr,"d");function We(t,e,r=0){if(e<0)throw new Error("Split position cannot be negative");if(e>t.length)throw new Error("Split position cannot exceed buffer length");let i=t.subarray(0,e),n=e+r;return n>=t.length?[i,Buffer.alloc(0)]:[i,t.subarray(n)]}o(We,"f");function zr(t=0){let{position:e,type:r}=this.descriptor,i=this.offset+e+t;return r.toObject(this.buffer.subarray(i),n=>{this.offset+=n})}o(zr,"l");function Pi(){let t=[],{arraySize:e=0,size:r}=this.descriptor;t.length=e;for(let i=0;i<e;i++)t[i]=zr.call(this,i*r);return t}o(Pi,"U");function Ni(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?Pi.call(this):zr.call(this)}o(Ni,"S");function Fr(t,e=0){t??={};let{position:r,type:i,size:n}=this.descriptor,s=i.toBuffer(t),a=this.offset+r+e,[c,u]=We(this.buffer,a,n);this.buffer=Buffer.concat([c,s,u]),s.length>n&&(this.offset+=s.length-n)}o(Fr,"T");function zi(t){let{arraySize:e=0,size:r}=this.descriptor;for(let i=0;i<e;i++){let n=i<t.length?t[i]:{};Fr.call(this,n,i*r)}}o(zi,"W");function Fi(t){return"arraySize"in this.descriptor&&this.descriptor.arraySize?zi.call(this,Array.isArray(t)?t:[t]):Fr.call(this,Array.isArray(t)?t[0]||{}:t)}o(Fi,"I");var K={Int8:8,UInt8:8,Int16LE:16,Int16BE:16,UInt16LE:16,UInt16BE:16,FloatLE:32,FloatBE:32,Int32LE:32,Int32BE:32,UInt32LE:32,UInt32BE:32,DoubleLE:64,DoubleBE:64,BigInt64LE:64,BigInt64BE:64,BigUInt64LE:64,BigUInt64BE:64};function Di(t,e=0){let r=/^([A-Za-z][A-Za-z0-9]*)(?:\[(\d+)\])?$/i,i=t.match(r);if(!i)throw new Error(`Invalid primitive descriptor: ${t}`);let n=K[i[1]];if(!n)throw new Error(`Invalid primitive type: ${i[1]}`);let s=i[1],a=i[2]?parseInt(i[2]):void 0;return{type:s,position:e,size:n/8,arraySize:a,kind:"primitive"}}o(Di,"x");function Dr(t=0){let{position:e,type:r}=this.descriptor,i=this.offset+e+t;return Pr(this.buffer,r)(i)}o(Dr,"z");function Hi(){let t=[],{arraySize:e=0,size:r}=this.descriptor;t.length=e;for(let i=0;i<e;i++)t[i]=Dr.call(this,i*r);return t}o(Hi,"N");function _i(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?Hi.call(this):Dr.call(this)}o(_i,"w");function Hr(t,e=0){t??=0;let{position:r,type:i}=this.descriptor,n=i.includes("Big");if(n&&t===0&&(t=BigInt(0)),n&&typeof t!="bigint")throw new TypeError(`Expected a BigInt for field "${i}", but received ${t}`);if(!n&&typeof t!="number")throw new TypeError(`Expected a number for field "${i}", but received ${t}`);let s=this.offset+r+e;Nr(this.buffer,i)(t,s)}o(Hr,"B");function Ki(t){let{arraySize:e=0,size:r}=this.descriptor;for(let i=0;i<e;i++){let n=i<t.length?t[i]:0;Hr.call(this,n,i*r)}}o(Ki,"_");function Ui(t){if("arraySize"in this.descriptor&&this.descriptor.arraySize)return Ki.call(this,Array.isArray(t)?t:[t]);Hr.call(this,Array.isArray(t)?t[0]||0:t)}o(Ui,"P");var jr=new Map;function Ye(t){return t.startsWith("Int")}o(Ye,"y");function _r(t){let e=jr.get(t);return e===void 0&&(e=(1<<t)-1,jr.set(t,e)),e}o(_r,"D");function Ji(t,e){return Ye(t.type)?Number(BigInt.asIntN(t.bitSize,BigInt(e))):e}o(Ji,"j");function Vi(t,e){let r=Ye(t.type),{bitSize:i,type:n}=t,s=r?(1<<i-1)-1:(1<<i)-1,a=r?-(1<<i-1):0;if(e<a||e>s)throw new RangeError(`Value ${e} does not fit within ${i} bits for type ${n}`)}o(Vi,"G");function Kr(t,e){if(t.bitSize<1||t.bitPosition<0)throw new Error(`bitSize(${t.bitSize}) and bitPosition(${t.bitPosition}) must be greater than bitSize(1) and bitPosition(0) for ${e}`);if(K[t.type]>32)throw new Error(`${t.type} is not supported yet`);if(t.bitPosition+t.bitSize>K[t.type])throw new Error(`bitPosition(${t.bitPosition}) + bitSize(${t.bitSize}) exceeds ${t.type} size for ${e}`)}o(Kr,"v");function Wi(t,e){Kr(e,"read operation");let{type:r,bitPosition:i,bitSize:n}=e,s=_r(n),a=t>>i&s;return Ye(r)&&a&1<<n-1?a|~s:a}o(Wi,"Z");function qi(t,e,r){Kr(e,"write operation"),Vi(e,r);let{bitPosition:i,bitSize:n}=e,s=Ji(e,r),a=_r(n)<<i;return t&~a|s<<i&a}o(qi,"q");function Yi(t,e=0,r=0){let[i,n]=t.split(":",2),s=parseInt(n,10),a=K[i],c=i.endsWith("BE");if(!a)throw new Error(`${i} is not supported`);if(r<0||r>=a)throw new Error(`Bitfield position ${r} is out of bounds (must be between 0 and ${a-1})`);if(!s)throw new Error(`${t} is not valid`);if(s+r>=a)throw new Error(`${i} size (${a}) is not enough to hold ${s} bits starting at position ${r}`);return{kind:"bitfield",type:i,size:a/8,position:e,bitSize:s,bitPosition:r,isBigEndian:c}}o(Yi,"$");function Gi(){let t=this.descriptor.position+this.offset,e=this.descriptor.isBigEndian?"BE":"LE",r=this.buffer[`readUInt${e}`](t,this.descriptor.size);return Wi(r,this.descriptor)}o(Gi,"C");function Xi(t){let e=this.descriptor.position+this.offset,r=this.descriptor.isBigEndian?"BE":"LE",i=this.buffer[`readUInt${r}`](e,this.descriptor.size),n=qi(i,this.descriptor,t);this.buffer[`writeUInt${r}`](n,e,this.descriptor.size)}o(Xi,"F");var Mr=new Set(["utf8","ascii","string"]);function Zi(t,e=0){let r=/^(utf8|ascii|string)(?:\[(\d+)\])?$/i,i=t.match(r);if(!i)throw new Error(`Invalid string descriptor: ${t}`);let n=i[1].toLowerCase(),s=i[2]?parseInt(i[2]):void 0;return{type:n,arraySize:s,position:e,size:2,lengthType:"UInt16LE",kind:"string"}}o(Zi,"A");function Ur(t=0){let{position:e,type:r,size:i}=this.descriptor,n=this.offset+e+t,s=r==="string"?"utf8":r;if("lengthType"in this.descriptor&&this.descriptor.lengthType){if(this.descriptor.lengthType.includes("Big"))throw new Error("BigInt are not supported");let a=this.descriptor.lengthType,c=Number(Pr(this.buffer,a)(n)),u=n+i;if(this.offset+=c,u+c>this.buffer.length)throw new Error(`String prefix length exceeds buffer position: ${u} size: ${c} > ${this.buffer.length}`);return this.buffer.subarray(u,u+c).toString(s)}if("nullTerminated"in this.descriptor){let a=n,c="maxLength"in this.descriptor?this.descriptor.maxLength:0;for(;a<this.buffer.length&&this.buffer[a]!==0;){if(c&&a>c)throw new Error(`NullTerminated String exceeds maximum length of ${c}`);a++}let u=a-n;return this.offset+=u+1,this.buffer.subarray(n,a).toString(s)}return this.buffer.subarray(n,n+i).toString(s)}o(Ur,"M");function Qi(){let t=[],{arraySize:e=0,size:r}=this.descriptor;t.length=e;for(let i=0;i<e;i++)t[i]=Ur.call(this,i*r);return t}o(Qi,"Y");function en(){return"arraySize"in this.descriptor&&this.descriptor.arraySize?Qi.call(this):Ur.call(this)}o(en,"L");function Jr(t,e=0){t??="";let{position:r,type:i,size:n}=this.descriptor,s=this.offset+r+e,a=i==="string"?"utf8":i;if("lengthType"in this.descriptor&&this.descriptor.lengthType){if(this.descriptor.lengthType.includes("Big"))throw new Error("BigInt are not supported");let c=Buffer.from(t,a);Nr(this.buffer,this.descriptor.lengthType)(c.length,s);let[u,p]=We(this.buffer,s+n);this.buffer=Buffer.concat([u,c,p]),this.offset+=c.length;return}if("nullTerminated"in this.descriptor){"maxLength"in this.descriptor&&this.descriptor.maxLength&&(t=t.length>this.descriptor.maxLength?t.slice(0,this.descriptor.maxLength):t);let c=t.endsWith("\0")?t:`${t}\0`,u=Buffer.from(c,a),[p,y]=We(this.buffer,s,n);this.buffer=Buffer.concat([p,u,y]),this.offset+=u.length;return}this.buffer.write(t,s,n,a)}o(Jr,"k");function tn(t){let{arraySize:e=0,size:r}=this.descriptor;for(let i=0;i<e;i++){let n=i<t.length?t[i]:"";Jr.call(this,n,i*r)}}o(tn,"O");function rn(t){return"arraySize"in this.descriptor&&this.descriptor.arraySize?tn.call(this,Array.isArray(t)?t:[t]):Jr.call(this,Array.isArray(t)?t[0]||"":t)}o(rn,"V");var U=class qe{static{o(this,"e")}size;schema=new Map;constructor(e){this.size=this.compileSchema(e)}toObject(e,r){if(!Buffer.isBuffer(e))throw new Error(`Expected a buffer, but received ${typeof e}`);if(e.length<this.size)throw new Error(`Buffer size is less than expected: ${e.length} < ${this.size}`);let i={},n={buffer:e,offset:0};for(let[s,a]of this.schema)n.descriptor=a,i[s]=this.readValue(n,a.kind);return r&&typeof r=="function"&&r(n.offset),i}toBuffer(e){if(!e||typeof e!="object")throw new Error(`Expected an object of fields, but received ${typeof e}`);let r={buffer:Buffer.alloc(this.size),offset:0};for(let[i,n]of this.schema){r.descriptor=n;let s=e[i];this.writeValue(r,n.kind,s)}return r.buffer}readValue(e,r){switch(r){case"struct":return Ni.call(e);case"bitfield":return Gi.call(e);case"string":return en.call(e);default:return _i.call(e)}}writeValue(e,r,i){switch(r){case"struct":Fi.call(e,i);break;case"bitfield":Xi.call(e,i);break;case"string":rn.call(e,i);break;default:Ui.call(e,i)}}computeFieldSize(e,r){if(e.type instanceof qe)return{...e,position:r,size:e.type.size,kind:"struct"};if(Mr.has(e.type))return this.computeStringFieldSize(e,r);let i=K[e.type];if(i!==void 0)return{...e,position:r,size:i/8,kind:"primitive"};throw new Error(`Invalid field type: ${e.type}`)}computeStringFieldSize(e,r){let i={...e,position:r,kind:"string"};if("lengthType"in e&&e.lengthType){let n=K[e.lengthType];if(!n)throw new Error(`Invalid length type: ${e.lengthType}`);i.size=n/8}else"nullTerminated"in e&&e.nullTerminated?i.size=0:(!("size"in e)||!e.size)&&(i.lengthType="UInt16LE",i.size=K.UInt16LE/8);return i}parseStringNotation(e,r){return e.includes(":")?Yi(e,r):[...Mr].find(i=>e.startsWith(i))?Zi(e,r):Di(e,r)}convertToSizedField(e,r){return e instanceof qe?{type:e,position:r,size:e.size,kind:"struct"}:typeof e=="string"?this.parseStringNotation(e,r):this.computeFieldSize(e,r)}compileSchema(e){let r={bits:0,bytes:0,bitFieldSize:0,bitFieldType:"UInt8"};for(let[i,n]of Object.entries(e)){let s=this.convertToSizedField(n,r.bytes);if("arraySize"in s&&s.arraySize&&s.arraySize>=Number.MAX_SAFE_INTEGER)throw new Error(`Array size exceeds maximum safe integer: ${s.arraySize}`);"bitSize"in s&&s.bitSize>0?this.processBitfield(r,i,s):this.processStandardField(r,i,s)}return r.bits>0&&(r.bytes+=r.bitFieldSize),r.bytes}processBitfield(e,r,i){let n=i.size*8,s=i.bitSize;(e.bits+s>n||e.bitFieldType!==i.type||e.bitFieldSize!==i.size)&&(e.bytes+=e.bitFieldSize,e.bits=0,i.position=e.bytes),i.bitPosition=e.bits,this.schema.set(r,i),e.bits+=s,e.bitFieldType=i.type,e.bitFieldSize=i.size}processStandardField(e,r,i){e.bits>0&&(e.bytes+=e.bitFieldSize,e.bits=0,i.position=e.bytes),this.schema.set(r,i);let n="arraySize"in i&&i.arraySize||0,s=n>0?i.size*n:i.size;e.bytes+=s}};var nn=new U({line:"UInt32LE",column:"UInt32LE",source:"string"}),Ge=new U({kind:"UInt8:4",suiteId:{type:"string",size:14},runnerId:{type:"string",size:14},timestamp:"string"}),Vr=new U({level:"UInt8",message:{type:"string",lengthType:"UInt32LE"},ancestry:{type:"string",lengthType:"UInt32LE"},invocation:nn}),Ee=new U({error:{type:"string",lengthType:"UInt32LE"}}),Wr=new U({type:"UInt8:5",todo:"UInt8:1",skipped:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"}}),qr=new U({type:"UInt8:5",passed:"UInt8:1",duration:"UInt32LE",ancestry:{type:"string",lengthType:"UInt32LE"},description:{type:"string",lengthType:"UInt32LE"},errors:{type:"string",lengthType:"UInt32LE"}});var Yr={1:Vr,2:Ee,3:Wr,4:qr};function le(t,e){let r=Yr[t];if(!r)throw new Error(`Invalid schema kind: ${t}`);let i={kind:t,suiteId:globalThis?.__XJET?.runtime?.suiteId??"",runnerId:globalThis?.__XJET?.runtime.runnerId??"",timestamp:new Date().toISOString()};return Buffer.concat([Ge.toBuffer(i),r.toBuffer(e)])}o(le,"encodePacket");function Xr(t,e,r){let i=Ge.toBuffer({kind:2,suiteId:e??"",runnerId:r??"",timestamp:new Date().toISOString()}),n=Ee.toBuffer({error:JSON.stringify(H(t))});return Buffer.concat([i,n])}o(Xr,"encodeErrorSchema");function J(t,e={}){dispatch(le(3,{type:t,todo:e?.todo,skipped:e?.skipped,duration:e?.duration,ancestry:e?.ancestry?.join(","),description:e?.description}))}o(J,"emitStatus");function Te(t,e){let r=e.errors?.map(i=>H(i))||[];dispatch(le(4,{type:t,errors:r.length>0?JSON.stringify(r):"",ancestry:e.ancestry.join(""),duration:e.duration,description:e.description}))}o(Te,"emitEvent");var Xe=(s=>(s[s.Silent=0]="Silent",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug",s))(Xe||{});var ue=class{constructor(e="",r={skip:!1,only:!1}){this.description=e;this.describeOptions=r}static{o(this,"DescribeModel")}ancestry=[];testsStack=[];describesStack=[];startTime=0;hooks={afterAll:[],afterEach:[],beforeAll:[],beforeEach:[]};get options(){return this.describeOptions}get tests(){return[...this.testsStack,...this.describesStack.flatMap(e=>e.tests)]}addHook(e,r){let i=this.hooks[e];if(!i)throw new Error(`Invalid hook type: ${e}`);i.push(r)}addTest(e){e&&(e.setAncestry(this.ancestry),this.description&&e.setAncestry([this.description]),e.applyExecutionFlags(this.options.skip,this.options.only),this.testsStack.push(e))}addDescribe(e){e&&(e.inheritFromParentDescribe(this),this.describesStack.push(e))}async run(e){this.startTime=Date.now(),this.notifyDescribeStatus(this.options.skip);let r=!e.afterAllErrors?.length,i=!e.beforeAllErrors?.length;try{e.beforeAllErrors?.length||await this.executeHooks("beforeAll",e);for(let n of this.shuffleTests(this.testsStack)){if(e.hasError)return;await n.run(e,this.executeHooks.bind(this))}for(let n of this.describesStack){if(e.hasError)return;await n.run(e)}await this.executeHooks("afterAll",e),e.afterAllErrors?.length?this.notifyDescribeFailure(e.afterAllErrors):this.notifyDescribeAction()}catch(n){this.notifyDescribeFailure([n,...e.afterAllErrors]),globalThis.__XJET?.runtime.bail&&(e.hasError=!0)}finally{r&&(e.afterAllErrors=[]),i&&(e.beforeAllErrors=[])}}inheritFromParentDescribe(e){this.ancestry.push(...e.ancestry),this.hooks.beforeEach=[...e.hooks.beforeEach,...this.hooks.beforeEach],this.hooks.afterEach=[...e.hooks.afterEach,...this.hooks.afterEach],e.description&&this.ancestry.push(e.description),e.options.skip&&(this.describeOptions.skip=!0),e.options.only&&(this.describeOptions.only=!0)}async executeHooks(e,r){if(!this.options.skip){r.beforeAllErrors=r.beforeAllErrors||[],r.afterAllErrors=r.afterAllErrors||[];for(let i of this.hooks[e])try{await i.run(r)}catch(n){await this.handleHookError(e,n,r)}}}async handleHookError(e,r,i){if(e==="beforeAll")i.beforeAllErrors.push(r);else if(e==="afterAll")i.afterAllErrors.push(r);else throw r}getExecutionDuration(){return this.startTime===0?0:Date.now()-this.startTime}notifyDescribeStatus(e=!1){J(2,{skipped:e,ancestry:this.ancestry,description:this.description})}notifyDescribeAction(e=[]){Te(2,{errors:e,ancestry:this.ancestry,description:this.description,duration:this.getExecutionDuration()})}notifyDescribeFailure(e){e?.length&&this.notifyDescribeAction(e)}shuffleTests(e){if(!(globalThis.__XJET?.runtime.randomize??!1)||e.length<=1)return e;let i=e.length;for(let n=i-1;n>0;n--){let s=Math.floor(Math.random()*(n+1));[e[n],e[s]]=[e[s],e[n]]}return e}};var R=class extends Error{static{o(this,"ExecutionError")}constructor(e){super(e),this.name="xJetExecutionError"}toJSON(){let e={};for(let r of Object.keys(this)){let i=this[r];i&&(e[r]=i)}return e.name=this.name,e.stack=this.stack,e.message=this.message,e}};var ei,Ze;ei=[Or({scope:"singleton"})];var V=class V{static{o(this,"SuiteState")}onlyMode=!1;currentDescribe;currentTest;hasTests=!1;rootDescribe;filterRegexChain=[];constructor(){this.rootDescribe=new ue,this.currentDescribe=this.rootDescribe,Array.isArray(__XJET?.runtime.filter)&&__XJET.runtime.filter.length>0&&(this.onlyMode=!0,this.filterRegexChain=__XJET.runtime.filter.map(e=>new RegExp(`^${e}$`)))}static matchesFilter(e,r){if(r.length>e.length)return!1;let i=e.length-r.length;return r.every((n,s)=>n.test(e[i+s]))}get isOnlyMode(){return this.onlyMode}get root(){return this.rootDescribe}get describe(){return this.currentDescribe}get test(){return this.currentTest}set test(e){this.currentTest=e}async run(e){try{let r=Date.now();if(J(4),!this.hasTests)throw new R("Your test suite must contain at least one test");await this.root.run(e),J(3,{duration:Date.now()-r})}catch(r){dispatch(Xr(r,__XJET.runtime.suiteId,__XJET.runtime.runnerId))}}addDescribe(e,r,i={},n=[]){let s={skip:!1,only:!1,...i};if(s.only&&(this.onlyMode=!0),this.filterRegexChain.length>0){let u=[...this.currentDescribe.ancestry,this.currentDescribe.description,e];V.matchesFilter(u,this.filterRegexChain)&&(s.only=!0)}let a=new ue(e,s);this.currentDescribe.addDescribe(a);let c=this.currentDescribe;this.currentDescribe=a;try{r.apply({},n)}finally{this.currentDescribe=c}}addTest(e){if(this.hasTests=!0,e.options.only&&(this.onlyMode=!0),this.currentDescribe.addTest(e),this.filterRegexChain.length>0){let r=[...e.ancestry,e.description];V.matchesFilter(r,this.filterRegexChain)&&(e.options.only=!0)}}};Ze=nt(null),V=at(Ze,0,"SuiteState",ei,V),ot(Ze,1,V);var E=V;var Q={V8:{GLOBAL:/at\s(.*):(\d+):(\d+)/,STANDARD:/at\s(.*?)\((?:(.+?):(\d+):(\d+)|(native))\)/,EVAL:/^at\s(.+?)\s\(eval\sat\s(.+?)\s?\((.*):(\d+):(\d+)\),\s(.+?):(\d+):(\d+)\)$/},SPIDERMONKEY:{EVAL:/^(.*)@(.+?):(\d+):(\d+),\s(.+?)@(.+?):(\d+):(\d+)$/,STANDARD:/^(.*)@(.*?)(?:(\[native code\])|:(\d+):(\d+))$/},JAVASCRIPT_CORE:{STANDARD:/^(?:(global|eval)\s)?(.*)@(.*?)(?::(\d+)(?::(\d+))?)?$/}},sn=(t=>(t[t.V8=0]="V8",t[t.SPIDERMONKEY=1]="SPIDERMONKEY",t[t.JAVASCRIPT_CORE=2]="JAVASCRIPT_CORE",t[t.UNKNOWN=3]="UNKNOWN",t))(sn||{});function on(t){return t.startsWith(" at ")||t.startsWith("at ")?0:t.includes("@")?/(?:global|eval) code@/.test(t)?2:1:3}o(on,"l");function W(t){return t.startsWith("file://")?t.startsWith("file:///")&&/^file:\/\/\/[A-Za-z]:/.test(t)?t.substring(8):t.substring(7):(t=t.replace(/\\/g,"/"),t)}o(W,"c");function Qe(t){return{source:t,eval:!1,async:!1,native:!1,constructor:!1}}o(Qe,"u");function $(t){return t&&t.trim()!==""?parseInt(t,10):void 0}o($,"i");function an(t){let e=Qe(t);t.toLowerCase().includes("new")&&(e.constructor=!0),t.toLowerCase().includes("async")&&(e.async=!0);let r=t.match(Q.V8.EVAL),i=t.match(Q.V8.GLOBAL),n=!r&&t.match(Q.V8.STANDARD);return r?(e.eval=!0,e.functionName=r[1]||void 0,e.evalOrigin={line:$(r[4])??void 0,column:$(r[5])??void 0,fileName:r[3]?W(r[3]):void 0,functionName:r[2]||"<anonymous>"},e.line=$(r[7])??void 0,e.column=$(r[8])??void 0,e.fileName=r[6]?W(r[6]):void 0):n?(e.functionName=n[1]?n[1].trim():void 0,n[5]==="native"?(e.native=!0,e.fileName="[native code]"):(e.line=$(n[3])??void 0,e.column=$(n[4])??void 0,e.fileName=n[2]?W(n[2]):void 0,e.fileName?.includes("node:")&&(e.native=!0))):i&&(e.fileName=i[1]?W(i[1]):void 0,e.line=$(i[2])??void 0,e.column=$(i[3])??void 0),e}o(an,"N");function cn(t){let e=Qe(t),r=t.match(Q.SPIDERMONKEY.EVAL);if(r)return e.eval=!0,e.functionName=r[1]?r[1]:void 0,t.toLowerCase().includes("constructor")&&(e.constructor=!0),t.toLowerCase().includes("async")&&(e.async=!0),e.evalOrigin={line:$(r[7])??void 0,column:$(r[8])??void 0,fileName:W(r[6]),functionName:r[5]?r[5]:void 0},e.line=$(r[3])??void 0,e.column=$(r[4])??void 0,e;let i=t.match(Q.SPIDERMONKEY.STANDARD);return i&&(e.functionName=i[1]?i[1]:void 0,e.fileName=W(i[2]),i[3]==="[native code]"?e.fileName="[native code]":(e.line=$(i[4])??void 0,e.column=$(i[5])??void 0)),e}o(cn,"S");function ln(t){let e=Qe(t),r=t.match(Q.JAVASCRIPT_CORE.STANDARD);return r&&(e.functionName=r[2],e.eval=r[1]==="eval"||r[3]==="eval",t.toLowerCase().includes("constructor")&&(e.constructor=!0),t.toLowerCase().includes("async")&&(e.async=!0),r[3]==="[native code]"?(e.native=!0,e.fileName="[native code]"):(e.line=$(r[4])??void 0,e.column=$(r[5])??void 0,e.fileName=W(r[3]))),e}o(ln,"p");function un(t,e){switch(e){case 1:return cn(t);case 2:return ln(t);case 0:default:return an(t)}}o(un,"g");function hn(t){if(!t)return"";let e=/^\s*at .+$|^.+@.+:\d+:\d+$|^@.+:\d+:\d+$|^.+@\[native code\]$/,r=t.split(`
66
+ `);for(let i=0;i<r.length;i++)if(e.test(r[i]))return r.slice(i).join(`
67
+ `);return""}o(hn,"A");function ti(t){let e=typeof t=="string"?{stack:t,message:t,name:""}:t,r=e.name||"Error",i=hn(e.stack||""),n=e?.message||"",s=on(i),a=i.split(`
68
+ `).map(c=>c.trim()).filter(c=>c.trim()!=="");return{name:r,message:n,stack:a.map(c=>un(c,s)),rawStack:i}}o(ti,"E");function ri(t=2){let r=ti(new Error).stack[t];if(r?.line&&r?.column&&r?.fileName)return{line:r.line,column:r.column,source:r.fileName}}o(ri,"getInvocationLocation");function q(t=2){let e=new Error;return e.stack?e.stack.split(`
69
+ `).slice(t+1).join(`
70
+ `):""}o(q,"getTrimmedStackString");function he(t){return function(...e){let r=S(E).test;r||(r=S(E).describe);let i=[...r?.ancestry??[],r?.description].join(","),n=e.map(a=>k(a).join(`
71
+ `)).join(" "),s=ri();dispatch(le(1,{level:Xe[t],message:n,ancestry:i??"",invocation:s}))}}o(he,"createLogHandler");var ii=he("Info"),ni=he("Info"),si=he("Warn"),oi=he("Error"),ai=he("Debug");function fn(t,e){let r=t[e],i=Object.getOwnPropertyDescriptor(t,e)||{},n=new C(()=>r,()=>{t[e]=i.value,Object.defineProperty(t,e,i)},"xJet.spyOn()");return C.mocks.push(n),Object.defineProperty(t,e,{get(){return n.apply(this,[])},set(s){return n.mockImplementation(()=>s),n.apply(this,[s])}}),n}o(fn,"spyOnDescriptorProperty");function ci(t,e){if(t==null||typeof t!="object"&&typeof t!="function")throw new R(`Cannot use spyOn on a primitive value; ${typeof t} given`);if(e===null)throw new R("No property name supplied");let r=t[e];if(!r)throw new Error(`Property '${String(e)}' does not exist in the provided object`);let i=Object.getOwnPropertyDescriptor(t,e);if(i&&typeof i.get=="function"&&i.configurable===!1)throw new Error(`Property '${String(e)}' is not configurable in an getter object`);if(typeof r!="function"||i&&typeof i.get=="function")return fn(t,e);if(!r.isMock){let n=r;n.prototype&&!Object.getOwnPropertyDescriptor(n,"prototype")?.writable&&(n=o((...s)=>new r(...s),"itemFunction")),t[e]=new C(n,()=>{t[e]=r},"xJet.spyOn()")}return t[e]}o(ci,"spyOnImplementation");var dn=/\$([#\w.])+/g;function mn(t){return typeof t=="string"?t:JSON.stringify(t,null,4)}o(mn,"prettyFormat");function yn(t,e){if(!(!e.length||!t))try{return e.reduce((r,i)=>{if(r==null||typeof r!="object")throw new Error("Path traversal failed");return r[i]},t)}catch{return}}o(yn,"getValueByPath");function gn(t,e,r){if(!t||typeof t!="string"||!t.startsWith("$"))return t;if(t==="$#")return String(r);let i=t.slice(1).split("."),n=yn(e,i);if(n==null)return t;if(typeof n=="object")try{return JSON.stringify(n,(s,a)=>s&&typeof a=="object"?"[Object]":a)}catch{return String(n)}return String(n)}o(gn,"resolveVariable");function vn(t,e,r){return t.replace(dn,i=>gn(i,e,r))}o(vn,"interpolateVariables");function li(t,e,r){let i=0;return t.includes("$")&&!t.includes("%%")&&(t=vn(t,e[0],r)),t.replace(/%([psdifjo#%])/g,(n,s)=>{if(s==="%")return"%";if(s==="#")return String(r);let a=e[i++];switch(s){case"p":return mn(a);case"s":return String(a);case"d":return Number(a).toString();case"i":return Math.floor(Number(a)).toString();case"f":return Number(a).toString();case"j":return JSON.stringify(a);case"o":return Object.prototype.toString.call(a);default:return n}})}o(li,"printf");function bn(t,e){let r=t[0].split("|").map(i=>i.trim());if(r.length===0||r.some(i=>i===""))throw new Error("Template string headings must not be empty and should contain pipe delimiters.");if(e.length%r.length!==0)throw new Error("Not enough arguments supplied for given headings.");return Array.from({length:e.length/r.length},(i,n)=>r.reduce((s,a,c)=>(s[a]=e[n*r.length+c],s),{}))}o(bn,"parseTemplate");function ke(t,...e){if(e.length<2)throw new Error("`.each` must be called with at leas 2 argument or Tagged Template Literal.");let i=e[0]instanceof Array&&e[0].raw!==void 0?bn(e.shift(),e):e;return(n,s,a)=>{i.forEach((c,u)=>{let p=Array.isArray(c)?c:[c];t(li(n,p,Number(u)),s,p,a)})}}o(ke,"each");var we=class extends Error{static{o(this,"TimeoutError")}constructor(e,r,i=""){super(`Exceeded timeout of ${e} ms at ${r}`),Object.setPrototypeOf(this,new.target.prototype),this.name="xJetTimeoutError",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="xJetFailingError",i&&(this.stack=`${this.name}: ${this.message}
72
+ ${i}`)}};async function Se(t,e,r,i){let n=typeof t=="function"?Promise.resolve(t()):Promise.resolve(t);if(e===-1||!globalThis?.setTimeout)return n;let s,a=new Promise((c,u)=>{s=globalThis?.setTimeout?.(()=>u(new we(e,r,i)),e)});try{return await Promise.race([n,a])}finally{globalThis?.clearTimeout?.(s)}}o(Se,"withTimeout");var $e=class t extends R{static{o(this,"FailingError")}constructor(e){super("Failing test passed even though it was supposed to fail. Remove `.failing` to remove error."),Error.captureStackTrace&&Error.captureStackTrace(this,t),this.name="xJetFailingError",this.stack=`${this.name}: ${this.message}
73
+ ${e}`}};var Ae=class{constructor(e,r,i,n=[],s={}){this.description=e;this.testImplementation=r;this.timeoutDuration=i;this.testParameters=n;this.testOptions=s}static{o(this,"TestModel")}ancestry=[];executionLocation="";executionStartTime=0;get options(){return this.testOptions}setExecutionLocation(e){this.executionLocation=e}applyExecutionFlags(e,r){this.testOptions.skip||=e,this.testOptions.only||=r}setAncestry(e){this.ancestry.push(...e)}async run(e,r,i=!1){if(S(E).test=this,this.executionStartTime=Date.now(),!this.shouldSkipDueToSetupErrors(e)&&!this.determineSkipAction(i))try{await this.executeTestWithLifecycle(e,r),this.validateTestOutcome()}catch(n){this.notifyTestFailure(n),globalThis.__XJET?.runtime.bail&&(e.hasError=!0)}finally{S(E).test=void 0}}shouldSkipDueToSetupErrors(e){return e.beforeAllErrors&&e.beforeAllErrors.length>0?(this.notifyTestFailure(e.beforeAllErrors),!0):!1}determineSkipAction(e){return S(E).isOnlyMode&&!this.testOptions.only?(this.notifyTestStatus(!0),!0):this.testOptions.skip||this.testOptions.todo?(this.notifyTestStatus(this.testOptions.skip,this.testOptions.todo),!0):e&&!this.testOptions.only?(this.notifyTestStatus(!0),!0):!1}async executeTestWithLifecycle(e,r){await r("beforeEach",e),await Se(this.executeTestWithContext(e),this.timeoutDuration,`'${this.timeoutDuration}' test`,this.executionLocation),await r("afterEach",e)}validateTestOutcome(){if(this.testOptions.failing)throw new $e(this.executionLocation);this.notifyTestAction()}isCallbackStyle(){return this.testImplementation.length===1&&this.testParameters.length===0?!0:this.testImplementation.length===2}getExecutionStrategy(){return X(this.testImplementation)?"ASYNC":this.isCallbackStyle()?"CALLBACK":"SYNC"}async executeTestWithContext(e){switch(this.getExecutionStrategy()){case"ASYNC":case"SYNC":await this.testImplementation.apply(e,this.testParameters);break;case"CALLBACK":await this.executeCallbackStyleTest(e);break}}async executeCallbackStyleTest(e){return new Promise((r,i)=>{let n=o(a=>{a&&i(a),r()},"callbackFn"),s=[...this.testParameters];s.push(n),this.testImplementation.apply(e,s)})}getExecutionDuration(){return this.executionStartTime===0?0:Date.now()-this.executionStartTime}notifyTestStatus(e=!1,r=!1){J(1,{todo:r,skipped:e,ancestry:this.ancestry,description:this.description})}notifyTestAction(e=[]){Te(1,{errors:e,ancestry:this.ancestry,duration:this.getExecutionDuration(),description:this.description})}notifyTestFailure(e){this.notifyTestAction(Array.isArray(e)?e:[e])}};var pe=class t extends Function{static{o(this,"TestDirective")}static instance;static ERROR_MESSAGES={SKIP_ONLY:'Cannot use "only" flag on skipped test',ONLY_SKIP:'Cannot use "skip" flag on only test',SKIP_TODO:'Cannot use "todo" flag on skipped test',SKIP_FAILING:'Cannot use "failing" flag on skipped test'};static DEFAULT_TIMEOUT=globalThis.__XJET?.runtime.timeout??5e3;options={};invocationStack="";constructor(){return super(),new Proxy(this,{apply:o((e,r,i)=>{let[n,s,a]=i;this.invocationStack=q(2),e.invoke(n,s,[],a)},"apply")})}static getInstance(){return t.instance||(t.instance=new t),t.instance}get skip(){if(this.options.only)throw new Error(t.ERROR_MESSAGES.ONLY_SKIP);return this.options.skip=!0,this}get only(){if(this.options.skip)throw new Error(t.ERROR_MESSAGES.SKIP_ONLY);return this.options.only=!0,this}get todo(){if(this.options.skip)throw new Error(t.ERROR_MESSAGES.SKIP_TODO);return this.options.todo=!0,this}get failing(){if(this.options.skip)throw new Error(t.ERROR_MESSAGES.SKIP_FAILING);return this.options.failing=!0,this}each(...e){return ke(this.invoke.bind(this),...e)}invoke(e,r,i=[],n){this.validateTestNesting(e),r||(this.options.todo=!0);let s=this.createTest(e,r,i,n);this.registerTest(s,this.invocationStack),this.resetFlags()}validateTestNesting(e){let r=S(E).test;if(r)throw new Error(`Cannot nest a test inside a test '${e}' in '${r.description}'`)}createTest(e,r,i,n){return new Ae(e,r,n??t.DEFAULT_TIMEOUT,i,{...this.options})}registerTest(e,r){r&&e.setExecutionLocation(r),S(E).addTest(e)}resetFlags(){this.options={}}};var Ce=class t extends Function{static{o(this,"DescribeDirective")}static instance=null;options={};constructor(){return super(),new Proxy(this,{apply(e,r,i){e.invoke(i[0],i[1])}})}static getInstance(){return t.instance||(t.instance=new t),t.instance}get skip(){if(this.options.only)throw new Error('Cannot use "skip" flag on only test');return this.options.skip=!0,this}get only(){if(this.options.skip)throw new Error('Cannot use "only" flag on skipped test');return this.options.only=!0,this}each(...e){return ke(this.invoke.bind(this),...e)}invoke(e,r,i=[]){let n=S(E),s=n.test;if(s)throw new Error(`Cannot nest a describe inside a test '${e}' in '${s.description}'`);n.addDescribe(e,r,this.options,i),this.options={}}};function xn(t){if(t.name in globalThis)return globalThis;let e=t.name,r=globalThis;for(let i of Object.keys(globalThis)){let n=r[i];if(!(typeof n!="function"&&typeof n!="object")&&n&&e in n)return r[i]}}o(xn,"getParentObject");function ui(t,e){return new C(t,e,"xJet.fn()")}o(ui,"fnImplementation");function hi(t){if(t.isMock)return t;let e=xn(t);if(!e)throw new R("Method is not part of an object");let r=t;if(t.prototype&&!Object.getOwnPropertyDescriptor(t,"prototype")?.writable){let i=new C((...n)=>new t(...n),()=>{e[t.name]=r});return e[t.name]=i,C.mocks.push(i),e[t.name]}if(typeof t=="function"){let i=new C(t,()=>{e[t.name]=r});return e[t.name]=i,C.mocks.push(i),e[t.name]}throw new R("Invalid method type")}o(hi,"mockImplementation");var Ie=class{constructor(e,r){this.hookFunction=e;this.timeout=r}static{o(this,"HookModel")}location="";setLocation(e){this.location=e}async run(e){return Se(this.executeHook(this.hookFunction,e),this.timeout,"hook while waiting for 'done()' to be called.",this.location)}async executeHook(e,r){if(X(e)&&e.length>0)throw new Error(`Async hook '${e.name}' should not use 'done' callback.`);return e.length>0?this.executeCallbackHook(e,r):e.call(r)}executeCallbackHook(e,r){return new Promise((i,n)=>{e.call(r,s=>{s?n(s):i()})})}};var En=globalThis.__XJET?.runtime.timeout??5e3;function Re(t,e,r,i=En){let n=new Ie(e,i);n.setLocation(r),S(E).describe.addHook(t,n)}o(Re,"createHook");function pi(t,e){Re("afterAll",t,q(),e)}o(pi,"afterAllDirective");function fi(t,e){Re("beforeAll",t,q(),e)}o(fi,"beforeAllDirective");function di(t,e){Re("afterEach",t,q(),e)}o(di,"afterEachDirective");function mi(t,e){Re("beforeEach",t,q(),e)}o(mi,"beforeEachDirective");function et(t){[...C.mocks].map(r=>{r[t]()})}o(et,"clearMocks");var Tn=o(()=>{let t=globalThis;t.xJet={fn:ui,mock:hi,spyOn:ci,log:ii,info:ni,warn:si,error:oi,debug:ai,clearAllMocks:o(()=>et("mockClear"),"clearAllMocks"),resetAllMocks:o(()=>et("mockReset"),"resetAllMocks"),restoreAllMocks:o(()=>et("mockRestore"),"restoreAllMocks")},t.expect=Rr,t.state=S(E),t.it=pe.getInstance(),t.test=pe.getInstance(),t.describe=Ce.getInstance(),t.afterAll=pi,t.beforeAll=fi,t.afterEach=di,t.beforeEach=mi},"setupGlobals");Tn();
74
+ //# sourceMappingURL=shared.js.map