@opra/common 1.19.7 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.cjs +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/api-document.js +14 -2
- package/cjs/document/common/document-node.js +12 -1
- package/cjs/document/constants.js +2 -1
- package/cjs/document/data-type/api-field.js +7 -6
- package/cjs/document/data-type/array-type.js +78 -0
- package/cjs/document/data-type/complex-type-base.js +3 -4
- package/cjs/document/data-type/extended-types/base64.type.js +6 -1
- package/cjs/document/data-type/extended-types/date-time.type.js +1 -1
- package/cjs/document/data-type/extended-types/date.type.js +1 -1
- package/cjs/document/data-type/extended-types/field-path.type.js +3 -3
- package/cjs/document/data-type/extended-types/filter.type.js +1 -1
- package/cjs/document/data-type/simple-type.js +10 -2
- package/cjs/document/decorators/http-operation.decorator.js +13 -0
- package/cjs/document/decorators/mq-operation.decorator.js +12 -8
- package/cjs/document/decorators/ws-controller.decorator.js +4 -4
- package/cjs/document/decorators/ws-operation.decorator.js +6 -7
- package/cjs/document/decorators/ws-param.decorator.js +22 -0
- package/cjs/document/factory/api-document.factory.js +9 -0
- package/cjs/document/factory/data-type.factory.js +27 -0
- package/cjs/document/factory/mq-api.factory.js +4 -4
- package/cjs/document/factory/ws-api.factory.js +26 -4
- package/cjs/document/http/http-media-type.js +13 -4
- package/cjs/document/http/http-parameter.js +8 -0
- package/cjs/document/index.js +2 -0
- package/cjs/document/mq/mq-header.js +8 -0
- package/cjs/document/mq/mq-operation-response.js +9 -9
- package/cjs/document/mq/mq-operation.js +23 -10
- package/cjs/document/ws/ws-operation.js +22 -20
- package/cjs/filter/filter-rules.js +2 -2
- package/cjs/schema/data-type/array-type.interface.js +7 -0
- package/cjs/schema/opra-schema.js +1 -0
- package/cjs/schema/type-guards.js +7 -1
- package/esm/document/api-document.js +14 -2
- package/esm/document/common/document-node.js +12 -1
- package/esm/document/constants.js +1 -0
- package/esm/document/data-type/api-field.js +7 -6
- package/esm/document/data-type/array-type.js +75 -0
- package/esm/document/data-type/complex-type-base.js +3 -4
- package/esm/document/data-type/extended-types/base64.type.js +6 -1
- package/esm/document/data-type/extended-types/date-time.type.js +1 -1
- package/esm/document/data-type/extended-types/date.type.js +1 -1
- package/esm/document/data-type/extended-types/field-path.type.js +3 -3
- package/esm/document/data-type/extended-types/filter.type.js +1 -1
- package/esm/document/data-type/simple-type.js +10 -2
- package/esm/document/decorators/http-operation.decorator.js +13 -0
- package/esm/document/decorators/mq-operation.decorator.js +13 -9
- package/esm/document/decorators/ws-controller.decorator.js +5 -5
- package/esm/document/decorators/ws-operation.decorator.js +7 -8
- package/esm/document/decorators/ws-param.decorator.js +19 -0
- package/esm/document/factory/api-document.factory.js +9 -0
- package/esm/document/factory/data-type.factory.js +27 -0
- package/esm/document/factory/mq-api.factory.js +4 -4
- package/esm/document/factory/ws-api.factory.js +27 -5
- package/esm/document/http/http-media-type.js +13 -4
- package/esm/document/http/http-parameter.js +8 -0
- package/esm/document/index.js +2 -0
- package/esm/document/mq/mq-header.js +8 -0
- package/esm/document/mq/mq-operation-response.js +9 -9
- package/esm/document/mq/mq-operation.js +23 -10
- package/esm/document/ws/ws-operation.js +22 -20
- package/esm/filter/filter-rules.js +2 -2
- package/esm/schema/data-type/array-type.interface.js +4 -0
- package/esm/schema/opra-schema.js +1 -0
- package/esm/schema/type-guards.js +6 -1
- package/package.json +1 -1
- package/types/document/api-document.d.ts +6 -3
- package/types/document/common/document-node.d.ts +7 -0
- package/types/document/constants.d.ts +1 -0
- package/types/document/data-type/api-field.d.ts +6 -9
- package/types/document/data-type/array-type.d.ts +76 -0
- package/types/document/data-type/extended-types/base64.type.d.ts +2 -1
- package/types/document/data-type/extended-types/date-time.type.d.ts +2 -1
- package/types/document/data-type/extended-types/date.type.d.ts +2 -1
- package/types/document/data-type/extended-types/field-path.type.d.ts +5 -2
- package/types/document/data-type/extended-types/filter.type.d.ts +3 -1
- package/types/document/data-type/simple-type.d.ts +6 -2
- package/types/document/decorators/mq-operation.decorator.d.ts +5 -5
- package/types/document/decorators/ws-controller.decorator.d.ts +0 -2
- package/types/document/decorators/ws-operation.decorator.d.ts +5 -5
- package/types/document/decorators/ws-param.decorator.d.ts +2 -0
- package/types/document/factory/data-type.factory.d.ts +12 -2
- package/types/document/http/http-media-type.d.ts +3 -1
- package/types/document/http/http-parameter.d.ts +5 -1
- package/types/document/index.d.ts +2 -0
- package/types/document/mq/mq-header.d.ts +5 -1
- package/types/document/mq/mq-operation-response.d.ts +8 -4
- package/types/document/mq/mq-operation.d.ts +13 -6
- package/types/document/ws/ws-controller.d.ts +0 -1
- package/types/document/ws/ws-operation.d.ts +14 -14
- package/types/schema/data-type/array-type.interface.d.ts +16 -0
- package/types/schema/data-type/data-type.interface.d.ts +3 -2
- package/types/schema/data-type/field.interface.d.ts +1 -0
- package/types/schema/http/http-media-type.interface.d.ts +1 -0
- package/types/schema/mq/mq-operation.interface.d.ts +2 -2
- package/types/schema/opra-schema.d.ts +1 -0
- package/types/schema/type-guards.d.ts +2 -0
- package/types/schema/value.interface.d.ts +1 -0
- package/types/schema/ws/ws-operation.interface.d.ts +3 -2
package/browser/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* http://www.panates.com
|
|
4
4
|
*****************************************/
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
`):void 0},!0)}init(e){this.message=(e==null?void 0:e.message)||this.constructor.name,this.severity=(e==null?void 0:e.severity)||"error",e&&(this.system=e.system,this.code=e.code,this.details=e.details)}initString(e){this.init({message:String(e||"")||this.constructor.name,severity:"error",code:this.constructor.name})}initError(e){this.init({message:e.message,severity:e.severity||"error",code:e.code||e.constructor.name})}};a(ri,"OpraException");var Ee=ri;var ii=class ii extends Ee{constructor(e,t,r){super(e,t instanceof Error?t:void 0),this.status=(typeof t=="number"?t:Number(r))||500}setStatus(e){return this.status=e,this}initError(e){typeof e.status=="number"?this.status=e.status:typeof e.getStatus=="function"&&(this.status=e.getStatus()),super.initError(e)}};a(ii,"OpraHttpError");var S=ii;var oi=class oi extends S{constructor(){super(...arguments),this.status=400}init(e){super.init({message:"Bad request",code:"BAD_REQUEST",...e})}};a(oi,"BadRequestError");var Ps=oi;var ni=class ni extends S{constructor(){super(...arguments),this.status=409}init(e){super.init({message:"Conflict",code:"CONFLICT",...e})}};a(ni,"ConflictError");var ks=ni;var si=class si extends S{constructor(){super(...arguments),this.status=424}init(e){super.init({message:"The request failed due to failure of a previous request",code:"FAILED_DEPENDENCY",...e})}};a(si,"FailedDependencyError");var js=si;var Cs;(function(o){o.X_Opra_Version="X-Opra-Version",o.X_Total_Count="X-Total-Count",o.WWW_Authenticate="WWW-Authenticate",o.Authorization="Authorization",o.Proxy_Authenticate="Proxy-Authenticate",o.Proxy_Authorization="Proxy-Authorization",o.Age="Age",o.Cache_Control="Cache-Control",o.Clear_Site_Data="Clear-Site-Data",o.Expires="Expires",o.Pragma="Pragma",o.Last_Modified="Last-Modified",o.ETag="ETag",o.If_Match="If-Match",o.If_None_Match="If-None-Match",o.If_Modified_Since="If-Modified-Since",o.If_Unmodified_Since="If-Unmodified-Since",o.Vary="Vary",o.Connection="Connection",o.Keep_Alive="Keep-Alive",o.Accept="Accept",o.Accept_Encoding="Accept-Encoding",o.Accept_Language="Accept-Language",o.Expect="Expect",o.Cookie="Cookie",o.Set_Cookie="Set-Cookie",o.Access_Control_Allow_Origin="Access-Control-Allow-Origin",o.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",o.Access_Control_Allow_Headers="Access-Control-Allow-Headers",o.Access_Control_Allow_Methods="Access-Control-Allow-Methods",o.Access_Control_Expose_Headers="Access-Control-Expose-Headers",o.Access_Control_Max_Age="Access-Control-Max-Age",o.Access_Control_Request_Headers="Access-Control-Request-Headers",o.Access_Control_Request_Method="Access-Control-Request-Method",o.Origin="Origin",o.Timing_Allow_Origin="Timing-Allow-Origin",o.Content_Disposition="Content-Disposition",o.Content_ID="Content-ID",o.Content_Length="Content-Length",o.Content_Type="Content-Type",o.Content_Transfer_Encoding="Content-Transfer-Encoding",o.Content_Encoding="Content-Encoding",o.Content_Language="Content-Language",o.Content_Location="Content-Location",o.Forwarded="Forwarded",o.X_Forwarded_For="X-Forwarded-For",o.X_Forwarded_Host="X-Forwarded-Host",o.X_Forwarded_Proto="X-Forwarded-Proto",o.Via="Via",o.Location="Location",o.From="From",o.Host="Host",o.Referer="Referer",o.Referrer_Policy="Referrer-Policy",o.User_Agent="User-Agent",o.Allow="Allow",o.Server="Server",o.Accept_Ranges="Accept-Ranges",o.Range="Range",o.If_Range="If-Range",o.Content_Range="Content-Range",o.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",o.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",o.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",o.Content_Security_Policy="Content-Security-Policy",o.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",o.Expect_CT="Expect-CT",o.Feature_Policy="Feature-Policy",o.Strict_Transport_Security="Strict-Transport-Security",o.Upgrade="Upgrade",o.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",o.X_Content_Type_Options="X-Content-Type-Options",o.X_Download_Options="X-Download-Options",o.X_Frame_Options="X-Frame-Options",o.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",o.X_Powered_By="X-Powered-By",o.X_XSS_Protection="X-XSS-Protection",o.Transfer_Encoding="Transfer-Encoding",o.TE="TE",o.Trailer="Trailer",o.Sec_WebSocket_Key="Sec-WebSocket-Key",o.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",o.Sec_WebSocket_Accept="Sec-WebSocket-Accept",o.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",o.Sec_WebSocket_Version="Sec-WebSocket-Version",o.Date="Date",o.Retry_After="Retry-After",o.Server_Timing="Server-Timing",o.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control",o.Max_Forwards="Max-Forwards"})(Cs||(Cs={}));var R;(function(o){o[o.CONTINUE=100]="CONTINUE",o[o.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",o[o.PROCESSING=102]="PROCESSING",o[o.EARLYHINTS=103]="EARLYHINTS",o[o.OK=200]="OK",o[o.CREATED=201]="CREATED",o[o.ACCEPTED=202]="ACCEPTED",o[o.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",o[o.NO_CONTENT=204]="NO_CONTENT",o[o.RESET_CONTENT=205]="RESET_CONTENT",o[o.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",o[o.AMBIGUOUS=300]="AMBIGUOUS",o[o.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",o[o.FOUND=302]="FOUND",o[o.SEE_OTHER=303]="SEE_OTHER",o[o.NOT_MODIFIED=304]="NOT_MODIFIED",o[o.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",o[o.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",o[o.BAD_REQUEST=400]="BAD_REQUEST",o[o.UNAUTHORIZED=401]="UNAUTHORIZED",o[o.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",o[o.FORBIDDEN=403]="FORBIDDEN",o[o.NOT_FOUND=404]="NOT_FOUND",o[o.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",o[o.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",o[o.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",o[o.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",o[o.CONFLICT=409]="CONFLICT",o[o.GONE=410]="GONE",o[o.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",o[o.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",o[o.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",o[o.URI_TOO_LONG=414]="URI_TOO_LONG",o[o.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",o[o.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",o[o.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",o[o.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",o[o.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",o[o.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",o[o.LOCKED=423]="LOCKED",o[o.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",o[o.TOO_EARLY=425]="TOO_EARLY",o[o.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",o[o.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",o[o.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",o[o.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",o[o.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",o[o.BAD_GATEWAY=502]="BAD_GATEWAY",o[o.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",o[o.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",o[o.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",o[o.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",o[o.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",o[o.LOOP_DETECTED=508]="LOOP_DETECTED",o[o.NOT_EXTENDED=510]="NOT_EXTENDED",o[o.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(R||(R={}));var Pf={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};var D;(function(o){o.json="application/json",o.opra_response_json="application/opra.response+json",o.xml="application/XML",o.text="text/plain",o.html="text/html",o.markdown="text/markdown",o.binary="binary/octet-stream"})(D||(D={}));var ai=class ai extends S{constructor(){super(...arguments),this.status=R.FORBIDDEN}init(e){super.init({message:"You are not authorized to perform this action",code:"FORBIDDEN",...e})}};a(ai,"ForbiddenError");var Er=ai;var pi=class pi extends S{constructor(){super(...arguments),this.status=500}init(e){super.init({message:"Internal server error",code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(pi,"InternalServerError");var Us=pi;var ci=class ci extends S{constructor(){super(...arguments),this.status=405}init(e){super.init({message:"Method not allowed",code:"METHOD_NOT_ALLOWED",...e})}};a(ci,"MethodNotAllowedError");var $s=ci;var li=class li extends S{constructor(){super(...arguments),this.status=406}init(e){super.init({message:"Not Acceptable",code:"NOT_ACCEPTABLE",...e})}};a(li,"NotAcceptableError");var qs=li;var fi=class fi extends S{constructor(){super(...arguments),this.status=404}init(e){super.init({message:"Not found",code:"NOT_FOUND",...e})}};a(fi,"NotFoundError");var Bs=fi;var mi=class mi extends Er{init(e){super.init({message:"You dont have permission for this operation",code:"PERMISSION_ERROR",...e})}};a(mi,"PermissionError");var Ks=mi;var ui=class ui extends S{constructor(e,t,r){super({message:`There is already an other "${e}" resource with same values for field(s) [${t}]`,severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};a(ui,"ResourceConflictError");var Vs=ui;var di=class di extends S{constructor(e,t,r){super({message:`Resource "${e}${t?"/"+t:""}" is not available`,severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,R.UNPROCESSABLE_ENTITY)}};a(di,"ResourceNotAvailableError");var zs=di;var hi=class hi extends S{constructor(){super(...arguments),this.status=401}init(e){super.init({message:"You don't have permission to perform this action",code:"UNAUTHORIZED",...e})}};a(hi,"UnauthorizedError");var Js=hi;var yi=class yi extends S{constructor(){super(...arguments),this.status=422}init(e){super.init({message:"Unprocessable entity",severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(yi,"UnprocessableEntityError");var Ws=yi;var Ys;(function(o){let e;(function(t){t.fatal="fatal",t.error="error",t.warning="warning",t.info="info"})(e=o.Enum||(o.Enum={})),o.name="IssueSeverity",o.description="Severity of the issue",o.Keys=Object.keys(o),o.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"}})(Ys||(Ys={}));BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});import{isConstructor as Za}from"@jsopen/objects";import Ha from"putil-promisify";async function pe(o){return o=Ha.isPromise(o)?await o:o,typeof o=="function"?Za(o)?o:await o():o}a(pe,"resolveThunk");var Qs=/^(?:file:\/\/)?(.+)$/;function Vm(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?Qs.exec(r):void 0;return i?i[1]:""}return""}a(Vm,"getStackFileName");function zm(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?Qs.exec(r):void 0;return i?i[1]:""}return""}a(zm,"getErrorStack");function _r(o,e,t){for(let r of Object.getOwnPropertyNames(e))r==="constructor"||r==="__proto__"||r==="toJSON"||r==="toString"||t&&!t(r)||Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(e,r)||Object.create(null))}a(_r,"mergePrototype");function xr(o,e,t=r=>!0){try{let r=new e;Object.getOwnPropertyNames(r).filter(n=>typeof r[n]<"u"&&typeof o[n]>"u").filter(n=>t(n)).forEach(n=>{o[n]=r[n]})}catch{}}a(xr,"inheritPropertyInitializers");import{isPlainObject as Xs,merge as ep}from"@jsopen/objects";var d=Symbol.for("opra.type.metadata"),ae=Symbol("opra.http-controller.metadata"),U=Symbol("opra.mq-controller.metadata"),Gm=Symbol("opra.ws-controller.metadata"),Xm=Symbol("opra.rpc-controller.metadata"),T=Symbol.for("opra.type.decoder"),O=Symbol("opra.type.encoder"),A=Symbol.for("DECORATOR"),Ue=Symbol.for("BUILTIN"),Gs=/([a-z$_]\w+):(.+)/i,I=/^[a-z][\w_]*$/i,L=Symbol.for("kDataTypeMap"),Or=Symbol.for("kCtorMap"),Ae=Symbol.for("kTypeNSMap");function P(o,e){return ep({},o,{deep:a(t=>Xs(t)&&!t[d],"deep"),symbolKeys:!0,copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||Xs(i)||Array.isArray(i))}})}a(P,"cloneObject");import{splitString as Zs}from"fast-tokenizer";var tp=/^([+-])?([a-z_$]\w*)$/i,rp=/[^.]\(/g,Ti=class Ti{};a(Ti,"FieldsProjection");var $e=Ti;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})($e||($e={}));function Hs(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new $e;for(let i of t)e||(i=i.toLowerCase()),ea(i,r);return r}a(Hs,"parseFieldsProjection");function ea(o,e){o=o.replace(rp,r=>r.charAt(0)+"."+r.substring(1));let t=Zs(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let c=Zs(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)ea(l,e);continue}let n=tp.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new $e.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new $e}}a(ea,"parse");function ip(o){return o&&typeof o.forEach=="function"}a(ip,"isMap");var Y=Symbol.for("kEntries"),ce=Symbol.for("kKeyMap"),gr=Symbol.for("kWellKnownKeys"),Ei=Symbol.for("kOptions"),tt=Symbol.for("kSize"),_i=class _i{constructor(e,t){Object.defineProperty(this,tt,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,Y,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ce,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,gr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,Ei,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[gr][i]=i:this[gr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[tt]}clear(){Object.keys(this[Y]).forEach(e=>delete this[Y][e]),Object.keys(this[ce]).forEach(e=>delete this[ce][e]),this[tt]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[Y][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[Y],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[Y],r);return this[Y][r]=t,i||this[tt]++,this[ce][r]=e,this}setAll(e){return ip(e)?e.forEach((t,r)=>this.set(r,t)):Object.keys(e).forEach(t=>this.set(t,e[t])),this}keys(){return Object.values(this[ce])[Symbol.iterator]()}values(){return Object.values(this[Y])[Symbol.iterator]()}entries(){return Object.entries(this[Y])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[Y],t);return delete this[Y][t],delete this[ce][t],r||this[tt]--,r}sort(e){let t={...this[Y]},r={...this[ce]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[Y][n]=t[n],this[ce][n]=r[n];return this[tt]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[ce]))e[r]=this[Y][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[Ei].caseSensitive)return e;let t=this._getStoringKey(e);return this[ce][t]??this[gr][t]??e}_getStoringKey(e){return this[Ei].caseSensitive?e:e.toLowerCase()}};a(_i,"ResponsiveMap");var N=_i;function pu(o,e,t){let r=new WeakSet;return JSON.stringify(o,(i,n)=>{if(n!==null&&typeof n=="object"){if(r.has(n))return;r.add(n)}return e?e(i,n):n},t)}a(pu,"safeJsonStringify");function xi(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(xi,"isStream");function fu(o){return xi(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(fu,"isReadable");function mu(o){return xi(o)&&typeof o._write=="function"}a(mu,"isWritable");function uu(o){return xi(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(uu,"isReadableStream");function du(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(du,"isBlob");function hu(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(hu,"isFormData");function yu(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(yu,"isURL");var Oi=class Oi{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(Oi,"Ast");var zt=Oi;var gi=class gi extends zt{};a(gi,"Expression");var $=gi;var wi=class wi extends ${};a(wi,"Term");var qe=wi;var Ai=class Ai extends qe{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(Ai,"Literal");var v=Ai;var Ri=class Ri extends ${constructor(){super(),this.items=[]}append(e,t){return this.items.push(new wr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(Ri,"ArithmeticExpression");var Be=Ri,bi=class bi{constructor(e){Object.assign(this,e)}};a(bi,"ArithmeticExpressionItem");var wr=bi;var Di=class Di extends qe{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(Di,"ArrayExpression");var _e=Di;var op=/\w/,Ni=class Ni extends ${constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${op.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(Ni,"ComparisonExpression");var le=Ni;var Si=class Si extends ${constructor(e){super(),Object.assign(this,e),this.op==="&&"&&(this.op="and"),this.op==="||"&&(this.op="or")}toString(){return this.items.map(e=>""+e).join(" "+this.op+" ")}};a(Si,"LogicalExpression");var fe=Si;var Mi=class Mi extends ${constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(Mi,"NegativeExpression");var Jt=Mi;var vi=class vi extends ${constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(vi,"ParenthesizedExpression");var xe=vi;var Fi=class Fi extends v{constructor(e){super(e)}};a(Fi,"BooleanLiteral");var Ke=Fi;import{toDateDef as lp}from"putil-varhelpers";var Ii=class Ii extends TypeError{};a(Ii,"SyntaxError");var Ar=Ii,Li=class Li extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(Li,"FilterValidationError");var me=Li,Pi=class Pi extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(Pi,"FilterParseError");var Rr=Pi;var np=/'/g,sp=/(\\)/g,ap=/\\(.)/g;function pp(o){return o.replace(sp,"\\\\")}a(pp,"escapeString");function cp(o){return o.replace(ap,"$1")}a(cp,"unescapeString");function Re(o){return"'"+pp(o).replace(np,"\\'")+"'"}a(Re,"quoteFilterString");function Wt(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?cp(o.substring(1,o.length-1)):o}a(Wt,"unquoteFilterString");var ta=new Date(0),ki=class ki extends v{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&lp(e,ta)!==ta){this.value=e;return}throw new me(`Invalid date value "${e}"`)}toString(){return Re(this.value)}};a(ki,"DateLiteral");var be=ki;import{toDateDef as fp}from"putil-varhelpers";var ra=new Date(0),ji=class ji extends v{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&fp(e,ra)!==ra){this.value=e;return}throw new me(`Invalid date-time value "${e}"`)}toString(){return Re(this.value)}};a(ji,"DateTimeLiteral");var Yt=ji;var Ci=class Ci extends v{constructor(){super(null),this.value=null}};a(Ci,"NullLiteral");var Ve=Ci;var Ui=class Ui extends v{constructor(e){if(super(0),typeof e=="number"||typeof e=="bigint"){this.value=e;return}try{if(typeof e=="string"){if(e.includes(".")){this.value=parseFloat(e);return}let t=Number(e);""+t===e?this.value=t:this.value=BigInt(e);return}}catch{}throw new me(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Ui,"NumberLiteral");var Oe=Ui;var $i=class $i extends v{constructor(e){super(""+e)}};a($i,"QualifiedIdentifier");var H=$i;var qi=class qi extends v{constructor(e){super(""+e)}toString(){return Re(this.value)}};a(qi,"StringLiteral");var ze=qi;var mp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,Bi=class Bi extends v{constructor(e){if(super(""),e instanceof Date){this.value=br(e.getHours())+":"+br(e.getMinutes())+(e.getSeconds()?":"+br(e.getSeconds()):"")+(e.getMilliseconds()?"."+br(e.getMilliseconds()):"");return}if(typeof e=="string"&&mp.test(e)){this.value=e;return}throw new me(`Invalid time value "${e}"`)}toString(){return Re(this.value)}};a(Bi,"TimeLiteral");var Je=Bi;function br(o){return o<=9?"0"+o:""+o}a(br,"pad");import{CharStream as Np,CommonTokenStream as Sp}from"@browsery/antlr4";import{ATNDeserializer as up,DFA as dp,Lexer as hp,LexerATNSimulator as yp,PredictionContextCache as Tp,Token as Ep}from"@browsery/antlr4";var J=class J extends hp{constructor(e){super(e),this._interp=new yp(this,J._ATN,J.DecisionsToDFA,new Tp)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return J.literalNames}get symbolicNames(){return J.symbolicNames}get ruleNames(){return J.ruleNames}get serializedATN(){return J._serializedATN}get channelNames(){return J.channelNames}get modeNames(){return J.modeNames}static get _ATN(){return J.__ATN||(J.__ATN=new up().deserialize(J._serializedATN)),J.__ATN}};a(J,"OpraFilterLexer");var h=J;h.T__0=1;h.T__1=2;h.T__2=3;h.T__3=4;h.T__4=5;h.T__5=6;h.T__6=7;h.T__7=8;h.T__8=9;h.T__9=10;h.T__10=11;h.T__11=12;h.T__12=13;h.T__13=14;h.T__14=15;h.T__15=16;h.T__16=17;h.T__17=18;h.T__18=19;h.T__19=20;h.T__20=21;h.T__21=22;h.T__22=23;h.T__23=24;h.T__24=25;h.T__25=26;h.T__26=27;h.T__27=28;h.T__28=29;h.T__29=30;h.T__30=31;h.T__31=32;h.T__32=33;h.T__33=34;h.IDENTIFIER=35;h.POLAR_OP=36;h.DATE=37;h.DATETIME=38;h.TIME=39;h.NUMBER=40;h.INTEGER=41;h.STRING=42;h.WHITESPACE=43;h.EOF=Ep.EOF;h.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];h.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];h.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,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];h.modeNames=["DEFAULT_MODE"];h.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","IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE","DIGIT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"];h._serializedATN=[4,0,43,461,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,1,0,1,0,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,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,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,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,1,34,1,34,5,34,225,8,34,10,34,12,34,228,9,34,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,3,36,240,8,36,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,291,8,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,301,8,38,1,39,3,39,304,8,39,1,39,4,39,307,8,39,11,39,12,39,308,1,39,1,39,5,39,313,8,39,10,39,12,39,316,9,39,3,39,318,8,39,1,39,1,39,3,39,322,8,39,1,39,4,39,325,8,39,11,39,12,39,326,3,39,329,8,39,1,39,1,39,1,39,1,39,4,39,335,8,39,11,39,12,39,336,3,39,339,8,39,1,40,3,40,342,8,40,1,40,4,40,345,8,40,11,40,12,40,346,1,40,1,40,1,40,1,40,4,40,353,8,40,11,40,12,40,354,3,40,357,8,40,1,41,1,41,1,41,5,41,362,8,41,10,41,12,41,365,9,41,1,41,1,41,1,41,1,41,5,41,371,8,41,10,41,12,41,374,9,41,1,41,3,41,377,8,41,1,42,4,42,380,8,42,11,42,12,42,381,1,42,1,42,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,397,8,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,406,8,44,1,45,1,45,1,45,1,45,3,45,412,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,4,45,424,8,45,11,45,12,45,425,3,45,428,8,45,3,45,430,8,45,1,46,1,46,1,46,3,46,435,8,46,1,46,1,46,1,46,3,46,440,8,46,1,46,1,46,1,46,3,46,445,8,46,3,46,447,8,46,1,47,1,47,1,47,3,47,452,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,0,0,50,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,0,89,0,91,0,93,0,95,0,97,0,99,0,1,0,16,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,2,0,43,43,45,45,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,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,3,0,48,57,65,70,97,102,491,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,1,101,1,0,0,0,3,103,1,0,0,0,5,105,1,0,0,0,7,109,1,0,0,0,9,111,1,0,0,0,11,113,1,0,0,0,13,115,1,0,0,0,15,117,1,0,0,0,17,119,1,0,0,0,19,121,1,0,0,0,21,126,1,0,0,0,23,132,1,0,0,0,25,137,1,0,0,0,27,146,1,0,0,0,29,155,1,0,0,0,31,157,1,0,0,0,33,159,1,0,0,0,35,161,1,0,0,0,37,163,1,0,0,0,39,166,1,0,0,0,41,168,1,0,0,0,43,170,1,0,0,0,45,173,1,0,0,0,47,175,1,0,0,0,49,178,1,0,0,0,51,181,1,0,0,0,53,185,1,0,0,0,55,190,1,0,0,0,57,196,1,0,0,0,59,202,1,0,0,0,61,209,1,0,0,0,63,213,1,0,0,0,65,216,1,0,0,0,67,219,1,0,0,0,69,222,1,0,0,0,71,229,1,0,0,0,73,239,1,0,0,0,75,290,1,0,0,0,77,300,1,0,0,0,79,338,1,0,0,0,81,356,1,0,0,0,83,376,1,0,0,0,85,379,1,0,0,0,87,385,1,0,0,0,89,387,1,0,0,0,91,411,1,0,0,0,93,446,1,0,0,0,95,448,1,0,0,0,97,453,1,0,0,0,99,459,1,0,0,0,101,102,5,40,0,0,102,2,1,0,0,0,103,104,5,41,0,0,104,4,1,0,0,0,105,106,5,110,0,0,106,107,5,111,0,0,107,108,5,116,0,0,108,6,1,0,0,0,109,110,5,33,0,0,110,8,1,0,0,0,111,112,5,46,0,0,112,10,1,0,0,0,113,114,5,64,0,0,114,12,1,0,0,0,115,116,5,91,0,0,116,14,1,0,0,0,117,118,5,44,0,0,118,16,1,0,0,0,119,120,5,93,0,0,120,18,1,0,0,0,121,122,5,116,0,0,122,123,5,114,0,0,123,124,5,117,0,0,124,125,5,101,0,0,125,20,1,0,0,0,126,127,5,102,0,0,127,128,5,97,0,0,128,129,5,108,0,0,129,130,5,115,0,0,130,131,5,101,0,0,131,22,1,0,0,0,132,133,5,110,0,0,133,134,5,117,0,0,134,135,5,108,0,0,135,136,5,108,0,0,136,24,1,0,0,0,137,138,5,73,0,0,138,139,5,110,0,0,139,140,5,102,0,0,140,141,5,105,0,0,141,142,5,110,0,0,142,143,5,105,0,0,143,144,5,116,0,0,144,145,5,121,0,0,145,26,1,0,0,0,146,147,5,105,0,0,147,148,5,110,0,0,148,149,5,102,0,0,149,150,5,105,0,0,150,151,5,110,0,0,151,152,5,105,0,0,152,153,5,116,0,0,153,154,5,121,0,0,154,28,1,0,0,0,155,156,5,43,0,0,156,30,1,0,0,0,157,158,5,45,0,0,158,32,1,0,0,0,159,160,5,42,0,0,160,34,1,0,0,0,161,162,5,47,0,0,162,36,1,0,0,0,163,164,5,60,0,0,164,165,5,61,0,0,165,38,1,0,0,0,166,167,5,60,0,0,167,40,1,0,0,0,168,169,5,62,0,0,169,42,1,0,0,0,170,171,5,62,0,0,171,172,5,61,0,0,172,44,1,0,0,0,173,174,5,61,0,0,174,46,1,0,0,0,175,176,5,33,0,0,176,177,5,61,0,0,177,48,1,0,0,0,178,179,5,105,0,0,179,180,5,110,0,0,180,50,1,0,0,0,181,182,5,33,0,0,182,183,5,105,0,0,183,184,5,110,0,0,184,52,1,0,0,0,185,186,5,108,0,0,186,187,5,105,0,0,187,188,5,107,0,0,188,189,5,101,0,0,189,54,1,0,0,0,190,191,5,33,0,0,191,192,5,108,0,0,192,193,5,105,0,0,193,194,5,107,0,0,194,195,5,101,0,0,195,56,1,0,0,0,196,197,5,105,0,0,197,198,5,108,0,0,198,199,5,105,0,0,199,200,5,107,0,0,200,201,5,101,0,0,201,58,1,0,0,0,202,203,5,33,0,0,203,204,5,105,0,0,204,205,5,108,0,0,205,206,5,105,0,0,206,207,5,107,0,0,207,208,5,101,0,0,208,60,1,0,0,0,209,210,5,97,0,0,210,211,5,110,0,0,211,212,5,100,0,0,212,62,1,0,0,0,213,214,5,111,0,0,214,215,5,114,0,0,215,64,1,0,0,0,216,217,5,38,0,0,217,218,5,38,0,0,218,66,1,0,0,0,219,220,5,124,0,0,220,221,5,124,0,0,221,68,1,0,0,0,222,226,7,0,0,0,223,225,7,1,0,0,224,223,1,0,0,0,225,228,1,0,0,0,226,224,1,0,0,0,226,227,1,0,0,0,227,70,1,0,0,0,228,226,1,0,0,0,229,230,7,2,0,0,230,72,1,0,0,0,231,232,5,39,0,0,232,233,3,89,44,0,233,234,5,39,0,0,234,240,1,0,0,0,235,236,5,34,0,0,236,237,3,89,44,0,237,238,5,34,0,0,238,240,1,0,0,0,239,231,1,0,0,0,239,235,1,0,0,0,240,74,1,0,0,0,241,242,5,39,0,0,242,243,3,89,44,0,243,244,5,84,0,0,244,245,3,91,45,0,245,246,3,93,46,0,246,247,5,39,0,0,247,248,5,39,0,0,248,249,3,89,44,0,249,250,5,32,0,0,250,251,3,91,45,0,251,252,3,93,46,0,252,253,5,39,0,0,253,254,5,39,0,0,254,255,3,89,44,0,255,256,5,84,0,0,256,257,3,91,45,0,257,258,5,39,0,0,258,259,5,39,0,0,259,260,3,89,44,0,260,261,5,32,0,0,261,262,3,91,45,0,262,263,5,39,0,0,263,291,1,0,0,0,264,265,5,34,0,0,265,266,3,89,44,0,266,267,5,84,0,0,267,268,3,91,45,0,268,269,3,93,46,0,269,270,5,34,0,0,270,291,1,0,0,0,271,272,5,34,0,0,272,273,3,89,44,0,273,274,5,32,0,0,274,275,3,91,45,0,275,276,3,93,46,0,276,277,5,34,0,0,277,291,1,0,0,0,278,279,5,34,0,0,279,280,3,89,44,0,280,281,5,84,0,0,281,282,3,91,45,0,282,283,5,34,0,0,283,291,1,0,0,0,284,285,5,34,0,0,285,286,3,89,44,0,286,287,5,32,0,0,287,288,3,91,45,0,288,289,5,34,0,0,289,291,1,0,0,0,290,241,1,0,0,0,290,264,1,0,0,0,290,271,1,0,0,0,290,278,1,0,0,0,290,284,1,0,0,0,291,76,1,0,0,0,292,293,5,39,0,0,293,294,3,91,45,0,294,295,5,39,0,0,295,301,1,0,0,0,296,297,5,34,0,0,297,298,3,91,45,0,298,299,5,34,0,0,299,301,1,0,0,0,300,292,1,0,0,0,300,296,1,0,0,0,301,78,1,0,0,0,302,304,3,71,35,0,303,302,1,0,0,0,303,304,1,0,0,0,304,306,1,0,0,0,305,307,3,87,43,0,306,305,1,0,0,0,307,308,1,0,0,0,308,306,1,0,0,0,308,309,1,0,0,0,309,317,1,0,0,0,310,314,5,46,0,0,311,313,3,87,43,0,312,311,1,0,0,0,313,316,1,0,0,0,314,312,1,0,0,0,314,315,1,0,0,0,315,318,1,0,0,0,316,314,1,0,0,0,317,310,1,0,0,0,317,318,1,0,0,0,318,328,1,0,0,0,319,321,5,69,0,0,320,322,7,2,0,0,321,320,1,0,0,0,321,322,1,0,0,0,322,324,1,0,0,0,323,325,3,87,43,0,324,323,1,0,0,0,325,326,1,0,0,0,326,324,1,0,0,0,326,327,1,0,0,0,327,329,1,0,0,0,328,319,1,0,0,0,328,329,1,0,0,0,329,339,1,0,0,0,330,331,5,48,0,0,331,332,5,120,0,0,332,334,1,0,0,0,333,335,3,99,49,0,334,333,1,0,0,0,335,336,1,0,0,0,336,334,1,0,0,0,336,337,1,0,0,0,337,339,1,0,0,0,338,303,1,0,0,0,338,330,1,0,0,0,339,80,1,0,0,0,340,342,3,71,35,0,341,340,1,0,0,0,341,342,1,0,0,0,342,344,1,0,0,0,343,345,3,87,43,0,344,343,1,0,0,0,345,346,1,0,0,0,346,344,1,0,0,0,346,347,1,0,0,0,347,357,1,0,0,0,348,349,5,48,0,0,349,350,5,120,0,0,350,352,1,0,0,0,351,353,3,99,49,0,352,351,1,0,0,0,353,354,1,0,0,0,354,352,1,0,0,0,354,355,1,0,0,0,355,357,1,0,0,0,356,341,1,0,0,0,356,348,1,0,0,0,357,82,1,0,0,0,358,363,5,39,0,0,359,362,3,95,47,0,360,362,8,3,0,0,361,359,1,0,0,0,361,360,1,0,0,0,362,365,1,0,0,0,363,361,1,0,0,0,363,364,1,0,0,0,364,366,1,0,0,0,365,363,1,0,0,0,366,377,5,39,0,0,367,372,5,34,0,0,368,371,3,95,47,0,369,371,8,4,0,0,370,368,1,0,0,0,370,369,1,0,0,0,371,374,1,0,0,0,372,370,1,0,0,0,372,373,1,0,0,0,373,375,1,0,0,0,374,372,1,0,0,0,375,377,5,34,0,0,376,358,1,0,0,0,376,367,1,0,0,0,377,84,1,0,0,0,378,380,7,5,0,0,379,378,1,0,0,0,380,381,1,0,0,0,381,379,1,0,0,0,381,382,1,0,0,0,382,383,1,0,0,0,383,384,6,42,0,0,384,86,1,0,0,0,385,386,7,6,0,0,386,88,1,0,0,0,387,388,7,6,0,0,388,389,7,6,0,0,389,390,7,6,0,0,390,391,7,6,0,0,391,396,5,45,0,0,392,393,7,7,0,0,393,397,7,8,0,0,394,395,7,9,0,0,395,397,7,10,0,0,396,392,1,0,0,0,396,394,1,0,0,0,397,398,1,0,0,0,398,405,5,45,0,0,399,400,7,11,0,0,400,406,7,7,0,0,401,402,7,10,0,0,402,406,7,8,0,0,403,404,5,51,0,0,404,406,5,49,0,0,405,399,1,0,0,0,405,401,1,0,0,0,405,403,1,0,0,0,406,90,1,0,0,0,407,408,7,12,0,0,408,412,7,6,0,0,409,410,5,50,0,0,410,412,7,13,0,0,411,407,1,0,0,0,411,409,1,0,0,0,412,413,1,0,0,0,413,414,5,58,0,0,414,415,7,14,0,0,415,416,7,6,0,0,416,429,1,0,0,0,417,418,5,58,0,0,418,419,7,14,0,0,419,420,7,6,0,0,420,427,1,0,0,0,421,423,5,46,0,0,422,424,7,6,0,0,423,422,1,0,0,0,424,425,1,0,0,0,425,423,1,0,0,0,425,426,1,0,0,0,426,428,1,0,0,0,427,421,1,0,0,0,427,428,1,0,0,0,428,430,1,0,0,0,429,417,1,0,0,0,429,430,1,0,0,0,430,92,1,0,0,0,431,447,5,90,0,0,432,439,7,2,0,0,433,435,7,12,0,0,434,433,1,0,0,0,434,435,1,0,0,0,435,436,1,0,0,0,436,440,7,6,0,0,437,438,5,50,0,0,438,440,7,13,0,0,439,434,1,0,0,0,439,437,1,0,0,0,440,444,1,0,0,0,441,442,5,58,0,0,442,443,7,14,0,0,443,445,7,6,0,0,444,441,1,0,0,0,444,445,1,0,0,0,445,447,1,0,0,0,446,431,1,0,0,0,446,432,1,0,0,0,447,94,1,0,0,0,448,451,5,92,0,0,449,452,3,97,48,0,450,452,9,0,0,0,451,449,1,0,0,0,451,450,1,0,0,0,452,96,1,0,0,0,453,454,5,117,0,0,454,455,3,99,49,0,455,456,3,99,49,0,456,457,3,99,49,0,457,458,3,99,49,0,458,98,1,0,0,0,459,460,7,15,0,0,460,100,1,0,0,0,35,0,226,239,290,300,303,308,314,317,321,326,328,336,338,341,346,354,356,361,363,370,372,376,381,396,405,411,425,427,429,434,439,444,446,451,1,0,1,0];h.DecisionsToDFA=h._ATN.decisionToState.map((o,e)=>new dp(o,e));var ia=h;import{ATN as oa,ATNDeserializer as _p,DFA as xp,FailedPredicateException as Op,NoViableAltException as Ki,Parser as gp,ParserATNSimulator as wp,ParserRuleContext as B,PredictionContextCache as Ap,RecognitionException as q,Token as Rp}from"@browsery/antlr4";var E=class E extends gp{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return E.literalNames}get symbolicNames(){return E.symbolicNames}get ruleNames(){return E.ruleNames}get serializedATN(){return E._serializedATN}createFailedPredicateException(e,t){return new Op(this,e,t)}constructor(e){super(e),this._interp=new wp(this,E._ATN,E.DecisionsToDFA,new Ap)}root(){let e=new Vi(this,this._ctx,this.state);this.enterRule(e,0,E.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(E.EOF)}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}expression(e){e===void 0&&(e=0);let t=this._ctx,r=this.state,i=new Z(this,this._ctx,r),n=i,s=2;this.enterRecursionRule(i,2,E.RULE_expression,e);let p;try{let c;this.enterOuterAlt(i,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:i=new Wi(this,i),this._ctx=i,n=i,this.state=38,i._left=this.comparisonLeft(),this.state=39,i._operator=this.comparisonOperator(),this.state=40,i._right=this.comparisonRight();break;case 1:i=new zi(this,i),this._ctx=i,n=i,this.state=42,this.match(E.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(E.T__1);break;case 3:case 4:i=new Ji(this,i),this._ctx=i,n=i,this.state=46,p=this._input.LA(1),p===3||p===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new Ki(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx);c!==2&&c!==oa.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new Qt(this,new Z(this,t,r)),this.pushNewRecursionContext(i,s,E.RULE_expression),this.state=50,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=51,i._op=this.logicalOperator(),this.state=52,this.expression(4)}}this.state=58,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(c){if(c instanceof q)i.exception=c,this._errHandler.reportError(this,c),this._errHandler.recover(this,c);else throw c}finally{this.unrollRecursionContexts(t)}return i}comparisonLeft(){let e=new Dr(this,this._ctx,this.state);this.enterRule(e,4,E.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}comparisonRight(){let e=new Nr(this,this._ctx,this.state);this.enterRule(e,6,E.RULE_comparisonRight);try{switch(this.state=65,this._errHandler.sync(this),this._input.LA(1)){case 10:case 11:case 12:case 13:case 14:case 37:case 38:case 39:case 40:case 42:this.enterOuterAlt(e,1),this.state=61,this.value();break;case 35:this.enterOuterAlt(e,2),this.state=62,this.qualifiedIdentifier();break;case 6:this.enterOuterAlt(e,3),this.state=63,this.externalConstant();break;case 7:this.enterOuterAlt(e,4),this.state=64,this.arrayValue();break;default:throw new Ki(this)}}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}parenthesizedItem(){let e=new Sr(this,this._ctx,this.state);this.enterRule(e,8,E.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}value(){let e=new Q(this,this._ctx,this.state);this.enterRule(e,10,E.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new to(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(E.NUMBER);break;case 13:case 14:e=new Hi(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new eo(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new Qi(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new Gi(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(E.DATETIME);break;case 37:e=new Zi(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(E.DATE);break;case 39:e=new Yi(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(E.TIME);break;case 42:e=new Xi(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(E.STRING);break;default:throw new Ki(this)}}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}qualifiedIdentifier(){let e=new Gt(this,this._ctx,this.state);this.enterRule(e,12,E.RULE_qualifiedIdentifier);try{let t;this.enterOuterAlt(e,1);{for(this.state=84,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);t!==2&&t!==oa.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(E.T__4)),this.state=86,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);this.state=87,this.identifier()}}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}externalConstant(){let e=new Mr(this,this._ctx,this.state);this.enterRule(e,14,E.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(E.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}identifier(){let e=new rt(this,this._ctx,this.state);this.enterRule(e,16,E.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(E.IDENTIFIER)}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}arrayValue(){let e=new vr(this,this._ctx,this.state);this.enterRule(e,18,E.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(E.T__6),this.state=95,this.value(),this.state=100,this._errHandler.sync(this),t=this._input.LA(1);t===8;)this.state=96,this.match(E.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(E.T__8)}}catch(r){if(r instanceof q)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}boolean_(){let e=new Fr(this,this._ctx,this.state);this.enterRule(e,20,E.RULE_boolean);let t;try{this.enterOuterAlt(e,1),this.state=105,t=this._input.LA(1),t===10||t===11?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof q)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}null_(){let e=new Ir(this,this._ctx,this.state);this.enterRule(e,22,E.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(E.T__11)}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}infinity(){let e=new Lr(this,this._ctx,this.state);this.enterRule(e,24,E.RULE_infinity);let t;try{this.enterOuterAlt(e,1),this.state=109,t=this._input.LA(1),t===13||t===14?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof q)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arithmeticOperator(){let e=new ro(this,this._ctx,this.state);this.enterRule(e,26,E.RULE_arithmeticOperator);let t;try{this.enterOuterAlt(e,1),this.state=111,t=this._input.LA(1),(t&-32)===0&&(1<<t&491520)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof q)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}comparisonOperator(){let e=new Pr(this,this._ctx,this.state);this.enterRule(e,28,E.RULE_comparisonOperator);let t;try{this.enterOuterAlt(e,1),this.state=113,t=this._input.LA(1),(t&-32)===0&&(1<<t&2146959360)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof q)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}logicalOperator(){let e=new kr(this,this._ctx,this.state);this.enterRule(e,30,E.RULE_logicalOperator);let t;try{this.enterOuterAlt(e,1),this.state=115,t=this._input.LA(1),(t-31&-32)===0&&(1<<t-31&15)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof q)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}polarityOperator(){let e=new io(this,this._ctx,this.state);this.enterRule(e,32,E.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(E.POLAR_OP)}catch(t){if(t instanceof q)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}sempred(e,t,r){switch(t){case 1:return this.expression_sempred(e,r)}return!0}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return E.__ATN||(E.__ATN=new _p().deserialize(E._serializedATN)),E.__ATN}};a(E,"OpraFilterParser");var f=E;f.T__0=1;f.T__1=2;f.T__2=3;f.T__3=4;f.T__4=5;f.T__5=6;f.T__6=7;f.T__7=8;f.T__8=9;f.T__9=10;f.T__10=11;f.T__11=12;f.T__12=13;f.T__13=14;f.T__14=15;f.T__15=16;f.T__16=17;f.T__17=18;f.T__18=19;f.T__19=20;f.T__20=21;f.T__21=22;f.T__22=23;f.T__23=24;f.T__24=25;f.T__25=26;f.T__26=27;f.T__27=28;f.T__28=29;f.T__29=30;f.T__30=31;f.T__31=32;f.T__32=33;f.T__33=34;f.IDENTIFIER=35;f.POLAR_OP=36;f.DATE=37;f.DATETIME=38;f.TIME=39;f.NUMBER=40;f.INTEGER=41;f.STRING=42;f.WHITESPACE=43;f.EOF=Rp.EOF;f.RULE_root=0;f.RULE_expression=1;f.RULE_comparisonLeft=2;f.RULE_comparisonRight=3;f.RULE_parenthesizedItem=4;f.RULE_value=5;f.RULE_qualifiedIdentifier=6;f.RULE_externalConstant=7;f.RULE_identifier=8;f.RULE_arrayValue=9;f.RULE_boolean=10;f.RULE_null=11;f.RULE_infinity=12;f.RULE_arithmeticOperator=13;f.RULE_comparisonOperator=14;f.RULE_logicalOperator=15;f.RULE_polarityOperator=16;f.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];f.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,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];f.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];f._serializedATN=[4,1,43,120,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,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,3,1,49,8,1,1,1,1,1,1,1,1,1,5,1,55,8,1,10,1,12,1,58,9,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,66,8,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,78,8,5,1,6,1,6,1,6,5,6,83,8,6,10,6,12,6,86,9,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,5,9,99,8,9,10,9,12,9,102,9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,16,0,1,2,17,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,6,1,0,3,4,1,0,10,11,1,0,13,14,1,0,15,18,1,0,19,30,1,0,31,34,117,0,34,1,0,0,0,2,48,1,0,0,0,4,59,1,0,0,0,6,65,1,0,0,0,8,67,1,0,0,0,10,77,1,0,0,0,12,84,1,0,0,0,14,89,1,0,0,0,16,92,1,0,0,0,18,94,1,0,0,0,20,105,1,0,0,0,22,107,1,0,0,0,24,109,1,0,0,0,26,111,1,0,0,0,28,113,1,0,0,0,30,115,1,0,0,0,32,117,1,0,0,0,34,35,3,2,1,0,35,36,5,0,0,1,36,1,1,0,0,0,37,38,6,1,-1,0,38,39,3,4,2,0,39,40,3,28,14,0,40,41,3,6,3,0,41,49,1,0,0,0,42,43,5,1,0,0,43,44,3,8,4,0,44,45,5,2,0,0,45,49,1,0,0,0,46,47,7,0,0,0,47,49,3,2,1,1,48,37,1,0,0,0,48,42,1,0,0,0,48,46,1,0,0,0,49,56,1,0,0,0,50,51,10,3,0,0,51,52,3,30,15,0,52,53,3,2,1,4,53,55,1,0,0,0,54,50,1,0,0,0,55,58,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,3,1,0,0,0,58,56,1,0,0,0,59,60,3,12,6,0,60,5,1,0,0,0,61,66,3,10,5,0,62,66,3,12,6,0,63,66,3,14,7,0,64,66,3,18,9,0,65,61,1,0,0,0,65,62,1,0,0,0,65,63,1,0,0,0,65,64,1,0,0,0,66,7,1,0,0,0,67,68,3,2,1,0,68,9,1,0,0,0,69,78,5,40,0,0,70,78,3,24,12,0,71,78,3,20,10,0,72,78,3,22,11,0,73,78,5,38,0,0,74,78,5,37,0,0,75,78,5,39,0,0,76,78,5,42,0,0,77,69,1,0,0,0,77,70,1,0,0,0,77,71,1,0,0,0,77,72,1,0,0,0,77,73,1,0,0,0,77,74,1,0,0,0,77,75,1,0,0,0,77,76,1,0,0,0,78,11,1,0,0,0,79,80,3,16,8,0,80,81,5,5,0,0,81,83,1,0,0,0,82,79,1,0,0,0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,87,1,0,0,0,86,84,1,0,0,0,87,88,3,16,8,0,88,13,1,0,0,0,89,90,5,6,0,0,90,91,3,16,8,0,91,15,1,0,0,0,92,93,5,35,0,0,93,17,1,0,0,0,94,95,5,7,0,0,95,100,3,10,5,0,96,97,5,8,0,0,97,99,3,10,5,0,98,96,1,0,0,0,99,102,1,0,0,0,100,98,1,0,0,0,100,101,1,0,0,0,101,103,1,0,0,0,102,100,1,0,0,0,103,104,5,9,0,0,104,19,1,0,0,0,105,106,7,1,0,0,106,21,1,0,0,0,107,108,5,12,0,0,108,23,1,0,0,0,109,110,7,2,0,0,110,25,1,0,0,0,111,112,7,3,0,0,112,27,1,0,0,0,113,114,7,4,0,0,114,29,1,0,0,0,115,116,7,5,0,0,116,31,1,0,0,0,117,118,5,36,0,0,118,33,1,0,0,0,6,48,56,65,77,84,100];f.DecisionsToDFA=f._ATN.decisionToState.map((o,e)=>new xp(o,e));var na=f,oo=class oo extends B{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(Z,0)}EOF(){return this.getToken(f.EOF,0)}get ruleIndex(){return f.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)}};a(oo,"RootContext");var Vi=oo,no=class no extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(no,"ExpressionContext");var Z=no,so=class so extends Z{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(Sr,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)}};a(so,"ParenthesizedExpressionContext");var zi=so,ao=class ao extends Z{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(Z,0)}enterRule(e){e.enterNegativeExpression&&e.enterNegativeExpression(this)}exitRule(e){e.exitNegativeExpression&&e.exitNegativeExpression(this)}accept(e){return e.visitNegativeExpression?e.visitNegativeExpression(this):e.visitChildren(this)}};a(ao,"NegativeExpressionContext");var Ji=ao,po=class po extends Z{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(Dr,0)}comparisonOperator(){return this.getTypedRuleContext(Pr,0)}comparisonRight(){return this.getTypedRuleContext(Nr,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)}};a(po,"ComparisonExpressionContext");var Wi=po,co=class co extends Z{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(Z)}expression(e){return this.getTypedRuleContext(Z,e)}logicalOperator(){return this.getTypedRuleContext(kr,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)}};a(co,"LogicalExpressionContext");var Qt=co,lo=class lo extends B{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(Gt,0)}get ruleIndex(){return f.RULE_comparisonLeft}enterRule(e){e.enterComparisonLeft&&e.enterComparisonLeft(this)}exitRule(e){e.exitComparisonLeft&&e.exitComparisonLeft(this)}accept(e){return e.visitComparisonLeft?e.visitComparisonLeft(this):e.visitChildren(this)}};a(lo,"ComparisonLeftContext");var Dr=lo,fo=class fo extends B{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(Q,0)}qualifiedIdentifier(){return this.getTypedRuleContext(Gt,0)}externalConstant(){return this.getTypedRuleContext(Mr,0)}arrayValue(){return this.getTypedRuleContext(vr,0)}get ruleIndex(){return f.RULE_comparisonRight}enterRule(e){e.enterComparisonRight&&e.enterComparisonRight(this)}exitRule(e){e.exitComparisonRight&&e.exitComparisonRight(this)}accept(e){return e.visitComparisonRight?e.visitComparisonRight(this):e.visitChildren(this)}};a(fo,"ComparisonRightContext");var Nr=fo,mo=class mo extends B{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(Z,0)}get ruleIndex(){return f.RULE_parenthesizedItem}enterRule(e){e.enterParenthesizedItem&&e.enterParenthesizedItem(this)}exitRule(e){e.exitParenthesizedItem&&e.exitParenthesizedItem(this)}accept(e){return e.visitParenthesizedItem?e.visitParenthesizedItem(this):e.visitChildren(this)}};a(mo,"ParenthesizedItemContext");var Sr=mo,uo=class uo extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_value}copyFrom(e){super.copyFrom(e)}};a(uo,"ValueContext");var Q=uo,ho=class ho extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(f.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)}};a(ho,"TimeLiteralContext");var Yi=ho,yo=class yo extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(Ir,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)}};a(yo,"NullLiteralContext");var Qi=yo,To=class To extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(f.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)}};a(To,"DateTimeLiteralContext");var Gi=To,Eo=class Eo extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(f.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)}};a(Eo,"StringLiteralContext");var Xi=Eo,_o=class _o extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(f.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)}};a(_o,"DateLiteralContext");var Zi=_o,xo=class xo extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(Lr,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)}};a(xo,"InfinityLiteralContext");var Hi=xo,Oo=class Oo extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(Fr,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)}};a(Oo,"BooleanLiteralContext");var eo=Oo,go=class go extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(f.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)}};a(go,"NumberLiteralContext");var to=go,wo=class wo extends B{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(rt)}identifier(e){return this.getTypedRuleContext(rt,e)}get ruleIndex(){return f.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)}};a(wo,"QualifiedIdentifierContext");var Gt=wo,Ao=class Ao extends B{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(rt,0)}get ruleIndex(){return f.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)}};a(Ao,"ExternalConstantContext");var Mr=Ao,Ro=class Ro extends B{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(f.IDENTIFIER,0)}get ruleIndex(){return f.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)}};a(Ro,"IdentifierContext");var rt=Ro,bo=class bo extends B{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(Q)}value(e){return this.getTypedRuleContext(Q,e)}get ruleIndex(){return f.RULE_arrayValue}enterRule(e){e.enterArrayValue&&e.enterArrayValue(this)}exitRule(e){e.exitArrayValue&&e.exitArrayValue(this)}accept(e){return e.visitArrayValue?e.visitArrayValue(this):e.visitChildren(this)}};a(bo,"ArrayValueContext");var vr=bo,Do=class Do extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.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)}};a(Do,"BooleanContext");var Fr=Do,No=class No extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.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)}};a(No,"NullContext");var Ir=No,So=class So extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.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)}};a(So,"InfinityContext");var Lr=So,Mo=class Mo extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_arithmeticOperator}enterRule(e){e.enterArithmeticOperator&&e.enterArithmeticOperator(this)}exitRule(e){e.exitArithmeticOperator&&e.exitArithmeticOperator(this)}accept(e){return e.visitArithmeticOperator?e.visitArithmeticOperator(this):e.visitChildren(this)}};a(Mo,"ArithmeticOperatorContext");var ro=Mo,vo=class vo extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_comparisonOperator}enterRule(e){e.enterComparisonOperator&&e.enterComparisonOperator(this)}exitRule(e){e.exitComparisonOperator&&e.exitComparisonOperator(this)}accept(e){return e.visitComparisonOperator?e.visitComparisonOperator(this):e.visitChildren(this)}};a(vo,"ComparisonOperatorContext");var Pr=vo,Fo=class Fo extends B{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return f.RULE_logicalOperator}enterRule(e){e.enterLogicalOperator&&e.enterLogicalOperator(this)}exitRule(e){e.exitLogicalOperator&&e.exitLogicalOperator(this)}accept(e){return e.visitLogicalOperator?e.visitLogicalOperator(this):e.visitChildren(this)}};a(Fo,"LogicalOperatorContext");var kr=Fo,Io=class Io extends B{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(f.POLAR_OP,0)}get ruleIndex(){return f.RULE_polarityOperator}enterRule(e){e.enterPolarityOperator&&e.enterPolarityOperator(this)}exitRule(e){e.exitPolarityOperator&&e.exitPolarityOperator(this)}accept(e){return e.visitPolarityOperator?e.visitPolarityOperator(this):e.visitChildren(this)}};a(Io,"PolarityOperatorContext");var io=Io;import{ParseTreeVisitor as bp}from"@browsery/antlr4";var Lo=class Lo extends v{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Lo,"ExternalConstant");var jr=Lo;var Po=class Po extends bp{constructor(e){super(),this._timeZone=e==null?void 0:e.timeZone}visitChildren(e){let t=super.visitChildren(e);return Array.isArray(t)&&t.length<2?t[0]:t??e.getText()}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitParenthesizedExpression(e){let t=this.visit(e.parenthesizedItem());return new xe(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new Jt(t)}visitComparisonExpression(e){return new le({op:e.comparisonOperator().getText(),left:this.visit(e.comparisonLeft()),right:this.visit(e.comparisonRight())})}visitLogicalExpression(e){let t=[],r=a((i,n)=>{for(let s of i){if(s instanceof Qt&&s.logicalOperator().getText()===n){r(s.expression_list(),s.logicalOperator().getText());continue}let p=this.visit(s);t.push(p)}},"wrapChildren");return r(e.expression_list(),e.logicalOperator().getText()),new fe({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new H(e.getText())}visitExternalConstant(e){return new jr(e.identifier().getText())}visitNullLiteral(){return new Ve}visitBooleanLiteral(e){return new Ke(e.getText()==="true")}visitNumberLiteral(e){return new Oe(e.getText())}visitStringLiteral(e){return new ze(Wt(e.getText()))}visitInfinityLiteral(){return new Oe(1/0)}visitDateLiteral(e){return new be(Wt(e.getText()))}visitDateTimeLiteral(e){return new Yt(Wt(e.getText()))}visitTimeLiteral(e){return new Je(Wt(e.getText()))}visitArrayValue(e){return new _e(e.value_list().map(t=>this.visit(t)))}};a(Po,"FilterTreeVisitor");var Xt=Po;import{ErrorListener as Dp}from"@browsery/antlr4";var ko=class ko extends Dp{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new Rr(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a(ko,"OpraErrorListener");var Zt=ko;function jo(o,e){let t=new Np(o),r=new ia(t),i=new Sp(r),n=new na(i);n.buildParseTrees=!0;let s=[],p=new Zt(s);r.removeErrorListeners(),r.addErrorListener(p),n.removeErrorListeners(),n.addErrorListener(p);let c=n.root();if(s.length){let l=[];for(let w of s)l.push(w.message+(o.includes(`
|
|
8
|
-
`)?" at line: "+
|
|
9
|
-
`));throw x.errors=s,x}return e=e||new Xt,e.visit(c)}a(jo,"parse");var Co=class Co{constructor(e,t){if(this._rules=new N,this._decoderCache=new WeakMap,Object.defineProperty(this,"_rules",{value:new N(null,{caseSensitive:t==null?void 0:t.caseSensitive}),enumerable:!1}),e)for(let[r,i]of Object.entries(e))this.set(r,i)}set(e,t){let r=typeof(t==null?void 0:t.operators)=="string"?t.operators.split(/\s*[,| ]\s*/):t==null?void 0:t.operators;this._rules.set(e,Mp({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?jo(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof le){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof H&&e.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let n=this._rules.get(e.left.value);if(!n)throw new Ee({message:`Field '${e.left.value}' is not available for filter operation`,code:"UNACCEPTED_FILTER_FIELD",details:{field:e.left.value}});if(n.operators&&!n.operators.includes(e.op))throw new Ee({message:`'${e.left.value}' field do not accept '${e.op}' filter operator`,code:"UNACCEPTED_FILTER_OPERATION",details:{field:e.left.value,operator:e.op}});return n.mappedField&&(e.left.value=n.mappedField),n.prepare&&(e.prepare=n.prepare),this.normalizeFilterAst(e.right,t,r),t.pop(),e}if(e instanceof fe)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof Be)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n.expression,t,r)),t.pop(),e;if(e instanceof _e)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof xe)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof H&&r)return e.value=r.normalizeFieldPath(e.value,{scope:i}),e.field=r.getField(e.value,i),e.dataType=e.field.type,e;if(e instanceof v){let n=t.findLastIndex(s=>s instanceof le);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof H&&s.left.field){if(e.value==null&&!s.left.field.required)return e.value;let p;s.op==="like"||s.op==="!like"||s.op==="ilike"||s.op==="!ilike"?p=vp:p=this._decoderCache.get(s.left.field),p||(p=s.left.field.type.generateCodec("decode",{scope:i,projection:"*",ignoreWriteonlyFields:!0,coerce:!0}),this._decoderCache.set(s.left.field,p)),e.value=p(e.value,{coerce:!0})}}}return e}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};a(Co,"FilterRules");var it=Co;import Vp from"object-hash";import{asMutable as zp}from"ts-gems";import{validator as Jp,vg as G}from"valgen";import{omitUndefined as Bp}from"@jsopen/objects";import{asMutable as Kp}from"ts-gems";import{asMutable as $p}from"ts-gems";import{uid as qp}from"uid";var m={};Tr(m,{ComplexType:()=>ot,EnumType:()=>nt,HttpController:()=>Ht,HttpOperation:()=>Uo,MQController:()=>$o,MQOperation:()=>qo,MappedType:()=>st,MixinType:()=>at,SimpleType:()=>pt,SpecVersion:()=>Vh,UnionType:()=>ct,WSController:()=>Bo,WSOperation:()=>Ko,isComplexType:()=>Ip,isDataType:()=>Fp,isEnumType:()=>jp,isHttpController:()=>Up,isMappedType:()=>kp,isMixinType:()=>Pp,isSimpleType:()=>Lp,isUnionType:()=>Cp});var Vh="1.0";var ot;(function(o){o.Kind="ComplexType"})(ot||(ot={}));var nt;(function(o){o.Kind="EnumType"})(nt||(nt={}));var st;(function(o){o.Kind="MappedType"})(st||(st={}));var at;(function(o){o.Kind="MixinType"})(at||(at={}));var pt;(function(o){o.Kind="SimpleType"})(pt||(pt={}));var ct;(function(o){o.Kind="UnionType"})(ct||(ct={}));var Ht;(function(o){o.Kind="HttpController"})(Ht||(Ht={}));var Uo;(function(o){o.Kind="HttpOperation"})(Uo||(Uo={}));var $o;(function(o){o.Kind="MQController"})($o||($o={}));var qo;(function(o){o.Kind="MQOperation"})(qo||(qo={}));function Fp(o){return o&&typeof o=="object"&&(o.kind===ot.Kind||o.kind===nt.Kind||o.kind===st.Kind||o.kind===pt.Kind||o.kind===at.Kind||o.kind===ct.Kind)}a(Fp,"isDataType");function Ip(o){return o&&typeof o=="object"&&o.kind===ot.Kind}a(Ip,"isComplexType");function Lp(o){return o&&typeof o=="object"&&o.kind===pt.Kind}a(Lp,"isSimpleType");function Pp(o){return o&&typeof o=="object"&&o.kind===at.Kind}a(Pp,"isMixinType");function kp(o){return o&&typeof o=="object"&&o.kind===st.Kind}a(kp,"isMappedType");function jp(o){return o&&typeof o=="object"&&o.kind===nt.Kind}a(jp,"isEnumType");function Cp(o){return o&&typeof o=="object"&&o.kind===ct.Kind}a(Cp,"isUnionType");function Up(o){return o&&typeof o=="object"&&o.kind===Ht.Kind}a(Up,"isHttpController");var Bo;(function(o){o.Kind="WSController"})(Bo||(Bo={}));var Ko;(function(o){o.Kind="WSOperation"})(Ko||(Ko={}));var Vo=class Vo{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[Ae])return this.element;if(this.parent)return this._document=this.parent.getDocument();throw new Error("ApiDocument not found in document tree")}hasDataType(e,t){return!!this.findDataType(e,t)}findDataType(e,t){var i;let r=(i=this[L])==null?void 0:i.get(e);return r&&r.inScope(t)?r:this.parent?this.parent.findDataType(e,t):void 0}getDataType(e,t){let r=this.findDataType(e,t);if(r)return r;let i="";if(typeof e=="function")i=Reflect.getMetadata(d,e).name;else if(typeof e=="object"){let n=e[d];i=n==null?void 0:n.name}throw i||(e&&typeof e=="string"?i=e:typeof e=="function"&&(i=e.name)),r?new TypeError(`Data type${i?" ("+i+")":""} is not in requested scope (${t})`):new TypeError(`Unknown data type${i?" ("+i+")":""}`)}getDataTypeNameWithNs(e){if(!e.name)return;let t=this.getDocument().getDataTypeNs(e);return t?t+":"+e.name:e.name}getComplexType(e,t){let r=this.getDataType(e,t);if(r.kind===m.ComplexType.Kind)return r;throw new TypeError(`Data type "${r.name}" is not a ComplexType`)}getSimpleType(e,t){let r=this.getDataType(e,t);if(r.kind===m.SimpleType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a SimpleType`)}getEnumType(e,t){let r=this.getDataType(e,t);if(r.kind===m.EnumType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a EnumType`)}getMappedType(e,t){let r=this.getDataType(e,t);if(r.kind===m.MappedType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MappedType`)}getMixinType(e,t){let r=this.getDataType(e,t);if(r.kind===m.MixinType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}getUnionType(e,t){let r=this.getDataType(e,t);if(r.kind===m.UnionType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}};a(Vo,"DocumentNode");var Cr=Vo;var g=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=$p(this);e.id=qp(16),Object.defineProperty(e,"node",{value:new Cr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),Jo=class Jo{};a(Jo,"DocumentElementClass");var zo=Jo;g.prototype=zo.prototype;var De=Symbol.for("nodejs.util.inspect.custom"),ge="\x1B[0m",Ne="\x1B[33m",Se="\x1B[35m";function er(o,e){return!e||o==="*"?!0:o?Array.isArray(e)?e.some(t=>typeof t=="string"?o===t:t.test(o)):typeof e=="string"?o===e:e.test(o):!1}a(er,"testScopeMatch");var _=a(function(o,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!I.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);g.call(this,o);let r=Kp(this);r.kind=e.kind,r.scopePattern=e.scopePattern?Array.isArray(e.scopePattern)?e.scopePattern:[e.scopePattern]:void 0,r.name=e.name,r.description=e.description,r.abstract=e.abstract,r.examples=e.examples},"DataType"),Yo=class Yo extends g{get embedded(){return!this.name}inScope(e){return er(e,this.scopePattern)}toJSON(e){let t=this._locateBase(r=>!r.inScope(e==null?void 0:e.scope));if(t){let r=this.node.getDataTypeNameWithNs(t);throw new TypeError(`"${r}" model is not available for "${(e==null?void 0:e.scope)||"null"}" scope`)}return Bp({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[De](){return`[${Ne+Object.getPrototypeOf(this).constructor.name+ge} ${Se+this.name+ge}]`}};a(Yo,"DataTypeClass");var Wo=Yo;_.prototype=Wo.prototype;var lt=/^([+-])?([a-z$_][\w.]*)$/i,j=a(function(...o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;_.call(this,e,t,r);let i=zp(this);i._fields=new N},"ComplexTypeBase"),Go=class Go extends _{fieldCount(e){if(e==="*")return this._fields.size;let t=0;for(let r of this.fields(e))t++;return t}fieldEntries(e){let t=this._fields.entries();if(e==="*")return t;let r;return{next(){for(;t&&(r=t.next(),!(r.done||r.value&&r.value[1].inScope(e))););return r.done?{done:r.done,value:void 0}:{done:r.done,value:[r.value[0],r.value[1].forScope(e)]}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fields(e){let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[1]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fieldNames(e){if(e==="*")return this._fields.keys();let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[0]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}findField(e,t){if(e.includes(".")){let i=this.parseFieldPath(e,{scope:t});if(i.length===0)throw new Error(`Field "${e}" does not exist in scope "${t}"`);let n=i.pop();return n==null?void 0:n.field}let r=this._fields.get(e);if(r&&r.inScope(t))return r.forScope(t)}getField(e,t){let r=this.findField(e,"*");if(r&&!r.inScope(t))throw new Error(`Field "${e}" does not exist in scope "${t||"null"}"`);if(!r)throw new Error(`Field (${e}) does not exist`);return r.forScope(t)}parseFieldPath(e,t){var w,y,X;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,x=a(()=>p.map(k=>k.fieldName).join("."),"getStrPath");for(let k=0;k<s;k++){let K={fieldName:n[k],dataType:c};p.push(K);let Ce=lt.exec(n[k]);if(!Ce)throw new TypeError(`Invalid field name (${x()})`);if(Ce[1]&&((k===0&&l==="first"||l==="each")&&(K.sign=Ce[1]),K.fieldName=Ce[2]),r){if(r instanceof j){if(i=r.findField(K.fieldName,t==null?void 0:t.scope),i){K.fieldName=i.name,K.field=i,K.dataType=i.type,r=i.type;continue}if(((w=r.additionalFields)==null?void 0:w[0])===!0){K.additionalField=!0,K.dataType=c,r=void 0;continue}if(((y=r.additionalFields)==null?void 0:y[0])==="type"&&((X=r.additionalFields)==null?void 0:X[1])instanceof _){K.additionalField=!0,K.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(ei=>ei.fieldName).join(".")})`)}throw new TypeError(`"${p.map(ei=>ei.fieldName).join(".")}" field is not a complex type and has no child fields`)}K.additionalField=!0,K.dataType=c}return p}normalizeFieldPath(e,t){return this.parseFieldPath(e,t).map(r=>(r.sign||"")+r.fieldName).join(".")}generateCodec(e,t){var p;let r=t!=null&&t.cache?t:{...t,projection:Array.isArray(t==null?void 0:t.projection)?Hs(t.projection):t==null?void 0:t.projection,currentPath:""},i=this._generateSchema(e,r),n;if(this.additionalFields instanceof _)n=this.additionalFields.generateCodec(e,t);else if(typeof this.additionalFields=="boolean")n=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)n="error";else{let c=n[1];n=Jp((l,x,w)=>x.fail(w,c,l))}let s=G.isObject(i,{ctor:this.name==="object"?Object:this.ctor,additionalFields:n,name:this.name,coerce:!0,caseInSensitive:t==null?void 0:t.caseInSensitive,onFail:t==null?void 0:t.onFail});if(r.level===0&&((p=r.forwardCallbacks)!=null&&p.size))for(let c of r.forwardCallbacks)c();return s}_generateSchema(e,t){var c;t.fieldCache=t.fieldCache||new Map,t.level=t.level||0,t.forwardCallbacks=t.forwardCallbacks||new Set;let r={},{currentPath:i,projection:n}=t,s=!!(n&&Object.values(n).find(l=>!l.sign)),p;for(let l of this.fields("*")){if(!l.inScope(t.scope)||!(t.keepKeyFields&&this.keyField)&&(t.ignoreReadonlyFields&&l.readonly||t.ignoreWriteonlyFields&&l.writeonly)){r[l.name]=G.isUndefined({coerce:!0});continue}p=l.name;let x;if(n!=="*"&&(x=n==null?void 0:n[p.toLowerCase()],(x==null?void 0:x.sign)==="-"||s&&!x||!s&&l.exclusive&&!x)){r[l.name]=G.isUndefined({coerce:!0});continue}let w=typeof n=="object"?((c=n[p])==null?void 0:c.projection)||"*":n,y=t.fieldCache.get(l),X=typeof w=="string"?w:Vp(w||{});y||(y={},t.fieldCache.set(l,y));let k=y[X];if(k===null)k=G.isAny(),t.forwardCallbacks.add(()=>{k=y[X],r[p]=t.partial||!l.required?G.optional(k):G.required(k)});else if(!k){let K=a(()=>{y[X]=null;let Ce=this._generateFieldCodec(e,l,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:w,currentPath:i+(i?".":"")+p});return y[X]=Ce,Ce},"defaultGenerator");t.fieldHook?k=t.fieldHook(l,t.currentPath,K):k=K()}r[p]=t.partial||!(l.required||k.id==="required")?G.optional(k):k.id==="required"?k:G.required(k)}return t.allowPatchOperators&&(r._$pull=G.optional(G.isAny()),r._$push=G.optional(G.isAny())),r}_generateFieldCodec(e,t,r){let i=t.type.generateCodec(e,{...r,level:r.level+1},{convertToNative:t.convertToNative});return t.fixed&&(i=G.isEqual(t.fixed)),t.isArray&&(i=G.isArray(i)),i}};a(Go,"ComplexTypeBaseClass");var Qo=Go;j.prototype=Qo.prototype;import"reflect-metadata";import{omitUndefined as Xo}from"@jsopen/objects";import{asMutable as Wp}from"ts-gems";import{vg as Yp}from"valgen";var ee=a(function(...o){if(!this)return ee[A].apply(void 0,o);let[e,t,r]=o;_.call(this,e,t,r);let i=Wp(this);if(i.kind=m.EnumType.Kind,t.base){if(!(t.base instanceof ee))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${i.kind}"`);i.base=t.base}i.instance=t.instance,i.ownAttributes=P(t.attributes||{}),i.attributes=i.base?P(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),Zo=class Zo extends _{extendsFrom(e){var t;return e instanceof _||(e=this.node.getDataType(e)),e instanceof ee?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return Yp.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return Xo({...t,kind:this.kind,base:r,attributes:P(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Zo,"EnumTypeClass");var tr=Zo;ee.prototype=tr.prototype;Object.assign(ee,tr);function Qp(o,...e){let t=e.length>=2?e[0]:void 0,r=e.length>=2?e[1]:e[0],i={},n=o;if(Array.isArray(o)){if(t){if(!Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be array');n=[...t,...o]}i={},o.forEach(p=>{var l;if(!isNaN(Number(p)))return;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[p]=Xo({description:c})})}else{if(t){if(Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be enum object');n={...t,...o}}Object.keys(o).forEach(p=>{var l;if(!isNaN(Number(p)))return;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[o[p]]=Xo({alias:p,description:c})})}let s={kind:m.EnumType.Kind,attributes:i,base:r==null?void 0:r.base,name:r==null?void 0:r.name,description:r==null?void 0:r.description};return Object.defineProperty(o,d,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(Qp,"EnumTypeFactory");ee.prototype=tr.prototype;ee[A]=Qp;var Nn={};Tr(Nn,{Base64Type:()=>rn,DateTimeType:()=>ir,DateTimeTypeTz:()=>or,DateType:()=>rr,EmailType:()=>te,FieldPathType:()=>W,FilterType:()=>Ye,ObjectIdType:()=>dn,OperationResult:()=>oe,PartialDateType:()=>sr,TimeType:()=>ar,UrlType:()=>Dn,UuidType:()=>Br});import{__decorate as Xp,__metadata as Zp}from"tslib";import{isBase64 as Hp,validator as la,vg as ca}from"valgen";import"reflect-metadata";import{omitUndefined as aa}from"@jsopen/objects";import{asMutable as Gp}from"ts-gems";import{isAny as pa}from"valgen";function Ho(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!I.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);i=o.name}else i=r.name,i=i.toLowerCase();let n=Reflect.getOwnMetadata(d,r)||{};o&&Object.assign(n,o),n.kind=m.SimpleType.Kind,n.name=i,Reflect.defineMetadata(d,n,r);for(let s of e)s(n,r)},"decorator");return t.Example=(r,i)=>(e.push(n=>{n.examples=n.examples||[],n.examples.push({description:i,value:r})}),t),t}a(Ho,"SimpleTypeDecoratorFactory");function sa(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(d,e.constructor)||{},i=Reflect.getMetadata("design:type",e,t),n="string";i===Boolean?n="boolean":i===Number&&(n="number"),r.kind=m.SimpleType.Kind,r.attributes=r.attributes||{},r.attributes[t]={format:(o==null?void 0:o.format)||n,description:o==null?void 0:o.description,deprecated:o==null?void 0:o.deprecated},Reflect.defineMetadata(d,r,e.constructor)}}a(sa,"AttributeDecoratorFactory");var u=a(function(...o){var n,s;if(!this)return u[A](...o);let[e,t,r]=o;_.call(this,e,t,r);let i=Gp(this);if(i.kind=m.SimpleType.Kind,t.base){if(!(t.base instanceof u))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base}if(i.properties=t.properties,i.ownNameMappings={...t.nameMappings},i.nameMappings={...(n=i.base)==null?void 0:n.nameMappings,...t.nameMappings},i.ownAttributes=P(t.attributes||{}),i.attributes=i.base?P(i.base.attributes):{},i.ownAttributes)for(let[p,c]of Object.entries(i.ownAttributes)){if((s=i.attributes[p])!=null&&s.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);i.attributes[p]=c}i._generateDecoder=t.generateDecoder,i._generateEncoder=t.generateEncoder},"SimpleType"),tn=class tn extends _{extend(e){return Object.setPrototypeOf(e,this),e}extendsFrom(e){var t;return e instanceof _||(e=this.node.getDataType(e)),e instanceof u?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(e,t,r){let i={...this.properties,...r};if(e==="decode"){let s=this;for(;s;){if(s._generateDecoder)return s._generateDecoder(i,(t==null?void 0:t.documentElement)||this.owner,t==null?void 0:t.scope);s=this.base}return pa}let n=this;for(;n;){if(n._generateEncoder)return n._generateEncoder(i,(t==null?void 0:t.documentElement)||this.owner,t==null?void 0:t.scope);n=this.base}return pa}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=aa(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?P(this.properties):{};let s={...t,kind:this.kind,base:r,attributes:i&&Object.keys(i).length?i:void 0,properties:Object.keys(n).length?n:void 0};return Object.keys(this.ownNameMappings).length&&(s.nameMappings={...this.ownNameMappings}),aa(s,!0)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(tn,"SimpleTypeClass");var en=tn;u.prototype=en.prototype;Object.assign(u,Ho);u[A]=Ho;u.Attribute=sa;var ft,rn=(ft=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=ca.isBase64({coerce:!0});return e.convertToNative?ca.pipe([t,ec],{coerce:!0}):t}[O](){return tc}},a(ft,"Base64Type"),ft);rn=Xp([u({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),Zp("design:paramtypes",[Object])],rn);var ec=la(o=>Buffer.from(o,"base64")),tc=la(o=>Buffer.isBuffer(o)?o.toString("base64"):Hp(o));import{__decorate as on,__metadata as nn}from"tslib";import{vg as Me}from"valgen";var fa=Me.isDateString({precisionMin:"day",trim:"day",coerce:!0}),rc=Me.isDate({trim:"day",coerce:!0}),mt,rr=(mt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t;e.convertToNative?t=rc:t=fa;let r=[t];return e.minValue!=null&&r.push(Me.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Me.isLte(t(e.maxValue))),r.length>0?Me.pipe(r,{returnIndex:0}):t}[O](e){let t=fa,r=[t];return e.minValue!=null&&r.push(Me.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Me.isLte(t(e.maxValue))),r.length>0?Me.pipe(r,{returnIndex:0}):t}},a(mt,"DateType"),mt);on([u.Attribute({description:"Minimum value"}),nn("design:type",String)],rr.prototype,"minValue",void 0);on([u.Attribute({description:"Maximum value"}),nn("design:type",String)],rr.prototype,"maxValue",void 0);rr=on([u({name:"date",description:"A date without time",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18","Full date value"),nn("design:paramtypes",[Object])],rr);import{__decorate as sn,__metadata as an}from"tslib";import{vg as ve}from"valgen";var ma=ve.isDateString({precisionMin:"day",trim:"tz",coerce:!0}),ic=ve.isDate({coerce:!0}),ut,ir=(ut=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t;e.convertToNative?t=ic:t=ma;let r=[t];return e.minValue!=null&&r.push(ve.isGte(t(e.minValue))),e.maxValue!=null&&r.push(ve.isLte(t(e.maxValue))),r.length>0?ve.pipe(r,{returnIndex:0}):t}[O](e){let t=ma,r=[t];return e.minValue!=null&&r.push(ve.isGte(t(e.minValue))),e.maxValue!=null&&r.push(ve.isLte(t(e.maxValue))),r.length>0?ve.pipe(r,{returnIndex:0}):t}},a(ut,"DateTimeType"),ut);sn([u.Attribute({description:"Minimum value"}),an("design:type",String)],ir.prototype,"minValue",void 0);sn([u.Attribute({description:"Maximum value"}),an("design:type",String)],ir.prototype,"maxValue",void 0);ir=sn([u({name:"datetime",description:"A full datetime value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15").Example("2021-04-18 22:30:15").Example("2021-04-18 22:30"),an("design:paramtypes",[Object])],ir);import{__decorate as pn,__metadata as cn}from"tslib";import{vg as We}from"valgen";var ua=We.isDateString({precisionMin:"tz",coerce:!0}),dt,or=(dt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=ua,r=[t];return e.minValue!=null&&r.push(We.isGte(t(e.minValue))),e.maxValue!=null&&r.push(We.isLte(t(e.maxValue))),r.length>0?We.pipe(r,{returnIndex:0}):t}[O](e){let t=ua,r=[t];return e.minValue!=null&&r.push(We.isGte(t(e.minValue))),e.maxValue!=null&&r.push(We.isLte(t(e.maxValue))),r.length>0?We.pipe(r,{returnIndex:0}):t}},a(dt,"DateTimeTypeTz"),dt);pn([u.Attribute({description:"Minimum value"}),cn("design:type",String)],or.prototype,"minValue",void 0);pn([u.Attribute({description:"Maximum value"}),cn("design:type",String)],or.prototype,"maxValue",void 0);or=pn([u({name:"datetimetz",description:"A full datetime value with time zone information",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15+03:00"),cn("design:paramtypes",[Object])],or);import{__decorate as ue,__metadata as de}from"tslib";import{vg as da}from"valgen";var ht,te=(ht=class{constructor(e){e&&Object.assign(this,e)}[T](e){return da.isEmail({...e,coerce:!0})}[O](e){return da.isEmail({...e,coerce:!0})}},a(ht,"EmailType"),ht);ue([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),de("design:type",Boolean)],te.prototype,"allowDisplayName",void 0);ue([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),de("design:type",Boolean)],te.prototype,"requireDisplayName",void 0);ue([u.Attribute({description:"If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",default:!0}),de("design:type",Boolean)],te.prototype,"utf8LocalPart",void 0);ue([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),de("design:type",Boolean)],te.prototype,"ignoreMaxLength",void 0);ue([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),de("design:type",Boolean)],te.prototype,"allowIpDomain",void 0);ue([u.Attribute({description:"If set to `true`, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.",default:!1}),de("design:type",Boolean)],te.prototype,"domainSpecificValidation",void 0);ue([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol one of the strings defined in it, the validation fails."}),de("design:type",Array)],te.prototype,"hostBlacklist",void 0);ue([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol matches none of the strings defined in it, the validation fails."}),de("design:type",Array)],te.prototype,"hostWhitelist",void 0);ue([u.Attribute({description:"If set to a string, then the validator will reject emails that include any of the characters in the string, in the name part."}),de("design:type",String)],te.prototype,"blacklistedChars",void 0);te=ue([u({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),de("design:paramtypes",[Object])],te);import{__decorate as ln,__metadata as fn}from"tslib";import{toString as oc,validator as nc,vg as sc}from"valgen";var yt,W=(yt=class{constructor(e){e&&Object.assign(this,e)}[T](e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=nc("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return sc.pipe([oc,s])}[O](e,t,r){return this[T](e,t,r)}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");_.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),allowSigns:e.allowSigns}}},a(yt,"FieldPathType"),yt);ln([u.Attribute({description:"Data type which field belong to"}),fn("design:type",Object)],W.prototype,"dataType",void 0);ln([u.Attribute({description:'Determines if signs (+,-) are allowed. If set "first" signs are allowed only beginning of the field pathIf set "each" signs are allowed at each field in the path'}),fn("design:type",String)],W.prototype,"allowSigns",void 0);W=ln([u({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),fn("design:paramtypes",[Object])],W);import{__decorate as mn,__metadata as un}from"tslib";import{validator as ya}from"valgen";var nr={};Tr(nr,{$and:()=>pc,$arithmetic:()=>bc,$array:()=>ha,$date:()=>cc,$eq:()=>uc,$field:()=>mc,$gt:()=>hc,$gte:()=>yc,$ilike:()=>wc,$in:()=>_c,$like:()=>Oc,$lt:()=>Tc,$lte:()=>Ec,$ne:()=>dc,$notILike:()=>Ac,$notIn:()=>xc,$notLike:()=>gc,$number:()=>fc,$or:()=>ac,$paren:()=>Rc,$time:()=>lc,ArithmeticExpression:()=>Be,ArithmeticExpressionItem:()=>wr,ArrayExpression:()=>_e,Ast:()=>zt,BooleanLiteral:()=>Ke,ComparisonExpression:()=>le,DateLiteral:()=>be,DateTimeLiteral:()=>Yt,Expression:()=>$,FilterTreeVisitor:()=>Xt,Literal:()=>v,LogicalExpression:()=>fe,NegativeExpression:()=>Jt,NullLiteral:()=>Ve,NumberLiteral:()=>Oe,OpraErrorListener:()=>Zt,ParenthesizedExpression:()=>xe,QualifiedIdentifier:()=>H,StringLiteral:()=>ze,Term:()=>qe,TimeLiteral:()=>Je,parse:()=>jo});function ac(...o){return new fe({op:"or",items:o})}a(ac,"$or");function pc(...o){return new fe({op:"and",items:o})}a(pc,"$and");function cc(o){return new be(o)}a(cc,"$date");function lc(o){return new Je(o)}a(lc,"$time");function fc(o){return new Oe(o)}a(fc,"$number");function ha(...o){return new _e(o.map(Ur))}a(ha,"$array");function mc(o){return new H(o)}a(mc,"$field");function uc(o,e){return re("=",o,e)}a(uc,"$eq");function dc(o,e){return re("!=",o,e)}a(dc,"$ne");function hc(o,e){return re(">",o,e)}a(hc,"$gt");function yc(o,e){return re(">=",o,e)}a(yc,"$gte");function Tc(o,e){return re("<",o,e)}a(Tc,"$lt");function Ec(o,e){return re("<=",o,e)}a(Ec,"$lte");function _c(o,e){return re("in",o,e)}a(_c,"$in");function xc(o,e){return re("!in",o,e)}a(xc,"$notIn");function Oc(o,e){return re("like",o,e)}a(Oc,"$like");function gc(o,e){return re("!like",o,e)}a(gc,"$notLike");function wc(o,e){return re("ilike",o,e)}a(wc,"$ilike");function Ac(o,e){return re("!ilike",o,e)}a(Ac,"$notILike");function Rc(o){return new xe(o)}a(Rc,"$paren");function bc(o){let e=new Be;return e.add=t=>(e.append("+",Tt(t)),e),e.sub=t=>(e.append("-",Tt(t)),e),e.mul=t=>(e.append("*",Tt(t)),e),e.div=t=>(e.append("/",Tt(t)),e),e.append("+",Ur(o)),e}a(bc,"$arithmetic");function re(o,e,t){let r=typeof e=="string"?new H(e):Ur(e),i=Ur(t);return new le({op:o,left:r,right:i})}a(re,"comparisonExpression");var Ur=a(o=>Array.isArray(o)?ha(...o.map(Tt)):Tt(o),"wrapEntryValue"),Tt=a(o=>o instanceof $?o:typeof o=="boolean"?new Ke(o):typeof o=="number"||typeof o=="bigint"?new Oe(o):o==null?new Ve:o instanceof Date?new be(o):new ze(""+o),"_wrapEntryValue");var Et,Ye=(Et=class{constructor(e){e&&Object.assign(this,e)}[T](e,t){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new it(e.rules):void 0;return Dc(r,i)}[O](){return Nc}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");_.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),rules:e.rules}}},a(Et,"FilterType"),Et);mn([u.Attribute({description:"Data type which filtering fields belong to"}),un("design:type",Object)],Ye.prototype,"dataType",void 0);mn([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),un("design:type",Object)],Ye.prototype,"rules",void 0);Ye=mn([u({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),un("design:paramtypes",[Object])],Ye);var Dc=a((o,e,t)=>ya("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=nr.parse(r);return e?e.normalizeFilter(s,o,t):s}catch(s){i.fail(n,`Not a valid filter expression. ${s.message}`,r);return}i.fail(n,"Nt a valid filter expression string",r)}),"decodeFilter"),Nc=ya("encodeFilter",(o,e,t)=>{if(o instanceof nr.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});import{__decorate as Sc,__metadata as Mc}from"tslib";import{vg as Ta}from"valgen";var _t,dn=(_t=class{constructor(e){e&&Object.assign(this,e)}[T](){return Ta.isObjectId({coerce:!0})}[O](){return Ta.isObjectId({coerce:!0})}},a(_t,"ObjectIdType"),_t);dn=Sc([u({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),Mc("design:paramtypes",[Object])],dn);import{__decorate as ye,__metadata as Te}from"tslib";import{omitUndefined as Ea}from"@jsopen/objects";import{asMutable as Fc}from"ts-gems";import{omitUndefined as vc}from"@jsopen/objects";function hn(o){let e=[],t=a(function(r,i){if(typeof i!="string")throw new TypeError("Symbol properties can't be used as a field");let n=Reflect.getOwnMetadata(d,r.constructor)||{};n.kind=m.ComplexType.Kind,n.fields=n.fields||{};let s=Reflect.getMetadata("design:type",r,i),p=n.fields[i]={...o,designType:s};s===Array?p.isArray=!0:p.type=p.type||s,Reflect.defineMetadata(d,n,r.constructor);for(let c of e)c(p)},"decorator");return t.Override=(r,i)=>(e.push(n=>{n.override=n.override||[],n.override.push(vc({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(hn,"ApiFieldDecoratorFactory");var C=a(function(...o){if(!this){let[n]=o;return C[A](n)}let[e,t]=o;g.call(this,e);let r=Fc(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof j))throw new Error("Field origin should be one of ComplexType, MappedType or MixinType");r.origin=i,r.type=t.type||e.node.getDataType("any"),r.description=t.description,r.isArray=t.isArray,r.isNestedEntity=t.isNestedEntity,r.default=t.default,r.fixed=t.fixed,r.required=t.required,r.exclusive=t.exclusive,r.localization=t.localization,r.keyField=t.keyField,r.deprecated=t.deprecated,r.readonly=t.readonly,r.writeonly=t.writeonly,r.examples=t.examples,r.override=t.override,r.scopePattern=t.scopePattern?Array.isArray(t.scopePattern)?t.scopePattern:[t.scopePattern]:void 0,r.convertToNative=t.convertToNative??(r.type.kind==="SimpleType"&&t.designType!==String&&typeof t.designType=="function"&&t.designType!==Object),r.override=t.override},"ApiField"),Tn=class Tn extends g{inScope(e){return er(e,this.scopePattern)}forScope(e){if(!(e&&this.override))return this;this._overrideCache=this._overrideCache||{};let t=this._overrideCache[e];if(t)return t;if(e!=="*"){for(let r of this.override)if(er(e,r.scopePattern)){t=Ea({...r,id:void 0,owner:void 0,node:void 0,origin:void 0,name:void 0,type:void 0,override:void 0,_overrideCache:void 0,scopePattern:r.scopePattern}),Object.setPrototypeOf(t,this);break}}return t=t||this,this._overrideCache[e]=t,t}toJSON(e){var r;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return Ea({type:t||((r=this.type)==null?void 0:r.toJSON(e)),description:this.description,isArray:this.isArray||void 0,isNestedEntity:this.isNestedEntity||void 0,default:this.default,fixed:this.fixed,required:this.required||void 0,exclusive:this.exclusive||void 0,localization:this.localization||void 0,keyField:this.keyField||void 0,deprecated:this.deprecated||void 0,readonly:this.readonly||void 0,writeonly:this.writeonly||void 0,examples:this.examples})}};a(Tn,"ApiFieldClass");var yn=Tn;C.prototype=yn.prototype;Object.assign(C,hn);C[A]=hn;import"reflect-metadata";import{omitUndefined as Lc}from"@jsopen/objects";import{asMutable as Pc}from"ts-gems";var En=class En extends Ee{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(En,"OpraDocumentError");var xt=En;var _n=class _n{constructor(e){this.path="",this.error=new xt,this.showErrorDetails=!0,this.maxErrors=(e==null?void 0:e.maxErrors)||0,this.error.message=""}addError(e){if(!this.error.details.length)if(e instanceof Error)this.error.stack=e.stack;else{let t=new Error;Error.captureStackTrace(t,this.addError),this.error.stack=t.stack}if(this.error.add({message:typeof e=="string"?e:e.message,path:this.path,...typeof e=="object"?e:void 0}),this.error.details.length>=this.maxErrors)throw this.error}enter(e,t){let r=this.path;this.path=this.path+e;try{return t()}catch(i){i!==this.error&&this.addError(i)}finally{this.path=r}}async enterAsync(e,t){let r=this.path;this.path=this.path+e;try{return await t()}catch(i){i!==this.error&&this.addError(i)}finally{this.path=r}}extend(e){let t={...e};return Object.setPrototypeOf(t,this),t}};a(_n,"DocumentInitContext");var he=_n;import{omit as Ic}from"@jsopen/objects";function xn(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!I.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);t=o.name}else t=e.name;let r=Reflect.getOwnMetadata(d,e);r||(r={},Reflect.defineMetadata(d,r,e)),r.kind=m.ComplexType.Kind,r.name=t,o&&Object.assign(r,Ic(o,["name"]))}}a(xn,"ComplexTypeDecorator");var ie=a(function(...o){var n;if(!this)return ie[A].apply(void 0,o);let[e,t]=o,r=o[2]||new he({maxErrors:0});j.call(this,e,t,r);let i=Pc(this);i.kind=m.ComplexType.Kind,i.discriminatorField=t.discriminatorField,i.discriminatorValue=t.discriminatorValue,t.base&&r.enter(".base",()=>{if(!(t.base instanceof j))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.additionalFields=i.base.additionalFields,i.keyField=i.base.keyField;for(let s of i.base.fields("*"))i._fields.set(s.name,new C(this,s))}),t.additionalFields!==void 0&&(i.additionalFields=t.additionalFields),t.keyField!==void 0&&(i.keyField=t.keyField),i.ctor=t.ctor||((n=i.base)==null?void 0:n.ctor),t.fields&&r.enter(".fields",()=>{for(let[s,p]of Object.entries(t.fields)){let c=new C(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),gn=class gn extends j{extendsFrom(e){var t;return e instanceof _||(e=this.node.getDataType(e)),e instanceof j?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i={...t,kind:this.kind,base:this.base?r||this.base.toJSON(e):void 0,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue};if(this.additionalFields)if(this.additionalFields instanceof _){let n=this.node.getDataTypeNameWithNs(this.additionalFields);i.additionalFields=n||this.additionalFields.toJSON(e)}else i.additionalFields=this.additionalFields;if(this._fields.size){let n={},s=0;for(let p of this._fields.values())p.origin===this&&p.inScope(e==null?void 0:e.scope)&&(n[p.name]=p.toJSON(e),s++);s&&(i.fields=n)}return Lc(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(gn,"ComplexTypeClass");var On=gn;ie.prototype=On.prototype;Object.assign(ie,xn);ie[A]=xn;var Ot,oe=(Ot=class{constructor(e){e&&Object.assign(this,e)}},a(Ot,"OperationResult"),Ot);ye([C(),Te("design:type",Number)],oe.prototype,"affected",void 0);ye([C(),Te("design:type",Number)],oe.prototype,"totalMatches",void 0);ye([C(),Te("design:type",String)],oe.prototype,"context",void 0);ye([C(),Te("design:type",String)],oe.prototype,"type",void 0);ye([C(),Te("design:type",String)],oe.prototype,"message",void 0);ye([C({type:"any"}),Te("design:type",Object)],oe.prototype,"payload",void 0);ye([C({type:"object"}),Te("design:type",Array)],oe.prototype,"errors",void 0);oe=ye([ie({name:"OperationResult",description:"Operation result"}),Te("design:paramtypes",[Object])],oe);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return ye([C({type:t,required:!0}),Te("design:type",Object)],r.prototype,"payload",void 0),r=ye([ie({embedded:!0}),Te("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(oe||(oe={}));import{__decorate as wn,__metadata as An}from"tslib";import{isDateString as $r,toString as _a,validator as kc,vg as Qe}from"valgen";var gt,sr=(gt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=Oa,r=[];return e.minValue!=null&&($r(e.minValue),r.push(_a,Qe.isGte(e.minValue))),e.maxValue!=null&&($r(e.maxValue),r.push(_a,Qe.isLte(e.maxValue))),r.length>0?Qe.pipe([t,...r],{returnIndex:0}):t}[O](e){let t=Oa,r=[];return e.minValue!=null&&($r(e.minValue),r.push(Qe.isGte(e.minValue))),e.maxValue!=null&&($r(e.maxValue),r.push(Qe.isLte(e.maxValue))),r.length>0?Qe.pipe([t,...r],{returnIndex:0}):t}},a(gt,"PartialDateType"),gt);wn([u.Attribute({description:"Minimum value"}),An("design:type",String)],sr.prototype,"minValue",void 0);wn([u.Attribute({description:"Maximum value"}),An("design:type",String)],sr.prototype,"maxValue",void 0);sr=wn([u({name:"partialdate",description:"Specifies a point in time using a 24-hour clock notation.\rFormat: YYYY-[MM-[DD-[T?HH:[MM:[SS[.S[S[S[S]]]]]]]]][+/-ZZ:ZZ].",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15:22+03:00").Example("2021-04-18 22:30").Example("2021-04-18").Example("2021"),An("design:paramtypes",[Object])],sr);var xa=Qe.isDateString({precisionMin:"year"}),Oa=kc(o=>{if(o instanceof Date){let e=xa(o,{coerce:!0});return e.endsWith("Z")&&(e=e.substring(0,e.length-1)),e.endsWith(".000")&&(e=e.substring(0,e.length-4)),e.endsWith(":00")&&(e=e.substring(0,e.length-3)),e.endsWith("00:00")&&(e=e.substring(0,e.length-6)),e}return xa(o,{coerce:!1})});import{__decorate as Rn,__metadata as bn}from"tslib";import{vg as qr}from"valgen";var jc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,wt,ar=(wt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=qr.matches(jc,{formatName:"time",coerce:!0}),r=[];return e.minValue!=null&&r.push(qr.isGte(e.minValue)),e.maxValue!=null&&r.push(qr.isLte(e.maxValue)),r.length>0?qr.pipe([t,...r],{returnIndex:0}):t}[O](e){return this[T](e)}},a(wt,"TimeType"),wt);Rn([u.Attribute({description:"Minimum value"}),bn("design:type",String)],ar.prototype,"minValue",void 0);Rn([u.Attribute({description:"Maximum value"}),bn("design:type",String)],ar.prototype,"maxValue",void 0);ar=Rn([u({name:"time",description:"Time string in 24h format",nameMappings:{js:"string",json:"string"}}).Example("18:23:00","Full time value").Example("18:23:00","Time value without seconds"),bn("design:paramtypes",[Object])],ar);import{__decorate as Cc,__metadata as Uc}from"tslib";import{vg as ga}from"valgen";var At,Dn=(At=class{constructor(e){e&&Object.assign(this,e)}[T](){return ga.isURL({coerce:!0})}[O](){return ga.isURL({coerce:!0})}},a(At,"UrlType"),At);Dn=Cc([u({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),Uc("design:paramtypes",[Object])],Dn);import{__decorate as Aa,__metadata as Ra}from"tslib";import{vg as wa}from"valgen";var Rt,Br=(Rt=class{constructor(e){e&&Object.assign(this,e)}[T](e){return wa.isUUID(e==null?void 0:e.version,{coerce:!0})}[O](e){return wa.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(Rt,"UuidType"),Rt);Aa([u.Attribute({description:"Version of the UUID"}),Ra("design:type",Number)],Br.prototype,"version",void 0);Br=Aa([u({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),Ra("design:paramtypes",[Object])],Br);import $c from"path-browserify";import{omitUndefined as qc}from"@jsopen/objects";import{asMutable as Bc}from"ts-gems";var ba,Da,ne=Symbol.for("kMap"),pr=Symbol.for("kCtorMap"),Sn=class Sn{constructor(){this[ba]=new N,this[Da]=new WeakMap}get size(){return this[ne].size}forEach(e,t){this[ne].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[pr].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(d,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[d];t=i==null?void 0:i.name}if(!t)return;let r=this[ne].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[ne].set(e,t),t.ctor?this[pr].set(t.ctor,e):t.instance&&this[pr].set(t.instance,e)}has(e){if(e instanceof _)return!!e.name&&this[ne].has(e.name);let t=typeof e=="string"?e:this[pr].get(e);return t?this[ne].has(t):!1}keys(){return this[ne].keys()}values(){return this[ne].values()}entries(){return this[ne].entries()}sort(e){return this[ne].sort(e),this}[(ba=ne,Da=pr,Symbol.iterator)](){return this[ne][Symbol.iterator]()}};a(Sn,"DataTypeMap");var V=Sn;function M(o,e){let t=a(((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:m.HttpOperation.Kind},s=Reflect.getOwnMetadata(ae,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(ae,s,r.constructor)}),"decorator");return t.Cookie=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="cookie"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Header=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="header"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="query"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="path"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Response=(r,i)=>{let n={...i,statusCode:r};return n.type&&(n.contentType=n.contentType||D.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===D.opra_response_json&&(n.contentEncoding=n.contentEncoding||"utf-8"),o.push(s=>{s.responses=s.responses||[],s.responses.push(n)}),t},t.RequestContent=function(r){let i=typeof r=="object"?r:{type:r};return i.type&&(i.contentType=i.contentType||D.json,i.contentEncoding=i.contentEncoding||"utf-8"),o.push(n=>{n.requestBody=n.requestBody||{required:!0,content:[]},n.requestBody.content=n.requestBody.content||[],n.requestBody.content.push(i)}),t},t.MultipartContent=function(r,i){let n={...r,contentType:(r==null?void 0:r.contentType)||"multipart/form-data"};if(o.push(s=>{s.requestBody=s.requestBody||{required:!0,content:[]},s.requestBody.content=s.requestBody.content||[],s.requestBody.content.push(n)}),i){let s={Field(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"field",...c}),s},File(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"file",...c}),s}};i(s)}return t},t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(M,"HttpOperationDecoratorFactory");var b=a(function(...o){if(!this){let[i]=o,n=[];return b[A].call(void 0,n,i)}let[e,t]=o;if(g.call(this,e),!I.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Bc(this);r.parameters=[],r.responses=[],r.types=r.node[L]=new V,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?P(t.compositionOptions):void 0},"HttpOperation"),vn=class vn extends g{findParameter(e,t){let r=e.toLowerCase(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i}getFullUrl(){let e=this.owner.getFullUrl();return e?this.path?this.mergePath?e+this.path:$c.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=qc({kind:m.HttpOperation.Kind,description:this.description,method:this.method,path:this.path,mergePath:this.mergePath,composition:this.composition,requestBody:(r=this.requestBody)==null?void 0:r.toJSON(e)});if(this.types.size){t.types={};for(let i of this.types.values())t.types[i.name]=i.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let i of this.parameters)t.parameters.push(i.toJSON(e))}return this.responses.length&&(t.responses=this.responses.map(i=>i.toJSON(e))),t}};a(vn,"HttpOperationClass");var Mn=vn;b.prototype=Mn.prototype;b[A]=M;b.GET=function(o){return M([],{...o,method:"GET"})};b.DELETE=function(o){return M([],{...o,method:"DELETE"})};b.HEAD=function(o){return M([],{...o,method:"HEAD"})};b.OPTIONS=function(o){return M([],{...o,method:"OPTIONS"})};b.PATCH=function(o){return M([],{...o,method:"PATCH"})};b.POST=function(o){return M([],{...o,method:"POST"})};b.PUT=function(o){return M([],{...o,method:"PUT"})};b.SEARCH=function(o){return M([],{...o,method:"SEARCH"})};b.Entity={};function z(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(d,o);if(!e)throw new TypeError(`Type (${o}) is not decorated with any datatype decorators`);if(e!=null&&e.name)return e.name;throw new TypeError("You should provide named data type but embedded one found")}a(z,"getDataTypeName");function Fe(o,e){return(t,r)=>{let i=typeof r=="string"||typeof r=="function"?{name:t,location:"path",type:r,keyParam:!0}:{...r,name:t,location:"path",keyParam:!0};return o.PathParam(t,i),e.push(n=>{var s;(s=n.path)!=null&&s.includes(":"+t)||(n.path=(n.path||"")+"@:"+t),n.mergePath=!0}),o}}a(Fe,"createKeyParamDecorator");function Na(o,e){return(...t)=>{let r=typeof t[0]=="object"?t[0]:t.reduce((s,p)=>{let c=p.split(":");return s[c[0]]=c[1]||c[0],s},{}),i=Object.keys(r).reduce((s,p)=>{let c=lt.exec(p),l=lt.exec(r[p]);return c&&l&&(s[c[2]]=l[2]),s},{}),n=Object.keys(r).reduce((s,p)=>{let c=lt.exec(p);return c&&(c[1]!="-"&&(s[c[2]]=c[2]),c[1]!="+"&&(s["-"+c[2]]="-"+c[2])),s},{});return e.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.sortFields=i}),o.QueryParam("sort",{description:"Determines sort fields",type:ee(n),isArray:!0,arraySeparator:",",parser:a(s=>s.map(p=>{let c=lt.exec(p);return c?(c[1]||"")+i[c[2]]:p}),"parser")}),o}}a(Na,"createSortFieldsDecorator");function Ie(o,e,t){let r=Reflect.getMetadata("FilterRules",o);r||(r=new it,Reflect.defineMetadata("FilterRules",r,o));let i=Reflect.getMetadata("FilterType",o);return i||(i=new Ye({dataType:t}),i.rules={},Reflect.defineMetadata("FilterType",i,o)),(n,s)=>{let p=(Array.isArray(s)?{operators:s}:typeof s=="string"?{operators:s.split(/\s*,\s*/)}:s)||{};if(p.operators=p.operators||["=","!="],n.includes(":")){let c=n.split(":");n=c[0],p.mappedField=c[1]}return e.push(()=>{r.set(n,p),i.rules=r.toJSON()}),o.QueryParam("filter",{type:i,description:"Determines filter fields"}),o}}a(Ie,"createFilterDecorator");b.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=z(t.type)}),i};b.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Fe(i,r),i};b.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.Filter=Ie(i,r,t.type),i};var Bn={};Tr(Bn,{AnyType:()=>Fn,BigintType:()=>jn,BooleanType:()=>Cn,IntegerType:()=>vt,NullType:()=>$n,NumberType:()=>we,ObjectType:()=>qn,StringType:()=>Ge});import{__decorate as Kc,__metadata as Vc}from"tslib";import{isAny as Sa}from"valgen";var bt,Fn=(bt=class{constructor(e){e&&Object.assign(this,e)}[T](){return Sa}[O](){return Sa}},a(bt,"AnyType"),bt);Fn=Kc([u({name:"any",description:"Represents any value"}),Vc("design:paramtypes",[Object])],Fn);import{__decorate as zc,__metadata as Jc}from"tslib";import{toBigint as va,vg as kn}from"valgen";import{__decorate as Ln,__metadata as Pn}from"tslib";import{toNumber as Ma,vg as In}from"valgen";var Dt,we=(Dt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];return e.minValue!=null&&t.push(In.isGte(e.minValue)),e.maxValue!=null&&t.push(In.isLte(e.maxValue)),t.length>0?In.pipe([Ma,...t],{returnIndex:0}):Ma}[O](e){return this[T](e)}},a(Dt,"NumberType"),Dt);Ln([u.Attribute({description:"Determines the minimum value"}),Pn("design:type",Number)],we.prototype,"minValue",void 0);Ln([u.Attribute({description:"Determines the maximum value"}),Pn("design:type",Number)],we.prototype,"maxValue",void 0);we=Ln([u({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),Pn("design:paramtypes",[Object])],we);var Nt,jn=(Nt=class extends we{constructor(e){super(e)}[T](e){let t=[];return e.minValue!=null&&t.push(kn.isGte(e.minValue)),e.maxValue!=null&&t.push(kn.isLte(e.maxValue)),t.length>0?kn.pipe([va,...t],{returnIndex:0}):va}[O](e){return this[T](e)}},a(Nt,"BigintType"),Nt);jn=zc([u({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),Jc("design:paramtypes",[Object])],jn);import{__decorate as Wc,__metadata as Yc}from"tslib";import{toBoolean as Fa}from"valgen";var St,Cn=(St=class{constructor(e){e&&Object.assign(this,e)}[T](){return Fa}[O](){return Fa}},a(St,"BooleanType"),St);Cn=Wc([u({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),Yc("design:paramtypes",[Object])],Cn);import{__decorate as Qc,__metadata as Gc}from"tslib";import{toInteger as Ia,vg as Un}from"valgen";var Mt,vt=(Mt=class extends we{constructor(e){super(e)}[T](e){let t=[];return e.minValue!=null&&t.push(Un.isGte(e.minValue)),e.maxValue!=null&&t.push(Un.isLte(e.maxValue)),t.length>0?Un.pipe([Ia,...t],{returnIndex:0}):Ia}[O](e){return this[T](e)}},a(Mt,"IntegerType"),Mt);vt=Qc([u({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),Gc("design:paramtypes",[Object])],vt);import{__decorate as Xc,__metadata as Zc}from"tslib";import{isNull as La}from"valgen";var Ft,$n=(Ft=class{constructor(e){e&&Object.assign(this,e)}[T](){return La}[O](){return La}},a(Ft,"NullType"),Ft);$n=Xc([u({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),Zc("design:paramtypes",[Object])],$n);import{__decorate as Hc,__metadata as el}from"tslib";var It,qn=(It=class{constructor(e){e&&Object.assign(this,e)}},a(It,"ObjectType"),It);qn=Hc([ie({name:"object",description:"A non modelled object",additionalFields:!0}),el("design:paramtypes",[Object])],qn);import{__decorate as cr,__metadata as lr}from"tslib";import{toString as Pa,vg as Kr}from"valgen";var Lt,Ge=(Lt=class{constructor(e){e&&Object.assign(this,e)}[T](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(d,Object.getPrototypeOf(this).constructor).name),t.push(Kr.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Kr.lengthMin(e.minLength)),e.maxLength&&t.push(Kr.lengthMax(e.maxLength)),t.length>0?Kr.pipe([Pa,...t],{returnIndex:0}):Pa}[O](e){return this[T](e)}},a(Lt,"StringType"),Lt);cr([u.Attribute({description:"Regex pattern to be used for validation"}),lr("design:type",Object)],Ge.prototype,"pattern",void 0);cr([u.Attribute({description:"Name of the pattern"}),lr("design:type",String)],Ge.prototype,"patternName",void 0);cr([u.Attribute({description:"Minimum number of characters"}),lr("design:type",Number)],Ge.prototype,"minLength",void 0);cr([u.Attribute({description:"Minimum number of characters"}),lr("design:type",Number)],Ge.prototype,"maxLength",void 0);Ge=cr([u({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),lr("design:paramtypes",[Object])],Ge);b.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"GET",...t,composition:"Entity.FindMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:D.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new vt({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new vt({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type),t.defaultLimit&&(s.defaultLimit=t.defaultLimit),t.defaultProjection&&(s.defaultProjection=t.defaultProjection),t.maxLimit&&(s.maxLimit=t.maxLimit)}),i.Filter=Ie(i,r,t.type),i.DefaultSort=(...n)=>(r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.defaultSort=n}),i),i.SortFields=Na(i,r),i};b.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Fe(i,r),i};b.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Fe(i,r),i};b.Entity.Update=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"PATCH",...t,composition:"Entity.Update",requestBody:{partial:"deep",immediateFetch:!0,allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new W({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=z(t.type)}),i.KeyParam=Fe(i,r),i.Filter=Ie(i,r,t.type),i};b.Entity.UpdateMany=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=M(r,{method:"PATCH",...t,composition:"Entity.UpdateMany",requestBody:{immediateFetch:!0,partial:"deep",allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=z(t.type)}),i.Filter=Ie(i,r,t.type),i};import{merge as Kn}from"@jsopen/objects";var tl=/^(.*)(Controller)$/,ka=[];function Pt(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=tl.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(U,Object.getPrototypeOf(r));s&&Kn(n,s,{deep:!0});let p=Reflect.getOwnMetadata(U,r);p&&Kn(n,p,{deep:!0}),Kn(n,{...o,kind:m.MQController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(U,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(U,n,r)},"decorator");return t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,type:i}:{...i,name:r};n.headers=n.headers||[],n.headers.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),ka.forEach(r=>r(t,e,o)),t}a(Pt,"MQControllerDecoratorFactory");Pt.augment=function(o){ka.push(o)};import{omit as il}from"@jsopen/objects";var ja=[];function fr(o,e,t){let r=!1,i=a(((n,s)=>{if(typeof s!="string")throw new TypeError("Symbol properties can not be decorated");let p={kind:m.MQOperation.Kind,channel:s,payloadType:e,...il(t,["kind","payloadType"])},c=Reflect.getOwnMetadata(U,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let l of o)l(p,n,s);Reflect.defineMetadata(U,c,n.constructor)}),"decorator");return i.UseType=(...n)=>(o.push(s=>{s.types=s.types||[],s.types.push(...n)}),i),i.Header=(n,s)=>(o.push(p=>{let c=typeof s=="string"||typeof s=="function"?{name:n,type:s}:{...s,name:n},l=r?p.response:p;l.headers?l.headers=l.headers.filter(x=>String(x.name)!==String(n)):l.headers=[],l.headers.push(c)}),i),i.Response=(n,s)=>(o.push(p=>{r=!0,p.response={...s,payloadType:n}}),i),ja.forEach(n=>n(i,o,e,t)),i}a(fr,"MQOperationDecoratorFactory");fr.augment=function(o){ja.push(o)};import{merge as Vn}from"@jsopen/objects";var nl=/^(.*)(Controller)$/,Ca=[];function kt(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=nl.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(U,Object.getPrototypeOf(r));s&&Vn(n,s,{deep:!0});let p=Reflect.getOwnMetadata(U,r);p&&Vn(n,p,{deep:!0}),Vn(n,{...o,kind:m.WSController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(U,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(U,n,r)},"decorator");return t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),Ca.forEach(r=>r(t,e,o)),t}a(kt,"WSControllerDecoratorFactory");kt.augment=function(o){Ca.push(o)};import{omit as al}from"@jsopen/objects";var Ua=[];function mr(o,e,t){let r=a(((i,n)=>{if(typeof n!="string")throw new TypeError("Symbol properties can not be decorated");let s={kind:m.WSOperation.Kind,channel:n,payloadType:e,...al(t,["kind","payloadType"])},p=Reflect.getOwnMetadata(U,i.constructor)||{};p.operations=p.operations||{},p.operations[n]=s;for(let c of o)c(s,i,n);Reflect.defineMetadata(U,p,i.constructor)}),"decorator");return r.UseType=(...i)=>(o.push(n=>{n.types=n.types||[],n.types.push(...i)}),r),Ua.forEach(i=>i(r,o,e,t)),r}a(mr,"WSOperationDecoratorFactory");mr.augment=function(o){Ua.push(o)};import"reflect-metadata";import{omitUndefined as cl}from"@jsopen/objects";import{asMutable as ll}from"ts-gems";function Vr(o,e){let t=o==null?void 0:o.map(i=>String(i).toLowerCase()),r=e==null?void 0:e.map(i=>String(i).toLowerCase());return i=>r&&r.includes(i.toLowerCase())?!1:t?t.includes(i.toLowerCase()):!0}a(Vr,"getIsInheritedPredicateFn");var Xe=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;j.call(this,e,t,r);let i=ll(this);if(i.kind=m.MappedType.Kind,t.base){if(!(t.base instanceof j))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.ctor=t.ctor||i.base.ctor,t.pick?i.pick=t.pick.map(l=>i.base.normalizeFieldPath(l)):t.omit?i.omit=t.omit.map(l=>i.base.normalizeFieldPath(l)):t.partial?i.partial=Array.isArray(t.partial)?t.partial.map(l=>i.base.normalizeFieldPath(l)):t.partial:t.required&&(i.required=Array.isArray(t.required)?t.required.map(l=>i.base.normalizeFieldPath(l)):t.required);let s=Vr(i.pick,i.omit),p=Array.isArray(i.partial)?i.partial.map(l=>l.toLowerCase()):i.partial,c=Array.isArray(i.required)?i.required.map(l=>l.toLowerCase()):i.required;for(let[l,x]of i.base.fieldEntries("*")){if(!s(l))continue;let w={...x};p===!0||Array.isArray(p)&&p.includes(x.name.toLowerCase())?w.required=!1:(c===!0||Array.isArray(c)&&c.includes(x.name.toLowerCase()))&&(w.required=!0);let y=new C(this,w);i._fields.set(y.name,y)}(!i.pick||i.base.additionalFields===!1||Array.isArray(i.base.additionalFields)&&((n=i.base.additionalFields)==null?void 0:n[0])==="error")&&(i.additionalFields=i.base.additionalFields),t.base.keyField&&s(t.base.keyField)&&(i.keyField=t.base.keyField),i.discriminatorField=t.base.discriminatorField,i.discriminatorValue=t.base.discriminatorValue}},"MappedType"),Jn=class Jn extends j{extendsFrom(e){var t;return e instanceof _||(e=this.node.getDataType(e)),e instanceof j?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return cl({...t,base:r||this.base.toJSON(e),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Jn,"MappedTypeClass");var zn=Jn;Xe.prototype=zn.prototype;Xe._applyMixin=()=>{};import"reflect-metadata";import{omitUndefined as fl}from"@jsopen/objects";import{asMutable as ml}from"ts-gems";var jt=a(function(...o){if(!this)return jt[A].apply(void 0,o);let[e,t,r]=o;j.call(this,e,t,r);let i=ml(this);i.kind=m.MixinType.Kind,i.types=[];for(let n of t.types){i.additionalFields!==!0&&(n.additionalFields===!0?i.additionalFields=!0:i.additionalFields||(i.additionalFields=n.additionalFields));for(let s of n.fields("*")){let p=new C(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),Yn=class Yn extends j{extendsFrom(e){if(e instanceof _||(e=this.node.getDataType(e)),!(e instanceof j))return!1;if(e===this)return!0;for(let t of this.types)if(t.extendsFrom(e))return!0;return!1}toJSON(e){let t=super.toJSON(e);return fl({...t,kind:this.kind,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}_locateBase(e){for(let t of this.types){if(e(t))return t;if(t._locateBase){let r=t._locateBase(e);if(r)return r}}}};a(Yn,"MixinTypeClass");var Wn=Yn;jt.prototype=Wn.prototype;jt[A]=ul;function ul(o,e){if(o=o.filter(n=>typeof n=="function"),!o.length)throw new TypeError("No Class has been provided");if(o.length===1)return o[0];let t=o[0].name+"Mixin",r={[t]:class{constructor(){for(let n of o)xr(this,n)}}}[t],i={...e,kind:m.MixinType.Kind,types:[]};Reflect.defineMetadata(d,i,r);for(let n of o){let s=Reflect.getMetadata(d,n);if(!(s&&(s.kind===m.ComplexType.Kind||s.kind===m.MixinType.Kind||s.kind===m.MappedType.Kind)))throw new TypeError(`Class "${n.name}" is not a ${m.ComplexType.Kind}, ${m.MixinType.Kind} or ${m.MappedType.Kind}`);i.types.push(n),_r(r.prototype,n.prototype)}return r}a(ul,"MixinTypeFactory");import"reflect-metadata";import{omitUndefined as dl}from"@jsopen/objects";import{asMutable as hl}from"ts-gems";import{vg as $a}from"valgen";var Ct=a(function(...o){if(!this)return Ct[A].apply(void 0,o);let[e,t,r]=o;_.call(this,e,t,r);let i=hl(this);i.kind=m.UnionType.Kind,i.discriminator=t.discriminator,i.types=[];for(let n of t.types)i.types.push(n)},"UnionType"),Gn=class Gn extends _{toJSON(e){let t=super.toJSON(e);return dl({...t,kind:this.kind,discriminator:this.discriminator,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}generateCodec(e,t){let r=this.types.map(i=>{let n=i.generateCodec(e,t);return(i.kind===m.ComplexType.Kind||i.kind===m.MappedType.Kind)&&i.discriminatorField?[n,{[i.discriminatorField]:$a.isEqual(i.discriminatorValue)}]:n});return $a.oneOf(r)}extendsFrom(){return!1}_locateBase(){}};a(Gn,"UnionTypeClass");var Qn=Gn;Ct.prototype=Qn.prototype;Ct[A]=yl;function yl(o,e){let i=class i{};a(i,"UnionClass");let t=i,r={...e,kind:m.UnionType.Kind,types:o};return Reflect.defineMetadata(d,r,t),t}a(yl,"UnionTypeFactory");var Xn=Symbol("initializing"),zr=class zr{static async createDataType(e,t,r){e=e||new he({maxErrors:0});let i=await this._importDataTypeArgs(e,t,r);if(i)return typeof i=="string"?t.node.getDataType(i):this._createDataType(e,t,i)}static async resolveDataType(e,t,r){if(r){let i=t.node.findDataType(r);if(i)return i}if(typeof r=="object"||typeof r=="function"){let i=await zr.createDataType(e,t,r);if(i)return i}if(r){let i=t.node.getDataType(r);if(i)return i}return t.node.getDataType("any")}static async addDataTypes(e,t,r){let i=t.node[L];if(!i)throw new TypeError("DocumentElement should has [kDataTypeMap] property");let n=await this.createAllDataTypes(e,t,r);if(n)for(let s of n)s!=null&&s.name&&i.set(s.name,s)}static async createAllDataTypes(e,t,r){e=e||new he({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new N;for(let c of i)n.set(c.name,c);let s=e.extend({initArgsMap:n}),p=[];for(let[c,l]of n.entries())e.enter(`[${c}]`,()=>{if(!n.has(c))return;let x=this._createDataType(s,t,l);x&&p.push(x)});return p}static async _prepareAllInitArgs(e,t,r){let i=new N,n=new N,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[L])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let p=0;for(let c of r)await s.enterAsync(`$[${p++}]`,async()=>{c=await pe(c);let l=Reflect.getMetadata(d,c)||c[d];if(!(l&&l.name))return typeof c=="function"?s.addError(`Class "${c.name}" doesn't have a valid data type metadata`):s.addError("Object doesn't have a valid data type metadata");i.set(l.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await pe(p),i.set(c,typeof p=="object"?{...p,name:c}:p)}for(let p of Array.from(i.keys())){if(!i.has(p))continue;let c=await this._importDataTypeArgs(s,t,p);c&&typeof c!="string"&&s.addError("Embedded data type can't be loaded into document node directly")}return Array.from(n.values())}static async _importDataTypeArgs(e,t,r,i){var w;r=await pe(r);let{importQueue:n,initArgsMap:s}=e,p=t.node.findDataType(r);if(p instanceof _)return p.name;let c,l,x;if(typeof r!="string"){let X=t.node.getDocument().types[Or].get(r);X&&(r=X)}if(typeof r=="string"){let y=r;if(r=(n==null?void 0:n.get(y))||((w=e.initArgsMap)==null?void 0:w.get(y)),!r)return e.addError(`Unknown data type (${y})`)}if(typeof r=="function"){if(c=Reflect.getMetadata(d,r),!c)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);l=r}else if(typeof r=="object"){if(c=r[d],c)x=r,c.kind!==m.EnumType.Kind&&(c=void 0);else if(m.isDataType(r))c=r,l=c.ctor;else if(l=Object.getPrototypeOf(r).constructor,c=l&&Reflect.getMetadata(d,l),c&&c.kind===m.SimpleType.Kind){let y=await this._importDataTypeArgs(e,t,c.name);return y?typeof y=="object"&&y.kind!==m.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:m.SimpleType.Kind,name:void 0,base:y,properties:r}:void 0}}return c?e.enterAsync(c.name?`[${c.name}]`:"",async()=>{if(c.name){let X=s==null?void 0:s.get(c.name);if(X)return i&&X[Xn]?e.addError("Circular reference detected"):c.name}let y={kind:c.kind,name:c.name};y[Xn]=!0;try{if(y.name)if(n!=null&&n.has(y.name))s==null||s.set(c.name,y),y._instance={name:c.name},y[L]=t.node[L];else return e.addError(`Data Type (${y.name}) must be explicitly added to type list in the document scope`);switch(y.kind){case m.ComplexType.Kind:y.ctor=l,await this._prepareComplexTypeArgs(e,t,y,c);break;case m.EnumType.Kind:y.instance=x,await this._prepareEnumTypeArgs(e,t,y,c);break;case m.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,y,c);break;case m.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,y,c);break;case m.SimpleType.Kind:y.ctor=l,await this._prepareSimpleTypeArgs(e,t,y,c);break;case m.UnionType.Kind:await this._prepareUnionTypeArgs(e,t,y,c);break;default:return e.addError(`Invalid data type kind ${c.kind}`)}}finally{y.name&&(n==null||n.delete(y.name)),delete y[Xn]}return n&&y.name?y.name:y}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples,t.scopePattern=r.scopePattern}static async _prepareComplexTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.keyField=i.keyField,r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Le(n),r.ctor=r.ctor||n.ctor)}),i.additionalFields!=null&&(typeof i.additionalFields=="boolean"||Array.isArray(i.additionalFields)?r.additionalFields=i.additionalFields:await e.enterAsync(".additionalFields",async()=>{let n=await this._importDataTypeArgs(e,t,i.additionalFields);n&&(r.additionalFields=Le(n))})),i.fields&&(r.fields={},await e.enterAsync(".fields",async()=>{for(let[n,s]of Object.entries(i.fields))await e.enterAsync(`[${n}]`,async()=>{let p=typeof s=="string"?{type:s}:s;if(p.isArray&&!p.type)return e.addError('"type" must be defined explicitly for array fields');let c=await this._importDataTypeArgs(e,t,p.type||"any");c&&(r.fields[n]={...p,type:Le(c)})})}))}static async _prepareEnumTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),i.base&&await e.enterAsync(".base",async()=>{let n=await this._importDataTypeArgs(e,t,i.base);n&&(r.base=Le(n))}),r.attributes=P(i.attributes)}static async _prepareSimpleTypeArgs(e,t,r,i){var n,s,p,c;await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let l;if(i.base)l=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let x=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,x)&&(l=await this._importDataTypeArgs(e,t,x))}l&&(r.base=Le(l),r.ctor=r.ctor||l.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=P(i.attributes)),typeof((n=r.properties)==null?void 0:n[T])=="function"&&(r.generateDecoder=(s=r.properties)==null?void 0:s[T].bind(r.properties)),typeof((p=r.properties)==null?void 0:p[O])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[O].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Le(n),r.ctor=r.ctor||n.ctor)}),i.pick?r.pick=[...i.pick]:i.omit?r.omit=[...i.omit]:i.partial?r.partial=Array.isArray(i.partial)?[...i.partial]:i.partial:i.required&&(r.required=Array.isArray(i.required)?[...i.required]:i.required)}static async _prepareMixinTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(Le(c))})})}static async _prepareUnionTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(Le(c))})})}static _createDataType(e,t,r){var s;let i=t.node.findDataType(typeof r=="string"?r:r.name||"");if(i instanceof _)return i;let n=typeof r=="string"?(s=e.initArgsMap)==null?void 0:s.get(r):r;if(n){let p=n[L];switch(p||delete n._instance,i=n._instance,i!=null&&i.name&&p&&p.set(i.name,i),n==null?void 0:n.kind){case m.ComplexType.Kind:return this._createComplexType(e,t,n);case m.EnumType.Kind:return this._createEnumType(e,t,n);case m.MappedType.Kind:return this._createMappedType(e,t,n);case m.MixinType.Kind:return this._createMixinType(e,t,n);case m.SimpleType.Kind:return this._createSimpleType(e,t,n);case m.UnionType.Kind:return this._createUnionType(e,t,n);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ie.prototype);let n=P(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?n.additionalFields=r.additionalFields:n.additionalFields=this._createDataType(e,t,r.additionalFields)}),n.fields={},r.fields&&e.enter(".fields",()=>{for(let[s,p]of Object.entries(r.fields))e.enter(`[${s}]`,()=>{let c=this._createDataType(e,t,p.type);c&&(n.fields[s]={...p,name:s,type:c})})}),ie.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ee.prototype);let n=P(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,ee.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Xe.prototype);let n=P(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),Xe.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,jt.prototype);let n=P(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof j))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),jt.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,u.prototype);let n=P(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(i,[t,n]),i}static _createUnionType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Ct.prototype);let n=P(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);n.types.push(c)})}),Ct.apply(i,[t,n]),i}};a(zr,"DataTypeFactory");var F=zr;function Le(o){return typeof o=="object"&&o.name?o.name:o}a(Le,"preferName");import{isConstructor as jl}from"@jsopen/objects";import{omitUndefined as El}from"@jsopen/objects";var Zn=class Zn extends g{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(e){return El({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!I.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(Zn,"ApiBase");var Pe=Zn;import Ol from"path-browserify";import{omitUndefined as gl}from"@jsopen/objects";import{asMutable as wl}from"ts-gems";import{merge as Hn,omit as _l}from"@jsopen/objects";var xl=/^(.*)(Controller)$/;function es(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=xl.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ae,Object.getPrototypeOf(r));s&&Hn(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ae,r);p&&Hn(n,p,{deep:!0}),Hn(n,{kind:m.HttpController.Kind,name:i,path:i,..._l(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(ae,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(ae,n,r)},"decorator");return t.Cookie=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.KeyParam=(r,i)=>(e.push(n=>{var p;(p=n.path)!=null&&p.includes(":"+r)||(n.path=(n.path||"")+"@:"+r);let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i,keyParam:!0}:{...i,name:r,location:"path",keyParam:!0};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(es,"HttpControllerDecoratorFactory");var se=a(function(...o){var i;if(!this)return se[A].apply(void 0,o);let[e,t]=o;if(g.call(this,e),!I.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=wl(this);r.kind=m.HttpController.Kind,r.types=r.node[L]=new V,r.operations=new N,r.controllers=new N,r.parameters=[],r.name=t.name,r.description=t.description,r.path=t.path??t.name,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"HttpController"),rs=class rs extends g{get isRoot(){return!(this.owner instanceof se)}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values()){if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;if(r.controllers.size&&(t=r.findController(e),t))return this._controllerReverseMap.set(e,t),t}this._controllerReverseMap.set(e,null);return}if(e.startsWith("/")&&(e=e.substring(1)),e.includes("/")){let t=e.split("/"),r=this;for(;r&&t.length>0;)r=r.controllers.get(t.shift());return r}return this.controllers.get(e)}findParameter(e,t){let r=e.toLowerCase(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i;if(this.node.parent&&this.node.parent.element instanceof se)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return Ol.posix.join(this.owner instanceof se?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=gl({kind:this.kind,description:this.description,path:this.path});if(this.operations.size){t.operations={};for(let r of this.operations.values())t.operations[r.name]=r.toJSON(e)}if(this.controllers.size){t.controllers={};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON(e)}if(this.types.size){t.types={};for(let r of this.types.values())t.types[r.name]=r.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let r of this.parameters)t.parameters.push(r.toJSON(e))}return t}[De](){return`[${Ne}HttpController${Se+this.name+ge}]`}};a(rs,"HttpControllerClass");var ts=rs;se.prototype=ts.prototype;Object.assign(se,es);se[A]=es;var is=class is extends Pe{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new N,this.url=e.url}findController(e){return se.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(e){let r={...super.toJSON(),transport:this.transport,url:this.url,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON(e);return r}};a(is,"HttpApi");var Ut=is;import Al from"@browsery/type-is";import{omitUndefined as Rl}from"@jsopen/objects";import{asMutable as bl}from"ts-gems";import{isAny as Dl,vg as Nl}from"valgen";var ke=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');g.call(this,o);let t=bl(this);if(e.contentType){let r=Array.isArray(e.contentType)?e.contentType:[e.contentType];r=r.map(i=>i.split(/\s*,\s*/)).flat(),t.contentType=r.length>1?r:r[0]}t.description=e.description,t.contentEncoding=e.contentEncoding,t.examples=e.examples,t.multipartFields=[],t.maxFieldsSize=e.maxFieldsSize,t.maxFields=e.maxFields,t.maxFiles=e.maxFiles,t.maxFileSize=e.maxFileSize,t.maxTotalFileSize=e.maxTotalFileSize,e!=null&&e.type&&(t.type=(e==null?void 0:e.type)instanceof _?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray},"HttpMediaType"),ns=class ns extends g{findMultipartField(e,t){if(this.multipartFields){for(let r of this.multipartFields)if((!t||t===r.fieldType)&&(r.fieldName instanceof RegExp&&r.fieldName.test(e)||r.fieldName===e))return r}}toJSON(e){var i,n;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,r=Rl({description:this.description,contentType:this.contentType,contentEncoding:this.contentEncoding,type:t||((i=this.type)==null?void 0:i.toJSON(e)),isArray:this.isArray,example:this.example,examples:this.examples,maxFields:this.maxFields,maxFieldsSize:this.maxFieldsSize,maxFiles:this.maxFiles,maxFileSize:this.maxFileSize,maxTotalFileSize:this.maxTotalFileSize});return(n=this.multipartFields)!=null&&n.length&&(r.multipartFields=this.multipartFields.map(s=>s.toJSON(e))),r}generateCodec(e,t){let r;return this.type?r=this.type.generateCodec(e,t):this.contentType&&(Array.isArray(this.contentType)?this.contentType:[this.contentType]).find(n=>Al.is(n,["json"]))&&(r=this.node.findDataType("object").generateCodec(e)),r=r||Dl,this.isArray?Nl.isArray(r):r}};a(ns,"HttpMediaTypeClass");var os=ns;ke.prototype=os.prototype;import{omitUndefined as Sl}from"@jsopen/objects";function $t(o,e){let t=o.lastIndexOf("/");if(o.startsWith("/")&&t){let r=o.substring(1,t),i=o.substring(t+1);if(e!=null&&e.includeFlags)for(let n of e.includeFlags)i.includes(n)||(i+=n);if(e!=null&&e.excludeFlags)for(let n of e.excludeFlags)i.replace(n,"");return new RegExp(r,i)}throw new TypeError(`"${o}" is not a valid RegExp string`)}a($t,"parseRegExp");var ss=class ss extends ke{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?$t(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return Sl({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(ss,"HttpMultipartField");var Jr=ss;import{omitUndefined as vl}from"@jsopen/objects";var Ml=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,as=class as{constructor(e,t){if(this.start=0,this.end=0,e&&typeof e=="object"&&(this.start=e.start||0,this.end=e.end||0),typeof e=="number"&&(this.start=e,this.end=t||this.start),typeof e=="string"){let r=Ml.exec(e);if(!r)throw new TypeError(`"${e}" is not a valid Status Code range`);this.start=parseInt(r[1],10),this.end=r[2]?parseInt(r[2],10):this.start}}includes(e){return e>=this.start&&e<=this.end}intersects(e,t){return t>=this.start&&e<=this.end}toString(){return this.start===this.end?String(this.start):String(this.start)+"-"+String(this.end)}toJSON(){return!this.end||this.start===this.end?this.start:{start:this.start,end:this.end}}};a(as,"HttpStatusRange");var ur=as;var ps=class ps extends ke{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new ur(r.start,r.end):new ur(r)),this.partial=t.partial}findParameter(e,t){e=e.toLowerCase();for(let r of this.parameters)if((!t||t===r.location)&&(r.name instanceof RegExp&&r.name.test(e)||r.name===e))return r}toJSON(e){let t=this.statusCode.map(i=>i.toJSON()),r=vl({...super.toJSON(e),statusCode:t.length===1&&typeof t[0]=="number"?t[0]:t,partial:this.partial});if(this.parameters.length){r.parameters=[];for(let i of this.parameters)r.parameters.push(i.toJSON(e))}return r}};a(ps,"HttpOperationResponse");var Wr=ps;import{omitUndefined as Ll}from"@jsopen/objects";import{asMutable as Pl}from"ts-gems";import{omitUndefined as Fl}from"@jsopen/objects";import{asMutable as Il}from"ts-gems";var Ze=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');g.call(this,o);let t=Il(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),ls=class ls extends g{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return Fl({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(ls,"ValueClass");var cs=ls;Ze.prototype=cs.prototype;var dr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');Ze.call(this,o,e);let t=Pl(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?$t(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.location=e.location,t.deprecated=e.deprecated,t.required=e.required,t.required==null&&e.location==="path"&&(t.required=!0),t.arraySeparator=e.arraySeparator,t.keyParam=e.keyParam,t.parser=e.parser},"HttpParameter"),ms=class ms extends Ze{toJSON(e){return Ll({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}};a(ms,"HttpParameterClass");var fs=ms;dr.prototype=fs.prototype;import{omitUndefined as kl}from"@jsopen/objects";var us=class us extends g{constructor(e){super(e),this.content=[]}toJSON(e){return kl({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(t=>t.toJSON(e)):[],partial:this.partial,allowPatchOperators:this.allowPatchOperators})}};a(us,"HttpRequestBody");var Yr=us;var ds=class ds{static async createApi(e,t){let r=new Ut(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,r,t.controllers)}),r}static async _createControllers(e,t,r){if(Array.isArray(r)){let i=0;for(let n of r){let s;await e.enterAsync(`[${i++}]`,async()=>{s=await this._resolveControllerMetadata(e,t,n)}),s&&await e.enterAsync(`[${s.metadata.name}]`,async()=>{let p=await this._createController(e,t,s.metadata,s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${s.name})`),t.controllers.set(p.name,p))})}return}for(let[i,n]of Object.entries(r))await e.enterAsync(`[${i}]`,async()=>{let s=await this._resolveControllerMetadata(e,t,n);if(!s)return;let p=await this._createController(e,t,{...s.metadata,name:i},s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${i})`),t.controllers.set(p.name,p))})}static async _resolveControllerMetadata(e,t,r){typeof r=="function"&&!jl(r)&&(r=t instanceof se?r(t.instance):r()),r=await pe(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(ae,r),!n)return e.addError(`Class "${r.name}" doesn't have a valid HttpController metadata`);i=r}else i=Object.getPrototypeOf(r).constructor,n=Reflect.getMetadata(ae,i),n?s=r:(n=r,r.instance==="object"&&(s=r.instance,i=Object.getPrototypeOf(s).constructor));return n?{metadata:n,instance:s,ctor:i}:e.addError(`Class "${i.name}" is not decorated with HttpController()`)}static async _createController(e,t,r,i,n){if(!r.name)throw new TypeError("Controller name required");let s=new se(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await F.addDataTypes(e,s,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let p=0;for(let c of r.parameters)await e.enterAsync(`[${p++}]`,async()=>{let l={...c};await e.enterAsync(".type",async()=>{l.type=await F.resolveDataType(e,s,c.type)});let x=new dr(s,l);s.parameters.push(x)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new b(s,{name:p,method:"GET"});await this._initHttpOperation(e,l,c),s.operations.set(p,l)})}),r.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,s,r.controllers)}),s}static async _initHttpOperation(e,t,r){let i={...r,name:t.name,types:void 0};return b.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await F.addDataTypes(e,t,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let n=0;for(let s of r.parameters)await e.enterAsync(`[${n++}]`,async()=>{let p={...s};await e.enterAsync(".type",async()=>{p.type=await F.resolveDataType(e,t,s.type)});let c=new dr(t,p);t.parameters.push(c)})}),r.responses&&await e.enterAsync(".responses",async()=>{let n=0;for(let s of r.responses)await e.enterAsync(`[${n++}]`,async()=>{let p=new Wr(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new Yr(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){ke.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await F.resolveDataType(e,t,r.type)}),r.multipartFields&&await e.enterAsync(".multipartFields",async()=>{for(let i=0;i<r.multipartFields.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.multipartFields[i],s=new Jr(t,{fieldName:n.fieldName,fieldType:n.fieldType});await this._initHttpMediaType(e,s,n),t.multipartFields.push(s)})})}static async _initHttpOperationResponse(e,t,r){await this._initHttpMediaType(e,t,r),t.partial=r.partial,r.parameters&&await e.enterAsync(".parameters",async()=>{let i=0;for(let n of r.parameters)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await F.resolveDataType(e,t,n.type)});let p=new dr(t,s);t.parameters.push(p)})})}static async _initHttpRequestBody(e,t,r){t.description=r.description,t.required=r.required,t.maxContentSize=r.maxContentSize,t.immediateFetch=r.immediateFetch,t.partial=r.partial,t.allowPatchOperators=r.allowPatchOperators,t.keepKeyFields=r.keepKeyFields,r.content&&await e.enterAsync(".content",async()=>{for(let i=0;i<r.content.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.content[i],s=new ke(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(ds,"HttpApiFactory");var qt=ds;import{omitUndefined as Ul}from"@jsopen/objects";import{md5 as $l}from"super-fast-md5";var hs=class hs extends Pe{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="mq",this.controllers=new N,this.platform=e.platform}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values())if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};a(hs,"MQApi");var Bt=hs;var ys=class ys extends Pe{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="ws",this.controllers=new N}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values())if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};a(ys,"WSApi");var Qr=ys;var qa,Ts=class Ts extends g{constructor(){super(null),this[qa]=new WeakMap,this.id="",this.info={},this.references=new N,this.types=new V,this.node[L]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof _?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[Ae].get(t)}findDocument(e){if(this.id===e)return this;for(let t of this.references.values()){if(t.id===e)return t;let r=t.findDocument(e);if(r)return r}}get httpApi(){if(!(this.api&&this.api instanceof Ut))throw new TypeError("The document do not contains HttpApi instance");return this.api}get mqApi(){if(!(this.api&&this.api instanceof Bt))throw new TypeError("The document do not contains MQApi instance");return this.api}get wsApi(){if(!(this.api&&this.api instanceof Qr))throw new TypeError("The document do not contains WSApi instance");return this.api}toJSON(){return this.export()}export(e){let t=Ul({spec:m.SpecVersion,id:this.id,url:this.url,info:P(this.info,!0)});if(this.references.size){let r=0,i={};for(let[n,s]of this.references.entries())s[Ue]||(i[n]={id:s.id,url:s.url,info:P(s.info,!0)},r++);r&&(t.references=i)}if(this.types.size){t.types={};for(let r of this.types.values())r.inScope(e==null?void 0:e.scope)&&(t.types[r.name]=r.toJSON(e))}return this.api&&(t.api=this.api.toJSON(e)),t}invalidate(){let e=this.export({});delete e.id,this.id=$l(JSON.stringify(e)),this[Ae]=new WeakMap}_findDataType(e,t,r){let i=this.types.get(e);if(i&&i.inScope(t))return i;if(!this.references.size)return;if(typeof e=="string"){let s=Gs.exec(e);if(s){let p=s[1];if(p){let c=this.references.get(p);return c?(r=r||new WeakMap,r.set(this,!0),r.set(c,!0),c._findDataType(s[2],t,r)):void 0}e=s[2]}}r=r||new WeakMap,r.set(this,!0);let n=Array.from(this.references.keys()).reverse();for(let s of n){let p=this.references.get(s);if(i=p==null?void 0:p.types.get(e),i)return this[Ae].set(i,p!=null&&p[Ue]?"":s),i}for(let s of n){let p=this.references.get(s);if(r.set(p,!0),i=p._findDataType(e,t,r),i)return this[Ae].set(i,p!=null&&p[Ue]?"":s),i}}};a(Ts,"ApiDocument");var He=Ts;qa=Ae;function je(o,e,t){let r=Vr(e.pick,e.omit),i=typeof o=="string"?o.charAt(0).toUpperCase()+o.substring(1):o.name,n=(t==null?void 0:t.name)||i+"Mapped",s={[n]:class{constructor(){typeof o=="function"&&xr(this,o,r)}}}[n];if(typeof o=="function"&&_r(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(d,o);if(!c)throw new TypeError(`Class "${o}" doesn't have datatype metadata information`);if(!(c.kind===m.ComplexType.Kind||c.kind===m.MappedType.Kind||c.kind===m.MixinType.Kind))throw new TypeError(`Class "${o}" is not a ${m.ComplexType.Kind}`)}let p={...t,kind:"MappedType",base:o};return e.pick&&(p.pick=e.pick),e.omit&&(p.omit=e.omit),e.partial&&(p.partial=e.partial),e.required&&(p.required=e.required),Reflect.defineMetadata(d,p,s),typeof o=="function"&&Xe._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(je,"createMappedClass");function Xx(o,e,t){return je(o,{omit:e},t)}a(Xx,"OmitType");function tO(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return je(o,{partial:t},r)}a(tO,"PartialType");function nO(o,e,t){return je(o,{pick:e},t)}a(nO,"PickType");function cO(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return je(o,{required:t},r)}a(cO,"RequiredType");import{isConstructor as Yl}from"@jsopen/objects";import{omitUndefined as ql}from"@jsopen/objects";import{asMutable as Bl}from"ts-gems";var et=a(function(...o){var i;if(!this)return et[A].apply(void 0,o);let[e,t]=o;if(g.call(this,e),!I.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=Bl(this);r.kind=m.MQController.Kind,r.types=r.node[L]=new V,r.operations=new N,r.headers=[],r.name=t.name,r.description=t.description,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"MQController"),_s=class _s extends g{findHeader(e,t){let r=e.toLowerCase(),i;for(i of this.headers)if(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e))return i;if(this.node.parent&&this.node.parent.element instanceof et)return this.node.parent.element.findHeader(e,t)}toString(){return`[MQController ${this.name}]`}toJSON(){let e=ql({kind:this.kind,description:this.description});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[t.name]=t.toJSON()}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}[De](){return`[${Ne}MQController${Se+this.name+ge}]`}};a(_s,"MQControllerClass");var Es=_s;et.prototype=Es.prototype;Object.assign(et,Pt);et[A]=Pt;import{omitUndefined as Kl}from"@jsopen/objects";import{asMutable as Vl}from"ts-gems";var hr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');Ze.call(this,o,e);let t=Vl(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?$t(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required},"MQHeader"),Os=class Os extends Ze{toJSON(){return Kl({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}};a(Os,"MQHeaderClass");var xs=Os;hr.prototype=xs.prototype;import{omitUndefined as zl}from"@jsopen/objects";import{asMutable as Jl}from"ts-gems";var yr=a(function(...o){if(!this){let[i,n]=o,s=[];return yr[A].call(void 0,s,i,n)}let[e,t]=o;if(g.call(this,e),!I.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Jl(this);r.headers=[],r.types=r.node[L]=new V,r.name=t.name,r.description=t.description,r.channel=t.channel,t!=null&&t.payloadType&&(r.payloadType=(t==null?void 0:t.payloadType)instanceof _?t.payloadType:r.owner.node.getDataType(t.payloadType)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof _?t.keyType:r.owner.node.getDataType(t.keyType))},"MQOperation"),ws=class ws extends g{findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){var t;let e=zl({kind:m.MQOperation.Kind,description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0,response:(t=this.response)==null?void 0:t.toJSON()});if(this.headers.length){e.headers=[];for(let r of this.headers)e.headers.push(r.toJSON())}return e}};a(ws,"MQOperationClass");var gs=ws;yr.prototype=gs.prototype;yr[A]=fr;import{omitUndefined as Wl}from"@jsopen/objects";var As=class As extends g{constructor(e,t){super(e),this.headers=[],this.channel=t==null?void 0:t.channel,this.description=t==null?void 0:t.description,t!=null&&t.payloadType?this.payloadType=(t==null?void 0:t.payloadType)instanceof _?t.payloadType:this.owner.node.getDataType(t.payloadType):this.payloadType=this.owner.node.getDataType("any"),t!=null&&t.keyType&&(this.keyType=(t==null?void 0:t.keyType)instanceof _?t.keyType:this.owner.node.getDataType(t.keyType))}findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){let e=Wl({description:this.description,channel:this.channel,payloadType:this.payloadType.name?this.payloadType.name:this.payloadType.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0});if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}};a(As,"MQOperationResponse");var Gr=As;var Rs=class Rs{static async createApi(e,t){let r=new Bt(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(t.controllers))for(let i of t.controllers){let n=await this._createController(e,r,i);n&&r.controllers.set(n.name,n)}else for(let[i,n]of Object.entries(t.controllers)){let s=await this._createController(e,r,n,i);s&&r.controllers.set(s.name,s)}}),r}static async _createController(e,t,r,i){typeof r=="function"&&!Yl(r)&&(r=r()),r=await pe(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(U,r),!s)return e.addError(`Class "${r.name}" doesn't have a valid MQController metadata`);n=r}else n=Object.getPrototypeOf(r).constructor,s=Reflect.getMetadata(U,n),s?p=r:(s=r,r.instance==="object"&&(p=r.instance,n=Object.getPrototypeOf(p).constructor));if(!s)return e.addError(`Class "${n.name}" is not decorated with MQController()`);if(i=i||s.name,!i)throw new TypeError("Controller name required");let c=new et(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await F.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let x of s.headers)await e.enterAsync(`[${l++}]`,async()=>{let w={...x};await e.enterAsync(".type",async()=>{x.type&&(w.type=c.node.findDataType(x.type)),!w.type&&typeof x.type=="object"&&(w.type=await F.createDataType(e,c,x.type)),w.type||(w.type=c.node.getDataType("any"))});let y=new hr(c,w);c.headers.push(y)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,x]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let w=new yr(c,{...x,name:l,types:void 0,payloadType:void 0,keyType:void 0});await this._initMQOperation(e,w,x),c.operations.set(w.name,w)})}),c}static async _initMQOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await F.addDataTypes(e,t,r.types)}),t.payloadType=await F.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await F.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await F.resolveDataType(e,t,n.type)});let p=new hr(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new Gr(t,{...r.response,payloadType:void 0,keyType:void 0});await this._initMQOperationResponse(e,i,r.response),t.response=i})}static async _initMQOperationResponse(e,t,r){t.payloadType=await F.resolveDataType(e,t,r.payloadType),r.keyType&&(t.keyType=await F.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await F.resolveDataType(e,t,n.type)});let p=new hr(t,s);t.headers.push(p)})})}};a(Rs,"MQApiFactory");var Xr=Rs;var Ql="https://oprajs.com/spec/v"+m.SpecVersion,Zr=class Zr{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new Zr,i=t instanceof he?t:new he(t);try{let n=new He;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof xt||i.addError(n)}catch{}if(!i.error.message){let s=i.error.details.length;i.error.message=`(${s}) error${s>1?"s":""} found in document schema.`,i.showErrorDetails&&(i.error.message+=i.error.details.map(p=>`
|
|
6
|
+
var Ks=Object.defineProperty;var a=(o,e)=>Ks(o,"name",{value:e,configurable:!0});var Rr=(o,e)=>{for(var t in e)Ks(o,t,{get:e[t],enumerable:!0})};import"reflect-metadata";Array.prototype.findLast||(Array.prototype.findLast=function(o,e){let t=this.findLastIndex(o,e);return t>=0?this[t]:void 0},Array.prototype.findLastIndex=function(o,e){if(this==null)throw new TypeError("this is null or not defined");let t=Object(this),r=this.length;e=e||this;for(let i=r-1;i>=0;i--)if(o.call(e,t[i],i,t))return i;return-1});import{omitUndefined as Bp}from"@jsopen/objects";import{isString as Kp}from"valgen";import{omitUndefined as cp}from"@jsopen/objects";import op from"@browsery/i18next";import{splitString as np,tokenize as zs}from"fast-tokenizer";var rp=/\\(.)/g,ip=/(\\)/g;function Vs(o){return o.replace(ip,"\\\\")}a(Vs,"escapeString");function Ws(o){return o.replace(rp,"$1")}a(Ws,"unescapeString");var sp=Object.getPrototypeOf(op.createInstance()).constructor,Qt=class Qt extends sp{async init(e,t){let r=typeof e=="object"?e:{},i=typeof e=="function"?e:t;try{let n=await super.init(r,i),s=this.services.formatter;if(s.add("lowercase",(p,c)=>p.toLocaleLowerCase(c)),s.add("uppercase",(p,c)=>p.toLocaleUpperCase(c)),s.add("upperFirst",(p,c)=>p.charAt(0).toLocaleUpperCase(c)+p.substring(1)),r!=null&&r.resources)for(let p of Object.keys(r.resources)){let c=r.resources[p];for(let l of Object.keys(c))this.addResourceBundle(p,l,c[l],!1,!0)}return i&&i(null,n),n}catch(n){throw i&&i(n,this.t),n}}deep(e,t){if(e==null)return e;let r=new WeakMap;return this._deepTranslate(e,r,t)}createInstance(e,t){return new Qt(e,t)}static createInstance(e,t){return new Qt(e,t)}_deepTranslate(e,t,r){if(e==null||r!=null&&r.ignore&&r.ignore(e,this))return e;if(typeof e=="object"&&t.has(e))return t.get(e);if(typeof e=="string"){let i="";for(let n of zs(e,{brackets:{"$t(":")"},quotes:!0,keepQuotes:!0,keepBrackets:!0,keepDelimiters:!0})){if(n.startsWith("$t(")&&n.endsWith(")")){n=n.substring(3,n.length-1);let s=np(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),p=Ws(n.substring((s[0]||"").length+1));n=s[0]||"";let c=[],l=null;for(let g of zs(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(g.startsWith("{")){l=JSON.parse(g);continue}c.push(g)}let x=c.length>1?"$t("+c.join(",")+")":c[0];i+=p?this.t(x,p,{...r,...l}):this.t(x,{...r,...l});continue}i+=n}return i}if(Array.isArray(e)){let i=Array(e.length);t.set(e,i);for(let n=0,s=e.length;n<s;n++)i[n]=this._deepTranslate(e[n],t,r);return t.delete(e),i}if(typeof e=="object"){if(Buffer.isBuffer(e)||Buffer.isBuffer(e)||e instanceof Symbol||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof WeakMap||e instanceof WeakSet)return e;let i={};t.set(e,i);let n=Object.keys(e);for(let s=0,p=n.length;s<p;s++){let c=n[s];i[c]=this._deepTranslate(e[c],t,r)}return t.delete(e),i}return e}static get defaultInstance(){return ap}};a(Qt,"I18n");var Gt=Qt,ap=Gt.createInstance();var pp=/(\))/g;function Mf(o,e,t){let r=e&&typeof e=="object"?e:void 0,i=typeof e=="string"?e:t;return"$t("+o+(r?","+JSON.stringify(r):"")+(i?"?"+Vs(i).replace(pp,"\\$1"):"")+")"}a(Mf,"translate");var ci=Gt.createInstance();ci.init().catch(()=>{});var li=class li extends Error{constructor(e,t){super("Unknown error"),this.severity="error",t=t||(e instanceof Error?e:void 0),e instanceof Error&&(t=e),t&&t instanceof Error&&(this.cause=t,t.stack&&(this.stack=t.stack)),typeof e=="string"?this.initString(e):e instanceof Error?this.initError(e):this.init(e),this.message=this.message||this.constructor.name}toString(){return ci.deep(this.message)}toJSON(){var t;let e="production";return cp({message:this.message,severity:this.severity,system:this.system,code:this.code,details:this.details,stack:e==="dev"||e==="development"||e==="test"?(t=this.stack)==null?void 0:t.split(`
|
|
7
|
+
`):void 0},!0)}init(e){this.message=(e==null?void 0:e.message)||this.constructor.name,this.severity=(e==null?void 0:e.severity)||"error",e&&(this.system=e.system,this.code=e.code,this.details=e.details)}initString(e){this.init({message:String(e||"")||this.constructor.name,severity:"error",code:this.constructor.name})}initError(e){this.init({message:e.message,severity:e.severity||"error",code:e.code||e.constructor.name})}};a(li,"OpraException");var xe=li;var fi=class fi extends xe{constructor(e,t,r){super(e,t instanceof Error?t:void 0),this.status=(typeof t=="number"?t:Number(r))||500}setStatus(e){return this.status=e,this}initError(e){typeof e.status=="number"?this.status=e.status:typeof e.getStatus=="function"&&(this.status=e.getStatus()),super.initError(e)}};a(fi,"OpraHttpError");var M=fi;var mi=class mi extends M{constructor(){super(...arguments),this.status=400}init(e){super.init({message:"Bad request",code:"BAD_REQUEST",...e})}};a(mi,"BadRequestError");var Js=mi;var ui=class ui extends M{constructor(){super(...arguments),this.status=409}init(e){super.init({message:"Conflict",code:"CONFLICT",...e})}};a(ui,"ConflictError");var Ys=ui;var di=class di extends M{constructor(){super(...arguments),this.status=424}init(e){super.init({message:"The request failed due to failure of a previous request",code:"FAILED_DEPENDENCY",...e})}};a(di,"FailedDependencyError");var Qs=di;var Gs;(function(o){o.X_Opra_Version="X-Opra-Version",o.X_Total_Count="X-Total-Count",o.WWW_Authenticate="WWW-Authenticate",o.Authorization="Authorization",o.Proxy_Authenticate="Proxy-Authenticate",o.Proxy_Authorization="Proxy-Authorization",o.Age="Age",o.Cache_Control="Cache-Control",o.Clear_Site_Data="Clear-Site-Data",o.Expires="Expires",o.Pragma="Pragma",o.Last_Modified="Last-Modified",o.ETag="ETag",o.If_Match="If-Match",o.If_None_Match="If-None-Match",o.If_Modified_Since="If-Modified-Since",o.If_Unmodified_Since="If-Unmodified-Since",o.Vary="Vary",o.Connection="Connection",o.Keep_Alive="Keep-Alive",o.Accept="Accept",o.Accept_Encoding="Accept-Encoding",o.Accept_Language="Accept-Language",o.Expect="Expect",o.Cookie="Cookie",o.Set_Cookie="Set-Cookie",o.Access_Control_Allow_Origin="Access-Control-Allow-Origin",o.Access_Control_Allow_Credentials="Access-Control-Allow-Credentials",o.Access_Control_Allow_Headers="Access-Control-Allow-Headers",o.Access_Control_Allow_Methods="Access-Control-Allow-Methods",o.Access_Control_Expose_Headers="Access-Control-Expose-Headers",o.Access_Control_Max_Age="Access-Control-Max-Age",o.Access_Control_Request_Headers="Access-Control-Request-Headers",o.Access_Control_Request_Method="Access-Control-Request-Method",o.Origin="Origin",o.Timing_Allow_Origin="Timing-Allow-Origin",o.Content_Disposition="Content-Disposition",o.Content_ID="Content-ID",o.Content_Length="Content-Length",o.Content_Type="Content-Type",o.Content_Transfer_Encoding="Content-Transfer-Encoding",o.Content_Encoding="Content-Encoding",o.Content_Language="Content-Language",o.Content_Location="Content-Location",o.Forwarded="Forwarded",o.X_Forwarded_For="X-Forwarded-For",o.X_Forwarded_Host="X-Forwarded-Host",o.X_Forwarded_Proto="X-Forwarded-Proto",o.Via="Via",o.Location="Location",o.From="From",o.Host="Host",o.Referer="Referer",o.Referrer_Policy="Referrer-Policy",o.User_Agent="User-Agent",o.Allow="Allow",o.Server="Server",o.Accept_Ranges="Accept-Ranges",o.Range="Range",o.If_Range="If-Range",o.Content_Range="Content-Range",o.Cross_Origin_Embedder_Policy="Cross-Origin-Embedder-Policy",o.Cross_Origin_Opener_Policy="Cross-Origin-Opener-Policy",o.Cross_Origin_Resource_Policy="Cross-Origin-Resource-Policy",o.Content_Security_Policy="Content-Security-Policy",o.Content_Security_Policy_Report_Only="Content-Security-Policy-Report-Only",o.Expect_CT="Expect-CT",o.Feature_Policy="Feature-Policy",o.Strict_Transport_Security="Strict-Transport-Security",o.Upgrade="Upgrade",o.Upgrade_Insecure_Requests="Upgrade-Insecure-Requests",o.X_Content_Type_Options="X-Content-Type-Options",o.X_Download_Options="X-Download-Options",o.X_Frame_Options="X-Frame-Options",o.X_Permitted_Cross_Domain_Policies="X-Permitted-Cross-Domain-Policies",o.X_Powered_By="X-Powered-By",o.X_XSS_Protection="X-XSS-Protection",o.Transfer_Encoding="Transfer-Encoding",o.TE="TE",o.Trailer="Trailer",o.Sec_WebSocket_Key="Sec-WebSocket-Key",o.Sec_WebSocket_Extensions="Sec-WebSocket-Extensions",o.Sec_WebSocket_Accept="Sec-WebSocket-Accept",o.Sec_WebSocket_Protocol="Sec-WebSocket-Protocol",o.Sec_WebSocket_Version="Sec-WebSocket-Version",o.Date="Date",o.Retry_After="Retry-After",o.Server_Timing="Server-Timing",o.X_DNS_Prefetch_Control="X-DNS-Prefetch-Control",o.Max_Forwards="Max-Forwards"})(Gs||(Gs={}));var R;(function(o){o[o.CONTINUE=100]="CONTINUE",o[o.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",o[o.PROCESSING=102]="PROCESSING",o[o.EARLYHINTS=103]="EARLYHINTS",o[o.OK=200]="OK",o[o.CREATED=201]="CREATED",o[o.ACCEPTED=202]="ACCEPTED",o[o.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",o[o.NO_CONTENT=204]="NO_CONTENT",o[o.RESET_CONTENT=205]="RESET_CONTENT",o[o.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",o[o.AMBIGUOUS=300]="AMBIGUOUS",o[o.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",o[o.FOUND=302]="FOUND",o[o.SEE_OTHER=303]="SEE_OTHER",o[o.NOT_MODIFIED=304]="NOT_MODIFIED",o[o.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",o[o.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",o[o.BAD_REQUEST=400]="BAD_REQUEST",o[o.UNAUTHORIZED=401]="UNAUTHORIZED",o[o.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",o[o.FORBIDDEN=403]="FORBIDDEN",o[o.NOT_FOUND=404]="NOT_FOUND",o[o.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",o[o.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",o[o.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",o[o.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",o[o.CONFLICT=409]="CONFLICT",o[o.GONE=410]="GONE",o[o.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",o[o.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",o[o.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",o[o.URI_TOO_LONG=414]="URI_TOO_LONG",o[o.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",o[o.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",o[o.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",o[o.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",o[o.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",o[o.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",o[o.LOCKED=423]="LOCKED",o[o.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",o[o.TOO_EARLY=425]="TOO_EARLY",o[o.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",o[o.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",o[o.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",o[o.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",o[o.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",o[o.BAD_GATEWAY=502]="BAD_GATEWAY",o[o.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",o[o.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",o[o.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",o[o.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",o[o.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",o[o.LOOP_DETECTED=508]="LOOP_DETECTED",o[o.NOT_EXTENDED=510]="NOT_EXTENDED",o[o.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(R||(R={}));var tm={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};var D;(function(o){o.json="application/json",o.opra_response_json="application/opra.response+json",o.xml="application/XML",o.text="text/plain",o.html="text/html",o.markdown="text/markdown",o.binary="binary/octet-stream"})(D||(D={}));var hi=class hi extends M{constructor(){super(...arguments),this.status=R.FORBIDDEN}init(e){super.init({message:"You are not authorized to perform this action",code:"FORBIDDEN",...e})}};a(hi,"ForbiddenError");var br=hi;var yi=class yi extends M{constructor(){super(...arguments),this.status=500}init(e){super.init({message:"Internal server error",code:"INTERNAL_SERVER_ERROR",severity:"fatal",...e})}};a(yi,"InternalServerError");var Xs=yi;var Ti=class Ti extends M{constructor(){super(...arguments),this.status=405}init(e){super.init({message:"Method not allowed",code:"METHOD_NOT_ALLOWED",...e})}};a(Ti,"MethodNotAllowedError");var Zs=Ti;var Ei=class Ei extends M{constructor(){super(...arguments),this.status=406}init(e){super.init({message:"Not Acceptable",code:"NOT_ACCEPTABLE",...e})}};a(Ei,"NotAcceptableError");var Hs=Ei;var _i=class _i extends M{constructor(){super(...arguments),this.status=404}init(e){super.init({message:"Not found",code:"NOT_FOUND",...e})}};a(_i,"NotFoundError");var ea=_i;var xi=class xi extends br{init(e){super.init({message:"You dont have permission for this operation",code:"PERMISSION_ERROR",...e})}};a(xi,"PermissionError");var ta=xi;var Oi=class Oi extends M{constructor(e,t,r){super({message:`There is already an other "${e}" resource with same values for field(s) [${t}]`,severity:"error",code:"RESOURCE_CONFLICT",details:{resource:e,location:t}},r),this.status=409}};a(Oi,"ResourceConflictError");var ra=Oi;var gi=class gi extends M{constructor(e,t,r){super({message:`Resource "${e}${t?"/"+t:""}" is not available`,severity:"error",code:"RESOURCE_NOT_AVAILABLE",details:{resource:e,key:t}},r,R.UNPROCESSABLE_ENTITY)}};a(gi,"ResourceNotAvailableError");var ia=gi;var wi=class wi extends M{constructor(){super(...arguments),this.status=401}init(e){super.init({message:"You don't have permission to perform this action",code:"UNAUTHORIZED",...e})}};a(wi,"UnauthorizedError");var oa=wi;var Ai=class Ai extends M{constructor(){super(...arguments),this.status=422}init(e){super.init({message:"Unprocessable entity",severity:"error",code:"UNPROCESSABLE_ENTITY",...e})}};a(Ai,"UnprocessableEntityError");var na=Ai;var sa;(function(o){let e;(function(t){t.fatal="fatal",t.error="error",t.warning="warning",t.info="info"})(e=o.Enum||(o.Enum={})),o.name="IssueSeverity",o.description="Severity of the issue",o.Keys=Object.keys(o),o.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"}})(sa||(sa={}));BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});import{isConstructor as lp}from"@jsopen/objects";import fp from"putil-promisify";async function Z(o){return o=fp.isPromise(o)?await o:o,typeof o=="function"?lp(o)?o:await o():o}a(Z,"resolveThunk");var aa=/^(?:file:\/\/)?(.+)$/;function lu(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?aa.exec(r):void 0;return i?i[1]:""}return""}a(lu,"getStackFileName");function fu(o=1){if(o>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+o+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");let e=Error.prepareStackTrace;Error.prepareStackTrace=(r,i)=>i;let t=new Error().stack;if(Error.prepareStackTrace=e,t!==null&&typeof t=="object"){let r=t[o]?t[o].getFileName():void 0,i=r?aa.exec(r):void 0;return i?i[1]:""}return""}a(fu,"getErrorStack");function Dr(o,e,t){for(let r of Object.getOwnPropertyNames(e))r==="constructor"||r==="__proto__"||r==="toJSON"||r==="toString"||t&&!t(r)||Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(e,r)||Object.create(null))}a(Dr,"mergePrototype");function Nr(o,e,t=r=>!0){try{let r=new e;Object.getOwnPropertyNames(r).filter(n=>typeof r[n]<"u"&&typeof o[n]>"u").filter(n=>t(n)).forEach(n=>{o[n]=r[n]})}catch{}}a(Nr,"inheritPropertyInitializers");import{isPlainObject as ca,merge as mp}from"@jsopen/objects";var d=Symbol.for("opra.type.metadata"),ae=Symbol("opra.http-controller.metadata"),pe=Symbol("opra.mq-controller.metadata"),ce=Symbol("opra.ws-controller.metadata"),Xt=Symbol("opra.ws-param.metadata"),yu=Symbol("opra.rpc-controller.metadata"),E=Symbol.for("opra.type.decoder"),O=Symbol("opra.type.encoder"),w=Symbol.for("DECORATOR"),Be=Symbol.for("BUILTIN"),pa=/([a-z$_]\w+):(.+)/i,P=/^[a-z][\w_]*$/i,L=Symbol.for("kDataTypeMap"),Sr=Symbol.for("kCtorMap"),De=Symbol.for("kTypeNSMap");function F(o,e){return mp({},o,{deep:a(t=>ca(t)&&!t[d],"deep"),symbolKeys:!0,copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||ca(i)||Array.isArray(i))}})}a(F,"cloneObject");import{splitString as la}from"fast-tokenizer";var up=/^([+-])?([a-z_$]\w*)$/i,dp=/[^.]\(/g,Ri=class Ri{};a(Ri,"FieldsProjection");var Ke=Ri;(function(o){let t=class t{};a(t,"Item");let e=t;o.Item=e})(Ke||(Ke={}));function fa(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new Ke;for(let i of t)e||(i=i.toLowerCase()),ma(i,r);return r}a(fa,"parseFieldsProjection");function ma(o,e){o=o.replace(dp,r=>r.charAt(0)+"."+r.substring(1));let t=la(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let c=la(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let l of c)ma(l,e);continue}let n=up.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],p=e[s]=e[s]||new Ke.Item;n[1]&&(p.sign=n[1]),r===t.length-1?delete p.projection:e=p.projection=p.projection||new Ke}}a(ma,"parse");function hp(o){return o&&typeof o.forEach=="function"}a(hp,"isMap");var Y=Symbol.for("kEntries"),le=Symbol.for("kKeyMap"),Mr=Symbol.for("kWellKnownKeys"),bi=Symbol.for("kOptions"),at=Symbol.for("kSize"),Di=class Di{constructor(e,t){Object.defineProperty(this,at,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,Y,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,le,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Mr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,bi,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[Mr][i]=i:this[Mr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[at]}clear(){Object.keys(this[Y]).forEach(e=>delete this[Y][e]),Object.keys(this[le]).forEach(e=>delete this[le][e]),this[at]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[Y][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[Y],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[Y],r);return this[Y][r]=t,i||this[at]++,this[le][r]=e,this}setAll(e){return hp(e)?e.forEach((t,r)=>this.set(r,t)):Object.keys(e).forEach(t=>this.set(t,e[t])),this}keys(){return Object.values(this[le])[Symbol.iterator]()}values(){return Object.values(this[Y])[Symbol.iterator]()}entries(){return Object.entries(this[Y])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[Y],t);return delete this[Y][t],delete this[le][t],r||this[at]--,r}sort(e){let t={...this[Y]},r={...this[le]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[Y][n]=t[n],this[le][n]=r[n];return this[at]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[le]))e[r]=this[Y][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[bi].caseSensitive)return e;let t=this._getStoringKey(e);return this[le][t]??this[Mr][t]??e}_getStoringKey(e){return this[bi].caseSensitive?e:e.toLowerCase()}};a(Di,"ResponsiveMap");var N=Di;function Du(o,e,t){let r=new WeakSet;return JSON.stringify(o,(i,n)=>{if(n!==null&&typeof n=="object"){if(r.has(n))return;r.add(n)}return e?e(i,n):n},t)}a(Du,"safeJsonStringify");function Ni(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(Ni,"isStream");function Mu(o){return Ni(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(Mu,"isReadable");function vu(o){return Ni(o)&&typeof o._write=="function"}a(vu,"isWritable");function Fu(o){return Ni(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Fu,"isReadableStream");function Iu(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(Iu,"isBlob");function Pu(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(Pu,"isFormData");function Lu(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(Lu,"isURL");var Si=class Si{constructor(){this.kind=Object.getPrototypeOf(this).constructor.name}};a(Si,"Ast");var Zt=Si;var Mi=class Mi extends Zt{};a(Mi,"Expression");var U=Mi;var vi=class vi extends U{};a(vi,"Term");var Ve=vi;var Fi=class Fi extends Ve{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(Fi,"Literal");var I=Fi;var Ii=class Ii extends U{constructor(){super(),this.items=[]}append(e,t){return this.items.push(new vr({op:e,expression:t})),this}toString(){return this.items.map((e,t)=>(t>0?e.op:"")+e.expression).join("")}};a(Ii,"ArithmeticExpression");var We=Ii,Pi=class Pi{constructor(e){Object.assign(this,e)}};a(Pi,"ArithmeticExpressionItem");var vr=Pi;var Li=class Li extends Ve{constructor(e){super(),this.items=e}toString(){return"["+this.items.map(e=>""+e).join(",")+"]"}};a(Li,"ArrayExpression");var Oe=Li;var yp=/\w/,ki=class ki extends U{constructor(e){super(),Object.assign(this,e)}toString(){return`${this.left}${yp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(ki,"ComparisonExpression");var fe=ki;var ji=class ji extends U{constructor(e){super(),Object.assign(this,e),this.op==="&&"&&(this.op="and"),this.op==="||"&&(this.op="or")}toString(){return this.items.map(e=>""+e).join(" "+this.op+" ")}};a(ji,"LogicalExpression");var me=ji;var Ci=class Ci extends U{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(Ci,"NegativeExpression");var Ht=Ci;var Ui=class Ui extends U{constructor(e){super(),this.expression=e}toString(){return`(${this.expression})`}};a(Ui,"ParenthesizedExpression");var ge=Ui;var $i=class $i extends I{constructor(e){super(e)}};a($i,"BooleanLiteral");var ze=$i;import{toDateDef as gp}from"putil-varhelpers";var qi=class qi extends TypeError{};a(qi,"SyntaxError");var Fr=qi,Bi=class Bi extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(Bi,"FilterValidationError");var ue=Bi,Ki=class Ki extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(Ki,"FilterParseError");var Ir=Ki;var Tp=/'/g,Ep=/(\\)/g,_p=/\\(.)/g;function xp(o){return o.replace(Ep,"\\\\")}a(xp,"escapeString");function Op(o){return o.replace(_p,"$1")}a(Op,"unescapeString");function Ne(o){return"'"+xp(o).replace(Tp,"\\'")+"'"}a(Ne,"quoteFilterString");function er(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?Op(o.substring(1,o.length-1)):o}a(er,"unquoteFilterString");var ua=new Date(0),Vi=class Vi extends I{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&gp(e,ua)!==ua){this.value=e;return}throw new ue(`Invalid date value "${e}"`)}toString(){return Ne(this.value)}};a(Vi,"DateLiteral");var Se=Vi;import{toDateDef as wp}from"putil-varhelpers";var da=new Date(0),Wi=class Wi extends I{constructor(e){if(super(""),e instanceof Date){this.value=e.toISOString();return}if(typeof e=="string"&&wp(e,da)!==da){this.value=e;return}throw new ue(`Invalid date-time value "${e}"`)}toString(){return Ne(this.value)}};a(Wi,"DateTimeLiteral");var tr=Wi;var zi=class zi extends I{constructor(){super(null),this.value=null}};a(zi,"NullLiteral");var Je=zi;var Ji=class Ji extends I{constructor(e){if(super(0),typeof e=="number"||typeof e=="bigint"){this.value=e;return}try{if(typeof e=="string"){if(e.includes(".")){this.value=parseFloat(e);return}let t=Number(e);""+t===e?this.value=t:this.value=BigInt(e);return}}catch{}throw new ue(`Invalid number literal ${e}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Ji,"NumberLiteral");var we=Ji;var Yi=class Yi extends I{constructor(e){super(""+e)}};a(Yi,"QualifiedIdentifier");var H=Yi;var Qi=class Qi extends I{constructor(e){super(""+e)}toString(){return Ne(this.value)}};a(Qi,"StringLiteral");var Ye=Qi;var Ap=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,Gi=class Gi extends I{constructor(e){if(super(""),e instanceof Date){this.value=Pr(e.getHours())+":"+Pr(e.getMinutes())+(e.getSeconds()?":"+Pr(e.getSeconds()):"")+(e.getMilliseconds()?"."+Pr(e.getMilliseconds()):"");return}if(typeof e=="string"&&Ap.test(e)){this.value=e;return}throw new ue(`Invalid time value "${e}"`)}toString(){return Ne(this.value)}};a(Gi,"TimeLiteral");var Qe=Gi;function Pr(o){return o<=9?"0"+o:""+o}a(Pr,"pad");import{CharStream as $p,CommonTokenStream as qp}from"@browsery/antlr4";import{ATNDeserializer as Rp,DFA as bp,Lexer as Dp,LexerATNSimulator as Np,PredictionContextCache as Sp,Token as Mp}from"@browsery/antlr4";var z=class z extends Dp{constructor(e){super(e),this._interp=new Np(this,z._ATN,z.DecisionsToDFA,new Sp)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return z.literalNames}get symbolicNames(){return z.symbolicNames}get ruleNames(){return z.ruleNames}get serializedATN(){return z._serializedATN}get channelNames(){return z.channelNames}get modeNames(){return z.modeNames}static get _ATN(){return z.__ATN||(z.__ATN=new Rp().deserialize(z._serializedATN)),z.__ATN}};a(z,"OpraFilterLexer");var y=z;y.T__0=1;y.T__1=2;y.T__2=3;y.T__3=4;y.T__4=5;y.T__5=6;y.T__6=7;y.T__7=8;y.T__8=9;y.T__9=10;y.T__10=11;y.T__11=12;y.T__12=13;y.T__13=14;y.T__14=15;y.T__15=16;y.T__16=17;y.T__17=18;y.T__18=19;y.T__19=20;y.T__20=21;y.T__21=22;y.T__22=23;y.T__23=24;y.T__24=25;y.T__25=26;y.T__26=27;y.T__27=28;y.T__28=29;y.T__29=30;y.T__30=31;y.T__31=32;y.T__32=33;y.T__33=34;y.IDENTIFIER=35;y.POLAR_OP=36;y.DATE=37;y.DATETIME=38;y.TIME=39;y.NUMBER=40;y.INTEGER=41;y.STRING=42;y.WHITESPACE=43;y.EOF=Mp.EOF;y.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];y.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];y.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,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];y.modeNames=["DEFAULT_MODE"];y.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","IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE","DIGIT","DATEFORMAT","TIMEFORMAT","TIMEZONEOFFSETFORMAT","ESC","UNICODE","HEX"];y._serializedATN=[4,0,43,461,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,1,0,1,0,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,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,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,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,1,34,1,34,5,34,225,8,34,10,34,12,34,228,9,34,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,3,36,240,8,36,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,291,8,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,301,8,38,1,39,3,39,304,8,39,1,39,4,39,307,8,39,11,39,12,39,308,1,39,1,39,5,39,313,8,39,10,39,12,39,316,9,39,3,39,318,8,39,1,39,1,39,3,39,322,8,39,1,39,4,39,325,8,39,11,39,12,39,326,3,39,329,8,39,1,39,1,39,1,39,1,39,4,39,335,8,39,11,39,12,39,336,3,39,339,8,39,1,40,3,40,342,8,40,1,40,4,40,345,8,40,11,40,12,40,346,1,40,1,40,1,40,1,40,4,40,353,8,40,11,40,12,40,354,3,40,357,8,40,1,41,1,41,1,41,5,41,362,8,41,10,41,12,41,365,9,41,1,41,1,41,1,41,1,41,5,41,371,8,41,10,41,12,41,374,9,41,1,41,3,41,377,8,41,1,42,4,42,380,8,42,11,42,12,42,381,1,42,1,42,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,397,8,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,406,8,44,1,45,1,45,1,45,1,45,3,45,412,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,4,45,424,8,45,11,45,12,45,425,3,45,428,8,45,3,45,430,8,45,1,46,1,46,1,46,3,46,435,8,46,1,46,1,46,1,46,3,46,440,8,46,1,46,1,46,1,46,3,46,445,8,46,3,46,447,8,46,1,47,1,47,1,47,3,47,452,8,47,1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,0,0,50,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,0,89,0,91,0,93,0,95,0,97,0,99,0,1,0,16,4,0,36,36,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122,2,0,43,43,45,45,1,0,39,39,1,0,34,34,3,0,9,10,13,13,32,32,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,3,0,48,57,65,70,97,102,491,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,1,101,1,0,0,0,3,103,1,0,0,0,5,105,1,0,0,0,7,109,1,0,0,0,9,111,1,0,0,0,11,113,1,0,0,0,13,115,1,0,0,0,15,117,1,0,0,0,17,119,1,0,0,0,19,121,1,0,0,0,21,126,1,0,0,0,23,132,1,0,0,0,25,137,1,0,0,0,27,146,1,0,0,0,29,155,1,0,0,0,31,157,1,0,0,0,33,159,1,0,0,0,35,161,1,0,0,0,37,163,1,0,0,0,39,166,1,0,0,0,41,168,1,0,0,0,43,170,1,0,0,0,45,173,1,0,0,0,47,175,1,0,0,0,49,178,1,0,0,0,51,181,1,0,0,0,53,185,1,0,0,0,55,190,1,0,0,0,57,196,1,0,0,0,59,202,1,0,0,0,61,209,1,0,0,0,63,213,1,0,0,0,65,216,1,0,0,0,67,219,1,0,0,0,69,222,1,0,0,0,71,229,1,0,0,0,73,239,1,0,0,0,75,290,1,0,0,0,77,300,1,0,0,0,79,338,1,0,0,0,81,356,1,0,0,0,83,376,1,0,0,0,85,379,1,0,0,0,87,385,1,0,0,0,89,387,1,0,0,0,91,411,1,0,0,0,93,446,1,0,0,0,95,448,1,0,0,0,97,453,1,0,0,0,99,459,1,0,0,0,101,102,5,40,0,0,102,2,1,0,0,0,103,104,5,41,0,0,104,4,1,0,0,0,105,106,5,110,0,0,106,107,5,111,0,0,107,108,5,116,0,0,108,6,1,0,0,0,109,110,5,33,0,0,110,8,1,0,0,0,111,112,5,46,0,0,112,10,1,0,0,0,113,114,5,64,0,0,114,12,1,0,0,0,115,116,5,91,0,0,116,14,1,0,0,0,117,118,5,44,0,0,118,16,1,0,0,0,119,120,5,93,0,0,120,18,1,0,0,0,121,122,5,116,0,0,122,123,5,114,0,0,123,124,5,117,0,0,124,125,5,101,0,0,125,20,1,0,0,0,126,127,5,102,0,0,127,128,5,97,0,0,128,129,5,108,0,0,129,130,5,115,0,0,130,131,5,101,0,0,131,22,1,0,0,0,132,133,5,110,0,0,133,134,5,117,0,0,134,135,5,108,0,0,135,136,5,108,0,0,136,24,1,0,0,0,137,138,5,73,0,0,138,139,5,110,0,0,139,140,5,102,0,0,140,141,5,105,0,0,141,142,5,110,0,0,142,143,5,105,0,0,143,144,5,116,0,0,144,145,5,121,0,0,145,26,1,0,0,0,146,147,5,105,0,0,147,148,5,110,0,0,148,149,5,102,0,0,149,150,5,105,0,0,150,151,5,110,0,0,151,152,5,105,0,0,152,153,5,116,0,0,153,154,5,121,0,0,154,28,1,0,0,0,155,156,5,43,0,0,156,30,1,0,0,0,157,158,5,45,0,0,158,32,1,0,0,0,159,160,5,42,0,0,160,34,1,0,0,0,161,162,5,47,0,0,162,36,1,0,0,0,163,164,5,60,0,0,164,165,5,61,0,0,165,38,1,0,0,0,166,167,5,60,0,0,167,40,1,0,0,0,168,169,5,62,0,0,169,42,1,0,0,0,170,171,5,62,0,0,171,172,5,61,0,0,172,44,1,0,0,0,173,174,5,61,0,0,174,46,1,0,0,0,175,176,5,33,0,0,176,177,5,61,0,0,177,48,1,0,0,0,178,179,5,105,0,0,179,180,5,110,0,0,180,50,1,0,0,0,181,182,5,33,0,0,182,183,5,105,0,0,183,184,5,110,0,0,184,52,1,0,0,0,185,186,5,108,0,0,186,187,5,105,0,0,187,188,5,107,0,0,188,189,5,101,0,0,189,54,1,0,0,0,190,191,5,33,0,0,191,192,5,108,0,0,192,193,5,105,0,0,193,194,5,107,0,0,194,195,5,101,0,0,195,56,1,0,0,0,196,197,5,105,0,0,197,198,5,108,0,0,198,199,5,105,0,0,199,200,5,107,0,0,200,201,5,101,0,0,201,58,1,0,0,0,202,203,5,33,0,0,203,204,5,105,0,0,204,205,5,108,0,0,205,206,5,105,0,0,206,207,5,107,0,0,207,208,5,101,0,0,208,60,1,0,0,0,209,210,5,97,0,0,210,211,5,110,0,0,211,212,5,100,0,0,212,62,1,0,0,0,213,214,5,111,0,0,214,215,5,114,0,0,215,64,1,0,0,0,216,217,5,38,0,0,217,218,5,38,0,0,218,66,1,0,0,0,219,220,5,124,0,0,220,221,5,124,0,0,221,68,1,0,0,0,222,226,7,0,0,0,223,225,7,1,0,0,224,223,1,0,0,0,225,228,1,0,0,0,226,224,1,0,0,0,226,227,1,0,0,0,227,70,1,0,0,0,228,226,1,0,0,0,229,230,7,2,0,0,230,72,1,0,0,0,231,232,5,39,0,0,232,233,3,89,44,0,233,234,5,39,0,0,234,240,1,0,0,0,235,236,5,34,0,0,236,237,3,89,44,0,237,238,5,34,0,0,238,240,1,0,0,0,239,231,1,0,0,0,239,235,1,0,0,0,240,74,1,0,0,0,241,242,5,39,0,0,242,243,3,89,44,0,243,244,5,84,0,0,244,245,3,91,45,0,245,246,3,93,46,0,246,247,5,39,0,0,247,248,5,39,0,0,248,249,3,89,44,0,249,250,5,32,0,0,250,251,3,91,45,0,251,252,3,93,46,0,252,253,5,39,0,0,253,254,5,39,0,0,254,255,3,89,44,0,255,256,5,84,0,0,256,257,3,91,45,0,257,258,5,39,0,0,258,259,5,39,0,0,259,260,3,89,44,0,260,261,5,32,0,0,261,262,3,91,45,0,262,263,5,39,0,0,263,291,1,0,0,0,264,265,5,34,0,0,265,266,3,89,44,0,266,267,5,84,0,0,267,268,3,91,45,0,268,269,3,93,46,0,269,270,5,34,0,0,270,291,1,0,0,0,271,272,5,34,0,0,272,273,3,89,44,0,273,274,5,32,0,0,274,275,3,91,45,0,275,276,3,93,46,0,276,277,5,34,0,0,277,291,1,0,0,0,278,279,5,34,0,0,279,280,3,89,44,0,280,281,5,84,0,0,281,282,3,91,45,0,282,283,5,34,0,0,283,291,1,0,0,0,284,285,5,34,0,0,285,286,3,89,44,0,286,287,5,32,0,0,287,288,3,91,45,0,288,289,5,34,0,0,289,291,1,0,0,0,290,241,1,0,0,0,290,264,1,0,0,0,290,271,1,0,0,0,290,278,1,0,0,0,290,284,1,0,0,0,291,76,1,0,0,0,292,293,5,39,0,0,293,294,3,91,45,0,294,295,5,39,0,0,295,301,1,0,0,0,296,297,5,34,0,0,297,298,3,91,45,0,298,299,5,34,0,0,299,301,1,0,0,0,300,292,1,0,0,0,300,296,1,0,0,0,301,78,1,0,0,0,302,304,3,71,35,0,303,302,1,0,0,0,303,304,1,0,0,0,304,306,1,0,0,0,305,307,3,87,43,0,306,305,1,0,0,0,307,308,1,0,0,0,308,306,1,0,0,0,308,309,1,0,0,0,309,317,1,0,0,0,310,314,5,46,0,0,311,313,3,87,43,0,312,311,1,0,0,0,313,316,1,0,0,0,314,312,1,0,0,0,314,315,1,0,0,0,315,318,1,0,0,0,316,314,1,0,0,0,317,310,1,0,0,0,317,318,1,0,0,0,318,328,1,0,0,0,319,321,5,69,0,0,320,322,7,2,0,0,321,320,1,0,0,0,321,322,1,0,0,0,322,324,1,0,0,0,323,325,3,87,43,0,324,323,1,0,0,0,325,326,1,0,0,0,326,324,1,0,0,0,326,327,1,0,0,0,327,329,1,0,0,0,328,319,1,0,0,0,328,329,1,0,0,0,329,339,1,0,0,0,330,331,5,48,0,0,331,332,5,120,0,0,332,334,1,0,0,0,333,335,3,99,49,0,334,333,1,0,0,0,335,336,1,0,0,0,336,334,1,0,0,0,336,337,1,0,0,0,337,339,1,0,0,0,338,303,1,0,0,0,338,330,1,0,0,0,339,80,1,0,0,0,340,342,3,71,35,0,341,340,1,0,0,0,341,342,1,0,0,0,342,344,1,0,0,0,343,345,3,87,43,0,344,343,1,0,0,0,345,346,1,0,0,0,346,344,1,0,0,0,346,347,1,0,0,0,347,357,1,0,0,0,348,349,5,48,0,0,349,350,5,120,0,0,350,352,1,0,0,0,351,353,3,99,49,0,352,351,1,0,0,0,353,354,1,0,0,0,354,352,1,0,0,0,354,355,1,0,0,0,355,357,1,0,0,0,356,341,1,0,0,0,356,348,1,0,0,0,357,82,1,0,0,0,358,363,5,39,0,0,359,362,3,95,47,0,360,362,8,3,0,0,361,359,1,0,0,0,361,360,1,0,0,0,362,365,1,0,0,0,363,361,1,0,0,0,363,364,1,0,0,0,364,366,1,0,0,0,365,363,1,0,0,0,366,377,5,39,0,0,367,372,5,34,0,0,368,371,3,95,47,0,369,371,8,4,0,0,370,368,1,0,0,0,370,369,1,0,0,0,371,374,1,0,0,0,372,370,1,0,0,0,372,373,1,0,0,0,373,375,1,0,0,0,374,372,1,0,0,0,375,377,5,34,0,0,376,358,1,0,0,0,376,367,1,0,0,0,377,84,1,0,0,0,378,380,7,5,0,0,379,378,1,0,0,0,380,381,1,0,0,0,381,379,1,0,0,0,381,382,1,0,0,0,382,383,1,0,0,0,383,384,6,42,0,0,384,86,1,0,0,0,385,386,7,6,0,0,386,88,1,0,0,0,387,388,7,6,0,0,388,389,7,6,0,0,389,390,7,6,0,0,390,391,7,6,0,0,391,396,5,45,0,0,392,393,7,7,0,0,393,397,7,8,0,0,394,395,7,9,0,0,395,397,7,10,0,0,396,392,1,0,0,0,396,394,1,0,0,0,397,398,1,0,0,0,398,405,5,45,0,0,399,400,7,11,0,0,400,406,7,7,0,0,401,402,7,10,0,0,402,406,7,8,0,0,403,404,5,51,0,0,404,406,5,49,0,0,405,399,1,0,0,0,405,401,1,0,0,0,405,403,1,0,0,0,406,90,1,0,0,0,407,408,7,12,0,0,408,412,7,6,0,0,409,410,5,50,0,0,410,412,7,13,0,0,411,407,1,0,0,0,411,409,1,0,0,0,412,413,1,0,0,0,413,414,5,58,0,0,414,415,7,14,0,0,415,416,7,6,0,0,416,429,1,0,0,0,417,418,5,58,0,0,418,419,7,14,0,0,419,420,7,6,0,0,420,427,1,0,0,0,421,423,5,46,0,0,422,424,7,6,0,0,423,422,1,0,0,0,424,425,1,0,0,0,425,423,1,0,0,0,425,426,1,0,0,0,426,428,1,0,0,0,427,421,1,0,0,0,427,428,1,0,0,0,428,430,1,0,0,0,429,417,1,0,0,0,429,430,1,0,0,0,430,92,1,0,0,0,431,447,5,90,0,0,432,439,7,2,0,0,433,435,7,12,0,0,434,433,1,0,0,0,434,435,1,0,0,0,435,436,1,0,0,0,436,440,7,6,0,0,437,438,5,50,0,0,438,440,7,13,0,0,439,434,1,0,0,0,439,437,1,0,0,0,440,444,1,0,0,0,441,442,5,58,0,0,442,443,7,14,0,0,443,445,7,6,0,0,444,441,1,0,0,0,444,445,1,0,0,0,445,447,1,0,0,0,446,431,1,0,0,0,446,432,1,0,0,0,447,94,1,0,0,0,448,451,5,92,0,0,449,452,3,97,48,0,450,452,9,0,0,0,451,449,1,0,0,0,451,450,1,0,0,0,452,96,1,0,0,0,453,454,5,117,0,0,454,455,3,99,49,0,455,456,3,99,49,0,456,457,3,99,49,0,457,458,3,99,49,0,458,98,1,0,0,0,459,460,7,15,0,0,460,100,1,0,0,0,35,0,226,239,290,300,303,308,314,317,321,326,328,336,338,341,346,354,356,361,363,370,372,376,381,396,405,411,425,427,429,434,439,444,446,451,1,0,1,0];y.DecisionsToDFA=y._ATN.decisionToState.map((o,e)=>new bp(o,e));var ha=y;import{ATN as ya,ATNDeserializer as vp,DFA as Fp,FailedPredicateException as Ip,NoViableAltException as Xi,Parser as Pp,ParserATNSimulator as Lp,ParserRuleContext as q,PredictionContextCache as kp,RecognitionException as $,Token as jp}from"@browsery/antlr4";var _=class _ extends Pp{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return _.literalNames}get symbolicNames(){return _.symbolicNames}get ruleNames(){return _.ruleNames}get serializedATN(){return _._serializedATN}createFailedPredicateException(e,t){return new Ip(this,e,t)}constructor(e){super(e),this._interp=new Lp(this,_._ATN,_.DecisionsToDFA,new kp)}root(){let e=new Zi(this,this._ctx,this.state);this.enterRule(e,0,_.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(_.EOF)}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}expression(e){e===void 0&&(e=0);let t=this._ctx,r=this.state,i=new X(this,this._ctx,r),n=i,s=2;this.enterRecursionRule(i,2,_.RULE_expression,e);let p;try{let c;this.enterOuterAlt(i,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:i=new to(this,i),this._ctx=i,n=i,this.state=38,i._left=this.comparisonLeft(),this.state=39,i._operator=this.comparisonOperator(),this.state=40,i._right=this.comparisonRight();break;case 1:i=new Hi(this,i),this._ctx=i,n=i,this.state=42,this.match(_.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(_.T__1);break;case 3:case 4:i=new eo(this,i),this._ctx=i,n=i,this.state=46,p=this._input.LA(1),p===3||p===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new Xi(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx);c!==2&&c!==ya.INVALID_ALT_NUMBER;){if(c===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new rr(this,new X(this,t,r)),this.pushNewRecursionContext(i,s,_.RULE_expression),this.state=50,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");this.state=51,i._op=this.logicalOperator(),this.state=52,this.expression(4)}}this.state=58,this._errHandler.sync(this),c=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(c){if(c instanceof $)i.exception=c,this._errHandler.reportError(this,c),this._errHandler.recover(this,c);else throw c}finally{this.unrollRecursionContexts(t)}return i}comparisonLeft(){let e=new Lr(this,this._ctx,this.state);this.enterRule(e,4,_.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}comparisonRight(){let e=new kr(this,this._ctx,this.state);this.enterRule(e,6,_.RULE_comparisonRight);try{switch(this.state=65,this._errHandler.sync(this),this._input.LA(1)){case 10:case 11:case 12:case 13:case 14:case 37:case 38:case 39:case 40:case 42:this.enterOuterAlt(e,1),this.state=61,this.value();break;case 35:this.enterOuterAlt(e,2),this.state=62,this.qualifiedIdentifier();break;case 6:this.enterOuterAlt(e,3),this.state=63,this.externalConstant();break;case 7:this.enterOuterAlt(e,4),this.state=64,this.arrayValue();break;default:throw new Xi(this)}}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}parenthesizedItem(){let e=new jr(this,this._ctx,this.state);this.enterRule(e,8,_.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}value(){let e=new Q(this,this._ctx,this.state);this.enterRule(e,10,_.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new co(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(_.NUMBER);break;case 13:case 14:e=new ao(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new po(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new io(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new oo(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(_.DATETIME);break;case 37:e=new so(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(_.DATE);break;case 39:e=new ro(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(_.TIME);break;case 42:e=new no(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(_.STRING);break;default:throw new Xi(this)}}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}qualifiedIdentifier(){let e=new ir(this,this._ctx,this.state);this.enterRule(e,12,_.RULE_qualifiedIdentifier);try{let t;this.enterOuterAlt(e,1);{for(this.state=84,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);t!==2&&t!==ya.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(_.T__4)),this.state=86,this._errHandler.sync(this),t=this._interp.adaptivePredict(this._input,4,this._ctx);this.state=87,this.identifier()}}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}externalConstant(){let e=new Cr(this,this._ctx,this.state);this.enterRule(e,14,_.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(_.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}identifier(){let e=new pt(this,this._ctx,this.state);this.enterRule(e,16,_.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(_.IDENTIFIER)}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}arrayValue(){let e=new Ur(this,this._ctx,this.state);this.enterRule(e,18,_.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(_.T__6),this.state=95,this.value(),this.state=100,this._errHandler.sync(this),t=this._input.LA(1);t===8;)this.state=96,this.match(_.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(_.T__8)}}catch(r){if(r instanceof $)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}boolean_(){let e=new $r(this,this._ctx,this.state);this.enterRule(e,20,_.RULE_boolean);let t;try{this.enterOuterAlt(e,1),this.state=105,t=this._input.LA(1),t===10||t===11?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof $)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}null_(){let e=new qr(this,this._ctx,this.state);this.enterRule(e,22,_.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(_.T__11)}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}infinity(){let e=new Br(this,this._ctx,this.state);this.enterRule(e,24,_.RULE_infinity);let t;try{this.enterOuterAlt(e,1),this.state=109,t=this._input.LA(1),t===13||t===14?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof $)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arithmeticOperator(){let e=new lo(this,this._ctx,this.state);this.enterRule(e,26,_.RULE_arithmeticOperator);let t;try{this.enterOuterAlt(e,1),this.state=111,t=this._input.LA(1),(t&-32)===0&&(1<<t&491520)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof $)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}comparisonOperator(){let e=new Kr(this,this._ctx,this.state);this.enterRule(e,28,_.RULE_comparisonOperator);let t;try{this.enterOuterAlt(e,1),this.state=113,t=this._input.LA(1),(t&-32)===0&&(1<<t&2146959360)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof $)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}logicalOperator(){let e=new Vr(this,this._ctx,this.state);this.enterRule(e,30,_.RULE_logicalOperator);let t;try{this.enterOuterAlt(e,1),this.state=115,t=this._input.LA(1),(t-31&-32)===0&&(1<<t-31&15)!==0?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof $)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}polarityOperator(){let e=new fo(this,this._ctx,this.state);this.enterRule(e,32,_.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(_.POLAR_OP)}catch(t){if(t instanceof $)e.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t);else throw t}finally{this.exitRule()}return e}sempred(e,t,r){switch(t){case 1:return this.expression_sempred(e,r)}return!0}expression_sempred(e,t){switch(t){case 0:return this.precpred(this._ctx,3)}return!0}static get _ATN(){return _.__ATN||(_.__ATN=new vp().deserialize(_._serializedATN)),_.__ATN}};a(_,"OpraFilterParser");var m=_;m.T__0=1;m.T__1=2;m.T__2=3;m.T__3=4;m.T__4=5;m.T__5=6;m.T__6=7;m.T__7=8;m.T__8=9;m.T__9=10;m.T__10=11;m.T__11=12;m.T__12=13;m.T__13=14;m.T__14=15;m.T__15=16;m.T__16=17;m.T__17=18;m.T__18=19;m.T__19=20;m.T__20=21;m.T__21=22;m.T__22=23;m.T__23=24;m.T__24=25;m.T__25=26;m.T__26=27;m.T__27=28;m.T__28=29;m.T__29=30;m.T__30=31;m.T__31=32;m.T__32=33;m.T__33=34;m.IDENTIFIER=35;m.POLAR_OP=36;m.DATE=37;m.DATETIME=38;m.TIME=39;m.NUMBER=40;m.INTEGER=41;m.STRING=42;m.WHITESPACE=43;m.EOF=jp.EOF;m.RULE_root=0;m.RULE_expression=1;m.RULE_comparisonLeft=2;m.RULE_comparisonRight=3;m.RULE_parenthesizedItem=4;m.RULE_value=5;m.RULE_qualifiedIdentifier=6;m.RULE_externalConstant=7;m.RULE_identifier=8;m.RULE_arrayValue=9;m.RULE_boolean=10;m.RULE_null=11;m.RULE_infinity=12;m.RULE_arithmeticOperator=13;m.RULE_comparisonOperator=14;m.RULE_logicalOperator=15;m.RULE_polarityOperator=16;m.literalNames=[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"];m.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,"IDENTIFIER","POLAR_OP","DATE","DATETIME","TIME","NUMBER","INTEGER","STRING","WHITESPACE"];m.ruleNames=["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"];m._serializedATN=[4,1,43,120,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,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,3,1,49,8,1,1,1,1,1,1,1,1,1,5,1,55,8,1,10,1,12,1,58,9,1,1,2,1,2,1,3,1,3,1,3,1,3,3,3,66,8,3,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,78,8,5,1,6,1,6,1,6,5,6,83,8,6,10,6,12,6,86,9,6,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,9,5,9,99,8,9,10,9,12,9,102,9,9,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,16,0,1,2,17,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,0,6,1,0,3,4,1,0,10,11,1,0,13,14,1,0,15,18,1,0,19,30,1,0,31,34,117,0,34,1,0,0,0,2,48,1,0,0,0,4,59,1,0,0,0,6,65,1,0,0,0,8,67,1,0,0,0,10,77,1,0,0,0,12,84,1,0,0,0,14,89,1,0,0,0,16,92,1,0,0,0,18,94,1,0,0,0,20,105,1,0,0,0,22,107,1,0,0,0,24,109,1,0,0,0,26,111,1,0,0,0,28,113,1,0,0,0,30,115,1,0,0,0,32,117,1,0,0,0,34,35,3,2,1,0,35,36,5,0,0,1,36,1,1,0,0,0,37,38,6,1,-1,0,38,39,3,4,2,0,39,40,3,28,14,0,40,41,3,6,3,0,41,49,1,0,0,0,42,43,5,1,0,0,43,44,3,8,4,0,44,45,5,2,0,0,45,49,1,0,0,0,46,47,7,0,0,0,47,49,3,2,1,1,48,37,1,0,0,0,48,42,1,0,0,0,48,46,1,0,0,0,49,56,1,0,0,0,50,51,10,3,0,0,51,52,3,30,15,0,52,53,3,2,1,4,53,55,1,0,0,0,54,50,1,0,0,0,55,58,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,3,1,0,0,0,58,56,1,0,0,0,59,60,3,12,6,0,60,5,1,0,0,0,61,66,3,10,5,0,62,66,3,12,6,0,63,66,3,14,7,0,64,66,3,18,9,0,65,61,1,0,0,0,65,62,1,0,0,0,65,63,1,0,0,0,65,64,1,0,0,0,66,7,1,0,0,0,67,68,3,2,1,0,68,9,1,0,0,0,69,78,5,40,0,0,70,78,3,24,12,0,71,78,3,20,10,0,72,78,3,22,11,0,73,78,5,38,0,0,74,78,5,37,0,0,75,78,5,39,0,0,76,78,5,42,0,0,77,69,1,0,0,0,77,70,1,0,0,0,77,71,1,0,0,0,77,72,1,0,0,0,77,73,1,0,0,0,77,74,1,0,0,0,77,75,1,0,0,0,77,76,1,0,0,0,78,11,1,0,0,0,79,80,3,16,8,0,80,81,5,5,0,0,81,83,1,0,0,0,82,79,1,0,0,0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,87,1,0,0,0,86,84,1,0,0,0,87,88,3,16,8,0,88,13,1,0,0,0,89,90,5,6,0,0,90,91,3,16,8,0,91,15,1,0,0,0,92,93,5,35,0,0,93,17,1,0,0,0,94,95,5,7,0,0,95,100,3,10,5,0,96,97,5,8,0,0,97,99,3,10,5,0,98,96,1,0,0,0,99,102,1,0,0,0,100,98,1,0,0,0,100,101,1,0,0,0,101,103,1,0,0,0,102,100,1,0,0,0,103,104,5,9,0,0,104,19,1,0,0,0,105,106,7,1,0,0,106,21,1,0,0,0,107,108,5,12,0,0,108,23,1,0,0,0,109,110,7,2,0,0,110,25,1,0,0,0,111,112,7,3,0,0,112,27,1,0,0,0,113,114,7,4,0,0,114,29,1,0,0,0,115,116,7,5,0,0,116,31,1,0,0,0,117,118,5,36,0,0,118,33,1,0,0,0,6,48,56,65,77,84,100];m.DecisionsToDFA=m._ATN.decisionToState.map((o,e)=>new Fp(o,e));var Ta=m,mo=class mo extends q{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(X,0)}EOF(){return this.getToken(m.EOF,0)}get ruleIndex(){return m.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)}};a(mo,"RootContext");var Zi=mo,uo=class uo extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(uo,"ExpressionContext");var X=uo,ho=class ho extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(jr,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)}};a(ho,"ParenthesizedExpressionContext");var Hi=ho,yo=class yo extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression(){return this.getTypedRuleContext(X,0)}enterRule(e){e.enterNegativeExpression&&e.enterNegativeExpression(this)}exitRule(e){e.exitNegativeExpression&&e.exitNegativeExpression(this)}accept(e){return e.visitNegativeExpression?e.visitNegativeExpression(this):e.visitChildren(this)}};a(yo,"NegativeExpressionContext");var eo=yo,To=class To extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}comparisonLeft(){return this.getTypedRuleContext(Lr,0)}comparisonOperator(){return this.getTypedRuleContext(Kr,0)}comparisonRight(){return this.getTypedRuleContext(kr,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)}};a(To,"ComparisonExpressionContext");var to=To,Eo=class Eo extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}expression_list(){return this.getTypedRuleContexts(X)}expression(e){return this.getTypedRuleContext(X,e)}logicalOperator(){return this.getTypedRuleContext(Vr,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)}};a(Eo,"LogicalExpressionContext");var rr=Eo,_o=class _o extends q{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(ir,0)}get ruleIndex(){return m.RULE_comparisonLeft}enterRule(e){e.enterComparisonLeft&&e.enterComparisonLeft(this)}exitRule(e){e.exitComparisonLeft&&e.exitComparisonLeft(this)}accept(e){return e.visitComparisonLeft?e.visitComparisonLeft(this):e.visitChildren(this)}};a(_o,"ComparisonLeftContext");var Lr=_o,xo=class xo extends q{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(Q,0)}qualifiedIdentifier(){return this.getTypedRuleContext(ir,0)}externalConstant(){return this.getTypedRuleContext(Cr,0)}arrayValue(){return this.getTypedRuleContext(Ur,0)}get ruleIndex(){return m.RULE_comparisonRight}enterRule(e){e.enterComparisonRight&&e.enterComparisonRight(this)}exitRule(e){e.exitComparisonRight&&e.exitComparisonRight(this)}accept(e){return e.visitComparisonRight?e.visitComparisonRight(this):e.visitChildren(this)}};a(xo,"ComparisonRightContext");var kr=xo,Oo=class Oo extends q{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(X,0)}get ruleIndex(){return m.RULE_parenthesizedItem}enterRule(e){e.enterParenthesizedItem&&e.enterParenthesizedItem(this)}exitRule(e){e.exitParenthesizedItem&&e.exitParenthesizedItem(this)}accept(e){return e.visitParenthesizedItem?e.visitParenthesizedItem(this):e.visitChildren(this)}};a(Oo,"ParenthesizedItemContext");var jr=Oo,go=class go extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.RULE_value}copyFrom(e){super.copyFrom(e)}};a(go,"ValueContext");var Q=go,wo=class wo extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(m.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)}};a(wo,"TimeLiteralContext");var ro=wo,Ao=class Ao extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(qr,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)}};a(Ao,"NullLiteralContext");var io=Ao,Ro=class Ro extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(m.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)}};a(Ro,"DateTimeLiteralContext");var oo=Ro,bo=class bo extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(m.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)}};a(bo,"StringLiteralContext");var no=bo,Do=class Do extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(m.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)}};a(Do,"DateLiteralContext");var so=Do,No=class No extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(Br,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)}};a(No,"InfinityLiteralContext");var ao=No,So=class So extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext($r,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)}};a(So,"BooleanLiteralContext");var po=So,Mo=class Mo extends Q{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(m.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)}};a(Mo,"NumberLiteralContext");var co=Mo,vo=class vo extends q{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(pt)}identifier(e){return this.getTypedRuleContext(pt,e)}get ruleIndex(){return m.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)}};a(vo,"QualifiedIdentifierContext");var ir=vo,Fo=class Fo extends q{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(pt,0)}get ruleIndex(){return m.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)}};a(Fo,"ExternalConstantContext");var Cr=Fo,Io=class Io extends q{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(m.IDENTIFIER,0)}get ruleIndex(){return m.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)}};a(Io,"IdentifierContext");var pt=Io,Po=class Po extends q{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(Q)}value(e){return this.getTypedRuleContext(Q,e)}get ruleIndex(){return m.RULE_arrayValue}enterRule(e){e.enterArrayValue&&e.enterArrayValue(this)}exitRule(e){e.exitArrayValue&&e.exitArrayValue(this)}accept(e){return e.visitArrayValue?e.visitArrayValue(this):e.visitChildren(this)}};a(Po,"ArrayValueContext");var Ur=Po,Lo=class Lo extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.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)}};a(Lo,"BooleanContext");var $r=Lo,ko=class ko extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.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)}};a(ko,"NullContext");var qr=ko,jo=class jo extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.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)}};a(jo,"InfinityContext");var Br=jo,Co=class Co extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.RULE_arithmeticOperator}enterRule(e){e.enterArithmeticOperator&&e.enterArithmeticOperator(this)}exitRule(e){e.exitArithmeticOperator&&e.exitArithmeticOperator(this)}accept(e){return e.visitArithmeticOperator?e.visitArithmeticOperator(this):e.visitChildren(this)}};a(Co,"ArithmeticOperatorContext");var lo=Co,Uo=class Uo extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.RULE_comparisonOperator}enterRule(e){e.enterComparisonOperator&&e.enterComparisonOperator(this)}exitRule(e){e.exitComparisonOperator&&e.exitComparisonOperator(this)}accept(e){return e.visitComparisonOperator?e.visitComparisonOperator(this):e.visitChildren(this)}};a(Uo,"ComparisonOperatorContext");var Kr=Uo,$o=class $o extends q{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return m.RULE_logicalOperator}enterRule(e){e.enterLogicalOperator&&e.enterLogicalOperator(this)}exitRule(e){e.exitLogicalOperator&&e.exitLogicalOperator(this)}accept(e){return e.visitLogicalOperator?e.visitLogicalOperator(this):e.visitChildren(this)}};a($o,"LogicalOperatorContext");var Vr=$o,qo=class qo extends q{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(m.POLAR_OP,0)}get ruleIndex(){return m.RULE_polarityOperator}enterRule(e){e.enterPolarityOperator&&e.enterPolarityOperator(this)}exitRule(e){e.exitPolarityOperator&&e.exitPolarityOperator(this)}accept(e){return e.visitPolarityOperator?e.visitPolarityOperator(this):e.visitChildren(this)}};a(qo,"PolarityOperatorContext");var fo=qo;import{ParseTreeVisitor as Cp}from"@browsery/antlr4";var Bo=class Bo extends I{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Bo,"ExternalConstant");var Wr=Bo;var Ko=class Ko extends Cp{constructor(e){super(),this._timeZone=e==null?void 0:e.timeZone}visitChildren(e){let t=super.visitChildren(e);return Array.isArray(t)&&t.length<2?t[0]:t??e.getText()}defaultResult(){}visitRoot(e){return this.visit(e.expression())}visitParenthesizedExpression(e){let t=this.visit(e.parenthesizedItem());return new ge(t)}visitParenthesizedItem(e){return this.visit(e.expression())}visitNegativeExpression(e){let t=this.visit(e.expression());return new Ht(t)}visitComparisonExpression(e){return new fe({op:e.comparisonOperator().getText(),left:this.visit(e.comparisonLeft()),right:this.visit(e.comparisonRight())})}visitLogicalExpression(e){let t=[],r=a((i,n)=>{for(let s of i){if(s instanceof rr&&s.logicalOperator().getText()===n){r(s.expression_list(),s.logicalOperator().getText());continue}let p=this.visit(s);t.push(p)}},"wrapChildren");return r(e.expression_list(),e.logicalOperator().getText()),new me({op:e.logicalOperator().getText(),items:t})}visitQualifiedIdentifier(e){return new H(e.getText())}visitExternalConstant(e){return new Wr(e.identifier().getText())}visitNullLiteral(){return new Je}visitBooleanLiteral(e){return new ze(e.getText()==="true")}visitNumberLiteral(e){return new we(e.getText())}visitStringLiteral(e){return new Ye(er(e.getText()))}visitInfinityLiteral(){return new we(1/0)}visitDateLiteral(e){return new Se(er(e.getText()))}visitDateTimeLiteral(e){return new tr(er(e.getText()))}visitTimeLiteral(e){return new Qe(er(e.getText()))}visitArrayValue(e){return new Oe(e.value_list().map(t=>this.visit(t)))}};a(Ko,"FilterTreeVisitor");var or=Ko;import{ErrorListener as Up}from"@browsery/antlr4";var Vo=class Vo extends Up{constructor(e){super(),this.errors=e}syntaxError(e,t,r,i,n,s){this.errors.push(new Ir(n,{recognizer:e,offendingSymbol:t,line:r,column:i,e:s}))}};a(Vo,"OpraErrorListener");var nr=Vo;function Wo(o,e){let t=new $p(o),r=new ha(t),i=new qp(r),n=new Ta(i);n.buildParseTrees=!0;let s=[],p=new nr(s);r.removeErrorListeners(),r.addErrorListener(p),n.removeErrorListeners(),n.addErrorListener(p);let c=n.root();if(s.length){let l=[];for(let g of s)l.push(g.message+(o.includes(`
|
|
8
|
+
`)?" at line: "+g.line+" column: "+g.column:" at column: "+g.column));let x=new Fr(l.join(`
|
|
9
|
+
`));throw x.errors=s,x}return e=e||new or,e.visit(c)}a(Wo,"parse");var zo=class zo{constructor(e,t){if(this._rules=new N,this._decoderCache=new WeakMap,Object.defineProperty(this,"_rules",{value:new N(null,{caseSensitive:t==null?void 0:t.caseSensitive}),enumerable:!1}),e)for(let[r,i]of Object.entries(e))this.set(r,i)}set(e,t){let r=typeof(t==null?void 0:t.operators)=="string"?t.operators.split(/\s*[,| ]\s*/):t==null?void 0:t.operators;this._rules.set(e,Bp({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?Wo(e):e;return this.normalizeFilterAst(i,[],t,r)}normalizeFilterAst(e,t,r,i){if(e instanceof fe){if(t.push(e),this.normalizeFilterAst(e.left,t,r),!(e.left instanceof H&&e.left.field))throw new TypeError("Invalid filter query. Left side should be a data field.");let n=this._rules.get(e.left.value);if(!n)throw new xe({message:`Field '${e.left.value}' is not available for filter operation`,code:"UNACCEPTED_FILTER_FIELD",details:{field:e.left.value}});if(n.operators&&!n.operators.includes(e.op))throw new xe({message:`'${e.left.value}' field do not accept '${e.op}' filter operator`,code:"UNACCEPTED_FILTER_OPERATION",details:{field:e.left.value,operator:e.op}});return n.mappedField&&(e.left.value=n.mappedField),n.prepare&&(e.prepare=n.prepare),this.normalizeFilterAst(e.right,t,r),t.pop(),e}if(e instanceof me)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof We)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n.expression,t,r)),t.pop(),e;if(e instanceof Oe)return t.push(e),e.items.forEach(n=>this.normalizeFilterAst(n,t,r)),t.pop(),e;if(e instanceof ge)return t.push(e),this.normalizeFilterAst(e.expression,t,r),t.pop(),e;if(e instanceof H&&r)return e.value=r.normalizeFieldPath(e.value,{scope:i}),e.field=r.getField(e.value,i),e.dataType=e.field.type,e;if(e instanceof I){let n=t.findLastIndex(s=>s instanceof fe);if(n>=0){let s=t[n];if((e===s.right||t[n+1]===s.right)&&s&&s.left instanceof H&&s.left.field){if(e.value==null&&!s.left.field.required)return e.value;let p;s.op==="like"||s.op==="!like"||s.op==="ilike"||s.op==="!ilike"?p=Kp:p=this._decoderCache.get(s.left.field),p||(p=s.left.field.generateCodec("decode",{scope:i,projection:"*",ignoreReadonlyFields:!0,coerce:!0}),this._decoderCache.set(s.left.field,p)),e.value=p(e.value,{coerce:!0})}}}return e}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};a(zo,"FilterRules");var ct=zo;import sc from"object-hash";import{asMutable as ac}from"ts-gems";import{validator as pc,vg as G}from"valgen";import"reflect-metadata";import{omitUndefined as ic}from"@jsopen/objects";import{asMutable as oc}from"ts-gems";import{vg as Jr}from"valgen";var f={};Rr(f,{ArrayType:()=>lt,ComplexType:()=>ft,EnumType:()=>mt,HttpController:()=>sr,HttpOperation:()=>Jo,MQController:()=>Yo,MQOperation:()=>Qo,MappedType:()=>ut,MixinType:()=>dt,SimpleType:()=>ht,SpecVersion:()=>c0,UnionType:()=>yt,WSController:()=>Go,WSOperation:()=>Xo,isArrayType:()=>Xp,isComplexType:()=>Wp,isDataType:()=>Vp,isEnumType:()=>Qp,isHttpController:()=>Zp,isMappedType:()=>Yp,isMixinType:()=>Jp,isSimpleType:()=>zp,isUnionType:()=>Gp});var c0="1.0";var lt;(function(o){o.Kind="ArrayType"})(lt||(lt={}));var ft;(function(o){o.Kind="ComplexType"})(ft||(ft={}));var mt;(function(o){o.Kind="EnumType"})(mt||(mt={}));var ut;(function(o){o.Kind="MappedType"})(ut||(ut={}));var dt;(function(o){o.Kind="MixinType"})(dt||(dt={}));var ht;(function(o){o.Kind="SimpleType"})(ht||(ht={}));var yt;(function(o){o.Kind="UnionType"})(yt||(yt={}));var sr;(function(o){o.Kind="HttpController"})(sr||(sr={}));var Jo;(function(o){o.Kind="HttpOperation"})(Jo||(Jo={}));var Yo;(function(o){o.Kind="MQController"})(Yo||(Yo={}));var Qo;(function(o){o.Kind="MQOperation"})(Qo||(Qo={}));function Vp(o){return o&&typeof o=="object"&&(o.kind===lt.Kind||o.kind===ft.Kind||o.kind===mt.Kind||o.kind===ut.Kind||o.kind===ht.Kind||o.kind===dt.Kind||o.kind===yt.Kind)}a(Vp,"isDataType");function Wp(o){return o&&typeof o=="object"&&o.kind===ft.Kind}a(Wp,"isComplexType");function zp(o){return o&&typeof o=="object"&&o.kind===ht.Kind}a(zp,"isSimpleType");function Jp(o){return o&&typeof o=="object"&&o.kind===dt.Kind}a(Jp,"isMixinType");function Yp(o){return o&&typeof o=="object"&&o.kind===ut.Kind}a(Yp,"isMappedType");function Qp(o){return o&&typeof o=="object"&&o.kind===mt.Kind}a(Qp,"isEnumType");function Gp(o){return o&&typeof o=="object"&&o.kind===yt.Kind}a(Gp,"isUnionType");function Xp(o){return o&&typeof o=="object"&&o.kind===lt.Kind}a(Xp,"isArrayType");function Zp(o){return o&&typeof o=="object"&&o.kind===sr.Kind}a(Zp,"isHttpController");var Go;(function(o){o.Kind="WSController"})(Go||(Go={}));var Xo;(function(o){o.Kind="WSOperation"})(Xo||(Xo={}));import{omitUndefined as tc}from"@jsopen/objects";import{asMutable as rc}from"ts-gems";import{asMutable as Hp}from"ts-gems";import{uid as ec}from"uid";var Zo=class Zo{constructor(e,t){this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[De])return this.element;if(this.parent)return this._document=this.parent.getDocument();throw new Error("ApiDocument not found in document tree")}hasDataType(e,t){return!!this.findDataType(e,t)}findDataType(e,t){var i;let r=(i=this[L])==null?void 0:i.get(e);return r&&r.inScope(t)?r:this.parent?this.parent.findDataType(e,t):void 0}getDataType(e,t){let r=this.findDataType(e,t);if(r)return r;let i="";if(typeof e=="function")i=Reflect.getMetadata(d,e).name;else if(typeof e=="object"){let n=e[d];i=n==null?void 0:n.name}throw i||(e&&typeof e=="string"?i=e:typeof e=="function"&&(i=e.name)),r?new TypeError(`Data type${i?" ("+i+")":""} is not in requested scope (${t})`):new TypeError(`Unknown data type${i?" ("+i+")":""}`)}getDataTypeNameWithNs(e){if(!e.name)return;let t=this.getDocument().getDataTypeNs(e);return t?t+":"+e.name:e.name}getArrayType(e,t){let r=this.getDataType(e,t);if(r.kind===f.ArrayType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}getComplexType(e,t){let r=this.getDataType(e,t);if(r.kind===f.ComplexType.Kind)return r;throw new TypeError(`Data type "${r.name}" is not a ComplexType`)}getSimpleType(e,t){let r=this.getDataType(e,t);if(r.kind===f.SimpleType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a SimpleType`)}getEnumType(e,t){let r=this.getDataType(e,t);if(r.kind===f.EnumType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a EnumType`)}getMappedType(e,t){let r=this.getDataType(e,t);if(r.kind===f.MappedType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MappedType`)}getMixinType(e,t){let r=this.getDataType(e,t);if(r.kind===f.MixinType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a MixinType`)}getUnionType(e,t){let r=this.getDataType(e,t);if(r.kind===f.UnionType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a UnionType`)}};a(Zo,"DocumentNode");var zr=Zo;var A=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=Hp(this);e.id=ec(16),Object.defineProperty(e,"node",{value:new zr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),en=class en{};a(en,"DocumentElementClass");var Ho=en;A.prototype=Ho.prototype;var Me=Symbol.for("nodejs.util.inspect.custom"),Ae="\x1B[0m",ve="\x1B[33m",Fe="\x1B[35m";function ar(o,e){return!e||o==="*"?!0:o?Array.isArray(e)?e.some(t=>typeof t=="string"?o===t:t.test(o)):typeof e=="string"?o===e:e.test(o):!1}a(ar,"testScopeMatch");var T=a(function(o,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!P.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);A.call(this,o);let r=rc(this);r.kind=e.kind,r.scopePattern=e.scopePattern?Array.isArray(e.scopePattern)?e.scopePattern:[e.scopePattern]:void 0,r.name=e.name,r.description=e.description,r.abstract=e.abstract,r.examples=e.examples},"DataType"),rn=class rn extends A{get embedded(){return!this.name}inScope(e){return ar(e,this.scopePattern)}toJSON(e){let t=this._locateBase(r=>!r.inScope(e==null?void 0:e.scope));if(t){let r=this.node.getDataTypeNameWithNs(t);throw new TypeError(`"${r}" model is not available for "${(e==null?void 0:e.scope)||"null"}" scope`)}return tc({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[Me](){return`[${ve+Object.getPrototypeOf(this).constructor.name+Ae} ${Fe+this.name+Ae}]`}};a(rn,"DataTypeClass");var tn=rn;T.prototype=tn.prototype;var de=a(function(...o){if(!this)return de[w].apply(void 0,o);let[e,t,r]=o;T.call(this,e,t,r);let i=oc(this);i.kind=f.ArrayType.Kind,i.type=t.type,i.minOccurs=t.minOccurs,i.maxOccurs=t.maxOccurs},"ArrayType"),nn=class nn extends T{toJSON(e){let t=super.toJSON(e),r=this.node.getDataTypeNameWithNs(this.type);return ic({...t,kind:this.kind,type:r||this.type.toJSON(e),minOccurs:this.minOccurs,maxOccurs:this.maxOccurs})}generateCodec(e,t,r){let i=this.type.generateCodec(e,t,r);i=Jr.isArray(i);let n=[];return this.minOccurs&&n.push(Jr.lengthMin(this.minOccurs)),this.maxOccurs&&n.push(Jr.lengthMax(this.maxOccurs)),n.length>0?Jr.pipe([i,...n],{returnIndex:0}):i}extendsFrom(){return!1}_locateBase(){}};a(nn,"ArrayTypeClass");var on=nn;de.prototype=on.prototype;de[w]=nc;function nc(o,e){let i=class i{};a(i,"ArrayClass");let t=i,r={...e,kind:f.ArrayType.Kind,type:o};return Reflect.defineMetadata(d,r,t),t}a(nc,"ArrayTypeFactory");var Tt=/^([+-])?([a-z$_][\w.]*)$/i,j=a(function(...o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;T.call(this,e,t,r);let i=ac(this);i._fields=new N},"ComplexTypeBase"),an=class an extends T{fieldCount(e){if(e==="*")return this._fields.size;let t=0;for(let r of this.fields(e))t++;return t}fieldEntries(e){let t=this._fields.entries();if(e==="*")return t;let r;return{next(){for(;t&&(r=t.next(),!(r.done||r.value&&r.value[1].inScope(e))););return r.done?{done:r.done,value:void 0}:{done:r.done,value:[r.value[0],r.value[1].forScope(e)]}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fields(e){let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[1]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}fieldNames(e){if(e==="*")return this._fields.keys();let t=this.fieldEntries(e),r;return{next(){var i;return t?(r=t.next(),{done:r.done,value:(i=r.value)==null?void 0:i[0]}):{done:!0,value:void 0}},return(i){return t=void 0,{done:!0,value:i}},[Symbol.iterator](){return this}}}findField(e,t){if(e.includes(".")){let i=this.parseFieldPath(e,{scope:t});if(i.length===0)throw new Error(`Field "${e}" does not exist in scope "${t}"`);let n=i.pop();return n==null?void 0:n.field}let r=this._fields.get(e);if(r&&r.inScope(t))return r.forScope(t)}getField(e,t){let r=this.findField(e,"*");if(r&&!r.inScope(t))throw new Error(`Field "${e}" does not exist in scope "${t||"null"}"`);if(!r)throw new Error(`Field (${e}) does not exist`);return r.forScope(t)}parseFieldPath(e,t){var g,h,B;let r=this,i,n=e.split("."),s=n.length,p=[],c=this.owner.node.getDataType("object"),l=t==null?void 0:t.allowSigns,x=a(()=>p.map(k=>k.fieldName).join("."),"getStrPath");for(let k=0;k<s;k++){let K={fieldName:n[k],dataType:c};p.push(K);let qe=Tt.exec(n[k]);if(!qe)throw new TypeError(`Invalid field name (${x()})`);if(qe[1]&&((k===0&&l==="first"||l==="each")&&(K.sign=qe[1]),K.fieldName=qe[2]),r){if(r instanceof j){if(i=r.findField(K.fieldName,t==null?void 0:t.scope),i){K.fieldName=i.name,K.field=i,K.dataType=i.type,r=i.type;continue}if(((g=r.additionalFields)==null?void 0:g[0])===!0){K.additionalField=!0,K.dataType=c,r=void 0;continue}if(((h=r.additionalFields)==null?void 0:h[0])==="type"&&((B=r.additionalFields)==null?void 0:B[1])instanceof T){K.additionalField=!0,K.dataType=r.additionalFields[1],r=r.additionalFields[1];continue}throw new Error(`Unknown field (${p.map(pi=>pi.fieldName).join(".")})`)}throw new TypeError(`"${p.map(pi=>pi.fieldName).join(".")}" field is not a complex type and has no child fields`)}K.additionalField=!0,K.dataType=c}return p}normalizeFieldPath(e,t){return this.parseFieldPath(e,t).map(r=>(r.sign||"")+r.fieldName).join(".")}generateCodec(e,t){var p;let r=t!=null&&t.cache?t:{...t,projection:Array.isArray(t==null?void 0:t.projection)?fa(t.projection):t==null?void 0:t.projection,currentPath:""},i=this._generateSchema(e,r),n;if(this.additionalFields instanceof T)n=this.additionalFields.generateCodec(e,t);else if(typeof this.additionalFields=="boolean")n=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)n="error";else{let c=n[1];n=pc((l,x,g)=>x.fail(g,c,l))}let s=G.isObject(i,{ctor:this.name==="object"?Object:this.ctor,additionalFields:n,name:this.name,coerce:!0,caseInSensitive:t==null?void 0:t.caseInSensitive,onFail:t==null?void 0:t.onFail});if(r.level===0&&((p=r.forwardCallbacks)!=null&&p.size))for(let c of r.forwardCallbacks)c();return s}_generateSchema(e,t){var c;t.fieldCache=t.fieldCache||new Map,t.level=t.level||0,t.forwardCallbacks=t.forwardCallbacks||new Set;let r={},{currentPath:i,projection:n}=t,s=!!(n&&Object.values(n).find(l=>!l.sign)),p;for(let l of this.fields("*")){if(!l.inScope(t.scope)||!(t.keepKeyFields&&this.keyField)&&(t.ignoreReadonlyFields&&l.readonly||t.ignoreWriteonlyFields&&l.writeonly)){r[l.name]=G.isUndefined({coerce:!0});continue}p=l.name;let x;if(n!=="*"&&(x=n==null?void 0:n[p.toLowerCase()],(x==null?void 0:x.sign)==="-"||s&&!x||!s&&l.exclusive&&!x)){r[l.name]=G.isUndefined({coerce:!0});continue}let g=typeof n=="object"?((c=n[p])==null?void 0:c.projection)||"*":n,h=t.fieldCache.get(l),B=typeof g=="string"?g:sc(g||{});h||(h={},t.fieldCache.set(l,h));let k=h[B];if(k===null)k=G.isAny(),t.forwardCallbacks.add(()=>{k=h[B],r[p]=t.partial||!l.required?G.optional(k):G.required(k)});else if(!k){let K=a(()=>{h[B]=null;let qe=this._generateFieldCodec(e,l,{...t,partial:t.partial==="deep"?t.partial:void 0,projection:g,currentPath:i+(i?".":"")+p});return h[B]=qe,qe},"defaultGenerator");t.fieldHook?k=t.fieldHook(l,t.currentPath,K):k=K()}r[p]=t.partial||!(l.required||k.id==="required")?G.optional(k):k.id==="required"?k:G.required(k)}return t.allowPatchOperators&&(r._$pull=G.optional(G.isAny()),r._$push=G.optional(G.isAny())),r}_generateFieldCodec(e,t,r){let i=t.generateCodec(e,{...r,level:r.level+1});return t.fixed&&(i=G.isEqual(t.fixed)),t.isArray&&!(t.type instanceof de)&&(i=G.isArray(i)),i}};a(an,"ComplexTypeBaseClass");var sn=an;j.prototype=sn.prototype;import"reflect-metadata";import{omitUndefined as pn}from"@jsopen/objects";import{asMutable as cc}from"ts-gems";import{vg as lc}from"valgen";var ee=a(function(...o){if(!this)return ee[w].apply(void 0,o);let[e,t,r]=o;T.call(this,e,t,r);let i=cc(this);if(i.kind=f.EnumType.Kind,t.base){if(!(t.base instanceof ee))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${i.kind}"`);i.base=t.base}i.instance=t.instance,i.ownAttributes=F(t.attributes||{}),i.attributes=i.base?F(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),cn=class cn extends T{extendsFrom(e){var t;return e instanceof T||(e=this.node.getDataType(e)),e instanceof ee?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return lc.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return pn({...t,kind:this.kind,base:r,attributes:F(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(cn,"EnumTypeClass");var pr=cn;ee.prototype=pr.prototype;Object.assign(ee,pr);function fc(o,...e){let t=e.length>=2?e[0]:void 0,r=e.length>=2?e[1]:e[0],i={},n=o;if(Array.isArray(o)){if(t){if(!Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be array');n=[...t,...o]}i={},o.forEach(p=>{var l;if(!isNaN(Number(p)))return;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[p]=pn({description:c})})}else{if(t){if(Array.isArray(t))throw new TypeError('Both "target" and "base" arguments should be enum object');n={...t,...o}}Object.keys(o).forEach(p=>{var l;if(!isNaN(Number(p)))return;let c=(l=r==null?void 0:r.meanings)==null?void 0:l[p];i[o[p]]=pn({alias:p,description:c})})}let s={kind:f.EnumType.Kind,attributes:i,base:r==null?void 0:r.base,name:r==null?void 0:r.name,description:r==null?void 0:r.description};return Object.defineProperty(o,d,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(fc,"EnumTypeFactory");ee.prototype=pr.prototype;ee[w]=fc;var $n={};Rr($n,{Base64Type:()=>dn,DateTimeType:()=>lr,DateTimeTypeTz:()=>fr,DateType:()=>cr,EmailType:()=>te,FieldPathType:()=>J,FilterType:()=>Xe,ObjectIdType:()=>bn,OperationResult:()=>oe,PartialDateType:()=>ur,TimeType:()=>dr,UrlType:()=>Un,UuidType:()=>Xr});import{__decorate as uc,__metadata as dc}from"tslib";import{isBase64 as hc,validator as hn,vg as un}from"valgen";import"reflect-metadata";import{omitUndefined as _a}from"@jsopen/objects";import{asMutable as mc}from"ts-gems";import{isAny as xa}from"valgen";function ln(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!P.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);i=o.name}else i=r.name,i=i.toLowerCase();let n=Reflect.getOwnMetadata(d,r)||{};o&&Object.assign(n,o),n.kind=f.SimpleType.Kind,n.name=i,Reflect.defineMetadata(d,n,r);for(let s of e)s(n,r)},"decorator");return t.Example=(r,i)=>(e.push(n=>{n.examples=n.examples||[],n.examples.push({description:i,value:r})}),t),t}a(ln,"SimpleTypeDecoratorFactory");function Ea(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(d,e.constructor)||{},i=Reflect.getMetadata("design:type",e,t),n="string";i===Boolean?n="boolean":i===Number&&(n="number"),r.kind=f.SimpleType.Kind,r.attributes=r.attributes||{},r.attributes[t]={format:(o==null?void 0:o.format)||n,description:o==null?void 0:o.description,deprecated:o==null?void 0:o.deprecated},Reflect.defineMetadata(d,r,e.constructor)}}a(Ea,"AttributeDecoratorFactory");var u=a(function(...o){var n,s;if(!this)return u[w](...o);let[e,t,r]=o;T.call(this,e,t,r);let i=mc(this);if(i.kind=f.SimpleType.Kind,t.base){if(!(t.base instanceof u))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base}if(i.properties=t.properties,i.ownNameMappings={...t.nameMappings},i.nameMappings={...(n=i.base)==null?void 0:n.nameMappings,...t.nameMappings},i.ownAttributes=F(t.attributes||{}),i.attributes=i.base?F(i.base.attributes):{},i.ownAttributes)for(let[p,c]of Object.entries(i.ownAttributes)){if((s=i.attributes[p])!=null&&s.sealed)throw new TypeError(`Sealed attribute "${p}" can not be overwritten`);i.attributes[p]=c}i._generateDecoder=t.generateDecoder,i._generateEncoder=t.generateEncoder},"SimpleType"),mn=class mn extends T{extend(e){return Object.setPrototypeOf(e,this),e}extendsFrom(e){var t;return e instanceof T||(e=this.node.getDataType(e)),e instanceof u?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(e,t,r){let i={...this.properties,...r};if(e==="decode"){let s=this;for(;s;){if(s._generateDecoder)return s._generateDecoder(i,{dataType:this,element:(t==null?void 0:t.documentElement)||this.owner,scope:t==null?void 0:t.scope});s=this.base}return xa}let n=this;for(;n;){if(n._generateEncoder)return n._generateEncoder(i,{dataType:this,element:(t==null?void 0:t.documentElement)||this.owner,scope:t==null?void 0:t.scope});n=this.base}return xa}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i=_a(this.ownAttributes),n;this.properties&&typeof this.properties.toJSON=="function"?n=this.properties.toJSON(this.properties,this.owner,e):n=this.properties?F(this.properties):{};let s={...t,kind:this.kind,base:r,attributes:i&&Object.keys(i).length?i:void 0,properties:Object.keys(n).length?n:void 0};return Object.keys(this.ownNameMappings).length&&(s.nameMappings={...this.ownNameMappings}),_a(s,!0)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(mn,"SimpleTypeClass");var fn=mn;u.prototype=fn.prototype;Object.assign(u,ln);u[w]=ln;u.Attribute=Ea;var Et,dn=(Et=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=un.isBase64({coerce:!0});return e.designType===Buffer?un.pipe([t,yc],{coerce:!0}):e.designType===Uint8Array?un.pipe([t,Tc],{coerce:!0}):t}[O](){return Ec}},a(Et,"Base64Type"),Et);dn=uc([u({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),dc("design:paramtypes",[Object])],dn);var yc=hn(o=>Buffer.from(o,"base64")),Tc=hn(o=>new Uint8Array(Buffer.from(o,"base64"))),Ec=hn(o=>Buffer.isBuffer(o)?o.toString("base64"):hc(o));import{__decorate as yn,__metadata as Tn}from"tslib";import{vg as Ie}from"valgen";var Oa=Ie.isDateString({precisionMin:"day",trim:"day",coerce:!0}),_c=Ie.isDate({trim:"day",coerce:!0}),_t,cr=(_t=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t;e.designType===Date?t=_c:t=Oa;let r=[t];return e.minValue!=null&&r.push(Ie.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ie.isLte(t(e.maxValue))),r.length>0?Ie.pipe(r,{returnIndex:0}):t}[O](e){let t=Oa,r=[t];return e.minValue!=null&&r.push(Ie.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ie.isLte(t(e.maxValue))),r.length>0?Ie.pipe(r,{returnIndex:0}):t}},a(_t,"DateType"),_t);yn([u.Attribute({description:"Minimum value"}),Tn("design:type",String)],cr.prototype,"minValue",void 0);yn([u.Attribute({description:"Maximum value"}),Tn("design:type",String)],cr.prototype,"maxValue",void 0);cr=yn([u({name:"date",description:"A date without time",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18","Full date value"),Tn("design:paramtypes",[Object])],cr);import{__decorate as En,__metadata as _n}from"tslib";import{vg as Pe}from"valgen";var ga=Pe.isDateString({precisionMin:"day",trim:"tz",coerce:!0}),xc=Pe.isDate({coerce:!0}),xt,lr=(xt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t;e.designType===Date?t=xc:t=ga;let r=[t];return e.minValue!=null&&r.push(Pe.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Pe.isLte(t(e.maxValue))),r.length>0?Pe.pipe(r,{returnIndex:0}):t}[O](e){let t=ga,r=[t];return e.minValue!=null&&r.push(Pe.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Pe.isLte(t(e.maxValue))),r.length>0?Pe.pipe(r,{returnIndex:0}):t}},a(xt,"DateTimeType"),xt);En([u.Attribute({description:"Minimum value"}),_n("design:type",String)],lr.prototype,"minValue",void 0);En([u.Attribute({description:"Maximum value"}),_n("design:type",String)],lr.prototype,"maxValue",void 0);lr=En([u({name:"datetime",description:"A full datetime value",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15").Example("2021-04-18 22:30:15").Example("2021-04-18 22:30"),_n("design:paramtypes",[Object])],lr);import{__decorate as xn,__metadata as On}from"tslib";import{vg as Ge}from"valgen";var wa=Ge.isDateString({precisionMin:"tz",coerce:!0}),Ot,fr=(Ot=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=wa,r=[t];return e.minValue!=null&&r.push(Ge.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ge.isLte(t(e.maxValue))),r.length>0?Ge.pipe(r,{returnIndex:0}):t}[O](e){let t=wa,r=[t];return e.minValue!=null&&r.push(Ge.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ge.isLte(t(e.maxValue))),r.length>0?Ge.pipe(r,{returnIndex:0}):t}},a(Ot,"DateTimeTypeTz"),Ot);xn([u.Attribute({description:"Minimum value"}),On("design:type",String)],fr.prototype,"minValue",void 0);xn([u.Attribute({description:"Maximum value"}),On("design:type",String)],fr.prototype,"maxValue",void 0);fr=xn([u({name:"datetimetz",description:"A full datetime value with time zone information",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15+03:00"),On("design:paramtypes",[Object])],fr);import{__decorate as he,__metadata as ye}from"tslib";import{vg as Aa}from"valgen";var gt,te=(gt=class{constructor(e){e&&Object.assign(this,e)}[E](e){return Aa.isEmail({...e,coerce:!0})}[O](e){return Aa.isEmail({...e,coerce:!0})}},a(gt,"EmailType"),gt);he([u.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),ye("design:type",Boolean)],te.prototype,"allowDisplayName",void 0);he([u.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),ye("design:type",Boolean)],te.prototype,"requireDisplayName",void 0);he([u.Attribute({description:"If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",default:!0}),ye("design:type",Boolean)],te.prototype,"utf8LocalPart",void 0);he([u.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),ye("design:type",Boolean)],te.prototype,"ignoreMaxLength",void 0);he([u.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),ye("design:type",Boolean)],te.prototype,"allowIpDomain",void 0);he([u.Attribute({description:"If set to `true`, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.",default:!1}),ye("design:type",Boolean)],te.prototype,"domainSpecificValidation",void 0);he([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol one of the strings defined in it, the validation fails."}),ye("design:type",Array)],te.prototype,"hostBlacklist",void 0);he([u.Attribute({description:"If set to an array of strings and the part of the email after the @ symbol matches none of the strings defined in it, the validation fails."}),ye("design:type",Array)],te.prototype,"hostWhitelist",void 0);he([u.Attribute({description:"If set to a string, then the validator will reject emails that include any of the characters in the string, in the name part."}),ye("design:type",String)],te.prototype,"blacklistedChars",void 0);te=he([u({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),ye("design:paramtypes",[Object])],te);import{__decorate as gn,__metadata as wn}from"tslib";import{toString as Oc,validator as gc,vg as wc}from"valgen";var wt,J=(wt=class{constructor(e){e&&Object.assign(this,e)}[E](e,{element:t,scope:r}){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=gc("decodeFieldPath",p=>i.normalizeFieldPath(p,{allowSigns:n,scope:r}));return wc.pipe([Oc,s])}[O](e,t){return this[E](e,t)}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");T.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),allowSigns:e.allowSigns}}},a(wt,"FieldPathType"),wt);gn([u.Attribute({description:"Data type which field belong to"}),wn("design:type",Object)],J.prototype,"dataType",void 0);gn([u.Attribute({description:'Determines if signs (+,-) are allowed. If set "first" signs are allowed only beginning of the field pathIf set "each" signs are allowed at each field in the path'}),wn("design:type",String)],J.prototype,"allowSigns",void 0);J=gn([u({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),wn("design:paramtypes",[Object])],J);import{__decorate as An,__metadata as Rn}from"tslib";import{validator as ba}from"valgen";var mr={};Rr(mr,{$and:()=>Rc,$arithmetic:()=>Kc,$array:()=>Ra,$date:()=>bc,$eq:()=>Mc,$field:()=>Sc,$gt:()=>Fc,$gte:()=>Ic,$ilike:()=>$c,$in:()=>kc,$like:()=>Cc,$lt:()=>Pc,$lte:()=>Lc,$ne:()=>vc,$notILike:()=>qc,$notIn:()=>jc,$notLike:()=>Uc,$number:()=>Nc,$or:()=>Ac,$paren:()=>Bc,$time:()=>Dc,ArithmeticExpression:()=>We,ArithmeticExpressionItem:()=>vr,ArrayExpression:()=>Oe,Ast:()=>Zt,BooleanLiteral:()=>ze,ComparisonExpression:()=>fe,DateLiteral:()=>Se,DateTimeLiteral:()=>tr,Expression:()=>U,FilterTreeVisitor:()=>or,Literal:()=>I,LogicalExpression:()=>me,NegativeExpression:()=>Ht,NullLiteral:()=>Je,NumberLiteral:()=>we,OpraErrorListener:()=>nr,ParenthesizedExpression:()=>ge,QualifiedIdentifier:()=>H,StringLiteral:()=>Ye,Term:()=>Ve,TimeLiteral:()=>Qe,parse:()=>Wo});function Ac(...o){return new me({op:"or",items:o})}a(Ac,"$or");function Rc(...o){return new me({op:"and",items:o})}a(Rc,"$and");function bc(o){return new Se(o)}a(bc,"$date");function Dc(o){return new Qe(o)}a(Dc,"$time");function Nc(o){return new we(o)}a(Nc,"$number");function Ra(...o){return new Oe(o.map(Yr))}a(Ra,"$array");function Sc(o){return new H(o)}a(Sc,"$field");function Mc(o,e){return re("=",o,e)}a(Mc,"$eq");function vc(o,e){return re("!=",o,e)}a(vc,"$ne");function Fc(o,e){return re(">",o,e)}a(Fc,"$gt");function Ic(o,e){return re(">=",o,e)}a(Ic,"$gte");function Pc(o,e){return re("<",o,e)}a(Pc,"$lt");function Lc(o,e){return re("<=",o,e)}a(Lc,"$lte");function kc(o,e){return re("in",o,e)}a(kc,"$in");function jc(o,e){return re("!in",o,e)}a(jc,"$notIn");function Cc(o,e){return re("like",o,e)}a(Cc,"$like");function Uc(o,e){return re("!like",o,e)}a(Uc,"$notLike");function $c(o,e){return re("ilike",o,e)}a($c,"$ilike");function qc(o,e){return re("!ilike",o,e)}a(qc,"$notILike");function Bc(o){return new ge(o)}a(Bc,"$paren");function Kc(o){let e=new We;return e.add=t=>(e.append("+",At(t)),e),e.sub=t=>(e.append("-",At(t)),e),e.mul=t=>(e.append("*",At(t)),e),e.div=t=>(e.append("/",At(t)),e),e.append("+",Yr(o)),e}a(Kc,"$arithmetic");function re(o,e,t){let r=typeof e=="string"?new H(e):Yr(e),i=Yr(t);return new fe({op:o,left:r,right:i})}a(re,"comparisonExpression");var Yr=a(o=>Array.isArray(o)?Ra(...o.map(At)):At(o),"wrapEntryValue"),At=a(o=>o instanceof U?o:typeof o=="boolean"?new ze(o):typeof o=="number"||typeof o=="bigint"?new we(o):o==null?new Je:o instanceof Date?new Se(o):new Ye(""+o),"_wrapEntryValue");var Rt,Xe=(Rt=class{constructor(e){e&&Object.assign(this,e)}[E](e,{element:t}){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new ct(e.rules):void 0;return Vc(r,i)}[O](){return Wc}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");T.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),rules:e.rules}}},a(Rt,"FilterType"),Rt);An([u.Attribute({description:"Data type which filtering fields belong to"}),Rn("design:type",Object)],Xe.prototype,"dataType",void 0);An([u.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),Rn("design:type",Object)],Xe.prototype,"rules",void 0);Xe=An([u({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),Rn("design:paramtypes",[Object])],Xe);var Vc=a((o,e,t)=>ba("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=mr.parse(r);return e?e.normalizeFilter(s,o,t):s}catch(s){i.fail(n,`Not a valid filter expression. ${s.message}`,r);return}i.fail(n,"Nt a valid filter expression string",r)}),"decodeFilter"),Wc=ba("encodeFilter",(o,e,t)=>{if(o instanceof mr.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});import{__decorate as zc,__metadata as Jc}from"tslib";import{vg as Da}from"valgen";var bt,bn=(bt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Da.isObjectId({coerce:!0})}[O](){return Da.isObjectId({coerce:!0})}},a(bt,"ObjectIdType"),bt);bn=zc([u({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),Jc("design:paramtypes",[Object])],bn);import{__decorate as Ee,__metadata as _e}from"tslib";import{omitUndefined as Na}from"@jsopen/objects";import{asMutable as Qc}from"ts-gems";import{omitUndefined as Yc}from"@jsopen/objects";function Dn(o){let e=[],t=a(function(r,i){if(typeof i!="string")throw new TypeError("Symbol properties can't be used as a field");let n=Reflect.getOwnMetadata(d,r.constructor)||{};n.kind=f.ComplexType.Kind,n.fields=n.fields||{};let s=Reflect.getMetadata("design:type",r,i),p=n.fields[i]={...o,designType:s};s===Array?p.isArray=!0:p.type=p.type||s,Reflect.defineMetadata(d,n,r.constructor);for(let c of e)c(p)},"decorator");return t.Override=(r,i)=>(e.push(n=>{n.override=n.override||[],n.override.push(Yc({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(Dn,"ApiFieldDecoratorFactory");var C=a(function(...o){if(!this){let[n]=o;return C[w](n)}let[e,t]=o;A.call(this,e);let r=Qc(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof j))throw new Error("Field origin should be one of ComplexType, MappedType or MixinType");r.origin=i,r.type=t.type||e.node.getDataType("any"),r.description=t.description,r.isArray=t.isArray,r.isNestedEntity=t.isNestedEntity,r.default=t.default,r.fixed=t.fixed,r.required=t.required,r.exclusive=t.exclusive,r.localization=t.localization,r.keyField=t.keyField,r.deprecated=t.deprecated,r.readonly=t.readonly,r.writeonly=t.writeonly,r.examples=t.examples,r.override=t.override,r.scopePattern=t.scopePattern?Array.isArray(t.scopePattern)?t.scopePattern:[t.scopePattern]:void 0,r.designType=t.designType,r.override=t.override},"ApiField"),Sn=class Sn extends A{inScope(e){return ar(e,this.scopePattern)}forScope(e){if(!(e&&this.override))return this;this._overrideCache=this._overrideCache||{};let t=this._overrideCache[e];if(t)return t;if(e!=="*"){for(let r of this.override)if(ar(e,r.scopePattern)){t=Na({...r,id:void 0,owner:void 0,node:void 0,origin:void 0,name:void 0,type:void 0,override:void 0,_overrideCache:void 0,scopePattern:r.scopePattern}),Object.setPrototypeOf(t,this);break}}return t=t||this,this._overrideCache[e]=t,t}toJSON(e){var r;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return Na({type:t||((r=this.type)==null?void 0:r.toJSON(e)),description:this.description,isArray:this.isArray||void 0,isNestedEntity:this.isNestedEntity||void 0,default:this.default,fixed:this.fixed,required:this.required||void 0,exclusive:this.exclusive||void 0,localization:this.localization||void 0,keyField:this.keyField||void 0,deprecated:this.deprecated||void 0,readonly:this.readonly||void 0,writeonly:this.writeonly||void 0,examples:this.examples})}generateCodec(e,t,r){return this.type.generateCodec(e,t,{...r,designType:this.designType})}};a(Sn,"ApiFieldClass");var Nn=Sn;C.prototype=Nn.prototype;Object.assign(C,Dn);C[w]=Dn;import"reflect-metadata";import{omitUndefined as Xc}from"@jsopen/objects";import{asMutable as Zc}from"ts-gems";var Mn=class Mn extends xe{constructor(){super(""),this.details=[]}add(e){return this.details.push(e),this}};a(Mn,"OpraDocumentError");var Dt=Mn;var vn=class vn{constructor(e){this.path="",this.error=new Dt,this.showErrorDetails=!0,this.maxErrors=(e==null?void 0:e.maxErrors)||0,this.error.message=""}addError(e){if(!this.error.details.length)if(e instanceof Error)this.error.stack=e.stack;else{let t=new Error;Error.captureStackTrace(t,this.addError),this.error.stack=t.stack}if(this.error.add({message:typeof e=="string"?e:e.message,path:this.path,...typeof e=="object"?e:void 0}),this.error.details.length>=this.maxErrors)throw this.error}enter(e,t){let r=this.path;this.path=this.path+e;try{return t()}catch(i){i!==this.error&&this.addError(i)}finally{this.path=r}}async enterAsync(e,t){let r=this.path;this.path=this.path+e;try{return await t()}catch(i){i!==this.error&&this.addError(i)}finally{this.path=r}}extend(e){let t={...e};return Object.setPrototypeOf(t,this),t}};a(vn,"DocumentInitContext");var Te=vn;import{omit as Gc}from"@jsopen/objects";function Fn(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!P.test(o.name))throw new TypeError(`"${o.name}" is not a valid type name`);t=o.name}else t=e.name;let r=Reflect.getOwnMetadata(d,e);r||(r={},Reflect.defineMetadata(d,r,e)),r.kind=f.ComplexType.Kind,r.name=t,o&&Object.assign(r,Gc(o,["name"]))}}a(Fn,"ComplexTypeDecorator");var ie=a(function(...o){var n;if(!this)return ie[w].apply(void 0,o);let[e,t]=o,r=o[2]||new Te({maxErrors:0});j.call(this,e,t,r);let i=Zc(this);i.kind=f.ComplexType.Kind,i.discriminatorField=t.discriminatorField,i.discriminatorValue=t.discriminatorValue,t.base&&r.enter(".base",()=>{if(!(t.base instanceof j))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.additionalFields=i.base.additionalFields,i.keyField=i.base.keyField;for(let s of i.base.fields("*"))i._fields.set(s.name,new C(this,s))}),t.additionalFields!==void 0&&(i.additionalFields=t.additionalFields),t.keyField!==void 0&&(i.keyField=t.keyField),i.ctor=t.ctor||((n=i.base)==null?void 0:n.ctor),t.fields&&r.enter(".fields",()=>{for(let[s,p]of Object.entries(t.fields)){let c=new C(this,{...p,name:s});this._fields.set(c.name,c)}})},"ComplexType"),Pn=class Pn extends j{extendsFrom(e){var t;return e instanceof T||(e=this.node.getDataType(e)),e instanceof j?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,i={...t,kind:this.kind,base:this.base?r||this.base.toJSON(e):void 0,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue};if(this.additionalFields)if(this.additionalFields instanceof T){let n=this.node.getDataTypeNameWithNs(this.additionalFields);i.additionalFields=n||this.additionalFields.toJSON(e)}else i.additionalFields=this.additionalFields;if(this._fields.size){let n={},s=0;for(let p of this._fields.values())p.origin===this&&p.inScope(e==null?void 0:e.scope)&&(n[p.name]=p.toJSON(e),s++);s&&(i.fields=n)}return Xc(i)}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(Pn,"ComplexTypeClass");var In=Pn;ie.prototype=In.prototype;Object.assign(ie,Fn);ie[w]=Fn;var Nt,oe=(Nt=class{constructor(e){e&&Object.assign(this,e)}},a(Nt,"OperationResult"),Nt);Ee([C(),_e("design:type",Number)],oe.prototype,"affected",void 0);Ee([C(),_e("design:type",Number)],oe.prototype,"totalMatches",void 0);Ee([C(),_e("design:type",String)],oe.prototype,"context",void 0);Ee([C(),_e("design:type",String)],oe.prototype,"type",void 0);Ee([C(),_e("design:type",String)],oe.prototype,"message",void 0);Ee([C({type:"any"}),_e("design:type",Object)],oe.prototype,"payload",void 0);Ee([C({type:"object"}),_e("design:type",Array)],oe.prototype,"errors",void 0);oe=Ee([ie({name:"OperationResult",description:"Operation result"}),_e("design:paramtypes",[Object])],oe);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return Ee([C({type:t,required:!0}),_e("design:type",Object)],r.prototype,"payload",void 0),r=Ee([ie({embedded:!0}),_e("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(oe||(oe={}));import{__decorate as Ln,__metadata as kn}from"tslib";import{isDateString as Qr,toString as Sa,validator as Hc,vg as Ze}from"valgen";var St,ur=(St=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=va,r=[];return e.minValue!=null&&(Qr(e.minValue),r.push(Sa,Ze.isGte(e.minValue))),e.maxValue!=null&&(Qr(e.maxValue),r.push(Sa,Ze.isLte(e.maxValue))),r.length>0?Ze.pipe([t,...r],{returnIndex:0}):t}[O](e){let t=va,r=[];return e.minValue!=null&&(Qr(e.minValue),r.push(Ze.isGte(e.minValue))),e.maxValue!=null&&(Qr(e.maxValue),r.push(Ze.isLte(e.maxValue))),r.length>0?Ze.pipe([t,...r],{returnIndex:0}):t}},a(St,"PartialDateType"),St);Ln([u.Attribute({description:"Minimum value"}),kn("design:type",String)],ur.prototype,"minValue",void 0);Ln([u.Attribute({description:"Maximum value"}),kn("design:type",String)],ur.prototype,"maxValue",void 0);ur=Ln([u({name:"partialdate",description:"Specifies a point in time using a 24-hour clock notation.\rFormat: YYYY-[MM-[DD-[T?HH:[MM:[SS[.S[S[S[S]]]]]]]]][+/-ZZ:ZZ].",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15:22+03:00").Example("2021-04-18 22:30").Example("2021-04-18").Example("2021"),kn("design:paramtypes",[Object])],ur);var Ma=Ze.isDateString({precisionMin:"year"}),va=Hc(o=>{if(o instanceof Date){let e=Ma(o,{coerce:!0});return e.endsWith("Z")&&(e=e.substring(0,e.length-1)),e.endsWith(".000")&&(e=e.substring(0,e.length-4)),e.endsWith(":00")&&(e=e.substring(0,e.length-3)),e.endsWith("00:00")&&(e=e.substring(0,e.length-6)),e}return Ma(o,{coerce:!1})});import{__decorate as jn,__metadata as Cn}from"tslib";import{vg as Gr}from"valgen";var el=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Mt,dr=(Mt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=Gr.matches(el,{formatName:"time",coerce:!0}),r=[];return e.minValue!=null&&r.push(Gr.isGte(e.minValue)),e.maxValue!=null&&r.push(Gr.isLte(e.maxValue)),r.length>0?Gr.pipe([t,...r],{returnIndex:0}):t}[O](e){return this[E](e)}},a(Mt,"TimeType"),Mt);jn([u.Attribute({description:"Minimum value"}),Cn("design:type",String)],dr.prototype,"minValue",void 0);jn([u.Attribute({description:"Maximum value"}),Cn("design:type",String)],dr.prototype,"maxValue",void 0);dr=jn([u({name:"time",description:"Time string in 24h format",nameMappings:{js:"string",json:"string"}}).Example("18:23:00","Full time value").Example("18:23:00","Time value without seconds"),Cn("design:paramtypes",[Object])],dr);import{__decorate as tl,__metadata as rl}from"tslib";import{vg as Fa}from"valgen";var vt,Un=(vt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Fa.isURL({coerce:!0})}[O](){return Fa.isURL({coerce:!0})}},a(vt,"UrlType"),vt);Un=tl([u({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),rl("design:paramtypes",[Object])],Un);import{__decorate as Pa,__metadata as La}from"tslib";import{vg as Ia}from"valgen";var Ft,Xr=(Ft=class{constructor(e){e&&Object.assign(this,e)}[E](e){return Ia.isUUID(e==null?void 0:e.version,{coerce:!0})}[O](e){return Ia.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(Ft,"UuidType"),Ft);Pa([u.Attribute({description:"Version of the UUID"}),La("design:type",Number)],Xr.prototype,"version",void 0);Xr=Pa([u({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),La("design:paramtypes",[Object])],Xr);import il from"path-browserify";import{omitUndefined as ol}from"@jsopen/objects";import{asMutable as nl}from"ts-gems";var ka,ja,ne=Symbol.for("kMap"),hr=Symbol.for("kCtorMap"),qn=class qn{constructor(){this[ka]=new N,this[ja]=new WeakMap}get size(){return this[ne].size}forEach(e,t){this[ne].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[hr].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(d,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[d];t=i==null?void 0:i.name}if(!t)return;let r=this[ne].get(t);if(r)return typeof e=="function"&&r.kind==="ComplexType"?r.ctor===e?r:void 0:r}set(e,t){this[ne].set(e,t),t.ctor?this[hr].set(t.ctor,e):t.instance&&this[hr].set(t.instance,e)}has(e){if(e instanceof T)return!!e.name&&this[ne].has(e.name);let t=typeof e=="string"?e:this[hr].get(e);return t?this[ne].has(t):!1}keys(){return this[ne].keys()}values(){return this[ne].values()}entries(){return this[ne].entries()}sort(e){return this[ne].sort(e),this}[(ka=ne,ja=hr,Symbol.iterator)](){return this[ne][Symbol.iterator]()}};a(qn,"DataTypeMap");var V=qn;import{isConstructor as It}from"@jsopen/objects";function v(o,e){let t=a(((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:f.HttpOperation.Kind},s=Reflect.getOwnMetadata(ae,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n);Reflect.defineMetadata(ae,s,r.constructor)}),"decorator");return t.Cookie=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};It(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="cookie"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Header=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};It(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="header"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};It(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="query"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(o.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};It(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(p=>!(p.location==="path"&&String(p.name)===String(r))):n.parameters=[],n.parameters.push(s)}),t),t.Response=(r,i)=>{let n={...i,statusCode:r};return n.type&&(n.contentType=n.contentType||D.opra_response_json,n.contentEncoding=n.contentEncoding||"utf-8"),n.contentType===D.opra_response_json&&(n.contentEncoding=n.contentEncoding||"utf-8"),It(n.type)&&(n.designType=n.type),o.push(s=>{s.responses=s.responses||[],s.responses.push(n)}),t},t.RequestContent=function(r){let i=typeof r=="object"?r:{type:r};return i.type&&(i.contentType=i.contentType||D.json,i.contentEncoding=i.contentEncoding||"utf-8",It(i.type)&&(i.designType=i.type)),o.push(n=>{n.requestBody=n.requestBody||{required:!0,content:[]},n.requestBody.content=n.requestBody.content||[],n.requestBody.content.push(i)}),t},t.MultipartContent=function(r,i){let n={...r,contentType:(r==null?void 0:r.contentType)||"multipart/form-data"};if(o.push(s=>{s.requestBody=s.requestBody||{required:!0,content:[]},s.requestBody.content=s.requestBody.content||[],s.requestBody.content.push(n)}),i){let s={Field(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"field",...c}),s},File(p,c){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:p,fieldType:"file",...c}),s}};i(s)}return t},t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(v,"HttpOperationDecoratorFactory");var b=a(function(...o){if(!this){let[i]=o,n=[];return b[w].call(void 0,n,i)}let[e,t]=o;if(A.call(this,e),!P.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=nl(this);r.parameters=[],r.responses=[],r.types=r.node[L]=new V,r.name=t.name,r.path=t.path,r.mergePath=t.mergePath,r.method=t.method||"GET",r.description=t.description,r.composition=t.composition,r.compositionOptions=t.compositionOptions?F(t.compositionOptions):void 0},"HttpOperation"),Kn=class Kn extends A{findParameter(e,t){let r=e.toLowerCase(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i}getFullUrl(){let e=this.owner.getFullUrl();return e?this.path?this.mergePath?e+this.path:il.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=ol({kind:f.HttpOperation.Kind,description:this.description,method:this.method,path:this.path,mergePath:this.mergePath,composition:this.composition,requestBody:(r=this.requestBody)==null?void 0:r.toJSON(e)});if(this.types.size){t.types={};for(let i of this.types.values())t.types[i.name]=i.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let i of this.parameters)t.parameters.push(i.toJSON(e))}return this.responses.length&&(t.responses=this.responses.map(i=>i.toJSON(e))),t}};a(Kn,"HttpOperationClass");var Bn=Kn;b.prototype=Bn.prototype;b[w]=v;b.GET=function(o){return v([],{...o,method:"GET"})};b.DELETE=function(o){return v([],{...o,method:"DELETE"})};b.HEAD=function(o){return v([],{...o,method:"HEAD"})};b.OPTIONS=function(o){return v([],{...o,method:"OPTIONS"})};b.PATCH=function(o){return v([],{...o,method:"PATCH"})};b.POST=function(o){return v([],{...o,method:"POST"})};b.PUT=function(o){return v([],{...o,method:"PUT"})};b.SEARCH=function(o){return v([],{...o,method:"SEARCH"})};b.Entity={};function W(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(d,o);if(!e)throw new TypeError(`Type (${o}) is not decorated with any datatype decorators`);if(e!=null&&e.name)return e.name;throw new TypeError("You should provide named data type but embedded one found")}a(W,"getDataTypeName");function Le(o,e){return(t,r)=>{let i=typeof r=="string"||typeof r=="function"?{name:t,location:"path",type:r,keyParam:!0}:{...r,name:t,location:"path",keyParam:!0};return o.PathParam(t,i),e.push(n=>{var s;(s=n.path)!=null&&s.includes(":"+t)||(n.path=(n.path||"")+"@:"+t),n.mergePath=!0}),o}}a(Le,"createKeyParamDecorator");function Ca(o,e){return(...t)=>{let r=typeof t[0]=="object"?t[0]:t.reduce((s,p)=>{let c=p.split(":");return s[c[0]]=c[1]||c[0],s},{}),i=Object.keys(r).reduce((s,p)=>{let c=Tt.exec(p),l=Tt.exec(r[p]);return c&&l&&(s[c[2]]=l[2]),s},{}),n=Object.keys(r).reduce((s,p)=>{let c=Tt.exec(p);return c&&(c[1]!="-"&&(s[c[2]]=c[2]),c[1]!="+"&&(s["-"+c[2]]="-"+c[2])),s},{});return e.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.sortFields=i}),o.QueryParam("sort",{description:"Determines sort fields",type:ee(n),isArray:!0,arraySeparator:",",parser:a(s=>s.map(p=>{let c=Tt.exec(p);return c?(c[1]||"")+i[c[2]]:p}),"parser")}),o}}a(Ca,"createSortFieldsDecorator");function ke(o,e,t){let r=Reflect.getMetadata("FilterRules",o);r||(r=new ct,Reflect.defineMetadata("FilterRules",r,o));let i=Reflect.getMetadata("FilterType",o);return i||(i=new Xe({dataType:t}),i.rules={},Reflect.defineMetadata("FilterType",i,o)),(n,s)=>{let p=(Array.isArray(s)?{operators:s}:typeof s=="string"?{operators:s.split(/\s*,\s*/)}:s)||{};if(p.operators=p.operators||["=","!="],n.includes(":")){let c=n.split(":");n=c[0],p.mappedField=c[1]}return e.push(()=>{r.set(n,p),i.rules=r.toJSON()}),o.QueryParam("filter",{type:i,description:"Determines filter fields"}),o}}a(ke,"createFilterDecorator");b.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"POST",...t,composition:"Entity.Create",requestBody:{immediateFetch:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.CREATED,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=W(t.type)}),i};b.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.KeyParam=Le(i,r),i};b.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.Filter=ke(i,r,t.type),i};var es={};Rr(es,{AnyType:()=>Vn,BigintType:()=>Qn,BooleanType:()=>Gn,IntegerType:()=>Ut,NullType:()=>Zn,NumberType:()=>Re,ObjectType:()=>Hn,StringType:()=>He});import{__decorate as sl,__metadata as al}from"tslib";import{isAny as Ua}from"valgen";var Pt,Vn=(Pt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Ua}[O](){return Ua}},a(Pt,"AnyType"),Pt);Vn=sl([u({name:"any",description:"Represents any value"}),al("design:paramtypes",[Object])],Vn);import{__decorate as pl,__metadata as cl}from"tslib";import{toBigint as qa,vg as Yn}from"valgen";import{__decorate as zn,__metadata as Jn}from"tslib";import{toNumber as $a,vg as Wn}from"valgen";var Lt,Re=(Lt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];return e.minValue!=null&&t.push(Wn.isGte(e.minValue)),e.maxValue!=null&&t.push(Wn.isLte(e.maxValue)),t.length>0?Wn.pipe([$a,...t],{returnIndex:0}):$a}[O](e){return this[E](e)}},a(Lt,"NumberType"),Lt);zn([u.Attribute({description:"Determines the minimum value"}),Jn("design:type",Number)],Re.prototype,"minValue",void 0);zn([u.Attribute({description:"Determines the maximum value"}),Jn("design:type",Number)],Re.prototype,"maxValue",void 0);Re=zn([u({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),Jn("design:paramtypes",[Object])],Re);var kt,Qn=(kt=class extends Re{constructor(e){super(e)}[E](e){let t=[];return e.minValue!=null&&t.push(Yn.isGte(e.minValue)),e.maxValue!=null&&t.push(Yn.isLte(e.maxValue)),t.length>0?Yn.pipe([qa,...t],{returnIndex:0}):qa}[O](e){return this[E](e)}},a(kt,"BigintType"),kt);Qn=pl([u({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),cl("design:paramtypes",[Object])],Qn);import{__decorate as ll,__metadata as fl}from"tslib";import{toBoolean as Ba}from"valgen";var jt,Gn=(jt=class{constructor(e){e&&Object.assign(this,e)}[E](){return Ba}[O](){return Ba}},a(jt,"BooleanType"),jt);Gn=ll([u({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),fl("design:paramtypes",[Object])],Gn);import{__decorate as ml,__metadata as ul}from"tslib";import{toInteger as Ka,vg as Xn}from"valgen";var Ct,Ut=(Ct=class extends Re{constructor(e){super(e)}[E](e){let t=[];return e.minValue!=null&&t.push(Xn.isGte(e.minValue)),e.maxValue!=null&&t.push(Xn.isLte(e.maxValue)),t.length>0?Xn.pipe([Ka,...t],{returnIndex:0}):Ka}[O](e){return this[E](e)}},a(Ct,"IntegerType"),Ct);Ut=ml([u({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),ul("design:paramtypes",[Object])],Ut);import{__decorate as dl,__metadata as hl}from"tslib";import{isNull as Va}from"valgen";var $t,Zn=($t=class{constructor(e){e&&Object.assign(this,e)}[E](){return Va}[O](){return Va}},a($t,"NullType"),$t);Zn=dl([u({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),hl("design:paramtypes",[Object])],Zn);import{__decorate as yl,__metadata as Tl}from"tslib";var qt,Hn=(qt=class{constructor(e){e&&Object.assign(this,e)}},a(qt,"ObjectType"),qt);Hn=yl([ie({name:"object",description:"A non modelled object",additionalFields:!0}),Tl("design:paramtypes",[Object])],Hn);import{__decorate as yr,__metadata as Tr}from"tslib";import{toString as Wa,vg as Zr}from"valgen";var Bt,He=(Bt=class{constructor(e){e&&Object.assign(this,e)}[E](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(d,Object.getPrototypeOf(this).constructor).name),t.push(Zr.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(Zr.lengthMin(e.minLength)),e.maxLength&&t.push(Zr.lengthMax(e.maxLength)),t.length>0?Zr.pipe([Wa,...t],{returnIndex:0}):Wa}[O](e){return this[E](e)}},a(Bt,"StringType"),Bt);yr([u.Attribute({description:"Regex pattern to be used for validation"}),Tr("design:type",Object)],He.prototype,"pattern",void 0);yr([u.Attribute({description:"Name of the pattern"}),Tr("design:type",String)],He.prototype,"patternName",void 0);yr([u.Attribute({description:"Minimum number of characters"}),Tr("design:type",Number)],He.prototype,"minLength",void 0);yr([u.Attribute({description:"Minimum number of characters"}),Tr("design:type",Number)],He.prototype,"maxLength",void 0);He=yr([u({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),Tr("design:paramtypes",[Object])],He);b.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"GET",...t,composition:"Entity.FindMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',contentType:D.opra_response_json,type:t.type,partial:"deep",isArray:!0}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new Ut({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new Ut({minValue:1})}).QueryParam("count",{description:"Counts all matching instances if enabled",type:Boolean}).QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type),t.defaultLimit&&(s.defaultLimit=t.defaultLimit),t.defaultProjection&&(s.defaultProjection=t.defaultProjection),t.maxLimit&&(s.maxLimit=t.maxLimit)}),i.Filter=ke(i,r,t.type),i.DefaultSort=(...n)=>(r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.defaultSort=n}),i),i.SortFields=Ca(i,r),i};b.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"GET",...t,composition:"Entity.Get"});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.KeyParam=Le(i,r),i};b.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"POST",...t,composition:"Entity.Replace"});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=W(t.type)}),i.KeyParam=Le(i,r),i};b.Entity.Update=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"PATCH",...t,composition:"Entity.Update",requestBody:{partial:"deep",immediateFetch:!0,allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.QueryParam("projection",{description:"Determines fields projection",type:new J({dataType:t.type,allowSigns:"each"}),isArray:!0,arraySeparator:","}).RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',contentType:D.opra_response_json,type:t.type,partial:"deep"}).Response(R.NO_CONTENT,{description:"Operation is successful but no resource found"}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=W(t.type)}),i.KeyParam=Le(i,r),i.Filter=ke(i,r,t.type),i};b.Entity.UpdateMany=function(o,e){var n;let t;typeof o=="object"&&!o[d]?t=o:t={...e,type:o};let r=[],i=v(r,{method:"PATCH",...t,composition:"Entity.UpdateMany",requestBody:{immediateFetch:!0,partial:"deep",allowPatchOperators:!0,keepKeyFields:!0,...t.requestBody,required:!0}});return i.RequestContent(((n=t.requestBody)==null?void 0:n.type)||t.type).Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:D.opra_response_json}).Response(R.UNPROCESSABLE_ENTITY,{description:"The request was well-formed but was unable to process operation due to one or many errors.",contentType:D.opra_response_json}),r.push(s=>{let p=s.compositionOptions=s.compositionOptions||{};p.type=W(t.type)}),i.Filter=ke(i,r,t.type),i};import{merge as ts}from"@jsopen/objects";var El=/^(.*)(Controller)$/,za=[];function Kt(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=El.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(pe,Object.getPrototypeOf(r));s&&ts(n,s,{deep:!0});let p=Reflect.getOwnMetadata(pe,r);p&&ts(n,p,{deep:!0}),ts(n,{...o,kind:f.MQController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(pe,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(pe,n,r)},"decorator");return t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,type:i}:{...i,name:r};n.headers=n.headers||[],n.headers.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),za.forEach(r=>r(t,e,o)),t}a(Kt,"MQControllerDecoratorFactory");Kt.augment=function(o){za.push(o)};import{isConstructor as Ja,omit as xl}from"@jsopen/objects";var Ya=[];function Er(o,e,t){let r=!1,i=a(((n,s)=>{if(typeof s!="string")throw new TypeError("Symbol properties can not be decorated");let p={kind:f.MQOperation.Kind,channel:s,type:e,...xl(t,["kind","type"])},c=Reflect.getOwnMetadata(pe,n.constructor)||{};c.operations=c.operations||{},c.operations[s]=p;for(let l of o)l(p,n,s);Reflect.defineMetadata(pe,c,n.constructor)}),"decorator");return i.UseType=(...n)=>(o.push(s=>{s.types=s.types||[],s.types.push(...n)}),i),i.Header=(n,s)=>(o.push(p=>{let c=typeof s=="string"||typeof s=="function"?{name:n,type:s}:{...s,name:n};Ja(c.type)&&(c.designType=c.type);let l=r?p.response:p;l.headers?l.headers=l.headers.filter(x=>String(x.name)!==String(n)):l.headers=[],l.headers.push(c)}),i),i.Response=(n,s)=>(o.push(p=>{r=!0,p.response={...s,type:n},Ja(n)&&(p.response.designType=n)}),i),Ya.forEach(n=>n(i,o,e,t)),i}a(Er,"MQOperationDecoratorFactory");Er.augment=function(o){Ya.push(o)};import{merge as rs}from"@jsopen/objects";var gl=/^(.*)(Controller)$/,Qa=[];function Vt(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=gl.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ce,Object.getPrototypeOf(r));s&&rs(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ce,r);p&&rs(n,p,{deep:!0}),rs(n,{...o,kind:f.WSController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(ce,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(ce,n,r)},"decorator");return t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),Qa.forEach(r=>r(t,e,o)),t}a(Vt,"WSControllerDecoratorFactory");Vt.augment=function(o){Qa.push(o)};import{omit as Al}from"@jsopen/objects";var Ga=[];function _r(o,e){let t=a(((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={kind:f.WSOperation.Kind,event:i,...Al(e,["kind"])},s=Reflect.getOwnMetadata(ce,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let p of o)p(n,r,i);Reflect.defineMetadata(ce,s,r.constructor)}),"decorator");return t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),Ga.forEach(r=>r(t,o,e)),t}a(_r,"WSOperationDecoratorFactory");_r.augment=function(o){Ga.push(o)};import"reflect-metadata";import{omitUndefined as bl}from"@jsopen/objects";import{asMutable as Dl}from"ts-gems";function Hr(o,e){let t=o==null?void 0:o.map(i=>String(i).toLowerCase()),r=e==null?void 0:e.map(i=>String(i).toLowerCase());return i=>r&&r.includes(i.toLowerCase())?!1:t?t.includes(i.toLowerCase()):!0}a(Hr,"getIsInheritedPredicateFn");var et=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;j.call(this,e,t,r);let i=Dl(this);if(i.kind=f.MappedType.Kind,t.base){if(!(t.base instanceof j))throw new TypeError(`"${t.base.kind}" can't be set as base for a "${this.kind}"`);i.base=t.base,i.ctor=t.ctor||i.base.ctor,t.pick?i.pick=t.pick.map(l=>i.base.normalizeFieldPath(l)):t.omit?i.omit=t.omit.map(l=>i.base.normalizeFieldPath(l)):t.partial?i.partial=Array.isArray(t.partial)?t.partial.map(l=>i.base.normalizeFieldPath(l)):t.partial:t.required&&(i.required=Array.isArray(t.required)?t.required.map(l=>i.base.normalizeFieldPath(l)):t.required);let s=Hr(i.pick,i.omit),p=Array.isArray(i.partial)?i.partial.map(l=>l.toLowerCase()):i.partial,c=Array.isArray(i.required)?i.required.map(l=>l.toLowerCase()):i.required;for(let[l,x]of i.base.fieldEntries("*")){if(!s(l))continue;let g={...x};p===!0||Array.isArray(p)&&p.includes(x.name.toLowerCase())?g.required=!1:(c===!0||Array.isArray(c)&&c.includes(x.name.toLowerCase()))&&(g.required=!0);let h=new C(this,g);i._fields.set(h.name,h)}(!i.pick||i.base.additionalFields===!1||Array.isArray(i.base.additionalFields)&&((n=i.base.additionalFields)==null?void 0:n[0])==="error")&&(i.additionalFields=i.base.additionalFields),t.base.keyField&&s(t.base.keyField)&&(i.keyField=t.base.keyField),i.discriminatorField=t.base.discriminatorField,i.discriminatorValue=t.base.discriminatorValue}},"MappedType"),os=class os extends j{extendsFrom(e){var t;return e instanceof T||(e=this.node.getDataType(e)),e instanceof j?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return bl({...t,base:r||this.base.toJSON(e),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(os,"MappedTypeClass");var is=os;et.prototype=is.prototype;et._applyMixin=()=>{};import"reflect-metadata";import{omitUndefined as Nl}from"@jsopen/objects";import{asMutable as Sl}from"ts-gems";var Wt=a(function(...o){if(!this)return Wt[w].apply(void 0,o);let[e,t,r]=o;j.call(this,e,t,r);let i=Sl(this);i.kind=f.MixinType.Kind,i.types=[];for(let n of t.types){i.additionalFields!==!0&&(n.additionalFields===!0?i.additionalFields=!0:i.additionalFields||(i.additionalFields=n.additionalFields));for(let s of n.fields("*")){let p=new C(this,s);i._fields.set(p.name,p)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),ss=class ss extends j{extendsFrom(e){if(e instanceof T||(e=this.node.getDataType(e)),!(e instanceof j))return!1;if(e===this)return!0;for(let t of this.types)if(t.extendsFrom(e))return!0;return!1}toJSON(e){let t=super.toJSON(e);return Nl({...t,kind:this.kind,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}_locateBase(e){for(let t of this.types){if(e(t))return t;if(t._locateBase){let r=t._locateBase(e);if(r)return r}}}};a(ss,"MixinTypeClass");var ns=ss;Wt.prototype=ns.prototype;Wt[w]=Ml;function Ml(o,e){if(o=o.filter(n=>typeof n=="function"),!o.length)throw new TypeError("No Class has been provided");if(o.length===1)return o[0];let t=o[0].name+"Mixin",r={[t]:class{constructor(){for(let n of o)Nr(this,n)}}}[t],i={...e,kind:f.MixinType.Kind,types:[]};Reflect.defineMetadata(d,i,r);for(let n of o){let s=Reflect.getMetadata(d,n);if(!(s&&(s.kind===f.ComplexType.Kind||s.kind===f.MixinType.Kind||s.kind===f.MappedType.Kind)))throw new TypeError(`Class "${n.name}" is not a ${f.ComplexType.Kind}, ${f.MixinType.Kind} or ${f.MappedType.Kind}`);i.types.push(n),Dr(r.prototype,n.prototype)}return r}a(Ml,"MixinTypeFactory");import"reflect-metadata";import{omitUndefined as vl}from"@jsopen/objects";import{asMutable as Fl}from"ts-gems";import{vg as Xa}from"valgen";var zt=a(function(...o){if(!this)return zt[w].apply(void 0,o);let[e,t,r]=o;T.call(this,e,t,r);let i=Fl(this);i.kind=f.UnionType.Kind,i.discriminator=t.discriminator,i.types=[];for(let n of t.types)i.types.push(n)},"UnionType"),ps=class ps extends T{toJSON(e){let t=super.toJSON(e);return vl({...t,kind:this.kind,discriminator:this.discriminator,types:this.types.map(r=>{let i=this.node.getDataTypeNameWithNs(r);return i||r.toJSON(e)})})}generateCodec(e,t){let r=this.types.map(i=>{let n=i.generateCodec(e,t);return(i.kind===f.ComplexType.Kind||i.kind===f.MappedType.Kind)&&i.discriminatorField?[n,{[i.discriminatorField]:Xa.isEqual(i.discriminatorValue)}]:n});return Xa.oneOf(r)}extendsFrom(){return!1}_locateBase(){}};a(ps,"UnionTypeClass");var as=ps;zt.prototype=as.prototype;zt[w]=Il;function Il(o,e){let i=class i{};a(i,"UnionClass");let t=i,r={...e,kind:f.UnionType.Kind,types:o};return Reflect.defineMetadata(d,r,t),t}a(Il,"UnionTypeFactory");var cs=Symbol("initializing"),ei=class ei{static async createDataType(e,t,r){e=e||new Te({maxErrors:0});let i=await this._importDataTypeArgs(e,t,r);if(i)return typeof i=="string"?t.node.getDataType(i):this._createDataType(e,t,i)}static async resolveDataType(e,t,r){if(r){let i=t.node.findDataType(r);if(i)return i}if(typeof r=="object"||typeof r=="function"){let i=await ei.createDataType(e,t,r);if(i)return i}if(r){let i=t.node.getDataType(r);if(i)return i}return t.node.getDataType("any")}static async addDataTypes(e,t,r){let i=t.node[L];if(!i)throw new TypeError("DocumentElement should has [kDataTypeMap] property");let n=await this.createAllDataTypes(e,t,r);if(n)for(let s of n)s!=null&&s.name&&i.set(s.name,s)}static async createAllDataTypes(e,t,r){e=e||new Te({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new N;for(let c of i)n.set(c.name,c);let s=e.extend({initArgsMap:n}),p=[];for(let[c,l]of n.entries())e.enter(`[${c}]`,()=>{if(!n.has(c))return;let x=this._createDataType(s,t,l);x&&p.push(x)});return p}static async _prepareAllInitArgs(e,t,r){let i=new N,n=new N,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[L])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let p=0;for(let c of r)await s.enterAsync(`$[${p++}]`,async()=>{c=await Z(c);let l=Reflect.getMetadata(d,c)||c[d];if(!(l&&l.name))return typeof c=="function"?s.addError(`Class "${c.name}" doesn't have a valid data type metadata`):s.addError("Object doesn't have a valid data type metadata");i.set(l.name,c)})}else{let p,c;for([c,p]of Object.entries(r))p=await Z(p),i.set(c,typeof p=="object"?{...p,name:c}:p)}for(let p of Array.from(i.keys())){if(!i.has(p))continue;let c=await this._importDataTypeArgs(s,t,p);c&&typeof c!="string"&&s.addError("Embedded data type can't be loaded into document node directly")}return Array.from(n.values())}static async _importDataTypeArgs(e,t,r,i){var g;r=await Z(r);let{importQueue:n,initArgsMap:s}=e,p=t.node.findDataType(r);if(p instanceof T)return p.name;let c,l,x;if(typeof r!="string"){let B=t.node.getDocument().types[Sr].get(r);B&&(r=B)}if(typeof r=="string"){let h=r;if(r=(n==null?void 0:n.get(h))||((g=e.initArgsMap)==null?void 0:g.get(h)),!r)return e.addError(`Unknown data type (${h})`)}if(typeof r=="function"){if(c=Reflect.getMetadata(d,r),!c)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);l=r}else if(typeof r=="object"){if(c=r[d],c)x=r,c.kind!==f.EnumType.Kind&&(c=void 0);else if(f.isDataType(r))c=r,l=c.ctor;else if(l=Object.getPrototypeOf(r).constructor,c=l&&Reflect.getMetadata(d,l),c&&c.kind===f.SimpleType.Kind){let h=await this._importDataTypeArgs(e,t,c.name);return h?typeof h=="object"&&h.kind!==f.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:f.SimpleType.Kind,name:void 0,base:h,properties:r}:void 0}}return c?e.enterAsync(c.name?`[${c.name}]`:"",async()=>{if(c.name){let B=s==null?void 0:s.get(c.name);if(B)return i&&B[cs]?e.addError("Circular reference detected"):c.name}let h={kind:c.kind,name:c.name};h[cs]=!0;try{if(h.name)if(n!=null&&n.has(h.name))s==null||s.set(c.name,h),h._instance={name:c.name},h[L]=t.node[L];else return e.addError(`Data Type (${h.name}) must be explicitly added to type list in the document scope`);switch(h.kind){case f.ArrayType.Kind:await this._prepareArrayTypeArgs(e,t,h,c);break;case f.ComplexType.Kind:h.ctor=l,await this._prepareComplexTypeArgs(e,t,h,c);break;case f.EnumType.Kind:h.instance=x,await this._prepareEnumTypeArgs(e,t,h,c);break;case f.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,h,c);break;case f.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,h,c);break;case f.SimpleType.Kind:h.ctor=l,await this._prepareSimpleTypeArgs(e,t,h,c);break;case f.UnionType.Kind:await this._prepareUnionTypeArgs(e,t,h,c);break;default:return e.addError(`Invalid data type kind ${c.kind}`)}}finally{h.name&&(n==null||n.delete(h.name)),delete h[cs]}return n&&h.name?h.name:h}):e.addError("No DataType metadata found")}static async _prepareDataTypeArgs(e,t,r){t.description=r.description,t.abstract=r.abstract,t.examples=r.examples,t.scopePattern=r.scopePattern}static async _prepareArrayTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".type",async()=>{let n=await this._importDataTypeArgs(e,t,i.type);n&&(r.type=be(n))})}static async _prepareComplexTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.keyField=i.keyField,r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=be(n),r.ctor=r.ctor||n.ctor)}),i.additionalFields!=null&&(typeof i.additionalFields=="boolean"||Array.isArray(i.additionalFields)?r.additionalFields=i.additionalFields:await e.enterAsync(".additionalFields",async()=>{let n=await this._importDataTypeArgs(e,t,i.additionalFields);n&&(r.additionalFields=be(n))})),i.fields&&(r.fields={},await e.enterAsync(".fields",async()=>{for(let[n,s]of Object.entries(i.fields))await e.enterAsync(`[${n}]`,async()=>{let p=typeof s=="string"?{type:s}:s;if(p.isArray&&!p.type)return e.addError('"type" must be defined explicitly for array fields');let c=await this._importDataTypeArgs(e,t,p.type||"any");c&&(r.fields[n]={...p,type:be(c)})})}))}static async _prepareEnumTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),i.base&&await e.enterAsync(".base",async()=>{let n=await this._importDataTypeArgs(e,t,i.base);n&&(r.base=be(n))}),r.attributes=F(i.attributes)}static async _prepareSimpleTypeArgs(e,t,r,i){var n,s,p,c;await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let l;if(i.base)l=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let x=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,x)&&(l=await this._importDataTypeArgs(e,t,x))}l&&(r.base=be(l),r.ctor=r.ctor||l.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=F(i.attributes)),typeof((n=r.properties)==null?void 0:n[E])=="function"&&(r.generateDecoder=(s=r.properties)==null?void 0:s[E].bind(r.properties)),typeof((p=r.properties)==null?void 0:p[O])=="function"&&(r.generateEncoder=(c=r.properties)==null?void 0:c[O].bind(r.properties))}static async _prepareMappedTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.discriminatorField=i.discriminatorField,r.discriminatorValue=i.discriminatorValue,await e.enterAsync(".base",async()=>{let n;if(i.base)n=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let s=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(d,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=be(n),r.ctor=r.ctor||n.ctor)}),i.pick?r.pick=[...i.pick]:i.omit?r.omit=[...i.omit]:i.partial?r.partial=Array.isArray(i.partial)?[...i.partial]:i.partial:i.required&&(r.required=Array.isArray(i.required)?[...i.required]:i.required)}static async _prepareMixinTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(be(c))})})}static async _prepareUnionTypeArgs(e,t,r,i){await this._prepareDataTypeArgs(e,r,i),r.types=[],await e.enterAsync(".types",async()=>{let n=i.types,s=0;for(let p of n)await e.enterAsync(`[${s++}]`,async()=>{let c=await this._importDataTypeArgs(e,t,p);c&&r.types.push(be(c))})})}static _createDataType(e,t,r){var s;let i=t.node.findDataType(typeof r=="string"?r:r.name||"");if(i instanceof T)return i;let n=typeof r=="string"?(s=e.initArgsMap)==null?void 0:s.get(r):r;if(n){let p=n[L];switch(p||delete n._instance,i=n._instance,i!=null&&i.name&&p&&p.set(i.name,i),n==null?void 0:n.kind){case f.ArrayType.Kind:return this._createArrayType(e,t,n);case f.ComplexType.Kind:return this._createComplexType(e,t,n);case f.EnumType.Kind:return this._createEnumType(e,t,n);case f.MappedType.Kind:return this._createMappedType(e,t,n);case f.MixinType.Kind:return this._createMixinType(e,t,n);case f.SimpleType.Kind:return this._createSimpleType(e,t,n);case f.UnionType.Kind:return this._createUnionType(e,t,n);default:break}}e.addError(`Unknown data type (${String(r)})`)}static _createArrayType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,de.prototype);let n=F(r);return r.type&&e.enter(".type",()=>{n.type=this._createDataType(e,t,r.type)}),de.apply(i,[t,n]),i}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ie.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),r.additionalFields&&e.enter(".additionalFields",()=>{typeof r.additionalFields=="boolean"||Array.isArray(r.additionalFields)?n.additionalFields=r.additionalFields:n.additionalFields=this._createDataType(e,t,r.additionalFields)}),n.fields={},r.fields&&e.enter(".fields",()=>{for(let[s,p]of Object.entries(r.fields))e.enter(`[${s}]`,()=>{let c=this._createDataType(e,t,p.type);c&&(n.fields[s]={...p,name:s,type:c})})}),ie.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ee.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),n.attributes=r.attributes,ee.apply(i,[t,n]),i}static _createMappedType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,et.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),et.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Wt.prototype);let n=F(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);if(!(c instanceof j))throw new TypeError(`"${c==null?void 0:c.kind}" can't be set as base for a "${n.kind}"`);n.types.push(c)})}),Wt.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,u.prototype);let n=F(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),u.apply(i,[t,n]),i}static _createUnionType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,zt.prototype);let n=F(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let p of r.types)e.enter(`[${s++}]`,()=>{let c=this._createDataType(e,t,p);n.types.push(c)})}),zt.apply(i,[t,n]),i}};a(ei,"DataTypeFactory");var S=ei;function be(o){return typeof o=="object"&&o.name?o.name:o}a(be,"preferName");import{isConstructor as tf}from"@jsopen/objects";import{omitUndefined as Ll}from"@jsopen/objects";var ls=class ls extends A{constructor(e){super(e.owner),this.name="OpraApi",this.name=e.name,this.description=e.description}toJSON(e){return Ll({transport:this.transport,name:this.name,description:this.description})}async _initialize(e,t){if(!P.test(e.name))throw new TypeError(`Invalid api name (${e.name})`);this.name=e.name,this.description=e==null?void 0:e.description}};a(ls,"ApiBase");var je=ls;import Cl from"path-browserify";import{omitUndefined as Ul}from"@jsopen/objects";import{asMutable as $l}from"ts-gems";import{merge as fs,omit as kl}from"@jsopen/objects";var jl=/^(.*)(Controller)$/;function ms(o){let e=[],t=a(function(r){var c;let i=o==null?void 0:o.name;i||(i=((c=jl.exec(r.name))==null?void 0:c[1])||r.name);let n={},s=Reflect.getOwnMetadata(ae,Object.getPrototypeOf(r));s&&fs(n,s,{deep:!0});let p=Reflect.getOwnMetadata(ae,r);p&&fs(n,p,{deep:!0}),fs(n,{kind:f.HttpController.Kind,name:i,path:i,...kl(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(ae,n,r);for(let l of e)l(n,r);Reflect.defineMetadata(ae,n,r)},"decorator");return t.Cookie=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"cookie",type:i}:{...i,name:r,location:"cookie"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.Header=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"header",type:i}:{...i,name:r,location:"header"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.QueryParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"query",type:i}:{...i,name:r,location:"query"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.PathParam=(r,i)=>(e.push(n=>{let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i}:{...i,name:r,location:"path"};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.KeyParam=(r,i)=>(e.push(n=>{var p;(p=n.path)!=null&&p.includes(":"+r)||(n.path=(n.path||"")+"@:"+r);let s=typeof i=="string"||typeof i=="function"?{name:r,location:"path",type:i,keyParam:!0}:{...i,name:r,location:"path",keyParam:!0};n.parameters=n.parameters||[],n.parameters.push(s)}),t),t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(ms,"HttpControllerDecoratorFactory");var se=a(function(...o){var i;if(!this)return se[w].apply(void 0,o);let[e,t]=o;if(A.call(this,e),!P.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=$l(this);r.kind=f.HttpController.Kind,r.types=r.node[L]=new V,r.operations=new N,r.controllers=new N,r.parameters=[],r.name=t.name,r.description=t.description,r.path=t.path??t.name,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"HttpController"),ds=class ds extends A{get isRoot(){return!(this.owner instanceof se)}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values()){if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;if(r.controllers.size&&(t=r.findController(e),t))return this._controllerReverseMap.set(e,t),t}this._controllerReverseMap.set(e,null);return}if(e.startsWith("/")&&(e=e.substring(1)),e.includes("/")){let t=e.split("/"),r=this;for(;r&&t.length>0;)r=r.controllers.get(t.shift());return r}return this.controllers.get(e)}findParameter(e,t){let r=e.toLowerCase(),i;for(i of this.parameters)if(!(t&&t!==i.location)&&(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e)))return i;if(this.node.parent&&this.node.parent.element instanceof se)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return Cl.posix.join(this.owner instanceof se?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=Ul({kind:this.kind,description:this.description,path:this.path});if(this.operations.size){t.operations={};for(let r of this.operations.values())t.operations[r.name]=r.toJSON(e)}if(this.controllers.size){t.controllers={};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON(e)}if(this.types.size){t.types={};for(let r of this.types.values())t.types[r.name]=r.toJSON(e)}if(this.parameters.length){t.parameters=[];for(let r of this.parameters)t.parameters.push(r.toJSON(e))}return t}[Me](){return`[${ve}HttpController${Fe+this.name+Ae}]`}};a(ds,"HttpControllerClass");var us=ds;se.prototype=us.prototype;Object.assign(se,ms);se[w]=ms;var hs=class hs extends je{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="http",this.controllers=new N,this.url=e.url}findController(e){return se.prototype.findController.call(this,e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(e){let r={...super.toJSON(),transport:this.transport,url:this.url,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON(e);return r}};a(hs,"HttpApi");var tt=hs;import ql from"@browsery/type-is";import{omitUndefined as Bl}from"@jsopen/objects";import{asMutable as Kl}from"ts-gems";import{isAny as Vl,vg as Wl}from"valgen";var Ce=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');A.call(this,o);let t=Kl(this);if(e.contentType){let r=Array.isArray(e.contentType)?e.contentType:[e.contentType];r=r.map(i=>i.split(/\s*,\s*/)).flat(),t.contentType=r.length>1?r:r[0]}t.description=e.description,t.contentEncoding=e.contentEncoding,t.examples=e.examples,t.multipartFields=[],t.maxFieldsSize=e.maxFieldsSize,t.maxFields=e.maxFields,t.maxFiles=e.maxFiles,t.maxFileSize=e.maxFileSize,t.maxTotalFileSize=e.maxTotalFileSize,e!=null&&e.type&&(t.type=(e==null?void 0:e.type)instanceof T?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray,t.designType=e.designType},"HttpMediaType"),Ts=class Ts extends A{findMultipartField(e,t){if(this.multipartFields){for(let r of this.multipartFields)if((!t||t===r.fieldType)&&(r.fieldName instanceof RegExp&&r.fieldName.test(e)||r.fieldName===e))return r}}toJSON(e){var i,n;let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0,r=Bl({description:this.description,contentType:this.contentType,contentEncoding:this.contentEncoding,type:t||((i=this.type)==null?void 0:i.toJSON(e)),isArray:this.isArray,example:this.example,examples:this.examples,maxFields:this.maxFields,maxFieldsSize:this.maxFieldsSize,maxFiles:this.maxFiles,maxFileSize:this.maxFileSize,maxTotalFileSize:this.maxTotalFileSize});return(n=this.multipartFields)!=null&&n.length&&(r.multipartFields=this.multipartFields.map(s=>s.toJSON(e))),r}generateCodec(e,t,r){let i;return this.type?i=this.type.generateCodec(e,t,{designType:this.designType}):this.contentType&&(Array.isArray(this.contentType)?this.contentType:[this.contentType]).find(s=>ql.is(s,["json"]))&&(i=this.node.findDataType("object").generateCodec(e,t,{...r,designType:this.designType})),i=i||Vl,this.isArray&&!(this.type instanceof de)?Wl.isArray(i):i}};a(Ts,"HttpMediaTypeClass");var ys=Ts;Ce.prototype=ys.prototype;import{omitUndefined as zl}from"@jsopen/objects";function Ue(o,e){let t=o.lastIndexOf("/");if(o.startsWith("/")&&t){let r=o.substring(1,t),i=o.substring(t+1);if(e!=null&&e.includeFlags)for(let n of e.includeFlags)i.includes(n)||(i+=n);if(e!=null&&e.excludeFlags)for(let n of e.excludeFlags)i.replace(n,"");return new RegExp(r,i)}throw new TypeError(`"${o}" is not a valid RegExp string`)}a(Ue,"parseRegExp");var Es=class Es extends Ce{constructor(e,t){super(e,t),this.fieldName=t.fieldName instanceof RegExp?t.fieldName:t.fieldName.startsWith("/")?Ue(t.fieldName):t.fieldName,this.fieldType=t.fieldType,this.required=t.required}toJSON(e){return zl({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(e)})}};a(Es,"HttpMultipartField");var ti=Es;import{omitUndefined as Yl}from"@jsopen/objects";var Jl=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,_s=class _s{constructor(e,t){if(this.start=0,this.end=0,e&&typeof e=="object"&&(this.start=e.start||0,this.end=e.end||0),typeof e=="number"&&(this.start=e,this.end=t||this.start),typeof e=="string"){let r=Jl.exec(e);if(!r)throw new TypeError(`"${e}" is not a valid Status Code range`);this.start=parseInt(r[1],10),this.end=r[2]?parseInt(r[2],10):this.start}}includes(e){return e>=this.start&&e<=this.end}intersects(e,t){return t>=this.start&&e<=this.end}toString(){return this.start===this.end?String(this.start):String(this.start)+"-"+String(this.end)}toJSON(){return!this.end||this.start===this.end?this.start:{start:this.start,end:this.end}}};a(_s,"HttpStatusRange");var xr=_s;var xs=class xs extends Ce{constructor(e,t){super(e,t),this.parameters=[],this.statusCode=(Array.isArray(t.statusCode)?t.statusCode:[t.statusCode]).map(r=>typeof r=="object"?new xr(r.start,r.end):new xr(r)),this.partial=t.partial}findParameter(e,t){e=e.toLowerCase();for(let r of this.parameters)if((!t||t===r.location)&&(r.name instanceof RegExp&&r.name.test(e)||r.name===e))return r}toJSON(e){let t=this.statusCode.map(i=>i.toJSON()),r=Yl({...super.toJSON(e),statusCode:t.length===1&&typeof t[0]=="number"?t[0]:t,partial:this.partial});if(this.parameters.length){r.parameters=[];for(let i of this.parameters)r.parameters.push(i.toJSON(e))}return r}};a(xs,"HttpOperationResponse");var ri=xs;import{omitUndefined as Xl}from"@jsopen/objects";import{asMutable as Zl}from"ts-gems";import{vg as Hl}from"valgen";import{omitUndefined as Ql}from"@jsopen/objects";import{asMutable as Gl}from"ts-gems";var rt=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');A.call(this,o);let t=Gl(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),gs=class gs extends A{toJSON(e){let t=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return Ql({type:this.type?t||this.type.toJSON(e):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(gs,"ValueClass");var Os=gs;rt.prototype=Os.prototype;var Or=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');rt.call(this,o,e);let t=Zl(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?Ue(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.location=e.location,t.deprecated=e.deprecated,t.required=e.required,t.required==null&&e.location==="path"&&(t.required=!0),t.arraySeparator=e.arraySeparator,t.keyParam=e.keyParam,t.parser=e.parser,t.designType=e.designType},"HttpParameter"),As=class As extends rt{toJSON(e){return Xl({...super.toJSON(e),name:this.name,location:this.location,arraySeparator:this.arraySeparator,keyParam:this.keyParam,required:this.required,deprecated:this.deprecated})}generateCodec(e,t,r){var i;return((i=this.type)==null?void 0:i.generateCodec(e,t,{...r,designType:this.designType}))||Hl.isAny()}};a(As,"HttpParameterClass");var ws=As;Or.prototype=ws.prototype;import{omitUndefined as ef}from"@jsopen/objects";var Rs=class Rs extends A{constructor(e){super(e),this.content=[]}toJSON(e){return ef({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(t=>t.toJSON(e)):[],partial:this.partial,allowPatchOperators:this.allowPatchOperators})}};a(Rs,"HttpRequestBody");var ii=Rs;var bs=class bs{static async createApi(e,t){let r=new tt(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,r,t.controllers)}),r}static async _createControllers(e,t,r){if(Array.isArray(r)){let i=0;for(let n of r){let s;await e.enterAsync(`[${i++}]`,async()=>{s=await this._resolveControllerMetadata(e,t,n)}),s&&await e.enterAsync(`[${s.metadata.name}]`,async()=>{let p=await this._createController(e,t,s.metadata,s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${s.name})`),t.controllers.set(p.name,p))})}return}for(let[i,n]of Object.entries(r))await e.enterAsync(`[${i}]`,async()=>{let s=await this._resolveControllerMetadata(e,t,n);if(!s)return;let p=await this._createController(e,t,{...s.metadata,name:i},s.instance,s.ctor);p&&(t.controllers.get(p.name)&&e.addError(`Duplicate controller name (${i})`),t.controllers.set(p.name,p))})}static async _resolveControllerMetadata(e,t,r){typeof r=="function"&&!tf(r)&&(r=t instanceof se?r(t.instance):r()),r=await Z(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(ae,r),!n)return e.addError(`Class "${r.name}" doesn't have a valid HttpController metadata`);i=r}else i=Object.getPrototypeOf(r).constructor,n=Reflect.getMetadata(ae,i),n?s=r:(n=r,r.instance==="object"&&(s=r.instance,i=Object.getPrototypeOf(s).constructor));return n?{metadata:n,instance:s,ctor:i}:e.addError(`Class "${i.name}" is not decorated with HttpController()`)}static async _createController(e,t,r,i,n){if(!r.name)throw new TypeError("Controller name required");let s=new se(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,s,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let p=0;for(let c of r.parameters)await e.enterAsync(`[${p++}]`,async()=>{let l={...c};await e.enterAsync(".type",async()=>{l.type=await S.resolveDataType(e,s,c.type)});let x=new Or(s,l);s.parameters.push(x)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[p,c]of Object.entries(r.operations))await e.enterAsync(`[${p}]`,async()=>{let l=new b(s,{name:p,method:"GET"});await this._initHttpOperation(e,l,c),s.operations.set(p,l)})}),r.controllers&&await e.enterAsync(".controllers",async()=>{await this._createControllers(e,s,r.controllers)}),s}static async _initHttpOperation(e,t,r){let i={...r,name:t.name,types:void 0};return b.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,t,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let n=0;for(let s of r.parameters)await e.enterAsync(`[${n++}]`,async()=>{let p={...s};await e.enterAsync(".type",async()=>{p.type=await S.resolveDataType(e,t,s.type)});let c=new Or(t,p);t.parameters.push(c)})}),r.responses&&await e.enterAsync(".responses",async()=>{let n=0;for(let s of r.responses)await e.enterAsync(`[${n++}]`,async()=>{let p=new ri(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,p,s),t.responses.push(p)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new ii(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){Ce.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await S.resolveDataType(e,t,r.type)}),r.multipartFields&&await e.enterAsync(".multipartFields",async()=>{for(let i=0;i<r.multipartFields.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.multipartFields[i],s=new ti(t,{fieldName:n.fieldName,fieldType:n.fieldType});await this._initHttpMediaType(e,s,n),t.multipartFields.push(s)})})}static async _initHttpOperationResponse(e,t,r){await this._initHttpMediaType(e,t,r),t.partial=r.partial,r.parameters&&await e.enterAsync(".parameters",async()=>{let i=0;for(let n of r.parameters)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await S.resolveDataType(e,t,n.type)});let p=new Or(t,s);t.parameters.push(p)})})}static async _initHttpRequestBody(e,t,r){t.description=r.description,t.required=r.required,t.maxContentSize=r.maxContentSize,t.immediateFetch=r.immediateFetch,t.partial=r.partial,t.allowPatchOperators=r.allowPatchOperators,t.keepKeyFields=r.keepKeyFields,r.content&&await e.enterAsync(".content",async()=>{for(let i=0;i<r.content.length;i++)await e.enterAsync(`[${i}]`,async()=>{let n=r.content[i],s=new Ce(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(bs,"HttpApiFactory");var Jt=bs;import{omitUndefined as of}from"@jsopen/objects";import{md5 as nf}from"super-fast-md5";var Ds=class Ds extends je{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="mq",this.controllers=new N,this.platform=e.platform}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values())if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};a(Ds,"MQApi");var it=Ds;var Ns=class Ns extends je{constructor(e){super(e),this._controllerReverseMap=new WeakMap,this.transport="ws",this.controllers=new N}findController(e){if(typeof e=="function"){let t=this._controllerReverseMap.get(e);if(t!=null)return t;for(let r of this.controllers.values())if(r.ctor===e)return this._controllerReverseMap.set(e,r),r;this._controllerReverseMap.set(e,null);return}return this.controllers.get(e)}findOperation(e,t){let r=this.findController(e);return r==null?void 0:r.operations.get(t)}toJSON(){let t={...super.toJSON(),transport:this.transport,controllers:{}};for(let r of this.controllers.values())t.controllers[r.name]=r.toJSON();return t}};a(Ns,"WSApi");var ot=Ns;var Za,Ss=class Ss extends A{constructor(){super(null),this[Za]=new WeakMap,this.id="",this.info={},this.references=new N,this.types=new V,this.node[L]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(e){let t=e instanceof T?this._findDataType(e.name||""):this._findDataType(e);if(t)return this[De].get(t)}findDocument(e){if(this.id===e)return this;for(let t of this.references.values()){if(t.id===e)return t;let r=t.findDocument(e);if(r)return r}}get httpApi(){if(this.api&&this.api instanceof tt)return this.api}get mqApi(){if(this.api&&this.api instanceof it)return this.api}get wsApi(){if(this.api&&this.api instanceof ot)return this.api}getHttpApi(){if(!(this.api&&this.api instanceof tt))throw new TypeError("The document do not contains HttpApi instance");return this.api}getMqApi(){if(!(this.api&&this.api instanceof it))throw new TypeError("The document do not contains MQApi instance");return this.api}getWsApi(){if(!(this.api&&this.api instanceof ot))throw new TypeError("The document do not contains WSApi instance");return this.api}toJSON(){return this.export()}export(e){let t=of({spec:f.SpecVersion,id:this.id,url:this.url,info:F(this.info,!0)});if(this.references.size){let r=0,i={};for(let[n,s]of this.references.entries())s[Be]||(i[n]={id:s.id,url:s.url,info:F(s.info,!0)},r++);r&&(t.references=i)}if(this.types.size){t.types={};for(let r of this.types.values())r.inScope(e==null?void 0:e.scope)&&(t.types[r.name]=r.toJSON(e))}return this.api&&(t.api=this.api.toJSON(e)),t}invalidate(){let e=this.export({});delete e.id,this.id=nf(JSON.stringify(e)),this[De]=new WeakMap}_findDataType(e,t,r){let i=this.types.get(e);if(i&&i.inScope(t))return i;if(!this.references.size)return;if(typeof e=="string"){let s=pa.exec(e);if(s){let p=s[1];if(p){let c=this.references.get(p);return c?(r=r||new WeakMap,r.set(this,!0),r.set(c,!0),c._findDataType(s[2],t,r)):void 0}e=s[2]}}r=r||new WeakMap,r.set(this,!0);let n=Array.from(this.references.keys()).reverse();for(let s of n){let p=this.references.get(s);if(i=p==null?void 0:p.types.get(e),i)return this[De].set(i,p!=null&&p[Be]?"":s),i}for(let s of n){let p=this.references.get(s);if(r.set(p,!0),i=p._findDataType(e,t,r),i)return this[De].set(i,p!=null&&p[Be]?"":s),i}}};a(Ss,"ApiDocument");var nt=Ss;Za=De;function $e(o,e,t){let r=Hr(e.pick,e.omit),i=typeof o=="string"?o.charAt(0).toUpperCase()+o.substring(1):o.name,n=(t==null?void 0:t.name)||i+"Mapped",s={[n]:class{constructor(){typeof o=="function"&&Nr(this,o,r)}}}[n];if(typeof o=="function"&&Dr(s.prototype,o.prototype),typeof o=="function"){let c=Reflect.getOwnMetadata(d,o);if(!c)throw new TypeError(`Class "${o}" doesn't have datatype metadata information`);if(!(c.kind===f.ComplexType.Kind||c.kind===f.MappedType.Kind||c.kind===f.MixinType.Kind))throw new TypeError(`Class "${o}" is not a ${f.ComplexType.Kind}`)}let p={...t,kind:"MappedType",base:o};return e.pick&&(p.pick=e.pick),e.omit&&(p.omit=e.omit),e.partial&&(p.partial=e.partial),e.required&&(p.required=e.required),Reflect.defineMetadata(d,p,s),typeof o=="function"&&et._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a($e,"createMappedClass");function IO(o,e,t){return $e(o,{omit:e},t)}a(IO,"OmitType");function jO(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return $e(o,{partial:t},r)}a(jO,"PartialType");function qO(o,e,t){return $e(o,{pick:e},t)}a(qO,"PickType");function WO(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return $e(o,{required:t},r)}a(WO,"RequiredType");function QO(o){return(e,t,r)=>{if(typeof t!="string")throw new TypeError("Un-named properties can not be decorated");if(!o&&(o=Reflect.getMetadata("design:paramtypes",e,t)[r],!o))throw new TypeError("Missing parameter type");let i=Reflect.getOwnMetadata(Xt,e,t);i||(i=[],Reflect.defineMetadata(Xt,i,e,t)),i[r]=o}}a(QO,"WsParam");import{isConstructor as df}from"@jsopen/objects";import{omitUndefined as sf}from"@jsopen/objects";import{asMutable as af}from"ts-gems";var st=a(function(...o){var i;if(!this)return st[w].apply(void 0,o);let[e,t]=o;if(A.call(this,e),!P.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=af(this);r.kind=f.MQController.Kind,r.types=r.node[L]=new V,r.operations=new N,r.headers=[],r.name=t.name,r.description=t.description,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"MQController"),vs=class vs extends A{findHeader(e,t){let r=e.toLowerCase(),i;for(i of this.headers)if(typeof i.name=="string"&&(i._nameLower=i._nameLower||i.name.toLowerCase(),i._nameLower===r)||i.name instanceof RegExp&&i.name.test(e))return i;if(this.node.parent&&this.node.parent.element instanceof st)return this.node.parent.element.findHeader(e,t)}toString(){return`[MQController ${this.name}]`}toJSON(){let e=sf({kind:this.kind,description:this.description});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[t.name]=t.toJSON()}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}[Me](){return`[${ve}MQController${Fe+this.name+Ae}]`}};a(vs,"MQControllerClass");var Ms=vs;st.prototype=Ms.prototype;Object.assign(st,Kt);st[w]=Kt;import{omitUndefined as pf}from"@jsopen/objects";import{asMutable as cf}from"ts-gems";import{vg as lf}from"valgen";var gr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');rt.call(this,o,e);let t=cf(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?Ue(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required,t.designType=e.designType},"MQHeader"),Is=class Is extends rt{toJSON(){return pf({...super.toJSON(),name:this.name,required:this.required,deprecated:this.deprecated})}generateCodec(e,t,r){var i;return((i=this.type)==null?void 0:i.generateCodec(e,t,{...r,designType:this.designType}))||lf.isAny()}};a(Is,"MQHeaderClass");var Fs=Is;gr.prototype=Fs.prototype;import{omitUndefined as ff}from"@jsopen/objects";import{asMutable as mf}from"ts-gems";import{vg as Ha}from"valgen";var wr=a(function(...o){if(!this){let[i,n]=o,s=[];return wr[w].call(void 0,s,i,n)}let[e,t]=o;if(A.call(this,e),!P.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=mf(this);r.headers=[],r.types=r.node[L]=new V,r.name=t.name,r.description=t.description,r.channel=t.channel,t!=null&&t.type&&(r.type=(t==null?void 0:t.type)instanceof T?t.type:r.owner.node.getDataType(t.type)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof T?t.keyType:r.owner.node.getDataType(t.keyType)),r.designType=t.designType,r.keyDesignType=t.keyDesignType},"MQOperation"),Ls=class Ls extends A{findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){var t;let e=ff({kind:f.MQOperation.Kind,description:this.description,channel:this.channel,type:this.type.name?this.type.name:this.type.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0,response:(t=this.response)==null?void 0:t.toJSON()});if(this.headers.length){e.headers=[];for(let r of this.headers)e.headers.push(r.toJSON())}return e}generateCodec(e,t,r){var i;return((i=this.type)==null?void 0:i.generateCodec(e,t,{...r,designType:this.designType}))||Ha.isAny()}generateKeyCodec(e,t,r){var i;return((i=this.keyType)==null?void 0:i.generateCodec(e,t,{...r,designType:this.keyDesignType}))||Ha.isAny()}};a(Ls,"MQOperationClass");var Ps=Ls;wr.prototype=Ps.prototype;wr[w]=Er;import{omitUndefined as uf}from"@jsopen/objects";var ks=class ks extends A{constructor(e,t){super(e),this.headers=[],this.channel=t==null?void 0:t.channel,this.description=t==null?void 0:t.description,t!=null&&t.type?this.type=(t==null?void 0:t.type)instanceof T?t.type:this.owner.node.getDataType(t.type):this.type=this.owner.node.getDataType("any"),t!=null&&t.keyType&&(this.keyType=(t==null?void 0:t.keyType)instanceof T?t.keyType:this.owner.node.getDataType(t.keyType)),this.designType=t==null?void 0:t.designType,this.keyDesignType=t==null?void 0:t.keyDesignType}findHeader(e){let t=e.toLowerCase(),r;for(r of this.headers)if(typeof r.name=="string"&&(r._nameLower=r._nameLower||r.name.toLowerCase(),r._nameLower===t)||r.name instanceof RegExp&&r.name.test(e))return r}toJSON(){let e=uf({description:this.description,channel:this.channel,type:this.type.name?this.type.name:this.type.toJSON(),keyType:this.keyType?this.keyType.name?this.keyType.name:this.keyType.toJSON():void 0});if(this.headers.length){e.headers=[];for(let t of this.headers)e.headers.push(t.toJSON())}return e}};a(ks,"MQOperationResponse");var oi=ks;var js=class js{static async createApi(e,t){let r=new it(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(t.controllers))for(let i of t.controllers){let n=await this._createController(e,r,i);n&&r.controllers.set(n.name,n)}else for(let[i,n]of Object.entries(t.controllers)){let s=await this._createController(e,r,n,i);s&&r.controllers.set(s.name,s)}}),r}static async _createController(e,t,r,i){typeof r=="function"&&!df(r)&&(r=r()),r=await Z(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(pe,r),!s)return e.addError(`Class "${r.name}" doesn't have a valid MQController metadata`);n=r}else n=Object.getPrototypeOf(r).constructor,s=Reflect.getMetadata(pe,n),s?p=r:(s=r,r.instance==="object"&&(p=r.instance,n=Object.getPrototypeOf(p).constructor));if(!s)return e.addError(`Class "${n.name}" is not decorated with MQController()`);if(i=i||s.name,!i)throw new TypeError("Controller name required");let c=new st(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,c,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let l=0;for(let x of s.headers)await e.enterAsync(`[${l++}]`,async()=>{let g={...x};await e.enterAsync(".type",async()=>{x.type&&(g.type=c.node.findDataType(x.type)),!g.type&&typeof x.type=="object"&&(g.type=await S.createDataType(e,c,x.type)),g.type||(g.type=c.node.getDataType("any"))});let h=new gr(c,g);c.headers.push(h)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,x]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let g=new wr(c,{...x,name:l,types:void 0,type:void 0,keyType:void 0});await this._initMQOperation(e,g,x),c.operations.set(g.name,g)})}),c}static async _initMQOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,t,r.types)}),t.type=await S.resolveDataType(e,t,r.type),r.keyType&&(t.keyType=await S.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await S.resolveDataType(e,t,n.type)});let p=new gr(t,s);t.headers.push(p)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new oi(t,{...r.response,type:void 0,keyType:void 0});await this._initMQOperationResponse(e,i,r.response),t.response=i})}static async _initMQOperationResponse(e,t,r){t.type=await S.resolveDataType(e,t,r.type),r.keyType&&(t.keyType=await S.resolveDataType(e,t,r.keyType)),r.headers&&await e.enterAsync(".headers",async()=>{let i=0;for(let n of r.headers)await e.enterAsync(`[${i++}]`,async()=>{let s={...n};await e.enterAsync(".type",async()=>{s.type=await S.resolveDataType(e,t,n.type)});let p=new gr(t,s);t.headers.push(p)})})}};a(js,"MQApiFactory");var ni=js;import{isConstructor as _f}from"@jsopen/objects";import{omitUndefined as hf}from"@jsopen/objects";import{asMutable as yf}from"ts-gems";var Yt=a(function(...o){var i;if(!this)return Yt[w].apply(void 0,o);let[e,t]=o;if(A.call(this,e),!P.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=yf(this);r.kind=f.WSController.Kind,r.types=r.node[L]=new V,r.operations=new N,r.name=t.name,r.description=t.description,r.instance=t.instance,r.ctor=t.ctor,r._controllerReverseMap=new WeakMap,(i=r._initialize)==null||i.call(r,t)},"WSController"),Us=class Us extends A{toString(){return`[WSController ${this.name}]`}toJSON(){let e=hf({kind:this.kind,description:this.description});if(this.operations.size){e.operations={};for(let t of this.operations.values())e.operations[t.name]=t.toJSON()}if(this.types.size){e.types={};for(let t of this.types.values())e.types[t.name]=t.toJSON()}return e}[Me](){return`[${ve}WSController${Fe+this.name+Ae}]`}};a(Us,"WSControllerClass");var Cs=Us;Yt.prototype=Cs.prototype;Object.assign(Yt,Vt);Yt[w]=Vt;import{omitUndefined as Tf}from"@jsopen/objects";import{asMutable as Ef}from"ts-gems";var Ar=a(function(...o){if(!this){let[i,n]=o,s=[];return Ar[w].call(void 0,s,i,n)}let[e,t]=o;if(A.call(this,e),!P.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Ef(this);r.types=r.node[L]=new V,r.name=t.name,r.description=t.description,t.event?this.event=t.event instanceof RegExp?t.event:t.event.startsWith("/")?Ue(t.event):t.event:r.event=this.name,t!=null&&t.arguments&&(r.arguments=t.arguments.map(i=>i instanceof T?i:r.owner.node.getDataType(i))),t!=null&&t.response&&(r.response=t.response instanceof T?t.response:r.owner.node.getDataType(t.response))},"WSOperation"),qs=class qs extends A{toJSON(){var e;return Tf({kind:f.WSOperation.Kind,description:this.description,event:this.event,arguments:(e=this.arguments)==null?void 0:e.map(t=>t.name?t.name:t.toJSON())})}};a(qs,"WSOperationClass");var $s=qs;Ar.prototype=$s.prototype;Ar[w]=_r;var Bs=class Bs{static async createApi(e,t){let r=new ot(t);return t.controllers&&await e.enterAsync(".controllers",async()=>{if(Array.isArray(t.controllers))for(let i of t.controllers){let n=await this._createController(e,r,i);n&&r.controllers.set(n.name,n)}else for(let[i,n]of Object.entries(t.controllers)){let s=await this._createController(e,r,n,i);s&&r.controllers.set(s.name,s)}}),r}static async _createController(e,t,r,i){typeof r=="function"&&!_f(r)&&(r=r()),r=await Z(r);let n,s,p;if(typeof r=="function"){if(s=Reflect.getMetadata(ce,r),!s)return e.addError(`Class "${r.name}" doesn't have a valid WSController metadata`);n=r}else n=Object.getPrototypeOf(r).constructor,s=Reflect.getMetadata(ce,n),s?p=r:(s=r,r.instance==="object"&&(p=r.instance,n=Object.getPrototypeOf(p).constructor));if(!s)return e.addError(`Class "${n.name}" is not decorated with WSController()`);if(i=i||s.name,!i)throw new TypeError("Controller name required");let c=new Yt(t,{...s,name:i,instance:p,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,c,s.types)}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[l,x]of Object.entries(s.operations))await e.enterAsync(`[${l}]`,async()=>{let g=Reflect.getMetadata(Xt,n.prototype,l),h=x;g&&(h={...h,arguments:g});let B=new Ar(c,{...h,name:l,types:void 0,type:void 0,keyType:void 0,arguments:void 0});await this._initWSOperation(e,B,h),c.operations.set(l,B)})}),c}static async _initWSOperation(e,t,r){var i;r.types&&await e.enterAsync(".types",async()=>{await S.addDataTypes(e,t,r.types)}),(i=r.arguments)!=null&&i.length&&await e.enterAsync(".arguments",async()=>{var n;t.arguments=[];for(let s of r.arguments){let p=await S.resolveDataType(e,t,s);(n=t.arguments)==null||n.push(p)}}),r.response&&await e.enterAsync(".response",async()=>{t.response=await S.resolveDataType(e,t,r.response)})}};a(Bs,"WSApiFactory");var si=Bs;var xf="https://oprajs.com/spec/v"+f.SpecVersion,ai=class ai{constructor(){this._allDocuments={}}static async createDocument(e,t){let r=new ai,i=t instanceof Te?t:new Te(t);try{let n=new nt;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof Dt||i.addError(n)}catch{}if(!i.error.message){let s=i.error.details.length;i.error.message=`(${s}) error${s>1?"s":""} found in document schema.`,i.showErrorDetails&&(i.error.message+=i.error.details.map(p=>`
|
|
10
10
|
|
|
11
11
|
- ${p.message}`+(p.path?`
|
|
12
|
-
@${p.path}`:"")).join(""))}throw i.error}}async initDocument(e,t,r){let i;if(typeof r=="string"){if(i=await(await fetch(r,{method:"GET"})).json(),!i)return t.addError(`Invalid response returned from url: ${r}`);i.url=r}else i=r;let n;if(!e[
|
|
12
|
+
@${p.path}`:"")).join(""))}throw i.error}}async initDocument(e,t,r){let i;if(typeof r=="string"){if(i=await(await fetch(r,{method:"GET"})).json(),!i)return t.addError(`Invalid response returned from url: ${r}`);i.url=r}else i=r;let n;if(!e[Be]){let s=e.node.findDataType("string");n=s==null?void 0:s.node.getDocument(),n||(n=await this.createBuiltinDocument(t),e.references.set("opra",n))}i.spec=i.spec||f.SpecVersion,e.url=i.url,i.info&&(e.info={...i.info}),i.references&&await t.enterAsync(".references",async()=>{let s,p;for([s,p]of Object.entries(i.references))p=await Z(p),await t.enterAsync(`[${s}]`,async()=>{if(!P.test(s))throw new TypeError(`Invalid namespace (${s})`);if(p instanceof nt){e.references.set(s,p);return}let c=new nt;n&&c.references.set("opra",n),await this.initDocument(c,t,p),e.references.set(s,this._allDocuments[c.id])})}),i.types&&await t.enterAsync(".types",async()=>{await S.addDataTypes(t,e,i.types)}),i.api&&await t.enterAsync(".api",async()=>{if(i.api&&i.api.transport==="http"){let s=await Jt.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="mq"){let s=await ni.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="ws"){let s=await si.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else t.addError(`Unknown service transport (${i.api.transport})`)}),e.invalidate(),this._allDocuments[e.id]||(this._allDocuments[e.id]=e)}async createBuiltinDocument(e){let t={spec:f.SpecVersion,url:xf,info:{version:f.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[...Object.values(es),...Object.values($n)]},r=new nt;r[Be]=!0;let i=Object.getPrototypeOf(BigInt(0)).constructor,n=Object.getPrototypeOf(Buffer.from([])),s=r.types[Sr];return s.set(Object,"object"),s.set(String,"string"),s.set(Number,"number"),s.set(Boolean,"boolean"),s.set(Object,"any"),s.set(Date,"datetime"),s.set(i,"bigint"),s.set(ArrayBuffer,"base64"),s.set(n,"base64"),await this.initDocument(r,e,t),r}};a(ai,"ApiDocumentFactory");var ep=ai;var tp;(function(o){o.HttpApiFactory=Jt,o.DataTypeFactory=S,o.MQOperationDecoratorFactory=Er,o.MQControllerDecoratorFactory=Kt,o.WSOperationDecoratorFactory=_r,o.WSControllerDecoratorFactory=Vt})(tp||(tp={}));import{uid as $A}from"uid";export{Vn as AnyType,je as ApiBase,nt as ApiDocument,ep as ApiDocumentFactory,C as ApiField,de as ArrayType,Be as BUILTIN,Js as BadRequestError,dn as Base64Type,sp as BaseI18n,Qn as BigintType,Gn as BooleanType,P as CLASS_NAME_PATTERN,ie as ComplexType,Ys as ConflictError,d as DATATYPE_METADATA,E as DECODER,w as DECORATOR,T as DataType,V as DataTypeMap,lr as DateTimeType,fr as DateTimeTypeTz,cr as DateType,A as DocumentElement,Te as DocumentInitContext,zr as DocumentNode,O as ENCODER,te as EmailType,ee as EnumType,Qs as FailedDependencyError,J as FieldPathType,Ke as FieldsProjection,Xe as FilterType,br as ForbiddenError,ae as HTTP_CONTROLLER_METADATA,tt as HttpApi,se as HttpController,Gs as HttpHeaderCodes,Ce as HttpMediaType,ti as HttpMultipartField,b as HttpOperation,ri as HttpOperationResponse,Or as HttpParameter,ii as HttpRequestBody,R as HttpStatusCode,tm as HttpStatusMessages,xr as HttpStatusRange,Gt as I18n,Ut as IntegerType,Xs as InternalServerError,sa as IssueSeverity,it as MQApi,st as MQController,gr as MQHeader,wr as MQOperation,pe as MQ_CONTROLLER_METADATA,et as MappedType,Zs as MethodNotAllowedError,D as MimeTypes,Wt as MixinType,pa as NAMESPACE_PATTERN,Hs as NotAcceptableError,ea as NotFoundError,Zn as NullType,Re as NumberType,bn as ObjectIdType,Hn as ObjectType,IO as OmitType,oe as OperationResult,Dt as OpraDocumentError,xe as OpraException,mr as OpraFilter,M as OpraHttpError,f as OpraSchema,ur as PartialDateType,jO as PartialType,ta as PermissionError,qO as PickType,yu as RPC_CONTROLLER_METADATA,WO as RequiredType,ra as ResourceConflictError,ia as ResourceNotAvailableError,N as ResponsiveMap,u as SimpleType,He as StringType,dr as TimeType,oa as UnauthorizedError,zt as UnionType,na as UnprocessableEntityError,Un as UrlType,Xr as UuidType,ot as WSApi,Yt as WSController,Ar as WSOperation,ce as WS_CONTROLLER_METADATA,Xt as WS_PARAM_METADATA,QO as WsParam,tp as classes,F as cloneObject,fu as getErrorStack,lu as getStackFileName,ci as i18n,Nr as inheritPropertyInitializers,Iu as isBlob,Pu as isFormData,Mu as isReadable,Fu as isReadableStream,Ni as isStream,Lu as isURL,vu as isWritable,Sr as kCtorMap,L as kDataTypeMap,De as kTypeNSMap,Dr as mergePrototype,ma as parse,fa as parseFieldsProjection,Z as resolveThunk,Du as safeJsonStringify,Mf as translate,$A as uid};
|