object-flatten-referencing 7.1.3 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,11 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## 7.1.0 (2025-10-15)
6
+ ## 7.2.0 (2026-08-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ - handle missing values in flatten helpers ([67fbc75](https://github.com/codsen/codsen/commit/67fbc75a4ae02ea36e11c95494416c0523e8ace9))
11
+ - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
12
+ - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
13
+ - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
7
14
 
8
15
  ### Features
9
16
 
10
- - if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
17
+ - add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
18
+ - refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
19
+
20
+ ### Performance Improvements
21
+
22
+ - clone the referenced object only once ([96cdb4f](https://github.com/codsen/codsen/commit/96cdb4f8e8c593ab75c91a45b8c543a95ebd9203))
23
+
24
+ ### Reverts
25
+
26
+ - Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
27
+ - Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
11
28
 
12
29
  ## 7.0.0 (2022-12-01)
13
30
 
@@ -221,7 +238,7 @@ For example, `['aaa', 'bbb', 'ccc']` referencing string 'zzz' would yield string
221
238
  ## 1.1.0 (2017-04-20)
222
239
 
223
240
  - New options setting `opts.ignore` which lets you skip flattening on an array (or a single string) of keys.
224
- - New options setting `opts.whatToDoWhenReferenceIsMissing` which allows you to specify exactly what do you want to happen when the equivalent value in the reference (object/array/string/whatever) is falsey.
241
+ - New options setting `opts.whatToDoWhenReferenceIsMissing` which allows you to specify exactly what do you want to happen when the equivalent value in the reference (object/array/string/whatever) is falsy.
225
242
  - 🔧 Done some rebasing, for example, `util.arrayiffyString` now DRY'ies the code a bit.
226
243
 
227
244
  ## 1.0.0 (2017-04-03)
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright © 2010-2025 Roy Revelt and other contributors
3
+ Copyright © 2010-2026 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -32,7 +32,7 @@ npm i object-flatten-referencing
32
32
  ## Quick Take
33
33
 
34
34
  ```js
35
- import { strict as assert } from "assert";
35
+ import { strict as assert } from "node:assert";
36
36
 
37
37
  import { flattenReferencing } from "object-flatten-referencing";
38
38
 
@@ -54,6 +54,7 @@ assert.deepEqual(
54
54
  );
55
55
  ```
56
56
 
57
+
57
58
  ## Documentation
58
59
 
59
60
  Please [visit codsen.com](https://codsen.com/os/object-flatten-referencing/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/object-flatten-referencing/CHANGELOG.md).
@@ -66,6 +67,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
66
67
 
67
68
  MIT License
68
69
 
69
- Copyright © 2010-2025 Roy Revelt and other contributors
70
+ Copyright © 2010-2026 Roy Revelt and other contributors
70
71
 
71
72
  <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name object-flatten-referencing
3
3
  * @fileoverview Flatten complex nested objects according to a reference objects
4
- * @version 7.1.3
4
+ * @version 7.2.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/object-flatten-referencing/}
8
8
  */
9
9
 
10
- import C from"rfdc";import{strIndexesOfPlus as S}from"str-indexes-of-plus";import{isMatch as P}from"matcher";import{arrayiffy as y}from"arrayiffy-if-string";import{existy as O,isStr as m,isPlainObject as b}from"codsen-utils";import A from"rfdc";import{isStr as w,isPlainObject as I}from"codsen-utils";var T=A(),W={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function j(g,u){let c={...W,...u};if(arguments.length===0||Object.keys(g).length===0)return[];let i=T(g),n=[];return I(i)&&Object.keys(i).forEach(a=>{I(i[a])&&(i[a]=j(i[a],c)),Array.isArray(i[a])&&(n=n.concat(i[a].map(p=>`${a}${c.objectKeyAndValueJoinChar}${p}`))),w(i[a])&&n.push(`${a}${c.objectKeyAndValueJoinChar}${i[a]}`)}),n}function v(g,u,c=!1,i=!1){let n={...W,...u};if(arguments.length===0||g.length===0)return"";let a=T(g),p="";if(a.length)if(i){for(let e=0,s=a.length;e<s;e++)if(w(a[e])){let l;l="",n.mergeArraysWithLineBreaks&&e>0&&(!n.mergeWithoutTrailingBrIfLineContainsBr||typeof a[e-1]!="string"||n.mergeWithoutTrailingBrIfLineContainsBr&&a[e-1]!==void 0&&!a[e-1].toLowerCase().includes("<br"))&&(l=`<br${n.xhtml?" /":""}>`),p+=`${l}${c?n.wrapHeadsWith:""}${a[e]}${c?n.wrapTailsWith:""}`}else if(Array.isArray(a[e])&&a[e].length&&a[e].every(w)){let l="";n.mergeArraysWithLineBreaks&&p.length&&(l=`<br${n.xhtml?" /":""}>`),p=a[e].reduce((d,t,o,r)=>{let f="";return o!==r.length-1&&(f=" "),d+(o===0?l:"")+(c?n.wrapHeadsWith:"")+t+(c?n.wrapTailsWith:"")+f},p)}}else p=a.reduce((e,s,l,d)=>{let t="";n.mergeArraysWithLineBreaks&&l>0&&(t=`<br${n.xhtml?" /":""}>`);let o="";return l!==d.length-1&&(o=" "),`${e}${l===0?t:""}${c?n.wrapHeadsWith:""}${s}${c?n.wrapTailsWith:""}${o}`},p);return p}var x="7.1.3";var D=C(),Q=x;function X(g,u,c){if(!b(g))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_01] the first input argument must be a plain object! It was given as ${JSON.stringify(g,null,4)} (its typeof was ${typeof g}).`);if(!b(u))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_02] the second input argument must be a plain object! It was given as ${JSON.stringify(u,null,4)} (its typeof was ${typeof u}).`);if(c&&!b(c))throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_03] the third input argument must be a plain object! It was given as ${JSON.stringify(c,null,4)} (its typeof was ${typeof c}).`);let i={...W,...c};i.dontWrapKeys=y(i.dontWrapKeys),i.preventWrappingIfContains=y(i.preventWrappingIfContains),i.dontWrapPaths=y(i.dontWrapPaths),i.ignore=y(i.ignore),typeof i.whatToDoWhenReferenceIsMissing!="number"&&(i.whatToDoWhenReferenceIsMissing=+i.whatToDoWhenReferenceIsMissing||0);function n(a,p,e,s=!0,l=!0,d=""){let t=D(a),o=D(p);return e.wrapGlobalFlipSwitch||(s=!1),b(t)?Object.keys(t).forEach(r=>{let f=d+(d.length===0?r:`.${r}`);if(e.ignore.length===0||!e.ignore.includes(r)){if(e.wrapGlobalFlipSwitch&&(s=!0,e.dontWrapKeys.length&&(s=s&&!e.dontWrapKeys.some(h=>P(r,h,{caseSensitive:!0}))),e.dontWrapPaths.length&&(s=s&&!e.dontWrapPaths.some(h=>h===f)),e.preventWrappingIfContains.length&&typeof t[r]=="string"&&(s=s&&!e.preventWrappingIfContains.some(h=>t[r].includes(h)))),O(o[r])||!O(o[r])&&e.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(t[r]))if(e.whatToDoWhenReferenceIsMissing===2||m(o[r]))t[r]=v(t[r],e,s,l);else{if(t[r].every(h=>typeof h=="string"||Array.isArray(h))){let h=!0;t[r].forEach($=>{Array.isArray($)&&!$.every(m)&&(h=!1)}),h&&(l=!1)}t[r]=n(t[r],o[r],e,s,l,f)}else b(t[r])?e.whatToDoWhenReferenceIsMissing===2||m(o[r])?t[r]=v(j(t[r],e),e,s,l):s?t[r]=n(t[r],o[r],e,s,l,f):t[r]=n(t[r],o[r],{...e,wrapGlobalFlipSwitch:!1},s,l,f):m(t[r])&&(t[r]=n(t[r],o[r],e,s,l,f));else if(typeof t[r]!=typeof o[r]&&e.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ${r} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(t)?Array.isArray(o)?t.forEach((r,f)=>{O(t[f])&&O(o[f])?t[f]=n(t[f],o[f],e,s,l,`${d}[${f}]`):t[f]=n(t[f],o[0],e,s,l,`${d}[${f}]`)}):m(o)&&(t=v(t,e,s,l)):m(t)&&t.length&&(e.wrapHeadsWith||e.wrapTailsWith)&&(!e.preventDoubleWrapping||(e.wrapHeadsWith===""||!S(t,e.wrapHeadsWith.trim()).length)&&(e.wrapTailsWith===""||!S(t,e.wrapTailsWith.trim()).length))&&(t=`${s?e.wrapHeadsWith:""}${t}${s?e.wrapTailsWith:""}`),t}return n(g,u,i)}export{y as arrayiffy,W as defaults,v as flattenArr,j as flattenObject,X as flattenReferencing,Q as version};
10
+ import{arrayiffy as v}from"arrayiffy-if-string";import{deepClone as S,existy as w,formatDiagnosticValue as $,isPlainObject as b,isStr as m,match as A}from"codsen-utils";import{strIndexesOfPlus as C}from"str-indexes-of-plus";var T="7.2.0";import{deepClone as R,isPlainObject as x,isStr as O}from"codsen-utils";var W={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function j(p,d){let c={...W,...d};if(!p||Object.keys(p).length===0)return[];let i=R(p),r=[];return x(i)&&Object.keys(i).forEach(a=>{x(i[a])&&(i[a]=j(i[a],c)),Array.isArray(i[a])&&(r=r.concat(i[a].map(h=>`${a}${c.objectKeyAndValueJoinChar}${h}`))),O(i[a])&&r.push(`${a}${c.objectKeyAndValueJoinChar}${i[a]}`)}),r}function y(p,d,c=!1,i=!1){let r={...W,...d};if(!p||p.length===0)return"";let a=R(p),h="";if(a.length)if(i){for(let e=0,s=a.length;e<s;e++)if(O(a[e])){let l;l="",r.mergeArraysWithLineBreaks&&e>0&&(!r.mergeWithoutTrailingBrIfLineContainsBr||typeof a[e-1]!="string"||r.mergeWithoutTrailingBrIfLineContainsBr&&a[e-1]!==void 0&&!a[e-1].toLowerCase().includes("<br"))&&(l=`<br${r.xhtml?" /":""}>`),h+=`${l}${c?r.wrapHeadsWith:""}${a[e]}${c?r.wrapTailsWith:""}`}else if(Array.isArray(a[e])&&a[e].length&&a[e].every(O)){let l="";r.mergeArraysWithLineBreaks&&h.length&&(l=`<br${r.xhtml?" /":""}>`),h=a[e].reduce((u,t,o,n)=>{let f="";return o!==n.length-1&&(f=" "),u+(o===0?l:"")+(c?r.wrapHeadsWith:"")+t+(c?r.wrapTailsWith:"")+f},h)}}else h=a.reduce((e,s,l,u)=>{let t="";r.mergeArraysWithLineBreaks&&l>0&&(t=`<br${r.xhtml?" /":""}>`);let o="";return l!==u.length-1&&(o=" "),`${e}${l===0?t:""}${c?r.wrapHeadsWith:""}${s}${c?r.wrapTailsWith:""}${o}`},h);return h}var V=T;function B(p,d,c){if(!b(p))throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_01] the first input argument must be a plain object! It was given as ${$(p,4)} (its typeof was ${typeof p}).`);if(!b(d))throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_02] the second input argument must be a plain object! It was given as ${$(d,4)} (its typeof was ${typeof d}).`);if(c&&!b(c))throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_03] the third input argument must be a plain object! It was given as ${$(c,4)} (its typeof was ${typeof c}).`);let i={...W,...c};i.dontWrapKeys=v(i.dontWrapKeys),i.preventWrappingIfContains=v(i.preventWrappingIfContains),i.dontWrapPaths=v(i.dontWrapPaths),i.ignore=v(i.ignore),typeof i.whatToDoWhenReferenceIsMissing!="number"&&(i.whatToDoWhenReferenceIsMissing=+i.whatToDoWhenReferenceIsMissing||0);function r(a,h,e,s=!0,l=!0,u=""){let t=a,o=h;return e.wrapGlobalFlipSwitch||(s=!1),b(t)?Object.keys(t).forEach(n=>{let f=u+(u.length===0?n:`.${n}`);if(e.ignore.length===0||!e.ignore.includes(n)){if(e.wrapGlobalFlipSwitch&&(s=!0,e.dontWrapKeys.length&&(s=s&&!e.dontWrapKeys.some(g=>A(n,g,{caseSensitiveMatch:!0}))),e.dontWrapPaths.length&&(s=s&&!e.dontWrapPaths.some(g=>g===f)),e.preventWrappingIfContains.length&&typeof t[n]=="string"&&(s=s&&!e.preventWrappingIfContains.some(g=>t[n].includes(g)))),w(o[n])||!w(o[n])&&e.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(t[n]))if(e.whatToDoWhenReferenceIsMissing===2||m(o[n]))t[n]=y(t[n],e,s,l);else{if(t[n].every(g=>typeof g=="string"||Array.isArray(g))){let g=!0;t[n].forEach(I=>{Array.isArray(I)&&!I.every(m)&&(g=!1)}),g&&(l=!1)}t[n]=r(t[n],o[n],e,s,l,f)}else b(t[n])?e.whatToDoWhenReferenceIsMissing===2||m(o[n])?t[n]=y(j(t[n],e),e,s,l):s?t[n]=r(t[n],o[n],e,s,l,f):t[n]=r(t[n],o[n],{...e,wrapGlobalFlipSwitch:!1},s,l,f):m(t[n])&&(t[n]=r(t[n],o[n],e,s,l,f));else if(typeof t[n]!=typeof o[n]&&e.whatToDoWhenReferenceIsMissing===1)throw new Error(`object-flatten-referencing/flattenReferencing(): [THROW_ID_04] resolvedReference object does not have the key ${n} and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing.`)}}):Array.isArray(t)?Array.isArray(o)?t.forEach((n,f)=>{w(t[f])&&w(o[f])?t[f]=r(t[f],o[f],e,s,l,`${u}[${f}]`):t[f]=r(t[f],o[0],e,s,l,`${u}[${f}]`)}):m(o)&&(t=y(t,e,s,l)):m(t)&&t.length&&(e.wrapHeadsWith||e.wrapTailsWith)&&(!e.preventDoubleWrapping||(e.wrapHeadsWith===""||!C(t,e.wrapHeadsWith.trim()).length)&&(e.wrapTailsWith===""||!C(t,e.wrapTailsWith.trim()).length))&&(t=`${s?e.wrapHeadsWith:""}${t}${s?e.wrapTailsWith:""}`),t}return r(S(p),d,i)}export{v as arrayiffy,W as defaults,y as flattenArr,j as flattenObject,B as flattenReferencing,V as version};
@@ -1,25 +1,17 @@
1
1
  /**
2
2
  * @name object-flatten-referencing
3
3
  * @fileoverview Flatten complex nested objects according to a reference objects
4
- * @version 7.1.3
4
+ * @version 7.2.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/object-flatten-referencing/}
8
8
  */
9
9
 
10
- "use strict";var objectFlattenReferencing=(()=>{var X=Object.create,P=Object.freeze,A=Object.defineProperty,Y=Object.defineProperties,U=Object.getOwnPropertyDescriptor,ee=Object.getOwnPropertyDescriptors,re=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols,te=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var _=(e,n,s)=>n in e?A(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s,b=(e,n)=>{for(var s in n||(n={}))R.call(n,s)&&_(e,s,n[s]);if(B)for(var s of B(n))ne.call(n,s)&&_(e,s,n[s]);return e},M=(e,n)=>Y(e,ee(n));var ie=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),se=(e,n)=>{for(var s in n)A(e,s,{get:n[s],enumerable:!0})},L=(e,n,s,f)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of re(n))!R.call(e,o)&&o!==s&&A(e,o,{get:()=>n[o],enumerable:!(f=U(n,o))||f.enumerable});return e};var C=(e,n,s)=>(s=e!=null?X(te(e)):{},L(n||!e||!e.__esModule?A(s,"default",{value:e,enumerable:!0}):s,e)),ae=e=>L(A({},"__esModule",{value:!0}),e);var W=(e,n)=>P(A(e,"raw",{value:P(n||e.slice())}));var v=ie((be,H)=>{"use strict";H.exports=oe;function w(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function oe(e){if(e=e||{},e.circles)return le(e);let n=new Map;if(n.set(Date,l=>new Date(l)),n.set(Map,(l,t)=>new Map(f(Array.from(l),t))),n.set(Set,(l,t)=>new Set(f(Array.from(l),t))),e.constructorHandlers)for(let l of e.constructorHandlers)n.set(l[0],l[1]);let s=null;return e.proto?c:o;function f(l,t){let r=Object.keys(l),a=new Array(r.length);for(let g=0;g<r.length;g++){let i=r[g],p=l[i];typeof p!="object"||p===null?a[i]=p:p.constructor!==Object&&(s=n.get(p.constructor))?a[i]=s(p,t):ArrayBuffer.isView(p)?a[i]=w(p):a[i]=t(p)}return a}function o(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return f(l,o);if(l.constructor!==Object&&(s=n.get(l.constructor)))return s(l,o);let t={};for(let r in l){if(Object.hasOwnProperty.call(l,r)===!1)continue;let a=l[r];typeof a!="object"||a===null?t[r]=a:a.constructor!==Object&&(s=n.get(a.constructor))?t[r]=s(a,o):ArrayBuffer.isView(a)?t[r]=w(a):t[r]=o(a)}return t}function c(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return f(l,c);if(l.constructor!==Object&&(s=n.get(l.constructor)))return s(l,c);let t={};for(let r in l){let a=l[r];typeof a!="object"||a===null?t[r]=a:a.constructor!==Object&&(s=n.get(a.constructor))?t[r]=s(a,c):ArrayBuffer.isView(a)?t[r]=w(a):t[r]=c(a)}return t}}function le(e){let n=[],s=[],f=new Map;if(f.set(Date,r=>new Date(r)),f.set(Map,(r,a)=>new Map(c(Array.from(r),a))),f.set(Set,(r,a)=>new Set(c(Array.from(r),a))),e.constructorHandlers)for(let r of e.constructorHandlers)f.set(r[0],r[1]);let o=null;return e.proto?t:l;function c(r,a){let g=Object.keys(r),i=new Array(g.length);for(let p=0;p<g.length;p++){let u=g[p],h=r[u];if(typeof h!="object"||h===null)i[u]=h;else if(h.constructor!==Object&&(o=f.get(h.constructor)))i[u]=o(h,a);else if(ArrayBuffer.isView(h))i[u]=w(h);else{let d=n.indexOf(h);d!==-1?i[u]=s[d]:i[u]=a(h)}}return i}function l(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return c(r,l);if(r.constructor!==Object&&(o=f.get(r.constructor)))return o(r,l);let a={};n.push(r),s.push(a);for(let g in r){if(Object.hasOwnProperty.call(r,g)===!1)continue;let i=r[g];if(typeof i!="object"||i===null)a[g]=i;else if(i.constructor!==Object&&(o=f.get(i.constructor)))a[g]=o(i,l);else if(ArrayBuffer.isView(i))a[g]=w(i);else{let p=n.indexOf(i);p!==-1?a[g]=s[p]:a[g]=l(i)}}return n.pop(),s.pop(),a}function t(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return c(r,t);if(r.constructor!==Object&&(o=f.get(r.constructor)))return o(r,t);let a={};n.push(r),s.push(a);for(let g in r){let i=r[g];if(typeof i!="object"||i===null)a[g]=i;else if(i.constructor!==Object&&(o=f.get(i.constructor)))a[g]=o(i,t);else if(ArrayBuffer.isView(i))a[g]=w(i);else{let p=n.indexOf(i);p!==-1?a[g]=s[p]:a[g]=t(i)}}return n.pop(),s.pop(),a}}});var he={};se(he,{arrayiffy:()=>O,defaults:()=>x,flattenArr:()=>S,flattenObject:()=>$,flattenReferencing:()=>ge,version:()=>pe});var Z=C(v(),1);function T(e,n,s=0){if(typeof e!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): first input argument must be a string! Currently it's: ".concat(typeof e));if(typeof n!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): second input argument must be a string! Currently it's: ".concat(typeof n));if(isNaN(+s)||typeof s=="string"&&!/^\d*$/.test(s))throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): third input argument must be a natural number! Currently it's: ".concat(s));let f=Array.from(e),o=Array.from(n);if(f.length===0||o.length===0||s!=null&&+s>=f.length)return[];s||(s=0);let c=[],l=!1,t;for(let r=s,a=f.length;r<a;r++)l&&(f[r]===o[r-+t]?r-+t+1===o.length&&c.push(+t):(t=null,l=!1)),l||f[r]===o[0]&&(o.length===1?c.push(r):(l=!0,t=r));return c}function D(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var I=new Map,N=(e,n)=>{if(!Array.isArray(e))switch(typeof e){case"string":{e=[e];break}case"undefined":{e=[];break}default:throw new TypeError("Expected '".concat(n,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(s=>{if(typeof s!="string"){if(s===void 0)return!1;throw new TypeError("Expected '".concat(n,"' to be an array of strings, but found a type of '").concat(typeof s,"' in the array"))}return!0})},K,F,J,fe=(e,n)=>{n=b({caseSensitive:!1},n);let s="s"+(n.caseSensitive?"":"i"),f=e+"|"+s;if(I.has(f))return I.get(f);let o=e[0]==="!";o&&(e=e.slice(1)),e=e.replaceAll(String.raw(K||(K=W(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=D(e).replaceAll(String.raw(F||(F=W(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(J||(J=W(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let c=new RegExp("^".concat(e,"$"),s);return c.negated=o,I.set(f,c),c},ce=(e,n,s,f)=>{if(e=N(e,"inputs"),n=N(n,"patterns"),n.length===0)return[];n=n.map(r=>fe(r,s));let o=n.filter(r=>r.negated),c=n.filter(r=>!r.negated),{allPatterns:l}=s||{},t=[];if(l&&f&&o.length>1&&c.length===0){for(let r of e)for(let a of o)if(a.test(r))return[];return e.slice(0,1)}for(let r of e){let a=!1;for(let g of o)if(g.test(r)){a=!0;break}if(!a){if(c.length===0)t.push(r);else if(l){let g=Array.from({length:c.length},()=>!1);for(let[i,p]of c.entries())p.test(r)&&(g[i]=!0);g.every(Boolean)&&t.push(r)}else{let g=!1;for(let i of c)if(i.test(r)){g=!0;break}g&&t.push(r)}if(f&&t.length>0)break}}return t};function V(e,n,s){return ce(e,n,s,!0).length>0}function O(e){return typeof e!="string"?e:e.length?[e]:[]}var G=C(v(),1);var xe=(0,G.default)();function y(e){if(e==null||typeof e!="object")return!1;let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&Object.getPrototypeOf(n)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function m(e){return typeof e=="string"}function j(e){return e!=null}var Q=C(v(),1);var k=(0,Q.default)(),x={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function $(e,n){let s=b(b({},x),n);if(arguments.length===0||Object.keys(e).length===0)return[];let f=k(e),o=[];return y(f)&&Object.keys(f).forEach(c=>{y(f[c])&&(f[c]=$(f[c],s)),Array.isArray(f[c])&&(o=o.concat(f[c].map(l=>"".concat(c).concat(s.objectKeyAndValueJoinChar).concat(l)))),m(f[c])&&o.push("".concat(c).concat(s.objectKeyAndValueJoinChar).concat(f[c]))}),o}function S(e,n,s=!1,f=!1){let o=b(b({},x),n);if(arguments.length===0||e.length===0)return"";let c=k(e),l="";if(c.length)if(f){for(let t=0,r=c.length;t<r;t++)if(m(c[t])){let a;a="",o.mergeArraysWithLineBreaks&&t>0&&(!o.mergeWithoutTrailingBrIfLineContainsBr||typeof c[t-1]!="string"||o.mergeWithoutTrailingBrIfLineContainsBr&&c[t-1]!==void 0&&!c[t-1].toLowerCase().includes("<br"))&&(a="<br".concat(o.xhtml?" /":"",">")),l+="".concat(a).concat(s?o.wrapHeadsWith:"").concat(c[t]).concat(s?o.wrapTailsWith:"")}else if(Array.isArray(c[t])&&c[t].length&&c[t].every(m)){let a="";o.mergeArraysWithLineBreaks&&l.length&&(a="<br".concat(o.xhtml?" /":"",">")),l=c[t].reduce((g,i,p,u)=>{let h="";return p!==u.length-1&&(h=" "),g+(p===0?a:"")+(s?o.wrapHeadsWith:"")+i+(s?o.wrapTailsWith:"")+h},l)}}else l=c.reduce((t,r,a,g)=>{let i="";o.mergeArraysWithLineBreaks&&a>0&&(i="<br".concat(o.xhtml?" /":"",">"));let p="";return a!==g.length-1&&(p=" "),"".concat(t).concat(a===0?i:"").concat(s?o.wrapHeadsWith:"").concat(r).concat(s?o.wrapTailsWith:"").concat(p)},l);return l}var q="7.1.3";var z=(0,Z.default)(),pe=q;function ge(e,n,s){if(!y(e))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_01] the first input argument must be a plain object! It was given as ".concat(JSON.stringify(e,null,4)," (its typeof was ").concat(typeof e,")."));if(!y(n))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_02] the second input argument must be a plain object! It was given as ".concat(JSON.stringify(n,null,4)," (its typeof was ").concat(typeof n,")."));if(s&&!y(s))throw new Error("object-flatten-referencing/ofr(): [THROW_ID_03] the third input argument must be a plain object! It was given as ".concat(JSON.stringify(s,null,4)," (its typeof was ").concat(typeof s,")."));let f=b(b({},x),s);f.dontWrapKeys=O(f.dontWrapKeys),f.preventWrappingIfContains=O(f.preventWrappingIfContains),f.dontWrapPaths=O(f.dontWrapPaths),f.ignore=O(f.ignore),typeof f.whatToDoWhenReferenceIsMissing!="number"&&(f.whatToDoWhenReferenceIsMissing=+f.whatToDoWhenReferenceIsMissing||0);function o(c,l,t,r=!0,a=!0,g=""){let i=z(c),p=z(l);return t.wrapGlobalFlipSwitch||(r=!1),y(i)?Object.keys(i).forEach(u=>{let h=g+(g.length===0?u:".".concat(u));if(t.ignore.length===0||!t.ignore.includes(u)){if(t.wrapGlobalFlipSwitch&&(r=!0,t.dontWrapKeys.length&&(r=r&&!t.dontWrapKeys.some(d=>V(u,d,{caseSensitive:!0}))),t.dontWrapPaths.length&&(r=r&&!t.dontWrapPaths.some(d=>d===h)),t.preventWrappingIfContains.length&&typeof i[u]=="string"&&(r=r&&!t.preventWrappingIfContains.some(d=>i[u].includes(d)))),j(p[u])||!j(p[u])&&t.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(i[u]))if(t.whatToDoWhenReferenceIsMissing===2||m(p[u]))i[u]=S(i[u],t,r,a);else{if(i[u].every(d=>typeof d=="string"||Array.isArray(d))){let d=!0;i[u].forEach(E=>{Array.isArray(E)&&!E.every(m)&&(d=!1)}),d&&(a=!1)}i[u]=o(i[u],p[u],t,r,a,h)}else y(i[u])?t.whatToDoWhenReferenceIsMissing===2||m(p[u])?i[u]=S($(i[u],t),t,r,a):r?i[u]=o(i[u],p[u],t,r,a,h):i[u]=o(i[u],p[u],M(b({},t),{wrapGlobalFlipSwitch:!1}),r,a,h):m(i[u])&&(i[u]=o(i[u],p[u],t,r,a,h));else if(typeof i[u]!=typeof p[u]&&t.whatToDoWhenReferenceIsMissing===1)throw new Error("object-flatten-referencing/ofr(): [THROW_ID_06] resolvedReference object does not have the key ".concat(u," and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing."))}}):Array.isArray(i)?Array.isArray(p)?i.forEach((u,h)=>{j(i[h])&&j(p[h])?i[h]=o(i[h],p[h],t,r,a,"".concat(g,"[").concat(h,"]")):i[h]=o(i[h],p[0],t,r,a,"".concat(g,"[").concat(h,"]"))}):m(p)&&(i=S(i,t,r,a)):m(i)&&i.length&&(t.wrapHeadsWith||t.wrapTailsWith)&&(!t.preventDoubleWrapping||(t.wrapHeadsWith===""||!T(i,t.wrapHeadsWith.trim()).length)&&(t.wrapTailsWith===""||!T(i,t.wrapTailsWith.trim()).length))&&(i="".concat(r?t.wrapHeadsWith:"").concat(i).concat(r?t.wrapTailsWith:"")),i}return o(e,n,f)}return ae(he);})();
11
- /**
12
- * @name str-indexes-of-plus
13
- * @fileoverview Like indexOf but returns array and counts per-grapheme
14
- * @version 5.1.3
15
- * @author Roy Revelt
16
- * @license MIT
17
- * {@link https://codsen.com/os/str-indexes-of-plus/}
18
- */
10
+ "use strict";var objectFlattenReferencing=(()=>{var T=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var E=(e,r,t)=>r in e?T(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,W=(e,r)=>{for(var t in r||(r={}))K.call(r,t)&&E(e,t,r[t]);if(k)for(var t of k(r))le.call(r,t)&&E(e,t,r[t]);return e},V=(e,r)=>re(e,ie(r));var ae=(e,r)=>{for(var t in r)T(e,t,{get:r[t],enumerable:!0})},oe=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of se(r))!K.call(e,s)&&s!==t&&T(e,s,{get:()=>r[s],enumerable:!(n=ne(r,s))||n.enumerable});return e};var ue=e=>oe(T({},"__esModule",{value:!0}),e);var $=(e,r,t)=>E(e,typeof r!="symbol"?r+"":r,t);var Ie={};ae(Ie,{arrayiffy:()=>C,defaults:()=>j,flattenArr:()=>D,flattenObject:()=>L,flattenReferencing:()=>Se,version:()=>$e});function C(e){return typeof e!="string"?e:e.length?[e]:[]}function fe(){let e=[],r=0,t=!1;return{append(n){return t?!1:r+n.length>1999?(e.push("\u2026"),r+=1,t=!0,!1):(e.push(n),r+=n.length,!0)},result(){return e.join("")},stopped(){return t}}}function ce(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function P(e,r){if(e.append('"')){for(let t=0;t<r.length&&!e.stopped();t+=1){let n=r.charCodeAt(t);n===34?e.append('\\"'):n===92?e.append("\\\\"):n===8?e.append("\\b"):n===9?e.append("\\t"):n===10?e.append("\\n"):n===12?e.append("\\f"):n===13?e.append("\\r"):n<32||n===8232||n===8233||n>=55296&&n<=57343?e.append(ce(n)):e.append(r[t])}e.append('"')}}function pe(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function U(e,r){e.append("Symbol(");let t=String(r);t.length>8&&P(e,t.slice(7,-1)),e.append(")")}function J(e,r){typeof r=="symbol"?U(e,r):P(e,String(r))}function B(e,r=0){let t=fe(),n=r===4?4:0,s=new WeakSet,i=0;function a(o){n&&t.append(" ".repeat(o*n))}function l(o,g){o&&t.append(","),n&&(t.append("\n"),a(g+1))}function u(o,g,m){n&&g&&(t.append("\n"),a(m)),t.append(o)}function f(o,g){Object.prototype.hasOwnProperty.call(o,"value")?p(o.value,g):t.append(pe(o))}function d(o,g){let m;try{m=Reflect.getOwnPropertyDescriptor(o,"length")}catch(b){t.append("[Uninspectable]");return}let y=m==null?void 0:m.value;if(!Number.isSafeInteger(y)||y<0){t.append("[Uninspectable]");return}t.append("[");let v=!1;for(let b=0;b<y&&!t.stopped();b+=1){if(l(v,g),v=!0,i>=50){t.append("[MaxEntries]");break}i+=1;let O;try{O=Reflect.getOwnPropertyDescriptor(o,String(b))}catch(je){t.append("[Uninspectable]");continue}O!=null&&O.enumerable?f(O,g+1):t.append("[Empty]")}u("]",v,g)}function c(o,g){let m;try{m=Reflect.ownKeys(o)}catch(v){t.append("[Uninspectable]");return}t.append("{");let y=!1;for(let v of m){if(t.stopped())break;if(i>=50){l(y,g),y=!0,P(t,"\u2026"),t.append(n?": ":":"),t.append("[MaxEntries]");break}i+=1;let b;try{b=Reflect.getOwnPropertyDescriptor(o,v)}catch(O){l(y,g),y=!0,J(t,v),t.append(n?": ":":"),t.append("[Uninspectable]");continue}b!=null&&b.enumerable&&(l(y,g),y=!0,J(t,v),t.append(n?": ":":"),f(b,g+1))}u("}",y,g)}function h(o,g){if(s.has(o)){t.append("[Circular]");return}if(g>=5){t.append("[MaxDepth]");return}let m;try{m=Array.isArray(o)}catch(y){t.append("[Uninspectable]");return}s.add(o);try{m?d(o,g):c(o,g)}finally{s.delete(o)}}function p(o,g){o===null?t.append("null"):typeof o=="string"?P(t,o):typeof o=="number"?t.append(Object.is(o,-0)?"-0":String(o)):typeof o=="boolean"?t.append(o?"true":"false"):typeof o>"u"?t.append("undefined"):typeof o=="bigint"?t.append("".concat(o,"n")):typeof o=="symbol"?U(t,o):typeof o=="function"?t.append("[Function]"):h(o,g)}try{return p(e,0),t.result()}catch(o){return"[Uninspectable]"}}var Re=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var he=class{constructor(){$(this,"hasRepeatedReferences",!1);$(this,"clones",[]);$(this,"index");$(this,"sources",[])}get(e){if(this.index){let t=this.index.get(e);return t!==void 0&&(this.hasRepeatedReferences=!0),t}let r=this.sources.indexOf(e);if(r!==-1)return this.hasRepeatedReferences=!0,this.clones[r]}set(e,r){if(this.index){this.index.set(e,r);return}if(this.sources.push(e),this.clones.push(r),this.sources.length===32){this.index=new WeakMap;for(let t=0;t<this.sources.length;t++)this.index.set(this.sources[t],this.clones[t]);this.sources=[],this.clones=[]}}};function Q(e,r){let t=r.get(e);if(t!==void 0)return t;let n=e.slice(0);return r.set(e,n),n}function ge(e,r){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let i=Buffer.from(e);return r.set(e,i),i}let t=Q(e.buffer,r);if(e instanceof DataView){let i=new DataView(t,e.byteOffset,e.byteLength);return r.set(e,i),i}let n=e.constructor,s=new n(t,e.byteOffset,e.length);return r.set(e,s),s}function _(e,r,t,n){for(let s of t){let i=r[s];e[s]=typeof i!="object"||i===null?i:x(i,n)}}function x(e,r){if(typeof e!="object"||e===null)return e;let t=r.get(e);if(t!==void 0)return t;if(Array.isArray(e)){let i=e.length,a=new Array(i);r.set(e,a);let l=e,u=Object.keys(e);if(u.length===i&&(i===0||u[i-1]==="".concat(i-1)))for(let f=0;f<i;f++){let d=l[f];a[f]=typeof d!="object"||d===null?d:x(d,r)}else _(a,l,u,r);return a}let n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){let i={};return r.set(e,i),_(i,e,Object.keys(e),r),i}if(e instanceof Date){let i=new Date(e.getTime());return r.set(e,i),i}if(ArrayBuffer.isView(e))return ge(e,r);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return Q(e,r);if(e instanceof Map){let i=new Map;r.set(e,i);for(let[a,l]of e)i.set(x(a,r),x(l,r));return i}if(e instanceof Set){let i=new Set;r.set(e,i);for(let a of e)i.add(x(a,r));return i}let s={};return r.set(e,s),_(s,e,Object.keys(e),r),s}function S(e){return x(e,new he)}function A(e){if(e==null||typeof e!="object")return!1;let r=Object.getPrototypeOf(e);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function w(e){return typeof e=="string"}function I(e){return e!=null}var de=256,me=1024,be=1,ye=new Map,ve=new Map;function H(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let r=String.fromCharCode(e).toUpperCase();if(r.length!==1)return e;let t=r.charCodeAt(0);return e>127&&t<128?e:t}function F(e,r,t,n,s,i){for(let a=0;a<s;a++){let l=e.charCodeAt(r+a),u=t.charCodeAt(n+a);if(i||(l>=97&&l<=122&&(l-=32),u>=97&&u<=122&&(u-=32)),l!==u)return!1}return!0}function z(e,r,t){let n=r.indexOf("\\");if(n===-1&&e===r)return!0;let s=r.indexOf("*");if(n===-1&&s===-1){if(t)return!1;for(let d=0;d<r.length;d++)if(r.charCodeAt(d)>127)return;return e.length===r.length&&F(e,0,r,0,r.length,!1)}if(n!==-1)return;let i=0,a=!1,l=-1;for(let d=0;d<r.length;d++){let c=r.charCodeAt(d);if(c>127)return;if(c===42){if(l=d,!a){if(i++,i>1)return;a=!0}}else a=!1}let u=l+1,f=r.length-u;return e.length<s+f?!1:F(e,0,r,0,s,t)&&F(e,e.length-f,r,u,f,t)}function we(e){let r=new Uint32Array(e.length),t=0;for(let n=1;n<e.length;n++){for(;t>0&&e[n]!==e[t];)t=r[t-1];e[n]===e[t]&&t++,r[n]=t}return r}function We(e,r){let t=[[]],n=!0,s=!1,i=!1,a=0;for(let h=0;h<e.length;){let p=e.codePointAt(h);if(p!==92){if(p===42)s=!0,i||(t.push([]),i=!0);else{let b=r?p:H(p);t[t.length-1].push(b),n&&(n=b<=127),a++,i=!1}h+=p>65535?2:1;continue}let o=h+1;for(;e.charCodeAt(o)===92;)o++;let g=o-h,m=e.codePointAt(o),y,v=!1;m===42?(v=g%2===0,y=v?g/2:(g-1)/2):m===void 0||m===10||m===13||m===8232||m===8233?y=Math.ceil(g/2):y=Math.floor(g/2);for(let b=0;b<y;b++)t[t.length-1].push(92),a++;if(v){i=!1,h=o;continue}if(m!==void 0){let b=r?m:H(m);t[t.length-1].push(b),n&&(n=b<=127),a++,o+=m>65535?2:1}i=!1,h=o}let l=s&&t[0].length===0,u=s&&t[t.length-1].length===0,f=[];for(let h of t)h.length&&f.push({values:h});let d=l?0:1,c=f.length-(u?0:1);for(let h=d;h<c;h++)f[h].values.length>be&&(f[h].failure=we(f[h].values));return{asciiOnly:n,endsWithWildcard:u,hasWildcard:s,minimumInputLength:a,segments:f,startsWithWildcard:l}}function Z(e,r){let t=r?ye:ve,n=e.length<=me;if(n){let i=t.get(e);if(i)return i}let s=We(e,r);if(n){if(t.size>=de){let i=t.keys().next().value;i!==void 0&&t.delete(i)}t.set(e,s)}return s}function q(e,r){if(r){let s=[];for(let i=0;i<e.length;){let a=e.codePointAt(i);s.push(a),i+=a>65535?2:1}return s}let t=new Uint32Array(e.length),n=0;for(let s=0;s<e.length;){let i=e.codePointAt(s);t[n]=H(i),n++,s+=i>65535?2:1}return n===t.length?t:t.subarray(0,n)}function R(e,r,t,n){for(let s=0;s<t.values.length;s++){let i=e.charCodeAt(r+s);if(!n&&i>=97&&i<=122&&(i-=32),i!==t.values[s])return!1}return!0}function Ae(e,r,t,n,s){let i=n-r.values.length;if(i<t)return-1;if(!r.failure){for(let l=t;l<=i;l++)if(R(e,l,r,s))return l;return-1}let a=0;for(let l=t;l<n;l++){let u=e.charCodeAt(l);for(!s&&u>=97&&u<=122&&(u-=32);a>0&&u!==r.values[a];)a=r.failure[a-1];if(u===r.values[a]&&(a++,a===r.values.length))return l-a+1}return-1}function Y(e,r,t){if(e.length<r.minimumInputLength)return!1;if(!r.hasWildcard)return e.length===r.minimumInputLength&&R(e,0,r.segments[0],t);let n=0,s=r.segments.length,i=0,a=e.length;if(!r.startsWithWildcard){let l=r.segments[0];if(!R(e,0,l,t))return!1;i=l.values.length,n++}if(!r.endsWithWildcard){s--;let l=r.segments[s];if(a-=l.values.length,!R(e,a,l,t))return!1}for(let l=n;l<s;l++){let u=r.segments[l],f=Ae(e,u,i,a,t);if(f===-1)return!1;i=f+u.values.length}return!0}function M(e,r,t){for(let n=0;n<t.values.length;n++)if(e[r+n]!==t.values[n])return!1;return!0}function Oe(e,r,t,n){let s=n-r.values.length;if(s<t)return-1;if(!r.failure){for(let a=t;a<=s;a++)if(M(e,a,r))return a;return-1}let i=0;for(let a=t;a<n;a++){for(;i>0&&e[a]!==r.values[i];)i=r.failure[i-1];if(e[a]===r.values[i]&&(i++,i===r.values.length))return a-i+1}return-1}function X(e,r){if(e.length<r.minimumInputLength)return!1;if(!r.hasWildcard)return e.length===r.minimumInputLength&&M(e,0,r.segments[0]);let t=0,n=r.segments.length,s=0,i=e.length;if(!r.startsWithWildcard){let a=r.segments[0];if(!M(e,0,a))return!1;s=a.values.length,t++}if(!r.endsWithWildcard){n--;let a=r.segments[n];if(i-=a.values.length,!M(e,i,a))return!1}for(let a=t;a<n;a++){let l=r.segments[a],u=Oe(e,l,s,i);if(u===-1)return!1;s=u+l.values.length}return!0}function Ce(e,r,t){let n=z(e,r,t);if(n!==void 0)return n;let s=Z(r,t);return s.asciiOnly?Y(e,s,t):X(q(e,t),s)}function G(e,r,t,n){var a;let s=z(e,r,t);if(s!==void 0)return s;let i=Z(r,t);return i.asciiOnly?Y(e,i,t):((a=n.tokens)!=null||(n.tokens=q(e,t)),X(n.tokens,i))}function ee(e,r,t){if(typeof r!="string"&&!r.length)return!1;let n=t===void 0?!1:t.caseSensitiveMatch===!0;if(typeof r=="string"){let l=r.charCodeAt(0)===33,u=l?r.slice(1):r,f=Ce(e,u,n);return l?!f:f}let s={},i=!1,a=!1;for(let l of r){let u=l.charCodeAt(0)===33,f=u?l.slice(1):l;if(u){if(G(e,f,n,s))return!1}else i=!0,!a&&G(e,f,n,s)&&(a=!0)}return i?a:!0}function N(e,r,t=0){if(typeof e!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_01] first input argument must be a string! Currently it's: ".concat(typeof e));if(typeof r!="string")throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_02] second input argument must be a string! Currently it's: ".concat(typeof r));let n=Number(t);if(!Number.isInteger(n)||n<0||typeof t=="string"&&!/^\d+$/.test(t))throw new TypeError("str-indexes-of-plus/strIndexesOfPlus(): [THROW_ID_03] third input argument must be a natural number! Currently it's: ".concat(t));let s=Array.from(e),i=Array.from(r);if(!s.length||!i.length||n>=s.length)return[];let a=[],l=s.length-i.length;e:for(let u=n;u<=l;u++){for(let f=0;f<i.length;f++)if(s[u+f]!==i[f])continue e;a.push(u)}return a}var te="7.2.0";var j={wrapHeadsWith:"%%_",wrapTailsWith:"_%%",dontWrapKeys:[],dontWrapPaths:[],xhtml:!0,preventDoubleWrapping:!0,preventWrappingIfContains:[],objectKeyAndValueJoinChar:".",wrapGlobalFlipSwitch:!0,ignore:[],whatToDoWhenReferenceIsMissing:0,mergeArraysWithLineBreaks:!0,mergeWithoutTrailingBrIfLineContainsBr:!0,enforceStrictKeyset:!0};function L(e,r){let t=W(W({},j),r);if(!e||Object.keys(e).length===0)return[];let n=S(e),s=[];return A(n)&&Object.keys(n).forEach(i=>{A(n[i])&&(n[i]=L(n[i],t)),Array.isArray(n[i])&&(s=s.concat(n[i].map(a=>"".concat(i).concat(t.objectKeyAndValueJoinChar).concat(a)))),w(n[i])&&s.push("".concat(i).concat(t.objectKeyAndValueJoinChar).concat(n[i]))}),s}function D(e,r,t=!1,n=!1){let s=W(W({},j),r);if(!e||e.length===0)return"";let i=S(e),a="";if(i.length)if(n){for(let l=0,u=i.length;l<u;l++)if(w(i[l])){let f;f="",s.mergeArraysWithLineBreaks&&l>0&&(!s.mergeWithoutTrailingBrIfLineContainsBr||typeof i[l-1]!="string"||s.mergeWithoutTrailingBrIfLineContainsBr&&i[l-1]!==void 0&&!i[l-1].toLowerCase().includes("<br"))&&(f="<br".concat(s.xhtml?" /":"",">")),a+="".concat(f).concat(t?s.wrapHeadsWith:"").concat(i[l]).concat(t?s.wrapTailsWith:"")}else if(Array.isArray(i[l])&&i[l].length&&i[l].every(w)){let f="";s.mergeArraysWithLineBreaks&&a.length&&(f="<br".concat(s.xhtml?" /":"",">")),a=i[l].reduce((d,c,h,p)=>{let o="";return h!==p.length-1&&(o=" "),d+(h===0?f:"")+(t?s.wrapHeadsWith:"")+c+(t?s.wrapTailsWith:"")+o},a)}}else a=i.reduce((l,u,f,d)=>{let c="";s.mergeArraysWithLineBreaks&&f>0&&(c="<br".concat(s.xhtml?" /":"",">"));let h="";return f!==d.length-1&&(h=" "),"".concat(l).concat(f===0?c:"").concat(t?s.wrapHeadsWith:"").concat(u).concat(t?s.wrapTailsWith:"").concat(h)},a);return a}var $e=te;function Se(e,r,t){if(!A(e))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_01] the first input argument must be a plain object! It was given as ".concat(B(e,4)," (its typeof was ").concat(typeof e,")."));if(!A(r))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_02] the second input argument must be a plain object! It was given as ".concat(B(r,4)," (its typeof was ").concat(typeof r,")."));if(t&&!A(t))throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_03] the third input argument must be a plain object! It was given as ".concat(B(t,4)," (its typeof was ").concat(typeof t,")."));let n=W(W({},j),t);n.dontWrapKeys=C(n.dontWrapKeys),n.preventWrappingIfContains=C(n.preventWrappingIfContains),n.dontWrapPaths=C(n.dontWrapPaths),n.ignore=C(n.ignore),typeof n.whatToDoWhenReferenceIsMissing!="number"&&(n.whatToDoWhenReferenceIsMissing=+n.whatToDoWhenReferenceIsMissing||0);function s(i,a,l,u=!0,f=!0,d=""){let c=i,h=a;return l.wrapGlobalFlipSwitch||(u=!1),A(c)?Object.keys(c).forEach(p=>{let o=d+(d.length===0?p:".".concat(p));if(l.ignore.length===0||!l.ignore.includes(p)){if(l.wrapGlobalFlipSwitch&&(u=!0,l.dontWrapKeys.length&&(u=u&&!l.dontWrapKeys.some(g=>ee(p,g,{caseSensitiveMatch:!0}))),l.dontWrapPaths.length&&(u=u&&!l.dontWrapPaths.some(g=>g===o)),l.preventWrappingIfContains.length&&typeof c[p]=="string"&&(u=u&&!l.preventWrappingIfContains.some(g=>c[p].includes(g)))),I(h[p])||!I(h[p])&&l.whatToDoWhenReferenceIsMissing===2)if(Array.isArray(c[p]))if(l.whatToDoWhenReferenceIsMissing===2||w(h[p]))c[p]=D(c[p],l,u,f);else{if(c[p].every(g=>typeof g=="string"||Array.isArray(g))){let g=!0;c[p].forEach(m=>{Array.isArray(m)&&!m.every(w)&&(g=!1)}),g&&(f=!1)}c[p]=s(c[p],h[p],l,u,f,o)}else A(c[p])?l.whatToDoWhenReferenceIsMissing===2||w(h[p])?c[p]=D(L(c[p],l),l,u,f):u?c[p]=s(c[p],h[p],l,u,f,o):c[p]=s(c[p],h[p],V(W({},l),{wrapGlobalFlipSwitch:!1}),u,f,o):w(c[p])&&(c[p]=s(c[p],h[p],l,u,f,o));else if(typeof c[p]!=typeof h[p]&&l.whatToDoWhenReferenceIsMissing===1)throw new Error("object-flatten-referencing/flattenReferencing(): [THROW_ID_04] resolvedReference object does not have the key ".concat(p," and we need it. TIP: Turn off throwing via opts2.whatToDoWhenReferenceIsMissing."))}}):Array.isArray(c)?Array.isArray(h)?c.forEach((p,o)=>{I(c[o])&&I(h[o])?c[o]=s(c[o],h[o],l,u,f,"".concat(d,"[").concat(o,"]")):c[o]=s(c[o],h[0],l,u,f,"".concat(d,"[").concat(o,"]"))}):w(h)&&(c=D(c,l,u,f)):w(c)&&c.length&&(l.wrapHeadsWith||l.wrapTailsWith)&&(!l.preventDoubleWrapping||(l.wrapHeadsWith===""||!N(c,l.wrapHeadsWith.trim()).length)&&(l.wrapTailsWith===""||!N(c,l.wrapTailsWith.trim()).length))&&(c="".concat(u?l.wrapHeadsWith:"").concat(c).concat(u?l.wrapTailsWith:"")),c}return s(S(e),r,n)}return ue(Ie);})();
19
11
  /**
20
12
  * @name arrayiffy-if-string
21
13
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
22
- * @version 5.1.3
14
+ * @version 5.2.0
23
15
  * @author Roy Revelt
24
16
  * @license MIT
25
17
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -27,8 +19,16 @@
27
19
  /**
28
20
  * @name codsen-utils
29
21
  * @fileoverview Various utility functions
30
- * @version 1.7.3
22
+ * @version 1.8.0
31
23
  * @author Roy Revelt
32
24
  * @license MIT
33
25
  * {@link https://codsen.com/os/codsen-utils/}
34
26
  */
27
+ /**
28
+ * @name str-indexes-of-plus
29
+ * @fileoverview Like indexOf but returns array and counts per-grapheme
30
+ * @version 5.2.0
31
+ * @author Roy Revelt
32
+ * @license MIT
33
+ * {@link https://codsen.com/os/str-indexes-of-plus/}
34
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "object-flatten-referencing",
3
- "version": "7.1.3",
3
+ "version": "7.2.0",
4
4
  "description": "Flatten complex nested objects according to a reference objects",
5
5
  "keywords": [
6
6
  "advanced",
@@ -34,47 +34,44 @@
34
34
  },
35
35
  "types": "types/index.d.ts",
36
36
  "scripts": {
37
- "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
38
- "cjs-off": "exit 0",
39
- "cjs-on": "exit 0",
40
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
37
+ "build": "node ../../ops/scripts/esbuild.js && npm run dts",
38
+ "coverage": "c8 uvu test",
39
+ "dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
41
40
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
42
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
41
+ "dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
43
42
  "examples": "node '../../ops/scripts/run-examples.js'",
44
- "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
45
- "letspublish": "npm publish --provenance || :",
46
- "lint": "eslint . --fix --concurrency=auto --cache",
43
+ "lect": "node '../../ops/lect/lect.js'",
44
+ "lect:check": "node '../../ops/lect/lect.js' --check",
45
+ "lint": "biome lint --error-on-warnings . && npm run typecheck",
46
+ "lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
47
47
  "perf": "node perf/check.js",
48
48
  "prep": "echo 'ready'",
49
- "prettier": "prettier",
50
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
51
- "pretest": "npm run lect && npm run build",
49
+ "prettier": "biome format",
50
+ "prettier:format": "biome format --write .",
51
+ "pretest": "npm run lect:check && npm run build",
52
52
  "test": "npm run devtest",
53
+ "typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
53
54
  "unit": "uvu test"
54
55
  },
55
- "engines": {
56
- "node": ">=14.18.0"
57
- },
58
56
  "c8": {
57
+ "all": true,
59
58
  "check-coverage": true,
60
- "exclude": [
61
- "**/test/**/*.*"
62
- ],
59
+ "exclude": ["**/test/**/*.*"],
60
+ "include": ["dist/*.esm.js"],
63
61
  "lines": 100
64
62
  },
65
63
  "lect": {
66
64
  "licence": {
67
- "extras": [
68
- ""
69
- ]
65
+ "extras": [""]
70
66
  }
71
67
  },
72
68
  "dependencies": {
73
- "arrayiffy-if-string": "^5.1.3",
74
- "codsen-utils": "^1.7.3",
75
- "matcher": "^6.0.0",
76
- "rfdc": "^1.4.1",
77
- "str-indexes-of-plus": "^5.1.3"
69
+ "arrayiffy-if-string": "^5.2.0",
70
+ "codsen-utils": "^1.8.0",
71
+ "str-indexes-of-plus": "^5.2.0"
72
+ },
73
+ "engines": {
74
+ "node": ">=18.20.8"
78
75
  },
79
76
  "publishConfig": {
80
77
  "registry": "https://registry.npmjs.org/"