twd-js 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.es.js +12 -9
- package/dist/mock-sw.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xo=require("./runner.cjs.js"),B=require("./jsx-runtime-DN5DOl8k.js"),ii=require("react"),um=require("./_commonjsHelpers-DwGv2jUC.js"),cm=(e,t,r=2e3,n=50)=>new Promise((o,i)=>{const a=Date.now(),s=()=>{const l=t();if(l)return o(l);if(Date.now()-a>r)return i(new Error(`Timeout waiting for element ${e}`));setTimeout(s,n)};s()}),dm=(e,t,r=2e3,n=50)=>new Promise((o,i)=>{const a=Date.now(),s=()=>{const l=t();if(l&&l.length>0)return o(Array.from(l));if(Date.now()-a>r)return i(new Error(`Timeout waiting for elements ${e}`));setTimeout(s,n)};s()}),_o=e=>new Promise(t=>setTimeout(t,e)),Yi=(e,t,r,n)=>{if(!e&&!t)throw new Error(n);if(e&&t)throw new Error(n.replace("to be","to not be").replace("to have","to not have").replace("to contain","to not contain"));return r};function fm(e){if(!e.isConnected)return!1;let t=e;for(;t;){const r=getComputedStyle(t);if(r.display==="none"||r.visibility==="hidden"||r.visibility==="collapse")return!1;t=t.parentElement}return!0}const pm={"have.text":{positive:{pass:e=>`Assertion passed: Text is exactly "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to be "${e[0]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Text is not exactly "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to not be "${e[0]}", but got "${t}"`}},"contain.text":{positive:{pass:e=>`Assertion passed: Text contains "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to contain "${e[0]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Text does not contain "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to not contain "${e[0]}", but got "${t}"`}},"be.empty":{positive:{pass:()=>"Assertion passed: Text is empty",fail:(e,t)=>`Assertion failed: Expected text to be empty, but got "${t}"`},negative:{pass:()=>"Assertion passed: Text is not empty",fail:(e,t)=>`Assertion failed: Expected text to not be empty, but got "${t}"`}},"have.attr":{positive:{pass:e=>`Assertion passed: Attribute "${e[0]}" is "${e[1]}"`,fail:(e,t)=>`Assertion failed: Expected attribute "${e[0]}" to be "${e[1]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Attribute "${e[0]}" is not "${e[1]}"`,fail:(e,t)=>`Assertion failed: Expected attribute "${e[0]}" to not be "${e[1]}", but got "${t}"`}},"have.value":{positive:{pass:e=>`Assertion passed: Value is "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected value to be "${e[0]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Value is not "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected value to not be "${e[0]}", but got "${t}"`}},"be.disabled":{positive:{pass:()=>"Assertion passed: Element is disabled",fail:()=>"Assertion failed: Expected element to be disabled"},negative:{pass:()=>"Assertion passed: Element is not disabled",fail:()=>"Assertion failed: Expected element to not be disabled"}},"be.enabled":{positive:{pass:()=>"Assertion passed: Element is enabled",fail:()=>"Assertion failed: Expected element to be enabled"},negative:{pass:()=>"Assertion passed: Element is not enabled",fail:()=>"Assertion failed: Expected element to not be enabled"}},"be.checked":{positive:{pass:()=>"Assertion passed: Element is checked",fail:()=>"Assertion failed: Expected element to be checked"},negative:{pass:()=>"Assertion passed: Element is not checked",fail:()=>"Assertion failed: Expected element to not be checked"}},"be.selected":{positive:{pass:()=>"Assertion passed: Element is selected",fail:()=>"Assertion failed: Expected element to be selected"},negative:{pass:()=>"Assertion passed: Element is not selected",fail:()=>"Assertion failed: Expected element to not be selected"}},"be.focused":{positive:{pass:()=>"Assertion passed: Element is focused",fail:()=>"Assertion failed: Expected element to be focused"},negative:{pass:()=>"Assertion passed: Element is not focused",fail:()=>"Assertion failed: Expected element to not be focused"}},"be.visible":{positive:{pass:()=>"Assertion passed: Element is visible",fail:()=>"Assertion failed: Expected element to be visible"},negative:{pass:()=>"Assertion passed: Element is not visible",fail:()=>"Assertion failed: Expected element to not be visible"}},"have.class":{positive:{pass:e=>`Assertion passed: Element has class "${e[0]}"`,fail:e=>`Assertion failed: Expected element to have class "${e[0]}"`},negative:{pass:e=>`Assertion passed: Element does not have class "${e[0]}"`,fail:e=>`Assertion failed: Expected element to not have class "${e[0]}"`}}},ji=(e,t,...r)=>{const n=t.startsWith("not."),o=n?t.slice(4):t,i=(e.textContent||"").trim(),a=pm[o];if(!a)throw new Error(`Unknown assertion: ${o}`);const s=n?"negative":"positive";let l,u;switch(o){case"have.text":l=i===r[0],u=i;break;case"contain.text":l=i.includes(r[0]),u=i;break;case"be.empty":l=i.length===0,u=i;break;case"have.attr":u=e.getAttribute(r[0]),l=u===r[1];break;case"have.value":u=e.value,l=u===r[0];break;case"be.disabled":l=e.disabled===!0;break;case"be.enabled":l=e.disabled===!1;break;case"be.checked":l=e.checked===!0;break;case"be.selected":l=e.selected===!0;break;case"be.focused":l=document.activeElement===e;break;case"be.visible":l=fm(e);break;case"have.class":l=e.classList.contains(r[0]);break;default:throw new Error(`Unknown assertion: ${o}`)}return Yi(l,n,a[s].pass(r),a[s].fail(r,u))},Re=e=>{const t=xo.handlers.size?Array.from(xo.handlers.values()).find(r=>r.status==="running"):null;t&&t.logs?.push(e)},xa="1.2.1",at=[],bd=100,mm=async()=>{"serviceWorker"in navigator&&(await navigator.serviceWorker.register(`/mock-sw.js?v=${xa}`),navigator.serviceWorker.controller||await new Promise(e=>{navigator.serviceWorker.addEventListener("controllerchange",e,{once:!0})}),navigator.serviceWorker.addEventListener("message",e=>{if(e.data?.type==="EXECUTED"){const{alias:t,request:r}=e.data,n=at.find(o=>o.alias===t);n&&(n.executed=!0,n.request=r)}}))},hm=async(e,t)=>{const r={alias:e,...t,executed:!1},n=at.findIndex(o=>o.alias===e);n!==-1?at[n]=r:at.push(r),navigator.serviceWorker.controller?.postMessage({type:"ADD_RULE",rule:r,version:xa}),await _o(bd),await Promise.resolve()},bm=async e=>await Promise.all(e.map(r=>vd(r))),vd=async e=>{await _o(bd);const t=at.find(r=>r.alias===e&&r.executed);if(!t)throw new Error(`Rule ${e} not found or not executed`);return Promise.resolve(t)},vm=()=>at,ym=()=>{navigator.serviceWorker.controller?.postMessage({type:"CLEAR_RULES",version:xa}),at.length=0},gm=(e,t)=>{const r=e.startsWith("not.");switch(r?e.slice(4):e){case"eq":return Yi(window.location.href===t,r,`Assertion passed: URL is ${t}`,`Assertion failed: Expected URL to be ${t}, but got ${window.location.href}`);case"contain.url":return Yi(window.location.href.includes(t),r,`Assertion passed: URL contains ${t}`,`Assertion failed: Expected URL to contain ${t}, but got ${window.location.href}`);default:throw new Error(`Unknown assertion: ${e}`)}},Rm=()=>({location:window.location,should:(e,t)=>{const r=gm(e,t);return Re(r),r}}),wm=100,Em=async(e,t)=>{if(Re(`visit("${e}")`),window.location.pathname===e||t){const r=`/__dummy_${Math.random().toString(36).slice(2)}`;window.history.pushState({},"",r),window.dispatchEvent(new PopStateEvent("popstate")),await _o(10)}window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate")),await _o(wm)},yd={get:async e=>{const t=`body > div:not(#twd-sidebar-root) ${e}`;Re(`Searching get("${e}")`);const r=await cm(e,()=>document.querySelector(t)),n={el:r,should:(o,...i)=>{const a=ji(r,o,...i);return Re(a),n}};return n},setInputValue:(e,t)=>{const{set:r}=Object.getOwnPropertyDescriptor(e.__proto__,"value");r.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))},getAll:async e=>{const t=`body > div:not(#twd-sidebar-root) ${e}`;return Re(`Searching getAll("${e}")`),(await dm(e,()=>document.querySelectorAll(t))).map(n=>{const o={el:n,should:(i,...a)=>{const s=ji(n,i,...a);return Re(s),o}};return o})},visit:Em,url:Rm,mockRequest:hm,waitForRequest:vd,waitForRequests:bm,initRequestMocking:mm,clearRequestMockRules:ym,getRequestMockRules:vm,should:(e,t,...r)=>{const n=ji(e,t,...r);Re(n)},wait:_o,mockComponent:B.mockComponent,clearComponentMocks:B.clearComponentMocks,notExists:async e=>{const t=`body > div:not(#twd-sidebar-root) ${e}`;if(Re(`Checking notExists("${e}")`),document.querySelector(t))throw new Error(`Element "${e}" exists in the DOM.`);Re(`Assertion passed: Element "${e}" does not exist in the DOM.`)}};var Ca=Object.defineProperty,xm=(e,t,r)=>t in e?Ca(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>Ca(e,"name",{value:t,configurable:!0}),qa=(e,t)=>{for(var r in t)Ca(e,r,{get:t[r],enumerable:!0})},gd=(e,t,r)=>xm(e,typeof t!="symbol"?t+"":t,r),ai={};qa(ai,{addChainableMethod:()=>$a,addLengthGuard:()=>Do,addMethod:()=>ka,addProperty:()=>Na,checkError:()=>fe,compareByInspect:()=>ui,eql:()=>Kd,events:()=>Ci,expectTypes:()=>Td,flag:()=>U,getActual:()=>Ei,getMessage:()=>Ta,getName:()=>qi,getOperator:()=>Ua,getOwnEnumerableProperties:()=>Fa,getOwnEnumerablePropertySymbols:()=>La,getPathInfo:()=>Oa,hasProperty:()=>xi,inspect:()=>H,isNaN:()=>ci,isNumeric:()=>ne,isProxyEnabled:()=>jo,isRegExp:()=>di,objDisplay:()=>st,overwriteChainableMethod:()=>Ba,overwriteMethod:()=>Da,overwriteProperty:()=>ja,proxify:()=>Pt,test:()=>Pa,transferFlags:()=>Ee,type:()=>Q});var fe={};qa(fe,{compatibleConstructor:()=>Ed,compatibleInstance:()=>wd,compatibleMessage:()=>xd,getConstructorName:()=>Cd,getMessage:()=>qd});function wi(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}x(wi,"isErrorInstance");function Rd(e){return Object.prototype.toString.call(e)==="[object RegExp]"}x(Rd,"isRegExp");function wd(e,t){return wi(t)&&e===t}x(wd,"compatibleInstance");function Ed(e,t){return wi(t)?e.constructor===t.constructor||e instanceof t.constructor:(typeof t=="object"||typeof t=="function")&&t.prototype?e.constructor===t||e instanceof t:!1}x(Ed,"compatibleConstructor");function xd(e,t){const r=typeof e=="string"?e:e.message;return Rd(t)?t.test(r):typeof t=="string"?r.indexOf(t)!==-1:!1}x(xd,"compatibleMessage");function Cd(e){let t=e;return wi(e)?t=e.constructor.name:typeof e=="function"&&(t=e.name,t===""&&(t=new e().name||t)),t}x(Cd,"getConstructorName");function qd(e){let t="";return e&&e.message?t=e.message:typeof e=="string"&&(t=e),t}x(qd,"getMessage");function U(e,t,r){let n=e.__flags||(e.__flags=Object.create(null));if(arguments.length===3)n[t]=r;else return n[t]}x(U,"flag");function Pa(e,t){let r=U(e,"negate"),n=t[0];return r?!n:n}x(Pa,"test");function Q(e){if(typeof e>"u")return"undefined";if(e===null)return"null";const t=e[Symbol.toStringTag];return typeof t=="string"?t:Object.prototype.toString.call(e).slice(8,-1)}x(Q,"type");var Cm="captureStackTrace"in Error,Pd=class _d extends Error{constructor(t="Unspecified AssertionError",r,n){super(t),gd(this,"message"),this.message=t,Cm&&Error.captureStackTrace(this,n||_d);for(const o in r)o in this||(this[o]=r[o])}get name(){return"AssertionError"}get ok(){return!1}toJSON(t){return{...this,name:this.name,message:this.message,ok:!1,stack:t!==!1?this.stack:void 0}}};x(Pd,"AssertionError");var G=Pd;function Td(e,t){let r=U(e,"message"),n=U(e,"ssfi");r=r?r+": ":"",e=U(e,"object"),t=t.map(function(a){return a.toLowerCase()}),t.sort();let o=t.map(function(a,s){let l=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an":"a";return(t.length>1&&s===t.length-1?"or ":"")+l+" "+a}).join(", "),i=Q(e).toLowerCase();if(!t.some(function(a){return i===a}))throw new G(r+"object tested must be "+o+", but "+i+" given",void 0,n)}x(Td,"expectTypes");function Ei(e,t){return t.length>4?t[4]:e._obj}x(Ei,"getActual");var qs={bold:["1","22"],dim:["2","22"],italic:["3","23"],underline:["4","24"],inverse:["7","27"],hidden:["8","28"],strike:["9","29"],black:["30","39"],red:["31","39"],green:["32","39"],yellow:["33","39"],blue:["34","39"],magenta:["35","39"],cyan:["36","39"],white:["37","39"],brightblack:["30;1","39"],brightred:["31;1","39"],brightgreen:["32;1","39"],brightyellow:["33;1","39"],brightblue:["34;1","39"],brightmagenta:["35;1","39"],brightcyan:["36;1","39"],brightwhite:["37;1","39"],grey:["90","39"]},qm={special:"cyan",number:"yellow",bigint:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",symbol:"green",date:"magenta",regexp:"red"},yt="…";function Sd(e,t){const r=qs[qm[t]]||qs[t]||"";return r?`\x1B[${r[0]}m${String(e)}\x1B[${r[1]}m`:String(e)}x(Sd,"colorise");function Ad({showHidden:e=!1,depth:t=2,colors:r=!1,customInspect:n=!0,showProxy:o=!1,maxArrayLength:i=1/0,breakLength:a=1/0,seen:s=[],truncate:l=1/0,stylize:u=String}={},f){const c={showHidden:!!e,depth:Number(t),colors:!!r,customInspect:!!n,showProxy:!!o,maxArrayLength:Number(i),breakLength:Number(a),truncate:Number(l),seen:s,inspect:f,stylize:u};return c.colors&&(c.stylize=Sd),c}x(Ad,"normaliseOptions");function Md(e){return e>="\uD800"&&e<="\uDBFF"}x(Md,"isHighSurrogate");function Fe(e,t,r=yt){e=String(e);const n=r.length,o=e.length;if(n>t&&o>n)return r;if(o>t&&o>n){let i=t-n;return i>0&&Md(e[i-1])&&(i=i-1),`${e.slice(0,i)}${r}`}return e}x(Fe,"truncate");function he(e,t,r,n=", "){r=r||t.inspect;const o=e.length;if(o===0)return"";const i=t.truncate;let a="",s="",l="";for(let u=0;u<o;u+=1){const f=u+1===e.length,c=u+2===e.length;l=`${yt}(${e.length-u})`;const d=e[u];t.truncate=i-a.length-(f?0:n.length);const b=s||r(d,t)+(f?"":n),v=a.length+b.length,R=v+l.length;if(f&&v>i&&a.length+l.length<=i||!f&&!c&&R>i||(s=f?"":r(e[u+1],t)+(c?"":n),!f&&c&&R>i&&v+s.length>i))break;if(a+=b,!f&&!c&&v+s.length>=i){l=`${yt}(${e.length-u-1})`;break}l=""}return`${a}${l}`}x(he,"inspectList");function Od(e){return e.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)?e:JSON.stringify(e).replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'")}x(Od,"quoteComplexKey");function gt([e,t],r){return r.truncate-=2,typeof e=="string"?e=Od(e):typeof e!="number"&&(e=`[${r.inspect(e,r)}]`),r.truncate-=e.length,t=r.inspect(t,r),`${e}: ${t}`}x(gt,"inspectProperty");function Id(e,t){const r=Object.keys(e).slice(e.length);if(!e.length&&!r.length)return"[]";t.truncate-=4;const n=he(e,t);t.truncate-=n.length;let o="";return r.length&&(o=he(r.map(i=>[i,e[i]]),t,gt)),`[ ${n}${o?`, ${o}`:""} ]`}x(Id,"inspectArray");var Pm=x(e=>typeof Buffer=="function"&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag]?e[Symbol.toStringTag]:e.constructor.name,"getArrayName");function qe(e,t){const r=Pm(e);t.truncate-=r.length+4;const n=Object.keys(e).slice(e.length);if(!e.length&&!n.length)return`${r}[]`;let o="";for(let a=0;a<e.length;a++){const s=`${t.stylize(Fe(e[a],t.truncate),"number")}${a===e.length-1?"":", "}`;if(t.truncate-=s.length,e[a]!==e.length&&t.truncate<=3){o+=`${yt}(${e.length-e[a]+1})`;break}o+=s}let i="";return n.length&&(i=he(n.map(a=>[a,e[a]]),t,gt)),`${r}[ ${o}${i?`, ${i}`:""} ]`}x(qe,"inspectTypedArray");function Nd(e,t){const r=e.toJSON();if(r===null)return"Invalid Date";const n=r.split("T"),o=n[0];return t.stylize(`${o}T${Fe(n[1],t.truncate-o.length-1)}`,"date")}x(Nd,"inspectDate");function Xi(e,t){const r=e[Symbol.toStringTag]||"Function",n=e.name;return n?t.stylize(`[${r} ${Fe(n,t.truncate-11)}]`,"special"):t.stylize(`[${r}]`,"special")}x(Xi,"inspectFunction");function kd([e,t],r){return r.truncate-=4,e=r.inspect(e,r),r.truncate-=e.length,t=r.inspect(t,r),`${e} => ${t}`}x(kd,"inspectMapEntry");function jd(e){const t=[];return e.forEach((r,n)=>{t.push([n,r])}),t}x(jd,"mapToEntries");function Dd(e,t){return e.size===0?"Map{}":(t.truncate-=7,`Map{ ${he(jd(e),t,kd)} }`)}x(Dd,"inspectMap");var _m=Number.isNaN||(e=>e!==e);function Ji(e,t){return _m(e)?t.stylize("NaN","number"):e===1/0?t.stylize("Infinity","number"):e===-1/0?t.stylize("-Infinity","number"):e===0?t.stylize(1/e===1/0?"+0":"-0","number"):t.stylize(Fe(String(e),t.truncate),"number")}x(Ji,"inspectNumber");function Qi(e,t){let r=Fe(e.toString(),t.truncate-1);return r!==yt&&(r+="n"),t.stylize(r,"bigint")}x(Qi,"inspectBigInt");function $d(e,t){const r=e.toString().split("/")[2],n=t.truncate-(2+r.length),o=e.source;return t.stylize(`/${Fe(o,n)}/${r}`,"regexp")}x($d,"inspectRegExp");function Bd(e){const t=[];return e.forEach(r=>{t.push(r)}),t}x(Bd,"arrayFromSet");function Ld(e,t){return e.size===0?"Set{}":(t.truncate-=7,`Set{ ${he(Bd(e),t)} }`)}x(Ld,"inspectSet");var Ps=new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]","g"),Tm={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","'":"\\'","\\":"\\\\"},Sm=16;function Fd(e){return Tm[e]||`\\u${`0000${e.charCodeAt(0).toString(Sm)}`.slice(-4)}`}x(Fd,"escape");function Zi(e,t){return Ps.test(e)&&(e=e.replace(Ps,Fd)),t.stylize(`'${Fe(e,t.truncate-2)}'`,"string")}x(Zi,"inspectString");function ea(e){return"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString()}x(ea,"inspectSymbol");var Am=x(()=>"Promise{…}","getPromiseValue"),Mm=Am;function Co(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[];if(r.length===0&&n.length===0)return"{}";if(t.truncate-=4,t.seen=t.seen||[],t.seen.includes(e))return"[Circular]";t.seen.push(e);const o=he(r.map(s=>[s,e[s]]),t,gt),i=he(n.map(s=>[s,e[s]]),t,gt);t.seen.pop();let a="";return o&&i&&(a=", "),`{ ${o}${a}${i} }`}x(Co,"inspectObject");var Di=typeof Symbol<"u"&&Symbol.toStringTag?Symbol.toStringTag:!1;function Ud(e,t){let r="";return Di&&Di in e&&(r=e[Di]),r=r||e.constructor.name,(!r||r==="_class")&&(r="<Anonymous Class>"),t.truncate-=r.length,`${r}${Co(e,t)}`}x(Ud,"inspectClass");function zd(e,t){return e.length===0?"Arguments[]":(t.truncate-=13,`Arguments[ ${he(e,t)} ]`)}x(zd,"inspectArguments");var Om=["stack","line","column","name","message","fileName","lineNumber","columnNumber","number","description","cause"];function Vd(e,t){const r=Object.getOwnPropertyNames(e).filter(a=>Om.indexOf(a)===-1),n=e.name;t.truncate-=n.length;let o="";if(typeof e.message=="string"?o=Fe(e.message,t.truncate):r.unshift("message"),o=o?`: ${o}`:"",t.truncate-=o.length+5,t.seen=t.seen||[],t.seen.includes(e))return"[Circular]";t.seen.push(e);const i=he(r.map(a=>[a,e[a]]),t,gt);return`${n}${o}${i?` { ${i} }`:""}`}x(Vd,"inspectObject");function Hd([e,t],r){return r.truncate-=3,t?`${r.stylize(String(e),"yellow")}=${r.stylize(`"${t}"`,"string")}`:`${r.stylize(String(e),"yellow")}`}x(Hd,"inspectAttribute");function si(e,t){return he(e,t,Wd,`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xo=require("./runner.cjs.js"),B=require("./jsx-runtime-DN5DOl8k.js"),ii=require("react"),um=require("./_commonjsHelpers-DwGv2jUC.js"),cm=(e,t,r=2e3,n=50)=>new Promise((o,i)=>{const a=Date.now(),s=()=>{const l=t();if(l)return o(l);if(Date.now()-a>r)return i(new Error(`Timeout waiting for element ${e}`));setTimeout(s,n)};s()}),dm=(e,t,r=2e3,n=50)=>new Promise((o,i)=>{const a=Date.now(),s=()=>{const l=t();if(l&&l.length>0)return o(Array.from(l));if(Date.now()-a>r)return i(new Error(`Timeout waiting for elements ${e}`));setTimeout(s,n)};s()}),_o=e=>new Promise(t=>setTimeout(t,e)),Yi=(e,t,r,n)=>{if(!e&&!t)throw new Error(n);if(e&&t)throw new Error(n.replace("to be","to not be").replace("to have","to not have").replace("to contain","to not contain"));return r};function fm(e){if(!e.isConnected)return!1;let t=e;for(;t;){const r=getComputedStyle(t);if(r.display==="none"||r.visibility==="hidden"||r.visibility==="collapse")return!1;t=t.parentElement}return!0}const pm={"have.text":{positive:{pass:e=>`Assertion passed: Text is exactly "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to be "${e[0]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Text is not exactly "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to not be "${e[0]}", but got "${t}"`}},"contain.text":{positive:{pass:e=>`Assertion passed: Text contains "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to contain "${e[0]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Text does not contain "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected text to not contain "${e[0]}", but got "${t}"`}},"be.empty":{positive:{pass:()=>"Assertion passed: Text is empty",fail:(e,t)=>`Assertion failed: Expected text to be empty, but got "${t}"`},negative:{pass:()=>"Assertion passed: Text is not empty",fail:(e,t)=>`Assertion failed: Expected text to not be empty, but got "${t}"`}},"have.attr":{positive:{pass:e=>`Assertion passed: Attribute "${e[0]}" is "${e[1]}"`,fail:(e,t)=>`Assertion failed: Expected attribute "${e[0]}" to be "${e[1]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Attribute "${e[0]}" is not "${e[1]}"`,fail:(e,t)=>`Assertion failed: Expected attribute "${e[0]}" to not be "${e[1]}", but got "${t}"`}},"have.value":{positive:{pass:e=>`Assertion passed: Value is "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected value to be "${e[0]}", but got "${t}"`},negative:{pass:e=>`Assertion passed: Value is not "${e[0]}"`,fail:(e,t)=>`Assertion failed: Expected value to not be "${e[0]}", but got "${t}"`}},"be.disabled":{positive:{pass:()=>"Assertion passed: Element is disabled",fail:()=>"Assertion failed: Expected element to be disabled"},negative:{pass:()=>"Assertion passed: Element is not disabled",fail:()=>"Assertion failed: Expected element to not be disabled"}},"be.enabled":{positive:{pass:()=>"Assertion passed: Element is enabled",fail:()=>"Assertion failed: Expected element to be enabled"},negative:{pass:()=>"Assertion passed: Element is not enabled",fail:()=>"Assertion failed: Expected element to not be enabled"}},"be.checked":{positive:{pass:()=>"Assertion passed: Element is checked",fail:()=>"Assertion failed: Expected element to be checked"},negative:{pass:()=>"Assertion passed: Element is not checked",fail:()=>"Assertion failed: Expected element to not be checked"}},"be.selected":{positive:{pass:()=>"Assertion passed: Element is selected",fail:()=>"Assertion failed: Expected element to be selected"},negative:{pass:()=>"Assertion passed: Element is not selected",fail:()=>"Assertion failed: Expected element to not be selected"}},"be.focused":{positive:{pass:()=>"Assertion passed: Element is focused",fail:()=>"Assertion failed: Expected element to be focused"},negative:{pass:()=>"Assertion passed: Element is not focused",fail:()=>"Assertion failed: Expected element to not be focused"}},"be.visible":{positive:{pass:()=>"Assertion passed: Element is visible",fail:()=>"Assertion failed: Expected element to be visible"},negative:{pass:()=>"Assertion passed: Element is not visible",fail:()=>"Assertion failed: Expected element to not be visible"}},"have.class":{positive:{pass:e=>`Assertion passed: Element has class "${e[0]}"`,fail:e=>`Assertion failed: Expected element to have class "${e[0]}"`},negative:{pass:e=>`Assertion passed: Element does not have class "${e[0]}"`,fail:e=>`Assertion failed: Expected element to not have class "${e[0]}"`}}},ji=(e,t,...r)=>{const n=t.startsWith("not."),o=n?t.slice(4):t,i=(e.textContent||"").trim(),a=pm[o];if(!a)throw new Error(`Unknown assertion: ${o}`);const s=n?"negative":"positive";let l,u;switch(o){case"have.text":l=i===r[0],u=i;break;case"contain.text":l=i.includes(r[0]),u=i;break;case"be.empty":l=i.length===0,u=i;break;case"have.attr":u=e.getAttribute(r[0]),l=u===r[1];break;case"have.value":u=e.value,l=u===r[0];break;case"be.disabled":l=e.disabled===!0;break;case"be.enabled":l=e.disabled===!1;break;case"be.checked":l=e.checked===!0;break;case"be.selected":l=e.selected===!0;break;case"be.focused":l=document.activeElement===e;break;case"be.visible":l=fm(e);break;case"have.class":l=e.classList.contains(r[0]);break;default:throw new Error(`Unknown assertion: ${o}`)}return Yi(l,n,a[s].pass(r),a[s].fail(r,u))},Re=e=>{const t=xo.handlers.size?Array.from(xo.handlers.values()).find(r=>r.status==="running"):null;t&&t.logs?.push(e)},xa="1.2.2",at=[],bd=100,mm=async e=>{if("serviceWorker"in navigator){const t=e??"/mock-sw.js";await navigator.serviceWorker.register(`${t}?v=${xa}`),navigator.serviceWorker.controller||await new Promise(r=>{navigator.serviceWorker.addEventListener("controllerchange",r,{once:!0})}),navigator.serviceWorker.addEventListener("message",r=>{if(r.data?.type==="EXECUTED"){const{alias:n,request:o}=r.data,i=at.find(a=>a.alias===n);i&&(i.executed=!0,i.request=o)}})}},hm=async(e,t)=>{const r={alias:e,...t,executed:!1},n=at.findIndex(o=>o.alias===e);n!==-1?at[n]=r:at.push(r),navigator.serviceWorker.controller?.postMessage({type:"ADD_RULE",rule:r,version:xa}),await _o(bd),await Promise.resolve()},bm=async e=>await Promise.all(e.map(r=>vd(r))),vd=async e=>{await _o(bd);const t=at.find(r=>r.alias===e&&r.executed);if(!t)throw new Error(`Rule ${e} not found or not executed`);return Promise.resolve(t)},vm=()=>at,ym=()=>{navigator.serviceWorker.controller?.postMessage({type:"CLEAR_RULES",version:xa}),at.length=0},gm=(e,t)=>{const r=e.startsWith("not.");switch(r?e.slice(4):e){case"eq":return Yi(window.location.href===t,r,`Assertion passed: URL is ${t}`,`Assertion failed: Expected URL to be ${t}, but got ${window.location.href}`);case"contain.url":return Yi(window.location.href.includes(t),r,`Assertion passed: URL contains ${t}`,`Assertion failed: Expected URL to contain ${t}, but got ${window.location.href}`);default:throw new Error(`Unknown assertion: ${e}`)}},Rm=()=>({location:window.location,should:(e,t)=>{const r=gm(e,t);return Re(r),r}}),wm=100,Em=async(e,t)=>{if(Re(`visit("${e}")`),window.location.pathname===e||t){const r=`/__dummy_${Math.random().toString(36).slice(2)}`;window.history.pushState({},"",r),window.dispatchEvent(new PopStateEvent("popstate")),await _o(10)}window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate")),await _o(wm)},yd={get:async e=>{const t=`body > div:not(#twd-sidebar-root) ${e}`;Re(`Searching get("${e}")`);const r=await cm(e,()=>document.querySelector(t)),n={el:r,should:(o,...i)=>{const a=ji(r,o,...i);return Re(a),n}};return n},setInputValue:(e,t)=>{const{set:r}=Object.getOwnPropertyDescriptor(e.__proto__,"value");r.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))},getAll:async e=>{const t=`body > div:not(#twd-sidebar-root) ${e}`;return Re(`Searching getAll("${e}")`),(await dm(e,()=>document.querySelectorAll(t))).map(n=>{const o={el:n,should:(i,...a)=>{const s=ji(n,i,...a);return Re(s),o}};return o})},visit:Em,url:Rm,mockRequest:hm,waitForRequest:vd,waitForRequests:bm,initRequestMocking:mm,clearRequestMockRules:ym,getRequestMockRules:vm,should:(e,t,...r)=>{const n=ji(e,t,...r);Re(n)},wait:_o,mockComponent:B.mockComponent,clearComponentMocks:B.clearComponentMocks,notExists:async e=>{const t=`body > div:not(#twd-sidebar-root) ${e}`;if(Re(`Checking notExists("${e}")`),document.querySelector(t))throw new Error(`Element "${e}" exists in the DOM.`);Re(`Assertion passed: Element "${e}" does not exist in the DOM.`)}};var Ca=Object.defineProperty,xm=(e,t,r)=>t in e?Ca(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>Ca(e,"name",{value:t,configurable:!0}),qa=(e,t)=>{for(var r in t)Ca(e,r,{get:t[r],enumerable:!0})},gd=(e,t,r)=>xm(e,typeof t!="symbol"?t+"":t,r),ai={};qa(ai,{addChainableMethod:()=>$a,addLengthGuard:()=>Do,addMethod:()=>ka,addProperty:()=>Na,checkError:()=>fe,compareByInspect:()=>ui,eql:()=>Kd,events:()=>Ci,expectTypes:()=>Td,flag:()=>U,getActual:()=>Ei,getMessage:()=>Ta,getName:()=>qi,getOperator:()=>Ua,getOwnEnumerableProperties:()=>Fa,getOwnEnumerablePropertySymbols:()=>La,getPathInfo:()=>Oa,hasProperty:()=>xi,inspect:()=>H,isNaN:()=>ci,isNumeric:()=>ne,isProxyEnabled:()=>jo,isRegExp:()=>di,objDisplay:()=>st,overwriteChainableMethod:()=>Ba,overwriteMethod:()=>Da,overwriteProperty:()=>ja,proxify:()=>Pt,test:()=>Pa,transferFlags:()=>Ee,type:()=>Q});var fe={};qa(fe,{compatibleConstructor:()=>Ed,compatibleInstance:()=>wd,compatibleMessage:()=>xd,getConstructorName:()=>Cd,getMessage:()=>qd});function wi(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}x(wi,"isErrorInstance");function Rd(e){return Object.prototype.toString.call(e)==="[object RegExp]"}x(Rd,"isRegExp");function wd(e,t){return wi(t)&&e===t}x(wd,"compatibleInstance");function Ed(e,t){return wi(t)?e.constructor===t.constructor||e instanceof t.constructor:(typeof t=="object"||typeof t=="function")&&t.prototype?e.constructor===t||e instanceof t:!1}x(Ed,"compatibleConstructor");function xd(e,t){const r=typeof e=="string"?e:e.message;return Rd(t)?t.test(r):typeof t=="string"?r.indexOf(t)!==-1:!1}x(xd,"compatibleMessage");function Cd(e){let t=e;return wi(e)?t=e.constructor.name:typeof e=="function"&&(t=e.name,t===""&&(t=new e().name||t)),t}x(Cd,"getConstructorName");function qd(e){let t="";return e&&e.message?t=e.message:typeof e=="string"&&(t=e),t}x(qd,"getMessage");function U(e,t,r){let n=e.__flags||(e.__flags=Object.create(null));if(arguments.length===3)n[t]=r;else return n[t]}x(U,"flag");function Pa(e,t){let r=U(e,"negate"),n=t[0];return r?!n:n}x(Pa,"test");function Q(e){if(typeof e>"u")return"undefined";if(e===null)return"null";const t=e[Symbol.toStringTag];return typeof t=="string"?t:Object.prototype.toString.call(e).slice(8,-1)}x(Q,"type");var Cm="captureStackTrace"in Error,Pd=class _d extends Error{constructor(t="Unspecified AssertionError",r,n){super(t),gd(this,"message"),this.message=t,Cm&&Error.captureStackTrace(this,n||_d);for(const o in r)o in this||(this[o]=r[o])}get name(){return"AssertionError"}get ok(){return!1}toJSON(t){return{...this,name:this.name,message:this.message,ok:!1,stack:t!==!1?this.stack:void 0}}};x(Pd,"AssertionError");var G=Pd;function Td(e,t){let r=U(e,"message"),n=U(e,"ssfi");r=r?r+": ":"",e=U(e,"object"),t=t.map(function(a){return a.toLowerCase()}),t.sort();let o=t.map(function(a,s){let l=~["a","e","i","o","u"].indexOf(a.charAt(0))?"an":"a";return(t.length>1&&s===t.length-1?"or ":"")+l+" "+a}).join(", "),i=Q(e).toLowerCase();if(!t.some(function(a){return i===a}))throw new G(r+"object tested must be "+o+", but "+i+" given",void 0,n)}x(Td,"expectTypes");function Ei(e,t){return t.length>4?t[4]:e._obj}x(Ei,"getActual");var qs={bold:["1","22"],dim:["2","22"],italic:["3","23"],underline:["4","24"],inverse:["7","27"],hidden:["8","28"],strike:["9","29"],black:["30","39"],red:["31","39"],green:["32","39"],yellow:["33","39"],blue:["34","39"],magenta:["35","39"],cyan:["36","39"],white:["37","39"],brightblack:["30;1","39"],brightred:["31;1","39"],brightgreen:["32;1","39"],brightyellow:["33;1","39"],brightblue:["34;1","39"],brightmagenta:["35;1","39"],brightcyan:["36;1","39"],brightwhite:["37;1","39"],grey:["90","39"]},qm={special:"cyan",number:"yellow",bigint:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",symbol:"green",date:"magenta",regexp:"red"},yt="…";function Sd(e,t){const r=qs[qm[t]]||qs[t]||"";return r?`\x1B[${r[0]}m${String(e)}\x1B[${r[1]}m`:String(e)}x(Sd,"colorise");function Ad({showHidden:e=!1,depth:t=2,colors:r=!1,customInspect:n=!0,showProxy:o=!1,maxArrayLength:i=1/0,breakLength:a=1/0,seen:s=[],truncate:l=1/0,stylize:u=String}={},f){const c={showHidden:!!e,depth:Number(t),colors:!!r,customInspect:!!n,showProxy:!!o,maxArrayLength:Number(i),breakLength:Number(a),truncate:Number(l),seen:s,inspect:f,stylize:u};return c.colors&&(c.stylize=Sd),c}x(Ad,"normaliseOptions");function Md(e){return e>="\uD800"&&e<="\uDBFF"}x(Md,"isHighSurrogate");function Fe(e,t,r=yt){e=String(e);const n=r.length,o=e.length;if(n>t&&o>n)return r;if(o>t&&o>n){let i=t-n;return i>0&&Md(e[i-1])&&(i=i-1),`${e.slice(0,i)}${r}`}return e}x(Fe,"truncate");function he(e,t,r,n=", "){r=r||t.inspect;const o=e.length;if(o===0)return"";const i=t.truncate;let a="",s="",l="";for(let u=0;u<o;u+=1){const f=u+1===e.length,c=u+2===e.length;l=`${yt}(${e.length-u})`;const d=e[u];t.truncate=i-a.length-(f?0:n.length);const b=s||r(d,t)+(f?"":n),v=a.length+b.length,R=v+l.length;if(f&&v>i&&a.length+l.length<=i||!f&&!c&&R>i||(s=f?"":r(e[u+1],t)+(c?"":n),!f&&c&&R>i&&v+s.length>i))break;if(a+=b,!f&&!c&&v+s.length>=i){l=`${yt}(${e.length-u-1})`;break}l=""}return`${a}${l}`}x(he,"inspectList");function Od(e){return e.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)?e:JSON.stringify(e).replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'")}x(Od,"quoteComplexKey");function gt([e,t],r){return r.truncate-=2,typeof e=="string"?e=Od(e):typeof e!="number"&&(e=`[${r.inspect(e,r)}]`),r.truncate-=e.length,t=r.inspect(t,r),`${e}: ${t}`}x(gt,"inspectProperty");function Id(e,t){const r=Object.keys(e).slice(e.length);if(!e.length&&!r.length)return"[]";t.truncate-=4;const n=he(e,t);t.truncate-=n.length;let o="";return r.length&&(o=he(r.map(i=>[i,e[i]]),t,gt)),`[ ${n}${o?`, ${o}`:""} ]`}x(Id,"inspectArray");var Pm=x(e=>typeof Buffer=="function"&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag]?e[Symbol.toStringTag]:e.constructor.name,"getArrayName");function qe(e,t){const r=Pm(e);t.truncate-=r.length+4;const n=Object.keys(e).slice(e.length);if(!e.length&&!n.length)return`${r}[]`;let o="";for(let a=0;a<e.length;a++){const s=`${t.stylize(Fe(e[a],t.truncate),"number")}${a===e.length-1?"":", "}`;if(t.truncate-=s.length,e[a]!==e.length&&t.truncate<=3){o+=`${yt}(${e.length-e[a]+1})`;break}o+=s}let i="";return n.length&&(i=he(n.map(a=>[a,e[a]]),t,gt)),`${r}[ ${o}${i?`, ${i}`:""} ]`}x(qe,"inspectTypedArray");function Nd(e,t){const r=e.toJSON();if(r===null)return"Invalid Date";const n=r.split("T"),o=n[0];return t.stylize(`${o}T${Fe(n[1],t.truncate-o.length-1)}`,"date")}x(Nd,"inspectDate");function Xi(e,t){const r=e[Symbol.toStringTag]||"Function",n=e.name;return n?t.stylize(`[${r} ${Fe(n,t.truncate-11)}]`,"special"):t.stylize(`[${r}]`,"special")}x(Xi,"inspectFunction");function kd([e,t],r){return r.truncate-=4,e=r.inspect(e,r),r.truncate-=e.length,t=r.inspect(t,r),`${e} => ${t}`}x(kd,"inspectMapEntry");function jd(e){const t=[];return e.forEach((r,n)=>{t.push([n,r])}),t}x(jd,"mapToEntries");function Dd(e,t){return e.size===0?"Map{}":(t.truncate-=7,`Map{ ${he(jd(e),t,kd)} }`)}x(Dd,"inspectMap");var _m=Number.isNaN||(e=>e!==e);function Ji(e,t){return _m(e)?t.stylize("NaN","number"):e===1/0?t.stylize("Infinity","number"):e===-1/0?t.stylize("-Infinity","number"):e===0?t.stylize(1/e===1/0?"+0":"-0","number"):t.stylize(Fe(String(e),t.truncate),"number")}x(Ji,"inspectNumber");function Qi(e,t){let r=Fe(e.toString(),t.truncate-1);return r!==yt&&(r+="n"),t.stylize(r,"bigint")}x(Qi,"inspectBigInt");function $d(e,t){const r=e.toString().split("/")[2],n=t.truncate-(2+r.length),o=e.source;return t.stylize(`/${Fe(o,n)}/${r}`,"regexp")}x($d,"inspectRegExp");function Bd(e){const t=[];return e.forEach(r=>{t.push(r)}),t}x(Bd,"arrayFromSet");function Ld(e,t){return e.size===0?"Set{}":(t.truncate-=7,`Set{ ${he(Bd(e),t)} }`)}x(Ld,"inspectSet");var Ps=new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]","g"),Tm={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","'":"\\'","\\":"\\\\"},Sm=16;function Fd(e){return Tm[e]||`\\u${`0000${e.charCodeAt(0).toString(Sm)}`.slice(-4)}`}x(Fd,"escape");function Zi(e,t){return Ps.test(e)&&(e=e.replace(Ps,Fd)),t.stylize(`'${Fe(e,t.truncate-2)}'`,"string")}x(Zi,"inspectString");function ea(e){return"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString()}x(ea,"inspectSymbol");var Am=x(()=>"Promise{…}","getPromiseValue"),Mm=Am;function Co(e,t){const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[];if(r.length===0&&n.length===0)return"{}";if(t.truncate-=4,t.seen=t.seen||[],t.seen.includes(e))return"[Circular]";t.seen.push(e);const o=he(r.map(s=>[s,e[s]]),t,gt),i=he(n.map(s=>[s,e[s]]),t,gt);t.seen.pop();let a="";return o&&i&&(a=", "),`{ ${o}${a}${i} }`}x(Co,"inspectObject");var Di=typeof Symbol<"u"&&Symbol.toStringTag?Symbol.toStringTag:!1;function Ud(e,t){let r="";return Di&&Di in e&&(r=e[Di]),r=r||e.constructor.name,(!r||r==="_class")&&(r="<Anonymous Class>"),t.truncate-=r.length,`${r}${Co(e,t)}`}x(Ud,"inspectClass");function zd(e,t){return e.length===0?"Arguments[]":(t.truncate-=13,`Arguments[ ${he(e,t)} ]`)}x(zd,"inspectArguments");var Om=["stack","line","column","name","message","fileName","lineNumber","columnNumber","number","description","cause"];function Vd(e,t){const r=Object.getOwnPropertyNames(e).filter(a=>Om.indexOf(a)===-1),n=e.name;t.truncate-=n.length;let o="";if(typeof e.message=="string"?o=Fe(e.message,t.truncate):r.unshift("message"),o=o?`: ${o}`:"",t.truncate-=o.length+5,t.seen=t.seen||[],t.seen.includes(e))return"[Circular]";t.seen.push(e);const i=he(r.map(a=>[a,e[a]]),t,gt);return`${n}${o}${i?` { ${i} }`:""}`}x(Vd,"inspectObject");function Hd([e,t],r){return r.truncate-=3,t?`${r.stylize(String(e),"yellow")}=${r.stylize(`"${t}"`,"string")}`:`${r.stylize(String(e),"yellow")}`}x(Hd,"inspectAttribute");function si(e,t){return he(e,t,Wd,`
|
|
2
2
|
`)}x(si,"inspectNodeCollection");function Wd(e,t){switch(e.nodeType){case 1:return _a(e,t);case 3:return t.inspect(e.data,t);default:return t.inspect(e,t)}}x(Wd,"inspectNode");function _a(e,t){const r=e.getAttributeNames(),n=e.tagName.toLowerCase(),o=t.stylize(`<${n}`,"special"),i=t.stylize(">","special"),a=t.stylize(`</${n}>`,"special");t.truncate-=n.length*2+5;let s="";r.length>0&&(s+=" ",s+=he(r.map(f=>[f,e.getAttribute(f)]),t,Hd," ")),t.truncate-=s.length;const l=t.truncate;let u=si(e.children,t);return u&&u.length>l&&(u=`${yt}(${e.children.length})`),`${o}${s}${i}${u}${a}`}x(_a,"inspectHTML");var Im=typeof Symbol=="function"&&typeof Symbol.for=="function",$i=Im?Symbol.for("chai/inspect"):"@@chai/inspect",Bi=Symbol.for("nodejs.util.inspect.custom"),_s=new WeakMap,Ts={},Ss={undefined:x((e,t)=>t.stylize("undefined","undefined"),"undefined"),null:x((e,t)=>t.stylize("null","null"),"null"),boolean:x((e,t)=>t.stylize(String(e),"boolean"),"boolean"),Boolean:x((e,t)=>t.stylize(String(e),"boolean"),"Boolean"),number:Ji,Number:Ji,bigint:Qi,BigInt:Qi,string:Zi,String:Zi,function:Xi,Function:Xi,symbol:ea,Symbol:ea,Array:Id,Date:Nd,Map:Dd,Set:Ld,RegExp:$d,Promise:Mm,WeakSet:x((e,t)=>t.stylize("WeakSet{…}","special"),"WeakSet"),WeakMap:x((e,t)=>t.stylize("WeakMap{…}","special"),"WeakMap"),Arguments:zd,Int8Array:qe,Uint8Array:qe,Uint8ClampedArray:qe,Int16Array:qe,Uint16Array:qe,Int32Array:qe,Uint32Array:qe,Float32Array:qe,Float64Array:qe,Generator:x(()=>"","Generator"),DataView:x(()=>"","DataView"),ArrayBuffer:x(()=>"","ArrayBuffer"),Error:Vd,HTMLCollection:si,NodeList:si},Nm=x((e,t,r,n)=>$i in e&&typeof e[$i]=="function"?e[$i](t):Bi in e&&typeof e[Bi]=="function"?e[Bi](t.depth,t,n):"inspect"in e&&typeof e.inspect=="function"?e.inspect(t.depth,t):"constructor"in e&&_s.has(e.constructor)?_s.get(e.constructor)(e,t):Ts[r]?Ts[r](e,t):"","inspectCustom"),km=Object.prototype.toString;function qo(e,t={}){const r=Ad(t,qo),{customInspect:n}=r;let o=e===null?"null":typeof e;if(o==="object"&&(o=km.call(e).slice(8,-1)),o in Ss)return Ss[o](e,r);if(n&&e){const a=Nm(e,r,o,qo);if(a)return typeof a=="string"?a:qo(a,r)}const i=e?Object.getPrototypeOf(e):!1;return i===Object.prototype||i===null?Co(e,r):e&&typeof HTMLElement=="function"&&e instanceof HTMLElement?_a(e,r):"constructor"in e?e.constructor!==Object?Ud(e,r):Co(e,r):e===Object(e)?Co(e,r):r.stylize(String(e),o)}x(qo,"inspect");var ie={includeStack:!1,showDiff:!0,truncateThreshold:40,useProxy:!0,proxyExcludedKeys:["then","catch","inspect","toJSON"],deepEqual:null};function H(e,t,r,n){let o={colors:n,depth:typeof r>"u"?2:r,showHidden:t,truncate:ie.truncateThreshold?ie.truncateThreshold:1/0};return qo(e,o)}x(H,"inspect");function st(e){let t=H(e),r=Object.prototype.toString.call(e);if(ie.truncateThreshold&&t.length>=ie.truncateThreshold){if(r==="[object Function]")return!e.name||e.name===""?"[Function]":"[Function: "+e.name+"]";if(r==="[object Array]")return"[ Array("+e.length+") ]";if(r==="[object Object]"){let n=Object.keys(e);return"{ Object ("+(n.length>2?n.splice(0,2).join(", ")+", ...":n.join(", "))+") }"}else return t}else return t}x(st,"objDisplay");function Ta(e,t){let r=U(e,"negate"),n=U(e,"object"),o=t[3],i=Ei(e,t),a=r?t[2]:t[1],s=U(e,"message");return typeof a=="function"&&(a=a()),a=a||"",a=a.replace(/#\{this\}/g,function(){return st(n)}).replace(/#\{act\}/g,function(){return st(i)}).replace(/#\{exp\}/g,function(){return st(o)}),s?s+": "+a:a}x(Ta,"getMessage");function Ee(e,t,r){let n=e.__flags||(e.__flags=Object.create(null));t.__flags||(t.__flags=Object.create(null)),r=arguments.length===3?r:!0;for(let o in n)(r||o!=="object"&&o!=="ssfi"&&o!=="lockSsfi"&&o!="message")&&(t.__flags[o]=n[o])}x(Ee,"transferFlags");function ta(e){if(typeof e>"u")return"undefined";if(e===null)return"null";const t=e[Symbol.toStringTag];return typeof t=="string"?t:Object.prototype.toString.call(e).slice(8,-1)}x(ta,"type");function Sa(){this._key="chai/deep-eql__"+Math.random()+Date.now()}x(Sa,"FakeMap");Sa.prototype={get:x(function(t){return t[this._key]},"get"),set:x(function(t,r){Object.isExtensible(t)&&Object.defineProperty(t,this._key,{value:r,configurable:!0})},"set")};var Gd=typeof WeakMap=="function"?WeakMap:Sa;function ra(e,t,r){if(!r||ut(e)||ut(t))return null;var n=r.get(e);if(n){var o=n.get(t);if(typeof o=="boolean")return o}return null}x(ra,"memoizeCompare");function go(e,t,r,n){if(!(!r||ut(e)||ut(t))){var o=r.get(e);o?o.set(t,n):(o=new Gd,o.set(t,n),r.set(e,o))}}x(go,"memoizeSet");var Kd=ko;function ko(e,t,r){if(r&&r.comparator)return na(e,t,r);var n=Aa(e,t);return n!==null?n:na(e,t,r)}x(ko,"deepEqual");function Aa(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t?!0:ut(e)||ut(t)?!1:null}x(Aa,"simpleEqual");function na(e,t,r){r=r||{},r.memoize=r.memoize===!1?!1:r.memoize||new Gd;var n=r&&r.comparator,o=ra(e,t,r.memoize);if(o!==null)return o;var i=ra(t,e,r.memoize);if(i!==null)return i;if(n){var a=n(e,t);if(a===!1||a===!0)return go(e,t,r.memoize,a),a;var s=Aa(e,t);if(s!==null)return s}var l=ta(e);if(l!==ta(t))return go(e,t,r.memoize,!1),!1;go(e,t,r.memoize,!0);var u=Yd(e,t,l,r);return go(e,t,r.memoize,u),u}x(na,"extensiveDeepEqual");function Yd(e,t,r,n){switch(r){case"String":case"Number":case"Boolean":case"Date":return ko(e.valueOf(),t.valueOf());case"Promise":case"Symbol":case"function":case"WeakMap":case"WeakSet":return e===t;case"Error":return Ma(e,t,["name","message","code"],n);case"Arguments":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"Array":return Xe(e,t,n);case"RegExp":return Xd(e,t);case"Generator":return Jd(e,t,n);case"DataView":return Xe(new Uint8Array(e.buffer),new Uint8Array(t.buffer),n);case"ArrayBuffer":return Xe(new Uint8Array(e),new Uint8Array(t),n);case"Set":return oa(e,t,n);case"Map":return oa(e,t,n);case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.Instant":case"Temporal.ZonedDateTime":case"Temporal.PlainYearMonth":case"Temporal.PlainMonthDay":return e.equals(t);case"Temporal.Duration":return e.total("nanoseconds")===t.total("nanoseconds");case"Temporal.TimeZone":case"Temporal.Calendar":return e.toString()===t.toString();default:return Zd(e,t,n)}}x(Yd,"extensiveDeepEqualByType");function Xd(e,t){return e.toString()===t.toString()}x(Xd,"regexpEqual");function oa(e,t,r){try{if(e.size!==t.size)return!1;if(e.size===0)return!0}catch{return!1}var n=[],o=[];return e.forEach(x(function(a,s){n.push([a,s])},"gatherEntries")),t.forEach(x(function(a,s){o.push([a,s])},"gatherEntries")),Xe(n.sort(),o.sort(),r)}x(oa,"entriesEqual");function Xe(e,t,r){var n=e.length;if(n!==t.length)return!1;if(n===0)return!0;for(var o=-1;++o<n;)if(ko(e[o],t[o],r)===!1)return!1;return!0}x(Xe,"iterableEqual");function Jd(e,t,r){return Xe(li(e),li(t),r)}x(Jd,"generatorEqual");function Qd(e){return typeof Symbol<"u"&&typeof e=="object"&&typeof Symbol.iterator<"u"&&typeof e[Symbol.iterator]=="function"}x(Qd,"hasIteratorFunction");function ia(e){if(Qd(e))try{return li(e[Symbol.iterator]())}catch{return[]}return[]}x(ia,"getIteratorEntries");function li(e){for(var t=e.next(),r=[t.value];t.done===!1;)t=e.next(),r.push(t.value);return r}x(li,"getGeneratorEntries");function aa(e){var t=[];for(var r in e)t.push(r);return t}x(aa,"getEnumerableKeys");function sa(e){for(var t=[],r=Object.getOwnPropertySymbols(e),n=0;n<r.length;n+=1){var o=r[n];Object.getOwnPropertyDescriptor(e,o).enumerable&&t.push(o)}return t}x(sa,"getEnumerableSymbols");function Ma(e,t,r,n){var o=r.length;if(o===0)return!0;for(var i=0;i<o;i+=1)if(ko(e[r[i]],t[r[i]],n)===!1)return!1;return!0}x(Ma,"keysEqual");function Zd(e,t,r){var n=aa(e),o=aa(t),i=sa(e),a=sa(t);if(n=n.concat(i),o=o.concat(a),n.length&&n.length===o.length)return Xe(la(n).sort(),la(o).sort())===!1?!1:Ma(e,t,n,r);var s=ia(e),l=ia(t);return s.length&&s.length===l.length?(s.sort(),l.sort(),Xe(s,l,r)):n.length===0&&s.length===0&&o.length===0&&l.length===0}x(Zd,"objectEqual");function ut(e){return e===null||typeof e!="object"}x(ut,"isPrimitive");function la(e){return e.map(x(function(r){return typeof r=="symbol"?r.toString():r},"mapSymbol"))}x(la,"mapSymbols");function xi(e,t){return typeof e>"u"||e===null?!1:t in Object(e)}x(xi,"hasProperty");function ef(e){return e.replace(/([^\\])\[/g,"$1.[").match(/(\\\.|[^.]+?)+/g).map(n=>{if(n==="constructor"||n==="__proto__"||n==="prototype")return{};const i=/^\[(\d+)\]$/.exec(n);let a=null;return i?a={i:parseFloat(i[1])}:a={p:n.replace(/\\([.[\]])/g,"$1")},a})}x(ef,"parsePath");function ua(e,t,r){let n=e,o=null;r=typeof r>"u"?t.length:r;for(let i=0;i<r;i++){const a=t[i];n&&(typeof a.p>"u"?n=n[a.i]:n=n[a.p],i===r-1&&(o=n))}return o}x(ua,"internalGetPathValue");function Oa(e,t){const r=ef(t),n=r[r.length-1],o={parent:r.length>1?ua(e,r,r.length-1):e,name:n.p||n.i,value:ua(e,r)};return o.exists=xi(o.parent,o.name),o}x(Oa,"getPathInfo");var tf=class rf{constructor(t,r,n,o){return gd(this,"__flags",{}),U(this,"ssfi",n||rf),U(this,"lockSsfi",o),U(this,"object",t),U(this,"message",r),U(this,"eql",ie.deepEqual||Kd),Pt(this)}static get includeStack(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),ie.includeStack}static set includeStack(t){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),ie.includeStack=t}static get showDiff(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),ie.showDiff}static set showDiff(t){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),ie.showDiff=t}static addProperty(t,r){Na(this.prototype,t,r)}static addMethod(t,r){ka(this.prototype,t,r)}static addChainableMethod(t,r,n){$a(this.prototype,t,r,n)}static overwriteProperty(t,r){ja(this.prototype,t,r)}static overwriteMethod(t,r){Da(this.prototype,t,r)}static overwriteChainableMethod(t,r,n){Ba(this.prototype,t,r,n)}assert(t,r,n,o,i,a){const s=Pa(this,arguments);if(a!==!1&&(a=!0),o===void 0&&i===void 0&&(a=!1),ie.showDiff!==!0&&(a=!1),!s){r=Ta(this,arguments);const u={actual:Ei(this,arguments),expected:o,showDiff:a},f=Ua(this,arguments);throw f&&(u.operator=f),new G(r,u,ie.includeStack?this.assert:U(this,"ssfi"))}}get _obj(){return U(this,"object")}set _obj(t){U(this,"object",t)}};x(tf,"Assertion");var h=tf,Ci=new EventTarget,nf=class extends Event{constructor(t,r,n){super(t),this.name=String(r),this.fn=n}};x(nf,"PluginEvent");var Ia=nf;function jo(){return ie.useProxy&&typeof Proxy<"u"&&typeof Reflect<"u"}x(jo,"isProxyEnabled");function Na(e,t,r){r=r===void 0?function(){}:r,Object.defineProperty(e,t,{get:x(function n(){!jo()&&!U(this,"lockSsfi")&&U(this,"ssfi",n);let o=r.call(this);if(o!==void 0)return o;let i=new h;return Ee(this,i),i},"propertyGetter"),configurable:!0}),Ci.dispatchEvent(new Ia("addProperty",t,r))}x(Na,"addProperty");var jm=Object.getOwnPropertyDescriptor(function(){},"length");function Do(e,t,r){return jm.configurable&&Object.defineProperty(e,"length",{get:x(function(){throw Error(r?"Invalid Chai property: "+t+'.length. Due to a compatibility issue, "length" cannot directly follow "'+t+'". Use "'+t+'.lengthOf" instead.':"Invalid Chai property: "+t+'.length. See docs for proper usage of "'+t+'".')},"get")}),e}x(Do,"addLengthGuard");function of(e){let t=Object.getOwnPropertyNames(e);function r(o){t.indexOf(o)===-1&&t.push(o)}x(r,"addProperty");let n=Object.getPrototypeOf(e);for(;n!==null;)Object.getOwnPropertyNames(n).forEach(r),n=Object.getPrototypeOf(n);return t}x(of,"getProperties");var As=["__flags","__methods","_obj","assert"];function Pt(e,t){return jo()?new Proxy(e,{get:x(function r(n,o){if(typeof o=="string"&&ie.proxyExcludedKeys.indexOf(o)===-1&&!Reflect.has(n,o)){if(t)throw Error("Invalid Chai property: "+t+"."+o+'. See docs for proper usage of "'+t+'".');let i=null,a=4;throw of(n).forEach(function(s){if(!Object.prototype.hasOwnProperty(s)&&As.indexOf(s)===-1){let l=af(o,s,a);l<a&&(i=s,a=l)}}),Error(i!==null?"Invalid Chai property: "+o+'. Did you mean "'+i+'"?':"Invalid Chai property: "+o)}return As.indexOf(o)===-1&&!U(n,"lockSsfi")&&U(n,"ssfi",r),Reflect.get(n,o)},"proxyGetter")}):e}x(Pt,"proxify");function af(e,t,r){if(Math.abs(e.length-t.length)>=r)return r;let n=[];for(let o=0;o<=e.length;o++)n[o]=Array(t.length+1).fill(0),n[o][0]=o;for(let o=0;o<t.length;o++)n[0][o]=o;for(let o=1;o<=e.length;o++){let i=e.charCodeAt(o-1);for(let a=1;a<=t.length;a++){if(Math.abs(o-a)>=r){n[o][a]=r;continue}n[o][a]=Math.min(n[o-1][a]+1,n[o][a-1]+1,n[o-1][a-1]+(i===t.charCodeAt(a-1)?0:1))}}return n[e.length][t.length]}x(af,"stringDistanceCapped");function ka(e,t,r){let n=x(function(){U(this,"lockSsfi")||U(this,"ssfi",n);let o=r.apply(this,arguments);if(o!==void 0)return o;let i=new h;return Ee(this,i),i},"methodWrapper");Do(n,t,!1),e[t]=Pt(n,t),Ci.dispatchEvent(new Ia("addMethod",t,r))}x(ka,"addMethod");function ja(e,t,r){let n=Object.getOwnPropertyDescriptor(e,t),o=x(function(){},"_super");n&&typeof n.get=="function"&&(o=n.get),Object.defineProperty(e,t,{get:x(function i(){!jo()&&!U(this,"lockSsfi")&&U(this,"ssfi",i);let a=U(this,"lockSsfi");U(this,"lockSsfi",!0);let s=r(o).call(this);if(U(this,"lockSsfi",a),s!==void 0)return s;let l=new h;return Ee(this,l),l},"overwritingPropertyGetter"),configurable:!0})}x(ja,"overwriteProperty");function Da(e,t,r){let n=e[t],o=x(function(){throw new Error(t+" is not a function")},"_super");n&&typeof n=="function"&&(o=n);let i=x(function(){U(this,"lockSsfi")||U(this,"ssfi",i);let a=U(this,"lockSsfi");U(this,"lockSsfi",!0);let s=r(o).apply(this,arguments);if(U(this,"lockSsfi",a),s!==void 0)return s;let l=new h;return Ee(this,l),l},"overwritingMethodWrapper");Do(i,t,!1),e[t]=Pt(i,t)}x(Da,"overwriteMethod");var Dm=typeof Object.setPrototypeOf=="function",Ms=x(function(){},"testFn"),$m=Object.getOwnPropertyNames(Ms).filter(function(e){let t=Object.getOwnPropertyDescriptor(Ms,e);return typeof t!="object"?!0:!t.configurable}),Bm=Function.prototype.call,Lm=Function.prototype.apply,sf=class extends Ia{constructor(t,r,n,o){super(t,r,n),this.chainingBehavior=o}};x(sf,"PluginAddChainableMethodEvent");var Fm=sf;function $a(e,t,r,n){typeof n!="function"&&(n=x(function(){},"chainingBehavior"));let o={method:r,chainingBehavior:n};e.__methods||(e.__methods={}),e.__methods[t]=o,Object.defineProperty(e,t,{get:x(function(){o.chainingBehavior.call(this);let a=x(function(){U(this,"lockSsfi")||U(this,"ssfi",a);let s=o.method.apply(this,arguments);if(s!==void 0)return s;let l=new h;return Ee(this,l),l},"chainableMethodWrapper");if(Do(a,t,!0),Dm){let s=Object.create(this);s.call=Bm,s.apply=Lm,Object.setPrototypeOf(a,s)}else Object.getOwnPropertyNames(e).forEach(function(l){if($m.indexOf(l)!==-1)return;let u=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(a,l,u)});return Ee(this,a),Pt(a)},"chainableMethodGetter"),configurable:!0}),Ci.dispatchEvent(new Fm("addChainableMethod",t,r,n))}x($a,"addChainableMethod");function Ba(e,t,r,n){let o=e.__methods[t],i=o.chainingBehavior;o.chainingBehavior=x(function(){let l=n(i).call(this);if(l!==void 0)return l;let u=new h;return Ee(this,u),u},"overwritingChainableMethodGetter");let a=o.method;o.method=x(function(){let l=r(a).apply(this,arguments);if(l!==void 0)return l;let u=new h;return Ee(this,u),u},"overwritingChainableMethodWrapper")}x(Ba,"overwriteChainableMethod");function ui(e,t){return H(e)<H(t)?-1:1}x(ui,"compareByInspect");function La(e){return typeof Object.getOwnPropertySymbols!="function"?[]:Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}x(La,"getOwnEnumerablePropertySymbols");function Fa(e){return Object.keys(e).concat(La(e))}x(Fa,"getOwnEnumerableProperties");var ci=Number.isNaN;function lf(e){let t=Q(e);return["Array","Object","Function"].indexOf(t)!==-1}x(lf,"isObjectType");function Ua(e,t){let r=U(e,"operator"),n=U(e,"negate"),o=t[3],i=n?t[2]:t[1];if(r)return r;if(typeof i=="function"&&(i=i()),i=i||"",!i||/\shave\s/.test(i))return;let a=lf(o);return/\snot\s/.test(i)?a?"notDeepStrictEqual":"notStrictEqual":a?"deepStrictEqual":"strictEqual"}x(Ua,"getOperator");function qi(e){return e.name}x(qi,"getName");function di(e){return Object.prototype.toString.call(e)==="[object RegExp]"}x(di,"isRegExp");function ne(e){return["Number","BigInt"].includes(Q(e))}x(ne,"isNumeric");var{flag:w}=ai;["to","be","been","is","and","has","have","with","that","which","at","of","same","but","does","still","also"].forEach(function(e){h.addProperty(e)});h.addProperty("not",function(){w(this,"negate",!0)});h.addProperty("deep",function(){w(this,"deep",!0)});h.addProperty("nested",function(){w(this,"nested",!0)});h.addProperty("own",function(){w(this,"own",!0)});h.addProperty("ordered",function(){w(this,"ordered",!0)});h.addProperty("any",function(){w(this,"any",!0),w(this,"all",!1)});h.addProperty("all",function(){w(this,"all",!0),w(this,"any",!1)});var Os={function:["function","asyncfunction","generatorfunction","asyncgeneratorfunction"],asyncfunction:["asyncfunction","asyncgeneratorfunction"],generatorfunction:["generatorfunction","asyncgeneratorfunction"],asyncgeneratorfunction:["asyncgeneratorfunction"]};function za(e,t){t&&w(this,"message",t),e=e.toLowerCase();let r=w(this,"object"),n=~["a","e","i","o","u"].indexOf(e.charAt(0))?"an ":"a ";const o=Q(r).toLowerCase();Os.function.includes(e)?this.assert(Os[e].includes(o),"expected #{this} to be "+n+e,"expected #{this} not to be "+n+e):this.assert(e===o,"expected #{this} to be "+n+e,"expected #{this} not to be "+n+e)}x(za,"an");h.addChainableMethod("an",za);h.addChainableMethod("a",za);function uf(e,t){return ci(e)&&ci(t)||e===t}x(uf,"SameValueZero");function $o(){w(this,"contains",!0)}x($o,"includeChainingBehavior");function Bo(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=Q(r).toLowerCase(),o=w(this,"message"),i=w(this,"negate"),a=w(this,"ssfi"),s=w(this,"deep"),l=s?"deep ":"",u=s?w(this,"eql"):uf;o=o?o+": ":"";let f=!1;switch(n){case"string":f=r.indexOf(e)!==-1;break;case"weakset":if(s)throw new G(o+"unable to use .deep.include with WeakSet",void 0,a);f=r.has(e);break;case"map":r.forEach(function(c){f=f||u(c,e)});break;case"set":s?r.forEach(function(c){f=f||u(c,e)}):f=r.has(e);break;case"array":s?f=r.some(function(c){return u(c,e)}):f=r.indexOf(e)!==-1;break;default:{if(e!==Object(e))throw new G(o+"the given combination of arguments ("+n+" and "+Q(e).toLowerCase()+") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a "+Q(e).toLowerCase(),void 0,a);let c=Object.keys(e),d=null,b=0;if(c.forEach(function(v){let R=new h(r);if(Ee(this,R,!0),w(R,"lockSsfi",!0),!i||c.length===1){R.property(v,e[v]);return}try{R.property(v,e[v])}catch(S){if(!fe.compatibleConstructor(S,G))throw S;d===null&&(d=S),b++}},this),i&&c.length>1&&b===c.length)throw d;return}}this.assert(f,"expected #{this} to "+l+"include "+H(e),"expected #{this} to not "+l+"include "+H(e))}x(Bo,"include");h.addChainableMethod("include",Bo,$o);h.addChainableMethod("contain",Bo,$o);h.addChainableMethod("contains",Bo,$o);h.addChainableMethod("includes",Bo,$o);h.addProperty("ok",function(){this.assert(w(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")});h.addProperty("true",function(){this.assert(w(this,"object")===!0,"expected #{this} to be true","expected #{this} to be false",!w(this,"negate"))});h.addProperty("numeric",function(){const e=w(this,"object");this.assert(["Number","BigInt"].includes(Q(e)),"expected #{this} to be numeric","expected #{this} to not be numeric",!w(this,"negate"))});h.addProperty("callable",function(){const e=w(this,"object"),t=w(this,"ssfi"),r=w(this,"message"),n=r?`${r}: `:"",o=w(this,"negate"),i=o?`${n}expected ${H(e)} not to be a callable function`:`${n}expected ${H(e)} to be a callable function`,a=["Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"].includes(Q(e));if(a&&o||!a&&!o)throw new G(i,void 0,t)});h.addProperty("false",function(){this.assert(w(this,"object")===!1,"expected #{this} to be false","expected #{this} to be true",!!w(this,"negate"))});h.addProperty("null",function(){this.assert(w(this,"object")===null,"expected #{this} to be null","expected #{this} not to be null")});h.addProperty("undefined",function(){this.assert(w(this,"object")===void 0,"expected #{this} to be undefined","expected #{this} not to be undefined")});h.addProperty("NaN",function(){this.assert(ci(w(this,"object")),"expected #{this} to be NaN","expected #{this} not to be NaN")});function Va(){let e=w(this,"object");this.assert(e!=null,"expected #{this} to exist","expected #{this} to not exist")}x(Va,"assertExist");h.addProperty("exist",Va);h.addProperty("exists",Va);h.addProperty("empty",function(){let e=w(this,"object"),t=w(this,"ssfi"),r=w(this,"message"),n;switch(r=r?r+": ":"",Q(e).toLowerCase()){case"array":case"string":n=e.length;break;case"map":case"set":n=e.size;break;case"weakmap":case"weakset":throw new G(r+".empty was passed a weak collection",void 0,t);case"function":{const o=r+".empty was passed a function "+qi(e);throw new G(o.trim(),void 0,t)}default:if(e!==Object(e))throw new G(r+".empty was passed non-string primitive "+H(e),void 0,t);n=Object.keys(e).length}this.assert(n===0,"expected #{this} to be empty","expected #{this} not to be empty")});function Ha(){let e=w(this,"object"),t=Q(e);this.assert(t==="Arguments","expected #{this} to be arguments but got "+t,"expected #{this} to not be arguments")}x(Ha,"checkArguments");h.addProperty("arguments",Ha);h.addProperty("Arguments",Ha);function Pi(e,t){t&&w(this,"message",t);let r=w(this,"object");if(w(this,"deep")){let n=w(this,"lockSsfi");w(this,"lockSsfi",!0),this.eql(e),w(this,"lockSsfi",n)}else this.assert(e===r,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",e,this._obj,!0)}x(Pi,"assertEqual");h.addMethod("equal",Pi);h.addMethod("equals",Pi);h.addMethod("eq",Pi);function Wa(e,t){t&&w(this,"message",t);let r=w(this,"eql");this.assert(r(e,w(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",e,this._obj,!0)}x(Wa,"assertEql");h.addMethod("eql",Wa);h.addMethod("eqls",Wa);function _i(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"doLength"),o=w(this,"message"),i=o?o+": ":"",a=w(this,"ssfi"),s=Q(r).toLowerCase(),l=Q(e).toLowerCase();if(n&&s!=="map"&&s!=="set"&&new h(r,o,a,!0).to.have.property("length"),!n&&s==="date"&&l!=="date")throw new G(i+"the argument to above must be a date",void 0,a);if(!ne(e)&&(n||ne(r)))throw new G(i+"the argument to above must be a number",void 0,a);if(!n&&s!=="date"&&!ne(r)){let u=s==="string"?"'"+r+"'":r;throw new G(i+"expected "+u+" to be a number or a date",void 0,a)}if(n){let u="length",f;s==="map"||s==="set"?(u="size",f=r.size):f=r.length,this.assert(f>e,"expected #{this} to have a "+u+" above #{exp} but got #{act}","expected #{this} to not have a "+u+" above #{exp}",e,f)}else this.assert(r>e,"expected #{this} to be above #{exp}","expected #{this} to be at most #{exp}",e)}x(_i,"assertAbove");h.addMethod("above",_i);h.addMethod("gt",_i);h.addMethod("greaterThan",_i);function Ti(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"doLength"),o=w(this,"message"),i=o?o+": ":"",a=w(this,"ssfi"),s=Q(r).toLowerCase(),l=Q(e).toLowerCase(),u,f=!0;if(n&&s!=="map"&&s!=="set"&&new h(r,o,a,!0).to.have.property("length"),!n&&s==="date"&&l!=="date")u=i+"the argument to least must be a date";else if(!ne(e)&&(n||ne(r)))u=i+"the argument to least must be a number";else if(!n&&s!=="date"&&!ne(r)){let c=s==="string"?"'"+r+"'":r;u=i+"expected "+c+" to be a number or a date"}else f=!1;if(f)throw new G(u,void 0,a);if(n){let c="length",d;s==="map"||s==="set"?(c="size",d=r.size):d=r.length,this.assert(d>=e,"expected #{this} to have a "+c+" at least #{exp} but got #{act}","expected #{this} to have a "+c+" below #{exp}",e,d)}else this.assert(r>=e,"expected #{this} to be at least #{exp}","expected #{this} to be below #{exp}",e)}x(Ti,"assertLeast");h.addMethod("least",Ti);h.addMethod("gte",Ti);h.addMethod("greaterThanOrEqual",Ti);function Si(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"doLength"),o=w(this,"message"),i=o?o+": ":"",a=w(this,"ssfi"),s=Q(r).toLowerCase(),l=Q(e).toLowerCase(),u,f=!0;if(n&&s!=="map"&&s!=="set"&&new h(r,o,a,!0).to.have.property("length"),!n&&s==="date"&&l!=="date")u=i+"the argument to below must be a date";else if(!ne(e)&&(n||ne(r)))u=i+"the argument to below must be a number";else if(!n&&s!=="date"&&!ne(r)){let c=s==="string"?"'"+r+"'":r;u=i+"expected "+c+" to be a number or a date"}else f=!1;if(f)throw new G(u,void 0,a);if(n){let c="length",d;s==="map"||s==="set"?(c="size",d=r.size):d=r.length,this.assert(d<e,"expected #{this} to have a "+c+" below #{exp} but got #{act}","expected #{this} to not have a "+c+" below #{exp}",e,d)}else this.assert(r<e,"expected #{this} to be below #{exp}","expected #{this} to be at least #{exp}",e)}x(Si,"assertBelow");h.addMethod("below",Si);h.addMethod("lt",Si);h.addMethod("lessThan",Si);function Ai(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"doLength"),o=w(this,"message"),i=o?o+": ":"",a=w(this,"ssfi"),s=Q(r).toLowerCase(),l=Q(e).toLowerCase(),u,f=!0;if(n&&s!=="map"&&s!=="set"&&new h(r,o,a,!0).to.have.property("length"),!n&&s==="date"&&l!=="date")u=i+"the argument to most must be a date";else if(!ne(e)&&(n||ne(r)))u=i+"the argument to most must be a number";else if(!n&&s!=="date"&&!ne(r)){let c=s==="string"?"'"+r+"'":r;u=i+"expected "+c+" to be a number or a date"}else f=!1;if(f)throw new G(u,void 0,a);if(n){let c="length",d;s==="map"||s==="set"?(c="size",d=r.size):d=r.length,this.assert(d<=e,"expected #{this} to have a "+c+" at most #{exp} but got #{act}","expected #{this} to have a "+c+" above #{exp}",e,d)}else this.assert(r<=e,"expected #{this} to be at most #{exp}","expected #{this} to be above #{exp}",e)}x(Ai,"assertMost");h.addMethod("most",Ai);h.addMethod("lte",Ai);h.addMethod("lessThanOrEqual",Ai);h.addMethod("within",function(e,t,r){r&&w(this,"message",r);let n=w(this,"object"),o=w(this,"doLength"),i=w(this,"message"),a=i?i+": ":"",s=w(this,"ssfi"),l=Q(n).toLowerCase(),u=Q(e).toLowerCase(),f=Q(t).toLowerCase(),c,d=!0,b=u==="date"&&f==="date"?e.toISOString()+".."+t.toISOString():e+".."+t;if(o&&l!=="map"&&l!=="set"&&new h(n,i,s,!0).to.have.property("length"),!o&&l==="date"&&(u!=="date"||f!=="date"))c=a+"the arguments to within must be dates";else if((!ne(e)||!ne(t))&&(o||ne(n)))c=a+"the arguments to within must be numbers";else if(!o&&l!=="date"&&!ne(n)){let v=l==="string"?"'"+n+"'":n;c=a+"expected "+v+" to be a number or a date"}else d=!1;if(d)throw new G(c,void 0,s);if(o){let v="length",R;l==="map"||l==="set"?(v="size",R=n.size):R=n.length,this.assert(R>=e&&R<=t,"expected #{this} to have a "+v+" within "+b,"expected #{this} to not have a "+v+" within "+b)}else this.assert(n>=e&&n<=t,"expected #{this} to be within "+b,"expected #{this} to not be within "+b)});function Ga(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"ssfi"),o=w(this,"message"),i;try{i=r instanceof e}catch(s){throw s instanceof TypeError?(o=o?o+": ":"",new G(o+"The instanceof assertion needs a constructor but "+Q(e)+" was given.",void 0,n)):s}let a=qi(e);a==null&&(a="an unnamed constructor"),this.assert(i,"expected #{this} to be an instance of "+a,"expected #{this} to not be an instance of "+a)}x(Ga,"assertInstanceOf");h.addMethod("instanceof",Ga);h.addMethod("instanceOf",Ga);function Ka(e,t,r){r&&w(this,"message",r);let n=w(this,"nested"),o=w(this,"own"),i=w(this,"message"),a=w(this,"object"),s=w(this,"ssfi"),l=typeof e;if(i=i?i+": ":"",n){if(l!=="string")throw new G(i+"the argument to property must be a string when using nested syntax",void 0,s)}else if(l!=="string"&&l!=="number"&&l!=="symbol")throw new G(i+"the argument to property must be a string, number, or symbol",void 0,s);if(n&&o)throw new G(i+'The "nested" and "own" flags cannot be combined.',void 0,s);if(a==null)throw new G(i+"Target cannot be null or undefined.",void 0,s);let u=w(this,"deep"),f=w(this,"negate"),c=n?Oa(a,e):null,d=n?c.value:a[e],b=u?w(this,"eql"):(S,p)=>S===p,v="";u&&(v+="deep "),o&&(v+="own "),n&&(v+="nested "),v+="property ";let R;o?R=Object.prototype.hasOwnProperty.call(a,e):n?R=c.exists:R=xi(a,e),(!f||arguments.length===1)&&this.assert(R,"expected #{this} to have "+v+H(e),"expected #{this} to not have "+v+H(e)),arguments.length>1&&this.assert(R&&b(t,d),"expected #{this} to have "+v+H(e)+" of #{exp}, but got #{act}","expected #{this} to not have "+v+H(e)+" of #{act}",t,d),w(this,"object",d)}x(Ka,"assertProperty");h.addMethod("property",Ka);function Ya(e,t,r){w(this,"own",!0),Ka.apply(this,arguments)}x(Ya,"assertOwnProperty");h.addMethod("ownProperty",Ya);h.addMethod("haveOwnProperty",Ya);function Xa(e,t,r){typeof t=="string"&&(r=t,t=null),r&&w(this,"message",r);let n=w(this,"object"),o=Object.getOwnPropertyDescriptor(Object(n),e),i=w(this,"eql");o&&t?this.assert(i(t,o),"expected the own property descriptor for "+H(e)+" on #{this} to match "+H(t)+", got "+H(o),"expected the own property descriptor for "+H(e)+" on #{this} to not match "+H(t),t,o,!0):this.assert(o,"expected #{this} to have an own property descriptor for "+H(e),"expected #{this} to not have an own property descriptor for "+H(e)),w(this,"object",o)}x(Xa,"assertOwnPropertyDescriptor");h.addMethod("ownPropertyDescriptor",Xa);h.addMethod("haveOwnPropertyDescriptor",Xa);function Ja(){w(this,"doLength",!0)}x(Ja,"assertLengthChain");function Qa(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=Q(r).toLowerCase(),o=w(this,"message"),i=w(this,"ssfi"),a="length",s;switch(n){case"map":case"set":a="size",s=r.size;break;default:new h(r,o,i,!0).to.have.property("length"),s=r.length}this.assert(s==e,"expected #{this} to have a "+a+" of #{exp} but got #{act}","expected #{this} to not have a "+a+" of #{act}",e,s)}x(Qa,"assertLength");h.addChainableMethod("length",Qa,Ja);h.addChainableMethod("lengthOf",Qa,Ja);function Za(e,t){t&&w(this,"message",t);let r=w(this,"object");this.assert(e.exec(r),"expected #{this} to match "+e,"expected #{this} not to match "+e)}x(Za,"assertMatch");h.addMethod("match",Za);h.addMethod("matches",Za);h.addMethod("string",function(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"message"),o=w(this,"ssfi");new h(r,n,o,!0).is.a("string"),this.assert(~r.indexOf(e),"expected #{this} to contain "+H(e),"expected #{this} to not contain "+H(e))});function es(e){let t=w(this,"object"),r=Q(t),n=Q(e),o=w(this,"ssfi"),i=w(this,"deep"),a,s="",l,u=!0,f=w(this,"message");f=f?f+": ":"";let c=f+"when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";if(r==="Map"||r==="Set")s=i?"deeply ":"",l=[],t.forEach(function(p,q){l.push(q)}),n!=="Array"&&(e=Array.prototype.slice.call(arguments));else{switch(l=Fa(t),n){case"Array":if(arguments.length>1)throw new G(c,void 0,o);break;case"Object":if(arguments.length>1)throw new G(c,void 0,o);e=Object.keys(e);break;default:e=Array.prototype.slice.call(arguments)}e=e.map(function(p){return typeof p=="symbol"?p:String(p)})}if(!e.length)throw new G(f+"keys required",void 0,o);let d=e.length,b=w(this,"any"),v=w(this,"all"),R=e,S=i?w(this,"eql"):(p,q)=>p===q;if(!b&&!v&&(v=!0),b&&(u=R.some(function(p){return l.some(function(q){return S(p,q)})})),v&&(u=R.every(function(p){return l.some(function(q){return S(p,q)})}),w(this,"contains")||(u=u&&e.length==l.length)),d>1){e=e.map(function(q){return H(q)});let p=e.pop();v&&(a=e.join(", ")+", and "+p),b&&(a=e.join(", ")+", or "+p)}else a=H(e[0]);a=(d>1?"keys ":"key ")+a,a=(w(this,"contains")?"contain ":"have ")+a,this.assert(u,"expected #{this} to "+s+a,"expected #{this} to not "+s+a,R.slice(0).sort(ui),l.sort(ui),!0)}x(es,"assertKeys");h.addMethod("keys",es);h.addMethod("key",es);function Mi(e,t,r){r&&w(this,"message",r);let n=w(this,"object"),o=w(this,"ssfi"),i=w(this,"message"),a=w(this,"negate")||!1;new h(n,i,o,!0).is.a("function"),(di(e)||typeof e=="string")&&(t=e,e=null);let s,l=!1;try{n()}catch(b){l=!0,s=b}let u=e===void 0&&t===void 0,f=!!(e&&t),c=!1,d=!1;if(u||!u&&!a){let b="an error";e instanceof Error?b="#{exp}":e&&(b=fe.getConstructorName(e));let v=s;if(s instanceof Error)v=s.toString();else if(typeof s=="string")v=s;else if(s&&(typeof s=="object"||typeof s=="function"))try{v=fe.getConstructorName(s)}catch{}this.assert(l,"expected #{this} to throw "+b,"expected #{this} to not throw an error but #{act} was thrown",e&&e.toString(),v)}if(e&&s&&(e instanceof Error&&fe.compatibleInstance(s,e)===a&&(f&&a?c=!0:this.assert(a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(s&&!a?" but #{act} was thrown":""),e.toString(),s.toString())),fe.compatibleConstructor(s,e)===a&&(f&&a?c=!0:this.assert(a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(s?" but #{act} was thrown":""),e instanceof Error?e.toString():e&&fe.getConstructorName(e),s instanceof Error?s.toString():s&&fe.getConstructorName(s)))),s&&t!==void 0&&t!==null){let b="including";di(t)&&(b="matching"),fe.compatibleMessage(s,t)===a&&(f&&a?d=!0:this.assert(a,"expected #{this} to throw error "+b+" #{exp} but got #{act}","expected #{this} to throw error not "+b+" #{exp}",t,fe.getMessage(s)))}c&&d&&this.assert(a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}"+(s?" but #{act} was thrown":""),e instanceof Error?e.toString():e&&fe.getConstructorName(e),s instanceof Error?s.toString():s&&fe.getConstructorName(s)),w(this,"object",s)}x(Mi,"assertThrows");h.addMethod("throw",Mi);h.addMethod("throws",Mi);h.addMethod("Throw",Mi);function ts(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"itself"),o=typeof r=="function"&&!n?r.prototype[e]:r[e];this.assert(typeof o=="function","expected #{this} to respond to "+H(e),"expected #{this} to not respond to "+H(e))}x(ts,"respondTo");h.addMethod("respondTo",ts);h.addMethod("respondsTo",ts);h.addProperty("itself",function(){w(this,"itself",!0)});function rs(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=e(r);this.assert(n,"expected #{this} to satisfy "+st(e),"expected #{this} to not satisfy"+st(e),!w(this,"negate"),n)}x(rs,"satisfy");h.addMethod("satisfy",rs);h.addMethod("satisfies",rs);function ns(e,t,r){r&&w(this,"message",r);let n=w(this,"object"),o=w(this,"message"),i=w(this,"ssfi");new h(n,o,i,!0).is.numeric;let a="A `delta` value is required for `closeTo`";if(t==null)throw new G(o?`${o}: ${a}`:a,void 0,i);if(new h(t,o,i,!0).is.numeric,a="A `expected` value is required for `closeTo`",e==null)throw new G(o?`${o}: ${a}`:a,void 0,i);new h(e,o,i,!0).is.numeric;const s=x(u=>u<0n?-u:u,"abs"),l=x(u=>parseFloat(parseFloat(u).toPrecision(12)),"strip");this.assert(l(s(n-e))<=t,"expected #{this} to be close to "+e+" +/- "+t,"expected #{this} not to be close to "+e+" +/- "+t)}x(ns,"closeTo");h.addMethod("closeTo",ns);h.addMethod("approximately",ns);function cf(e,t,r,n,o){let i=Array.from(t),a=Array.from(e);if(!n){if(a.length!==i.length)return!1;i=i.slice()}return a.every(function(s,l){if(o)return r?r(s,i[l]):s===i[l];if(!r){let u=i.indexOf(s);return u===-1?!1:(n||i.splice(u,1),!0)}return i.some(function(u,f){return r(s,u)?(n||i.splice(f,1),!0):!1})})}x(cf,"isSubsetOf");h.addMethod("members",function(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"message"),o=w(this,"ssfi");new h(r,n,o,!0).to.be.iterable,new h(e,n,o,!0).to.be.iterable;let i=w(this,"contains"),a=w(this,"ordered"),s,l,u;i?(s=a?"an ordered superset":"a superset",l="expected #{this} to be "+s+" of #{exp}",u="expected #{this} to not be "+s+" of #{exp}"):(s=a?"ordered members":"members",l="expected #{this} to have the same "+s+" as #{exp}",u="expected #{this} to not have the same "+s+" as #{exp}");let f=w(this,"deep")?w(this,"eql"):void 0;this.assert(cf(e,r,f,i,a),l,u,e,r,!0)});h.addProperty("iterable",function(e){e&&w(this,"message",e);let t=w(this,"object");this.assert(t!=null&&t[Symbol.iterator],"expected #{this} to be an iterable","expected #{this} to not be an iterable",t)});function df(e,t){t&&w(this,"message",t);let r=w(this,"object"),n=w(this,"message"),o=w(this,"ssfi"),i=w(this,"contains"),a=w(this,"deep"),s=w(this,"eql");new h(e,n,o,!0).to.be.an("array"),i?this.assert(e.some(function(l){return r.indexOf(l)>-1}),"expected #{this} to contain one of #{exp}","expected #{this} to not contain one of #{exp}",e,r):a?this.assert(e.some(function(l){return s(r,l)}),"expected #{this} to deeply equal one of #{exp}","expected #{this} to deeply equal one of #{exp}",e,r):this.assert(e.indexOf(r)>-1,"expected #{this} to be one of #{exp}","expected #{this} to not be one of #{exp}",e,r)}x(df,"oneOf");h.addMethod("oneOf",df);function os(e,t,r){r&&w(this,"message",r);let n=w(this,"object"),o=w(this,"message"),i=w(this,"ssfi");new h(n,o,i,!0).is.a("function");let a;t?(new h(e,o,i,!0).to.have.property(t),a=e[t]):(new h(e,o,i,!0).is.a("function"),a=e()),n();let s=t==null?e():e[t],l=t==null?a:"."+t;w(this,"deltaMsgObj",l),w(this,"initialDeltaValue",a),w(this,"finalDeltaValue",s),w(this,"deltaBehavior","change"),w(this,"realDelta",s!==a),this.assert(a!==s,"expected "+l+" to change","expected "+l+" to not change")}x(os,"assertChanges");h.addMethod("change",os);h.addMethod("changes",os);function is(e,t,r){r&&w(this,"message",r);let n=w(this,"object"),o=w(this,"message"),i=w(this,"ssfi");new h(n,o,i,!0).is.a("function");let a;t?(new h(e,o,i,!0).to.have.property(t),a=e[t]):(new h(e,o,i,!0).is.a("function"),a=e()),new h(a,o,i,!0).is.a("number"),n();let s=t==null?e():e[t],l=t==null?a:"."+t;w(this,"deltaMsgObj",l),w(this,"initialDeltaValue",a),w(this,"finalDeltaValue",s),w(this,"deltaBehavior","increase"),w(this,"realDelta",s-a),this.assert(s-a>0,"expected "+l+" to increase","expected "+l+" to not increase")}x(is,"assertIncreases");h.addMethod("increase",is);h.addMethod("increases",is);function as(e,t,r){r&&w(this,"message",r);let n=w(this,"object"),o=w(this,"message"),i=w(this,"ssfi");new h(n,o,i,!0).is.a("function");let a;t?(new h(e,o,i,!0).to.have.property(t),a=e[t]):(new h(e,o,i,!0).is.a("function"),a=e()),new h(a,o,i,!0).is.a("number"),n();let s=t==null?e():e[t],l=t==null?a:"."+t;w(this,"deltaMsgObj",l),w(this,"initialDeltaValue",a),w(this,"finalDeltaValue",s),w(this,"deltaBehavior","decrease"),w(this,"realDelta",a-s),this.assert(s-a<0,"expected "+l+" to decrease","expected "+l+" to not decrease")}x(as,"assertDecreases");h.addMethod("decrease",as);h.addMethod("decreases",as);function ff(e,t){t&&w(this,"message",t);let r=w(this,"deltaMsgObj"),n=w(this,"initialDeltaValue"),o=w(this,"finalDeltaValue"),i=w(this,"deltaBehavior"),a=w(this,"realDelta"),s;i==="change"?s=Math.abs(o-n)===Math.abs(e):s=a===Math.abs(e),this.assert(s,"expected "+r+" to "+i+" by "+e,"expected "+r+" to not "+i+" by "+e)}x(ff,"assertDelta");h.addMethod("by",ff);h.addProperty("extensible",function(){let e=w(this,"object"),t=e===Object(e)&&Object.isExtensible(e);this.assert(t,"expected #{this} to be extensible","expected #{this} to not be extensible")});h.addProperty("sealed",function(){let e=w(this,"object"),t=e===Object(e)?Object.isSealed(e):!0;this.assert(t,"expected #{this} to be sealed","expected #{this} to not be sealed")});h.addProperty("frozen",function(){let e=w(this,"object"),t=e===Object(e)?Object.isFrozen(e):!0;this.assert(t,"expected #{this} to be frozen","expected #{this} to not be frozen")});h.addProperty("finite",function(e){let t=w(this,"object");this.assert(typeof t=="number"&&isFinite(t),"expected #{this} to be a finite number","expected #{this} to not be a finite number")});function fi(e,t){return e===t?!0:typeof t!=typeof e?!1:typeof e!="object"||e===null?e===t:t?Array.isArray(e)?Array.isArray(t)?e.every(function(r){return t.some(function(n){return fi(r,n)})}):!1:e instanceof Date?t instanceof Date?e.getTime()===t.getTime():!1:Object.keys(e).every(function(r){let n=e[r],o=t[r];return typeof n=="object"&&n!==null&&o!==null?fi(n,o):typeof n=="function"?n(o):o===n}):!1}x(fi,"compareSubset");h.addMethod("containSubset",function(e){const t=U(this,"object"),r=ie.showDiff;this.assert(fi(e,t),"expected #{act} to contain subset #{exp}","expected #{act} to not contain subset #{exp}",e,t,r)});function To(e,t){return new h(e,t)}x(To,"expect");To.fail=function(e,t,r,n){throw arguments.length<2&&(r=e,e=void 0),r=r||"expect.fail()",new G(r,{actual:e,expected:t,operator:n},To.fail)};var pf={};qa(pf,{Should:()=>zm,should:()=>Um});function ss(){function e(){return this instanceof String||this instanceof Number||this instanceof Boolean||typeof Symbol=="function"&&this instanceof Symbol||typeof BigInt=="function"&&this instanceof BigInt?new h(this.valueOf(),null,e):new h(this,null,e)}x(e,"shouldGetter");function t(n){Object.defineProperty(this,"should",{value:n,enumerable:!0,configurable:!0,writable:!0})}x(t,"shouldSetter"),Object.defineProperty(Object.prototype,"should",{set:t,get:e,configurable:!0});let r={};return r.fail=function(n,o,i,a){throw arguments.length<2&&(i=n,n=void 0),i=i||"should.fail()",new G(i,{actual:n,expected:o,operator:a},r.fail)},r.equal=function(n,o,i){new h(n,i).to.equal(o)},r.Throw=function(n,o,i,a){new h(n,a).to.Throw(o,i)},r.exist=function(n,o){new h(n,o).to.exist},r.not={},r.not.equal=function(n,o,i){new h(n,i).to.not.equal(o)},r.not.Throw=function(n,o,i,a){new h(n,a).to.not.Throw(o,i)},r.not.exist=function(n,o){new h(n,o).to.not.exist},r.throw=r.Throw,r.not.throw=r.not.Throw,r}x(ss,"loadShould");var Um=ss,zm=ss;function m(e,t){new h(null,null,m,!0).assert(e,t,"[ negation message unavailable ]")}x(m,"assert");m.fail=function(e,t,r,n){throw arguments.length<2&&(r=e,e=void 0),r=r||"assert.fail()",new G(r,{actual:e,expected:t,operator:n},m.fail)};m.isOk=function(e,t){new h(e,t,m.isOk,!0).is.ok};m.isNotOk=function(e,t){new h(e,t,m.isNotOk,!0).is.not.ok};m.equal=function(e,t,r){let n=new h(e,r,m.equal,!0);n.assert(t==U(n,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",t,e,!0)};m.notEqual=function(e,t,r){let n=new h(e,r,m.notEqual,!0);n.assert(t!=U(n,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",t,e,!0)};m.strictEqual=function(e,t,r){new h(e,r,m.strictEqual,!0).to.equal(t)};m.notStrictEqual=function(e,t,r){new h(e,r,m.notStrictEqual,!0).to.not.equal(t)};m.deepEqual=m.deepStrictEqual=function(e,t,r){new h(e,r,m.deepEqual,!0).to.eql(t)};m.notDeepEqual=function(e,t,r){new h(e,r,m.notDeepEqual,!0).to.not.eql(t)};m.isAbove=function(e,t,r){new h(e,r,m.isAbove,!0).to.be.above(t)};m.isAtLeast=function(e,t,r){new h(e,r,m.isAtLeast,!0).to.be.least(t)};m.isBelow=function(e,t,r){new h(e,r,m.isBelow,!0).to.be.below(t)};m.isAtMost=function(e,t,r){new h(e,r,m.isAtMost,!0).to.be.most(t)};m.isTrue=function(e,t){new h(e,t,m.isTrue,!0).is.true};m.isNotTrue=function(e,t){new h(e,t,m.isNotTrue,!0).to.not.equal(!0)};m.isFalse=function(e,t){new h(e,t,m.isFalse,!0).is.false};m.isNotFalse=function(e,t){new h(e,t,m.isNotFalse,!0).to.not.equal(!1)};m.isNull=function(e,t){new h(e,t,m.isNull,!0).to.equal(null)};m.isNotNull=function(e,t){new h(e,t,m.isNotNull,!0).to.not.equal(null)};m.isNaN=function(e,t){new h(e,t,m.isNaN,!0).to.be.NaN};m.isNotNaN=function(e,t){new h(e,t,m.isNotNaN,!0).not.to.be.NaN};m.exists=function(e,t){new h(e,t,m.exists,!0).to.exist};m.notExists=function(e,t){new h(e,t,m.notExists,!0).to.not.exist};m.isUndefined=function(e,t){new h(e,t,m.isUndefined,!0).to.equal(void 0)};m.isDefined=function(e,t){new h(e,t,m.isDefined,!0).to.not.equal(void 0)};m.isCallable=function(e,t){new h(e,t,m.isCallable,!0).is.callable};m.isNotCallable=function(e,t){new h(e,t,m.isNotCallable,!0).is.not.callable};m.isObject=function(e,t){new h(e,t,m.isObject,!0).to.be.a("object")};m.isNotObject=function(e,t){new h(e,t,m.isNotObject,!0).to.not.be.a("object")};m.isArray=function(e,t){new h(e,t,m.isArray,!0).to.be.an("array")};m.isNotArray=function(e,t){new h(e,t,m.isNotArray,!0).to.not.be.an("array")};m.isString=function(e,t){new h(e,t,m.isString,!0).to.be.a("string")};m.isNotString=function(e,t){new h(e,t,m.isNotString,!0).to.not.be.a("string")};m.isNumber=function(e,t){new h(e,t,m.isNumber,!0).to.be.a("number")};m.isNotNumber=function(e,t){new h(e,t,m.isNotNumber,!0).to.not.be.a("number")};m.isNumeric=function(e,t){new h(e,t,m.isNumeric,!0).is.numeric};m.isNotNumeric=function(e,t){new h(e,t,m.isNotNumeric,!0).is.not.numeric};m.isFinite=function(e,t){new h(e,t,m.isFinite,!0).to.be.finite};m.isBoolean=function(e,t){new h(e,t,m.isBoolean,!0).to.be.a("boolean")};m.isNotBoolean=function(e,t){new h(e,t,m.isNotBoolean,!0).to.not.be.a("boolean")};m.typeOf=function(e,t,r){new h(e,r,m.typeOf,!0).to.be.a(t)};m.notTypeOf=function(e,t,r){new h(e,r,m.notTypeOf,!0).to.not.be.a(t)};m.instanceOf=function(e,t,r){new h(e,r,m.instanceOf,!0).to.be.instanceOf(t)};m.notInstanceOf=function(e,t,r){new h(e,r,m.notInstanceOf,!0).to.not.be.instanceOf(t)};m.include=function(e,t,r){new h(e,r,m.include,!0).include(t)};m.notInclude=function(e,t,r){new h(e,r,m.notInclude,!0).not.include(t)};m.deepInclude=function(e,t,r){new h(e,r,m.deepInclude,!0).deep.include(t)};m.notDeepInclude=function(e,t,r){new h(e,r,m.notDeepInclude,!0).not.deep.include(t)};m.nestedInclude=function(e,t,r){new h(e,r,m.nestedInclude,!0).nested.include(t)};m.notNestedInclude=function(e,t,r){new h(e,r,m.notNestedInclude,!0).not.nested.include(t)};m.deepNestedInclude=function(e,t,r){new h(e,r,m.deepNestedInclude,!0).deep.nested.include(t)};m.notDeepNestedInclude=function(e,t,r){new h(e,r,m.notDeepNestedInclude,!0).not.deep.nested.include(t)};m.ownInclude=function(e,t,r){new h(e,r,m.ownInclude,!0).own.include(t)};m.notOwnInclude=function(e,t,r){new h(e,r,m.notOwnInclude,!0).not.own.include(t)};m.deepOwnInclude=function(e,t,r){new h(e,r,m.deepOwnInclude,!0).deep.own.include(t)};m.notDeepOwnInclude=function(e,t,r){new h(e,r,m.notDeepOwnInclude,!0).not.deep.own.include(t)};m.match=function(e,t,r){new h(e,r,m.match,!0).to.match(t)};m.notMatch=function(e,t,r){new h(e,r,m.notMatch,!0).to.not.match(t)};m.property=function(e,t,r){new h(e,r,m.property,!0).to.have.property(t)};m.notProperty=function(e,t,r){new h(e,r,m.notProperty,!0).to.not.have.property(t)};m.propertyVal=function(e,t,r,n){new h(e,n,m.propertyVal,!0).to.have.property(t,r)};m.notPropertyVal=function(e,t,r,n){new h(e,n,m.notPropertyVal,!0).to.not.have.property(t,r)};m.deepPropertyVal=function(e,t,r,n){new h(e,n,m.deepPropertyVal,!0).to.have.deep.property(t,r)};m.notDeepPropertyVal=function(e,t,r,n){new h(e,n,m.notDeepPropertyVal,!0).to.not.have.deep.property(t,r)};m.ownProperty=function(e,t,r){new h(e,r,m.ownProperty,!0).to.have.own.property(t)};m.notOwnProperty=function(e,t,r){new h(e,r,m.notOwnProperty,!0).to.not.have.own.property(t)};m.ownPropertyVal=function(e,t,r,n){new h(e,n,m.ownPropertyVal,!0).to.have.own.property(t,r)};m.notOwnPropertyVal=function(e,t,r,n){new h(e,n,m.notOwnPropertyVal,!0).to.not.have.own.property(t,r)};m.deepOwnPropertyVal=function(e,t,r,n){new h(e,n,m.deepOwnPropertyVal,!0).to.have.deep.own.property(t,r)};m.notDeepOwnPropertyVal=function(e,t,r,n){new h(e,n,m.notDeepOwnPropertyVal,!0).to.not.have.deep.own.property(t,r)};m.nestedProperty=function(e,t,r){new h(e,r,m.nestedProperty,!0).to.have.nested.property(t)};m.notNestedProperty=function(e,t,r){new h(e,r,m.notNestedProperty,!0).to.not.have.nested.property(t)};m.nestedPropertyVal=function(e,t,r,n){new h(e,n,m.nestedPropertyVal,!0).to.have.nested.property(t,r)};m.notNestedPropertyVal=function(e,t,r,n){new h(e,n,m.notNestedPropertyVal,!0).to.not.have.nested.property(t,r)};m.deepNestedPropertyVal=function(e,t,r,n){new h(e,n,m.deepNestedPropertyVal,!0).to.have.deep.nested.property(t,r)};m.notDeepNestedPropertyVal=function(e,t,r,n){new h(e,n,m.notDeepNestedPropertyVal,!0).to.not.have.deep.nested.property(t,r)};m.lengthOf=function(e,t,r){new h(e,r,m.lengthOf,!0).to.have.lengthOf(t)};m.hasAnyKeys=function(e,t,r){new h(e,r,m.hasAnyKeys,!0).to.have.any.keys(t)};m.hasAllKeys=function(e,t,r){new h(e,r,m.hasAllKeys,!0).to.have.all.keys(t)};m.containsAllKeys=function(e,t,r){new h(e,r,m.containsAllKeys,!0).to.contain.all.keys(t)};m.doesNotHaveAnyKeys=function(e,t,r){new h(e,r,m.doesNotHaveAnyKeys,!0).to.not.have.any.keys(t)};m.doesNotHaveAllKeys=function(e,t,r){new h(e,r,m.doesNotHaveAllKeys,!0).to.not.have.all.keys(t)};m.hasAnyDeepKeys=function(e,t,r){new h(e,r,m.hasAnyDeepKeys,!0).to.have.any.deep.keys(t)};m.hasAllDeepKeys=function(e,t,r){new h(e,r,m.hasAllDeepKeys,!0).to.have.all.deep.keys(t)};m.containsAllDeepKeys=function(e,t,r){new h(e,r,m.containsAllDeepKeys,!0).to.contain.all.deep.keys(t)};m.doesNotHaveAnyDeepKeys=function(e,t,r){new h(e,r,m.doesNotHaveAnyDeepKeys,!0).to.not.have.any.deep.keys(t)};m.doesNotHaveAllDeepKeys=function(e,t,r){new h(e,r,m.doesNotHaveAllDeepKeys,!0).to.not.have.all.deep.keys(t)};m.throws=function(e,t,r,n){(typeof t=="string"||t instanceof RegExp)&&(r=t,t=null);let o=new h(e,n,m.throws,!0).to.throw(t,r);return U(o,"object")};m.doesNotThrow=function(e,t,r,n){(typeof t=="string"||t instanceof RegExp)&&(r=t,t=null),new h(e,n,m.doesNotThrow,!0).to.not.throw(t,r)};m.operator=function(e,t,r,n){let o;switch(t){case"==":o=e==r;break;case"===":o=e===r;break;case">":o=e>r;break;case">=":o=e>=r;break;case"<":o=e<r;break;case"<=":o=e<=r;break;case"!=":o=e!=r;break;case"!==":o=e!==r;break;default:throw n=n&&n+": ",new G(n+'Invalid operator "'+t+'"',void 0,m.operator)}let i=new h(o,n,m.operator,!0);i.assert(U(i,"object")===!0,"expected "+H(e)+" to be "+t+" "+H(r),"expected "+H(e)+" to not be "+t+" "+H(r))};m.closeTo=function(e,t,r,n){new h(e,n,m.closeTo,!0).to.be.closeTo(t,r)};m.approximately=function(e,t,r,n){new h(e,n,m.approximately,!0).to.be.approximately(t,r)};m.sameMembers=function(e,t,r){new h(e,r,m.sameMembers,!0).to.have.same.members(t)};m.notSameMembers=function(e,t,r){new h(e,r,m.notSameMembers,!0).to.not.have.same.members(t)};m.sameDeepMembers=function(e,t,r){new h(e,r,m.sameDeepMembers,!0).to.have.same.deep.members(t)};m.notSameDeepMembers=function(e,t,r){new h(e,r,m.notSameDeepMembers,!0).to.not.have.same.deep.members(t)};m.sameOrderedMembers=function(e,t,r){new h(e,r,m.sameOrderedMembers,!0).to.have.same.ordered.members(t)};m.notSameOrderedMembers=function(e,t,r){new h(e,r,m.notSameOrderedMembers,!0).to.not.have.same.ordered.members(t)};m.sameDeepOrderedMembers=function(e,t,r){new h(e,r,m.sameDeepOrderedMembers,!0).to.have.same.deep.ordered.members(t)};m.notSameDeepOrderedMembers=function(e,t,r){new h(e,r,m.notSameDeepOrderedMembers,!0).to.not.have.same.deep.ordered.members(t)};m.includeMembers=function(e,t,r){new h(e,r,m.includeMembers,!0).to.include.members(t)};m.notIncludeMembers=function(e,t,r){new h(e,r,m.notIncludeMembers,!0).to.not.include.members(t)};m.includeDeepMembers=function(e,t,r){new h(e,r,m.includeDeepMembers,!0).to.include.deep.members(t)};m.notIncludeDeepMembers=function(e,t,r){new h(e,r,m.notIncludeDeepMembers,!0).to.not.include.deep.members(t)};m.includeOrderedMembers=function(e,t,r){new h(e,r,m.includeOrderedMembers,!0).to.include.ordered.members(t)};m.notIncludeOrderedMembers=function(e,t,r){new h(e,r,m.notIncludeOrderedMembers,!0).to.not.include.ordered.members(t)};m.includeDeepOrderedMembers=function(e,t,r){new h(e,r,m.includeDeepOrderedMembers,!0).to.include.deep.ordered.members(t)};m.notIncludeDeepOrderedMembers=function(e,t,r){new h(e,r,m.notIncludeDeepOrderedMembers,!0).to.not.include.deep.ordered.members(t)};m.oneOf=function(e,t,r){new h(e,r,m.oneOf,!0).to.be.oneOf(t)};m.isIterable=function(e,t){if(e==null||!e[Symbol.iterator])throw t=t?`${t} expected ${H(e)} to be an iterable`:`expected ${H(e)} to be an iterable`,new G(t,void 0,m.isIterable)};m.changes=function(e,t,r,n){arguments.length===3&&typeof t=="function"&&(n=r,r=null),new h(e,n,m.changes,!0).to.change(t,r)};m.changesBy=function(e,t,r,n,o){if(arguments.length===4&&typeof t=="function"){let i=n;n=r,o=i}else arguments.length===3&&(n=r,r=null);new h(e,o,m.changesBy,!0).to.change(t,r).by(n)};m.doesNotChange=function(e,t,r,n){return arguments.length===3&&typeof t=="function"&&(n=r,r=null),new h(e,n,m.doesNotChange,!0).to.not.change(t,r)};m.changesButNotBy=function(e,t,r,n,o){if(arguments.length===4&&typeof t=="function"){let i=n;n=r,o=i}else arguments.length===3&&(n=r,r=null);new h(e,o,m.changesButNotBy,!0).to.change(t,r).but.not.by(n)};m.increases=function(e,t,r,n){return arguments.length===3&&typeof t=="function"&&(n=r,r=null),new h(e,n,m.increases,!0).to.increase(t,r)};m.increasesBy=function(e,t,r,n,o){if(arguments.length===4&&typeof t=="function"){let i=n;n=r,o=i}else arguments.length===3&&(n=r,r=null);new h(e,o,m.increasesBy,!0).to.increase(t,r).by(n)};m.doesNotIncrease=function(e,t,r,n){return arguments.length===3&&typeof t=="function"&&(n=r,r=null),new h(e,n,m.doesNotIncrease,!0).to.not.increase(t,r)};m.increasesButNotBy=function(e,t,r,n,o){if(arguments.length===4&&typeof t=="function"){let i=n;n=r,o=i}else arguments.length===3&&(n=r,r=null);new h(e,o,m.increasesButNotBy,!0).to.increase(t,r).but.not.by(n)};m.decreases=function(e,t,r,n){return arguments.length===3&&typeof t=="function"&&(n=r,r=null),new h(e,n,m.decreases,!0).to.decrease(t,r)};m.decreasesBy=function(e,t,r,n,o){if(arguments.length===4&&typeof t=="function"){let i=n;n=r,o=i}else arguments.length===3&&(n=r,r=null);new h(e,o,m.decreasesBy,!0).to.decrease(t,r).by(n)};m.doesNotDecrease=function(e,t,r,n){return arguments.length===3&&typeof t=="function"&&(n=r,r=null),new h(e,n,m.doesNotDecrease,!0).to.not.decrease(t,r)};m.doesNotDecreaseBy=function(e,t,r,n,o){if(arguments.length===4&&typeof t=="function"){let i=n;n=r,o=i}else arguments.length===3&&(n=r,r=null);return new h(e,o,m.doesNotDecreaseBy,!0).to.not.decrease(t,r).by(n)};m.decreasesButNotBy=function(e,t,r,n,o){if(arguments.length===4&&typeof t=="function"){let i=n;n=r,o=i}else arguments.length===3&&(n=r,r=null);new h(e,o,m.decreasesButNotBy,!0).to.decrease(t,r).but.not.by(n)};m.ifError=function(e){if(e)throw e};m.isExtensible=function(e,t){new h(e,t,m.isExtensible,!0).to.be.extensible};m.isNotExtensible=function(e,t){new h(e,t,m.isNotExtensible,!0).to.not.be.extensible};m.isSealed=function(e,t){new h(e,t,m.isSealed,!0).to.be.sealed};m.isNotSealed=function(e,t){new h(e,t,m.isNotSealed,!0).to.not.be.sealed};m.isFrozen=function(e,t){new h(e,t,m.isFrozen,!0).to.be.frozen};m.isNotFrozen=function(e,t){new h(e,t,m.isNotFrozen,!0).to.not.be.frozen};m.isEmpty=function(e,t){new h(e,t,m.isEmpty,!0).to.be.empty};m.isNotEmpty=function(e,t){new h(e,t,m.isNotEmpty,!0).to.not.be.empty};m.containsSubset=function(e,t,r){new h(e,r).to.containSubset(t)};m.doesNotContainSubset=function(e,t,r){new h(e,r).to.not.containSubset(t)};var Vm=[["isOk","ok"],["isNotOk","notOk"],["throws","throw"],["throws","Throw"],["isExtensible","extensible"],["isNotExtensible","notExtensible"],["isSealed","sealed"],["isNotSealed","notSealed"],["isFrozen","frozen"],["isNotFrozen","notFrozen"],["isEmpty","empty"],["isNotEmpty","notEmpty"],["isCallable","isFunction"],["isNotCallable","isNotFunction"],["containsSubset","containSubset"]];for(const[e,t]of Vm)m[t]=m[e];var Is=[];function mf(e){const t={use:mf,AssertionError:G,util:ai,config:ie,expect:To,assert:m,Assertion:h,...pf};return~Is.indexOf(e)||(e(t,ai),Is.push(e)),t}x(mf,"use");const Hm=e=>{const t=new Map,r=[];for(const n of e)t.set(n.id,{...n,childrenNodes:[]});for(const n of t.values())n.parent?t.get(n.parent)?.childrenNodes?.push(n):r.push(n);return r},Wm={animation:"spin 1s linear infinite"},Gm=()=>B.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#364153",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle-icon lucide-loader-circle",style:Wm,"data-testid":"loader-icon",children:B.jsxRuntimeExports.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),Vo=document.createElement("style");Vo&&!document.getElementById("loader-spin-keyframes")&&(Vo.id="loader-spin-keyframes",Vo.innerHTML=`
|
|
3
3
|
@keyframes spin {
|
|
4
4
|
0% { transform: rotate(0deg); }
|
package/dist/index.d.ts
CHANGED
|
@@ -276,15 +276,16 @@ declare interface TWDAPI {
|
|
|
276
276
|
url: () => URLCommandAPI;
|
|
277
277
|
/**
|
|
278
278
|
* Initializes request mocking (registers the service worker).
|
|
279
|
-
*
|
|
279
|
+
* @param [path] service worker absolute path (optional)
|
|
280
280
|
*
|
|
281
281
|
* @example
|
|
282
282
|
* ```ts
|
|
283
283
|
* await twd.initRequestMocking();
|
|
284
|
-
*
|
|
284
|
+
* // init with custom service worker path
|
|
285
|
+
* await twd.initRequestMocking('/test-path/mock-sw.js');
|
|
285
286
|
* ```
|
|
286
287
|
*/
|
|
287
|
-
initRequestMocking: () => Promise<void>;
|
|
288
|
+
initRequestMocking: (path?: string) => Promise<void>;
|
|
288
289
|
/**
|
|
289
290
|
* Clears all request mock rules.
|
|
290
291
|
*
|
package/dist/index.es.js
CHANGED
|
@@ -214,15 +214,18 @@ const bm = {
|
|
|
214
214
|
}, we = (e) => {
|
|
215
215
|
const t = ni.size ? Array.from(ni.values()).find((r) => r.status === "running") : null;
|
|
216
216
|
t && t.logs?.push(e);
|
|
217
|
-
}, xa = "1.2.
|
|
218
|
-
"serviceWorker" in navigator
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
217
|
+
}, xa = "1.2.2", at = [], bd = 100, vm = async (e) => {
|
|
218
|
+
if ("serviceWorker" in navigator) {
|
|
219
|
+
const t = e ?? "/mock-sw.js";
|
|
220
|
+
await navigator.serviceWorker.register(`${t}?v=${xa}`), navigator.serviceWorker.controller || await new Promise((r) => {
|
|
221
|
+
navigator.serviceWorker.addEventListener("controllerchange", r, { once: !0 });
|
|
222
|
+
}), navigator.serviceWorker.addEventListener("message", (r) => {
|
|
223
|
+
if (r.data?.type === "EXECUTED") {
|
|
224
|
+
const { alias: n, request: o } = r.data, i = at.find((a) => a.alias === n);
|
|
225
|
+
i && (i.executed = !0, i.request = o);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
226
229
|
}, ym = async (e, t) => {
|
|
227
230
|
const r = { alias: e, ...t, executed: !1 }, n = at.findIndex((o) => o.alias === e);
|
|
228
231
|
n !== -1 ? at[n] = r : at.push(r), navigator.serviceWorker.controller?.postMessage({
|
package/dist/mock-sw.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const h=e=>{try{return new RegExp(e),!0}catch{return!1}},u=e=>{const s=e.split("?")[0];return/\.([a-zA-Z0-9]+)$/.test(s)};function f(e,s,n){return n.find(t=>{const o=t.method.toLowerCase()===e.toLowerCase();if(t.urlRegex&&h(t.url)){const a=new RegExp(t.url);return o&&a.test(s)}if(u(t.url))return o&&s.includes(t.url);const l=t.url===s||s.includes(t.url);return o&&l&&!u(s)})}function p(e,s,n){e.forEach(t=>t.postMessage({type:"EXECUTED",alias:s.alias,request:n}))}const y=(e,s,n)=>{const o=![204,205,304].includes(s),i=o?JSON.stringify(e):null;return new Response(i,{status:s,headers:o?n||{"Content-Type":"application/json"}:n||{}})},c="1.2.
|
|
1
|
+
const h=e=>{try{return new RegExp(e),!0}catch{return!1}},u=e=>{const s=e.split("?")[0];return/\.([a-zA-Z0-9]+)$/.test(s)};function f(e,s,n){return n.find(t=>{const o=t.method.toLowerCase()===e.toLowerCase();if(t.urlRegex&&h(t.url)){const a=new RegExp(t.url);return o&&a.test(s)}if(u(t.url))return o&&s.includes(t.url);const l=t.url===s||s.includes(t.url);return o&&l&&!u(s)})}function p(e,s,n){e.forEach(t=>t.postMessage({type:"EXECUTED",alias:s.alias,request:n}))}const y=(e,s,n)=>{const o=![204,205,304].includes(s),i=o?JSON.stringify(e):null;return new Response(i,{status:s,headers:o?n||{"Content-Type":"application/json"}:n||{}})},c="1.2.2";let r=[];const g=async e=>{const{method:s}=e.request,n=e.request.url,t=f(s,n,r);t&&(console.log("[TWD] Mock hit:",t.alias,s,n),e.respondWith((async()=>{let o=null;const i=e.request.headers.get("content-type")||"application/json";if(i.includes("application/json"))try{o=await e.request.clone().json()}catch{}else if(i.includes("form"))try{const l=await e.request.clone().formData();o={},l.forEach((a,d)=>{o[d]=a})}catch{}else if(i.includes("text"))try{o=await e.request.clone().text()}catch{}else if(i.includes("octet-stream"))try{o=await e.request.clone().arrayBuffer()}catch{}else if(i.includes("image"))try{o=await e.request.clone().blob()}catch{}else try{o=await e.request.clone().text()}catch{}return self.clients.matchAll().then(l=>{p(l,t,o)}),y(t.response,t.status??200,t.responseHeaders)})()))},m=e=>{e!==c&&console.warn(`[TWD] ⚠️ Version mismatch detected:
|
|
2
2
|
Client version: ${e}
|
|
3
3
|
Service Worker version: ${c}
|
|
4
4
|
|