@opra/client 0.11.4 → 0.11.5
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/cjs/index.min.mjs +1 -1
- package/esm/index.min.mjs +1 -1
- package/package.json +10 -8
package/cjs/index.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("fast-tokenizer"),t=require("@browsery/fs"),r=require("@browsery/i18next"),s=require("path-browserify"),i=require("putil-varhelpers"),n=require("@browsery/antlr4"),o=require("@browsery/highland"),a=require("uid");require("reflect-metadata");var c=require("lodash.omit"),l=require("putil-promisify"),h=require("putil-isplainobject"),u=require("putil-merge"),p=require("events");require("@browsery/http-parser"),require("@browsery/stream");var d=require("rxjs");function _(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe}function f(e){return _(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState}function y(e){return null!==e&&"string"==typeof e.host&&"string"==typeof e.href}const m=/^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/i;const T=/\\(.)/g;function x(e){return e.replace(T,"$1")}const E=Object.getPrototypeOf(r).constructor,g=[];class R extends E{async init(e,t){const r="object"==typeof e?e:{},s="function"==typeof e?e:t;try{const e=await super.init(r,s),t=this.services.formatter;if(t.add("lowercase",((e,t)=>e.toLocaleLowerCase(t))),t.add("uppercase",((e,t)=>e.toLocaleUpperCase(t))),t.add("upperFirst",((e,t)=>e.charAt(0).toLocaleUpperCase(t)+e.substring(1))),g.length&&await this.loadResourceDir(g,!1,!0),r?.resourceDirs?.length&&await this.loadResourceDir(r.resourceDirs,!1,!0),r?.resources)for(const e of Object.keys(r.resources)){const t=r.resources[e];for(const r of Object.keys(t))this.addResourceBundle(e,r,t[r],!1,!0)}return s&&s(null,e),e}catch(e){throw s&&s(e,this.t),e}}deep(e,t){if(null==e)return e;const r=new WeakMap;return this._deepTranslate(e,r,t)}registerLocaleDir(...e){g.push(...e)}async loadResourceBundle(e,r,s,i,n){let o;if(a=s,m.test(a))o=(await fetch(s,{headers:{accept:"application/json"}})).json();else{const e=t.readFileSync(s,"utf8");o=JSON.parse(e)}var a;this.addResourceBundle(e,r,o,i,n)}async loadResourceDir(e,r,i){for(const n of Array.isArray(e)?e:[e]){if(!t.statSync(n).isDirectory())continue;const e=t.readdirSync(n);for(const o of e){const e=s.join(n,o);if(t.statSync(e).isDirectory()){const n=t.readdirSync(e);for(const a of n){const n=s.join(e,a),c=s.extname(a);if(".json"===c&&t.statSync(n).isFile()){const e=s.basename(a,c);await this.loadResourceBundle(o,e,n,r,i)}}}}}}createInstance(e={},t){return new R(e,t)}static createInstance(e,t){return new R(e,t)}_deepTranslate(t,r,s){if(null==t)return t;if(s?.ignore&&s.ignore(t,this))return t;if("object"==typeof t&&r.has(t))return r.get(t);if("string"==typeof t){let r="";for(let i of e.tokenize(t,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0}))if(i.startsWith("$t(")&&i.endsWith(")")){i=i.substring(3,i.length-1);const t=e.splitString(i,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),n=x(i.substring((t[0]||"").length+1));i=t[0]||"";const o=[];let a=null;for(const t of e.tokenize(i,{delimiters:",",quotes:!0,brackets:{"{":"}"}}))t.startsWith("{")?a=JSON.parse(t):o.push(t);const c=o.length>1?"$t("+o.join(",")+")":o[0];r+=n?this.t(c,n,{...s,...a}):this.t(c,{...s,...a})}else r+=i;return r}if(Array.isArray(t)){const e=Array(t.length);r.set(t,e);for(let i=0,n=t.length;i<n;i++)e[i]=this._deepTranslate(t[i],r,s);return r.delete(t),e}if("object"==typeof t){if(Buffer.isBuffer(t))return t;if(Buffer.isBuffer(t)||t instanceof Symbol||t instanceof RegExp||t instanceof Map||t instanceof Set||t instanceof WeakMap||t instanceof WeakSet)return t;const e={};r.set(t,e);const i=Object.keys(t);for(let n=0,o=i.length;n<o;n++){const o=i[n];e[o]=this._deepTranslate(t[o],r,s)}return r.delete(t),e}return t}static get defaultInstance(){return w}}const w=R.createInstance();var C;R.createInstance().init().catch((()=>{})),function(e){var t;(t=e.Enum||(e.Enum={})).fatal="fatal",t.error="error",t.warning="warning",t.info="info",e.name="IssueSeverity",e.description="Severity of the issue",e.Keys=Object.keys(e),e.descriptions={fatal:"The issue caused the action to fail and no further checking could be performed",error:"The issue is sufficiently important to cause the action to fail",warning:"The issue is not important enough to cause the action to fail but may cause it to be performed suboptimally or in a way that is not as desired",info:"The issue has no relation to the degree of success of the action"}}(C||(C={}));class O{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}}class I extends O{}class A extends I{}class v extends A{constructor(e){super(),this.value=e}toString(){return""+this.value}}class b extends I{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new N({op:e,expression:t})),this}toString(){return this.items.map(((e,t)=>(t>0?e.op:"")+e.expression)).join("")}}class N{constructor(e){Object.assign(this,e)}}class L extends A{constructor(e){super(),this.items=e}toString(){return"["+this.items.map((e=>""+e)).join(",")+"]"}}const S=/\w/;class k extends I{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${S.test(this.op)?" "+this.op+" ":this.op}${this.right}`}}class D extends I{constructor(e){super(),Object.assign(this,e)}toString(){return this.items.map((e=>""+e)).join(" "+this.op+" ")}}class P extends I{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}}class U extends v{constructor(e){super(e)}}class M extends TypeError{}class F extends TypeError{}class H extends Error{constructor(e,t){super(e),Object.assign(this,t)}}const $=/'/g,j=/(\\)/g,B=/\\(.)/g;function q(e){return"'"+function(e){return e.replace(j,"\\\\")}(e).replace($,"\\'")+"'"}function z(e){return e&&(e.startsWith("'")||e.startsWith('"'))&&e.endsWith(e.charAt(0))?function(e){return e.replace(B,"$1")}(e.substring(1,e.length-1)):e}const G=new Date(0);class V extends v{constructor(e){if(super(""),e instanceof Date)this.value=e.toISOString();else{if("string"!=typeof e||i.toDateDef(e,G)===G)throw new F(`Invalid date value "${e}"`);this.value=e}}toString(){return q(this.value)}}class W extends v{constructor(){super(null),this.value=null}}class Q extends v{constructor(e){if(super(0),"number"!=typeof e&&"bigint"!=typeof e){try{if("string"==typeof e){if(e.includes("."))return void(this.value=parseFloat(e));const t=Number(e);return void(this.value=""+t===e?t:BigInt(e))}}catch{}throw new F(`Invalid number literal ${e}`)}this.value=e}toString(){return"bigint"==typeof this.value?(""+this.value).replace(/n$/,""):""+this.value}}class X extends v{constructor(e){super(""+e)}}class K extends v{constructor(e){super(""+e)}toString(){return q(this.value)}}const Y=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;class Z extends v{constructor(e){if(super(""),e instanceof Date)this.value=J(e.getHours())+":"+J(e.getMinutes())+(e.getSeconds()?":"+J(e.getSeconds()):"")+(e.getMilliseconds()?"."+J(e.getMilliseconds()):"");else{if("string"!=typeof e||!Y.test(e))throw new F(`Invalid time value "${e}"`);this.value=e}}toString(){return q(this.value)}}function J(e){return e<=9?"0"+e:""+e}class ee extends n.Lexer{constructor(e){super(e),this._interp=new n.LexerATNSimulator(this,ee._ATN,ee.DecisionsToDFA,new n.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return ee.literalNames}get symbolicNames(){return ee.symbolicNames}get ruleNames(){return ee.ruleNames}get serializedATN(){return ee._serializedATN}get channelNames(){return ee.channelNames}get modeNames(){return ee.modeNames}static get _ATN(){return ee.__ATN||(ee.__ATN=(new n.ATNDeserializer).deserialize(ee._serializedATN)),ee.__ATN}}ee.T__0=1,ee.T__1=2,ee.T__2=3,ee.T__3=4,ee.T__4=5,ee.T__5=6,ee.T__6=7,ee.T__7=8,ee.T__8=9,ee.T__9=10,ee.T__10=11,ee.T__11=12,ee.T__12=13,ee.T__13=14,ee.T__14=15,ee.T__15=16,ee.T__16=17,ee.T__17=18,ee.T__18=19,ee.T__19=20,ee.T__20=21,ee.T__21=22,ee.T__22=23,ee.T__23=24,ee.T__24=25,ee.T__25=26,ee.T__26=27,ee.T__27=28,ee.T__28=29,ee.T__29=30,ee.T__30=31,ee.T__31=32,ee.T__32=33,ee.T__33=34,ee.T__34=35,ee.T__35=36,ee.T__36=37,ee.T__37=38,ee.T__38=39,ee.T__39=40,ee.T__40=41,ee.T__41=42,ee.T__42=43,ee.T__43=44,ee.T__44=45,ee.T__45=46,ee.DATE=47,ee.DATETIME=48,ee.TIME=49,ee.IDENTIFIER=50,ee.STRING=51,ee.NUMBER=52,ee.INTEGER=53,ee.WHITESPACE=54,ee.COMMENT=55,ee.LINE_COMMENT=56,ee.EOF=n.Token.EOF,ee.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],ee.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],ee.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],ee.modeNames=["DEFAULT_MODE"],ee.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","T__34","T__35","T__36","T__37","T__38","T__39","T__40","T__41","T__42","T__43","T__44","T__45","DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT","NUMBERFORMAT","INTEGERFORMAT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"],ee._serializedATN=[4,0,56,536,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,36,1,36,1,37,1,37,1,38,1,38,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,3,46,357,8,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,3,47,373,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,3,48,383,8,48,1,49,1,49,5,49,387,8,49,10,49,12,49,390,9,49,1,50,1,50,1,50,5,50,395,8,50,10,50,12,50,398,9,50,1,50,1,50,1,50,1,50,5,50,404,8,50,10,50,12,50,407,9,50,1,50,3,50,410,8,50,1,51,1,51,1,52,1,52,1,53,4,53,417,8,53,11,53,12,53,418,1,53,1,53,1,54,1,54,1,54,1,54,5,54,427,8,54,10,54,12,54,430,9,54,1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,5,55,441,8,55,10,55,12,55,444,9,55,1,55,1,55,1,56,4,56,449,8,56,11,56,12,56,450,1,56,1,56,4,56,455,8,56,11,56,12,56,456,3,56,459,8,56,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,472,8,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,481,8,58,1,59,1,59,1,59,1,59,3,59,487,8,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,4,59,499,8,59,11,59,12,59,500,3,59,503,8,59,3,59,505,8,59,1,60,1,60,1,60,3,60,510,8,60,1,60,1,60,1,60,3,60,515,8,60,1,60,1,60,1,60,3,60,520,8,60,3,60,522,8,60,1,61,1,61,1,61,3,61,527,8,61,1,62,1,62,1,62,1,62,1,62,1,62,1,63,1,63,1,428,0,64,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50,101,51,103,52,105,53,107,54,109,55,111,56,113,0,115,0,117,0,119,0,121,0,123,0,125,0,127,0,1,0,17,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,2,0,10,10,13,13,1,0,48,57,1,0,48,48,1,0,49,57,1,0,49,49,1,0,48,50,1,0,49,51,1,0,48,49,1,0,48,51,1,0,48,53,2,0,43,43,45,45,3,0,48,57,65,70,97,102,554,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,1,129,1,0,0,0,3,131,1,0,0,0,5,133,1,0,0,0,7,135,1,0,0,0,9,137,1,0,0,0,11,139,1,0,0,0,13,144,1,0,0,0,15,150,1,0,0,0,17,155,1,0,0,0,19,159,1,0,0,0,21,164,1,0,0,0,23,171,1,0,0,0,25,178,1,0,0,0,27,190,1,0,0,0,29,196,1,0,0,0,31,203,1,0,0,0,33,209,1,0,0,0,35,214,1,0,0,0,37,220,1,0,0,0,39,228,1,0,0,0,41,236,1,0,0,0,43,249,1,0,0,0,45,251,1,0,0,0,47,253,1,0,0,0,49,256,1,0,0,0,51,258,1,0,0,0,53,260,1,0,0,0,55,263,1,0,0,0,57,265,1,0,0,0,59,268,1,0,0,0,61,271,1,0,0,0,63,275,1,0,0,0,65,280,1,0,0,0,67,286,1,0,0,0,69,292,1,0,0,0,71,299,1,0,0,0,73,301,1,0,0,0,75,303,1,0,0,0,77,305,1,0,0,0,79,307,1,0,0,0,81,311,1,0,0,0,83,314,1,0,0,0,85,319,1,0,0,0,87,325,1,0,0,0,89,330,1,0,0,0,91,339,1,0,0,0,93,356,1,0,0,0,95,372,1,0,0,0,97,382,1,0,0,0,99,384,1,0,0,0,101,409,1,0,0,0,103,411,1,0,0,0,105,413,1,0,0,0,107,416,1,0,0,0,109,422,1,0,0,0,111,436,1,0,0,0,113,448,1,0,0,0,115,460,1,0,0,0,117,462,1,0,0,0,119,486,1,0,0,0,121,521,1,0,0,0,123,523,1,0,0,0,125,528,1,0,0,0,127,534,1,0,0,0,129,130,5,40,0,0,130,2,1,0,0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,91,0,0,134,6,1,0,0,0,135,136,5,44,0,0,136,8,1,0,0,0,137,138,5,93,0,0,138,10,1,0,0,0,139,140,5,121,0,0,140,141,5,101,0,0,141,142,5,97,0,0,142,143,5,114,0,0,143,12,1,0,0,0,144,145,5,109,0,0,145,146,5,111,0,0,146,147,5,110,0,0,147,148,5,116,0,0,148,149,5,104,0,0,149,14,1,0,0,0,150,151,5,119,0,0,151,152,5,101,0,0,152,153,5,101,0,0,153,154,5,107,0,0,154,16,1,0,0,0,155,156,5,100,0,0,156,157,5,97,0,0,157,158,5,121,0,0,158,18,1,0,0,0,159,160,5,104,0,0,160,161,5,111,0,0,161,162,5,117,0,0,162,163,5,114,0,0,163,20,1,0,0,0,164,165,5,109,0,0,165,166,5,105,0,0,166,167,5,110,0,0,167,168,5,117,0,0,168,169,5,116,0,0,169,170,5,101,0,0,170,22,1,0,0,0,171,172,5,115,0,0,172,173,5,101,0,0,173,174,5,99,0,0,174,175,5,111,0,0,175,176,5,110,0,0,176,177,5,100,0,0,177,24,1,0,0,0,178,179,5,109,0,0,179,180,5,105,0,0,180,181,5,108,0,0,181,182,5,108,0,0,182,183,5,105,0,0,183,184,5,115,0,0,184,185,5,101,0,0,185,186,5,99,0,0,186,187,5,111,0,0,187,188,5,110,0,0,188,189,5,100,0,0,189,26,1,0,0,0,190,191,5,121,0,0,191,192,5,101,0,0,192,193,5,97,0,0,193,194,5,114,0,0,194,195,5,115,0,0,195,28,1,0,0,0,196,197,5,109,0,0,197,198,5,111,0,0,198,199,5,110,0,0,199,200,5,116,0,0,200,201,5,104,0,0,201,202,5,115,0,0,202,30,1,0,0,0,203,204,5,119,0,0,204,205,5,101,0,0,205,206,5,101,0,0,206,207,5,107,0,0,207,208,5,115,0,0,208,32,1,0,0,0,209,210,5,100,0,0,210,211,5,97,0,0,211,212,5,121,0,0,212,213,5,115,0,0,213,34,1,0,0,0,214,215,5,104,0,0,215,216,5,111,0,0,216,217,5,117,0,0,217,218,5,114,0,0,218,219,5,115,0,0,219,36,1,0,0,0,220,221,5,109,0,0,221,222,5,105,0,0,222,223,5,110,0,0,223,224,5,117,0,0,224,225,5,116,0,0,225,226,5,101,0,0,226,227,5,115,0,0,227,38,1,0,0,0,228,229,5,115,0,0,229,230,5,101,0,0,230,231,5,99,0,0,231,232,5,111,0,0,232,233,5,110,0,0,233,234,5,100,0,0,234,235,5,115,0,0,235,40,1,0,0,0,236,237,5,109,0,0,237,238,5,105,0,0,238,239,5,108,0,0,239,240,5,108,0,0,240,241,5,105,0,0,241,242,5,115,0,0,242,243,5,101,0,0,243,244,5,99,0,0,244,245,5,111,0,0,245,246,5,110,0,0,246,247,5,100,0,0,247,248,5,115,0,0,248,42,1,0,0,0,249,250,5,46,0,0,250,44,1,0,0,0,251,252,5,64,0,0,252,46,1,0,0,0,253,254,5,60,0,0,254,255,5,61,0,0,255,48,1,0,0,0,256,257,5,60,0,0,257,50,1,0,0,0,258,259,5,62,0,0,259,52,1,0,0,0,260,261,5,62,0,0,261,262,5,61,0,0,262,54,1,0,0,0,263,264,5,61,0,0,264,56,1,0,0,0,265,266,5,33,0,0,266,267,5,61,0,0,267,58,1,0,0,0,268,269,5,105,0,0,269,270,5,110,0,0,270,60,1,0,0,0,271,272,5,33,0,0,272,273,5,105,0,0,273,274,5,110,0,0,274,62,1,0,0,0,275,276,5,108,0,0,276,277,5,105,0,0,277,278,5,107,0,0,278,279,5,101,0,0,279,64,1,0,0,0,280,281,5,33,0,0,281,282,5,108,0,0,282,283,5,105,0,0,283,284,5,107,0,0,284,285,5,101,0,0,285,66,1,0,0,0,286,287,5,105,0,0,287,288,5,108,0,0,288,289,5,105,0,0,289,290,5,107,0,0,290,291,5,101,0,0,291,68,1,0,0,0,292,293,5,33,0,0,293,294,5,105,0,0,294,295,5,108,0,0,295,296,5,105,0,0,296,297,5,107,0,0,297,298,5,101,0,0,298,70,1,0,0,0,299,300,5,43,0,0,300,72,1,0,0,0,301,302,5,45,0,0,302,74,1,0,0,0,303,304,5,42,0,0,304,76,1,0,0,0,305,306,5,47,0,0,306,78,1,0,0,0,307,308,5,97,0,0,308,309,5,110,0,0,309,310,5,100,0,0,310,80,1,0,0,0,311,312,5,111,0,0,312,313,5,114,0,0,313,82,1,0,0,0,314,315,5,116,0,0,315,316,5,114,0,0,316,317,5,117,0,0,317,318,5,101,0,0,318,84,1,0,0,0,319,320,5,102,0,0,320,321,5,97,0,0,321,322,5,108,0,0,322,323,5,115,0,0,323,324,5,101,0,0,324,86,1,0,0,0,325,326,5,110,0,0,326,327,5,117,0,0,327,328,5,108,0,0,328,329,5,108,0,0,329,88,1,0,0,0,330,331,5,73,0,0,331,332,5,110,0,0,332,333,5,102,0,0,333,334,5,105,0,0,334,335,5,110,0,0,335,336,5,105,0,0,336,337,5,116,0,0,337,338,5,121,0,0,338,90,1,0,0,0,339,340,5,105,0,0,340,341,5,110,0,0,341,342,5,102,0,0,342,343,5,105,0,0,343,344,5,110,0,0,344,345,5,105,0,0,345,346,5,116,0,0,346,347,5,121,0,0,347,92,1,0,0,0,348,349,5,39,0,0,349,350,3,117,58,0,350,351,5,39,0,0,351,357,1,0,0,0,352,353,5,34,0,0,353,354,3,117,58,0,354,355,5,34,0,0,355,357,1,0,0,0,356,348,1,0,0,0,356,352,1,0,0,0,357,94,1,0,0,0,358,359,5,39,0,0,359,360,3,117,58,0,360,361,5,84,0,0,361,362,3,119,59,0,362,363,3,121,60,0,363,364,5,39,0,0,364,373,1,0,0,0,365,366,5,34,0,0,366,367,3,117,58,0,367,368,5,84,0,0,368,369,3,119,59,0,369,370,3,121,60,0,370,371,5,34,0,0,371,373,1,0,0,0,372,358,1,0,0,0,372,365,1,0,0,0,373,96,1,0,0,0,374,375,5,39,0,0,375,376,3,119,59,0,376,377,5,39,0,0,377,383,1,0,0,0,378,379,5,34,0,0,379,380,3,119,59,0,380,381,5,34,0,0,381,383,1,0,0,0,382,374,1,0,0,0,382,378,1,0,0,0,383,98,1,0,0,0,384,388,7,0,0,0,385,387,7,1,0,0,386,385,1,0,0,0,387,390,1,0,0,0,388,386,1,0,0,0,388,389,1,0,0,0,389,100,1,0,0,0,390,388,1,0,0,0,391,396,5,39,0,0,392,395,3,123,61,0,393,395,8,2,0,0,394,392,1,0,0,0,394,393,1,0,0,0,395,398,1,0,0,0,396,394,1,0,0,0,396,397,1,0,0,0,397,399,1,0,0,0,398,396,1,0,0,0,399,410,5,39,0,0,400,405,5,34,0,0,401,404,3,123,61,0,402,404,8,3,0,0,403,401,1,0,0,0,403,402,1,0,0,0,404,407,1,0,0,0,405,403,1,0,0,0,405,406,1,0,0,0,406,408,1,0,0,0,407,405,1,0,0,0,408,410,5,34,0,0,409,391,1,0,0,0,409,400,1,0,0,0,410,102,1,0,0,0,411,412,3,113,56,0,412,104,1,0,0,0,413,414,3,115,57,0,414,106,1,0,0,0,415,417,7,4,0,0,416,415,1,0,0,0,417,418,1,0,0,0,418,416,1,0,0,0,418,419,1,0,0,0,419,420,1,0,0,0,420,421,6,53,0,0,421,108,1,0,0,0,422,423,5,47,0,0,423,424,5,42,0,0,424,428,1,0,0,0,425,427,9,0,0,0,426,425,1,0,0,0,427,430,1,0,0,0,428,429,1,0,0,0,428,426,1,0,0,0,429,431,1,0,0,0,430,428,1,0,0,0,431,432,5,42,0,0,432,433,5,47,0,0,433,434,1,0,0,0,434,435,6,54,0,0,435,110,1,0,0,0,436,437,5,47,0,0,437,438,5,47,0,0,438,442,1,0,0,0,439,441,8,5,0,0,440,439,1,0,0,0,441,444,1,0,0,0,442,440,1,0,0,0,442,443,1,0,0,0,443,445,1,0,0,0,444,442,1,0,0,0,445,446,6,55,0,0,446,112,1,0,0,0,447,449,7,6,0,0,448,447,1,0,0,0,449,450,1,0,0,0,450,448,1,0,0,0,450,451,1,0,0,0,451,458,1,0,0,0,452,454,5,46,0,0,453,455,7,6,0,0,454,453,1,0,0,0,455,456,1,0,0,0,456,454,1,0,0,0,456,457,1,0,0,0,457,459,1,0,0,0,458,452,1,0,0,0,458,459,1,0,0,0,459,114,1,0,0,0,460,461,7,6,0,0,461,116,1,0,0,0,462,463,7,6,0,0,463,464,7,6,0,0,464,465,7,6,0,0,465,466,7,6,0,0,466,471,5,45,0,0,467,468,7,7,0,0,468,472,7,8,0,0,469,470,7,9,0,0,470,472,7,10,0,0,471,467,1,0,0,0,471,469,1,0,0,0,472,473,1,0,0,0,473,480,5,45,0,0,474,475,7,11,0,0,475,481,7,7,0,0,476,477,7,10,0,0,477,481,7,8,0,0,478,479,5,51,0,0,479,481,5,49,0,0,480,474,1,0,0,0,480,476,1,0,0,0,480,478,1,0,0,0,481,118,1,0,0,0,482,483,7,12,0,0,483,487,7,6,0,0,484,485,5,50,0,0,485,487,7,13,0,0,486,482,1,0,0,0,486,484,1,0,0,0,487,488,1,0,0,0,488,489,5,58,0,0,489,490,7,14,0,0,490,491,7,6,0,0,491,504,1,0,0,0,492,493,5,58,0,0,493,494,7,14,0,0,494,495,7,6,0,0,495,502,1,0,0,0,496,498,5,46,0,0,497,499,7,6,0,0,498,497,1,0,0,0,499,500,1,0,0,0,500,498,1,0,0,0,500,501,1,0,0,0,501,503,1,0,0,0,502,496,1,0,0,0,502,503,1,0,0,0,503,505,1,0,0,0,504,492,1,0,0,0,504,505,1,0,0,0,505,120,1,0,0,0,506,522,5,90,0,0,507,514,7,15,0,0,508,510,7,12,0,0,509,508,1,0,0,0,509,510,1,0,0,0,510,511,1,0,0,0,511,515,7,6,0,0,512,513,5,50,0,0,513,515,7,13,0,0,514,509,1,0,0,0,514,512,1,0,0,0,515,519,1,0,0,0,516,517,5,58,0,0,517,518,7,14,0,0,518,520,7,6,0,0,519,516,1,0,0,0,519,520,1,0,0,0,520,522,1,0,0,0,521,506,1,0,0,0,521,507,1,0,0,0,522,122,1,0,0,0,523,526,5,92,0,0,524,527,3,125,62,0,525,527,9,0,0,0,526,524,1,0,0,0,526,525,1,0,0,0,527,124,1,0,0,0,528,529,5,117,0,0,529,530,3,127,63,0,530,531,3,127,63,0,531,532,3,127,63,0,532,533,3,127,63,0,533,126,1,0,0,0,534,535,7,16,0,0,535,128,1,0,0,0,27,0,356,372,382,388,394,396,403,405,409,418,428,442,450,456,458,471,480,486,500,502,504,509,514,519,521,526,1,0,1,0],ee.DecisionsToDFA=ee._ATN.decisionToState.map(((e,t)=>new n.DFA(e,t)));class te extends n.Parser{constructor(e){super(e),this._interp=new n.ParserATNSimulator(this,te._ATN,te.DecisionsToDFA,new n.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return te.literalNames}get symbolicNames(){return te.symbolicNames}get ruleNames(){return te.ruleNames}get serializedATN(){return te._serializedATN}createFailedPredicateException(e,t){return new n.FailedPredicateException(this,e,t)}root(){let e=new re(this,this._ctx,this.state);this.enterRule(e,0,te.RULE_root);try{this.enterOuterAlt(e,1),this.state=44,this.expression(0),this.state=45,this.match(te.EOF)}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}expression(e){void 0===e&&(e=0);let t,r=this._ctx,s=this.state,i=new se(this,this._ctx,s),o=i;this.enterRecursionRule(i,2,te.RULE_expression,e);try{let e;switch(this.enterOuterAlt(i,1),this.state=67,this._errHandler.sync(this),this._input.LA(1)){case 23:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:i=new he(this,i),this._ctx=i,o=i,this.state=48,this.term();break;case 36:case 37:i=new oe(this,i),this._ctx=i,o=i,this.state=49,this.polarOp(),this.state=50,this.expression(6);break;case 1:i=new ie(this,i),this._ctx=i,o=i,this.state=52,this.match(te.T__0),this.state=53,this.expression(0),this.state=54,this.match(te.T__1);break;case 3:for(i=new ne(this,i),this._ctx=i,o=i,this.state=56,this.match(te.T__2),this.state=57,this.expression(0),this.state=62,this._errHandler.sync(this),t=this._input.LA(1);4===t;)this.state=58,this.match(te.T__3),this.state=59,this.expression(0),this.state=64,this._errHandler.sync(this),t=this._input.LA(1);this.state=65,this.match(te.T__4);break;default:throw new n.NoViableAltException(this)}for(this._ctx.stop=this._input.LT(-1),this.state=83,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx);2!==e&&e!==n.ATN.INVALID_ALT_NUMBER;){if(1===e)switch(null!=this._parseListeners&&this.triggerExitRuleEvent(),o=i,this.state=81,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,2,this._ctx)){case 1:if(i=new ce(this,new se(this,r,s)),this.pushNewRecursionContext(i,2,te.RULE_expression),this.state=69,!this.precpred(this._ctx,5))throw this.createFailedPredicateException("this.precpred(this._ctx, 5)");this.state=70,this.arthOp(),this.state=71,this.expression(6);break;case 2:if(i=new ae(this,new se(this,r,s)),this.pushNewRecursionContext(i,2,te.RULE_expression),this.state=73,!this.precpred(this._ctx,4))throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");this.state=74,this.compOp(),this.state=75,this.expression(5);break;case 3:if(i=new le(this,new se(this,r,s)),this.pushNewRecursionContext(i,2,te.RULE_expression),this.state=77,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=78,this.logOp(),this.state=79,this.expression(4)}this.state=85,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx)}}catch(e){if(!(e instanceof n.RecognitionException))throw e;i.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.unrollRecursionContexts(r)}return i}term(){let e=new ue(this,this._ctx,this.state);this.enterRule(e,4,te.RULE_term);try{switch(this.state=89,this._errHandler.sync(this),this._input.LA(1)){case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 51:case 52:e=new de(this,e),this.enterOuterAlt(e,1),this.state=86,this.literal();break;case 50:e=new _e(this,e),this.enterOuterAlt(e,2),this.state=87,this.qualifiedIdentifier();break;case 23:e=new pe(this,e),this.enterOuterAlt(e,3),this.state=88,this.externalConstant();break;default:throw new n.NoViableAltException(this)}}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocable(){let e=new fe(this,this._ctx,this.state);this.enterRule(e,6,te.RULE_invocable);try{this.enterOuterAlt(e,1),this.state=91,this.function_()}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocation(){let e=new ye(this,this._ctx,this.state);this.enterRule(e,8,te.RULE_invocation);try{e=new me(this,e),this.enterOuterAlt(e,1),this.state=93,this.identifier()}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}indexer(){let e=new Te(this,this._ctx,this.state);this.enterRule(e,10,te.RULE_indexer);try{switch(this.state=97,this._errHandler.sync(this),this._input.LA(1)){case 50:e=new Ee(this,e),this.enterOuterAlt(e,1),this.state=95,this.identifier();break;case 53:e=new xe(this,e),this.enterOuterAlt(e,2),this.state=96,this.match(te.INTEGER);break;default:throw new n.NoViableAltException(this)}}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}function_(){let e,t=new ge(this,this._ctx,this.state);this.enterRule(t,12,te.RULE_function);try{this.enterOuterAlt(t,1),this.state=99,this.identifier(),this.state=100,this.match(te.T__0),this.state=102,this._errHandler.sync(this),e=this._input.LA(1),(0==(-32&e)&&0!=(1<<e&8388618)||0==(e-36&-32)&&0!=(1<<e-36&131011))&&(this.state=101,this.paramList()),this.state=104,this.match(te.T__1)}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}paramList(){let e,t=new Re(this,this._ctx,this.state);this.enterRule(t,14,te.RULE_paramList);try{for(this.enterOuterAlt(t,1),this.state=106,this.expression(0),this.state=111,this._errHandler.sync(this),e=this._input.LA(1);4===e;)this.state=107,this.match(te.T__3),this.state=108,this.expression(0),this.state=113,this._errHandler.sync(this),e=this._input.LA(1)}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}unit(){let e=new we(this,this._ctx,this.state);this.enterRule(e,16,te.RULE_unit);try{switch(this.state=117,this._errHandler.sync(this),this._input.LA(1)){case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:this.enterOuterAlt(e,1),this.state=114,this.dateTimePrecision();break;case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:this.enterOuterAlt(e,2),this.state=115,this.pluralDateTimePrecision();break;case 51:this.enterOuterAlt(e,3),this.state=116,this.match(te.STRING);break;default:throw new n.NoViableAltException(this)}}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}dateTimePrecision(){let e,t=new Ce(this,this._ctx,this.state);this.enterRule(t,18,te.RULE_dateTimePrecision);try{this.enterOuterAlt(t,1),this.state=119,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&16320)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}pluralDateTimePrecision(){let e,t=new Oe(this,this._ctx,this.state);this.enterRule(t,20,te.RULE_pluralDateTimePrecision);try{this.enterOuterAlt(t,1),this.state=121,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&4177920)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}qualifiedIdentifier(){let e=new Ie(this,this._ctx,this.state);this.enterRule(e,22,te.RULE_qualifiedIdentifier);try{let t;for(this.enterOuterAlt(e,1),this.state=128,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);2!==t&&t!==n.ATN.INVALID_ALT_NUMBER;)1===t&&(this.state=123,this.identifier(),this.state=124,this.match(te.T__21)),this.state=130,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);this.state=131,this.identifier()}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}externalConstant(){let e,t=new Ae(this,this._ctx,this.state);this.enterRule(t,24,te.RULE_externalConstant);try{this.enterOuterAlt(t,1),this.state=133,this.match(te.T__22),this.state=134,e=this._input.LA(1),50!==e&&51!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}identifier(){let e=new ve(this,this._ctx,this.state);this.enterRule(e,26,te.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=136,this.match(te.IDENTIFIER)}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}literal(){let e=new be(this,this._ctx,this.state);this.enterRule(e,28,te.RULE_literal);try{switch(this.state=146,this._errHandler.sync(this),this._input.LA(1)){case 52:e=new Me(this,e),this.enterOuterAlt(e,1),this.state=138,this.match(te.NUMBER);break;case 45:case 46:e=new Pe(this,e),this.enterOuterAlt(e,2),this.state=139,this.infinity();break;case 42:case 43:e=new Ue(this,e),this.enterOuterAlt(e,3),this.state=140,this.boolean_();break;case 44:e=new Le(this,e),this.enterOuterAlt(e,4),this.state=141,this.null_();break;case 47:e=new De(this,e),this.enterOuterAlt(e,5),this.state=142,this.match(te.DATE);break;case 48:e=new Se(this,e),this.enterOuterAlt(e,6),this.state=143,this.match(te.DATETIME);break;case 49:e=new Ne(this,e),this.enterOuterAlt(e,7),this.state=144,this.match(te.TIME);break;case 51:e=new ke(this,e),this.enterOuterAlt(e,8),this.state=145,this.match(te.STRING);break;default:throw new n.NoViableAltException(this)}}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}compOp(){let e,t=new Fe(this,this._ctx,this.state);this.enterRule(t,30,te.RULE_compOp);try{this.enterOuterAlt(t,1),this.state=148,e=this._input.LA(1),0!=(e-24&-32)||0==(1<<e-24&4095)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}arthOp(){let e,t=new He(this,this._ctx,this.state);this.enterRule(t,32,te.RULE_arthOp);try{this.enterOuterAlt(t,1),this.state=150,e=this._input.LA(1),0!=(e-36&-32)||0==(1<<e-36&15)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}polarOp(){let e,t=new $e(this,this._ctx,this.state);this.enterRule(t,34,te.RULE_polarOp);try{this.enterOuterAlt(t,1),this.state=152,e=this._input.LA(1),36!==e&&37!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}logOp(){let e,t=new je(this,this._ctx,this.state);this.enterRule(t,36,te.RULE_logOp);try{this.enterOuterAlt(t,1),this.state=154,e=this._input.LA(1),40!==e&&41!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}boolean_(){let e,t=new Be(this,this._ctx,this.state);this.enterRule(t,38,te.RULE_boolean);try{this.enterOuterAlt(t,1),this.state=156,e=this._input.LA(1),42!==e&&43!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}null_(){let e=new qe(this,this._ctx,this.state);this.enterRule(e,40,te.RULE_null);try{this.enterOuterAlt(e,1),this.state=158,this.match(te.T__43)}catch(t){if(!(t instanceof n.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}infinity(){let e,t=new ze(this,this._ctx,this.state);this.enterRule(t,42,te.RULE_infinity);try{this.enterOuterAlt(t,1),this.state=160,e=this._input.LA(1),45!==e&&46!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof n.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}sempred(e,t,r){return 1!==t||this.expression_sempred(e,r)}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,5);case 1:return this.precpred(this._ctx,4);case 2:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return te.__ATN||(te.__ATN=(new n.ATNDeserializer).deserialize(te._serializedATN)),te.__ATN}}te.T__0=1,te.T__1=2,te.T__2=3,te.T__3=4,te.T__4=5,te.T__5=6,te.T__6=7,te.T__7=8,te.T__8=9,te.T__9=10,te.T__10=11,te.T__11=12,te.T__12=13,te.T__13=14,te.T__14=15,te.T__15=16,te.T__16=17,te.T__17=18,te.T__18=19,te.T__19=20,te.T__20=21,te.T__21=22,te.T__22=23,te.T__23=24,te.T__24=25,te.T__25=26,te.T__26=27,te.T__27=28,te.T__28=29,te.T__29=30,te.T__30=31,te.T__31=32,te.T__32=33,te.T__33=34,te.T__34=35,te.T__35=36,te.T__36=37,te.T__37=38,te.T__38=39,te.T__39=40,te.T__40=41,te.T__41=42,te.T__42=43,te.T__43=44,te.T__44=45,te.T__45=46,te.DATE=47,te.DATETIME=48,te.TIME=49,te.IDENTIFIER=50,te.STRING=51,te.NUMBER=52,te.INTEGER=53,te.WHITESPACE=54,te.COMMENT=55,te.LINE_COMMENT=56,te.EOF=n.Token.EOF,te.RULE_root=0,te.RULE_expression=1,te.RULE_term=2,te.RULE_invocable=3,te.RULE_invocation=4,te.RULE_indexer=5,te.RULE_function=6,te.RULE_paramList=7,te.RULE_unit=8,te.RULE_dateTimePrecision=9,te.RULE_pluralDateTimePrecision=10,te.RULE_qualifiedIdentifier=11,te.RULE_externalConstant=12,te.RULE_identifier=13,te.RULE_literal=14,te.RULE_compOp=15,te.RULE_arthOp=16,te.RULE_polarOp=17,te.RULE_logOp=18,te.RULE_boolean=19,te.RULE_null=20,te.RULE_infinity=21,te.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],te.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],te.ruleNames=["root","expression","term","invocable","invocation","indexer","function","paramList","unit","dateTimePrecision","pluralDateTimePrecision","qualifiedIdentifier","externalConstant","identifier","literal","compOp","arthOp","polarOp","logOp","boolean","null","infinity"],te._serializedATN=[4,1,56,163,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,61,8,1,10,1,12,1,64,9,1,1,1,1,1,3,1,68,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,82,8,1,10,1,12,1,85,9,1,1,2,1,2,1,2,3,2,90,8,2,1,3,1,3,1,4,1,4,1,5,1,5,3,5,98,8,5,1,6,1,6,1,6,3,6,103,8,6,1,6,1,6,1,7,1,7,1,7,5,7,110,8,7,10,7,12,7,113,9,7,1,8,1,8,1,8,3,8,118,8,8,1,9,1,9,1,10,1,10,1,11,1,11,1,11,5,11,127,8,11,10,11,12,11,130,9,11,1,11,1,11,1,12,1,12,1,12,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,3,14,147,8,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,0,1,2,22,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,0,9,1,0,6,13,1,0,14,21,1,0,50,51,1,0,24,35,1,0,36,39,1,0,36,37,1,0,40,41,1,0,42,43,1,0,45,46,162,0,44,1,0,0,0,2,67,1,0,0,0,4,89,1,0,0,0,6,91,1,0,0,0,8,93,1,0,0,0,10,97,1,0,0,0,12,99,1,0,0,0,14,106,1,0,0,0,16,117,1,0,0,0,18,119,1,0,0,0,20,121,1,0,0,0,22,128,1,0,0,0,24,133,1,0,0,0,26,136,1,0,0,0,28,146,1,0,0,0,30,148,1,0,0,0,32,150,1,0,0,0,34,152,1,0,0,0,36,154,1,0,0,0,38,156,1,0,0,0,40,158,1,0,0,0,42,160,1,0,0,0,44,45,3,2,1,0,45,46,5,0,0,1,46,1,1,0,0,0,47,48,6,1,-1,0,48,68,3,4,2,0,49,50,3,34,17,0,50,51,3,2,1,6,51,68,1,0,0,0,52,53,5,1,0,0,53,54,3,2,1,0,54,55,5,2,0,0,55,68,1,0,0,0,56,57,5,3,0,0,57,62,3,2,1,0,58,59,5,4,0,0,59,61,3,2,1,0,60,58,1,0,0,0,61,64,1,0,0,0,62,60,1,0,0,0,62,63,1,0,0,0,63,65,1,0,0,0,64,62,1,0,0,0,65,66,5,5,0,0,66,68,1,0,0,0,67,47,1,0,0,0,67,49,1,0,0,0,67,52,1,0,0,0,67,56,1,0,0,0,68,83,1,0,0,0,69,70,10,5,0,0,70,71,3,32,16,0,71,72,3,2,1,6,72,82,1,0,0,0,73,74,10,4,0,0,74,75,3,30,15,0,75,76,3,2,1,5,76,82,1,0,0,0,77,78,10,3,0,0,78,79,3,36,18,0,79,80,3,2,1,4,80,82,1,0,0,0,81,69,1,0,0,0,81,73,1,0,0,0,81,77,1,0,0,0,82,85,1,0,0,0,83,81,1,0,0,0,83,84,1,0,0,0,84,3,1,0,0,0,85,83,1,0,0,0,86,90,3,28,14,0,87,90,3,22,11,0,88,90,3,24,12,0,89,86,1,0,0,0,89,87,1,0,0,0,89,88,1,0,0,0,90,5,1,0,0,0,91,92,3,12,6,0,92,7,1,0,0,0,93,94,3,26,13,0,94,9,1,0,0,0,95,98,3,26,13,0,96,98,5,53,0,0,97,95,1,0,0,0,97,96,1,0,0,0,98,11,1,0,0,0,99,100,3,26,13,0,100,102,5,1,0,0,101,103,3,14,7,0,102,101,1,0,0,0,102,103,1,0,0,0,103,104,1,0,0,0,104,105,5,2,0,0,105,13,1,0,0,0,106,111,3,2,1,0,107,108,5,4,0,0,108,110,3,2,1,0,109,107,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,15,1,0,0,0,113,111,1,0,0,0,114,118,3,18,9,0,115,118,3,20,10,0,116,118,5,51,0,0,117,114,1,0,0,0,117,115,1,0,0,0,117,116,1,0,0,0,118,17,1,0,0,0,119,120,7,0,0,0,120,19,1,0,0,0,121,122,7,1,0,0,122,21,1,0,0,0,123,124,3,26,13,0,124,125,5,22,0,0,125,127,1,0,0,0,126,123,1,0,0,0,127,130,1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128,1,0,0,0,131,132,3,26,13,0,132,23,1,0,0,0,133,134,5,23,0,0,134,135,7,2,0,0,135,25,1,0,0,0,136,137,5,50,0,0,137,27,1,0,0,0,138,147,5,52,0,0,139,147,3,42,21,0,140,147,3,38,19,0,141,147,3,40,20,0,142,147,5,47,0,0,143,147,5,48,0,0,144,147,5,49,0,0,145,147,5,51,0,0,146,138,1,0,0,0,146,139,1,0,0,0,146,140,1,0,0,0,146,141,1,0,0,0,146,142,1,0,0,0,146,143,1,0,0,0,146,144,1,0,0,0,146,145,1,0,0,0,147,29,1,0,0,0,148,149,7,3,0,0,149,31,1,0,0,0,150,151,7,4,0,0,151,33,1,0,0,0,152,153,7,5,0,0,153,35,1,0,0,0,154,155,7,6,0,0,155,37,1,0,0,0,156,157,7,7,0,0,157,39,1,0,0,0,158,159,5,44,0,0,159,41,1,0,0,0,160,161,7,8,0,0,161,43,1,0,0,0,11,62,67,81,83,89,97,102,111,117,128,146],te.DecisionsToDFA=te._ATN.decisionToState.map(((e,t)=>new n.DFA(e,t)));class re extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(se,0)}EOF(){return this.getToken(te.EOF,0)}get ruleIndex(){return te.RULE_root}enterRule(e){e.enterRoot&&e.enterRoot(this)}exitRule(e){e.exitRoot&&e.exitRoot(this)}accept(e){return e.visitRoot?e.visitRoot(this):e.visitChildren(this)}}class se extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_expression}copyFrom(e){super.copyFrom(e)}}class ie extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(se,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}}class ne extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}enterRule(e){e.enterArrayExpression&&e.enterArrayExpression(this)}exitRule(e){e.exitArrayExpression&&e.exitArrayExpression(this)}accept(e){return e.visitArrayExpression?e.visitArrayExpression(this):e.visitChildren(this)}}class oe extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}polarOp(){return this.getTypedRuleContext($e,0)}expression(){return this.getTypedRuleContext(se,0)}enterRule(e){e.enterPolarityExpression&&e.enterPolarityExpression(this)}exitRule(e){e.exitPolarityExpression&&e.exitPolarityExpression(this)}accept(e){return e.visitPolarityExpression?e.visitPolarityExpression(this):e.visitChildren(this)}}class ae extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}compOp(){return this.getTypedRuleContext(Fe,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}}class ce extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}arthOp(){return this.getTypedRuleContext(He,0)}enterRule(e){e.enterArithmeticExpression&&e.enterArithmeticExpression(this)}exitRule(e){e.exitArithmeticExpression&&e.exitArithmeticExpression(this)}accept(e){return e.visitArithmeticExpression?e.visitArithmeticExpression(this):e.visitChildren(this)}}class le extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}logOp(){return this.getTypedRuleContext(je,0)}enterRule(e){e.enterLogicalExpression&&e.enterLogicalExpression(this)}exitRule(e){e.exitLogicalExpression&&e.exitLogicalExpression(this)}accept(e){return e.visitLogicalExpression?e.visitLogicalExpression(this):e.visitChildren(this)}}class he extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}term(){return this.getTypedRuleContext(ue,0)}enterRule(e){e.enterTermExpression&&e.enterTermExpression(this)}exitRule(e){e.exitTermExpression&&e.exitTermExpression(this)}accept(e){return e.visitTermExpression?e.visitTermExpression(this):e.visitChildren(this)}}class ue extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_term}copyFrom(e){super.copyFrom(e)}}class pe extends ue{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}externalConstant(){return this.getTypedRuleContext(Ae,0)}enterRule(e){e.enterExternalConstantTerm&&e.enterExternalConstantTerm(this)}exitRule(e){e.exitExternalConstantTerm&&e.exitExternalConstantTerm(this)}accept(e){return e.visitExternalConstantTerm?e.visitExternalConstantTerm(this):e.visitChildren(this)}}class de extends ue{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}literal(){return this.getTypedRuleContext(be,0)}enterRule(e){e.enterLiteralTerm&&e.enterLiteralTerm(this)}exitRule(e){e.exitLiteralTerm&&e.exitLiteralTerm(this)}accept(e){return e.visitLiteralTerm?e.visitLiteralTerm(this):e.visitChildren(this)}}class _e extends ue{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}qualifiedIdentifier(){return this.getTypedRuleContext(Ie,0)}enterRule(e){e.enterQualifiedIdentifierTerm&&e.enterQualifiedIdentifierTerm(this)}exitRule(e){e.exitQualifiedIdentifierTerm&&e.exitQualifiedIdentifierTerm(this)}accept(e){return e.visitQualifiedIdentifierTerm?e.visitQualifiedIdentifierTerm(this):e.visitChildren(this)}}class fe extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}function_(){return this.getTypedRuleContext(ge,0)}get ruleIndex(){return te.RULE_invocable}enterRule(e){e.enterInvocable&&e.enterInvocable(this)}exitRule(e){e.exitInvocable&&e.exitInvocable(this)}accept(e){return e.visitInvocable?e.visitInvocable(this):e.visitChildren(this)}}class ye extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_invocation}copyFrom(e){super.copyFrom(e)}}class me extends ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(ve,0)}enterRule(e){e.enterMemberInvocation&&e.enterMemberInvocation(this)}exitRule(e){e.exitMemberInvocation&&e.exitMemberInvocation(this)}accept(e){return e.visitMemberInvocation?e.visitMemberInvocation(this):e.visitChildren(this)}}class Te extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_indexer}copyFrom(e){super.copyFrom(e)}}class xe extends Te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}INTEGER(){return this.getToken(te.INTEGER,0)}enterRule(e){e.enterNumberIndex&&e.enterNumberIndex(this)}exitRule(e){e.exitNumberIndex&&e.exitNumberIndex(this)}accept(e){return e.visitNumberIndex?e.visitNumberIndex(this):e.visitChildren(this)}}class Ee extends Te{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(ve,0)}enterRule(e){e.enterMemberIndex&&e.enterMemberIndex(this)}exitRule(e){e.exitMemberIndex&&e.exitMemberIndex(this)}accept(e){return e.visitMemberIndex?e.visitMemberIndex(this):e.visitChildren(this)}}class ge extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(ve,0)}paramList(){return this.getTypedRuleContext(Re,0)}get ruleIndex(){return te.RULE_function}enterRule(e){e.enterFunction&&e.enterFunction(this)}exitRule(e){e.exitFunction&&e.exitFunction(this)}accept(e){return e.visitFunction?e.visitFunction(this):e.visitChildren(this)}}class Re extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}get ruleIndex(){return te.RULE_paramList}enterRule(e){e.enterParamList&&e.enterParamList(this)}exitRule(e){e.exitParamList&&e.exitParamList(this)}accept(e){return e.visitParamList?e.visitParamList(this):e.visitChildren(this)}}class we extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}dateTimePrecision(){return this.getTypedRuleContext(Ce,0)}pluralDateTimePrecision(){return this.getTypedRuleContext(Oe,0)}STRING(){return this.getToken(te.STRING,0)}get ruleIndex(){return te.RULE_unit}enterRule(e){e.enterUnit&&e.enterUnit(this)}exitRule(e){e.exitUnit&&e.exitUnit(this)}accept(e){return e.visitUnit?e.visitUnit(this):e.visitChildren(this)}}class Ce extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_dateTimePrecision}enterRule(e){e.enterDateTimePrecision&&e.enterDateTimePrecision(this)}exitRule(e){e.exitDateTimePrecision&&e.exitDateTimePrecision(this)}accept(e){return e.visitDateTimePrecision?e.visitDateTimePrecision(this):e.visitChildren(this)}}class Oe extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_pluralDateTimePrecision}enterRule(e){e.enterPluralDateTimePrecision&&e.enterPluralDateTimePrecision(this)}exitRule(e){e.exitPluralDateTimePrecision&&e.exitPluralDateTimePrecision(this)}accept(e){return e.visitPluralDateTimePrecision?e.visitPluralDateTimePrecision(this):e.visitChildren(this)}}class Ie extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(ve)}identifier(e){return this.getTypedRuleContext(ve,e)}get ruleIndex(){return te.RULE_qualifiedIdentifier}enterRule(e){e.enterQualifiedIdentifier&&e.enterQualifiedIdentifier(this)}exitRule(e){e.exitQualifiedIdentifier&&e.exitQualifiedIdentifier(this)}accept(e){return e.visitQualifiedIdentifier?e.visitQualifiedIdentifier(this):e.visitChildren(this)}}class Ae extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(te.IDENTIFIER,0)}STRING(){return this.getToken(te.STRING,0)}get ruleIndex(){return te.RULE_externalConstant}enterRule(e){e.enterExternalConstant&&e.enterExternalConstant(this)}exitRule(e){e.exitExternalConstant&&e.exitExternalConstant(this)}accept(e){return e.visitExternalConstant?e.visitExternalConstant(this):e.visitChildren(this)}}class ve extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(te.IDENTIFIER,0)}get ruleIndex(){return te.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}}class be extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_literal}copyFrom(e){super.copyFrom(e)}}class Ne extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(te.TIME,0)}enterRule(e){e.enterTimeLiteral&&e.enterTimeLiteral(this)}exitRule(e){e.exitTimeLiteral&&e.exitTimeLiteral(this)}accept(e){return e.visitTimeLiteral?e.visitTimeLiteral(this):e.visitChildren(this)}}class Le extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(qe,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}}class Se extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(te.DATETIME,0)}enterRule(e){e.enterDateTimeLiteral&&e.enterDateTimeLiteral(this)}exitRule(e){e.exitDateTimeLiteral&&e.exitDateTimeLiteral(this)}accept(e){return e.visitDateTimeLiteral?e.visitDateTimeLiteral(this):e.visitChildren(this)}}class ke extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(te.STRING,0)}enterRule(e){e.enterStringLiteral&&e.enterStringLiteral(this)}exitRule(e){e.exitStringLiteral&&e.exitStringLiteral(this)}accept(e){return e.visitStringLiteral?e.visitStringLiteral(this):e.visitChildren(this)}}class De extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(te.DATE,0)}enterRule(e){e.enterDateLiteral&&e.enterDateLiteral(this)}exitRule(e){e.exitDateLiteral&&e.exitDateLiteral(this)}accept(e){return e.visitDateLiteral?e.visitDateLiteral(this):e.visitChildren(this)}}class Pe extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(ze,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}}class Ue extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(Be,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}}class Me extends be{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(te.NUMBER,0)}enterRule(e){e.enterNumberLiteral&&e.enterNumberLiteral(this)}exitRule(e){e.exitNumberLiteral&&e.exitNumberLiteral(this)}accept(e){return e.visitNumberLiteral?e.visitNumberLiteral(this):e.visitChildren(this)}}class Fe extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_compOp}enterRule(e){e.enterCompOp&&e.enterCompOp(this)}exitRule(e){e.exitCompOp&&e.exitCompOp(this)}accept(e){return e.visitCompOp?e.visitCompOp(this):e.visitChildren(this)}}class He extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_arthOp}enterRule(e){e.enterArthOp&&e.enterArthOp(this)}exitRule(e){e.exitArthOp&&e.exitArthOp(this)}accept(e){return e.visitArthOp?e.visitArthOp(this):e.visitChildren(this)}}class $e extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_polarOp}enterRule(e){e.enterPolarOp&&e.enterPolarOp(this)}exitRule(e){e.exitPolarOp&&e.exitPolarOp(this)}accept(e){return e.visitPolarOp?e.visitPolarOp(this):e.visitChildren(this)}}class je extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_logOp}enterRule(e){e.enterLogOp&&e.enterLogOp(this)}exitRule(e){e.exitLogOp&&e.exitLogOp(this)}accept(e){return e.visitLogOp?e.visitLogOp(this):e.visitChildren(this)}}class Be extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}}class qe extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}}class ze extends n.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return te.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}}class Ge extends v{constructor(e){super(""+e)}toString(){return"@"+super.toString()}}const Ve=n.tree.ParseTreeVisitor;class We extends Ve{constructor(e){super(),this._timeZone=e?.timeZone}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitIdentifier(e){return e.getText()}visitNullLiteral(){return new W}visitBooleanLiteral(e){return new U("true"===e.getText())}visitNumberLiteral(e){return new Q(e.getText())}visitStringLiteral(e){return new K(z(e.getText()))}visitInfinityLiteral(){return new Q(1/0)}visitDateLiteral(e){return new V(z(e.getText()))}visitDateTimeLiteral(e){return new V(z(e.getText()))}visitTimeLiteral(e){return new Z(z(e.getText()))}visitQualifiedIdentifierTerm(e){return new X(e.getText())}visitPolarityExpression(e){const t=this.visit(e.expression());if("NumberLiteral"===t.kind)return"-"===e.polarOp().getText()&&(t.value*=-1),t;throw new M('Unexpected token "'+e.getText()+'"')}visitExternalConstantTerm(e){return new Ge(e.externalConstant().getText().substring(1))}visitParenthesizedExpression(e){const t=this.visit(e.expression());return new P(t)}visitArrayExpression(e){return new L(e.expression_list().map((e=>this.visit(e))))}visitComparisonExpression(e){return new k({op:e.compOp().getText(),left:this.visit(e.expression(0)),right:this.visit(e.expression(1))})}visitLogicalExpression(e){const t=[],r=(e,s)=>{for(const i of e){if(i instanceof le&&i.logOp().getText()===s){r(i.expression_list(),i.logOp().getText());continue}const e=this.visit(i);t.push(e)}};return r(e.expression_list(),e.logOp().getText()),new D({op:e.logOp().getText(),items:t})}visitArithmeticExpression(e){const t=new b,r=(e,s)=>{for(let i=0,n=e.length;i<n;i++){const n=e[i];if(n instanceof ce){r(n.expression_list(),n.arthOp().getText());continue}const o=this.visit(n);t.append(s||"+",o)}};return r(e.expression_list(),e.arthOp().getText()),t}}class Qe extends n.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,s,i,n){this.errors.push(new H(i,{recognizer:e,offendingSymbol:t,line:r,e:n}))}}var Xe,Ke;!function(e){e.X_Opra_Version="X-Opra-Version",e.X_Opra_DataType="X-Opra-DataType",e.X_Opra_Count="X-Opra-Count",e.WWW_Authenticate="WWW-Authenticate",e.Authorization="Authorization",e.Proxy_Authenticate="Proxy-Authenticate",e.Proxy_Authorization="Proxy-Authorization",e.Age="Age",e.Cache_Control="Cache-Control",e.Clear_Site_Data="Clear-Site-Data",e.Expires="Expires",e.Pragma="Pragma",e.Last_Modified="Last-Modified",e.ETag="ETag",e.If_Match="If-Match",e.If_None_Match="If-None-Match",e.If_Modified_Since="If-Modified-Since",e.If_Unmodified_Since="If-Unmodified-Since",e.Vary="Vary",e.Connection="Connection",e.Keep_Alive="Keep-Alive",e.Accept="Accept",e.Accept_Encoding="Accept-Encoding",e.Accept_Language="Accept-Language",e.Expect="Expect",e.Cookie="Cookie",e.Set_Cookie="Set-Cookie",e.Access_Control_Allow_Origin="Access-Control-Allow-Origin",e.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",e.Access_Control_Allow_Headers="Access-Control-Allow-Headers",e.Access_Control_Allow_Methods="Access-Control-Allow-Methods",e.Access_Control_Expose_Headers="Access-Control-Expose-Headers",e.Access_Control_Max_Age="Access-Control-Max-Age",e.Access_Control_Request_Headers="Access-Control-Request-Headers",e.Access_Control_Request_Method="Access-Control-Request-Method",e.Origin="Origin",e.Timing_Allow_Origin="Timing-Allow-Origin",e.Content_Disposition="Content-Disposition",e.Content_ID="Content-ID",e.Content_Length="Content-Length",e.Content_Type="Content-Type",e.Content_Transfer_Encoding="Content-Transfer-Encoding",e.Content_Encoding="Content-Encoding",e.Content_Language="Content-Language",e.Content_Location="Content-Location",e.Forwarded="Forwarded",e.X_Forwarded_For="X-Forwarded-For",e.X_Forwarded_Host="X-Forwarded-Host",e.X_Forwarded_Proto="X-Forwarded-Proto",e.Via="Via",e.Location="Location",e.From="From",e.Host="Host",e.Referer="Referer",e.Referrer_Policy="Referrer-Policy",e.User_Agent="User-Agent",e.Allow="Allow",e.Server="Server",e.Accept_Ranges="Accept-Ranges",e.Range="Range",e.If_Range="If-Range",e.Content_Range="Content-Range",e.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",e.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",e.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",e.Content_Security_Policy="Content-Security-Policy",e.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",e.Expect_CT="Expect-CT",e.Feature_Policy="Feature-Policy",e.Strict_Transport_Security="Strict-Transport-Security",e.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",e.X_Content_Type_Options="X-Content-Type-Options",e.X_Download_Options="X-Download-Options",e.X_Frame_Options="X-Frame-Options",e.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",e.X_Powered_By="X-Powered-By",e.X_XSS_Protection="X-XSS-Protection",e.Transfer_Encoding="Transfer-Encoding",e.TE="TE",e.Trailer="Trailer",e.Sec_WebSocket_Key="Sec-WebSocket-Key",e.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",e.Sec_WebSocket_Accept="Sec-WebSocket-Accept",e.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",e.Sec_WebSocket_Version="Sec-WebSocket-Version",e.Date="Date",e.Retry_After="Retry-After",e.Server_Timing="Server-Timing",e.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control"}(Xe||(Xe={})),function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLYHINTS=103]="EARLYHINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.AMBIGUOUS=300]="AMBIGUOUS",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.TOO_EARLY=425]="TOO_EARLY",e[e.UPGRADE_REQUIRED=428]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(Ke||(Ke={}));const Ye=Object.keys(Xe),Ze=Ye.map((e=>e.toLowerCase()));function Je(e,t){return e&&Object.keys(e).reduce(((r,s)=>{const i=e[s],n=t?Ye[Ze.indexOf(s.toLowerCase())]||s.replace(/(^\w|[A-Z]|\b\w)/g,(function(e){return e.toUpperCase()})):s.toLowerCase();return"set-cookie"===s.toLowerCase()?r[n]=Array.isArray(i)?i:[i]:r[n]=Array.isArray(i)?i.join(";"):i,r}),{})||{}}class et{constructor(e){this.method=e.method,this.url=encodeURI(decodeURI(e.url)),this.headers=e.headers,this.data=e.data}}class tt{constructor(e){this.status=e.status,this.headers=e.headers,this.data=e.data}}const rt="\r\n",st=/ *charset=./i;class it{constructor(){this._parts=[],this.boundary="batch_"+a.uid(12)}addRequestPart(e,t){const r={...Je(t?.headers||{},!0),[Xe.Content_Type]:"application/http",[Xe.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Xe.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new et(e)}),this}addHttpResponse(e,t){const r={...Je(t?.headers||{},!0),[Xe.Content_Type]:"application/http",[Xe.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Xe.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new tt(e)}),this}addBatch(e,t){const r={...Je(t?.headers||{},!0),[Xe.Content_Type]:"application/http",[Xe.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Xe.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:e}),this}stream(){const e=[];return this._build(e),o(e).flatten().toNodeStream()}_build(e){for(const t of this._parts){if(!(t.content instanceof et||t.content instanceof tt))throw new Error("Not implemented yet");{let r=t.content.data,s=0;const i=Je(t.content.headers);if(r){const e=String(i["content-type"]||"").split(/\s*;\s*/);let t="";if(f(r)?s=parseInt(String(i["content-length"]),10)||0:"object"==typeof r?"function"==typeof r.stream?(e[0]=r.type||"binary",s=r.size,r=r.stream()):Buffer.isBuffer(r)?i["content-length"]=String(r.length):(e[0]=e[0]||"application/json",t="utf-8",r=Buffer.from(JSON.stringify(r),"utf-8"),s=r.length):(e[0]=e[0]||"text/plain",t="utf-8",r=Buffer.from(String(r),"utf-8"),s=r.length),e[0]){if(t){const r=e.findIndex((e=>st.test(String(e))));r>0?e[r]="charset="+t:e.join("charset="+t)}i["content-type"]=e.join(";")}s&&(i["content-length"]=String(s))}let n="--"+this.boundary+rt;for(const[e,r]of Object.entries(t.headers))""!==r&&null!=r&&(n+=e+": "+(Array.isArray(r)?r.join(";"):r)+rt);if(n+=rt,t.content instanceof et?n+=(t.content.method||"GET").toUpperCase()+" "+t.content.url+" HTTP/1.1"+rt:n+="HTTP/1.1 "+t.content.status+(Ke[t.content.status]||"Unknown")+rt,t.content.headers)for(const[e,r]of Object.entries(t.content.headers))""!==r&&null!=r&&("set-cookie"===e&&Array.isArray(r)?r.forEach((t=>n+=e+": "+t)):n+=e+": "+(Array.isArray(r)?r.join(";"):r)+rt);n+=rt,e.push(Buffer.from(n,"utf-8")),r&&(e.push(r),e.push(Buffer.from(rt+rt)))}}e.push(Buffer.from("--"+this.boundary+"--"+rt,"utf-8"))}}const nt="opra:complex_type.fields",ot="opra:resolver.metadata",at="opra:ignore_resolver-method",ct="opra:mapped_type.metadata",lt=["create","delete","get","update"],ht=[...lt,"count","deleteMany","updateMany","search"];var ut;!function(e){e.Version="1.0",e.isDataType=function(e){return e&&"object"==typeof e&&("ComplexType"===e.kind||"SimpleType"===e.kind||"UnionType"===e.kind)},e.isComplexType=function(e){return e&&"object"==typeof e&&"ComplexType"===e.kind},e.isSimpleType=function(e){return e&&"object"==typeof e&&"SimpleType"===e.kind},e.isUnionTypee=function(e){return e&&"object"==typeof e&&"UnionType"===e.kind},e.isResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind||"CollectionResource"===e.kind||"SingletonResource"===e.kind},e.isCollectionResource=function(e){return e&&"object"==typeof e&&"CollectionResource"===e.kind},e.isSingletonResource=function(e){return e&&"object"==typeof e&&"SingletonResource"===e.kind},e.isContainerResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind}}(ut||(ut={}));class pt extends Map{constructor(e,t){super(),this._keyMap=new Map,this._keyOrder=[],this._wellKnownKeyMap=new Map,t&&t.forEach((e=>this._wellKnownKeyMap.set(e.toLowerCase(),e))),"function"==typeof e?.forEach?e.forEach(((e,t)=>this.set(t,e))):e&&"object"==typeof e&&Object.keys(e).forEach((t=>this.set(t,e[t])))}clear(){super.clear(),this._keyMap.clear(),this._keyOrder=[]}get(e){const t=this._getOriginalKey(e);return super.get(t)}has(e){return this._keyMap.has(this._getLowerKey(e))}set(e,t){return e=this._getOriginalKey(e),this._keyMap.set(this._getLowerKey(e),e),this._keyOrder.includes(e)||this._keyOrder.push(e),super.set(e,t)}keys(){return this._keyOrder.values()}values(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:r.get(t[e])})}}entries(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],r.get(t[e])]})}}delete(e){const t=this._getOriginalKey(e),r=this._getLowerKey(e);this._keyMap.delete(r);const s=this._keyOrder.indexOf(t);return s>=0&&this._keyOrder.splice(s,1),super.delete(t)}sort(e){return this._keyOrder.sort(e),this}[Symbol.iterator](){return this.entries()}_getOriginalKey(e){return"string"==typeof e?this._keyMap.get(e.toLowerCase())??this._wellKnownKeyMap.get(e.toLowerCase())??e:e}_getLowerKey(e){return"string"==typeof e?e.toLowerCase():e}}function dt(e){return"function"==typeof e&&!(!e.prototype||!e.prototype.constructor)}const _t={kind:"UnionType",description:"Any value",ctor:Object,types:[]},ft={kind:"SimpleType",description:"A stream of bytes, base64 encoded",ctor:Object.getPrototypeOf(Buffer.from("")).constructor,parse:e=>Buffer.from(e),serialize:e=>Buffer.isBuffer(e)?e.toString("base64"):void 0},yt={kind:"SimpleType",description:"BigInt number",ctor:Object.getPrototypeOf(BigInt(0)).constructor,parse:e=>BigInt(e),serialize:e=>String(e)},mt={kind:"SimpleType",description:"Simple true/false value",ctor:Boolean,parse:e=>i.toBoolean(e),serialize:e=>i.toBoolean(e)},Tt={kind:"SimpleType",description:"A date, date-time or partial date",ctor:String,parse:e=>i.toDate(e),serialize:e=>String(e)},xt={kind:"SimpleType",description:"A date, date-time or partial date in string format",ctor:String,parse:e=>i.toString(e),serialize:e=>i.toString(e)},Et={kind:"SimpleType",description:"A guid value",ctor:String,parse:e=>i.toString(e),serialize:e=>i.toString(e)},gt={kind:"SimpleType",description:"An integer number",ctor:Number,parse:e=>i.toInt(e),serialize:e=>i.toInt(e)},Rt={kind:"SimpleType",description:"Both Integer as well as Floating-Point numbers",ctor:Number,parse:e=>i.toNumber(e),serialize:e=>i.toNumber(e)},wt={kind:"ComplexType",description:"A non modelled object",ctor:Object,additionalFields:!0,parse:e=>e,serialize:e=>e},Ct={kind:"SimpleType",description:"A sequence of characters",ctor:String,parse:e=>i.toString(e),serialize:e=>i.toString(e)},Ot=Object.getPrototypeOf(BigInt(0)).constructor,It=Object.getPrototypeOf(Buffer.from("")).constructor,At=new pt;At.set("any",_t),At.set("base64Binary",ft),At.set("bigint",yt),At.set("boolean",mt),At.set("date",Tt),At.set("dateString",xt),At.set("guid",Et),At.set("integer",gt),At.set("number",Rt),At.set("object",wt),At.set("string",Ct);const vt=new Map;function bt(e,t){return u({},e,{deep:!0,clone:!0,filter:(e,r)=>{const s=e[r];return null!=s&&!t||"function"!=typeof s&&("object"!=typeof s||h(s)||Array.isArray(s))}})}async function Nt(e){const t=Object.getPrototypeOf(e).constructor,r=Reflect.getMetadata("opra:resource.metadata",t);if(!r)throw new TypeError(`Class "${t.name}" doesn't have "Resource" metadata information`);const s=bt(r);if(s.instance=e,s.name=r.name||t.name.replace(/(Resource|Controller)$/,""),ut.isCollectionResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let s,i;const n=(e,t)=>{i=e[t],s=Reflect.getMetadata(ot,e,t),null==i&&s&&(e=Object.getPrototypeOf(e),i=e[t])};for(const o of ht){if(n(t,o),"function"!=typeof i)continue;const a=e[o]={...s};Reflect.hasMetadata(at,r.constructor,o)||(a.handler=i.bind(t),i=t["pre_"+o],"function"==typeof i&&(e["pre_"+o]=i.bind(t)))}return e}(s);if(ut.isSingletonResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let s,i;const n=(e,t)=>{i=e[t],s=Reflect.getMetadata(ot,e,t),null==i&&s&&(e=Object.getPrototypeOf(e),i=e[t])};for(const o of lt){if(n(t,o),"function"!=typeof i)continue;const a=e[o]={...s};Reflect.hasMetadata(at,r.constructor,o)||(a.handler=i.bind(t),i=t["pre_"+o],"function"==typeof i&&(e["pre_"+o]=i.bind(t)))}return e}(s);throw new TypeError("Invalid Resource metadata")}vt.set(Boolean,"boolean"),vt.set(String,"string"),vt.set(Number,"number"),vt.set(Date,"date"),vt.set(Ot,"bigint"),vt.set(It,"base64Binary"),vt.set(Object,"object");const Lt=Symbol.for("opra.optional-lib.sqb-connect");async function St(e){const t=Reflect.getMetadata("opra:data_type.metadata",e);if(!t)throw new TypeError(`Class "${e}" doesn't have "DataType" metadata information`);if(ut.isComplexType(t))return await async function(e,t){const r=bt(t);r.ctor=e;const s=Reflect.getMetadata(ct,e);s&&(r.extends=[...s.map((e=>bt(e)))]);const i=Reflect.getMetadata(nt,e);if(i){r.fields=bt(i);for(const[t,s]of Object.entries(r.fields)){if("function"==typeof s.type){const e=vt.get(s.type);e&&(s.type=e)}const r=globalThis[Lt]?.SqbConnect;let i;if(r){const{EntityMetadata:n,isAssociationField:o}=r,a=n.get(e);if(i=a&&n.getField(a,t),i){if((s.type===Function||"object"===s.type||s.type===Object||"any"===s.type)&&(s.type="any",o(i))){i.association.returnsMany()||delete s.isArray;const e=await i.association.resolveTarget();e&&(s.type=e.ctor)}i.exclusive&&void 0===s.exclusive&&(s.exclusive=i.exclusive)}}if(i&&"column"===i.kind){const e=r.DataType;if("number"===s.type||s.type===Number)switch(i.dataType){case e.INTEGER:case e.SMALLINT:s.type="integer";break;case e.BIGINT:s.type="bigint"}else if(("string"===s.type||s.type===String)&&i.dataType===e.GUID)s.type="guid";i.notNull&&void 0===s.required&&(s.required=i.notNull),i.exclusive&&void 0===s.exclusive&&(s.exclusive=i.exclusive),void 0!==i.default&&void 0===s.default&&(s.default=i.default)}}}return r}(e,t);if(ut.isSimpleType(t))return await async function(e,t){const r=bt(t);return r.ctor=e,r}(e,t);throw new TypeError("Invalid DataType metadata")}const kt=Symbol.for("opra.optional-lib.sqb-connect");class Dt{constructor(e){this._dataTypes=new pt,this._resources=new pt,this._args=e}buildSchema(){const e={...this._args,version:ut.Version};return this._dataTypes.size&&(e.types=Array.from(this._dataTypes.keys()).sort().reduce(((e,t)=>(e[t]=this._dataTypes.get(t),e)),{})),this._resources.size&&(e.resources=Array.from(this._resources.keys()).sort().reduce(((e,t)=>(e[t]=this._resources.get(t),e)),{})),e}async addDataTypeSchema(e,t){if(!ut.isDataType(t))throw new TypeError("Invalid DataType schema");const r=this._dataTypes.get(e);if(r){if(r.kind!==t.kind||!r.ctor||r.ctor!==t.ctor)throw new Error(`An other instance of "${e}" data type previously defined`)}else if(this._dataTypes.set(e,t),ut.isComplexType(t)){if(t.extends)for(const e of t.extends)"string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type));if(t.fields)for(const e of Object.values(t.fields))e.type=e.type||"string","string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type))}}async addDataTypeClass(e){if(!dt(e=l.isPromise(e)?await e:e))return this.addDataTypeClass(e());const t=vt.get(e);if(t)return t;const r=await St(e),s=r.name,i=r;return delete i.name,await this.addDataTypeSchema(s,i),s}async addResourceSchema(e,t){if(!ut.isResource(t))throw new TypeError("Invalid Resource schema");if(this._resources.has(e))throw new Error(`An other instance of "${e}" resource previously defined`);if(ut.isCollectionResource(t)||ut.isSingletonResource(t)){const e="function"==typeof t.type?await this.addDataTypeClass(t.type):t.type;if(t.type=e,!this._dataTypes.has(t.type)&&!At.has(t.type))throw new Error(`Resource registration error. Type "${t.type}" not found.`)}if(ut.isCollectionResource(t)&&!t.keyFields){const r=this._dataTypes.get(t.type),s=globalThis[kt]?.SqbConnect;if(s&&r?.ctor){const e=s.EntityMetadata.get(r?.ctor);if(e?.indexes){const r=e.indexes.find((e=>e.primary));r&&(t.keyFields=r.columns)}}if(t.keyFields=Array.isArray(t.keyFields)?t.keyFields.length?t.keyFields:"":t.keyFields,!t.keyFields)throw new TypeError(`You must provide keyFields for "${e}" entity resource`)}this._resources.set(e,t)}async addResourceInstance(e){let t;"function"==typeof(e=l.isPromise(e)?await e:e)?dt(e)?(t={},Object.setPrototypeOf(t,e.prototype)):t=await e():t=e;const r=await Nt(t),s=r.name,i=r;return delete i.name,await this.addResourceSchema(s,i),s}}function Pt(e,t){return e<t?-1:e>t?1:0}const Ut=Symbol.for("nodejs.util.inspect.custom"),Mt="[0m",Ft="[33m",Ht="[35m";class $t{constructor(e,t,r){this._document=e,this._name=t,this._metadata=r}get document(){return this._document}get kind(){return this._metadata.kind}get name(){return this._name}get description(){return this._metadata.description}get ctor(){return this._metadata.ctor}parse(e){return this._metadata.parse?this._metadata.parse(e):e}getSchema(e){return bt(this._metadata,e)}}class jt extends $t{constructor(e,t,r){super(e,t,{kind:"ComplexType",...r}),this._initialized=!1,this.ownFields=new pt,this.fields=new pt}get abstract(){return!!this._metadata.abstract}get additionalFields(){return this._metadata.additionalFields||this._mixinAdditionalFields}get extends(){return this._metadata.extends}getField(e){if(e.includes(".")){let t=this;const r=e.split(".");let s;for(const e of r)s=t.getField(e),t=t.document.getDataType(s.type||"string");return s}const t=this.fields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have a field named "${e}"`);return t}getFieldType(e){const t=this.getField(e);return this.document.getDataType(t.type||"string")}getOwnField(e){const t=this.ownFields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have an own field named "${e}"`);return t}getSchema(){const e=super.getSchema();if(this.additionalFields&&(e.additionalFields=this.additionalFields),this.ownFields.size){e.fields={};for(const[t,r]of this.ownFields)e.fields[t]=bt(r),delete e.fields[t].name}return e}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[Ut](){return`[${Ft+Object.getPrototypeOf(this).constructor.name+Mt} ${Ht+this.name+Mt}]`}init(){if(this._initialized)return;this._initialized=!0;const e=this._metadata;if(e.extends)for(const t of e.extends){const e=this.document.types.get(t.type);if(!e)throw new TypeError(`Extending schema (${t.type}) of data type "${this.name}" does not exists`);if(!(e instanceof jt))throw new TypeError(`Cannot extend ${this.name} from a "${e.kind}"`);e.init(),e.additionalFields&&(this._mixinAdditionalFields=!0);for(const[t,r]of e.fields){const e=bt(r);e.name=t,e.parent=this,this.fields.set(t,e)}}if(e.fields)for(const[t,r]of Object.entries(e.fields)){if(!this.document.types.get(r.type))throw new TypeError(`Type "${r.type}" defined for "${this.name}.${t}" does not exists`);const e=bt(r);e.name=t,this.fields.set(t,e),this.ownFields.set(t,e)}}}class Bt extends $t{constructor(e,t,r){super(e,t,{kind:"SimpleType",...r})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[Ut](){return`[${Ft+Object.getPrototypeOf(this).constructor.name+Mt} ${Ht+this.name+Mt}]`}}class qt extends $t{constructor(e,t,r){super(e,t,c({kind:"UnionType",...r},["types"])),this.types=r.types,this.hasAdditionalFields="any"===t||!!this.types.find((e=>e instanceof jt&&e.additionalFields))}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[Ut](){return`[${Ft+Object.getPrototypeOf(this).constructor.name+Mt} ${Ht+this.name+Mt}]`}}const zt=/^([^.]+)\.(.*)$/;function Gt(e){if(e.length)return Vt(e,{})}function Vt(e,t){for(const r of e){const e=zt.exec(r);if(e){const r=e[1];if(!0===t[r])continue;const s=t[r]="object"==typeof t[r]?t[r]:{};Vt([e[2]],s)}else t[r]=!0}return t}function Wt(e,t,r,s=""){return Qt([],e,t,Gt(r)||{},"",s,{additionalFields:!0})}function Qt(e,t,r,s,i="",n="",o){let a="";for(const c of Object.keys(s)){const l=s[c],h=r?.fields.get(c);if(!h){if(a=i?i+"."+c:c,!o?.additionalFields||r&&!r.additionalFields)throw new TypeError(`Unknown field "${a}"`);"object"==typeof l?Qt(e,t,void 0,l,a,n,o):e.push(a);continue}a=i?i+"."+h.name:h.name;const u=t.getDataType(h.type||"string");if("object"!=typeof l)e.findIndex((e=>e.startsWith(a+".")))>=0&&(e=e.filter((e=>!e.startsWith(a+".")))),e.push(a);else{if(!(u&&u instanceof jt))throw new TypeError(`"${n?n+"."+a:a}" is not a complex type and has no sub fields`);if(e.findIndex((e=>e===i))>=0)continue;e=Qt(e,t,u,l,a,n,o)}}return e}class Xt{constructor(e,t,r){this.document=e,this.name=t,this.metadata=r}get instance(){return this.metadata.instance}get kind(){return this.metadata.kind}get description(){return this.metadata.description}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}validateQueryOptions(){}getSchema(e){return bt(this.metadata,e)}[Ut](){return`[${Ft+Object.getPrototypeOf(this).constructor.name+Mt} ${Ht+this.name+Mt}]`}}class Kt extends Xt{constructor(e,t,r,s){if(!s.keyFields)throw new TypeError(`You should provide key fields for ${t}`);super(e,t,s),s.keyFields=Array.isArray(s.keyFields)?s.keyFields:[s.keyFields],s.keyFields.forEach((e=>r.getField(e))),this.dataType=r,s.search&&s.search.sortFields&&(s.search.sortFields=Wt(e,r,s.search.sortFields))}get keyFields(){return this.metadata.keyFields}get create(){return this.metadata.create}get count(){return this.metadata.count}get delete(){return this.metadata.delete}get deleteMany(){return this.metadata.deleteMany}get get(){return this.metadata.get}get update(){return this.metadata.update}get updateMany(){return this.metadata.updateMany}get search(){return this.metadata.search}getSchema(e){const t=super.getSchema(e);t.keyFields.length<2&&(t.keyFields=t.keyFields[0]);for(const e of ht)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class Yt extends Xt{constructor(e,t,r,s){if(!(r instanceof jt))throw new TypeError('You should provide a ComplexType as "dataType" argument');super(e,t,s),this.dataType=r}get create(){return this.metadata.create}get delete(){return this.metadata.delete}get get(){return this.metadata.get}get update(){return this.metadata.update}getSchema(e){const t=super.getSchema(e);for(const e of lt)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class Zt{constructor(e){this._ownTypes=new pt,this._types=new pt,this._resources=new pt,this._meta=c(e,["types","resources"]);for(const[e,t]of At.entries())this._addDataType(e,t,!1);if(e.types)for(const[t,r]of Object.entries(e.types))this._addDataType(t,r,!0);if(this._initTypes(),e.resources)for(const[t,r]of Object.entries(e.resources))this._addResource(t,r)}get info(){return this._meta.info}get types(){return this._types}getDataType(e){const t=this.types.get(e);if(t)return t;throw new Error(`Data type "${e}" does not exists`)}getComplexDataType(e){const t=this.getDataType(e);if(t&&t instanceof jt)return t;throw new Error(`Data type "${e}" is not a ComplexType`)}getSimpleDataType(e){const t=this.getDataType(e);if(t&&t instanceof Bt)return t;throw new Error(`Data type "${e}" is not a SimpleType`)}getUnionDataType(e){const t=this.getDataType(e);if(t&&t instanceof qt)return t;throw new Error(`Data type "${e}" is not a UnionType`)}get resources(){return this._resources}get servers(){return this._meta.servers}getResource(e){const t=this.resources.get(e);if(!t)throw new Error(`Resource "${e}" does not exists`);return t}getCollectionResource(e){const t=this.getResource(e);if(!(t instanceof Kt))throw new Error(`"${e}" is not a CollectionResource`);return t}getSingletonResource(e){const t=this.getResource(e);if(!(t instanceof Yt))throw new Error(`"${e}" is not a SingletonResource`);return t}getMetadata(e){const t={version:ut.Version,info:bt(this.info)};return this._ownTypes.size&&(t.types=Array.from(this._ownTypes.values()).sort(((e,t)=>Pt(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),this.resources.size&&(t.resources=Array.from(this._resources.values()).sort(((e,t)=>Pt(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),t}_addDataType(e,t,r){let s=this._types.get(e);if(s)return s;if(ut.isComplexType(t))s=new jt(this,e,t);else if(ut.isSimpleType(t))s=new Bt(this,e,t);else{if(!ut.isUnionTypee(t))throw new TypeError("Invalid data type schema");s=new qt(this,e,{...t,types:[]})}return this._types.set(e,s),r&&this._ownTypes.set(e,s),s}_addResource(e,t){if(!ut.isCollectionResource(t)&&!ut.isSingletonResource(t))throw new TypeError(`Unknown resource kind (${t.kind})`);{const r=this.getDataType(t.type);if(!r)throw new TypeError(`Datatype "${t.type}" declared in CollectionResource (${e}) does not exists`);if(!(r instanceof jt))throw new TypeError(`${t.type} is not an ComplexType`);ut.isCollectionResource(t)?this.resources.set(e,new Kt(this,e,r,t)):this.resources.set(e,new Yt(this,e,r,t))}}_initTypes(){for(const e of this._types.values())e instanceof jt&&e.init()}static async create(e){const t=new Dt(e);if(e.types)if(Array.isArray(e.types))for(const r of e.types)await t.addDataTypeClass(r);else for(const[r,s]of Object.entries(e.types))await t.addDataTypeSchema(r,s);if(e.resources)if(Array.isArray(e.resources))for(const r of e.resources)await t.addResourceInstance(r);else for(const[r,s]of Object.entries(e.resources))await t.addResourceSchema(r,s);const r=t.buildSchema();return new Zt(r)}}function Jt(e,t){if(!e)return"";for(;t&&e.startsWith("/");)e=e.substring(1);for(;e.endsWith("/");)e=e.substring(0,e.length-1);return e}const er=/^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;function tr(t){const r=er.exec(t);if(!r)throw Object.assign(new TypeError("Invalid URL path"),{code:"ERR_INVALID_URL_PATH",input:t});const s=decodeURIComponent(r[1]);let i;if(r[2]){const s=decodeURIComponent(r[2]||""),n=e.splitString(s,{delimiters:";",quotes:!0,escape:!1});for(const r of n){const s=e.splitString(r,{delimiters:"=",quotes:!0,escape:!1});if(n.length>1&&s.length<2||i&&s.length>=2&&"object"!=typeof i||s.length<2&&"object"==typeof i)throw Object.assign(new TypeError("Invalid URL path. name:value pair required for multiple key format"),{pathComponent:t,code:"ERR_INVALID_URL_PATH"});s.length>=2?(i=i||{},i[s.shift()||""]=s.join("=")):i=s[0]}}return r[3]?{resource:s,key:i,typeCast:r[3]}:{resource:s,key:i}}function rr(e,t,r){if(null==e)return"";let s="";if(""!==t&&null!=t)if(h(t)){const e=[];for(const r of Object.keys(t))e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));s=e.join(";")}else s=encodeURIComponent(""+t);return r&&(r=encodeURIComponent(r)),encodeURIComponent(e).replace(/%24/,"$")+(s?"@"+s:"")+(r?"::"+r:"")}const sr=Symbol.for("nodejs.util.inspect.custom");class ir{constructor(e){this.resource=e.resource,this.key=e.key,this.typeCast=e.typeCast}toString(){const e=rr(this.resource,this.key,this.typeCast);return e&&Object.setPrototypeOf(e,ir.prototype),e}[sr](){const e={resource:this.resource};return null!=this.key&&(e.key=this.key),null!=this.typeCast&&(e.typeCast=this.typeCast),e}}const nr=Symbol.for("nodejs.util.inspect.custom");class or extends p.EventEmitter{constructor(...e){super(),this._entries=[];for(const t of e)y(t)?this._parse(t.pathname):t instanceof or?this._entries.push(...t._entries):this.add(t)}get size(){return this._entries.length}add(e,t,r){this._add(e,t,r),this.emit("change")}clear(){this._entries=[],this.emit("change")}get(e){return this._entries[e]}join(t){const r=e.tokenize(Jt(t,!0),{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){const t=tr(e);this._add(t)}return this.emit("change"),this}entries(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],e]})}}values(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:t[e]})}}forEach(e){for(const t of this._entries)e.call(this,t.resource,t.key,this)}getResource(e){const t=this._entries[e];return null==t?void 0:t.resource}getKey(e){const t=this._entries[e];return null==t?void 0:t.key}toString(){return this._entries.map((e=>rr(e.resource,e.key,e.typeCast))).join("/")}[Symbol.iterator](){return this.entries()}[nr](){return this._entries}_add(e,t,r){e instanceof ir?this._entries.push(e):"object"==typeof e?this._entries.push(new ir(e)):this._entries.push(new ir({resource:e,key:t,typeCast:r}))}_parse(t){if(!t)return;const r=e.tokenize(t,{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){if(!e)continue;const t=tr(e);this._add(t)}this.emit("change")}}class ar{}const cr=["true","t","yes","y","1"],lr=["false","f","no","n","0"];const hr=/^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;function ur(e,t,r){if(""===e||null==e)return"";const s=e.match(hr);if(!s)throw new TypeError(`"${e}" is not a valid date.`);let i=s[1]+"-"+(s[2]||"01")+"-"+(s[3]||"01");return t&&(i+="T"+(s[4]||"00")+":"+(s[5]||"00")+":"+(s[6]||"00")+(s[7]?"."+s[7]:""),r&&(i+=s[8]?"Z":s[9]?s[9]+(s[10]||"00")+":"+(s[11]||"00"):"")),i}class pr extends ar{constructor(e){super(),this.max=e?.max,this.min=e?.min}parse(e){const t="number"==typeof e?e:parseFloat(e);if(isNaN(t))throw new TypeError(`"${e}" is not a valid number`);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return"number"==typeof e?""+e:""}}class dr extends pr{constructor(e){super(e),this.enum=e?.enum}parse(e){const t=super.parse(e);if(!Number.isInteger(t))throw new TypeError(`"${e}" is not a valid integer`);if(this.enum&&!this.enum.includes(t))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return t}}const _r={integer:new dr,number:new pr,string:new class extends ar{constructor(e){super(),this.maxLength=e?.maxLength,this.minLength=e?.minLength,this.enum=e?.enum}parse(e){if(null!=this.minLength&&e.length<this.minLength)throw new TypeError(`Value must be at least ${this.minLength} character${this.minLength>1?"s":""} long.`);if(null!=this.maxLength&&e.length>this.maxLength)throw new TypeError(`Value can be up to ${this.maxLength} character${this.maxLength>1?"s":""} long.`);if(this.enum&&!this.enum.includes(e))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return e}stringify(e){return null==e?"":""+e}},boolean:new class extends ar{parse(e){if(""===e)return!0;if("boolean"==typeof e)return e;if(cr.includes(e.toLowerCase()))return!0;if(lr.includes(e.toLowerCase()))return!1;throw new TypeError(`"${e}" is not a valid boolean`)}stringify(e){return"boolean"==typeof e?e?"true":"false":""}},date:new class extends ar{constructor(e){super(),this.max=e?.max?ur(e.max):void 0,this.min=e?.min?ur(e.min):void 0,this.time=e?.time??!0,this.timeZone=e?.timeZone??!0}parse(e){const t=ur(e,this.time,this.timeZone);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return ur(e,this.time,this.timeZone)}},filter:new class extends ar{parse(e){return e instanceof I?e:function(e,t){const r=new n.CharStream(e),s=new ee(r),i=new n.CommonTokenStream(s),o=new te(i);o.buildParseTrees=!0;const a=[],c=new Qe(a);s.removeErrorListeners(),s.addErrorListener(c),o.removeErrorListeners(),o.addErrorListener(c);const l=o.root(),h=(t=t||new We).visit(l);if(a.length){const e=[];for(const t of a)e.push(t.message+" at (line: "+t.line+" column: "+t.charPositionInLine+")");const t=new M(e.join("\n"));throw t.errors=a,t}return h}(e)}stringify(e){return e?""+e:""}}},fr=Symbol.for("nodejs.util.inspect.custom");class yr extends p.EventEmitter{constructor(e){super(),this._params=new pt,this._entries=new pt,this._size=0,this.defineParam("$filter",{format:"filter"}),this.defineParam("$limit",{format:new dr({min:0})}),this.defineParam("$skip",{format:new dr({min:0})}),this.defineParam("$pick",{format:"string",array:"strict"}),this.defineParam("$omit",{format:"string",array:"strict"}),this.defineParam("$include",{format:"string",array:"strict"}),this.defineParam("$sort",{format:"string",array:"strict"}),this.defineParam("$distinct",{format:"boolean"}),this.defineParam("$count",{format:"boolean"}),e&&("string"==typeof e?this.parse(e):this.addAll(e))}get size(){return this._size}addAll(e){let t=!1;if("function"==typeof e.forEach)e.forEach(((e,r)=>{t=this._add(r,e)||t}));else if("object"!=typeof e)throw new TypeError("Invalid argument");t&&this.emit("change")}append(e,t){this._add(e,t)&&this.emit("change")}clear(){this._entries.clear(),this._size=0,this.emit("change")}defineParam(e,t){if(!e)throw new Error("Parameter name required");const r={...t,name:e,format:t?.format||"string"};if("string"==typeof r.format&&!_r[r.format])throw new Error(`Unknown data format "${r.format}"`);return r.format=r.format||"string",this._params.set(e,r),this}delete(e){this._delete(e)&&this.emit("change")}entries(){const e=[];return this.forEach(((t,r)=>{e.push([r,t])})),e.values()}forEach(e){for(const[t,r]of this._entries.entries())for(let s=0;s<r.length;s++)e(r[s],t,this)}get(e,t){const r=this._entries.get(e),s=r&&r[t||0];return null==s?null:s}getAll(e){const t=this._entries.get(e);return t?t.slice(0):[]}has(e){return this._entries.has(e)}keys(){return this._entries.keys()}set(e,t){this._delete(e),this._add(e,t),this.emit("change")}sort(e){this._entries.sort(e),this.emit("change")}values(){const e=[];return this.forEach((t=>e.push(t))),e.values()}toString(){let e="";return this.forEach(((t,r)=>{const s=this._params.get(r),i=s?"string"==typeof s.format?_r[s.format]:s.format:void 0,n=e=>encodeURIComponent(i?i.stringify(e,r):null==e?"":""+e),o=Array.isArray(t)?t.map(n).join(s?.arrayDelimiter||","):n(t);o&&(e.length>0&&(e+="&"),e+=r+"="+o)})),e}parse(t){if(this._entries.clear(),this._size=0,t&&t.startsWith("?")&&(t=t.substring(1)),!t)return;const r=e.tokenize(t,{delimiters:"&",quotes:!0,brackets:!0});for(const t of r){if(!t)continue;const r=e.tokenize(t,{delimiters:"=",quotes:!0,brackets:!0}),s=decodeURIComponent(r.next()||""),i=r.join("="),n=this._params.get(s);if(n?.array){const t=e.splitString(i,{delimiters:n?.arrayDelimiter||",",brackets:!0,quotes:!0}).map((e=>decodeURIComponent(e)));this._add(s,t)}else this._add(s,decodeURIComponent(i))}this.emit("change")}toURLSearchParams(){const e=new URLSearchParams;return this.forEach(((t,r)=>{const s=this._params.get(r),i=s?"string"==typeof s.format?_r[s.format]:s.format:void 0,n=e=>i?i.stringify(e,r):null==e?"":""+e,o=Array.isArray(t)?t.map(n).join(s?.arrayDelimiter||","):n(t);e.append(r,o)})),e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"URLSearchParams"}[fr](){return this._entries}_delete(e){const t=this._entries.get(e);return!!t&&(this._size-=t.length,this._entries.delete(e),!0)}_add(e,t){const r=this._params.get(e),s=r?"string"==typeof r.format?_r[r.format]:r.format:void 0,i=t=>s?s.parse(t,e):t;let n=Array.isArray(t)?t.map(i):i(t);if(r&&("strict"===r.array?n=Array.isArray(n)?n:[n]:r.array&&(n=Array.isArray(n)&&1===n.length?n[0]:n),Array.isArray(n))){if(r.minArrayItems&&n.length<r.minArrayItems)throw new Error(`"${e}" parameter requires at least ${r.minArrayItems} values`);if(r.maxArrayItems&&n.length>r.maxArrayItems)throw new Error(`"${e}" parameter accepts up to ${r.maxArrayItems} values`)}let o=this._entries.get(e);return o||(o=[],this._entries.set(e,o)),o.push(n),this._size++,!0}}Buffer.from("\r\n");class mr extends Error{constructor(e,t){super(e.message),this.cause=t,this.issues=e.issues||[],this.status=e.status,t&&(this.cause=t,t.stack&&(this.stack=t.stack))}}const Tr=/^application\/([\w-]+\+)?\bjson\b/i,xr=/^text\/.*$/i,Er=/^multipart\/\bform-data\b/i;class gr extends d.Observable{constructor(e,t={}){super((e=>{"response"!==t.observe?this.resolve().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t))):this.fetch().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t)))})),this._handler=e,this.options=t,this.contentId=a.uid(6),this.options=t}header(e,t){return this._headers=this._headers||{},this._headers[e]=t,this}async fetch(){const e=this._promise||(this._promise=new Promise(((e,t)=>{setTimeout((()=>{this._execute().then(e).catch(t)}),0)})));return await e}async resolve(){return(await this.fetch()).data}with(e){return e(this),this}binding(){return{}}async _execute(){const e=this.prepare();return await this._handler(e)}}function Rr(e,...t){let r;const s=[e,...t];let i;for(let e=s.length-1;e>=0;e--){const t=s[e];t?.headers&&(i=i||{},Object.assign(i,Je(t.headers)))}for(const t of s)t&&(Object.assign(e,t),t?.params&&(r=r||new yr,t.params.forEach(((e,t)=>r?.append(t,e)))));return e.headers=i,e.params=r,e}class wr extends gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.data=r,this.options=s}prepare(){const e=new yr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),Rr({method:"POST",path:this.resource.name,params:e,body:this.data},this.options.http)}}class Cr extends gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new yr;return this.options.filter&&e.set("$filter",this.options.filter),Rr({method:"DELETE",path:this.resource.name,params:e},this.options.http)}}class Or extends gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.keyValue=r,this.options=s}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "delete" request');return Rr({method:"DELETE",path:new or({resource:this.resource.name,key:this.keyValue}).toString()},this.options.http)}}class Ir extends gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.keyValue=r,this.options=s}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new or({resource:this.resource.name,key:this.keyValue}),t=new yr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),Rr({method:"GET",path:e.toString(),params:t},this.options.http)}}class Ar extends gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new yr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),this.options.sort&&e.set("$sort",this.options.sort),this.options.filter&&e.set("$filter",this.options.filter),null!=this.options.limit&&e.set("$limit",this.options.limit),null!=this.options.skip&&e.set("$skip",this.options.skip),null!=this.options.count&&e.set("$count",this.options.count),null!=this.options.distinct&&e.set("$distinct",this.options.distinct),Rr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class vr extends gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.data=r,this.options=s}prepare(){const e=new yr;return this.options.filter&&e.set("$filter",this.options.filter),Rr({method:"PATCH",path:this.resource.name,params:e,body:this.data},this.options.http)}}class br extends gr{constructor(e,t,r,s,i={}){super(e,i),this._handler=e,this.resource=t,this.keyValue=r,this.data=s,this.options=i}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new or({resource:this.resource.name,key:this.keyValue}),t=new yr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),Rr({method:"PATCH",path:e.toString(),params:t,body:this.data},this.options.http)}}class Nr{constructor(e,t){this.resource=e,this._handler=t}create(e,t){return new wr(this._handler,this.resource,e,t)}delete(e,t){return new Or(this._handler,this.resource,e,t)}deleteMany(e){return new Cr(this._handler,this.resource,e)}get(e,t){return new Ir(this._handler,this.resource,e,t)}search(e){return new Ar(this._handler,this.resource,e)}update(e,t,r){return new br(this._handler,this.resource,e,t,r)}updateMany(e,t){return new vr(this._handler,this.resource,e,t)}}class Lr extends gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new URLSearchParams;return this.options.include&&e.set("$include",""+this.options.include),this.options.pick&&e.set("$pick",""+this.options.pick),this.options.omit&&e.set("$omit",""+this.options.omit),Rr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class Sr{constructor(e,t){this.resource=e,this._handler=t}get(e){return new Lr(this._handler,this.resource,e)}}class kr extends gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.requests=t,this.options=r,this._results=new WeakMap,this._listeners=new Set,t.forEach((e=>{Object.defineProperty(e,"_execute",{writable:!0,enumerable:!1,configurable:!0,value:()=>new Promise(((t,r)=>{const s=this._results.get(e);if(s)return s.error?r(s.error):t(s.response);const i=(e,s)=>{if(this._listeners.delete(i),e)return r(e);t(s)};this._listeners.add(i)}))})}))}prepare(){const e=this._buildBatchMultipart(this);return Rr({method:"POST",path:"/$batch",headers:{"content-type":"multipart/mixed;boundary="+e.boundary},body:e.stream()},this.options.http)}_buildBatchMultipart(e){const t=new it;for(const r of e.requests){const e=r.prepare();if(r instanceof kr){const e=this._buildBatchMultipart(r);t.addBatch(e)}else t.addRequestPart({method:e.method,url:e.path,headers:e.headers,data:e.body})}return t}async _execute(){const e=this.prepare();return await this._handler(e)}}const Dr=new Map,Pr=new Map;exports.BatchRequest=kr,exports.ClientError=mr,exports.CollectionCreateRequest=wr,exports.CollectionDeleteManyRequest=Cr,exports.CollectionDeleteRequest=Or,exports.CollectionGetRequest=Ir,exports.CollectionSearchRequest=Ar,exports.CollectionUpdateManyRequest=vr,exports.CollectionUpdateRequest=br,exports.HttpCollectionService=Nr,exports.HttpRequest=gr,exports.HttpSingletonGetRequest=Lr,exports.HttpSingletonService=Sr,exports.OpraHttpClient=class{constructor(e,t){if(this._serviceUrl=e,this._metadata=t?.document,!this._metadata){const e=Dr.get(this.serviceUrl.toLowerCase());e&&(this._metadata=e)}this.defaults=t?.defaults||{}}get serviceUrl(){return this._serviceUrl}get initialized(){return!!this._metadata}get metadata(){return this._assertMetadata(),this._metadata}async init(e){if(!e&&this.initialized)return;const t=this.serviceUrl.toLowerCase();let r=Pr.get(t);if(!r)return r=this._resolveMetadata(),Pr.set(t,r),r.catch((()=>{})).finally((()=>Pr.delete(t)));await r}batch(e){return this._assertMetadata(),new kr((e=>this._handleRequest(e)),e)}collection(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getCollectionResource(e);return new Nr(t,(e=>this._handleRequest(e)))}singleton(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getSingletonResource(e);return new Sr(t,(e=>this._handleRequest(e)))}async _resolveMetadata(){const e=await this._handleRequest({method:"GET",path:"/$metadata",headers:{accept:"application/json"}});this._metadata=new Zt(e.data)}async _handleRequest(e){Rr(e,this.defaults);let t=function(...e){const t=[];let r;for(let s=0,i=e.length;s<i;s++)r=Jt(e[s],s>0),r&&t.push(r);return t.join("/")}(this.serviceUrl,e.path);var r;return e.params&&(t+="?"+e.params.toString()),e.body&&"object"==typeof e.body&&(f(e.body)||_(r=e.body)&&!1!==r.readable&&"function"==typeof r.getReader&&"function"==typeof r.pipeThrough&&"function"==typeof r.pipeTo||Buffer.isBuffer(e.body)||(e.headers?.["content-type"]||(e.headers=e.headers||{},e.headers["content-type"]="application/json"),e.body=JSON.stringify(e.body))),this._fetch(t,e)}async _fetch(e,t){const r=await fetch(e,t);let s;if(r.body&&(Tr.test(r.headers.get("Content-Type")||"")?(s=await r.json(),"string"==typeof s&&(s=JSON.parse(s))):s=xr.test(r.headers.get("Content-Type")||"")?await r.text():Er.test(r.headers.get("Content-Type")||"")?await r.formData():await r.arrayBuffer()),r.status>=400&&r.status<600)throw new mr({message:r.status+" "+r.statusText,status:r.status,issues:s?.errors});return{get headers(){return r.headers},get ok(){return r.ok},get redirected(){return r.redirected},get status(){return r.status},get statusText(){return r.statusText},get type(){return r.type},get url(){return r.url},get contentId(){return r.headers.get("Content-ID")},get data(){return s}}}_assertMetadata(){if(!this._metadata)throw new Error("You must call init() to before using the client instance")}static async create(e,t){const r=new this(e,t);return r._metadata||await r.init(),r}};
|
|
1
|
+
"use strict";var e=require("buffer"),t=require("fast-tokenizer"),r=require("@browsery/fs"),i=require("@browsery/i18next"),s=require("path-browserify"),n=require("putil-varhelpers"),o=require("@browsery/antlr4"),a=require("@browsery/highland"),c=require("uid");require("reflect-metadata");var l=require("lodash.omit"),h=require("putil-promisify"),u=require("putil-isplainobject"),p=require("putil-merge"),d=require("events");require("@browsery/http-parser"),require("@browsery/stream");var _=require("rxjs");function f(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe}function y(e){return f(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState}function m(e){return null!==e&&"string"==typeof e.host&&"string"==typeof e.href}const T=/^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/i;const x=/\\(.)/g;function E(e){return e.replace(x,"$1")}const g=Object.getPrototypeOf(i).constructor,R=[];class w extends g{async init(e,t){const r="object"==typeof e?e:{},i="function"==typeof e?e:t;try{const e=await super.init(r,i),t=this.services.formatter;if(t.add("lowercase",((e,t)=>e.toLocaleLowerCase(t))),t.add("uppercase",((e,t)=>e.toLocaleUpperCase(t))),t.add("upperFirst",((e,t)=>e.charAt(0).toLocaleUpperCase(t)+e.substring(1))),R.length&&await this.loadResourceDir(R,!1,!0),r?.resourceDirs?.length&&await this.loadResourceDir(r.resourceDirs,!1,!0),r?.resources)for(const e of Object.keys(r.resources)){const t=r.resources[e];for(const r of Object.keys(t))this.addResourceBundle(e,r,t[r],!1,!0)}return i&&i(null,e),e}catch(e){throw i&&i(e,this.t),e}}deep(e,t){if(null==e)return e;const r=new WeakMap;return this._deepTranslate(e,r,t)}registerLocaleDir(...e){R.push(...e)}async loadResourceBundle(e,t,i,s,n){let o;if(a=i,T.test(a))o=(await fetch(i,{headers:{accept:"application/json"}})).json();else{const e=r.readFileSync(i,"utf8");o=JSON.parse(e)}var a;this.addResourceBundle(e,t,o,s,n)}async loadResourceDir(e,t,i){for(const n of Array.isArray(e)?e:[e]){if(!r.statSync(n).isDirectory())continue;const e=r.readdirSync(n);for(const o of e){const e=s.join(n,o);if(r.statSync(e).isDirectory()){const n=r.readdirSync(e);for(const a of n){const n=s.join(e,a),c=s.extname(a);if(".json"===c&&r.statSync(n).isFile()){const e=s.basename(a,c);await this.loadResourceBundle(o,e,n,t,i)}}}}}}createInstance(e={},t){return new w(e,t)}static createInstance(e,t){return new w(e,t)}_deepTranslate(r,i,s){if(null==r)return r;if(s?.ignore&&s.ignore(r,this))return r;if("object"==typeof r&&i.has(r))return i.get(r);if("string"==typeof r){let e="";for(let i of t.tokenize(r,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0}))if(i.startsWith("$t(")&&i.endsWith(")")){i=i.substring(3,i.length-1);const r=t.splitString(i,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),n=E(i.substring((r[0]||"").length+1));i=r[0]||"";const o=[];let a=null;for(const e of t.tokenize(i,{delimiters:",",quotes:!0,brackets:{"{":"}"}}))e.startsWith("{")?a=JSON.parse(e):o.push(e);const c=o.length>1?"$t("+o.join(",")+")":o[0];e+=n?this.t(c,n,{...s,...a}):this.t(c,{...s,...a})}else e+=i;return e}if(Array.isArray(r)){const e=Array(r.length);i.set(r,e);for(let t=0,n=r.length;t<n;t++)e[t]=this._deepTranslate(r[t],i,s);return i.delete(r),e}if("object"==typeof r){if(e.Buffer.isBuffer(r))return r;if(e.Buffer.isBuffer(r)||r instanceof Symbol||r instanceof RegExp||r instanceof Map||r instanceof Set||r instanceof WeakMap||r instanceof WeakSet)return r;const t={};i.set(r,t);const n=Object.keys(r);for(let e=0,o=n.length;e<o;e++){const o=n[e];t[o]=this._deepTranslate(r[o],i,s)}return i.delete(r),t}return r}static get defaultInstance(){return C}}const C=w.createInstance();var O;w.createInstance().init().catch((()=>{})),function(e){var t;(t=e.Enum||(e.Enum={})).fatal="fatal",t.error="error",t.warning="warning",t.info="info",e.name="IssueSeverity",e.description="Severity of the issue",e.Keys=Object.keys(e),e.descriptions={fatal:"The issue caused the action to fail and no further checking could be performed",error:"The issue is sufficiently important to cause the action to fail",warning:"The issue is not important enough to cause the action to fail but may cause it to be performed suboptimally or in a way that is not as desired",info:"The issue has no relation to the degree of success of the action"}}(O||(O={}));class I{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}}class A extends I{}class v extends A{}class b extends v{constructor(e){super(),this.value=e}toString(){return""+this.value}}class N extends A{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new L({op:e,expression:t})),this}toString(){return this.items.map(((e,t)=>(t>0?e.op:"")+e.expression)).join("")}}class L{constructor(e){Object.assign(this,e)}}class S extends v{constructor(e){super(),this.items=e}toString(){return"["+this.items.map((e=>""+e)).join(",")+"]"}}const k=/\w/;class D extends A{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${k.test(this.op)?" "+this.op+" ":this.op}${this.right}`}}class P extends A{constructor(e){super(),Object.assign(this,e)}toString(){return this.items.map((e=>""+e)).join(" "+this.op+" ")}}class U extends A{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}}class M extends b{constructor(e){super(e)}}class F extends TypeError{}class H extends TypeError{}class $ extends Error{constructor(e,t){super(e),Object.assign(this,t)}}const j=/'/g,B=/(\\)/g,q=/\\(.)/g;function z(e){return"'"+function(e){return e.replace(B,"\\\\")}(e).replace(j,"\\'")+"'"}function G(e){return e&&(e.startsWith("'")||e.startsWith('"'))&&e.endsWith(e.charAt(0))?function(e){return e.replace(q,"$1")}(e.substring(1,e.length-1)):e}const V=new Date(0);class W extends b{constructor(e){if(super(""),e instanceof Date)this.value=e.toISOString();else{if("string"!=typeof e||n.toDateDef(e,V)===V)throw new H(`Invalid date value "${e}"`);this.value=e}}toString(){return z(this.value)}}class Q extends b{constructor(){super(null),this.value=null}}class X extends b{constructor(e){if(super(0),"number"!=typeof e&&"bigint"!=typeof e){try{if("string"==typeof e){if(e.includes("."))return void(this.value=parseFloat(e));const t=Number(e);return void(this.value=""+t===e?t:BigInt(e))}}catch{}throw new H(`Invalid number literal ${e}`)}this.value=e}toString(){return"bigint"==typeof this.value?(""+this.value).replace(/n$/,""):""+this.value}}class K extends b{constructor(e){super(""+e)}}class Y extends b{constructor(e){super(""+e)}toString(){return z(this.value)}}const Z=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;class J extends b{constructor(e){if(super(""),e instanceof Date)this.value=ee(e.getHours())+":"+ee(e.getMinutes())+(e.getSeconds()?":"+ee(e.getSeconds()):"")+(e.getMilliseconds()?"."+ee(e.getMilliseconds()):"");else{if("string"!=typeof e||!Z.test(e))throw new H(`Invalid time value "${e}"`);this.value=e}}toString(){return z(this.value)}}function ee(e){return e<=9?"0"+e:""+e}class te extends o.Lexer{constructor(e){super(e),this._interp=new o.LexerATNSimulator(this,te._ATN,te.DecisionsToDFA,new o.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return te.literalNames}get symbolicNames(){return te.symbolicNames}get ruleNames(){return te.ruleNames}get serializedATN(){return te._serializedATN}get channelNames(){return te.channelNames}get modeNames(){return te.modeNames}static get _ATN(){return te.__ATN||(te.__ATN=(new o.ATNDeserializer).deserialize(te._serializedATN)),te.__ATN}}te.T__0=1,te.T__1=2,te.T__2=3,te.T__3=4,te.T__4=5,te.T__5=6,te.T__6=7,te.T__7=8,te.T__8=9,te.T__9=10,te.T__10=11,te.T__11=12,te.T__12=13,te.T__13=14,te.T__14=15,te.T__15=16,te.T__16=17,te.T__17=18,te.T__18=19,te.T__19=20,te.T__20=21,te.T__21=22,te.T__22=23,te.T__23=24,te.T__24=25,te.T__25=26,te.T__26=27,te.T__27=28,te.T__28=29,te.T__29=30,te.T__30=31,te.T__31=32,te.T__32=33,te.T__33=34,te.T__34=35,te.T__35=36,te.T__36=37,te.T__37=38,te.T__38=39,te.T__39=40,te.T__40=41,te.T__41=42,te.T__42=43,te.T__43=44,te.T__44=45,te.T__45=46,te.DATE=47,te.DATETIME=48,te.TIME=49,te.IDENTIFIER=50,te.STRING=51,te.NUMBER=52,te.INTEGER=53,te.WHITESPACE=54,te.COMMENT=55,te.LINE_COMMENT=56,te.EOF=o.Token.EOF,te.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],te.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],te.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],te.modeNames=["DEFAULT_MODE"],te.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","T__34","T__35","T__36","T__37","T__38","T__39","T__40","T__41","T__42","T__43","T__44","T__45","DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT","NUMBERFORMAT","INTEGERFORMAT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"],te._serializedATN=[4,0,56,536,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,36,1,36,1,37,1,37,1,38,1,38,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,3,46,357,8,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,3,47,373,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,3,48,383,8,48,1,49,1,49,5,49,387,8,49,10,49,12,49,390,9,49,1,50,1,50,1,50,5,50,395,8,50,10,50,12,50,398,9,50,1,50,1,50,1,50,1,50,5,50,404,8,50,10,50,12,50,407,9,50,1,50,3,50,410,8,50,1,51,1,51,1,52,1,52,1,53,4,53,417,8,53,11,53,12,53,418,1,53,1,53,1,54,1,54,1,54,1,54,5,54,427,8,54,10,54,12,54,430,9,54,1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,5,55,441,8,55,10,55,12,55,444,9,55,1,55,1,55,1,56,4,56,449,8,56,11,56,12,56,450,1,56,1,56,4,56,455,8,56,11,56,12,56,456,3,56,459,8,56,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,472,8,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,481,8,58,1,59,1,59,1,59,1,59,3,59,487,8,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,4,59,499,8,59,11,59,12,59,500,3,59,503,8,59,3,59,505,8,59,1,60,1,60,1,60,3,60,510,8,60,1,60,1,60,1,60,3,60,515,8,60,1,60,1,60,1,60,3,60,520,8,60,3,60,522,8,60,1,61,1,61,1,61,3,61,527,8,61,1,62,1,62,1,62,1,62,1,62,1,62,1,63,1,63,1,428,0,64,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50,101,51,103,52,105,53,107,54,109,55,111,56,113,0,115,0,117,0,119,0,121,0,123,0,125,0,127,0,1,0,17,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,2,0,10,10,13,13,1,0,48,57,1,0,48,48,1,0,49,57,1,0,49,49,1,0,48,50,1,0,49,51,1,0,48,49,1,0,48,51,1,0,48,53,2,0,43,43,45,45,3,0,48,57,65,70,97,102,554,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,1,129,1,0,0,0,3,131,1,0,0,0,5,133,1,0,0,0,7,135,1,0,0,0,9,137,1,0,0,0,11,139,1,0,0,0,13,144,1,0,0,0,15,150,1,0,0,0,17,155,1,0,0,0,19,159,1,0,0,0,21,164,1,0,0,0,23,171,1,0,0,0,25,178,1,0,0,0,27,190,1,0,0,0,29,196,1,0,0,0,31,203,1,0,0,0,33,209,1,0,0,0,35,214,1,0,0,0,37,220,1,0,0,0,39,228,1,0,0,0,41,236,1,0,0,0,43,249,1,0,0,0,45,251,1,0,0,0,47,253,1,0,0,0,49,256,1,0,0,0,51,258,1,0,0,0,53,260,1,0,0,0,55,263,1,0,0,0,57,265,1,0,0,0,59,268,1,0,0,0,61,271,1,0,0,0,63,275,1,0,0,0,65,280,1,0,0,0,67,286,1,0,0,0,69,292,1,0,0,0,71,299,1,0,0,0,73,301,1,0,0,0,75,303,1,0,0,0,77,305,1,0,0,0,79,307,1,0,0,0,81,311,1,0,0,0,83,314,1,0,0,0,85,319,1,0,0,0,87,325,1,0,0,0,89,330,1,0,0,0,91,339,1,0,0,0,93,356,1,0,0,0,95,372,1,0,0,0,97,382,1,0,0,0,99,384,1,0,0,0,101,409,1,0,0,0,103,411,1,0,0,0,105,413,1,0,0,0,107,416,1,0,0,0,109,422,1,0,0,0,111,436,1,0,0,0,113,448,1,0,0,0,115,460,1,0,0,0,117,462,1,0,0,0,119,486,1,0,0,0,121,521,1,0,0,0,123,523,1,0,0,0,125,528,1,0,0,0,127,534,1,0,0,0,129,130,5,40,0,0,130,2,1,0,0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,91,0,0,134,6,1,0,0,0,135,136,5,44,0,0,136,8,1,0,0,0,137,138,5,93,0,0,138,10,1,0,0,0,139,140,5,121,0,0,140,141,5,101,0,0,141,142,5,97,0,0,142,143,5,114,0,0,143,12,1,0,0,0,144,145,5,109,0,0,145,146,5,111,0,0,146,147,5,110,0,0,147,148,5,116,0,0,148,149,5,104,0,0,149,14,1,0,0,0,150,151,5,119,0,0,151,152,5,101,0,0,152,153,5,101,0,0,153,154,5,107,0,0,154,16,1,0,0,0,155,156,5,100,0,0,156,157,5,97,0,0,157,158,5,121,0,0,158,18,1,0,0,0,159,160,5,104,0,0,160,161,5,111,0,0,161,162,5,117,0,0,162,163,5,114,0,0,163,20,1,0,0,0,164,165,5,109,0,0,165,166,5,105,0,0,166,167,5,110,0,0,167,168,5,117,0,0,168,169,5,116,0,0,169,170,5,101,0,0,170,22,1,0,0,0,171,172,5,115,0,0,172,173,5,101,0,0,173,174,5,99,0,0,174,175,5,111,0,0,175,176,5,110,0,0,176,177,5,100,0,0,177,24,1,0,0,0,178,179,5,109,0,0,179,180,5,105,0,0,180,181,5,108,0,0,181,182,5,108,0,0,182,183,5,105,0,0,183,184,5,115,0,0,184,185,5,101,0,0,185,186,5,99,0,0,186,187,5,111,0,0,187,188,5,110,0,0,188,189,5,100,0,0,189,26,1,0,0,0,190,191,5,121,0,0,191,192,5,101,0,0,192,193,5,97,0,0,193,194,5,114,0,0,194,195,5,115,0,0,195,28,1,0,0,0,196,197,5,109,0,0,197,198,5,111,0,0,198,199,5,110,0,0,199,200,5,116,0,0,200,201,5,104,0,0,201,202,5,115,0,0,202,30,1,0,0,0,203,204,5,119,0,0,204,205,5,101,0,0,205,206,5,101,0,0,206,207,5,107,0,0,207,208,5,115,0,0,208,32,1,0,0,0,209,210,5,100,0,0,210,211,5,97,0,0,211,212,5,121,0,0,212,213,5,115,0,0,213,34,1,0,0,0,214,215,5,104,0,0,215,216,5,111,0,0,216,217,5,117,0,0,217,218,5,114,0,0,218,219,5,115,0,0,219,36,1,0,0,0,220,221,5,109,0,0,221,222,5,105,0,0,222,223,5,110,0,0,223,224,5,117,0,0,224,225,5,116,0,0,225,226,5,101,0,0,226,227,5,115,0,0,227,38,1,0,0,0,228,229,5,115,0,0,229,230,5,101,0,0,230,231,5,99,0,0,231,232,5,111,0,0,232,233,5,110,0,0,233,234,5,100,0,0,234,235,5,115,0,0,235,40,1,0,0,0,236,237,5,109,0,0,237,238,5,105,0,0,238,239,5,108,0,0,239,240,5,108,0,0,240,241,5,105,0,0,241,242,5,115,0,0,242,243,5,101,0,0,243,244,5,99,0,0,244,245,5,111,0,0,245,246,5,110,0,0,246,247,5,100,0,0,247,248,5,115,0,0,248,42,1,0,0,0,249,250,5,46,0,0,250,44,1,0,0,0,251,252,5,64,0,0,252,46,1,0,0,0,253,254,5,60,0,0,254,255,5,61,0,0,255,48,1,0,0,0,256,257,5,60,0,0,257,50,1,0,0,0,258,259,5,62,0,0,259,52,1,0,0,0,260,261,5,62,0,0,261,262,5,61,0,0,262,54,1,0,0,0,263,264,5,61,0,0,264,56,1,0,0,0,265,266,5,33,0,0,266,267,5,61,0,0,267,58,1,0,0,0,268,269,5,105,0,0,269,270,5,110,0,0,270,60,1,0,0,0,271,272,5,33,0,0,272,273,5,105,0,0,273,274,5,110,0,0,274,62,1,0,0,0,275,276,5,108,0,0,276,277,5,105,0,0,277,278,5,107,0,0,278,279,5,101,0,0,279,64,1,0,0,0,280,281,5,33,0,0,281,282,5,108,0,0,282,283,5,105,0,0,283,284,5,107,0,0,284,285,5,101,0,0,285,66,1,0,0,0,286,287,5,105,0,0,287,288,5,108,0,0,288,289,5,105,0,0,289,290,5,107,0,0,290,291,5,101,0,0,291,68,1,0,0,0,292,293,5,33,0,0,293,294,5,105,0,0,294,295,5,108,0,0,295,296,5,105,0,0,296,297,5,107,0,0,297,298,5,101,0,0,298,70,1,0,0,0,299,300,5,43,0,0,300,72,1,0,0,0,301,302,5,45,0,0,302,74,1,0,0,0,303,304,5,42,0,0,304,76,1,0,0,0,305,306,5,47,0,0,306,78,1,0,0,0,307,308,5,97,0,0,308,309,5,110,0,0,309,310,5,100,0,0,310,80,1,0,0,0,311,312,5,111,0,0,312,313,5,114,0,0,313,82,1,0,0,0,314,315,5,116,0,0,315,316,5,114,0,0,316,317,5,117,0,0,317,318,5,101,0,0,318,84,1,0,0,0,319,320,5,102,0,0,320,321,5,97,0,0,321,322,5,108,0,0,322,323,5,115,0,0,323,324,5,101,0,0,324,86,1,0,0,0,325,326,5,110,0,0,326,327,5,117,0,0,327,328,5,108,0,0,328,329,5,108,0,0,329,88,1,0,0,0,330,331,5,73,0,0,331,332,5,110,0,0,332,333,5,102,0,0,333,334,5,105,0,0,334,335,5,110,0,0,335,336,5,105,0,0,336,337,5,116,0,0,337,338,5,121,0,0,338,90,1,0,0,0,339,340,5,105,0,0,340,341,5,110,0,0,341,342,5,102,0,0,342,343,5,105,0,0,343,344,5,110,0,0,344,345,5,105,0,0,345,346,5,116,0,0,346,347,5,121,0,0,347,92,1,0,0,0,348,349,5,39,0,0,349,350,3,117,58,0,350,351,5,39,0,0,351,357,1,0,0,0,352,353,5,34,0,0,353,354,3,117,58,0,354,355,5,34,0,0,355,357,1,0,0,0,356,348,1,0,0,0,356,352,1,0,0,0,357,94,1,0,0,0,358,359,5,39,0,0,359,360,3,117,58,0,360,361,5,84,0,0,361,362,3,119,59,0,362,363,3,121,60,0,363,364,5,39,0,0,364,373,1,0,0,0,365,366,5,34,0,0,366,367,3,117,58,0,367,368,5,84,0,0,368,369,3,119,59,0,369,370,3,121,60,0,370,371,5,34,0,0,371,373,1,0,0,0,372,358,1,0,0,0,372,365,1,0,0,0,373,96,1,0,0,0,374,375,5,39,0,0,375,376,3,119,59,0,376,377,5,39,0,0,377,383,1,0,0,0,378,379,5,34,0,0,379,380,3,119,59,0,380,381,5,34,0,0,381,383,1,0,0,0,382,374,1,0,0,0,382,378,1,0,0,0,383,98,1,0,0,0,384,388,7,0,0,0,385,387,7,1,0,0,386,385,1,0,0,0,387,390,1,0,0,0,388,386,1,0,0,0,388,389,1,0,0,0,389,100,1,0,0,0,390,388,1,0,0,0,391,396,5,39,0,0,392,395,3,123,61,0,393,395,8,2,0,0,394,392,1,0,0,0,394,393,1,0,0,0,395,398,1,0,0,0,396,394,1,0,0,0,396,397,1,0,0,0,397,399,1,0,0,0,398,396,1,0,0,0,399,410,5,39,0,0,400,405,5,34,0,0,401,404,3,123,61,0,402,404,8,3,0,0,403,401,1,0,0,0,403,402,1,0,0,0,404,407,1,0,0,0,405,403,1,0,0,0,405,406,1,0,0,0,406,408,1,0,0,0,407,405,1,0,0,0,408,410,5,34,0,0,409,391,1,0,0,0,409,400,1,0,0,0,410,102,1,0,0,0,411,412,3,113,56,0,412,104,1,0,0,0,413,414,3,115,57,0,414,106,1,0,0,0,415,417,7,4,0,0,416,415,1,0,0,0,417,418,1,0,0,0,418,416,1,0,0,0,418,419,1,0,0,0,419,420,1,0,0,0,420,421,6,53,0,0,421,108,1,0,0,0,422,423,5,47,0,0,423,424,5,42,0,0,424,428,1,0,0,0,425,427,9,0,0,0,426,425,1,0,0,0,427,430,1,0,0,0,428,429,1,0,0,0,428,426,1,0,0,0,429,431,1,0,0,0,430,428,1,0,0,0,431,432,5,42,0,0,432,433,5,47,0,0,433,434,1,0,0,0,434,435,6,54,0,0,435,110,1,0,0,0,436,437,5,47,0,0,437,438,5,47,0,0,438,442,1,0,0,0,439,441,8,5,0,0,440,439,1,0,0,0,441,444,1,0,0,0,442,440,1,0,0,0,442,443,1,0,0,0,443,445,1,0,0,0,444,442,1,0,0,0,445,446,6,55,0,0,446,112,1,0,0,0,447,449,7,6,0,0,448,447,1,0,0,0,449,450,1,0,0,0,450,448,1,0,0,0,450,451,1,0,0,0,451,458,1,0,0,0,452,454,5,46,0,0,453,455,7,6,0,0,454,453,1,0,0,0,455,456,1,0,0,0,456,454,1,0,0,0,456,457,1,0,0,0,457,459,1,0,0,0,458,452,1,0,0,0,458,459,1,0,0,0,459,114,1,0,0,0,460,461,7,6,0,0,461,116,1,0,0,0,462,463,7,6,0,0,463,464,7,6,0,0,464,465,7,6,0,0,465,466,7,6,0,0,466,471,5,45,0,0,467,468,7,7,0,0,468,472,7,8,0,0,469,470,7,9,0,0,470,472,7,10,0,0,471,467,1,0,0,0,471,469,1,0,0,0,472,473,1,0,0,0,473,480,5,45,0,0,474,475,7,11,0,0,475,481,7,7,0,0,476,477,7,10,0,0,477,481,7,8,0,0,478,479,5,51,0,0,479,481,5,49,0,0,480,474,1,0,0,0,480,476,1,0,0,0,480,478,1,0,0,0,481,118,1,0,0,0,482,483,7,12,0,0,483,487,7,6,0,0,484,485,5,50,0,0,485,487,7,13,0,0,486,482,1,0,0,0,486,484,1,0,0,0,487,488,1,0,0,0,488,489,5,58,0,0,489,490,7,14,0,0,490,491,7,6,0,0,491,504,1,0,0,0,492,493,5,58,0,0,493,494,7,14,0,0,494,495,7,6,0,0,495,502,1,0,0,0,496,498,5,46,0,0,497,499,7,6,0,0,498,497,1,0,0,0,499,500,1,0,0,0,500,498,1,0,0,0,500,501,1,0,0,0,501,503,1,0,0,0,502,496,1,0,0,0,502,503,1,0,0,0,503,505,1,0,0,0,504,492,1,0,0,0,504,505,1,0,0,0,505,120,1,0,0,0,506,522,5,90,0,0,507,514,7,15,0,0,508,510,7,12,0,0,509,508,1,0,0,0,509,510,1,0,0,0,510,511,1,0,0,0,511,515,7,6,0,0,512,513,5,50,0,0,513,515,7,13,0,0,514,509,1,0,0,0,514,512,1,0,0,0,515,519,1,0,0,0,516,517,5,58,0,0,517,518,7,14,0,0,518,520,7,6,0,0,519,516,1,0,0,0,519,520,1,0,0,0,520,522,1,0,0,0,521,506,1,0,0,0,521,507,1,0,0,0,522,122,1,0,0,0,523,526,5,92,0,0,524,527,3,125,62,0,525,527,9,0,0,0,526,524,1,0,0,0,526,525,1,0,0,0,527,124,1,0,0,0,528,529,5,117,0,0,529,530,3,127,63,0,530,531,3,127,63,0,531,532,3,127,63,0,532,533,3,127,63,0,533,126,1,0,0,0,534,535,7,16,0,0,535,128,1,0,0,0,27,0,356,372,382,388,394,396,403,405,409,418,428,442,450,456,458,471,480,486,500,502,504,509,514,519,521,526,1,0,1,0],te.DecisionsToDFA=te._ATN.decisionToState.map(((e,t)=>new o.DFA(e,t)));class re extends o.Parser{constructor(e){super(e),this._interp=new o.ParserATNSimulator(this,re._ATN,re.DecisionsToDFA,new o.PredictionContextCache)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return re.literalNames}get symbolicNames(){return re.symbolicNames}get ruleNames(){return re.ruleNames}get serializedATN(){return re._serializedATN}createFailedPredicateException(e,t){return new o.FailedPredicateException(this,e,t)}root(){let e=new ie(this,this._ctx,this.state);this.enterRule(e,0,re.RULE_root);try{this.enterOuterAlt(e,1),this.state=44,this.expression(0),this.state=45,this.match(re.EOF)}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}expression(e){void 0===e&&(e=0);let t,r=this._ctx,i=this.state,s=new se(this,this._ctx,i),n=s;this.enterRecursionRule(s,2,re.RULE_expression,e);try{let e;switch(this.enterOuterAlt(s,1),this.state=67,this._errHandler.sync(this),this._input.LA(1)){case 23:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:s=new ue(this,s),this._ctx=s,n=s,this.state=48,this.term();break;case 36:case 37:s=new ae(this,s),this._ctx=s,n=s,this.state=49,this.polarOp(),this.state=50,this.expression(6);break;case 1:s=new ne(this,s),this._ctx=s,n=s,this.state=52,this.match(re.T__0),this.state=53,this.expression(0),this.state=54,this.match(re.T__1);break;case 3:for(s=new oe(this,s),this._ctx=s,n=s,this.state=56,this.match(re.T__2),this.state=57,this.expression(0),this.state=62,this._errHandler.sync(this),t=this._input.LA(1);4===t;)this.state=58,this.match(re.T__3),this.state=59,this.expression(0),this.state=64,this._errHandler.sync(this),t=this._input.LA(1);this.state=65,this.match(re.T__4);break;default:throw new o.NoViableAltException(this)}for(this._ctx.stop=this._input.LT(-1),this.state=83,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx);2!==e&&e!==o.ATN.INVALID_ALT_NUMBER;){if(1===e)switch(null!=this._parseListeners&&this.triggerExitRuleEvent(),n=s,this.state=81,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,2,this._ctx)){case 1:if(s=new le(this,new se(this,r,i)),this.pushNewRecursionContext(s,2,re.RULE_expression),this.state=69,!this.precpred(this._ctx,5))throw this.createFailedPredicateException("this.precpred(this._ctx, 5)");this.state=70,this.arthOp(),this.state=71,this.expression(6);break;case 2:if(s=new ce(this,new se(this,r,i)),this.pushNewRecursionContext(s,2,re.RULE_expression),this.state=73,!this.precpred(this._ctx,4))throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");this.state=74,this.compOp(),this.state=75,this.expression(5);break;case 3:if(s=new he(this,new se(this,r,i)),this.pushNewRecursionContext(s,2,re.RULE_expression),this.state=77,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=78,this.logOp(),this.state=79,this.expression(4)}this.state=85,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx)}}catch(e){if(!(e instanceof o.RecognitionException))throw e;s.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.unrollRecursionContexts(r)}return s}term(){let e=new pe(this,this._ctx,this.state);this.enterRule(e,4,re.RULE_term);try{switch(this.state=89,this._errHandler.sync(this),this._input.LA(1)){case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 51:case 52:e=new _e(this,e),this.enterOuterAlt(e,1),this.state=86,this.literal();break;case 50:e=new fe(this,e),this.enterOuterAlt(e,2),this.state=87,this.qualifiedIdentifier();break;case 23:e=new de(this,e),this.enterOuterAlt(e,3),this.state=88,this.externalConstant();break;default:throw new o.NoViableAltException(this)}}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocable(){let e=new ye(this,this._ctx,this.state);this.enterRule(e,6,re.RULE_invocable);try{this.enterOuterAlt(e,1),this.state=91,this.function_()}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocation(){let e=new me(this,this._ctx,this.state);this.enterRule(e,8,re.RULE_invocation);try{e=new Te(this,e),this.enterOuterAlt(e,1),this.state=93,this.identifier()}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}indexer(){let e=new xe(this,this._ctx,this.state);this.enterRule(e,10,re.RULE_indexer);try{switch(this.state=97,this._errHandler.sync(this),this._input.LA(1)){case 50:e=new ge(this,e),this.enterOuterAlt(e,1),this.state=95,this.identifier();break;case 53:e=new Ee(this,e),this.enterOuterAlt(e,2),this.state=96,this.match(re.INTEGER);break;default:throw new o.NoViableAltException(this)}}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}function_(){let e,t=new Re(this,this._ctx,this.state);this.enterRule(t,12,re.RULE_function);try{this.enterOuterAlt(t,1),this.state=99,this.identifier(),this.state=100,this.match(re.T__0),this.state=102,this._errHandler.sync(this),e=this._input.LA(1),(0==(-32&e)&&0!=(1<<e&8388618)||0==(e-36&-32)&&0!=(1<<e-36&131011))&&(this.state=101,this.paramList()),this.state=104,this.match(re.T__1)}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}paramList(){let e,t=new we(this,this._ctx,this.state);this.enterRule(t,14,re.RULE_paramList);try{for(this.enterOuterAlt(t,1),this.state=106,this.expression(0),this.state=111,this._errHandler.sync(this),e=this._input.LA(1);4===e;)this.state=107,this.match(re.T__3),this.state=108,this.expression(0),this.state=113,this._errHandler.sync(this),e=this._input.LA(1)}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}unit(){let e=new Ce(this,this._ctx,this.state);this.enterRule(e,16,re.RULE_unit);try{switch(this.state=117,this._errHandler.sync(this),this._input.LA(1)){case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:this.enterOuterAlt(e,1),this.state=114,this.dateTimePrecision();break;case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:this.enterOuterAlt(e,2),this.state=115,this.pluralDateTimePrecision();break;case 51:this.enterOuterAlt(e,3),this.state=116,this.match(re.STRING);break;default:throw new o.NoViableAltException(this)}}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}dateTimePrecision(){let e,t=new Oe(this,this._ctx,this.state);this.enterRule(t,18,re.RULE_dateTimePrecision);try{this.enterOuterAlt(t,1),this.state=119,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&16320)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}pluralDateTimePrecision(){let e,t=new Ie(this,this._ctx,this.state);this.enterRule(t,20,re.RULE_pluralDateTimePrecision);try{this.enterOuterAlt(t,1),this.state=121,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&4177920)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}qualifiedIdentifier(){let e=new Ae(this,this._ctx,this.state);this.enterRule(e,22,re.RULE_qualifiedIdentifier);try{let t;for(this.enterOuterAlt(e,1),this.state=128,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);2!==t&&t!==o.ATN.INVALID_ALT_NUMBER;)1===t&&(this.state=123,this.identifier(),this.state=124,this.match(re.T__21)),this.state=130,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);this.state=131,this.identifier()}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}externalConstant(){let e,t=new ve(this,this._ctx,this.state);this.enterRule(t,24,re.RULE_externalConstant);try{this.enterOuterAlt(t,1),this.state=133,this.match(re.T__22),this.state=134,e=this._input.LA(1),50!==e&&51!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}identifier(){let e=new be(this,this._ctx,this.state);this.enterRule(e,26,re.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=136,this.match(re.IDENTIFIER)}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}literal(){let e=new Ne(this,this._ctx,this.state);this.enterRule(e,28,re.RULE_literal);try{switch(this.state=146,this._errHandler.sync(this),this._input.LA(1)){case 52:e=new Fe(this,e),this.enterOuterAlt(e,1),this.state=138,this.match(re.NUMBER);break;case 45:case 46:e=new Ue(this,e),this.enterOuterAlt(e,2),this.state=139,this.infinity();break;case 42:case 43:e=new Me(this,e),this.enterOuterAlt(e,3),this.state=140,this.boolean_();break;case 44:e=new Se(this,e),this.enterOuterAlt(e,4),this.state=141,this.null_();break;case 47:e=new Pe(this,e),this.enterOuterAlt(e,5),this.state=142,this.match(re.DATE);break;case 48:e=new ke(this,e),this.enterOuterAlt(e,6),this.state=143,this.match(re.DATETIME);break;case 49:e=new Le(this,e),this.enterOuterAlt(e,7),this.state=144,this.match(re.TIME);break;case 51:e=new De(this,e),this.enterOuterAlt(e,8),this.state=145,this.match(re.STRING);break;default:throw new o.NoViableAltException(this)}}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}compOp(){let e,t=new He(this,this._ctx,this.state);this.enterRule(t,30,re.RULE_compOp);try{this.enterOuterAlt(t,1),this.state=148,e=this._input.LA(1),0!=(e-24&-32)||0==(1<<e-24&4095)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}arthOp(){let e,t=new $e(this,this._ctx,this.state);this.enterRule(t,32,re.RULE_arthOp);try{this.enterOuterAlt(t,1),this.state=150,e=this._input.LA(1),0!=(e-36&-32)||0==(1<<e-36&15)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}polarOp(){let e,t=new je(this,this._ctx,this.state);this.enterRule(t,34,re.RULE_polarOp);try{this.enterOuterAlt(t,1),this.state=152,e=this._input.LA(1),36!==e&&37!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}logOp(){let e,t=new Be(this,this._ctx,this.state);this.enterRule(t,36,re.RULE_logOp);try{this.enterOuterAlt(t,1),this.state=154,e=this._input.LA(1),40!==e&&41!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}boolean_(){let e,t=new qe(this,this._ctx,this.state);this.enterRule(t,38,re.RULE_boolean);try{this.enterOuterAlt(t,1),this.state=156,e=this._input.LA(1),42!==e&&43!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}null_(){let e=new ze(this,this._ctx,this.state);this.enterRule(e,40,re.RULE_null);try{this.enterOuterAlt(e,1),this.state=158,this.match(re.T__43)}catch(t){if(!(t instanceof o.RecognitionException))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}infinity(){let e,t=new Ge(this,this._ctx,this.state);this.enterRule(t,42,re.RULE_infinity);try{this.enterOuterAlt(t,1),this.state=160,e=this._input.LA(1),45!==e&&46!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof o.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}sempred(e,t,r){return 1!==t||this.expression_sempred(e,r)}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,5);case 1:return this.precpred(this._ctx,4);case 2:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return re.__ATN||(re.__ATN=(new o.ATNDeserializer).deserialize(re._serializedATN)),re.__ATN}}re.T__0=1,re.T__1=2,re.T__2=3,re.T__3=4,re.T__4=5,re.T__5=6,re.T__6=7,re.T__7=8,re.T__8=9,re.T__9=10,re.T__10=11,re.T__11=12,re.T__12=13,re.T__13=14,re.T__14=15,re.T__15=16,re.T__16=17,re.T__17=18,re.T__18=19,re.T__19=20,re.T__20=21,re.T__21=22,re.T__22=23,re.T__23=24,re.T__24=25,re.T__25=26,re.T__26=27,re.T__27=28,re.T__28=29,re.T__29=30,re.T__30=31,re.T__31=32,re.T__32=33,re.T__33=34,re.T__34=35,re.T__35=36,re.T__36=37,re.T__37=38,re.T__38=39,re.T__39=40,re.T__40=41,re.T__41=42,re.T__42=43,re.T__43=44,re.T__44=45,re.T__45=46,re.DATE=47,re.DATETIME=48,re.TIME=49,re.IDENTIFIER=50,re.STRING=51,re.NUMBER=52,re.INTEGER=53,re.WHITESPACE=54,re.COMMENT=55,re.LINE_COMMENT=56,re.EOF=o.Token.EOF,re.RULE_root=0,re.RULE_expression=1,re.RULE_term=2,re.RULE_invocable=3,re.RULE_invocation=4,re.RULE_indexer=5,re.RULE_function=6,re.RULE_paramList=7,re.RULE_unit=8,re.RULE_dateTimePrecision=9,re.RULE_pluralDateTimePrecision=10,re.RULE_qualifiedIdentifier=11,re.RULE_externalConstant=12,re.RULE_identifier=13,re.RULE_literal=14,re.RULE_compOp=15,re.RULE_arthOp=16,re.RULE_polarOp=17,re.RULE_logOp=18,re.RULE_boolean=19,re.RULE_null=20,re.RULE_infinity=21,re.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],re.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],re.ruleNames=["root","expression","term","invocable","invocation","indexer","function","paramList","unit","dateTimePrecision","pluralDateTimePrecision","qualifiedIdentifier","externalConstant","identifier","literal","compOp","arthOp","polarOp","logOp","boolean","null","infinity"],re._serializedATN=[4,1,56,163,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,61,8,1,10,1,12,1,64,9,1,1,1,1,1,3,1,68,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,82,8,1,10,1,12,1,85,9,1,1,2,1,2,1,2,3,2,90,8,2,1,3,1,3,1,4,1,4,1,5,1,5,3,5,98,8,5,1,6,1,6,1,6,3,6,103,8,6,1,6,1,6,1,7,1,7,1,7,5,7,110,8,7,10,7,12,7,113,9,7,1,8,1,8,1,8,3,8,118,8,8,1,9,1,9,1,10,1,10,1,11,1,11,1,11,5,11,127,8,11,10,11,12,11,130,9,11,1,11,1,11,1,12,1,12,1,12,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,3,14,147,8,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,0,1,2,22,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,0,9,1,0,6,13,1,0,14,21,1,0,50,51,1,0,24,35,1,0,36,39,1,0,36,37,1,0,40,41,1,0,42,43,1,0,45,46,162,0,44,1,0,0,0,2,67,1,0,0,0,4,89,1,0,0,0,6,91,1,0,0,0,8,93,1,0,0,0,10,97,1,0,0,0,12,99,1,0,0,0,14,106,1,0,0,0,16,117,1,0,0,0,18,119,1,0,0,0,20,121,1,0,0,0,22,128,1,0,0,0,24,133,1,0,0,0,26,136,1,0,0,0,28,146,1,0,0,0,30,148,1,0,0,0,32,150,1,0,0,0,34,152,1,0,0,0,36,154,1,0,0,0,38,156,1,0,0,0,40,158,1,0,0,0,42,160,1,0,0,0,44,45,3,2,1,0,45,46,5,0,0,1,46,1,1,0,0,0,47,48,6,1,-1,0,48,68,3,4,2,0,49,50,3,34,17,0,50,51,3,2,1,6,51,68,1,0,0,0,52,53,5,1,0,0,53,54,3,2,1,0,54,55,5,2,0,0,55,68,1,0,0,0,56,57,5,3,0,0,57,62,3,2,1,0,58,59,5,4,0,0,59,61,3,2,1,0,60,58,1,0,0,0,61,64,1,0,0,0,62,60,1,0,0,0,62,63,1,0,0,0,63,65,1,0,0,0,64,62,1,0,0,0,65,66,5,5,0,0,66,68,1,0,0,0,67,47,1,0,0,0,67,49,1,0,0,0,67,52,1,0,0,0,67,56,1,0,0,0,68,83,1,0,0,0,69,70,10,5,0,0,70,71,3,32,16,0,71,72,3,2,1,6,72,82,1,0,0,0,73,74,10,4,0,0,74,75,3,30,15,0,75,76,3,2,1,5,76,82,1,0,0,0,77,78,10,3,0,0,78,79,3,36,18,0,79,80,3,2,1,4,80,82,1,0,0,0,81,69,1,0,0,0,81,73,1,0,0,0,81,77,1,0,0,0,82,85,1,0,0,0,83,81,1,0,0,0,83,84,1,0,0,0,84,3,1,0,0,0,85,83,1,0,0,0,86,90,3,28,14,0,87,90,3,22,11,0,88,90,3,24,12,0,89,86,1,0,0,0,89,87,1,0,0,0,89,88,1,0,0,0,90,5,1,0,0,0,91,92,3,12,6,0,92,7,1,0,0,0,93,94,3,26,13,0,94,9,1,0,0,0,95,98,3,26,13,0,96,98,5,53,0,0,97,95,1,0,0,0,97,96,1,0,0,0,98,11,1,0,0,0,99,100,3,26,13,0,100,102,5,1,0,0,101,103,3,14,7,0,102,101,1,0,0,0,102,103,1,0,0,0,103,104,1,0,0,0,104,105,5,2,0,0,105,13,1,0,0,0,106,111,3,2,1,0,107,108,5,4,0,0,108,110,3,2,1,0,109,107,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,15,1,0,0,0,113,111,1,0,0,0,114,118,3,18,9,0,115,118,3,20,10,0,116,118,5,51,0,0,117,114,1,0,0,0,117,115,1,0,0,0,117,116,1,0,0,0,118,17,1,0,0,0,119,120,7,0,0,0,120,19,1,0,0,0,121,122,7,1,0,0,122,21,1,0,0,0,123,124,3,26,13,0,124,125,5,22,0,0,125,127,1,0,0,0,126,123,1,0,0,0,127,130,1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128,1,0,0,0,131,132,3,26,13,0,132,23,1,0,0,0,133,134,5,23,0,0,134,135,7,2,0,0,135,25,1,0,0,0,136,137,5,50,0,0,137,27,1,0,0,0,138,147,5,52,0,0,139,147,3,42,21,0,140,147,3,38,19,0,141,147,3,40,20,0,142,147,5,47,0,0,143,147,5,48,0,0,144,147,5,49,0,0,145,147,5,51,0,0,146,138,1,0,0,0,146,139,1,0,0,0,146,140,1,0,0,0,146,141,1,0,0,0,146,142,1,0,0,0,146,143,1,0,0,0,146,144,1,0,0,0,146,145,1,0,0,0,147,29,1,0,0,0,148,149,7,3,0,0,149,31,1,0,0,0,150,151,7,4,0,0,151,33,1,0,0,0,152,153,7,5,0,0,153,35,1,0,0,0,154,155,7,6,0,0,155,37,1,0,0,0,156,157,7,7,0,0,157,39,1,0,0,0,158,159,5,44,0,0,159,41,1,0,0,0,160,161,7,8,0,0,161,43,1,0,0,0,11,62,67,81,83,89,97,102,111,117,128,146],re.DecisionsToDFA=re._ATN.decisionToState.map(((e,t)=>new o.DFA(e,t)));class ie extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(se,0)}EOF(){return this.getToken(re.EOF,0)}get ruleIndex(){return re.RULE_root}enterRule(e){e.enterRoot&&e.enterRoot(this)}exitRule(e){e.exitRoot&&e.exitRoot(this)}accept(e){return e.visitRoot?e.visitRoot(this):e.visitChildren(this)}}class se extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_expression}copyFrom(e){super.copyFrom(e)}}class ne extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(se,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}}class oe extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}enterRule(e){e.enterArrayExpression&&e.enterArrayExpression(this)}exitRule(e){e.exitArrayExpression&&e.exitArrayExpression(this)}accept(e){return e.visitArrayExpression?e.visitArrayExpression(this):e.visitChildren(this)}}class ae extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}polarOp(){return this.getTypedRuleContext(je,0)}expression(){return this.getTypedRuleContext(se,0)}enterRule(e){e.enterPolarityExpression&&e.enterPolarityExpression(this)}exitRule(e){e.exitPolarityExpression&&e.exitPolarityExpression(this)}accept(e){return e.visitPolarityExpression?e.visitPolarityExpression(this):e.visitChildren(this)}}class ce extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}compOp(){return this.getTypedRuleContext(He,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}}class le extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}arthOp(){return this.getTypedRuleContext($e,0)}enterRule(e){e.enterArithmeticExpression&&e.enterArithmeticExpression(this)}exitRule(e){e.exitArithmeticExpression&&e.exitArithmeticExpression(this)}accept(e){return e.visitArithmeticExpression?e.visitArithmeticExpression(this):e.visitChildren(this)}}class he extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}logOp(){return this.getTypedRuleContext(Be,0)}enterRule(e){e.enterLogicalExpression&&e.enterLogicalExpression(this)}exitRule(e){e.exitLogicalExpression&&e.exitLogicalExpression(this)}accept(e){return e.visitLogicalExpression?e.visitLogicalExpression(this):e.visitChildren(this)}}class ue extends se{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}term(){return this.getTypedRuleContext(pe,0)}enterRule(e){e.enterTermExpression&&e.enterTermExpression(this)}exitRule(e){e.exitTermExpression&&e.exitTermExpression(this)}accept(e){return e.visitTermExpression?e.visitTermExpression(this):e.visitChildren(this)}}class pe extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_term}copyFrom(e){super.copyFrom(e)}}class de extends pe{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}externalConstant(){return this.getTypedRuleContext(ve,0)}enterRule(e){e.enterExternalConstantTerm&&e.enterExternalConstantTerm(this)}exitRule(e){e.exitExternalConstantTerm&&e.exitExternalConstantTerm(this)}accept(e){return e.visitExternalConstantTerm?e.visitExternalConstantTerm(this):e.visitChildren(this)}}class _e extends pe{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}literal(){return this.getTypedRuleContext(Ne,0)}enterRule(e){e.enterLiteralTerm&&e.enterLiteralTerm(this)}exitRule(e){e.exitLiteralTerm&&e.exitLiteralTerm(this)}accept(e){return e.visitLiteralTerm?e.visitLiteralTerm(this):e.visitChildren(this)}}class fe extends pe{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}qualifiedIdentifier(){return this.getTypedRuleContext(Ae,0)}enterRule(e){e.enterQualifiedIdentifierTerm&&e.enterQualifiedIdentifierTerm(this)}exitRule(e){e.exitQualifiedIdentifierTerm&&e.exitQualifiedIdentifierTerm(this)}accept(e){return e.visitQualifiedIdentifierTerm?e.visitQualifiedIdentifierTerm(this):e.visitChildren(this)}}class ye extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}function_(){return this.getTypedRuleContext(Re,0)}get ruleIndex(){return re.RULE_invocable}enterRule(e){e.enterInvocable&&e.enterInvocable(this)}exitRule(e){e.exitInvocable&&e.exitInvocable(this)}accept(e){return e.visitInvocable?e.visitInvocable(this):e.visitChildren(this)}}class me extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_invocation}copyFrom(e){super.copyFrom(e)}}class Te extends me{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(be,0)}enterRule(e){e.enterMemberInvocation&&e.enterMemberInvocation(this)}exitRule(e){e.exitMemberInvocation&&e.exitMemberInvocation(this)}accept(e){return e.visitMemberInvocation?e.visitMemberInvocation(this):e.visitChildren(this)}}class xe extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_indexer}copyFrom(e){super.copyFrom(e)}}class Ee extends xe{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}INTEGER(){return this.getToken(re.INTEGER,0)}enterRule(e){e.enterNumberIndex&&e.enterNumberIndex(this)}exitRule(e){e.exitNumberIndex&&e.exitNumberIndex(this)}accept(e){return e.visitNumberIndex?e.visitNumberIndex(this):e.visitChildren(this)}}class ge extends xe{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(be,0)}enterRule(e){e.enterMemberIndex&&e.enterMemberIndex(this)}exitRule(e){e.exitMemberIndex&&e.exitMemberIndex(this)}accept(e){return e.visitMemberIndex?e.visitMemberIndex(this):e.visitChildren(this)}}class Re extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(be,0)}paramList(){return this.getTypedRuleContext(we,0)}get ruleIndex(){return re.RULE_function}enterRule(e){e.enterFunction&&e.enterFunction(this)}exitRule(e){e.exitFunction&&e.exitFunction(this)}accept(e){return e.visitFunction?e.visitFunction(this):e.visitChildren(this)}}class we extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}expression_list(){return this.getTypedRuleContexts(se)}expression(e){return this.getTypedRuleContext(se,e)}get ruleIndex(){return re.RULE_paramList}enterRule(e){e.enterParamList&&e.enterParamList(this)}exitRule(e){e.exitParamList&&e.exitParamList(this)}accept(e){return e.visitParamList?e.visitParamList(this):e.visitChildren(this)}}class Ce extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}dateTimePrecision(){return this.getTypedRuleContext(Oe,0)}pluralDateTimePrecision(){return this.getTypedRuleContext(Ie,0)}STRING(){return this.getToken(re.STRING,0)}get ruleIndex(){return re.RULE_unit}enterRule(e){e.enterUnit&&e.enterUnit(this)}exitRule(e){e.exitUnit&&e.exitUnit(this)}accept(e){return e.visitUnit?e.visitUnit(this):e.visitChildren(this)}}class Oe extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_dateTimePrecision}enterRule(e){e.enterDateTimePrecision&&e.enterDateTimePrecision(this)}exitRule(e){e.exitDateTimePrecision&&e.exitDateTimePrecision(this)}accept(e){return e.visitDateTimePrecision?e.visitDateTimePrecision(this):e.visitChildren(this)}}class Ie extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_pluralDateTimePrecision}enterRule(e){e.enterPluralDateTimePrecision&&e.enterPluralDateTimePrecision(this)}exitRule(e){e.exitPluralDateTimePrecision&&e.exitPluralDateTimePrecision(this)}accept(e){return e.visitPluralDateTimePrecision?e.visitPluralDateTimePrecision(this):e.visitChildren(this)}}class Ae extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(be)}identifier(e){return this.getTypedRuleContext(be,e)}get ruleIndex(){return re.RULE_qualifiedIdentifier}enterRule(e){e.enterQualifiedIdentifier&&e.enterQualifiedIdentifier(this)}exitRule(e){e.exitQualifiedIdentifier&&e.exitQualifiedIdentifier(this)}accept(e){return e.visitQualifiedIdentifier?e.visitQualifiedIdentifier(this):e.visitChildren(this)}}class ve extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(re.IDENTIFIER,0)}STRING(){return this.getToken(re.STRING,0)}get ruleIndex(){return re.RULE_externalConstant}enterRule(e){e.enterExternalConstant&&e.enterExternalConstant(this)}exitRule(e){e.exitExternalConstant&&e.exitExternalConstant(this)}accept(e){return e.visitExternalConstant?e.visitExternalConstant(this):e.visitChildren(this)}}class be extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(re.IDENTIFIER,0)}get ruleIndex(){return re.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}}class Ne extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_literal}copyFrom(e){super.copyFrom(e)}}class Le extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(re.TIME,0)}enterRule(e){e.enterTimeLiteral&&e.enterTimeLiteral(this)}exitRule(e){e.exitTimeLiteral&&e.exitTimeLiteral(this)}accept(e){return e.visitTimeLiteral?e.visitTimeLiteral(this):e.visitChildren(this)}}class Se extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(ze,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}}class ke extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(re.DATETIME,0)}enterRule(e){e.enterDateTimeLiteral&&e.enterDateTimeLiteral(this)}exitRule(e){e.exitDateTimeLiteral&&e.exitDateTimeLiteral(this)}accept(e){return e.visitDateTimeLiteral?e.visitDateTimeLiteral(this):e.visitChildren(this)}}class De extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(re.STRING,0)}enterRule(e){e.enterStringLiteral&&e.enterStringLiteral(this)}exitRule(e){e.exitStringLiteral&&e.exitStringLiteral(this)}accept(e){return e.visitStringLiteral?e.visitStringLiteral(this):e.visitChildren(this)}}class Pe extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(re.DATE,0)}enterRule(e){e.enterDateLiteral&&e.enterDateLiteral(this)}exitRule(e){e.exitDateLiteral&&e.exitDateLiteral(this)}accept(e){return e.visitDateLiteral?e.visitDateLiteral(this):e.visitChildren(this)}}class Ue extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(Ge,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}}class Me extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(qe,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}}class Fe extends Ne{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(re.NUMBER,0)}enterRule(e){e.enterNumberLiteral&&e.enterNumberLiteral(this)}exitRule(e){e.exitNumberLiteral&&e.exitNumberLiteral(this)}accept(e){return e.visitNumberLiteral?e.visitNumberLiteral(this):e.visitChildren(this)}}class He extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_compOp}enterRule(e){e.enterCompOp&&e.enterCompOp(this)}exitRule(e){e.exitCompOp&&e.exitCompOp(this)}accept(e){return e.visitCompOp?e.visitCompOp(this):e.visitChildren(this)}}class $e extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_arthOp}enterRule(e){e.enterArthOp&&e.enterArthOp(this)}exitRule(e){e.exitArthOp&&e.exitArthOp(this)}accept(e){return e.visitArthOp?e.visitArthOp(this):e.visitChildren(this)}}class je extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_polarOp}enterRule(e){e.enterPolarOp&&e.enterPolarOp(this)}exitRule(e){e.exitPolarOp&&e.exitPolarOp(this)}accept(e){return e.visitPolarOp?e.visitPolarOp(this):e.visitChildren(this)}}class Be extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_logOp}enterRule(e){e.enterLogOp&&e.enterLogOp(this)}exitRule(e){e.exitLogOp&&e.exitLogOp(this)}accept(e){return e.visitLogOp?e.visitLogOp(this):e.visitChildren(this)}}class qe extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}}class ze extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}}class Ge extends o.ParserRuleContext{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return re.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}}class Ve extends b{constructor(e){super(""+e)}toString(){return"@"+super.toString()}}const We=o.tree.ParseTreeVisitor;class Qe extends We{constructor(e){super(),this._timeZone=e?.timeZone}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitIdentifier(e){return e.getText()}visitNullLiteral(){return new Q}visitBooleanLiteral(e){return new M("true"===e.getText())}visitNumberLiteral(e){return new X(e.getText())}visitStringLiteral(e){return new Y(G(e.getText()))}visitInfinityLiteral(){return new X(1/0)}visitDateLiteral(e){return new W(G(e.getText()))}visitDateTimeLiteral(e){return new W(G(e.getText()))}visitTimeLiteral(e){return new J(G(e.getText()))}visitQualifiedIdentifierTerm(e){return new K(e.getText())}visitPolarityExpression(e){const t=this.visit(e.expression());if("NumberLiteral"===t.kind)return"-"===e.polarOp().getText()&&(t.value*=-1),t;throw new F('Unexpected token "'+e.getText()+'"')}visitExternalConstantTerm(e){return new Ve(e.externalConstant().getText().substring(1))}visitParenthesizedExpression(e){const t=this.visit(e.expression());return new U(t)}visitArrayExpression(e){return new S(e.expression_list().map((e=>this.visit(e))))}visitComparisonExpression(e){return new D({op:e.compOp().getText(),left:this.visit(e.expression(0)),right:this.visit(e.expression(1))})}visitLogicalExpression(e){const t=[],r=(e,i)=>{for(const s of e){if(s instanceof he&&s.logOp().getText()===i){r(s.expression_list(),s.logOp().getText());continue}const e=this.visit(s);t.push(e)}};return r(e.expression_list(),e.logOp().getText()),new P({op:e.logOp().getText(),items:t})}visitArithmeticExpression(e){const t=new N,r=(e,i)=>{for(let s=0,n=e.length;s<n;s++){const n=e[s];if(n instanceof le){r(n.expression_list(),n.arthOp().getText());continue}const o=this.visit(n);t.append(i||"+",o)}};return r(e.expression_list(),e.arthOp().getText()),t}}class Xe extends o.ErrorListener{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,s,n){this.errors.push(new $(s,{recognizer:e,offendingSymbol:t,line:r,e:n}))}}var Ke,Ye;!function(e){e.X_Opra_Version="X-Opra-Version",e.X_Opra_DataType="X-Opra-DataType",e.X_Opra_Count="X-Opra-Count",e.WWW_Authenticate="WWW-Authenticate",e.Authorization="Authorization",e.Proxy_Authenticate="Proxy-Authenticate",e.Proxy_Authorization="Proxy-Authorization",e.Age="Age",e.Cache_Control="Cache-Control",e.Clear_Site_Data="Clear-Site-Data",e.Expires="Expires",e.Pragma="Pragma",e.Last_Modified="Last-Modified",e.ETag="ETag",e.If_Match="If-Match",e.If_None_Match="If-None-Match",e.If_Modified_Since="If-Modified-Since",e.If_Unmodified_Since="If-Unmodified-Since",e.Vary="Vary",e.Connection="Connection",e.Keep_Alive="Keep-Alive",e.Accept="Accept",e.Accept_Encoding="Accept-Encoding",e.Accept_Language="Accept-Language",e.Expect="Expect",e.Cookie="Cookie",e.Set_Cookie="Set-Cookie",e.Access_Control_Allow_Origin="Access-Control-Allow-Origin",e.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",e.Access_Control_Allow_Headers="Access-Control-Allow-Headers",e.Access_Control_Allow_Methods="Access-Control-Allow-Methods",e.Access_Control_Expose_Headers="Access-Control-Expose-Headers",e.Access_Control_Max_Age="Access-Control-Max-Age",e.Access_Control_Request_Headers="Access-Control-Request-Headers",e.Access_Control_Request_Method="Access-Control-Request-Method",e.Origin="Origin",e.Timing_Allow_Origin="Timing-Allow-Origin",e.Content_Disposition="Content-Disposition",e.Content_ID="Content-ID",e.Content_Length="Content-Length",e.Content_Type="Content-Type",e.Content_Transfer_Encoding="Content-Transfer-Encoding",e.Content_Encoding="Content-Encoding",e.Content_Language="Content-Language",e.Content_Location="Content-Location",e.Forwarded="Forwarded",e.X_Forwarded_For="X-Forwarded-For",e.X_Forwarded_Host="X-Forwarded-Host",e.X_Forwarded_Proto="X-Forwarded-Proto",e.Via="Via",e.Location="Location",e.From="From",e.Host="Host",e.Referer="Referer",e.Referrer_Policy="Referrer-Policy",e.User_Agent="User-Agent",e.Allow="Allow",e.Server="Server",e.Accept_Ranges="Accept-Ranges",e.Range="Range",e.If_Range="If-Range",e.Content_Range="Content-Range",e.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",e.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",e.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",e.Content_Security_Policy="Content-Security-Policy",e.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",e.Expect_CT="Expect-CT",e.Feature_Policy="Feature-Policy",e.Strict_Transport_Security="Strict-Transport-Security",e.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",e.X_Content_Type_Options="X-Content-Type-Options",e.X_Download_Options="X-Download-Options",e.X_Frame_Options="X-Frame-Options",e.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",e.X_Powered_By="X-Powered-By",e.X_XSS_Protection="X-XSS-Protection",e.Transfer_Encoding="Transfer-Encoding",e.TE="TE",e.Trailer="Trailer",e.Sec_WebSocket_Key="Sec-WebSocket-Key",e.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",e.Sec_WebSocket_Accept="Sec-WebSocket-Accept",e.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",e.Sec_WebSocket_Version="Sec-WebSocket-Version",e.Date="Date",e.Retry_After="Retry-After",e.Server_Timing="Server-Timing",e.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control"}(Ke||(Ke={})),function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLYHINTS=103]="EARLYHINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.AMBIGUOUS=300]="AMBIGUOUS",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.TOO_EARLY=425]="TOO_EARLY",e[e.UPGRADE_REQUIRED=428]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(Ye||(Ye={}));const Ze=Object.keys(Ke),Je=Ze.map((e=>e.toLowerCase()));function et(e,t){return e&&Object.keys(e).reduce(((r,i)=>{const s=e[i],n=t?Ze[Je.indexOf(i.toLowerCase())]||i.replace(/(^\w|[A-Z]|\b\w)/g,(function(e){return e.toUpperCase()})):i.toLowerCase();return"set-cookie"===i.toLowerCase()?r[n]=Array.isArray(s)?s:[s]:r[n]=Array.isArray(s)?s.join(";"):s,r}),{})||{}}class tt{constructor(e){this.method=e.method,this.url=encodeURI(decodeURI(e.url)),this.headers=e.headers,this.data=e.data}}class rt{constructor(e){this.status=e.status,this.headers=e.headers,this.data=e.data}}const it="\r\n",st=/ *charset=./i;class nt{constructor(){this._parts=[],this.boundary="batch_"+c.uid(12)}addRequestPart(e,t){const r={...et(t?.headers||{},!0),[Ke.Content_Type]:"application/http",[Ke.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Ke.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new tt(e)}),this}addHttpResponse(e,t){const r={...et(t?.headers||{},!0),[Ke.Content_Type]:"application/http",[Ke.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Ke.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new rt(e)}),this}addBatch(e,t){const r={...et(t?.headers||{},!0),[Ke.Content_Type]:"application/http",[Ke.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Ke.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:e}),this}stream(){const e=[];return this._build(e),a(e).flatten().toNodeStream()}_build(t){for(const r of this._parts){if(!(r.content instanceof tt||r.content instanceof rt))throw new Error("Not implemented yet");{let i=r.content.data,s=0;const n=et(r.content.headers);if(i){const t=String(n["content-type"]||"").split(/\s*;\s*/);let r="";if(y(i)?s=parseInt(String(n["content-length"]),10)||0:"object"==typeof i?"function"==typeof i.stream?(t[0]=i.type||"binary",s=i.size,i=i.stream()):e.Buffer.isBuffer(i)?n["content-length"]=String(i.length):(t[0]=t[0]||"application/json",r="utf-8",i=e.Buffer.from(JSON.stringify(i),"utf-8"),s=i.length):(t[0]=t[0]||"text/plain",r="utf-8",i=e.Buffer.from(String(i),"utf-8"),s=i.length),t[0]){if(r){const e=t.findIndex((e=>st.test(String(e))));e>0?t[e]="charset="+r:t.join("charset="+r)}n["content-type"]=t.join(";")}s&&(n["content-length"]=String(s))}let o="--"+this.boundary+it;for(const[e,t]of Object.entries(r.headers))""!==t&&null!=t&&(o+=e+": "+(Array.isArray(t)?t.join(";"):t)+it);if(o+=it,r.content instanceof tt?o+=(r.content.method||"GET").toUpperCase()+" "+r.content.url+" HTTP/1.1"+it:o+="HTTP/1.1 "+r.content.status+(Ye[r.content.status]||"Unknown")+it,r.content.headers)for(const[e,t]of Object.entries(r.content.headers))""!==t&&null!=t&&("set-cookie"===e&&Array.isArray(t)?t.forEach((t=>o+=e+": "+t)):o+=e+": "+(Array.isArray(t)?t.join(";"):t)+it);o+=it,t.push(e.Buffer.from(o,"utf-8")),i&&(t.push(i),t.push(e.Buffer.from(it+it)))}}t.push(e.Buffer.from("--"+this.boundary+"--"+it,"utf-8"))}}const ot="opra:complex_type.fields",at="opra:resolver.metadata",ct="opra:ignore_resolver-method",lt="opra:mapped_type.metadata",ht=["create","delete","get","update"],ut=[...ht,"count","deleteMany","updateMany","search"];var pt;!function(e){e.Version="1.0",e.isDataType=function(e){return e&&"object"==typeof e&&("ComplexType"===e.kind||"SimpleType"===e.kind||"UnionType"===e.kind)},e.isComplexType=function(e){return e&&"object"==typeof e&&"ComplexType"===e.kind},e.isSimpleType=function(e){return e&&"object"==typeof e&&"SimpleType"===e.kind},e.isUnionTypee=function(e){return e&&"object"==typeof e&&"UnionType"===e.kind},e.isResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind||"CollectionResource"===e.kind||"SingletonResource"===e.kind},e.isCollectionResource=function(e){return e&&"object"==typeof e&&"CollectionResource"===e.kind},e.isSingletonResource=function(e){return e&&"object"==typeof e&&"SingletonResource"===e.kind},e.isContainerResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind}}(pt||(pt={}));class dt extends Map{constructor(e,t){super(),this._keyMap=new Map,this._keyOrder=[],this._wellKnownKeyMap=new Map,t&&t.forEach((e=>this._wellKnownKeyMap.set(e.toLowerCase(),e))),"function"==typeof e?.forEach?e.forEach(((e,t)=>this.set(t,e))):e&&"object"==typeof e&&Object.keys(e).forEach((t=>this.set(t,e[t])))}clear(){super.clear(),this._keyMap.clear(),this._keyOrder=[]}get(e){const t=this._getOriginalKey(e);return super.get(t)}has(e){return this._keyMap.has(this._getLowerKey(e))}set(e,t){return e=this._getOriginalKey(e),this._keyMap.set(this._getLowerKey(e),e),this._keyOrder.includes(e)||this._keyOrder.push(e),super.set(e,t)}keys(){return this._keyOrder.values()}values(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:r.get(t[e])})}}entries(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],r.get(t[e])]})}}delete(e){const t=this._getOriginalKey(e),r=this._getLowerKey(e);this._keyMap.delete(r);const i=this._keyOrder.indexOf(t);return i>=0&&this._keyOrder.splice(i,1),super.delete(t)}sort(e){return this._keyOrder.sort(e),this}[Symbol.iterator](){return this.entries()}_getOriginalKey(e){return"string"==typeof e?this._keyMap.get(e.toLowerCase())??this._wellKnownKeyMap.get(e.toLowerCase())??e:e}_getLowerKey(e){return"string"==typeof e?e.toLowerCase():e}}function _t(e){return"function"==typeof e&&!(!e.prototype||!e.prototype.constructor)}const ft={kind:"UnionType",description:"Any value",ctor:Object,types:[]},yt={kind:"SimpleType",description:"A stream of bytes, base64 encoded",ctor:Object.getPrototypeOf(e.Buffer.from("")).constructor,parse:t=>e.Buffer.from(t),serialize:t=>e.Buffer.isBuffer(t)?t.toString("base64"):void 0},mt={kind:"SimpleType",description:"BigInt number",ctor:Object.getPrototypeOf(BigInt(0)).constructor,parse:e=>BigInt(e),serialize:e=>String(e)},Tt={kind:"SimpleType",description:"Simple true/false value",ctor:Boolean,parse:e=>n.toBoolean(e),serialize:e=>n.toBoolean(e)},xt={kind:"SimpleType",description:"A date, date-time or partial date",ctor:String,parse:e=>n.toDate(e),serialize:e=>String(e)},Et={kind:"SimpleType",description:"A date, date-time or partial date in string format",ctor:String,parse:e=>n.toString(e),serialize:e=>n.toString(e)},gt={kind:"SimpleType",description:"A guid value",ctor:String,parse:e=>n.toString(e),serialize:e=>n.toString(e)},Rt={kind:"SimpleType",description:"An integer number",ctor:Number,parse:e=>n.toInt(e),serialize:e=>n.toInt(e)},wt={kind:"SimpleType",description:"Both Integer as well as Floating-Point numbers",ctor:Number,parse:e=>n.toNumber(e),serialize:e=>n.toNumber(e)},Ct={kind:"ComplexType",description:"A non modelled object",ctor:Object,additionalFields:!0,parse:e=>e,serialize:e=>e},Ot={kind:"SimpleType",description:"A sequence of characters",ctor:String,parse:e=>n.toString(e),serialize:e=>n.toString(e)},It=Object.getPrototypeOf(BigInt(0)).constructor,At=Object.getPrototypeOf(e.Buffer.from("")).constructor,vt=new dt;vt.set("any",ft),vt.set("base64Binary",yt),vt.set("bigint",mt),vt.set("boolean",Tt),vt.set("date",xt),vt.set("dateString",Et),vt.set("guid",gt),vt.set("integer",Rt),vt.set("number",wt),vt.set("object",Ct),vt.set("string",Ot);const bt=new Map;function Nt(e,t){return p({},e,{deep:!0,clone:!0,filter:(e,r)=>{const i=e[r];return null!=i&&!t||"function"!=typeof i&&("object"!=typeof i||u(i)||Array.isArray(i))}})}async function Lt(e){const t=Object.getPrototypeOf(e).constructor,r=Reflect.getMetadata("opra:resource.metadata",t);if(!r)throw new TypeError(`Class "${t.name}" doesn't have "Resource" metadata information`);const i=Nt(r);if(i.instance=e,i.name=r.name||t.name.replace(/(Resource|Controller)$/,""),pt.isCollectionResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let i,s;const n=(e,t)=>{s=e[t],i=Reflect.getMetadata(at,e,t),null==s&&i&&(e=Object.getPrototypeOf(e),s=e[t])};for(const o of ut){if(n(t,o),"function"!=typeof s)continue;const a=e[o]={...i};Reflect.hasMetadata(ct,r.constructor,o)||(a.handler=s.bind(t),s=t["pre_"+o],"function"==typeof s&&(e["pre_"+o]=s.bind(t)))}return e}(i);if(pt.isSingletonResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let i,s;const n=(e,t)=>{s=e[t],i=Reflect.getMetadata(at,e,t),null==s&&i&&(e=Object.getPrototypeOf(e),s=e[t])};for(const o of ht){if(n(t,o),"function"!=typeof s)continue;const a=e[o]={...i};Reflect.hasMetadata(ct,r.constructor,o)||(a.handler=s.bind(t),s=t["pre_"+o],"function"==typeof s&&(e["pre_"+o]=s.bind(t)))}return e}(i);throw new TypeError("Invalid Resource metadata")}bt.set(Boolean,"boolean"),bt.set(String,"string"),bt.set(Number,"number"),bt.set(Date,"date"),bt.set(It,"bigint"),bt.set(At,"base64Binary"),bt.set(Object,"object");const St=Symbol.for("opra.optional-lib.sqb-connect");async function kt(e){const t=Reflect.getMetadata("opra:data_type.metadata",e);if(!t)throw new TypeError(`Class "${e}" doesn't have "DataType" metadata information`);if(pt.isComplexType(t))return await async function(e,t){const r=Nt(t);r.ctor=e;const i=Reflect.getMetadata(lt,e);i&&(r.extends=[...i.map((e=>Nt(e)))]);const s=Reflect.getMetadata(ot,e);if(s){r.fields=Nt(s);for(const[t,i]of Object.entries(r.fields)){if("function"==typeof i.type){const e=bt.get(i.type);e&&(i.type=e)}const r=globalThis[St]?.SqbConnect;let s;if(r){const{EntityMetadata:n,isAssociationField:o}=r,a=n.get(e);if(s=a&&n.getField(a,t),s){if((i.type===Function||"object"===i.type||i.type===Object||"any"===i.type)&&(i.type="any",o(s))){s.association.returnsMany()||delete i.isArray;const e=await s.association.resolveTarget();e&&(i.type=e.ctor)}s.exclusive&&void 0===i.exclusive&&(i.exclusive=s.exclusive)}}if(s&&"column"===s.kind){const e=r.DataType;if("number"===i.type||i.type===Number)switch(s.dataType){case e.INTEGER:case e.SMALLINT:i.type="integer";break;case e.BIGINT:i.type="bigint"}else if(("string"===i.type||i.type===String)&&s.dataType===e.GUID)i.type="guid";s.notNull&&void 0===i.required&&(i.required=s.notNull),s.exclusive&&void 0===i.exclusive&&(i.exclusive=s.exclusive),void 0!==s.default&&void 0===i.default&&(i.default=s.default)}}}return r}(e,t);if(pt.isSimpleType(t))return await async function(e,t){const r=Nt(t);return r.ctor=e,r}(e,t);throw new TypeError("Invalid DataType metadata")}const Dt=Symbol.for("opra.optional-lib.sqb-connect");class Pt{constructor(e){this._dataTypes=new dt,this._resources=new dt,this._args=e}buildSchema(){const e={...this._args,version:pt.Version};return this._dataTypes.size&&(e.types=Array.from(this._dataTypes.keys()).sort().reduce(((e,t)=>(e[t]=this._dataTypes.get(t),e)),{})),this._resources.size&&(e.resources=Array.from(this._resources.keys()).sort().reduce(((e,t)=>(e[t]=this._resources.get(t),e)),{})),e}async addDataTypeSchema(e,t){if(!pt.isDataType(t))throw new TypeError("Invalid DataType schema");const r=this._dataTypes.get(e);if(r){if(r.kind!==t.kind||!r.ctor||r.ctor!==t.ctor)throw new Error(`An other instance of "${e}" data type previously defined`)}else if(this._dataTypes.set(e,t),pt.isComplexType(t)){if(t.extends)for(const e of t.extends)"string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type));if(t.fields)for(const e of Object.values(t.fields))e.type=e.type||"string","string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type))}}async addDataTypeClass(e){if(!_t(e=h.isPromise(e)?await e:e))return this.addDataTypeClass(e());const t=bt.get(e);if(t)return t;const r=await kt(e),i=r.name,s=r;return delete s.name,await this.addDataTypeSchema(i,s),i}async addResourceSchema(e,t){if(!pt.isResource(t))throw new TypeError("Invalid Resource schema");if(this._resources.has(e))throw new Error(`An other instance of "${e}" resource previously defined`);if(pt.isCollectionResource(t)||pt.isSingletonResource(t)){const e="function"==typeof t.type?await this.addDataTypeClass(t.type):t.type;if(t.type=e,!this._dataTypes.has(t.type)&&!vt.has(t.type))throw new Error(`Resource registration error. Type "${t.type}" not found.`)}if(pt.isCollectionResource(t)&&!t.keyFields){const r=this._dataTypes.get(t.type),i=globalThis[Dt]?.SqbConnect;if(i&&r?.ctor){const e=i.EntityMetadata.get(r?.ctor);if(e?.indexes){const r=e.indexes.find((e=>e.primary));r&&(t.keyFields=r.columns)}}if(t.keyFields=Array.isArray(t.keyFields)?t.keyFields.length?t.keyFields:"":t.keyFields,!t.keyFields)throw new TypeError(`You must provide keyFields for "${e}" entity resource`)}this._resources.set(e,t)}async addResourceInstance(e){let t;"function"==typeof(e=h.isPromise(e)?await e:e)?_t(e)?(t={},Object.setPrototypeOf(t,e.prototype)):t=await e():t=e;const r=await Lt(t),i=r.name,s=r;return delete s.name,await this.addResourceSchema(i,s),i}}function Ut(e,t){return e<t?-1:e>t?1:0}const Mt=Symbol.for("nodejs.util.inspect.custom"),Ft="[0m",Ht="[33m",$t="[35m";class jt{constructor(e,t,r){this._document=e,this._name=t,this._metadata=r}get document(){return this._document}get kind(){return this._metadata.kind}get name(){return this._name}get description(){return this._metadata.description}get ctor(){return this._metadata.ctor}parse(e){return this._metadata.parse?this._metadata.parse(e):e}getSchema(e){return Nt(this._metadata,e)}}class Bt extends jt{constructor(e,t,r){super(e,t,{kind:"ComplexType",...r}),this._initialized=!1,this.ownFields=new dt,this.fields=new dt}get abstract(){return!!this._metadata.abstract}get additionalFields(){return this._metadata.additionalFields||this._mixinAdditionalFields}get extends(){return this._metadata.extends}getField(e){if(e.includes(".")){let t=this;const r=e.split(".");let i;for(const e of r)i=t.getField(e),t=t.document.getDataType(i.type||"string");return i}const t=this.fields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have a field named "${e}"`);return t}getFieldType(e){const t=this.getField(e);return this.document.getDataType(t.type||"string")}getOwnField(e){const t=this.ownFields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have an own field named "${e}"`);return t}getSchema(){const e=super.getSchema();if(this.additionalFields&&(e.additionalFields=this.additionalFields),this.ownFields.size){e.fields={};for(const[t,r]of this.ownFields)e.fields[t]=Nt(r),delete e.fields[t].name}return e}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[Mt](){return`[${Ht+Object.getPrototypeOf(this).constructor.name+Ft} ${$t+this.name+Ft}]`}init(){if(this._initialized)return;this._initialized=!0;const e=this._metadata;if(e.extends)for(const t of e.extends){const e=this.document.types.get(t.type);if(!e)throw new TypeError(`Extending schema (${t.type}) of data type "${this.name}" does not exists`);if(!(e instanceof Bt))throw new TypeError(`Cannot extend ${this.name} from a "${e.kind}"`);e.init(),e.additionalFields&&(this._mixinAdditionalFields=!0);for(const[t,r]of e.fields){const e=Nt(r);e.name=t,e.parent=this,this.fields.set(t,e)}}if(e.fields)for(const[t,r]of Object.entries(e.fields)){if(!this.document.types.get(r.type))throw new TypeError(`Type "${r.type}" defined for "${this.name}.${t}" does not exists`);const e=Nt(r);e.name=t,this.fields.set(t,e),this.ownFields.set(t,e)}}}class qt extends jt{constructor(e,t,r){super(e,t,{kind:"SimpleType",...r})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[Mt](){return`[${Ht+Object.getPrototypeOf(this).constructor.name+Ft} ${$t+this.name+Ft}]`}}class zt extends jt{constructor(e,t,r){super(e,t,l({kind:"UnionType",...r},["types"])),this.types=r.types,this.hasAdditionalFields="any"===t||!!this.types.find((e=>e instanceof Bt&&e.additionalFields))}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[Mt](){return`[${Ht+Object.getPrototypeOf(this).constructor.name+Ft} ${$t+this.name+Ft}]`}}const Gt=/^([^.]+)\.(.*)$/;function Vt(e){if(e.length)return Wt(e,{})}function Wt(e,t){for(const r of e){const e=Gt.exec(r);if(e){const r=e[1];if(!0===t[r])continue;const i=t[r]="object"==typeof t[r]?t[r]:{};Wt([e[2]],i)}else t[r]=!0}return t}function Qt(e,t,r,i=""){return Xt([],e,t,Vt(r)||{},"",i,{additionalFields:!0})}function Xt(e,t,r,i,s="",n="",o){let a="";for(const c of Object.keys(i)){const l=i[c],h=r?.fields.get(c);if(!h){if(a=s?s+"."+c:c,!o?.additionalFields||r&&!r.additionalFields)throw new TypeError(`Unknown field "${a}"`);"object"==typeof l?Xt(e,t,void 0,l,a,n,o):e.push(a);continue}a=s?s+"."+h.name:h.name;const u=t.getDataType(h.type||"string");if("object"!=typeof l)e.findIndex((e=>e.startsWith(a+".")))>=0&&(e=e.filter((e=>!e.startsWith(a+".")))),e.push(a);else{if(!(u&&u instanceof Bt))throw new TypeError(`"${n?n+"."+a:a}" is not a complex type and has no sub fields`);if(e.findIndex((e=>e===s))>=0)continue;e=Xt(e,t,u,l,a,n,o)}}return e}class Kt{constructor(e,t,r){this.document=e,this.name=t,this.metadata=r}get instance(){return this.metadata.instance}get kind(){return this.metadata.kind}get description(){return this.metadata.description}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}validateQueryOptions(){}getSchema(e){return Nt(this.metadata,e)}[Mt](){return`[${Ht+Object.getPrototypeOf(this).constructor.name+Ft} ${$t+this.name+Ft}]`}}class Yt extends Kt{constructor(e,t,r,i){if(!i.keyFields)throw new TypeError(`You should provide key fields for ${t}`);super(e,t,i),i.keyFields=Array.isArray(i.keyFields)?i.keyFields:[i.keyFields],i.keyFields.forEach((e=>r.getField(e))),this.dataType=r,i.search&&i.search.sortFields&&(i.search.sortFields=Qt(e,r,i.search.sortFields))}get keyFields(){return this.metadata.keyFields}get create(){return this.metadata.create}get count(){return this.metadata.count}get delete(){return this.metadata.delete}get deleteMany(){return this.metadata.deleteMany}get get(){return this.metadata.get}get update(){return this.metadata.update}get updateMany(){return this.metadata.updateMany}get search(){return this.metadata.search}getSchema(e){const t=super.getSchema(e);t.keyFields.length<2&&(t.keyFields=t.keyFields[0]);for(const e of ut)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class Zt extends Kt{constructor(e,t,r,i){if(!(r instanceof Bt))throw new TypeError('You should provide a ComplexType as "dataType" argument');super(e,t,i),this.dataType=r}get create(){return this.metadata.create}get delete(){return this.metadata.delete}get get(){return this.metadata.get}get update(){return this.metadata.update}getSchema(e){const t=super.getSchema(e);for(const e of ht)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class Jt{constructor(e){this._ownTypes=new dt,this._types=new dt,this._resources=new dt,this._meta=l(e,["types","resources"]);for(const[e,t]of vt.entries())this._addDataType(e,t,!1);if(e.types)for(const[t,r]of Object.entries(e.types))this._addDataType(t,r,!0);if(this._initTypes(),e.resources)for(const[t,r]of Object.entries(e.resources))this._addResource(t,r)}get info(){return this._meta.info}get types(){return this._types}getDataType(e){const t=this.types.get(e);if(t)return t;throw new Error(`Data type "${e}" does not exists`)}getComplexDataType(e){const t=this.getDataType(e);if(t&&t instanceof Bt)return t;throw new Error(`Data type "${e}" is not a ComplexType`)}getSimpleDataType(e){const t=this.getDataType(e);if(t&&t instanceof qt)return t;throw new Error(`Data type "${e}" is not a SimpleType`)}getUnionDataType(e){const t=this.getDataType(e);if(t&&t instanceof zt)return t;throw new Error(`Data type "${e}" is not a UnionType`)}get resources(){return this._resources}get servers(){return this._meta.servers}getResource(e){const t=this.resources.get(e);if(!t)throw new Error(`Resource "${e}" does not exists`);return t}getCollectionResource(e){const t=this.getResource(e);if(!(t instanceof Yt))throw new Error(`"${e}" is not a CollectionResource`);return t}getSingletonResource(e){const t=this.getResource(e);if(!(t instanceof Zt))throw new Error(`"${e}" is not a SingletonResource`);return t}getMetadata(e){const t={version:pt.Version,info:Nt(this.info)};return this._ownTypes.size&&(t.types=Array.from(this._ownTypes.values()).sort(((e,t)=>Ut(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),this.resources.size&&(t.resources=Array.from(this._resources.values()).sort(((e,t)=>Ut(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),t}_addDataType(e,t,r){let i=this._types.get(e);if(i)return i;if(pt.isComplexType(t))i=new Bt(this,e,t);else if(pt.isSimpleType(t))i=new qt(this,e,t);else{if(!pt.isUnionTypee(t))throw new TypeError("Invalid data type schema");i=new zt(this,e,{...t,types:[]})}return this._types.set(e,i),r&&this._ownTypes.set(e,i),i}_addResource(e,t){if(!pt.isCollectionResource(t)&&!pt.isSingletonResource(t))throw new TypeError(`Unknown resource kind (${t.kind})`);{const r=this.getDataType(t.type);if(!r)throw new TypeError(`Datatype "${t.type}" declared in CollectionResource (${e}) does not exists`);if(!(r instanceof Bt))throw new TypeError(`${t.type} is not an ComplexType`);pt.isCollectionResource(t)?this.resources.set(e,new Yt(this,e,r,t)):this.resources.set(e,new Zt(this,e,r,t))}}_initTypes(){for(const e of this._types.values())e instanceof Bt&&e.init()}static async create(e){const t=new Pt(e);if(e.types)if(Array.isArray(e.types))for(const r of e.types)await t.addDataTypeClass(r);else for(const[r,i]of Object.entries(e.types))await t.addDataTypeSchema(r,i);if(e.resources)if(Array.isArray(e.resources))for(const r of e.resources)await t.addResourceInstance(r);else for(const[r,i]of Object.entries(e.resources))await t.addResourceSchema(r,i);const r=t.buildSchema();return new Jt(r)}}function er(e,t){if(!e)return"";for(;t&&e.startsWith("/");)e=e.substring(1);for(;e.endsWith("/");)e=e.substring(0,e.length-1);return e}const tr=/^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;function rr(e){const r=tr.exec(e);if(!r)throw Object.assign(new TypeError("Invalid URL path"),{code:"ERR_INVALID_URL_PATH",input:e});const i=decodeURIComponent(r[1]);let s;if(r[2]){const i=decodeURIComponent(r[2]||""),n=t.splitString(i,{delimiters:";",quotes:!0,escape:!1});for(const r of n){const i=t.splitString(r,{delimiters:"=",quotes:!0,escape:!1});if(n.length>1&&i.length<2||s&&i.length>=2&&"object"!=typeof s||i.length<2&&"object"==typeof s)throw Object.assign(new TypeError("Invalid URL path. name:value pair required for multiple key format"),{pathComponent:e,code:"ERR_INVALID_URL_PATH"});i.length>=2?(s=s||{},s[i.shift()||""]=i.join("=")):s=i[0]}}return r[3]?{resource:i,key:s,typeCast:r[3]}:{resource:i,key:s}}function ir(e,t,r){if(null==e)return"";let i="";if(""!==t&&null!=t)if(u(t)){const e=[];for(const r of Object.keys(t))e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));i=e.join(";")}else i=encodeURIComponent(""+t);return r&&(r=encodeURIComponent(r)),encodeURIComponent(e).replace(/%24/,"$")+(i?"@"+i:"")+(r?"::"+r:"")}const sr=Symbol.for("nodejs.util.inspect.custom");class nr{constructor(e){this.resource=e.resource,this.key=e.key,this.typeCast=e.typeCast}toString(){const e=ir(this.resource,this.key,this.typeCast);return e&&Object.setPrototypeOf(e,nr.prototype),e}[sr](){const e={resource:this.resource};return null!=this.key&&(e.key=this.key),null!=this.typeCast&&(e.typeCast=this.typeCast),e}}const or=Symbol.for("nodejs.util.inspect.custom");class ar extends d.EventEmitter{constructor(...e){super(),this._entries=[];for(const t of e)m(t)?this._parse(t.pathname):t instanceof ar?this._entries.push(...t._entries):this.add(t)}get size(){return this._entries.length}add(e,t,r){this._add(e,t,r),this.emit("change")}clear(){this._entries=[],this.emit("change")}get(e){return this._entries[e]}join(e){const r=t.tokenize(er(e,!0),{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){const t=rr(e);this._add(t)}return this.emit("change"),this}entries(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],e]})}}values(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:t[e]})}}forEach(e){for(const t of this._entries)e.call(this,t.resource,t.key,this)}getResource(e){const t=this._entries[e];return null==t?void 0:t.resource}getKey(e){const t=this._entries[e];return null==t?void 0:t.key}toString(){return this._entries.map((e=>ir(e.resource,e.key,e.typeCast))).join("/")}[Symbol.iterator](){return this.entries()}[or](){return this._entries}_add(e,t,r){e instanceof nr?this._entries.push(e):"object"==typeof e?this._entries.push(new nr(e)):this._entries.push(new nr({resource:e,key:t,typeCast:r}))}_parse(e){if(!e)return;const r=t.tokenize(e,{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){if(!e)continue;const t=rr(e);this._add(t)}this.emit("change")}}class cr{}const lr=["true","t","yes","y","1"],hr=["false","f","no","n","0"];const ur=/^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;function pr(e,t,r){if(""===e||null==e)return"";const i=e.match(ur);if(!i)throw new TypeError(`"${e}" is not a valid date.`);let s=i[1]+"-"+(i[2]||"01")+"-"+(i[3]||"01");return t&&(s+="T"+(i[4]||"00")+":"+(i[5]||"00")+":"+(i[6]||"00")+(i[7]?"."+i[7]:""),r&&(s+=i[8]?"Z":i[9]?i[9]+(i[10]||"00")+":"+(i[11]||"00"):"")),s}class dr extends cr{constructor(e){super(),this.max=e?.max,this.min=e?.min}parse(e){const t="number"==typeof e?e:parseFloat(e);if(isNaN(t))throw new TypeError(`"${e}" is not a valid number`);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return"number"==typeof e?""+e:""}}class _r extends dr{constructor(e){super(e),this.enum=e?.enum}parse(e){const t=super.parse(e);if(!Number.isInteger(t))throw new TypeError(`"${e}" is not a valid integer`);if(this.enum&&!this.enum.includes(t))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return t}}const fr={integer:new _r,number:new dr,string:new class extends cr{constructor(e){super(),this.maxLength=e?.maxLength,this.minLength=e?.minLength,this.enum=e?.enum}parse(e){if(null!=this.minLength&&e.length<this.minLength)throw new TypeError(`Value must be at least ${this.minLength} character${this.minLength>1?"s":""} long.`);if(null!=this.maxLength&&e.length>this.maxLength)throw new TypeError(`Value can be up to ${this.maxLength} character${this.maxLength>1?"s":""} long.`);if(this.enum&&!this.enum.includes(e))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return e}stringify(e){return null==e?"":""+e}},boolean:new class extends cr{parse(e){if(""===e)return!0;if("boolean"==typeof e)return e;if(lr.includes(e.toLowerCase()))return!0;if(hr.includes(e.toLowerCase()))return!1;throw new TypeError(`"${e}" is not a valid boolean`)}stringify(e){return"boolean"==typeof e?e?"true":"false":""}},date:new class extends cr{constructor(e){super(),this.max=e?.max?pr(e.max):void 0,this.min=e?.min?pr(e.min):void 0,this.time=e?.time??!0,this.timeZone=e?.timeZone??!0}parse(e){const t=pr(e,this.time,this.timeZone);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return pr(e,this.time,this.timeZone)}},filter:new class extends cr{parse(e){return e instanceof A?e:function(e,t){const r=new o.CharStream(e),i=new te(r),s=new o.CommonTokenStream(i),n=new re(s);n.buildParseTrees=!0;const a=[],c=new Xe(a);i.removeErrorListeners(),i.addErrorListener(c),n.removeErrorListeners(),n.addErrorListener(c);const l=n.root(),h=(t=t||new Qe).visit(l);if(a.length){const e=[];for(const t of a)e.push(t.message+" at (line: "+t.line+" column: "+t.charPositionInLine+")");const t=new F(e.join("\n"));throw t.errors=a,t}return h}(e)}stringify(e){return e?""+e:""}}},yr=Symbol.for("nodejs.util.inspect.custom");class mr extends d.EventEmitter{constructor(e){super(),this._params=new dt,this._entries=new dt,this._size=0,this.defineParam("$filter",{format:"filter"}),this.defineParam("$limit",{format:new _r({min:0})}),this.defineParam("$skip",{format:new _r({min:0})}),this.defineParam("$pick",{format:"string",array:"strict"}),this.defineParam("$omit",{format:"string",array:"strict"}),this.defineParam("$include",{format:"string",array:"strict"}),this.defineParam("$sort",{format:"string",array:"strict"}),this.defineParam("$distinct",{format:"boolean"}),this.defineParam("$count",{format:"boolean"}),e&&("string"==typeof e?this.parse(e):this.addAll(e))}get size(){return this._size}addAll(e){let t=!1;if("function"==typeof e.forEach)e.forEach(((e,r)=>{t=this._add(r,e)||t}));else if("object"!=typeof e)throw new TypeError("Invalid argument");t&&this.emit("change")}append(e,t){this._add(e,t)&&this.emit("change")}clear(){this._entries.clear(),this._size=0,this.emit("change")}defineParam(e,t){if(!e)throw new Error("Parameter name required");const r={...t,name:e,format:t?.format||"string"};if("string"==typeof r.format&&!fr[r.format])throw new Error(`Unknown data format "${r.format}"`);return r.format=r.format||"string",this._params.set(e,r),this}delete(e){this._delete(e)&&this.emit("change")}entries(){const e=[];return this.forEach(((t,r)=>{e.push([r,t])})),e.values()}forEach(e){for(const[t,r]of this._entries.entries())for(let i=0;i<r.length;i++)e(r[i],t,this)}get(e,t){const r=this._entries.get(e),i=r&&r[t||0];return null==i?null:i}getAll(e){const t=this._entries.get(e);return t?t.slice(0):[]}has(e){return this._entries.has(e)}keys(){return this._entries.keys()}set(e,t){this._delete(e),this._add(e,t),this.emit("change")}sort(e){this._entries.sort(e),this.emit("change")}values(){const e=[];return this.forEach((t=>e.push(t))),e.values()}toString(){let e="";return this.forEach(((t,r)=>{const i=this._params.get(r),s=i?"string"==typeof i.format?fr[i.format]:i.format:void 0,n=e=>encodeURIComponent(s?s.stringify(e,r):null==e?"":""+e),o=Array.isArray(t)?t.map(n).join(i?.arrayDelimiter||","):n(t);o&&(e.length>0&&(e+="&"),e+=r+"="+o)})),e}parse(e){if(this._entries.clear(),this._size=0,e&&e.startsWith("?")&&(e=e.substring(1)),!e)return;const r=t.tokenize(e,{delimiters:"&",quotes:!0,brackets:!0});for(const e of r){if(!e)continue;const r=t.tokenize(e,{delimiters:"=",quotes:!0,brackets:!0}),i=decodeURIComponent(r.next()||""),s=r.join("="),n=this._params.get(i);if(n?.array){const e=t.splitString(s,{delimiters:n?.arrayDelimiter||",",brackets:!0,quotes:!0}).map((e=>decodeURIComponent(e)));this._add(i,e)}else this._add(i,decodeURIComponent(s))}this.emit("change")}toURLSearchParams(){const e=new URLSearchParams;return this.forEach(((t,r)=>{const i=this._params.get(r),s=i?"string"==typeof i.format?fr[i.format]:i.format:void 0,n=e=>s?s.stringify(e,r):null==e?"":""+e,o=Array.isArray(t)?t.map(n).join(i?.arrayDelimiter||","):n(t);e.append(r,o)})),e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"URLSearchParams"}[yr](){return this._entries}_delete(e){const t=this._entries.get(e);return!!t&&(this._size-=t.length,this._entries.delete(e),!0)}_add(e,t){const r=this._params.get(e),i=r?"string"==typeof r.format?fr[r.format]:r.format:void 0,s=t=>i?i.parse(t,e):t;let n=Array.isArray(t)?t.map(s):s(t);if(r&&("strict"===r.array?n=Array.isArray(n)?n:[n]:r.array&&(n=Array.isArray(n)&&1===n.length?n[0]:n),Array.isArray(n))){if(r.minArrayItems&&n.length<r.minArrayItems)throw new Error(`"${e}" parameter requires at least ${r.minArrayItems} values`);if(r.maxArrayItems&&n.length>r.maxArrayItems)throw new Error(`"${e}" parameter accepts up to ${r.maxArrayItems} values`)}let o=this._entries.get(e);return o||(o=[],this._entries.set(e,o)),o.push(n),this._size++,!0}}e.Buffer.from("\r\n");class Tr extends Error{constructor(e,t){super(e.message),this.cause=t,this.issues=e.issues||[],this.status=e.status,t&&(this.cause=t,t.stack&&(this.stack=t.stack))}}const xr=/^application\/([\w-]+\+)?\bjson\b/i,Er=/^text\/.*$/i,gr=/^multipart\/\bform-data\b/i;class Rr extends _.Observable{constructor(e,t={}){super((e=>{"response"!==t.observe?this.resolve().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t))):this.fetch().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t)))})),this._handler=e,this.options=t,this.contentId=c.uid(6),this.options=t}header(e,t){return this._headers=this._headers||{},this._headers[e]=t,this}async fetch(){const e=this._promise||(this._promise=new Promise(((e,t)=>{setTimeout((()=>{this._execute().then(e).catch(t)}),0)})));return await e}async resolve(){return(await this.fetch()).data}with(e){return e(this),this}binding(){return{}}async _execute(){const e=this.prepare();return await this._handler(e)}}function wr(e,...t){let r;const i=[e,...t];let s;for(let e=i.length-1;e>=0;e--){const t=i[e];t?.headers&&(s=s||{},Object.assign(s,et(t.headers)))}for(const t of i)t&&(Object.assign(e,t),t?.params&&(r=r||new mr,t.params.forEach(((e,t)=>r?.append(t,e)))));return e.headers=s,e.params=r,e}class Cr extends Rr{constructor(e,t,r,i={}){super(e,i),this._handler=e,this.resource=t,this.data=r,this.options=i}prepare(){const e=new mr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),wr({method:"POST",path:this.resource.name,params:e,body:this.data},this.options.http)}}class Or extends Rr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new mr;return this.options.filter&&e.set("$filter",this.options.filter),wr({method:"DELETE",path:this.resource.name,params:e},this.options.http)}}class Ir extends Rr{constructor(e,t,r,i={}){super(e,i),this._handler=e,this.resource=t,this.keyValue=r,this.options=i}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "delete" request');return wr({method:"DELETE",path:new ar({resource:this.resource.name,key:this.keyValue}).toString()},this.options.http)}}class Ar extends Rr{constructor(e,t,r,i={}){super(e,i),this._handler=e,this.resource=t,this.keyValue=r,this.options=i}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new ar({resource:this.resource.name,key:this.keyValue}),t=new mr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),wr({method:"GET",path:e.toString(),params:t},this.options.http)}}class vr extends Rr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new mr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),this.options.sort&&e.set("$sort",this.options.sort),this.options.filter&&e.set("$filter",this.options.filter),null!=this.options.limit&&e.set("$limit",this.options.limit),null!=this.options.skip&&e.set("$skip",this.options.skip),null!=this.options.count&&e.set("$count",this.options.count),null!=this.options.distinct&&e.set("$distinct",this.options.distinct),wr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class br extends Rr{constructor(e,t,r,i={}){super(e,i),this._handler=e,this.resource=t,this.data=r,this.options=i}prepare(){const e=new mr;return this.options.filter&&e.set("$filter",this.options.filter),wr({method:"PATCH",path:this.resource.name,params:e,body:this.data},this.options.http)}}class Nr extends Rr{constructor(e,t,r,i,s={}){super(e,s),this._handler=e,this.resource=t,this.keyValue=r,this.data=i,this.options=s}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new ar({resource:this.resource.name,key:this.keyValue}),t=new mr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),wr({method:"PATCH",path:e.toString(),params:t,body:this.data},this.options.http)}}class Lr{constructor(e,t){this.resource=e,this._handler=t}create(e,t){return new Cr(this._handler,this.resource,e,t)}delete(e,t){return new Ir(this._handler,this.resource,e,t)}deleteMany(e){return new Or(this._handler,this.resource,e)}get(e,t){return new Ar(this._handler,this.resource,e,t)}search(e){return new vr(this._handler,this.resource,e)}update(e,t,r){return new Nr(this._handler,this.resource,e,t,r)}updateMany(e,t){return new br(this._handler,this.resource,e,t)}}class Sr extends Rr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new URLSearchParams;return this.options.include&&e.set("$include",""+this.options.include),this.options.pick&&e.set("$pick",""+this.options.pick),this.options.omit&&e.set("$omit",""+this.options.omit),wr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class kr{constructor(e,t){this.resource=e,this._handler=t}get(e){return new Sr(this._handler,this.resource,e)}}class Dr extends Rr{constructor(e,t,r={}){super(e,r),this._handler=e,this.requests=t,this.options=r,this._results=new WeakMap,this._listeners=new Set,t.forEach((e=>{Object.defineProperty(e,"_execute",{writable:!0,enumerable:!1,configurable:!0,value:()=>new Promise(((t,r)=>{const i=this._results.get(e);if(i)return i.error?r(i.error):t(i.response);const s=(e,i)=>{if(this._listeners.delete(s),e)return r(e);t(i)};this._listeners.add(s)}))})}))}prepare(){const e=this._buildBatchMultipart(this);return wr({method:"POST",path:"/$batch",headers:{"content-type":"multipart/mixed;boundary="+e.boundary},body:e.stream()},this.options.http)}_buildBatchMultipart(e){const t=new nt;for(const r of e.requests){const e=r.prepare();if(r instanceof Dr){const e=this._buildBatchMultipart(r);t.addBatch(e)}else t.addRequestPart({method:e.method,url:e.path,headers:e.headers,data:e.body})}return t}async _execute(){const e=this.prepare();return await this._handler(e)}}const Pr=new Map,Ur=new Map;exports.BatchRequest=Dr,exports.ClientError=Tr,exports.CollectionCreateRequest=Cr,exports.CollectionDeleteManyRequest=Or,exports.CollectionDeleteRequest=Ir,exports.CollectionGetRequest=Ar,exports.CollectionSearchRequest=vr,exports.CollectionUpdateManyRequest=br,exports.CollectionUpdateRequest=Nr,exports.HttpCollectionService=Lr,exports.HttpRequest=Rr,exports.HttpSingletonGetRequest=Sr,exports.HttpSingletonService=kr,exports.OpraHttpClient=class{constructor(e,t){if(this._serviceUrl=e,this._metadata=t?.document,!this._metadata){const e=Pr.get(this.serviceUrl.toLowerCase());e&&(this._metadata=e)}this.defaults=t?.defaults||{}}get serviceUrl(){return this._serviceUrl}get initialized(){return!!this._metadata}get metadata(){return this._assertMetadata(),this._metadata}async init(e){if(!e&&this.initialized)return;const t=this.serviceUrl.toLowerCase();let r=Ur.get(t);if(!r)return r=this._resolveMetadata(),Ur.set(t,r),r.catch((()=>{})).finally((()=>Ur.delete(t)));await r}batch(e){return this._assertMetadata(),new Dr((e=>this._handleRequest(e)),e)}collection(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getCollectionResource(e);return new Lr(t,(e=>this._handleRequest(e)))}singleton(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getSingletonResource(e);return new kr(t,(e=>this._handleRequest(e)))}async _resolveMetadata(){const e=await this._handleRequest({method:"GET",path:"/$metadata",headers:{accept:"application/json"}});this._metadata=new Jt(e.data)}async _handleRequest(t){wr(t,this.defaults);let r=function(...e){const t=[];let r;for(let i=0,s=e.length;i<s;i++)r=er(e[i],i>0),r&&t.push(r);return t.join("/")}(this.serviceUrl,t.path);var i;return t.params&&(r+="?"+t.params.toString()),t.body&&"object"==typeof t.body&&(y(t.body)||f(i=t.body)&&!1!==i.readable&&"function"==typeof i.getReader&&"function"==typeof i.pipeThrough&&"function"==typeof i.pipeTo||e.Buffer.isBuffer(t.body)||(t.headers?.["content-type"]||(t.headers=t.headers||{},t.headers["content-type"]="application/json"),t.body=JSON.stringify(t.body))),this._fetch(r,t)}async _fetch(e,t){const r=await fetch(e,t);let i;if(r.body&&(xr.test(r.headers.get("Content-Type")||"")?(i=await r.json(),"string"==typeof i&&(i=JSON.parse(i))):i=Er.test(r.headers.get("Content-Type")||"")?await r.text():gr.test(r.headers.get("Content-Type")||"")?await r.formData():await r.arrayBuffer()),r.status>=400&&r.status<600)throw new Tr({message:r.status+" "+r.statusText,status:r.status,issues:i?.errors});return{get headers(){return r.headers},get ok(){return r.ok},get redirected(){return r.redirected},get status(){return r.status},get statusText(){return r.statusText},get type(){return r.type},get url(){return r.url},get contentId(){return r.headers.get("Content-ID")},get data(){return i}}}_assertMetadata(){if(!this._metadata)throw new Error("You must call init() to before using the client instance")}static async create(e,t){const r=new this(e,t);return r._metadata||await r.init(),r}};
|
package/esm/index.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{tokenize as e,splitString as t}from"fast-tokenizer";import r from"@browsery/fs";import s from"@browsery/i18next";import i from"path-browserify";import{toDateDef as n,toBoolean as o,toDate as a,toString as c,toInt as h,toNumber as l}from"putil-varhelpers";import u,{Token as p,DFA as d,Lexer as _,LexerATNSimulator as f,PredictionContextCache as m,ATNDeserializer as y,Parser as T,ParserATNSimulator as E,FailedPredicateException as x,RecognitionException as g,NoViableAltException as R,ATN as w,ParserRuleContext as O,ErrorListener as I,CharStream as A,CommonTokenStream as C}from"@browsery/antlr4";import v from"@browsery/highland";import{uid as b}from"uid";import"reflect-metadata";import L from"lodash.omit";import N from"putil-promisify";import S from"putil-isplainobject";import k from"putil-merge";import{EventEmitter as D}from"events";import"@browsery/http-parser";import"@browsery/stream";import{Observable as P}from"rxjs";function U(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe}function M(e){return U(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState}function F(e){return null!==e&&"string"==typeof e.host&&"string"==typeof e.href}const H=/^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/i;const $=/\\(.)/g;function j(e){return e.replace($,"$1")}const B=Object.getPrototypeOf(s).constructor,G=[];class z extends B{async init(e,t){const r="object"==typeof e?e:{},s="function"==typeof e?e:t;try{const e=await super.init(r,s),t=this.services.formatter;if(t.add("lowercase",((e,t)=>e.toLocaleLowerCase(t))),t.add("uppercase",((e,t)=>e.toLocaleUpperCase(t))),t.add("upperFirst",((e,t)=>e.charAt(0).toLocaleUpperCase(t)+e.substring(1))),G.length&&await this.loadResourceDir(G,!1,!0),r?.resourceDirs?.length&&await this.loadResourceDir(r.resourceDirs,!1,!0),r?.resources)for(const e of Object.keys(r.resources)){const t=r.resources[e];for(const r of Object.keys(t))this.addResourceBundle(e,r,t[r],!1,!0)}return s&&s(null,e),e}catch(e){throw s&&s(e,this.t),e}}deep(e,t){if(null==e)return e;const r=new WeakMap;return this._deepTranslate(e,r,t)}registerLocaleDir(...e){G.push(...e)}async loadResourceBundle(e,t,s,i,n){let o;if(a=s,H.test(a))o=(await fetch(s,{headers:{accept:"application/json"}})).json();else{const e=r.readFileSync(s,"utf8");o=JSON.parse(e)}var a;this.addResourceBundle(e,t,o,i,n)}async loadResourceDir(e,t,s){for(const n of Array.isArray(e)?e:[e]){if(!r.statSync(n).isDirectory())continue;const e=r.readdirSync(n);for(const o of e){const e=i.join(n,o);if(r.statSync(e).isDirectory()){const n=r.readdirSync(e);for(const a of n){const n=i.join(e,a),c=i.extname(a);if(".json"===c&&r.statSync(n).isFile()){const e=i.basename(a,c);await this.loadResourceBundle(o,e,n,t,s)}}}}}}createInstance(e={},t){return new z(e,t)}static createInstance(e,t){return new z(e,t)}_deepTranslate(r,s,i){if(null==r)return r;if(i?.ignore&&i.ignore(r,this))return r;if("object"==typeof r&&s.has(r))return s.get(r);if("string"==typeof r){let s="";for(let n of e(r,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0}))if(n.startsWith("$t(")&&n.endsWith(")")){n=n.substring(3,n.length-1);const r=t(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),o=j(n.substring((r[0]||"").length+1));n=r[0]||"";const a=[];let c=null;for(const t of e(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}}))t.startsWith("{")?c=JSON.parse(t):a.push(t);const h=a.length>1?"$t("+a.join(",")+")":a[0];s+=o?this.t(h,o,{...i,...c}):this.t(h,{...i,...c})}else s+=n;return s}if(Array.isArray(r)){const e=Array(r.length);s.set(r,e);for(let t=0,n=r.length;t<n;t++)e[t]=this._deepTranslate(r[t],s,i);return s.delete(r),e}if("object"==typeof r){if(Buffer.isBuffer(r))return r;if(Buffer.isBuffer(r)||r instanceof Symbol||r instanceof RegExp||r instanceof Map||r instanceof Set||r instanceof WeakMap||r instanceof WeakSet)return r;const e={};s.set(r,e);const t=Object.keys(r);for(let n=0,o=t.length;n<o;n++){const o=t[n];e[o]=this._deepTranslate(r[o],s,i)}return s.delete(r),e}return r}static get defaultInstance(){return q}}const q=z.createInstance();var V;z.createInstance().init().catch((()=>{})),function(e){var t;(t=e.Enum||(e.Enum={})).fatal="fatal",t.error="error",t.warning="warning",t.info="info",e.name="IssueSeverity",e.description="Severity of the issue",e.Keys=Object.keys(e),e.descriptions={fatal:"The issue caused the action to fail and no further checking could be performed",error:"The issue is sufficiently important to cause the action to fail",warning:"The issue is not important enough to cause the action to fail but may cause it to be performed suboptimally or in a way that is not as desired",info:"The issue has no relation to the degree of success of the action"}}(V||(V={}));class W{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}}class Q extends W{}class X extends Q{}class K extends X{constructor(e){super(),this.value=e}toString(){return""+this.value}}class Y extends Q{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new Z({op:e,expression:t})),this}toString(){return this.items.map(((e,t)=>(t>0?e.op:"")+e.expression)).join("")}}class Z{constructor(e){Object.assign(this,e)}}class J extends X{constructor(e){super(),this.items=e}toString(){return"["+this.items.map((e=>""+e)).join(",")+"]"}}const ee=/\w/;class te extends Q{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${ee.test(this.op)?" "+this.op+" ":this.op}${this.right}`}}class re extends Q{constructor(e){super(),Object.assign(this,e)}toString(){return this.items.map((e=>""+e)).join(" "+this.op+" ")}}class se extends Q{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}}class ie extends K{constructor(e){super(e)}}class ne extends TypeError{}class oe extends TypeError{}class ae extends Error{constructor(e,t){super(e),Object.assign(this,t)}}const ce=/'/g,he=/(\\)/g,le=/\\(.)/g;function ue(e){return"'"+function(e){return e.replace(he,"\\\\")}(e).replace(ce,"\\'")+"'"}function pe(e){return e&&(e.startsWith("'")||e.startsWith('"'))&&e.endsWith(e.charAt(0))?function(e){return e.replace(le,"$1")}(e.substring(1,e.length-1)):e}const de=new Date(0);class _e extends K{constructor(e){if(super(""),e instanceof Date)this.value=e.toISOString();else{if("string"!=typeof e||n(e,de)===de)throw new oe(`Invalid date value "${e}"`);this.value=e}}toString(){return ue(this.value)}}class fe extends K{constructor(){super(null),this.value=null}}class me extends K{constructor(e){if(super(0),"number"!=typeof e&&"bigint"!=typeof e){try{if("string"==typeof e){if(e.includes("."))return void(this.value=parseFloat(e));const t=Number(e);return void(this.value=""+t===e?t:BigInt(e))}}catch{}throw new oe(`Invalid number literal ${e}`)}this.value=e}toString(){return"bigint"==typeof this.value?(""+this.value).replace(/n$/,""):""+this.value}}class ye extends K{constructor(e){super(""+e)}}class Te extends K{constructor(e){super(""+e)}toString(){return ue(this.value)}}const Ee=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;class xe extends K{constructor(e){if(super(""),e instanceof Date)this.value=ge(e.getHours())+":"+ge(e.getMinutes())+(e.getSeconds()?":"+ge(e.getSeconds()):"")+(e.getMilliseconds()?"."+ge(e.getMilliseconds()):"");else{if("string"!=typeof e||!Ee.test(e))throw new oe(`Invalid time value "${e}"`);this.value=e}}toString(){return ue(this.value)}}function ge(e){return e<=9?"0"+e:""+e}class Re extends _{constructor(e){super(e),this._interp=new f(this,Re._ATN,Re.DecisionsToDFA,new m)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return Re.literalNames}get symbolicNames(){return Re.symbolicNames}get ruleNames(){return Re.ruleNames}get serializedATN(){return Re._serializedATN}get channelNames(){return Re.channelNames}get modeNames(){return Re.modeNames}static get _ATN(){return Re.__ATN||(Re.__ATN=(new y).deserialize(Re._serializedATN)),Re.__ATN}}Re.T__0=1,Re.T__1=2,Re.T__2=3,Re.T__3=4,Re.T__4=5,Re.T__5=6,Re.T__6=7,Re.T__7=8,Re.T__8=9,Re.T__9=10,Re.T__10=11,Re.T__11=12,Re.T__12=13,Re.T__13=14,Re.T__14=15,Re.T__15=16,Re.T__16=17,Re.T__17=18,Re.T__18=19,Re.T__19=20,Re.T__20=21,Re.T__21=22,Re.T__22=23,Re.T__23=24,Re.T__24=25,Re.T__25=26,Re.T__26=27,Re.T__27=28,Re.T__28=29,Re.T__29=30,Re.T__30=31,Re.T__31=32,Re.T__32=33,Re.T__33=34,Re.T__34=35,Re.T__35=36,Re.T__36=37,Re.T__37=38,Re.T__38=39,Re.T__39=40,Re.T__40=41,Re.T__41=42,Re.T__42=43,Re.T__43=44,Re.T__44=45,Re.T__45=46,Re.DATE=47,Re.DATETIME=48,Re.TIME=49,Re.IDENTIFIER=50,Re.STRING=51,Re.NUMBER=52,Re.INTEGER=53,Re.WHITESPACE=54,Re.COMMENT=55,Re.LINE_COMMENT=56,Re.EOF=p.EOF,Re.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],Re.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],Re.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],Re.modeNames=["DEFAULT_MODE"],Re.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","T__34","T__35","T__36","T__37","T__38","T__39","T__40","T__41","T__42","T__43","T__44","T__45","DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT","NUMBERFORMAT","INTEGERFORMAT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"],Re._serializedATN=[4,0,56,536,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,36,1,36,1,37,1,37,1,38,1,38,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,3,46,357,8,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,3,47,373,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,3,48,383,8,48,1,49,1,49,5,49,387,8,49,10,49,12,49,390,9,49,1,50,1,50,1,50,5,50,395,8,50,10,50,12,50,398,9,50,1,50,1,50,1,50,1,50,5,50,404,8,50,10,50,12,50,407,9,50,1,50,3,50,410,8,50,1,51,1,51,1,52,1,52,1,53,4,53,417,8,53,11,53,12,53,418,1,53,1,53,1,54,1,54,1,54,1,54,5,54,427,8,54,10,54,12,54,430,9,54,1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,5,55,441,8,55,10,55,12,55,444,9,55,1,55,1,55,1,56,4,56,449,8,56,11,56,12,56,450,1,56,1,56,4,56,455,8,56,11,56,12,56,456,3,56,459,8,56,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,472,8,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,481,8,58,1,59,1,59,1,59,1,59,3,59,487,8,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,4,59,499,8,59,11,59,12,59,500,3,59,503,8,59,3,59,505,8,59,1,60,1,60,1,60,3,60,510,8,60,1,60,1,60,1,60,3,60,515,8,60,1,60,1,60,1,60,3,60,520,8,60,3,60,522,8,60,1,61,1,61,1,61,3,61,527,8,61,1,62,1,62,1,62,1,62,1,62,1,62,1,63,1,63,1,428,0,64,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50,101,51,103,52,105,53,107,54,109,55,111,56,113,0,115,0,117,0,119,0,121,0,123,0,125,0,127,0,1,0,17,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,2,0,10,10,13,13,1,0,48,57,1,0,48,48,1,0,49,57,1,0,49,49,1,0,48,50,1,0,49,51,1,0,48,49,1,0,48,51,1,0,48,53,2,0,43,43,45,45,3,0,48,57,65,70,97,102,554,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,1,129,1,0,0,0,3,131,1,0,0,0,5,133,1,0,0,0,7,135,1,0,0,0,9,137,1,0,0,0,11,139,1,0,0,0,13,144,1,0,0,0,15,150,1,0,0,0,17,155,1,0,0,0,19,159,1,0,0,0,21,164,1,0,0,0,23,171,1,0,0,0,25,178,1,0,0,0,27,190,1,0,0,0,29,196,1,0,0,0,31,203,1,0,0,0,33,209,1,0,0,0,35,214,1,0,0,0,37,220,1,0,0,0,39,228,1,0,0,0,41,236,1,0,0,0,43,249,1,0,0,0,45,251,1,0,0,0,47,253,1,0,0,0,49,256,1,0,0,0,51,258,1,0,0,0,53,260,1,0,0,0,55,263,1,0,0,0,57,265,1,0,0,0,59,268,1,0,0,0,61,271,1,0,0,0,63,275,1,0,0,0,65,280,1,0,0,0,67,286,1,0,0,0,69,292,1,0,0,0,71,299,1,0,0,0,73,301,1,0,0,0,75,303,1,0,0,0,77,305,1,0,0,0,79,307,1,0,0,0,81,311,1,0,0,0,83,314,1,0,0,0,85,319,1,0,0,0,87,325,1,0,0,0,89,330,1,0,0,0,91,339,1,0,0,0,93,356,1,0,0,0,95,372,1,0,0,0,97,382,1,0,0,0,99,384,1,0,0,0,101,409,1,0,0,0,103,411,1,0,0,0,105,413,1,0,0,0,107,416,1,0,0,0,109,422,1,0,0,0,111,436,1,0,0,0,113,448,1,0,0,0,115,460,1,0,0,0,117,462,1,0,0,0,119,486,1,0,0,0,121,521,1,0,0,0,123,523,1,0,0,0,125,528,1,0,0,0,127,534,1,0,0,0,129,130,5,40,0,0,130,2,1,0,0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,91,0,0,134,6,1,0,0,0,135,136,5,44,0,0,136,8,1,0,0,0,137,138,5,93,0,0,138,10,1,0,0,0,139,140,5,121,0,0,140,141,5,101,0,0,141,142,5,97,0,0,142,143,5,114,0,0,143,12,1,0,0,0,144,145,5,109,0,0,145,146,5,111,0,0,146,147,5,110,0,0,147,148,5,116,0,0,148,149,5,104,0,0,149,14,1,0,0,0,150,151,5,119,0,0,151,152,5,101,0,0,152,153,5,101,0,0,153,154,5,107,0,0,154,16,1,0,0,0,155,156,5,100,0,0,156,157,5,97,0,0,157,158,5,121,0,0,158,18,1,0,0,0,159,160,5,104,0,0,160,161,5,111,0,0,161,162,5,117,0,0,162,163,5,114,0,0,163,20,1,0,0,0,164,165,5,109,0,0,165,166,5,105,0,0,166,167,5,110,0,0,167,168,5,117,0,0,168,169,5,116,0,0,169,170,5,101,0,0,170,22,1,0,0,0,171,172,5,115,0,0,172,173,5,101,0,0,173,174,5,99,0,0,174,175,5,111,0,0,175,176,5,110,0,0,176,177,5,100,0,0,177,24,1,0,0,0,178,179,5,109,0,0,179,180,5,105,0,0,180,181,5,108,0,0,181,182,5,108,0,0,182,183,5,105,0,0,183,184,5,115,0,0,184,185,5,101,0,0,185,186,5,99,0,0,186,187,5,111,0,0,187,188,5,110,0,0,188,189,5,100,0,0,189,26,1,0,0,0,190,191,5,121,0,0,191,192,5,101,0,0,192,193,5,97,0,0,193,194,5,114,0,0,194,195,5,115,0,0,195,28,1,0,0,0,196,197,5,109,0,0,197,198,5,111,0,0,198,199,5,110,0,0,199,200,5,116,0,0,200,201,5,104,0,0,201,202,5,115,0,0,202,30,1,0,0,0,203,204,5,119,0,0,204,205,5,101,0,0,205,206,5,101,0,0,206,207,5,107,0,0,207,208,5,115,0,0,208,32,1,0,0,0,209,210,5,100,0,0,210,211,5,97,0,0,211,212,5,121,0,0,212,213,5,115,0,0,213,34,1,0,0,0,214,215,5,104,0,0,215,216,5,111,0,0,216,217,5,117,0,0,217,218,5,114,0,0,218,219,5,115,0,0,219,36,1,0,0,0,220,221,5,109,0,0,221,222,5,105,0,0,222,223,5,110,0,0,223,224,5,117,0,0,224,225,5,116,0,0,225,226,5,101,0,0,226,227,5,115,0,0,227,38,1,0,0,0,228,229,5,115,0,0,229,230,5,101,0,0,230,231,5,99,0,0,231,232,5,111,0,0,232,233,5,110,0,0,233,234,5,100,0,0,234,235,5,115,0,0,235,40,1,0,0,0,236,237,5,109,0,0,237,238,5,105,0,0,238,239,5,108,0,0,239,240,5,108,0,0,240,241,5,105,0,0,241,242,5,115,0,0,242,243,5,101,0,0,243,244,5,99,0,0,244,245,5,111,0,0,245,246,5,110,0,0,246,247,5,100,0,0,247,248,5,115,0,0,248,42,1,0,0,0,249,250,5,46,0,0,250,44,1,0,0,0,251,252,5,64,0,0,252,46,1,0,0,0,253,254,5,60,0,0,254,255,5,61,0,0,255,48,1,0,0,0,256,257,5,60,0,0,257,50,1,0,0,0,258,259,5,62,0,0,259,52,1,0,0,0,260,261,5,62,0,0,261,262,5,61,0,0,262,54,1,0,0,0,263,264,5,61,0,0,264,56,1,0,0,0,265,266,5,33,0,0,266,267,5,61,0,0,267,58,1,0,0,0,268,269,5,105,0,0,269,270,5,110,0,0,270,60,1,0,0,0,271,272,5,33,0,0,272,273,5,105,0,0,273,274,5,110,0,0,274,62,1,0,0,0,275,276,5,108,0,0,276,277,5,105,0,0,277,278,5,107,0,0,278,279,5,101,0,0,279,64,1,0,0,0,280,281,5,33,0,0,281,282,5,108,0,0,282,283,5,105,0,0,283,284,5,107,0,0,284,285,5,101,0,0,285,66,1,0,0,0,286,287,5,105,0,0,287,288,5,108,0,0,288,289,5,105,0,0,289,290,5,107,0,0,290,291,5,101,0,0,291,68,1,0,0,0,292,293,5,33,0,0,293,294,5,105,0,0,294,295,5,108,0,0,295,296,5,105,0,0,296,297,5,107,0,0,297,298,5,101,0,0,298,70,1,0,0,0,299,300,5,43,0,0,300,72,1,0,0,0,301,302,5,45,0,0,302,74,1,0,0,0,303,304,5,42,0,0,304,76,1,0,0,0,305,306,5,47,0,0,306,78,1,0,0,0,307,308,5,97,0,0,308,309,5,110,0,0,309,310,5,100,0,0,310,80,1,0,0,0,311,312,5,111,0,0,312,313,5,114,0,0,313,82,1,0,0,0,314,315,5,116,0,0,315,316,5,114,0,0,316,317,5,117,0,0,317,318,5,101,0,0,318,84,1,0,0,0,319,320,5,102,0,0,320,321,5,97,0,0,321,322,5,108,0,0,322,323,5,115,0,0,323,324,5,101,0,0,324,86,1,0,0,0,325,326,5,110,0,0,326,327,5,117,0,0,327,328,5,108,0,0,328,329,5,108,0,0,329,88,1,0,0,0,330,331,5,73,0,0,331,332,5,110,0,0,332,333,5,102,0,0,333,334,5,105,0,0,334,335,5,110,0,0,335,336,5,105,0,0,336,337,5,116,0,0,337,338,5,121,0,0,338,90,1,0,0,0,339,340,5,105,0,0,340,341,5,110,0,0,341,342,5,102,0,0,342,343,5,105,0,0,343,344,5,110,0,0,344,345,5,105,0,0,345,346,5,116,0,0,346,347,5,121,0,0,347,92,1,0,0,0,348,349,5,39,0,0,349,350,3,117,58,0,350,351,5,39,0,0,351,357,1,0,0,0,352,353,5,34,0,0,353,354,3,117,58,0,354,355,5,34,0,0,355,357,1,0,0,0,356,348,1,0,0,0,356,352,1,0,0,0,357,94,1,0,0,0,358,359,5,39,0,0,359,360,3,117,58,0,360,361,5,84,0,0,361,362,3,119,59,0,362,363,3,121,60,0,363,364,5,39,0,0,364,373,1,0,0,0,365,366,5,34,0,0,366,367,3,117,58,0,367,368,5,84,0,0,368,369,3,119,59,0,369,370,3,121,60,0,370,371,5,34,0,0,371,373,1,0,0,0,372,358,1,0,0,0,372,365,1,0,0,0,373,96,1,0,0,0,374,375,5,39,0,0,375,376,3,119,59,0,376,377,5,39,0,0,377,383,1,0,0,0,378,379,5,34,0,0,379,380,3,119,59,0,380,381,5,34,0,0,381,383,1,0,0,0,382,374,1,0,0,0,382,378,1,0,0,0,383,98,1,0,0,0,384,388,7,0,0,0,385,387,7,1,0,0,386,385,1,0,0,0,387,390,1,0,0,0,388,386,1,0,0,0,388,389,1,0,0,0,389,100,1,0,0,0,390,388,1,0,0,0,391,396,5,39,0,0,392,395,3,123,61,0,393,395,8,2,0,0,394,392,1,0,0,0,394,393,1,0,0,0,395,398,1,0,0,0,396,394,1,0,0,0,396,397,1,0,0,0,397,399,1,0,0,0,398,396,1,0,0,0,399,410,5,39,0,0,400,405,5,34,0,0,401,404,3,123,61,0,402,404,8,3,0,0,403,401,1,0,0,0,403,402,1,0,0,0,404,407,1,0,0,0,405,403,1,0,0,0,405,406,1,0,0,0,406,408,1,0,0,0,407,405,1,0,0,0,408,410,5,34,0,0,409,391,1,0,0,0,409,400,1,0,0,0,410,102,1,0,0,0,411,412,3,113,56,0,412,104,1,0,0,0,413,414,3,115,57,0,414,106,1,0,0,0,415,417,7,4,0,0,416,415,1,0,0,0,417,418,1,0,0,0,418,416,1,0,0,0,418,419,1,0,0,0,419,420,1,0,0,0,420,421,6,53,0,0,421,108,1,0,0,0,422,423,5,47,0,0,423,424,5,42,0,0,424,428,1,0,0,0,425,427,9,0,0,0,426,425,1,0,0,0,427,430,1,0,0,0,428,429,1,0,0,0,428,426,1,0,0,0,429,431,1,0,0,0,430,428,1,0,0,0,431,432,5,42,0,0,432,433,5,47,0,0,433,434,1,0,0,0,434,435,6,54,0,0,435,110,1,0,0,0,436,437,5,47,0,0,437,438,5,47,0,0,438,442,1,0,0,0,439,441,8,5,0,0,440,439,1,0,0,0,441,444,1,0,0,0,442,440,1,0,0,0,442,443,1,0,0,0,443,445,1,0,0,0,444,442,1,0,0,0,445,446,6,55,0,0,446,112,1,0,0,0,447,449,7,6,0,0,448,447,1,0,0,0,449,450,1,0,0,0,450,448,1,0,0,0,450,451,1,0,0,0,451,458,1,0,0,0,452,454,5,46,0,0,453,455,7,6,0,0,454,453,1,0,0,0,455,456,1,0,0,0,456,454,1,0,0,0,456,457,1,0,0,0,457,459,1,0,0,0,458,452,1,0,0,0,458,459,1,0,0,0,459,114,1,0,0,0,460,461,7,6,0,0,461,116,1,0,0,0,462,463,7,6,0,0,463,464,7,6,0,0,464,465,7,6,0,0,465,466,7,6,0,0,466,471,5,45,0,0,467,468,7,7,0,0,468,472,7,8,0,0,469,470,7,9,0,0,470,472,7,10,0,0,471,467,1,0,0,0,471,469,1,0,0,0,472,473,1,0,0,0,473,480,5,45,0,0,474,475,7,11,0,0,475,481,7,7,0,0,476,477,7,10,0,0,477,481,7,8,0,0,478,479,5,51,0,0,479,481,5,49,0,0,480,474,1,0,0,0,480,476,1,0,0,0,480,478,1,0,0,0,481,118,1,0,0,0,482,483,7,12,0,0,483,487,7,6,0,0,484,485,5,50,0,0,485,487,7,13,0,0,486,482,1,0,0,0,486,484,1,0,0,0,487,488,1,0,0,0,488,489,5,58,0,0,489,490,7,14,0,0,490,491,7,6,0,0,491,504,1,0,0,0,492,493,5,58,0,0,493,494,7,14,0,0,494,495,7,6,0,0,495,502,1,0,0,0,496,498,5,46,0,0,497,499,7,6,0,0,498,497,1,0,0,0,499,500,1,0,0,0,500,498,1,0,0,0,500,501,1,0,0,0,501,503,1,0,0,0,502,496,1,0,0,0,502,503,1,0,0,0,503,505,1,0,0,0,504,492,1,0,0,0,504,505,1,0,0,0,505,120,1,0,0,0,506,522,5,90,0,0,507,514,7,15,0,0,508,510,7,12,0,0,509,508,1,0,0,0,509,510,1,0,0,0,510,511,1,0,0,0,511,515,7,6,0,0,512,513,5,50,0,0,513,515,7,13,0,0,514,509,1,0,0,0,514,512,1,0,0,0,515,519,1,0,0,0,516,517,5,58,0,0,517,518,7,14,0,0,518,520,7,6,0,0,519,516,1,0,0,0,519,520,1,0,0,0,520,522,1,0,0,0,521,506,1,0,0,0,521,507,1,0,0,0,522,122,1,0,0,0,523,526,5,92,0,0,524,527,3,125,62,0,525,527,9,0,0,0,526,524,1,0,0,0,526,525,1,0,0,0,527,124,1,0,0,0,528,529,5,117,0,0,529,530,3,127,63,0,530,531,3,127,63,0,531,532,3,127,63,0,532,533,3,127,63,0,533,126,1,0,0,0,534,535,7,16,0,0,535,128,1,0,0,0,27,0,356,372,382,388,394,396,403,405,409,418,428,442,450,456,458,471,480,486,500,502,504,509,514,519,521,526,1,0,1,0],Re.DecisionsToDFA=Re._ATN.decisionToState.map(((e,t)=>new d(e,t)));class we extends T{constructor(e){super(e),this._interp=new E(this,we._ATN,we.DecisionsToDFA,new m)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return we.literalNames}get symbolicNames(){return we.symbolicNames}get ruleNames(){return we.ruleNames}get serializedATN(){return we._serializedATN}createFailedPredicateException(e,t){return new x(this,e,t)}root(){let e=new Oe(this,this._ctx,this.state);this.enterRule(e,0,we.RULE_root);try{this.enterOuterAlt(e,1),this.state=44,this.expression(0),this.state=45,this.match(we.EOF)}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}expression(e){void 0===e&&(e=0);let t,r=this._ctx,s=this.state,i=new Ie(this,this._ctx,s),n=i;this.enterRecursionRule(i,2,we.RULE_expression,e);try{let e;switch(this.enterOuterAlt(i,1),this.state=67,this._errHandler.sync(this),this._input.LA(1)){case 23:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:i=new Se(this,i),this._ctx=i,n=i,this.state=48,this.term();break;case 36:case 37:i=new ve(this,i),this._ctx=i,n=i,this.state=49,this.polarOp(),this.state=50,this.expression(6);break;case 1:i=new Ae(this,i),this._ctx=i,n=i,this.state=52,this.match(we.T__0),this.state=53,this.expression(0),this.state=54,this.match(we.T__1);break;case 3:for(i=new Ce(this,i),this._ctx=i,n=i,this.state=56,this.match(we.T__2),this.state=57,this.expression(0),this.state=62,this._errHandler.sync(this),t=this._input.LA(1);4===t;)this.state=58,this.match(we.T__3),this.state=59,this.expression(0),this.state=64,this._errHandler.sync(this),t=this._input.LA(1);this.state=65,this.match(we.T__4);break;default:throw new R(this)}for(this._ctx.stop=this._input.LT(-1),this.state=83,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx);2!==e&&e!==w.INVALID_ALT_NUMBER;){if(1===e)switch(null!=this._parseListeners&&this.triggerExitRuleEvent(),n=i,this.state=81,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,2,this._ctx)){case 1:if(i=new Le(this,new Ie(this,r,s)),this.pushNewRecursionContext(i,2,we.RULE_expression),this.state=69,!this.precpred(this._ctx,5))throw this.createFailedPredicateException("this.precpred(this._ctx, 5)");this.state=70,this.arthOp(),this.state=71,this.expression(6);break;case 2:if(i=new be(this,new Ie(this,r,s)),this.pushNewRecursionContext(i,2,we.RULE_expression),this.state=73,!this.precpred(this._ctx,4))throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");this.state=74,this.compOp(),this.state=75,this.expression(5);break;case 3:if(i=new Ne(this,new Ie(this,r,s)),this.pushNewRecursionContext(i,2,we.RULE_expression),this.state=77,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=78,this.logOp(),this.state=79,this.expression(4)}this.state=85,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx)}}catch(e){if(!(e instanceof g))throw e;i.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.unrollRecursionContexts(r)}return i}term(){let e=new ke(this,this._ctx,this.state);this.enterRule(e,4,we.RULE_term);try{switch(this.state=89,this._errHandler.sync(this),this._input.LA(1)){case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 51:case 52:e=new Pe(this,e),this.enterOuterAlt(e,1),this.state=86,this.literal();break;case 50:e=new Ue(this,e),this.enterOuterAlt(e,2),this.state=87,this.qualifiedIdentifier();break;case 23:e=new De(this,e),this.enterOuterAlt(e,3),this.state=88,this.externalConstant();break;default:throw new R(this)}}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocable(){let e=new Me(this,this._ctx,this.state);this.enterRule(e,6,we.RULE_invocable);try{this.enterOuterAlt(e,1),this.state=91,this.function_()}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocation(){let e=new Fe(this,this._ctx,this.state);this.enterRule(e,8,we.RULE_invocation);try{e=new He(this,e),this.enterOuterAlt(e,1),this.state=93,this.identifier()}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}indexer(){let e=new $e(this,this._ctx,this.state);this.enterRule(e,10,we.RULE_indexer);try{switch(this.state=97,this._errHandler.sync(this),this._input.LA(1)){case 50:e=new Be(this,e),this.enterOuterAlt(e,1),this.state=95,this.identifier();break;case 53:e=new je(this,e),this.enterOuterAlt(e,2),this.state=96,this.match(we.INTEGER);break;default:throw new R(this)}}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}function_(){let e,t=new Ge(this,this._ctx,this.state);this.enterRule(t,12,we.RULE_function);try{this.enterOuterAlt(t,1),this.state=99,this.identifier(),this.state=100,this.match(we.T__0),this.state=102,this._errHandler.sync(this),e=this._input.LA(1),(0==(-32&e)&&0!=(1<<e&8388618)||0==(e-36&-32)&&0!=(1<<e-36&131011))&&(this.state=101,this.paramList()),this.state=104,this.match(we.T__1)}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}paramList(){let e,t=new ze(this,this._ctx,this.state);this.enterRule(t,14,we.RULE_paramList);try{for(this.enterOuterAlt(t,1),this.state=106,this.expression(0),this.state=111,this._errHandler.sync(this),e=this._input.LA(1);4===e;)this.state=107,this.match(we.T__3),this.state=108,this.expression(0),this.state=113,this._errHandler.sync(this),e=this._input.LA(1)}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}unit(){let e=new qe(this,this._ctx,this.state);this.enterRule(e,16,we.RULE_unit);try{switch(this.state=117,this._errHandler.sync(this),this._input.LA(1)){case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:this.enterOuterAlt(e,1),this.state=114,this.dateTimePrecision();break;case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:this.enterOuterAlt(e,2),this.state=115,this.pluralDateTimePrecision();break;case 51:this.enterOuterAlt(e,3),this.state=116,this.match(we.STRING);break;default:throw new R(this)}}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}dateTimePrecision(){let e,t=new Ve(this,this._ctx,this.state);this.enterRule(t,18,we.RULE_dateTimePrecision);try{this.enterOuterAlt(t,1),this.state=119,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&16320)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}pluralDateTimePrecision(){let e,t=new We(this,this._ctx,this.state);this.enterRule(t,20,we.RULE_pluralDateTimePrecision);try{this.enterOuterAlt(t,1),this.state=121,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&4177920)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}qualifiedIdentifier(){let e=new Qe(this,this._ctx,this.state);this.enterRule(e,22,we.RULE_qualifiedIdentifier);try{let t;for(this.enterOuterAlt(e,1),this.state=128,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);2!==t&&t!==w.INVALID_ALT_NUMBER;)1===t&&(this.state=123,this.identifier(),this.state=124,this.match(we.T__21)),this.state=130,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);this.state=131,this.identifier()}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}externalConstant(){let e,t=new Xe(this,this._ctx,this.state);this.enterRule(t,24,we.RULE_externalConstant);try{this.enterOuterAlt(t,1),this.state=133,this.match(we.T__22),this.state=134,e=this._input.LA(1),50!==e&&51!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}identifier(){let e=new Ke(this,this._ctx,this.state);this.enterRule(e,26,we.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=136,this.match(we.IDENTIFIER)}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}literal(){let e=new Ye(this,this._ctx,this.state);this.enterRule(e,28,we.RULE_literal);try{switch(this.state=146,this._errHandler.sync(this),this._input.LA(1)){case 52:e=new nt(this,e),this.enterOuterAlt(e,1),this.state=138,this.match(we.NUMBER);break;case 45:case 46:e=new st(this,e),this.enterOuterAlt(e,2),this.state=139,this.infinity();break;case 42:case 43:e=new it(this,e),this.enterOuterAlt(e,3),this.state=140,this.boolean_();break;case 44:e=new Je(this,e),this.enterOuterAlt(e,4),this.state=141,this.null_();break;case 47:e=new rt(this,e),this.enterOuterAlt(e,5),this.state=142,this.match(we.DATE);break;case 48:e=new et(this,e),this.enterOuterAlt(e,6),this.state=143,this.match(we.DATETIME);break;case 49:e=new Ze(this,e),this.enterOuterAlt(e,7),this.state=144,this.match(we.TIME);break;case 51:e=new tt(this,e),this.enterOuterAlt(e,8),this.state=145,this.match(we.STRING);break;default:throw new R(this)}}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}compOp(){let e,t=new ot(this,this._ctx,this.state);this.enterRule(t,30,we.RULE_compOp);try{this.enterOuterAlt(t,1),this.state=148,e=this._input.LA(1),0!=(e-24&-32)||0==(1<<e-24&4095)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}arthOp(){let e,t=new at(this,this._ctx,this.state);this.enterRule(t,32,we.RULE_arthOp);try{this.enterOuterAlt(t,1),this.state=150,e=this._input.LA(1),0!=(e-36&-32)||0==(1<<e-36&15)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}polarOp(){let e,t=new ct(this,this._ctx,this.state);this.enterRule(t,34,we.RULE_polarOp);try{this.enterOuterAlt(t,1),this.state=152,e=this._input.LA(1),36!==e&&37!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}logOp(){let e,t=new ht(this,this._ctx,this.state);this.enterRule(t,36,we.RULE_logOp);try{this.enterOuterAlt(t,1),this.state=154,e=this._input.LA(1),40!==e&&41!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}boolean_(){let e,t=new lt(this,this._ctx,this.state);this.enterRule(t,38,we.RULE_boolean);try{this.enterOuterAlt(t,1),this.state=156,e=this._input.LA(1),42!==e&&43!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}null_(){let e=new ut(this,this._ctx,this.state);this.enterRule(e,40,we.RULE_null);try{this.enterOuterAlt(e,1),this.state=158,this.match(we.T__43)}catch(t){if(!(t instanceof g))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}infinity(){let e,t=new pt(this,this._ctx,this.state);this.enterRule(t,42,we.RULE_infinity);try{this.enterOuterAlt(t,1),this.state=160,e=this._input.LA(1),45!==e&&46!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof g))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}sempred(e,t,r){return 1!==t||this.expression_sempred(e,r)}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,5);case 1:return this.precpred(this._ctx,4);case 2:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return we.__ATN||(we.__ATN=(new y).deserialize(we._serializedATN)),we.__ATN}}we.T__0=1,we.T__1=2,we.T__2=3,we.T__3=4,we.T__4=5,we.T__5=6,we.T__6=7,we.T__7=8,we.T__8=9,we.T__9=10,we.T__10=11,we.T__11=12,we.T__12=13,we.T__13=14,we.T__14=15,we.T__15=16,we.T__16=17,we.T__17=18,we.T__18=19,we.T__19=20,we.T__20=21,we.T__21=22,we.T__22=23,we.T__23=24,we.T__24=25,we.T__25=26,we.T__26=27,we.T__27=28,we.T__28=29,we.T__29=30,we.T__30=31,we.T__31=32,we.T__32=33,we.T__33=34,we.T__34=35,we.T__35=36,we.T__36=37,we.T__37=38,we.T__38=39,we.T__39=40,we.T__40=41,we.T__41=42,we.T__42=43,we.T__43=44,we.T__44=45,we.T__45=46,we.DATE=47,we.DATETIME=48,we.TIME=49,we.IDENTIFIER=50,we.STRING=51,we.NUMBER=52,we.INTEGER=53,we.WHITESPACE=54,we.COMMENT=55,we.LINE_COMMENT=56,we.EOF=p.EOF,we.RULE_root=0,we.RULE_expression=1,we.RULE_term=2,we.RULE_invocable=3,we.RULE_invocation=4,we.RULE_indexer=5,we.RULE_function=6,we.RULE_paramList=7,we.RULE_unit=8,we.RULE_dateTimePrecision=9,we.RULE_pluralDateTimePrecision=10,we.RULE_qualifiedIdentifier=11,we.RULE_externalConstant=12,we.RULE_identifier=13,we.RULE_literal=14,we.RULE_compOp=15,we.RULE_arthOp=16,we.RULE_polarOp=17,we.RULE_logOp=18,we.RULE_boolean=19,we.RULE_null=20,we.RULE_infinity=21,we.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],we.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],we.ruleNames=["root","expression","term","invocable","invocation","indexer","function","paramList","unit","dateTimePrecision","pluralDateTimePrecision","qualifiedIdentifier","externalConstant","identifier","literal","compOp","arthOp","polarOp","logOp","boolean","null","infinity"],we._serializedATN=[4,1,56,163,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,61,8,1,10,1,12,1,64,9,1,1,1,1,1,3,1,68,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,82,8,1,10,1,12,1,85,9,1,1,2,1,2,1,2,3,2,90,8,2,1,3,1,3,1,4,1,4,1,5,1,5,3,5,98,8,5,1,6,1,6,1,6,3,6,103,8,6,1,6,1,6,1,7,1,7,1,7,5,7,110,8,7,10,7,12,7,113,9,7,1,8,1,8,1,8,3,8,118,8,8,1,9,1,9,1,10,1,10,1,11,1,11,1,11,5,11,127,8,11,10,11,12,11,130,9,11,1,11,1,11,1,12,1,12,1,12,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,3,14,147,8,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,0,1,2,22,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,0,9,1,0,6,13,1,0,14,21,1,0,50,51,1,0,24,35,1,0,36,39,1,0,36,37,1,0,40,41,1,0,42,43,1,0,45,46,162,0,44,1,0,0,0,2,67,1,0,0,0,4,89,1,0,0,0,6,91,1,0,0,0,8,93,1,0,0,0,10,97,1,0,0,0,12,99,1,0,0,0,14,106,1,0,0,0,16,117,1,0,0,0,18,119,1,0,0,0,20,121,1,0,0,0,22,128,1,0,0,0,24,133,1,0,0,0,26,136,1,0,0,0,28,146,1,0,0,0,30,148,1,0,0,0,32,150,1,0,0,0,34,152,1,0,0,0,36,154,1,0,0,0,38,156,1,0,0,0,40,158,1,0,0,0,42,160,1,0,0,0,44,45,3,2,1,0,45,46,5,0,0,1,46,1,1,0,0,0,47,48,6,1,-1,0,48,68,3,4,2,0,49,50,3,34,17,0,50,51,3,2,1,6,51,68,1,0,0,0,52,53,5,1,0,0,53,54,3,2,1,0,54,55,5,2,0,0,55,68,1,0,0,0,56,57,5,3,0,0,57,62,3,2,1,0,58,59,5,4,0,0,59,61,3,2,1,0,60,58,1,0,0,0,61,64,1,0,0,0,62,60,1,0,0,0,62,63,1,0,0,0,63,65,1,0,0,0,64,62,1,0,0,0,65,66,5,5,0,0,66,68,1,0,0,0,67,47,1,0,0,0,67,49,1,0,0,0,67,52,1,0,0,0,67,56,1,0,0,0,68,83,1,0,0,0,69,70,10,5,0,0,70,71,3,32,16,0,71,72,3,2,1,6,72,82,1,0,0,0,73,74,10,4,0,0,74,75,3,30,15,0,75,76,3,2,1,5,76,82,1,0,0,0,77,78,10,3,0,0,78,79,3,36,18,0,79,80,3,2,1,4,80,82,1,0,0,0,81,69,1,0,0,0,81,73,1,0,0,0,81,77,1,0,0,0,82,85,1,0,0,0,83,81,1,0,0,0,83,84,1,0,0,0,84,3,1,0,0,0,85,83,1,0,0,0,86,90,3,28,14,0,87,90,3,22,11,0,88,90,3,24,12,0,89,86,1,0,0,0,89,87,1,0,0,0,89,88,1,0,0,0,90,5,1,0,0,0,91,92,3,12,6,0,92,7,1,0,0,0,93,94,3,26,13,0,94,9,1,0,0,0,95,98,3,26,13,0,96,98,5,53,0,0,97,95,1,0,0,0,97,96,1,0,0,0,98,11,1,0,0,0,99,100,3,26,13,0,100,102,5,1,0,0,101,103,3,14,7,0,102,101,1,0,0,0,102,103,1,0,0,0,103,104,1,0,0,0,104,105,5,2,0,0,105,13,1,0,0,0,106,111,3,2,1,0,107,108,5,4,0,0,108,110,3,2,1,0,109,107,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,15,1,0,0,0,113,111,1,0,0,0,114,118,3,18,9,0,115,118,3,20,10,0,116,118,5,51,0,0,117,114,1,0,0,0,117,115,1,0,0,0,117,116,1,0,0,0,118,17,1,0,0,0,119,120,7,0,0,0,120,19,1,0,0,0,121,122,7,1,0,0,122,21,1,0,0,0,123,124,3,26,13,0,124,125,5,22,0,0,125,127,1,0,0,0,126,123,1,0,0,0,127,130,1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128,1,0,0,0,131,132,3,26,13,0,132,23,1,0,0,0,133,134,5,23,0,0,134,135,7,2,0,0,135,25,1,0,0,0,136,137,5,50,0,0,137,27,1,0,0,0,138,147,5,52,0,0,139,147,3,42,21,0,140,147,3,38,19,0,141,147,3,40,20,0,142,147,5,47,0,0,143,147,5,48,0,0,144,147,5,49,0,0,145,147,5,51,0,0,146,138,1,0,0,0,146,139,1,0,0,0,146,140,1,0,0,0,146,141,1,0,0,0,146,142,1,0,0,0,146,143,1,0,0,0,146,144,1,0,0,0,146,145,1,0,0,0,147,29,1,0,0,0,148,149,7,3,0,0,149,31,1,0,0,0,150,151,7,4,0,0,151,33,1,0,0,0,152,153,7,5,0,0,153,35,1,0,0,0,154,155,7,6,0,0,155,37,1,0,0,0,156,157,7,7,0,0,157,39,1,0,0,0,158,159,5,44,0,0,159,41,1,0,0,0,160,161,7,8,0,0,161,43,1,0,0,0,11,62,67,81,83,89,97,102,111,117,128,146],we.DecisionsToDFA=we._ATN.decisionToState.map(((e,t)=>new d(e,t)));class Oe extends O{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(Ie,0)}EOF(){return this.getToken(we.EOF,0)}get ruleIndex(){return we.RULE_root}enterRule(e){e.enterRoot&&e.enterRoot(this)}exitRule(e){e.exitRoot&&e.exitRoot(this)}accept(e){return e.visitRoot?e.visitRoot(this):e.visitChildren(this)}}class Ie extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_expression}copyFrom(e){super.copyFrom(e)}}class Ae extends Ie{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(Ie,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}}class Ce extends Ie{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ie)}expression(e){return this.getTypedRuleContext(Ie,e)}enterRule(e){e.enterArrayExpression&&e.enterArrayExpression(this)}exitRule(e){e.exitArrayExpression&&e.exitArrayExpression(this)}accept(e){return e.visitArrayExpression?e.visitArrayExpression(this):e.visitChildren(this)}}class ve extends Ie{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}polarOp(){return this.getTypedRuleContext(ct,0)}expression(){return this.getTypedRuleContext(Ie,0)}enterRule(e){e.enterPolarityExpression&&e.enterPolarityExpression(this)}exitRule(e){e.exitPolarityExpression&&e.exitPolarityExpression(this)}accept(e){return e.visitPolarityExpression?e.visitPolarityExpression(this):e.visitChildren(this)}}class be extends Ie{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ie)}expression(e){return this.getTypedRuleContext(Ie,e)}compOp(){return this.getTypedRuleContext(ot,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}}class Le extends Ie{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ie)}expression(e){return this.getTypedRuleContext(Ie,e)}arthOp(){return this.getTypedRuleContext(at,0)}enterRule(e){e.enterArithmeticExpression&&e.enterArithmeticExpression(this)}exitRule(e){e.exitArithmeticExpression&&e.exitArithmeticExpression(this)}accept(e){return e.visitArithmeticExpression?e.visitArithmeticExpression(this):e.visitChildren(this)}}class Ne extends Ie{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ie)}expression(e){return this.getTypedRuleContext(Ie,e)}logOp(){return this.getTypedRuleContext(ht,0)}enterRule(e){e.enterLogicalExpression&&e.enterLogicalExpression(this)}exitRule(e){e.exitLogicalExpression&&e.exitLogicalExpression(this)}accept(e){return e.visitLogicalExpression?e.visitLogicalExpression(this):e.visitChildren(this)}}class Se extends Ie{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}term(){return this.getTypedRuleContext(ke,0)}enterRule(e){e.enterTermExpression&&e.enterTermExpression(this)}exitRule(e){e.exitTermExpression&&e.exitTermExpression(this)}accept(e){return e.visitTermExpression?e.visitTermExpression(this):e.visitChildren(this)}}class ke extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_term}copyFrom(e){super.copyFrom(e)}}class De extends ke{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}externalConstant(){return this.getTypedRuleContext(Xe,0)}enterRule(e){e.enterExternalConstantTerm&&e.enterExternalConstantTerm(this)}exitRule(e){e.exitExternalConstantTerm&&e.exitExternalConstantTerm(this)}accept(e){return e.visitExternalConstantTerm?e.visitExternalConstantTerm(this):e.visitChildren(this)}}class Pe extends ke{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}literal(){return this.getTypedRuleContext(Ye,0)}enterRule(e){e.enterLiteralTerm&&e.enterLiteralTerm(this)}exitRule(e){e.exitLiteralTerm&&e.exitLiteralTerm(this)}accept(e){return e.visitLiteralTerm?e.visitLiteralTerm(this):e.visitChildren(this)}}class Ue extends ke{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}qualifiedIdentifier(){return this.getTypedRuleContext(Qe,0)}enterRule(e){e.enterQualifiedIdentifierTerm&&e.enterQualifiedIdentifierTerm(this)}exitRule(e){e.exitQualifiedIdentifierTerm&&e.exitQualifiedIdentifierTerm(this)}accept(e){return e.visitQualifiedIdentifierTerm?e.visitQualifiedIdentifierTerm(this):e.visitChildren(this)}}class Me extends O{constructor(e,t,r){super(t,r),this.parser=e}function_(){return this.getTypedRuleContext(Ge,0)}get ruleIndex(){return we.RULE_invocable}enterRule(e){e.enterInvocable&&e.enterInvocable(this)}exitRule(e){e.exitInvocable&&e.exitInvocable(this)}accept(e){return e.visitInvocable?e.visitInvocable(this):e.visitChildren(this)}}class Fe extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_invocation}copyFrom(e){super.copyFrom(e)}}class He extends Fe{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(Ke,0)}enterRule(e){e.enterMemberInvocation&&e.enterMemberInvocation(this)}exitRule(e){e.exitMemberInvocation&&e.exitMemberInvocation(this)}accept(e){return e.visitMemberInvocation?e.visitMemberInvocation(this):e.visitChildren(this)}}class $e extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_indexer}copyFrom(e){super.copyFrom(e)}}class je extends $e{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}INTEGER(){return this.getToken(we.INTEGER,0)}enterRule(e){e.enterNumberIndex&&e.enterNumberIndex(this)}exitRule(e){e.exitNumberIndex&&e.exitNumberIndex(this)}accept(e){return e.visitNumberIndex?e.visitNumberIndex(this):e.visitChildren(this)}}class Be extends $e{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(Ke,0)}enterRule(e){e.enterMemberIndex&&e.enterMemberIndex(this)}exitRule(e){e.exitMemberIndex&&e.exitMemberIndex(this)}accept(e){return e.visitMemberIndex?e.visitMemberIndex(this):e.visitChildren(this)}}class Ge extends O{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(Ke,0)}paramList(){return this.getTypedRuleContext(ze,0)}get ruleIndex(){return we.RULE_function}enterRule(e){e.enterFunction&&e.enterFunction(this)}exitRule(e){e.exitFunction&&e.exitFunction(this)}accept(e){return e.visitFunction?e.visitFunction(this):e.visitChildren(this)}}class ze extends O{constructor(e,t,r){super(t,r),this.parser=e}expression_list(){return this.getTypedRuleContexts(Ie)}expression(e){return this.getTypedRuleContext(Ie,e)}get ruleIndex(){return we.RULE_paramList}enterRule(e){e.enterParamList&&e.enterParamList(this)}exitRule(e){e.exitParamList&&e.exitParamList(this)}accept(e){return e.visitParamList?e.visitParamList(this):e.visitChildren(this)}}class qe extends O{constructor(e,t,r){super(t,r),this.parser=e}dateTimePrecision(){return this.getTypedRuleContext(Ve,0)}pluralDateTimePrecision(){return this.getTypedRuleContext(We,0)}STRING(){return this.getToken(we.STRING,0)}get ruleIndex(){return we.RULE_unit}enterRule(e){e.enterUnit&&e.enterUnit(this)}exitRule(e){e.exitUnit&&e.exitUnit(this)}accept(e){return e.visitUnit?e.visitUnit(this):e.visitChildren(this)}}class Ve extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_dateTimePrecision}enterRule(e){e.enterDateTimePrecision&&e.enterDateTimePrecision(this)}exitRule(e){e.exitDateTimePrecision&&e.exitDateTimePrecision(this)}accept(e){return e.visitDateTimePrecision?e.visitDateTimePrecision(this):e.visitChildren(this)}}class We extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_pluralDateTimePrecision}enterRule(e){e.enterPluralDateTimePrecision&&e.enterPluralDateTimePrecision(this)}exitRule(e){e.exitPluralDateTimePrecision&&e.exitPluralDateTimePrecision(this)}accept(e){return e.visitPluralDateTimePrecision?e.visitPluralDateTimePrecision(this):e.visitChildren(this)}}class Qe extends O{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(Ke)}identifier(e){return this.getTypedRuleContext(Ke,e)}get ruleIndex(){return we.RULE_qualifiedIdentifier}enterRule(e){e.enterQualifiedIdentifier&&e.enterQualifiedIdentifier(this)}exitRule(e){e.exitQualifiedIdentifier&&e.exitQualifiedIdentifier(this)}accept(e){return e.visitQualifiedIdentifier?e.visitQualifiedIdentifier(this):e.visitChildren(this)}}class Xe extends O{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(we.IDENTIFIER,0)}STRING(){return this.getToken(we.STRING,0)}get ruleIndex(){return we.RULE_externalConstant}enterRule(e){e.enterExternalConstant&&e.enterExternalConstant(this)}exitRule(e){e.exitExternalConstant&&e.exitExternalConstant(this)}accept(e){return e.visitExternalConstant?e.visitExternalConstant(this):e.visitChildren(this)}}class Ke extends O{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(we.IDENTIFIER,0)}get ruleIndex(){return we.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}}class Ye extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_literal}copyFrom(e){super.copyFrom(e)}}class Ze extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(we.TIME,0)}enterRule(e){e.enterTimeLiteral&&e.enterTimeLiteral(this)}exitRule(e){e.exitTimeLiteral&&e.exitTimeLiteral(this)}accept(e){return e.visitTimeLiteral?e.visitTimeLiteral(this):e.visitChildren(this)}}class Je extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(ut,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}}class et extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(we.DATETIME,0)}enterRule(e){e.enterDateTimeLiteral&&e.enterDateTimeLiteral(this)}exitRule(e){e.exitDateTimeLiteral&&e.exitDateTimeLiteral(this)}accept(e){return e.visitDateTimeLiteral?e.visitDateTimeLiteral(this):e.visitChildren(this)}}class tt extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(we.STRING,0)}enterRule(e){e.enterStringLiteral&&e.enterStringLiteral(this)}exitRule(e){e.exitStringLiteral&&e.exitStringLiteral(this)}accept(e){return e.visitStringLiteral?e.visitStringLiteral(this):e.visitChildren(this)}}class rt extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(we.DATE,0)}enterRule(e){e.enterDateLiteral&&e.enterDateLiteral(this)}exitRule(e){e.exitDateLiteral&&e.exitDateLiteral(this)}accept(e){return e.visitDateLiteral?e.visitDateLiteral(this):e.visitChildren(this)}}class st extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(pt,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}}class it extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(lt,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}}class nt extends Ye{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(we.NUMBER,0)}enterRule(e){e.enterNumberLiteral&&e.enterNumberLiteral(this)}exitRule(e){e.exitNumberLiteral&&e.exitNumberLiteral(this)}accept(e){return e.visitNumberLiteral?e.visitNumberLiteral(this):e.visitChildren(this)}}class ot extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_compOp}enterRule(e){e.enterCompOp&&e.enterCompOp(this)}exitRule(e){e.exitCompOp&&e.exitCompOp(this)}accept(e){return e.visitCompOp?e.visitCompOp(this):e.visitChildren(this)}}class at extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_arthOp}enterRule(e){e.enterArthOp&&e.enterArthOp(this)}exitRule(e){e.exitArthOp&&e.exitArthOp(this)}accept(e){return e.visitArthOp?e.visitArthOp(this):e.visitChildren(this)}}class ct extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_polarOp}enterRule(e){e.enterPolarOp&&e.enterPolarOp(this)}exitRule(e){e.exitPolarOp&&e.exitPolarOp(this)}accept(e){return e.visitPolarOp?e.visitPolarOp(this):e.visitChildren(this)}}class ht extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_logOp}enterRule(e){e.enterLogOp&&e.enterLogOp(this)}exitRule(e){e.exitLogOp&&e.exitLogOp(this)}accept(e){return e.visitLogOp?e.visitLogOp(this):e.visitChildren(this)}}class lt extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}}class ut extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}}class pt extends O{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return we.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}}class dt extends K{constructor(e){super(""+e)}toString(){return"@"+super.toString()}}const _t=u.tree.ParseTreeVisitor;class ft extends _t{constructor(e){super(),this._timeZone=e?.timeZone}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitIdentifier(e){return e.getText()}visitNullLiteral(){return new fe}visitBooleanLiteral(e){return new ie("true"===e.getText())}visitNumberLiteral(e){return new me(e.getText())}visitStringLiteral(e){return new Te(pe(e.getText()))}visitInfinityLiteral(){return new me(1/0)}visitDateLiteral(e){return new _e(pe(e.getText()))}visitDateTimeLiteral(e){return new _e(pe(e.getText()))}visitTimeLiteral(e){return new xe(pe(e.getText()))}visitQualifiedIdentifierTerm(e){return new ye(e.getText())}visitPolarityExpression(e){const t=this.visit(e.expression());if("NumberLiteral"===t.kind)return"-"===e.polarOp().getText()&&(t.value*=-1),t;throw new ne('Unexpected token "'+e.getText()+'"')}visitExternalConstantTerm(e){return new dt(e.externalConstant().getText().substring(1))}visitParenthesizedExpression(e){const t=this.visit(e.expression());return new se(t)}visitArrayExpression(e){return new J(e.expression_list().map((e=>this.visit(e))))}visitComparisonExpression(e){return new te({op:e.compOp().getText(),left:this.visit(e.expression(0)),right:this.visit(e.expression(1))})}visitLogicalExpression(e){const t=[],r=(e,s)=>{for(const i of e){if(i instanceof Ne&&i.logOp().getText()===s){r(i.expression_list(),i.logOp().getText());continue}const e=this.visit(i);t.push(e)}};return r(e.expression_list(),e.logOp().getText()),new re({op:e.logOp().getText(),items:t})}visitArithmeticExpression(e){const t=new Y,r=(e,s)=>{for(let i=0,n=e.length;i<n;i++){const n=e[i];if(n instanceof Le){r(n.expression_list(),n.arthOp().getText());continue}const o=this.visit(n);t.append(s||"+",o)}};return r(e.expression_list(),e.arthOp().getText()),t}}class mt extends I{constructor(e){super(),this.errors=e}syntaxError(e,t,r,s,i,n){this.errors.push(new ae(i,{recognizer:e,offendingSymbol:t,line:r,e:n}))}}var yt,Tt;!function(e){e.X_Opra_Version="X-Opra-Version",e.X_Opra_DataType="X-Opra-DataType",e.X_Opra_Count="X-Opra-Count",e.WWW_Authenticate="WWW-Authenticate",e.Authorization="Authorization",e.Proxy_Authenticate="Proxy-Authenticate",e.Proxy_Authorization="Proxy-Authorization",e.Age="Age",e.Cache_Control="Cache-Control",e.Clear_Site_Data="Clear-Site-Data",e.Expires="Expires",e.Pragma="Pragma",e.Last_Modified="Last-Modified",e.ETag="ETag",e.If_Match="If-Match",e.If_None_Match="If-None-Match",e.If_Modified_Since="If-Modified-Since",e.If_Unmodified_Since="If-Unmodified-Since",e.Vary="Vary",e.Connection="Connection",e.Keep_Alive="Keep-Alive",e.Accept="Accept",e.Accept_Encoding="Accept-Encoding",e.Accept_Language="Accept-Language",e.Expect="Expect",e.Cookie="Cookie",e.Set_Cookie="Set-Cookie",e.Access_Control_Allow_Origin="Access-Control-Allow-Origin",e.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",e.Access_Control_Allow_Headers="Access-Control-Allow-Headers",e.Access_Control_Allow_Methods="Access-Control-Allow-Methods",e.Access_Control_Expose_Headers="Access-Control-Expose-Headers",e.Access_Control_Max_Age="Access-Control-Max-Age",e.Access_Control_Request_Headers="Access-Control-Request-Headers",e.Access_Control_Request_Method="Access-Control-Request-Method",e.Origin="Origin",e.Timing_Allow_Origin="Timing-Allow-Origin",e.Content_Disposition="Content-Disposition",e.Content_ID="Content-ID",e.Content_Length="Content-Length",e.Content_Type="Content-Type",e.Content_Transfer_Encoding="Content-Transfer-Encoding",e.Content_Encoding="Content-Encoding",e.Content_Language="Content-Language",e.Content_Location="Content-Location",e.Forwarded="Forwarded",e.X_Forwarded_For="X-Forwarded-For",e.X_Forwarded_Host="X-Forwarded-Host",e.X_Forwarded_Proto="X-Forwarded-Proto",e.Via="Via",e.Location="Location",e.From="From",e.Host="Host",e.Referer="Referer",e.Referrer_Policy="Referrer-Policy",e.User_Agent="User-Agent",e.Allow="Allow",e.Server="Server",e.Accept_Ranges="Accept-Ranges",e.Range="Range",e.If_Range="If-Range",e.Content_Range="Content-Range",e.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",e.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",e.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",e.Content_Security_Policy="Content-Security-Policy",e.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",e.Expect_CT="Expect-CT",e.Feature_Policy="Feature-Policy",e.Strict_Transport_Security="Strict-Transport-Security",e.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",e.X_Content_Type_Options="X-Content-Type-Options",e.X_Download_Options="X-Download-Options",e.X_Frame_Options="X-Frame-Options",e.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",e.X_Powered_By="X-Powered-By",e.X_XSS_Protection="X-XSS-Protection",e.Transfer_Encoding="Transfer-Encoding",e.TE="TE",e.Trailer="Trailer",e.Sec_WebSocket_Key="Sec-WebSocket-Key",e.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",e.Sec_WebSocket_Accept="Sec-WebSocket-Accept",e.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",e.Sec_WebSocket_Version="Sec-WebSocket-Version",e.Date="Date",e.Retry_After="Retry-After",e.Server_Timing="Server-Timing",e.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control"}(yt||(yt={})),function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLYHINTS=103]="EARLYHINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.AMBIGUOUS=300]="AMBIGUOUS",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.TOO_EARLY=425]="TOO_EARLY",e[e.UPGRADE_REQUIRED=428]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(Tt||(Tt={}));const Et=Object.keys(yt),xt=Et.map((e=>e.toLowerCase()));function gt(e,t){return e&&Object.keys(e).reduce(((r,s)=>{const i=e[s],n=t?Et[xt.indexOf(s.toLowerCase())]||s.replace(/(^\w|[A-Z]|\b\w)/g,(function(e){return e.toUpperCase()})):s.toLowerCase();return"set-cookie"===s.toLowerCase()?r[n]=Array.isArray(i)?i:[i]:r[n]=Array.isArray(i)?i.join(";"):i,r}),{})||{}}class Rt{constructor(e){this.method=e.method,this.url=encodeURI(decodeURI(e.url)),this.headers=e.headers,this.data=e.data}}class wt{constructor(e){this.status=e.status,this.headers=e.headers,this.data=e.data}}const Ot="\r\n",It=/ *charset=./i;class At{constructor(){this._parts=[],this.boundary="batch_"+b(12)}addRequestPart(e,t){const r={...gt(t?.headers||{},!0),[yt.Content_Type]:"application/http",[yt.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[yt.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new Rt(e)}),this}addHttpResponse(e,t){const r={...gt(t?.headers||{},!0),[yt.Content_Type]:"application/http",[yt.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[yt.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new wt(e)}),this}addBatch(e,t){const r={...gt(t?.headers||{},!0),[yt.Content_Type]:"application/http",[yt.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[yt.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:e}),this}stream(){const e=[];return this._build(e),v(e).flatten().toNodeStream()}_build(e){for(const t of this._parts){if(!(t.content instanceof Rt||t.content instanceof wt))throw new Error("Not implemented yet");{let r=t.content.data,s=0;const i=gt(t.content.headers);if(r){const e=String(i["content-type"]||"").split(/\s*;\s*/);let t="";if(M(r)?s=parseInt(String(i["content-length"]),10)||0:"object"==typeof r?"function"==typeof r.stream?(e[0]=r.type||"binary",s=r.size,r=r.stream()):Buffer.isBuffer(r)?i["content-length"]=String(r.length):(e[0]=e[0]||"application/json",t="utf-8",r=Buffer.from(JSON.stringify(r),"utf-8"),s=r.length):(e[0]=e[0]||"text/plain",t="utf-8",r=Buffer.from(String(r),"utf-8"),s=r.length),e[0]){if(t){const r=e.findIndex((e=>It.test(String(e))));r>0?e[r]="charset="+t:e.join("charset="+t)}i["content-type"]=e.join(";")}s&&(i["content-length"]=String(s))}let n="--"+this.boundary+Ot;for(const[e,r]of Object.entries(t.headers))""!==r&&null!=r&&(n+=e+": "+(Array.isArray(r)?r.join(";"):r)+Ot);if(n+=Ot,t.content instanceof Rt?n+=(t.content.method||"GET").toUpperCase()+" "+t.content.url+" HTTP/1.1"+Ot:n+="HTTP/1.1 "+t.content.status+(Tt[t.content.status]||"Unknown")+Ot,t.content.headers)for(const[e,r]of Object.entries(t.content.headers))""!==r&&null!=r&&("set-cookie"===e&&Array.isArray(r)?r.forEach((t=>n+=e+": "+t)):n+=e+": "+(Array.isArray(r)?r.join(";"):r)+Ot);n+=Ot,e.push(Buffer.from(n,"utf-8")),r&&(e.push(r),e.push(Buffer.from(Ot+Ot)))}}e.push(Buffer.from("--"+this.boundary+"--"+Ot,"utf-8"))}}const Ct="opra:complex_type.fields",vt="opra:resolver.metadata",bt="opra:ignore_resolver-method",Lt="opra:mapped_type.metadata",Nt=["create","delete","get","update"],St=[...Nt,"count","deleteMany","updateMany","search"];var kt;!function(e){e.Version="1.0",e.isDataType=function(e){return e&&"object"==typeof e&&("ComplexType"===e.kind||"SimpleType"===e.kind||"UnionType"===e.kind)},e.isComplexType=function(e){return e&&"object"==typeof e&&"ComplexType"===e.kind},e.isSimpleType=function(e){return e&&"object"==typeof e&&"SimpleType"===e.kind},e.isUnionTypee=function(e){return e&&"object"==typeof e&&"UnionType"===e.kind},e.isResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind||"CollectionResource"===e.kind||"SingletonResource"===e.kind},e.isCollectionResource=function(e){return e&&"object"==typeof e&&"CollectionResource"===e.kind},e.isSingletonResource=function(e){return e&&"object"==typeof e&&"SingletonResource"===e.kind},e.isContainerResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind}}(kt||(kt={}));class Dt extends Map{constructor(e,t){super(),this._keyMap=new Map,this._keyOrder=[],this._wellKnownKeyMap=new Map,t&&t.forEach((e=>this._wellKnownKeyMap.set(e.toLowerCase(),e))),"function"==typeof e?.forEach?e.forEach(((e,t)=>this.set(t,e))):e&&"object"==typeof e&&Object.keys(e).forEach((t=>this.set(t,e[t])))}clear(){super.clear(),this._keyMap.clear(),this._keyOrder=[]}get(e){const t=this._getOriginalKey(e);return super.get(t)}has(e){return this._keyMap.has(this._getLowerKey(e))}set(e,t){return e=this._getOriginalKey(e),this._keyMap.set(this._getLowerKey(e),e),this._keyOrder.includes(e)||this._keyOrder.push(e),super.set(e,t)}keys(){return this._keyOrder.values()}values(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:r.get(t[e])})}}entries(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],r.get(t[e])]})}}delete(e){const t=this._getOriginalKey(e),r=this._getLowerKey(e);this._keyMap.delete(r);const s=this._keyOrder.indexOf(t);return s>=0&&this._keyOrder.splice(s,1),super.delete(t)}sort(e){return this._keyOrder.sort(e),this}[Symbol.iterator](){return this.entries()}_getOriginalKey(e){return"string"==typeof e?this._keyMap.get(e.toLowerCase())??this._wellKnownKeyMap.get(e.toLowerCase())??e:e}_getLowerKey(e){return"string"==typeof e?e.toLowerCase():e}}function Pt(e){return"function"==typeof e&&!(!e.prototype||!e.prototype.constructor)}const Ut={kind:"UnionType",description:"Any value",ctor:Object,types:[]},Mt={kind:"SimpleType",description:"A stream of bytes, base64 encoded",ctor:Object.getPrototypeOf(Buffer.from("")).constructor,parse:e=>Buffer.from(e),serialize:e=>Buffer.isBuffer(e)?e.toString("base64"):void 0},Ft={kind:"SimpleType",description:"BigInt number",ctor:Object.getPrototypeOf(BigInt(0)).constructor,parse:e=>BigInt(e),serialize:e=>String(e)},Ht={kind:"SimpleType",description:"Simple true/false value",ctor:Boolean,parse:e=>o(e),serialize:e=>o(e)},$t={kind:"SimpleType",description:"A date, date-time or partial date",ctor:String,parse:e=>a(e),serialize:e=>String(e)},jt={kind:"SimpleType",description:"A date, date-time or partial date in string format",ctor:String,parse:e=>c(e),serialize:e=>c(e)},Bt={kind:"SimpleType",description:"A guid value",ctor:String,parse:e=>c(e),serialize:e=>c(e)},Gt={kind:"SimpleType",description:"An integer number",ctor:Number,parse:e=>h(e),serialize:e=>h(e)},zt={kind:"SimpleType",description:"Both Integer as well as Floating-Point numbers",ctor:Number,parse:e=>l(e),serialize:e=>l(e)},qt={kind:"ComplexType",description:"A non modelled object",ctor:Object,additionalFields:!0,parse:e=>e,serialize:e=>e},Vt={kind:"SimpleType",description:"A sequence of characters",ctor:String,parse:e=>c(e),serialize:e=>c(e)},Wt=Object.getPrototypeOf(BigInt(0)).constructor,Qt=Object.getPrototypeOf(Buffer.from("")).constructor,Xt=new Dt;Xt.set("any",Ut),Xt.set("base64Binary",Mt),Xt.set("bigint",Ft),Xt.set("boolean",Ht),Xt.set("date",$t),Xt.set("dateString",jt),Xt.set("guid",Bt),Xt.set("integer",Gt),Xt.set("number",zt),Xt.set("object",qt),Xt.set("string",Vt);const Kt=new Map;function Yt(e,t){return k({},e,{deep:!0,clone:!0,filter:(e,r)=>{const s=e[r];return null!=s&&!t||"function"!=typeof s&&("object"!=typeof s||S(s)||Array.isArray(s))}})}async function Zt(e){const t=Object.getPrototypeOf(e).constructor,r=Reflect.getMetadata("opra:resource.metadata",t);if(!r)throw new TypeError(`Class "${t.name}" doesn't have "Resource" metadata information`);const s=Yt(r);if(s.instance=e,s.name=r.name||t.name.replace(/(Resource|Controller)$/,""),kt.isCollectionResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let s,i;const n=(e,t)=>{i=e[t],s=Reflect.getMetadata(vt,e,t),null==i&&s&&(e=Object.getPrototypeOf(e),i=e[t])};for(const o of St){if(n(t,o),"function"!=typeof i)continue;const a=e[o]={...s};Reflect.hasMetadata(bt,r.constructor,o)||(a.handler=i.bind(t),i=t["pre_"+o],"function"==typeof i&&(e["pre_"+o]=i.bind(t)))}return e}(s);if(kt.isSingletonResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let s,i;const n=(e,t)=>{i=e[t],s=Reflect.getMetadata(vt,e,t),null==i&&s&&(e=Object.getPrototypeOf(e),i=e[t])};for(const o of Nt){if(n(t,o),"function"!=typeof i)continue;const a=e[o]={...s};Reflect.hasMetadata(bt,r.constructor,o)||(a.handler=i.bind(t),i=t["pre_"+o],"function"==typeof i&&(e["pre_"+o]=i.bind(t)))}return e}(s);throw new TypeError("Invalid Resource metadata")}Kt.set(Boolean,"boolean"),Kt.set(String,"string"),Kt.set(Number,"number"),Kt.set(Date,"date"),Kt.set(Wt,"bigint"),Kt.set(Qt,"base64Binary"),Kt.set(Object,"object");const Jt=Symbol.for("opra.optional-lib.sqb-connect");async function er(e){const t=Reflect.getMetadata("opra:data_type.metadata",e);if(!t)throw new TypeError(`Class "${e}" doesn't have "DataType" metadata information`);if(kt.isComplexType(t))return await async function(e,t){const r=Yt(t);r.ctor=e;const s=Reflect.getMetadata(Lt,e);s&&(r.extends=[...s.map((e=>Yt(e)))]);const i=Reflect.getMetadata(Ct,e);if(i){r.fields=Yt(i);for(const[t,s]of Object.entries(r.fields)){if("function"==typeof s.type){const e=Kt.get(s.type);e&&(s.type=e)}const r=globalThis[Jt]?.SqbConnect;let i;if(r){const{EntityMetadata:n,isAssociationField:o}=r,a=n.get(e);if(i=a&&n.getField(a,t),i){if((s.type===Function||"object"===s.type||s.type===Object||"any"===s.type)&&(s.type="any",o(i))){i.association.returnsMany()||delete s.isArray;const e=await i.association.resolveTarget();e&&(s.type=e.ctor)}i.exclusive&&void 0===s.exclusive&&(s.exclusive=i.exclusive)}}if(i&&"column"===i.kind){const e=r.DataType;if("number"===s.type||s.type===Number)switch(i.dataType){case e.INTEGER:case e.SMALLINT:s.type="integer";break;case e.BIGINT:s.type="bigint"}else if(("string"===s.type||s.type===String)&&i.dataType===e.GUID)s.type="guid";i.notNull&&void 0===s.required&&(s.required=i.notNull),i.exclusive&&void 0===s.exclusive&&(s.exclusive=i.exclusive),void 0!==i.default&&void 0===s.default&&(s.default=i.default)}}}return r}(e,t);if(kt.isSimpleType(t))return await async function(e,t){const r=Yt(t);return r.ctor=e,r}(e,t);throw new TypeError("Invalid DataType metadata")}const tr=Symbol.for("opra.optional-lib.sqb-connect");class rr{constructor(e){this._dataTypes=new Dt,this._resources=new Dt,this._args=e}buildSchema(){const e={...this._args,version:kt.Version};return this._dataTypes.size&&(e.types=Array.from(this._dataTypes.keys()).sort().reduce(((e,t)=>(e[t]=this._dataTypes.get(t),e)),{})),this._resources.size&&(e.resources=Array.from(this._resources.keys()).sort().reduce(((e,t)=>(e[t]=this._resources.get(t),e)),{})),e}async addDataTypeSchema(e,t){if(!kt.isDataType(t))throw new TypeError("Invalid DataType schema");const r=this._dataTypes.get(e);if(r){if(r.kind!==t.kind||!r.ctor||r.ctor!==t.ctor)throw new Error(`An other instance of "${e}" data type previously defined`)}else if(this._dataTypes.set(e,t),kt.isComplexType(t)){if(t.extends)for(const e of t.extends)"string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type));if(t.fields)for(const e of Object.values(t.fields))e.type=e.type||"string","string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type))}}async addDataTypeClass(e){if(!Pt(e=N.isPromise(e)?await e:e))return this.addDataTypeClass(e());const t=Kt.get(e);if(t)return t;const r=await er(e),s=r.name,i=r;return delete i.name,await this.addDataTypeSchema(s,i),s}async addResourceSchema(e,t){if(!kt.isResource(t))throw new TypeError("Invalid Resource schema");if(this._resources.has(e))throw new Error(`An other instance of "${e}" resource previously defined`);if(kt.isCollectionResource(t)||kt.isSingletonResource(t)){const e="function"==typeof t.type?await this.addDataTypeClass(t.type):t.type;if(t.type=e,!this._dataTypes.has(t.type)&&!Xt.has(t.type))throw new Error(`Resource registration error. Type "${t.type}" not found.`)}if(kt.isCollectionResource(t)&&!t.keyFields){const r=this._dataTypes.get(t.type),s=globalThis[tr]?.SqbConnect;if(s&&r?.ctor){const e=s.EntityMetadata.get(r?.ctor);if(e?.indexes){const r=e.indexes.find((e=>e.primary));r&&(t.keyFields=r.columns)}}if(t.keyFields=Array.isArray(t.keyFields)?t.keyFields.length?t.keyFields:"":t.keyFields,!t.keyFields)throw new TypeError(`You must provide keyFields for "${e}" entity resource`)}this._resources.set(e,t)}async addResourceInstance(e){let t;"function"==typeof(e=N.isPromise(e)?await e:e)?Pt(e)?(t={},Object.setPrototypeOf(t,e.prototype)):t=await e():t=e;const r=await Zt(t),s=r.name,i=r;return delete i.name,await this.addResourceSchema(s,i),s}}function sr(e,t){return e<t?-1:e>t?1:0}const ir=Symbol.for("nodejs.util.inspect.custom"),nr="[0m",or="[33m",ar="[35m";class cr{constructor(e,t,r){this._document=e,this._name=t,this._metadata=r}get document(){return this._document}get kind(){return this._metadata.kind}get name(){return this._name}get description(){return this._metadata.description}get ctor(){return this._metadata.ctor}parse(e){return this._metadata.parse?this._metadata.parse(e):e}getSchema(e){return Yt(this._metadata,e)}}class hr extends cr{constructor(e,t,r){super(e,t,{kind:"ComplexType",...r}),this._initialized=!1,this.ownFields=new Dt,this.fields=new Dt}get abstract(){return!!this._metadata.abstract}get additionalFields(){return this._metadata.additionalFields||this._mixinAdditionalFields}get extends(){return this._metadata.extends}getField(e){if(e.includes(".")){let t=this;const r=e.split(".");let s;for(const e of r)s=t.getField(e),t=t.document.getDataType(s.type||"string");return s}const t=this.fields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have a field named "${e}"`);return t}getFieldType(e){const t=this.getField(e);return this.document.getDataType(t.type||"string")}getOwnField(e){const t=this.ownFields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have an own field named "${e}"`);return t}getSchema(){const e=super.getSchema();if(this.additionalFields&&(e.additionalFields=this.additionalFields),this.ownFields.size){e.fields={};for(const[t,r]of this.ownFields)e.fields[t]=Yt(r),delete e.fields[t].name}return e}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[ir](){return`[${or+Object.getPrototypeOf(this).constructor.name+nr} ${ar+this.name+nr}]`}init(){if(this._initialized)return;this._initialized=!0;const e=this._metadata;if(e.extends)for(const t of e.extends){const e=this.document.types.get(t.type);if(!e)throw new TypeError(`Extending schema (${t.type}) of data type "${this.name}" does not exists`);if(!(e instanceof hr))throw new TypeError(`Cannot extend ${this.name} from a "${e.kind}"`);e.init(),e.additionalFields&&(this._mixinAdditionalFields=!0);for(const[t,r]of e.fields){const e=Yt(r);e.name=t,e.parent=this,this.fields.set(t,e)}}if(e.fields)for(const[t,r]of Object.entries(e.fields)){if(!this.document.types.get(r.type))throw new TypeError(`Type "${r.type}" defined for "${this.name}.${t}" does not exists`);const e=Yt(r);e.name=t,this.fields.set(t,e),this.ownFields.set(t,e)}}}class lr extends cr{constructor(e,t,r){super(e,t,{kind:"SimpleType",...r})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[ir](){return`[${or+Object.getPrototypeOf(this).constructor.name+nr} ${ar+this.name+nr}]`}}class ur extends cr{constructor(e,t,r){super(e,t,L({kind:"UnionType",...r},["types"])),this.types=r.types,this.hasAdditionalFields="any"===t||!!this.types.find((e=>e instanceof hr&&e.additionalFields))}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[ir](){return`[${or+Object.getPrototypeOf(this).constructor.name+nr} ${ar+this.name+nr}]`}}const pr=/^([^.]+)\.(.*)$/;function dr(e){if(e.length)return _r(e,{})}function _r(e,t){for(const r of e){const e=pr.exec(r);if(e){const r=e[1];if(!0===t[r])continue;const s=t[r]="object"==typeof t[r]?t[r]:{};_r([e[2]],s)}else t[r]=!0}return t}function fr(e,t,r,s=""){return mr([],e,t,dr(r)||{},"",s,{additionalFields:!0})}function mr(e,t,r,s,i="",n="",o){let a="";for(const c of Object.keys(s)){const h=s[c],l=r?.fields.get(c);if(!l){if(a=i?i+"."+c:c,!o?.additionalFields||r&&!r.additionalFields)throw new TypeError(`Unknown field "${a}"`);"object"==typeof h?mr(e,t,void 0,h,a,n,o):e.push(a);continue}a=i?i+"."+l.name:l.name;const u=t.getDataType(l.type||"string");if("object"!=typeof h)e.findIndex((e=>e.startsWith(a+".")))>=0&&(e=e.filter((e=>!e.startsWith(a+".")))),e.push(a);else{if(!(u&&u instanceof hr))throw new TypeError(`"${n?n+"."+a:a}" is not a complex type and has no sub fields`);if(e.findIndex((e=>e===i))>=0)continue;e=mr(e,t,u,h,a,n,o)}}return e}class yr{constructor(e,t,r){this.document=e,this.name=t,this.metadata=r}get instance(){return this.metadata.instance}get kind(){return this.metadata.kind}get description(){return this.metadata.description}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}validateQueryOptions(){}getSchema(e){return Yt(this.metadata,e)}[ir](){return`[${or+Object.getPrototypeOf(this).constructor.name+nr} ${ar+this.name+nr}]`}}class Tr extends yr{constructor(e,t,r,s){if(!s.keyFields)throw new TypeError(`You should provide key fields for ${t}`);super(e,t,s),s.keyFields=Array.isArray(s.keyFields)?s.keyFields:[s.keyFields],s.keyFields.forEach((e=>r.getField(e))),this.dataType=r,s.search&&s.search.sortFields&&(s.search.sortFields=fr(e,r,s.search.sortFields))}get keyFields(){return this.metadata.keyFields}get create(){return this.metadata.create}get count(){return this.metadata.count}get delete(){return this.metadata.delete}get deleteMany(){return this.metadata.deleteMany}get get(){return this.metadata.get}get update(){return this.metadata.update}get updateMany(){return this.metadata.updateMany}get search(){return this.metadata.search}getSchema(e){const t=super.getSchema(e);t.keyFields.length<2&&(t.keyFields=t.keyFields[0]);for(const e of St)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class Er extends yr{constructor(e,t,r,s){if(!(r instanceof hr))throw new TypeError('You should provide a ComplexType as "dataType" argument');super(e,t,s),this.dataType=r}get create(){return this.metadata.create}get delete(){return this.metadata.delete}get get(){return this.metadata.get}get update(){return this.metadata.update}getSchema(e){const t=super.getSchema(e);for(const e of Nt)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class xr{constructor(e){this._ownTypes=new Dt,this._types=new Dt,this._resources=new Dt,this._meta=L(e,["types","resources"]);for(const[e,t]of Xt.entries())this._addDataType(e,t,!1);if(e.types)for(const[t,r]of Object.entries(e.types))this._addDataType(t,r,!0);if(this._initTypes(),e.resources)for(const[t,r]of Object.entries(e.resources))this._addResource(t,r)}get info(){return this._meta.info}get types(){return this._types}getDataType(e){const t=this.types.get(e);if(t)return t;throw new Error(`Data type "${e}" does not exists`)}getComplexDataType(e){const t=this.getDataType(e);if(t&&t instanceof hr)return t;throw new Error(`Data type "${e}" is not a ComplexType`)}getSimpleDataType(e){const t=this.getDataType(e);if(t&&t instanceof lr)return t;throw new Error(`Data type "${e}" is not a SimpleType`)}getUnionDataType(e){const t=this.getDataType(e);if(t&&t instanceof ur)return t;throw new Error(`Data type "${e}" is not a UnionType`)}get resources(){return this._resources}get servers(){return this._meta.servers}getResource(e){const t=this.resources.get(e);if(!t)throw new Error(`Resource "${e}" does not exists`);return t}getCollectionResource(e){const t=this.getResource(e);if(!(t instanceof Tr))throw new Error(`"${e}" is not a CollectionResource`);return t}getSingletonResource(e){const t=this.getResource(e);if(!(t instanceof Er))throw new Error(`"${e}" is not a SingletonResource`);return t}getMetadata(e){const t={version:kt.Version,info:Yt(this.info)};return this._ownTypes.size&&(t.types=Array.from(this._ownTypes.values()).sort(((e,t)=>sr(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),this.resources.size&&(t.resources=Array.from(this._resources.values()).sort(((e,t)=>sr(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),t}_addDataType(e,t,r){let s=this._types.get(e);if(s)return s;if(kt.isComplexType(t))s=new hr(this,e,t);else if(kt.isSimpleType(t))s=new lr(this,e,t);else{if(!kt.isUnionTypee(t))throw new TypeError("Invalid data type schema");s=new ur(this,e,{...t,types:[]})}return this._types.set(e,s),r&&this._ownTypes.set(e,s),s}_addResource(e,t){if(!kt.isCollectionResource(t)&&!kt.isSingletonResource(t))throw new TypeError(`Unknown resource kind (${t.kind})`);{const r=this.getDataType(t.type);if(!r)throw new TypeError(`Datatype "${t.type}" declared in CollectionResource (${e}) does not exists`);if(!(r instanceof hr))throw new TypeError(`${t.type} is not an ComplexType`);kt.isCollectionResource(t)?this.resources.set(e,new Tr(this,e,r,t)):this.resources.set(e,new Er(this,e,r,t))}}_initTypes(){for(const e of this._types.values())e instanceof hr&&e.init()}static async create(e){const t=new rr(e);if(e.types)if(Array.isArray(e.types))for(const r of e.types)await t.addDataTypeClass(r);else for(const[r,s]of Object.entries(e.types))await t.addDataTypeSchema(r,s);if(e.resources)if(Array.isArray(e.resources))for(const r of e.resources)await t.addResourceInstance(r);else for(const[r,s]of Object.entries(e.resources))await t.addResourceSchema(r,s);const r=t.buildSchema();return new xr(r)}}function gr(e,t){if(!e)return"";for(;t&&e.startsWith("/");)e=e.substring(1);for(;e.endsWith("/");)e=e.substring(0,e.length-1);return e}const Rr=/^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;function wr(e){const r=Rr.exec(e);if(!r)throw Object.assign(new TypeError("Invalid URL path"),{code:"ERR_INVALID_URL_PATH",input:e});const s=decodeURIComponent(r[1]);let i;if(r[2]){const s=decodeURIComponent(r[2]||""),n=t(s,{delimiters:";",quotes:!0,escape:!1});for(const r of n){const s=t(r,{delimiters:"=",quotes:!0,escape:!1});if(n.length>1&&s.length<2||i&&s.length>=2&&"object"!=typeof i||s.length<2&&"object"==typeof i)throw Object.assign(new TypeError("Invalid URL path. name:value pair required for multiple key format"),{pathComponent:e,code:"ERR_INVALID_URL_PATH"});s.length>=2?(i=i||{},i[s.shift()||""]=s.join("=")):i=s[0]}}return r[3]?{resource:s,key:i,typeCast:r[3]}:{resource:s,key:i}}function Or(e,t,r){if(null==e)return"";let s="";if(""!==t&&null!=t)if(S(t)){const e=[];for(const r of Object.keys(t))e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));s=e.join(";")}else s=encodeURIComponent(""+t);return r&&(r=encodeURIComponent(r)),encodeURIComponent(e).replace(/%24/,"$")+(s?"@"+s:"")+(r?"::"+r:"")}const Ir=Symbol.for("nodejs.util.inspect.custom");class Ar{constructor(e){this.resource=e.resource,this.key=e.key,this.typeCast=e.typeCast}toString(){const e=Or(this.resource,this.key,this.typeCast);return e&&Object.setPrototypeOf(e,Ar.prototype),e}[Ir](){const e={resource:this.resource};return null!=this.key&&(e.key=this.key),null!=this.typeCast&&(e.typeCast=this.typeCast),e}}const Cr=Symbol.for("nodejs.util.inspect.custom");class vr extends D{constructor(...e){super(),this._entries=[];for(const t of e)F(t)?this._parse(t.pathname):t instanceof vr?this._entries.push(...t._entries):this.add(t)}get size(){return this._entries.length}add(e,t,r){this._add(e,t,r),this.emit("change")}clear(){this._entries=[],this.emit("change")}get(e){return this._entries[e]}join(t){const r=e(gr(t,!0),{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){const t=wr(e);this._add(t)}return this.emit("change"),this}entries(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],e]})}}values(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:t[e]})}}forEach(e){for(const t of this._entries)e.call(this,t.resource,t.key,this)}getResource(e){const t=this._entries[e];return null==t?void 0:t.resource}getKey(e){const t=this._entries[e];return null==t?void 0:t.key}toString(){return this._entries.map((e=>Or(e.resource,e.key,e.typeCast))).join("/")}[Symbol.iterator](){return this.entries()}[Cr](){return this._entries}_add(e,t,r){e instanceof Ar?this._entries.push(e):"object"==typeof e?this._entries.push(new Ar(e)):this._entries.push(new Ar({resource:e,key:t,typeCast:r}))}_parse(t){if(!t)return;const r=e(t,{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){if(!e)continue;const t=wr(e);this._add(t)}this.emit("change")}}class br{}const Lr=["true","t","yes","y","1"],Nr=["false","f","no","n","0"];const Sr=/^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;function kr(e,t,r){if(""===e||null==e)return"";const s=e.match(Sr);if(!s)throw new TypeError(`"${e}" is not a valid date.`);let i=s[1]+"-"+(s[2]||"01")+"-"+(s[3]||"01");return t&&(i+="T"+(s[4]||"00")+":"+(s[5]||"00")+":"+(s[6]||"00")+(s[7]?"."+s[7]:""),r&&(i+=s[8]?"Z":s[9]?s[9]+(s[10]||"00")+":"+(s[11]||"00"):"")),i}class Dr extends br{constructor(e){super(),this.max=e?.max,this.min=e?.min}parse(e){const t="number"==typeof e?e:parseFloat(e);if(isNaN(t))throw new TypeError(`"${e}" is not a valid number`);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return"number"==typeof e?""+e:""}}class Pr extends Dr{constructor(e){super(e),this.enum=e?.enum}parse(e){const t=super.parse(e);if(!Number.isInteger(t))throw new TypeError(`"${e}" is not a valid integer`);if(this.enum&&!this.enum.includes(t))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return t}}const Ur={integer:new Pr,number:new Dr,string:new class extends br{constructor(e){super(),this.maxLength=e?.maxLength,this.minLength=e?.minLength,this.enum=e?.enum}parse(e){if(null!=this.minLength&&e.length<this.minLength)throw new TypeError(`Value must be at least ${this.minLength} character${this.minLength>1?"s":""} long.`);if(null!=this.maxLength&&e.length>this.maxLength)throw new TypeError(`Value can be up to ${this.maxLength} character${this.maxLength>1?"s":""} long.`);if(this.enum&&!this.enum.includes(e))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return e}stringify(e){return null==e?"":""+e}},boolean:new class extends br{parse(e){if(""===e)return!0;if("boolean"==typeof e)return e;if(Lr.includes(e.toLowerCase()))return!0;if(Nr.includes(e.toLowerCase()))return!1;throw new TypeError(`"${e}" is not a valid boolean`)}stringify(e){return"boolean"==typeof e?e?"true":"false":""}},date:new class extends br{constructor(e){super(),this.max=e?.max?kr(e.max):void 0,this.min=e?.min?kr(e.min):void 0,this.time=e?.time??!0,this.timeZone=e?.timeZone??!0}parse(e){const t=kr(e,this.time,this.timeZone);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return kr(e,this.time,this.timeZone)}},filter:new class extends br{parse(e){return e instanceof Q?e:function(e,t){const r=new A(e),s=new Re(r),i=new C(s),n=new we(i);n.buildParseTrees=!0;const o=[],a=new mt(o);s.removeErrorListeners(),s.addErrorListener(a),n.removeErrorListeners(),n.addErrorListener(a);const c=n.root(),h=(t=t||new ft).visit(c);if(o.length){const e=[];for(const t of o)e.push(t.message+" at (line: "+t.line+" column: "+t.charPositionInLine+")");const t=new ne(e.join("\n"));throw t.errors=o,t}return h}(e)}stringify(e){return e?""+e:""}}},Mr=Symbol.for("nodejs.util.inspect.custom");class Fr extends D{constructor(e){super(),this._params=new Dt,this._entries=new Dt,this._size=0,this.defineParam("$filter",{format:"filter"}),this.defineParam("$limit",{format:new Pr({min:0})}),this.defineParam("$skip",{format:new Pr({min:0})}),this.defineParam("$pick",{format:"string",array:"strict"}),this.defineParam("$omit",{format:"string",array:"strict"}),this.defineParam("$include",{format:"string",array:"strict"}),this.defineParam("$sort",{format:"string",array:"strict"}),this.defineParam("$distinct",{format:"boolean"}),this.defineParam("$count",{format:"boolean"}),e&&("string"==typeof e?this.parse(e):this.addAll(e))}get size(){return this._size}addAll(e){let t=!1;if("function"==typeof e.forEach)e.forEach(((e,r)=>{t=this._add(r,e)||t}));else if("object"!=typeof e)throw new TypeError("Invalid argument");t&&this.emit("change")}append(e,t){this._add(e,t)&&this.emit("change")}clear(){this._entries.clear(),this._size=0,this.emit("change")}defineParam(e,t){if(!e)throw new Error("Parameter name required");const r={...t,name:e,format:t?.format||"string"};if("string"==typeof r.format&&!Ur[r.format])throw new Error(`Unknown data format "${r.format}"`);return r.format=r.format||"string",this._params.set(e,r),this}delete(e){this._delete(e)&&this.emit("change")}entries(){const e=[];return this.forEach(((t,r)=>{e.push([r,t])})),e.values()}forEach(e){for(const[t,r]of this._entries.entries())for(let s=0;s<r.length;s++)e(r[s],t,this)}get(e,t){const r=this._entries.get(e),s=r&&r[t||0];return null==s?null:s}getAll(e){const t=this._entries.get(e);return t?t.slice(0):[]}has(e){return this._entries.has(e)}keys(){return this._entries.keys()}set(e,t){this._delete(e),this._add(e,t),this.emit("change")}sort(e){this._entries.sort(e),this.emit("change")}values(){const e=[];return this.forEach((t=>e.push(t))),e.values()}toString(){let e="";return this.forEach(((t,r)=>{const s=this._params.get(r),i=s?"string"==typeof s.format?Ur[s.format]:s.format:void 0,n=e=>encodeURIComponent(i?i.stringify(e,r):null==e?"":""+e),o=Array.isArray(t)?t.map(n).join(s?.arrayDelimiter||","):n(t);o&&(e.length>0&&(e+="&"),e+=r+"="+o)})),e}parse(r){if(this._entries.clear(),this._size=0,r&&r.startsWith("?")&&(r=r.substring(1)),!r)return;const s=e(r,{delimiters:"&",quotes:!0,brackets:!0});for(const r of s){if(!r)continue;const s=e(r,{delimiters:"=",quotes:!0,brackets:!0}),i=decodeURIComponent(s.next()||""),n=s.join("="),o=this._params.get(i);if(o?.array){const e=t(n,{delimiters:o?.arrayDelimiter||",",brackets:!0,quotes:!0}).map((e=>decodeURIComponent(e)));this._add(i,e)}else this._add(i,decodeURIComponent(n))}this.emit("change")}toURLSearchParams(){const e=new URLSearchParams;return this.forEach(((t,r)=>{const s=this._params.get(r),i=s?"string"==typeof s.format?Ur[s.format]:s.format:void 0,n=e=>i?i.stringify(e,r):null==e?"":""+e,o=Array.isArray(t)?t.map(n).join(s?.arrayDelimiter||","):n(t);e.append(r,o)})),e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"URLSearchParams"}[Mr](){return this._entries}_delete(e){const t=this._entries.get(e);return!!t&&(this._size-=t.length,this._entries.delete(e),!0)}_add(e,t){const r=this._params.get(e),s=r?"string"==typeof r.format?Ur[r.format]:r.format:void 0,i=t=>s?s.parse(t,e):t;let n=Array.isArray(t)?t.map(i):i(t);if(r&&("strict"===r.array?n=Array.isArray(n)?n:[n]:r.array&&(n=Array.isArray(n)&&1===n.length?n[0]:n),Array.isArray(n))){if(r.minArrayItems&&n.length<r.minArrayItems)throw new Error(`"${e}" parameter requires at least ${r.minArrayItems} values`);if(r.maxArrayItems&&n.length>r.maxArrayItems)throw new Error(`"${e}" parameter accepts up to ${r.maxArrayItems} values`)}let o=this._entries.get(e);return o||(o=[],this._entries.set(e,o)),o.push(n),this._size++,!0}}Buffer.from("\r\n");class Hr extends Error{constructor(e,t){super(e.message),this.cause=t,this.issues=e.issues||[],this.status=e.status,t&&(this.cause=t,t.stack&&(this.stack=t.stack))}}const $r=/^application\/([\w-]+\+)?\bjson\b/i,jr=/^text\/.*$/i,Br=/^multipart\/\bform-data\b/i;class Gr extends P{constructor(e,t={}){super((e=>{"response"!==t.observe?this.resolve().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t))):this.fetch().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t)))})),this._handler=e,this.options=t,this.contentId=b(6),this.options=t}header(e,t){return this._headers=this._headers||{},this._headers[e]=t,this}async fetch(){const e=this._promise||(this._promise=new Promise(((e,t)=>{setTimeout((()=>{this._execute().then(e).catch(t)}),0)})));return await e}async resolve(){return(await this.fetch()).data}with(e){return e(this),this}binding(){return{}}async _execute(){const e=this.prepare();return await this._handler(e)}}function zr(e,...t){let r;const s=[e,...t];let i;for(let e=s.length-1;e>=0;e--){const t=s[e];t?.headers&&(i=i||{},Object.assign(i,gt(t.headers)))}for(const t of s)t&&(Object.assign(e,t),t?.params&&(r=r||new Fr,t.params.forEach(((e,t)=>r?.append(t,e)))));return e.headers=i,e.params=r,e}class qr extends Gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.data=r,this.options=s}prepare(){const e=new Fr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),zr({method:"POST",path:this.resource.name,params:e,body:this.data},this.options.http)}}class Vr extends Gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new Fr;return this.options.filter&&e.set("$filter",this.options.filter),zr({method:"DELETE",path:this.resource.name,params:e},this.options.http)}}class Wr extends Gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.keyValue=r,this.options=s}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "delete" request');return zr({method:"DELETE",path:new vr({resource:this.resource.name,key:this.keyValue}).toString()},this.options.http)}}class Qr extends Gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.keyValue=r,this.options=s}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new vr({resource:this.resource.name,key:this.keyValue}),t=new Fr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),zr({method:"GET",path:e.toString(),params:t},this.options.http)}}class Xr extends Gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new Fr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),this.options.sort&&e.set("$sort",this.options.sort),this.options.filter&&e.set("$filter",this.options.filter),null!=this.options.limit&&e.set("$limit",this.options.limit),null!=this.options.skip&&e.set("$skip",this.options.skip),null!=this.options.count&&e.set("$count",this.options.count),null!=this.options.distinct&&e.set("$distinct",this.options.distinct),zr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class Kr extends Gr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.data=r,this.options=s}prepare(){const e=new Fr;return this.options.filter&&e.set("$filter",this.options.filter),zr({method:"PATCH",path:this.resource.name,params:e,body:this.data},this.options.http)}}class Yr extends Gr{constructor(e,t,r,s,i={}){super(e,i),this._handler=e,this.resource=t,this.keyValue=r,this.data=s,this.options=i}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new vr({resource:this.resource.name,key:this.keyValue}),t=new Fr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),zr({method:"PATCH",path:e.toString(),params:t,body:this.data},this.options.http)}}class Zr{constructor(e,t){this.resource=e,this._handler=t}create(e,t){return new qr(this._handler,this.resource,e,t)}delete(e,t){return new Wr(this._handler,this.resource,e,t)}deleteMany(e){return new Vr(this._handler,this.resource,e)}get(e,t){return new Qr(this._handler,this.resource,e,t)}search(e){return new Xr(this._handler,this.resource,e)}update(e,t,r){return new Yr(this._handler,this.resource,e,t,r)}updateMany(e,t){return new Kr(this._handler,this.resource,e,t)}}class Jr extends Gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new URLSearchParams;return this.options.include&&e.set("$include",""+this.options.include),this.options.pick&&e.set("$pick",""+this.options.pick),this.options.omit&&e.set("$omit",""+this.options.omit),zr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class es{constructor(e,t){this.resource=e,this._handler=t}get(e){return new Jr(this._handler,this.resource,e)}}class ts extends Gr{constructor(e,t,r={}){super(e,r),this._handler=e,this.requests=t,this.options=r,this._results=new WeakMap,this._listeners=new Set,t.forEach((e=>{Object.defineProperty(e,"_execute",{writable:!0,enumerable:!1,configurable:!0,value:()=>new Promise(((t,r)=>{const s=this._results.get(e);if(s)return s.error?r(s.error):t(s.response);const i=(e,s)=>{if(this._listeners.delete(i),e)return r(e);t(s)};this._listeners.add(i)}))})}))}prepare(){const e=this._buildBatchMultipart(this);return zr({method:"POST",path:"/$batch",headers:{"content-type":"multipart/mixed;boundary="+e.boundary},body:e.stream()},this.options.http)}_buildBatchMultipart(e){const t=new At;for(const r of e.requests){const e=r.prepare();if(r instanceof ts){const e=this._buildBatchMultipart(r);t.addBatch(e)}else t.addRequestPart({method:e.method,url:e.path,headers:e.headers,data:e.body})}return t}async _execute(){const e=this.prepare();return await this._handler(e)}}const rs=new Map,ss=new Map;class is{constructor(e,t){if(this._serviceUrl=e,this._metadata=t?.document,!this._metadata){const e=rs.get(this.serviceUrl.toLowerCase());e&&(this._metadata=e)}this.defaults=t?.defaults||{}}get serviceUrl(){return this._serviceUrl}get initialized(){return!!this._metadata}get metadata(){return this._assertMetadata(),this._metadata}async init(e){if(!e&&this.initialized)return;const t=this.serviceUrl.toLowerCase();let r=ss.get(t);if(!r)return r=this._resolveMetadata(),ss.set(t,r),r.catch((()=>{})).finally((()=>ss.delete(t)));await r}batch(e){return this._assertMetadata(),new ts((e=>this._handleRequest(e)),e)}collection(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getCollectionResource(e);return new Zr(t,(e=>this._handleRequest(e)))}singleton(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getSingletonResource(e);return new es(t,(e=>this._handleRequest(e)))}async _resolveMetadata(){const e=await this._handleRequest({method:"GET",path:"/$metadata",headers:{accept:"application/json"}});this._metadata=new xr(e.data)}async _handleRequest(e){zr(e,this.defaults);let t=function(...e){const t=[];let r;for(let s=0,i=e.length;s<i;s++)r=gr(e[s],s>0),r&&t.push(r);return t.join("/")}(this.serviceUrl,e.path);var r;return e.params&&(t+="?"+e.params.toString()),e.body&&"object"==typeof e.body&&(M(e.body)||U(r=e.body)&&!1!==r.readable&&"function"==typeof r.getReader&&"function"==typeof r.pipeThrough&&"function"==typeof r.pipeTo||Buffer.isBuffer(e.body)||(e.headers?.["content-type"]||(e.headers=e.headers||{},e.headers["content-type"]="application/json"),e.body=JSON.stringify(e.body))),this._fetch(t,e)}async _fetch(e,t){const r=await fetch(e,t);let s;if(r.body&&($r.test(r.headers.get("Content-Type")||"")?(s=await r.json(),"string"==typeof s&&(s=JSON.parse(s))):s=jr.test(r.headers.get("Content-Type")||"")?await r.text():Br.test(r.headers.get("Content-Type")||"")?await r.formData():await r.arrayBuffer()),r.status>=400&&r.status<600)throw new Hr({message:r.status+" "+r.statusText,status:r.status,issues:s?.errors});return{get headers(){return r.headers},get ok(){return r.ok},get redirected(){return r.redirected},get status(){return r.status},get statusText(){return r.statusText},get type(){return r.type},get url(){return r.url},get contentId(){return r.headers.get("Content-ID")},get data(){return s}}}_assertMetadata(){if(!this._metadata)throw new Error("You must call init() to before using the client instance")}static async create(e,t){const r=new this(e,t);return r._metadata||await r.init(),r}}export{ts as BatchRequest,Hr as ClientError,qr as CollectionCreateRequest,Vr as CollectionDeleteManyRequest,Wr as CollectionDeleteRequest,Qr as CollectionGetRequest,Xr as CollectionSearchRequest,Kr as CollectionUpdateManyRequest,Yr as CollectionUpdateRequest,Zr as HttpCollectionService,Gr as HttpRequest,Jr as HttpSingletonGetRequest,es as HttpSingletonService,is as OpraHttpClient};
|
|
1
|
+
import{Buffer as e}from"buffer";import{tokenize as t,splitString as r}from"fast-tokenizer";import s from"@browsery/fs";import i from"@browsery/i18next";import n from"path-browserify";import{toDateDef as o,toBoolean as a,toDate as c,toString as h,toInt as l,toNumber as u}from"putil-varhelpers";import p,{Token as d,DFA as _,Lexer as f,LexerATNSimulator as m,PredictionContextCache as y,ATNDeserializer as T,Parser as E,ParserATNSimulator as x,FailedPredicateException as g,RecognitionException as R,NoViableAltException as w,ATN as O,ParserRuleContext as I,ErrorListener as A,CharStream as C,CommonTokenStream as v}from"@browsery/antlr4";import b from"@browsery/highland";import{uid as L}from"uid";import"reflect-metadata";import N from"lodash.omit";import S from"putil-promisify";import k from"putil-isplainobject";import D from"putil-merge";import{EventEmitter as P}from"events";import"@browsery/http-parser";import"@browsery/stream";import{Observable as U}from"rxjs";function M(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe}function F(e){return M(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState}function H(e){return null!==e&&"string"==typeof e.host&&"string"==typeof e.href}const $=/^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/i;const j=/\\(.)/g;function B(e){return e.replace(j,"$1")}const G=Object.getPrototypeOf(i).constructor,z=[];class q extends G{async init(e,t){const r="object"==typeof e?e:{},s="function"==typeof e?e:t;try{const e=await super.init(r,s),t=this.services.formatter;if(t.add("lowercase",((e,t)=>e.toLocaleLowerCase(t))),t.add("uppercase",((e,t)=>e.toLocaleUpperCase(t))),t.add("upperFirst",((e,t)=>e.charAt(0).toLocaleUpperCase(t)+e.substring(1))),z.length&&await this.loadResourceDir(z,!1,!0),r?.resourceDirs?.length&&await this.loadResourceDir(r.resourceDirs,!1,!0),r?.resources)for(const e of Object.keys(r.resources)){const t=r.resources[e];for(const r of Object.keys(t))this.addResourceBundle(e,r,t[r],!1,!0)}return s&&s(null,e),e}catch(e){throw s&&s(e,this.t),e}}deep(e,t){if(null==e)return e;const r=new WeakMap;return this._deepTranslate(e,r,t)}registerLocaleDir(...e){z.push(...e)}async loadResourceBundle(e,t,r,i,n){let o;if(a=r,$.test(a))o=(await fetch(r,{headers:{accept:"application/json"}})).json();else{const e=s.readFileSync(r,"utf8");o=JSON.parse(e)}var a;this.addResourceBundle(e,t,o,i,n)}async loadResourceDir(e,t,r){for(const i of Array.isArray(e)?e:[e]){if(!s.statSync(i).isDirectory())continue;const e=s.readdirSync(i);for(const o of e){const e=n.join(i,o);if(s.statSync(e).isDirectory()){const i=s.readdirSync(e);for(const a of i){const i=n.join(e,a),c=n.extname(a);if(".json"===c&&s.statSync(i).isFile()){const e=n.basename(a,c);await this.loadResourceBundle(o,e,i,t,r)}}}}}}createInstance(e={},t){return new q(e,t)}static createInstance(e,t){return new q(e,t)}_deepTranslate(s,i,n){if(null==s)return s;if(n?.ignore&&n.ignore(s,this))return s;if("object"==typeof s&&i.has(s))return i.get(s);if("string"==typeof s){let e="";for(let i of t(s,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0}))if(i.startsWith("$t(")&&i.endsWith(")")){i=i.substring(3,i.length-1);const s=r(i,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),o=B(i.substring((s[0]||"").length+1));i=s[0]||"";const a=[];let c=null;for(const e of t(i,{delimiters:",",quotes:!0,brackets:{"{":"}"}}))e.startsWith("{")?c=JSON.parse(e):a.push(e);const h=a.length>1?"$t("+a.join(",")+")":a[0];e+=o?this.t(h,o,{...n,...c}):this.t(h,{...n,...c})}else e+=i;return e}if(Array.isArray(s)){const e=Array(s.length);i.set(s,e);for(let t=0,r=s.length;t<r;t++)e[t]=this._deepTranslate(s[t],i,n);return i.delete(s),e}if("object"==typeof s){if(e.isBuffer(s))return s;if(e.isBuffer(s)||s instanceof Symbol||s instanceof RegExp||s instanceof Map||s instanceof Set||s instanceof WeakMap||s instanceof WeakSet)return s;const t={};i.set(s,t);const r=Object.keys(s);for(let e=0,o=r.length;e<o;e++){const o=r[e];t[o]=this._deepTranslate(s[o],i,n)}return i.delete(s),t}return s}static get defaultInstance(){return V}}const V=q.createInstance();var W;q.createInstance().init().catch((()=>{})),function(e){var t;(t=e.Enum||(e.Enum={})).fatal="fatal",t.error="error",t.warning="warning",t.info="info",e.name="IssueSeverity",e.description="Severity of the issue",e.Keys=Object.keys(e),e.descriptions={fatal:"The issue caused the action to fail and no further checking could be performed",error:"The issue is sufficiently important to cause the action to fail",warning:"The issue is not important enough to cause the action to fail but may cause it to be performed suboptimally or in a way that is not as desired",info:"The issue has no relation to the degree of success of the action"}}(W||(W={}));class Q{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}}class X extends Q{}class K extends X{}class Y extends K{constructor(e){super(),this.value=e}toString(){return""+this.value}}class Z extends X{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new J({op:e,expression:t})),this}toString(){return this.items.map(((e,t)=>(t>0?e.op:"")+e.expression)).join("")}}class J{constructor(e){Object.assign(this,e)}}class ee extends K{constructor(e){super(),this.items=e}toString(){return"["+this.items.map((e=>""+e)).join(",")+"]"}}const te=/\w/;class re extends X{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${te.test(this.op)?" "+this.op+" ":this.op}${this.right}`}}class se extends X{constructor(e){super(),Object.assign(this,e)}toString(){return this.items.map((e=>""+e)).join(" "+this.op+" ")}}class ie extends X{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}}class ne extends Y{constructor(e){super(e)}}class oe extends TypeError{}class ae extends TypeError{}class ce extends Error{constructor(e,t){super(e),Object.assign(this,t)}}const he=/'/g,le=/(\\)/g,ue=/\\(.)/g;function pe(e){return"'"+function(e){return e.replace(le,"\\\\")}(e).replace(he,"\\'")+"'"}function de(e){return e&&(e.startsWith("'")||e.startsWith('"'))&&e.endsWith(e.charAt(0))?function(e){return e.replace(ue,"$1")}(e.substring(1,e.length-1)):e}const _e=new Date(0);class fe extends Y{constructor(e){if(super(""),e instanceof Date)this.value=e.toISOString();else{if("string"!=typeof e||o(e,_e)===_e)throw new ae(`Invalid date value "${e}"`);this.value=e}}toString(){return pe(this.value)}}class me extends Y{constructor(){super(null),this.value=null}}class ye extends Y{constructor(e){if(super(0),"number"!=typeof e&&"bigint"!=typeof e){try{if("string"==typeof e){if(e.includes("."))return void(this.value=parseFloat(e));const t=Number(e);return void(this.value=""+t===e?t:BigInt(e))}}catch{}throw new ae(`Invalid number literal ${e}`)}this.value=e}toString(){return"bigint"==typeof this.value?(""+this.value).replace(/n$/,""):""+this.value}}class Te extends Y{constructor(e){super(""+e)}}class Ee extends Y{constructor(e){super(""+e)}toString(){return pe(this.value)}}const xe=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;class ge extends Y{constructor(e){if(super(""),e instanceof Date)this.value=Re(e.getHours())+":"+Re(e.getMinutes())+(e.getSeconds()?":"+Re(e.getSeconds()):"")+(e.getMilliseconds()?"."+Re(e.getMilliseconds()):"");else{if("string"!=typeof e||!xe.test(e))throw new ae(`Invalid time value "${e}"`);this.value=e}}toString(){return pe(this.value)}}function Re(e){return e<=9?"0"+e:""+e}class we extends f{constructor(e){super(e),this._interp=new m(this,we._ATN,we.DecisionsToDFA,new y)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return we.literalNames}get symbolicNames(){return we.symbolicNames}get ruleNames(){return we.ruleNames}get serializedATN(){return we._serializedATN}get channelNames(){return we.channelNames}get modeNames(){return we.modeNames}static get _ATN(){return we.__ATN||(we.__ATN=(new T).deserialize(we._serializedATN)),we.__ATN}}we.T__0=1,we.T__1=2,we.T__2=3,we.T__3=4,we.T__4=5,we.T__5=6,we.T__6=7,we.T__7=8,we.T__8=9,we.T__9=10,we.T__10=11,we.T__11=12,we.T__12=13,we.T__13=14,we.T__14=15,we.T__15=16,we.T__16=17,we.T__17=18,we.T__18=19,we.T__19=20,we.T__20=21,we.T__21=22,we.T__22=23,we.T__23=24,we.T__24=25,we.T__25=26,we.T__26=27,we.T__27=28,we.T__28=29,we.T__29=30,we.T__30=31,we.T__31=32,we.T__32=33,we.T__33=34,we.T__34=35,we.T__35=36,we.T__36=37,we.T__37=38,we.T__38=39,we.T__39=40,we.T__40=41,we.T__41=42,we.T__42=43,we.T__43=44,we.T__44=45,we.T__45=46,we.DATE=47,we.DATETIME=48,we.TIME=49,we.IDENTIFIER=50,we.STRING=51,we.NUMBER=52,we.INTEGER=53,we.WHITESPACE=54,we.COMMENT=55,we.LINE_COMMENT=56,we.EOF=d.EOF,we.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],we.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],we.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],we.modeNames=["DEFAULT_MODE"],we.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","T__34","T__35","T__36","T__37","T__38","T__39","T__40","T__41","T__42","T__43","T__44","T__45","DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT","NUMBERFORMAT","INTEGERFORMAT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"],we._serializedATN=[4,0,56,536,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,28,1,28,1,28,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,36,1,36,1,37,1,37,1,38,1,38,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,3,46,357,8,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,3,47,373,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,48,1,48,3,48,383,8,48,1,49,1,49,5,49,387,8,49,10,49,12,49,390,9,49,1,50,1,50,1,50,5,50,395,8,50,10,50,12,50,398,9,50,1,50,1,50,1,50,1,50,5,50,404,8,50,10,50,12,50,407,9,50,1,50,3,50,410,8,50,1,51,1,51,1,52,1,52,1,53,4,53,417,8,53,11,53,12,53,418,1,53,1,53,1,54,1,54,1,54,1,54,5,54,427,8,54,10,54,12,54,430,9,54,1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,5,55,441,8,55,10,55,12,55,444,9,55,1,55,1,55,1,56,4,56,449,8,56,11,56,12,56,450,1,56,1,56,4,56,455,8,56,11,56,12,56,456,3,56,459,8,56,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,472,8,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,481,8,58,1,59,1,59,1,59,1,59,3,59,487,8,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,4,59,499,8,59,11,59,12,59,500,3,59,503,8,59,3,59,505,8,59,1,60,1,60,1,60,3,60,510,8,60,1,60,1,60,1,60,3,60,515,8,60,1,60,1,60,1,60,3,60,520,8,60,3,60,522,8,60,1,61,1,61,1,61,3,61,527,8,61,1,62,1,62,1,62,1,62,1,62,1,62,1,63,1,63,1,428,0,64,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,99,50,101,51,103,52,105,53,107,54,109,55,111,56,113,0,115,0,117,0,119,0,121,0,123,0,125,0,127,0,1,0,17,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,2,0,10,10,13,13,1,0,48,57,1,0,48,48,1,0,49,57,1,0,49,49,1,0,48,50,1,0,49,51,1,0,48,49,1,0,48,51,1,0,48,53,2,0,43,43,45,45,3,0,48,57,65,70,97,102,554,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,1,129,1,0,0,0,3,131,1,0,0,0,5,133,1,0,0,0,7,135,1,0,0,0,9,137,1,0,0,0,11,139,1,0,0,0,13,144,1,0,0,0,15,150,1,0,0,0,17,155,1,0,0,0,19,159,1,0,0,0,21,164,1,0,0,0,23,171,1,0,0,0,25,178,1,0,0,0,27,190,1,0,0,0,29,196,1,0,0,0,31,203,1,0,0,0,33,209,1,0,0,0,35,214,1,0,0,0,37,220,1,0,0,0,39,228,1,0,0,0,41,236,1,0,0,0,43,249,1,0,0,0,45,251,1,0,0,0,47,253,1,0,0,0,49,256,1,0,0,0,51,258,1,0,0,0,53,260,1,0,0,0,55,263,1,0,0,0,57,265,1,0,0,0,59,268,1,0,0,0,61,271,1,0,0,0,63,275,1,0,0,0,65,280,1,0,0,0,67,286,1,0,0,0,69,292,1,0,0,0,71,299,1,0,0,0,73,301,1,0,0,0,75,303,1,0,0,0,77,305,1,0,0,0,79,307,1,0,0,0,81,311,1,0,0,0,83,314,1,0,0,0,85,319,1,0,0,0,87,325,1,0,0,0,89,330,1,0,0,0,91,339,1,0,0,0,93,356,1,0,0,0,95,372,1,0,0,0,97,382,1,0,0,0,99,384,1,0,0,0,101,409,1,0,0,0,103,411,1,0,0,0,105,413,1,0,0,0,107,416,1,0,0,0,109,422,1,0,0,0,111,436,1,0,0,0,113,448,1,0,0,0,115,460,1,0,0,0,117,462,1,0,0,0,119,486,1,0,0,0,121,521,1,0,0,0,123,523,1,0,0,0,125,528,1,0,0,0,127,534,1,0,0,0,129,130,5,40,0,0,130,2,1,0,0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,91,0,0,134,6,1,0,0,0,135,136,5,44,0,0,136,8,1,0,0,0,137,138,5,93,0,0,138,10,1,0,0,0,139,140,5,121,0,0,140,141,5,101,0,0,141,142,5,97,0,0,142,143,5,114,0,0,143,12,1,0,0,0,144,145,5,109,0,0,145,146,5,111,0,0,146,147,5,110,0,0,147,148,5,116,0,0,148,149,5,104,0,0,149,14,1,0,0,0,150,151,5,119,0,0,151,152,5,101,0,0,152,153,5,101,0,0,153,154,5,107,0,0,154,16,1,0,0,0,155,156,5,100,0,0,156,157,5,97,0,0,157,158,5,121,0,0,158,18,1,0,0,0,159,160,5,104,0,0,160,161,5,111,0,0,161,162,5,117,0,0,162,163,5,114,0,0,163,20,1,0,0,0,164,165,5,109,0,0,165,166,5,105,0,0,166,167,5,110,0,0,167,168,5,117,0,0,168,169,5,116,0,0,169,170,5,101,0,0,170,22,1,0,0,0,171,172,5,115,0,0,172,173,5,101,0,0,173,174,5,99,0,0,174,175,5,111,0,0,175,176,5,110,0,0,176,177,5,100,0,0,177,24,1,0,0,0,178,179,5,109,0,0,179,180,5,105,0,0,180,181,5,108,0,0,181,182,5,108,0,0,182,183,5,105,0,0,183,184,5,115,0,0,184,185,5,101,0,0,185,186,5,99,0,0,186,187,5,111,0,0,187,188,5,110,0,0,188,189,5,100,0,0,189,26,1,0,0,0,190,191,5,121,0,0,191,192,5,101,0,0,192,193,5,97,0,0,193,194,5,114,0,0,194,195,5,115,0,0,195,28,1,0,0,0,196,197,5,109,0,0,197,198,5,111,0,0,198,199,5,110,0,0,199,200,5,116,0,0,200,201,5,104,0,0,201,202,5,115,0,0,202,30,1,0,0,0,203,204,5,119,0,0,204,205,5,101,0,0,205,206,5,101,0,0,206,207,5,107,0,0,207,208,5,115,0,0,208,32,1,0,0,0,209,210,5,100,0,0,210,211,5,97,0,0,211,212,5,121,0,0,212,213,5,115,0,0,213,34,1,0,0,0,214,215,5,104,0,0,215,216,5,111,0,0,216,217,5,117,0,0,217,218,5,114,0,0,218,219,5,115,0,0,219,36,1,0,0,0,220,221,5,109,0,0,221,222,5,105,0,0,222,223,5,110,0,0,223,224,5,117,0,0,224,225,5,116,0,0,225,226,5,101,0,0,226,227,5,115,0,0,227,38,1,0,0,0,228,229,5,115,0,0,229,230,5,101,0,0,230,231,5,99,0,0,231,232,5,111,0,0,232,233,5,110,0,0,233,234,5,100,0,0,234,235,5,115,0,0,235,40,1,0,0,0,236,237,5,109,0,0,237,238,5,105,0,0,238,239,5,108,0,0,239,240,5,108,0,0,240,241,5,105,0,0,241,242,5,115,0,0,242,243,5,101,0,0,243,244,5,99,0,0,244,245,5,111,0,0,245,246,5,110,0,0,246,247,5,100,0,0,247,248,5,115,0,0,248,42,1,0,0,0,249,250,5,46,0,0,250,44,1,0,0,0,251,252,5,64,0,0,252,46,1,0,0,0,253,254,5,60,0,0,254,255,5,61,0,0,255,48,1,0,0,0,256,257,5,60,0,0,257,50,1,0,0,0,258,259,5,62,0,0,259,52,1,0,0,0,260,261,5,62,0,0,261,262,5,61,0,0,262,54,1,0,0,0,263,264,5,61,0,0,264,56,1,0,0,0,265,266,5,33,0,0,266,267,5,61,0,0,267,58,1,0,0,0,268,269,5,105,0,0,269,270,5,110,0,0,270,60,1,0,0,0,271,272,5,33,0,0,272,273,5,105,0,0,273,274,5,110,0,0,274,62,1,0,0,0,275,276,5,108,0,0,276,277,5,105,0,0,277,278,5,107,0,0,278,279,5,101,0,0,279,64,1,0,0,0,280,281,5,33,0,0,281,282,5,108,0,0,282,283,5,105,0,0,283,284,5,107,0,0,284,285,5,101,0,0,285,66,1,0,0,0,286,287,5,105,0,0,287,288,5,108,0,0,288,289,5,105,0,0,289,290,5,107,0,0,290,291,5,101,0,0,291,68,1,0,0,0,292,293,5,33,0,0,293,294,5,105,0,0,294,295,5,108,0,0,295,296,5,105,0,0,296,297,5,107,0,0,297,298,5,101,0,0,298,70,1,0,0,0,299,300,5,43,0,0,300,72,1,0,0,0,301,302,5,45,0,0,302,74,1,0,0,0,303,304,5,42,0,0,304,76,1,0,0,0,305,306,5,47,0,0,306,78,1,0,0,0,307,308,5,97,0,0,308,309,5,110,0,0,309,310,5,100,0,0,310,80,1,0,0,0,311,312,5,111,0,0,312,313,5,114,0,0,313,82,1,0,0,0,314,315,5,116,0,0,315,316,5,114,0,0,316,317,5,117,0,0,317,318,5,101,0,0,318,84,1,0,0,0,319,320,5,102,0,0,320,321,5,97,0,0,321,322,5,108,0,0,322,323,5,115,0,0,323,324,5,101,0,0,324,86,1,0,0,0,325,326,5,110,0,0,326,327,5,117,0,0,327,328,5,108,0,0,328,329,5,108,0,0,329,88,1,0,0,0,330,331,5,73,0,0,331,332,5,110,0,0,332,333,5,102,0,0,333,334,5,105,0,0,334,335,5,110,0,0,335,336,5,105,0,0,336,337,5,116,0,0,337,338,5,121,0,0,338,90,1,0,0,0,339,340,5,105,0,0,340,341,5,110,0,0,341,342,5,102,0,0,342,343,5,105,0,0,343,344,5,110,0,0,344,345,5,105,0,0,345,346,5,116,0,0,346,347,5,121,0,0,347,92,1,0,0,0,348,349,5,39,0,0,349,350,3,117,58,0,350,351,5,39,0,0,351,357,1,0,0,0,352,353,5,34,0,0,353,354,3,117,58,0,354,355,5,34,0,0,355,357,1,0,0,0,356,348,1,0,0,0,356,352,1,0,0,0,357,94,1,0,0,0,358,359,5,39,0,0,359,360,3,117,58,0,360,361,5,84,0,0,361,362,3,119,59,0,362,363,3,121,60,0,363,364,5,39,0,0,364,373,1,0,0,0,365,366,5,34,0,0,366,367,3,117,58,0,367,368,5,84,0,0,368,369,3,119,59,0,369,370,3,121,60,0,370,371,5,34,0,0,371,373,1,0,0,0,372,358,1,0,0,0,372,365,1,0,0,0,373,96,1,0,0,0,374,375,5,39,0,0,375,376,3,119,59,0,376,377,5,39,0,0,377,383,1,0,0,0,378,379,5,34,0,0,379,380,3,119,59,0,380,381,5,34,0,0,381,383,1,0,0,0,382,374,1,0,0,0,382,378,1,0,0,0,383,98,1,0,0,0,384,388,7,0,0,0,385,387,7,1,0,0,386,385,1,0,0,0,387,390,1,0,0,0,388,386,1,0,0,0,388,389,1,0,0,0,389,100,1,0,0,0,390,388,1,0,0,0,391,396,5,39,0,0,392,395,3,123,61,0,393,395,8,2,0,0,394,392,1,0,0,0,394,393,1,0,0,0,395,398,1,0,0,0,396,394,1,0,0,0,396,397,1,0,0,0,397,399,1,0,0,0,398,396,1,0,0,0,399,410,5,39,0,0,400,405,5,34,0,0,401,404,3,123,61,0,402,404,8,3,0,0,403,401,1,0,0,0,403,402,1,0,0,0,404,407,1,0,0,0,405,403,1,0,0,0,405,406,1,0,0,0,406,408,1,0,0,0,407,405,1,0,0,0,408,410,5,34,0,0,409,391,1,0,0,0,409,400,1,0,0,0,410,102,1,0,0,0,411,412,3,113,56,0,412,104,1,0,0,0,413,414,3,115,57,0,414,106,1,0,0,0,415,417,7,4,0,0,416,415,1,0,0,0,417,418,1,0,0,0,418,416,1,0,0,0,418,419,1,0,0,0,419,420,1,0,0,0,420,421,6,53,0,0,421,108,1,0,0,0,422,423,5,47,0,0,423,424,5,42,0,0,424,428,1,0,0,0,425,427,9,0,0,0,426,425,1,0,0,0,427,430,1,0,0,0,428,429,1,0,0,0,428,426,1,0,0,0,429,431,1,0,0,0,430,428,1,0,0,0,431,432,5,42,0,0,432,433,5,47,0,0,433,434,1,0,0,0,434,435,6,54,0,0,435,110,1,0,0,0,436,437,5,47,0,0,437,438,5,47,0,0,438,442,1,0,0,0,439,441,8,5,0,0,440,439,1,0,0,0,441,444,1,0,0,0,442,440,1,0,0,0,442,443,1,0,0,0,443,445,1,0,0,0,444,442,1,0,0,0,445,446,6,55,0,0,446,112,1,0,0,0,447,449,7,6,0,0,448,447,1,0,0,0,449,450,1,0,0,0,450,448,1,0,0,0,450,451,1,0,0,0,451,458,1,0,0,0,452,454,5,46,0,0,453,455,7,6,0,0,454,453,1,0,0,0,455,456,1,0,0,0,456,454,1,0,0,0,456,457,1,0,0,0,457,459,1,0,0,0,458,452,1,0,0,0,458,459,1,0,0,0,459,114,1,0,0,0,460,461,7,6,0,0,461,116,1,0,0,0,462,463,7,6,0,0,463,464,7,6,0,0,464,465,7,6,0,0,465,466,7,6,0,0,466,471,5,45,0,0,467,468,7,7,0,0,468,472,7,8,0,0,469,470,7,9,0,0,470,472,7,10,0,0,471,467,1,0,0,0,471,469,1,0,0,0,472,473,1,0,0,0,473,480,5,45,0,0,474,475,7,11,0,0,475,481,7,7,0,0,476,477,7,10,0,0,477,481,7,8,0,0,478,479,5,51,0,0,479,481,5,49,0,0,480,474,1,0,0,0,480,476,1,0,0,0,480,478,1,0,0,0,481,118,1,0,0,0,482,483,7,12,0,0,483,487,7,6,0,0,484,485,5,50,0,0,485,487,7,13,0,0,486,482,1,0,0,0,486,484,1,0,0,0,487,488,1,0,0,0,488,489,5,58,0,0,489,490,7,14,0,0,490,491,7,6,0,0,491,504,1,0,0,0,492,493,5,58,0,0,493,494,7,14,0,0,494,495,7,6,0,0,495,502,1,0,0,0,496,498,5,46,0,0,497,499,7,6,0,0,498,497,1,0,0,0,499,500,1,0,0,0,500,498,1,0,0,0,500,501,1,0,0,0,501,503,1,0,0,0,502,496,1,0,0,0,502,503,1,0,0,0,503,505,1,0,0,0,504,492,1,0,0,0,504,505,1,0,0,0,505,120,1,0,0,0,506,522,5,90,0,0,507,514,7,15,0,0,508,510,7,12,0,0,509,508,1,0,0,0,509,510,1,0,0,0,510,511,1,0,0,0,511,515,7,6,0,0,512,513,5,50,0,0,513,515,7,13,0,0,514,509,1,0,0,0,514,512,1,0,0,0,515,519,1,0,0,0,516,517,5,58,0,0,517,518,7,14,0,0,518,520,7,6,0,0,519,516,1,0,0,0,519,520,1,0,0,0,520,522,1,0,0,0,521,506,1,0,0,0,521,507,1,0,0,0,522,122,1,0,0,0,523,526,5,92,0,0,524,527,3,125,62,0,525,527,9,0,0,0,526,524,1,0,0,0,526,525,1,0,0,0,527,124,1,0,0,0,528,529,5,117,0,0,529,530,3,127,63,0,530,531,3,127,63,0,531,532,3,127,63,0,532,533,3,127,63,0,533,126,1,0,0,0,534,535,7,16,0,0,535,128,1,0,0,0,27,0,356,372,382,388,394,396,403,405,409,418,428,442,450,456,458,471,480,486,500,502,504,509,514,519,521,526,1,0,1,0],we.DecisionsToDFA=we._ATN.decisionToState.map(((e,t)=>new _(e,t)));class Oe extends E{constructor(e){super(e),this._interp=new x(this,Oe._ATN,Oe.DecisionsToDFA,new y)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return Oe.literalNames}get symbolicNames(){return Oe.symbolicNames}get ruleNames(){return Oe.ruleNames}get serializedATN(){return Oe._serializedATN}createFailedPredicateException(e,t){return new g(this,e,t)}root(){let e=new Ie(this,this._ctx,this.state);this.enterRule(e,0,Oe.RULE_root);try{this.enterOuterAlt(e,1),this.state=44,this.expression(0),this.state=45,this.match(Oe.EOF)}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}expression(e){void 0===e&&(e=0);let t,r=this._ctx,s=this.state,i=new Ae(this,this._ctx,s),n=i;this.enterRecursionRule(i,2,Oe.RULE_expression,e);try{let e;switch(this.enterOuterAlt(i,1),this.state=67,this._errHandler.sync(this),this._input.LA(1)){case 23:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:i=new ke(this,i),this._ctx=i,n=i,this.state=48,this.term();break;case 36:case 37:i=new be(this,i),this._ctx=i,n=i,this.state=49,this.polarOp(),this.state=50,this.expression(6);break;case 1:i=new Ce(this,i),this._ctx=i,n=i,this.state=52,this.match(Oe.T__0),this.state=53,this.expression(0),this.state=54,this.match(Oe.T__1);break;case 3:for(i=new ve(this,i),this._ctx=i,n=i,this.state=56,this.match(Oe.T__2),this.state=57,this.expression(0),this.state=62,this._errHandler.sync(this),t=this._input.LA(1);4===t;)this.state=58,this.match(Oe.T__3),this.state=59,this.expression(0),this.state=64,this._errHandler.sync(this),t=this._input.LA(1);this.state=65,this.match(Oe.T__4);break;default:throw new w(this)}for(this._ctx.stop=this._input.LT(-1),this.state=83,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx);2!==e&&e!==O.INVALID_ALT_NUMBER;){if(1===e)switch(null!=this._parseListeners&&this.triggerExitRuleEvent(),n=i,this.state=81,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,2,this._ctx)){case 1:if(i=new Ne(this,new Ae(this,r,s)),this.pushNewRecursionContext(i,2,Oe.RULE_expression),this.state=69,!this.precpred(this._ctx,5))throw this.createFailedPredicateException("this.precpred(this._ctx, 5)");this.state=70,this.arthOp(),this.state=71,this.expression(6);break;case 2:if(i=new Le(this,new Ae(this,r,s)),this.pushNewRecursionContext(i,2,Oe.RULE_expression),this.state=73,!this.precpred(this._ctx,4))throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");this.state=74,this.compOp(),this.state=75,this.expression(5);break;case 3:if(i=new Se(this,new Ae(this,r,s)),this.pushNewRecursionContext(i,2,Oe.RULE_expression),this.state=77,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=78,this.logOp(),this.state=79,this.expression(4)}this.state=85,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,3,this._ctx)}}catch(e){if(!(e instanceof R))throw e;i.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.unrollRecursionContexts(r)}return i}term(){let e=new De(this,this._ctx,this.state);this.enterRule(e,4,Oe.RULE_term);try{switch(this.state=89,this._errHandler.sync(this),this._input.LA(1)){case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 51:case 52:e=new Ue(this,e),this.enterOuterAlt(e,1),this.state=86,this.literal();break;case 50:e=new Me(this,e),this.enterOuterAlt(e,2),this.state=87,this.qualifiedIdentifier();break;case 23:e=new Pe(this,e),this.enterOuterAlt(e,3),this.state=88,this.externalConstant();break;default:throw new w(this)}}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocable(){let e=new Fe(this,this._ctx,this.state);this.enterRule(e,6,Oe.RULE_invocable);try{this.enterOuterAlt(e,1),this.state=91,this.function_()}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}invocation(){let e=new He(this,this._ctx,this.state);this.enterRule(e,8,Oe.RULE_invocation);try{e=new $e(this,e),this.enterOuterAlt(e,1),this.state=93,this.identifier()}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}indexer(){let e=new je(this,this._ctx,this.state);this.enterRule(e,10,Oe.RULE_indexer);try{switch(this.state=97,this._errHandler.sync(this),this._input.LA(1)){case 50:e=new Ge(this,e),this.enterOuterAlt(e,1),this.state=95,this.identifier();break;case 53:e=new Be(this,e),this.enterOuterAlt(e,2),this.state=96,this.match(Oe.INTEGER);break;default:throw new w(this)}}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}function_(){let e,t=new ze(this,this._ctx,this.state);this.enterRule(t,12,Oe.RULE_function);try{this.enterOuterAlt(t,1),this.state=99,this.identifier(),this.state=100,this.match(Oe.T__0),this.state=102,this._errHandler.sync(this),e=this._input.LA(1),(0==(-32&e)&&0!=(1<<e&8388618)||0==(e-36&-32)&&0!=(1<<e-36&131011))&&(this.state=101,this.paramList()),this.state=104,this.match(Oe.T__1)}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}paramList(){let e,t=new qe(this,this._ctx,this.state);this.enterRule(t,14,Oe.RULE_paramList);try{for(this.enterOuterAlt(t,1),this.state=106,this.expression(0),this.state=111,this._errHandler.sync(this),e=this._input.LA(1);4===e;)this.state=107,this.match(Oe.T__3),this.state=108,this.expression(0),this.state=113,this._errHandler.sync(this),e=this._input.LA(1)}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}unit(){let e=new Ve(this,this._ctx,this.state);this.enterRule(e,16,Oe.RULE_unit);try{switch(this.state=117,this._errHandler.sync(this),this._input.LA(1)){case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:this.enterOuterAlt(e,1),this.state=114,this.dateTimePrecision();break;case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:this.enterOuterAlt(e,2),this.state=115,this.pluralDateTimePrecision();break;case 51:this.enterOuterAlt(e,3),this.state=116,this.match(Oe.STRING);break;default:throw new w(this)}}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}dateTimePrecision(){let e,t=new We(this,this._ctx,this.state);this.enterRule(t,18,Oe.RULE_dateTimePrecision);try{this.enterOuterAlt(t,1),this.state=119,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&16320)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}pluralDateTimePrecision(){let e,t=new Qe(this,this._ctx,this.state);this.enterRule(t,20,Oe.RULE_pluralDateTimePrecision);try{this.enterOuterAlt(t,1),this.state=121,e=this._input.LA(1),0!=(-32&e)||0==(1<<e&4177920)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}qualifiedIdentifier(){let e=new Xe(this,this._ctx,this.state);this.enterRule(e,22,Oe.RULE_qualifiedIdentifier);try{let t;for(this.enterOuterAlt(e,1),this.state=128,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);2!==t&&t!==O.INVALID_ALT_NUMBER;)1===t&&(this.state=123,this.identifier(),this.state=124,this.match(Oe.T__21)),this.state=130,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,9,this._ctx);this.state=131,this.identifier()}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}externalConstant(){let e,t=new Ke(this,this._ctx,this.state);this.enterRule(t,24,Oe.RULE_externalConstant);try{this.enterOuterAlt(t,1),this.state=133,this.match(Oe.T__22),this.state=134,e=this._input.LA(1),50!==e&&51!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}identifier(){let e=new Ye(this,this._ctx,this.state);this.enterRule(e,26,Oe.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=136,this.match(Oe.IDENTIFIER)}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}literal(){let e=new Ze(this,this._ctx,this.state);this.enterRule(e,28,Oe.RULE_literal);try{switch(this.state=146,this._errHandler.sync(this),this._input.LA(1)){case 52:e=new ot(this,e),this.enterOuterAlt(e,1),this.state=138,this.match(Oe.NUMBER);break;case 45:case 46:e=new it(this,e),this.enterOuterAlt(e,2),this.state=139,this.infinity();break;case 42:case 43:e=new nt(this,e),this.enterOuterAlt(e,3),this.state=140,this.boolean_();break;case 44:e=new et(this,e),this.enterOuterAlt(e,4),this.state=141,this.null_();break;case 47:e=new st(this,e),this.enterOuterAlt(e,5),this.state=142,this.match(Oe.DATE);break;case 48:e=new tt(this,e),this.enterOuterAlt(e,6),this.state=143,this.match(Oe.DATETIME);break;case 49:e=new Je(this,e),this.enterOuterAlt(e,7),this.state=144,this.match(Oe.TIME);break;case 51:e=new rt(this,e),this.enterOuterAlt(e,8),this.state=145,this.match(Oe.STRING);break;default:throw new w(this)}}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}compOp(){let e,t=new at(this,this._ctx,this.state);this.enterRule(t,30,Oe.RULE_compOp);try{this.enterOuterAlt(t,1),this.state=148,e=this._input.LA(1),0!=(e-24&-32)||0==(1<<e-24&4095)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}arthOp(){let e,t=new ct(this,this._ctx,this.state);this.enterRule(t,32,Oe.RULE_arthOp);try{this.enterOuterAlt(t,1),this.state=150,e=this._input.LA(1),0!=(e-36&-32)||0==(1<<e-36&15)?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}polarOp(){let e,t=new ht(this,this._ctx,this.state);this.enterRule(t,34,Oe.RULE_polarOp);try{this.enterOuterAlt(t,1),this.state=152,e=this._input.LA(1),36!==e&&37!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}logOp(){let e,t=new lt(this,this._ctx,this.state);this.enterRule(t,36,Oe.RULE_logOp);try{this.enterOuterAlt(t,1),this.state=154,e=this._input.LA(1),40!==e&&41!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}boolean_(){let e,t=new ut(this,this._ctx,this.state);this.enterRule(t,38,Oe.RULE_boolean);try{this.enterOuterAlt(t,1),this.state=156,e=this._input.LA(1),42!==e&&43!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}null_(){let e=new pt(this,this._ctx,this.state);this.enterRule(e,40,Oe.RULE_null);try{this.enterOuterAlt(e,1),this.state=158,this.match(Oe.T__43)}catch(t){if(!(t instanceof R))throw t;e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.exitRule()}return e}infinity(){let e,t=new dt(this,this._ctx,this.state);this.enterRule(t,42,Oe.RULE_infinity);try{this.enterOuterAlt(t,1),this.state=160,e=this._input.LA(1),45!==e&&46!==e?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof R))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t}sempred(e,t,r){return 1!==t||this.expression_sempred(e,r)}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,5);case 1:return this.precpred(this._ctx,4);case 2:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return Oe.__ATN||(Oe.__ATN=(new T).deserialize(Oe._serializedATN)),Oe.__ATN}}Oe.T__0=1,Oe.T__1=2,Oe.T__2=3,Oe.T__3=4,Oe.T__4=5,Oe.T__5=6,Oe.T__6=7,Oe.T__7=8,Oe.T__8=9,Oe.T__9=10,Oe.T__10=11,Oe.T__11=12,Oe.T__12=13,Oe.T__13=14,Oe.T__14=15,Oe.T__15=16,Oe.T__16=17,Oe.T__17=18,Oe.T__18=19,Oe.T__19=20,Oe.T__20=21,Oe.T__21=22,Oe.T__22=23,Oe.T__23=24,Oe.T__24=25,Oe.T__25=26,Oe.T__26=27,Oe.T__27=28,Oe.T__28=29,Oe.T__29=30,Oe.T__30=31,Oe.T__31=32,Oe.T__32=33,Oe.T__33=34,Oe.T__34=35,Oe.T__35=36,Oe.T__36=37,Oe.T__37=38,Oe.T__38=39,Oe.T__39=40,Oe.T__40=41,Oe.T__41=42,Oe.T__42=43,Oe.T__43=44,Oe.T__44=45,Oe.T__45=46,Oe.DATE=47,Oe.DATETIME=48,Oe.TIME=49,Oe.IDENTIFIER=50,Oe.STRING=51,Oe.NUMBER=52,Oe.INTEGER=53,Oe.WHITESPACE=54,Oe.COMMENT=55,Oe.LINE_COMMENT=56,Oe.EOF=d.EOF,Oe.RULE_root=0,Oe.RULE_expression=1,Oe.RULE_term=2,Oe.RULE_invocable=3,Oe.RULE_invocation=4,Oe.RULE_indexer=5,Oe.RULE_function=6,Oe.RULE_paramList=7,Oe.RULE_unit=8,Oe.RULE_dateTimePrecision=9,Oe.RULE_pluralDateTimePrecision=10,Oe.RULE_qualifiedIdentifier=11,Oe.RULE_externalConstant=12,Oe.RULE_identifier=13,Oe.RULE_literal=14,Oe.RULE_compOp=15,Oe.RULE_arthOp=16,Oe.RULE_polarOp=17,Oe.RULE_logOp=18,Oe.RULE_boolean=19,Oe.RULE_null=20,Oe.RULE_infinity=21,Oe.literalNames=[null,"'('","')'","'['","','","']'","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'","'.'","'@'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'+'","'-'","'*'","'/'","'and'","'or'","'true'","'false'","'null'","'Infinity'","'infinity'"],Oe.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATE","DATETIME","TIME","IDENTIFIER","STRING","NUMBER","INTEGER","WHITESPACE","COMMENT","LINE_COMMENT"],Oe.ruleNames=["root","expression","term","invocable","invocation","indexer","function","paramList","unit","dateTimePrecision","pluralDateTimePrecision","qualifiedIdentifier","externalConstant","identifier","literal","compOp","arthOp","polarOp","logOp","boolean","null","infinity"],Oe._serializedATN=[4,1,56,163,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,61,8,1,10,1,12,1,64,9,1,1,1,1,1,3,1,68,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,82,8,1,10,1,12,1,85,9,1,1,2,1,2,1,2,3,2,90,8,2,1,3,1,3,1,4,1,4,1,5,1,5,3,5,98,8,5,1,6,1,6,1,6,3,6,103,8,6,1,6,1,6,1,7,1,7,1,7,5,7,110,8,7,10,7,12,7,113,9,7,1,8,1,8,1,8,3,8,118,8,8,1,9,1,9,1,10,1,10,1,11,1,11,1,11,5,11,127,8,11,10,11,12,11,130,9,11,1,11,1,11,1,12,1,12,1,12,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,3,14,147,8,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,0,1,2,22,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,0,9,1,0,6,13,1,0,14,21,1,0,50,51,1,0,24,35,1,0,36,39,1,0,36,37,1,0,40,41,1,0,42,43,1,0,45,46,162,0,44,1,0,0,0,2,67,1,0,0,0,4,89,1,0,0,0,6,91,1,0,0,0,8,93,1,0,0,0,10,97,1,0,0,0,12,99,1,0,0,0,14,106,1,0,0,0,16,117,1,0,0,0,18,119,1,0,0,0,20,121,1,0,0,0,22,128,1,0,0,0,24,133,1,0,0,0,26,136,1,0,0,0,28,146,1,0,0,0,30,148,1,0,0,0,32,150,1,0,0,0,34,152,1,0,0,0,36,154,1,0,0,0,38,156,1,0,0,0,40,158,1,0,0,0,42,160,1,0,0,0,44,45,3,2,1,0,45,46,5,0,0,1,46,1,1,0,0,0,47,48,6,1,-1,0,48,68,3,4,2,0,49,50,3,34,17,0,50,51,3,2,1,6,51,68,1,0,0,0,52,53,5,1,0,0,53,54,3,2,1,0,54,55,5,2,0,0,55,68,1,0,0,0,56,57,5,3,0,0,57,62,3,2,1,0,58,59,5,4,0,0,59,61,3,2,1,0,60,58,1,0,0,0,61,64,1,0,0,0,62,60,1,0,0,0,62,63,1,0,0,0,63,65,1,0,0,0,64,62,1,0,0,0,65,66,5,5,0,0,66,68,1,0,0,0,67,47,1,0,0,0,67,49,1,0,0,0,67,52,1,0,0,0,67,56,1,0,0,0,68,83,1,0,0,0,69,70,10,5,0,0,70,71,3,32,16,0,71,72,3,2,1,6,72,82,1,0,0,0,73,74,10,4,0,0,74,75,3,30,15,0,75,76,3,2,1,5,76,82,1,0,0,0,77,78,10,3,0,0,78,79,3,36,18,0,79,80,3,2,1,4,80,82,1,0,0,0,81,69,1,0,0,0,81,73,1,0,0,0,81,77,1,0,0,0,82,85,1,0,0,0,83,81,1,0,0,0,83,84,1,0,0,0,84,3,1,0,0,0,85,83,1,0,0,0,86,90,3,28,14,0,87,90,3,22,11,0,88,90,3,24,12,0,89,86,1,0,0,0,89,87,1,0,0,0,89,88,1,0,0,0,90,5,1,0,0,0,91,92,3,12,6,0,92,7,1,0,0,0,93,94,3,26,13,0,94,9,1,0,0,0,95,98,3,26,13,0,96,98,5,53,0,0,97,95,1,0,0,0,97,96,1,0,0,0,98,11,1,0,0,0,99,100,3,26,13,0,100,102,5,1,0,0,101,103,3,14,7,0,102,101,1,0,0,0,102,103,1,0,0,0,103,104,1,0,0,0,104,105,5,2,0,0,105,13,1,0,0,0,106,111,3,2,1,0,107,108,5,4,0,0,108,110,3,2,1,0,109,107,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,15,1,0,0,0,113,111,1,0,0,0,114,118,3,18,9,0,115,118,3,20,10,0,116,118,5,51,0,0,117,114,1,0,0,0,117,115,1,0,0,0,117,116,1,0,0,0,118,17,1,0,0,0,119,120,7,0,0,0,120,19,1,0,0,0,121,122,7,1,0,0,122,21,1,0,0,0,123,124,3,26,13,0,124,125,5,22,0,0,125,127,1,0,0,0,126,123,1,0,0,0,127,130,1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128,1,0,0,0,131,132,3,26,13,0,132,23,1,0,0,0,133,134,5,23,0,0,134,135,7,2,0,0,135,25,1,0,0,0,136,137,5,50,0,0,137,27,1,0,0,0,138,147,5,52,0,0,139,147,3,42,21,0,140,147,3,38,19,0,141,147,3,40,20,0,142,147,5,47,0,0,143,147,5,48,0,0,144,147,5,49,0,0,145,147,5,51,0,0,146,138,1,0,0,0,146,139,1,0,0,0,146,140,1,0,0,0,146,141,1,0,0,0,146,142,1,0,0,0,146,143,1,0,0,0,146,144,1,0,0,0,146,145,1,0,0,0,147,29,1,0,0,0,148,149,7,3,0,0,149,31,1,0,0,0,150,151,7,4,0,0,151,33,1,0,0,0,152,153,7,5,0,0,153,35,1,0,0,0,154,155,7,6,0,0,155,37,1,0,0,0,156,157,7,7,0,0,157,39,1,0,0,0,158,159,5,44,0,0,159,41,1,0,0,0,160,161,7,8,0,0,161,43,1,0,0,0,11,62,67,81,83,89,97,102,111,117,128,146],Oe.DecisionsToDFA=Oe._ATN.decisionToState.map(((e,t)=>new _(e,t)));class Ie extends I{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(Ae,0)}EOF(){return this.getToken(Oe.EOF,0)}get ruleIndex(){return Oe.RULE_root}enterRule(e){e.enterRoot&&e.enterRoot(this)}exitRule(e){e.exitRoot&&e.exitRoot(this)}accept(e){return e.visitRoot?e.visitRoot(this):e.visitChildren(this)}}class Ae extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_expression}copyFrom(e){super.copyFrom(e)}}class Ce extends Ae{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(Ae,0)}enterRule(e){e.enterParenthesizedExpression&&e.enterParenthesizedExpression(this)}exitRule(e){e.exitParenthesizedExpression&&e.exitParenthesizedExpression(this)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}}class ve extends Ae{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ae)}expression(e){return this.getTypedRuleContext(Ae,e)}enterRule(e){e.enterArrayExpression&&e.enterArrayExpression(this)}exitRule(e){e.exitArrayExpression&&e.exitArrayExpression(this)}accept(e){return e.visitArrayExpression?e.visitArrayExpression(this):e.visitChildren(this)}}class be extends Ae{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}polarOp(){return this.getTypedRuleContext(ht,0)}expression(){return this.getTypedRuleContext(Ae,0)}enterRule(e){e.enterPolarityExpression&&e.enterPolarityExpression(this)}exitRule(e){e.exitPolarityExpression&&e.exitPolarityExpression(this)}accept(e){return e.visitPolarityExpression?e.visitPolarityExpression(this):e.visitChildren(this)}}class Le extends Ae{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ae)}expression(e){return this.getTypedRuleContext(Ae,e)}compOp(){return this.getTypedRuleContext(at,0)}enterRule(e){e.enterComparisonExpression&&e.enterComparisonExpression(this)}exitRule(e){e.exitComparisonExpression&&e.exitComparisonExpression(this)}accept(e){return e.visitComparisonExpression?e.visitComparisonExpression(this):e.visitChildren(this)}}class Ne extends Ae{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ae)}expression(e){return this.getTypedRuleContext(Ae,e)}arthOp(){return this.getTypedRuleContext(ct,0)}enterRule(e){e.enterArithmeticExpression&&e.enterArithmeticExpression(this)}exitRule(e){e.exitArithmeticExpression&&e.exitArithmeticExpression(this)}accept(e){return e.visitArithmeticExpression?e.visitArithmeticExpression(this):e.visitChildren(this)}}class Se extends Ae{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Ae)}expression(e){return this.getTypedRuleContext(Ae,e)}logOp(){return this.getTypedRuleContext(lt,0)}enterRule(e){e.enterLogicalExpression&&e.enterLogicalExpression(this)}exitRule(e){e.exitLogicalExpression&&e.exitLogicalExpression(this)}accept(e){return e.visitLogicalExpression?e.visitLogicalExpression(this):e.visitChildren(this)}}class ke extends Ae{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}term(){return this.getTypedRuleContext(De,0)}enterRule(e){e.enterTermExpression&&e.enterTermExpression(this)}exitRule(e){e.exitTermExpression&&e.exitTermExpression(this)}accept(e){return e.visitTermExpression?e.visitTermExpression(this):e.visitChildren(this)}}class De extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_term}copyFrom(e){super.copyFrom(e)}}class Pe extends De{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}externalConstant(){return this.getTypedRuleContext(Ke,0)}enterRule(e){e.enterExternalConstantTerm&&e.enterExternalConstantTerm(this)}exitRule(e){e.exitExternalConstantTerm&&e.exitExternalConstantTerm(this)}accept(e){return e.visitExternalConstantTerm?e.visitExternalConstantTerm(this):e.visitChildren(this)}}class Ue extends De{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}literal(){return this.getTypedRuleContext(Ze,0)}enterRule(e){e.enterLiteralTerm&&e.enterLiteralTerm(this)}exitRule(e){e.exitLiteralTerm&&e.exitLiteralTerm(this)}accept(e){return e.visitLiteralTerm?e.visitLiteralTerm(this):e.visitChildren(this)}}class Me extends De{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}qualifiedIdentifier(){return this.getTypedRuleContext(Xe,0)}enterRule(e){e.enterQualifiedIdentifierTerm&&e.enterQualifiedIdentifierTerm(this)}exitRule(e){e.exitQualifiedIdentifierTerm&&e.exitQualifiedIdentifierTerm(this)}accept(e){return e.visitQualifiedIdentifierTerm?e.visitQualifiedIdentifierTerm(this):e.visitChildren(this)}}class Fe extends I{constructor(e,t,r){super(t,r),this.parser=e}function_(){return this.getTypedRuleContext(ze,0)}get ruleIndex(){return Oe.RULE_invocable}enterRule(e){e.enterInvocable&&e.enterInvocable(this)}exitRule(e){e.exitInvocable&&e.exitInvocable(this)}accept(e){return e.visitInvocable?e.visitInvocable(this):e.visitChildren(this)}}class He extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_invocation}copyFrom(e){super.copyFrom(e)}}class $e extends He{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(Ye,0)}enterRule(e){e.enterMemberInvocation&&e.enterMemberInvocation(this)}exitRule(e){e.exitMemberInvocation&&e.exitMemberInvocation(this)}accept(e){return e.visitMemberInvocation?e.visitMemberInvocation(this):e.visitChildren(this)}}class je extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_indexer}copyFrom(e){super.copyFrom(e)}}class Be extends je{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}INTEGER(){return this.getToken(Oe.INTEGER,0)}enterRule(e){e.enterNumberIndex&&e.enterNumberIndex(this)}exitRule(e){e.exitNumberIndex&&e.exitNumberIndex(this)}accept(e){return e.visitNumberIndex?e.visitNumberIndex(this):e.visitChildren(this)}}class Ge extends je{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}identifier(){return this.getTypedRuleContext(Ye,0)}enterRule(e){e.enterMemberIndex&&e.enterMemberIndex(this)}exitRule(e){e.exitMemberIndex&&e.exitMemberIndex(this)}accept(e){return e.visitMemberIndex?e.visitMemberIndex(this):e.visitChildren(this)}}class ze extends I{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(Ye,0)}paramList(){return this.getTypedRuleContext(qe,0)}get ruleIndex(){return Oe.RULE_function}enterRule(e){e.enterFunction&&e.enterFunction(this)}exitRule(e){e.exitFunction&&e.exitFunction(this)}accept(e){return e.visitFunction?e.visitFunction(this):e.visitChildren(this)}}class qe extends I{constructor(e,t,r){super(t,r),this.parser=e}expression_list(){return this.getTypedRuleContexts(Ae)}expression(e){return this.getTypedRuleContext(Ae,e)}get ruleIndex(){return Oe.RULE_paramList}enterRule(e){e.enterParamList&&e.enterParamList(this)}exitRule(e){e.exitParamList&&e.exitParamList(this)}accept(e){return e.visitParamList?e.visitParamList(this):e.visitChildren(this)}}class Ve extends I{constructor(e,t,r){super(t,r),this.parser=e}dateTimePrecision(){return this.getTypedRuleContext(We,0)}pluralDateTimePrecision(){return this.getTypedRuleContext(Qe,0)}STRING(){return this.getToken(Oe.STRING,0)}get ruleIndex(){return Oe.RULE_unit}enterRule(e){e.enterUnit&&e.enterUnit(this)}exitRule(e){e.exitUnit&&e.exitUnit(this)}accept(e){return e.visitUnit?e.visitUnit(this):e.visitChildren(this)}}class We extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_dateTimePrecision}enterRule(e){e.enterDateTimePrecision&&e.enterDateTimePrecision(this)}exitRule(e){e.exitDateTimePrecision&&e.exitDateTimePrecision(this)}accept(e){return e.visitDateTimePrecision?e.visitDateTimePrecision(this):e.visitChildren(this)}}class Qe extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_pluralDateTimePrecision}enterRule(e){e.enterPluralDateTimePrecision&&e.enterPluralDateTimePrecision(this)}exitRule(e){e.exitPluralDateTimePrecision&&e.exitPluralDateTimePrecision(this)}accept(e){return e.visitPluralDateTimePrecision?e.visitPluralDateTimePrecision(this):e.visitChildren(this)}}class Xe extends I{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(Ye)}identifier(e){return this.getTypedRuleContext(Ye,e)}get ruleIndex(){return Oe.RULE_qualifiedIdentifier}enterRule(e){e.enterQualifiedIdentifier&&e.enterQualifiedIdentifier(this)}exitRule(e){e.exitQualifiedIdentifier&&e.exitQualifiedIdentifier(this)}accept(e){return e.visitQualifiedIdentifier?e.visitQualifiedIdentifier(this):e.visitChildren(this)}}class Ke extends I{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(Oe.IDENTIFIER,0)}STRING(){return this.getToken(Oe.STRING,0)}get ruleIndex(){return Oe.RULE_externalConstant}enterRule(e){e.enterExternalConstant&&e.enterExternalConstant(this)}exitRule(e){e.exitExternalConstant&&e.exitExternalConstant(this)}accept(e){return e.visitExternalConstant?e.visitExternalConstant(this):e.visitChildren(this)}}class Ye extends I{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(Oe.IDENTIFIER,0)}get ruleIndex(){return Oe.RULE_identifier}enterRule(e){e.enterIdentifier&&e.enterIdentifier(this)}exitRule(e){e.exitIdentifier&&e.exitIdentifier(this)}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}}class Ze extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_literal}copyFrom(e){super.copyFrom(e)}}class Je extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(Oe.TIME,0)}enterRule(e){e.enterTimeLiteral&&e.enterTimeLiteral(this)}exitRule(e){e.exitTimeLiteral&&e.exitTimeLiteral(this)}accept(e){return e.visitTimeLiteral?e.visitTimeLiteral(this):e.visitChildren(this)}}class et extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(pt,0)}enterRule(e){e.enterNullLiteral&&e.enterNullLiteral(this)}exitRule(e){e.exitNullLiteral&&e.exitNullLiteral(this)}accept(e){return e.visitNullLiteral?e.visitNullLiteral(this):e.visitChildren(this)}}class tt extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(Oe.DATETIME,0)}enterRule(e){e.enterDateTimeLiteral&&e.enterDateTimeLiteral(this)}exitRule(e){e.exitDateTimeLiteral&&e.exitDateTimeLiteral(this)}accept(e){return e.visitDateTimeLiteral?e.visitDateTimeLiteral(this):e.visitChildren(this)}}class rt extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(Oe.STRING,0)}enterRule(e){e.enterStringLiteral&&e.enterStringLiteral(this)}exitRule(e){e.exitStringLiteral&&e.exitStringLiteral(this)}accept(e){return e.visitStringLiteral?e.visitStringLiteral(this):e.visitChildren(this)}}class st extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(Oe.DATE,0)}enterRule(e){e.enterDateLiteral&&e.enterDateLiteral(this)}exitRule(e){e.exitDateLiteral&&e.exitDateLiteral(this)}accept(e){return e.visitDateLiteral?e.visitDateLiteral(this):e.visitChildren(this)}}class it extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(dt,0)}enterRule(e){e.enterInfinityLiteral&&e.enterInfinityLiteral(this)}exitRule(e){e.exitInfinityLiteral&&e.exitInfinityLiteral(this)}accept(e){return e.visitInfinityLiteral?e.visitInfinityLiteral(this):e.visitChildren(this)}}class nt extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(ut,0)}enterRule(e){e.enterBooleanLiteral&&e.enterBooleanLiteral(this)}exitRule(e){e.exitBooleanLiteral&&e.exitBooleanLiteral(this)}accept(e){return e.visitBooleanLiteral?e.visitBooleanLiteral(this):e.visitChildren(this)}}class ot extends Ze{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(Oe.NUMBER,0)}enterRule(e){e.enterNumberLiteral&&e.enterNumberLiteral(this)}exitRule(e){e.exitNumberLiteral&&e.exitNumberLiteral(this)}accept(e){return e.visitNumberLiteral?e.visitNumberLiteral(this):e.visitChildren(this)}}class at extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_compOp}enterRule(e){e.enterCompOp&&e.enterCompOp(this)}exitRule(e){e.exitCompOp&&e.exitCompOp(this)}accept(e){return e.visitCompOp?e.visitCompOp(this):e.visitChildren(this)}}class ct extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_arthOp}enterRule(e){e.enterArthOp&&e.enterArthOp(this)}exitRule(e){e.exitArthOp&&e.exitArthOp(this)}accept(e){return e.visitArthOp?e.visitArthOp(this):e.visitChildren(this)}}class ht extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_polarOp}enterRule(e){e.enterPolarOp&&e.enterPolarOp(this)}exitRule(e){e.exitPolarOp&&e.exitPolarOp(this)}accept(e){return e.visitPolarOp?e.visitPolarOp(this):e.visitChildren(this)}}class lt extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_logOp}enterRule(e){e.enterLogOp&&e.enterLogOp(this)}exitRule(e){e.exitLogOp&&e.exitLogOp(this)}accept(e){return e.visitLogOp?e.visitLogOp(this):e.visitChildren(this)}}class ut extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_boolean}enterRule(e){e.enterBoolean&&e.enterBoolean(this)}exitRule(e){e.exitBoolean&&e.exitBoolean(this)}accept(e){return e.visitBoolean?e.visitBoolean(this):e.visitChildren(this)}}class pt extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_null}enterRule(e){e.enterNull&&e.enterNull(this)}exitRule(e){e.exitNull&&e.exitNull(this)}accept(e){return e.visitNull?e.visitNull(this):e.visitChildren(this)}}class dt extends I{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return Oe.RULE_infinity}enterRule(e){e.enterInfinity&&e.enterInfinity(this)}exitRule(e){e.exitInfinity&&e.exitInfinity(this)}accept(e){return e.visitInfinity?e.visitInfinity(this):e.visitChildren(this)}}class _t extends Y{constructor(e){super(""+e)}toString(){return"@"+super.toString()}}const ft=p.tree.ParseTreeVisitor;class mt extends ft{constructor(e){super(),this._timeZone=e?.timeZone}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitIdentifier(e){return e.getText()}visitNullLiteral(){return new me}visitBooleanLiteral(e){return new ne("true"===e.getText())}visitNumberLiteral(e){return new ye(e.getText())}visitStringLiteral(e){return new Ee(de(e.getText()))}visitInfinityLiteral(){return new ye(1/0)}visitDateLiteral(e){return new fe(de(e.getText()))}visitDateTimeLiteral(e){return new fe(de(e.getText()))}visitTimeLiteral(e){return new ge(de(e.getText()))}visitQualifiedIdentifierTerm(e){return new Te(e.getText())}visitPolarityExpression(e){const t=this.visit(e.expression());if("NumberLiteral"===t.kind)return"-"===e.polarOp().getText()&&(t.value*=-1),t;throw new oe('Unexpected token "'+e.getText()+'"')}visitExternalConstantTerm(e){return new _t(e.externalConstant().getText().substring(1))}visitParenthesizedExpression(e){const t=this.visit(e.expression());return new ie(t)}visitArrayExpression(e){return new ee(e.expression_list().map((e=>this.visit(e))))}visitComparisonExpression(e){return new re({op:e.compOp().getText(),left:this.visit(e.expression(0)),right:this.visit(e.expression(1))})}visitLogicalExpression(e){const t=[],r=(e,s)=>{for(const i of e){if(i instanceof Se&&i.logOp().getText()===s){r(i.expression_list(),i.logOp().getText());continue}const e=this.visit(i);t.push(e)}};return r(e.expression_list(),e.logOp().getText()),new se({op:e.logOp().getText(),items:t})}visitArithmeticExpression(e){const t=new Z,r=(e,s)=>{for(let i=0,n=e.length;i<n;i++){const n=e[i];if(n instanceof Ne){r(n.expression_list(),n.arthOp().getText());continue}const o=this.visit(n);t.append(s||"+",o)}};return r(e.expression_list(),e.arthOp().getText()),t}}class yt extends A{constructor(e){super(),this.errors=e}syntaxError(e,t,r,s,i,n){this.errors.push(new ce(i,{recognizer:e,offendingSymbol:t,line:r,e:n}))}}var Tt,Et;!function(e){e.X_Opra_Version="X-Opra-Version",e.X_Opra_DataType="X-Opra-DataType",e.X_Opra_Count="X-Opra-Count",e.WWW_Authenticate="WWW-Authenticate",e.Authorization="Authorization",e.Proxy_Authenticate="Proxy-Authenticate",e.Proxy_Authorization="Proxy-Authorization",e.Age="Age",e.Cache_Control="Cache-Control",e.Clear_Site_Data="Clear-Site-Data",e.Expires="Expires",e.Pragma="Pragma",e.Last_Modified="Last-Modified",e.ETag="ETag",e.If_Match="If-Match",e.If_None_Match="If-None-Match",e.If_Modified_Since="If-Modified-Since",e.If_Unmodified_Since="If-Unmodified-Since",e.Vary="Vary",e.Connection="Connection",e.Keep_Alive="Keep-Alive",e.Accept="Accept",e.Accept_Encoding="Accept-Encoding",e.Accept_Language="Accept-Language",e.Expect="Expect",e.Cookie="Cookie",e.Set_Cookie="Set-Cookie",e.Access_Control_Allow_Origin="Access-Control-Allow-Origin",e.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",e.Access_Control_Allow_Headers="Access-Control-Allow-Headers",e.Access_Control_Allow_Methods="Access-Control-Allow-Methods",e.Access_Control_Expose_Headers="Access-Control-Expose-Headers",e.Access_Control_Max_Age="Access-Control-Max-Age",e.Access_Control_Request_Headers="Access-Control-Request-Headers",e.Access_Control_Request_Method="Access-Control-Request-Method",e.Origin="Origin",e.Timing_Allow_Origin="Timing-Allow-Origin",e.Content_Disposition="Content-Disposition",e.Content_ID="Content-ID",e.Content_Length="Content-Length",e.Content_Type="Content-Type",e.Content_Transfer_Encoding="Content-Transfer-Encoding",e.Content_Encoding="Content-Encoding",e.Content_Language="Content-Language",e.Content_Location="Content-Location",e.Forwarded="Forwarded",e.X_Forwarded_For="X-Forwarded-For",e.X_Forwarded_Host="X-Forwarded-Host",e.X_Forwarded_Proto="X-Forwarded-Proto",e.Via="Via",e.Location="Location",e.From="From",e.Host="Host",e.Referer="Referer",e.Referrer_Policy="Referrer-Policy",e.User_Agent="User-Agent",e.Allow="Allow",e.Server="Server",e.Accept_Ranges="Accept-Ranges",e.Range="Range",e.If_Range="If-Range",e.Content_Range="Content-Range",e.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",e.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",e.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",e.Content_Security_Policy="Content-Security-Policy",e.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",e.Expect_CT="Expect-CT",e.Feature_Policy="Feature-Policy",e.Strict_Transport_Security="Strict-Transport-Security",e.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",e.X_Content_Type_Options="X-Content-Type-Options",e.X_Download_Options="X-Download-Options",e.X_Frame_Options="X-Frame-Options",e.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",e.X_Powered_By="X-Powered-By",e.X_XSS_Protection="X-XSS-Protection",e.Transfer_Encoding="Transfer-Encoding",e.TE="TE",e.Trailer="Trailer",e.Sec_WebSocket_Key="Sec-WebSocket-Key",e.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",e.Sec_WebSocket_Accept="Sec-WebSocket-Accept",e.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",e.Sec_WebSocket_Version="Sec-WebSocket-Version",e.Date="Date",e.Retry_After="Retry-After",e.Server_Timing="Server-Timing",e.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control"}(Tt||(Tt={})),function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLYHINTS=103]="EARLYHINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.AMBIGUOUS=300]="AMBIGUOUS",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.TOO_EARLY=425]="TOO_EARLY",e[e.UPGRADE_REQUIRED=428]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(Et||(Et={}));const xt=Object.keys(Tt),gt=xt.map((e=>e.toLowerCase()));function Rt(e,t){return e&&Object.keys(e).reduce(((r,s)=>{const i=e[s],n=t?xt[gt.indexOf(s.toLowerCase())]||s.replace(/(^\w|[A-Z]|\b\w)/g,(function(e){return e.toUpperCase()})):s.toLowerCase();return"set-cookie"===s.toLowerCase()?r[n]=Array.isArray(i)?i:[i]:r[n]=Array.isArray(i)?i.join(";"):i,r}),{})||{}}class wt{constructor(e){this.method=e.method,this.url=encodeURI(decodeURI(e.url)),this.headers=e.headers,this.data=e.data}}class Ot{constructor(e){this.status=e.status,this.headers=e.headers,this.data=e.data}}const It="\r\n",At=/ *charset=./i;class Ct{constructor(){this._parts=[],this.boundary="batch_"+L(12)}addRequestPart(e,t){const r={...Rt(t?.headers||{},!0),[Tt.Content_Type]:"application/http",[Tt.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Tt.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new wt(e)}),this}addHttpResponse(e,t){const r={...Rt(t?.headers||{},!0),[Tt.Content_Type]:"application/http",[Tt.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Tt.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:new Ot(e)}),this}addBatch(e,t){const r={...Rt(t?.headers||{},!0),[Tt.Content_Type]:"application/http",[Tt.Content_Transfer_Encoding]:"binary"};return t?.contentId&&(r[Tt.Content_ID]=t.contentId),this._parts.push({headers:r,contentId:t?.contentId,content:e}),this}stream(){const e=[];return this._build(e),b(e).flatten().toNodeStream()}_build(t){for(const r of this._parts){if(!(r.content instanceof wt||r.content instanceof Ot))throw new Error("Not implemented yet");{let s=r.content.data,i=0;const n=Rt(r.content.headers);if(s){const t=String(n["content-type"]||"").split(/\s*;\s*/);let r="";if(F(s)?i=parseInt(String(n["content-length"]),10)||0:"object"==typeof s?"function"==typeof s.stream?(t[0]=s.type||"binary",i=s.size,s=s.stream()):e.isBuffer(s)?n["content-length"]=String(s.length):(t[0]=t[0]||"application/json",r="utf-8",s=e.from(JSON.stringify(s),"utf-8"),i=s.length):(t[0]=t[0]||"text/plain",r="utf-8",s=e.from(String(s),"utf-8"),i=s.length),t[0]){if(r){const e=t.findIndex((e=>At.test(String(e))));e>0?t[e]="charset="+r:t.join("charset="+r)}n["content-type"]=t.join(";")}i&&(n["content-length"]=String(i))}let o="--"+this.boundary+It;for(const[e,t]of Object.entries(r.headers))""!==t&&null!=t&&(o+=e+": "+(Array.isArray(t)?t.join(";"):t)+It);if(o+=It,r.content instanceof wt?o+=(r.content.method||"GET").toUpperCase()+" "+r.content.url+" HTTP/1.1"+It:o+="HTTP/1.1 "+r.content.status+(Et[r.content.status]||"Unknown")+It,r.content.headers)for(const[e,t]of Object.entries(r.content.headers))""!==t&&null!=t&&("set-cookie"===e&&Array.isArray(t)?t.forEach((t=>o+=e+": "+t)):o+=e+": "+(Array.isArray(t)?t.join(";"):t)+It);o+=It,t.push(e.from(o,"utf-8")),s&&(t.push(s),t.push(e.from(It+It)))}}t.push(e.from("--"+this.boundary+"--"+It,"utf-8"))}}const vt="opra:complex_type.fields",bt="opra:resolver.metadata",Lt="opra:ignore_resolver-method",Nt="opra:mapped_type.metadata",St=["create","delete","get","update"],kt=[...St,"count","deleteMany","updateMany","search"];var Dt;!function(e){e.Version="1.0",e.isDataType=function(e){return e&&"object"==typeof e&&("ComplexType"===e.kind||"SimpleType"===e.kind||"UnionType"===e.kind)},e.isComplexType=function(e){return e&&"object"==typeof e&&"ComplexType"===e.kind},e.isSimpleType=function(e){return e&&"object"==typeof e&&"SimpleType"===e.kind},e.isUnionTypee=function(e){return e&&"object"==typeof e&&"UnionType"===e.kind},e.isResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind||"CollectionResource"===e.kind||"SingletonResource"===e.kind},e.isCollectionResource=function(e){return e&&"object"==typeof e&&"CollectionResource"===e.kind},e.isSingletonResource=function(e){return e&&"object"==typeof e&&"SingletonResource"===e.kind},e.isContainerResource=function(e){return e&&"object"==typeof e&&"ContainerResource"===e.kind}}(Dt||(Dt={}));class Pt extends Map{constructor(e,t){super(),this._keyMap=new Map,this._keyOrder=[],this._wellKnownKeyMap=new Map,t&&t.forEach((e=>this._wellKnownKeyMap.set(e.toLowerCase(),e))),"function"==typeof e?.forEach?e.forEach(((e,t)=>this.set(t,e))):e&&"object"==typeof e&&Object.keys(e).forEach((t=>this.set(t,e[t])))}clear(){super.clear(),this._keyMap.clear(),this._keyOrder=[]}get(e){const t=this._getOriginalKey(e);return super.get(t)}has(e){return this._keyMap.has(this._getLowerKey(e))}set(e,t){return e=this._getOriginalKey(e),this._keyMap.set(this._getLowerKey(e),e),this._keyOrder.includes(e)||this._keyOrder.push(e),super.set(e,t)}keys(){return this._keyOrder.values()}values(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:r.get(t[e])})}}entries(){let e=-1;const t=this._keyOrder,r=this;return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],r.get(t[e])]})}}delete(e){const t=this._getOriginalKey(e),r=this._getLowerKey(e);this._keyMap.delete(r);const s=this._keyOrder.indexOf(t);return s>=0&&this._keyOrder.splice(s,1),super.delete(t)}sort(e){return this._keyOrder.sort(e),this}[Symbol.iterator](){return this.entries()}_getOriginalKey(e){return"string"==typeof e?this._keyMap.get(e.toLowerCase())??this._wellKnownKeyMap.get(e.toLowerCase())??e:e}_getLowerKey(e){return"string"==typeof e?e.toLowerCase():e}}function Ut(e){return"function"==typeof e&&!(!e.prototype||!e.prototype.constructor)}const Mt={kind:"UnionType",description:"Any value",ctor:Object,types:[]},Ft={kind:"SimpleType",description:"A stream of bytes, base64 encoded",ctor:Object.getPrototypeOf(e.from("")).constructor,parse:t=>e.from(t),serialize:t=>e.isBuffer(t)?t.toString("base64"):void 0},Ht={kind:"SimpleType",description:"BigInt number",ctor:Object.getPrototypeOf(BigInt(0)).constructor,parse:e=>BigInt(e),serialize:e=>String(e)},$t={kind:"SimpleType",description:"Simple true/false value",ctor:Boolean,parse:e=>a(e),serialize:e=>a(e)},jt={kind:"SimpleType",description:"A date, date-time or partial date",ctor:String,parse:e=>c(e),serialize:e=>String(e)},Bt={kind:"SimpleType",description:"A date, date-time or partial date in string format",ctor:String,parse:e=>h(e),serialize:e=>h(e)},Gt={kind:"SimpleType",description:"A guid value",ctor:String,parse:e=>h(e),serialize:e=>h(e)},zt={kind:"SimpleType",description:"An integer number",ctor:Number,parse:e=>l(e),serialize:e=>l(e)},qt={kind:"SimpleType",description:"Both Integer as well as Floating-Point numbers",ctor:Number,parse:e=>u(e),serialize:e=>u(e)},Vt={kind:"ComplexType",description:"A non modelled object",ctor:Object,additionalFields:!0,parse:e=>e,serialize:e=>e},Wt={kind:"SimpleType",description:"A sequence of characters",ctor:String,parse:e=>h(e),serialize:e=>h(e)},Qt=Object.getPrototypeOf(BigInt(0)).constructor,Xt=Object.getPrototypeOf(e.from("")).constructor,Kt=new Pt;Kt.set("any",Mt),Kt.set("base64Binary",Ft),Kt.set("bigint",Ht),Kt.set("boolean",$t),Kt.set("date",jt),Kt.set("dateString",Bt),Kt.set("guid",Gt),Kt.set("integer",zt),Kt.set("number",qt),Kt.set("object",Vt),Kt.set("string",Wt);const Yt=new Map;function Zt(e,t){return D({},e,{deep:!0,clone:!0,filter:(e,r)=>{const s=e[r];return null!=s&&!t||"function"!=typeof s&&("object"!=typeof s||k(s)||Array.isArray(s))}})}async function Jt(e){const t=Object.getPrototypeOf(e).constructor,r=Reflect.getMetadata("opra:resource.metadata",t);if(!r)throw new TypeError(`Class "${t.name}" doesn't have "Resource" metadata information`);const s=Zt(r);if(s.instance=e,s.name=r.name||t.name.replace(/(Resource|Controller)$/,""),Dt.isCollectionResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let s,i;const n=(e,t)=>{i=e[t],s=Reflect.getMetadata(bt,e,t),null==i&&s&&(e=Object.getPrototypeOf(e),i=e[t])};for(const o of kt){if(n(t,o),"function"!=typeof i)continue;const a=e[o]={...s};Reflect.hasMetadata(Lt,r.constructor,o)||(a.handler=i.bind(t),i=t["pre_"+o],"function"==typeof i&&(e["pre_"+o]=i.bind(t)))}return e}(s);if(Dt.isSingletonResource(r))return await async function(e){const t=e.instance,r=Object.getPrototypeOf(e.instance);let s,i;const n=(e,t)=>{i=e[t],s=Reflect.getMetadata(bt,e,t),null==i&&s&&(e=Object.getPrototypeOf(e),i=e[t])};for(const o of St){if(n(t,o),"function"!=typeof i)continue;const a=e[o]={...s};Reflect.hasMetadata(Lt,r.constructor,o)||(a.handler=i.bind(t),i=t["pre_"+o],"function"==typeof i&&(e["pre_"+o]=i.bind(t)))}return e}(s);throw new TypeError("Invalid Resource metadata")}Yt.set(Boolean,"boolean"),Yt.set(String,"string"),Yt.set(Number,"number"),Yt.set(Date,"date"),Yt.set(Qt,"bigint"),Yt.set(Xt,"base64Binary"),Yt.set(Object,"object");const er=Symbol.for("opra.optional-lib.sqb-connect");async function tr(e){const t=Reflect.getMetadata("opra:data_type.metadata",e);if(!t)throw new TypeError(`Class "${e}" doesn't have "DataType" metadata information`);if(Dt.isComplexType(t))return await async function(e,t){const r=Zt(t);r.ctor=e;const s=Reflect.getMetadata(Nt,e);s&&(r.extends=[...s.map((e=>Zt(e)))]);const i=Reflect.getMetadata(vt,e);if(i){r.fields=Zt(i);for(const[t,s]of Object.entries(r.fields)){if("function"==typeof s.type){const e=Yt.get(s.type);e&&(s.type=e)}const r=globalThis[er]?.SqbConnect;let i;if(r){const{EntityMetadata:n,isAssociationField:o}=r,a=n.get(e);if(i=a&&n.getField(a,t),i){if((s.type===Function||"object"===s.type||s.type===Object||"any"===s.type)&&(s.type="any",o(i))){i.association.returnsMany()||delete s.isArray;const e=await i.association.resolveTarget();e&&(s.type=e.ctor)}i.exclusive&&void 0===s.exclusive&&(s.exclusive=i.exclusive)}}if(i&&"column"===i.kind){const e=r.DataType;if("number"===s.type||s.type===Number)switch(i.dataType){case e.INTEGER:case e.SMALLINT:s.type="integer";break;case e.BIGINT:s.type="bigint"}else if(("string"===s.type||s.type===String)&&i.dataType===e.GUID)s.type="guid";i.notNull&&void 0===s.required&&(s.required=i.notNull),i.exclusive&&void 0===s.exclusive&&(s.exclusive=i.exclusive),void 0!==i.default&&void 0===s.default&&(s.default=i.default)}}}return r}(e,t);if(Dt.isSimpleType(t))return await async function(e,t){const r=Zt(t);return r.ctor=e,r}(e,t);throw new TypeError("Invalid DataType metadata")}const rr=Symbol.for("opra.optional-lib.sqb-connect");class sr{constructor(e){this._dataTypes=new Pt,this._resources=new Pt,this._args=e}buildSchema(){const e={...this._args,version:Dt.Version};return this._dataTypes.size&&(e.types=Array.from(this._dataTypes.keys()).sort().reduce(((e,t)=>(e[t]=this._dataTypes.get(t),e)),{})),this._resources.size&&(e.resources=Array.from(this._resources.keys()).sort().reduce(((e,t)=>(e[t]=this._resources.get(t),e)),{})),e}async addDataTypeSchema(e,t){if(!Dt.isDataType(t))throw new TypeError("Invalid DataType schema");const r=this._dataTypes.get(e);if(r){if(r.kind!==t.kind||!r.ctor||r.ctor!==t.ctor)throw new Error(`An other instance of "${e}" data type previously defined`)}else if(this._dataTypes.set(e,t),Dt.isComplexType(t)){if(t.extends)for(const e of t.extends)"string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type));if(t.fields)for(const e of Object.values(t.fields))e.type=e.type||"string","string"!=typeof e.type&&(e.type=await this.addDataTypeClass(e.type))}}async addDataTypeClass(e){if(!Ut(e=S.isPromise(e)?await e:e))return this.addDataTypeClass(e());const t=Yt.get(e);if(t)return t;const r=await tr(e),s=r.name,i=r;return delete i.name,await this.addDataTypeSchema(s,i),s}async addResourceSchema(e,t){if(!Dt.isResource(t))throw new TypeError("Invalid Resource schema");if(this._resources.has(e))throw new Error(`An other instance of "${e}" resource previously defined`);if(Dt.isCollectionResource(t)||Dt.isSingletonResource(t)){const e="function"==typeof t.type?await this.addDataTypeClass(t.type):t.type;if(t.type=e,!this._dataTypes.has(t.type)&&!Kt.has(t.type))throw new Error(`Resource registration error. Type "${t.type}" not found.`)}if(Dt.isCollectionResource(t)&&!t.keyFields){const r=this._dataTypes.get(t.type),s=globalThis[rr]?.SqbConnect;if(s&&r?.ctor){const e=s.EntityMetadata.get(r?.ctor);if(e?.indexes){const r=e.indexes.find((e=>e.primary));r&&(t.keyFields=r.columns)}}if(t.keyFields=Array.isArray(t.keyFields)?t.keyFields.length?t.keyFields:"":t.keyFields,!t.keyFields)throw new TypeError(`You must provide keyFields for "${e}" entity resource`)}this._resources.set(e,t)}async addResourceInstance(e){let t;"function"==typeof(e=S.isPromise(e)?await e:e)?Ut(e)?(t={},Object.setPrototypeOf(t,e.prototype)):t=await e():t=e;const r=await Jt(t),s=r.name,i=r;return delete i.name,await this.addResourceSchema(s,i),s}}function ir(e,t){return e<t?-1:e>t?1:0}const nr=Symbol.for("nodejs.util.inspect.custom"),or="[0m",ar="[33m",cr="[35m";class hr{constructor(e,t,r){this._document=e,this._name=t,this._metadata=r}get document(){return this._document}get kind(){return this._metadata.kind}get name(){return this._name}get description(){return this._metadata.description}get ctor(){return this._metadata.ctor}parse(e){return this._metadata.parse?this._metadata.parse(e):e}getSchema(e){return Zt(this._metadata,e)}}class lr extends hr{constructor(e,t,r){super(e,t,{kind:"ComplexType",...r}),this._initialized=!1,this.ownFields=new Pt,this.fields=new Pt}get abstract(){return!!this._metadata.abstract}get additionalFields(){return this._metadata.additionalFields||this._mixinAdditionalFields}get extends(){return this._metadata.extends}getField(e){if(e.includes(".")){let t=this;const r=e.split(".");let s;for(const e of r)s=t.getField(e),t=t.document.getDataType(s.type||"string");return s}const t=this.fields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have a field named "${e}"`);return t}getFieldType(e){const t=this.getField(e);return this.document.getDataType(t.type||"string")}getOwnField(e){const t=this.ownFields.get(e);if(!t)throw new Error(`"${this.name}" type doesn't have an own field named "${e}"`);return t}getSchema(){const e=super.getSchema();if(this.additionalFields&&(e.additionalFields=this.additionalFields),this.ownFields.size){e.fields={};for(const[t,r]of this.ownFields)e.fields[t]=Zt(r),delete e.fields[t].name}return e}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[nr](){return`[${ar+Object.getPrototypeOf(this).constructor.name+or} ${cr+this.name+or}]`}init(){if(this._initialized)return;this._initialized=!0;const e=this._metadata;if(e.extends)for(const t of e.extends){const e=this.document.types.get(t.type);if(!e)throw new TypeError(`Extending schema (${t.type}) of data type "${this.name}" does not exists`);if(!(e instanceof lr))throw new TypeError(`Cannot extend ${this.name} from a "${e.kind}"`);e.init(),e.additionalFields&&(this._mixinAdditionalFields=!0);for(const[t,r]of e.fields){const e=Zt(r);e.name=t,e.parent=this,this.fields.set(t,e)}}if(e.fields)for(const[t,r]of Object.entries(e.fields)){if(!this.document.types.get(r.type))throw new TypeError(`Type "${r.type}" defined for "${this.name}.${t}" does not exists`);const e=Zt(r);e.name=t,this.fields.set(t,e),this.ownFields.set(t,e)}}}class ur extends hr{constructor(e,t,r){super(e,t,{kind:"SimpleType",...r})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[nr](){return`[${ar+Object.getPrototypeOf(this).constructor.name+or} ${cr+this.name+or}]`}}class pr extends hr{constructor(e,t,r){super(e,t,N({kind:"UnionType",...r},["types"])),this.types=r.types,this.hasAdditionalFields="any"===t||!!this.types.find((e=>e instanceof lr&&e.additionalFields))}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}[nr](){return`[${ar+Object.getPrototypeOf(this).constructor.name+or} ${cr+this.name+or}]`}}const dr=/^([^.]+)\.(.*)$/;function _r(e){if(e.length)return fr(e,{})}function fr(e,t){for(const r of e){const e=dr.exec(r);if(e){const r=e[1];if(!0===t[r])continue;const s=t[r]="object"==typeof t[r]?t[r]:{};fr([e[2]],s)}else t[r]=!0}return t}function mr(e,t,r,s=""){return yr([],e,t,_r(r)||{},"",s,{additionalFields:!0})}function yr(e,t,r,s,i="",n="",o){let a="";for(const c of Object.keys(s)){const h=s[c],l=r?.fields.get(c);if(!l){if(a=i?i+"."+c:c,!o?.additionalFields||r&&!r.additionalFields)throw new TypeError(`Unknown field "${a}"`);"object"==typeof h?yr(e,t,void 0,h,a,n,o):e.push(a);continue}a=i?i+"."+l.name:l.name;const u=t.getDataType(l.type||"string");if("object"!=typeof h)e.findIndex((e=>e.startsWith(a+".")))>=0&&(e=e.filter((e=>!e.startsWith(a+".")))),e.push(a);else{if(!(u&&u instanceof lr))throw new TypeError(`"${n?n+"."+a:a}" is not a complex type and has no sub fields`);if(e.findIndex((e=>e===i))>=0)continue;e=yr(e,t,u,h,a,n,o)}}return e}class Tr{constructor(e,t,r){this.document=e,this.name=t,this.metadata=r}get instance(){return this.metadata.instance}get kind(){return this.metadata.kind}get description(){return this.metadata.description}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name}]`}validateQueryOptions(){}getSchema(e){return Zt(this.metadata,e)}[nr](){return`[${ar+Object.getPrototypeOf(this).constructor.name+or} ${cr+this.name+or}]`}}class Er extends Tr{constructor(e,t,r,s){if(!s.keyFields)throw new TypeError(`You should provide key fields for ${t}`);super(e,t,s),s.keyFields=Array.isArray(s.keyFields)?s.keyFields:[s.keyFields],s.keyFields.forEach((e=>r.getField(e))),this.dataType=r,s.search&&s.search.sortFields&&(s.search.sortFields=mr(e,r,s.search.sortFields))}get keyFields(){return this.metadata.keyFields}get create(){return this.metadata.create}get count(){return this.metadata.count}get delete(){return this.metadata.delete}get deleteMany(){return this.metadata.deleteMany}get get(){return this.metadata.get}get update(){return this.metadata.update}get updateMany(){return this.metadata.updateMany}get search(){return this.metadata.search}getSchema(e){const t=super.getSchema(e);t.keyFields.length<2&&(t.keyFields=t.keyFields[0]);for(const e of kt)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class xr extends Tr{constructor(e,t,r,s){if(!(r instanceof lr))throw new TypeError('You should provide a ComplexType as "dataType" argument');super(e,t,s),this.dataType=r}get create(){return this.metadata.create}get delete(){return this.metadata.delete}get get(){return this.metadata.get}get update(){return this.metadata.update}getSchema(e){const t=super.getSchema(e);for(const e of St)"object"!=typeof t[e]||Object.keys(t[e]).length||(t[e]=!0);return t}}class gr{constructor(e){this._ownTypes=new Pt,this._types=new Pt,this._resources=new Pt,this._meta=N(e,["types","resources"]);for(const[e,t]of Kt.entries())this._addDataType(e,t,!1);if(e.types)for(const[t,r]of Object.entries(e.types))this._addDataType(t,r,!0);if(this._initTypes(),e.resources)for(const[t,r]of Object.entries(e.resources))this._addResource(t,r)}get info(){return this._meta.info}get types(){return this._types}getDataType(e){const t=this.types.get(e);if(t)return t;throw new Error(`Data type "${e}" does not exists`)}getComplexDataType(e){const t=this.getDataType(e);if(t&&t instanceof lr)return t;throw new Error(`Data type "${e}" is not a ComplexType`)}getSimpleDataType(e){const t=this.getDataType(e);if(t&&t instanceof ur)return t;throw new Error(`Data type "${e}" is not a SimpleType`)}getUnionDataType(e){const t=this.getDataType(e);if(t&&t instanceof pr)return t;throw new Error(`Data type "${e}" is not a UnionType`)}get resources(){return this._resources}get servers(){return this._meta.servers}getResource(e){const t=this.resources.get(e);if(!t)throw new Error(`Resource "${e}" does not exists`);return t}getCollectionResource(e){const t=this.getResource(e);if(!(t instanceof Er))throw new Error(`"${e}" is not a CollectionResource`);return t}getSingletonResource(e){const t=this.getResource(e);if(!(t instanceof xr))throw new Error(`"${e}" is not a SingletonResource`);return t}getMetadata(e){const t={version:Dt.Version,info:Zt(this.info)};return this._ownTypes.size&&(t.types=Array.from(this._ownTypes.values()).sort(((e,t)=>ir(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),this.resources.size&&(t.resources=Array.from(this._resources.values()).sort(((e,t)=>ir(e.name,t.name))).reduce(((t,r)=>(t[r.name]=r.getSchema(e),t)),{})),t}_addDataType(e,t,r){let s=this._types.get(e);if(s)return s;if(Dt.isComplexType(t))s=new lr(this,e,t);else if(Dt.isSimpleType(t))s=new ur(this,e,t);else{if(!Dt.isUnionTypee(t))throw new TypeError("Invalid data type schema");s=new pr(this,e,{...t,types:[]})}return this._types.set(e,s),r&&this._ownTypes.set(e,s),s}_addResource(e,t){if(!Dt.isCollectionResource(t)&&!Dt.isSingletonResource(t))throw new TypeError(`Unknown resource kind (${t.kind})`);{const r=this.getDataType(t.type);if(!r)throw new TypeError(`Datatype "${t.type}" declared in CollectionResource (${e}) does not exists`);if(!(r instanceof lr))throw new TypeError(`${t.type} is not an ComplexType`);Dt.isCollectionResource(t)?this.resources.set(e,new Er(this,e,r,t)):this.resources.set(e,new xr(this,e,r,t))}}_initTypes(){for(const e of this._types.values())e instanceof lr&&e.init()}static async create(e){const t=new sr(e);if(e.types)if(Array.isArray(e.types))for(const r of e.types)await t.addDataTypeClass(r);else for(const[r,s]of Object.entries(e.types))await t.addDataTypeSchema(r,s);if(e.resources)if(Array.isArray(e.resources))for(const r of e.resources)await t.addResourceInstance(r);else for(const[r,s]of Object.entries(e.resources))await t.addResourceSchema(r,s);const r=t.buildSchema();return new gr(r)}}function Rr(e,t){if(!e)return"";for(;t&&e.startsWith("/");)e=e.substring(1);for(;e.endsWith("/");)e=e.substring(0,e.length-1);return e}const wr=/^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;function Or(e){const t=wr.exec(e);if(!t)throw Object.assign(new TypeError("Invalid URL path"),{code:"ERR_INVALID_URL_PATH",input:e});const s=decodeURIComponent(t[1]);let i;if(t[2]){const s=decodeURIComponent(t[2]||""),n=r(s,{delimiters:";",quotes:!0,escape:!1});for(const t of n){const s=r(t,{delimiters:"=",quotes:!0,escape:!1});if(n.length>1&&s.length<2||i&&s.length>=2&&"object"!=typeof i||s.length<2&&"object"==typeof i)throw Object.assign(new TypeError("Invalid URL path. name:value pair required for multiple key format"),{pathComponent:e,code:"ERR_INVALID_URL_PATH"});s.length>=2?(i=i||{},i[s.shift()||""]=s.join("=")):i=s[0]}}return t[3]?{resource:s,key:i,typeCast:t[3]}:{resource:s,key:i}}function Ir(e,t,r){if(null==e)return"";let s="";if(""!==t&&null!=t)if(k(t)){const e=[];for(const r of Object.keys(t))e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));s=e.join(";")}else s=encodeURIComponent(""+t);return r&&(r=encodeURIComponent(r)),encodeURIComponent(e).replace(/%24/,"$")+(s?"@"+s:"")+(r?"::"+r:"")}const Ar=Symbol.for("nodejs.util.inspect.custom");class Cr{constructor(e){this.resource=e.resource,this.key=e.key,this.typeCast=e.typeCast}toString(){const e=Ir(this.resource,this.key,this.typeCast);return e&&Object.setPrototypeOf(e,Cr.prototype),e}[Ar](){const e={resource:this.resource};return null!=this.key&&(e.key=this.key),null!=this.typeCast&&(e.typeCast=this.typeCast),e}}const vr=Symbol.for("nodejs.util.inspect.custom");class br extends P{constructor(...e){super(),this._entries=[];for(const t of e)H(t)?this._parse(t.pathname):t instanceof br?this._entries.push(...t._entries):this.add(t)}get size(){return this._entries.length}add(e,t,r){this._add(e,t,r),this.emit("change")}clear(){this._entries=[],this.emit("change")}get(e){return this._entries[e]}join(e){const r=t(Rr(e,!0),{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){const t=Or(e);this._add(t)}return this.emit("change"),this}entries(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:[t[e],e]})}}values(){let e=-1;const t=[...this._entries];return{[Symbol.iterator](){return this},next:()=>(e++,{done:e>=t.length,value:t[e]})}}forEach(e){for(const t of this._entries)e.call(this,t.resource,t.key,this)}getResource(e){const t=this._entries[e];return null==t?void 0:t.resource}getKey(e){const t=this._entries[e];return null==t?void 0:t.key}toString(){return this._entries.map((e=>Ir(e.resource,e.key,e.typeCast))).join("/")}[Symbol.iterator](){return this.entries()}[vr](){return this._entries}_add(e,t,r){e instanceof Cr?this._entries.push(e):"object"==typeof e?this._entries.push(new Cr(e)):this._entries.push(new Cr({resource:e,key:t,typeCast:r}))}_parse(e){if(!e)return;const r=t(e,{delimiters:"/",quotes:!0,brackets:!0});for(const e of r){if(!e)continue;const t=Or(e);this._add(t)}this.emit("change")}}class Lr{}const Nr=["true","t","yes","y","1"],Sr=["false","f","no","n","0"];const kr=/^(\d{4})(?:-?(0[1-9]|1[012])(?:-?([123]0|[012][1-9]|31))?)?(?:[T ]?([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?)?$/;function Dr(e,t,r){if(""===e||null==e)return"";const s=e.match(kr);if(!s)throw new TypeError(`"${e}" is not a valid date.`);let i=s[1]+"-"+(s[2]||"01")+"-"+(s[3]||"01");return t&&(i+="T"+(s[4]||"00")+":"+(s[5]||"00")+":"+(s[6]||"00")+(s[7]?"."+s[7]:""),r&&(i+=s[8]?"Z":s[9]?s[9]+(s[10]||"00")+":"+(s[11]||"00"):"")),i}class Pr extends Lr{constructor(e){super(),this.max=e?.max,this.min=e?.min}parse(e){const t="number"==typeof e?e:parseFloat(e);if(isNaN(t))throw new TypeError(`"${e}" is not a valid number`);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return"number"==typeof e?""+e:""}}class Ur extends Pr{constructor(e){super(e),this.enum=e?.enum}parse(e){const t=super.parse(e);if(!Number.isInteger(t))throw new TypeError(`"${e}" is not a valid integer`);if(this.enum&&!this.enum.includes(t))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return t}}const Mr={integer:new Ur,number:new Pr,string:new class extends Lr{constructor(e){super(),this.maxLength=e?.maxLength,this.minLength=e?.minLength,this.enum=e?.enum}parse(e){if(null!=this.minLength&&e.length<this.minLength)throw new TypeError(`Value must be at least ${this.minLength} character${this.minLength>1?"s":""} long.`);if(null!=this.maxLength&&e.length>this.maxLength)throw new TypeError(`Value can be up to ${this.maxLength} character${this.maxLength>1?"s":""} long.`);if(this.enum&&!this.enum.includes(e))throw new TypeError(`"${e}" is not one of allowed enum values (${this.enum}).`);return e}stringify(e){return null==e?"":""+e}},boolean:new class extends Lr{parse(e){if(""===e)return!0;if("boolean"==typeof e)return e;if(Nr.includes(e.toLowerCase()))return!0;if(Sr.includes(e.toLowerCase()))return!1;throw new TypeError(`"${e}" is not a valid boolean`)}stringify(e){return"boolean"==typeof e?e?"true":"false":""}},date:new class extends Lr{constructor(e){super(),this.max=e?.max?Dr(e.max):void 0,this.min=e?.min?Dr(e.min):void 0,this.time=e?.time??!0,this.timeZone=e?.timeZone??!0}parse(e){const t=Dr(e,this.time,this.timeZone);if(null!=this.min&&t<this.min)throw new TypeError(`Value must be ${this.min} or greater.`);if(null!=this.max&&t>this.max)throw new TypeError(`Value must be ${this.max} or less.`);return t}stringify(e){return Dr(e,this.time,this.timeZone)}},filter:new class extends Lr{parse(e){return e instanceof X?e:function(e,t){const r=new C(e),s=new we(r),i=new v(s),n=new Oe(i);n.buildParseTrees=!0;const o=[],a=new yt(o);s.removeErrorListeners(),s.addErrorListener(a),n.removeErrorListeners(),n.addErrorListener(a);const c=n.root(),h=(t=t||new mt).visit(c);if(o.length){const e=[];for(const t of o)e.push(t.message+" at (line: "+t.line+" column: "+t.charPositionInLine+")");const t=new oe(e.join("\n"));throw t.errors=o,t}return h}(e)}stringify(e){return e?""+e:""}}},Fr=Symbol.for("nodejs.util.inspect.custom");class Hr extends P{constructor(e){super(),this._params=new Pt,this._entries=new Pt,this._size=0,this.defineParam("$filter",{format:"filter"}),this.defineParam("$limit",{format:new Ur({min:0})}),this.defineParam("$skip",{format:new Ur({min:0})}),this.defineParam("$pick",{format:"string",array:"strict"}),this.defineParam("$omit",{format:"string",array:"strict"}),this.defineParam("$include",{format:"string",array:"strict"}),this.defineParam("$sort",{format:"string",array:"strict"}),this.defineParam("$distinct",{format:"boolean"}),this.defineParam("$count",{format:"boolean"}),e&&("string"==typeof e?this.parse(e):this.addAll(e))}get size(){return this._size}addAll(e){let t=!1;if("function"==typeof e.forEach)e.forEach(((e,r)=>{t=this._add(r,e)||t}));else if("object"!=typeof e)throw new TypeError("Invalid argument");t&&this.emit("change")}append(e,t){this._add(e,t)&&this.emit("change")}clear(){this._entries.clear(),this._size=0,this.emit("change")}defineParam(e,t){if(!e)throw new Error("Parameter name required");const r={...t,name:e,format:t?.format||"string"};if("string"==typeof r.format&&!Mr[r.format])throw new Error(`Unknown data format "${r.format}"`);return r.format=r.format||"string",this._params.set(e,r),this}delete(e){this._delete(e)&&this.emit("change")}entries(){const e=[];return this.forEach(((t,r)=>{e.push([r,t])})),e.values()}forEach(e){for(const[t,r]of this._entries.entries())for(let s=0;s<r.length;s++)e(r[s],t,this)}get(e,t){const r=this._entries.get(e),s=r&&r[t||0];return null==s?null:s}getAll(e){const t=this._entries.get(e);return t?t.slice(0):[]}has(e){return this._entries.has(e)}keys(){return this._entries.keys()}set(e,t){this._delete(e),this._add(e,t),this.emit("change")}sort(e){this._entries.sort(e),this.emit("change")}values(){const e=[];return this.forEach((t=>e.push(t))),e.values()}toString(){let e="";return this.forEach(((t,r)=>{const s=this._params.get(r),i=s?"string"==typeof s.format?Mr[s.format]:s.format:void 0,n=e=>encodeURIComponent(i?i.stringify(e,r):null==e?"":""+e),o=Array.isArray(t)?t.map(n).join(s?.arrayDelimiter||","):n(t);o&&(e.length>0&&(e+="&"),e+=r+"="+o)})),e}parse(e){if(this._entries.clear(),this._size=0,e&&e.startsWith("?")&&(e=e.substring(1)),!e)return;const s=t(e,{delimiters:"&",quotes:!0,brackets:!0});for(const e of s){if(!e)continue;const s=t(e,{delimiters:"=",quotes:!0,brackets:!0}),i=decodeURIComponent(s.next()||""),n=s.join("="),o=this._params.get(i);if(o?.array){const e=r(n,{delimiters:o?.arrayDelimiter||",",brackets:!0,quotes:!0}).map((e=>decodeURIComponent(e)));this._add(i,e)}else this._add(i,decodeURIComponent(n))}this.emit("change")}toURLSearchParams(){const e=new URLSearchParams;return this.forEach(((t,r)=>{const s=this._params.get(r),i=s?"string"==typeof s.format?Mr[s.format]:s.format:void 0,n=e=>i?i.stringify(e,r):null==e?"":""+e,o=Array.isArray(t)?t.map(n).join(s?.arrayDelimiter||","):n(t);e.append(r,o)})),e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"URLSearchParams"}[Fr](){return this._entries}_delete(e){const t=this._entries.get(e);return!!t&&(this._size-=t.length,this._entries.delete(e),!0)}_add(e,t){const r=this._params.get(e),s=r?"string"==typeof r.format?Mr[r.format]:r.format:void 0,i=t=>s?s.parse(t,e):t;let n=Array.isArray(t)?t.map(i):i(t);if(r&&("strict"===r.array?n=Array.isArray(n)?n:[n]:r.array&&(n=Array.isArray(n)&&1===n.length?n[0]:n),Array.isArray(n))){if(r.minArrayItems&&n.length<r.minArrayItems)throw new Error(`"${e}" parameter requires at least ${r.minArrayItems} values`);if(r.maxArrayItems&&n.length>r.maxArrayItems)throw new Error(`"${e}" parameter accepts up to ${r.maxArrayItems} values`)}let o=this._entries.get(e);return o||(o=[],this._entries.set(e,o)),o.push(n),this._size++,!0}}e.from("\r\n");class $r extends Error{constructor(e,t){super(e.message),this.cause=t,this.issues=e.issues||[],this.status=e.status,t&&(this.cause=t,t.stack&&(this.stack=t.stack))}}const jr=/^application\/([\w-]+\+)?\bjson\b/i,Br=/^text\/.*$/i,Gr=/^multipart\/\bform-data\b/i;class zr extends U{constructor(e,t={}){super((e=>{"response"!==t.observe?this.resolve().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t))):this.fetch().then((t=>{e.next(t),e.complete()})).catch((t=>e.error(t)))})),this._handler=e,this.options=t,this.contentId=L(6),this.options=t}header(e,t){return this._headers=this._headers||{},this._headers[e]=t,this}async fetch(){const e=this._promise||(this._promise=new Promise(((e,t)=>{setTimeout((()=>{this._execute().then(e).catch(t)}),0)})));return await e}async resolve(){return(await this.fetch()).data}with(e){return e(this),this}binding(){return{}}async _execute(){const e=this.prepare();return await this._handler(e)}}function qr(e,...t){let r;const s=[e,...t];let i;for(let e=s.length-1;e>=0;e--){const t=s[e];t?.headers&&(i=i||{},Object.assign(i,Rt(t.headers)))}for(const t of s)t&&(Object.assign(e,t),t?.params&&(r=r||new Hr,t.params.forEach(((e,t)=>r?.append(t,e)))));return e.headers=i,e.params=r,e}class Vr extends zr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.data=r,this.options=s}prepare(){const e=new Hr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),qr({method:"POST",path:this.resource.name,params:e,body:this.data},this.options.http)}}class Wr extends zr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new Hr;return this.options.filter&&e.set("$filter",this.options.filter),qr({method:"DELETE",path:this.resource.name,params:e},this.options.http)}}class Qr extends zr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.keyValue=r,this.options=s}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "delete" request');return qr({method:"DELETE",path:new br({resource:this.resource.name,key:this.keyValue}).toString()},this.options.http)}}class Xr extends zr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.keyValue=r,this.options=s}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new br({resource:this.resource.name,key:this.keyValue}),t=new Hr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),qr({method:"GET",path:e.toString(),params:t},this.options.http)}}class Kr extends zr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new Hr;return this.options.include&&e.set("$include",this.options.include),this.options.pick&&e.set("$pick",this.options.pick),this.options.omit&&e.set("$omit",this.options.omit),this.options.sort&&e.set("$sort",this.options.sort),this.options.filter&&e.set("$filter",this.options.filter),null!=this.options.limit&&e.set("$limit",this.options.limit),null!=this.options.skip&&e.set("$skip",this.options.skip),null!=this.options.count&&e.set("$count",this.options.count),null!=this.options.distinct&&e.set("$distinct",this.options.distinct),qr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class Yr extends zr{constructor(e,t,r,s={}){super(e,s),this._handler=e,this.resource=t,this.data=r,this.options=s}prepare(){const e=new Hr;return this.options.filter&&e.set("$filter",this.options.filter),qr({method:"PATCH",path:this.resource.name,params:e,body:this.data},this.options.http)}}class Zr extends zr{constructor(e,t,r,s,i={}){super(e,i),this._handler=e,this.resource=t,this.keyValue=r,this.data=s,this.options=i}prepare(){if(null==this.keyValue||""===this.keyValue)throw new TypeError('Key value required to perform "get" request');const e=new br({resource:this.resource.name,key:this.keyValue}),t=new Hr;return this.options.include&&t.set("$include",this.options.include),this.options.pick&&t.set("$pick",this.options.pick),this.options.omit&&t.set("$omit",this.options.omit),qr({method:"PATCH",path:e.toString(),params:t,body:this.data},this.options.http)}}class Jr{constructor(e,t){this.resource=e,this._handler=t}create(e,t){return new Vr(this._handler,this.resource,e,t)}delete(e,t){return new Qr(this._handler,this.resource,e,t)}deleteMany(e){return new Wr(this._handler,this.resource,e)}get(e,t){return new Xr(this._handler,this.resource,e,t)}search(e){return new Kr(this._handler,this.resource,e)}update(e,t,r){return new Zr(this._handler,this.resource,e,t,r)}updateMany(e,t){return new Yr(this._handler,this.resource,e,t)}}class es extends zr{constructor(e,t,r={}){super(e,r),this._handler=e,this.resource=t,this.options=r}prepare(){const e=new URLSearchParams;return this.options.include&&e.set("$include",""+this.options.include),this.options.pick&&e.set("$pick",""+this.options.pick),this.options.omit&&e.set("$omit",""+this.options.omit),qr({method:"GET",path:this.resource.name,params:e},this.options.http)}}class ts{constructor(e,t){this.resource=e,this._handler=t}get(e){return new es(this._handler,this.resource,e)}}class rs extends zr{constructor(e,t,r={}){super(e,r),this._handler=e,this.requests=t,this.options=r,this._results=new WeakMap,this._listeners=new Set,t.forEach((e=>{Object.defineProperty(e,"_execute",{writable:!0,enumerable:!1,configurable:!0,value:()=>new Promise(((t,r)=>{const s=this._results.get(e);if(s)return s.error?r(s.error):t(s.response);const i=(e,s)=>{if(this._listeners.delete(i),e)return r(e);t(s)};this._listeners.add(i)}))})}))}prepare(){const e=this._buildBatchMultipart(this);return qr({method:"POST",path:"/$batch",headers:{"content-type":"multipart/mixed;boundary="+e.boundary},body:e.stream()},this.options.http)}_buildBatchMultipart(e){const t=new Ct;for(const r of e.requests){const e=r.prepare();if(r instanceof rs){const e=this._buildBatchMultipart(r);t.addBatch(e)}else t.addRequestPart({method:e.method,url:e.path,headers:e.headers,data:e.body})}return t}async _execute(){const e=this.prepare();return await this._handler(e)}}const ss=new Map,is=new Map;class ns{constructor(e,t){if(this._serviceUrl=e,this._metadata=t?.document,!this._metadata){const e=ss.get(this.serviceUrl.toLowerCase());e&&(this._metadata=e)}this.defaults=t?.defaults||{}}get serviceUrl(){return this._serviceUrl}get initialized(){return!!this._metadata}get metadata(){return this._assertMetadata(),this._metadata}async init(e){if(!e&&this.initialized)return;const t=this.serviceUrl.toLowerCase();let r=is.get(t);if(!r)return r=this._resolveMetadata(),is.set(t,r),r.catch((()=>{})).finally((()=>is.delete(t)));await r}batch(e){return this._assertMetadata(),new rs((e=>this._handleRequest(e)),e)}collection(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getCollectionResource(e);return new Jr(t,(e=>this._handleRequest(e)))}singleton(e){this._assertMetadata(),"function"==typeof e&&(e=e.name);const t=this.metadata.getSingletonResource(e);return new ts(t,(e=>this._handleRequest(e)))}async _resolveMetadata(){const e=await this._handleRequest({method:"GET",path:"/$metadata",headers:{accept:"application/json"}});this._metadata=new gr(e.data)}async _handleRequest(t){qr(t,this.defaults);let r=function(...e){const t=[];let r;for(let s=0,i=e.length;s<i;s++)r=Rr(e[s],s>0),r&&t.push(r);return t.join("/")}(this.serviceUrl,t.path);var s;return t.params&&(r+="?"+t.params.toString()),t.body&&"object"==typeof t.body&&(F(t.body)||M(s=t.body)&&!1!==s.readable&&"function"==typeof s.getReader&&"function"==typeof s.pipeThrough&&"function"==typeof s.pipeTo||e.isBuffer(t.body)||(t.headers?.["content-type"]||(t.headers=t.headers||{},t.headers["content-type"]="application/json"),t.body=JSON.stringify(t.body))),this._fetch(r,t)}async _fetch(e,t){const r=await fetch(e,t);let s;if(r.body&&(jr.test(r.headers.get("Content-Type")||"")?(s=await r.json(),"string"==typeof s&&(s=JSON.parse(s))):s=Br.test(r.headers.get("Content-Type")||"")?await r.text():Gr.test(r.headers.get("Content-Type")||"")?await r.formData():await r.arrayBuffer()),r.status>=400&&r.status<600)throw new $r({message:r.status+" "+r.statusText,status:r.status,issues:s?.errors});return{get headers(){return r.headers},get ok(){return r.ok},get redirected(){return r.redirected},get status(){return r.status},get statusText(){return r.statusText},get type(){return r.type},get url(){return r.url},get contentId(){return r.headers.get("Content-ID")},get data(){return s}}}_assertMetadata(){if(!this._metadata)throw new Error("You must call init() to before using the client instance")}static async create(e,t){const r=new this(e,t);return r._metadata||await r.init(),r}}export{rs as BatchRequest,$r as ClientError,Vr as CollectionCreateRequest,Wr as CollectionDeleteManyRequest,Qr as CollectionDeleteRequest,Xr as CollectionGetRequest,Kr as CollectionSearchRequest,Yr as CollectionUpdateManyRequest,Zr as CollectionUpdateRequest,Jr as HttpCollectionService,zr as HttpRequest,es as HttpSingletonGetRequest,ts as HttpSingletonService,ns as OpraHttpClient};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/client",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "Opra Client package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,12 +24,14 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@browsery/antlr4": "^0.0
|
|
28
|
-
"@browsery/fs": "^0.0
|
|
29
|
-
"@browsery/highland": "^0.0
|
|
30
|
-
"@browsery/http-parser": "^0.0
|
|
31
|
-
"@browsery/i18next": "^0.0
|
|
32
|
-
"@browsery/stream": "^0.0
|
|
27
|
+
"@browsery/antlr4": "^0.1.0",
|
|
28
|
+
"@browsery/fs": "^0.1.0",
|
|
29
|
+
"@browsery/highland": "^0.1.0",
|
|
30
|
+
"@browsery/http-parser": "^0.1.0",
|
|
31
|
+
"@browsery/i18next": "^0.1.0",
|
|
32
|
+
"@browsery/stream": "^0.1.0",
|
|
33
|
+
"@browsery/util": "^0.1.0",
|
|
34
|
+
"buffer": "^6.0.3",
|
|
33
35
|
"events": "^3.3.0",
|
|
34
36
|
"fast-tokenizer": "^1.2.0",
|
|
35
37
|
"lodash.omit": "^4.5.0",
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
"ts-lib": "^0.0.5",
|
|
40
42
|
"putil-isplainobject": "^1.1.5",
|
|
41
43
|
"putil-merge": "^3.10.1",
|
|
42
|
-
"putil-promisify": "^1.
|
|
44
|
+
"putil-promisify": "^1.10.0",
|
|
43
45
|
"putil-varhelpers": "^1.6.5",
|
|
44
46
|
"reflect-metadata": "^0.1.13",
|
|
45
47
|
"uid": "^2.0.1"
|