@nocobase/plugin-workflow-json-query 1.9.8 → 2.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -4
- package/dist/node_modules/jmespath/package.json +1 -1
- package/dist/node_modules/jsonata/jsonata-es5.js +1178 -1266
- package/dist/node_modules/jsonata/jsonata-es5.min.js +1 -1
- package/dist/node_modules/jsonata/jsonata.js +1 -1
- package/dist/node_modules/jsonata/jsonata.min.js +1 -1
- package/dist/node_modules/jsonata/package.json +1 -1
- package/dist/node_modules/jsonpath-plus/package.json +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e={245:function(e){(function(t){if(true){e.exports=t()}else{var n}})((function(){var e,t,n;return function(){function r(e,t,n){function o(i,s){if(!t[i]){if(!e[i]){var u=require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var c=t[i]={exports:{}};e[i][0].call(c.exports,(function(t){var n=e[i][1][t];return o(n||t)}),c,c.exports,r,e,t,n)}return t[i].exports}for(var a=require,i=0;i<n.length;i++)o(n[i]);return o}return r}()({1:[function(e,t,n){const a=e("./utils");const i=function(){"use strict";const e=a.stringToArray;const t=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"];const n=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"];const i=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"];const s=["Thousand","Million","Billion","Trillion"];function numberToWords(e,a){var lookup=function(e,a,u){var f="";if(e<=19){f=(a?" and ":"")+(u?n[e]:t[e])}else if(e<100){const t=Math.floor(e/10);const n=e%10;f=(a?" and ":"")+i[t-2];if(n>0){f+="-"+lookup(n,false,u)}else if(u){f=f.substring(0,f.length-1)+"ieth"}}else if(e<1e3){const n=Math.floor(e/100);const i=e%100;f=(a?", ":"")+t[n]+" Hundred";if(i>0){f+=lookup(i,true,u)}else if(u){f+="th"}}else{var c=Math.floor(Math.log10(e)/3);if(c>s.length){c=s.length}const t=Math.pow(10,c*3);const n=Math.floor(e/t);const i=e-n*t;f=(a?", ":"")+lookup(n,false,false)+" "+s[c-1];if(i>0){f+=lookup(i,true,u)}else if(u){f+="th"}}return f};var u=lookup(e,false,a);return u}const u={};t.forEach((function(e,t){u[e.toLowerCase()]=t}));n.forEach((function(e,t){u[e.toLowerCase()]=t}));i.forEach((function(e,t){const n=e.toLowerCase();u[n]=(t+2)*10;u[n.substring(0,e.length-1)+"ieth"]=u[n]}));u.hundredth=100;s.forEach((function(e,t){const n=e.toLowerCase();const a=Math.pow(10,(t+1)*3);u[n]=a;u[n+"th"]=a}));function wordsToNumber(e){const t=e.split(/,\s|\sand\s|[\s\\-]/);const n=t.map((e=>u[e]));let a=[0];n.forEach((e=>{if(e<100){let t=a.pop();if(t>=1e3){a.push(t);t=0}a.push(t+e)}else{a.push(a.pop()*e)}}));const i=a.reduce(((e,t)=>e+t),0);return i}const f=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];const c={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function decimalToRoman(e){for(var t=0;t<f.length;t++){const n=f[t];if(e>=n[0]){return n[1]+decimalToRoman(e-n[0])}}return""}function romanToDecimal(e){var t=0;var n=1;for(var a=e.length-1;a>=0;a--){const i=e[a];const s=c[i];if(s<n){t-=s}else{n=s;t+=s}}return t}function decimalToLetters(e,t){var n=[];var a=t.charCodeAt(0);while(e>0){n.unshift(String.fromCharCode((e-1)%26+a));e=Math.floor((e-1)/26)}return n.join("")}function lettersToDecimal(e,t){var n=t.charCodeAt(0);var a=0;for(var i=0;i<e.length;i++){a+=(e.charCodeAt(e.length-i-1)-n+1)*Math.pow(26,i)}return a}function formatInteger(e,t){if(typeof e==="undefined"){return undefined}e=Math.floor(e);const n=analyseIntegerPicture(t);return _formatInteger(e,n)}const l={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"};const p={UPPER:"upper",LOWER:"lower",TITLE:"title"};function _formatInteger(t,n){let a;const i=t<0;t=Math.abs(t);switch(n.primary){case l.LETTERS:a=decimalToLetters(t,n.case===p.UPPER?"A":"a");break;case l.ROMAN:a=decimalToRoman(t);if(n.case===p.UPPER){a=a.toUpperCase()}break;case l.WORDS:a=numberToWords(t,n.ordinal);if(n.case===p.UPPER){a=a.toUpperCase()}else if(n.case===p.LOWER){a=a.toLowerCase()}break;case l.DECIMAL:a=""+t;var s=n.mandatoryDigits-a.length;if(s>0){var u=new Array(s+1).join("0");a=u+a}if(n.zeroCode!==48){a=e(a).map((e=>String.fromCodePoint(e.codePointAt(0)+n.zeroCode-48))).join("")}if(n.regular){const e=Math.floor((a.length-1)/n.groupingSeparators.position);for(let t=e;t>0;t--){const e=a.length-t*n.groupingSeparators.position;a=a.substr(0,e)+n.groupingSeparators.character+a.substr(e)}}else{n.groupingSeparators.reverse().forEach((e=>{const t=a.length-e.position;a=a.substr(0,t)+e.character+a.substr(t)}))}if(n.ordinal){var f={1:"st",2:"nd",3:"rd"};var c=a[a.length-1];var d=f[c];if(!d||a.length>1&&a[a.length-2]==="1"){d="th"}a=a+d}break;case l.SEQUENCE:throw{code:"D3130",value:n.token}}if(i){a="-"+a}return a}const d=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function analyseIntegerPicture(t){const n={type:"integer",primary:l.DECIMAL,case:p.LOWER,ordinal:false};let a,i;const s=t.lastIndexOf(";");if(s===-1){a=t}else{a=t.substring(0,s);i=t.substring(s+1);if(i[0]==="o"){n.ordinal=true}}switch(a){case"A":n.case=p.UPPER;case"a":n.primary=l.LETTERS;break;case"I":n.case=p.UPPER;case"i":n.primary=l.ROMAN;break;case"W":n.case=p.UPPER;n.primary=l.WORDS;break;case"Ww":n.case=p.TITLE;n.primary=l.WORDS;break;case"w":n.primary=l.WORDS;break;default:{let t=null;let i=0;let s=0;let u=[];let f=0;const c=e(a).map((e=>e.codePointAt(0))).reverse();c.forEach((e=>{let n=false;for(let a=0;a<d.length;a++){const s=d[a];if(e>=s&&e<=s+9){n=true;i++;f++;if(t===null){t=s}else if(s!==t){throw{code:"D3131"}}break}}if(!n){if(e===35){f++;s++}else{u.push({position:f,character:String.fromCodePoint(e)})}}}));if(i>0){n.primary=l.DECIMAL;n.zeroCode=t;n.mandatoryDigits=i;n.optionalDigits=s;const regularRepeat=function(e){if(e.length===0){return 0}const t=e[0].character;for(let n=1;n<e.length;n++){if(e[n].character!==t){return 0}}const n=e.map((e=>e.position));const gcd=function(e,t){return t===0?e:gcd(t,e%t)};const a=n.reduce(gcd);for(let e=1;e<=n.length;e++){if(n.indexOf(e*a)===-1){return 0}}return a};const e=regularRepeat(u);if(e>0){n.regular=true;n.groupingSeparators={position:e,character:u[0].character}}else{n.regular=false;n.groupingSeparators=u}}else{n.primary=l.SEQUENCE;n.token=a}}}return n}const h={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function analyseDateTimePicture(e){var t=[];const n={type:"datetime",parts:t};const addLiteral=function(n,a){if(a>n){let i=e.substring(n,a);i=i.split("]]").join("]");t.push({type:"literal",value:i})}};var a=0,i=0;while(i<e.length){if(e.charAt(i)==="["){if(e.charAt(i+1)==="["){addLiteral(a,i);t.push({type:"literal",value:"["});i+=2;a=i;continue}addLiteral(a,i);a=i;i=e.indexOf("]",a);if(i===-1){throw{code:"D3135"}}let n=e.substring(a+1,i);n=n.split(/\s+/).join("");var s={type:"marker",component:n.charAt(0)};var u=n.lastIndexOf(",");var f;if(u!==-1){const e=n.substring(u+1);const t=e.indexOf("-");let a,i;const parseWidth=function(e){if(typeof e==="undefined"||e==="*"){return undefined}else{return parseInt(e)}};if(t===-1){a=e}else{a=e.substring(0,t);i=e.substring(t+1)}const c={min:parseWidth(a),max:parseWidth(i)};s.width=c;f=n.substring(1,u)}else{f=n.substring(1)}if(f.length===1){s.presentation1=f}else if(f.length>1){var c=f.charAt(f.length-1);if("atco".indexOf(c)!==-1){s.presentation2=c;if(c==="o"){s.ordinal=true}s.presentation1=f.substring(0,f.length-1)}else{s.presentation1=f}}else{s.presentation1=h[s.component]}if(typeof s.presentation1==="undefined"){throw{code:"D3132",value:s.component}}if(s.presentation1[0]==="n"){s.names=p.LOWER}else if(s.presentation1[0]==="N"){if(s.presentation1[1]==="n"){s.names=p.TITLE}else{s.names=p.UPPER}}else if("YMDdFWwXxHhmsf".indexOf(s.component)!==-1){var l=s.presentation1;if(s.presentation2){l+=";"+s.presentation2}s.integerFormat=analyseIntegerPicture(l);if(s.width&&s.width.min!==undefined){if(s.integerFormat.mandatoryDigits<s.width.min){s.integerFormat.mandatoryDigits=s.width.min}}if("YMD".indexOf(s.component)!==-1){s.n=-1;if(s.width&&s.width.max!==undefined){s.n=s.width.max;s.integerFormat.mandatoryDigits=s.n}else{var d=s.integerFormat.mandatoryDigits+s.integerFormat.optionalDigits;if(d>=2){s.n=d}}}}if(s.component==="Z"||s.component==="z"){s.integerFormat=analyseIntegerPicture(s.presentation1)}t.push(s);a=i+1}i++}addLiteral(a,i);return n}const v=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];const g=["January","February","March","April","May","June","July","August","September","October","November","December"];const y=1e3*60*60*24;const startOfFirstWeek=function(e){const t=Date.UTC(e.year,e.month);var n=new Date(t).getUTCDay();if(n===0){n=7}return n>4?t+(8-n)*y:t-(n-1)*y};const yearMonth=function(e,t){return{year:e,month:t,nextMonth:function(){return t===11?yearMonth(e+1,0):yearMonth(e,t+1)},previousMonth:function(){return t===0?yearMonth(e-1,11):yearMonth(e,t-1)},nextYear:function(){return yearMonth(e+1,t)},previousYear:function(){return yearMonth(e-1,t)}}};const deltaWeeks=function(e,t){return(t-e)/(y*7)+1};const getDateTimeFragment=(e,t)=>{let n;switch(t){case"Y":n=e.getUTCFullYear();break;case"M":n=e.getUTCMonth()+1;break;case"D":n=e.getUTCDate();break;case"d":{const t=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());const a=Date.UTC(e.getUTCFullYear(),0);n=(t-a)/y+1;break}case"F":n=e.getUTCDay();if(n===0){n=7}break;case"W":{const t=yearMonth(e.getUTCFullYear(),0);const a=startOfFirstWeek(t);const i=Date.UTC(t.year,e.getUTCMonth(),e.getUTCDate());let s=deltaWeeks(a,i);if(s>52){const e=startOfFirstWeek(t.nextYear());if(i>=e){s=1}}else if(s<1){const e=startOfFirstWeek(t.previousYear());s=deltaWeeks(e,i)}n=Math.floor(s);break}case"w":{const t=yearMonth(e.getUTCFullYear(),e.getUTCMonth());const a=startOfFirstWeek(t);const i=Date.UTC(t.year,t.month,e.getUTCDate());let s=deltaWeeks(a,i);if(s>4){const e=startOfFirstWeek(t.nextMonth());if(i>=e){s=1}}else if(s<1){const e=startOfFirstWeek(t.previousMonth());s=deltaWeeks(e,i)}n=Math.floor(s);break}case"X":{const t=yearMonth(e.getUTCFullYear(),0);const a=startOfFirstWeek(t);const i=startOfFirstWeek(t.nextYear());const s=e.getTime();if(s<a){n=t.year-1}else if(s>=i){n=t.year+1}else{n=t.year}break}case"x":{const t=yearMonth(e.getUTCFullYear(),e.getUTCMonth());const a=startOfFirstWeek(t);const i=t.nextMonth();const s=startOfFirstWeek(i);const u=e.getTime();if(u<a){n=t.previousMonth().month+1}else if(u>=s){n=i.month+1}else{n=t.month+1}break}case"H":n=e.getUTCHours();break;case"h":n=e.getUTCHours();n=n%12;if(n===0){n=12}break;case"P":n=e.getUTCHours()>=12?"pm":"am";break;case"m":n=e.getUTCMinutes();break;case"s":n=e.getUTCSeconds();break;case"f":n=e.getUTCMilliseconds();break;case"Z":case"z":break;case"C":n="ISO";break;case"E":n="ISO";break}return n};let m=null;function formatDateTime(e,t,n){var a=0;var i=0;if(typeof n!=="undefined"){const e=parseInt(n);a=Math.floor(e/100);i=e%100}var formatComponent=function(e,t){var n=getDateTimeFragment(e,t.component);if("YMDdFWwXxHhms".indexOf(t.component)!==-1){if(t.component==="Y"){if(t.n!==-1){n=n%Math.pow(10,t.n)}}if(t.names){if(t.component==="M"||t.component==="x"){n=g[n-1]}else if(t.component==="F"){n=v[n]}else{throw{code:"D3133",value:t.component}}if(t.names===p.UPPER){n=n.toUpperCase()}else if(t.names===p.LOWER){n=n.toLowerCase()}if(t.width&&n.length>t.width.max){n=n.substring(0,t.width.max)}}else{n=_formatInteger(n,t.integerFormat)}}else if(t.component==="f"){n=_formatInteger(n,t.integerFormat)}else if(t.component==="Z"||t.component==="z"){const e=a*100+i;if(t.integerFormat.regular){n=_formatInteger(e,t.integerFormat)}else{const s=t.integerFormat.mandatoryDigits;if(s===1||s===2){n=_formatInteger(a,t.integerFormat);if(i!==0){n+=":"+formatInteger(i,"00")}}else if(s===3||s===4){n=_formatInteger(e,t.integerFormat)}else{throw{code:"D3134",value:s}}}if(e>=0){n="+"+n}if(t.component==="z"){n="GMT"+n}if(e===0&&t.presentation2==="t"){n="Z"}}else if(t.component==="P"){if(t.names===p.UPPER){n=n.toUpperCase()}}return n};let s;if(typeof t==="undefined"){if(m===null){m=analyseDateTimePicture("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")}s=m}else{s=analyseDateTimePicture(t)}const u=(60*a+i)*60*1e3;const f=new Date(e+u);let c="";s.parts.forEach((function(e){if(e.type==="literal"){c+=e.value}else{c+=formatComponent(f,e)}}));return c}function generateRegex(e){var t={};if(e.type==="datetime"){t.type="datetime";t.parts=e.parts.map((function(e){var t={};if(e.type==="literal"){t.regex=e.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else if(e.component==="Z"||e.component==="z"){let n;if(!Array.isArray(e.integerFormat.groupingSeparators)){n=e.integerFormat.groupingSeparators}t.regex="";if(e.component==="z"){t.regex="GMT"}t.regex+="[-+][0-9]+";if(n){t.regex+=n.character+"[0-9]+"}t.parse=function(t){if(e.component==="z"){t=t.substring(3)}let a=0,i=0;if(n){a=Number.parseInt(t.substring(0,t.indexOf(n.character)));i=Number.parseInt(t.substring(t.indexOf(n.character)+1))}else{const e=t.length-1;if(e<=2){a=Number.parseInt(t)}else{a=Number.parseInt(t.substring(0,3));i=Number.parseInt(t.substring(3))}}return a*60+i}}else if(e.integerFormat){e.integerFormat.n=e.n;t=generateRegex(e.integerFormat)}else{t.regex="[a-zA-Z]+";var n={};if(e.component==="M"||e.component==="x"){g.forEach((function(t,a){if(e.width&&e.width.max){n[t.substring(0,e.width.max)]=a+1}else{n[t]=a+1}}))}else if(e.component==="F"){v.forEach((function(t,a){if(a>0){if(e.width&&e.width.max){n[t.substring(0,e.width.max)]=a}else{n[t]=a}}}))}else if(e.component==="P"){n={am:0,AM:0,pm:1,PM:1}}else{throw{code:"D3133",value:e.component}}t.parse=function(e){return n[e]}}t.component=e.component;return t}))}else{t.type="integer";const n=e.case===p.UPPER;let a;if(e.n&&e.n>0){if(e.optionalDigits===0){a=`{${e.n}}`}else{a=`{${e.n-e.optionalDigits},${e.n}}`}}else{a="+"}switch(e.primary){case l.LETTERS:t.regex=n?"[A-Z]+":"[a-z]+";t.parse=function(e){return lettersToDecimal(e,n?"A":"a")};break;case l.ROMAN:t.regex=n?"[MDCLXVI]+":"[mdclxvi]+";t.parse=function(e){return romanToDecimal(n?e:e.toUpperCase())};break;case l.WORDS:t.regex="(?:"+Object.keys(u).concat("and","[\\-, ]").join("|")+")+";t.parse=function(e){return wordsToNumber(e.toLowerCase())};break;case l.DECIMAL:t.regex=`[0-9]${a}`;if(e.ordinal){t.regex+="(?:th|st|nd|rd)"}t.parse=function(t){let n=t;if(e.ordinal){n=t.substring(0,t.length-2)}if(e.regular){n=n.split(",").join("")}else{e.groupingSeparators.forEach((e=>{n=n.split(e.character).join("")}))}if(e.zeroCode!==48){n=n.split("").map((t=>String.fromCodePoint(t.codePointAt(0)-e.zeroCode+48))).join("")}return parseInt(n)};break;case l.SEQUENCE:throw{code:"D3130",value:e.token}}}return t}function parseInteger(e,t){if(typeof e==="undefined"){return undefined}const n=analyseIntegerPicture(t);const a=generateRegex(n);const i=a.parse(e);return i}function parseDateTime(e,t){const n=analyseDateTimePicture(t);const a=generateRegex(n);const i="^"+a.parts.map((e=>"("+e.regex+")")).join("")+"$";const s=new RegExp(i,"i");var u=s.exec(e);if(u!==null){const e=161;const t=130;const n=84;const i=72;const s=23;const c=47;const l={};for(let e=1;e<u.length;e++){const t=a.parts[e-1];if(t.parse){l[t.component]=t.parse(u[e])}}if(Object.getOwnPropertyNames(l).length===0){return undefined}let p=0;const shift=e=>{p<<=1;p+=e?1:0};const isType=e=>!(~e&p)&&!!(e&p);"YXMxWwdD".split("").forEach((e=>shift(l[e])));const d=isType(e);const h=!d&&isType(t);const v=isType(n);const g=!v&&isType(i);p=0;"PHhmsf".split("").forEach((e=>shift(l[e])));const y=isType(s);const m=!y&&isType(c);const b=h?"YD":v?"XxwF":g?"XWF":"YMD";const w=m?"Phmsf":"Hmsf";const k=b+w;const x=this.environment.timestamp;let A=false;let E=false;k.split("").forEach((e=>{if(typeof l[e]==="undefined"){if(A){l[e]="MDd".indexOf(e)!==-1?1:0;E=true}else{l[e]=getDateTimeFragment(x,e)}}else{A=true;if(E){throw{code:"D3136"}}}}));if(l.M>0){l.M-=1}else{l.M=0}if(h){const e=Date.UTC(l.Y,0);const t=(l.d-1)*1e3*60*60*24;const n=new Date(e+t);l.M=n.getUTCMonth();l.D=n.getUTCDate()}if(v){throw{code:"D3136"}}if(g){throw{code:"D3136"}}if(m){l.H=l.h===12?0:l.h;if(l.P===1){l.H+=12}}var f=Date.UTC(l.Y,l.M,l.D,l.H,l.m,l.s,l.f);if(l.Z||l.z){f-=(l.Z||l.z)*60*1e3}return f}}var b=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function toMillis(e,t){if(typeof e==="undefined"){return undefined}if(typeof t==="undefined"){if(!b.test(e)){throw{stack:(new Error).stack,code:"D3110",value:e}}return Date.parse(e)}else{return parseDateTime.call(this,e,t)}}function fromMillis(e,t,n){if(typeof e==="undefined"){return undefined}return formatDateTime.call(this,e,t,n)}return{formatInteger:formatInteger,parseInteger:parseInteger,fromMillis:fromMillis,toMillis:toMillis}}();t.exports=i},{"./utils":6}],2:[function(e,t,n){(function(n){(function(){var a=e("./utils");const i=(()=>{"use strict";var e=a.isNumeric;var t=a.isArrayOfStrings;var i=a.isArrayOfNumbers;var s=a.createSequence;var u=a.isSequence;var f=a.isFunction;var c=a.isLambda;var l=a.isPromise;var p=a.getFunctionArity;var d=a.isDeepEqual;var h=a.stringToArray;function sum(e){if(typeof e==="undefined"){return undefined}var t=0;e.forEach((function(e){t+=e}));return t}function count(e){if(typeof e==="undefined"){return 0}return e.length}function max(e){if(typeof e==="undefined"||e.length===0){return undefined}return Math.max.apply(Math,e)}function min(e){if(typeof e==="undefined"||e.length===0){return undefined}return Math.min.apply(Math,e)}function average(e){if(typeof e==="undefined"||e.length===0){return undefined}var t=0;e.forEach((function(e){t+=e}));return t/e.length}function string(t,n=false){if(typeof t==="undefined"){return undefined}var a;if(typeof t==="string"){a=t}else if(f(t)){a=""}else if(typeof t==="number"&&!isFinite(t)){throw{code:"D3001",value:t,stack:(new Error).stack}}else{var i=n?2:0;if(Array.isArray(t)&&t.outerWrapper){t=t[0]}a=JSON.stringify(t,(function(t,n){return typeof n!=="undefined"&&n!==null&&n.toPrecision&&e(n)?Number(n.toPrecision(15)):n&&f(n)?"":n}),i)}return a}function substring(e,t,n){if(typeof e==="undefined"){return undefined}var a=h(e);var i=a.length;if(i+t<0){t=0}if(typeof n!=="undefined"){if(n<=0){return""}var s=t>=0?t+n:i+t+n;return a.slice(t,s).join("")}return a.slice(t).join("")}function substringBefore(e,t){if(typeof e==="undefined"){return undefined}var n=e.indexOf(t);if(n>-1){return e.substr(0,n)}else{return e}}function substringAfter(e,t){if(typeof e==="undefined"){return undefined}var n=e.indexOf(t);if(n>-1){return e.substr(n+t.length)}else{return e}}function lowercase(e){if(typeof e==="undefined"){return undefined}return e.toLowerCase()}function uppercase(e){if(typeof e==="undefined"){return undefined}return e.toUpperCase()}function length(e){if(typeof e==="undefined"){return undefined}return h(e).length}function trim(e){if(typeof e==="undefined"){return undefined}var t=e.replace(/[ \t\n\r]+/gm," ");if(t.charAt(0)===" "){t=t.substring(1)}if(t.charAt(t.length-1)===" "){t=t.substring(0,t.length-1)}return t}function pad(e,t,n){if(typeof e==="undefined"){return undefined}if(typeof n==="undefined"||n.length===0){n=" "}var a;var i=Math.abs(t)-length(e);if(i>0){var s=new Array(i+1).join(n);if(n.length>1){s=substring(s,0,i)}if(t>0){a=e+s}else{a=s+e}}else{a=e}return a}async function evaluateMatcher(e,t){var n=e.apply(this,[t]);if(l(n)){n=await n}if(n&&!(typeof n.start==="number"||n.end==="number"||Array.isArray(n.groups)||f(n.next))){throw{code:"T1010",stack:(new Error).stack}}return n}async function contains(e,t){if(typeof e==="undefined"){return undefined}var n;if(typeof t==="string"){n=e.indexOf(t)!==-1}else{var a=await evaluateMatcher(t,e);n=typeof a!=="undefined"}return n}async function match(e,t,n){if(typeof e==="undefined"){return undefined}if(n<0){throw{stack:(new Error).stack,value:n,code:"D3040",index:3}}var a=s();if(typeof n==="undefined"||n>0){var i=0;var u=await evaluateMatcher(t,e);if(typeof u!=="undefined"){while(typeof u!=="undefined"&&(typeof n==="undefined"||i<n)){a.push({match:u.match,index:u.start,groups:u.groups});u=await evaluateMatcher(u.next);i++}}}return a}async function replace(e,t,n,a){if(typeof e==="undefined"){return undefined}var i=this;if(t===""){throw{code:"D3010",stack:(new Error).stack,value:t,index:2}}if(a<0){throw{code:"D3011",stack:(new Error).stack,value:a,index:4}}var s;if(typeof n==="string"){s=function(e){var t="";var a=0;var i=n.indexOf("$",a);while(i!==-1&&a<n.length){t+=n.substring(a,i);a=i+1;var s=n.charAt(a);if(s==="$"){t+="$";a++}else if(s==="0"){t+=e.match;a++}else{var u;if(e.groups.length===0){u=1}else{u=Math.floor(Math.log(e.groups.length)*Math.LOG10E)+1}i=parseInt(n.substring(a,a+u),10);if(u>1&&i>e.groups.length){i=parseInt(n.substring(a,a+u-1),10)}if(!isNaN(i)){if(e.groups.length>0){var f=e.groups[i-1];if(typeof f!=="undefined"){t+=f}}a+=i.toString().length}else{t+="$"}}i=n.indexOf("$",a)}t+=n.substring(a);return t}}else{s=n}var u="";var f=0;if(typeof a==="undefined"||a>0){var c=0;if(typeof t==="string"){var p=e.indexOf(t,f);while(p!==-1&&(typeof a==="undefined"||c<a)){u+=e.substring(f,p);u+=n;f=p+t.length;c++;p=e.indexOf(t,f)}u+=e.substring(f)}else{var d=await evaluateMatcher(t,e);if(typeof d!=="undefined"){while(typeof d!=="undefined"&&(typeof a==="undefined"||c<a)){u+=e.substring(f,d.start);var h=s.apply(i,[d]);if(l(h)){h=await h}if(typeof h==="string"){u+=h}else{throw{code:"D3012",stack:(new Error).stack,value:h}}f=d.start+d.match.length;c++;d=await evaluateMatcher(d.next)}u+=e.substring(f)}else{u=e}}}else{u=e}return u}function base64encode(e){if(typeof e==="undefined"){return undefined}var t=typeof window!=="undefined"?window.btoa:function(e){return new n.Buffer.from(e,"binary").toString("base64")};return t(e)}function base64decode(e){if(typeof e==="undefined"){return undefined}var t=typeof window!=="undefined"?window.atob:function(e){return new n.Buffer.from(e,"base64").toString("binary")};return t(e)}function encodeUrlComponent(e){if(typeof e==="undefined"){return undefined}var t;try{t=encodeURIComponent(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"encodeUrlComponent"}}return t}function encodeUrl(e){if(typeof e==="undefined"){return undefined}var t;try{t=encodeURI(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"encodeUrl"}}return t}function decodeUrlComponent(e){if(typeof e==="undefined"){return undefined}var t;try{t=decodeURIComponent(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"decodeUrlComponent"}}return t}function decodeUrl(e){if(typeof e==="undefined"){return undefined}var t;try{t=decodeURI(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"decodeUrl"}}return t}async function split(e,t,n){if(typeof e==="undefined"){return undefined}if(n<0){throw{code:"D3020",stack:(new Error).stack,value:n,index:3}}var a=[];if(typeof n==="undefined"||n>0){if(typeof t==="string"){a=e.split(t,n)}else{var i=0;var s=await evaluateMatcher(t,e);if(typeof s!=="undefined"){var u=0;while(typeof s!=="undefined"&&(typeof n==="undefined"||i<n)){a.push(e.substring(u,s.start));u=s.end;s=await evaluateMatcher(s.next);i++}if(typeof n==="undefined"||i<n){a.push(e.substring(u))}}else{a.push(e)}}}return a}function join(e,t){if(typeof e==="undefined"){return undefined}if(typeof t==="undefined"){t=""}return e.join(t)}function formatNumber(e,t,n){if(typeof e==="undefined"){return undefined}var a={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"};var i=a;if(typeof n!=="undefined"){Object.keys(n).forEach((function(e){i[e]=n[e]}))}var s=[];var u=i["zero-digit"].charCodeAt(0);for(var f=u;f<u+10;f++){s.push(String.fromCharCode(f))}var c=s.concat([i["decimal-separator"],i["exponent-separator"],i["grouping-separator"],i.digit,i["pattern-separator"]]);var l=t.split(i["pattern-separator"]);if(l.length>2){throw{code:"D3080",stack:(new Error).stack}}var splitParts=function(e){var t=function(){var t;for(var n=0;n<e.length;n++){t=e.charAt(n);if(c.indexOf(t)!==-1&&t!==i["exponent-separator"]){return e.substring(0,n)}}}();var n=function(){var t;for(var n=e.length-1;n>=0;n--){t=e.charAt(n);if(c.indexOf(t)!==-1&&t!==i["exponent-separator"]){return e.substring(n+1)}}}();var a=e.substring(t.length,e.length-n.length);var s,u,f,l;var p=e.indexOf(i["exponent-separator"],t.length);if(p===-1||p>e.length-n.length){s=a;u=undefined}else{s=a.substring(0,p);u=a.substring(p+1)}var d=s.indexOf(i["decimal-separator"]);if(d===-1){f=s;l=n}else{f=s.substring(0,d);l=s.substring(d+1)}return{prefix:t,suffix:n,activePart:a,mantissaPart:s,exponentPart:u,integerPart:f,fractionalPart:l,subpicture:e}};var validate=function(e){var t;var n;var a=e.subpicture;var u=a.indexOf(i["decimal-separator"]);if(u!==a.lastIndexOf(i["decimal-separator"])){t="D3081"}if(a.indexOf(i.percent)!==a.lastIndexOf(i.percent)){t="D3082"}if(a.indexOf(i["per-mille"])!==a.lastIndexOf(i["per-mille"])){t="D3083"}if(a.indexOf(i.percent)!==-1&&a.indexOf(i["per-mille"])!==-1){t="D3084"}var f=false;for(n=0;n<e.mantissaPart.length;n++){var l=e.mantissaPart.charAt(n);if(s.indexOf(l)!==-1||l===i.digit){f=true;break}}if(!f){t="D3085"}var p=e.activePart.split("").map((function(e){return c.indexOf(e)===-1?"p":"a"})).join("");if(p.indexOf("p")!==-1){t="D3086"}if(u!==-1){if(a.charAt(u-1)===i["grouping-separator"]||a.charAt(u+1)===i["grouping-separator"]){t="D3087"}}else if(e.integerPart.charAt(e.integerPart.length-1)===i["grouping-separator"]){t="D3088"}if(a.indexOf(i["grouping-separator"]+i["grouping-separator"])!==-1){t="D3089"}var d=e.integerPart.indexOf(i.digit);if(d!==-1&&e.integerPart.substring(0,d).split("").filter((function(e){return s.indexOf(e)>-1})).length>0){t="D3090"}d=e.fractionalPart.lastIndexOf(i.digit);if(d!==-1&&e.fractionalPart.substring(d).split("").filter((function(e){return s.indexOf(e)>-1})).length>0){t="D3091"}var h=typeof e.exponentPart==="string";if(h&&e.exponentPart.length>0&&(a.indexOf(i.percent)!==-1||a.indexOf(i["per-mille"])!==-1)){t="D3092"}if(h&&(e.exponentPart.length===0||e.exponentPart.split("").filter((function(e){return s.indexOf(e)===-1})).length>0)){t="D3093"}if(t){throw{code:t,stack:(new Error).stack}}};var analyse=function(e){var getGroupingPositions=function(t,n){var a=[];var u=t.indexOf(i["grouping-separator"]);while(u!==-1){var f=(n?t.substring(0,u):t.substring(u)).split("").filter((function(e){return s.indexOf(e)!==-1||e===i.digit})).length;a.push(f);u=e.integerPart.indexOf(i["grouping-separator"],u+1)}return a};var t=getGroupingPositions(e.integerPart);var regular=function(e){if(e.length===0){return 0}var gcd=function(e,t){return t===0?e:gcd(t,e%t)};var t=e.reduce(gcd);for(var n=1;n<=e.length;n++){if(e.indexOf(n*t)===-1){return 0}}return t};var n=regular(t);var a=getGroupingPositions(e.fractionalPart,true);var u=e.integerPart.split("").filter((function(e){return s.indexOf(e)!==-1})).length;var f=u;var c=e.fractionalPart.split("");var l=c.filter((function(e){return s.indexOf(e)!==-1})).length;var p=c.filter((function(e){return s.indexOf(e)!==-1||e===i.digit})).length;var d=typeof e.exponentPart==="string";if(u===0&&p===0){if(d){l=1;p=1}else{u=1}}if(d&&u===0&&e.integerPart.indexOf(i.digit)!==-1){u=1}if(u===0&&l===0){l=1}var h=0;if(d){h=e.exponentPart.split("").filter((function(e){return s.indexOf(e)!==-1})).length}return{integerPartGroupingPositions:t,regularGrouping:n,minimumIntegerPartSize:u,scalingFactor:f,prefix:e.prefix,fractionalPartGroupingPositions:a,minimumFactionalPartSize:l,maximumFactionalPartSize:p,minimumExponentSize:h,suffix:e.suffix,picture:e.subpicture}};var p=l.map(splitParts);p.forEach(validate);var d=p.map(analyse);var h=i["minus-sign"];var v=i["zero-digit"];var g=i["decimal-separator"];var y=i["grouping-separator"];if(d.length===1){d.push(JSON.parse(JSON.stringify(d[0])));d[1].prefix=h+d[1].prefix}var m;if(e>=0){m=d[0]}else{m=d[1]}var b;if(m.picture.indexOf(i.percent)!==-1){b=e*100}else if(m.picture.indexOf(i["per-mille"])!==-1){b=e*1e3}else{b=e}var w,k;if(m.minimumExponentSize===0){w=b}else{var x=Math.pow(10,m.scalingFactor);var A=Math.pow(10,m.scalingFactor-1);w=b;k=0;while(w<A){w*=10;k-=1}while(w>x){w/=10;k+=1}}var E=round(w,m.maximumFactionalPartSize);var makeString=function(e,t){var n=Math.abs(e).toFixed(t);if(v!=="0"){n=n.split("").map((function(e){if(e>="0"&&e<="9"){return s[e.charCodeAt(0)-48]}else{return e}})).join("")}return n};var T=makeString(E,m.maximumFactionalPartSize);var F=T.indexOf(".");if(F===-1){T=T+g}else{T=T.replace(".",g)}while(T.charAt(0)===v){T=T.substring(1)}while(T.charAt(T.length-1)===v){T=T.substring(0,T.length-1)}F=T.indexOf(g);var D=m.minimumIntegerPartSize-F;var S=m.minimumFactionalPartSize-(T.length-F-1);T=(D>0?new Array(D+1).join(v):"")+T;T=T+(S>0?new Array(S+1).join(v):"");F=T.indexOf(g);if(m.regularGrouping>0){var O=Math.floor((F-1)/m.regularGrouping);for(var P=1;P<=O;P++){T=[T.slice(0,F-P*m.regularGrouping),y,T.slice(F-P*m.regularGrouping)].join("")}}else{m.integerPartGroupingPositions.forEach((function(e){T=[T.slice(0,F-e),y,T.slice(F-e)].join("");F++}))}F=T.indexOf(g);m.fractionalPartGroupingPositions.forEach((function(e){T=[T.slice(0,e+F+1),y,T.slice(e+F+1)].join("")}));F=T.indexOf(g);if(m.picture.indexOf(g)===-1||F===T.length-1){T=T.substring(0,T.length-1)}if(typeof k!=="undefined"){var M=makeString(k,0);D=m.minimumExponentSize-M.length;if(D>0){M=new Array(D+1).join(v)+M}T=T+i["exponent-separator"]+(k<0?h:"")+M}T=m.prefix+T+m.suffix;return T}function formatBase(e,t){if(typeof e==="undefined"){return undefined}e=round(e);if(typeof t==="undefined"){t=10}else{t=round(t)}if(t<2||t>36){throw{code:"D3100",stack:(new Error).stack,value:t}}var n=e.toString(t);return n}function number(e){var t;if(typeof e==="undefined"){return undefined}if(typeof e==="number"){t=e}else if(typeof e==="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(e)&&!isNaN(parseFloat(e))&&isFinite(e)){t=parseFloat(e)}else if(typeof e==="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(e)){t=Number(e)}else if(e===true){t=1}else if(e===false){t=0}else{throw{code:"D3030",value:e,stack:(new Error).stack,index:1}}return t}function abs(e){var t;if(typeof e==="undefined"){return undefined}t=Math.abs(e);return t}function floor(e){var t;if(typeof e==="undefined"){return undefined}t=Math.floor(e);return t}function ceil(e){var t;if(typeof e==="undefined"){return undefined}t=Math.ceil(e);return t}function round(e,t){var n;if(typeof e==="undefined"){return undefined}if(t){var a=e.toString().split("e");e=+(a[0]+"e"+(a[1]?+a[1]+t:t))}n=Math.round(e);var i=n-e;if(Math.abs(i)===.5&&Math.abs(n%2)===1){n=n-1}if(t){a=n.toString().split("e");n=+(a[0]+"e"+(a[1]?+a[1]-t:-t))}if(Object.is(n,-0)){n=0}return n}function sqrt(e){var t;if(typeof e==="undefined"){return undefined}if(e<0){throw{stack:(new Error).stack,code:"D3060",index:1,value:e}}t=Math.sqrt(e);return t}function power(e,t){var n;if(typeof e==="undefined"){return undefined}n=Math.pow(e,t);if(!isFinite(n)){throw{stack:(new Error).stack,code:"D3061",index:1,value:e,exp:t}}return n}function random(){return Math.random()}function boolean(t){if(typeof t==="undefined"){return undefined}var n=false;if(Array.isArray(t)){if(t.length===1){n=boolean(t[0])}else if(t.length>1){var a=t.filter((function(e){return boolean(e)}));n=a.length>0}}else if(typeof t==="string"){if(t.length>0){n=true}}else if(e(t)){if(t!==0){n=true}}else if(t!==null&&typeof t==="object"){if(Object.keys(t).length>0){n=true}}else if(typeof t==="boolean"&&t===true){n=true}return n}function not(e){if(typeof e==="undefined"){return undefined}return!boolean(e)}function hofFuncArgs(e,t,n,a){var i=[t];var s=p(e);if(s>=2){i.push(n)}if(s>=3){i.push(a)}return i}async function map(e,t){if(typeof e==="undefined"){return undefined}var n=s();for(var a=0;a<e.length;a++){var i=hofFuncArgs(t,e[a],a,e);var u=await t.apply(this,i);if(typeof u!=="undefined"){n.push(u)}}return n}async function filter(e,t){if(typeof e==="undefined"){return undefined}var n=s();for(var a=0;a<e.length;a++){var i=e[a];var u=hofFuncArgs(t,i,a,e);var f=await t.apply(this,u);if(boolean(f)){n.push(i)}}return n}async function single(e,t){if(typeof e==="undefined"){return undefined}var n=false;var a;for(var i=0;i<e.length;i++){var s=e[i];var u=true;if(typeof t!=="undefined"){var f=hofFuncArgs(t,s,i,e);var c=await t.apply(this,f);u=boolean(c)}if(u){if(!n){a=s;n=true}else{throw{stack:(new Error).stack,code:"D3138",index:i}}}}if(!n){throw{stack:(new Error).stack,code:"D3139"}}return a}function zip(){var e=[];var t=Array.prototype.slice.call(arguments);var n=Math.min.apply(Math,t.map((function(e){if(Array.isArray(e)){return e.length}return 0})));for(var a=0;a<n;a++){var i=t.map((e=>e[a]));e.push(i)}return e}async function foldLeft(e,t,n){if(typeof e==="undefined"){return undefined}var a;var i=p(t);if(i<2){throw{stack:(new Error).stack,code:"D3050",index:1}}var s;if(typeof n==="undefined"&&e.length>0){a=e[0];s=1}else{a=n;s=0}while(s<e.length){var u=[a,e[s]];if(i>=3){u.push(s)}if(i>=4){u.push(e)}a=await t.apply(this,u);s++}return a}function keys(e){var t=s();if(Array.isArray(e)){var n={};e.forEach((function(e){var t=keys(e);t.forEach((function(e){n[e]=true}))}));t=keys(n)}else if(e!==null&&typeof e==="object"&&!f(e)){Object.keys(e).forEach((e=>t.push(e)))}return t}function lookup(e,t){var n;if(Array.isArray(e)){n=s();for(var a=0;a<e.length;a++){var i=lookup(e[a],t);if(typeof i!=="undefined"){if(Array.isArray(i)){i.forEach((e=>n.push(e)))}else{n.push(i)}}}}else if(e!==null&&typeof e==="object"&&!f(e)){n=e[t]}return n}function append(e,t){if(typeof e==="undefined"){return t}if(typeof t==="undefined"){return e}if(!Array.isArray(e)){e=s(e)}if(!Array.isArray(t)){t=[t]}return e.concat(t)}function exists(e){if(typeof e==="undefined"){return false}else{return true}}function spread(e){var t=s();if(Array.isArray(e)){e.forEach((function(e){t=append(t,spread(e))}))}else if(e!==null&&typeof e==="object"&&!c(e)){for(var n in e){var a={};a[n]=e[n];t.push(a)}}else{t=e}return t}function merge(e){if(typeof e==="undefined"){return undefined}var t={};e.forEach((function(e){for(var n in e){t[n]=e[n]}}));return t}function reverse(e){if(typeof e==="undefined"){return undefined}if(e.length<=1){return e}var t=e.length;var n=new Array(t);for(var a=0;a<t;a++){n[t-a-1]=e[a]}return n}async function each(e,t){var n=s();for(var a in e){var i=hofFuncArgs(t,e[a],a,e);var u=await t.apply(this,i);if(typeof u!=="undefined"){n.push(u)}}return n}function error(e){throw{code:"D3137",stack:(new Error).stack,message:e||"$error() function evaluated"}}function assert(e,t){if(!e){throw{code:"D3141",stack:(new Error).stack,message:t||"$assert() statement failed"}}return undefined}function type(t){if(t===undefined){return undefined}if(t===null){return"null"}if(e(t)){return"number"}if(typeof t==="string"){return"string"}if(typeof t==="boolean"){return"boolean"}if(Array.isArray(t)){return"array"}if(f(t)){return"function"}return"object"}async function sort(e,n){if(typeof e==="undefined"){return undefined}if(e.length<=1){return e}var a;if(typeof n==="undefined"){if(!i(e)&&!t(e)){throw{stack:(new Error).stack,code:"D3070",index:1}}a=async function(e,t){return e>t}}else{a=n}var merge=async function(e,t){var merge_iter=async function(e,t,n){if(t.length===0){Array.prototype.push.apply(e,n)}else if(n.length===0){Array.prototype.push.apply(e,t)}else if(await a(t[0],n[0])){e.push(n[0]);await merge_iter(e,t,n.slice(1))}else{e.push(t[0]);await merge_iter(e,t.slice(1),n)}};var n=[];await merge_iter(n,e,t);return n};var msort=async function(e){if(!Array.isArray(e)||e.length<=1){return e}else{var t=Math.floor(e.length/2);var n=e.slice(0,t);var a=e.slice(t);n=await msort(n);a=await msort(a);return await merge(n,a)}};var s=await msort(e);return s}function shuffle(e){if(typeof e==="undefined"){return undefined}if(e.length<=1){return e}var t=new Array(e.length);for(var n=0;n<e.length;n++){var a=Math.floor(Math.random()*(n+1));if(n!==a){t[n]=t[a]}t[a]=e[n]}return t}function distinct(e){if(typeof e==="undefined"){return undefined}if(!Array.isArray(e)||e.length<=1){return e}var t=u(e)?s():[];for(var n=0;n<e.length;n++){var a=e[n];var i=false;for(var f=0;f<t.length;f++){if(d(a,t[f])){i=true;break}}if(!i){t.push(a)}}return t}async function sift(e,t){var n={};for(var a in e){var i=e[a];var s=hofFuncArgs(t,i,a,e);var u=await t.apply(this,s);if(boolean(u)){n[a]=i}}if(Object.keys(n).length===0){n=undefined}return n}return{sum:sum,count:count,max:max,min:min,average:average,string:string,substring:substring,substringBefore:substringBefore,substringAfter:substringAfter,lowercase:lowercase,uppercase:uppercase,length:length,trim:trim,pad:pad,match:match,contains:contains,replace:replace,split:split,join:join,formatNumber:formatNumber,formatBase:formatBase,number:number,floor:floor,ceil:ceil,round:round,abs:abs,sqrt:sqrt,power:power,random:random,boolean:boolean,not:not,map:map,zip:zip,filter:filter,single:single,foldLeft:foldLeft,sift:sift,keys:keys,lookup:lookup,append:append,exists:exists,spread:spread,merge:merge,reverse:reverse,each:each,error:error,assert:assert,type:type,sort:sort,shuffle:shuffle,distinct:distinct,base64encode:base64encode,base64decode:base64decode,encodeUrlComponent:encodeUrlComponent,encodeUrl:encodeUrl,decodeUrlComponent:decodeUrlComponent,decodeUrl:decodeUrl}})();t.exports=i}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./utils":6}],3:[function(e,t,n){var a=e("./datetime");var i=e("./functions");var s=e("./utils");var u=e("./parser");var f=e("./signature");var c=function(){"use strict";var e=s.isNumeric;var t=s.isArrayOfStrings;var n=s.isArrayOfNumbers;var c=s.createSequence;var l=s.isSequence;var p=s.isFunction;var d=s.isLambda;var h=s.isIterable;var v=s.isPromise;var g=s.getFunctionArity;var y=s.isDeepEqual;var m=createFrame(null);async function evaluate(e,t,n){var a;var i=n.lookup(Symbol.for("jsonata.__evaluate_entry"));if(i){await i(e,t,n)}switch(e.type){case"path":a=await evaluatePath(e,t,n);break;case"binary":a=await evaluateBinary(e,t,n);break;case"unary":a=await evaluateUnary(e,t,n);break;case"name":a=evaluateName(e,t,n);break;case"string":case"number":case"value":a=evaluateLiteral(e,t,n);break;case"wildcard":a=evaluateWildcard(e,t,n);break;case"descendant":a=evaluateDescendants(e,t,n);break;case"parent":a=n.lookup(e.slot.label);break;case"condition":a=await evaluateCondition(e,t,n);break;case"block":a=await evaluateBlock(e,t,n);break;case"bind":a=await evaluateBindExpression(e,t,n);break;case"regex":a=evaluateRegex(e,t,n);break;case"function":a=await evaluateFunction(e,t,n);break;case"variable":a=evaluateVariable(e,t,n);break;case"lambda":a=evaluateLambda(e,t,n);break;case"partial":a=await evaluatePartialApplication(e,t,n);break;case"apply":a=await evaluateApplyExpression(e,t,n);break;case"transform":a=evaluateTransformExpression(e,t,n);break}if(Object.prototype.hasOwnProperty.call(e,"predicate")){for(var s=0;s<e.predicate.length;s++){a=await evaluateFilter(e.predicate[s].expr,a,n)}}if(e.type!=="path"&&Object.prototype.hasOwnProperty.call(e,"group")){a=await evaluateGroupExpression(e.group,a,n)}var u=n.lookup(Symbol.for("jsonata.__evaluate_exit"));if(u){await u(e,t,n,a)}if(a&&l(a)&&!a.tupleStream){if(e.keepArray){a.keepSingleton=true}if(a.length===0){a=undefined}else if(a.length===1){a=a.keepSingleton?a:a[0]}}return a}async function evaluatePath(e,t,n){var a;if(Array.isArray(t)&&e.steps[0].type!=="variable"){a=t}else{a=c(t)}var i;var s=false;var u=undefined;for(var f=0;f<e.steps.length;f++){var l=e.steps[f];if(l.tuple){s=true}if(f===0&&l.consarray){i=await evaluate(l,a,n)}else{if(s){u=await evaluateTupleStep(l,a,u,n)}else{i=await evaluateStep(l,a,n,f===e.steps.length-1)}}if(!s&&(typeof i==="undefined"||i.length===0)){break}if(typeof l.focus==="undefined"){a=i}}if(s){if(e.tuple){i=u}else{i=c();for(f=0;f<u.length;f++){i.push(u[f]["@"])}}}if(e.keepSingletonArray){if(Array.isArray(i)&&i.cons&&!i.sequence){i=c(i)}i.keepSingleton=true}if(e.hasOwnProperty("group")){i=await evaluateGroupExpression(e.group,s?u:i,n)}return i}function createFrameFromTuple(e,t){var n=createFrame(e);for(const e in t){n.bind(e,t[e])}return n}async function evaluateStep(e,t,n,a){var i;if(e.type==="sort"){i=await evaluateSortExpression(e,t,n);if(e.stages){i=await evaluateStages(e.stages,i,n)}return i}i=c();for(var s=0;s<t.length;s++){var u=await evaluate(e,t[s],n);if(e.stages){for(var f=0;f<e.stages.length;f++){u=await evaluateFilter(e.stages[f].expr,u,n)}}if(typeof u!=="undefined"){i.push(u)}}var p=c();if(a&&i.length===1&&Array.isArray(i[0])&&!l(i[0])){p=i[0]}else{i.forEach((function(e){if(!Array.isArray(e)||e.cons){p.push(e)}else{e.forEach((e=>p.push(e)))}}))}return p}async function evaluateStages(e,t,n){var a=t;for(var i=0;i<e.length;i++){var s=e[i];switch(s.type){case"filter":a=await evaluateFilter(s.expr,a,n);break;case"index":for(var u=0;u<a.length;u++){var f=a[u];f[s.value]=u}break}}return a}async function evaluateTupleStep(e,t,n,a){var i;if(e.type==="sort"){if(n){i=await evaluateSortExpression(e,n,a)}else{var s=await evaluateSortExpression(e,t,a);i=c();i.tupleStream=true;for(var u=0;u<s.length;u++){var f={"@":s[u]};f[e.index]=u;i.push(f)}}if(e.stages){i=await evaluateStages(e.stages,i,a)}return i}i=c();i.tupleStream=true;var l=a;if(n===undefined){n=t.map((e=>({"@":e})))}for(var p=0;p<n.length;p++){l=createFrameFromTuple(a,n[p]);var d=await evaluate(e,n[p]["@"],l);if(typeof d!=="undefined"){if(!Array.isArray(d)){d=[d]}for(var h=0;h<d.length;h++){f={};Object.assign(f,n[p]);if(d.tupleStream){Object.assign(f,d[h])}else{if(e.focus){f[e.focus]=d[h];f["@"]=n[p]["@"]}else{f["@"]=d[h]}if(e.index){f[e.index]=h}if(e.ancestor){f[e.ancestor.label]=n[p]["@"]}}i.push(f)}}}if(e.stages){i=await evaluateStages(e.stages,i,a)}return i}async function evaluateFilter(t,a,s){var u=c();if(a&&a.tupleStream){u.tupleStream=true}if(!Array.isArray(a)){a=c(a)}if(t.type==="number"){var f=Math.floor(t.value);if(f<0){f=a.length+f}var l=a[f];if(typeof l!=="undefined"){if(Array.isArray(l)){u=l}else{u.push(l)}}}else{for(f=0;f<a.length;f++){var l=a[f];var p=l;var d=s;if(a.tupleStream){p=l["@"];d=createFrameFromTuple(s,l)}var h=await evaluate(t,p,d);if(e(h)){h=[h]}if(n(h)){h.forEach((function(e){var t=Math.floor(e);if(t<0){t=a.length+t}if(t===f){u.push(l)}}))}else if(i.boolean(h)){u.push(l)}}}return u}async function evaluateBinary(e,t,n){var a;var i=await evaluate(e.lhs,t,n);var s=e.value;var evalrhs=async()=>await evaluate(e.rhs,t,n);if(s==="and"||s==="or"){try{return await evaluateBooleanExpression(i,evalrhs,s)}catch(t){t.position=e.position;t.token=s;throw t}}var u=await evalrhs();try{switch(s){case"+":case"-":case"*":case"/":case"%":a=evaluateNumericExpression(i,u,s);break;case"=":case"!=":a=evaluateEqualityExpression(i,u,s);break;case"<":case"<=":case">":case">=":a=evaluateComparisonExpression(i,u,s);break;case"&":a=evaluateStringConcat(i,u);break;case"..":a=evaluateRangeExpression(i,u);break;case"in":a=evaluateIncludesExpression(i,u);break}}catch(t){t.position=e.position;t.token=s;throw t}return a}async function evaluateUnary(t,n,a){var s;switch(t.value){case"-":s=await evaluate(t.expression,n,a);if(typeof s==="undefined"){s=undefined}else if(e(s)){s=-s}else{throw{code:"D1002",stack:(new Error).stack,position:t.position,token:t.value,value:s}}break;case"[":s=[];let c=await Promise.all(t.expressions.map((async(e,t)=>{a.isParallelCall=t>0;return[e,await evaluate(e,n,a)]})));for(let e of c){var[u,f]=e;if(typeof f!=="undefined"){if(u.value==="["){s.push(f)}else{s=i.append(s,f)}}}if(t.consarray){Object.defineProperty(s,"cons",{enumerable:false,configurable:false,value:true})}break;case"{":s=await evaluateGroupExpression(t,n,a);break}return s}function evaluateName(e,t,n){return i.lookup(t,e.value)}function evaluateLiteral(e){return e.value}function evaluateWildcard(e,t){var n=c();if(Array.isArray(t)&&t.outerWrapper&&t.length>0){t=t[0]}if(t!==null&&typeof t==="object"){Object.keys(t).forEach((function(e){var a=t[e];if(Array.isArray(a)){a=flatten(a);n=i.append(n,a)}else{n.push(a)}}))}return n}function flatten(e,t){if(typeof t==="undefined"){t=[]}if(Array.isArray(e)){e.forEach((function(e){flatten(e,t)}))}else{t.push(e)}return t}function evaluateDescendants(e,t){var n;var a=c();if(typeof t!=="undefined"){recurseDescendants(t,a);if(a.length===1){n=a[0]}else{n=a}}return n}function recurseDescendants(e,t){if(!Array.isArray(e)){t.push(e)}if(Array.isArray(e)){e.forEach((function(e){recurseDescendants(e,t)}))}else if(e!==null&&typeof e==="object"){Object.keys(e).forEach((function(n){recurseDescendants(e[n],t)}))}}function evaluateNumericExpression(t,n,a){var i;if(typeof t!=="undefined"&&!e(t)){throw{code:"T2001",stack:(new Error).stack,value:t}}if(typeof n!=="undefined"&&!e(n)){throw{code:"T2002",stack:(new Error).stack,value:n}}if(typeof t==="undefined"||typeof n==="undefined"){return i}switch(a){case"+":i=t+n;break;case"-":i=t-n;break;case"*":i=t*n;break;case"/":i=t/n;break;case"%":i=t%n;break}return i}function evaluateEqualityExpression(e,t,n){var a;var i=typeof e;var s=typeof t;if(i==="undefined"||s==="undefined"){return false}switch(n){case"=":a=y(e,t);break;case"!=":a=!y(e,t);break}return a}function evaluateComparisonExpression(e,t,n){var a;var i=typeof e;var s=typeof t;var u=i==="undefined"||i==="string"||i==="number";var f=s==="undefined"||s==="string"||s==="number";if(!u||!f){throw{code:"T2010",stack:(new Error).stack,value:!(i==="string"||i==="number")?e:t}}if(i==="undefined"||s==="undefined"){return undefined}if(i!==s){throw{code:"T2009",stack:(new Error).stack,value:e,value2:t}}switch(n){case"<":a=e<t;break;case"<=":a=e<=t;break;case">":a=e>t;break;case">=":a=e>=t;break}return a}function evaluateIncludesExpression(e,t){var n=false;if(typeof e==="undefined"||typeof t==="undefined"){return false}if(!Array.isArray(t)){t=[t]}for(var a=0;a<t.length;a++){if(t[a]===e){n=true;break}}return n}async function evaluateBooleanExpression(e,t,n){var a;var i=boolize(e);switch(n){case"and":a=i&&boolize(await t());break;case"or":a=i||boolize(await t());break}return a}function boolize(e){var t=i.boolean(e);return typeof t==="undefined"?false:t}function evaluateStringConcat(e,t){var n;var a="";var s="";if(typeof e!=="undefined"){a=i.string(e)}if(typeof t!=="undefined"){s=i.string(t)}n=a.concat(s);return n}async function evaluateGroupExpression(e,t,n){var a={};var s={};var u=t&&t.tupleStream?true:false;if(!Array.isArray(t)){t=c(t)}if(t.length===0){t.push(undefined)}for(var f=0;f<t.length;f++){var l=t[f];var p=u?createFrameFromTuple(n,l):n;for(var d=0;d<e.lhs.length;d++){var h=e.lhs[d];var v=await evaluate(h[0],u?l["@"]:l,p);if(typeof v!=="string"&&v!==undefined){throw{code:"T1003",stack:(new Error).stack,position:e.position,value:v}}if(v!==undefined){var g={data:l,exprIndex:d};if(s.hasOwnProperty(v)){if(s[v].exprIndex!==d){throw{code:"D1009",stack:(new Error).stack,position:e.position,value:v}}s[v].data=i.append(s[v].data,l)}else{s[v]=g}}}}let y=await Promise.all(Object.keys(s).map((async(t,a)=>{let i=s[t];var f=i.data;var c=n;if(u){var l=reduceTupleStream(i.data);f=l["@"];delete l["@"];c=createFrameFromTuple(n,l)}n.isParallelCall=a>0;return[t,await evaluate(e.lhs[i.exprIndex][1],f,c)]})));for(let e of y){var[v,m]=await e;if(typeof m!=="undefined"){a[v]=m}}return a}function reduceTupleStream(e){if(!Array.isArray(e)){return e}var t={};Object.assign(t,e[0]);for(var n=1;n<e.length;n++){for(const a in e[n]){t[a]=i.append(t[a],e[n][a])}}return t}function evaluateRangeExpression(e,t){var n;if(typeof e!=="undefined"&&!Number.isInteger(e)){throw{code:"T2003",stack:(new Error).stack,value:e}}if(typeof t!=="undefined"&&!Number.isInteger(t)){throw{code:"T2004",stack:(new Error).stack,value:t}}if(typeof e==="undefined"||typeof t==="undefined"){return n}if(e>t){return n}var a=t-e+1;if(a>1e7){throw{code:"D2014",stack:(new Error).stack,value:a}}n=new Array(a);for(var i=e,s=0;i<=t;i++,s++){n[s]=i}n.sequence=true;return n}async function evaluateBindExpression(e,t,n){var a=await evaluate(e.rhs,t,n);n.bind(e.lhs.value,a);return a}async function evaluateCondition(e,t,n){var a;var s=await evaluate(e.condition,t,n);if(i.boolean(s)){a=await evaluate(e.then,t,n)}else if(typeof e.else!=="undefined"){a=await evaluate(e.else,t,n)}return a}async function evaluateBlock(e,t,n){var a;var i=createFrame(n);for(var s=0;s<e.expressions.length;s++){a=await evaluate(e.expressions[s],t,i)}return a}function evaluateRegex(e){var t=new jsonata.RegexEngine(e.value);var closure=function(n,a){var i;t.lastIndex=a||0;var s=t.exec(n);if(s!==null){i={match:s[0],start:s.index,end:s.index+s[0].length,groups:[]};if(s.length>1){for(var u=1;u<s.length;u++){i.groups.push(s[u])}}i.next=function(){if(t.lastIndex>=n.length){return undefined}else{var a=closure(n,t.lastIndex);if(a&&a.match===""){throw{code:"D1004",stack:(new Error).stack,position:e.position,value:e.value.source}}return a}}}return i};return closure}function evaluateVariable(e,t,n){var a;if(e.value===""){a=t&&t.outerWrapper?t[0]:t}else{a=n.lookup(e.value)}return a}async function evaluateSortExpression(e,t,n){var a;var s=t;var u=t.tupleStream?true:false;var comparator=async function(t,a){var i=0;for(var s=0;i===0&&s<e.terms.length;s++){var f=e.terms[s];var c=t;var l=n;if(u){c=t["@"];l=createFrameFromTuple(n,t)}var p=await evaluate(f.expression,c,l);c=a;l=n;if(u){c=a["@"];l=createFrameFromTuple(n,a)}var d=await evaluate(f.expression,c,l);var h=typeof p;var v=typeof d;if(h==="undefined"){i=v==="undefined"?0:1;continue}if(v==="undefined"){i=-1;continue}if(!(h==="string"||h==="number")||!(v==="string"||v==="number")){throw{code:"T2008",stack:(new Error).stack,position:e.position,value:!(h==="string"||h==="number")?p:d}}if(h!==v){throw{code:"T2007",stack:(new Error).stack,position:e.position,value:p,value2:d}}if(p===d){continue}else if(p<d){i=-1}else{i=1}if(f.descending===true){i=-i}}return i===1};var f={environment:n,input:t};a=await i.sort.apply(f,[s,comparator]);return a}function evaluateTransformExpression(e,n,a){var transformer=async function(n){if(typeof n==="undefined"){return undefined}var i=a.lookup("clone");if(!p(i)){throw{code:"T2013",stack:(new Error).stack,position:e.position}}var s=await apply(i,[n],null,a);var u=await evaluate(e.pattern,s,a);if(typeof u!=="undefined"){if(!Array.isArray(u)){u=[u]}for(var f=0;f<u.length;f++){var c=u[f];if(c&&(c.isPrototypeOf(s)||c instanceof Object.constructor)){throw{code:"D1010",stack:(new Error).stack,position:e.position}}var l=await evaluate(e.update,c,a);var d=typeof l;if(d!=="undefined"){if(d!=="object"||l===null||Array.isArray(l)){throw{code:"T2011",stack:(new Error).stack,position:e.update.position,value:l}}for(var h in l){c[h]=l[h]}}if(typeof e.delete!=="undefined"){var v=await evaluate(e.delete,c,a);if(typeof v!=="undefined"){var g=v;if(!Array.isArray(v)){v=[v]}if(!t(v)){throw{code:"T2012",stack:(new Error).stack,position:e.delete.position,value:g}}for(var y=0;y<v.length;y++){if(typeof c==="object"&&c!==null){delete c[v[y]]}}}}}}return s};return defineFunction(transformer,"<(oa):o>")}var b=u("function($f, $g) { function($x){ $g($f($x)) } }");async function evaluateApplyExpression(e,t,n){var a;var i=await evaluate(e.lhs,t,n);if(e.rhs.type==="function"){a=await evaluateFunction(e.rhs,t,n,{context:i})}else{var s=await evaluate(e.rhs,t,n);if(!p(s)){throw{code:"T2006",stack:(new Error).stack,position:e.position,value:s}}if(p(i)){var u=await evaluate(b,null,n);a=await apply(u,[i,s],null,n)}else{a=await apply(s,[i],null,n)}}return a}async function evaluateFunction(e,t,n,a){var i;var s=await evaluate(e.procedure,t,n);if(typeof s==="undefined"&&e.procedure.type==="path"&&n.lookup(e.procedure.steps[0].value)){throw{code:"T1005",stack:(new Error).stack,position:e.position,token:e.procedure.steps[0].value}}var u=[];if(typeof a!=="undefined"){u.push(a.context)}for(var f=0;f<e.arguments.length;f++){const a=await evaluate(e.arguments[f],t,n);if(p(a)){const closure=async function(...e){return await apply(a,e,null,n)};closure.arity=g(a);u.push(closure)}else{u.push(a)}}var c=e.procedure.type==="path"?e.procedure.steps[0].value:e.procedure.value;try{if(typeof s==="object"){s.token=c;s.position=e.position}i=await apply(s,u,t,n)}catch(t){if(!t.position){t.position=e.position}if(!t.token){t.token=c}throw t}return i}async function apply(e,t,n,a){var i;i=await applyInner(e,t,n,a);while(d(i)&&i.thunk===true){var s=await evaluate(i.body.procedure,i.input,i.environment);if(i.body.procedure.type==="variable"){s.token=i.body.procedure.value}s.position=i.body.procedure.position;var u=[];for(var f=0;f<i.body.arguments.length;f++){u.push(await evaluate(i.body.arguments[f],i.input,i.environment))}i=await applyInner(s,u,n,a)}return i}async function applyInner(e,t,n,a){var i;try{var s=t;if(e){s=validateArguments(e.signature,t,n)}if(d(e)){i=await applyProcedure(e,s)}else if(e&&e._jsonata_function===true){var u={environment:a,input:n};i=e.implementation.apply(u,s);if(h(i)){i=i.next().value}if(v(i)){i=await i}}else if(typeof e==="function"){i=e.apply(n,s);if(v(i)){i=await i}}else{throw{code:"T1006",stack:(new Error).stack}}}catch(t){if(e){if(typeof t.token=="undefined"&&typeof e.token!=="undefined"){t.token=e.token}t.position=e.position||t.position}throw t}return i}function evaluateLambda(e,t,n){var a={_jsonata_lambda:true,input:t,environment:n,arguments:e.arguments,signature:e.signature,body:e.body};if(e.thunk===true){a.thunk=true}a.apply=async function(e,i){return await apply(a,i,t,!!e?e.environment:n)};return a}async function evaluatePartialApplication(e,t,n){var a;var i=[];for(var s=0;s<e.arguments.length;s++){var u=e.arguments[s];if(u.type==="operator"&&u.value==="?"){i.push(u)}else{i.push(await evaluate(u,t,n))}}var f=await evaluate(e.procedure,t,n);if(typeof f==="undefined"&&e.procedure.type==="path"&&n.lookup(e.procedure.steps[0].value)){throw{code:"T1007",stack:(new Error).stack,position:e.position,token:e.procedure.steps[0].value}}if(d(f)){a=partialApplyProcedure(f,i)}else if(f&&f._jsonata_function===true){a=partialApplyNativeFunction(f.implementation,i)}else if(typeof f==="function"){a=partialApplyNativeFunction(f,i)}else{throw{code:"T1008",stack:(new Error).stack,position:e.position,token:e.procedure.type==="path"?e.procedure.steps[0].value:e.procedure.value}}return a}function validateArguments(e,t,n){if(typeof e==="undefined"){return t}var a=e.validate(t,n);return a}async function applyProcedure(e,t){var n;var a=createFrame(e.environment);e.arguments.forEach((function(e,n){a.bind(e.value,t[n])}));if(typeof e.body==="function"){n=await applyNativeFunction(e.body,a)}else{n=await evaluate(e.body,e.input,a)}return n}function partialApplyProcedure(e,t){var n=createFrame(e.environment);var a=[];e.arguments.forEach((function(e,i){var s=t[i];if(s&&s.type==="operator"&&s.value==="?"){a.push(e)}else{n.bind(e.value,s)}}));var i={_jsonata_lambda:true,input:e.input,environment:n,arguments:a,body:e.body};return i}function partialApplyNativeFunction(e,t){var n=getNativeFunctionArguments(e);n=n.map((function(e){return"$"+e.trim()}));var a="function("+n.join(", ")+"){ _ }";var i=u(a);i.body=e;var s=partialApplyProcedure(i,t);return s}async function applyNativeFunction(e,t){var n=getNativeFunctionArguments(e);var a=n.map((function(e){return t.lookup(e.trim())}));var i={environment:t};var s=e.apply(i,a);if(v(s)){s=await s}return s}function getNativeFunctionArguments(e){var t=e.toString();var n=/\(([^)]*)\)/.exec(t)[1];var a=n.split(",");return a}function defineFunction(e,t){var n={_jsonata_function:true,implementation:e};if(typeof t!=="undefined"){n.signature=f(t)}return n}async function functionEval(e,t){if(typeof e==="undefined"){return undefined}var n=this.input;if(typeof t!=="undefined"){n=t;if(Array.isArray(n)&&!l(n)){n=c(n);n.outerWrapper=true}}try{var a=u(e,false)}catch(e){populateMessage(e);throw{stack:(new Error).stack,code:"D3120",value:e.message,error:e}}try{var i=await evaluate(a,n,this.environment)}catch(e){populateMessage(e);throw{stack:(new Error).stack,code:"D3121",value:e.message,error:e}}return i}function functionClone(e){if(typeof e==="undefined"){return undefined}return JSON.parse(i.string(e))}function createFrame(e){var t={};const n={bind:function(e,n){t[e]=n},lookup:function(n){var a;if(t.hasOwnProperty(n)){a=t[n]}else if(e){a=e.lookup(n)}return a},timestamp:e?e.timestamp:null,async:e?e.async:false,isParallelCall:e?e.isParallelCall:false,global:e?e.global:{ancestry:[null]}};if(e){var a=e.lookup(Symbol.for("jsonata.__createFrame_push"));if(a){a(e,n)}}return n}m.bind("sum",defineFunction(i.sum,"<a<n>:n>"));m.bind("count",defineFunction(i.count,"<a:n>"));m.bind("max",defineFunction(i.max,"<a<n>:n>"));m.bind("min",defineFunction(i.min,"<a<n>:n>"));m.bind("average",defineFunction(i.average,"<a<n>:n>"));m.bind("string",defineFunction(i.string,"<x-b?:s>"));m.bind("substring",defineFunction(i.substring,"<s-nn?:s>"));m.bind("substringBefore",defineFunction(i.substringBefore,"<s-s:s>"));m.bind("substringAfter",defineFunction(i.substringAfter,"<s-s:s>"));m.bind("lowercase",defineFunction(i.lowercase,"<s-:s>"));m.bind("uppercase",defineFunction(i.uppercase,"<s-:s>"));m.bind("length",defineFunction(i.length,"<s-:n>"));m.bind("trim",defineFunction(i.trim,"<s-:s>"));m.bind("pad",defineFunction(i.pad,"<s-ns?:s>"));m.bind("match",defineFunction(i.match,"<s-f<s:o>n?:a<o>>"));m.bind("contains",defineFunction(i.contains,"<s-(sf):b>"));m.bind("replace",defineFunction(i.replace,"<s-(sf)(sf)n?:s>"));m.bind("split",defineFunction(i.split,"<s-(sf)n?:a<s>>"));m.bind("join",defineFunction(i.join,"<a<s>s?:s>"));m.bind("formatNumber",defineFunction(i.formatNumber,"<n-so?:s>"));m.bind("formatBase",defineFunction(i.formatBase,"<n-n?:s>"));m.bind("formatInteger",defineFunction(a.formatInteger,"<n-s:s>"));m.bind("parseInteger",defineFunction(a.parseInteger,"<s-s:n>"));m.bind("number",defineFunction(i.number,"<(nsb)-:n>"));m.bind("floor",defineFunction(i.floor,"<n-:n>"));m.bind("ceil",defineFunction(i.ceil,"<n-:n>"));m.bind("round",defineFunction(i.round,"<n-n?:n>"));m.bind("abs",defineFunction(i.abs,"<n-:n>"));m.bind("sqrt",defineFunction(i.sqrt,"<n-:n>"));m.bind("power",defineFunction(i.power,"<n-n:n>"));m.bind("random",defineFunction(i.random,"<:n>"));m.bind("boolean",defineFunction(i.boolean,"<x-:b>"));m.bind("not",defineFunction(i.not,"<x-:b>"));m.bind("map",defineFunction(i.map,"<af>"));m.bind("zip",defineFunction(i.zip,"<a+>"));m.bind("filter",defineFunction(i.filter,"<af>"));m.bind("single",defineFunction(i.single,"<af?>"));m.bind("reduce",defineFunction(i.foldLeft,"<afj?:j>"));m.bind("sift",defineFunction(i.sift,"<o-f?:o>"));m.bind("keys",defineFunction(i.keys,"<x-:a<s>>"));m.bind("lookup",defineFunction(i.lookup,"<x-s:x>"));m.bind("append",defineFunction(i.append,"<xx:a>"));m.bind("exists",defineFunction(i.exists,"<x:b>"));m.bind("spread",defineFunction(i.spread,"<x-:a<o>>"));m.bind("merge",defineFunction(i.merge,"<a<o>:o>"));m.bind("reverse",defineFunction(i.reverse,"<a:a>"));m.bind("each",defineFunction(i.each,"<o-f:a>"));m.bind("error",defineFunction(i.error,"<s?:x>"));m.bind("assert",defineFunction(i.assert,"<bs?:x>"));m.bind("type",defineFunction(i.type,"<x:s>"));m.bind("sort",defineFunction(i.sort,"<af?:a>"));m.bind("shuffle",defineFunction(i.shuffle,"<a:a>"));m.bind("distinct",defineFunction(i.distinct,"<x:x>"));m.bind("base64encode",defineFunction(i.base64encode,"<s-:s>"));m.bind("base64decode",defineFunction(i.base64decode,"<s-:s>"));m.bind("encodeUrlComponent",defineFunction(i.encodeUrlComponent,"<s-:s>"));m.bind("encodeUrl",defineFunction(i.encodeUrl,"<s-:s>"));m.bind("decodeUrlComponent",defineFunction(i.decodeUrlComponent,"<s-:s>"));m.bind("decodeUrl",defineFunction(i.decodeUrl,"<s-:s>"));m.bind("eval",defineFunction(functionEval,"<sx?:x>"));m.bind("toMillis",defineFunction(a.toMillis,"<s-s?:n>"));m.bind("fromMillis",defineFunction(a.fromMillis,"<n-s?s?:s>"));m.bind("clone",defineFunction(functionClone,"<(oa)-:o>"));var w={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",D1010:"Attempted to access the Javascript object prototype",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function populateMessage(e){var t=w[e.code];if(typeof t!=="undefined"){var n=t.replace(/\{\{\{([^}]+)}}}/g,(function(){return e[arguments[1]]}));n=n.replace(/\{\{([^}]+)}}/g,(function(){return JSON.stringify(e[arguments[1]])}));e.message=n}}function jsonata(e,t){var n;var i;try{n=u(e,t&&t.recover);i=n.errors;delete n.errors}catch(e){populateMessage(e);throw e}var s=createFrame(m);var f=new Date;s.bind("now",defineFunction((function(e,t){return a.fromMillis(f.getTime(),e,t)}),"<s?s?:s>"));s.bind("millis",defineFunction((function(){return f.getTime()}),"<:n>"));if(t&&t.RegexEngine){jsonata.RegexEngine=t.RegexEngine}else{jsonata.RegexEngine=RegExp}return{evaluate:async function(e,t,a){if(typeof i!=="undefined"){var u={code:"S0500",position:0};populateMessage(u);throw u}if(typeof t!=="undefined"){var p;p=createFrame(s);for(var d in t){p.bind(d,t[d])}}else{p=s}p.bind("$",e);f=new Date;p.timestamp=f;if(Array.isArray(e)&&!l(e)){e=c(e);e.outerWrapper=true}var h;try{h=await evaluate(n,e,p);if(typeof a==="function"){a(null,h)}return h}catch(u){populateMessage(u);throw u}},assign:function(e,t){s.bind(e,t)},registerFunction:function(e,t,n){var a=defineFunction(t,n);s.bind(e,a)},ast:function(){return n},errors:function(){return i}}}jsonata.parser=u;return jsonata}();t.exports=c},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(e,t,n){var a=e("./signature");const i=(()=>{"use strict";var e={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,and:30,or:25,in:40,"&":50,"!":0,"~":0};var t={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};var tokenizer=function(n){var a=0;var i=n.length;var create=function(e,t){var n={type:e,value:t,position:a};return n};var scanRegex=function(){var e=a;var t=0;var s;var u;var isClosingSlash=function(e){if(n.charAt(e)==="/"&&t===0){var a=0;while(n.charAt(e-(a+1))==="\\"){a++}if(a%2===0){return true}}return false};while(a<i){var f=n.charAt(a);if(isClosingSlash(a)){s=n.substring(e,a);if(s===""){throw{code:"S0301",stack:(new Error).stack,position:a}}a++;f=n.charAt(a);e=a;while(f==="i"||f==="m"){a++;f=n.charAt(a)}u=n.substring(e,a)+"g";return new RegExp(s,u)}if((f==="("||f==="["||f==="{")&&n.charAt(a-1)!=="\\"){t++}if((f===")"||f==="]"||f==="}")&&n.charAt(a-1)!=="\\"){t--}a++}throw{code:"S0302",stack:(new Error).stack,position:a}};var next=function(s){if(a>=i)return null;var u=n.charAt(a);while(a<i&&" \t\n\r\v".indexOf(u)>-1){a++;u=n.charAt(a)}if(u==="/"&&n.charAt(a+1)==="*"){var f=a;a+=2;u=n.charAt(a);while(!(u==="*"&&n.charAt(a+1)==="/")){u=n.charAt(++a);if(a>=i){throw{code:"S0106",stack:(new Error).stack,position:f}}}a+=2;u=n.charAt(a);return next(s)}if(s!==true&&u==="/"){a++;return create("regex",scanRegex())}if(u==="."&&n.charAt(a+1)==="."){a+=2;return create("operator","..")}if(u===":"&&n.charAt(a+1)==="="){a+=2;return create("operator",":=")}if(u==="!"&&n.charAt(a+1)==="="){a+=2;return create("operator","!=")}if(u===">"&&n.charAt(a+1)==="="){a+=2;return create("operator",">=")}if(u==="<"&&n.charAt(a+1)==="="){a+=2;return create("operator","<=")}if(u==="*"&&n.charAt(a+1)==="*"){a+=2;return create("operator","**")}if(u==="~"&&n.charAt(a+1)===">"){a+=2;return create("operator","~>")}if(Object.prototype.hasOwnProperty.call(e,u)){a++;return create("operator",u)}if(u==='"'||u==="'"){var c=u;a++;var l="";while(a<i){u=n.charAt(a);if(u==="\\"){a++;u=n.charAt(a);if(Object.prototype.hasOwnProperty.call(t,u)){l+=t[u]}else if(u==="u"){var p=n.substr(a+1,4);if(/^[0-9a-fA-F]+$/.test(p)){var d=parseInt(p,16);l+=String.fromCharCode(d);a+=4}else{throw{code:"S0104",stack:(new Error).stack,position:a}}}else{throw{code:"S0103",stack:(new Error).stack,position:a,token:u}}}else if(u===c){a++;return create("string",l)}else{l+=u}a++}throw{code:"S0101",stack:(new Error).stack,position:a}}var h=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/;var v=h.exec(n.substring(a));if(v!==null){var g=parseFloat(v[0]);if(!isNaN(g)&&isFinite(g)){a+=v[0].length;return create("number",g)}else{throw{code:"S0102",stack:(new Error).stack,position:a,token:v[0]}}}var y;if(u==="`"){a++;var m=n.indexOf("`",a);if(m!==-1){y=n.substring(a,m);a=m+1;return create("name",y)}a=i;throw{code:"S0105",stack:(new Error).stack,position:a}}var b=a;var w;for(;;){w=n.charAt(b);if(b===i||" \t\n\r\v".indexOf(w)>-1||Object.prototype.hasOwnProperty.call(e,w)){if(n.charAt(a)==="$"){y=n.substring(a+1,b);a=b;return create("variable",y)}else{y=n.substring(a,b);a=b;switch(y){case"or":case"in":case"and":return create("operator",y);case"true":return create("value",true);case"false":return create("value",false);case"null":return create("value",null);default:if(a===i&&y===""){return null}return create("name",y)}}}else{b++}}};return next};var parser=function(t,n){var i;var s;var u={};var f=[];var remainingTokens=function(){var e=[];if(i.id!=="(end)"){e.push({type:i.type,value:i.value,position:i.position})}var t=s();while(t!==null){e.push(t);t=s()}return e};var c={nud:function(){var e={code:"S0211",token:this.value,position:this.position};if(n){e.remaining=remainingTokens();e.type="error";f.push(e);return e}else{e.stack=(new Error).stack;throw e}}};var symbol=function(e,t){var n=u[e];t=t||0;if(n){if(t>=n.lbp){n.lbp=t}}else{n=Object.create(c);n.id=n.value=e;n.lbp=t;u[e]=n}return n};var handleError=function(e){if(n){e.remaining=remainingTokens();f.push(e);var t=u["(error)"];i=Object.create(t);i.error=e;i.type="(error)";return i}else{e.stack=(new Error).stack;throw e}};var advance=function(e,n){if(e&&i.id!==e){var a;if(i.id==="(end)"){a="S0203"}else{a="S0202"}var f={code:a,position:i.position,token:i.value,value:e};return handleError(f)}var c=s(n);if(c===null){i=u["(end)"];i.position=t.length;return i}var l=c.value;var p=c.type;var d;switch(p){case"name":case"variable":d=u["(name)"];break;case"operator":d=u[l];if(!d){return handleError({code:"S0204",stack:(new Error).stack,position:c.position,token:l})}break;case"string":case"number":case"value":d=u["(literal)"];break;case"regex":p="regex";d=u["(regex)"];break;default:return handleError({code:"S0205",stack:(new Error).stack,position:c.position,token:l})}i=Object.create(d);i.value=l;i.type=p;i.position=c.position;return i};var expression=function(e){var t;var n=i;advance(null,true);t=n.nud();while(e<i.lbp){n=i;advance();t=n.led(t)}return t};var terminal=function(e){var t=symbol(e,0);t.nud=function(){return this}};var infix=function(t,n,a){var i=n||e[t];var s=symbol(t,i);s.led=a||function(e){this.lhs=e;this.rhs=expression(i);this.type="binary";return this};return s};var infixr=function(e,t,n){var a=symbol(e,t);a.led=n;return a};var prefix=function(e,t){var n=symbol(e);n.nud=t||function(){this.expression=expression(70);this.type="unary";return this};return n};terminal("(end)");terminal("(name)");terminal("(literal)");terminal("(regex)");symbol(":");symbol(";");symbol(",");symbol(")");symbol("]");symbol("}");symbol("..");infix(".");infix("+");infix("-");infix("*");infix("/");infix("%");infix("=");infix("<");infix(">");infix("!=");infix("<=");infix(">=");infix("&");infix("and");infix("or");infix("in");terminal("and");terminal("or");terminal("in");prefix("-");infix("~>");infixr("(error)",10,(function(e){this.lhs=e;this.error=i.error;this.remaining=remainingTokens();this.type="error";return this}));prefix("*",(function(){this.type="wildcard";return this}));prefix("**",(function(){this.type="descendant";return this}));prefix("%",(function(){this.type="parent";return this}));infix("(",e["("],(function(e){this.procedure=e;this.type="function";this.arguments=[];if(i.id!==")"){for(;;){if(i.type==="operator"&&i.id==="?"){this.type="partial";this.arguments.push(i);advance("?")}else{this.arguments.push(expression(0))}if(i.id!==",")break;advance(",")}}advance(")",true);if(e.type==="name"&&(e.value==="function"||e.value==="λ")){this.arguments.forEach((function(e,t){if(e.type!=="variable"){return handleError({code:"S0208",stack:(new Error).stack,position:e.position,token:e.value,value:t+1})}}));this.type="lambda";if(i.id==="<"){var t=i.position;var n=1;var s="<";while(n>0&&i.id!=="{"&&i.id!=="(end)"){var u=advance();if(u.id===">"){n--}else if(u.id==="<"){n++}s+=u.value}advance(">");try{this.signature=a(s)}catch(e){e.position=t+e.offset;return handleError(e)}}advance("{");this.body=expression(0);advance("}")}return this}));prefix("(",(function(){var e=[];while(i.id!==")"){e.push(expression(0));if(i.id!==";"){break}advance(";")}advance(")",true);this.type="block";this.expressions=e;return this}));prefix("[",(function(){var e=[];if(i.id!=="]"){for(;;){var t=expression(0);if(i.id===".."){var n={type:"binary",value:"..",position:i.position,lhs:t};advance("..");n.rhs=expression(0);t=n}e.push(t);if(i.id!==","){break}advance(",")}}advance("]",true);this.expressions=e;this.type="unary";return this}));infix("[",e["["],(function(t){if(i.id==="]"){var n=t;while(n&&n.type==="binary"&&n.value==="["){n=n.lhs}n.keepArray=true;advance("]");return t}else{this.lhs=t;this.rhs=expression(e["]"]);this.type="binary";advance("]",true);return this}}));infix("^",e["^"],(function(e){advance("(");var t=[];for(;;){var n={descending:false};if(i.id==="<"){advance("<")}else if(i.id===">"){n.descending=true;advance(">")}else{}n.expression=expression(0);t.push(n);if(i.id!==","){break}advance(",")}advance(")");this.lhs=e;this.rhs=t;this.type="binary";return this}));var objectParser=function(e){var t=[];if(i.id!=="}"){for(;;){var n=expression(0);advance(":");var a=expression(0);t.push([n,a]);if(i.id!==","){break}advance(",")}}advance("}",true);if(typeof e==="undefined"){this.lhs=t;this.type="unary"}else{this.lhs=e;this.rhs=t;this.type="binary"}return this};prefix("{",objectParser);infix("{",e["{"],objectParser);infixr(":=",e[":="],(function(t){if(t.type!=="variable"){return handleError({code:"S0212",stack:(new Error).stack,position:t.position,token:t.value})}this.lhs=t;this.rhs=expression(e[":="]-1);this.type="binary";return this}));infix("@",e["@"],(function(t){this.lhs=t;this.rhs=expression(e["@"]);if(this.rhs.type!=="variable"){return handleError({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"@"})}this.type="binary";return this}));infix("#",e["#"],(function(t){this.lhs=t;this.rhs=expression(e["#"]);if(this.rhs.type!=="variable"){return handleError({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"#"})}this.type="binary";return this}));infix("?",e["?"],(function(e){this.type="condition";this.condition=e;this.then=expression(0);if(i.id===":"){advance(":");this.else=expression(0)}return this}));prefix("|",(function(){this.type="transform";this.pattern=expression(0);advance("|");this.update=expression(0);if(i.id===","){advance(",");this.delete=expression(0)}advance("|");return this}));var tailCallOptimize=function(e){var t;if(e.type==="function"&&!e.predicate){var n={type:"lambda",thunk:true,arguments:[],position:e.position};n.body=e;t=n}else if(e.type==="condition"){e.then=tailCallOptimize(e.then);if(typeof e.else!=="undefined"){e.else=tailCallOptimize(e.else)}t=e}else if(e.type==="block"){var a=e.expressions.length;if(a>0){e.expressions[a-1]=tailCallOptimize(e.expressions[a-1])}t=e}else{t=e}return t};var l=0;var p=0;var d=[];var seekParent=function(e,t){switch(e.type){case"name":case"wildcard":t.level--;if(t.level===0){if(typeof e.ancestor==="undefined"){e.ancestor=t}else{d[t.index].slot.label=e.ancestor.label;e.ancestor=t}e.tuple=true}break;case"parent":t.level++;break;case"block":if(e.expressions.length>0){e.tuple=true;t=seekParent(e.expressions[e.expressions.length-1],t)}break;case"path":e.tuple=true;var n=e.steps.length-1;t=seekParent(e.steps[n--],t);while(t.level>0&&n>=0){t=seekParent(e.steps[n--],t)}break;default:throw{code:"S0217",token:e.type,position:e.position}}return t};var pushAncestry=function(e,t){if(typeof t.seekingParent!=="undefined"||t.type==="parent"){var n=typeof t.seekingParent!=="undefined"?t.seekingParent:[];if(t.type==="parent"){n.push(t.slot)}if(typeof e.seekingParent==="undefined"){e.seekingParent=n}else{Array.prototype.push.apply(e.seekingParent,n)}}};var resolveAncestry=function(e){var t=e.steps.length-1;var n=e.steps[t];var a=typeof n.seekingParent!=="undefined"?n.seekingParent:[];if(n.type==="parent"){a.push(n.slot)}for(var i=0;i<a.length;i++){var s=a[i];t=e.steps.length-2;while(s.level>0){if(t<0){if(typeof e.seekingParent==="undefined"){e.seekingParent=[s]}else{e.seekingParent.push(s)}break}var u=e.steps[t--];while(t>=0&&u.focus&&e.steps[t].focus){u=e.steps[t--]}s=seekParent(u,s)}}};var processAST=function(e){var t;switch(e.type){case"binary":switch(e.value){case".":var a=processAST(e.lhs);if(a.type==="path"){t=a}else{t={type:"path",steps:[a]}}if(a.type==="parent"){t.seekingParent=[a.slot]}var i=processAST(e.rhs);if(i.type==="function"&&i.procedure.type==="path"&&i.procedure.steps.length===1&&i.procedure.steps[0].type==="name"&&t.steps[t.steps.length-1].type==="function"){t.steps[t.steps.length-1].nextFunction=i.procedure.steps[0].value}if(i.type==="path"){Array.prototype.push.apply(t.steps,i.steps)}else{if(typeof i.predicate!=="undefined"){i.stages=i.predicate;delete i.predicate}t.steps.push(i)}t.steps.filter((function(e){if(e.type==="number"||e.type==="value"){throw{code:"S0213",stack:(new Error).stack,position:e.position,value:e.value}}return e.type==="string"})).forEach((function(e){e.type="name"}));if(t.steps.filter((function(e){return e.keepArray===true})).length>0){t.keepSingletonArray=true}var s=t.steps[0];if(s.type==="unary"&&s.value==="["){s.consarray=true}var u=t.steps[t.steps.length-1];if(u.type==="unary"&&u.value==="["){u.consarray=true}resolveAncestry(t);break;case"[":t=processAST(e.lhs);var c=t;var h="predicate";if(t.type==="path"){c=t.steps[t.steps.length-1];h="stages"}if(typeof c.group!=="undefined"){throw{code:"S0209",stack:(new Error).stack,position:e.position}}if(typeof c[h]==="undefined"){c[h]=[]}var v=processAST(e.rhs);if(typeof v.seekingParent!=="undefined"){v.seekingParent.forEach((e=>{if(e.level===1){seekParent(c,e)}else{e.level--}}));pushAncestry(c,v)}c[h].push({type:"filter",expr:v,position:e.position});break;case"{":t=processAST(e.lhs);if(typeof t.group!=="undefined"){throw{code:"S0210",stack:(new Error).stack,position:e.position}}t.group={lhs:e.rhs.map((function(e){return[processAST(e[0]),processAST(e[1])]})),position:e.position};break;case"^":t=processAST(e.lhs);if(t.type!=="path"){t={type:"path",steps:[t]}}var g={type:"sort",position:e.position};g.terms=e.rhs.map((function(e){var t=processAST(e.expression);pushAncestry(g,t);return{descending:e.descending,expression:t}}));t.steps.push(g);resolveAncestry(t);break;case":=":t={type:"bind",value:e.value,position:e.position};t.lhs=processAST(e.lhs);t.rhs=processAST(e.rhs);pushAncestry(t,t.rhs);break;case"@":t=processAST(e.lhs);c=t;if(t.type==="path"){c=t.steps[t.steps.length-1]}if(typeof c.stages!=="undefined"||typeof c.predicate!=="undefined"){throw{code:"S0215",stack:(new Error).stack,position:e.position}}if(c.type==="sort"){throw{code:"S0216",stack:(new Error).stack,position:e.position}}if(e.keepArray){c.keepArray=true}c.focus=e.rhs.value;c.tuple=true;break;case"#":t=processAST(e.lhs);c=t;if(t.type==="path"){c=t.steps[t.steps.length-1]}else{t={type:"path",steps:[t]};if(typeof c.predicate!=="undefined"){c.stages=c.predicate;delete c.predicate}}if(typeof c.stages==="undefined"){c.index=e.rhs.value}else{c.stages.push({type:"index",value:e.rhs.value,position:e.position})}c.tuple=true;break;case"~>":t={type:"apply",value:e.value,position:e.position};t.lhs=processAST(e.lhs);t.rhs=processAST(e.rhs);t.keepArray=t.lhs.keepArray||t.rhs.keepArray;break;default:t={type:e.type,value:e.value,position:e.position};t.lhs=processAST(e.lhs);t.rhs=processAST(e.rhs);pushAncestry(t,t.lhs);pushAncestry(t,t.rhs)}break;case"unary":t={type:e.type,value:e.value,position:e.position};if(e.value==="["){t.expressions=e.expressions.map((function(e){var n=processAST(e);pushAncestry(t,n);return n}))}else if(e.value==="{"){t.lhs=e.lhs.map((function(e){var n=processAST(e[0]);pushAncestry(t,n);var a=processAST(e[1]);pushAncestry(t,a);return[n,a]}))}else{t.expression=processAST(e.expression);if(e.value==="-"&&t.expression.type==="number"){t=t.expression;t.value=-t.value}else{pushAncestry(t,t.expression)}}break;case"function":case"partial":t={type:e.type,name:e.name,value:e.value,position:e.position};t.arguments=e.arguments.map((function(e){var n=processAST(e);pushAncestry(t,n);return n}));t.procedure=processAST(e.procedure);break;case"lambda":t={type:e.type,arguments:e.arguments,signature:e.signature,position:e.position};var y=processAST(e.body);t.body=tailCallOptimize(y);break;case"condition":t={type:e.type,position:e.position};t.condition=processAST(e.condition);pushAncestry(t,t.condition);t.then=processAST(e.then);pushAncestry(t,t.then);if(typeof e.else!=="undefined"){t.else=processAST(e.else);pushAncestry(t,t.else)}break;case"transform":t={type:e.type,position:e.position};t.pattern=processAST(e.pattern);t.update=processAST(e.update);if(typeof e.delete!=="undefined"){t.delete=processAST(e.delete)}break;case"block":t={type:e.type,position:e.position};t.expressions=e.expressions.map((function(e){var n=processAST(e);pushAncestry(t,n);if(n.consarray||n.type==="path"&&n.steps[0].consarray){t.consarray=true}return n}));break;case"name":t={type:"path",steps:[e]};if(e.keepArray){t.keepSingletonArray=true}break;case"parent":t={type:"parent",slot:{label:"!"+l++,level:1,index:p++}};d.push(t);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":t=e;break;case"operator":if(e.value==="and"||e.value==="or"||e.value==="in"){e.type="name";t=processAST(e)}else if(e.value==="?"){t=e}else{throw{code:"S0201",stack:(new Error).stack,position:e.position,token:e.value}}break;case"error":t=e;if(e.lhs){t=processAST(e.lhs)}break;default:var m="S0206";if(e.id==="(end)"){m="S0207"}var b={code:m,position:e.position,token:e.value};if(n){f.push(b);return{type:"error",error:b}}else{b.stack=(new Error).stack;throw b}}if(e.keepArray){t.keepArray=true}return t};s=tokenizer(t);advance();var h=expression(0);if(i.id!=="(end)"){var v={code:"S0201",position:i.position,token:i.value};handleError(v)}h=processAST(h);if(h.type==="parent"||typeof h.seekingParent!=="undefined"){throw{code:"S0217",token:h.type,position:h.position}}if(f.length>0){h.errors=f}return h};return parser})();t.exports=i},{"./signature":5}],5:[function(e,t,n){var a=e("./utils");const i=(()=>{"use strict";var e={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function parseSignature(t){var n=1;var i=[];var s={};var u=s;while(n<t.length){var f=t.charAt(n);if(f===":"){break}var next=function(){i.push(s);u=s;s={}};var findClosingBracket=function(e,t,n,a){var i=1;var s=t;while(s<e.length){s++;f=e.charAt(s);if(f===a){i--;if(i===0){break}}else if(f===n){i++}}return s};switch(f){case"s":case"n":case"b":case"l":case"o":s.regex="["+f+"m]";s.type=f;next();break;case"a":s.regex="[asnblfom]";s.type=f;s.array=true;next();break;case"f":s.regex="f";s.type=f;next();break;case"j":s.regex="[asnblom]";s.type=f;next();break;case"x":s.regex="[asnblfom]";s.type=f;next();break;case"-":u.context=true;u.contextRegex=new RegExp(u.regex);u.regex+="?";break;case"?":case"+":u.regex+=f;break;case"(":var c=findClosingBracket(t,n,"(",")");var l=t.substring(n+1,c);if(l.indexOf("<")===-1){s.regex="["+l+"m]"}else{throw{code:"S0402",stack:(new Error).stack,value:l,offset:n}}s.type="("+l+")";n=c;next();break;case"<":if(u.type==="a"||u.type==="f"){var p=findClosingBracket(t,n,"<",">");u.subtype=t.substring(n+1,p);n=p}else{throw{code:"S0401",stack:(new Error).stack,value:u.type,offset:n}}break}n++}var d="^"+i.map((function(e){return"("+e.regex+")"})).join("")+"$";var h=new RegExp(d);var getSymbol=function(e){var t;if(a.isFunction(e)){t="f"}else{var n=typeof e;switch(n){case"string":t="s";break;case"number":t="n";break;case"boolean":t="b";break;case"object":if(e===null){t="l"}else if(Array.isArray(e)){t="a"}else{t="o"}break;case"undefined":default:t="m"}}return t};var throwValidationError=function(e,t){var n="^";var a=0;for(var s=0;s<i.length;s++){n+=i[s].regex;var u=t.match(n);if(u===null){throw{code:"T0410",stack:(new Error).stack,value:e[a],index:a+1}}a=u[0].length}throw{code:"T0410",stack:(new Error).stack,value:e[a],index:a+1}};return{definition:t,validate:function(t,n){var a="";t.forEach((function(e){a+=getSymbol(e)}));var s=h.exec(a);if(s){var u=[];var f=0;i.forEach((function(a,i){var c=t[f];var l=s[i+1];if(l===""){if(a.context&&a.contextRegex){var p=getSymbol(n);if(a.contextRegex.test(p)){u.push(n)}else{throw{code:"T0411",stack:(new Error).stack,value:n,index:f+1}}}else{u.push(c);f++}}else{l.split("").forEach((function(n){if(a.type==="a"){if(n==="m"){c=undefined}else{c=t[f];var i=true;if(typeof a.subtype!=="undefined"){if(n!=="a"&&l!==a.subtype){i=false}else if(n==="a"){if(c.length>0){var s=getSymbol(c[0]);if(s!==a.subtype.charAt(0)){i=false}else{var p=c.filter((function(e){return getSymbol(e)!==s}));i=p.length===0}}}}if(!i){throw{code:"T0412",stack:(new Error).stack,value:c,index:f+1,type:e[a.subtype]}}if(n!=="a"){c=[c]}}u.push(c);f++}else{u.push(c);f++}}))}}));return u}throwValidationError(t,a)}}}return parseSignature})();t.exports=i},{"./utils":6}],6:[function(e,t,n){const a=(()=>{"use strict";function isNumeric(e){var t=false;if(typeof e==="number"){t=!isNaN(e);if(t&&!isFinite(e)){throw{code:"D1001",value:e,stack:(new Error).stack}}}return t}function isArrayOfStrings(e){var t=false;if(Array.isArray(e)){t=e.filter((function(e){return typeof e!=="string"})).length===0}return t}function isArrayOfNumbers(e){var t=false;if(Array.isArray(e)){t=e.filter((function(e){return!isNumeric(e)})).length===0}return t}function createSequence(){var e=[];e.sequence=true;if(arguments.length===1){e.push(arguments[0])}return e}function isSequence(e){return e.sequence===true&&Array.isArray(e)}function isFunction(e){return e&&(e._jsonata_function===true||e._jsonata_lambda===true)||typeof e==="function"}function getFunctionArity(e){var t=typeof e.arity==="number"?e.arity:typeof e.implementation==="function"?e.implementation.length:typeof e.length==="number"?e.length:e.arguments.length;return t}function isLambda(e){return e&&e._jsonata_lambda===true}var e=(typeof Symbol==="function"?Symbol:{}).iterator||"@@iterator";function isIterable(t){return typeof t==="object"&&t!==null&&e in t&&"next"in t&&typeof t.next==="function"}function isDeepEqual(e,t){if(e===t){return true}if(typeof e==="object"&&typeof t==="object"&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length){return false}for(var n=0;n<e.length;n++){if(!isDeepEqual(e[n],t[n])){return false}}return true}var a=Object.getOwnPropertyNames(e);var i=Object.getOwnPropertyNames(t);if(a.length!==i.length){return false}a=a.sort();i=i.sort();for(n=0;n<a.length;n++){if(a[n]!==i[n]){return false}}for(n=0;n<a.length;n++){var s=a[n];if(!isDeepEqual(e[s],t[s])){return false}}return true}return false}function isPromise(e){return typeof e==="object"&&e!==null&&"then"in e&&typeof e.then==="function"}function stringToArray(e){var t=[];for(let n of e){t.push(n)}return t}return{isNumeric:isNumeric,isArrayOfStrings:isArrayOfStrings,isArrayOfNumbers:isArrayOfNumbers,createSequence:createSequence,isSequence:isSequence,isFunction:isFunction,isLambda:isLambda,isIterable:isIterable,getFunctionArity:getFunctionArity,isDeepEqual:isDeepEqual,stringToArray:stringToArray,isPromise:isPromise}})();t.exports=a},{}]},{},[3])(3)}))}};var t={};function __nccwpck_require__(n){var a=t[n];if(a!==undefined){return a.exports}var i=t[n]={exports:{}};var s=true;try{e[n](i,i.exports,__nccwpck_require__);s=false}finally{if(s)delete t[n]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(245);module.exports=n})();
|
|
1
|
+
(function(){var e={245:function(e){(function(t){if(true){e.exports=t()}else{var n}})((function(){var e,t,n;return function(){function r(e,t,n){function o(i,s){if(!t[i]){if(!e[i]){var u=require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var c=t[i]={exports:{}};e[i][0].call(c.exports,(function(t){var n=e[i][1][t];return o(n||t)}),c,c.exports,r,e,t,n)}return t[i].exports}for(var a=require,i=0;i<n.length;i++)o(n[i]);return o}return r}()({1:[function(e,t,n){const a=e("./utils");const i=function(){"use strict";const e=a.stringToArray;const t=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"];const n=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"];const i=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"];const s=["Thousand","Million","Billion","Trillion"];function numberToWords(e,a){var lookup=function(e,a,u){var f="";if(e<=19){f=(a?" and ":"")+(u?n[e]:t[e])}else if(e<100){const t=Math.floor(e/10);const n=e%10;f=(a?" and ":"")+i[t-2];if(n>0){f+="-"+lookup(n,false,u)}else if(u){f=f.substring(0,f.length-1)+"ieth"}}else if(e<1e3){const n=Math.floor(e/100);const i=e%100;f=(a?", ":"")+t[n]+" Hundred";if(i>0){f+=lookup(i,true,u)}else if(u){f+="th"}}else{var c=Math.floor(Math.log10(e)/3);if(c>s.length){c=s.length}const t=Math.pow(10,c*3);const n=Math.floor(e/t);const i=e-n*t;f=(a?", ":"")+lookup(n,false,false)+" "+s[c-1];if(i>0){f+=lookup(i,true,u)}else if(u){f+="th"}}return f};var u=lookup(e,false,a);return u}const u={};t.forEach((function(e,t){u[e.toLowerCase()]=t}));n.forEach((function(e,t){u[e.toLowerCase()]=t}));i.forEach((function(e,t){const n=e.toLowerCase();u[n]=(t+2)*10;u[n.substring(0,e.length-1)+"ieth"]=u[n]}));u.hundredth=100;s.forEach((function(e,t){const n=e.toLowerCase();const a=Math.pow(10,(t+1)*3);u[n]=a;u[n+"th"]=a}));function wordsToNumber(e){const t=e.split(/,\s|\sand\s|[\s\\-]/);const n=t.map((e=>u[e]));let a=[0];n.forEach((e=>{if(e<100){let t=a.pop();if(t>=1e3){a.push(t);t=0}a.push(t+e)}else{a.push(a.pop()*e)}}));const i=a.reduce(((e,t)=>e+t),0);return i}const f=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];const c={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function decimalToRoman(e){for(var t=0;t<f.length;t++){const n=f[t];if(e>=n[0]){return n[1]+decimalToRoman(e-n[0])}}return""}function romanToDecimal(e){var t=0;var n=1;for(var a=e.length-1;a>=0;a--){const i=e[a];const s=c[i];if(s<n){t-=s}else{n=s;t+=s}}return t}function decimalToLetters(e,t){var n=[];var a=t.charCodeAt(0);while(e>0){n.unshift(String.fromCharCode((e-1)%26+a));e=Math.floor((e-1)/26)}return n.join("")}function lettersToDecimal(e,t){var n=t.charCodeAt(0);var a=0;for(var i=0;i<e.length;i++){a+=(e.charCodeAt(e.length-i-1)-n+1)*Math.pow(26,i)}return a}function formatInteger(e,t){if(typeof e==="undefined"){return undefined}e=Math.floor(e);const n=analyseIntegerPicture(t);return _formatInteger(e,n)}const l={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"};const p={UPPER:"upper",LOWER:"lower",TITLE:"title"};function _formatInteger(t,n){let a;const i=t<0;t=Math.abs(t);switch(n.primary){case l.LETTERS:a=decimalToLetters(t,n.case===p.UPPER?"A":"a");break;case l.ROMAN:a=decimalToRoman(t);if(n.case===p.UPPER){a=a.toUpperCase()}break;case l.WORDS:a=numberToWords(t,n.ordinal);if(n.case===p.UPPER){a=a.toUpperCase()}else if(n.case===p.LOWER){a=a.toLowerCase()}break;case l.DECIMAL:a=""+t;var s=n.mandatoryDigits-a.length;if(s>0){var u=new Array(s+1).join("0");a=u+a}if(n.zeroCode!==48){a=e(a).map((e=>String.fromCodePoint(e.codePointAt(0)+n.zeroCode-48))).join("")}if(n.regular){const e=Math.floor((a.length-1)/n.groupingSeparators.position);for(let t=e;t>0;t--){const e=a.length-t*n.groupingSeparators.position;a=a.substr(0,e)+n.groupingSeparators.character+a.substr(e)}}else{n.groupingSeparators.reverse().forEach((e=>{const t=a.length-e.position;a=a.substr(0,t)+e.character+a.substr(t)}))}if(n.ordinal){var f={1:"st",2:"nd",3:"rd"};var c=a[a.length-1];var d=f[c];if(!d||a.length>1&&a[a.length-2]==="1"){d="th"}a=a+d}break;case l.SEQUENCE:throw{code:"D3130",value:n.token}}if(i){a="-"+a}return a}const d=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function analyseIntegerPicture(t){const n={type:"integer",primary:l.DECIMAL,case:p.LOWER,ordinal:false};let a,i;const s=t.lastIndexOf(";");if(s===-1){a=t}else{a=t.substring(0,s);i=t.substring(s+1);if(i[0]==="o"){n.ordinal=true}}switch(a){case"A":n.case=p.UPPER;case"a":n.primary=l.LETTERS;break;case"I":n.case=p.UPPER;case"i":n.primary=l.ROMAN;break;case"W":n.case=p.UPPER;n.primary=l.WORDS;break;case"Ww":n.case=p.TITLE;n.primary=l.WORDS;break;case"w":n.primary=l.WORDS;break;default:{let t=null;let i=0;let s=0;let u=[];let f=0;const c=e(a).map((e=>e.codePointAt(0))).reverse();c.forEach((e=>{let n=false;for(let a=0;a<d.length;a++){const s=d[a];if(e>=s&&e<=s+9){n=true;i++;f++;if(t===null){t=s}else if(s!==t){throw{code:"D3131"}}break}}if(!n){if(e===35){f++;s++}else{u.push({position:f,character:String.fromCodePoint(e)})}}}));if(i>0){n.primary=l.DECIMAL;n.zeroCode=t;n.mandatoryDigits=i;n.optionalDigits=s;const regularRepeat=function(e){if(e.length===0){return 0}const t=e[0].character;for(let n=1;n<e.length;n++){if(e[n].character!==t){return 0}}const n=e.map((e=>e.position));const gcd=function(e,t){return t===0?e:gcd(t,e%t)};const a=n.reduce(gcd);for(let e=1;e<=n.length;e++){if(n.indexOf(e*a)===-1){return 0}}return a};const e=regularRepeat(u);if(e>0){n.regular=true;n.groupingSeparators={position:e,character:u[0].character}}else{n.regular=false;n.groupingSeparators=u}}else{n.primary=l.SEQUENCE;n.token=a}}}return n}const h={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function analyseDateTimePicture(e){var t=[];const n={type:"datetime",parts:t};const addLiteral=function(n,a){if(a>n){let i=e.substring(n,a);i=i.split("]]").join("]");t.push({type:"literal",value:i})}};var a=0,i=0;while(i<e.length){if(e.charAt(i)==="["){if(e.charAt(i+1)==="["){addLiteral(a,i);t.push({type:"literal",value:"["});i+=2;a=i;continue}addLiteral(a,i);a=i;i=e.indexOf("]",a);if(i===-1){throw{code:"D3135"}}let n=e.substring(a+1,i);n=n.split(/\s+/).join("");var s={type:"marker",component:n.charAt(0)};var u=n.lastIndexOf(",");var f;if(u!==-1){const e=n.substring(u+1);const t=e.indexOf("-");let a,i;const parseWidth=function(e){if(typeof e==="undefined"||e==="*"){return undefined}else{return parseInt(e)}};if(t===-1){a=e}else{a=e.substring(0,t);i=e.substring(t+1)}const c={min:parseWidth(a),max:parseWidth(i)};s.width=c;f=n.substring(1,u)}else{f=n.substring(1)}if(f.length===1){s.presentation1=f}else if(f.length>1){var c=f.charAt(f.length-1);if("atco".indexOf(c)!==-1){s.presentation2=c;if(c==="o"){s.ordinal=true}s.presentation1=f.substring(0,f.length-1)}else{s.presentation1=f}}else{s.presentation1=h[s.component]}if(typeof s.presentation1==="undefined"){throw{code:"D3132",value:s.component}}if(s.presentation1[0]==="n"){s.names=p.LOWER}else if(s.presentation1[0]==="N"){if(s.presentation1[1]==="n"){s.names=p.TITLE}else{s.names=p.UPPER}}else if("YMDdFWwXxHhmsf".indexOf(s.component)!==-1){var l=s.presentation1;if(s.presentation2){l+=";"+s.presentation2}s.integerFormat=analyseIntegerPicture(l);if(s.width&&s.width.min!==undefined){if(s.integerFormat.mandatoryDigits<s.width.min){s.integerFormat.mandatoryDigits=s.width.min}}if(s.component==="Y"){s.n=-1;if(s.width&&s.width.max!==undefined){s.n=s.width.max;s.integerFormat.mandatoryDigits=s.n}else{var d=s.integerFormat.mandatoryDigits+s.integerFormat.optionalDigits;if(d>=2){s.n=d}}}const e=t[t.length-1];if(e&&e.integerFormat){e.integerFormat.parseWidth=e.integerFormat.mandatoryDigits}}if(s.component==="Z"||s.component==="z"){s.integerFormat=analyseIntegerPicture(s.presentation1)}t.push(s);a=i+1}i++}addLiteral(a,i);return n}const v=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];const g=["January","February","March","April","May","June","July","August","September","October","November","December"];const y=1e3*60*60*24;const startOfFirstWeek=function(e){const t=Date.UTC(e.year,e.month);var n=new Date(t).getUTCDay();if(n===0){n=7}return n>4?t+(8-n)*y:t-(n-1)*y};const yearMonth=function(e,t){return{year:e,month:t,nextMonth:function(){return t===11?yearMonth(e+1,0):yearMonth(e,t+1)},previousMonth:function(){return t===0?yearMonth(e-1,11):yearMonth(e,t-1)},nextYear:function(){return yearMonth(e+1,t)},previousYear:function(){return yearMonth(e-1,t)}}};const deltaWeeks=function(e,t){return(t-e)/(y*7)+1};const getDateTimeFragment=(e,t)=>{let n;switch(t){case"Y":n=e.getUTCFullYear();break;case"M":n=e.getUTCMonth()+1;break;case"D":n=e.getUTCDate();break;case"d":{const t=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());const a=Date.UTC(e.getUTCFullYear(),0);n=(t-a)/y+1;break}case"F":n=e.getUTCDay();if(n===0){n=7}break;case"W":{const t=yearMonth(e.getUTCFullYear(),0);const a=startOfFirstWeek(t);const i=Date.UTC(t.year,e.getUTCMonth(),e.getUTCDate());let s=deltaWeeks(a,i);if(s>52){const e=startOfFirstWeek(t.nextYear());if(i>=e){s=1}}else if(s<1){const e=startOfFirstWeek(t.previousYear());s=deltaWeeks(e,i)}n=Math.floor(s);break}case"w":{const t=yearMonth(e.getUTCFullYear(),e.getUTCMonth());const a=startOfFirstWeek(t);const i=Date.UTC(t.year,t.month,e.getUTCDate());let s=deltaWeeks(a,i);if(s>4){const e=startOfFirstWeek(t.nextMonth());if(i>=e){s=1}}else if(s<1){const e=startOfFirstWeek(t.previousMonth());s=deltaWeeks(e,i)}n=Math.floor(s);break}case"X":{const t=yearMonth(e.getUTCFullYear(),0);const a=startOfFirstWeek(t);const i=startOfFirstWeek(t.nextYear());const s=e.getTime();if(s<a){n=t.year-1}else if(s>=i){n=t.year+1}else{n=t.year}break}case"x":{const t=yearMonth(e.getUTCFullYear(),e.getUTCMonth());const a=startOfFirstWeek(t);const i=t.nextMonth();const s=startOfFirstWeek(i);const u=e.getTime();if(u<a){n=t.previousMonth().month+1}else if(u>=s){n=i.month+1}else{n=t.month+1}break}case"H":n=e.getUTCHours();break;case"h":n=e.getUTCHours();n=n%12;if(n===0){n=12}break;case"P":n=e.getUTCHours()>=12?"pm":"am";break;case"m":n=e.getUTCMinutes();break;case"s":n=e.getUTCSeconds();break;case"f":n=e.getUTCMilliseconds();break;case"Z":case"z":break;case"C":n="ISO";break;case"E":n="ISO";break}return n};let m=null;function formatDateTime(e,t,n){var a=0;var i=0;if(typeof n!=="undefined"){const e=parseInt(n);a=Math.floor(e/100);i=e%100}var formatComponent=function(e,t){var n=getDateTimeFragment(e,t.component);if("YMDdFWwXxHhms".indexOf(t.component)!==-1){if(t.component==="Y"){if(t.n!==-1){n=n%Math.pow(10,t.n)}}if(t.names){if(t.component==="M"||t.component==="x"){n=g[n-1]}else if(t.component==="F"){n=v[n]}else{throw{code:"D3133",value:t.component}}if(t.names===p.UPPER){n=n.toUpperCase()}else if(t.names===p.LOWER){n=n.toLowerCase()}if(t.width&&n.length>t.width.max){n=n.substring(0,t.width.max)}}else{n=_formatInteger(n,t.integerFormat)}}else if(t.component==="f"){n=_formatInteger(n,t.integerFormat)}else if(t.component==="Z"||t.component==="z"){const e=a*100+i;if(t.integerFormat.regular){n=_formatInteger(e,t.integerFormat)}else{const s=t.integerFormat.mandatoryDigits;if(s===1||s===2){n=_formatInteger(a,t.integerFormat);if(i!==0){n+=":"+formatInteger(i,"00")}}else if(s===3||s===4){n=_formatInteger(e,t.integerFormat)}else{throw{code:"D3134",value:s}}}if(e>=0){n="+"+n}if(t.component==="z"){n="GMT"+n}if(e===0&&t.presentation2==="t"){n="Z"}}else if(t.component==="P"){if(t.names===p.UPPER){n=n.toUpperCase()}}return n};let s;if(typeof t==="undefined"){if(m===null){m=analyseDateTimePicture("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")}s=m}else{s=analyseDateTimePicture(t)}const u=(60*a+i)*60*1e3;const f=new Date(e+u);let c="";s.parts.forEach((function(e){if(e.type==="literal"){c+=e.value}else{c+=formatComponent(f,e)}}));return c}function generateRegex(e){var t={};if(e.type==="datetime"){t.type="datetime";t.parts=e.parts.map((function(e){var t={};if(e.type==="literal"){t.regex=e.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}else if(e.component==="Z"||e.component==="z"){let n;if(!Array.isArray(e.integerFormat.groupingSeparators)){n=e.integerFormat.groupingSeparators}t.regex="";if(e.component==="z"){t.regex="GMT"}t.regex+="[-+][0-9]+";if(n){t.regex+=n.character+"[0-9]+"}t.parse=function(t){if(e.component==="z"){t=t.substring(3)}let a=0,i=0;if(n){a=Number.parseInt(t.substring(0,t.indexOf(n.character)));i=Number.parseInt(t.substring(t.indexOf(n.character)+1))}else{const e=t.length-1;if(e<=2){a=Number.parseInt(t)}else{a=Number.parseInt(t.substring(0,3));i=Number.parseInt(t.substring(3))}}return a*60+i}}else if(e.integerFormat){t=generateRegex(e.integerFormat)}else{t.regex="[a-zA-Z]+";var n={};if(e.component==="M"||e.component==="x"){g.forEach((function(t,a){if(e.width&&e.width.max){n[t.substring(0,e.width.max)]=a+1}else{n[t]=a+1}}))}else if(e.component==="F"){v.forEach((function(t,a){if(a>0){if(e.width&&e.width.max){n[t.substring(0,e.width.max)]=a}else{n[t]=a}}}))}else if(e.component==="P"){n={am:0,AM:0,pm:1,PM:1}}else{throw{code:"D3133",value:e.component}}t.parse=function(e){return n[e]}}t.component=e.component;return t}))}else{t.type="integer";const n=e.case===p.UPPER;switch(e.primary){case l.LETTERS:t.regex=n?"[A-Z]+":"[a-z]+";t.parse=function(e){return lettersToDecimal(e,n?"A":"a")};break;case l.ROMAN:t.regex=n?"[MDCLXVI]+":"[mdclxvi]+";t.parse=function(e){return romanToDecimal(n?e:e.toUpperCase())};break;case l.WORDS:t.regex="(?:"+Object.keys(u).concat("and","[\\-, ]").join("|")+")+";t.parse=function(e){return wordsToNumber(e.toLowerCase())};break;case l.DECIMAL:t.regex="[0-9]";if(e.parseWidth){t.regex+=`{${e.parseWidth}}`}else{t.regex+="+"}if(e.ordinal){t.regex+="(?:th|st|nd|rd)"}t.parse=function(t){let n=t;if(e.ordinal){n=t.substring(0,t.length-2)}if(e.regular){n=n.split(",").join("")}else{e.groupingSeparators.forEach((e=>{n=n.split(e.character).join("")}))}if(e.zeroCode!==48){n=n.split("").map((t=>String.fromCodePoint(t.codePointAt(0)-e.zeroCode+48))).join("")}return parseInt(n)};break;case l.SEQUENCE:throw{code:"D3130",value:e.token}}}return t}function parseInteger(e,t){if(typeof e==="undefined"){return undefined}const n=analyseIntegerPicture(t);const a=generateRegex(n);const i=a.parse(e);return i}function parseDateTime(e,t){const n=analyseDateTimePicture(t);const a=generateRegex(n);const i="^"+a.parts.map((e=>"("+e.regex+")")).join("")+"$";const s=new RegExp(i,"i");var u=s.exec(e);if(u!==null){const e=161;const t=130;const n=84;const i=72;const s=23;const c=47;const l={};for(let e=1;e<u.length;e++){const t=a.parts[e-1];if(t.parse){l[t.component]=t.parse(u[e])}}if(Object.getOwnPropertyNames(l).length===0){return undefined}let p=0;const shift=e=>{p<<=1;p+=e?1:0};const isType=e=>!(~e&p)&&!!(e&p);"YXMxWwdD".split("").forEach((e=>shift(l[e])));const d=isType(e);const h=!d&&isType(t);const v=isType(n);const g=!v&&isType(i);p=0;"PHhmsf".split("").forEach((e=>shift(l[e])));const y=isType(s);const m=!y&&isType(c);const b=h?"YD":v?"XxwF":g?"XWF":"YMD";const w=m?"Phmsf":"Hmsf";const k=b+w;const x=this.environment.timestamp;let A=false;let E=false;k.split("").forEach((e=>{if(typeof l[e]==="undefined"){if(A){l[e]="MDd".indexOf(e)!==-1?1:0;E=true}else{l[e]=getDateTimeFragment(x,e)}}else{A=true;if(E){throw{code:"D3136"}}}}));if(l.M>0){l.M-=1}else{l.M=0}if(h){const e=Date.UTC(l.Y,0);const t=(l.d-1)*1e3*60*60*24;const n=new Date(e+t);l.M=n.getUTCMonth();l.D=n.getUTCDate()}if(v){throw{code:"D3136"}}if(g){throw{code:"D3136"}}if(m){l.H=l.h===12?0:l.h;if(l.P===1){l.H+=12}}var f=Date.UTC(l.Y,l.M,l.D,l.H,l.m,l.s,l.f);if(l.Z||l.z){f-=(l.Z||l.z)*60*1e3}return f}}var b=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function toMillis(e,t){if(typeof e==="undefined"){return undefined}if(typeof t==="undefined"){if(!b.test(e)){throw{stack:(new Error).stack,code:"D3110",value:e}}return Date.parse(e)}else{return parseDateTime.call(this,e,t)}}function fromMillis(e,t,n){if(typeof e==="undefined"){return undefined}return formatDateTime.call(this,e,t,n)}return{formatInteger:formatInteger,parseInteger:parseInteger,fromMillis:fromMillis,toMillis:toMillis}}();t.exports=i},{"./utils":6}],2:[function(e,t,n){(function(n){(function(){var a=e("./utils");const i=(()=>{"use strict";var e=a.isNumeric;var t=a.isArrayOfStrings;var i=a.isArrayOfNumbers;var s=a.createSequence;var u=a.isSequence;var f=a.isFunction;var c=a.isLambda;var l=a.isPromise;var p=a.getFunctionArity;var d=a.isDeepEqual;var h=a.stringToArray;function sum(e){if(typeof e==="undefined"){return undefined}var t=0;e.forEach((function(e){t+=e}));return t}function count(e){if(typeof e==="undefined"){return 0}return e.length}function max(e){if(typeof e==="undefined"||e.length===0){return undefined}return Math.max.apply(Math,e)}function min(e){if(typeof e==="undefined"||e.length===0){return undefined}return Math.min.apply(Math,e)}function average(e){if(typeof e==="undefined"||e.length===0){return undefined}var t=0;e.forEach((function(e){t+=e}));return t/e.length}function string(t,n=false){if(typeof t==="undefined"){return undefined}var a;if(typeof t==="string"){a=t}else if(f(t)){a=""}else if(typeof t==="number"&&!isFinite(t)){throw{code:"D3001",value:t,stack:(new Error).stack}}else{var i=n?2:0;if(Array.isArray(t)&&t.outerWrapper){t=t[0]}a=JSON.stringify(t,(function(t,n){return typeof n!=="undefined"&&n!==null&&n.toPrecision&&e(n)?Number(n.toPrecision(15)):n&&f(n)?"":n}),i)}return a}function substring(e,t,n){if(typeof e==="undefined"){return undefined}var a=h(e);var i=a.length;if(i+t<0){t=0}if(typeof n!=="undefined"){if(n<=0){return""}var s=t>=0?t+n:i+t+n;return a.slice(t,s).join("")}return a.slice(t).join("")}function substringBefore(e,t){if(typeof e==="undefined"){return undefined}var n=e.indexOf(t);if(n>-1){return e.substr(0,n)}else{return e}}function substringAfter(e,t){if(typeof e==="undefined"){return undefined}var n=e.indexOf(t);if(n>-1){return e.substr(n+t.length)}else{return e}}function lowercase(e){if(typeof e==="undefined"){return undefined}return e.toLowerCase()}function uppercase(e){if(typeof e==="undefined"){return undefined}return e.toUpperCase()}function length(e){if(typeof e==="undefined"){return undefined}return h(e).length}function trim(e){if(typeof e==="undefined"){return undefined}var t=e.replace(/[ \t\n\r]+/gm," ");if(t.charAt(0)===" "){t=t.substring(1)}if(t.charAt(t.length-1)===" "){t=t.substring(0,t.length-1)}return t}function pad(e,t,n){if(typeof e==="undefined"){return undefined}if(typeof n==="undefined"||n.length===0){n=" "}var a;t=Math.trunc(t);var i=Math.abs(t)-length(e);if(i>0){var s=new Array(i+1).join(n);if(n.length>1){s=substring(s,0,i)}if(t>0){a=e+s}else{a=s+e}}else{a=e}return a}async function evaluateMatcher(e,t){var n=e.apply(this,[t]);if(l(n)){n=await n}if(n&&!(typeof n.start==="number"||n.end==="number"||Array.isArray(n.groups)||f(n.next))){throw{code:"T1010",stack:(new Error).stack}}return n}async function contains(e,t){if(typeof e==="undefined"){return undefined}var n;if(typeof t==="string"){n=e.indexOf(t)!==-1}else{var a=await evaluateMatcher(t,e);n=typeof a!=="undefined"}return n}async function match(e,t,n){if(typeof e==="undefined"){return undefined}if(n<0){throw{stack:(new Error).stack,value:n,code:"D3040",index:3}}var a=s();if(typeof n==="undefined"||n>0){var i=0;var u=await evaluateMatcher(t,e);if(typeof u!=="undefined"){while(typeof u!=="undefined"&&(typeof n==="undefined"||i<n)){a.push({match:u.match,index:u.start,groups:u.groups});u=await evaluateMatcher(u.next);i++}}}return a}async function replace(e,t,n,a){if(typeof e==="undefined"){return undefined}var i=this;if(t===""){throw{code:"D3010",stack:(new Error).stack,value:t,index:2}}if(a<0){throw{code:"D3011",stack:(new Error).stack,value:a,index:4}}var s;if(typeof n==="string"){s=function(e){var t="";var a=0;var i=n.indexOf("$",a);while(i!==-1&&a<n.length){t+=n.substring(a,i);a=i+1;var s=n.charAt(a);if(s==="$"){t+="$";a++}else if(s==="0"){t+=e.match;a++}else{var u;if(e.groups.length===0){u=1}else{u=Math.floor(Math.log(e.groups.length)*Math.LOG10E)+1}i=parseInt(n.substring(a,a+u),10);if(u>1&&i>e.groups.length){i=parseInt(n.substring(a,a+u-1),10)}if(!isNaN(i)){if(e.groups.length>0){var f=e.groups[i-1];if(typeof f!=="undefined"){t+=f}}a+=i.toString().length}else{t+="$"}}i=n.indexOf("$",a)}t+=n.substring(a);return t}}else{s=n}var u="";var f=0;if(typeof a==="undefined"||a>0){var c=0;if(typeof t==="string"){var p=e.indexOf(t,f);while(p!==-1&&(typeof a==="undefined"||c<a)){u+=e.substring(f,p);u+=n;f=p+t.length;c++;p=e.indexOf(t,f)}u+=e.substring(f)}else{var d=await evaluateMatcher(t,e);if(typeof d!=="undefined"){while(typeof d!=="undefined"&&(typeof a==="undefined"||c<a)){u+=e.substring(f,d.start);var h=s.apply(i,[d]);if(l(h)){h=await h}if(typeof h==="string"){u+=h}else{throw{code:"D3012",stack:(new Error).stack,value:h}}f=d.start+d.match.length;c++;d=await evaluateMatcher(d.next)}u+=e.substring(f)}else{u=e}}}else{u=e}return u}function base64encode(e){if(typeof e==="undefined"){return undefined}var t=typeof window!=="undefined"?window.btoa:function(e){return new n.Buffer.from(e,"binary").toString("base64")};return t(e)}function base64decode(e){if(typeof e==="undefined"){return undefined}var t=typeof window!=="undefined"?window.atob:function(e){return new n.Buffer.from(e,"base64").toString("binary")};return t(e)}function encodeUrlComponent(e){if(typeof e==="undefined"){return undefined}var t;try{t=encodeURIComponent(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"encodeUrlComponent"}}return t}function encodeUrl(e){if(typeof e==="undefined"){return undefined}var t;try{t=encodeURI(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"encodeUrl"}}return t}function decodeUrlComponent(e){if(typeof e==="undefined"){return undefined}var t;try{t=decodeURIComponent(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"decodeUrlComponent"}}return t}function decodeUrl(e){if(typeof e==="undefined"){return undefined}var t;try{t=decodeURI(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"decodeUrl"}}return t}async function split(e,t,n){if(typeof e==="undefined"){return undefined}if(n<0){throw{code:"D3020",stack:(new Error).stack,value:n,index:3}}var a=[];if(typeof n==="undefined"||n>0){if(typeof t==="string"){a=e.split(t,n)}else{var i=0;var s=await evaluateMatcher(t,e);if(typeof s!=="undefined"){var u=0;while(typeof s!=="undefined"&&(typeof n==="undefined"||i<n)){a.push(e.substring(u,s.start));u=s.end;s=await evaluateMatcher(s.next);i++}if(typeof n==="undefined"||i<n){a.push(e.substring(u))}}else{a.push(e)}}}return a}function join(e,t){if(typeof e==="undefined"){return undefined}if(typeof t==="undefined"){t=""}return e.join(t)}function formatNumber(e,t,n){if(typeof e==="undefined"){return undefined}var a={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"};var i=a;if(typeof n!=="undefined"){Object.keys(n).forEach((function(e){i[e]=n[e]}))}var s=[];var u=i["zero-digit"].charCodeAt(0);for(var f=u;f<u+10;f++){s.push(String.fromCharCode(f))}var c=s.concat([i["decimal-separator"],i["exponent-separator"],i["grouping-separator"],i.digit,i["pattern-separator"]]);var l=t.split(i["pattern-separator"]);if(l.length>2){throw{code:"D3080",stack:(new Error).stack}}var splitParts=function(e){var t=function(){var t;for(var n=0;n<e.length;n++){t=e.charAt(n);if(c.indexOf(t)!==-1&&t!==i["exponent-separator"]){return e.substring(0,n)}}}();var n=function(){var t;for(var n=e.length-1;n>=0;n--){t=e.charAt(n);if(c.indexOf(t)!==-1&&t!==i["exponent-separator"]){return e.substring(n+1)}}}();var a=e.substring(t.length,e.length-n.length);var s,u,f,l;var p=e.indexOf(i["exponent-separator"],t.length);if(p===-1||p>e.length-n.length){s=a;u=undefined}else{s=a.substring(0,p);u=a.substring(p+1)}var d=s.indexOf(i["decimal-separator"]);if(d===-1){f=s;l=n}else{f=s.substring(0,d);l=s.substring(d+1)}return{prefix:t,suffix:n,activePart:a,mantissaPart:s,exponentPart:u,integerPart:f,fractionalPart:l,subpicture:e}};var validate=function(e){var t;var n;var a=e.subpicture;var u=a.indexOf(i["decimal-separator"]);if(u!==a.lastIndexOf(i["decimal-separator"])){t="D3081"}if(a.indexOf(i.percent)!==a.lastIndexOf(i.percent)){t="D3082"}if(a.indexOf(i["per-mille"])!==a.lastIndexOf(i["per-mille"])){t="D3083"}if(a.indexOf(i.percent)!==-1&&a.indexOf(i["per-mille"])!==-1){t="D3084"}var f=false;for(n=0;n<e.mantissaPart.length;n++){var l=e.mantissaPart.charAt(n);if(s.indexOf(l)!==-1||l===i.digit){f=true;break}}if(!f){t="D3085"}var p=e.activePart.split("").map((function(e){return c.indexOf(e)===-1?"p":"a"})).join("");if(p.indexOf("p")!==-1){t="D3086"}if(u!==-1){if(a.charAt(u-1)===i["grouping-separator"]||a.charAt(u+1)===i["grouping-separator"]){t="D3087"}}else if(e.integerPart.charAt(e.integerPart.length-1)===i["grouping-separator"]){t="D3088"}if(a.indexOf(i["grouping-separator"]+i["grouping-separator"])!==-1){t="D3089"}var d=e.integerPart.indexOf(i.digit);if(d!==-1&&e.integerPart.substring(0,d).split("").filter((function(e){return s.indexOf(e)>-1})).length>0){t="D3090"}d=e.fractionalPart.lastIndexOf(i.digit);if(d!==-1&&e.fractionalPart.substring(d).split("").filter((function(e){return s.indexOf(e)>-1})).length>0){t="D3091"}var h=typeof e.exponentPart==="string";if(h&&e.exponentPart.length>0&&(a.indexOf(i.percent)!==-1||a.indexOf(i["per-mille"])!==-1)){t="D3092"}if(h&&(e.exponentPart.length===0||e.exponentPart.split("").filter((function(e){return s.indexOf(e)===-1})).length>0)){t="D3093"}if(t){throw{code:t,stack:(new Error).stack}}};var analyse=function(e){var getGroupingPositions=function(t,n){var a=[];var u=t.indexOf(i["grouping-separator"]);while(u!==-1){var f=(n?t.substring(0,u):t.substring(u)).split("").filter((function(e){return s.indexOf(e)!==-1||e===i.digit})).length;a.push(f);u=e.integerPart.indexOf(i["grouping-separator"],u+1)}return a};var t=getGroupingPositions(e.integerPart);var regular=function(e){if(e.length===0){return 0}var gcd=function(e,t){return t===0?e:gcd(t,e%t)};var t=e.reduce(gcd);for(var n=1;n<=e.length;n++){if(e.indexOf(n*t)===-1){return 0}}return t};var n=regular(t);var a=getGroupingPositions(e.fractionalPart,true);var u=e.integerPart.split("").filter((function(e){return s.indexOf(e)!==-1})).length;var f=u;var c=e.fractionalPart.split("");var l=c.filter((function(e){return s.indexOf(e)!==-1})).length;var p=c.filter((function(e){return s.indexOf(e)!==-1||e===i.digit})).length;var d=typeof e.exponentPart==="string";if(u===0&&p===0){if(d){l=1;p=1}else{u=1}}if(d&&u===0&&e.integerPart.indexOf(i.digit)!==-1){u=1}if(u===0&&l===0){l=1}var h=0;if(d){h=e.exponentPart.split("").filter((function(e){return s.indexOf(e)!==-1})).length}return{integerPartGroupingPositions:t,regularGrouping:n,minimumIntegerPartSize:u,scalingFactor:f,prefix:e.prefix,fractionalPartGroupingPositions:a,minimumFactionalPartSize:l,maximumFactionalPartSize:p,minimumExponentSize:h,suffix:e.suffix,picture:e.subpicture}};var p=l.map(splitParts);p.forEach(validate);var d=p.map(analyse);var h=i["minus-sign"];var v=i["zero-digit"];var g=i["decimal-separator"];var y=i["grouping-separator"];if(d.length===1){d.push(JSON.parse(JSON.stringify(d[0])));d[1].prefix=h+d[1].prefix}var m;if(e>=0){m=d[0]}else{m=d[1]}var b;if(m.picture.indexOf(i.percent)!==-1){b=e*100}else if(m.picture.indexOf(i["per-mille"])!==-1){b=e*1e3}else{b=e}var w,k;if(m.minimumExponentSize===0){w=b}else{var x=Math.pow(10,m.scalingFactor);var A=Math.pow(10,m.scalingFactor-1);w=b;k=0;while(w<A){w*=10;k-=1}while(w>x){w/=10;k+=1}}var E=round(w,m.maximumFactionalPartSize);var makeString=function(e,t){var n=Math.abs(e).toFixed(t);if(v!=="0"){n=n.split("").map((function(e){if(e>="0"&&e<="9"){return s[e.charCodeAt(0)-48]}else{return e}})).join("")}return n};var T=makeString(E,m.maximumFactionalPartSize);var F=T.indexOf(".");if(F===-1){T=T+g}else{T=T.replace(".",g)}while(T.charAt(0)===v){T=T.substring(1)}while(T.charAt(T.length-1)===v){T=T.substring(0,T.length-1)}F=T.indexOf(g);var D=m.minimumIntegerPartSize-F;var S=m.minimumFactionalPartSize-(T.length-F-1);T=(D>0?new Array(D+1).join(v):"")+T;T=T+(S>0?new Array(S+1).join(v):"");F=T.indexOf(g);if(m.regularGrouping>0){var O=Math.floor((F-1)/m.regularGrouping);for(var P=1;P<=O;P++){T=[T.slice(0,F-P*m.regularGrouping),y,T.slice(F-P*m.regularGrouping)].join("")}}else{m.integerPartGroupingPositions.forEach((function(e){T=[T.slice(0,F-e),y,T.slice(F-e)].join("");F++}))}F=T.indexOf(g);m.fractionalPartGroupingPositions.forEach((function(e){T=[T.slice(0,e+F+1),y,T.slice(e+F+1)].join("")}));F=T.indexOf(g);if(m.picture.indexOf(g)===-1||F===T.length-1){T=T.substring(0,T.length-1)}if(typeof k!=="undefined"){var M=makeString(k,0);D=m.minimumExponentSize-M.length;if(D>0){M=new Array(D+1).join(v)+M}T=T+i["exponent-separator"]+(k<0?h:"")+M}T=m.prefix+T+m.suffix;return T}function formatBase(e,t){if(typeof e==="undefined"){return undefined}e=round(e);if(typeof t==="undefined"){t=10}else{t=round(t)}if(t<2||t>36){throw{code:"D3100",stack:(new Error).stack,value:t}}var n=e.toString(t);return n}function number(e){var t;if(typeof e==="undefined"){return undefined}if(typeof e==="number"){t=e}else if(typeof e==="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(e)&&!isNaN(parseFloat(e))&&isFinite(e)){t=parseFloat(e)}else if(typeof e==="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(e)){t=Number(e)}else if(e===true){t=1}else if(e===false){t=0}else{throw{code:"D3030",value:e,stack:(new Error).stack,index:1}}return t}function abs(e){var t;if(typeof e==="undefined"){return undefined}t=Math.abs(e);return t}function floor(e){var t;if(typeof e==="undefined"){return undefined}t=Math.floor(e);return t}function ceil(e){var t;if(typeof e==="undefined"){return undefined}t=Math.ceil(e);return t}function round(e,t){var n;if(typeof e==="undefined"){return undefined}if(t){var a=e.toString().split("e");e=+(a[0]+"e"+(a[1]?+a[1]+t:t))}n=Math.round(e);var i=n-e;if(Math.abs(i)===.5&&Math.abs(n%2)===1){n=n-1}if(t){a=n.toString().split("e");n=+(a[0]+"e"+(a[1]?+a[1]-t:-t))}if(Object.is(n,-0)){n=0}return n}function sqrt(e){var t;if(typeof e==="undefined"){return undefined}if(e<0){throw{stack:(new Error).stack,code:"D3060",index:1,value:e}}t=Math.sqrt(e);return t}function power(e,t){var n;if(typeof e==="undefined"){return undefined}n=Math.pow(e,t);if(!isFinite(n)){throw{stack:(new Error).stack,code:"D3061",index:1,value:e,exp:t}}return n}function random(){return Math.random()}function boolean(t){if(typeof t==="undefined"){return undefined}var n=false;if(Array.isArray(t)){if(t.length===1){n=boolean(t[0])}else if(t.length>1){var a=t.filter((function(e){return boolean(e)}));n=a.length>0}}else if(typeof t==="string"){if(t.length>0){n=true}}else if(e(t)){if(t!==0){n=true}}else if(t!==null&&typeof t==="object"&&!f(t)){if(Object.keys(t).length>0){n=true}}else if(typeof t==="boolean"&&t===true){n=true}return n}function not(e){if(typeof e==="undefined"){return undefined}return!boolean(e)}function hofFuncArgs(e,t,n,a){var i=[t];var s=p(e);if(s>=2){i.push(n)}if(s>=3){i.push(a)}return i}async function map(e,t){if(typeof e==="undefined"){return undefined}var n=s();for(var a=0;a<e.length;a++){var i=hofFuncArgs(t,e[a],a,e);var u=await t.apply(this,i);if(typeof u!=="undefined"){n.push(u)}}return n}async function filter(e,t){if(typeof e==="undefined"){return undefined}var n=s();for(var a=0;a<e.length;a++){var i=e[a];var u=hofFuncArgs(t,i,a,e);var f=await t.apply(this,u);if(boolean(f)){n.push(i)}}return n}async function single(e,t){if(typeof e==="undefined"){return undefined}var n=false;var a;for(var i=0;i<e.length;i++){var s=e[i];var u=true;if(typeof t!=="undefined"){var f=hofFuncArgs(t,s,i,e);var c=await t.apply(this,f);u=boolean(c)}if(u){if(!n){a=s;n=true}else{throw{stack:(new Error).stack,code:"D3138",index:i}}}}if(!n){throw{stack:(new Error).stack,code:"D3139"}}return a}function zip(){var e=[];var t=Array.prototype.slice.call(arguments);var n=Math.min.apply(Math,t.map((function(e){if(Array.isArray(e)){return e.length}return 0})));for(var a=0;a<n;a++){var i=t.map((e=>e[a]));e.push(i)}return e}async function foldLeft(e,t,n){if(typeof e==="undefined"){return undefined}var a;var i=p(t);if(i<2){throw{stack:(new Error).stack,code:"D3050",index:1}}var s;if(typeof n==="undefined"&&e.length>0){a=e[0];s=1}else{a=n;s=0}while(s<e.length){var u=[a,e[s]];if(i>=3){u.push(s)}if(i>=4){u.push(e)}a=await t.apply(this,u);s++}return a}function keys(e){var t=s();if(Array.isArray(e)){var n={};e.forEach((function(e){var t=keys(e);t.forEach((function(e){n[e]=true}))}));t=keys(n)}else if(e!==null&&typeof e==="object"&&!f(e)){Object.keys(e).forEach((e=>t.push(e)))}return t}function lookup(e,t){var n;if(Array.isArray(e)){n=s();for(var a=0;a<e.length;a++){var i=lookup(e[a],t);if(typeof i!=="undefined"){if(Array.isArray(i)){i.forEach((e=>n.push(e)))}else{n.push(i)}}}}else if(e!==null&&typeof e==="object"&&!f(e)){n=e[t]}return n}function append(e,t){if(typeof e==="undefined"){return t}if(typeof t==="undefined"){return e}if(!Array.isArray(e)){e=s(e)}if(!Array.isArray(t)){t=[t]}return e.concat(t)}function exists(e){if(typeof e==="undefined"){return false}else{return true}}function spread(e){var t=s();if(Array.isArray(e)){e.forEach((function(e){t=append(t,spread(e))}))}else if(e!==null&&typeof e==="object"&&!c(e)){for(var n in e){var a={};a[n]=e[n];t.push(a)}}else{t=e}return t}function merge(e){if(typeof e==="undefined"){return undefined}var t={};e.forEach((function(e){for(var n in e){t[n]=e[n]}}));return t}function reverse(e){if(typeof e==="undefined"){return undefined}if(e.length<=1){return e}var t=e.length;var n=new Array(t);for(var a=0;a<t;a++){n[t-a-1]=e[a]}return n}async function each(e,t){var n=s();for(var a in e){var i=hofFuncArgs(t,e[a],a,e);var u=await t.apply(this,i);if(typeof u!=="undefined"){n.push(u)}}return n}function error(e){throw{code:"D3137",stack:(new Error).stack,message:e||"$error() function evaluated"}}function assert(e,t){if(!e){throw{code:"D3141",stack:(new Error).stack,message:t||"$assert() statement failed"}}return undefined}function type(t){if(t===undefined){return undefined}if(t===null){return"null"}if(e(t)){return"number"}if(typeof t==="string"){return"string"}if(typeof t==="boolean"){return"boolean"}if(Array.isArray(t)){return"array"}if(f(t)){return"function"}return"object"}async function sort(e,n){if(typeof e==="undefined"){return undefined}if(e.length<=1){return e}var a;if(typeof n==="undefined"){if(!i(e)&&!t(e)){throw{stack:(new Error).stack,code:"D3070",index:1}}a=async function(e,t){return e>t}}else{a=n}var merge=async function(e,t){var merge_iter=async function(e,t,n){if(t.length===0){Array.prototype.push.apply(e,n)}else if(n.length===0){Array.prototype.push.apply(e,t)}else if(await a(t[0],n[0])){e.push(n[0]);await merge_iter(e,t,n.slice(1))}else{e.push(t[0]);await merge_iter(e,t.slice(1),n)}};var n=[];await merge_iter(n,e,t);return n};var msort=async function(e){if(!Array.isArray(e)||e.length<=1){return e}else{var t=Math.floor(e.length/2);var n=e.slice(0,t);var a=e.slice(t);n=await msort(n);a=await msort(a);return await merge(n,a)}};var s=await msort(e);return s}function shuffle(e){if(typeof e==="undefined"){return undefined}if(e.length<=1){return e}var t=new Array(e.length);for(var n=0;n<e.length;n++){var a=Math.floor(Math.random()*(n+1));if(n!==a){t[n]=t[a]}t[a]=e[n]}return t}function distinct(e){if(typeof e==="undefined"){return undefined}if(!Array.isArray(e)||e.length<=1){return e}var t=u(e)?s():[];for(var n=0;n<e.length;n++){var a=e[n];var i=false;for(var f=0;f<t.length;f++){if(d(a,t[f])){i=true;break}}if(!i){t.push(a)}}return t}async function sift(e,t){var n={};for(var a in e){var i=e[a];var s=hofFuncArgs(t,i,a,e);var u=await t.apply(this,s);if(boolean(u)){n[a]=i}}if(Object.keys(n).length===0){n=undefined}return n}return{sum:sum,count:count,max:max,min:min,average:average,string:string,substring:substring,substringBefore:substringBefore,substringAfter:substringAfter,lowercase:lowercase,uppercase:uppercase,length:length,trim:trim,pad:pad,match:match,contains:contains,replace:replace,split:split,join:join,formatNumber:formatNumber,formatBase:formatBase,number:number,floor:floor,ceil:ceil,round:round,abs:abs,sqrt:sqrt,power:power,random:random,boolean:boolean,not:not,map:map,zip:zip,filter:filter,single:single,foldLeft:foldLeft,sift:sift,keys:keys,lookup:lookup,append:append,exists:exists,spread:spread,merge:merge,reverse:reverse,each:each,error:error,assert:assert,type:type,sort:sort,shuffle:shuffle,distinct:distinct,base64encode:base64encode,base64decode:base64decode,encodeUrlComponent:encodeUrlComponent,encodeUrl:encodeUrl,decodeUrlComponent:decodeUrlComponent,decodeUrl:decodeUrl}})();t.exports=i}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./utils":6}],3:[function(e,t,n){var a=e("./datetime");var i=e("./functions");var s=e("./utils");var u=e("./parser");var f=e("./signature");var c=function(){"use strict";var e=s.isNumeric;var t=s.isArrayOfStrings;var n=s.isArrayOfNumbers;var c=s.createSequence;var l=s.isSequence;var p=s.isFunction;var d=s.isLambda;var h=s.isIterable;var v=s.isPromise;var g=s.getFunctionArity;var y=s.isDeepEqual;var m=createFrame(null);async function evaluate(e,t,n){var a;var i=n.lookup(Symbol.for("jsonata.__evaluate_entry"));if(i){await i(e,t,n)}switch(e.type){case"path":a=await evaluatePath(e,t,n);break;case"binary":a=await evaluateBinary(e,t,n);break;case"unary":a=await evaluateUnary(e,t,n);break;case"name":a=evaluateName(e,t,n);break;case"string":case"number":case"value":a=evaluateLiteral(e,t,n);break;case"wildcard":a=evaluateWildcard(e,t,n);break;case"descendant":a=evaluateDescendants(e,t,n);break;case"parent":a=n.lookup(e.slot.label);break;case"condition":a=await evaluateCondition(e,t,n);break;case"block":a=await evaluateBlock(e,t,n);break;case"bind":a=await evaluateBindExpression(e,t,n);break;case"regex":a=evaluateRegex(e,t,n);break;case"function":a=await evaluateFunction(e,t,n);break;case"variable":a=evaluateVariable(e,t,n);break;case"lambda":a=evaluateLambda(e,t,n);break;case"partial":a=await evaluatePartialApplication(e,t,n);break;case"apply":a=await evaluateApplyExpression(e,t,n);break;case"transform":a=evaluateTransformExpression(e,t,n);break}if(Object.prototype.hasOwnProperty.call(e,"predicate")){for(var s=0;s<e.predicate.length;s++){a=await evaluateFilter(e.predicate[s].expr,a,n)}}if(e.type!=="path"&&Object.prototype.hasOwnProperty.call(e,"group")){a=await evaluateGroupExpression(e.group,a,n)}var u=n.lookup(Symbol.for("jsonata.__evaluate_exit"));if(u){await u(e,t,n,a)}if(a&&l(a)&&!a.tupleStream){if(e.keepArray){a.keepSingleton=true}if(a.length===0){a=undefined}else if(a.length===1){a=a.keepSingleton?a:a[0]}}return a}async function evaluatePath(e,t,n){var a;if(Array.isArray(t)&&e.steps[0].type!=="variable"){a=t}else{a=c(t)}var i;var s=false;var u=undefined;for(var f=0;f<e.steps.length;f++){var l=e.steps[f];if(l.tuple){s=true}if(f===0&&l.consarray){i=await evaluate(l,a,n)}else{if(s){u=await evaluateTupleStep(l,a,u,n)}else{i=await evaluateStep(l,a,n,f===e.steps.length-1)}}if(!s&&(typeof i==="undefined"||i.length===0)){break}if(typeof l.focus==="undefined"){a=i}}if(s){if(e.tuple){i=u}else{i=c();for(f=0;f<u.length;f++){i.push(u[f]["@"])}}}if(e.keepSingletonArray){if(Array.isArray(i)&&i.cons&&!i.sequence){i=c(i)}i.keepSingleton=true}if(e.hasOwnProperty("group")){i=await evaluateGroupExpression(e.group,s?u:i,n)}return i}function createFrameFromTuple(e,t){var n=createFrame(e);for(const e in t){n.bind(e,t[e])}return n}async function evaluateStep(e,t,n,a){var i;if(e.type==="sort"){i=await evaluateSortExpression(e,t,n);if(e.stages){i=await evaluateStages(e.stages,i,n)}return i}i=c();for(var s=0;s<t.length;s++){var u=await evaluate(e,t[s],n);if(e.stages){for(var f=0;f<e.stages.length;f++){u=await evaluateFilter(e.stages[f].expr,u,n)}}if(typeof u!=="undefined"){i.push(u)}}var p=c();if(a&&i.length===1&&Array.isArray(i[0])&&!l(i[0])){p=i[0]}else{i.forEach((function(e){if(!Array.isArray(e)||e.cons){p.push(e)}else{e.forEach((e=>p.push(e)))}}))}return p}async function evaluateStages(e,t,n){var a=t;for(var i=0;i<e.length;i++){var s=e[i];switch(s.type){case"filter":a=await evaluateFilter(s.expr,a,n);break;case"index":for(var u=0;u<a.length;u++){var f=a[u];f[s.value]=u}break}}return a}async function evaluateTupleStep(e,t,n,a){var i;if(e.type==="sort"){if(n){i=await evaluateSortExpression(e,n,a)}else{var s=await evaluateSortExpression(e,t,a);i=c();i.tupleStream=true;for(var u=0;u<s.length;u++){var f={"@":s[u]};f[e.index]=u;i.push(f)}}if(e.stages){i=await evaluateStages(e.stages,i,a)}return i}i=c();i.tupleStream=true;var l=a;if(n===undefined){n=t.map((e=>({"@":e})))}for(var p=0;p<n.length;p++){l=createFrameFromTuple(a,n[p]);var d=await evaluate(e,n[p]["@"],l);if(typeof d!=="undefined"){if(!Array.isArray(d)){d=[d]}for(var h=0;h<d.length;h++){f={};Object.assign(f,n[p]);if(d.tupleStream){Object.assign(f,d[h])}else{if(e.focus){f[e.focus]=d[h];f["@"]=n[p]["@"]}else{f["@"]=d[h]}if(e.index){f[e.index]=h}if(e.ancestor){f[e.ancestor.label]=n[p]["@"]}}i.push(f)}}}if(e.stages){i=await evaluateStages(e.stages,i,a)}return i}async function evaluateFilter(t,a,s){var u=c();if(a&&a.tupleStream){u.tupleStream=true}if(!Array.isArray(a)){a=c(a)}if(t.type==="number"){var f=Math.floor(t.value);if(f<0){f=a.length+f}var l=await a[f];if(typeof l!=="undefined"){if(Array.isArray(l)){u=l}else{u.push(l)}}}else{for(f=0;f<a.length;f++){var l=a[f];var p=l;var d=s;if(a.tupleStream){p=l["@"];d=createFrameFromTuple(s,l)}var h=await evaluate(t,p,d);if(e(h)){h=[h]}if(n(h)){h.forEach((function(e){var t=Math.floor(e);if(t<0){t=a.length+t}if(t===f){u.push(l)}}))}else if(i.boolean(h)){u.push(l)}}}return u}async function evaluateBinary(e,t,n){var a;var i=await evaluate(e.lhs,t,n);var s=e.value;var evalrhs=async()=>await evaluate(e.rhs,t,n);if(s==="and"||s==="or"){try{return await evaluateBooleanExpression(i,evalrhs,s)}catch(t){t.position=e.position;t.token=s;throw t}}var u=await evalrhs();try{switch(s){case"+":case"-":case"*":case"/":case"%":a=evaluateNumericExpression(i,u,s);break;case"=":case"!=":a=evaluateEqualityExpression(i,u,s);break;case"<":case"<=":case">":case">=":a=evaluateComparisonExpression(i,u,s);break;case"&":a=evaluateStringConcat(i,u);break;case"..":a=evaluateRangeExpression(i,u);break;case"in":a=evaluateIncludesExpression(i,u);break}}catch(t){t.position=e.position;t.token=s;throw t}return a}async function evaluateUnary(t,n,a){var s;switch(t.value){case"-":s=await evaluate(t.expression,n,a);if(typeof s==="undefined"){s=undefined}else if(e(s)){s=-s}else{throw{code:"D1002",stack:(new Error).stack,position:t.position,token:t.value,value:s}}break;case"[":s=[];let c=await Promise.all(t.expressions.map((async(e,t)=>{a.isParallelCall=t>0;return[e,await evaluate(e,n,a)]})));for(let e of c){var[u,f]=e;if(typeof f!=="undefined"){if(u.value==="["){s.push(f)}else{s=i.append(s,f)}}}if(t.consarray){Object.defineProperty(s,"cons",{enumerable:false,configurable:false,value:true})}break;case"{":s=await evaluateGroupExpression(t,n,a);break}return s}function evaluateName(e,t,n){return i.lookup(t,e.value)}function evaluateLiteral(e){return e.value}function evaluateWildcard(e,t){var n=c();if(Array.isArray(t)&&t.outerWrapper&&t.length>0){t=t[0]}if(t!==null&&typeof t==="object"){Object.keys(t).forEach((function(e){var a=t[e];if(Array.isArray(a)){a=flatten(a);n=i.append(n,a)}else{n.push(a)}}))}return n}function flatten(e,t){if(typeof t==="undefined"){t=[]}if(Array.isArray(e)){e.forEach((function(e){flatten(e,t)}))}else{t.push(e)}return t}function evaluateDescendants(e,t){var n;var a=c();if(typeof t!=="undefined"){recurseDescendants(t,a);if(a.length===1){n=a[0]}else{n=a}}return n}function recurseDescendants(e,t){if(!Array.isArray(e)){t.push(e)}if(Array.isArray(e)){e.forEach((function(e){recurseDescendants(e,t)}))}else if(e!==null&&typeof e==="object"){Object.keys(e).forEach((function(n){recurseDescendants(e[n],t)}))}}function evaluateNumericExpression(t,n,a){var i;if(typeof t!=="undefined"&&!e(t)){throw{code:"T2001",stack:(new Error).stack,value:t}}if(typeof n!=="undefined"&&!e(n)){throw{code:"T2002",stack:(new Error).stack,value:n}}if(typeof t==="undefined"||typeof n==="undefined"){return i}switch(a){case"+":i=t+n;break;case"-":i=t-n;break;case"*":i=t*n;break;case"/":i=t/n;break;case"%":i=t%n;break}return i}function evaluateEqualityExpression(e,t,n){var a;var i=typeof e;var s=typeof t;if(i==="undefined"||s==="undefined"){return false}switch(n){case"=":a=y(e,t);break;case"!=":a=!y(e,t);break}return a}function evaluateComparisonExpression(e,t,n){var a;var i=typeof e;var s=typeof t;var u=i==="undefined"||i==="string"||i==="number";var f=s==="undefined"||s==="string"||s==="number";if(!u||!f){throw{code:"T2010",stack:(new Error).stack,value:!(i==="string"||i==="number")?e:t}}if(i==="undefined"||s==="undefined"){return undefined}if(i!==s){throw{code:"T2009",stack:(new Error).stack,value:e,value2:t}}switch(n){case"<":a=e<t;break;case"<=":a=e<=t;break;case">":a=e>t;break;case">=":a=e>=t;break}return a}function evaluateIncludesExpression(e,t){var n=false;if(typeof e==="undefined"||typeof t==="undefined"){return false}if(!Array.isArray(t)){t=[t]}for(var a=0;a<t.length;a++){if(t[a]===e){n=true;break}}return n}async function evaluateBooleanExpression(e,t,n){var a;var i=boolize(e);switch(n){case"and":a=i&&boolize(await t());break;case"or":a=i||boolize(await t());break}return a}function boolize(e){var t=i.boolean(e);return typeof t==="undefined"?false:t}function evaluateStringConcat(e,t){var n;var a="";var s="";if(typeof e!=="undefined"){a=i.string(e)}if(typeof t!=="undefined"){s=i.string(t)}n=a.concat(s);return n}async function evaluateGroupExpression(e,t,n){var a={};var s={};var u=t&&t.tupleStream?true:false;if(!Array.isArray(t)){t=c(t)}if(t.length===0){t.push(undefined)}for(var f=0;f<t.length;f++){var l=t[f];var p=u?createFrameFromTuple(n,l):n;for(var d=0;d<e.lhs.length;d++){var h=e.lhs[d];var v=await evaluate(h[0],u?l["@"]:l,p);if(typeof v!=="string"&&v!==undefined){throw{code:"T1003",stack:(new Error).stack,position:e.position,value:v}}if(v!==undefined){var g={data:l,exprIndex:d};if(s.hasOwnProperty(v)){if(s[v].exprIndex!==d){throw{code:"D1009",stack:(new Error).stack,position:e.position,value:v}}s[v].data=i.append(s[v].data,l)}else{s[v]=g}}}}let y=await Promise.all(Object.keys(s).map((async(t,a)=>{let i=s[t];var f=i.data;var c=n;if(u){var l=reduceTupleStream(i.data);f=l["@"];delete l["@"];c=createFrameFromTuple(n,l)}n.isParallelCall=a>0;return[t,await evaluate(e.lhs[i.exprIndex][1],f,c)]})));for(let e of y){var[v,m]=await e;if(typeof m!=="undefined"){a[v]=m}}return a}function reduceTupleStream(e){if(!Array.isArray(e)){return e}var t={};Object.assign(t,e[0]);for(var n=1;n<e.length;n++){for(const a in e[n]){t[a]=i.append(t[a],e[n][a])}}return t}function evaluateRangeExpression(e,t){var n;if(typeof e!=="undefined"&&!Number.isInteger(e)){throw{code:"T2003",stack:(new Error).stack,value:e}}if(typeof t!=="undefined"&&!Number.isInteger(t)){throw{code:"T2004",stack:(new Error).stack,value:t}}if(typeof e==="undefined"||typeof t==="undefined"){return n}if(e>t){return n}var a=t-e+1;if(a>1e7){throw{code:"D2014",stack:(new Error).stack,value:a}}n=new Array(a);for(var i=e,s=0;i<=t;i++,s++){n[s]=i}n.sequence=true;return n}async function evaluateBindExpression(e,t,n){var a=await evaluate(e.rhs,t,n);n.bind(e.lhs.value,a);return a}async function evaluateCondition(e,t,n){var a;var s=await evaluate(e.condition,t,n);if(i.boolean(s)){a=await evaluate(e.then,t,n)}else if(typeof e.else!=="undefined"){a=await evaluate(e.else,t,n)}return a}async function evaluateBlock(e,t,n){var a;var i=createFrame(n);for(var s=0;s<e.expressions.length;s++){a=await evaluate(e.expressions[s],t,i)}return a}function evaluateRegex(e){var t=new jsonata.RegexEngine(e.value);var closure=function(n,a){var i;t.lastIndex=a||0;var s=t.exec(n);if(s!==null){i={match:s[0],start:s.index,end:s.index+s[0].length,groups:[]};if(s.length>1){for(var u=1;u<s.length;u++){i.groups.push(s[u])}}i.next=function(){if(t.lastIndex>=n.length){return undefined}else{var a=closure(n,t.lastIndex);if(a&&a.match===""){throw{code:"D1004",stack:(new Error).stack,position:e.position,value:e.value.source}}return a}}}return i};return closure}function evaluateVariable(e,t,n){var a;if(e.value===""){a=t&&t.outerWrapper?t[0]:t}else{a=n.lookup(e.value)}return a}async function evaluateSortExpression(e,t,n){var a;var s=t;var u=t.tupleStream?true:false;var comparator=async function(t,a){var i=0;for(var s=0;i===0&&s<e.terms.length;s++){var f=e.terms[s];var c=t;var l=n;if(u){c=t["@"];l=createFrameFromTuple(n,t)}var p=await evaluate(f.expression,c,l);c=a;l=n;if(u){c=a["@"];l=createFrameFromTuple(n,a)}var d=await evaluate(f.expression,c,l);var h=typeof p;var v=typeof d;if(h==="undefined"){i=v==="undefined"?0:1;continue}if(v==="undefined"){i=-1;continue}if(!(h==="string"||h==="number")||!(v==="string"||v==="number")){throw{code:"T2008",stack:(new Error).stack,position:e.position,value:!(h==="string"||h==="number")?p:d}}if(h!==v){throw{code:"T2007",stack:(new Error).stack,position:e.position,value:p,value2:d}}if(p===d){continue}else if(p<d){i=-1}else{i=1}if(f.descending===true){i=-i}}return i===1};var f={environment:n,input:t};a=await i.sort.apply(f,[s,comparator]);return a}function evaluateTransformExpression(e,n,a){var transformer=async function(n){if(typeof n==="undefined"){return undefined}var i=a.lookup("clone");if(!p(i)){throw{code:"T2013",stack:(new Error).stack,position:e.position}}var s=await apply(i,[n],null,a);var u=await evaluate(e.pattern,s,a);if(typeof u!=="undefined"){if(!Array.isArray(u)){u=[u]}for(var f=0;f<u.length;f++){var c=u[f];if(c&&(c.isPrototypeOf(s)||c instanceof Object.constructor)){throw{code:"D1010",stack:(new Error).stack,position:e.position}}var l=await evaluate(e.update,c,a);var d=typeof l;if(d!=="undefined"){if(d!=="object"||l===null||Array.isArray(l)){throw{code:"T2011",stack:(new Error).stack,position:e.update.position,value:l}}for(var h in l){c[h]=l[h]}}if(typeof e.delete!=="undefined"){var v=await evaluate(e.delete,c,a);if(typeof v!=="undefined"){var g=v;if(!Array.isArray(v)){v=[v]}if(!t(v)){throw{code:"T2012",stack:(new Error).stack,position:e.delete.position,value:g}}for(var y=0;y<v.length;y++){if(typeof c==="object"&&c!==null){delete c[v[y]]}}}}}}return s};return defineFunction(transformer,"<(oa):o>")}var b=u("function($f, $g) { function($x){ $g($f($x)) } }");async function evaluateApplyExpression(e,t,n){var a;var i=await evaluate(e.lhs,t,n);if(e.rhs.type==="function"){a=await evaluateFunction(e.rhs,t,n,{context:i})}else{var s=await evaluate(e.rhs,t,n);if(!p(s)){throw{code:"T2006",stack:(new Error).stack,position:e.position,value:s}}if(p(i)){var u=await evaluate(b,null,n);a=await apply(u,[i,s],null,n)}else{a=await apply(s,[i],null,n)}}return a}async function evaluateFunction(e,t,n,a){var i;var s=await evaluate(e.procedure,t,n);if(typeof s==="undefined"&&e.procedure.type==="path"&&n.lookup(e.procedure.steps[0].value)){throw{code:"T1005",stack:(new Error).stack,position:e.position,token:e.procedure.steps[0].value}}var u=[];if(typeof a!=="undefined"){u.push(a.context)}for(var f=0;f<e.arguments.length;f++){const a=await evaluate(e.arguments[f],t,n);if(p(a)){const closure=async function(...e){return await apply(a,e,null,n)};closure.arity=g(a);u.push(closure)}else{u.push(a)}}var c=e.procedure.type==="path"?e.procedure.steps[0].value:e.procedure.value;try{if(typeof s==="object"){s.token=c;s.position=e.position}i=await apply(s,u,t,n)}catch(t){if(!t.position){t.position=e.position}if(!t.token){t.token=c}throw t}return i}async function apply(e,t,n,a){var i;i=await applyInner(e,t,n,a);while(d(i)&&i.thunk===true){var s=await evaluate(i.body.procedure,i.input,i.environment);if(i.body.procedure.type==="variable"){s.token=i.body.procedure.value}s.position=i.body.procedure.position;var u=[];for(var f=0;f<i.body.arguments.length;f++){u.push(await evaluate(i.body.arguments[f],i.input,i.environment))}i=await applyInner(s,u,n,a)}return i}async function applyInner(e,t,n,a){var i;try{var s=t;if(e){s=validateArguments(e.signature,t,n)}if(d(e)){i=await applyProcedure(e,s)}else if(e&&e._jsonata_function===true){var u={environment:a,input:n};i=e.implementation.apply(u,s);if(h(i)){i=i.next().value}if(v(i)){i=await i}}else if(typeof e==="function"){i=e.apply(n,s);if(v(i)){i=await i}}else{throw{code:"T1006",stack:(new Error).stack}}}catch(t){if(e){if(typeof t.token=="undefined"&&typeof e.token!=="undefined"){t.token=e.token}t.position=e.position||t.position}throw t}return i}function evaluateLambda(e,t,n){var a={_jsonata_lambda:true,input:t,environment:n,arguments:e.arguments,signature:e.signature,body:e.body};if(e.thunk===true){a.thunk=true}a.apply=async function(e,i){return await apply(a,i,t,!!e?e.environment:n)};return a}async function evaluatePartialApplication(e,t,n){var a;var i=[];for(var s=0;s<e.arguments.length;s++){var u=e.arguments[s];if(u.type==="operator"&&u.value==="?"){i.push(u)}else{i.push(await evaluate(u,t,n))}}var f=await evaluate(e.procedure,t,n);if(typeof f==="undefined"&&e.procedure.type==="path"&&n.lookup(e.procedure.steps[0].value)){throw{code:"T1007",stack:(new Error).stack,position:e.position,token:e.procedure.steps[0].value}}if(d(f)){a=partialApplyProcedure(f,i)}else if(f&&f._jsonata_function===true){a=partialApplyNativeFunction(f.implementation,i)}else if(typeof f==="function"){a=partialApplyNativeFunction(f,i)}else{throw{code:"T1008",stack:(new Error).stack,position:e.position,token:e.procedure.type==="path"?e.procedure.steps[0].value:e.procedure.value}}return a}function validateArguments(e,t,n){if(typeof e==="undefined"){return t}var a=e.validate(t,n);return a}async function applyProcedure(e,t){var n;var a=createFrame(e.environment);e.arguments.forEach((function(e,n){a.bind(e.value,t[n])}));if(typeof e.body==="function"){n=await applyNativeFunction(e.body,a)}else{n=await evaluate(e.body,e.input,a)}return n}function partialApplyProcedure(e,t){var n=createFrame(e.environment);var a=[];e.arguments.forEach((function(e,i){var s=t[i];if(s&&s.type==="operator"&&s.value==="?"){a.push(e)}else{n.bind(e.value,s)}}));var i={_jsonata_lambda:true,input:e.input,environment:n,arguments:a,body:e.body};return i}function partialApplyNativeFunction(e,t){var n=getNativeFunctionArguments(e);n=n.map((function(e){return"$"+e.trim()}));var a="function("+n.join(", ")+"){ _ }";var i=u(a);i.body=e;var s=partialApplyProcedure(i,t);return s}async function applyNativeFunction(e,t){var n=getNativeFunctionArguments(e);var a=n.map((function(e){return t.lookup(e.trim())}));var i={environment:t};var s=e.apply(i,a);if(v(s)){s=await s}return s}function getNativeFunctionArguments(e){var t=e.toString();var n=/\(([^)]*)\)/.exec(t)[1];var a=n.split(",");return a}function defineFunction(e,t){var n={_jsonata_function:true,implementation:e};if(typeof t!=="undefined"){n.signature=f(t)}return n}async function functionEval(e,t){if(typeof e==="undefined"){return undefined}var n=this.input;if(typeof t!=="undefined"){n=t;if(Array.isArray(n)&&!l(n)){n=c(n);n.outerWrapper=true}}try{var a=u(e,false)}catch(e){populateMessage(e);throw{stack:(new Error).stack,code:"D3120",value:e.message,error:e}}try{var i=await evaluate(a,n,this.environment)}catch(e){populateMessage(e);throw{stack:(new Error).stack,code:"D3121",value:e.message,error:e}}return i}function functionClone(e){if(typeof e==="undefined"){return undefined}return JSON.parse(i.string(e))}function createFrame(e){var t={};const n={bind:function(e,n){t[e]=n},lookup:function(n){var a;if(t.hasOwnProperty(n)){a=t[n]}else if(e){a=e.lookup(n)}return a},timestamp:e?e.timestamp:null,async:e?e.async:false,isParallelCall:e?e.isParallelCall:false,global:e?e.global:{ancestry:[null]}};if(e){var a=e.lookup(Symbol.for("jsonata.__createFrame_push"));if(a){a(e,n)}}return n}m.bind("sum",defineFunction(i.sum,"<a<n>:n>"));m.bind("count",defineFunction(i.count,"<a:n>"));m.bind("max",defineFunction(i.max,"<a<n>:n>"));m.bind("min",defineFunction(i.min,"<a<n>:n>"));m.bind("average",defineFunction(i.average,"<a<n>:n>"));m.bind("string",defineFunction(i.string,"<x-b?:s>"));m.bind("substring",defineFunction(i.substring,"<s-nn?:s>"));m.bind("substringBefore",defineFunction(i.substringBefore,"<s-s:s>"));m.bind("substringAfter",defineFunction(i.substringAfter,"<s-s:s>"));m.bind("lowercase",defineFunction(i.lowercase,"<s-:s>"));m.bind("uppercase",defineFunction(i.uppercase,"<s-:s>"));m.bind("length",defineFunction(i.length,"<s-:n>"));m.bind("trim",defineFunction(i.trim,"<s-:s>"));m.bind("pad",defineFunction(i.pad,"<s-ns?:s>"));m.bind("match",defineFunction(i.match,"<s-f<s:o>n?:a<o>>"));m.bind("contains",defineFunction(i.contains,"<s-(sf):b>"));m.bind("replace",defineFunction(i.replace,"<s-(sf)(sf)n?:s>"));m.bind("split",defineFunction(i.split,"<s-(sf)n?:a<s>>"));m.bind("join",defineFunction(i.join,"<a<s>s?:s>"));m.bind("formatNumber",defineFunction(i.formatNumber,"<n-so?:s>"));m.bind("formatBase",defineFunction(i.formatBase,"<n-n?:s>"));m.bind("formatInteger",defineFunction(a.formatInteger,"<n-s:s>"));m.bind("parseInteger",defineFunction(a.parseInteger,"<s-s:n>"));m.bind("number",defineFunction(i.number,"<(nsb)-:n>"));m.bind("floor",defineFunction(i.floor,"<n-:n>"));m.bind("ceil",defineFunction(i.ceil,"<n-:n>"));m.bind("round",defineFunction(i.round,"<n-n?:n>"));m.bind("abs",defineFunction(i.abs,"<n-:n>"));m.bind("sqrt",defineFunction(i.sqrt,"<n-:n>"));m.bind("power",defineFunction(i.power,"<n-n:n>"));m.bind("random",defineFunction(i.random,"<:n>"));m.bind("boolean",defineFunction(i.boolean,"<x-:b>"));m.bind("not",defineFunction(i.not,"<x-:b>"));m.bind("map",defineFunction(i.map,"<af>"));m.bind("zip",defineFunction(i.zip,"<a+>"));m.bind("filter",defineFunction(i.filter,"<af>"));m.bind("single",defineFunction(i.single,"<af?>"));m.bind("reduce",defineFunction(i.foldLeft,"<afj?:j>"));m.bind("sift",defineFunction(i.sift,"<o-f?:o>"));m.bind("keys",defineFunction(i.keys,"<x-:a<s>>"));m.bind("lookup",defineFunction(i.lookup,"<x-s:x>"));m.bind("append",defineFunction(i.append,"<xx:a>"));m.bind("exists",defineFunction(i.exists,"<x:b>"));m.bind("spread",defineFunction(i.spread,"<x-:a<o>>"));m.bind("merge",defineFunction(i.merge,"<a<o>:o>"));m.bind("reverse",defineFunction(i.reverse,"<a:a>"));m.bind("each",defineFunction(i.each,"<o-f:a>"));m.bind("error",defineFunction(i.error,"<s?:x>"));m.bind("assert",defineFunction(i.assert,"<bs?:x>"));m.bind("type",defineFunction(i.type,"<x:s>"));m.bind("sort",defineFunction(i.sort,"<af?:a>"));m.bind("shuffle",defineFunction(i.shuffle,"<a:a>"));m.bind("distinct",defineFunction(i.distinct,"<x:x>"));m.bind("base64encode",defineFunction(i.base64encode,"<s-:s>"));m.bind("base64decode",defineFunction(i.base64decode,"<s-:s>"));m.bind("encodeUrlComponent",defineFunction(i.encodeUrlComponent,"<s-:s>"));m.bind("encodeUrl",defineFunction(i.encodeUrl,"<s-:s>"));m.bind("decodeUrlComponent",defineFunction(i.decodeUrlComponent,"<s-:s>"));m.bind("decodeUrl",defineFunction(i.decodeUrl,"<s-:s>"));m.bind("eval",defineFunction(functionEval,"<sx?:x>"));m.bind("toMillis",defineFunction(a.toMillis,"<s-s?:n>"));m.bind("fromMillis",defineFunction(a.fromMillis,"<n-s?s?:s>"));m.bind("clone",defineFunction(functionClone,"<(oa)-:o>"));var w={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",D1010:"Attempted to access the Javascript object prototype",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function populateMessage(e){var t=w[e.code];if(typeof t!=="undefined"){var n=t.replace(/\{\{\{([^}]+)}}}/g,(function(){return e[arguments[1]]}));n=n.replace(/\{\{([^}]+)}}/g,(function(){return JSON.stringify(e[arguments[1]])}));e.message=n}}function jsonata(e,t){var n;var i;try{n=u(e,t&&t.recover);i=n.errors;delete n.errors}catch(e){populateMessage(e);throw e}var s=createFrame(m);var f=new Date;s.bind("now",defineFunction((function(e,t){return a.fromMillis(f.getTime(),e,t)}),"<s?s?:s>"));s.bind("millis",defineFunction((function(){return f.getTime()}),"<:n>"));if(t&&t.RegexEngine){jsonata.RegexEngine=t.RegexEngine}else{jsonata.RegexEngine=RegExp}return{evaluate:async function(e,t,a){if(typeof i!=="undefined"){var u={code:"S0500",position:0};populateMessage(u);throw u}if(typeof t!=="undefined"){var p;p=createFrame(s);for(var d in t){p.bind(d,t[d])}}else{p=s}p.bind("$",e);f=new Date;p.timestamp=f;if(Array.isArray(e)&&!l(e)){e=c(e);e.outerWrapper=true}var h;try{h=await evaluate(n,e,p);if(typeof a==="function"){a(null,h)}return h}catch(u){populateMessage(u);throw u}},assign:function(e,t){s.bind(e,t)},registerFunction:function(e,t,n){var a=defineFunction(t,n);s.bind(e,a)},ast:function(){return n},errors:function(){return i}}}jsonata.parser=u;return jsonata}();t.exports=c},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(e,t,n){var a=e("./signature");const i=(()=>{"use strict";var e={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0};var t={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};var tokenizer=function(n){var a=0;var i=n.length;var create=function(e,t){var n={type:e,value:t,position:a};return n};var scanRegex=function(){var e=a;var t=0;var s;var u;var isClosingSlash=function(e){if(n.charAt(e)==="/"&&t===0){var a=0;while(n.charAt(e-(a+1))==="\\"){a++}if(a%2===0){return true}}return false};while(a<i){var f=n.charAt(a);if(isClosingSlash(a)){s=n.substring(e,a);if(s===""){throw{code:"S0301",stack:(new Error).stack,position:a}}a++;f=n.charAt(a);e=a;while(f==="i"||f==="m"){a++;f=n.charAt(a)}u=n.substring(e,a)+"g";return new RegExp(s,u)}if((f==="("||f==="["||f==="{")&&n.charAt(a-1)!=="\\"){t++}if((f===")"||f==="]"||f==="}")&&n.charAt(a-1)!=="\\"){t--}a++}throw{code:"S0302",stack:(new Error).stack,position:a}};var next=function(s){if(a>=i)return null;var u=n.charAt(a);while(a<i&&" \t\n\r\v".indexOf(u)>-1){a++;u=n.charAt(a)}if(u==="/"&&n.charAt(a+1)==="*"){var f=a;a+=2;u=n.charAt(a);while(!(u==="*"&&n.charAt(a+1)==="/")){u=n.charAt(++a);if(a>=i){throw{code:"S0106",stack:(new Error).stack,position:f}}}a+=2;u=n.charAt(a);return next(s)}if(s!==true&&u==="/"){a++;return create("regex",scanRegex())}if(u==="."&&n.charAt(a+1)==="."){a+=2;return create("operator","..")}if(u===":"&&n.charAt(a+1)==="="){a+=2;return create("operator",":=")}if(u==="!"&&n.charAt(a+1)==="="){a+=2;return create("operator","!=")}if(u===">"&&n.charAt(a+1)==="="){a+=2;return create("operator",">=")}if(u==="<"&&n.charAt(a+1)==="="){a+=2;return create("operator","<=")}if(u==="*"&&n.charAt(a+1)==="*"){a+=2;return create("operator","**")}if(u==="~"&&n.charAt(a+1)===">"){a+=2;return create("operator","~>")}if(u==="?"&&n.charAt(a+1)===":"){a+=2;return create("operator","?:")}if(u==="?"&&n.charAt(a+1)==="?"){a+=2;return create("operator","??")}if(Object.prototype.hasOwnProperty.call(e,u)){a++;return create("operator",u)}if(u==='"'||u==="'"){var c=u;a++;var l="";while(a<i){u=n.charAt(a);if(u==="\\"){a++;u=n.charAt(a);if(Object.prototype.hasOwnProperty.call(t,u)){l+=t[u]}else if(u==="u"){var p=n.substr(a+1,4);if(/^[0-9a-fA-F]+$/.test(p)){var d=parseInt(p,16);l+=String.fromCharCode(d);a+=4}else{throw{code:"S0104",stack:(new Error).stack,position:a}}}else{throw{code:"S0103",stack:(new Error).stack,position:a,token:u}}}else if(u===c){a++;return create("string",l)}else{l+=u}a++}throw{code:"S0101",stack:(new Error).stack,position:a}}var h=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/;var v=h.exec(n.substring(a));if(v!==null){var g=parseFloat(v[0]);if(!isNaN(g)&&isFinite(g)){a+=v[0].length;return create("number",g)}else{throw{code:"S0102",stack:(new Error).stack,position:a,token:v[0]}}}var y;if(u==="`"){a++;var m=n.indexOf("`",a);if(m!==-1){y=n.substring(a,m);a=m+1;return create("name",y)}a=i;throw{code:"S0105",stack:(new Error).stack,position:a}}var b=a;var w;for(;;){w=n.charAt(b);if(b===i||" \t\n\r\v".indexOf(w)>-1||Object.prototype.hasOwnProperty.call(e,w)){if(n.charAt(a)==="$"){y=n.substring(a+1,b);a=b;return create("variable",y)}else{y=n.substring(a,b);a=b;switch(y){case"or":case"in":case"and":return create("operator",y);case"true":return create("value",true);case"false":return create("value",false);case"null":return create("value",null);default:if(a===i&&y===""){return null}return create("name",y)}}}else{b++}}};return next};var parser=function(t,n){var i;var s;var u={};var f=[];var remainingTokens=function(){var e=[];if(i.id!=="(end)"){e.push({type:i.type,value:i.value,position:i.position})}var t=s();while(t!==null){e.push(t);t=s()}return e};var c={nud:function(){var e={code:"S0211",token:this.value,position:this.position};if(n){e.remaining=remainingTokens();e.type="error";f.push(e);return e}else{e.stack=(new Error).stack;throw e}}};var symbol=function(e,t){var n=u[e];t=t||0;if(n){if(t>=n.lbp){n.lbp=t}}else{n=Object.create(c);n.id=n.value=e;n.lbp=t;u[e]=n}return n};var handleError=function(e){if(n){e.remaining=remainingTokens();f.push(e);var t=u["(error)"];i=Object.create(t);i.error=e;i.type="(error)";return i}else{e.stack=(new Error).stack;throw e}};var advance=function(e,n){if(e&&i.id!==e){var a;if(i.id==="(end)"){a="S0203"}else{a="S0202"}var f={code:a,position:i.position,token:i.value,value:e};return handleError(f)}var c=s(n);if(c===null){i=u["(end)"];i.position=t.length;return i}var l=c.value;var p=c.type;var d;switch(p){case"name":case"variable":d=u["(name)"];break;case"operator":d=u[l];if(!d){return handleError({code:"S0204",stack:(new Error).stack,position:c.position,token:l})}break;case"string":case"number":case"value":d=u["(literal)"];break;case"regex":p="regex";d=u["(regex)"];break;default:return handleError({code:"S0205",stack:(new Error).stack,position:c.position,token:l})}i=Object.create(d);i.value=l;i.type=p;i.position=c.position;return i};var expression=function(e){var t;var n=i;advance(null,true);t=n.nud();while(e<i.lbp){n=i;advance();t=n.led(t)}return t};var terminal=function(e){var t=symbol(e,0);t.nud=function(){return this}};var infix=function(t,n,a){var i=n||e[t];var s=symbol(t,i);s.led=a||function(e){this.lhs=e;this.rhs=expression(i);this.type="binary";return this};return s};var infixr=function(e,t,n){var a=symbol(e,t);a.led=n;return a};var prefix=function(e,t){var n=symbol(e);n.nud=t||function(){this.expression=expression(70);this.type="unary";return this};return n};terminal("(end)");terminal("(name)");terminal("(literal)");terminal("(regex)");symbol(":");symbol(";");symbol(",");symbol(")");symbol("]");symbol("}");symbol("..");infix(".");infix("+");infix("-");infix("*");infix("/");infix("%");infix("=");infix("<");infix(">");infix("!=");infix("<=");infix(">=");infix("&");infix("and");infix("or");infix("in");terminal("and");terminal("or");terminal("in");prefix("-");infix("~>");infix("??",e["??"],(function(e){this.type="condition";this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[e]};this.then=e;this.else=expression(0);return this}));infixr("(error)",10,(function(e){this.lhs=e;this.error=i.error;this.remaining=remainingTokens();this.type="error";return this}));prefix("*",(function(){this.type="wildcard";return this}));prefix("**",(function(){this.type="descendant";return this}));prefix("%",(function(){this.type="parent";return this}));infix("(",e["("],(function(e){this.procedure=e;this.type="function";this.arguments=[];if(i.id!==")"){for(;;){if(i.type==="operator"&&i.id==="?"){this.type="partial";this.arguments.push(i);advance("?")}else{this.arguments.push(expression(0))}if(i.id!==",")break;advance(",")}}advance(")",true);if(e.type==="name"&&(e.value==="function"||e.value==="λ")){this.arguments.forEach((function(e,t){if(e.type!=="variable"){return handleError({code:"S0208",stack:(new Error).stack,position:e.position,token:e.value,value:t+1})}}));this.type="lambda";if(i.id==="<"){var t=i.position;var n=1;var s="<";while(n>0&&i.id!=="{"&&i.id!=="(end)"){var u=advance();if(u.id===">"){n--}else if(u.id==="<"){n++}s+=u.value}advance(">");try{this.signature=a(s)}catch(e){e.position=t+e.offset;return handleError(e)}}advance("{");this.body=expression(0);advance("}")}return this}));prefix("(",(function(){var e=[];while(i.id!==")"){e.push(expression(0));if(i.id!==";"){break}advance(";")}advance(")",true);this.type="block";this.expressions=e;return this}));prefix("[",(function(){var e=[];if(i.id!=="]"){for(;;){var t=expression(0);if(i.id===".."){var n={type:"binary",value:"..",position:i.position,lhs:t};advance("..");n.rhs=expression(0);t=n}e.push(t);if(i.id!==","){break}advance(",")}}advance("]",true);this.expressions=e;this.type="unary";return this}));infix("[",e["["],(function(t){if(i.id==="]"){var n=t;while(n&&n.type==="binary"&&n.value==="["){n=n.lhs}n.keepArray=true;advance("]");return t}else{this.lhs=t;this.rhs=expression(e["]"]);this.type="binary";advance("]",true);return this}}));infix("^",e["^"],(function(e){advance("(");var t=[];for(;;){var n={descending:false};if(i.id==="<"){advance("<")}else if(i.id===">"){n.descending=true;advance(">")}else{}n.expression=expression(0);t.push(n);if(i.id!==","){break}advance(",")}advance(")");this.lhs=e;this.rhs=t;this.type="binary";return this}));var objectParser=function(e){var t=[];if(i.id!=="}"){for(;;){var n=expression(0);advance(":");var a=expression(0);t.push([n,a]);if(i.id!==","){break}advance(",")}}advance("}",true);if(typeof e==="undefined"){this.lhs=t;this.type="unary"}else{this.lhs=e;this.rhs=t;this.type="binary"}return this};prefix("{",objectParser);infix("{",e["{"],objectParser);infixr(":=",e[":="],(function(t){if(t.type!=="variable"){return handleError({code:"S0212",stack:(new Error).stack,position:t.position,token:t.value})}this.lhs=t;this.rhs=expression(e[":="]-1);this.type="binary";return this}));infix("@",e["@"],(function(t){this.lhs=t;this.rhs=expression(e["@"]);if(this.rhs.type!=="variable"){return handleError({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"@"})}this.type="binary";return this}));infix("#",e["#"],(function(t){this.lhs=t;this.rhs=expression(e["#"]);if(this.rhs.type!=="variable"){return handleError({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"#"})}this.type="binary";return this}));infix("?",e["?"],(function(e){this.type="condition";this.condition=e;this.then=expression(0);if(i.id===":"){advance(":");this.else=expression(0)}return this}));infix("?:",e["?:"],(function(e){this.type="condition";this.condition=e;this.then=e;this.else=expression(0);return this}));prefix("|",(function(){this.type="transform";this.pattern=expression(0);advance("|");this.update=expression(0);if(i.id===","){advance(",");this.delete=expression(0)}advance("|");return this}));var tailCallOptimize=function(e){var t;if(e.type==="function"&&!e.predicate){var n={type:"lambda",thunk:true,arguments:[],position:e.position};n.body=e;t=n}else if(e.type==="condition"){e.then=tailCallOptimize(e.then);if(typeof e.else!=="undefined"){e.else=tailCallOptimize(e.else)}t=e}else if(e.type==="block"){var a=e.expressions.length;if(a>0){e.expressions[a-1]=tailCallOptimize(e.expressions[a-1])}t=e}else{t=e}return t};var l=0;var p=0;var d=[];var seekParent=function(e,t){switch(e.type){case"name":case"wildcard":t.level--;if(t.level===0){if(typeof e.ancestor==="undefined"){e.ancestor=t}else{d[t.index].slot.label=e.ancestor.label;e.ancestor=t}e.tuple=true}break;case"parent":t.level++;break;case"block":if(e.expressions.length>0){e.tuple=true;t=seekParent(e.expressions[e.expressions.length-1],t)}break;case"path":e.tuple=true;var n=e.steps.length-1;t=seekParent(e.steps[n--],t);while(t.level>0&&n>=0){t=seekParent(e.steps[n--],t)}break;default:throw{code:"S0217",token:e.type,position:e.position}}return t};var pushAncestry=function(e,t){if(typeof t.seekingParent!=="undefined"||t.type==="parent"){var n=typeof t.seekingParent!=="undefined"?t.seekingParent:[];if(t.type==="parent"){n.push(t.slot)}if(typeof e.seekingParent==="undefined"){e.seekingParent=n}else{Array.prototype.push.apply(e.seekingParent,n)}}};var resolveAncestry=function(e){var t=e.steps.length-1;var n=e.steps[t];var a=typeof n.seekingParent!=="undefined"?n.seekingParent:[];if(n.type==="parent"){a.push(n.slot)}for(var i=0;i<a.length;i++){var s=a[i];t=e.steps.length-2;while(s.level>0){if(t<0){if(typeof e.seekingParent==="undefined"){e.seekingParent=[s]}else{e.seekingParent.push(s)}break}var u=e.steps[t--];while(t>=0&&u.focus&&e.steps[t].focus){u=e.steps[t--]}s=seekParent(u,s)}}};var processAST=function(e){var t;switch(e.type){case"binary":switch(e.value){case".":var a=processAST(e.lhs);if(a.type==="path"){t=a}else{t={type:"path",steps:[a]}}if(a.type==="parent"){t.seekingParent=[a.slot]}var i=processAST(e.rhs);if(i.type==="function"&&i.procedure.type==="path"&&i.procedure.steps.length===1&&i.procedure.steps[0].type==="name"&&t.steps[t.steps.length-1].type==="function"){t.steps[t.steps.length-1].nextFunction=i.procedure.steps[0].value}if(i.type==="path"){Array.prototype.push.apply(t.steps,i.steps)}else{if(typeof i.predicate!=="undefined"){i.stages=i.predicate;delete i.predicate}t.steps.push(i)}t.steps.filter((function(e){if(e.type==="number"||e.type==="value"){throw{code:"S0213",stack:(new Error).stack,position:e.position,value:e.value}}return e.type==="string"})).forEach((function(e){e.type="name"}));if(t.steps.filter((function(e){return e.keepArray===true})).length>0){t.keepSingletonArray=true}var s=t.steps[0];if(s.type==="unary"&&s.value==="["){s.consarray=true}var u=t.steps[t.steps.length-1];if(u.type==="unary"&&u.value==="["){u.consarray=true}resolveAncestry(t);break;case"[":t=processAST(e.lhs);var c=t;var h="predicate";if(t.type==="path"){c=t.steps[t.steps.length-1];h="stages"}if(typeof c.group!=="undefined"){throw{code:"S0209",stack:(new Error).stack,position:e.position}}if(typeof c[h]==="undefined"){c[h]=[]}var v=processAST(e.rhs);if(typeof v.seekingParent!=="undefined"){v.seekingParent.forEach((e=>{if(e.level===1){seekParent(c,e)}else{e.level--}}));pushAncestry(c,v)}c[h].push({type:"filter",expr:v,position:e.position});break;case"{":t=processAST(e.lhs);if(typeof t.group!=="undefined"){throw{code:"S0210",stack:(new Error).stack,position:e.position}}t.group={lhs:e.rhs.map((function(e){return[processAST(e[0]),processAST(e[1])]})),position:e.position};break;case"^":t=processAST(e.lhs);if(t.type!=="path"){t={type:"path",steps:[t]}}var g={type:"sort",position:e.position};g.terms=e.rhs.map((function(e){var t=processAST(e.expression);pushAncestry(g,t);return{descending:e.descending,expression:t}}));t.steps.push(g);resolveAncestry(t);break;case":=":t={type:"bind",value:e.value,position:e.position};t.lhs=processAST(e.lhs);t.rhs=processAST(e.rhs);pushAncestry(t,t.rhs);break;case"@":t=processAST(e.lhs);c=t;if(t.type==="path"){c=t.steps[t.steps.length-1]}if(typeof c.stages!=="undefined"||typeof c.predicate!=="undefined"){throw{code:"S0215",stack:(new Error).stack,position:e.position}}if(c.type==="sort"){throw{code:"S0216",stack:(new Error).stack,position:e.position}}if(e.keepArray){c.keepArray=true}c.focus=e.rhs.value;c.tuple=true;break;case"#":t=processAST(e.lhs);c=t;if(t.type==="path"){c=t.steps[t.steps.length-1]}else{t={type:"path",steps:[t]};if(typeof c.predicate!=="undefined"){c.stages=c.predicate;delete c.predicate}}if(typeof c.stages==="undefined"){c.index=e.rhs.value}else{c.stages.push({type:"index",value:e.rhs.value,position:e.position})}c.tuple=true;break;case"~>":t={type:"apply",value:e.value,position:e.position};t.lhs=processAST(e.lhs);t.rhs=processAST(e.rhs);t.keepArray=t.lhs.keepArray||t.rhs.keepArray;break;default:t={type:e.type,value:e.value,position:e.position};t.lhs=processAST(e.lhs);t.rhs=processAST(e.rhs);pushAncestry(t,t.lhs);pushAncestry(t,t.rhs)}break;case"unary":t={type:e.type,value:e.value,position:e.position};if(e.value==="["){t.expressions=e.expressions.map((function(e){var n=processAST(e);pushAncestry(t,n);return n}))}else if(e.value==="{"){t.lhs=e.lhs.map((function(e){var n=processAST(e[0]);pushAncestry(t,n);var a=processAST(e[1]);pushAncestry(t,a);return[n,a]}))}else{t.expression=processAST(e.expression);if(e.value==="-"&&t.expression.type==="number"){t=t.expression;t.value=-t.value}else{pushAncestry(t,t.expression)}}break;case"function":case"partial":t={type:e.type,name:e.name,value:e.value,position:e.position};t.arguments=e.arguments.map((function(e){var n=processAST(e);pushAncestry(t,n);return n}));t.procedure=processAST(e.procedure);break;case"lambda":t={type:e.type,arguments:e.arguments,signature:e.signature,position:e.position};var y=processAST(e.body);t.body=tailCallOptimize(y);break;case"condition":t={type:e.type,position:e.position};t.condition=processAST(e.condition);pushAncestry(t,t.condition);t.then=processAST(e.then);pushAncestry(t,t.then);if(typeof e.else!=="undefined"){t.else=processAST(e.else);pushAncestry(t,t.else)}break;case"transform":t={type:e.type,position:e.position};t.pattern=processAST(e.pattern);t.update=processAST(e.update);if(typeof e.delete!=="undefined"){t.delete=processAST(e.delete)}break;case"block":t={type:e.type,position:e.position};t.expressions=e.expressions.map((function(e){var n=processAST(e);pushAncestry(t,n);if(n.consarray||n.type==="path"&&n.steps[0].consarray){t.consarray=true}return n}));break;case"name":t={type:"path",steps:[e]};if(e.keepArray){t.keepSingletonArray=true}break;case"parent":t={type:"parent",slot:{label:"!"+l++,level:1,index:p++}};d.push(t);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":t=e;break;case"operator":if(e.value==="and"||e.value==="or"||e.value==="in"){e.type="name";t=processAST(e)}else if(e.value==="?"){t=e}else{throw{code:"S0201",stack:(new Error).stack,position:e.position,token:e.value}}break;case"error":t=e;if(e.lhs){t=processAST(e.lhs)}break;default:var m="S0206";if(e.id==="(end)"){m="S0207"}var b={code:m,position:e.position,token:e.value};if(n){f.push(b);return{type:"error",error:b}}else{b.stack=(new Error).stack;throw b}}if(e.keepArray){t.keepArray=true}return t};s=tokenizer(t);advance();var h=expression(0);if(i.id!=="(end)"){var v={code:"S0201",position:i.position,token:i.value};handleError(v)}h=processAST(h);if(h.type==="parent"||typeof h.seekingParent!=="undefined"){throw{code:"S0217",token:h.type,position:h.position}}if(f.length>0){h.errors=f}return h};return parser})();t.exports=i},{"./signature":5}],5:[function(e,t,n){var a=e("./utils");const i=(()=>{"use strict";var e={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function parseSignature(t){var n=1;var i=[];var s={};var u=s;while(n<t.length){var f=t.charAt(n);if(f===":"){break}var next=function(){i.push(s);u=s;s={}};var findClosingBracket=function(e,t,n,a){var i=1;var s=t;while(s<e.length){s++;f=e.charAt(s);if(f===a){i--;if(i===0){break}}else if(f===n){i++}}return s};switch(f){case"s":case"n":case"b":case"l":case"o":s.regex="["+f+"m]";s.type=f;next();break;case"a":s.regex="[asnblfom]";s.type=f;s.array=true;next();break;case"f":s.regex="f";s.type=f;next();break;case"j":s.regex="[asnblom]";s.type=f;next();break;case"x":s.regex="[asnblfom]";s.type=f;next();break;case"-":u.context=true;u.contextRegex=new RegExp(u.regex);u.regex+="?";break;case"?":case"+":u.regex+=f;break;case"(":var c=findClosingBracket(t,n,"(",")");var l=t.substring(n+1,c);if(l.indexOf("<")===-1){s.regex="["+l+"m]"}else{throw{code:"S0402",stack:(new Error).stack,value:l,offset:n}}s.type="("+l+")";n=c;next();break;case"<":if(u.type==="a"||u.type==="f"){var p=findClosingBracket(t,n,"<",">");u.subtype=t.substring(n+1,p);n=p}else{throw{code:"S0401",stack:(new Error).stack,value:u.type,offset:n}}break}n++}var d="^"+i.map((function(e){return"("+e.regex+")"})).join("")+"$";var h=new RegExp(d);var getSymbol=function(e){var t;if(a.isFunction(e)){t="f"}else{var n=typeof e;switch(n){case"string":t="s";break;case"number":t="n";break;case"boolean":t="b";break;case"object":if(e===null){t="l"}else if(Array.isArray(e)){t="a"}else{t="o"}break;case"undefined":default:t="m"}}return t};var throwValidationError=function(e,t){var n="^";var a=0;for(var s=0;s<i.length;s++){n+=i[s].regex;var u=t.match(n);if(u===null){throw{code:"T0410",stack:(new Error).stack,value:e[a],index:a+1}}a=u[0].length}throw{code:"T0410",stack:(new Error).stack,value:e[a],index:a+1}};return{definition:t,validate:function(t,n){var a="";t.forEach((function(e){a+=getSymbol(e)}));var s=h.exec(a);if(s){var u=[];var f=0;i.forEach((function(a,i){var c=t[f];var l=s[i+1];if(l===""){if(a.context&&a.contextRegex){var p=getSymbol(n);if(a.contextRegex.test(p)){u.push(n)}else{throw{code:"T0411",stack:(new Error).stack,value:n,index:f+1}}}else{u.push(c);f++}}else{l.split("").forEach((function(n){if(a.type==="a"){if(n==="m"){c=undefined}else{c=t[f];var i=true;if(typeof a.subtype!=="undefined"){if(n!=="a"&&l!==a.subtype){i=false}else if(n==="a"){if(c.length>0){var s=getSymbol(c[0]);if(s!==a.subtype.charAt(0)){i=false}else{var p=c.filter((function(e){return getSymbol(e)!==s}));i=p.length===0}}}}if(!i){throw{code:"T0412",stack:(new Error).stack,value:c,index:f+1,type:e[a.subtype]}}if(n!=="a"){c=[c]}}u.push(c);f++}else{u.push(c);f++}}))}}));return u}throwValidationError(t,a)}}}return parseSignature})();t.exports=i},{"./utils":6}],6:[function(e,t,n){const a=(()=>{"use strict";function isNumeric(e){var t=false;if(typeof e==="number"){t=!isNaN(e);if(t&&!isFinite(e)){throw{code:"D1001",value:e,stack:(new Error).stack}}}return t}function isArrayOfStrings(e){var t=false;if(Array.isArray(e)){t=e.filter((function(e){return typeof e!=="string"})).length===0}return t}function isArrayOfNumbers(e){var t=false;if(Array.isArray(e)){t=e.filter((function(e){return!isNumeric(e)})).length===0}return t}function createSequence(){var e=[];e.sequence=true;if(arguments.length===1){e.push(arguments[0])}return e}function isSequence(e){return e.sequence===true&&Array.isArray(e)}function isFunction(e){return e&&(e._jsonata_function===true||e._jsonata_lambda===true)||typeof e==="function"}function getFunctionArity(e){var t=typeof e.arity==="number"?e.arity:typeof e.implementation==="function"?e.implementation.length:typeof e.length==="number"?e.length:e.arguments.length;return t}function isLambda(e){return e&&e._jsonata_lambda===true}var e=(typeof Symbol==="function"?Symbol:{}).iterator||"@@iterator";function isIterable(t){return typeof t==="object"&&t!==null&&e in t&&"next"in t&&typeof t.next==="function"}function isDeepEqual(e,t){if(e===t){return true}if(typeof e==="object"&&typeof t==="object"&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length){return false}for(var n=0;n<e.length;n++){if(!isDeepEqual(e[n],t[n])){return false}}return true}var a=Object.getOwnPropertyNames(e);var i=Object.getOwnPropertyNames(t);if(a.length!==i.length){return false}a=a.sort();i=i.sort();for(n=0;n<a.length;n++){if(a[n]!==i[n]){return false}}for(n=0;n<a.length;n++){var s=a[n];if(!isDeepEqual(e[s],t[s])){return false}}return true}return false}function isPromise(e){return typeof e==="object"&&e!==null&&"then"in e&&typeof e.then==="function"}function stringToArray(e){var t=[];for(let n of e){t.push(n)}return t}return{isNumeric:isNumeric,isArrayOfStrings:isArrayOfStrings,isArrayOfNumbers:isArrayOfNumbers,createSequence:createSequence,isSequence:isSequence,isFunction:isFunction,isLambda:isLambda,isIterable:isIterable,getFunctionArity:getFunctionArity,isDeepEqual:isDeepEqual,stringToArray:stringToArray,isPromise:isPromise}})();t.exports=a},{}]},{},[3])(3)}))}};var t={};function __nccwpck_require__(n){var a=t[n];if(a!==undefined){return a.exports}var i=t[n]={exports:{}};var s=true;try{e[n](i,i.exports,__nccwpck_require__);s=false}finally{if(s)delete t[n]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(245);module.exports=n})();
|