twenty-sdk 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/dev.d.ts +1 -0
- package/dist/cli/constants/dev-api-key.d.ts +2 -0
- package/dist/cli/operations/index.d.ts +1 -0
- package/dist/cli/types.d.ts +1 -0
- package/dist/cli.cjs +11 -11
- package/dist/cli.mjs +372 -376
- package/dist/define/index.cjs +1 -1
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.mjs +4 -2
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs +1 -1
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.d.ts +3 -1
- package/dist/front-component/index.mjs +23 -17
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-DT3stfoz.js → get-function-input-schema-BZ7_XyUh-BkkT5sr_.js} +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-OrMskPPC.mjs → get-function-input-schema-BZ7_XyUh-Dd-bckv_.mjs} +1 -1
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +24 -22
- package/dist/{uninstall-BIllVz44.js → uninstall-BL0Kw7KG.js} +5 -5
- package/dist/{uninstall-XLw7db6v.mjs → uninstall-xvZY2Uuc.mjs} +28 -25
- package/package.json +2 -2
package/dist/define/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const sn=require("uuid"),X=require("zod"),ee=require("@sniptt/guards"),x=({config:e,errors:a=[],warnings:o=[]})=>({success:a.length===0,config:e,errors:a,warnings:o}),Tu=e=>{const a=[];return e.universalIdentifier||a.push("Agent must have a universalIdentifier"),e.name||a.push("Agent must have a name"),e.label||a.push("Agent must have a label"),e.prompt||a.push("Agent must have a prompt"),x({config:e,errors:a})},Ju=e=>{const a=[],o=[];return e.universalIdentifier||a.push("Application must have a universalIdentifier"),(!e.displayName||e.displayName.length===0)&&a.push("Application must have a non empty display name"),e.defaultRoleUniversalIdentifier&&o.push("`defaultRoleUniversalIdentifier` on defineApplication() is deprecated. Use defineApplicationRole() in your role file instead."),x({config:e,errors:a,warnings:o})};var L=(e=>(e.ACTOR="ACTOR",e.ADDRESS="ADDRESS",e.ARRAY="ARRAY",e.BOOLEAN="BOOLEAN",e.CURRENCY="CURRENCY",e.DATE="DATE",e.DATE_TIME="DATE_TIME",e.EMAILS="EMAILS",e.FILES="FILES",e.FULL_NAME="FULL_NAME",e.LINKS="LINKS",e.MORPH_RELATION="MORPH_RELATION",e.MULTI_SELECT="MULTI_SELECT",e.NUMBER="NUMBER",e.NUMERIC="NUMERIC",e.PHONES="PHONES",e.POSITION="POSITION",e.RATING="RATING",e.RAW_JSON="RAW_JSON",e.RELATION="RELATION",e.RICH_TEXT="RICH_TEXT",e.SELECT="SELECT",e.TEXT="TEXT",e.TS_VECTOR="TS_VECTOR",e.UUID="UUID",e))(L||{}),Da=(e=>(e.EMAIL="EMAIL",e.CALENDAR="CALENDAR",e.WORKFLOW="WORKFLOW",e.AGENT="AGENT",e.API="API",e.IMPORT="IMPORT",e.MANUAL="MANUAL",e.SYSTEM="SYSTEM",e.WEBHOOK="WEBHOOK",e.APPLICATION="APPLICATION",e))(Da||{});const Du={type:L.ACTOR,properties:[{name:"source",type:L.SELECT,hidden:!1,isRequired:!0,options:Object.keys(Da).map((e,a)=>({id:sn.v4(),label:`${Da[e].toLowerCase()}`,value:e,position:a}))},{name:"workspaceMemberId",type:L.UUID,hidden:"input",isRequired:!1},{name:"name",type:L.TEXT,hidden:"input",isRequired:!0},{name:"context",type:L.RAW_JSON,hidden:!1,isRequired:!1}]};var la=(e=>(e.MONDAY="MONDAY",e.SUNDAY="SUNDAY",e.SATURDAY="SATURDAY",e))(la||{}),ge=(e=>(e.DAY="DAY",e.MONTH="MONTH",e.QUARTER="QUARTER",e.YEAR="YEAR",e.WEEK="WEEK",e.DAY_OF_THE_WEEK="DAY_OF_THE_WEEK",e.MONTH_OF_THE_YEAR="MONTH_OF_THE_YEAR",e.QUARTER_OF_THE_YEAR="QUARTER_OF_THE_YEAR",e.NONE="NONE",e))(ge||{}),le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},J=(e=>(e.IS="IS",e.IS_NOT_NULL="IS_NOT_NULL",e.IS_NOT="IS_NOT",e.LESS_THAN_OR_EQUAL="LESS_THAN_OR_EQUAL",e.GREATER_THAN_OR_EQUAL="GREATER_THAN_OR_EQUAL",e.IS_BEFORE="IS_BEFORE",e.IS_AFTER="IS_AFTER",e.CONTAINS="CONTAINS",e.DOES_NOT_CONTAIN="DOES_NOT_CONTAIN",e.IS_EMPTY="IS_EMPTY",e.IS_NOT_EMPTY="IS_NOT_EMPTY",e.IS_RELATIVE="IS_RELATIVE",e.IS_IN_PAST="IS_IN_PAST",e.IS_IN_FUTURE="IS_IN_FUTURE",e.IS_TODAY="IS_TODAY",e.VECTOR_SEARCH="VECTOR_SEARCH",e))(J||{}),_=(e=>(e.Is="is",e.IsNotNull="isNotNull",e.IsNot="isNot",e.LessThanOrEqual="lessThan",e.GreaterThanOrEqual="greaterThan",e.IsBefore="isBefore",e.IsAfter="isAfter",e.Contains="contains",e.DoesNotContain="doesNotContain",e.IsEmpty="isEmpty",e.IsNotEmpty="isNotEmpty",e.IsRelative="isRelative",e.IsInPast="isInPast",e.IsInFuture="isInFuture",e.IsToday="isToday",e))(_||{}),rn=(e=>(e.MIN="MIN",e.MAX="MAX",e.AVG="AVG",e.SUM="SUM",e.COUNT="COUNT",e.COUNT_UNIQUE_VALUES="COUNT_UNIQUE_VALUES",e.COUNT_EMPTY="COUNT_EMPTY",e.COUNT_NOT_EMPTY="COUNT_NOT_EMPTY",e.COUNT_TRUE="COUNT_TRUE",e.COUNT_FALSE="COUNT_FALSE",e.PERCENTAGE_EMPTY="PERCENTAGE_EMPTY",e.PERCENTAGE_NOT_EMPTY="PERCENTAGE_NOT_EMPTY",e))(rn||{});const Mu={type:L.ADDRESS,properties:[{name:"addressStreet1",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressStreet2",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressCity",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressPostcode",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressState",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressCountry",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressLat",type:L.NUMERIC,hidden:!1,isRequired:!1},{name:"addressLng",type:L.NUMERIC,hidden:!1,isRequired:!1}]},Pu={type:L.CURRENCY,properties:[{name:"amountMicros",type:L.NUMERIC,hidden:!1,isRequired:!1},{name:"currencyCode",type:L.TEXT,hidden:!1,isRequired:!1}]},Au={type:L.EMAILS,properties:[{name:"primaryEmail",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"additionalEmails",type:L.RAW_JSON,hidden:!1,isRequired:!1}]},Xu={type:L.FULL_NAME,properties:[{name:"firstName",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!1},{name:"lastName",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!1}]},Nu={type:L.LINKS,properties:[{name:"primaryLinkLabel",type:L.TEXT,hidden:!1,isRequired:!1},{name:"primaryLinkUrl",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"secondaryLinks",type:L.RAW_JSON,hidden:!1,isRequired:!1}]},Hu={type:L.PHONES,properties:[{name:"primaryPhoneNumber",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"primaryPhoneCountryCode",type:L.TEXT,hidden:!1,isRequired:!1},{name:"primaryPhoneCallingCode",type:L.TEXT,hidden:!1,isRequired:!1},{name:"additionalPhones",type:L.RAW_JSON,hidden:!1,isRequired:!1}]},Eu={type:L.RICH_TEXT,properties:[{name:"blocknote",type:L.TEXT,hidden:!1,isRequired:!1},{name:"markdown",type:L.TEXT,hidden:!1,isRequired:!1}]};X.z.object({blocknote:X.z.string().nullable().optional(),markdown:X.z.string().nullable()});L.LINKS,L.CURRENCY,L.FULL_NAME,L.ADDRESS,L.ACTOR,L.EMAILS,L.PHONES,L.RICH_TEXT;var dn=(e=>(e.COPY="COPY",e.OPEN_LINK="OPEN_LINK",e.OPEN_IN_APP="OPEN_IN_APP",e))(dn||{}),ln=(e=>(e.FLOAT="float",e.INT="int",e.BIGINT="bigint",e))(ln||{}),gn=(e=>(e.RELATIVE="RELATIVE",e.USER_SETTINGS="USER_SETTINGS",e.CUSTOM="CUSTOM",e))(gn||{}),hn=(e=>(e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE",e))(hn||{}),cn=(e=>(e.VIEW="VIEW",e.FOLDER="FOLDER",e.LINK="LINK",e.OBJECT="OBJECT",e.RECORD="RECORD",e.PAGE_LAYOUT="PAGE_LAYOUT",e))(cn||{}),fn=(e=>(e.GRID="GRID",e.VERTICAL_LIST="VERTICAL_LIST",e.CANVAS="CANVAS",e))(fn||{}),bn=(e=>(e.CASCADE="CASCADE",e.RESTRICT="RESTRICT",e.SET_NULL="SET_NULL",e.NO_ACTION="NO_ACTION",e))(bn||{}),yn=(e=>(e.MANY_TO_ONE="MANY_TO_ONE",e.ONE_TO_MANY="ONE_TO_MANY",e))(yn||{}),pn=(e=>(e.DAY="DAY",e.WEEK="WEEK",e.MONTH="MONTH",e))(pn||{}),wn=(e=>(e.AND="AND",e.OR="OR",e.NOT="NOT",e))(wn||{}),mn=(e=>(e.INDEX="INDEX",e))(mn||{}),jn=(e=>(e.SIDE_PANEL="SIDE_PANEL",e.RECORD_PAGE="RECORD_PAGE",e))(jn||{}),je=(e=>(e.ASC="ASC",e.DESC="DESC",e))(je||{}),vn=(e=>(e.TABLE="TABLE",e.KANBAN="KANBAN",e.CALENDAR="CALENDAR",e.FIELDS_WIDGET="FIELDS_WIDGET",e.TABLE_WIDGET="TABLE_WIDGET",e))(vn||{}),Sn=(e=>(e.WORKSPACE="WORKSPACE",e.UNLISTED="UNLISTED",e))(Sn||{});const Ha=e=>{if(!e)return[];const a=[];for(const o of e)ee.isNonEmptyString(o.label)||a.push("Field must have a label"),ee.isNonEmptyString(o.name)||a.push(`Field "${o.label}" must have a name`),ee.isNonEmptyString(o.universalIdentifier)||a.push(`Field "${o.label}" must have a universalIdentifier`),(o.type===L.SELECT||o.type===L.MULTI_SELECT)&&(!Array.isArray(o.options)||o.options.length===0)&&a.push(`Field "${o.label}" is a SELECT/MULTI_SELECT type and must have options`),o.isUnique===!0&&(o.type===L.RELATION||o.type===L.MORPH_RELATION||o.type===L.FILES)&&a.push(`Field "${o.label}" of type ${o.type} cannot be unique`);return a},Bu=e=>{const a=[];e.objectUniversalIdentifier||a.push("Field must have an objectUniversalIdentifier");const o=Ha([e]);return a.push(...o),x({config:e,errors:a})},Fu=e=>{const a=[];return e.universalIdentifier||a.push("CommandMenuItem must have a universalIdentifier"),e.label||a.push("CommandMenuItem must have a label"),e.frontComponentUniversalIdentifier||a.push("CommandMenuItem must have a frontComponentUniversalIdentifier (the universalIdentifier of the front component this command opens)"),x({config:e,errors:a})},Ru=e=>{const a=[];return e.universalIdentifier||a.push("Front component must have a universalIdentifier"),e.component||a.push("Front component must have a component"),typeof e.component!="function"&&a.push("Front component component must be a React component"),x({config:e,errors:a})},xu=e=>{const a=[];return e.universalIdentifier||a.push("Logic function must have a universalIdentifier"),e.handler||a.push("Logic function must have a handler"),typeof e.handler!="function"&&a.push("Logic function handler must be a function"),e.httpRouteTriggerSettings&&(e.httpRouteTriggerSettings.path||a.push("Route trigger must have a path"),e.httpRouteTriggerSettings.httpMethod||a.push("Route trigger must have an httpMethod")),e.cronTriggerSettings&&(e.cronTriggerSettings.pattern||a.push("Cron trigger must have a pattern")),e.databaseEventTriggerSettings&&(e.databaseEventTriggerSettings.eventName||a.push("Database event trigger must have an eventName")),x({config:e,errors:a})},Gu=e=>{const a=[];return e.universalIdentifier||a.push("Post install logic function must have a universalIdentifier"),e.handler||a.push("Post install logic function must have a handler"),typeof e.handler!="function"&&a.push("Post install logic function handler must be a function"),x({config:e,errors:a})},_u=e=>{const a=[];return e.universalIdentifier||a.push("Pre install logic function must have a universalIdentifier"),e.handler||a.push("Pre install logic function must have a handler"),typeof e.handler!="function"&&a.push("Pre install logic function handler must be a function"),x({config:e,errors:a})},ei=/^[a-z][a-z0-9-]*$/,Qu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ai=["oauth"],Ou=e=>{const a=[];if(e.universalIdentifier?Qu.test(e.universalIdentifier)||a.push(`Connection provider universalIdentifier "${e.universalIdentifier}" must be a UUID. Generate one with \`uuidgen\` or any UUID v4 tool.`):a.push("Connection provider must have a universalIdentifier"),e.name?ei.test(e.name)||a.push(`Connection provider name "${e.name}" must match ${ei} (used in URLs)`):a.push("Connection provider must have a name"),e.displayName||a.push("Connection provider must have a displayName"),e.type?ai.includes(e.type)||a.push(`Connection provider type "${e.type}" is not supported. Supported types: ${ai.join(", ")}.`):a.push("Connection provider must declare a `type` (e.g. 'oauth')"),e.type==="oauth"){const o=e.oauth;o?(o.authorizationEndpoint||a.push("OAuth connection provider must have an authorizationEndpoint"),o.tokenEndpoint||a.push("OAuth connection provider must have a tokenEndpoint"),o.clientIdVariable||a.push("OAuth connection provider must reference a clientIdVariable (key of a serverVariable on defineApplication)"),o.clientSecretVariable||a.push("OAuth connection provider must reference a clientSecretVariable (key of a serverVariable on defineApplication)"),Array.isArray(o.scopes)||a.push("OAuth connection provider must declare a scopes array")):a.push("Connection provider with type 'oauth' must declare an `oauth` config block")}return x({config:e,errors:a})},Wu=e=>{const a=[];return e.universalIdentifier||a.push("NavigationMenuItem must have a universalIdentifier"),typeof e.position!="number"&&a.push("NavigationMenuItem must have a position"),x({config:e,errors:a})},ke=e=>!ee.isUndefined(e)&&!ee.isNull(e);var V="INUMBER",Ie="IOP1",Ze="IOP2",Te="IOP3",se="IVAR",ce="IVARNAME",Ce="IFUNCALL",ca="IFUNDEF",K="IEXPR",Ea="IEXPREVAL",fe="IMEMBER",fa="IENDSTATEMENT",Le="IARRAY";function A(e,a){this.type=e,this.value=a??0}A.prototype.toString=function(){switch(this.type){case V:case Ie:case Ze:case Te:case se:case ce:case fa:return this.value;case Ce:return"CALL "+this.value;case ca:return"DEF "+this.value;case Le:return"ARRAY "+this.value;case fe:return"."+this.value;default:return"Invalid Instruction"}};function ba(e){return new A(Ie,e)}function de(e){return new A(Ze,e)}function $n(e){return new A(Te,e)}function Ma(e,a,o,t,h){for(var l=[],b=[],c,r,d,s,y=0;y<e.length;y++){var u=e[y],n=u.type;if(n===V||n===ce)Array.isArray(u.value)?l.push.apply(l,Ma(u.value.map(function(i){return new A(V,i)}).concat(new A(Le,u.value.length)),a,o,t,h)):l.push(u);else if(n===se&&Object.hasOwn(h,u.value))u=new A(V,h[u.value]),l.push(u);else if(n===Ze&&l.length>1)r=l.pop(),c=l.pop(),s=o[u.value],u=new A(V,s(c.value,r.value)),l.push(u);else if(n===Te&&l.length>2)d=l.pop(),r=l.pop(),c=l.pop(),u.value==="?"?l.push(c.value?r.value:d.value):(s=t[u.value],u=new A(V,s(c.value,r.value,d.value)),l.push(u));else if(n===Ie&&l.length>0)c=l.pop(),s=a[u.value],u=new A(V,s(c.value)),l.push(u);else if(n===K){for(;l.length>0;)b.push(l.shift());b.push(new A(K,Ma(u.value,a,o,t,h)))}else if(n===fe&&l.length>0)c=l.pop(),l.push(new A(V,c.value[u.value]));else{for(;l.length>0;)b.push(l.shift());b.push(u)}}for(;l.length>0;)b.push(l.shift());return b}function Cn(e,a,o){for(var t=[],h=0;h<e.length;h++){var l=e[h],b=l.type;if(b===se&&l.value===a)for(var c=0;c<o.tokens.length;c++){var r=o.tokens[c],d;r.type===Ie?d=ba(r.value):r.type===Ze?d=de(r.value):r.type===Te?d=$n(r.value):d=new A(r.type,r.value),t.push(d)}else b===K?t.push(new A(K,Cn(l.value,a,o))):t.push(l)}return t}function ja(e,a,o){if(Object.values(a.functions).includes(e))return!0;for(const h of Object.values(o))if(typeof h=="object"&&h!==null){for(const l of Object.values(h))if(l===e){const b=Object.freeze({abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,clz32:Math.clz32,cos:Math.cos,exp:Math.exp,floor:Math.floor,imul:Math.imul,fround:Math.fround,f16round:Math.f16round,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,log10:Math.log10,log2:Math.log2,log1p:Math.log1p,expm1:Math.expm1,cosh:Math.cosh,sinh:Math.sinh,tanh:Math.tanh,acosh:Math.acosh,asinh:Math.asinh,atanh:Math.atanh,hypot:Math.hypot,trunc:Math.trunc,sign:Math.sign,cbrt:Math.cbrt});for(var t of Object.getOwnPropertyNames(b))if(b[t]===l)return!0;return Object.values(a.functions).includes(l)}}return!1}function he(e,a,o){var t=[],h,l,b,c,r,d;if(Ba(e))return oe(e,o);for(var s=e.length,y=0;y<s;y++){var u=e[y],n=u.type;if(n===V||n===ce)t.push(u.value);else if(n===Ze)l=t.pop(),h=t.pop(),u.value==="and"?t.push(h?!!he(l,a,o):!1):u.value==="or"?t.push(h?!0:!!he(l,a,o)):u.value==="="?(c=a.binaryOps[u.value],t.push(c(h,he(l,a,o),o))):(c=a.binaryOps[u.value],t.push(c(oe(h,o),oe(l,o))));else if(n===Te)b=t.pop(),l=t.pop(),h=t.pop(),u.value==="?"?t.push(he(h?l:b,a,o)):(c=a.ternaryOps[u.value],t.push(c(oe(h,o),oe(l,o),oe(b,o))));else if(n===se){if(/^__proto__|prototype|constructor$/.test(u.value))throw new Error("prototype access detected");if(u.value in a.functions)t.push(a.functions[u.value]);else if(u.value in a.unaryOps&&a.parser.isOperatorEnabled(u.value))t.push(a.unaryOps[u.value]);else{var i=o[u.value];if(i!==void 0){if(typeof i=="function"&&!ja(i,a,o))throw new Error("Variable references an unallowed function: "+u.value);t.push(i)}else throw new Error("undefined variable: "+u.value)}}else if(n===Ie)h=t.pop(),c=a.unaryOps[u.value],t.push(c(oe(h,o)));else if(n===Ce){for(d=u.value,r=[];d-- >0;)r.unshift(oe(t.pop(),o));if(c=t.pop(),!ja(c,a,o))throw new Error("Is not an allowed function.");if(c.apply&&c.call)t.push(c.apply(void 0,r));else throw new Error(c+" is not a function")}else if(n===ca)t.push((function(){for(var g=t.pop(),f=[],p=u.value;p-- >0;)f.unshift(t.pop());var m=t.pop(),S=function(){for(var j=Object.assign({},o),w=0,$=f.length;w<$;w++)j[f[w]]=arguments[w];return he(g,a,j)};return a.functions["lambda_"+a.functions.__counter++]=S,o[m]=S,S})());else if(n===K)t.push(Ku(u,a));else if(n===Ea)t.push(u);else if(n===fe){if(h=t.pop(),/^__proto__|prototype|constructor$/.test(u.value))throw new Error("prototype access detected in MEMBER");if(typeof h=="object"&&typeof h[u.value]=="function"&&!ja(h[u.value],a,o))throw new Error("Is not an allowed function in MEMBER.");t.push(h[u.value])}else if(n===fa)t.pop();else if(n===Le){for(d=u.value,r=[];d-- >0;)r.unshift(t.pop());t.push(r)}else throw new Error("invalid Expression")}if(t.length>1)throw new Error("invalid Expression (parity)");return t[0]===0?0:oe(t[0],o)}function Ku(e,a,o){return Ba(e)?e:{type:Ea,value:function(t){return he(e.value,a,t)}}}function Ba(e){return e&&e.type===Ea}function oe(e,a){return Ba(e)?e.value(a):e}function Fa(e,a){for(var o=[],t,h,l,b,c,r,d=0;d<e.length;d++){var s=e[d],y=s.type;if(y===V)typeof s.value=="number"&&s.value<0?o.push("("+s.value+")"):Array.isArray(s.value)?o.push("["+s.value.map(ii).join(", ")+"]"):o.push(ii(s.value));else if(y===Ze)h=o.pop(),t=o.pop(),b=s.value,a?b==="^"?o.push("Math.pow("+t+", "+h+")"):b==="and"?o.push("(!!"+t+" && !!"+h+")"):b==="or"?o.push("(!!"+t+" || !!"+h+")"):b==="||"?o.push("(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }(("+t+"),("+h+")))"):b==="=="?o.push("("+t+" === "+h+")"):b==="!="?o.push("("+t+" !== "+h+")"):b==="["?o.push(t+"[("+h+") | 0]"):o.push("("+t+" "+b+" "+h+")"):b==="["?o.push(t+"["+h+"]"):o.push("("+t+" "+b+" "+h+")");else if(y===Te)if(l=o.pop(),h=o.pop(),t=o.pop(),b=s.value,b==="?")o.push("("+t+" ? "+h+" : "+l+")");else throw new Error("invalid Expression");else if(y===se||y===ce)o.push(s.value);else if(y===Ie)t=o.pop(),b=s.value,b==="-"||b==="+"?o.push("("+b+t+")"):a?b==="not"?o.push("(!"+t+")"):b==="!"?o.push("fac("+t+")"):o.push(b+"("+t+")"):b==="!"?o.push("("+t+"!)"):o.push("("+b+" "+t+")");else if(y===Ce){for(r=s.value,c=[];r-- >0;)c.unshift(o.pop());b=o.pop(),o.push(b+"("+c.join(", ")+")")}else if(y===ca){for(h=o.pop(),r=s.value,c=[];r-- >0;)c.unshift(o.pop());t=o.pop(),a?o.push("("+t+" = function("+c.join(", ")+") { return "+h+" })"):o.push("("+t+"("+c.join(", ")+") = "+h+")")}else if(y===fe)t=o.pop(),o.push(t+"."+s.value);else if(y===Le){for(r=s.value,c=[];r-- >0;)c.unshift(o.pop());o.push("["+c.join(", ")+"]")}else if(y===K)o.push("("+Fa(s.value,a)+")");else if(y!==fa)throw new Error("invalid Expression")}return o.length>1&&(a?o=[o.join(",")]:o=[o.join(";")]),String(o[0])}function ii(e){return typeof e=="string"?JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):e}function ve(e,a){for(var o=0;o<e.length;o++)if(e[o]===a)return!0;return!1}function Ra(e,a,o){o=o||{};for(var t=!!o.withMembers,h=null,l=0;l<e.length;l++){var b=e[l];b.type===se||b.type===ce?!t&&!ve(a,b.value)?a.push(b.value):(h!==null&&(ve(a,h)||a.push(h)),h=b.value):b.type===fe&&t&&h!==null?h+="."+b.value:b.type===K?Ra(b.value,a,o):h!==null&&(ve(a,h)||a.push(h),h=null)}h!==null&&!ve(a,h)&&a.push(h)}function ne(e,a){this.tokens=e,this.parser=a,this.unaryOps=a.unaryOps,this.binaryOps=a.binaryOps,this.ternaryOps=a.ternaryOps,this.functions=a.functions}ne.prototype.simplify=function(e){return e=e||{},new ne(Ma(this.tokens,this.unaryOps,this.binaryOps,this.ternaryOps,e),this.parser)};ne.prototype.substitute=function(e,a){return a instanceof ne||(a=this.parser.parse(String(a))),new ne(Cn(this.tokens,e,a),this.parser)};ne.prototype.evaluate=function(e){return e=e||{},he(this.tokens,this,e)};ne.prototype.toString=function(){return Fa(this.tokens,!1)};ne.prototype.symbols=function(e){e=e||{};var a=[];return Ra(this.tokens,a,e),a};ne.prototype.variables=function(e){e=e||{};var a=[];Ra(this.tokens,a,e);var o=this.functions;return a.filter(function(t){return!(t in o)})};ne.prototype.toJSFunction=function(e,a){var o=this,t=new Function(e,"with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return "+Fa(this.simplify(a).tokens,!0)+"; }");return function(){return t.apply(o,arguments)}};var Xe="TEOF",N="TOP",ya="TNUMBER",Ln="TSTRING",re="TPAREN",Ye="TBRACKET",pa="TCOMMA",xa="TNAME",Ga="TSEMICOLON";function Yn(e,a,o){this.type=e,this.value=a,this.index=o}Yn.prototype.toString=function(){return this.type+": "+this.value};function B(e,a){this.pos=0,this.current=null,this.unaryOps=e.unaryOps,this.binaryOps=e.binaryOps,this.ternaryOps=e.ternaryOps,this.consts=e.consts,this.expression=a,this.savedPosition=0,this.savedCurrent=null,this.options=e.options,this.parser=e}B.prototype.newToken=function(e,a,o){return new Yn(e,a,o??this.pos)};B.prototype.save=function(){this.savedPosition=this.pos,this.savedCurrent=this.current};B.prototype.restore=function(){this.pos=this.savedPosition,this.current=this.savedCurrent};B.prototype.next=function(){if(this.pos>=this.expression.length)return this.newToken(Xe,"EOF");if(this.isWhitespace()||this.isComment())return this.next();if(this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName())return this.current;this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')};B.prototype.isString=function(){var e=!1,a=this.pos,o=this.expression.charAt(a);if(o==="'"||o==='"')for(var t=this.expression.indexOf(o,a+1);t>=0&&this.pos<this.expression.length;){if(this.pos=t+1,this.expression.charAt(t-1)!=="\\"){var h=this.expression.substring(a+1,t);this.current=this.newToken(Ln,this.unescape(h),a),e=!0;break}t=this.expression.indexOf(o,t+1)}return e};B.prototype.isParen=function(){var e=this.expression.charAt(this.pos);return e==="("||e===")"?(this.current=this.newToken(re,e),this.pos++,!0):!1};B.prototype.isBracket=function(){var e=this.expression.charAt(this.pos);return(e==="["||e==="]")&&this.isOperatorEnabled("[")?(this.current=this.newToken(Ye,e),this.pos++,!0):!1};B.prototype.isComma=function(){var e=this.expression.charAt(this.pos);return e===","?(this.current=this.newToken(pa,","),this.pos++,!0):!1};B.prototype.isSemicolon=function(){var e=this.expression.charAt(this.pos);return e===";"?(this.current=this.newToken(Ga,";"),this.pos++,!0):!1};B.prototype.isConst=function(){for(var e=this.pos,a=e;a<this.expression.length;a++){var o=this.expression.charAt(a);if(o.toUpperCase()===o.toLowerCase()&&(a===this.pos||o!=="_"&&o!=="."&&(o<"0"||o>"9")))break}if(a>e){var t=this.expression.substring(e,a);if(t in this.consts)return this.current=this.newToken(ya,this.consts[t]),this.pos+=t.length,!0}return!1};B.prototype.isNamedOp=function(){for(var e=this.pos,a=e;a<this.expression.length;a++){var o=this.expression.charAt(a);if(o.toUpperCase()===o.toLowerCase()&&(a===this.pos||o!=="_"&&(o<"0"||o>"9")))break}if(a>e){var t=this.expression.substring(e,a);if(this.isOperatorEnabled(t)&&(t in this.binaryOps||t in this.unaryOps||t in this.ternaryOps))return this.current=this.newToken(N,t),this.pos+=t.length,!0}return!1};B.prototype.isName=function(){for(var e=this.pos,a=e,o=!1;a<this.expression.length;a++){var t=this.expression.charAt(a);if(t.toUpperCase()===t.toLowerCase()){if(a===this.pos&&(t==="$"||t==="_")){t==="_"&&(o=!0);continue}else if(a===this.pos||!o||t!=="_"&&(t<"0"||t>"9"))break}else o=!0}if(o){var h=this.expression.substring(e,a);return this.current=this.newToken(xa,h),this.pos+=h.length,!0}return!1};B.prototype.isWhitespace=function(){for(var e=!1,a=this.expression.charAt(this.pos);(a===" "||a===" "||a===`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const sn=require("uuid"),X=require("zod"),ee=require("@sniptt/guards"),x=({config:e,errors:a=[],warnings:o=[]})=>({success:a.length===0,config:e,errors:a,warnings:o}),Tu=e=>{const a=[];return e.universalIdentifier||a.push("Agent must have a universalIdentifier"),e.name||a.push("Agent must have a name"),e.label||a.push("Agent must have a label"),e.prompt||a.push("Agent must have a prompt"),x({config:e,errors:a})},Ju=e=>{const a=[],o=[];return e.universalIdentifier||a.push("Application must have a universalIdentifier"),(!e.displayName||e.displayName.length===0)&&a.push("Application must have a non empty display name"),e.defaultRoleUniversalIdentifier&&o.push("`defaultRoleUniversalIdentifier` on defineApplication() is deprecated. Use defineApplicationRole() in your role file instead."),x({config:e,errors:a,warnings:o})};var L=(e=>(e.ACTOR="ACTOR",e.ADDRESS="ADDRESS",e.ARRAY="ARRAY",e.BOOLEAN="BOOLEAN",e.CURRENCY="CURRENCY",e.DATE="DATE",e.DATE_TIME="DATE_TIME",e.EMAILS="EMAILS",e.FILES="FILES",e.FULL_NAME="FULL_NAME",e.LINKS="LINKS",e.MORPH_RELATION="MORPH_RELATION",e.MULTI_SELECT="MULTI_SELECT",e.NUMBER="NUMBER",e.NUMERIC="NUMERIC",e.PHONES="PHONES",e.POSITION="POSITION",e.RATING="RATING",e.RAW_JSON="RAW_JSON",e.RELATION="RELATION",e.RICH_TEXT="RICH_TEXT",e.SELECT="SELECT",e.TEXT="TEXT",e.TS_VECTOR="TS_VECTOR",e.UUID="UUID",e))(L||{}),Da=(e=>(e.EMAIL="EMAIL",e.CALENDAR="CALENDAR",e.WORKFLOW="WORKFLOW",e.AGENT="AGENT",e.API="API",e.IMPORT="IMPORT",e.MANUAL="MANUAL",e.SYSTEM="SYSTEM",e.WEBHOOK="WEBHOOK",e.APPLICATION="APPLICATION",e))(Da||{});const Du={type:L.ACTOR,properties:[{name:"source",type:L.SELECT,hidden:!1,isRequired:!0,options:Object.keys(Da).map((e,a)=>({id:sn.v4(),label:`${Da[e].toLowerCase()}`,value:e,position:a}))},{name:"workspaceMemberId",type:L.UUID,hidden:"input",isRequired:!1},{name:"name",type:L.TEXT,hidden:"input",isRequired:!0},{name:"context",type:L.RAW_JSON,hidden:!1,isRequired:!1}]};var la=(e=>(e.MONDAY="MONDAY",e.SUNDAY="SUNDAY",e.SATURDAY="SATURDAY",e))(la||{}),ge=(e=>(e.DAY="DAY",e.MONTH="MONTH",e.QUARTER="QUARTER",e.YEAR="YEAR",e.WEEK="WEEK",e.DAY_OF_THE_WEEK="DAY_OF_THE_WEEK",e.MONTH_OF_THE_YEAR="MONTH_OF_THE_YEAR",e.QUARTER_OF_THE_YEAR="QUARTER_OF_THE_YEAR",e.NONE="NONE",e))(ge||{}),le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},J=(e=>(e.IS="IS",e.IS_NOT_NULL="IS_NOT_NULL",e.IS_NOT="IS_NOT",e.LESS_THAN_OR_EQUAL="LESS_THAN_OR_EQUAL",e.GREATER_THAN_OR_EQUAL="GREATER_THAN_OR_EQUAL",e.IS_BEFORE="IS_BEFORE",e.IS_AFTER="IS_AFTER",e.CONTAINS="CONTAINS",e.DOES_NOT_CONTAIN="DOES_NOT_CONTAIN",e.IS_EMPTY="IS_EMPTY",e.IS_NOT_EMPTY="IS_NOT_EMPTY",e.IS_RELATIVE="IS_RELATIVE",e.IS_IN_PAST="IS_IN_PAST",e.IS_IN_FUTURE="IS_IN_FUTURE",e.IS_TODAY="IS_TODAY",e.VECTOR_SEARCH="VECTOR_SEARCH",e))(J||{}),_=(e=>(e.Is="is",e.IsNotNull="isNotNull",e.IsNot="isNot",e.LessThanOrEqual="lessThan",e.GreaterThanOrEqual="greaterThan",e.IsBefore="isBefore",e.IsAfter="isAfter",e.Contains="contains",e.DoesNotContain="doesNotContain",e.IsEmpty="isEmpty",e.IsNotEmpty="isNotEmpty",e.IsRelative="isRelative",e.IsInPast="isInPast",e.IsInFuture="isInFuture",e.IsToday="isToday",e))(_||{}),rn=(e=>(e.MIN="MIN",e.MAX="MAX",e.AVG="AVG",e.SUM="SUM",e.COUNT="COUNT",e.COUNT_UNIQUE_VALUES="COUNT_UNIQUE_VALUES",e.COUNT_EMPTY="COUNT_EMPTY",e.COUNT_NOT_EMPTY="COUNT_NOT_EMPTY",e.COUNT_TRUE="COUNT_TRUE",e.COUNT_FALSE="COUNT_FALSE",e.PERCENTAGE_EMPTY="PERCENTAGE_EMPTY",e.PERCENTAGE_NOT_EMPTY="PERCENTAGE_NOT_EMPTY",e))(rn||{});const Mu={type:L.ADDRESS,properties:[{name:"addressStreet1",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressStreet2",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressCity",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressPostcode",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressState",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressCountry",type:L.TEXT,hidden:!1,isRequired:!1},{name:"addressLat",type:L.NUMERIC,hidden:!1,isRequired:!1},{name:"addressLng",type:L.NUMERIC,hidden:!1,isRequired:!1}]},Pu={type:L.CURRENCY,properties:[{name:"amountMicros",type:L.NUMERIC,hidden:!1,isRequired:!1},{name:"currencyCode",type:L.TEXT,hidden:!1,isRequired:!1}]},Au={type:L.EMAILS,properties:[{name:"primaryEmail",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"additionalEmails",type:L.RAW_JSON,hidden:!1,isRequired:!1}]},Xu={type:L.FULL_NAME,properties:[{name:"firstName",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!1},{name:"lastName",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!1}]},Nu={type:L.LINKS,properties:[{name:"primaryLinkLabel",type:L.TEXT,hidden:!1,isRequired:!1},{name:"primaryLinkUrl",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"secondaryLinks",type:L.RAW_JSON,hidden:!1,isRequired:!1}]},Hu={type:L.PHONES,properties:[{name:"primaryPhoneNumber",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"primaryPhoneCountryCode",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"primaryPhoneCallingCode",type:L.TEXT,hidden:!1,isRequired:!1,isIncludedInUniqueConstraint:!0},{name:"additionalPhones",type:L.RAW_JSON,hidden:!1,isRequired:!1}]},Eu={type:L.RICH_TEXT,properties:[{name:"blocknote",type:L.TEXT,hidden:!1,isRequired:!1},{name:"markdown",type:L.TEXT,hidden:!1,isRequired:!1}]};X.z.object({blocknote:X.z.string().nullable().optional(),markdown:X.z.string().nullable()});L.LINKS,L.CURRENCY,L.FULL_NAME,L.ADDRESS,L.ACTOR,L.EMAILS,L.PHONES,L.RICH_TEXT;var dn=(e=>(e.COPY="COPY",e.OPEN_LINK="OPEN_LINK",e.OPEN_IN_APP="OPEN_IN_APP",e))(dn||{}),ln=(e=>(e.FLOAT="float",e.INT="int",e.BIGINT="bigint",e))(ln||{}),gn=(e=>(e.RELATIVE="RELATIVE",e.USER_SETTINGS="USER_SETTINGS",e.CUSTOM="CUSTOM",e))(gn||{}),hn=(e=>(e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE",e))(hn||{}),cn=(e=>(e.VIEW="VIEW",e.FOLDER="FOLDER",e.LINK="LINK",e.OBJECT="OBJECT",e.RECORD="RECORD",e.PAGE_LAYOUT="PAGE_LAYOUT",e))(cn||{}),fn=(e=>(e.GRID="GRID",e.VERTICAL_LIST="VERTICAL_LIST",e.CANVAS="CANVAS",e))(fn||{}),bn=(e=>(e.CASCADE="CASCADE",e.RESTRICT="RESTRICT",e.SET_NULL="SET_NULL",e.NO_ACTION="NO_ACTION",e))(bn||{}),yn=(e=>(e.MANY_TO_ONE="MANY_TO_ONE",e.ONE_TO_MANY="ONE_TO_MANY",e))(yn||{}),pn=(e=>(e.DAY="DAY",e.WEEK="WEEK",e.MONTH="MONTH",e))(pn||{}),wn=(e=>(e.AND="AND",e.OR="OR",e.NOT="NOT",e))(wn||{}),mn=(e=>(e.INDEX="INDEX",e))(mn||{}),jn=(e=>(e.SIDE_PANEL="SIDE_PANEL",e.RECORD_PAGE="RECORD_PAGE",e))(jn||{}),je=(e=>(e.ASC="ASC",e.DESC="DESC",e))(je||{}),vn=(e=>(e.TABLE="TABLE",e.KANBAN="KANBAN",e.CALENDAR="CALENDAR",e.FIELDS_WIDGET="FIELDS_WIDGET",e.TABLE_WIDGET="TABLE_WIDGET",e))(vn||{}),Sn=(e=>(e.WORKSPACE="WORKSPACE",e.UNLISTED="UNLISTED",e))(Sn||{});const Ha=e=>{if(!e)return[];const a=[];for(const o of e)ee.isNonEmptyString(o.label)||a.push("Field must have a label"),ee.isNonEmptyString(o.name)||a.push(`Field "${o.label}" must have a name`),ee.isNonEmptyString(o.universalIdentifier)||a.push(`Field "${o.label}" must have a universalIdentifier`),(o.type===L.SELECT||o.type===L.MULTI_SELECT)&&(!Array.isArray(o.options)||o.options.length===0)&&a.push(`Field "${o.label}" is a SELECT/MULTI_SELECT type and must have options`),o.isUnique===!0&&(o.type===L.RELATION||o.type===L.MORPH_RELATION||o.type===L.FILES)&&a.push(`Field "${o.label}" of type ${o.type} cannot be unique`);return a},Bu=e=>{const a=[];e.objectUniversalIdentifier||a.push("Field must have an objectUniversalIdentifier");const o=Ha([e]);return a.push(...o),x({config:e,errors:a})},Fu=e=>{const a=[];return e.universalIdentifier||a.push("CommandMenuItem must have a universalIdentifier"),e.label||a.push("CommandMenuItem must have a label"),e.frontComponentUniversalIdentifier||a.push("CommandMenuItem must have a frontComponentUniversalIdentifier (the universalIdentifier of the front component this command opens)"),x({config:e,errors:a})},Ru=e=>{const a=[];return e.universalIdentifier||a.push("Front component must have a universalIdentifier"),e.component||a.push("Front component must have a component"),typeof e.component!="function"&&a.push("Front component component must be a React component"),x({config:e,errors:a})},xu=e=>{const a=[];return e.universalIdentifier||a.push("Logic function must have a universalIdentifier"),e.handler||a.push("Logic function must have a handler"),typeof e.handler!="function"&&a.push("Logic function handler must be a function"),e.httpRouteTriggerSettings&&(e.httpRouteTriggerSettings.path||a.push("Route trigger must have a path"),e.httpRouteTriggerSettings.httpMethod||a.push("Route trigger must have an httpMethod")),e.cronTriggerSettings&&(e.cronTriggerSettings.pattern||a.push("Cron trigger must have a pattern")),e.databaseEventTriggerSettings&&(e.databaseEventTriggerSettings.eventName||a.push("Database event trigger must have an eventName")),x({config:e,errors:a})},Gu=e=>{const a=[];return e.universalIdentifier||a.push("Post install logic function must have a universalIdentifier"),e.handler||a.push("Post install logic function must have a handler"),typeof e.handler!="function"&&a.push("Post install logic function handler must be a function"),x({config:e,errors:a})},_u=e=>{const a=[];return e.universalIdentifier||a.push("Pre install logic function must have a universalIdentifier"),e.handler||a.push("Pre install logic function must have a handler"),typeof e.handler!="function"&&a.push("Pre install logic function handler must be a function"),x({config:e,errors:a})},ei=/^[a-z][a-z0-9-]*$/,Qu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ai=["oauth"],Ou=e=>{const a=[];if(e.universalIdentifier?Qu.test(e.universalIdentifier)||a.push(`Connection provider universalIdentifier "${e.universalIdentifier}" must be a UUID. Generate one with \`uuidgen\` or any UUID v4 tool.`):a.push("Connection provider must have a universalIdentifier"),e.name?ei.test(e.name)||a.push(`Connection provider name "${e.name}" must match ${ei} (used in URLs)`):a.push("Connection provider must have a name"),e.displayName||a.push("Connection provider must have a displayName"),e.type?ai.includes(e.type)||a.push(`Connection provider type "${e.type}" is not supported. Supported types: ${ai.join(", ")}.`):a.push("Connection provider must declare a `type` (e.g. 'oauth')"),e.type==="oauth"){const o=e.oauth;o?(o.authorizationEndpoint||a.push("OAuth connection provider must have an authorizationEndpoint"),o.tokenEndpoint||a.push("OAuth connection provider must have a tokenEndpoint"),o.clientIdVariable||a.push("OAuth connection provider must reference a clientIdVariable (key of a serverVariable on defineApplication)"),o.clientSecretVariable||a.push("OAuth connection provider must reference a clientSecretVariable (key of a serverVariable on defineApplication)"),Array.isArray(o.scopes)||a.push("OAuth connection provider must declare a scopes array")):a.push("Connection provider with type 'oauth' must declare an `oauth` config block")}return x({config:e,errors:a})},Wu=e=>{const a=[];return e.universalIdentifier||a.push("NavigationMenuItem must have a universalIdentifier"),typeof e.position!="number"&&a.push("NavigationMenuItem must have a position"),x({config:e,errors:a})},ke=e=>!ee.isUndefined(e)&&!ee.isNull(e);var V="INUMBER",Ie="IOP1",Ze="IOP2",Te="IOP3",se="IVAR",ce="IVARNAME",Ce="IFUNCALL",ca="IFUNDEF",K="IEXPR",Ea="IEXPREVAL",fe="IMEMBER",fa="IENDSTATEMENT",Le="IARRAY";function A(e,a){this.type=e,this.value=a??0}A.prototype.toString=function(){switch(this.type){case V:case Ie:case Ze:case Te:case se:case ce:case fa:return this.value;case Ce:return"CALL "+this.value;case ca:return"DEF "+this.value;case Le:return"ARRAY "+this.value;case fe:return"."+this.value;default:return"Invalid Instruction"}};function ba(e){return new A(Ie,e)}function de(e){return new A(Ze,e)}function $n(e){return new A(Te,e)}function Ma(e,a,o,t,h){for(var l=[],b=[],c,r,d,s,y=0;y<e.length;y++){var u=e[y],n=u.type;if(n===V||n===ce)Array.isArray(u.value)?l.push.apply(l,Ma(u.value.map(function(i){return new A(V,i)}).concat(new A(Le,u.value.length)),a,o,t,h)):l.push(u);else if(n===se&&Object.hasOwn(h,u.value))u=new A(V,h[u.value]),l.push(u);else if(n===Ze&&l.length>1)r=l.pop(),c=l.pop(),s=o[u.value],u=new A(V,s(c.value,r.value)),l.push(u);else if(n===Te&&l.length>2)d=l.pop(),r=l.pop(),c=l.pop(),u.value==="?"?l.push(c.value?r.value:d.value):(s=t[u.value],u=new A(V,s(c.value,r.value,d.value)),l.push(u));else if(n===Ie&&l.length>0)c=l.pop(),s=a[u.value],u=new A(V,s(c.value)),l.push(u);else if(n===K){for(;l.length>0;)b.push(l.shift());b.push(new A(K,Ma(u.value,a,o,t,h)))}else if(n===fe&&l.length>0)c=l.pop(),l.push(new A(V,c.value[u.value]));else{for(;l.length>0;)b.push(l.shift());b.push(u)}}for(;l.length>0;)b.push(l.shift());return b}function Cn(e,a,o){for(var t=[],h=0;h<e.length;h++){var l=e[h],b=l.type;if(b===se&&l.value===a)for(var c=0;c<o.tokens.length;c++){var r=o.tokens[c],d;r.type===Ie?d=ba(r.value):r.type===Ze?d=de(r.value):r.type===Te?d=$n(r.value):d=new A(r.type,r.value),t.push(d)}else b===K?t.push(new A(K,Cn(l.value,a,o))):t.push(l)}return t}function ja(e,a,o){if(Object.values(a.functions).includes(e))return!0;for(const h of Object.values(o))if(typeof h=="object"&&h!==null){for(const l of Object.values(h))if(l===e){const b=Object.freeze({abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,clz32:Math.clz32,cos:Math.cos,exp:Math.exp,floor:Math.floor,imul:Math.imul,fround:Math.fround,f16round:Math.f16round,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,log10:Math.log10,log2:Math.log2,log1p:Math.log1p,expm1:Math.expm1,cosh:Math.cosh,sinh:Math.sinh,tanh:Math.tanh,acosh:Math.acosh,asinh:Math.asinh,atanh:Math.atanh,hypot:Math.hypot,trunc:Math.trunc,sign:Math.sign,cbrt:Math.cbrt});for(var t of Object.getOwnPropertyNames(b))if(b[t]===l)return!0;return Object.values(a.functions).includes(l)}}return!1}function he(e,a,o){var t=[],h,l,b,c,r,d;if(Ba(e))return oe(e,o);for(var s=e.length,y=0;y<s;y++){var u=e[y],n=u.type;if(n===V||n===ce)t.push(u.value);else if(n===Ze)l=t.pop(),h=t.pop(),u.value==="and"?t.push(h?!!he(l,a,o):!1):u.value==="or"?t.push(h?!0:!!he(l,a,o)):u.value==="="?(c=a.binaryOps[u.value],t.push(c(h,he(l,a,o),o))):(c=a.binaryOps[u.value],t.push(c(oe(h,o),oe(l,o))));else if(n===Te)b=t.pop(),l=t.pop(),h=t.pop(),u.value==="?"?t.push(he(h?l:b,a,o)):(c=a.ternaryOps[u.value],t.push(c(oe(h,o),oe(l,o),oe(b,o))));else if(n===se){if(/^__proto__|prototype|constructor$/.test(u.value))throw new Error("prototype access detected");if(u.value in a.functions)t.push(a.functions[u.value]);else if(u.value in a.unaryOps&&a.parser.isOperatorEnabled(u.value))t.push(a.unaryOps[u.value]);else{var i=o[u.value];if(i!==void 0){if(typeof i=="function"&&!ja(i,a,o))throw new Error("Variable references an unallowed function: "+u.value);t.push(i)}else throw new Error("undefined variable: "+u.value)}}else if(n===Ie)h=t.pop(),c=a.unaryOps[u.value],t.push(c(oe(h,o)));else if(n===Ce){for(d=u.value,r=[];d-- >0;)r.unshift(oe(t.pop(),o));if(c=t.pop(),!ja(c,a,o))throw new Error("Is not an allowed function.");if(c.apply&&c.call)t.push(c.apply(void 0,r));else throw new Error(c+" is not a function")}else if(n===ca)t.push((function(){for(var g=t.pop(),f=[],p=u.value;p-- >0;)f.unshift(t.pop());var m=t.pop(),S=function(){for(var j=Object.assign({},o),w=0,$=f.length;w<$;w++)j[f[w]]=arguments[w];return he(g,a,j)};return a.functions["lambda_"+a.functions.__counter++]=S,o[m]=S,S})());else if(n===K)t.push(Ku(u,a));else if(n===Ea)t.push(u);else if(n===fe){if(h=t.pop(),/^__proto__|prototype|constructor$/.test(u.value))throw new Error("prototype access detected in MEMBER");if(typeof h=="object"&&typeof h[u.value]=="function"&&!ja(h[u.value],a,o))throw new Error("Is not an allowed function in MEMBER.");t.push(h[u.value])}else if(n===fa)t.pop();else if(n===Le){for(d=u.value,r=[];d-- >0;)r.unshift(t.pop());t.push(r)}else throw new Error("invalid Expression")}if(t.length>1)throw new Error("invalid Expression (parity)");return t[0]===0?0:oe(t[0],o)}function Ku(e,a,o){return Ba(e)?e:{type:Ea,value:function(t){return he(e.value,a,t)}}}function Ba(e){return e&&e.type===Ea}function oe(e,a){return Ba(e)?e.value(a):e}function Fa(e,a){for(var o=[],t,h,l,b,c,r,d=0;d<e.length;d++){var s=e[d],y=s.type;if(y===V)typeof s.value=="number"&&s.value<0?o.push("("+s.value+")"):Array.isArray(s.value)?o.push("["+s.value.map(ii).join(", ")+"]"):o.push(ii(s.value));else if(y===Ze)h=o.pop(),t=o.pop(),b=s.value,a?b==="^"?o.push("Math.pow("+t+", "+h+")"):b==="and"?o.push("(!!"+t+" && !!"+h+")"):b==="or"?o.push("(!!"+t+" || !!"+h+")"):b==="||"?o.push("(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }(("+t+"),("+h+")))"):b==="=="?o.push("("+t+" === "+h+")"):b==="!="?o.push("("+t+" !== "+h+")"):b==="["?o.push(t+"[("+h+") | 0]"):o.push("("+t+" "+b+" "+h+")"):b==="["?o.push(t+"["+h+"]"):o.push("("+t+" "+b+" "+h+")");else if(y===Te)if(l=o.pop(),h=o.pop(),t=o.pop(),b=s.value,b==="?")o.push("("+t+" ? "+h+" : "+l+")");else throw new Error("invalid Expression");else if(y===se||y===ce)o.push(s.value);else if(y===Ie)t=o.pop(),b=s.value,b==="-"||b==="+"?o.push("("+b+t+")"):a?b==="not"?o.push("(!"+t+")"):b==="!"?o.push("fac("+t+")"):o.push(b+"("+t+")"):b==="!"?o.push("("+t+"!)"):o.push("("+b+" "+t+")");else if(y===Ce){for(r=s.value,c=[];r-- >0;)c.unshift(o.pop());b=o.pop(),o.push(b+"("+c.join(", ")+")")}else if(y===ca){for(h=o.pop(),r=s.value,c=[];r-- >0;)c.unshift(o.pop());t=o.pop(),a?o.push("("+t+" = function("+c.join(", ")+") { return "+h+" })"):o.push("("+t+"("+c.join(", ")+") = "+h+")")}else if(y===fe)t=o.pop(),o.push(t+"."+s.value);else if(y===Le){for(r=s.value,c=[];r-- >0;)c.unshift(o.pop());o.push("["+c.join(", ")+"]")}else if(y===K)o.push("("+Fa(s.value,a)+")");else if(y!==fa)throw new Error("invalid Expression")}return o.length>1&&(a?o=[o.join(",")]:o=[o.join(";")]),String(o[0])}function ii(e){return typeof e=="string"?JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):e}function ve(e,a){for(var o=0;o<e.length;o++)if(e[o]===a)return!0;return!1}function Ra(e,a,o){o=o||{};for(var t=!!o.withMembers,h=null,l=0;l<e.length;l++){var b=e[l];b.type===se||b.type===ce?!t&&!ve(a,b.value)?a.push(b.value):(h!==null&&(ve(a,h)||a.push(h)),h=b.value):b.type===fe&&t&&h!==null?h+="."+b.value:b.type===K?Ra(b.value,a,o):h!==null&&(ve(a,h)||a.push(h),h=null)}h!==null&&!ve(a,h)&&a.push(h)}function ne(e,a){this.tokens=e,this.parser=a,this.unaryOps=a.unaryOps,this.binaryOps=a.binaryOps,this.ternaryOps=a.ternaryOps,this.functions=a.functions}ne.prototype.simplify=function(e){return e=e||{},new ne(Ma(this.tokens,this.unaryOps,this.binaryOps,this.ternaryOps,e),this.parser)};ne.prototype.substitute=function(e,a){return a instanceof ne||(a=this.parser.parse(String(a))),new ne(Cn(this.tokens,e,a),this.parser)};ne.prototype.evaluate=function(e){return e=e||{},he(this.tokens,this,e)};ne.prototype.toString=function(){return Fa(this.tokens,!1)};ne.prototype.symbols=function(e){e=e||{};var a=[];return Ra(this.tokens,a,e),a};ne.prototype.variables=function(e){e=e||{};var a=[];Ra(this.tokens,a,e);var o=this.functions;return a.filter(function(t){return!(t in o)})};ne.prototype.toJSFunction=function(e,a){var o=this,t=new Function(e,"with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return "+Fa(this.simplify(a).tokens,!0)+"; }");return function(){return t.apply(o,arguments)}};var Xe="TEOF",N="TOP",ya="TNUMBER",Ln="TSTRING",re="TPAREN",Ye="TBRACKET",pa="TCOMMA",xa="TNAME",Ga="TSEMICOLON";function Yn(e,a,o){this.type=e,this.value=a,this.index=o}Yn.prototype.toString=function(){return this.type+": "+this.value};function B(e,a){this.pos=0,this.current=null,this.unaryOps=e.unaryOps,this.binaryOps=e.binaryOps,this.ternaryOps=e.ternaryOps,this.consts=e.consts,this.expression=a,this.savedPosition=0,this.savedCurrent=null,this.options=e.options,this.parser=e}B.prototype.newToken=function(e,a,o){return new Yn(e,a,o??this.pos)};B.prototype.save=function(){this.savedPosition=this.pos,this.savedCurrent=this.current};B.prototype.restore=function(){this.pos=this.savedPosition,this.current=this.savedCurrent};B.prototype.next=function(){if(this.pos>=this.expression.length)return this.newToken(Xe,"EOF");if(this.isWhitespace()||this.isComment())return this.next();if(this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName())return this.current;this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')};B.prototype.isString=function(){var e=!1,a=this.pos,o=this.expression.charAt(a);if(o==="'"||o==='"')for(var t=this.expression.indexOf(o,a+1);t>=0&&this.pos<this.expression.length;){if(this.pos=t+1,this.expression.charAt(t-1)!=="\\"){var h=this.expression.substring(a+1,t);this.current=this.newToken(Ln,this.unescape(h),a),e=!0;break}t=this.expression.indexOf(o,t+1)}return e};B.prototype.isParen=function(){var e=this.expression.charAt(this.pos);return e==="("||e===")"?(this.current=this.newToken(re,e),this.pos++,!0):!1};B.prototype.isBracket=function(){var e=this.expression.charAt(this.pos);return(e==="["||e==="]")&&this.isOperatorEnabled("[")?(this.current=this.newToken(Ye,e),this.pos++,!0):!1};B.prototype.isComma=function(){var e=this.expression.charAt(this.pos);return e===","?(this.current=this.newToken(pa,","),this.pos++,!0):!1};B.prototype.isSemicolon=function(){var e=this.expression.charAt(this.pos);return e===";"?(this.current=this.newToken(Ga,";"),this.pos++,!0):!1};B.prototype.isConst=function(){for(var e=this.pos,a=e;a<this.expression.length;a++){var o=this.expression.charAt(a);if(o.toUpperCase()===o.toLowerCase()&&(a===this.pos||o!=="_"&&o!=="."&&(o<"0"||o>"9")))break}if(a>e){var t=this.expression.substring(e,a);if(t in this.consts)return this.current=this.newToken(ya,this.consts[t]),this.pos+=t.length,!0}return!1};B.prototype.isNamedOp=function(){for(var e=this.pos,a=e;a<this.expression.length;a++){var o=this.expression.charAt(a);if(o.toUpperCase()===o.toLowerCase()&&(a===this.pos||o!=="_"&&(o<"0"||o>"9")))break}if(a>e){var t=this.expression.substring(e,a);if(this.isOperatorEnabled(t)&&(t in this.binaryOps||t in this.unaryOps||t in this.ternaryOps))return this.current=this.newToken(N,t),this.pos+=t.length,!0}return!1};B.prototype.isName=function(){for(var e=this.pos,a=e,o=!1;a<this.expression.length;a++){var t=this.expression.charAt(a);if(t.toUpperCase()===t.toLowerCase()){if(a===this.pos&&(t==="$"||t==="_")){t==="_"&&(o=!0);continue}else if(a===this.pos||!o||t!=="_"&&(t<"0"||t>"9"))break}else o=!0}if(o){var h=this.expression.substring(e,a);return this.current=this.newToken(xa,h),this.pos+=h.length,!0}return!1};B.prototype.isWhitespace=function(){for(var e=!1,a=this.expression.charAt(this.pos);(a===" "||a===" "||a===`
|
|
2
2
|
`||a==="\r")&&(e=!0,this.pos++,!(this.pos>=this.expression.length));)a=this.expression.charAt(this.pos);return e};var Uu=/^[0-9a-f]{4}$/i;B.prototype.unescape=function(e){var a=e.indexOf("\\");if(a<0)return e;for(var o=e.substring(0,a);a>=0;){var t=e.charAt(++a);switch(t){case"'":o+="'";break;case'"':o+='"';break;case"\\":o+="\\";break;case"/":o+="/";break;case"b":o+="\b";break;case"f":o+="\f";break;case"n":o+=`
|
|
3
3
|
`;break;case"r":o+="\r";break;case"t":o+=" ";break;case"u":var h=e.substring(a+1,a+5);Uu.test(h)||this.parseError("Illegal escape sequence: \\u"+h),o+=String.fromCharCode(parseInt(h,16)),a+=4;break;default:throw this.parseError('Illegal escape sequence: "\\'+t+'"')}++a;var l=e.indexOf("\\",a);o+=e.substring(a,l<0?e.length:l),a=l}return o};B.prototype.isComment=function(){var e=this.expression.charAt(this.pos);return e==="/"&&this.expression.charAt(this.pos+1)==="*"?(this.pos=this.expression.indexOf("*/",this.pos)+2,this.pos===1&&(this.pos=this.expression.length),!0):!1};B.prototype.isRadixInteger=function(){var e=this.pos;if(e>=this.expression.length-2||this.expression.charAt(e)!=="0")return!1;++e;var a,o;if(this.expression.charAt(e)==="x")a=16,o=/^[0-9a-f]$/i,++e;else if(this.expression.charAt(e)==="b")a=2,o=/^[01]$/i,++e;else return!1;for(var t=!1,h=e;e<this.expression.length;){var l=this.expression.charAt(e);if(o.test(l))e++,t=!0;else break}return t&&(this.current=this.newToken(ya,parseInt(this.expression.substring(h,e),a)),this.pos=e),t};B.prototype.isNumber=function(){for(var e=!1,a=this.pos,o=a,t=a,h=!1,l=!1,b;a<this.expression.length&&(b=this.expression.charAt(a),b>="0"&&b<="9"||!h&&b===".");)b==="."?h=!0:l=!0,a++,e=l;if(e&&(t=a),b==="e"||b==="E"){a++;for(var c=!0,r=!1;a<this.expression.length;){if(b=this.expression.charAt(a),c&&(b==="+"||b==="-"))c=!1;else if(b>="0"&&b<="9")r=!0,c=!1;else break;a++}r||(a=t)}return e?(this.current=this.newToken(ya,parseFloat(this.expression.substring(o,a))),this.pos=a):this.pos=t,e};B.prototype.isOperator=function(){var e=this.pos,a=this.expression.charAt(this.pos);if(a==="+"||a==="-"||a==="*"||a==="/"||a==="%"||a==="^"||a==="?"||a===":"||a===".")this.current=this.newToken(N,a);else if(a==="∙"||a==="•")this.current=this.newToken(N,"*");else if(a===">")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(N,">="),this.pos++):this.current=this.newToken(N,">");else if(a==="<")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(N,"<="),this.pos++):this.current=this.newToken(N,"<");else if(a==="|")if(this.expression.charAt(this.pos+1)==="|")this.current=this.newToken(N,"||"),this.pos++;else return!1;else if(a==="=")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(N,"=="),this.pos++):this.current=this.newToken(N,a);else if(a==="!")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(N,"!="),this.pos++):this.current=this.newToken(N,a);else return!1;return this.pos++,this.isOperatorEnabled(this.current.value)?!0:(this.pos=e,!1)};B.prototype.isOperatorEnabled=function(e){return this.parser.isOperatorEnabled(e)};B.prototype.getCoordinates=function(){var e=0,a,o=-1;do e++,a=this.pos-o,o=this.expression.indexOf(`
|
|
4
4
|
`,o+1);while(o>=0&&o<this.pos);return{line:e,column:a}};B.prototype.parseError=function(e){var a=this.getCoordinates();throw new Error("parse error ["+a.line+":"+a.column+"]: "+e)};function E(e,a,o){this.parser=e,this.tokens=a,this.current=null,this.nextToken=null,this.next(),this.savedCurrent=null,this.savedNextToken=null,this.allowMemberAccess=o.allowMemberAccess!==!1}E.prototype.next=function(){return this.current=this.nextToken,this.nextToken=this.tokens.next()};E.prototype.tokenMatches=function(e,a){return typeof a>"u"?!0:Array.isArray(a)?ve(a,e.value):typeof a=="function"?a(e):e.value===a};E.prototype.save=function(){this.savedCurrent=this.current,this.savedNextToken=this.nextToken,this.tokens.save()};E.prototype.restore=function(){this.tokens.restore(),this.current=this.savedCurrent,this.nextToken=this.savedNextToken};E.prototype.accept=function(e,a){return this.nextToken.type===e&&this.tokenMatches(this.nextToken,a)?(this.next(),!0):!1};E.prototype.expect=function(e,a){if(!this.accept(e,a)){var o=this.tokens.getCoordinates();throw new Error("parse error ["+o.line+":"+o.column+"]: Expected "+(a||e))}};E.prototype.parseAtom=function(e){var a=this.tokens.unaryOps;function o(h){return h.value in a}if(this.accept(xa)||this.accept(N,o))e.push(new A(se,this.current.value));else if(this.accept(ya))e.push(new A(V,this.current.value));else if(this.accept(Ln))e.push(new A(V,this.current.value));else if(this.accept(re,"("))this.parseExpression(e),this.expect(re,")");else if(this.accept(Ye,"["))if(this.accept(Ye,"]"))e.push(new A(Le,0));else{var t=this.parseArrayList(e);e.push(new A(Le,t))}else throw new Error("unexpected "+this.nextToken)};E.prototype.parseExpression=function(e){var a=[];this.parseUntilEndStatement(e,a)||(this.parseVariableAssignmentExpression(a),!this.parseUntilEndStatement(e,a)&&this.pushExpression(e,a))};E.prototype.pushExpression=function(e,a){for(var o=0,t=a.length;o<t;o++)e.push(a[o])};E.prototype.parseUntilEndStatement=function(e,a){return this.accept(Ga)?(this.nextToken&&this.nextToken.type!==Xe&&!(this.nextToken.type===re&&this.nextToken.value===")")&&a.push(new A(fa)),this.nextToken.type!==Xe&&this.parseExpression(a),e.push(new A(K,a)),!0):!1};E.prototype.parseArrayList=function(e){for(var a=0;!this.accept(Ye,"]");)for(this.parseExpression(e),++a;this.accept(pa);)this.parseExpression(e),++a;return a};E.prototype.parseVariableAssignmentExpression=function(e){for(this.parseConditionalExpression(e);this.accept(N,"=");){var a=e.pop(),o=[],t=e.length-1;if(a.type===Ce){if(!this.tokens.isOperatorEnabled("()="))throw new Error("function definition is not permitted");for(var h=0,l=a.value+1;h<l;h++){var b=t-h;e[b].type===se&&(e[b]=new A(ce,e[b].value))}this.parseVariableAssignmentExpression(o),e.push(new A(K,o)),e.push(new A(ca,a.value));continue}if(a.type!==se&&a.type!==fe)throw new Error("expected variable for assignment");this.parseVariableAssignmentExpression(o),e.push(new A(ce,a.value)),e.push(new A(K,o)),e.push(de("="))}};E.prototype.parseConditionalExpression=function(e){for(this.parseOrExpression(e);this.accept(N,"?");){var a=[],o=[];this.parseConditionalExpression(a),this.expect(N,":"),this.parseConditionalExpression(o),e.push(new A(K,a)),e.push(new A(K,o)),e.push($n("?"))}};E.prototype.parseOrExpression=function(e){for(this.parseAndExpression(e);this.accept(N,"or");){var a=[];this.parseAndExpression(a),e.push(new A(K,a)),e.push(de("or"))}};E.prototype.parseAndExpression=function(e){for(this.parseComparison(e);this.accept(N,"and");){var a=[];this.parseComparison(a),e.push(new A(K,a)),e.push(de("and"))}};var zu=["==","!=","<","<=",">=",">","in"];E.prototype.parseComparison=function(e){for(this.parseAddSub(e);this.accept(N,zu);){var a=this.current;this.parseAddSub(e),e.push(de(a.value))}};var qu=["+","-","||"];E.prototype.parseAddSub=function(e){for(this.parseTerm(e);this.accept(N,qu);){var a=this.current;this.parseTerm(e),e.push(de(a.value))}};var Vu=["*","/","%"];E.prototype.parseTerm=function(e){for(this.parseFactor(e);this.accept(N,Vu);){var a=this.current;this.parseFactor(e),e.push(de(a.value))}};E.prototype.parseFactor=function(e){var a=this.tokens.unaryOps;function o(h){return h.value in a}if(this.save(),this.accept(N,o)){if(this.current.value!=="-"&&this.current.value!=="+"){if(this.nextToken.type===re&&this.nextToken.value==="("){this.restore(),this.parseExponential(e);return}else if(this.nextToken.type===Ga||this.nextToken.type===pa||this.nextToken.type===Xe||this.nextToken.type===re&&this.nextToken.value===")"){this.restore(),this.parseAtom(e);return}}var t=this.current;this.parseFactor(e),e.push(ba(t.value))}else this.parseExponential(e)};E.prototype.parseExponential=function(e){for(this.parsePostfixExpression(e);this.accept(N,"^");)this.parseFactor(e),e.push(de("^"))};E.prototype.parsePostfixExpression=function(e){for(this.parseFunctionCall(e);this.accept(N,"!");)e.push(ba("!"))};E.prototype.parseFunctionCall=function(e){var a=this.tokens.unaryOps;function o(l){return l.value in a}if(this.accept(N,o)){var t=this.current;this.parseAtom(e),e.push(ba(t.value))}else for(this.parseMemberExpression(e);this.accept(re,"(");)if(this.accept(re,")"))e.push(new A(Ce,0));else{var h=this.parseArgumentList(e);e.push(new A(Ce,h))}};E.prototype.parseArgumentList=function(e){for(var a=0;!this.accept(re,")");)for(this.parseExpression(e),++a;this.accept(pa);)this.parseExpression(e),++a;return a};E.prototype.parseMemberExpression=function(e){for(this.parseAtom(e);this.accept(N,".")||this.accept(Ye,"[");){var a=this.current;if(a.value==="."){if(!this.allowMemberAccess)throw new Error('unexpected ".", member access is not permitted');this.expect(xa),e.push(new A(fe,this.current.value))}else if(a.value==="["){if(!this.tokens.isOperatorEnabled("["))throw new Error('unexpected "[]", arrays are disabled');this.parseExpression(e),this.expect(Ye,"]"),e.push(de("["))}else throw new Error("unexpected symbol: "+a.value)}};function eo(e,a){return Number(e)+Number(a)}function ao(e,a){return e-a}function io(e,a){return e*a}function no(e,a){return e/a}function uo(e,a){return e%a}function oo(e,a){return Array.isArray(e)&&Array.isArray(a)?e.concat(a):""+e+a}function to(e,a){return e===a}function so(e,a){return e!==a}function ro(e,a){return e>a}function lo(e,a){return e<a}function go(e,a){return e>=a}function ho(e,a){return e<=a}function co(e,a){return!!(e&&a)}function fo(e,a){return!!(e||a)}function bo(e,a){return ve(a,e)}function yo(e){return(Math.exp(e)-Math.exp(-e))/2}function po(e){return(Math.exp(e)+Math.exp(-e))/2}function wo(e){return e===1/0?1:e===-1/0?-1:(Math.exp(e)-Math.exp(-e))/(Math.exp(e)+Math.exp(-e))}function mo(e){return e===-1/0?e:Math.log(e+Math.sqrt(e*e+1))}function jo(e){return Math.log(e+Math.sqrt(e*e-1))}function vo(e){return Math.log((1+e)/(1-e))/2}function ni(e){return Math.log(e)*Math.LOG10E}function So(e){return-e}function $o(e){return!e}function Co(e){return e<0?Math.ceil(e):Math.floor(e)}function Lo(e){return Math.random()*(e||1)}function ui(e){return _a(e+1)}function Yo(e){return isFinite(e)&&e===Math.round(e)}var ko=4.7421875,va=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function _a(e){var a,o;if(Yo(e)){if(e<=0)return isFinite(e)?1/0:NaN;if(e>171)return 1/0;for(var t=e-2,h=e-1;t>1;)h*=t,t--;return h===0&&(h=1),h}if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*_a(1-e));if(e>=171.35)return 1/0;if(e>85){var l=e*e,b=l*e,c=b*e,r=c*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*l)-139/(51840*b)-571/(2488320*c)+163879/(209018880*r)+5246819/(75246796800*r*e))}--e,o=va[0];for(var d=1;d<va.length;++d)o+=va[d]/(e+d);return a=e+ko+.5,Math.sqrt(2*Math.PI)*Math.pow(a,e+.5)*Math.exp(-a)*o}function Io(e){return Array.isArray(e)?e.length:String(e).length}function oi(){for(var e=0,a=0,o=0;o<arguments.length;o++){var t=Math.abs(arguments[o]),h;a<t?(h=a/t,e=e*h*h+1,a=t):t>0?(h=t/a,e+=h*h):e+=t}return a===1/0?1/0:a*Math.sqrt(e)}function ti(e,a,o){return e?a:o}function Zo(e,a){return typeof a>"u"||+a==0?Math.round(e):(e=+e,a=-+a,isNaN(e)||!(typeof a=="number"&&a%1===0)?NaN:(e=e.toString().split("e"),e=Math.round(+(e[0]+"e"+(e[1]?+e[1]-a:-a))),e=e.toString().split("e"),+(e[0]+"e"+(e[1]?+e[1]+a:a))))}function To(e,a,o){return o&&(o[e]=a),a}function Jo(e,a){return e[a|0]}function Do(e){return arguments.length===1&&Array.isArray(e)?Math.max.apply(Math,e):Math.max.apply(Math,arguments)}function Mo(e){return arguments.length===1&&Array.isArray(e)?Math.min.apply(Math,e):Math.min.apply(Math,arguments)}function Po(e,a){if(typeof e!="function")throw new Error("First argument to map is not a function");if(!Array.isArray(a))throw new Error("Second argument to map is not an array");return a.map(function(o,t){return e(o,t)})}function Ao(e,a,o){if(typeof e!="function")throw new Error("First argument to fold is not a function");if(!Array.isArray(o))throw new Error("Second argument to fold is not an array");return o.reduce(function(t,h,l){return e(t,h,l)},a)}function Xo(e,a){if(typeof e!="function")throw new Error("First argument to filter is not a function");if(!Array.isArray(a))throw new Error("Second argument to filter is not an array");return a.filter(function(o,t){return e(o,t)})}function No(e,a){if(!(Array.isArray(a)||typeof a=="string"))throw new Error("Second argument to indexOf is not a string or array");return a.indexOf(e)}function Ho(e,a){if(!Array.isArray(a))throw new Error("Second argument to join is not an array");return a.join(e)}function Eo(e){return(e>0)-(e<0)||+e}var si=1/3;function Bo(e){return e<0?-Math.pow(-e,si):Math.pow(e,si)}function Fo(e){return Math.exp(e)-1}function Ro(e){return Math.log(1+e)}function xo(e){return Math.log(e)/Math.LN2}function Go(e){if(!Array.isArray(e))throw new Error("Sum argument is not an array");return e.reduce(function(a,o){return a+Number(o)},0)}function be(e){this.options=e||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||yo,cosh:Math.cosh||po,tanh:Math.tanh||wo,asinh:Math.asinh||mo,acosh:Math.acosh||jo,atanh:Math.atanh||vo,sqrt:Math.sqrt,cbrt:Math.cbrt||Bo,log:Math.log,log2:Math.log2||xo,ln:Math.log,lg:Math.log10||ni,log10:Math.log10||ni,expm1:Math.expm1||Fo,log1p:Math.log1p||Ro,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||Co,"-":So,"+":Number,exp:Math.exp,not:$o,length:Io,"!":ui,sign:Math.sign||Eo},this.binaryOps={"+":eo,"-":ao,"*":io,"/":no,"%":uo,"^":Math.pow,"||":oo,"==":to,"!=":so,">":ro,"<":lo,">=":go,"<=":ho,and:co,or:fo,in:bo,"=":To,"[":Jo},this.ternaryOps={"?":ti},this.functions={random:Lo,fac:ui,min:Mo,max:Do,hypot:Math.hypot||oi,pyt:Math.hypot||oi,pow:Math.pow,atan2:Math.atan2,if:ti,gamma:_a,roundTo:Zo,map:Po,fold:Ao,filter:Xo,indexOf:No,join:Ho,sum:Go},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}be.prototype.parse=function(e){var a=[],o=new E(this,new B(this,e),{allowMemberAccess:this.options.allowMemberAccess});return o.parseExpression(a),o.expect(Xe,"EOF"),new ne(a,this)};be.prototype.evaluate=function(e,a){return this.parse(e).evaluate(a)};var kn=new be;be.parse=function(e){return kn.parse(e)};be.evaluate=function(e,a){return kn.parse(e).evaluate(a)};var ri={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","^":"power","!":"factorial","<":"comparison",">":"comparison","<=":"comparison",">=":"comparison","==":"comparison","!=":"comparison","||":"concatenate",and:"logical",or:"logical",not:"logical","?":"conditional",":":"conditional","=":"assignment","[":"array","()=":"fndef"};function _o(e){return Object.hasOwn(ri,e)?ri[e]:e}be.prototype.isOperatorEnabled=function(e){var a=_o(e),o=this.options.operators||{};return!(a in o)||!!o[a]};var Be={exports:{}},Fe={exports:{}},ie={},O={},di;function U(){if(di)return O;di=1,O.__esModule=!0,O.extend=h,O.indexOf=r,O.escapeExpression=d,O.isEmpty=s,O.createFrame=y,O.blockParams=u,O.appendContextPath=n;var e={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},a=/[&<>"'`=]/g,o=/[&<>"'`=]/;function t(i){return e[i]}function h(i){for(var g=1;g<arguments.length;g++)for(var f in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],f)&&(i[f]=arguments[g][f]);return i}var l=Object.prototype.toString;O.toString=l;var b=function(g){return typeof g=="function"};b(/x/)&&(O.isFunction=b=function(i){return typeof i=="function"&&l.call(i)==="[object Function]"}),O.isFunction=b;var c=Array.isArray||function(i){return i&&typeof i=="object"?l.call(i)==="[object Array]":!1};O.isArray=c;function r(i,g){for(var f=0,p=i.length;f<p;f++)if(i[f]===g)return f;return-1}function d(i){if(typeof i!="string"){if(i&&i.toHTML)return i.toHTML();if(i==null)return"";if(!i)return i+"";i=""+i}return o.test(i)?i.replace(a,t):i}function s(i){return!i&&i!==0?!0:!!(c(i)&&i.length===0)}function y(i){var g=h({},i);return g._parent=i,g}function u(i,g){return i.path=g,i}function n(i,g){return(i?i+".":"")+g}return O}var Re={exports:{}},li;function ae(){return li||(li=1,(function(e,a){a.__esModule=!0;var o=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function t(h,l){var b=l&&l.loc,c=void 0,r=void 0,d=void 0,s=void 0;b&&(c=b.start.line,r=b.end.line,d=b.start.column,s=b.end.column,h+=" - "+c+":"+d);for(var y=Error.prototype.constructor.call(this,h),u=0;u<o.length;u++)this[o[u]]=y[o[u]];Error.captureStackTrace&&Error.captureStackTrace(this,t);try{b&&(this.lineNumber=c,this.endLineNumber=r,Object.defineProperty?(Object.defineProperty(this,"column",{value:d,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:s,enumerable:!0})):(this.column=d,this.endColumn=s))}catch{}}t.prototype=new Error,a.default=t,e.exports=a.default})(Re,Re.exports)),Re.exports}var Me={},xe={exports:{}},gi;function Qo(){return gi||(gi=1,(function(e,a){a.__esModule=!0;var o=U();a.default=function(t){t.registerHelper("blockHelperMissing",function(h,l){var b=l.inverse,c=l.fn;if(h===!0)return c(this);if(h===!1||h==null)return b(this);if(o.isArray(h))return h.length>0?(l.ids&&(l.ids=[l.name]),t.helpers.each(h,l)):b(this);if(l.data&&l.ids){var r=o.createFrame(l.data);r.contextPath=o.appendContextPath(l.data.contextPath,l.name),l={data:r}}return c(h,l)})},e.exports=a.default})(xe,xe.exports)),xe.exports}var Ge={exports:{}},hi;function Oo(){return hi||(hi=1,(function(e,a){a.__esModule=!0;function o(b){return b&&b.__esModule?b:{default:b}}var t=U(),h=ae(),l=o(h);a.default=function(b){b.registerHelper("each",function(c,r){if(!r)throw new l.default("Must pass iterator to #each");var d=r.fn,s=r.inverse,y=0,u="",n=void 0,i=void 0;r.data&&r.ids&&(i=t.appendContextPath(r.data.contextPath,r.ids[0])+"."),t.isFunction(c)&&(c=c.call(this)),r.data&&(n=t.createFrame(r.data));function g(j,w,$){n&&(n.key=j,n.index=w,n.first=w===0,n.last=!!$,i&&(n.contextPath=i+j)),u=u+d(c[j],{data:n,blockParams:t.blockParams([c[j],j],[i+j,null])})}if(c&&typeof c=="object")if(t.isArray(c))for(var f=c.length;y<f;y++)y in c&&g(y,y,y===c.length-1);else if(typeof Symbol=="function"&&c[Symbol.iterator]){for(var p=[],m=c[Symbol.iterator](),S=m.next();!S.done;S=m.next())p.push(S.value);c=p;for(var f=c.length;y<f;y++)g(y,y,y===c.length-1)}else(function(){var j=void 0;Object.keys(c).forEach(function(w){j!==void 0&&g(j,y-1),j=w,y++}),j!==void 0&&g(j,y-1,!0)})();return y===0&&(u=s(this)),u})},e.exports=a.default})(Ge,Ge.exports)),Ge.exports}var _e={exports:{}},ci;function Wo(){return ci||(ci=1,(function(e,a){a.__esModule=!0;function o(l){return l&&l.__esModule?l:{default:l}}var t=ae(),h=o(t);a.default=function(l){l.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new h.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},e.exports=a.default})(_e,_e.exports)),_e.exports}var Qe={exports:{}},fi;function Ko(){return fi||(fi=1,(function(e,a){a.__esModule=!0;function o(b){return b&&b.__esModule?b:{default:b}}var t=U(),h=ae(),l=o(h);a.default=function(b){b.registerHelper("if",function(c,r){if(arguments.length!=2)throw new l.default("#if requires exactly one argument");return t.isFunction(c)&&(c=c.call(this)),!r.hash.includeZero&&!c||t.isEmpty(c)?r.inverse(this):r.fn(this)}),b.registerHelper("unless",function(c,r){if(arguments.length!=2)throw new l.default("#unless requires exactly one argument");return b.helpers.if.call(this,c,{fn:r.inverse,inverse:r.fn,hash:r.hash})})},e.exports=a.default})(Qe,Qe.exports)),Qe.exports}var Oe={exports:{}},bi;function Uo(){return bi||(bi=1,(function(e,a){a.__esModule=!0,a.default=function(o){o.registerHelper("log",function(){for(var t=[void 0],h=arguments[arguments.length-1],l=0;l<arguments.length-1;l++)t.push(arguments[l]);var b=1;h.hash.level!=null?b=h.hash.level:h.data&&h.data.level!=null&&(b=h.data.level),t[0]=b,o.log.apply(o,t)})},e.exports=a.default})(Oe,Oe.exports)),Oe.exports}var We={exports:{}},yi;function zo(){return yi||(yi=1,(function(e,a){a.__esModule=!0,a.default=function(o){o.registerHelper("lookup",function(t,h,l){return t&&l.lookupProperty(t,h)})},e.exports=a.default})(We,We.exports)),We.exports}var Ke={exports:{}},pi;function qo(){return pi||(pi=1,(function(e,a){a.__esModule=!0;function o(b){return b&&b.__esModule?b:{default:b}}var t=U(),h=ae(),l=o(h);a.default=function(b){b.registerHelper("with",function(c,r){if(arguments.length!=2)throw new l.default("#with requires exactly one argument");t.isFunction(c)&&(c=c.call(this));var d=r.fn;if(t.isEmpty(c))return r.inverse(this);var s=r.data;return r.data&&r.ids&&(s=t.createFrame(r.data),s.contextPath=t.appendContextPath(r.data.contextPath,r.ids[0])),d(c,{data:s,blockParams:t.blockParams([c],[s&&s.contextPath])})})},e.exports=a.default})(Ke,Ke.exports)),Ke.exports}var wi;function In(){if(wi)return Me;wi=1,Me.__esModule=!0,Me.registerDefaultHelpers=g,Me.moveHelperToHooks=f;function e(p){return p&&p.__esModule?p:{default:p}}var a=Qo(),o=e(a),t=Oo(),h=e(t),l=Wo(),b=e(l),c=Ko(),r=e(c),d=Uo(),s=e(d),y=zo(),u=e(y),n=qo(),i=e(n);function g(p){o.default(p),h.default(p),b.default(p),r.default(p),s.default(p),u.default(p),i.default(p)}function f(p,m,S){p.helpers[m]&&(p.hooks[m]=p.helpers[m],S||(p.helpers[m]=void 0))}return Me}var Ue={},ze={exports:{}},mi;function Vo(){return mi||(mi=1,(function(e,a){a.__esModule=!0;var o=U();a.default=function(t){t.registerDecorator("inline",function(h,l,b,c){var r=h;return l.partials||(l.partials={},r=function(d,s){var y=b.partials;b.partials=o.extend({},y,l.partials);var u=h(d,s);return b.partials=y,u}),l.partials[c.args[0]]=c.fn,r})},e.exports=a.default})(ze,ze.exports)),ze.exports}var ji;function et(){if(ji)return Ue;ji=1,Ue.__esModule=!0,Ue.registerDefaultDecorators=t;function e(h){return h&&h.__esModule?h:{default:h}}var a=Vo(),o=e(a);function t(h){o.default(h)}return Ue}var qe={exports:{}},vi;function Zn(){return vi||(vi=1,(function(e,a){a.__esModule=!0;var o=U(),t={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(l){if(typeof l=="string"){var b=o.indexOf(t.methodMap,l.toLowerCase());b>=0?l=b:l=parseInt(l,10)}return l},log:function(l){if(l=t.lookupLevel(l),typeof console<"u"&&t.lookupLevel(t.level)<=l){var b=t.methodMap[l];console[b]||(b="log");for(var c=arguments.length,r=Array(c>1?c-1:0),d=1;d<c;d++)r[d-1]=arguments[d];console[b].apply(console,r)}}};a.default=t,e.exports=a.default})(qe,qe.exports)),qe.exports}var pe={},Si;function Tn(){if(Si)return pe;Si=1,pe.__esModule=!0,pe.createProtoAccessControl=l,pe.resultIsAllowed=b,pe.resetLoggedProperties=d;function e(s){return s&&s.__esModule?s:{default:s}}var a=U(),o=Zn(),t=e(o),h=Object.create(null);function l(s){var y=Object.create(null);y.__proto__=!1,a.extend(y,s.allowedProtoProperties);var u=Object.create(null);return u.constructor=!1,u.__defineGetter__=!1,u.__defineSetter__=!1,u.__lookupGetter__=!1,u.__lookupSetter__=!1,a.extend(u,s.allowedProtoMethods),{properties:{whitelist:y,defaultValue:s.allowProtoPropertiesByDefault},methods:{whitelist:u,defaultValue:s.allowProtoMethodsByDefault}}}function b(s,y,u){return c(typeof s=="function"?y.methods:y.properties,u)}function c(s,y){return s.whitelist[y]!==void 0?s.whitelist[y]===!0:s.defaultValue!==void 0?s.defaultValue:(r(y),!1)}function r(s){h[s]!==!0&&(h[s]=!0,t.default.log("error",'Handlebars: Access has been denied to resolve the property "'+s+`" because it is not an "own property" of its parent.
|