json-variables 12.1.3 → 12.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,6 +3,25 @@
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
+ ## 12.2.0 (2026-08-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
+ - normalise resolver validation errors ([f0cf7c7](https://github.com/codsen/codsen/commit/f0cf7c70ce3ae8d9df23cad425a424f2099dd9d1))
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))
14
+
15
+ ### Features
16
+
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
+ ### Reverts
21
+
22
+ - 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)
23
+ - 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)
24
+
6
25
  ## 12.1.0 (2025-10-15)
7
26
 
8
27
  ### Features
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 json-variables
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 { jVar } from "json-variables";
38
38
 
@@ -52,6 +52,7 @@ assert.deepEqual(
52
52
  );
53
53
  ```
54
54
 
55
+
55
56
  ## Documentation
56
57
 
57
58
  Please [visit codsen.com](https://codsen.com/os/json-variables/) 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/json-variables/CHANGELOG.md).
@@ -64,6 +65,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
64
65
 
65
66
  MIT License
66
67
 
67
- Copyright © 2010-2025 Roy Revelt and other contributors
68
+ Copyright © 2010-2026 Roy Revelt and other contributors
68
69
 
69
70
  <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,16 +1,16 @@
1
1
  /**
2
2
  * @name json-variables
3
3
  * @fileoverview Resolves custom-marked, cross-referenced paths in parsed JSON
4
- * @version 12.1.3
4
+ * @version 12.2.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/json-variables/}
8
8
  */
9
9
 
10
- import{strFindHeadsTails as U}from"string-find-heads-tails";import{getByKey as F}from"ast-get-values-by-key";import{arrayiffy as ee}from"arrayiffy-if-string";import{traverse as re}from"ast-monkey-traverse";import{rApply as R}from"ranges-apply";import d from"object-path";import{Ranges as te}from"ranges-push";import{isPlainObject as E,existy as ne,isBool as J,isNull as v,isStr as p,isNum as H}from"codsen-utils";import{isStr as L}from"codsen-utils";function _(r){if(L(r)&&r.length&&r.indexOf(".")!==-1){for(let e=0,t=r.length;e<t;e++)if(r[e]===".")return r.slice(0,e)}return r}import{isStr as M}from"codsen-utils";function T(r){if(M(r)&&r.length&&r.indexOf(".")!==-1){for(let e=r.length;e--;)if(r[e]===".")return r.slice(0,e)}return r}import{isStr as K}from"codsen-utils";function A(r){if(K(r)&&r.length&&r.indexOf(".")!==-1){for(let e=r.length;e--;)if(r[e]===".")return r.slice(e+1)}return r}import{isStr as q}from"codsen-utils";function C(r){if(q(r)&&r.length&&r.indexOf(".")!==-1){for(let e=0,t=r.length;e<t;e++)if(r[e]===".")return r.slice(e+1)}return r}import{isStr as j}from"codsen-utils";function D(r,e){return!j(r)||!r.trim()?!1:!!(r.includes(e.heads)||r.includes(e.tails)||j(e.headsNoWrap)&&e.headsNoWrap.length&&r.includes(e.headsNoWrap)||j(e.tailsNoWrap)&&e.tailsNoWrap.length&&r.includes(e.tailsNoWrap))}import{isMatch as Q}from"matcher";import{remDup as X}from"string-remove-duplicate-heads-tails";import{isStr as G}from"codsen-utils";import{matchLeftIncl as z,matchRightIncl as Y}from"string-match-left-right";function x(r,e,t){let o,i;return G(r)&&r.length&&Y(r,0,e,{trimBeforeMatching:!0,cb:(n,l,a)=>(o=a,!0)})&&z(r,r.length-1,t,{trimBeforeMatching:!0,cb:(n,l,a)=>(i=(a||0)+1,!0)})?r.slice(o,i):r}import{isStr as S}from"codsen-utils";function I(r,e,t=!1,o,i,n){if(e.wrapHeadsWith||(e.wrapHeadsWith=""),e.wrapTailsWith||(e.wrapTailsWith=""),S(r)&&!t&&e.wrapGlobalFlipSwitch&&!e.dontWrapVars.some(l=>Q(n,l))&&(!e.preventDoubleWrapping||e.preventDoubleWrapping&&S(r)&&!r.includes(e.wrapHeadsWith)&&!r.includes(e.wrapTailsWith)))return`${e.wrapHeadsWith}${r}${e.wrapTailsWith}`;if(t){if(!S(r))return r;let l=X(r,{heads:e.wrapHeadsWith,tails:e.wrapTailsWith});return S(l)?x(l,e.wrapHeadsWith,e.wrapTailsWith):l}return r}var k="12.1.3";var Fe=k,le=Object.prototype.hasOwnProperty,oe={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function u(r){return p(r)?r.trim():r}function ae(r,e,t,o){let i;if(t.indexOf(".")!==-1){let n=t,l=!0;if(o.lookForDataContainers&&p(o.dataContainerIdentifierTails)&&o.dataContainerIdentifierTails.length&&!n.endsWith(o.dataContainerIdentifierTails)){let a=d.get(r,n+o.dataContainerIdentifierTails);E(a)&&d.get(a,e)&&(i=d.get(a,e),l=!1)}for(;l&&n.indexOf(".")!==-1;){if(n=T(n),A(n)===e)throw new Error(`json-variables/findValues(): [THROW_ID_20] While trying to resolve: "${e}" at path "${t}", we encountered a closed loop. The parent key "${A(n)}" is called the same as the variable "${e}" we're looking for.`);if(o.lookForDataContainers&&p(o.dataContainerIdentifierTails)&&o.dataContainerIdentifierTails.length&&!n.endsWith(o.dataContainerIdentifierTails)){let a=d.get(r,n+o.dataContainerIdentifierTails);E(a)&&d.get(a,e)&&(i=d.get(a,e),l=!1)}if(i===void 0){let a=d.get(r,n);E(a)&&d.get(a,e)&&(i=d.get(a,e),l=!1)}}}if(i===void 0){let n=d.get(r,e);n!==void 0&&(i=n)}if(i===void 0)if(e.indexOf(".")===-1){let n=F(r,e);if(n.length){for(let l=0,a=n.length;l<a;l++)if(p(n[l].val)||J(n[l].val)||v(n[l].val)){i=n[l].val;break}else if(H(n[l].val)){i=n[l].val;break}else if(Array.isArray(n[l].val)){i=n[l].val.join("");break}}}else{let n=F(r,_(e));if(n.length)for(let l=0,a=n.length;l<a;l++){let s=d.get(n[l].val,C(e));s&&p(s)&&(i=s)}}return i}function B(r,e,t,o,i=[]){if(i.includes(t)){let g="";if(i.length>1){let m=` \u2192
11
- `;g=i.reduce((y,$,N)=>y+(N===0?"":m)+($===t?"\u{1F4A5} ":" ")+$,` Here's the path we travelled up until we hit the recursion:
10
+ import{arrayiffy as re}from"arrayiffy-if-string";import{getByKey as F}from"ast-get-values-by-key";import{traverse as te}from"ast-monkey-traverse";import{existy as ne,formatDiagnosticValue as oe,isBool as H,isNull as N,isNum as P,isPlainObject as w,isStr as f}from"codsen-utils";import c from"object-path";import{rApply as J}from"ranges-apply";import{Ranges as le}from"ranges-push";import{strFindHeadsTails as B}from"string-find-heads-tails";var k="12.2.0";import{isStr as A}from"codsen-utils";function S(r,e){return!A(r)||!r.trim()?!1:!!(r.includes(e.heads)||r.includes(e.tails)||A(e.headsNoWrap)&&e.headsNoWrap.length&&r.includes(e.headsNoWrap)||A(e.tailsNoWrap)&&e.tailsNoWrap.length&&r.includes(e.tailsNoWrap))}import{isStr as M}from"codsen-utils";function j(r){if(M(r)&&r.length&&r.indexOf(".")!==-1){for(let e=r.length;e--;)if(r[e]===".")return r.slice(e+1)}return r}import{isStr as q}from"codsen-utils";function C(r){if(q(r)&&r.length&&r.indexOf(".")!==-1){for(let e=0,t=r.length;e<t;e++)if(r[e]===".")return r.slice(0,e)}return r}import{isStr as G}from"codsen-utils";function I(r){if(G(r)&&r.length&&r.indexOf(".")!==-1){for(let e=r.length;e--;)if(r[e]===".")return r.slice(0,e)}return r}import{isStr as z}from"codsen-utils";function x(r){if(z(r)&&r.length&&r.indexOf(".")!==-1){for(let e=0,t=r.length;e<t;e++)if(r[e]===".")return r.slice(e+1)}return r}import{isStr as v,match as Z}from"codsen-utils";import{remDup as ee}from"string-remove-duplicate-heads-tails";import{isStr as Y}from"codsen-utils";import{matchLeftIncl as Q,matchRightIncl as X}from"string-match-left-right";function U(r,e,t){let l,i;return Y(r)&&r.length&&X(r,0,e,{trimBeforeMatching:!0,cb:(n,o,a)=>(l=a,!0)})&&Q(r,r.length-1,t,{trimBeforeMatching:!0,cb:(n,o,a)=>(i=(a||0)+1,!0)})?r.slice(l,i):r}function R(r,e,t=!1,l,i,n){if(e.wrapHeadsWith||(e.wrapHeadsWith=""),e.wrapTailsWith||(e.wrapTailsWith=""),v(r)&&!t&&e.wrapGlobalFlipSwitch&&!e.dontWrapVars.some(o=>Z(n,o))&&(!e.preventDoubleWrapping||e.preventDoubleWrapping&&v(r)&&!r.includes(e.wrapHeadsWith)&&!r.includes(e.wrapTailsWith)))return`${e.wrapHeadsWith}${r}${e.wrapTailsWith}`;if(t){if(!v(r))return r;let o=ee(r,{heads:e.wrapHeadsWith,tails:e.wrapTailsWith});return v(o)?U(o,e.wrapHeadsWith,e.wrapTailsWith):o}return r}var Fe=k,ae=Object.prototype.hasOwnProperty,se={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function u(r){return f(r)?r.trim():r}function ie(r,e,t,l){let i;if(t.indexOf(".")!==-1){let n=t,o=!0;if(l.lookForDataContainers&&f(l.dataContainerIdentifierTails)&&l.dataContainerIdentifierTails.length&&!n.endsWith(l.dataContainerIdentifierTails)){let a=c.get(r,n+l.dataContainerIdentifierTails);w(a)&&c.get(a,e)&&(i=c.get(a,e),o=!1)}for(;o&&n.indexOf(".")!==-1;){if(n=I(n),j(n)===e)throw new Error(`json-variables/findValues(): [THROW_ID_01] While trying to resolve: "${e}" at path "${t}", we encountered a closed loop. The parent key "${j(n)}" is called the same as the variable "${e}" we're looking for.`);if(l.lookForDataContainers&&f(l.dataContainerIdentifierTails)&&l.dataContainerIdentifierTails.length&&!n.endsWith(l.dataContainerIdentifierTails)){let a=c.get(r,n+l.dataContainerIdentifierTails);w(a)&&c.get(a,e)&&(i=c.get(a,e),o=!1)}if(i===void 0){let a=c.get(r,n);w(a)&&c.get(a,e)&&(i=c.get(a,e),o=!1)}}}if(i===void 0){let n=c.get(r,e);n!==void 0&&(i=n)}if(i===void 0)if(e.indexOf(".")===-1){let n=F(r,e);if(n.length){for(let o=0,a=n.length;o<a;o++)if(f(n[o].val)||H(n[o].val)||N(n[o].val)){i=n[o].val;break}else if(P(n[o].val)){i=n[o].val;break}else if(Array.isArray(n[o].val)){i=n[o].val.join("");break}}}else{let n=F(r,C(e));if(n.length)for(let o=0,a=n.length;o<a;o++){let s=c.get(n[o].val,x(e));s&&f(s)&&(i=s)}}return i}function L(r,e,t,l,i=[]){if(i.includes(t)){let p="";if(i.length>1){let V=` \u2192
11
+ `;p=i.reduce((b,$,O)=>b+(O===0?"":V)+($===t?"\u{1F4A5} ":" ")+$,` Here's the path we travelled up until we hit the recursion:
12
12
 
13
- `),g+=`${m}\u{1F4A5} ${t}`}throw new Error(`json-variables/resolveString(): [THROW_ID_19] While trying to resolve: "${e}" at path "${t}", we encountered a closed loop, the key is referencing itself."${g}`)}let n={},l=Array.from(i);l.push(t);let a=new te,s;function P(g,m,y){for(let $=0,N=g.length;$<N;$++){let f=g[$],h=e.slice(f.headsEndAt,f.tailsStartAt);if(h.length===0)a.push(f.headsStartAt,f.tailsEndAt);else if(le.call(n,h)&&p(n[h]))a.push(f.headsStartAt,f.tailsEndAt,n[h]);else{if(s=ae(r,h.trim(),t,o),s===void 0)if(o.allowUnresolved===!0)s="";else if(p(o.allowUnresolved))s=o.allowUnresolved;else throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_18] We couldn't find the value to resolve the variable ${e.slice(f.headsEndAt,f.tailsStartAt)}. We're at path: "${t}".`);if(!y&&o.throwWhenNonStringInsertedInString&&!p(s))throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_23] While resolving the variable ${e.slice(f.headsEndAt,f.tailsStartAt)} at path ${t}, it resolved into a non-string value, ${JSON.stringify(s,null,4)}. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").`);if(J(s)){if(o.resolveToBoolIfAnyValuesContainBool)return a.wipe(),o.resolveToFalseIfAnyValuesContainBool?!1:s;s=""}else{if(v(s)&&y)return a.wipe(),s;Array.isArray(s)?s=String(s.join("")):v(s)?s="":(!H(s)||!y)&&(s=String(s))}let O=t.includes(".")?`${T(t)}.${h}`:h;if(D(s,o)){let b=I(B(r,s,O,o,l),o,m,l,O,h.trim());b!==!1&&a.push(f.headsStartAt,f.tailsEndAt,b)}else{n[h]=s;let b=I(s,o,m,l,O,h.trim());b!==!1&&a.push(f.headsStartAt,f.tailsEndAt,b)}}}}let c;try{c=U(e,o.heads,o.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(g){throw new Error(`json-variables/resolveString(): [THROW_ID_17] While trying to resolve string: "${e}" at path ${t}, something wrong with heads and tails was detected! Here's the internal error message:
14
- ${g}`)}let V=!1;c.length===1&&R(e,[[c[0].headsStartAt,c[0].tailsEndAt]]).trim()===""&&(V=!0);let w=P(c,!1,V);if(typeof w=="boolean"||w===null)return w;try{c=U(e,o.headsNoWrap,o.tailsNoWrap,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(g){throw new Error(`json-variables/resolveString(): [THROW_ID_22] While trying to resolve string: "${e}" at path ${t}, something wrong with no-wrap heads and no-wrap tails was detected! Here's the internal error message:
15
- ${g}`)}c.length===1&&R(e,[[c[0].headsStartAt,c[0].tailsEndAt]]).trim()===""&&(V=!0);let W=P(c,!0,V);if(J(W)||v(W))return W;if(a?.current()){let g=a.current();if(V){if(typeof s=="number")return s;if(g?.length===1&&g[0].length===3&&H(g[0][2]))return g[0][2]}return R(e,g)}return e}function Be(r,e){if(!arguments.length)throw new Error("json-variables/jVar(): [THROW_ID_01] Alas! Inputs are missing!");if(!E(r))throw new TypeError(`json-variables/jVar(): [THROW_ID_02] Alas! The input must be a plain object! Currently it's: ${Array.isArray(r)?"array":typeof r}`);if(e&&!E(e))throw new TypeError(`json-variables/jVar(): [THROW_ID_03] Alas! An Optional Options Object must be a plain object! Currently it's: ${Array.isArray(e)?"array":typeof e}`);let t={...oe,...e};t.dontWrapVars?Array.isArray(t.dontWrapVars)||(t.dontWrapVars=ee(t.dontWrapVars)):t.dontWrapVars=[];let o,i;if(t.dontWrapVars.length&&!t.dontWrapVars.every((l,a)=>p(l)?!0:(o=l,i=a,!1)))throw new Error(`json-variables/jVar(): [THROW_ID_05] Alas! All variable names set in resolvedOpts.dontWrapVars should be of a string type. Computer detected a value "${o}" at index ${i}, which is not string but ${Array.isArray(o)?"array":typeof o}!`);if(t.heads==="")throw new Error("json-variables/jVar(): [THROW_ID_06] Alas! resolvedOpts.heads are empty!");if(t.tails==="")throw new Error("json-variables/jVar(): [THROW_ID_07] Alas! resolvedOpts.tails are empty!");if(t.lookForDataContainers&&t.dataContainerIdentifierTails==="")throw new Error("json-variables/jVar(): [THROW_ID_08] Alas! resolvedOpts.dataContainerIdentifierTails is empty!");if(t.heads===t.tails)throw new Error("json-variables/jVar(): [THROW_ID_09] Alas! resolvedOpts.heads and resolvedOpts.tails can't be equal!");if(t.heads===t.headsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_10] Alas! resolvedOpts.heads and resolvedOpts.headsNoWrap can't be equal!");if(t.tails===t.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_11] Alas! resolvedOpts.tails and resolvedOpts.tailsNoWrap can't be equal!");if(t.headsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_12] Alas! resolvedOpts.headsNoWrap is an empty string!");if(t.tailsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_13] Alas! resolvedOpts.tailsNoWrap is an empty string!");if(t.headsNoWrap===t.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_14] Alas! resolvedOpts.headsNoWrap and resolvedOpts.tailsNoWrap can't be equal!");let n;return re(r,(l,a,s)=>{if(ne(a)&&D(l,t))throw new Error(`json-variables/jVar(): [THROW_ID_15] Alas! Object keys can't contain variables!
16
- Please check the following key: ${l}`);if(a!==void 0?n=a:n=l,n==="")return n;if(t.heads.length&&u(n)===u(t.heads)||t.tails.length&&u(n)===u(t.tails)||t.headsNoWrap.length&&u(n)===u(t.headsNoWrap)||t.tailsNoWrap.length&&u(n)===u(t.tailsNoWrap)){if(!t.noSingleMarkers)return n;throw new Error(`json-variables/jVar(): [THROW_ID_16] Alas! While processing the input, we stumbled upon ${u(n)} which is equal to ${u(n)===u(t.heads)?"heads":""}${u(n)===u(t.tails)?"tails":""}${p(t.headsNoWrap)&&u(n)===u(t.headsNoWrap)?"headsNoWrap":""}${p(t.tailsNoWrap)&&u(n)===u(t.tailsNoWrap)?"tailsNoWrap":""}. If you wouldn't have set resolvedOpts.noSingleMarkers to "true" this error would not happen and computer would have left the current element (${u(n)}) alone`)}return p(n)&&D(n,t)?B(r,n,s.path,t):n})}export{oe as defaults,Be as jVar,Fe as version};
13
+ `),p+=`${V}\u{1F4A5} ${t}`}throw new Error(`json-variables/resolveString(): [THROW_ID_02] While trying to resolve: "${e}" at path "${t}", we encountered a closed loop, the key is referencing itself."${p}`)}let n={},o=Array.from(i);o.push(t);let a=new le,s;function _(p,V,b){for(let $=0,O=p.length;$<O;$++){let g=p[$],h=e.slice(g.headsEndAt,g.tailsStartAt);if(h.length===0)a.push(g.headsStartAt,g.tailsEndAt);else if(ae.call(n,h)&&f(n[h]))a.push(g.headsStartAt,g.tailsEndAt,n[h]);else{if(s=ie(r,h.trim(),t,l),s===void 0)if(l.allowUnresolved===!0)s="";else if(f(l.allowUnresolved))s=l.allowUnresolved;else throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_03] We couldn't find the value to resolve the variable ${e.slice(g.headsEndAt,g.tailsStartAt)}. We're at path: "${t}".`);if(!b&&l.throwWhenNonStringInsertedInString&&!f(s))throw new Error(`json-variables/processHeadsAndTails(): [THROW_ID_04] While resolving the variable ${e.slice(g.headsEndAt,g.tailsStartAt)} at path ${t}, it resolved into a non-string value, ${oe(s,4)}. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").`);if(H(s)){if(l.resolveToBoolIfAnyValuesContainBool)return a.wipe(),l.resolveToFalseIfAnyValuesContainBool?!1:s;s=""}else{if(N(s)&&b)return a.wipe(),s;Array.isArray(s)?s=String(s.join("")):N(s)?s="":(!P(s)||!b)&&(s=String(s))}let T=t.includes(".")?`${I(t)}.${h}`:h;if(S(s,l)){let E=R(L(r,s,T,l,o),l,V,o,T,h.trim());E!==!1&&a.push(g.headsStartAt,g.tailsEndAt,E)}else{n[h]=s;let E=R(s,l,V,o,T,h.trim());E!==!1&&a.push(g.headsStartAt,g.tailsEndAt,E)}}}}let d;try{d=B(e,l.heads,l.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(p){throw new Error(`json-variables/resolveString(): [THROW_ID_05] While trying to resolve string: "${e}" at path ${t}, something wrong with heads and tails was detected! Here's the internal error message:
14
+ ${p}`)}let y=!1;d.length===1&&J(e,[[d[0].headsStartAt,d[0].tailsEndAt]]).trim()===""&&(y=!0);let W=_(d,!1,y);if(typeof W=="boolean"||W===null)return W;try{d=B(e,l.headsNoWrap,l.tailsNoWrap,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(p){throw new Error(`json-variables/resolveString(): [THROW_ID_06] While trying to resolve string: "${e}" at path ${t}, something wrong with no-wrap heads and no-wrap tails was detected! Here's the internal error message:
15
+ ${p}`)}d.length===1&&J(e,[[d[0].headsStartAt,d[0].tailsEndAt]]).trim()===""&&(y=!0);let D=_(d,!0,y);if(H(D)||N(D))return D;let m=a.current();if(m){if(y){if(typeof s=="number")return s;if(m?.length===1&&m[0].length===3&&P(m[0][2]))return m[0][2]}return J(e,m)}return e}function Be(r,e){if(!arguments.length)throw new Error("json-variables/jVar(): [THROW_ID_07] Alas! Inputs are missing!");if(!w(r))throw new TypeError(`json-variables/jVar(): [THROW_ID_08] Alas! The input must be a plain object! Currently it's: ${Array.isArray(r)?"array":typeof r}`);if(e&&!w(e))throw new TypeError(`json-variables/jVar(): [THROW_ID_09] Alas! An Optional Options Object must be a plain object! Currently it's: ${Array.isArray(e)?"array":typeof e}`);let t={...se,...e};t.dontWrapVars?Array.isArray(t.dontWrapVars)||(t.dontWrapVars=re(t.dontWrapVars)):t.dontWrapVars=[];let l,i;if(t.dontWrapVars.length&&!t.dontWrapVars.every((o,a)=>f(o)?!0:(l=o,i=a,!1)))throw new Error(`json-variables/jVar(): [THROW_ID_10] Alas! All variable names set in resolvedOpts.dontWrapVars should be of a string type. Computer detected a value "${l}" at index ${i}, which is not string but ${Array.isArray(l)?"array":typeof l}!`);if(t.heads==="")throw new Error("json-variables/jVar(): [THROW_ID_11] Alas! resolvedOpts.heads are empty!");if(t.tails==="")throw new Error("json-variables/jVar(): [THROW_ID_12] Alas! resolvedOpts.tails are empty!");if(t.lookForDataContainers&&t.dataContainerIdentifierTails==="")throw new Error("json-variables/jVar(): [THROW_ID_13] Alas! resolvedOpts.dataContainerIdentifierTails is empty!");if(t.heads===t.tails)throw new Error("json-variables/jVar(): [THROW_ID_14] Alas! resolvedOpts.heads and resolvedOpts.tails can't be equal!");if(t.heads===t.headsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_15] Alas! resolvedOpts.heads and resolvedOpts.headsNoWrap can't be equal!");if(t.tails===t.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_16] Alas! resolvedOpts.tails and resolvedOpts.tailsNoWrap can't be equal!");if(t.headsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_17] Alas! resolvedOpts.headsNoWrap is an empty string!");if(t.tailsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_18] Alas! resolvedOpts.tailsNoWrap is an empty string!");if(t.headsNoWrap===t.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_19] Alas! resolvedOpts.headsNoWrap and resolvedOpts.tailsNoWrap can't be equal!");let n;return te(r,(o,a,s)=>{if(ne(a)&&S(o,t))throw new Error(`json-variables/jVar(): [THROW_ID_20] Alas! Object keys can't contain variables!
16
+ Please check the following key: ${o}`);if(a!==void 0?n=a:n=o,n==="")return n;if(t.heads.length&&u(n)===u(t.heads)||t.tails.length&&u(n)===u(t.tails)||t.headsNoWrap.length&&u(n)===u(t.headsNoWrap)||t.tailsNoWrap.length&&u(n)===u(t.tailsNoWrap)){if(!t.noSingleMarkers)return n;throw new Error(`json-variables/jVar(): [THROW_ID_21] Alas! While processing the input, we stumbled upon ${u(n)} which is equal to ${u(n)===u(t.heads)?"heads":""}${u(n)===u(t.tails)?"tails":""}${f(t.headsNoWrap)&&u(n)===u(t.headsNoWrap)?"headsNoWrap":""}${f(t.tailsNoWrap)&&u(n)===u(t.tailsNoWrap)?"tailsNoWrap":""}. If you wouldn't have set resolvedOpts.noSingleMarkers to "true" this error would not happen and computer would have left the current element (${u(n)}) alone`)}return f(n)&&S(n,t)?L(r,n,s.path,t):n})}export{se as defaults,Be as jVar,Fe as version};
@@ -1,57 +1,33 @@
1
1
  /**
2
2
  * @name json-variables
3
3
  * @fileoverview Resolves custom-marked, cross-referenced paths in parsed JSON
4
- * @version 12.1.3
4
+ * @version 12.2.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/json-variables/}
8
8
  */
9
9
 
10
- "use strict";var jsonVariables=(()=>{var ke=Object.create,ce=Object.freeze,R=Object.defineProperty,Fe=Object.defineProperties,Le=Object.getOwnPropertyDescriptor,qe=Object.getOwnPropertyDescriptors,Ue=Object.getOwnPropertyNames,ge=Object.getOwnPropertySymbols,Ke=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable;var X=(e,r,n)=>r in e?R(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,A=(e,r)=>{for(var n in r||(r={}))he.call(r,n)&&X(e,n,r[n]);if(ge)for(var n of ge(r))ze.call(r,n)&&X(e,n,r[n]);return e},B=(e,r)=>Fe(e,qe(r));var pe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Ge=(e,r)=>{for(var n in r)R(e,n,{get:r[n],enumerable:!0})},de=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let f of Ue(r))!he.call(e,f)&&f!==n&&R(e,f,{get:()=>r[f],enumerable:!(s=Le(r,f))||s.enumerable});return e};var F=(e,r,n)=>(n=e!=null?ke(Ke(e)):{},de(r||!e||!e.__esModule?R(n,"default",{value:e,enumerable:!0}):n,e)),Qe=e=>de(R({},"__esModule",{value:!0}),e);var ee=(e,r,n)=>X(e,typeof r!="symbol"?r+"":r,n);var L=(e,r)=>ce(R(e,"raw",{value:ce(r||e.slice())}));var q=pe((mr,me)=>{"use strict";me.exports=Ze;function x(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Ze(e){if(e=e||{},e.circles)return Ye(e);let r=new Map;if(r.set(Date,o=>new Date(o)),r.set(Map,(o,l)=>new Map(s(Array.from(o),l))),r.set(Set,(o,l)=>new Set(s(Array.from(o),l))),e.constructorHandlers)for(let o of e.constructorHandlers)r.set(o[0],o[1]);let n=null;return e.proto?t:f;function s(o,l){let i=Object.keys(o),u=new Array(i.length);for(let a=0;a<i.length;a++){let c=i[a],$=o[c];typeof $!="object"||$===null?u[c]=$:$.constructor!==Object&&(n=r.get($.constructor))?u[c]=n($,l):ArrayBuffer.isView($)?u[c]=x($):u[c]=l($)}return u}function f(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,f);if(o.constructor!==Object&&(n=r.get(o.constructor)))return n(o,f);let l={};for(let i in o){if(Object.hasOwnProperty.call(o,i)===!1)continue;let u=o[i];typeof u!="object"||u===null?l[i]=u:u.constructor!==Object&&(n=r.get(u.constructor))?l[i]=n(u,f):ArrayBuffer.isView(u)?l[i]=x(u):l[i]=f(u)}return l}function t(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,t);if(o.constructor!==Object&&(n=r.get(o.constructor)))return n(o,t);let l={};for(let i in o){let u=o[i];typeof u!="object"||u===null?l[i]=u:u.constructor!==Object&&(n=r.get(u.constructor))?l[i]=n(u,t):ArrayBuffer.isView(u)?l[i]=x(u):l[i]=t(u)}return l}}function Ye(e){let r=[],n=[],s=new Map;if(s.set(Date,i=>new Date(i)),s.set(Map,(i,u)=>new Map(t(Array.from(i),u))),s.set(Set,(i,u)=>new Set(t(Array.from(i),u))),e.constructorHandlers)for(let i of e.constructorHandlers)s.set(i[0],i[1]);let f=null;return e.proto?l:o;function t(i,u){let a=Object.keys(i),c=new Array(a.length);for(let $=0;$<a.length;$++){let y=a[$],g=i[y];if(typeof g!="object"||g===null)c[y]=g;else if(g.constructor!==Object&&(f=s.get(g.constructor)))c[y]=f(g,u);else if(ArrayBuffer.isView(g))c[y]=x(g);else{let d=r.indexOf(g);d!==-1?c[y]=n[d]:c[y]=u(g)}}return c}function o(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return t(i,o);if(i.constructor!==Object&&(f=s.get(i.constructor)))return f(i,o);let u={};r.push(i),n.push(u);for(let a in i){if(Object.hasOwnProperty.call(i,a)===!1)continue;let c=i[a];if(typeof c!="object"||c===null)u[a]=c;else if(c.constructor!==Object&&(f=s.get(c.constructor)))u[a]=f(c,o);else if(ArrayBuffer.isView(c))u[a]=x(c);else{let $=r.indexOf(c);$!==-1?u[a]=n[$]:u[a]=o(c)}}return r.pop(),n.pop(),u}function l(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return t(i,l);if(i.constructor!==Object&&(f=s.get(i.constructor)))return f(i,l);let u={};r.push(i),n.push(u);for(let a in i){let c=i[a];if(typeof c!="object"||c===null)u[a]=c;else if(c.constructor!==Object&&(f=s.get(c.constructor)))u[a]=f(c,l);else if(ArrayBuffer.isView(c))u[a]=x(c);else{let $=r.indexOf(c);$!==-1?u[a]=n[$]:u[a]=l(c)}}return r.pop(),n.pop(),u}}});var Re=pe((_e,G)=>{(function(e,r){"use strict";typeof G=="object"&&typeof G.exports=="object"?G.exports=r():typeof define=="function"&&define.amd?define([],r):e.objectPath=r()})(_e,function(){"use strict";var e=Object.prototype.toString;function r(a,c){return a==null?!1:Object.prototype.hasOwnProperty.call(a,c)}function n(a){if(!a||t(a)&&a.length===0)return!0;if(typeof a!="string"){for(var c in a)if(r(a,c))return!1;return!0}return!1}function s(a){return e.call(a)}function f(a){return typeof a=="object"&&s(a)==="[object Object]"}var t=Array.isArray||function(a){return e.call(a)==="[object Array]"};function o(a){return typeof a=="boolean"||s(a)==="[object Boolean]"}function l(a){var c=parseInt(a);return c.toString()===a?c:a}function i(a){a=a||{};var c=function(m){return Object.keys(c).reduce(function(h,p){return p==="create"||typeof c[p]=="function"&&(h[p]=c[p].bind(c,m)),h},{})},$;a.includeInheritedProps?$=function(){return!0}:$=function(m,h){return typeof h=="number"&&Array.isArray(m)||r(m,h)};function y(m,h){if($(m,h))return m[h]}var g;a.includeInheritedProps?g=function(m,h){typeof h!="string"&&typeof h!="number"&&(h=String(h));var p=y(m,h);if(h==="__proto__"||h==="prototype"||h==="constructor"&&typeof p=="function")throw new Error("For security reasons, object's magic properties cannot be set");return p}:g=function(m,h){return y(m,h)};function d(m,h,p,w){if(typeof h=="number"&&(h=[h]),!h||h.length===0)return m;if(typeof h=="string")return d(m,h.split(".").map(l),p,w);var b=h[0],v=g(m,b);return h.length===1?((v===void 0||!w)&&(m[b]=p),v):(v===void 0&&(typeof h[1]=="number"?m[b]=[]:m[b]={}),d(m[b],h.slice(1),p,w))}return c.has=function(m,h){if(typeof h=="number"?h=[h]:typeof h=="string"&&(h=h.split(".")),!h||h.length===0)return!!m;for(var p=0;p<h.length;p++){var w=l(h[p]);if(typeof w=="number"&&t(m)&&w<m.length||(a.includeInheritedProps?w in Object(m):r(m,w)))m=m[w];else return!1}return!0},c.ensureExists=function(m,h,p){return d(m,h,p,!0)},c.set=function(m,h,p,w){return d(m,h,p,w)},c.insert=function(m,h,p,w){var b=c.get(m,h);w=~~w,t(b)||(b=[],c.set(m,h,b)),b.splice(w,0,p)},c.empty=function(m,h){if(!n(h)&&m!=null){var p,w;if(p=c.get(m,h)){if(typeof p=="string")return c.set(m,h,"");if(o(p))return c.set(m,h,!1);if(typeof p=="number")return c.set(m,h,0);if(t(p))p.length=0;else if(f(p))for(w in p)$(p,w)&&delete p[w];else return c.set(m,h,null)}}},c.push=function(m,h){var p=c.get(m,h);t(p)||(p=[],c.set(m,h,p)),p.push.apply(p,Array.prototype.slice.call(arguments,2))},c.coalesce=function(m,h,p){for(var w,b=0,v=h.length;b<v;b++)if((w=c.get(m,h[b]))!==void 0)return w;return p},c.get=function(m,h,p){if(typeof h=="number"&&(h=[h]),!h||h.length===0)return m;if(m==null)return p;if(typeof h=="string")return c.get(m,h.split("."),p);var w=l(h[0]),b=g(m,w);return b===void 0?p:h.length===1?b:c.get(m[w],h.slice(1),p)},c.del=function(h,p){if(typeof p=="number"&&(p=[p]),h==null||n(p))return h;if(typeof p=="string")return c.del(h,p.split("."));var w=l(p[0]);if(g(h,w),!$(h,w))return h;if(p.length===1)t(h)?h.splice(w,1):delete h[w];else return c.del(h[w],p.slice(1));return h},c}var u=i();return u.create=i,u.withInheritedProps=i({includeInheritedProps:!0}),u})});var pr={};Ge(pr,{defaults:()=>Je,jVar:()=>hr,version:()=>fr});var ye=F(q(),1);var yr=(0,ye.default)();function E(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 T(e){return typeof e=="string"}function H(e){return Number.isFinite(e)}function _(e){return Number.isSafeInteger(e)&&e>=0}function U(e){return typeof e=="boolean"}function J(e){return e===null}function I(e){return e!=null}function we(e,r){return E(e)&&T(r)&&r in e}function S(e){return typeof e!="string"?e:e.length?[e]:[]}var be={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Xe=e=>e+1;function er(e,r,n,s,f=!1,t=Xe){var w;let o=typeof n=="function"?n():n;if(+r<0&&f&&o==="EOL")return o;let l=A(A({},be),s);if(r>=e.length&&!f)return!1;let i=f?1:n.length,u=0,a=!1,c=!1,$=!1,y=l.maxMismatches,g=r,d=!1,m=!1,h=!1;function p(){return u===1&&y<l.maxMismatches-1}for(;e[g];){let b=t(g);if(l.trimBeforeMatching&&e[g].trim()===""){if(!e[b]&&f&&n==="EOL")return!0;g=t(g);continue}if(l&&!l.i&&((w=l==null?void 0:l.trimCharsBeforeMatching)!=null&&w.includes(e[g]))||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(W=>W.toLowerCase()).includes(e[g].toLowerCase())){if(f&&n==="EOL"&&!e[b])return!0;g=t(g);continue}let v=b>g?n[n.length-i]:n[i-1];if(!l.i&&e[g]===v||l.i&&e[g].toLowerCase()===v.toLowerCase()){if(d||(d=!0),$||($=!0),i===n.length){if(m=!0,y!==l.maxMismatches)return!1}else i===1&&(h=!0);if(i-=1,u++,p())return!1;if(!i)return u!==n.length||y===l.maxMismatches||!a?g:!1}else if(!a&&!u&&(a=!0),l.maxMismatches&&y&&g){y-=1;for(let W=0;W<=y;W++){let V=b>g?n[n.length-i+1+W]:n[i-2-W],Y=e[t(g)];if(V&&(!l.i&&e[g]===V||l.i&&e[g].toLowerCase()===V.toLowerCase())&&(!l.firstMustMatch||i!==n.length)){if(u++,p())return!1;i-=2,d=!0;break}else if(Y&&V&&(!l.i&&Y===V||l.i&&Y.toLowerCase()===V.toLowerCase())&&(!l.firstMustMatch||i!==n.length)){if(!u&&!l.hungry)return!1;i-=1,d=!0;break}else if(V===void 0&&y>=0&&d&&(!l.firstMustMatch||m)&&(!l.lastMustMatch||h))return g}d||(c=g)}else return g===0&&i===1&&!l.lastMustMatch&&$?0:!1;if(c!==!1&&c!==g&&(c=!1),i<1)return g;g=t(g)}if(i>0)return f&&o==="EOL"?!0:l&&l.maxMismatches>=i&&$?c||0:!1}function $e(e,r,n,s,f){var a,c,$;if(E(f)&&we(f,"trimBeforeMatching")&&f&&typeof f.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(f.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let t=A(A({},be),f);if(typeof t.trimCharsBeforeMatching=="string"&&(t.trimCharsBeforeMatching=S(t.trimCharsBeforeMatching)),t.trimCharsBeforeMatching=t.trimCharsBeforeMatching.map(y=>T(y)?y:String(y)),!T(r)||!r.length)return!1;if(!Number.isInteger(n)||n<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ").concat(typeof n,", equal to:\n").concat(JSON.stringify(n,null,4)));let o,l;if(T(s))o=[s];else if(Array.isArray(s))o=s;else if(!s)o=s;else if(typeof s=="function")o=[],o.push(s);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof s,", equal to:\n").concat(JSON.stringify(s,null,4)));if(f&&!E(f))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof f,'", and equal to:\n').concat(JSON.stringify(f,null,4)));let i=0,u="";if((a=t==null?void 0:t.trimCharsBeforeMatching)!=null&&a.some((y,g)=>y.length>1?(i=g,u=y,!0):!1))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ").concat(i," is longer than 1 character, ").concat(u.length," (equals to ").concat(u,"). Please split it into separate characters and put into array as separate elements."));if(!o||!Array.isArray(o)||Array.isArray(o)&&!o.length||Array.isArray(o)&&o.length===1&&T(o[0])&&!o[0].trim()){if(typeof t.cb=="function"){let g,d=n;if((e==="matchLeftIncl"||e==="matchRight")&&(d+=1),e[5]==="L")for(let w=d;w--;){let b=r[w];if((!t.trimBeforeMatching||t.trimBeforeMatching&&(b!=null&&b.trim()))&&(!((c=t.trimCharsBeforeMatching)!=null&&c.length)||b!==void 0&&!t.trimCharsBeforeMatching.includes(b))){g=w;break}}else if(e.startsWith("matchRight"))for(let w=d;w<r.length;w++){let b=r[w];if((!t.trimBeforeMatching||t.trimBeforeMatching&&b.trim())&&(!(($=t.trimCharsBeforeMatching)!=null&&$.length)||!t.trimCharsBeforeMatching.includes(b))){g=w;break}}if(g===void 0)return!1;let m=r[g],h=g+1,p="";return h&&h>0&&(p=r.slice(0,h)),e[5]==="L"||g&&g>0&&(p=r.slice(g)),t.cb(m,p,g)}let y="";throw f||(y=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(e,'(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!').concat(y))}for(let y=0,g=o.length;y<g;y++){l=typeof o[y]=="function";let d=o[y],m,h,p="",w=n;e==="matchRight"?w+=1:e==="matchLeft"&&(w-=1);let b=er(r,w,d,t,l,v=>e[5]==="L"?v-1:v+1);if(b&&l&&typeof d=="function"&&d()==="EOL")return d()&&(!t.cb||t.cb(m,p,h))?d():!1;if(Number.isInteger(b)&&(h=e.startsWith("matchLeft")?b-1:b+1,e[5]==="L"?p=r.slice(0,b):p=r.slice(h)),h<0&&(h=void 0),r[h]&&(m=r[h]),Number.isInteger(b)&&(!t.cb||t.cb(m,p,h)))return d}return!1}function C(e,r,n,s){return $e("matchLeftIncl",e,r,n,s)}function D(e,r,n,s){return $e("matchRightIncl",e,r,n,s)}var Te={fromIndex:0,throwWhenSomethingWrongIsDetected:!0,allowWholeValueToBeOnlyHeadsOrTails:!0,source:"string-find-heads-tails",matchHeadsAndTailsStrictlyInPairsByTheirOrder:!1,relaxedAPI:!1};function re(e,r,n,s){if(I(s)&&!E(s))throw new TypeError("string-find-heads-tails: [THROW_ID_01] the fourth input argument, an Optional Options Object, must be a plain object! Currently it's equal to: ".concat(s," (type: ").concat(typeof s,")"));let f=A(A({},Te),s);if(T(f.fromIndex)&&/^\d*$/.test(f.fromIndex))f.fromIndex=Number(f.fromIndex);else if(!Number.isInteger(f.fromIndex)||f.fromIndex<0)throw new TypeError("".concat(f.source," [THROW_ID_18] the fourth input argument must be a natural number or zero! Currently it's: ").concat(f.fromIndex));if(!T(e)||e.length===0){if(f.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_02] the first input argument, input string, must be a non-zero-length string! Currently it's: ".concat(typeof e,", equal to: ").concat(e))}let t,o;if(!T(r)&&!Array.isArray(r)){if(f.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_03] the second input argument, heads, must be either a string or an array of strings! Currently it's: ".concat(typeof r,", equal to:\n").concat(JSON.stringify(r,null,4)))}else if(T(r))if(r.length===0){if(f.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_04] the second input argument, heads, must be a non-empty string! Currently it's empty.")}else r=S(r);else if(Array.isArray(r))if(r.length===0){if(f.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_05] the second input argument, heads, must be a non-empty array and contain at least one string! Currently it's empty.")}else if(r.every((g,d)=>(t=g,o=d,T(g)))){if(!r.every((g,d)=>(o=d,T(g)&&g.length&&g.trim()!=="")))if(f.relaxedAPI){if(r=r.filter(g=>T(g)&&g.length),r.length===0)return[]}else throw new TypeError("string-find-heads-tails: [THROW_ID_07] the second input argument, heads, should not contain empty strings! For example, there's one detected at index ".concat(o," of heads array:\n").concat(JSON.stringify(r,null,4),"."))}else if(f.relaxedAPI){if(r=r.filter(g=>T(g)&&g.length),r.length===0)return[]}else throw new TypeError("string-find-heads-tails: [THROW_ID_06] the second input argument, heads, contains non-string elements! For example, element at ".concat(o,"th index is ").concat(typeof t,", equal to:\n").concat(JSON.stringify(t,null,4),". Whole heads array looks like:\n").concat(JSON.stringify(r,null,4)));if(!T(n)&&!Array.isArray(n)){if(f.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_08] the third input argument, tails, must be either a string or an array of strings! Currently it's: ".concat(typeof n,", equal to:\n").concat(JSON.stringify(n,null,4)))}else if(T(n))if(n.length===0){if(f.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_09] the third input argument, tails, must be a non-empty string! Currently it's empty.")}else n=S(n);else if(Array.isArray(n))if(n.length===0){if(f.relaxedAPI)return[];throw new TypeError("string-find-heads-tails: [THROW_ID_10] the third input argument, tails, must be a non-empty array and contain at least one string! Currently it's empty.")}else if(n.every((g,d)=>(t=g,o=d,T(g)))){if(!n.every((g,d)=>(o=d,T(g)&&g.length&&g.trim()!=="")))if(f.relaxedAPI){if(n=n.filter(g=>T(g)&&g.length),n.length===0)return[]}else throw new TypeError("string-find-heads-tails: [THROW_ID_12] the third input argument, tails, should not contain empty strings! For example, there's one detected at index ".concat(o,". Whole tails array is equal to:\n").concat(JSON.stringify(n,null,4)))}else if(f.relaxedAPI){if(n=n.filter(g=>T(g)&&g.length),n.length===0)return[]}else throw new TypeError("string-find-heads-tails: [THROW_ID_11] the third input argument, tails, contains non-string elements! For example, element at ".concat(o,"th index is ").concat(typeof t,", equal to:\n").concat(JSON.stringify(t,null,4),". Whole tails array is equal to:\n").concat(JSON.stringify(n,null,4)));let l=f.source===Te.source;if(f.throwWhenSomethingWrongIsDetected&&!f.allowWholeValueToBeOnlyHeadsOrTails){if(S(r).includes(e))throw new Error("".concat(f.source).concat(l?": [THROW_ID_16]":""," the whole input string can't be equal to ").concat(T(r)?"":"one of ","heads (").concat(e,")!"));if(S(n).includes(e))throw new Error("".concat(f.source).concat(l?": [THROW_ID_17]":""," the whole input string can't be equal to ").concat(T(n)?"":"one of ","tails (").concat(e,")!"))}let i=r.concat(n).map(g=>g.charAt(0)).reduce((g,d)=>d.charCodeAt(0)>g[1]?[g[0],d.charCodeAt(0)]:d.charCodeAt(0)<g[0]?[d.charCodeAt(0),g[1]]:g,[r[0].charCodeAt(0),r[0].charCodeAt(0)]),u=[],a=!1,c={},$="",y;for(let g=f.fromIndex,d=e.length;g<d;g++){let m=e[g].charCodeAt(0);if(m<=i[1]&&m>=i[0]){let h=D(e,g,r);if(h&&f.matchHeadsAndTailsStrictlyInPairsByTheirOrder){for(let w=r.length;w--;)if(r[w]===h){y=w;break}}if(T(h))if(a){if(f.throwWhenSomethingWrongIsDetected)throw new TypeError("".concat(f.source).concat(l?": [THROW_ID_19]":"",' When processing "').concat(e,'", we found heads (').concat(e.slice(g,g+h.length),') starting at character with index number "').concat(g,'" and there was another set of heads before it! Generally speaking, there should be "heads-tails-heads-tails", not "heads-heads-tails"!\nWe\'re talking about the area of the code:\n\n\n--------------------------------------starts\n').concat(e.slice(Math.max(g-200,0),g),"\n \x1B[33m------->\x1B[39m ").concat("\x1B[31m".concat(e.slice(g,g+h.length),"\x1B[39m")," \x1B[33m<-------\x1B[39m\n").concat(e.slice(g+h.length,Math.min(d,g+200)),"\n--------------------------------------ends\n\n\nTo turn off this error being thrown, set resolvedOpts.throwWhenSomethingWrongIsDetected to Boolean false."))}else{c={},c.headsStartAt=g,c.headsEndAt=g+h.length,a=!0,g+=h.length-1,$&&($="");continue}let p=D(e,g,n);if(a&&p&&f.matchHeadsAndTailsStrictlyInPairsByTheirOrder&&y!==void 0&&n[y]!==void 0&&n[y]!==p){let w;for(let b=n.length;b--;)if(n[b]===p){w=b;break}throw new TypeError("".concat(f.source).concat(l?": [THROW_ID_20]":"",' When processing "').concat(e,'", we had "resolvedOpts.matchHeadsAndTailsStrictlyInPairsByTheirOrder" on. We found heads (').concat(r[y],") but the tails the followed it were not of the same index, ").concat(y," (").concat(n[y],") but ").concat(w," (").concat(p,")."))}if(T(p))if(a){c.tailsStartAt=g,c.tailsEndAt=g+p.length,u.push(c),c={},a=!1,g+=p.length-1;continue}else f.throwWhenSomethingWrongIsDetected&&($="".concat(f.source).concat(l?": [THROW_ID_21]":"",' When processing "').concat(e,'", we found tails (').concat(e.slice(g,g+p.length),') starting at character with index number "').concat(g,"\" but there were no heads preceding it. That's very naughty!"))}if(f.throwWhenSomethingWrongIsDetected&&g===d-1){if(Object.keys(c).length!==0)throw new TypeError("".concat(f.source).concat(l?": [THROW_ID_22]":"",' When processing "').concat(e,"\", we reached the end of the string and yet didn't find any tails (").concat(JSON.stringify(n,null,4),") to match the last detected heads (").concat(e.slice(c.headsStartAt,c.headsEndAt),")!"));if($)throw new Error($)}}return u}var Ae=F(q(),1);function te(e){if(e.includes(".")){let r=e.lastIndexOf(".");if(!e.slice(0,r).includes("."))return e.slice(0,r);for(let n=r-1;n--;)if(e[n]===".")return e.slice(n+1,r)}return null}var ne=(0,Ae.default)();function K(e,r){let n={now:!1};function s(f,t,o,l){let i=ne(f),u,a=A({depth:-1,path:""},o);if(a.depth+=1,Array.isArray(i))for(let c=0,$=i.length;c<$&&!l.now;c++){let y=a.path?"".concat(a.path,".").concat(c):"".concat(c);i[c]!==void 0?(a.parent=ne(i),a.parentType="array",a.parentKey=te(y),u=s(t(i[c],void 0,B(A({},a),{path:y}),l),t,B(A({},a),{path:y}),l),Number.isNaN(u)&&c<i.length?(i.splice(c,1),c-=1):i[c]=u):i.splice(c,1)}else if(E(i))for(let c in i){if(l.now&&c!=null)break;let $=a.path?"".concat(a.path,".").concat(c):c;a.depth===0&&c!=null&&(a.topmostKey=c),a.parent=ne(i),a.parentType="object",a.parentKey=te($),u=s(t(c,i[c],B(A({},a),{path:$}),l),t,B(A({},a),{path:$}),l),Number.isNaN(u)?delete i[c]:i[c]=u}return i}return s(e,r,{},n)}function se(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var ie=new Map,Oe=(e,r)=>{if(!Array.isArray(e))switch(typeof e){case"string":{e=[e];break}case"undefined":{e=[];break}default:throw new TypeError("Expected '".concat(r,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(n=>{if(typeof n!="string"){if(n===void 0)return!1;throw new TypeError("Expected '".concat(r,"' to be an array of strings, but found a type of '").concat(typeof n,"' in the array"))}return!0})},ve,Ee,Se,rr=(e,r)=>{r=A({caseSensitive:!1},r);let n="s"+(r.caseSensitive?"":"i"),s=e+"|"+n;if(ie.has(s))return ie.get(s);let f=e[0]==="!";f&&(e=e.slice(1)),e=e.replaceAll(String.raw(ve||(ve=L(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=se(e).replaceAll(String.raw(Ee||(Ee=L(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(Se||(Se=L(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let t=new RegExp("^".concat(e,"$"),n);return t.negated=f,ie.set(s,t),t},tr=(e,r,n,s)=>{if(e=Oe(e,"inputs"),r=Oe(r,"patterns"),r.length===0)return[];r=r.map(i=>rr(i,n));let f=r.filter(i=>i.negated),t=r.filter(i=>!i.negated),{allPatterns:o}=n||{},l=[];if(o&&s&&f.length>1&&t.length===0){for(let i of e)for(let u of f)if(u.test(i))return[];return e.slice(0,1)}for(let i of e){let u=!1;for(let a of f)if(a.test(i)){u=!0;break}if(!u){if(t.length===0)l.push(i);else if(o){let a=Array.from({length:t.length},()=>!1);for(let[c,$]of t.entries())$.test(i)&&(a[c]=!0);a.every(Boolean)&&l.push(i)}else{let a=!1;for(let c of t)if(c.test(i)){a=!0;break}a&&l.push(i)}if(s&&l.length>0)break}}return l};function z(e,r,n){return tr(e,r,n,!0).length>0}var We=F(q(),1);var Ie=(0,We.default)();function ae(e,r,n){let s;n!==void 0&&(s=Array.isArray(n)?Ie(n):[Ie(n)]);let f=[],t=K(e,(o,l,i)=>{let u=l!==void 0?l:o;if(l!==void 0&&z(o,r,{caseSensitive:!0})){if(s===void 0)f.push({val:l,path:i.path});else if(s.length)return s.shift()}return u});return s===void 0?f:t}var nr={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function j(e,r){if(!Array.isArray(e)||!e.length)return e;let n=A(A({},nr),r),s,f;if(n.strictlyTwoElementsInRangeArrays&&!e.every((l,i)=>!Array.isArray(l)||l.length!==2?(s=i,f=l.length,!1):!0))throw new TypeError("ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(s,"th range (").concat(JSON.stringify(e[s],null,4),") has not two but ").concat(f," elements!"));if(!e.every((l,i)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(s=i,!1):!0))throw new TypeError("ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(s,"th range (").concat(JSON.stringify(e[s],null,4),") does not consist of only natural numbers!"));let t=e.length**2,o=0;return Array.from(e).sort((l,i)=>(n.progressFn&&(o+=1,n.progressFn(Math.floor(o*100/t))),l[0]===i[0]?l[1]<i[1]?-1:l[1]>i[1]?1:0:l[0]<i[0]?-1:1))}var De={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ne(e,r){function n(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(n(r)){if(s=A(A({},De),r),s.progressFn&&n(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "'.concat(typeof s.progressFn,'", equal to ').concat(JSON.stringify(s.progressFn,null,4)));if(![1,2,"1","2"].includes(s.mergeType))throw new Error('ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof s.mergeType,'", equal to ').concat(JSON.stringify(s.mergeType,null,4)));if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof s.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(s.joinRangesThatTouchEdges,null,4)))}else throw new Error("emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(r,null,4)," (type ").concat(typeof r,")"));else s=A({},De);let f=e.filter(u=>Array.isArray(u)).map(u=>[...u]).filter(u=>u[2]!==void 0||u[0]!==u[1]),t,o,l;s.progressFn?t=j(f,{progressFn:u=>{l=Math.floor(u/5),l!==o&&(o=l,s.progressFn(l))}}):t=j(f);let i=t.length-1;for(let u=i;u>0;u--)s.progressFn&&(l=Math.floor((1-u/i)*78)+21,l!==o&&l>o&&(o=l,s.progressFn(l))),(t[u][0]<=t[u-1][0]||!s.joinRangesThatTouchEdges&&t[u][0]<t[u-1][1]||s.joinRangesThatTouchEdges&&t[u][0]<=t[u-1][1])&&(t[u-1][0]=Math.min(t[u][0],t[u-1][0]),t[u-1][1]=Math.max(t[u][1],t[u-1][1]),t[u][2]!==void 0&&(t[u-1][0]>=t[u][0]||t[u-1][1]<=t[u][1])&&t[u-1][2]!==null&&(t[u][2]===null&&t[u-1][2]!==null?t[u-1][2]=null:t[u-1][2]!=null?+s.mergeType==2&&t[u-1][0]===t[u][0]?t[u-1][2]=t[u][2]:t[u-1][2]+=t[u][2]:t[u-1][2]=t[u][2]),t.splice(u,1),u=t.length);return t.length?t:null}var sr=!0,oe="Invariant failed";function Ve(e,r){if(!e){if(sr)throw new Error(oe);var n=typeof r=="function"?r():r,s=n?"".concat(oe,": ").concat(n):oe;throw new Error(s)}}function P(e,r,n){let s=0,f=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(JSON.stringify(e,null,4)));if(r&&!Array.isArray(r))throw new TypeError("ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof r,", equal to: ").concat(JSON.stringify(r,null,4)));if(n&&typeof n!="function")throw new TypeError("ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ".concat(typeof n,", equal to: ").concat(JSON.stringify(n,null,4)));if(!(r!=null&&r.filter(a=>a).length))return e;let t;Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?t=[Array.from(r)]:t=Array.from(r);let o=t.length,l=0;t.filter(a=>a).forEach((a,c)=>{if(n&&(s=Math.floor(l/o*10),s!==f&&(f=s,n(s))),!Array.isArray(a))throw new TypeError("ranges-apply: [THROW_ID_05] ranges array, second input arg., has ".concat(c,"th element not an array: ").concat(JSON.stringify(a,null,4),", which is ").concat(typeof a));if(!Number.isInteger(a[0])){if(!Number.isInteger(+a[0])||+a[0]<0)throw new TypeError("ranges-apply: [THROW_ID_06] ranges array, second input arg. has ".concat(c,"th element, array ").concat(JSON.stringify(a,null,0),". Its first element is not an integer, string index, but ").concat(typeof a[0],", equal to: ").concat(JSON.stringify(a[0],null,4),"."));t[c][0]=+t[c][0]}if(!Number.isInteger(a[1])){if(!Number.isInteger(+a[1])||+a[1]<0)throw new TypeError("ranges-apply: [THROW_ID_07] ranges array, second input arg. has ".concat(c,"th element, array ").concat(JSON.stringify(a,null,0),". Its second element is not an integer, string index, but ").concat(typeof a[1],", equal to: ").concat(JSON.stringify(a[1],null,4),"."));t[c][1]=+t[c][1]}l+=1});let i=Ne(t,{progressFn:a=>{n&&(s=10+Math.floor(a/10),s!==f&&(f=s,n(s)))}});Ve(i);let u=i.length;if(u>0){let a=e.slice(i[u-1][1]);e=i.reduce((c,$,y,g)=>{n&&(s=20+Math.floor(y/u*80),s!==f&&(f=s,n(s)));let d=y===0?0:g[y-1][1],m=g[y][0];return"".concat(c).concat(e.slice(d,m)).concat(g[y][2]||"")},""),e+=a}return e}var N=F(Re(),1);function Q(e,r=1){let n="\xA0";function s(t){return Array.from(t).reverse().join("")}function f(t,o,l){let i=l?"\n":"\r",u=l?"\r":"\n";if(!t)return t;let a=0,c=0,$="";for(let y=0,g=t.length;y<g;y++)(t[y]===i||t[y]===u&&t[y-1]!==i)&&c++,"\r\n".includes(t[y])||t[y]===n?(a=0,t[y]===n?$+=t[y]:t[y]===i?c<=o&&($+=t[y],t[y+1]===u&&($+=t[y+1],y++)):t[y]===u&&(t==null?void 0:t[y-1])!==i&&c<=o&&($+=t[y])):(a++,!t[y+1]&&!c&&($+=" "));return $}if(typeof e=="string"&&e.length){let t=1;typeof+r=="number"&&Number.isInteger(+r)&&+r>=0&&(t=+r);let o="",l="";if(!e.trim())o=e;else if(!e[0].trim()){for(let i=0,u=e.length;i<u;i++)if(e[i].trim()){o=e.slice(0,i);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===n)){for(let i=e.length;i--;)if(e[i].trim()){l=e.slice(i+1);break}}return"".concat(f(o,t,!1)).concat(e.trim()).concat(s(f(s(l),t,!0)))}return e}var xe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function ir(e,r){var u;function n(a){return!!a&&typeof a=="object"&&!Array.isArray(a)}if(!Array.isArray(e)||!e.length)return null;let s;if(r)if(n(r)){if(s=A(A({},xe),r),s.progressFn&&n(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof s.progressFn,'", equal to ').concat(JSON.stringify(s.progressFn,null,4)));if(![1,2,"1","2"].includes(s.mergeType))throw new Error('ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof s.mergeType,'", equal to ').concat(JSON.stringify(s.mergeType,null,4)));if(typeof s.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof s.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(s.joinRangesThatTouchEdges,null,4)))}else throw new Error("ranges-merge: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(r,null,4)," (type ").concat(typeof r,")"));else s=A({},xe);let f=e.filter(a=>Array.isArray(a)).map(a=>[...a]).filter(a=>a[2]!==void 0||a[0]!==a[1]),t,o,l;s.progressFn?t=j(f,{progressFn:a=>{l=Math.floor(a/5),l!==o&&(o=l,s.progressFn!=null&&s.progressFn(l))}}):t=j(f);let i=t.length-1;for(let a=i;a>0;a--)s.progressFn&&(l=Math.floor((1-a/i)*78)+21,l!==o&&l>o&&(o=l,s.progressFn(l))),(t[a][0]<=t[a-1][0]||!s.joinRangesThatTouchEdges&&t[a][0]<t[a-1][1]||s.joinRangesThatTouchEdges&&t[a][0]<=t[a-1][1])&&(t[a-1][0]=Math.min(t[a][0],t[a-1][0]),t[a-1][1]=Math.max(t[a][1],t[a-1][1]),t[a][2]!==void 0&&(t[a-1][0]>=t[a][0]||t[a-1][1]<=t[a][1])&&t[a-1][2]!==null&&(t[a][2]===null&&t[a-1][2]!==null?t[a-1][2]=null:t[a-1][2]!=null?+((u=s||{})==null?void 0:u.mergeType)==2&&t[a-1][0]===t[a][0]?t[a-1][2]=t[a][2]:t[a-1][2]+=t[a][2]:t[a-1][2]=t[a][2]),t.splice(a,1),a=t.length);return t.length?t:null}var ar={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},M=class{constructor(e){ee(this,"ranges");ee(this,"opts");let r=A(A({},ar),e);if(r.mergeType&&r.mergeType!==1&&r.mergeType!==2)if(T(r.mergeType)&&r.mergeType.trim()==="1")r.mergeType=1;else if(T(r.mergeType)&&r.mergeType.trim()==="2")r.mergeType=2;else throw new Error('ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof r.mergeType,'", equal to ').concat(JSON.stringify(r.mergeType,null,4)));this.opts=r,this.ranges=[]}add(e,r,n){var t;if(e==null&&r==null)return;if(I(e)&&!I(r)){if(Array.isArray(e)){if(e.length){if(e.some(o=>Array.isArray(o))){e.forEach(o=>{Array.isArray(o)&&this.add(...o)});return}e.length&&_(+e[0])&&_(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set ('.concat(JSON.stringify(e,null,0),') but second-one, "to" is not (').concat(JSON.stringify(r,null,0),")"))}else if(!I(e)&&I(r))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set ('.concat(JSON.stringify(r,null,0),') but first-one, "from" is not (').concat(JSON.stringify(e,null,0),")"));let s=+e,f=+r;if(_(s)&&_(f)){if(I(n)&&!T(n)&&!H(n))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ".concat(typeof n,", equal to:\n").concat(JSON.stringify(n,null,4)));if(I(this.ranges)&&Array.isArray(this.last())&&s===this.last()[1]){if(this.last()[1]=f,this.last()[2],this.last()[2]!==null&&I(n)){let o=this.last()[2]&&this.last()[2].length&&(!((t=this.opts)!=null&&t.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(n):n;this.opts.limitToBeAddedWhitespace&&(o=Q(o,this.opts.limitLinebreaksCount)),T(o)&&!o.length||(this.last()[2]=o)}}else{this.ranges||(this.ranges=[]);let o=n!==void 0&&!(T(n)&&!n.length)?[s,f,n&&this.opts.limitToBeAddedWhitespace?Q(n,this.opts.limitLinebreaksCount):n]:[s,f];this.ranges.push(o)}}else throw _(s)&&s>=0?new TypeError('ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof f,'" equal to: ').concat(JSON.stringify(f,null,4))):new TypeError('ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof s,'" equal to: ').concat(JSON.stringify(s,null,4)))}push(e,r,n){this.add(e,r,n)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=ir(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>I(e[2])?[e[0],e[1],Q(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&_(e[0][0]))this.ranges=Array.from(e);else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ".concat(JSON.stringify(e[0],null,4)," should be an array and its first element should be an integer, a string index."));else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};function He(e){if(T(e)&&e.length&&e.indexOf(".")!==-1){for(let r=0,n=e.length;r<n;r++)if(e[r]===".")return e.slice(0,r)}return e}function le(e){if(T(e)&&e.length&&e.indexOf(".")!==-1){for(let r=e.length;r--;)if(e[r]===".")return e.slice(0,r)}return e}function ue(e){if(T(e)&&e.length&&e.indexOf(".")!==-1){for(let r=e.length;r--;)if(e[r]===".")return e.slice(r+1)}return e}function Ce(e){if(T(e)&&e.length&&e.indexOf(".")!==-1){for(let r=0,n=e.length;r<n;r++)if(e[r]===".")return e.slice(r+1)}return e}function Z(e,r){return!T(e)||!e.trim()?!1:!!(e.includes(r.heads)||e.includes(r.tails)||T(r.headsNoWrap)&&r.headsNoWrap.length&&e.includes(r.headsNoWrap)||T(r.tailsNoWrap)&&r.tailsNoWrap.length&&e.includes(r.tailsNoWrap))}var or={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function k(e,r){if(typeof e!="string")throw new Error("string-trim-spaces-only: [THROW_ID_01] input must be string! It was given as ".concat(typeof e,", equal to:\n").concat(JSON.stringify(e,null,4)));let n=A(A({},or),r);function s(o){return n.classicTrim&&!o.trim()||!n.classicTrim&&(n.space&&o===" "||n.cr&&o==="\r"||n.lf&&o==="\n"||n.tab&&o===" "||n.nbsp&&o==="\xA0")}let f,t;if(e.length){if(s(e[0]))for(let o=0,l=e.length;o<l;o++){if(!s(e[o])){f=o;break}if(o===e.length-1)return{res:"",ranges:[[0,e.length]]}}if(s(e[e.length-1])){for(let o=e.length;o--;)if(!s(e[o])){t=o+1;break}}return f?t?{res:e.slice(f,t),ranges:[[0,f],[t,e.length]]}:{res:e.slice(f),ranges:[[0,f]]}:t?{res:e.slice(0,t),ranges:[[t,e.length]]}:{res:e,ranges:[]}}return{res:"",ranges:[]}}var lr={heads:["{{"],tails:["}}"]};function je(e,r){let n=Object.prototype.hasOwnProperty;if(e===void 0)throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_01] The input is missing!");if(typeof e!="string")return e;if(r&&!E(r))throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_03] The given options are not a plain object but ".concat(typeof r,"!"));let s=A({},r);if(s&&n.call(s,"heads"))if(S(s.heads).every(d=>typeof d=="string"||Array.isArray(d)))typeof s.heads=="string"&&(s.heads=S(s.heads));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_04] The resolvedOpts.heads contains elements which are not string-type!");if(s&&n.call(s,"tails"))if(S(s.tails).every(d=>typeof d=="string"||Array.isArray(d)))typeof s.tails=="string"&&(s.tails=S(s.tails));else throw new Error("string-remove-duplicate-heads-tails: [THROW_ID_05] The resolvedOpts.tails contains elements which are not string-type!");let f=k(e).res;if(f.length===0)return e;e=f;let t=A(A({},lr),s);t.heads=t.heads.map(d=>d.trim()),t.tails=t.tails.map(d=>d.trim());let o=!1,l=!1,i=new M({limitToBeAddedWhitespace:!0}),u=new M({limitToBeAddedWhitespace:!0}),a=!0,c=!0,$="";function y(d,m){let h;return D(d,0,m.heads,{trimBeforeMatching:!0,cb:(p,w,b)=>(h=b,!0)})&&D(d,h,m.tails,{trimBeforeMatching:!0,cb:(p,w,b)=>(h=b,!0)})?d.slice(h):d}for(;e!==y(e,t);)e=k(y(e,t)).res;function g(d,m){let h;return!C(d,d.length-1,m.tails,{trimBeforeMatching:!0,cb:(p,w,b)=>(h=b,!0)})||!h?d:C(d,h,m.heads,{trimBeforeMatching:!0,cb:(p,w,b)=>(h=b,!0)})?d.slice(0,h+1):d}for(;e!==g(e,t);)e=k(g(e,t)).res;if(!t.heads.length||!D(e,0,t.heads,{trimBeforeMatching:!0})||!t.tails.length||!C(e,e.length-1,t.tails,{trimBeforeMatching:!0}))return k(e).res;for(let d=0,m=e.length;d<m;d++)if(e[d].trim()!==""){let h;if(D(e,d,t.heads,{trimBeforeMatching:!0,cb:(p,w,b)=>(h=b,!0)})&&h){c=!0,a&&(a=!0);let p;D(e,h,t.tails,{trimBeforeMatching:!0,cb:(w,b,v)=>(p=v,!0)})&&i.push(d,p),u.current()&&o&&$!=="tails"&&i.push(u.current()),o||u.current()&&(i.push(u.current()),u.wipe()),u.push(d,h),$="heads",d=h-1;continue}if(D(e,d,t.tails,{trimBeforeMatching:!0,cb:(p,w,b)=>(h=Number.isInteger(b)?b:e.length,!0)})&&h){c=!0,a?($==="heads"&&u.wipe(),a=!1):u.push(d,h),$="tails",d=h-1;continue}a&&(a=!0),c&&!o?(o=!0,c=!1):c&&!l?(l=!0,a=!0,c=!1,$==="heads"&&u.wipe()):c&&l&&u.wipe()}return u.current()&&i.push(u.current()),i.current()?P(e,i.current()).trim():e.trim()}function Pe(e,r,n){let s,f;return T(e)&&e.length&&D(e,0,r,{trimBeforeMatching:!0,cb:(t,o,l)=>(s=l,!0)})&&C(e,e.length-1,n,{trimBeforeMatching:!0,cb:(t,o,l)=>(f=(l||0)+1,!0)})?e.slice(s,f):e}function fe(e,r,n=!1,s,f,t){if(r.wrapHeadsWith||(r.wrapHeadsWith=""),r.wrapTailsWith||(r.wrapTailsWith=""),T(e)&&!n&&r.wrapGlobalFlipSwitch&&!r.dontWrapVars.some(o=>z(t,o))&&(!r.preventDoubleWrapping||r.preventDoubleWrapping&&T(e)&&!e.includes(r.wrapHeadsWith)&&!e.includes(r.wrapTailsWith)))return"".concat(r.wrapHeadsWith).concat(e).concat(r.wrapTailsWith);if(n){if(!T(e))return e;let o=je(e,{heads:r.wrapHeadsWith,tails:r.wrapTailsWith});return T(o)?Pe(o,r.wrapHeadsWith,r.wrapTailsWith):o}return e}var Be="12.1.3";var fr=Be,cr=Object.prototype.hasOwnProperty,Je={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function O(e){return T(e)?e.trim():e}function gr(e,r,n,s){let f;if(n.indexOf(".")!==-1){let t=n,o=!0;if(s.lookForDataContainers&&T(s.dataContainerIdentifierTails)&&s.dataContainerIdentifierTails.length&&!t.endsWith(s.dataContainerIdentifierTails)){let l=N.default.get(e,t+s.dataContainerIdentifierTails);E(l)&&N.default.get(l,r)&&(f=N.default.get(l,r),o=!1)}for(;o&&t.indexOf(".")!==-1;){if(t=le(t),ue(t)===r)throw new Error('json-variables/findValues(): [THROW_ID_20] While trying to resolve: "'.concat(r,'" at path "').concat(n,'", we encountered a closed loop. The parent key "').concat(ue(t),'" is called the same as the variable "').concat(r,"\" we're looking for."));if(s.lookForDataContainers&&T(s.dataContainerIdentifierTails)&&s.dataContainerIdentifierTails.length&&!t.endsWith(s.dataContainerIdentifierTails)){let l=N.default.get(e,t+s.dataContainerIdentifierTails);E(l)&&N.default.get(l,r)&&(f=N.default.get(l,r),o=!1)}if(f===void 0){let l=N.default.get(e,t);E(l)&&N.default.get(l,r)&&(f=N.default.get(l,r),o=!1)}}}if(f===void 0){let t=N.default.get(e,r);t!==void 0&&(f=t)}if(f===void 0)if(r.indexOf(".")===-1){let t=ae(e,r);if(t.length){for(let o=0,l=t.length;o<l;o++)if(T(t[o].val)||U(t[o].val)||J(t[o].val)){f=t[o].val;break}else if(H(t[o].val)){f=t[o].val;break}else if(Array.isArray(t[o].val)){f=t[o].val.join("");break}}}else{let t=ae(e,He(r));if(t.length)for(let o=0,l=t.length;o<l;o++){let i=N.default.get(t[o].val,Ce(r));i&&T(i)&&(f=i)}}return f}function Me(e,r,n,s,f=[]){if(f.includes(n)){let g="";if(f.length>1){let d=" \u2192\n";g=f.reduce((m,h,p)=>m+(p===0?"":d)+(h===n?"\u{1F4A5} ":" ")+h," Here's the path we travelled up until we hit the recursion:\n\n"),g+="".concat(d,"\u{1F4A5} ").concat(n)}throw new Error('json-variables/resolveString(): [THROW_ID_19] While trying to resolve: "'.concat(r,'" at path "').concat(n,'", we encountered a closed loop, the key is referencing itself."').concat(g))}let t={},o=Array.from(f);o.push(n);let l=new M,i;function u(g,d,m){for(let h=0,p=g.length;h<p;h++){let w=g[h],b=r.slice(w.headsEndAt,w.tailsStartAt);if(b.length===0)l.push(w.headsStartAt,w.tailsEndAt);else if(cr.call(t,b)&&T(t[b]))l.push(w.headsStartAt,w.tailsEndAt,t[b]);else{if(i=gr(e,b.trim(),n,s),i===void 0)if(s.allowUnresolved===!0)i="";else if(T(s.allowUnresolved))i=s.allowUnresolved;else throw new Error("json-variables/processHeadsAndTails(): [THROW_ID_18] We couldn't find the value to resolve the variable ".concat(r.slice(w.headsEndAt,w.tailsStartAt),". We're at path: \"").concat(n,'".'));if(!m&&s.throwWhenNonStringInsertedInString&&!T(i))throw new Error("json-variables/processHeadsAndTails(): [THROW_ID_23] While resolving the variable ".concat(r.slice(w.headsEndAt,w.tailsStartAt)," at path ").concat(n,", it resolved into a non-string value, ").concat(JSON.stringify(i,null,4),'. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").'));if(U(i)){if(s.resolveToBoolIfAnyValuesContainBool)return l.wipe(),s.resolveToFalseIfAnyValuesContainBool?!1:i;i=""}else{if(J(i)&&m)return l.wipe(),i;Array.isArray(i)?i=String(i.join("")):J(i)?i="":(!H(i)||!m)&&(i=String(i))}let v=n.includes(".")?"".concat(le(n),".").concat(b):b;if(Z(i,s)){let W=fe(Me(e,i,v,s,o),s,d,o,v,b.trim());W!==!1&&l.push(w.headsStartAt,w.tailsEndAt,W)}else{t[b]=i;let W=fe(i,s,d,o,v,b.trim());W!==!1&&l.push(w.headsStartAt,w.tailsEndAt,W)}}}}let a;try{a=re(r,s.heads,s.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(g){throw new Error('json-variables/resolveString(): [THROW_ID_17] While trying to resolve string: "'.concat(r,'" at path ').concat(n,", something wrong with heads and tails was detected! Here's the internal error message:\n").concat(g))}let c=!1;a.length===1&&P(r,[[a[0].headsStartAt,a[0].tailsEndAt]]).trim()===""&&(c=!0);let $=u(a,!1,c);if(typeof $=="boolean"||$===null)return $;try{a=re(r,s.headsNoWrap,s.tailsNoWrap,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(g){throw new Error('json-variables/resolveString(): [THROW_ID_22] While trying to resolve string: "'.concat(r,'" at path ').concat(n,", something wrong with no-wrap heads and no-wrap tails was detected! Here's the internal error message:\n").concat(g))}a.length===1&&P(r,[[a[0].headsStartAt,a[0].tailsEndAt]]).trim()===""&&(c=!0);let y=u(a,!0,c);if(U(y)||J(y))return y;if(l!=null&&l.current()){let g=l.current();if(c){if(typeof i=="number")return i;if((g==null?void 0:g.length)===1&&g[0].length===3&&H(g[0][2]))return g[0][2]}return P(r,g)}return r}function hr(e,r){if(!arguments.length)throw new Error("json-variables/jVar(): [THROW_ID_01] Alas! Inputs are missing!");if(!E(e))throw new TypeError("json-variables/jVar(): [THROW_ID_02] Alas! The input must be a plain object! Currently it's: ".concat(Array.isArray(e)?"array":typeof e));if(r&&!E(r))throw new TypeError("json-variables/jVar(): [THROW_ID_03] Alas! An Optional Options Object must be a plain object! Currently it's: ".concat(Array.isArray(r)?"array":typeof r));let n=A(A({},Je),r);n.dontWrapVars?Array.isArray(n.dontWrapVars)||(n.dontWrapVars=S(n.dontWrapVars)):n.dontWrapVars=[];let s,f;if(n.dontWrapVars.length&&!n.dontWrapVars.every((o,l)=>T(o)?!0:(s=o,f=l,!1)))throw new Error('json-variables/jVar(): [THROW_ID_05] Alas! All variable names set in resolvedOpts.dontWrapVars should be of a string type. Computer detected a value "'.concat(s,'" at index ').concat(f,", which is not string but ").concat(Array.isArray(s)?"array":typeof s,"!"));if(n.heads==="")throw new Error("json-variables/jVar(): [THROW_ID_06] Alas! resolvedOpts.heads are empty!");if(n.tails==="")throw new Error("json-variables/jVar(): [THROW_ID_07] Alas! resolvedOpts.tails are empty!");if(n.lookForDataContainers&&n.dataContainerIdentifierTails==="")throw new Error("json-variables/jVar(): [THROW_ID_08] Alas! resolvedOpts.dataContainerIdentifierTails is empty!");if(n.heads===n.tails)throw new Error("json-variables/jVar(): [THROW_ID_09] Alas! resolvedOpts.heads and resolvedOpts.tails can't be equal!");if(n.heads===n.headsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_10] Alas! resolvedOpts.heads and resolvedOpts.headsNoWrap can't be equal!");if(n.tails===n.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_11] Alas! resolvedOpts.tails and resolvedOpts.tailsNoWrap can't be equal!");if(n.headsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_12] Alas! resolvedOpts.headsNoWrap is an empty string!");if(n.tailsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_13] Alas! resolvedOpts.tailsNoWrap is an empty string!");if(n.headsNoWrap===n.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_14] Alas! resolvedOpts.headsNoWrap and resolvedOpts.tailsNoWrap can't be equal!");let t;return K(e,(o,l,i)=>{if(I(l)&&Z(o,n))throw new Error("json-variables/jVar(): [THROW_ID_15] Alas! Object keys can't contain variables!\nPlease check the following key: ".concat(o));if(l!==void 0?t=l:t=o,t==="")return t;if(n.heads.length&&O(t)===O(n.heads)||n.tails.length&&O(t)===O(n.tails)||n.headsNoWrap.length&&O(t)===O(n.headsNoWrap)||n.tailsNoWrap.length&&O(t)===O(n.tailsNoWrap)){if(!n.noSingleMarkers)return t;throw new Error("json-variables/jVar(): [THROW_ID_16] Alas! While processing the input, we stumbled upon ".concat(O(t)," which is equal to ").concat(O(t)===O(n.heads)?"heads":"").concat(O(t)===O(n.tails)?"tails":"").concat(T(n.headsNoWrap)&&O(t)===O(n.headsNoWrap)?"headsNoWrap":"").concat(T(n.tailsNoWrap)&&O(t)===O(n.tailsNoWrap)?"tailsNoWrap":"",'. If you wouldn\'t have set resolvedOpts.noSingleMarkers to "true" this error would not happen and computer would have left the current element (').concat(O(t),") alone"))}return T(t)&&Z(t,n)?Me(e,t,i.path,n):t})}return Qe(pr);})();
11
- /**
12
- * @name codsen-utils
13
- * @fileoverview Various utility functions
14
- * @version 1.7.3
15
- * @author Roy Revelt
16
- * @license MIT
17
- * {@link https://codsen.com/os/codsen-utils/}
18
- */
10
+ "use strict";var jsonVariables=(()=>{var Pe=Object.create;var B=Object.defineProperty,ke=Object.defineProperties,Be=Object.getOwnPropertyDescriptor,Fe=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertyNames,pe=Object.getOwnPropertySymbols,Je=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable;var ne=(e,t,r)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))ce.call(t,r)&&ne(e,r,t[r]);if(pe)for(var r of pe(t))Ue.call(t,r)&&ne(e,r,t[r]);return e},F=(e,t)=>ke(e,Fe(t));var qe=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ke=(e,t)=>{for(var r in t)B(e,r,{get:t[r],enumerable:!0})},de=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Le(t))!ce.call(e,o)&&o!==r&&B(e,o,{get:()=>t[o],enumerable:!(i=Be(t,o))||i.enumerable});return e};var ze=(e,t,r)=>(r=e!=null?Pe(Je(e)):{},de(t||!e||!e.__esModule?B(r,"default",{value:e,enumerable:!0}):r,e)),Ge=e=>de(B({},"__esModule",{value:!0}),e);var N=(e,t,r)=>ne(e,typeof t!="symbol"?t+"":t,r);var De=qe((Ee,Y)=>{(function(e,t){"use strict";typeof Y=="object"&&typeof Y.exports=="object"?Y.exports=t():typeof define=="function"&&define.amd?define([],t):e.objectPath=t()})(Ee,function(){"use strict";var e=Object.prototype.toString;function t(g,c){return g==null?!1:Object.prototype.hasOwnProperty.call(g,c)}function r(g){if(!g||n(g)&&g.length===0)return!0;if(typeof g!="string"){for(var c in g)if(t(g,c))return!1;return!0}return!1}function i(g){return e.call(g)}function o(g){return typeof g=="object"&&i(g)==="[object Object]"}var n=Array.isArray||function(g){return e.call(g)==="[object Array]"};function s(g){return typeof g=="boolean"||i(g)==="[object Boolean]"}function a(g){var c=parseInt(g);return c.toString()===g?c:g}function h(g){g=g||{};var c=function(d){return Object.keys(c).reduce(function(f,m){return m==="create"||typeof c[m]=="function"&&(f[m]=c[m].bind(c,d)),f},{})},T;g.includeInheritedProps?T=function(){return!0}:T=function(d,f){return typeof f=="number"&&Array.isArray(d)||t(d,f)};function b(d,f){if(T(d,f))return d[f]}var u;g.includeInheritedProps?u=function(d,f){typeof f!="string"&&typeof f!="number"&&(f=String(f));var m=b(d,f);if(f==="__proto__"||f==="prototype"||f==="constructor"&&typeof m=="function")throw new Error("For security reasons, object's magic properties cannot be set");return m}:u=function(d,f){return b(d,f)};function p(d,f,m,y){if(typeof f=="number"&&(f=[f]),!f||f.length===0)return d;if(typeof f=="string")return p(d,f.split(".").map(a),m,y);var w=f[0],O=u(d,w);return f.length===1?((O===void 0||!y)&&(d[w]=m),O):(O===void 0&&(typeof f[1]=="number"?d[w]=[]:d[w]={}),p(d[w],f.slice(1),m,y))}return c.has=function(d,f){if(typeof f=="number"?f=[f]:typeof f=="string"&&(f=f.split(".")),!f||f.length===0)return!!d;for(var m=0;m<f.length;m++){var y=a(f[m]);if(typeof y=="number"&&n(d)&&y<d.length||(g.includeInheritedProps?y in Object(d):t(d,y)))d=d[y];else return!1}return!0},c.ensureExists=function(d,f,m){return p(d,f,m,!0)},c.set=function(d,f,m,y){return p(d,f,m,y)},c.insert=function(d,f,m,y){var w=c.get(d,f);y=~~y,n(w)||(w=[],c.set(d,f,w)),w.splice(y,0,m)},c.empty=function(d,f){if(!r(f)&&d!=null){var m,y;if(m=c.get(d,f)){if(typeof m=="string")return c.set(d,f,"");if(s(m))return c.set(d,f,!1);if(typeof m=="number")return c.set(d,f,0);if(n(m))m.length=0;else if(o(m))for(y in m)T(m,y)&&delete m[y];else return c.set(d,f,null)}}},c.push=function(d,f){var m=c.get(d,f);n(m)||(m=[],c.set(d,f,m)),m.push.apply(m,Array.prototype.slice.call(arguments,2))},c.coalesce=function(d,f,m){for(var y,w=0,O=f.length;w<O;w++)if((y=c.get(d,f[w]))!==void 0)return y;return m},c.get=function(d,f,m){if(typeof f=="number"&&(f=[f]),!f||f.length===0)return d;if(d==null)return m;if(typeof f=="string")return c.get(d,f.split("."),m);var y=a(f[0]),w=u(d,y);return w===void 0?m:f.length===1?w:c.get(d[y],f.slice(1),m)},c.del=function(f,m){if(typeof m=="number"&&(m=[m]),f==null||r(m))return f;if(typeof m=="string")return c.del(f,m.split("."));var y=a(m[0]);if(u(f,y),!T(f,y))return f;if(m.length===1)n(f)?f.splice(y,1):delete f[y];else return c.del(f[y],m.slice(1));return f},c}var l=h();return l.create=h,l.withInheritedProps=h({includeInheritedProps:!0}),l})});var Dt={};Ke(Dt,{defaults:()=>Me,jVar:()=>Et,version:()=>At});function D(e){return typeof e!="string"?e:e.length?[e]:[]}function Qe(){let e=[],t=0,r=!1;return{append(i){return r?!1:t+i.length>1999?(e.push("\u2026"),t+=1,r=!0,!1):(e.push(i),t+=i.length,!0)},result(){return e.join("")},stopped(){return r}}}function Ze(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function z(e,t){if(e.append('"')){for(let r=0;r<t.length&&!e.stopped();r+=1){let i=t.charCodeAt(r);i===34?e.append('\\"'):i===92?e.append("\\\\"):i===8?e.append("\\b"):i===9?e.append("\\t"):i===10?e.append("\\n"):i===12?e.append("\\f"):i===13?e.append("\\r"):i<32||i===8232||i===8233||i>=55296&&i<=57343?e.append(Ze(i)):e.append(t[r])}e.append('"')}}function Ye(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function be(e,t){e.append("Symbol(");let r=String(t);r.length>8&&z(e,r.slice(7,-1)),e.append(")")}function me(e,t){typeof t=="symbol"?be(e,t):z(e,String(t))}function v(e,t=0){let r=Qe(),i=t===4?4:0,o=new WeakSet,n=0;function s(u){i&&r.append(" ".repeat(u*i))}function a(u,p){u&&r.append(","),i&&(r.append("\n"),s(p+1))}function h(u,p,d){i&&p&&(r.append("\n"),s(d)),r.append(u)}function l(u,p){Object.prototype.hasOwnProperty.call(u,"value")?b(u.value,p):r.append(Ye(u))}function g(u,p){let d;try{d=Reflect.getOwnPropertyDescriptor(u,"length")}catch(y){r.append("[Uninspectable]");return}let f=d==null?void 0:d.value;if(!Number.isSafeInteger(f)||f<0){r.append("[Uninspectable]");return}r.append("[");let m=!1;for(let y=0;y<f&&!r.stopped();y+=1){if(a(m,p),m=!0,n>=50){r.append("[MaxEntries]");break}n+=1;let w;try{w=Reflect.getOwnPropertyDescriptor(u,String(y))}catch(O){r.append("[Uninspectable]");continue}w!=null&&w.enumerable?l(w,p+1):r.append("[Empty]")}h("]",m,p)}function c(u,p){let d;try{d=Reflect.ownKeys(u)}catch(m){r.append("[Uninspectable]");return}r.append("{");let f=!1;for(let m of d){if(r.stopped())break;if(n>=50){a(f,p),f=!0,z(r,"\u2026"),r.append(i?": ":":"),r.append("[MaxEntries]");break}n+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(u,m)}catch(w){a(f,p),f=!0,me(r,m),r.append(i?": ":":"),r.append("[Uninspectable]");continue}y!=null&&y.enumerable&&(a(f,p),f=!0,me(r,m),r.append(i?": ":":"),l(y,p+1))}h("}",f,p)}function T(u,p){if(o.has(u)){r.append("[Circular]");return}if(p>=5){r.append("[MaxDepth]");return}let d;try{d=Array.isArray(u)}catch(f){r.append("[Uninspectable]");return}o.add(u);try{d?g(u,p):c(u,p)}finally{o.delete(u)}}function b(u,p){u===null?r.append("null"):typeof u=="string"?z(r,u):typeof u=="number"?r.append(Object.is(u,-0)?"-0":String(u)):typeof u=="boolean"?r.append(u?"true":"false"):typeof u>"u"?r.append("undefined"):typeof u=="bigint"?r.append("".concat(u,"n")):typeof u=="symbol"?be(r,u):typeof u=="function"?r.append("[Function]"):T(u,p)}try{return b(e,0),r.result()}catch(u){return"[Uninspectable]"}}var Vt=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"]),Xe=Object.prototype.hasOwnProperty,et=class{constructor(){N(this,"hasRepeatedReferences",!1);N(this,"clones",[]);N(this,"index");N(this,"sources",[])}get(e){if(this.index){let r=this.index.get(e);return r!==void 0&&(this.hasRepeatedReferences=!0),r}let t=this.sources.indexOf(e);if(t!==-1)return this.hasRepeatedReferences=!0,this.clones[t]}set(e,t){if(this.index){this.index.set(e,t);return}if(this.sources.push(e),this.clones.push(t),this.sources.length===32){this.index=new WeakMap;for(let r=0;r<this.sources.length;r++)this.index.set(this.sources[r],this.clones[r]);this.sources=[],this.clones=[]}}};function we(e,t){let r=t.get(e);if(r!==void 0)return r;let i=e.slice(0);return t.set(e,i),i}function tt(e,t){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let n=Buffer.from(e);return t.set(e,n),n}let r=we(e.buffer,t);if(e instanceof DataView){let n=new DataView(r,e.byteOffset,e.byteLength);return t.set(e,n),n}let i=e.constructor,o=new i(r,e.byteOffset,e.length);return t.set(e,o),o}function ie(e,t,r,i){for(let o of r){let n=t[o];e[o]=typeof n!="object"||n===null?n:C(n,i)}}function C(e,t){if(typeof e!="object"||e===null)return e;let r=t.get(e);if(r!==void 0)return r;if(Array.isArray(e)){let n=e.length,s=new Array(n);t.set(e,s);let a=e,h=Object.keys(e);if(h.length===n&&(n===0||h[n-1]==="".concat(n-1)))for(let l=0;l<n;l++){let g=a[l];s[l]=typeof g!="object"||g===null?g:C(g,t)}else ie(s,a,h,t);return s}let i=Object.getPrototypeOf(e);if(i===Object.prototype||i===null){let n={};return t.set(e,n),ie(n,e,Object.keys(e),t),n}if(e instanceof Date){let n=new Date(e.getTime());return t.set(e,n),n}if(ArrayBuffer.isView(e))return tt(e,t);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return we(e,t);if(e instanceof Map){let n=new Map;t.set(e,n);for(let[s,a]of e)n.set(C(s,t),C(a,t));return n}if(e instanceof Set){let n=new Set;t.set(e,n);for(let s of e)n.add(C(s,t));return n}let o={};return t.set(e,o),ie(o,e,Object.keys(e),t),o}function x(e){return C(e,new et)}function W(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function $(e){return typeof e=="string"}function M(e){return Number.isFinite(e)}function H(e){return Number.isSafeInteger(e)&&e>=0}function G(e){return typeof e=="boolean"}function L(e){return e===null}function S(e){return e!=null}function $e(e,t){return W(e)&&$(t)&&Xe.call(e,t)}var rt=256,nt=1024,it=1,st=new Map,at=new Map;function ae(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let t=String.fromCharCode(e).toUpperCase();if(t.length!==1)return e;let r=t.charCodeAt(0);return e>127&&r<128?e:r}function se(e,t,r,i,o,n){for(let s=0;s<o;s++){let a=e.charCodeAt(t+s),h=r.charCodeAt(i+s);if(n||(a>=97&&a<=122&&(a-=32),h>=97&&h<=122&&(h-=32)),a!==h)return!1}return!0}function Te(e,t,r){let i=t.indexOf("\\");if(i===-1&&e===t)return!0;let o=t.indexOf("*");if(i===-1&&o===-1){if(r)return!1;for(let g=0;g<t.length;g++)if(t.charCodeAt(g)>127)return;return e.length===t.length&&se(e,0,t,0,t.length,!1)}if(i!==-1)return;let n=0,s=!1,a=-1;for(let g=0;g<t.length;g++){let c=t.charCodeAt(g);if(c>127)return;if(c===42){if(a=g,!s){if(n++,n>1)return;s=!0}}else s=!1}let h=a+1,l=t.length-h;return e.length<o+l?!1:se(e,0,t,0,o,r)&&se(e,e.length-l,t,h,l,r)}function ot(e){let t=new Uint32Array(e.length),r=0;for(let i=1;i<e.length;i++){for(;r>0&&e[i]!==e[r];)r=t[r-1];e[i]===e[r]&&r++,t[i]=r}return t}function lt(e,t){let r=[[]],i=!0,o=!1,n=!1,s=0;for(let T=0;T<e.length;){let b=e.codePointAt(T);if(b!==92){if(b===42)o=!0,n||(r.push([]),n=!0);else{let y=t?b:ae(b);r[r.length-1].push(y),i&&(i=y<=127),s++,n=!1}T+=b>65535?2:1;continue}let u=T+1;for(;e.charCodeAt(u)===92;)u++;let p=u-T,d=e.codePointAt(u),f,m=!1;d===42?(m=p%2===0,f=m?p/2:(p-1)/2):d===void 0||d===10||d===13||d===8232||d===8233?f=Math.ceil(p/2):f=Math.floor(p/2);for(let y=0;y<f;y++)r[r.length-1].push(92),s++;if(m){n=!1,T=u;continue}if(d!==void 0){let y=t?d:ae(d);r[r.length-1].push(y),i&&(i=y<=127),s++,u+=d>65535?2:1}n=!1,T=u}let a=o&&r[0].length===0,h=o&&r[r.length-1].length===0,l=[];for(let T of r)T.length&&l.push({values:T});let g=a?0:1,c=l.length-(h?0:1);for(let T=g;T<c;T++)l[T].values.length>it&&(l[T].failure=ot(l[T].values));return{asciiOnly:i,endsWithWildcard:h,hasWildcard:o,minimumInputLength:s,segments:l,startsWithWildcard:a}}function ve(e,t){let r=t?st:at,i=e.length<=nt;if(i){let n=r.get(e);if(n)return n}let o=lt(e,t);if(i){if(r.size>=rt){let n=r.keys().next().value;n!==void 0&&r.delete(n)}r.set(e,o)}return o}function Ae(e,t){if(t){let o=[];for(let n=0;n<e.length;){let s=e.codePointAt(n);o.push(s),n+=s>65535?2:1}return o}let r=new Uint32Array(e.length),i=0;for(let o=0;o<e.length;){let n=e.codePointAt(o);r[i]=ae(n),i++,o+=n>65535?2:1}return i===r.length?r:r.subarray(0,i)}function q(e,t,r,i){for(let o=0;o<r.values.length;o++){let n=e.charCodeAt(t+o);if(!i&&n>=97&&n<=122&&(n-=32),n!==r.values[o])return!1}return!0}function ut(e,t,r,i,o){let n=i-t.values.length;if(n<r)return-1;if(!t.failure){for(let a=r;a<=n;a++)if(q(e,a,t,o))return a;return-1}let s=0;for(let a=r;a<i;a++){let h=e.charCodeAt(a);for(!o&&h>=97&&h<=122&&(h-=32);s>0&&h!==t.values[s];)s=t.failure[s-1];if(h===t.values[s]&&(s++,s===t.values.length))return a-s+1}return-1}function Oe(e,t,r){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&q(e,0,t.segments[0],r);let i=0,o=t.segments.length,n=0,s=e.length;if(!t.startsWithWildcard){let a=t.segments[0];if(!q(e,0,a,r))return!1;n=a.values.length,i++}if(!t.endsWithWildcard){o--;let a=t.segments[o];if(s-=a.values.length,!q(e,s,a,r))return!1}for(let a=i;a<o;a++){let h=t.segments[a],l=ut(e,h,n,s,r);if(l===-1)return!1;n=l+h.values.length}return!0}function K(e,t,r){for(let i=0;i<r.values.length;i++)if(e[t+i]!==r.values[i])return!1;return!0}function ft(e,t,r,i){let o=i-t.values.length;if(o<r)return-1;if(!t.failure){for(let s=r;s<=o;s++)if(K(e,s,t))return s;return-1}let n=0;for(let s=r;s<i;s++){for(;n>0&&e[s]!==t.values[n];)n=t.failure[n-1];if(e[s]===t.values[n]&&(n++,n===t.values.length))return s-n+1}return-1}function We(e,t){if(e.length<t.minimumInputLength)return!1;if(!t.hasWildcard)return e.length===t.minimumInputLength&&K(e,0,t.segments[0]);let r=0,i=t.segments.length,o=0,n=e.length;if(!t.startsWithWildcard){let s=t.segments[0];if(!K(e,0,s))return!1;o=s.values.length,r++}if(!t.endsWithWildcard){i--;let s=t.segments[i];if(n-=s.values.length,!K(e,n,s))return!1}for(let s=r;s<i;s++){let a=t.segments[s],h=ft(e,a,o,n);if(h===-1)return!1;o=h+a.values.length}return!0}function ht(e,t,r){let i=Te(e,t,r);if(i!==void 0)return i;let o=ve(t,r);return o.asciiOnly?Oe(e,o,r):We(Ae(e,r),o)}function ye(e,t,r,i){var s;let o=Te(e,t,r);if(o!==void 0)return o;let n=ve(t,r);return n.asciiOnly?Oe(e,n,r):((s=i.tokens)!=null||(i.tokens=Ae(e,r)),We(i.tokens,n))}function Q(e,t,r){if(typeof t!="string"&&!t.length)return!1;let i=r===void 0?!1:r.caseSensitiveMatch===!0;if(typeof t=="string"){let a=t.charCodeAt(0)===33,h=a?t.slice(1):t,l=ht(e,h,i);return a?!l:l}let o={},n=!1,s=!1;for(let a of t){let h=a.charCodeAt(0)===33,l=h?a.slice(1):a;if(h){if(ye(e,l,i,o))return!1}else n=!0,!s&&ye(e,l,i,o)&&(s=!0)}return n?s:!0}function Z(e,t){if(typeof t!="function")throw new TypeError("ast-monkey-traverse/traverse(): [THROW_ID_01] The second argument must be a callback function. It was ".concat(typeof t,"."));let r={now:!1};function i(o,n,s,a){let h=o,l,g=A({depth:-1,path:""},s);if(g.depth+=1,Array.isArray(h))for(let c=0,T=h.length;c<T&&!a.now;c++){let b=g.path?"".concat(g.path,".").concat(c):"".concat(c);if(h[c]!==void 0){g.parent=x(h),g.parentType="array",g.parentKey=g.path?g.path.slice(g.path.lastIndexOf(".")+1):null;let u=h[c],p=n(u,void 0,F(A({},g),{path:b}),a);l=i(p===u?p:x(p),n,F(A({},g),{path:b}),a),Number.isNaN(l)&&c<h.length?(h.splice(c,1),c-=1):h[c]=l}else h.splice(c,1)}else if(W(h))for(let c in h){if(a.now&&c!=null)break;let T=g.path?"".concat(g.path,".").concat(c):c;g.depth===0&&c!=null&&(g.topmostKey=c),g.parent=x(h),g.parentType="object",g.parentKey=g.path?g.path.slice(g.path.lastIndexOf(".")+1):null;let b=h[c],u=n(c,b,F(A({},g),{path:T}),a);l=i(u===b?u:x(u),n,F(A({},g),{path:T}),a),Number.isNaN(l)?delete h[c]:h[c]=l}return h}return i(x(e),t,{},r)}function oe(e,t,r){let i;r!==void 0&&(i=Array.isArray(r)?x(r):[x(r)]);let o=[],n=Z(e,(s,a,h)=>{let l=a!==void 0?a:s;if(a!==void 0&&Q(s,t,{caseSensitiveMatch:!0})){if(i===void 0)o.push({val:a,path:h.path});else if(i.length)return i.shift()}return l});return i===void 0?o:n}var R=ze(De(),1);var gt={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function j(e,t){if(!Array.isArray(e)||!e.length)return e;let r=A(A({},gt),t),i,o;if(r.strictlyTwoElementsInRangeArrays&&!e.every((a,h)=>!Array.isArray(a)||a.length!==2?(i=h,o=a.length,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(i,"th range (").concat(v(e[i],4),") has not two but ").concat(o," elements!"));if(!e.every((a,h)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(i=h,!1):!0))throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(i,"th range (").concat(v(e[i],4),") does not consist of only natural numbers!"));let n=e.length**2,s=0;return Array.from(e).sort((a,h)=>(r.progressFn&&(s+=1,r.progressFn(Math.floor(s*100/n))),a[0]===h[0]?a[1]<h[1]?-1:a[1]>h[1]?1:0:a[0]<h[0]?-1:1))}var pt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function le(e,t){function r(l){return!!l&&typeof l=="object"&&!Array.isArray(l)}if(!Array.isArray(e)||!e.length)return null;if(t&&!r(t))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(v(t,4)," (type ").concat(typeof t,")"));let i=A(A({},pt),t);if(i.progressFn&&r(i.progressFn)&&!Object.keys(i.progressFn).length)i.progressFn=null;else if(i.progressFn&&typeof i.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof i.progressFn,'", equal to ').concat(v(i.progressFn,4)));if(![1,2,"1","2"].includes(i.mergeType))throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof i.mergeType,'", equal to ').concat(v(i.mergeType,4)));if(typeof i.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof i.joinRangesThatTouchEdges,'", equal to ').concat(v(i.joinRangesThatTouchEdges,4)));let o=e.filter(l=>Array.isArray(l)).map(l=>[...l]).filter(l=>l[2]!==void 0||l[0]!==l[1]),n,s,a;i.progressFn?n=j(o,{progressFn:l=>{a=Math.floor(l/5),a!==s&&(s=a,i.progressFn(a))}}):n=j(o);let h=n.length-1;for(let l=h;l>0;l--)i.progressFn&&(a=Math.floor((1-l/h)*78)+21,a!==s&&a>s&&(s=a,i.progressFn(a))),(n[l][0]<=n[l-1][0]||!i.joinRangesThatTouchEdges&&n[l][0]<n[l-1][1]||i.joinRangesThatTouchEdges&&n[l][0]<=n[l-1][1])&&(n[l-1][0]=Math.min(n[l][0],n[l-1][0]),n[l-1][1]=Math.max(n[l][1],n[l-1][1]),n[l][2]!==void 0&&(n[l-1][0]>=n[l][0]||n[l-1][1]<=n[l][1])&&n[l-1][2]!==null&&(n[l][2]===null&&n[l-1][2]!==null?n[l-1][2]=null:n[l-1][2]!=null?+i.mergeType==2&&n[l-1][0]===n[l][0]?n[l-1][2]=n[l][2]:n[l-1][2]+=n[l][2]:n[l-1][2]=n[l][2]),n.splice(l,1),l=n.length);return n.length?n:null}function X(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let t=Number(e);return Number.isInteger(t)&&t>=0}function P(e,t,r){let i=0,o=0;if(e===void 0&&t===void 0&&r===void 0)throw new Error("ranges-apply/rApply(): [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply/rApply(): [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(v(e,4)));if(t!=null&&!Array.isArray(t))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof t,", equal to: ").concat(v(t,4)));if(r&&typeof r!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function (or falsy)! Currently it's: ".concat(typeof r,", equal to: ").concat(v(r,4)));if(!(t!=null&&t.some(Boolean)))return e;let n;Array.isArray(t)&&!Array.isArray(t[0])&&X(t[0])&&X(t[1])?n=[Array.from(t)]:n=Array.from(t);let s=n.length,a=0;n.forEach((g,c)=>{if(g){if(r&&(i=Math.floor(a/s*10),i!==o&&(o=i,r(i))),!Array.isArray(g))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(c,"th element not an array: ").concat(v(g,4),", which is ").concat(typeof g));if(!X(g[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(c,"th element, array ").concat(v(g),". Its first element is not a non-negative integer or string index, but ").concat(typeof g[0],", equal to: ").concat(v(g[0],4),"."));if(typeof g[0]=="string"&&(n[c]=[...g],n[c][0]=Number(g[0])),!X(g[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(c,"th element, array ").concat(v(g),". Its second element is not a non-negative integer or string index, but ").concat(typeof g[1],", equal to: ").concat(v(g[1],4),"."));typeof g[1]=="string"&&(n[c]===g&&(n[c]=[...g]),n[c][1]=Number(g[1])),a+=1}});let h=r?le(n,{progressFn:g=>{i=10+Math.floor(g/10),i!==o&&(o=i,r(i))}}):le(n),l=(h==null?void 0:h.length)||0;if(h&&l>0){let g=e.slice(h[l-1][1]);e=h.reduce((c,T,b,u)=>{r&&(i=20+Math.floor(b/l*80),i!==o&&(o=i,r(i)));let p=b===0?0:u[b-1][1],d=u[b][0];return"".concat(c).concat(e.slice(p,d)).concat(u[b][2]||"")},""),e+=g}return e}function ee(e,t=1){let r="\xA0";function i(n){return Array.from(n).reverse().join("")}function o(n,s,a){let h=a?"\n":"\r",l=a?"\r":"\n";if(!n)return n;let g=0,c=0,T="";for(let b=0,u=n.length;b<u;b++)(n[b]===h||n[b]===l&&n[b-1]!==h)&&c++,"\r\n".includes(n[b])||n[b]===r?(g=0,n[b]===r?T+=n[b]:n[b]===h?c<=s&&(T+=n[b],n[b+1]===l&&(T+=n[b+1],b++)):n[b]===l&&(n==null?void 0:n[b-1])!==h&&c<=s&&(T+=n[b])):(g++,!n[b+1]&&!c&&(T+=" "));return T}if(typeof e=="string"&&e.length){let n=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(n=+t);let s="",a="";if(!e.trim())s=e;else if(!e[0].trim()){for(let h=0,l=e.length;h<l;h++)if(e[h].trim()){s=e.slice(0,h);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===r)){for(let h=e.length;h--;)if(e[h].trim()){a=e.slice(h+1);break}}return"".concat(o(s,n,!1)).concat(e.trim()).concat(i(o(i(a),n,!0)))}return e}var ct={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function dt(e,t){function r(l){return!!l&&typeof l=="object"&&!Array.isArray(l)}if(!Array.isArray(e)||!e.length)return null;if(t&&!r(t))throw new TypeError("ranges-push/rMerge(): [THROW_ID_10] the second input argument must be a plain object. It was given as:\n".concat(v(t,4)," (type ").concat(typeof t,")"));let i=A(A({},ct),t);if(i.progressFn&&r(i.progressFn)&&!Object.keys(i.progressFn).length)i.progressFn=null;else if(i.progressFn&&typeof i.progressFn!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_11] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof i.progressFn,'", equal to ').concat(v(i.progressFn,4)));if(![1,2,"1","2"].includes(i.mergeType))throw new TypeError('ranges-push/rMerge(): [THROW_ID_12] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof i.mergeType,'", equal to ').concat(v(i.mergeType,4)));if(typeof i.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_13] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof i.joinRangesThatTouchEdges,'", equal to ').concat(v(i.joinRangesThatTouchEdges,4)));let o=e.filter(l=>Array.isArray(l)).map(l=>[...l]).filter(l=>l[2]!==void 0||l[0]!==l[1]),n,s,a;i.progressFn?n=j(o,{progressFn:l=>{a=Math.floor(l/5),a!==s&&(s=a,i.progressFn!=null&&i.progressFn(a))}}):n=j(o);let h=n.length-1;for(let l=h;l>0;l--)i.progressFn&&(a=Math.floor((1-l/h)*78)+21,a!==s&&a>s&&(s=a,i.progressFn(a))),(n[l][0]<=n[l-1][0]||!i.joinRangesThatTouchEdges&&n[l][0]<n[l-1][1]||i.joinRangesThatTouchEdges&&n[l][0]<=n[l-1][1])&&(n[l-1][0]=Math.min(n[l][0],n[l-1][0]),n[l-1][1]=Math.max(n[l][1],n[l-1][1]),n[l][2]!==void 0&&(n[l-1][0]>=n[l][0]||n[l-1][1]<=n[l][1])&&n[l-1][2]!==null&&(n[l][2]===null&&n[l-1][2]!==null?n[l-1][2]=null:n[l-1][2]!=null?+i.mergeType==2&&n[l-1][0]===n[l][0]?n[l-1][2]=n[l][2]:n[l-1][2]+=n[l][2]:n[l-1][2]=n[l][2]),n.splice(l,1),l=n.length);return n.length?n:null}var mt={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1};function Ie(e){return e[2]===void 0&&e[0]===e[1]}function yt(e){let t=-1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(Array.isArray(o)){if(o[0]<t)return!1;t=o[0]}}return!0}var J=class{constructor(e){N(this,"ranges");N(this,"opts");N(this,"sorted");if(e!=null&&!W(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(v(e,4)," (type ").concat(typeof e,")."));let t=A(A({},mt),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if($(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if($(t.mergeType)&&t.mergeType.trim()==="2")t.mergeType=2;else throw new Error('ranges-push/Ranges/constructor(): [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat(v(t.mergeType,4)));this.opts=t,this.ranges=[],this.sorted=!0}add(e,t,r){var n;if(e==null&&t==null)return;if(S(e)&&!S(t)){if(Array.isArray(e)){if(e.length){if(e.some(s=>Array.isArray(s))){e.forEach(s=>{Array.isArray(s)&&this.add(...s)});return}e.length&&H(+e[0])&&H(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_03] the first input argument, "from" is set ('.concat(v(e),') but second-one, "to" is not (').concat(v(t),")"))}else if(!S(e)&&S(t))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_04] the second input argument, "to" is set ('.concat(v(t),') but first-one, "from" is not (').concat(v(e),")"));let i=+e,o=+t;if(H(i)&&H(o)){if(S(r)&&!$(r)&&!M(r))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_05] The third argument, the value to add, was given not as string but ".concat(typeof r,", equal to:\n").concat(v(r,4)));if(S(this.ranges)&&Array.isArray(this.last())&&i===this.last()[1]){if(this.last()[1]=o,this.last()[2],this.last()[2]!==null&&S(r)){let s=this.last()[2]&&this.last()[2].length&&(!((n=this.opts)!=null&&n.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(r):r;this.opts.limitToBeAddedWhitespace&&(s=ee(s,this.opts.limitLinebreaksCount)),$(s)&&!s.length||(this.last()[2]=s)}}else{this.ranges||(this.ranges=[]);let s=this.last();s&&i<s[0]&&(this.sorted=!1);let a=r!==void 0&&!($(r)&&!r.length)?[i,o,r&&this.opts.limitToBeAddedWhitespace?ee(r,this.opts.limitLinebreaksCount):r]:[i,o];this.ranges.push(a)}}else throw H(i)?new TypeError('ranges-push/Ranges/add(): [THROW_ID_07] "to" value, the second input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof t,'" equal to: ').concat(v(t,4))):new TypeError('ranges-push/Ranges/add(): [THROW_ID_06] "from" value, the first input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof e,'" equal to: ').concat(v(e,4)))}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=dt(this.ranges,{mergeType:this.opts.mergeType}),this.sorted=!0,this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>S(e[2])?[e[0],e[1],ee(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}firstCovers(e){if(!H(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_08] the input argument must be a natural number or zero! It was given as ".concat(v(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=null;if(this.sorted){for(let i=0,o=this.ranges.length;i<o;i++){let n=this.ranges[i];if(!(!Array.isArray(n)||Ie(n))){if(t===null){if(n[0]!==0)return!1;t=n[1]}else{if(n[0]>t)break;n[1]>t&&(t=n[1])}if(t>=e)return!0}}return t!==null&&t>=e}let r=!0;for(;r;){r=!1;for(let i=0,o=this.ranges.length;i<o;i++){let n=this.ranges[i];if(!(!Array.isArray(n)||Ie(n))){if(n[0]<0)return!1;(t===null?n[0]===0:n[0]<=t&&n[1]>t)&&(t=n[1],r=!0)}}}return t!==null&&t>=e}wipe(){this.ranges=[],this.sorted=!0}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&H(e[0][0]))this.ranges=Array.from(e),this.sorted=yt(this.ranges);else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_09] Single range was given but we expected array of arrays! The first element, ".concat(v(e[0],4)," should be an array and its first element should be an integer, a string index."));else this.ranges=[],this.sorted=!0}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var Se={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},bt=e=>e+1;function wt(e,t,r,i,o=!1,n=bt){var y;let s=typeof r=="function"?r():r;if(+t<0&&o&&s==="EOL")return s;let a=A(A({},Se),i);if(t>=e.length&&!o)return!1;let h=o?1:r.length,l=0,g=!1,c=!1,T=!1,b=a.maxMismatches,u=t,p=!1,d=!1,f=!1;function m(){return l===1&&b<a.maxMismatches-1}for(;e[u];){let w=n(u);if(a.trimBeforeMatching&&e[u].trim()===""){if(!e[w]&&o&&r==="EOL")return!0;u=n(u);continue}if(a&&!a.i&&((y=a==null?void 0:a.trimCharsBeforeMatching)!=null&&y.includes(e[u]))||a!=null&&a.i&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.map(_=>_.toLowerCase()).includes(e[u].toLowerCase())){if(o&&r==="EOL"&&!e[w])return!0;u=n(u);continue}let O=w>u?r[r.length-h]:r[h-1];if(!a.i&&e[u]===O||a.i&&O!==void 0&&e[u].toLowerCase()===O.toLowerCase()){if(p||(p=!0),T||(T=!0),h===r.length){if(d=!0,b!==a.maxMismatches)return!1}else h===1&&(f=!0);if(h-=1,l++,m())return!1;if(!h)return l!==r.length||b===a.maxMismatches||!g?u:!1}else if(!g&&!l&&(g=!0),a.maxMismatches&&b&&u){b-=1;for(let _=0;_<=b;_++){let I=w>u?r[r.length-h+1+_]:r[h-2-_],re=e[n(u)];if(I&&(!a.i&&e[u]===I||a.i&&e[u].toLowerCase()===I.toLowerCase())&&(!a.firstMustMatch||h!==r.length)){if(l++,m())return!1;h-=2,p=!0;break}else if(re&&I&&(!a.i&&re===I||a.i&&re.toLowerCase()===I.toLowerCase())&&(!a.firstMustMatch||h!==r.length)){if(!l&&!a.hungry)return!1;h-=1,p=!0;break}else if(I===void 0&&b>=0&&p&&(!a.firstMustMatch||d)&&(!a.lastMustMatch||f))return u}p||(c=u)}else return u===0&&h===1&&!a.lastMustMatch&&T?0:!1;if(c!==!1&&c!==u&&(c=!1),h<1)return u;u=n(u)}if(h>0)return o&&s==="EOL"?!0:a&&a.maxMismatches>=h&&T?c||0:!1}function Ve(e,t,r,i,o){var g,c,T;if(W(o)&&$e(o,"trimBeforeMatching")&&o&&typeof o.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_01] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(o.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let n=A(A({},Se),o);if(typeof n.trimCharsBeforeMatching=="string"&&(n.trimCharsBeforeMatching=D(n.trimCharsBeforeMatching)),n.trimCharsBeforeMatching=n.trimCharsBeforeMatching.map(b=>$(b)?b:String(b)),!$(t)||!t.length)return!1;if(!Number.isInteger(r)||r<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_02] the second argument should be a natural number. Currently it's of a type: ").concat(typeof r,", equal to:\n").concat(v(r,4)));let s,a;if($(i))s=[i];else if(Array.isArray(i))s=i;else if(!i)s=i;else if(typeof i=="function")s=[],s.push(i);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof i,", equal to:\n").concat(v(i,4)));if(o&&!W(o))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_04] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof o,'", and equal to:\n').concat(v(o,4)));let h=0,l="";if((g=n==null?void 0:n.trimCharsBeforeMatching)!=null&&g.some((b,u)=>b.length>1?(h=u,l=b,!0):!1))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ").concat(h," is longer than 1 character, ").concat(l.length," (equals to ").concat(l,"). Please split it into separate characters and put into array as separate elements."));if(!s||!Array.isArray(s)||Array.isArray(s)&&!s.length||Array.isArray(s)&&s.length===1&&$(s[0])&&!s[0].trim()){if(typeof n.cb=="function"){let u,p=r;if((e==="matchLeftIncl"||e==="matchRight")&&(p+=1),e[5]==="L")for(let y=p;y--;){let w=t[y];if((!n.trimBeforeMatching||n.trimBeforeMatching&&(w!=null&&w.trim()))&&(!((c=n.trimCharsBeforeMatching)!=null&&c.length)||w!==void 0&&!n.trimCharsBeforeMatching.includes(w))){u=y;break}}else if(e.startsWith("matchRight"))for(let y=p;y<t.length;y++){let w=t[y];if((!n.trimBeforeMatching||n.trimBeforeMatching&&w.trim())&&(!((T=n.trimCharsBeforeMatching)!=null&&T.length)||!n.trimCharsBeforeMatching.includes(w))){u=y;break}}if(u===void 0)return!1;let d=t[u],f=u+1,m="";return f&&f>0&&(m=t.slice(0,f)),e[5]==="L"||u&&u>0&&(m=t.slice(u)),n.cb(d,m,u)}let b="";throw o||(b=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(e,'(): [THROW_ID_06] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!').concat(b))}for(let b=0,u=s.length;b<u;b++){a=typeof s[b]=="function";let p=s[b],d,f,m="",y=r;e==="matchRight"?y+=1:e==="matchLeft"&&(y-=1);let w=wt(t,y,p,n,a,O=>e[5]==="L"?O-1:O+1);if(w&&a&&typeof p=="function"&&p()==="EOL")return p()&&(!n.cb||n.cb(d,m,f))?p():!1;if(Number.isInteger(w)&&(f=e.startsWith("matchLeft")?w-1:w+1,e[5]==="L"?m=t.slice(0,w):m=t.slice(f)),f<0&&(f=void 0),t[f]&&(d=t[f]),Number.isInteger(w)&&(!n.cb||n.cb(d,m,f)))return p}return!1}function k(e,t,r,i){return Ve("matchLeftIncl",e,t,r,i)}function V(e,t,r,i){return Ve("matchRightIncl",e,t,r,i)}var Re={fromIndex:0,throwWhenSomethingWrongIsDetected:!0,allowWholeValueToBeOnlyHeadsOrTails:!0,source:"string-find-heads-tails",matchHeadsAndTailsStrictlyInPairsByTheirOrder:!1,relaxedAPI:!1};function ue(e,t,r,i){if(S(i)&&!W(i))throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_01] the fourth input argument, an Optional Options Object, must be a plain object! Currently it's equal to: ".concat(i," (type: ").concat(typeof i,")"));let o=A(A({},Re),i),n=o.source===Re.source?"":"".concat(o.source,": ");if($(o.fromIndex)&&/^\d*$/.test(o.fromIndex))o.fromIndex=Number(o.fromIndex);else if(!Number.isInteger(o.fromIndex)||o.fromIndex<0)throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_02] ".concat(n,"the fourth input argument must be a natural number or zero! Currently it's: ").concat(o.fromIndex));if(!$(e)||e.length===0){if(o.relaxedAPI)return[];throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_03] the first input argument, input string, must be a non-zero-length string! Currently it's: ".concat(typeof e,", equal to: ").concat(e))}let s,a;if(!$(t)&&!Array.isArray(t)){if(o.relaxedAPI)return[];throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_04] the second input argument, heads, must be either a string or an array of strings! Currently it's: ".concat(typeof t,", equal to:\n").concat(v(t,4)))}else if($(t))if(t.length===0){if(o.relaxedAPI)return[];throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_05] the second input argument, heads, must be a non-empty string! Currently it's empty.")}else t=D(t);else if(Array.isArray(t))if(t.length===0){if(o.relaxedAPI)return[];throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_06] the second input argument, heads, must be a non-empty array and contain at least one string! Currently it's empty.")}else if(t.every((u,p)=>(s=u,a=p,$(u)))){if(!t.every((u,p)=>(a=p,$(u)&&u.length&&u.trim()!=="")))if(o.relaxedAPI){if(t=t.filter(u=>$(u)&&u.length),t.length===0)return[]}else throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_08] the second input argument, heads, should not contain empty strings! For example, there's one detected at index ".concat(a," of heads array:\n").concat(v(t,4),"."))}else if(o.relaxedAPI){if(t=t.filter(u=>$(u)&&u.length),t.length===0)return[]}else throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_07] the second input argument, heads, contains non-string elements! For example, element at ".concat(a,"th index is ").concat(typeof s,", equal to:\n").concat(v(s,4),". Whole heads array looks like:\n").concat(v(t,4)));if(!$(r)&&!Array.isArray(r)){if(o.relaxedAPI)return[];throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_09] the third input argument, tails, must be either a string or an array of strings! Currently it's: ".concat(typeof r,", equal to:\n").concat(v(r,4)))}else if($(r))if(r.length===0){if(o.relaxedAPI)return[];throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_10] the third input argument, tails, must be a non-empty string! Currently it's empty.")}else r=D(r);else if(Array.isArray(r))if(r.length===0){if(o.relaxedAPI)return[];throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_11] the third input argument, tails, must be a non-empty array and contain at least one string! Currently it's empty.")}else if(r.every((u,p)=>(s=u,a=p,$(u)))){if(!r.every((u,p)=>(a=p,$(u)&&u.length&&u.trim()!=="")))if(o.relaxedAPI){if(r=r.filter(u=>$(u)&&u.length),r.length===0)return[]}else throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_13] the third input argument, tails, should not contain empty strings! For example, there's one detected at index ".concat(a,". Whole tails array is equal to:\n").concat(v(r,4)))}else if(o.relaxedAPI){if(r=r.filter(u=>$(u)&&u.length),r.length===0)return[]}else throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_12] the third input argument, tails, contains non-string elements! For example, element at ".concat(a,"th index is ").concat(typeof s,", equal to:\n").concat(v(s,4),". Whole tails array is equal to:\n").concat(v(r,4)));if(o.throwWhenSomethingWrongIsDetected&&!o.allowWholeValueToBeOnlyHeadsOrTails){if(D(t).includes(e))throw new Error("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_14] ".concat(n,"the whole input string can't be equal to ").concat($(t)?"":"one of ","heads (").concat(e,")!"));if(D(r).includes(e))throw new Error("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_15] ".concat(n,"the whole input string can't be equal to ").concat($(r)?"":"one of ","tails (").concat(e,")!"))}let h=t.concat(r).map(u=>u.charAt(0)).reduce((u,p)=>p.charCodeAt(0)>u[1]?[u[0],p.charCodeAt(0)]:p.charCodeAt(0)<u[0]?[p.charCodeAt(0),u[1]]:u,[t[0].charCodeAt(0),t[0].charCodeAt(0)]),l=[],g=!1,c={},T,b;for(let u=o.fromIndex,p=e.length;u<p;u++){let d=e[u].charCodeAt(0);if(d<=h[1]&&d>=h[0]){let f=V(e,u,t);if(f&&o.matchHeadsAndTailsStrictlyInPairsByTheirOrder){for(let y=t.length;y--;)if(t[y]===f){b=y;break}}if($(f))if(g){if(o.throwWhenSomethingWrongIsDetected)throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_16] ".concat(n,'When processing "').concat(e,'", we found heads (').concat(e.slice(u,u+f.length),') starting at character with index number "').concat(u,'" and there was another set of heads before it! Generally speaking, there should be "heads-tails-heads-tails", not "heads-heads-tails"!\nWe\'re talking about the area of the code:\n\n\n--------------------------------------starts\n').concat(e.slice(Math.max(u-200,0),u),"\n \x1B[33m------->\x1B[39m ").concat("\x1B[31m".concat(e.slice(u,u+f.length),"\x1B[39m")," \x1B[33m<-------\x1B[39m\n").concat(e.slice(u+f.length,Math.min(p,u+200)),"\n--------------------------------------ends\n\n\nTo turn off this error being thrown, set resolvedOpts.throwWhenSomethingWrongIsDetected to Boolean false."))}else{c={},c.headsStartAt=u,c.headsEndAt=u+f.length,g=!0,u+=f.length-1,T&&(T=void 0);continue}let m=V(e,u,r);if(g&&m&&o.matchHeadsAndTailsStrictlyInPairsByTheirOrder&&b!==void 0&&r[b]!==void 0&&r[b]!==m){let y;for(let w=r.length;w--;)if(r[w]===m){y=w;break}throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_17] ".concat(n,'When processing "').concat(e,'", we had "resolvedOpts.matchHeadsAndTailsStrictlyInPairsByTheirOrder" on. We found heads (').concat(t[b],") but the tails the followed it were not of the same index, ").concat(b," (").concat(r[b],") but ").concat(y," (").concat(m,")."))}if($(m))if(g){c.tailsStartAt=u,c.tailsEndAt=u+m.length,l.push(c),c={},g=!1,u+=m.length-1;continue}else o.throwWhenSomethingWrongIsDetected&&(T=new Error("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_18] ".concat(n,'When processing "').concat(e,'", we found tails (').concat(e.slice(u,u+m.length),') starting at character with index number "').concat(u,"\" but there were no heads preceding it. That's very naughty!")))}if(o.throwWhenSomethingWrongIsDetected&&u===p-1){if(Object.keys(c).length!==0)throw new TypeError("string-find-heads-tails/strFindHeadsTails(): [THROW_ID_19] ".concat(n,'When processing "').concat(e,"\", we reached the end of the string and yet didn't find any tails (").concat(v(r,4),") to match the last detected heads (").concat(e.slice(c.headsStartAt,c.headsEndAt),")!"));if(T)throw T}}return l}var _e="12.2.0";function te(e,t){return!$(e)||!e.trim()?!1:!!(e.includes(t.heads)||e.includes(t.tails)||$(t.headsNoWrap)&&t.headsNoWrap.length&&e.includes(t.headsNoWrap)||$(t.tailsNoWrap)&&t.tailsNoWrap.length&&e.includes(t.tailsNoWrap))}function fe(e){if($(e)&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(t+1)}return e}function Ne(e){if($(e)&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(0,t)}return e}function he(e){if($(e)&&e.length&&e.indexOf(".")!==-1){for(let t=e.length;t--;)if(e[t]===".")return e.slice(0,t)}return e}function xe(e){if($(e)&&e.length&&e.indexOf(".")!==-1){for(let t=0,r=e.length;t<r;t++)if(e[t]===".")return e.slice(t+1)}return e}var Tt={classicTrim:!1,cr:!1,lf:!1,tab:!1,space:!0,nbsp:!1};function U(e,t){if(typeof e!="string")throw new Error("string-trim-spaces-only/trimSpaces(): [THROW_ID_01] input must be string! It was given as ".concat(typeof e,", equal to:\n").concat(v(e,4)));let r=A(A({},Tt),t);function i(s){return r.classicTrim&&!s.trim()||!r.classicTrim&&(r.space&&s===" "||r.cr&&s==="\r"||r.lf&&s==="\n"||r.tab&&s===" "||r.nbsp&&s==="\xA0")}let o,n;if(e.length){if(i(e[0]))for(let s=0,a=e.length;s<a;s++){if(!i(e[s])){o=s;break}if(s===e.length-1)return{res:"",ranges:[[0,e.length]]}}if(i(e[e.length-1])){for(let s=e.length;s--;)if(!i(e[s])){n=s+1;break}}return o?n?{res:e.slice(o,n),ranges:[[0,o],[n,e.length]]}:{res:e.slice(o),ranges:[[0,o]]}:n?{res:e.slice(0,n),ranges:[[n,e.length]]}:{res:e,ranges:[]}}return{res:"",ranges:[]}}var vt={heads:["{{"],tails:["}}"]};function He(e,t){let r=Object.prototype.hasOwnProperty;if(e===void 0)throw new Error("string-remove-duplicate-heads-tails/remDup(): [THROW_ID_01] The input is missing!");if(typeof e!="string")return e;if(t&&!W(t))throw new Error("string-remove-duplicate-heads-tails/remDup(): [THROW_ID_02] The given options are not a plain object but ".concat(typeof t,"!"));let i=A({},t);if(i&&r.call(i,"heads"))if(D(i.heads).every(p=>typeof p=="string"||Array.isArray(p)))typeof i.heads=="string"&&(i.heads=D(i.heads));else throw new Error("string-remove-duplicate-heads-tails/remDup(): [THROW_ID_03] The resolvedOpts.heads contains elements which are not string-type!");if(i&&r.call(i,"tails"))if(D(i.tails).every(p=>typeof p=="string"||Array.isArray(p)))typeof i.tails=="string"&&(i.tails=D(i.tails));else throw new Error("string-remove-duplicate-heads-tails/remDup(): [THROW_ID_04] The resolvedOpts.tails contains elements which are not string-type!");let o=U(e).res;if(o.length===0)return e;e=o;let n=A(A({},vt),i);n.heads=n.heads.map(p=>p.trim()),n.tails=n.tails.map(p=>p.trim());let s=!1,a=!1,h=new J({limitToBeAddedWhitespace:!0}),l=new J({limitToBeAddedWhitespace:!0}),g=!0,c=!0,T="";function b(p,d){let f;return V(p,0,d.heads,{trimBeforeMatching:!0,cb:(m,y,w)=>(f=w,!0)})&&V(p,f,d.tails,{trimBeforeMatching:!0,cb:(m,y,w)=>(f=w,!0)})?p.slice(f):p}for(;e!==b(e,n);)e=U(b(e,n)).res;function u(p,d){let f;return!k(p,p.length-1,d.tails,{trimBeforeMatching:!0,cb:(m,y,w)=>(f=w,!0)})||!f?p:k(p,f,d.heads,{trimBeforeMatching:!0,cb:(m,y,w)=>(f=w,!0)})?p.slice(0,f+1):p}for(;e!==u(e,n);)e=U(u(e,n)).res;if(!n.heads.length||!V(e,0,n.heads,{trimBeforeMatching:!0})||!n.tails.length||!k(e,e.length-1,n.tails,{trimBeforeMatching:!0}))return U(e).res;for(let p=0,d=e.length;p<d;p++)if(e[p].trim()!==""){let f;if(V(e,p,n.heads,{trimBeforeMatching:!0,cb:(m,y,w)=>(f=w,!0)})&&f){c=!0,g&&(g=!0);let m;V(e,f,n.tails,{trimBeforeMatching:!0,cb:(y,w,O)=>(m=O,!0)})&&h.push(p,m),l.current()&&s&&T!=="tails"&&h.push(l.current()),s||l.current()&&(h.push(l.current()),l.wipe()),l.push(p,f),T="heads",p=f-1;continue}if(V(e,p,n.tails,{trimBeforeMatching:!0,cb:(m,y,w)=>(f=Number.isInteger(w)?w:e.length,!0)})&&f){c=!0,g?(T==="heads"&&l.wipe(),g=!1):l.push(p,f),T="tails",p=f-1;continue}g&&(g=!0),c&&!s?(s=!0,c=!1):c&&!a?(a=!0,g=!0,c=!1,T==="heads"&&l.wipe()):c&&a&&l.wipe()}return l.current()&&h.push(l.current()),h.current()?P(e,h.current()).trim():e.trim()}function Ce(e,t,r){let i,o;return $(e)&&e.length&&V(e,0,t,{trimBeforeMatching:!0,cb:(n,s,a)=>(i=a,!0)})&&k(e,e.length-1,r,{trimBeforeMatching:!0,cb:(n,s,a)=>(o=(a||0)+1,!0)})?e.slice(i,o):e}function ge(e,t,r=!1,i,o,n){if(t.wrapHeadsWith||(t.wrapHeadsWith=""),t.wrapTailsWith||(t.wrapTailsWith=""),$(e)&&!r&&t.wrapGlobalFlipSwitch&&!t.dontWrapVars.some(s=>Q(n,s))&&(!t.preventDoubleWrapping||t.preventDoubleWrapping&&$(e)&&!e.includes(t.wrapHeadsWith)&&!e.includes(t.wrapTailsWith)))return"".concat(t.wrapHeadsWith).concat(e).concat(t.wrapTailsWith);if(r){if(!$(e))return e;let s=He(e,{heads:t.wrapHeadsWith,tails:t.wrapTailsWith});return $(s)?Ce(s,t.wrapHeadsWith,t.wrapTailsWith):s}return e}var At=_e,Ot=Object.prototype.hasOwnProperty,Me={heads:"%%_",tails:"_%%",headsNoWrap:"%%-",tailsNoWrap:"-%%",lookForDataContainers:!0,dataContainerIdentifierTails:"_data",wrapHeadsWith:"",wrapTailsWith:"",dontWrapVars:[],preventDoubleWrapping:!0,wrapGlobalFlipSwitch:!0,noSingleMarkers:!1,resolveToBoolIfAnyValuesContainBool:!0,resolveToFalseIfAnyValuesContainBool:!0,throwWhenNonStringInsertedInString:!1,allowUnresolved:!1};function E(e){return $(e)?e.trim():e}function Wt(e,t,r,i){let o;if(r.indexOf(".")!==-1){let n=r,s=!0;if(i.lookForDataContainers&&$(i.dataContainerIdentifierTails)&&i.dataContainerIdentifierTails.length&&!n.endsWith(i.dataContainerIdentifierTails)){let a=R.default.get(e,n+i.dataContainerIdentifierTails);W(a)&&R.default.get(a,t)&&(o=R.default.get(a,t),s=!1)}for(;s&&n.indexOf(".")!==-1;){if(n=he(n),fe(n)===t)throw new Error('json-variables/findValues(): [THROW_ID_01] While trying to resolve: "'.concat(t,'" at path "').concat(r,'", we encountered a closed loop. The parent key "').concat(fe(n),'" is called the same as the variable "').concat(t,"\" we're looking for."));if(i.lookForDataContainers&&$(i.dataContainerIdentifierTails)&&i.dataContainerIdentifierTails.length&&!n.endsWith(i.dataContainerIdentifierTails)){let a=R.default.get(e,n+i.dataContainerIdentifierTails);W(a)&&R.default.get(a,t)&&(o=R.default.get(a,t),s=!1)}if(o===void 0){let a=R.default.get(e,n);W(a)&&R.default.get(a,t)&&(o=R.default.get(a,t),s=!1)}}}if(o===void 0){let n=R.default.get(e,t);n!==void 0&&(o=n)}if(o===void 0)if(t.indexOf(".")===-1){let n=oe(e,t);if(n.length){for(let s=0,a=n.length;s<a;s++)if($(n[s].val)||G(n[s].val)||L(n[s].val)){o=n[s].val;break}else if(M(n[s].val)){o=n[s].val;break}else if(Array.isArray(n[s].val)){o=n[s].val.join("");break}}}else{let n=oe(e,Ne(t));if(n.length)for(let s=0,a=n.length;s<a;s++){let h=R.default.get(n[s].val,xe(t));h&&$(h)&&(o=h)}}return o}function je(e,t,r,i,o=[]){if(o.includes(r)){let p="";if(o.length>1){let d=" \u2192\n";p=o.reduce((f,m,y)=>f+(y===0?"":d)+(m===r?"\u{1F4A5} ":" ")+m," Here's the path we travelled up until we hit the recursion:\n\n"),p+="".concat(d,"\u{1F4A5} ").concat(r)}throw new Error('json-variables/resolveString(): [THROW_ID_02] While trying to resolve: "'.concat(t,'" at path "').concat(r,'", we encountered a closed loop, the key is referencing itself."').concat(p))}let n={},s=Array.from(o);s.push(r);let a=new J,h;function l(p,d,f){for(let m=0,y=p.length;m<y;m++){let w=p[m],O=t.slice(w.headsEndAt,w.tailsStartAt);if(O.length===0)a.push(w.headsStartAt,w.tailsEndAt);else if(Ot.call(n,O)&&$(n[O]))a.push(w.headsStartAt,w.tailsEndAt,n[O]);else{if(h=Wt(e,O.trim(),r,i),h===void 0)if(i.allowUnresolved===!0)h="";else if($(i.allowUnresolved))h=i.allowUnresolved;else throw new Error("json-variables/processHeadsAndTails(): [THROW_ID_03] We couldn't find the value to resolve the variable ".concat(t.slice(w.headsEndAt,w.tailsStartAt),". We're at path: \"").concat(r,'".'));if(!f&&i.throwWhenNonStringInsertedInString&&!$(h))throw new Error("json-variables/processHeadsAndTails(): [THROW_ID_04] While resolving the variable ".concat(t.slice(w.headsEndAt,w.tailsStartAt)," at path ").concat(r,", it resolved into a non-string value, ").concat(v(h,4),'. This is happening because options setting "throwWhenNonStringInsertedInString" is active (set to "true").'));if(G(h)){if(i.resolveToBoolIfAnyValuesContainBool)return a.wipe(),i.resolveToFalseIfAnyValuesContainBool?!1:h;h=""}else{if(L(h)&&f)return a.wipe(),h;Array.isArray(h)?h=String(h.join("")):L(h)?h="":(!M(h)||!f)&&(h=String(h))}let _=r.includes(".")?"".concat(he(r),".").concat(O):O;if(te(h,i)){let I=ge(je(e,h,_,i,s),i,d,s,_,O.trim());I!==!1&&a.push(w.headsStartAt,w.tailsEndAt,I)}else{n[O]=h;let I=ge(h,i,d,s,_,O.trim());I!==!1&&a.push(w.headsStartAt,w.tailsEndAt,I)}}}}let g;try{g=ue(t,i.heads,i.tails,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(p){throw new Error('json-variables/resolveString(): [THROW_ID_05] While trying to resolve string: "'.concat(t,'" at path ').concat(r,", something wrong with heads and tails was detected! Here's the internal error message:\n").concat(p))}let c=!1;g.length===1&&P(t,[[g[0].headsStartAt,g[0].tailsEndAt]]).trim()===""&&(c=!0);let T=l(g,!1,c);if(typeof T=="boolean"||T===null)return T;try{g=ue(t,i.headsNoWrap,i.tailsNoWrap,{source:"",throwWhenSomethingWrongIsDetected:!1})}catch(p){throw new Error('json-variables/resolveString(): [THROW_ID_06] While trying to resolve string: "'.concat(t,'" at path ').concat(r,", something wrong with no-wrap heads and no-wrap tails was detected! Here's the internal error message:\n").concat(p))}g.length===1&&P(t,[[g[0].headsStartAt,g[0].tailsEndAt]]).trim()===""&&(c=!0);let b=l(g,!0,c);if(G(b)||L(b))return b;let u=a.current();if(u){if(c){if(typeof h=="number")return h;if((u==null?void 0:u.length)===1&&u[0].length===3&&M(u[0][2]))return u[0][2]}return P(t,u)}return t}function Et(e,t){if(!arguments.length)throw new Error("json-variables/jVar(): [THROW_ID_07] Alas! Inputs are missing!");if(!W(e))throw new TypeError("json-variables/jVar(): [THROW_ID_08] Alas! The input must be a plain object! Currently it's: ".concat(Array.isArray(e)?"array":typeof e));if(t&&!W(t))throw new TypeError("json-variables/jVar(): [THROW_ID_09] Alas! An Optional Options Object must be a plain object! Currently it's: ".concat(Array.isArray(t)?"array":typeof t));let r=A(A({},Me),t);r.dontWrapVars?Array.isArray(r.dontWrapVars)||(r.dontWrapVars=D(r.dontWrapVars)):r.dontWrapVars=[];let i,o;if(r.dontWrapVars.length&&!r.dontWrapVars.every((s,a)=>$(s)?!0:(i=s,o=a,!1)))throw new Error('json-variables/jVar(): [THROW_ID_10] Alas! All variable names set in resolvedOpts.dontWrapVars should be of a string type. Computer detected a value "'.concat(i,'" at index ').concat(o,", which is not string but ").concat(Array.isArray(i)?"array":typeof i,"!"));if(r.heads==="")throw new Error("json-variables/jVar(): [THROW_ID_11] Alas! resolvedOpts.heads are empty!");if(r.tails==="")throw new Error("json-variables/jVar(): [THROW_ID_12] Alas! resolvedOpts.tails are empty!");if(r.lookForDataContainers&&r.dataContainerIdentifierTails==="")throw new Error("json-variables/jVar(): [THROW_ID_13] Alas! resolvedOpts.dataContainerIdentifierTails is empty!");if(r.heads===r.tails)throw new Error("json-variables/jVar(): [THROW_ID_14] Alas! resolvedOpts.heads and resolvedOpts.tails can't be equal!");if(r.heads===r.headsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_15] Alas! resolvedOpts.heads and resolvedOpts.headsNoWrap can't be equal!");if(r.tails===r.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_16] Alas! resolvedOpts.tails and resolvedOpts.tailsNoWrap can't be equal!");if(r.headsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_17] Alas! resolvedOpts.headsNoWrap is an empty string!");if(r.tailsNoWrap==="")throw new Error("json-variables/jVar(): [THROW_ID_18] Alas! resolvedOpts.tailsNoWrap is an empty string!");if(r.headsNoWrap===r.tailsNoWrap)throw new Error("json-variables/jVar(): [THROW_ID_19] Alas! resolvedOpts.headsNoWrap and resolvedOpts.tailsNoWrap can't be equal!");let n;return Z(e,(s,a,h)=>{if(S(a)&&te(s,r))throw new Error("json-variables/jVar(): [THROW_ID_20] Alas! Object keys can't contain variables!\nPlease check the following key: ".concat(s));if(a!==void 0?n=a:n=s,n==="")return n;if(r.heads.length&&E(n)===E(r.heads)||r.tails.length&&E(n)===E(r.tails)||r.headsNoWrap.length&&E(n)===E(r.headsNoWrap)||r.tailsNoWrap.length&&E(n)===E(r.tailsNoWrap)){if(!r.noSingleMarkers)return n;throw new Error("json-variables/jVar(): [THROW_ID_21] Alas! While processing the input, we stumbled upon ".concat(E(n)," which is equal to ").concat(E(n)===E(r.heads)?"heads":"").concat(E(n)===E(r.tails)?"tails":"").concat($(r.headsNoWrap)&&E(n)===E(r.headsNoWrap)?"headsNoWrap":"").concat($(r.tailsNoWrap)&&E(n)===E(r.tailsNoWrap)?"tailsNoWrap":"",'. If you wouldn\'t have set resolvedOpts.noSingleMarkers to "true" this error would not happen and computer would have left the current element (').concat(E(n),") alone"))}return $(n)&&te(n,r)?je(e,n,h.path,r):n})}return Ge(Dt);})();
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/}
26
18
  */
27
19
  /**
28
- * @name string-match-left-right
29
- * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
30
- * @version 9.1.3
31
- * @author Roy Revelt
32
- * @license MIT
33
- * {@link https://codsen.com/os/string-match-left-right/}
34
- */
35
- /**
36
- * @name string-find-heads-tails
37
- * @fileoverview Finds where are arbitrary templating marker heads and tails located
38
- * @version 6.1.3
39
- * @author Roy Revelt
40
- * @license MIT
41
- * {@link https://codsen.com/os/string-find-heads-tails/}
42
- */
43
- /**
44
- * @name ast-monkey-util
45
- * @fileoverview Utility library of AST helper functions
46
- * @version 3.1.3
20
+ * @name codsen-utils
21
+ * @fileoverview Various utility functions
22
+ * @version 1.8.0
47
23
  * @author Roy Revelt
48
24
  * @license MIT
49
- * {@link https://codsen.com/os/ast-monkey-util/}
25
+ * {@link https://codsen.com/os/codsen-utils/}
50
26
  */
51
27
  /**
52
28
  * @name ast-monkey-traverse
53
29
  * @fileoverview Utility library to traverse AST
54
- * @version 4.1.3
30
+ * @version 4.2.0
55
31
  * @author Roy Revelt
56
32
  * @license MIT
57
33
  * {@link https://codsen.com/os/ast-monkey-traverse/}
@@ -59,7 +35,7 @@
59
35
  /**
60
36
  * @name ast-get-values-by-key
61
37
  * @fileoverview Extract values and paths from AST by keys OR set them by keys
62
- * @version 5.1.3
38
+ * @version 5.2.0
63
39
  * @author Roy Revelt
64
40
  * @license MIT
65
41
  * {@link https://codsen.com/os/ast-get-values-by-key/}
@@ -67,7 +43,7 @@
67
43
  /**
68
44
  * @name ranges-sort
69
45
  * @fileoverview Sort string index ranges
70
- * @version 6.1.3
46
+ * @version 6.2.0
71
47
  * @author Roy Revelt
72
48
  * @license MIT
73
49
  * {@link https://codsen.com/os/ranges-sort/}
@@ -75,7 +51,7 @@
75
51
  /**
76
52
  * @name ranges-merge
77
53
  * @fileoverview Merge and sort string index ranges
78
- * @version 9.1.3
54
+ * @version 9.2.0
79
55
  * @author Roy Revelt
80
56
  * @license MIT
81
57
  * {@link https://codsen.com/os/ranges-merge/}
@@ -83,7 +59,7 @@
83
59
  /**
84
60
  * @name ranges-apply
85
61
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
86
- * @version 7.1.3
62
+ * @version 7.2.0
87
63
  * @author Roy Revelt
88
64
  * @license MIT
89
65
  * {@link https://codsen.com/os/ranges-apply/}
@@ -91,7 +67,7 @@
91
67
  /**
92
68
  * @name string-collapse-leading-whitespace
93
69
  * @fileoverview Collapse the leading and trailing whitespace of a string
94
- * @version 7.1.3
70
+ * @version 7.2.0
95
71
  * @author Roy Revelt
96
72
  * @license MIT
97
73
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
@@ -99,15 +75,31 @@
99
75
  /**
100
76
  * @name ranges-push
101
77
  * @fileoverview Gather string index ranges
102
- * @version 7.1.3
78
+ * @version 7.2.0
103
79
  * @author Roy Revelt
104
80
  * @license MIT
105
81
  * {@link https://codsen.com/os/ranges-push/}
106
82
  */
83
+ /**
84
+ * @name string-match-left-right
85
+ * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
86
+ * @version 9.2.0
87
+ * @author Roy Revelt
88
+ * @license MIT
89
+ * {@link https://codsen.com/os/string-match-left-right/}
90
+ */
91
+ /**
92
+ * @name string-find-heads-tails
93
+ * @fileoverview Finds where are arbitrary templating marker heads and tails located
94
+ * @version 6.2.0
95
+ * @author Roy Revelt
96
+ * @license MIT
97
+ * {@link https://codsen.com/os/string-find-heads-tails/}
98
+ */
107
99
  /**
108
100
  * @name string-trim-spaces-only
109
101
  * @fileoverview Like String.trim() but you can choose granularly what to trim
110
- * @version 5.1.3
102
+ * @version 5.2.0
111
103
  * @author Roy Revelt
112
104
  * @license MIT
113
105
  * {@link https://codsen.com/os/string-trim-spaces-only/}
@@ -115,7 +107,7 @@
115
107
  /**
116
108
  * @name string-remove-duplicate-heads-tails
117
109
  * @fileoverview Detect and (recursively) remove head and tail wrappings around the input string
118
- * @version 7.1.3
110
+ * @version 7.2.0
119
111
  * @author Roy Revelt
120
112
  * @license MIT
121
113
  * {@link https://codsen.com/os/string-remove-duplicate-heads-tails/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-variables",
3
- "version": "12.1.3",
3
+ "version": "12.2.0",
4
4
  "description": "Resolves custom-marked, cross-referenced paths in parsed JSON",
5
5
  "keywords": [
6
6
  "comb",
@@ -41,54 +41,52 @@
41
41
  },
42
42
  "types": "types/index.d.ts",
43
43
  "scripts": {
44
- "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
45
- "cjs-off": "exit 0",
46
- "cjs-on": "exit 0",
47
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
44
+ "build": "node ../../ops/scripts/esbuild.js && npm run dts",
45
+ "coverage": "c8 uvu test",
46
+ "dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
48
47
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
49
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
48
+ "dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
50
49
  "examples": "node '../../ops/scripts/run-examples.js'",
51
- "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
52
- "letspublish": "npm publish --provenance || :",
53
- "lint": "eslint . --fix --concurrency=auto --cache",
50
+ "lect": "node '../../ops/lect/lect.js'",
51
+ "lect:check": "node '../../ops/lect/lect.js' --check",
52
+ "lint": "biome lint --error-on-warnings . && npm run typecheck",
53
+ "lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
54
54
  "perf": "node perf/check.js",
55
55
  "prep": "echo 'ready'",
56
- "prettier": "prettier",
57
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
58
- "pretest": "npm run lect && npm run build",
56
+ "prettier": "biome format",
57
+ "prettier:format": "biome format --write .",
58
+ "pretest": "npm run lect:check && npm run build",
59
59
  "test": "npm run devtest",
60
+ "typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
60
61
  "unit": "uvu test"
61
62
  },
62
- "engines": {
63
- "node": ">=14.18.0"
64
- },
65
63
  "c8": {
64
+ "all": true,
66
65
  "check-coverage": true,
67
- "exclude": [
68
- "**/test/**/*.*"
69
- ],
66
+ "exclude": ["**/test/**/*.*"],
67
+ "include": ["dist/*.esm.js"],
70
68
  "lines": 100
71
69
  },
72
70
  "lect": {
73
71
  "licence": {
74
- "extras": [
75
- ""
76
- ]
72
+ "extras": [""]
77
73
  },
78
74
  "various": {}
79
75
  },
80
76
  "dependencies": {
81
- "arrayiffy-if-string": "^5.1.3",
82
- "ast-get-values-by-key": "^5.1.3",
83
- "ast-monkey-traverse": "^4.1.3",
84
- "codsen-utils": "^1.7.3",
85
- "matcher": "^6.0.0",
77
+ "arrayiffy-if-string": "^5.2.0",
78
+ "ast-get-values-by-key": "^5.2.0",
79
+ "ast-monkey-traverse": "^4.2.0",
80
+ "codsen-utils": "^1.8.0",
86
81
  "object-path": "^0.11.8",
87
- "ranges-apply": "^7.1.3",
88
- "ranges-push": "^7.1.3",
89
- "string-find-heads-tails": "^6.1.3",
90
- "string-match-left-right": "^9.1.3",
91
- "string-remove-duplicate-heads-tails": "^7.1.3"
82
+ "ranges-apply": "^7.2.0",
83
+ "ranges-push": "^7.2.0",
84
+ "string-find-heads-tails": "^6.2.0",
85
+ "string-match-left-right": "^9.2.0",
86
+ "string-remove-duplicate-heads-tails": "^7.2.0"
87
+ },
88
+ "engines": {
89
+ "node": ">=18.20.8"
92
90
  },
93
91
  "publishConfig": {
94
92
  "registry": "https://registry.npmjs.org/"