UNPKG

ast-deep-contains

Version:

Like t.same assert on array of objects, where element order doesn't matter.

40 lines (38 loc) 21.9 kB
/** * @name ast-deep-contains * @fileoverview Like t.same assert on array of objects, where element order doesn't matter. * @version 5.0.23 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/ast-deep-contains/} */ "use strict";var astDeepContains=(()=>{var jr=Object.create;var j=Object.defineProperty,Br=Object.defineProperties,Cr=Object.getOwnPropertyDescriptor,Pr=Object.getOwnPropertyDescriptors,Ur=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols,Vr=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable;var Q=(r,t,u)=>t in r?j(r,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):r[t]=u,T=(r,t)=>{for(var u in t||(t={}))q.call(t,u)&&Q(r,u,t[u]);if(_)for(var u of _(t))Mr.call(t,u)&&Q(r,u,t[u]);return r},B=(r,t)=>Br(r,Pr(t));var z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Rr=(r,t)=>{for(var u in t)j(r,u,{get:t[u],enumerable:!0})},Y=(r,t,u,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let w of Ur(t))!q.call(r,w)&&w!==u&&j(r,w,{get:()=>t[w],enumerable:!(d=Cr(t,w))||d.enumerable});return r};var W=(r,t,u)=>(u=r!=null?jr(Vr(r)):{},Y(t||!r||!r.__esModule?j(u,"default",{value:r,enumerable:!0}):u,r)),Lr=r=>Y(j({},"__esModule",{value:!0}),r);var X=z((Z,M)=>{(function(r,t){"use strict";typeof M=="object"&&typeof M.exports=="object"?M.exports=t():typeof define=="function"&&define.amd?define([],t):r.objectPath=t()})(Z,function(){"use strict";var r=Object.prototype.toString;function t(o,n){return o==null?!1:Object.prototype.hasOwnProperty.call(o,n)}function u(o){if(!o||A(o)&&o.length===0)return!0;if(typeof o!="string"){for(var n in o)if(t(o,n))return!1;return!0}return!1}function d(o){return r.call(o)}function w(o){return typeof o=="object"&&d(o)==="[object Object]"}var A=Array.isArray||function(o){return r.call(o)==="[object Array]"};function a(o){return typeof o=="boolean"||d(o)==="[object Boolean]"}function s(o){var n=parseInt(o);return n.toString()===o?n:o}function i(o){o=o||{};var n=function(p){return Object.keys(n).reduce(function(e,f){return f==="create"||typeof n[f]=="function"&&(e[f]=n[f].bind(n,p)),e},{})},l;o.includeInheritedProps?l=function(){return!0}:l=function(p,e){return typeof e=="number"&&Array.isArray(p)||t(p,e)};function S(p,e){if(l(p,e))return p[e]}var x;o.includeInheritedProps?x=function(p,e){typeof e!="string"&&typeof e!="number"&&(e=String(e));var f=S(p,e);if(e==="__proto__"||e==="prototype"||e==="constructor"&&typeof f=="function")throw new Error("For security reasons, object's magic properties cannot be set");return f}:x=function(p,e){return S(p,e)};function I(p,e,f,y){if(typeof e=="number"&&(e=[e]),!e||e.length===0)return p;if(typeof e=="string")return I(p,e.split(".").map(s),f,y);var h=e[0],E=x(p,h);return e.length===1?((E===void 0||!y)&&(p[h]=f),E):(E===void 0&&(typeof e[1]=="number"?p[h]=[]:p[h]={}),I(p[h],e.slice(1),f,y))}return n.has=function(p,e){if(typeof e=="number"?e=[e]:typeof e=="string"&&(e=e.split(".")),!e||e.length===0)return!!p;for(var f=0;f<e.length;f++){var y=s(e[f]);if(typeof y=="number"&&A(p)&&y<p.length||(o.includeInheritedProps?y in Object(p):t(p,y)))p=p[y];else return!1}return!0},n.ensureExists=function(p,e,f){return I(p,e,f,!0)},n.set=function(p,e,f,y){return I(p,e,f,y)},n.insert=function(p,e,f,y){var h=n.get(p,e);y=~~y,A(h)||(h=[],n.set(p,e,h)),h.splice(y,0,f)},n.empty=function(p,e){if(!u(e)&&p!=null){var f,y;if(f=n.get(p,e)){if(typeof f=="string")return n.set(p,e,"");if(a(f))return n.set(p,e,!1);if(typeof f=="number")return n.set(p,e,0);if(A(f))f.length=0;else if(w(f))for(y in f)l(f,y)&&delete f[y];else return n.set(p,e,null)}}},n.push=function(p,e){var f=n.get(p,e);A(f)||(f=[],n.set(p,e,f)),f.push.apply(f,Array.prototype.slice.call(arguments,2))},n.coalesce=function(p,e,f){for(var y,h=0,E=e.length;h<E;h++)if((y=n.get(p,e[h]))!==void 0)return y;return f},n.get=function(p,e,f){if(typeof e=="number"&&(e=[e]),!e||e.length===0)return p;if(p==null)return f;if(typeof e=="string")return n.get(p,e.split("."),f);var y=s(e[0]),h=x(p,y);return h===void 0?f:e.length===1?h:n.get(p[y],e.slice(1),f)},n.del=function(e,f){if(typeof f=="number"&&(f=[f]),e==null||u(f))return e;if(typeof f=="string")return n.del(e,f.split("."));var y=s(f[0]);if(x(e,y),!l(e,y))return e;if(f.length===1)A(e)?e.splice(y,1):delete e[y];else return n.del(e[y],f.slice(1));return e},n}var c=i();return c.create=i,c.withInheritedProps=i({includeInheritedProps:!0}),c})});var G=z((sn,v)=>{"use strict";v.exports=Wr;function k(r){return r instanceof Buffer?Buffer.from(r):new r.constructor(r.buffer.slice(),r.byteOffset,r.length)}function Wr(r){if(r=r||{},r.circles)return Gr(r);let t=new Map;if(t.set(Date,a=>new Date(a)),t.set(Map,(a,s)=>new Map(d(Array.from(a),s))),t.set(Set,(a,s)=>new Set(d(Array.from(a),s))),r.constructorHandlers)for(let a of r.constructorHandlers)t.set(a[0],a[1]);let u=null;return r.proto?A:w;function d(a,s){let i=Object.keys(a),c=new Array(i.length);for(let o=0;o<i.length;o++){let n=i[o],l=a[n];typeof l!="object"||l===null?c[n]=l:l.constructor!==Object&&(u=t.get(l.constructor))?c[n]=u(l,s):ArrayBuffer.isView(l)?c[n]=k(l):c[n]=s(l)}return c}function w(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return d(a,w);if(a.constructor!==Object&&(u=t.get(a.constructor)))return u(a,w);let s={};for(let i in a){if(Object.hasOwnProperty.call(a,i)===!1)continue;let c=a[i];typeof c!="object"||c===null?s[i]=c:c.constructor!==Object&&(u=t.get(c.constructor))?s[i]=u(c,w):ArrayBuffer.isView(c)?s[i]=k(c):s[i]=w(c)}return s}function A(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return d(a,A);if(a.constructor!==Object&&(u=t.get(a.constructor)))return u(a,A);let s={};for(let i in a){let c=a[i];typeof c!="object"||c===null?s[i]=c:c.constructor!==Object&&(u=t.get(c.constructor))?s[i]=u(c,A):ArrayBuffer.isView(c)?s[i]=k(c):s[i]=A(c)}return s}}function Gr(r){let t=[],u=[],d=new Map;if(d.set(Date,i=>new Date(i)),d.set(Map,(i,c)=>new Map(A(Array.from(i),c))),d.set(Set,(i,c)=>new Set(A(Array.from(i),c))),r.constructorHandlers)for(let i of r.constructorHandlers)d.set(i[0],i[1]);let w=null;return r.proto?s:a;function A(i,c){let o=Object.keys(i),n=new Array(o.length);for(let l=0;l<o.length;l++){let S=o[l],x=i[S];if(typeof x!="object"||x===null)n[S]=x;else if(x.constructor!==Object&&(w=d.get(x.constructor)))n[S]=w(x,c);else if(ArrayBuffer.isView(x))n[S]=k(x);else{let I=t.indexOf(x);I!==-1?n[S]=u[I]:n[S]=c(x)}}return n}function a(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return A(i,a);if(i.constructor!==Object&&(w=d.get(i.constructor)))return w(i,a);let c={};t.push(i),u.push(c);for(let o in i){if(Object.hasOwnProperty.call(i,o)===!1)continue;let n=i[o];if(typeof n!="object"||n===null)c[o]=n;else if(n.constructor!==Object&&(w=d.get(n.constructor)))c[o]=w(n,a);else if(ArrayBuffer.isView(n))c[o]=k(n);else{let l=t.indexOf(n);l!==-1?c[o]=u[l]:c[o]=a(n)}}return t.pop(),u.pop(),c}function s(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return A(i,s);if(i.constructor!==Object&&(w=d.get(i.constructor)))return w(i,s);let c={};t.push(i),u.push(c);for(let o in i){let n=i[o];if(typeof n!="object"||n===null)c[o]=n;else if(n.constructor!==Object&&(w=d.get(n.constructor)))c[o]=w(n,s);else if(ArrayBuffer.isView(n))c[o]=k(n);else{let l=t.indexOf(n);l!==-1?c[o]=u[l]:c[o]=s(n)}}return t.pop(),u.pop(),c}}});var an={};Rr(an,{deepContains:()=>kr,defaults:()=>Dr,version:()=>fn});var L=W(X(),1);var nr=W(G(),1);var rr=W(G(),1);var dn=(0,rr.default)();function tr(r){if(r==null||typeof r!="object")return!1;let t=Object.getPrototypeOf(r);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in r)&&!(Symbol.toStringTag in r)}function J(r){if(r.includes(".")){let t=r.lastIndexOf(".");if(!r.slice(0,t).includes("."))return r.slice(0,t);for(let u=t-1;u--;)if(r[u]===".")return r.slice(u+1,t)}return null}var H=(0,nr.default)();function er(r,t){let u={now:!1};function d(w,A,a,s){let i=H(w),c,o=T({depth:-1,path:""},a);if(o.depth+=1,Array.isArray(i))for(let n=0,l=i.length;n<l&&!s.now;n++){let S=o.path?`${o.path}.${n}`:`${n}`;i[n]!==void 0?(o.parent=H(i),o.parentType="array",o.parentKey=J(S),c=d(A(i[n],void 0,B(T({},o),{path:S}),s),A,B(T({},o),{path:S}),s),Number.isNaN(c)&&n<i.length?(i.splice(n,1),n-=1):i[n]=c):i.splice(n,1)}else if(tr(i))for(let n in i){if(s.now&&n!=null)break;let l=o.path?`${o.path}.${n}`:n;o.depth===0&&n!=null&&(o.topmostKey=n),o.parent=H(i),o.parentType="object",o.parentKey=J(l),c=d(A(n,i[n],B(T({},o),{path:l}),s),A,B(T({},o),{path:l}),s),Number.isNaN(c)?delete i[n]:i[n]=c}return i}return d(r,t,{},u)}var or=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Jr(r){return or.includes(r)}var ur=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...or];function Hr(r){return ur.includes(r)}var cr=["null","undefined","string","number","bigint","boolean","symbol"];function gr(r){return cr.includes(r)}var Sn=["positive number","negative number","Class","string with a number","null or undefined","Iterable","AsyncIterable","native Promise","EnumCase","string with a URL","truthy","falsy","primitive","integer","plain object","TypedArray","array-like","tuple-like","Node.js Stream","infinite number","empty array","non-empty array","empty string","empty string or whitespace","non-empty string","non-empty string and not whitespace","empty object","non-empty object","empty set","non-empty set","empty map","non-empty map","PropertyKey","even integer","odd integer","T","in range","predicate returns truthy for any value","predicate returns truthy for all values","valid Date","valid length","whitespace string",...ur,...cr],b=r=>{let t=Object.prototype.toString.call(r).slice(8,-1);if(/HTML\w+Element/.test(t)&&dr(r))return"HTMLElement";if(Hr(t))return t};function ir(r){if(r===null)return"null";switch(typeof r){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(r)?"NaN":"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(K(r))return"Observable";if(D(r))return"Array";if(ar(r))return"Buffer";let t=b(r);if(t)return t;if(r instanceof String||r instanceof Boolean||r instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}function Kr(r){return $(r==null?void 0:r.then)&&$(r==null?void 0:r.catch)}var _r=Object.assign(ir,{all:Qr,any:pr,array:D,arrayBuffer:qr,arrayLike:zr,asyncFunction:Yr,asyncGenerator:Zr,asyncGeneratorFunction:Xr,asyncIterable:yr,bigint:vr,bigInt64Array:rt,bigUint64Array:tt,blob:nt,boolean:et,boundFunction:it,buffer:ar,class:ot,dataView:ut,date:lr,detect:ir,directInstanceOf:ct,emptyArray:ft,emptyMap:pt,emptyObject:yt,emptySet:at,emptyString:sr,emptyStringOrWhitespace:g,enumCase:lt,error:st,evenInteger:dt,falsy:bt,float32Array:ht,float64Array:wt,formData:At,function:$,generator:Et,generatorFunction:xt,htmlElement:dr,infinite:Ot,inRange:Tt,int16Array:Nt,int32Array:mt,int8Array:It,integer:br,iterable:hr,map:C,nan:wr,nativePromise:Ar,negativeNumber:Dt,nodeStream:kt,nonEmptyArray:Ft,nonEmptyMap:jt,nonEmptyObject:Bt,nonEmptySet:Ct,nonEmptyString:Pt,nonEmptyStringAndNotWhitespace:Ut,null:R,nullOrUndefined:Er,number:P,numericString:Vt,object:U,observable:K,oddInteger:Mt,plainObject:xr,positiveNumber:Rt,primitive:Lt,promise:Wt,propertyKey:Gt,regExp:Jt,safeInteger:Sr,set:V,sharedArrayBuffer:Ht,string:N,symbol:$r,truthy:gt,tupleLike:Kt,typedArray:_t,uint16Array:Qt,uint32Array:qt,uint8Array:zt,uint8ClampedArray:Yt,undefined:Or,urlInstance:Zt,urlSearchParams:Xt,urlString:vt,validDate:rn,validLength:Tr,weakMap:tn,weakRef:nn,weakSet:en,whitespaceString:Nr});function fr(r){return t=>br(t)&&Math.abs(t%2)===r}function Qr(r,...t){return mr(Array.prototype.every,r,t)}function pr(r,...t){return(D(r)?r:[r]).some(d=>mr(Array.prototype.some,d,t))}function D(r,t){return Array.isArray(r)?$(t)?r.every(u=>t(u)):!0:!1}function qr(r){return b(r)==="ArrayBuffer"}function zr(r){return!Er(r)&&!$(r)&&Tr(r.length)}function Yr(r){return b(r)==="AsyncFunction"}function Zr(r){return yr(r)&&$(r.next)&&$(r.throw)}function Xr(r){return b(r)==="AsyncGeneratorFunction"}function yr(r){return $(r==null?void 0:r[Symbol.asyncIterator])}function vr(r){return typeof r=="bigint"}function rt(r){return b(r)==="BigInt64Array"}function tt(r){return b(r)==="BigUint64Array"}function nt(r){return b(r)==="Blob"}function et(r){return r===!0||r===!1}function it(r){return $(r)&&!Object.hasOwn(r,"prototype")}function ar(r){var t,u,d;return(d=(u=(t=r==null?void 0:r.constructor)==null?void 0:t.isBuffer)==null?void 0:u.call(t,r))!=null?d:!1}function ot(r){return $(r)&&r.toString().startsWith("class ")}function ut(r){return b(r)==="DataView"}function lr(r){return b(r)==="Date"}function ct(r,t){return r==null?!1:Object.getPrototypeOf(r)===t.prototype}function ft(r){return D(r)&&r.length===0}function pt(r){return C(r)&&r.size===0}function yt(r){return U(r)&&!C(r)&&!V(r)&&Object.keys(r).length===0}function at(r){return V(r)&&r.size===0}function sr(r){return N(r)&&r.length===0}function g(r){return sr(r)||Nr(r)}function lt(r,t){return Object.values(t).includes(r)}function st(r){return b(r)==="Error"}function dt(r){return fr(0)(r)}function bt(r){return!r}function ht(r){return b(r)==="Float32Array"}function wt(r){return b(r)==="Float64Array"}function At(r){return b(r)==="FormData"}function $(r){return typeof r=="function"}function Et(r){return hr(r)&&$(r==null?void 0:r.next)&&$(r==null?void 0:r.throw)}function xt(r){return b(r)==="GeneratorFunction"}var St=1,$t=["innerHTML","ownerDocument","style","attributes","nodeValue"];function dr(r){return U(r)&&r.nodeType===St&&N(r.nodeName)&&!xr(r)&&$t.every(t=>t in r)}function Ot(r){return r===Number.POSITIVE_INFINITY||r===Number.NEGATIVE_INFINITY}function Tt(r,t){if(P(t))return r>=Math.min(0,t)&&r<=Math.max(t,0);if(D(t)&&t.length===2)return r>=Math.min(...t)&&r<=Math.max(...t);throw new TypeError(`Invalid range: ${JSON.stringify(t)}`)}function Nt(r){return b(r)==="Int16Array"}function mt(r){return b(r)==="Int32Array"}function It(r){return b(r)==="Int8Array"}function br(r){return Number.isInteger(r)}function hr(r){return $(r==null?void 0:r[Symbol.iterator])}function C(r){return b(r)==="Map"}function wr(r){return Number.isNaN(r)}function Ar(r){return b(r)==="Promise"}function Dt(r){return P(r)&&r<0}function kt(r){return U(r)&&$(r.pipe)&&!K(r)}function Ft(r){return D(r)&&r.length>0}function jt(r){return C(r)&&r.size>0}function Bt(r){return U(r)&&!C(r)&&!V(r)&&Object.keys(r).length>0}function Ct(r){return V(r)&&r.size>0}function Pt(r){return N(r)&&r.length>0}function Ut(r){return N(r)&&!g(r)}function R(r){return r===null}function Er(r){return R(r)||Or(r)}function P(r){return typeof r=="number"&&!Number.isNaN(r)}function Vt(r){return N(r)&&!g(r)&&!Number.isNaN(Number(r))}function U(r){return!R(r)&&(typeof r=="object"||$(r))}function K(r){var t,u;return r?r===((t=r[Symbol.observable])==null?void 0:t.call(r))||r===((u=r["@@observable"])==null?void 0:u.call(r)):!1}function Mt(r){return fr(1)(r)}function xr(r){if(typeof r!="object"||r===null)return!1;let t=Object.getPrototypeOf(r);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Rt(r){return P(r)&&r>0}function Lt(r){return R(r)||gr(typeof r)}function Wt(r){return Ar(r)||Kr(r)}function Gt(r){return pr([N,P,$r],r)}function Jt(r){return b(r)==="RegExp"}function Sr(r){return Number.isSafeInteger(r)}function V(r){return b(r)==="Set"}function Ht(r){return b(r)==="SharedArrayBuffer"}function N(r){return typeof r=="string"}function $r(r){return typeof r=="symbol"}function gt(r){return!!r}function Kt(r,t){return D(t)&&D(r)&&t.length===r.length?t.every((u,d)=>u(r[d])):!1}function _t(r){return Jr(b(r))}function Qt(r){return b(r)==="Uint16Array"}function qt(r){return b(r)==="Uint32Array"}function zt(r){return b(r)==="Uint8Array"}function Yt(r){return b(r)==="Uint8ClampedArray"}function Or(r){return r===void 0}function Zt(r){return b(r)==="URL"}function Xt(r){return b(r)==="URLSearchParams"}function vt(r){if(!N(r))return!1;try{return new URL(r),!0}catch(t){return!1}}function rn(r){return lr(r)&&!wr(Number(r))}function Tr(r){return Sr(r)&&r>=0}function tn(r){return b(r)==="WeakMap"}function nn(r){return b(r)==="WeakRef"}function en(r){return b(r)==="WeakSet"}function Nr(r){return N(r)&&/^\s+$/.test(r)}function mr(r,t,u){if(!$(t))throw new TypeError(`Invalid predicate: ${JSON.stringify(t)}`);if(u.length===0)throw new TypeError("Invalid number of values");return r.call(u,t)}var $n=new Intl.ListFormat("en",{style:"long",type:"conjunction"}),On=new Intl.ListFormat("en",{style:"long",type:"disjunction"});var on={isArray:"Array",isArrayBuffer:"ArrayBuffer",isArrayLike:"array-like",isAsyncFunction:"AsyncFunction",isAsyncGenerator:"AsyncGenerator",isAsyncGeneratorFunction:"AsyncGeneratorFunction",isAsyncIterable:"AsyncIterable",isBigint:"bigint",isBigInt64Array:"BigInt64Array",isBigUint64Array:"BigUint64Array",isBlob:"Blob",isBoolean:"boolean",isBoundFunction:"Function",isBuffer:"Buffer",isClass:"Class",isDataView:"DataView",isDate:"Date",isDirectInstanceOf:"T",isEmptyArray:"empty array",isEmptyMap:"empty map",isEmptyObject:"empty object",isEmptySet:"empty set",isEmptyString:"empty string",isEmptyStringOrWhitespace:"empty string or whitespace",isEnumCase:"EnumCase",isError:"Error",isEvenInteger:"even integer",isFalsy:"falsy",isFloat32Array:"Float32Array",isFloat64Array:"Float64Array",isFormData:"FormData",isFunction:"Function",isGenerator:"Generator",isGeneratorFunction:"GeneratorFunction",isHtmlElement:"HTMLElement",isInfinite:"infinite number",isInRange:"in range",isInt16Array:"Int16Array",isInt32Array:"Int32Array",isInt8Array:"Int8Array",isInteger:"integer",isIterable:"Iterable",isMap:"Map",isNan:"NaN",isNativePromise:"native Promise",isNegativeNumber:"negative number",isNodeStream:"Node.js Stream",isNonEmptyArray:"non-empty array",isNonEmptyMap:"non-empty map",isNonEmptyObject:"non-empty object",isNonEmptySet:"non-empty set",isNonEmptyString:"non-empty string",isNonEmptyStringAndNotWhitespace:"non-empty string and not whitespace",isNull:"null",isNullOrUndefined:"null or undefined",isNumber:"number",isNumericString:"string with a number",isObject:"Object",isObservable:"Observable",isOddInteger:"odd integer",isPlainObject:"plain object",isPositiveNumber:"positive number",isPrimitive:"primitive",isPromise:"Promise",isPropertyKey:"PropertyKey",isRegExp:"RegExp",isSafeInteger:"integer",isSet:"Set",isSharedArrayBuffer:"SharedArrayBuffer",isString:"string",isSymbol:"symbol",isTruthy:"truthy",isTupleLike:"tuple-like",isTypedArray:"TypedArray",isUint16Array:"Uint16Array",isUint32Array:"Uint32Array",isUint8Array:"Uint8Array",isUint8ClampedArray:"Uint8ClampedArray",isUndefined:"undefined",isUrlInstance:"URL",isUrlSearchParams:"URLSearchParams",isUrlString:"string with a URL",isValidDate:"valid Date",isValidLength:"valid length",isWeakMap:"WeakMap",isWeakRef:"WeakRef",isWeakSet:"WeakSet",isWhitespaceString:"whitespace string"};function un(r){return Object.keys(r)}var Tn=un(on);var m=_r;var Ir="5.0.23";var fn=Ir;function pn(r){if(r.includes(".")){for(let t=r.length;t--;)if(r[t]===".")return r.slice(0,t)}return r}function yn(r,t){return Array.from(r).filter((u,d)=>d!==t)}var Dr={skipContainers:!0,arrayStrictComparison:!1};function kr(r,t,u,d,w){let A=T(T({},Dr),w);m(r)!==m(t)?d(`the first input arg is of a type ${m(r).toLowerCase()} but the second is ${m(t).toLowerCase()}. Values are - 1st: ${JSON.stringify(r,null,4)} 2nd: ${JSON.stringify(t,null,4)}`):er(t,(a,s,i,c)=>{let o=s!==void 0?s:a,{path:n}=i;if(L.default.has(r,n))if(!A.arrayStrictComparison&&m.plainObject(o)&&i.parentType==="array"&&i.parent.length>1){c.now=!0;let l=Array.from(i.path.includes(".")?L.default.get(r,pn(n)):r);if(l.length<i.parent.length)d(`the first array: ${JSON.stringify(l,null,4)} has less objects than array we're matching against, ${JSON.stringify(i.parent,null,4)}`);else{let S=i.parent,x=l.map((y,h)=>h),I=S.map((y,h)=>h),p=[];for(let y=0,h=x.length;y<h;y++){let E=[],O=x[y],F=yn(x,y);E.push(O),F.forEach(Fr=>{p.push(Array.from(E).concat(Fr))})}let e=p.map(y=>y.map((h,E)=>[E,h])),f=0;for(let y=0,h=e.length;y<h;y++){let E=0;e[y].forEach(O=>{m.plainObject(S[O[0]])&&m.plainObject(l[O[1]])&&Object.keys(S[O[0]]).forEach(F=>{Object.keys(l[O[1]]).includes(F)&&(E+=1,l[O[1]][F]===S[O[0]][F]&&(E+=5))})}),e[y].push(E),E>f&&(f=E)}for(let y=0,h=e.length;y<h;y++)if(e[y][2]===f){e[y].forEach((E,O)=>{O<e[y].length-1&&kr(l[E[1]],S[E[0]],u,d,A)});break}}}else{let l=L.default.get(r,n);(!A.skipContainers||!m.plainObject(l)&&!Array.isArray(l))&&u(l,o,n)}else d(`the first input: ${JSON.stringify(r,null,4)} does not have the path "${n}", we were looking, would it contain a value ${JSON.stringify(o,null,0)}.`);return o})}return Lr(an);})(); /** * @name codsen-utils * @fileoverview Various utility functions * @version 1.6.7 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/codsen-utils/} */ /** * @name ast-monkey-util * @fileoverview Utility library of AST helper functions * @version 3.0.10 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/ast-monkey-util/} */ /** * @name ast-monkey-traverse * @fileoverview Utility library to traverse AST * @version 4.0.19 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/ast-monkey-traverse/} */