@opra/common 1.25.2 → 1.25.4

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.js CHANGED
@@ -3,9 +3,9 @@
3
3
  * http://www.panates.com
4
4
  *****************************************/
5
5
 
6
- var ci=Object.defineProperty;var Qa=(o,e,t)=>e in o?ci(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var a=(o,e)=>ci(o,"name",{value:e,configurable:!0});var br=(o,e)=>{for(var t in e)ci(o,t,{get:e[t],enumerable:!0})};var p=(o,e,t)=>Qa(o,typeof e!="symbol"?e+"":e,t);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 Pp}from"@jsopen/objects";import{isString as Fp}from"valgen";import{omitUndefined as rp}from"@jsopen/objects";import Xa from"@browsery/i18next";import{splitString as Za,tokenize as Bs}from"fast-tokenizer";var Ya=/\\(.)/g,Ga=/(\\)/g;function $s(o){return o.replace(Ga,"\\\\")}a($s,"escapeString");function qs(o){return o.replace(Ya,"$1")}a(qs,"unescapeString");var Ha=Object.getPrototypeOf(Xa.createInstance()).constructor,Yt=class Yt extends Ha{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",(c,l)=>c.toLocaleLowerCase(l)),s.add("uppercase",(c,l)=>c.toLocaleUpperCase(l)),s.add("upperFirst",(c,l)=>c.charAt(0).toLocaleUpperCase(l)+c.substring(1)),r!=null&&r.resources)for(let c of Object.keys(r.resources)){let l=r.resources[c];for(let m of Object.keys(l))this.addResourceBundle(c,m,l[m],!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 Yt(e,t)}static createInstance(e,t){return new Yt(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 Bs(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=Za(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),c=qs(n.substring((s[0]||"").length+1));n=s[0]||"";let l=[],m=null;for(let g of Bs(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(g.startsWith("{")){m=JSON.parse(g);continue}l.push(g)}let T=l.length>1?"$t("+l.join(",")+")":l[0];i+=c?this.t(T,c,{...r,...m}):this.t(T,{...r,...m});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,c=n.length;s<c;s++){let l=n[s];i[l]=this._deepTranslate(e[l],t,r)}return t.delete(e),i}return e}static get defaultInstance(){return ep}};a(Yt,"I18n");var Gt=Yt,ep=Gt.createInstance();var tp=/(\))/g;function Af(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?"?"+$s(i).replace(tp,"\\$1"):"")+")"}a(Af,"translate");var li=Gt.createInstance();li.init().catch(()=>{});var fi=class fi extends Error{constructor(t,r){super("Unknown error");p(this,"cause");p(this,"severity","error");p(this,"system");p(this,"code");p(this,"details");r=r||(t instanceof Error?t:void 0),t instanceof Error&&(r=t),r&&r instanceof Error&&(this.cause=r,r.stack&&(this.stack=r.stack)),typeof t=="string"?this.initString(t):t instanceof Error?this.initError(t):this.init(t),this.message=this.message||this.constructor.name}toString(){return li.deep(this.message)}toJSON(){return rp({message:this.message,severity:this.severity,system:this.system,code:this.code,details:this.details,stack:this.stack},!0)}init(t){this.message=(t==null?void 0:t.message)||this.constructor.name,this.severity=(t==null?void 0:t.severity)||"error",t&&(this.system=t.system,this.code=t.code,this.details=t.details)}initString(t){this.init({message:String(t||"")||this.constructor.name,severity:"error",code:this.constructor.name})}initError(t){let r="production";this.init({message:t.message,severity:t.severity||"error",code:t.code||t.constructor.name,stack:r==="dev"||r==="development"||r==="test"?t.stack:void 0})}};a(fi,"OpraException");var Ee=fi;var mi=class mi extends Ee{constructor(t,r,i){super(t,r instanceof Error?r:void 0);p(this,"status");this.status=(typeof r=="number"?r:Number(i))||500}setStatus(t){return this.status=t,this}initError(t){typeof t.status=="number"?this.status=t.status:typeof t.getStatus=="function"&&(this.status=t.getStatus()),super.initError(t)}};a(mi,"OpraHttpError");var v=mi;var ui=class ui extends v{constructor(){super(...arguments);p(this,"status",400)}init(t){super.init({message:"Bad request",code:"BAD_REQUEST",...t})}};a(ui,"BadRequestError");var Ks=ui;var di=class di extends v{constructor(){super(...arguments);p(this,"status",409)}init(t){super.init({message:"Conflict",code:"CONFLICT",...t})}};a(di,"ConflictError");var Vs=di;var hi=class hi extends v{constructor(){super(...arguments);p(this,"status",424)}init(t){super.init({message:"The request failed due to failure of a previous request",code:"FAILED_DEPENDENCY",...t})}};a(hi,"FailedDependencyError");var Ws=hi;var zs;(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"})(zs||(zs={}));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 Qf={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 b;(function(o){o.json="application/json",o.xml="application/xml",o.yaml="text/yaml",o.yaml2="application/yaml",o.toml="text/toml",o.toml2="application/toml",o.text="text/plain",o.html="text/html",o.markdown="text/markdown",o.binary="binary/octet-stream",o.opra_response_json="application/opra.response+json",o.opra_response_xml="application/opra.response+xml",o.opra_response_yaml="text/opra.response+yaml",o.opra_response_toml="text/opra.response+toml"})(b||(b={}));var yi=class yi extends v{constructor(){super(...arguments);p(this,"status",R.FORBIDDEN)}init(t){super.init({message:"You are not authorized to perform this action",code:"FORBIDDEN",...t})}};a(yi,"ForbiddenError");var Dr=yi;var Ti=class Ti extends v{constructor(){super(...arguments);p(this,"status",500)}init(t){super.init({message:"Internal server error",code:"INTERNAL_SERVER_ERROR",severity:"fatal",...t})}};a(Ti,"InternalServerError");var Js=Ti;var Ei=class Ei extends v{constructor(){super(...arguments);p(this,"status",405)}init(t){super.init({message:"Method not allowed",code:"METHOD_NOT_ALLOWED",...t})}};a(Ei,"MethodNotAllowedError");var Qs=Ei;var _i=class _i extends v{constructor(){super(...arguments);p(this,"status",406)}init(t){super.init({message:"Not Acceptable",code:"NOT_ACCEPTABLE",...t})}};a(_i,"NotAcceptableError");var Ys=_i;var xi=class xi extends v{constructor(){super(...arguments);p(this,"status",404)}init(t){super.init({message:"Not found",code:"NOT_FOUND",...t})}};a(xi,"NotFoundError");var Gs=xi;var gi=class gi extends Dr{init(e){super.init({message:"You dont have permission for this operation",code:"PERMISSION_ERROR",...e})}};a(gi,"PermissionError");var Xs=gi;var wi=class wi extends v{constructor(t,r,i){super({message:`There is already an other "${t}" resource with same values for field(s) [${r}]`,severity:"error",code:"RESOURCE_CONFLICT",details:{resource:t,location:r}},i);p(this,"status",409)}};a(wi,"ResourceConflictError");var Zs=wi;var Ai=class Ai extends v{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(Ai,"ResourceNotAvailableError");var Hs=Ai;var Oi=class Oi extends v{constructor(){super(...arguments);p(this,"status",401)}init(t){super.init({message:"You don't have permission to perform this action",code:"UNAUTHORIZED",...t})}};a(Oi,"UnauthorizedError");var ea=Oi;var Ri=class Ri extends v{constructor(){super(...arguments);p(this,"status",422)}init(t){super.init({message:"Unprocessable entity",severity:"error",code:"UNPROCESSABLE_ENTITY",...t})}};a(Ri,"UnprocessableEntityError");var ta=Ri;var ra;(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"}})(ra||(ra={}));BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});import{isConstructor as ip}from"@jsopen/objects";import op from"putil-promisify";async function Z(o){return o=op.isPromise(o)?await o:o,typeof o=="function"?ip(o)?o:await o():o}a(Z,"resolveThunk");var ia=/^(?:file:\/\/)?(.+)$/;function iu(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?ia.exec(r):void 0;return i?i[1]:""}return""}a(iu,"getStackFileName");function ou(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?ia.exec(r):void 0;return i?i[1]:""}return""}a(ou,"getErrorStack");function Nr(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(Nr,"mergePrototype");function Sr(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(Sr,"inheritPropertyInitializers");import{isPlainObject as na,merge as np}from"@jsopen/objects";var y=Symbol.for("opra.type.metadata"),se=Symbol("opra.http-controller.metadata"),ae=Symbol("opra.mq-controller.metadata"),pe=Symbol("opra.ws-controller.metadata"),Xt=Symbol("opra.ws-param.metadata"),cu=Symbol("opra.rpc-controller.metadata"),x=Symbol.for("opra.type.decoder"),w=Symbol("opra.type.encoder"),A=Symbol.for("DECORATOR"),Ke=Symbol.for("BUILTIN"),oa=/([a-z$_]\w+):(.+)/i,F=/^[a-z][\w_]*$/i,k=Symbol.for("kDataTypeMap"),Mr=Symbol.for("kCtorMap"),be=Symbol.for("kTypeNSMap");function L(o,e){return np({},o,{deep:a(t=>na(t)&&!t[y],"deep"),symbolKeys:!0,copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||na(i)||Array.isArray(i))}})}a(L,"cloneObject");import{splitString as sa}from"fast-tokenizer";var sp=/^([+-])?([a-z_$]\w*)$/i,ap=/[^.]\(/g,bi=class bi{};a(bi,"FieldsProjection");var Ve=bi;(function(o){let t=class t{constructor(){p(this,"sign");p(this,"projection")}};a(t,"Item");let e=t;o.Item=e})(Ve||(Ve={}));function aa(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new Ve;for(let i of t)e||(i=i.toLowerCase()),pa(i,r);return r}a(aa,"parseFieldsProjection");function pa(o,e){o=o.replace(ap,r=>r.charAt(0)+"."+r.substring(1));let t=sa(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let l=sa(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let m of l)pa(m,e);continue}let n=sp.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],c=e[s]=e[s]||new Ve.Item;n[1]&&(c.sign=n[1]),r===t.length-1?delete c.projection:e=c.projection=c.projection||new Ve}}a(pa,"parse");function pp(o){return o&&typeof o.forEach=="function"}a(pp,"isMap");var Q=Symbol.for("kEntries"),ce=Symbol.for("kKeyMap"),vr=Symbol.for("kWellKnownKeys"),Di=Symbol.for("kOptions"),pt=Symbol.for("kSize"),Ni=class Ni{constructor(e,t){Object.defineProperty(this,pt,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,Q,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ce,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,vr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,Di,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[vr][i]=i:this[vr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[pt]}clear(){Object.keys(this[Q]).forEach(e=>delete this[Q][e]),Object.keys(this[ce]).forEach(e=>delete this[ce][e]),this[pt]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[Q][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[Q],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[Q],r);return this[Q][r]=t,i||this[pt]++,this[ce][r]=e,this}setAll(e){return pp(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[Q])[Symbol.iterator]()}entries(){return Object.entries(this[Q])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[Q],t);return delete this[Q][t],delete this[ce][t],r||this[pt]--,r}sort(e){let t={...this[Q]},r={...this[ce]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[Q][n]=t[n],this[ce][n]=r[n];return this[pt]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[ce]))e[r]=this[Q][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[Di].caseSensitive)return e;let t=this._getStoringKey(e);return this[ce][t]??this[vr][t]??e}_getStoringKey(e){return this[Di].caseSensitive?e:e.toLowerCase()}};a(Ni,"ResponsiveMap");var S=Ni;function xu(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(xu,"safeJsonStringify");function Si(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(Si,"isStream");function Au(o){return Si(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(Au,"isReadable");function Ou(o){return Si(o)&&typeof o._write=="function"}a(Ou,"isWritable");function Ru(o){return Si(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Ru,"isReadableStream");function bu(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(bu,"isBlob");function Du(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(Du,"isFormData");function Nu(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(Nu,"isURL");var Mi=class Mi{constructor(){p(this,"kind");this.kind=Object.getPrototypeOf(this).constructor.name}};a(Mi,"Ast");var Zt=Mi;var vi=class vi extends Zt{};a(vi,"Expression");var q=vi;var Ii=class Ii extends q{};a(Ii,"Term");var We=Ii;var ki=class ki extends We{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(ki,"Literal");var P=ki;var Li=class Li extends q{constructor(){super();p(this,"items",[])}append(t,r){return this.items.push(new Ir({op:t,expression:r})),this}toString(){return this.items.map((t,r)=>(r>0?t.op:"")+t.expression).join("")}};a(Li,"ArithmeticExpression");var ze=Li,Pi=class Pi{constructor(e){p(this,"op");p(this,"expression");Object.assign(this,e)}};a(Pi,"ArithmeticExpressionItem");var Ir=Pi;var Fi=class Fi extends We{constructor(t){super();p(this,"items");this.items=t}toString(){return"["+this.items.map(t=>""+t).join(",")+"]"}};a(Fi,"ArrayExpression");var _e=Fi;var cp=/\w/,ji=class ji extends q{constructor(t){super();p(this,"op");p(this,"left");p(this,"right");p(this,"prepare");Object.assign(this,t)}toString(){return`${this.left}${cp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(ji,"ComparisonExpression");var le=ji;var Ci=class Ci extends q{constructor(t){super();p(this,"op");p(this,"items");Object.assign(this,t),this.op==="&&"&&(this.op="and"),this.op==="||"&&(this.op="or")}toString(){return this.items.map(t=>""+t).join(" "+this.op+" ")}};a(Ci,"LogicalExpression");var fe=Ci;var Ui=class Ui extends q{constructor(t){super();p(this,"expression");this.expression=t}toString(){return`(${this.expression})`}};a(Ui,"NegativeExpression");var Ht=Ui;var $i=class $i extends q{constructor(t){super();p(this,"expression");this.expression=t}toString(){return`(${this.expression})`}};a($i,"ParenthesizedExpression");var xe=$i;var qi=class qi extends P{constructor(e){super(e)}};a(qi,"BooleanLiteral");var Je=qi;import{toDateDef as hp}from"putil-varhelpers";var Bi=class Bi extends TypeError{};a(Bi,"SyntaxError");var kr=Bi,Ki=class Ki extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(Ki,"FilterValidationError");var me=Ki,Vi=class Vi extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(Vi,"FilterParseError");var Lr=Vi;var lp=/'/g,fp=/(\\)/g,mp=/\\(.)/g;function up(o){return o.replace(fp,"\\\\")}a(up,"escapeString");function dp(o){return o.replace(mp,"$1")}a(dp,"unescapeString");function De(o){return"'"+up(o).replace(lp,"\\'")+"'"}a(De,"quoteFilterString");function er(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?dp(o.substring(1,o.length-1)):o}a(er,"unquoteFilterString");var ca=new Date(0),Wi=class Wi extends P{constructor(t){super("");p(this,"value");if(t instanceof Date){this.value=t.toISOString();return}if(typeof t=="string"&&hp(t,ca)!==ca){this.value=t;return}throw new me(`Invalid date value "${t}"`)}toString(){return De(this.value)}};a(Wi,"DateLiteral");var Ne=Wi;import{toDateDef as yp}from"putil-varhelpers";var la=new Date(0),zi=class zi extends P{constructor(t){super("");p(this,"value");if(t instanceof Date){this.value=t.toISOString();return}if(typeof t=="string"&&yp(t,la)!==la){this.value=t;return}throw new me(`Invalid date-time value "${t}"`)}toString(){return De(this.value)}};a(zi,"DateTimeLiteral");var tr=zi;var Ji=class Ji extends P{constructor(){super(null);p(this,"value",null)}};a(Ji,"NullLiteral");var Qe=Ji;var Qi=class Qi extends P{constructor(t){super(0);p(this,"value");if(typeof t=="number"||typeof t=="bigint"){this.value=t;return}try{if(typeof t=="string"){if(t.includes(".")){this.value=parseFloat(t);return}let r=Number(t);""+r===t?this.value=r:this.value=BigInt(t);return}}catch{}throw new me(`Invalid number literal ${t}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(Qi,"NumberLiteral");var ge=Qi;var Yi=class Yi extends P{constructor(e){super(""+e)}};a(Yi,"QualifiedIdentifier");var H=Yi;var Gi=class Gi extends P{constructor(e){super(""+e)}toString(){return De(this.value)}};a(Gi,"StringLiteral");var Ye=Gi;var Tp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,Xi=class Xi extends P{constructor(t){super("");p(this,"value");if(t instanceof Date){this.value=Pr(t.getHours())+":"+Pr(t.getMinutes())+(t.getSeconds()?":"+Pr(t.getSeconds()):"")+(t.getMilliseconds()?"."+Pr(t.getMilliseconds()):"");return}if(typeof t=="string"&&Tp.test(t)){this.value=t;return}throw new me(`Invalid time value "${t}"`)}toString(){return De(this.value)}};a(Xi,"TimeLiteral");var Ge=Xi;function Pr(o){return o<=9?"0"+o:""+o}a(Pr,"pad");import{CharStream as kp,CommonTokenStream as Lp}from"@browsery/antlr4";import{ATNDeserializer as Ep,DFA as _p,Lexer as xp,LexerATNSimulator as gp,PredictionContextCache as wp,Token as Ap}from"@browsery/antlr4";var h=class h extends xp{constructor(e){super(e),this._interp=new gp(this,h._ATN,h.DecisionsToDFA,new wp)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return h.literalNames}get symbolicNames(){return h.symbolicNames}get ruleNames(){return h.ruleNames}get serializedATN(){return h._serializedATN}get channelNames(){return h.channelNames}get modeNames(){return h.modeNames}static get _ATN(){return h.__ATN||(h.__ATN=new Ep().deserialize(h._serializedATN)),h.__ATN}};a(h,"OpraFilterLexer"),p(h,"T__0",1),p(h,"T__1",2),p(h,"T__2",3),p(h,"T__3",4),p(h,"T__4",5),p(h,"T__5",6),p(h,"T__6",7),p(h,"T__7",8),p(h,"T__8",9),p(h,"T__9",10),p(h,"T__10",11),p(h,"T__11",12),p(h,"T__12",13),p(h,"T__13",14),p(h,"T__14",15),p(h,"T__15",16),p(h,"T__16",17),p(h,"T__17",18),p(h,"T__18",19),p(h,"T__19",20),p(h,"T__20",21),p(h,"T__21",22),p(h,"T__22",23),p(h,"T__23",24),p(h,"T__24",25),p(h,"T__25",26),p(h,"T__26",27),p(h,"T__27",28),p(h,"T__28",29),p(h,"T__29",30),p(h,"T__30",31),p(h,"T__31",32),p(h,"T__32",33),p(h,"T__33",34),p(h,"IDENTIFIER",35),p(h,"POLAR_OP",36),p(h,"DATE",37),p(h,"DATETIME",38),p(h,"TIME",39),p(h,"NUMBER",40),p(h,"INTEGER",41),p(h,"STRING",42),p(h,"WHITESPACE",43),p(h,"EOF",Ap.EOF),p(h,"channelNames",["DEFAULT_TOKEN_CHANNEL","HIDDEN"]),p(h,"literalNames",[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"]),p(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"]),p(h,"modeNames",["DEFAULT_MODE"]),p(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"]),p(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]),p(h,"__ATN"),p(h,"DecisionsToDFA",h._ATN.decisionToState.map((e,t)=>new _p(e,t)));var rr=h;import{ATN as fa,ATNDeserializer as Op,DFA as Rp,FailedPredicateException as bp,NoViableAltException as Zi,Parser as Dp,ParserATNSimulator as Np,ParserRuleContext as K,PredictionContextCache as Sp,RecognitionException as B,Token as Mp}from"@browsery/antlr4";var f=class f extends Dp{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return f.literalNames}get symbolicNames(){return f.symbolicNames}get ruleNames(){return f.ruleNames}get serializedATN(){return f._serializedATN}createFailedPredicateException(e,t){return new bp(this,e,t)}constructor(e){super(e),this._interp=new Np(this,f._ATN,f.DecisionsToDFA,new Sp)}root(){let e=new Hi(this,this._ctx,this.state);this.enterRule(e,0,f.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(f.EOF)}catch(t){if(t instanceof B)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,f.RULE_expression,e);let c;try{let l;this.enterOuterAlt(i,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:i=new ro(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 eo(this,i),this._ctx=i,n=i,this.state=42,this.match(f.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(f.T__1);break;case 3:case 4:i=new to(this,i),this._ctx=i,n=i,this.state=46,c=this._input.LA(1),c===3||c===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new Zi(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),l=this._interp.adaptivePredict(this._input,1,this._ctx);l!==2&&l!==fa.INVALID_ALT_NUMBER;){if(l===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new ir(this,new X(this,t,r)),this.pushNewRecursionContext(i,s,f.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),l=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(l){if(l instanceof B)i.exception=l,this._errHandler.reportError(this,l),this._errHandler.recover(this,l);else throw l}finally{this.unrollRecursionContexts(t)}return i}comparisonLeft(){let e=new Fr(this,this._ctx,this.state);this.enterRule(e,4,f.RULE_comparisonLeft);try{this.enterOuterAlt(e,1),this.state=59,this.qualifiedIdentifier()}catch(t){if(t instanceof B)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 jr(this,this._ctx,this.state);this.enterRule(e,6,f.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 Zi(this)}}catch(t){if(t instanceof B)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 Cr(this,this._ctx,this.state);this.enterRule(e,8,f.RULE_parenthesizedItem);try{this.enterOuterAlt(e,1),this.state=67,this.expression(0)}catch(t){if(t instanceof B)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 Y(this,this._ctx,this.state);this.enterRule(e,10,f.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new lo(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(f.NUMBER);break;case 13:case 14:e=new po(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new co(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new oo(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new no(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(f.DATETIME);break;case 37:e=new ao(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(f.DATE);break;case 39:e=new io(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(f.TIME);break;case 42:e=new so(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(f.STRING);break;default:throw new Zi(this)}}catch(t){if(t instanceof B)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 or(this,this._ctx,this.state);this.enterRule(e,12,f.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!==fa.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(f.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 B)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 Ur(this,this._ctx,this.state);this.enterRule(e,14,f.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(f.T__5),this.state=90,this.identifier()}catch(t){if(t instanceof B)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 ct(this,this._ctx,this.state);this.enterRule(e,16,f.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(f.IDENTIFIER)}catch(t){if(t instanceof B)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 $r(this,this._ctx,this.state);this.enterRule(e,18,f.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(f.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(f.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(f.T__8)}}catch(r){if(r instanceof B)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 qr(this,this._ctx,this.state);this.enterRule(e,20,f.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 B)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 Br(this,this._ctx,this.state);this.enterRule(e,22,f.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(f.T__11)}catch(t){if(t instanceof B)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 Kr(this,this._ctx,this.state);this.enterRule(e,24,f.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 B)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 fo(this,this._ctx,this.state);this.enterRule(e,26,f.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 B)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 Vr(this,this._ctx,this.state);this.enterRule(e,28,f.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 B)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 Wr(this,this._ctx,this.state);this.enterRule(e,30,f.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 B)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 mo(this,this._ctx,this.state);this.enterRule(e,32,f.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(f.POLAR_OP)}catch(t){if(t instanceof B)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){return t===1?this.expression_sempred(e,r):!0}expression_sempred(e,t){return t===0?this.precpred(this._ctx,3):!0}static get _ATN(){return f.__ATN||(f.__ATN=new Op().deserialize(f._serializedATN)),f.__ATN}};a(f,"OpraFilterParser"),p(f,"T__0",1),p(f,"T__1",2),p(f,"T__2",3),p(f,"T__3",4),p(f,"T__4",5),p(f,"T__5",6),p(f,"T__6",7),p(f,"T__7",8),p(f,"T__8",9),p(f,"T__9",10),p(f,"T__10",11),p(f,"T__11",12),p(f,"T__12",13),p(f,"T__13",14),p(f,"T__14",15),p(f,"T__15",16),p(f,"T__16",17),p(f,"T__17",18),p(f,"T__18",19),p(f,"T__19",20),p(f,"T__20",21),p(f,"T__21",22),p(f,"T__22",23),p(f,"T__23",24),p(f,"T__24",25),p(f,"T__25",26),p(f,"T__26",27),p(f,"T__27",28),p(f,"T__28",29),p(f,"T__29",30),p(f,"T__30",31),p(f,"T__31",32),p(f,"T__32",33),p(f,"T__33",34),p(f,"IDENTIFIER",35),p(f,"POLAR_OP",36),p(f,"DATE",37),p(f,"DATETIME",38),p(f,"TIME",39),p(f,"NUMBER",40),p(f,"INTEGER",41),p(f,"STRING",42),p(f,"WHITESPACE",43),p(f,"EOF",Mp.EOF),p(f,"RULE_root",0),p(f,"RULE_expression",1),p(f,"RULE_comparisonLeft",2),p(f,"RULE_comparisonRight",3),p(f,"RULE_parenthesizedItem",4),p(f,"RULE_value",5),p(f,"RULE_qualifiedIdentifier",6),p(f,"RULE_externalConstant",7),p(f,"RULE_identifier",8),p(f,"RULE_arrayValue",9),p(f,"RULE_boolean",10),p(f,"RULE_null",11),p(f,"RULE_infinity",12),p(f,"RULE_arithmeticOperator",13),p(f,"RULE_comparisonOperator",14),p(f,"RULE_logicalOperator",15),p(f,"RULE_polarityOperator",16),p(f,"literalNames",[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"]),p(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"]),p(f,"ruleNames",["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"]),p(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]),p(f,"__ATN"),p(f,"DecisionsToDFA",f._ATN.decisionToState.map((e,t)=>new Rp(e,t)));var N=f,uo=class uo extends K{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(X,0)}EOF(){return this.getToken(N.EOF,0)}get ruleIndex(){return N.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(uo,"RootContext");var Hi=uo,ho=class ho extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(ho,"ExpressionContext");var X=ho,yo=class yo extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(Cr,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(yo,"ParenthesizedExpressionContext");var eo=yo,To=class To 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(To,"NegativeExpressionContext");var to=To,Eo=class Eo extends X{constructor(t,r){super(t,r.parentCtx,r.invokingState);p(this,"_left");p(this,"_operator");p(this,"_right");super.copyFrom(r)}comparisonLeft(){return this.getTypedRuleContext(Fr,0)}comparisonOperator(){return this.getTypedRuleContext(Vr,0)}comparisonRight(){return this.getTypedRuleContext(jr,0)}enterRule(t){t.enterComparisonExpression&&t.enterComparisonExpression(this)}exitRule(t){t.exitComparisonExpression&&t.exitComparisonExpression(this)}accept(t){return t.visitComparisonExpression?t.visitComparisonExpression(this):t.visitChildren(this)}};a(Eo,"ComparisonExpressionContext");var ro=Eo,_o=class _o extends X{constructor(t,r){super(t,r.parentCtx,r.invokingState);p(this,"_op");super.copyFrom(r)}expression_list(){return this.getTypedRuleContexts(X)}expression(t){return this.getTypedRuleContext(X,t)}logicalOperator(){return this.getTypedRuleContext(Wr,0)}enterRule(t){t.enterLogicalExpression&&t.enterLogicalExpression(this)}exitRule(t){t.exitLogicalExpression&&t.exitLogicalExpression(this)}accept(t){return t.visitLogicalExpression?t.visitLogicalExpression(this):t.visitChildren(this)}};a(_o,"LogicalExpressionContext");var ir=_o,xo=class xo extends K{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(or,0)}get ruleIndex(){return N.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(xo,"ComparisonLeftContext");var Fr=xo,go=class go extends K{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(Y,0)}qualifiedIdentifier(){return this.getTypedRuleContext(or,0)}externalConstant(){return this.getTypedRuleContext(Ur,0)}arrayValue(){return this.getTypedRuleContext($r,0)}get ruleIndex(){return N.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(go,"ComparisonRightContext");var jr=go,wo=class wo extends K{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(X,0)}get ruleIndex(){return N.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(wo,"ParenthesizedItemContext");var Cr=wo,Ao=class Ao extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.RULE_value}copyFrom(e){super.copyFrom(e)}};a(Ao,"ValueContext");var Y=Ao,Oo=class Oo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(N.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(Oo,"TimeLiteralContext");var io=Oo,Ro=class Ro extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}null_(){return this.getTypedRuleContext(Br,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(Ro,"NullLiteralContext");var oo=Ro,bo=class bo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(N.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(bo,"DateTimeLiteralContext");var no=bo,Do=class Do extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(N.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(Do,"StringLiteralContext");var so=Do,No=class No extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(N.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(No,"DateLiteralContext");var ao=No,So=class So extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(Kr,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(So,"InfinityLiteralContext");var po=So,Mo=class Mo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(qr,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(Mo,"BooleanLiteralContext");var co=Mo,vo=class vo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(N.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(vo,"NumberLiteralContext");var lo=vo,Io=class Io extends K{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(ct)}identifier(e){return this.getTypedRuleContext(ct,e)}get ruleIndex(){return N.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(Io,"QualifiedIdentifierContext");var or=Io,ko=class ko extends K{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(ct,0)}get ruleIndex(){return N.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(ko,"ExternalConstantContext");var Ur=ko,Lo=class Lo extends K{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(N.IDENTIFIER,0)}get ruleIndex(){return N.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(Lo,"IdentifierContext");var ct=Lo,Po=class Po extends K{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(Y)}value(e){return this.getTypedRuleContext(Y,e)}get ruleIndex(){return N.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 $r=Po,Fo=class Fo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(Fo,"BooleanContext");var qr=Fo,jo=class jo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(jo,"NullContext");var Br=jo,Co=class Co extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(Co,"InfinityContext");var Kr=Co,Uo=class Uo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(Uo,"ArithmeticOperatorContext");var fo=Uo,$o=class $o extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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($o,"ComparisonOperatorContext");var Vr=$o,qo=class qo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(qo,"LogicalOperatorContext");var Wr=qo,Bo=class Bo extends K{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(N.POLAR_OP,0)}get ruleIndex(){return N.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(Bo,"PolarityOperatorContext");var mo=Bo;import{ParseTreeVisitor as vp}from"@browsery/antlr4";var Ko=class Ko extends P{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Ko,"ExternalConstant");var zr=Ko;var Vo=class Vo extends vp{constructor(t){super();p(this,"_timeZone");this._timeZone=t==null?void 0:t.timeZone}visitChildren(t){let r=super.visitChildren(t);return Array.isArray(r)&&r.length<2?r[0]:r??t.getText()}defaultResult(){}visitRoot(t){return this.visit(t.expression())}visitParenthesizedExpression(t){let r=this.visit(t.parenthesizedItem());return new xe(r)}visitParenthesizedItem(t){return this.visit(t.expression())}visitNegativeExpression(t){let r=this.visit(t.expression());return new Ht(r)}visitComparisonExpression(t){return new le({op:t.comparisonOperator().getText(),left:this.visit(t.comparisonLeft()),right:this.visit(t.comparisonRight())})}visitLogicalExpression(t){let r=[],i=a((n,s)=>{for(let c of n){if(c instanceof ir&&c.logicalOperator().getText()===s){i(c.expression_list(),c.logicalOperator().getText());continue}let l=this.visit(c);r.push(l)}},"wrapChildren");return i(t.expression_list(),t.logicalOperator().getText()),new fe({op:t.logicalOperator().getText(),items:r})}visitQualifiedIdentifier(t){return new H(t.getText())}visitExternalConstant(t){return new zr(t.identifier().getText())}visitNullLiteral(){return new Qe}visitBooleanLiteral(t){return new Je(t.getText()==="true")}visitNumberLiteral(t){return new ge(t.getText())}visitStringLiteral(t){return new Ye(er(t.getText()))}visitInfinityLiteral(){return new ge(1/0)}visitDateLiteral(t){return new Ne(er(t.getText()))}visitDateTimeLiteral(t){return new tr(er(t.getText()))}visitTimeLiteral(t){return new Ge(er(t.getText()))}visitArrayValue(t){return new _e(t.value_list().map(r=>this.visit(r)))}};a(Vo,"FilterTreeVisitor");var nr=Vo;import{ErrorListener as Ip}from"@browsery/antlr4";var Wo=class Wo extends Ip{constructor(t){super();p(this,"errors");this.errors=t}syntaxError(t,r,i,n,s,c){this.errors.push(new Lr(s,{recognizer:t,offendingSymbol:r,line:i,column:n,e:c}))}};a(Wo,"OpraErrorListener");var sr=Wo;function zo(o,e){let t=new kp(o),r=new rr(t),i=new Lp(r),n=new N(i);n.buildParseTrees=!0;let s=[],c=new sr(s);r.removeErrorListeners(),r.addErrorListener(c),n.removeErrorListeners(),n.addErrorListener(c);let l=n.root();if(s.length){let m=[];for(let g of s)m.push(g.message+(o.includes(`
7
- `)?" at line: "+g.line+" column: "+g.column:" at column: "+g.column));let T=new kr(m.join(`
8
- `));throw T.errors=s,T}return e=e||new nr,e.visit(l)}a(zo,"parse");var Jo=class Jo{constructor(e,t){p(this,"_rules",new S);p(this,"_decoderCache",new WeakMap);if(Object.defineProperty(this,"_rules",{value:new S(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,Pp({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?zo(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 ze)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 P){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 c;s.op==="like"||s.op==="!like"||s.op==="ilike"||s.op==="!ilike"?c=Fp:c=this._decoderCache.get(s.left.field),c||(c=s.left.field.generateCodec("decode",{scope:i,projection:"*",ignoreReadonlyFields:!0,coerce:!0}),this._decoderCache.set(s.left.field,c)),e.value=c(e.value,{coerce:!0})}}}return e}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};a(Jo,"FilterRules");var lt=Jo;import Hp from"object-hash";import{asMutable as ec}from"ts-gems";import{validator as tc,vg as G}from"valgen";import"reflect-metadata";import{omitUndefined as Gp}from"@jsopen/objects";import{asMutable as Xp}from"ts-gems";import{vg as Qr}from"valgen";var u={};br(u,{ArrayType:()=>ft,ComplexType:()=>mt,EnumType:()=>ut,HttpController:()=>ar,HttpOperation:()=>Qo,MQController:()=>Yo,MQOperation:()=>Go,MappedType:()=>dt,MixinType:()=>ht,SimpleType:()=>yt,SpecVersion:()=>ry,UnionType:()=>Tt,WSController:()=>Xo,WSOperation:()=>Zo,isArrayType:()=>Vp,isComplexType:()=>Cp,isDataType:()=>jp,isEnumType:()=>Bp,isHttpController:()=>Wp,isMappedType:()=>qp,isMixinType:()=>$p,isSimpleType:()=>Up,isUnionType:()=>Kp});var ry="1.0";var ft;(function(o){o.Kind="ArrayType"})(ft||(ft={}));var mt;(function(o){o.Kind="ComplexType"})(mt||(mt={}));var ut;(function(o){o.Kind="EnumType"})(ut||(ut={}));var dt;(function(o){o.Kind="MappedType"})(dt||(dt={}));var ht;(function(o){o.Kind="MixinType"})(ht||(ht={}));var yt;(function(o){o.Kind="SimpleType"})(yt||(yt={}));var Tt;(function(o){o.Kind="UnionType"})(Tt||(Tt={}));var ar;(function(o){o.Kind="HttpController"})(ar||(ar={}));var Qo;(function(o){o.Kind="HttpOperation"})(Qo||(Qo={}));var Yo;(function(o){o.Kind="MQController"})(Yo||(Yo={}));var Go;(function(o){o.Kind="MQOperation"})(Go||(Go={}));function jp(o){return o&&typeof o=="object"&&(o.kind===ft.Kind||o.kind===mt.Kind||o.kind===ut.Kind||o.kind===dt.Kind||o.kind===yt.Kind||o.kind===ht.Kind||o.kind===Tt.Kind)}a(jp,"isDataType");function Cp(o){return o&&typeof o=="object"&&o.kind===mt.Kind}a(Cp,"isComplexType");function Up(o){return o&&typeof o=="object"&&o.kind===yt.Kind}a(Up,"isSimpleType");function $p(o){return o&&typeof o=="object"&&o.kind===ht.Kind}a($p,"isMixinType");function qp(o){return o&&typeof o=="object"&&o.kind===dt.Kind}a(qp,"isMappedType");function Bp(o){return o&&typeof o=="object"&&o.kind===ut.Kind}a(Bp,"isEnumType");function Kp(o){return o&&typeof o=="object"&&o.kind===Tt.Kind}a(Kp,"isUnionType");function Vp(o){return o&&typeof o=="object"&&o.kind===ft.Kind}a(Vp,"isArrayType");function Wp(o){return o&&typeof o=="object"&&o.kind===ar.Kind}a(Wp,"isHttpController");var Xo;(function(o){o.Kind="WSController"})(Xo||(Xo={}));var Zo;(function(o){o.Kind="WSOperation"})(Zo||(Zo={}));import{omitUndefined as Qp}from"@jsopen/objects";import{asMutable as Yp}from"ts-gems";import{asMutable as zp}from"ts-gems";import{uid as Jp}from"uid";var ma;ma=k;var Ho=class Ho{constructor(e,t){p(this,ma);p(this,"_document");p(this,"parent");p(this,"element");this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[be])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[k])==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(y,e).name;else if(typeof e=="object"){let n=e[y];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===u.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===u.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===u.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===u.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===u.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===u.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===u.UnionType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a UnionType`)}};a(Ho,"DocumentNode");var Jr=Ho;var O=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=zp(this);e.id=Jp(16),Object.defineProperty(e,"node",{value:new Jr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),tn=class tn{};a(tn,"DocumentElementClass");var en=tn;O.prototype=en.prototype;var Se=Symbol.for("nodejs.util.inspect.custom"),we="\x1B[0m",Me="\x1B[33m",ve="\x1B[35m";function pr(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(pr,"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&&!F.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);O.call(this,o);let r=Yp(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"),on=class on extends O{get embedded(){return!this.name}inScope(e){return pr(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 Qp({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[Se](){return`[${Me+Object.getPrototypeOf(this).constructor.name+we} ${ve+this.name+we}]`}};a(on,"DataTypeClass");var rn=on;_.prototype=rn.prototype;var ue=a(function(...o){if(!this)return ue[A].apply(void 0,o);let[e,t,r]=o;_.call(this,e,t,r);let i=Xp(this);i.kind=u.ArrayType.Kind,i.type=t.type,i.minOccurs=t.minOccurs,i.maxOccurs=t.maxOccurs},"ArrayType"),sn=class sn extends _{toJSON(e){let t=super.toJSON(e),r=this.node.getDataTypeNameWithNs(this.type);return Gp({...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=Qr.isArray(i);let n=[];return this.minOccurs&&n.push(Qr.lengthMin(this.minOccurs)),this.maxOccurs&&n.push(Qr.lengthMax(this.maxOccurs)),n.length>0?Qr.pipe([i,...n],{returnIndex:0}):i}extendsFrom(){return!1}_locateBase(){}};a(sn,"ArrayTypeClass");var nn=sn;ue.prototype=nn.prototype;ue[A]=Zp;function Zp(o,e){let i=class i{};a(i,"ArrayClass");let t=i,r={...e,kind:u.ArrayType.Kind,type:o};return Reflect.defineMetadata(y,r,t),t}a(Zp,"ArrayTypeFactory");var Et=/^([+-])?([a-z$_][\w.]*)$/i,C=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=ec(this);i._fields=new S},"ComplexTypeBase"),pn=class pn extends _{constructor(){super(...arguments);p(this,"ctor");p(this,"additionalFields");p(this,"keyField")}fieldCount(t){if(t==="*")return this._fields.size;let r=0;for(let i of this.fields(t))r++;return r}fieldEntries(t){let r=this._fields.entries();if(t==="*")return r;let i;return{next(){for(;r&&(i=r.next(),!(i.done||i.value&&i.value[1].inScope(t))););return i.done?{done:i.done,value:void 0}:{done:i.done,value:[i.value[0],i.value[1].forScope(t)]}},return(n){return r=void 0,{done:!0,value:n}},[Symbol.iterator](){return this}}}fields(t){let r=this.fieldEntries(t),i;return{next(){var n;return r?(i=r.next(),{done:i.done,value:(n=i.value)==null?void 0:n[1]}):{done:!0,value:void 0}},return(n){return r=void 0,{done:!0,value:n}},[Symbol.iterator](){return this}}}fieldNames(t){if(t==="*")return this._fields.keys();let r=this.fieldEntries(t),i;return{next(){var n;return r?(i=r.next(),{done:i.done,value:(n=i.value)==null?void 0:n[0]}):{done:!0,value:void 0}},return(n){return r=void 0,{done:!0,value:n}},[Symbol.iterator](){return this}}}findField(t,r){if(t.includes(".")){let n=this.parseFieldPath(t,{scope:r});if(n.length===0)throw new Error(`Field "${t}" does not exist in scope "${r}"`);let s=n.pop();return s==null?void 0:s.field}let i=this._fields.get(t);if(i&&i.inScope(r))return i.forScope(r)}getField(t,r){let i=this.findField(t,"*");if(i&&!i.inScope(r))throw new Error(`Field "${t}" does not exist in scope "${r||"null"}"`);if(!i)throw new Error(`Field (${t}) does not exist`);return i.forScope(r)}parseFieldPath(t,r){var E,U,qe;let i=this,n,s=t.split("."),c=s.length,l=[],m=this.owner.node.getDataType("object"),T=r==null?void 0:r.allowSigns,g=a(()=>l.map(j=>j.fieldName).join("."),"getStrPath");for(let j=0;j<c;j++){let V={fieldName:s[j],dataType:m};l.push(V);let Be=Et.exec(s[j]);if(!Be)throw new TypeError(`Invalid field name (${g()})`);if(Be[1]&&((j===0&&T==="first"||T==="each")&&(V.sign=Be[1]),V.fieldName=Be[2]),i){if(i instanceof C){if(n=i.findField(V.fieldName,r==null?void 0:r.scope),n){V.fieldName=n.name,V.field=n,V.dataType=n.type,i=n.type;continue}if(((E=i.additionalFields)==null?void 0:E[0])===!0){V.additionalField=!0,V.dataType=m,i=void 0;continue}if(((U=i.additionalFields)==null?void 0:U[0])==="type"&&((qe=i.additionalFields)==null?void 0:qe[1])instanceof _){V.additionalField=!0,V.dataType=i.additionalFields[1],i=i.additionalFields[1];continue}throw new Error(`Unknown field (${l.map(pi=>pi.fieldName).join(".")})`)}throw new TypeError(`"${l.map(pi=>pi.fieldName).join(".")}" field is not a complex type and has no child fields`)}V.additionalField=!0,V.dataType=m}return l}normalizeFieldPath(t,r){return this.parseFieldPath(t,r).map(i=>(i.sign||"")+i.fieldName).join(".")}generateCodec(t,r){var l;let i=r!=null&&r.cache?r:{...r,projection:Array.isArray(r==null?void 0:r.projection)?aa(r.projection):r==null?void 0:r.projection,currentPath:""},n=this._generateSchema(t,i),s;if(this.additionalFields instanceof _)s=this.additionalFields.generateCodec(t,r);else if(typeof this.additionalFields=="boolean")s=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)s="error";else{let m=s[1];s=tc((T,g,E)=>g.fail(E,m,T))}let c=G.isObject(n,{ctor:this.name==="object"?Object:this.ctor,additionalFields:s,name:this.name,coerce:!0,caseInSensitive:r==null?void 0:r.caseInSensitive,onFail:r==null?void 0:r.onFail});if(i.level===0&&((l=i.forwardCallbacks)!=null&&l.size))for(let m of i.forwardCallbacks)m();return c}_generateSchema(t,r){var m;r.fieldCache=r.fieldCache||new Map,r.level=r.level||0,r.forwardCallbacks=r.forwardCallbacks||new Set;let i={},{currentPath:n,projection:s}=r,c=!!(s&&Object.values(s).find(T=>!T.sign)),l;for(let T of this.fields("*")){if(!T.inScope(r.scope)||!(r.keepKeyFields&&this.keyField)&&(r.ignoreReadonlyFields&&T.readonly||r.ignoreWriteonlyFields&&T.writeonly)){i[T.name]=G.isUndefined({coerce:!0});continue}l=T.name;let g;if(s!=="*"&&(g=s==null?void 0:s[l.toLowerCase()],(g==null?void 0:g.sign)==="-"||c&&!g||!c&&T.exclusive&&!g)){i[T.name]=G.isUndefined({coerce:!0});continue}let E=typeof s=="object"?((m=s[l])==null?void 0:m.projection)||"*":s,U=r.fieldCache.get(T),qe=typeof E=="string"?E:Hp(E||{});U||(U={},r.fieldCache.set(T,U));let j=U[qe];if(j===null)j=G.isAny(),r.forwardCallbacks.add(()=>{j=U[qe],i[l]=r.partial||!T.required?G.optional(j):G.required(j)});else if(!j){let V=a(()=>{U[qe]=null;let Be=this._generateFieldCodec(t,T,{...r,partial:r.partial==="deep"?r.partial:void 0,projection:E,currentPath:n+(n?".":"")+l});return U[qe]=Be,Be},"defaultGenerator");r.fieldHook?j=r.fieldHook(T,r.currentPath,V):j=V()}i[l]=r.partial||!(T.required||j.id==="required")?G.optional(j):j.id==="required"?j:G.required(j)}return r.allowPatchOperators&&(i._$pull=G.optional(G.isAny()),i._$push=G.optional(G.isAny())),i}_generateFieldCodec(t,r,i){let n=r.generateCodec(t,{...i,level:i.level+1});return r.fixed&&(n=G.isEqual(r.fixed)),r.isArray&&!(r.type instanceof ue)&&(n=G.isArray(n)),n}};a(pn,"ComplexTypeBaseClass");var an=pn;C.prototype=an.prototype;import"reflect-metadata";import{omitUndefined as cn}from"@jsopen/objects";import{asMutable as rc}from"ts-gems";import{vg as ic}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=rc(this);if(i.kind=u.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=L(t.attributes||{}),i.attributes=i.base?L(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),ln=class ln 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 ic.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return cn({...t,kind:this.kind,base:r,attributes:L(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(ln,"EnumTypeClass");var cr=ln;ee.prototype=cr.prototype;Object.assign(ee,cr);function oc(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(c=>{var m;if(!isNaN(Number(c)))return;let l=(m=r==null?void 0:r.meanings)==null?void 0:m[c];i[c]=cn({description:l})})}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(c=>{var m;if(!isNaN(Number(c)))return;let l=(m=r==null?void 0:r.meanings)==null?void 0:m[c];i[o[c]]=cn({alias:c,description:l})})}let s={kind:u.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,y,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(oc,"EnumTypeFactory");ee.prototype=cr.prototype;ee[A]=oc;var jn={};br(jn,{Base64Type:()=>hn,DateTimeType:()=>Xe,DateTimeTypeTz:()=>ur,DateType:()=>lr,EmailType:()=>te,FieldPathType:()=>J,FilterType:()=>He,ObjectIdType:()=>Rn,OperationResult:()=>Te,TimeType:()=>hr,UrlType:()=>Fn,UuidType:()=>Xr});import{__decorate as sc,__metadata as ac}from"tslib";import{isBase64 as pc,validator as yn,vg as dn}from"valgen";import"reflect-metadata";import{omitUndefined as da}from"@jsopen/objects";import{asMutable as nc}from"ts-gems";import{isAny as ha}from"valgen";function fn(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!F.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(y,r)||{};o&&Object.assign(n,o),n.kind=u.SimpleType.Kind,n.name=i,Reflect.defineMetadata(y,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(fn,"SimpleTypeDecoratorFactory");function ua(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(y,e.constructor)||{},i=Reflect.getMetadata("design:type",e,t),n="string";i===Boolean?n="boolean":i===Number&&(n="number"),r.kind=u.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(y,r,e.constructor)}}a(ua,"AttributeDecoratorFactory");var d=a(function(...o){var n,s;if(!this)return d[A](...o);let[e,t,r]=o;_.call(this,e,t,r);let i=nc(this);if(i.kind=u.SimpleType.Kind,t.base){if(!(t.base instanceof d))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=L(t.attributes||{}),i.attributes=i.base?L(i.base.attributes):{},i.ownAttributes)for(let[c,l]of Object.entries(i.ownAttributes)){if((s=i.attributes[c])!=null&&s.sealed)throw new TypeError(`Sealed attribute "${c}" can not be overwritten`);i.attributes[c]=l}i._generateDecoder=t.generateDecoder,i._generateEncoder=t.generateEncoder},"SimpleType"),un=class un extends _{constructor(){super(...arguments);p(this,"_generateDecoder");p(this,"_generateEncoder");p(this,"properties")}extend(t){return Object.setPrototypeOf(t,this),t}extendsFrom(t){var r;return t instanceof _||(t=this.node.getDataType(t)),t instanceof d?t===this?!0:!!((r=this.base)!=null&&r.extendsFrom(t)):!1}generateCodec(t,r,i){let n={...this.properties,...i};if(t==="decode"){let c=this;for(;c;){if(c._generateDecoder)return c._generateDecoder(n,{dataType:this,element:(r==null?void 0:r.documentElement)||this.owner,scope:r==null?void 0:r.scope});c=this.base}return ha}let s=this;for(;s;){if(s._generateEncoder)return s._generateEncoder(n,{dataType:this,element:(r==null?void 0:r.documentElement)||this.owner,scope:r==null?void 0:r.scope});s=this.base}return ha}toJSON(t){let r=super.toJSON(t),i=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,n=da(this.ownAttributes),s;this.properties&&typeof this.properties.toJSON=="function"?s=this.properties.toJSON(this.properties,this.owner,t):s=this.properties?L(this.properties):{};let c={...r,kind:this.kind,base:i,attributes:n&&Object.keys(n).length?n:void 0,properties:Object.keys(s).length?s:void 0};return Object.keys(this.ownNameMappings).length&&(c.nameMappings={...this.ownNameMappings}),da(c,!0)}_locateBase(t){if(this.base){if(t(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(t)}}};a(un,"SimpleTypeClass");var mn=un;d.prototype=mn.prototype;Object.assign(d,fn);d[A]=fn;d.Attribute=ua;var _t,hn=(_t=class{constructor(e){p(this,"designType");e&&Object.assign(this,e)}[x](e){let t=dn.isBase64({coerce:!0});return e.designType===Buffer?dn.pipe([t,cc],{coerce:!0}):e.designType===Uint8Array?dn.pipe([t,lc],{coerce:!0}):t}[w](){return fc}},a(_t,"Base64Type"),_t);hn=sc([d({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),ac("design:paramtypes",[Object])],hn);var cc=yn(o=>Buffer.from(o,"base64")),lc=yn(o=>new Uint8Array(Buffer.from(o,"base64"))),fc=yn(o=>Buffer.isBuffer(o)?o.toString("base64"):pc(o));import{__decorate as Tn,__metadata as En}from"tslib";import{vg as Ie}from"valgen";var ya=Ie.isDateString({precisionMin:"day",precisionMax:"day",trim:!0,coerce:!0}),mc=Ie.isDate({trim:"day",coerce:!0}),xt,lr=(xt=class{constructor(e){p(this,"designType");p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[x](e){let t;e.designType===Date?t=mc:t=ya;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}[w](e){let t=ya,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(xt,"DateType"),xt);Tn([d.Attribute({description:"Minimum value"}),En("design:type",String)],lr.prototype,"minValue",void 0);Tn([d.Attribute({description:"Maximum value"}),En("design:type",String)],lr.prototype,"maxValue",void 0);lr=Tn([d({name:"date",description:"A date without time",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18","Full date value"),En("design:paramtypes",[Object])],lr);import{__decorate as fr,__metadata as mr}from"tslib";import{vg as Ae}from"valgen";var gt,Xe=(gt=class{constructor(e){p(this,"designType");p(this,"precisionMin");p(this,"precisionMax");p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[x](e){let t;e.designType===Date?t=Ae.isDate({coerce:!0}):t=Ae.isDateString({precisionMin:e.precisionMin||"day",precisionMax:e.precisionMax||"ms",trim:!0,coerce:!0});let r=[t];return e.minValue!=null&&r.push(Ae.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ae.isLte(t(e.maxValue))),r.length>0?Ae.pipe(r,{returnIndex:0}):t}[w](e){let t=Ae.isDateString({precisionMin:e.precisionMin||"day",precisionMax:e.precisionMax||"ms",trim:!0,coerce:!0}),r=[t];return e.minValue!=null&&r.push(Ae.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ae.isLte(t(e.maxValue))),r.length>0?Ae.pipe(r,{returnIndex:0}):t}},a(gt,"DateTimeType"),gt);fr([d.Attribute({description:'Determines the minimum precision, e.g. "year", "month", "hours", "minutes", "seconds" etc. Defaults to "day".'}),mr("design:type",String)],Xe.prototype,"precisionMin",void 0);fr([d.Attribute({description:'Determines the minimum precision, e.g. "year", "month", "hours", "minutes", "seconds" etc. Defaults to "ms".'}),mr("design:type",String)],Xe.prototype,"precisionMax",void 0);fr([d.Attribute({description:"Minimum value"}),mr("design:type",String)],Xe.prototype,"minValue",void 0);fr([d.Attribute({description:"Maximum value"}),mr("design:type",String)],Xe.prototype,"maxValue",void 0);Xe=fr([d({name:"datetime",description:"A full datetime value",nameMappings:{js:"string",json:"string"}}),mr("design:paramtypes",[Object])],Xe);import{__decorate as _n,__metadata as xn}from"tslib";import{vg as Ze}from"valgen";var Ta=Ze.isDateString({precisionMin:"tz",coerce:!0}),wt,ur=(wt=class{constructor(e){p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[x](e){let t=Ta,r=[t];return e.minValue!=null&&r.push(Ze.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ze.isLte(t(e.maxValue))),r.length>0?Ze.pipe(r,{returnIndex:0}):t}[w](e){let t=Ta,r=[t];return e.minValue!=null&&r.push(Ze.isGte(t(e.minValue))),e.maxValue!=null&&r.push(Ze.isLte(t(e.maxValue))),r.length>0?Ze.pipe(r,{returnIndex:0}):t}},a(wt,"DateTimeTypeTz"),wt);_n([d.Attribute({description:"Minimum value"}),xn("design:type",String)],ur.prototype,"minValue",void 0);_n([d.Attribute({description:"Maximum value"}),xn("design:type",String)],ur.prototype,"maxValue",void 0);ur=_n([d({name:"datetimetz",description:"A full datetime value with time zone information",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15+03:00"),xn("design:paramtypes",[Object])],ur);import{__decorate as de,__metadata as he}from"tslib";import{vg as Ea}from"valgen";var At,te=(At=class{constructor(e){p(this,"allowDisplayName");p(this,"requireDisplayName");p(this,"utf8LocalPart");p(this,"ignoreMaxLength");p(this,"allowIpDomain");p(this,"domainSpecificValidation");p(this,"hostBlacklist");p(this,"hostWhitelist");p(this,"blacklistedChars");e&&Object.assign(this,e)}[x](e){return Ea.isEmail({...e,coerce:!0})}[w](e){return Ea.isEmail({...e,coerce:!0})}},a(At,"EmailType"),At);de([d.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),he("design:type",Boolean)],te.prototype,"allowDisplayName",void 0);de([d.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),he("design:type",Boolean)],te.prototype,"requireDisplayName",void 0);de([d.Attribute({description:"If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",default:!0}),he("design:type",Boolean)],te.prototype,"utf8LocalPart",void 0);de([d.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),he("design:type",Boolean)],te.prototype,"ignoreMaxLength",void 0);de([d.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),he("design:type",Boolean)],te.prototype,"allowIpDomain",void 0);de([d.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}),he("design:type",Boolean)],te.prototype,"domainSpecificValidation",void 0);de([d.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."}),he("design:type",Array)],te.prototype,"hostBlacklist",void 0);de([d.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."}),he("design:type",Array)],te.prototype,"hostWhitelist",void 0);de([d.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."}),he("design:type",String)],te.prototype,"blacklistedChars",void 0);te=de([d({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),he("design:paramtypes",[Object])],te);import{__decorate as gn,__metadata as wn}from"tslib";import{toString as uc,validator as dc,vg as hc}from"valgen";var Ot,J=(Ot=class{constructor(e){p(this,"dataType");p(this,"allowSigns");e&&Object.assign(this,e)}[x](e,{element:t,scope:r}){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=dc("decodeFieldPath",c=>i.normalizeFieldPath(c,{allowSigns:n,scope:r}));return hc.pipe([uc,s])}[w](e,t){return this[x](e,t)}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(Ot,"FieldPathType"),Ot);gn([d.Attribute({description:"Data type which field belong to"}),wn("design:type",Object)],J.prototype,"dataType",void 0);gn([d.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([d({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),wn("design:paramtypes",[Object])],J);import{__decorate as An,__metadata as On}from"tslib";import{validator as xa}from"valgen";var dr={};br(dr,{$and:()=>Tc,$arithmetic:()=>Pc,$array:()=>_a,$date:()=>Ec,$eq:()=>wc,$field:()=>gc,$gt:()=>Oc,$gte:()=>Rc,$ilike:()=>Ic,$in:()=>Nc,$like:()=>Mc,$lt:()=>bc,$lte:()=>Dc,$ne:()=>Ac,$notILike:()=>kc,$notIn:()=>Sc,$notLike:()=>vc,$number:()=>xc,$or:()=>yc,$paren:()=>Lc,$time:()=>_c,ArithmeticExpression:()=>ze,ArithmeticExpressionItem:()=>Ir,ArrayExpression:()=>_e,Ast:()=>Zt,BooleanLiteral:()=>Je,ComparisonExpression:()=>le,DateLiteral:()=>Ne,DateTimeLiteral:()=>tr,Expression:()=>q,FilterTreeVisitor:()=>nr,Literal:()=>P,LogicalExpression:()=>fe,NegativeExpression:()=>Ht,NullLiteral:()=>Qe,NumberLiteral:()=>ge,OpraErrorListener:()=>sr,ParenthesizedExpression:()=>xe,QualifiedIdentifier:()=>H,StringLiteral:()=>Ye,Term:()=>We,TimeLiteral:()=>Ge,parse:()=>zo});function yc(...o){return new fe({op:"or",items:o})}a(yc,"$or");function Tc(...o){return new fe({op:"and",items:o})}a(Tc,"$and");function Ec(o){return new Ne(o)}a(Ec,"$date");function _c(o){return new Ge(o)}a(_c,"$time");function xc(o){return new ge(o)}a(xc,"$number");function _a(...o){return new _e(o.map(Yr))}a(_a,"$array");function gc(o){return new H(o)}a(gc,"$field");function wc(o,e){return re("=",o,e)}a(wc,"$eq");function Ac(o,e){return re("!=",o,e)}a(Ac,"$ne");function Oc(o,e){return re(">",o,e)}a(Oc,"$gt");function Rc(o,e){return re(">=",o,e)}a(Rc,"$gte");function bc(o,e){return re("<",o,e)}a(bc,"$lt");function Dc(o,e){return re("<=",o,e)}a(Dc,"$lte");function Nc(o,e){return re("in",o,e)}a(Nc,"$in");function Sc(o,e){return re("!in",o,e)}a(Sc,"$notIn");function Mc(o,e){return re("like",o,e)}a(Mc,"$like");function vc(o,e){return re("!like",o,e)}a(vc,"$notLike");function Ic(o,e){return re("ilike",o,e)}a(Ic,"$ilike");function kc(o,e){return re("!ilike",o,e)}a(kc,"$notILike");function Lc(o){return new xe(o)}a(Lc,"$paren");function Pc(o){let e=new ze;return e.add=t=>(e.append("+",Rt(t)),e),e.sub=t=>(e.append("-",Rt(t)),e),e.mul=t=>(e.append("*",Rt(t)),e),e.div=t=>(e.append("/",Rt(t)),e),e.append("+",Yr(o)),e}a(Pc,"$arithmetic");function re(o,e,t){let r=typeof e=="string"?new H(e):Yr(e),i=Yr(t);return new le({op:o,left:r,right:i})}a(re,"comparisonExpression");var Yr=a(o=>Array.isArray(o)?_a(...o.map(Rt)):Rt(o),"wrapEntryValue"),Rt=a(o=>o instanceof q?o:typeof o=="boolean"?new Je(o):typeof o=="number"||typeof o=="bigint"?new ge(o):o==null?new Qe:o instanceof Date?new Ne(o):new Ye(""+o),"_wrapEntryValue");var bt,He=(bt=class{constructor(e){p(this,"dataType");p(this,"rules");e&&Object.assign(this,e)}[x](e,{element:t}){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new lt(e.rules):void 0;return Fc(r,i)}[w](){return jc}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(bt,"FilterType"),bt);An([d.Attribute({description:"Data type which filtering fields belong to"}),On("design:type",Object)],He.prototype,"dataType",void 0);An([d.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),On("design:type",Object)],He.prototype,"rules",void 0);He=An([d({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),On("design:paramtypes",[Object])],He);var Fc=a((o,e,t)=>xa("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=dr.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"),jc=xa("encodeFilter",(o,e,t)=>{if(o instanceof dr.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});import{__decorate as Cc,__metadata as Uc}from"tslib";import{vg as ga}from"valgen";var Dt,Rn=(Dt=class{constructor(e){e&&Object.assign(this,e)}[x](){return ga.isObjectId({coerce:!0})}[w](){return ga.isObjectId({coerce:!0})}},a(Dt,"ObjectIdType"),Dt);Rn=Cc([d({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),Uc("design:paramtypes",[Object])],Rn);import{__decorate as ke,__metadata as Le}from"tslib";import{omitUndefined as wa}from"@jsopen/objects";import{asMutable as qc}from"ts-gems";import{omitUndefined as $c}from"@jsopen/objects";function bn(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(y,r.constructor)||{};n.kind=u.ComplexType.Kind,n.fields=n.fields||{};let s=Reflect.getMetadata("design:type",r,i),c=n.fields[i]={...o,designType:s};s===Array?c.isArray=!0:c.type=c.type||s,Reflect.defineMetadata(y,n,r.constructor);for(let l of e)l(c)},"decorator");return t.Override=(r,i)=>(e.push(n=>{n.override=n.override||[],n.override.push($c({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(bn,"ApiFieldDecoratorFactory");var $=a(function(...o){if(!this){let[n]=o;return $[A](n)}let[e,t]=o;O.call(this,e);let r=qc(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof C))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"),Nn=class Nn extends O{constructor(){super(...arguments);p(this,"origin")}inScope(t){return pr(t,this.scopePattern)}forScope(t){if(!(t&&this.override))return this;this._overrideCache=this._overrideCache||{};let r=this._overrideCache[t];if(r)return r;if(t!=="*"){for(let i of this.override)if(pr(t,i.scopePattern)){r=wa({...i,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:i.scopePattern}),Object.setPrototypeOf(r,this);break}}return r=r||this,this._overrideCache[t]=r,r}toJSON(t){var i;let r=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return wa({type:r||((i=this.type)==null?void 0:i.toJSON(t)),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(t,r,i){return this.type.generateCodec(t,r,{...i,designType:this.designType})}};a(Nn,"ApiFieldClass");var Dn=Nn;$.prototype=Dn.prototype;Object.assign($,bn);$[A]=bn;import"reflect-metadata";import{omitUndefined as Kc}from"@jsopen/objects";import{asMutable as Vc}from"ts-gems";var Sn=class Sn extends Ee{constructor(){super("");p(this,"details",[])}add(t){return this.details.push(t),this}};a(Sn,"OpraDocumentError");var Nt=Sn;var Mn=class Mn{constructor(e){p(this,"path","");p(this,"error",new Nt);p(this,"maxErrors");p(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(Mn,"DocumentInitContext");var ye=Mn;import{omit as Bc}from"@jsopen/objects";function vn(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!F.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(y,e);r||(r={},Reflect.defineMetadata(y,r,e)),r.kind=u.ComplexType.Kind,r.name=t,o&&Object.assign(r,Bc(o,["name"]))}}a(vn,"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 ye({maxErrors:0});C.call(this,e,t,r);let i=Vc(this);i.kind=u.ComplexType.Kind,i.discriminatorField=t.discriminatorField,i.discriminatorValue=t.discriminatorValue,t.base&&r.enter(".base",()=>{if(!(t.base instanceof C))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 $(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,c]of Object.entries(t.fields)){let l=new $(this,{...c,name:s});this._fields.set(l.name,l)}})},"ComplexType"),kn=class kn extends C{constructor(){super(...arguments);p(this,"base")}extendsFrom(t){var r;return t instanceof _||(t=this.node.getDataType(t)),t instanceof C?t===this?!0:!!((r=this.base)!=null&&r.extendsFrom(t)):!1}toJSON(t){let r=super.toJSON(t),i=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,n={...r,kind:this.kind,base:this.base?i||this.base.toJSON(t):void 0,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue};if(this.additionalFields)if(this.additionalFields instanceof _){let s=this.node.getDataTypeNameWithNs(this.additionalFields);n.additionalFields=s||this.additionalFields.toJSON(t)}else n.additionalFields=this.additionalFields;if(this._fields.size){let s={},c=0;for(let l of this._fields.values())l.origin===this&&l.inScope(t==null?void 0:t.scope)&&(s[l.name]=l.toJSON(t),c++);c&&(n.fields=s)}return Kc(n)}_locateBase(t){if(this.base){if(t(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(t)}}};a(kn,"ComplexTypeClass");var In=kn;ie.prototype=In.prototype;Object.assign(ie,vn);ie[A]=vn;var St,Te=(St=class{constructor(e){e&&Object.assign(this,e)}},a(St,"OperationResult"),St);ke([$(),Le("design:type",String)],Te.prototype,"context",void 0);ke([$(),Le("design:type",String)],Te.prototype,"type",void 0);ke([$(),Le("design:type",String)],Te.prototype,"message",void 0);ke([$({type:"any"}),Le("design:type",Object)],Te.prototype,"payload",void 0);ke([$({type:"object"}),Le("design:type",Array)],Te.prototype,"errors",void 0);Te=ke([ie({name:"OperationResult",description:"Operation result",additionalFields:!0}),Le("design:paramtypes",[Object])],Te);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return ke([$({type:t,required:!0}),Le("design:type",Object)],r.prototype,"payload",void 0),r=ke([ie({embedded:!0}),Le("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(Te||(Te={}));import{__decorate as Ln,__metadata as Pn}from"tslib";import{vg as Gr}from"valgen";var Wc=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,Mt,hr=(Mt=class{constructor(e){p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[x](e){let t=Gr.matches(Wc,{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}[w](e){return this[x](e)}},a(Mt,"TimeType"),Mt);Ln([d.Attribute({description:"Minimum value"}),Pn("design:type",String)],hr.prototype,"minValue",void 0);Ln([d.Attribute({description:"Maximum value"}),Pn("design:type",String)],hr.prototype,"maxValue",void 0);hr=Ln([d({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"),Pn("design:paramtypes",[Object])],hr);import{__decorate as zc,__metadata as Jc}from"tslib";import{vg as Aa}from"valgen";var vt,Fn=(vt=class{constructor(e){e&&Object.assign(this,e)}[x](){return Aa.isURL({coerce:!0})}[w](){return Aa.isURL({coerce:!0})}},a(vt,"UrlType"),vt);Fn=zc([d({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),Jc("design:paramtypes",[Object])],Fn);import{__decorate as Ra,__metadata as ba}from"tslib";import{vg as Oa}from"valgen";var It,Xr=(It=class{constructor(e){p(this,"version");e&&Object.assign(this,e)}[x](e){return Oa.isUUID(e==null?void 0:e.version,{coerce:!0})}[w](e){return Oa.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(It,"UuidType"),It);Ra([d.Attribute({description:"Version of the UUID"}),ba("design:type",Number)],Xr.prototype,"version",void 0);Xr=Ra([d({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),ba("design:paramtypes",[Object])],Xr);import Yc from"path-browserify";import{omitUndefined as Gc}from"@jsopen/objects";import{asMutable as Xc}from"ts-gems";var oe=Symbol.for("kMap"),yr=Symbol.for("kCtorMap"),Da,Na,Cn=class Cn{constructor(){p(this,Na,new S);p(this,Da,new WeakMap)}get size(){return this[oe].size}forEach(e,t){this[oe].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[yr].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(y,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[y];t=i==null?void 0:i.name}if(!t)return;let r=this[oe].get(t);if(r){if(typeof e=="function"&&r.kind==="ComplexType"&&r.ctor!==e)throw new TypeError(`An other data type with same class (${e.name}) already exists.`);return r}}set(e,t){this[oe].set(e,t),t.ctor?this[yr].set(t.ctor,e):t.instance&&this[yr].set(t.instance,e)}has(e){if(e instanceof _)return!!e.name&&this[oe].has(e.name);let t=typeof e=="string"?e:this[yr].get(e);return t?this[oe].has(t):!1}keys(){return this[oe].keys()}values(){return this[oe].values()}entries(){return this[oe].entries()}sort(e){return this[oe].sort(e),this}[(Na=oe,Da=yr,Symbol.iterator)](){return this[oe][Symbol.iterator]()}};a(Cn,"DataTypeMap");var W=Cn;import Qc from"@browsery/type-is";import{isConstructor as kt}from"@jsopen/objects";function I(o,e){let t=a(((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:u.HttpOperation.Kind},s=Reflect.getOwnMetadata(se,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let c of o)c(n);Reflect.defineMetadata(se,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"};kt(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="cookie"&&String(c.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"};kt(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="header"&&String(c.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"};kt(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="query"&&String(c.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"};kt(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="path"&&String(c.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??b.json),(n.contentType?Array.isArray(n.contentType)?n.contentType:[n.contentType]:[]).find(c=>c.endsWith("+json")||c.endsWith("+xml")||c.endsWith("+yaml")||c.endsWith("+toml")||Qc.is(c,"json","html","text","xml"))&&(n.contentEncoding=n.contentEncoding??"utf-8"),kt(n.type)&&(n.designType=n.type),o.push(c=>{c.responses=c.responses||[],c.responses.push(n)}),t},t.RequestContent=function(r){let i=typeof r=="object"?r:{type:r};return i.type&&(i.contentType=i.contentType||[b.json,b.yaml,b.yaml2,b.toml,b.toml2],i.contentEncoding=i.contentEncoding||"utf-8",kt(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(c,l){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:c,fieldType:"field",...l}),s},File(c,l){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:c,fieldType:"file",...l}),s}};i(s)}return t},t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(I,"HttpOperationDecoratorFactory");var D=a(function(...o){if(!this){let[i]=o,n=[];return D[A].call(void 0,n,i)}let[e,t]=o;if(O.call(this,e),!F.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Xc(this);r.parameters=[],r.responses=[],r.types=r.node[k]=new W,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?L(t.compositionOptions):void 0},"HttpOperation"),$n=class $n extends O{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:Yc.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=Gc({kind:u.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($n,"HttpOperationClass");var Un=$n;D.prototype=Un.prototype;D[A]=I;D.GET=function(o){return I([],{...o,method:"GET"})};D.DELETE=function(o){return I([],{...o,method:"DELETE"})};D.HEAD=function(o){return I([],{...o,method:"HEAD"})};D.OPTIONS=function(o){return I([],{...o,method:"OPTIONS"})};D.PATCH=function(o){return I([],{...o,method:"PATCH"})};D.POST=function(o){return I([],{...o,method:"POST"})};D.PUT=function(o){return I([],{...o,method:"PUT"})};D.SEARCH=function(o){return I([],{...o,method:"SEARCH"})};D.Entity={};function z(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(y,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 Pe(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(Pe,"createKeyParamDecorator");function Sa(o,e){return(...t)=>{let r=typeof t[0]=="object"?t[0]:t.reduce((s,c)=>{let l=c.split(":");return s[l[0]]=l[1]||l[0],s},{}),i=Object.keys(r).reduce((s,c)=>{let l=Et.exec(c),m=Et.exec(r[c]);return l&&m&&(s[l[2]]=m[2]),s},{}),n=Object.keys(r).reduce((s,c)=>{let l=Et.exec(c);return l&&(l[1]!="-"&&(s[l[2]]=l[2]),l[1]!="+"&&(s["-"+l[2]]="-"+l[2])),s},{});return e.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.sortFields=i}),o.QueryParam("sort",{description:"Determines sort fields",type:ee(n),isArray:!0,arraySeparator:",",parser:a(s=>s.map(c=>{let l=Et.exec(c);return l?(l[1]||"")+i[l[2]]:c}),"parser")}),o}}a(Sa,"createSortFieldsDecorator");function Fe(o,e,t){let r=Reflect.getMetadata("FilterRules",o);r||(r=new lt,Reflect.defineMetadata("FilterRules",r,o));let i=Reflect.getMetadata("FilterType",o);return i||(i=new He({dataType:t}),i.rules={},Reflect.defineMetadata("FilterType",i,o)),(n,s)=>{let c=(Array.isArray(s)?{operators:s}:typeof s=="string"?{operators:s.split(/\s*,\s*/)}:s)||{};if(c.operators=c.operators||["=","!="],n.includes(":")){let l=n.split(":");n=l[0],c.mappedField=l[1]}return e.push(()=>{r.set(n,c),i.rules=r.toJSON()}),o.QueryParam("filter",{type:i,description:"Determines filter fields"}),o}}a(Fe,"createFilterDecorator");D.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.type=z(t.type)}),i};D.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Pe(i,r),i};D.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.Filter=Fe(i,r,t.type),i};var Xn={};br(Xn,{AnyType:()=>qn,BigintType:()=>zn,BooleanType:()=>Jn,IntegerType:()=>Ut,NullType:()=>Yn,NumberType:()=>Oe,ObjectType:()=>Gn,StringType:()=>et});import{__decorate as Zc,__metadata as Hc}from"tslib";import{isAny as Ma}from"valgen";var Lt,qn=(Lt=class{constructor(e){e&&Object.assign(this,e)}[x](){return Ma}[w](){return Ma}},a(Lt,"AnyType"),Lt);qn=Zc([d({name:"any",description:"Represents any value"}),Hc("design:paramtypes",[Object])],qn);import{__decorate as el,__metadata as tl}from"tslib";import{toBigint as Ia,vg as Wn}from"valgen";import{__decorate as Kn,__metadata as Vn}from"tslib";import{toNumber as va,vg as Bn}from"valgen";var Pt,Oe=(Pt=class{constructor(e){p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[x](e){let t=[];return e.minValue!=null&&t.push(Bn.isGte(e.minValue)),e.maxValue!=null&&t.push(Bn.isLte(e.maxValue)),t.length>0?Bn.pipe([va,...t],{returnIndex:0}):va}[w](e){return this[x](e)}},a(Pt,"NumberType"),Pt);Kn([d.Attribute({description:"Determines the minimum value"}),Vn("design:type",Number)],Oe.prototype,"minValue",void 0);Kn([d.Attribute({description:"Determines the maximum value"}),Vn("design:type",Number)],Oe.prototype,"maxValue",void 0);Oe=Kn([d({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),Vn("design:paramtypes",[Object])],Oe);var Ft,zn=(Ft=class extends Oe{constructor(e){super(e)}[x](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([Ia,...t],{returnIndex:0}):Ia}[w](e){return this[x](e)}},a(Ft,"BigintType"),Ft);zn=el([d({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),tl("design:paramtypes",[Object])],zn);import{__decorate as rl,__metadata as il}from"tslib";import{toBoolean as ka}from"valgen";var jt,Jn=(jt=class{constructor(e){e&&Object.assign(this,e)}[x](){return ka}[w](){return ka}},a(jt,"BooleanType"),jt);Jn=rl([d({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),il("design:paramtypes",[Object])],Jn);import{__decorate as ol,__metadata as nl}from"tslib";import{toInteger as La,vg as Qn}from"valgen";var Ct,Ut=(Ct=class extends Oe{constructor(e){super(e)}[x](e){let t=[];return e.minValue!=null&&t.push(Qn.isGte(e.minValue)),e.maxValue!=null&&t.push(Qn.isLte(e.maxValue)),t.length>0?Qn.pipe([La,...t],{returnIndex:0}):La}[w](e){return this[x](e)}},a(Ct,"IntegerType"),Ct);Ut=ol([d({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),nl("design:paramtypes",[Object])],Ut);import{__decorate as sl,__metadata as al}from"tslib";import{isNull as Pa}from"valgen";var $t,Yn=($t=class{constructor(e){e&&Object.assign(this,e)}[x](){return Pa}[w](){return Pa}},a($t,"NullType"),$t);Yn=sl([d({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),al("design:paramtypes",[Object])],Yn);import{__decorate as pl,__metadata as cl}from"tslib";var qt,Gn=(qt=class{constructor(e){e&&Object.assign(this,e)}},a(qt,"ObjectType"),qt);Gn=pl([ie({name:"object",description:"A non modelled object",additionalFields:!0}),cl("design:paramtypes",[Object])],Gn);import{__decorate as Tr,__metadata as Er}from"tslib";import{toString as Fa,vg as Zr}from"valgen";var Bt,et=(Bt=class{constructor(e){p(this,"pattern");p(this,"patternName");p(this,"minLength");p(this,"maxLength");e&&Object.assign(this,e)}[x](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(y,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([Fa,...t],{returnIndex:0}):Fa}[w](e){return this[x](e)}},a(Bt,"StringType"),Bt);Tr([d.Attribute({description:"Regex pattern to be used for validation"}),Er("design:type",Object)],et.prototype,"pattern",void 0);Tr([d.Attribute({description:"Name of the pattern"}),Er("design:type",String)],et.prototype,"patternName",void 0);Tr([d.Attribute({description:"Minimum number of characters"}),Er("design:type",Number)],et.prototype,"minLength",void 0);Tr([d.Attribute({description:"Minimum number of characters"}),Er("design:type",Number)],et.prototype,"maxLength",void 0);et=Tr([d({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),Er("design:paramtypes",[Object])],et);D.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.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=z(t.type),t.defaultLimit&&(s.defaultLimit=t.defaultLimit),t.defaultProjection&&(s.defaultProjection=t.defaultProjection),t.maxLimit&&(s.maxLimit=t.maxLimit)}),i.Filter=Fe(i,r,t.type),i.DefaultSort=(...n)=>(r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.defaultSort=n}),i),i.SortFields=Sa(i,r),i};D.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Pe(i,r),i};D.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=Pe(i,r),i};D.Entity.Update=function(o,e){var n;let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.type=z(t.type)}),i.KeyParam=Pe(i,r),i.Filter=Fe(i,r,t.type),i};D.Entity.UpdateMany=function(o,e){var n;let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.type=z(t.type)}),i.Filter=Fe(i,r,t.type),i};import{merge as Zn}from"@jsopen/objects";var ll=/^(.*)(Controller)$/,ja=[];function Kt(o){let e=[],t=a(function(r){var l;let i=o==null?void 0:o.name;i||(i=((l=ll.exec(r.name))==null?void 0:l[1])||r.name);let n={},s=Reflect.getOwnMetadata(ae,Object.getPrototypeOf(r));s&&Zn(n,s,{deep:!0});let c=Reflect.getOwnMetadata(ae,r);c&&Zn(n,c,{deep:!0}),Zn(n,{...o,kind:u.MQController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(ae,n,r);for(let m of e)m(n,r);Reflect.defineMetadata(ae,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),ja.forEach(r=>r(t,e,o)),t}a(Kt,"MQControllerDecoratorFactory");Kt.augment=function(o){ja.push(o)};import{isConstructor as Ca,omit as ml}from"@jsopen/objects";var Ua=[];function _r(o,e,t){let r=!1,i=a(((n,s)=>{if(typeof s!="string")throw new TypeError("Symbol properties can not be decorated");let c={kind:u.MQOperation.Kind,channel:s,type:e,...ml(t,["kind","type"])},l=Reflect.getOwnMetadata(ae,n.constructor)||{};l.operations=l.operations||{},l.operations[s]=c;for(let m of o)m(c,n,s);Reflect.defineMetadata(ae,l,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(c=>{let l=typeof s=="string"||typeof s=="function"?{name:n,type:s}:{...s,name:n};Ca(l.type)&&(l.designType=l.type);let m=r?c.response:c;m.headers?m.headers=m.headers.filter(T=>String(T.name)!==String(n)):m.headers=[],m.headers.push(l)}),i),i.Response=(n,s)=>(o.push(c=>{r=!0,c.response={...s,type:n},Ca(n)&&(c.response.designType=n)}),i),Ua.forEach(n=>n(i,o,e,t)),i}a(_r,"MQOperationDecoratorFactory");_r.augment=function(o){Ua.push(o)};import{merge as Hn}from"@jsopen/objects";var dl=/^(.*)(Controller)$/,$a=[];function Vt(o){let e=[],t=a(function(r){var l;let i=o==null?void 0:o.name;i||(i=((l=dl.exec(r.name))==null?void 0:l[1])||r.name);let n={},s=Reflect.getOwnMetadata(pe,Object.getPrototypeOf(r));s&&Hn(n,s,{deep:!0});let c=Reflect.getOwnMetadata(pe,r);c&&Hn(n,c,{deep:!0}),Hn(n,{...o,kind:u.WSController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(pe,n,r);for(let m of e)m(n,r);Reflect.defineMetadata(pe,n,r)},"decorator");return t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),$a.forEach(r=>r(t,e,o)),t}a(Vt,"WSControllerDecoratorFactory");Vt.augment=function(o){$a.push(o)};import{omit as yl}from"@jsopen/objects";var qa=[];function xr(o,e){let t=a(((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={kind:u.WSOperation.Kind,event:i,...yl(e,["kind"])},s=Reflect.getOwnMetadata(pe,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let c of o)c(n,r,i);Reflect.defineMetadata(pe,s,r.constructor)}),"decorator");return t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),qa.forEach(r=>r(t,o,e)),t}a(xr,"WSOperationDecoratorFactory");xr.augment=function(o){qa.push(o)};import"reflect-metadata";import{omitUndefined as El}from"@jsopen/objects";import{asMutable as _l}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 tt=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;C.call(this,e,t,r);let i=_l(this);if(i.kind=u.MappedType.Kind,t.base){if(!(t.base instanceof C))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(m=>i.base.normalizeFieldPath(m)):t.omit?i.omit=t.omit.map(m=>i.base.normalizeFieldPath(m)):t.partial?i.partial=Array.isArray(t.partial)?t.partial.map(m=>i.base.normalizeFieldPath(m)):t.partial:t.required&&(i.required=Array.isArray(t.required)?t.required.map(m=>i.base.normalizeFieldPath(m)):t.required);let s=Hr(i.pick,i.omit),c=Array.isArray(i.partial)?i.partial.map(m=>m.toLowerCase()):i.partial,l=Array.isArray(i.required)?i.required.map(m=>m.toLowerCase()):i.required;for(let[m,T]of i.base.fieldEntries("*")){if(!s(m))continue;let g={...T};c===!0||Array.isArray(c)&&c.includes(T.name.toLowerCase())?g.required=!1:(l===!0||Array.isArray(l)&&l.includes(T.name.toLowerCase()))&&(g.required=!0);let E=new $(this,g);i._fields.set(E.name,E)}(!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"),ts=class ts extends C{constructor(){super(...arguments);p(this,"omit");p(this,"pick");p(this,"partial");p(this,"required")}extendsFrom(t){var r;return t instanceof _||(t=this.node.getDataType(t)),t instanceof C?t===this?!0:!!((r=this.base)!=null&&r.extendsFrom(t)):!1}toJSON(t){let r=super.toJSON(t),i=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return El({...r,base:i||this.base.toJSON(t),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue})}_locateBase(t){if(this.base){if(t(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(t)}}};a(ts,"MappedTypeClass");var es=ts;tt.prototype=es.prototype;tt._applyMixin=()=>{};import"reflect-metadata";import{omitUndefined as xl}from"@jsopen/objects";import{asMutable as gl}from"ts-gems";var Wt=a(function(...o){if(!this)return Wt[A].apply(void 0,o);let[e,t,r]=o;C.call(this,e,t,r);let i=gl(this);i.kind=u.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 c=new $(this,s);i._fields.set(c.name,c)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),is=class is extends C{extendsFrom(e){if(e instanceof _||(e=this.node.getDataType(e)),!(e instanceof C))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 xl({...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(is,"MixinTypeClass");var rs=is;Wt.prototype=rs.prototype;Wt[A]=wl;function wl(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)Sr(this,n)}}}[t],i={...e,kind:u.MixinType.Kind,types:[]};Reflect.defineMetadata(y,i,r);for(let n of o){let s=Reflect.getMetadata(y,n);if(!(s&&(s.kind===u.ComplexType.Kind||s.kind===u.MixinType.Kind||s.kind===u.MappedType.Kind)))throw new TypeError(`Class "${n.name}" is not a ${u.ComplexType.Kind}, ${u.MixinType.Kind} or ${u.MappedType.Kind}`);i.types.push(n),Nr(r.prototype,n.prototype)}return r}a(wl,"MixinTypeFactory");import"reflect-metadata";import{omitUndefined as Al}from"@jsopen/objects";import{asMutable as Ol}from"ts-gems";import{vg as Ba}from"valgen";var zt=a(function(...o){if(!this)return zt[A].apply(void 0,o);let[e,t,r]=o;_.call(this,e,t,r);let i=Ol(this);i.kind=u.UnionType.Kind,i.discriminator=t.discriminator,i.types=[];for(let n of t.types)i.types.push(n)},"UnionType"),ns=class ns extends _{toJSON(e){let t=super.toJSON(e);return Al({...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===u.ComplexType.Kind||i.kind===u.MappedType.Kind)&&i.discriminatorField?[n,{[i.discriminatorField]:Ba.isEqual(i.discriminatorValue)}]:n});return Ba.oneOf(r)}extendsFrom(){return!1}_locateBase(){}};a(ns,"UnionTypeClass");var os=ns;zt.prototype=os.prototype;zt[A]=Rl;function Rl(o,e){let i=class i{};a(i,"UnionClass");let t=i,r={...e,kind:u.UnionType.Kind,types:o};return Reflect.defineMetadata(y,r,t),t}a(Rl,"UnionTypeFactory");var ss=Symbol("initializing"),ei=class ei{static async createDataType(e,t,r){e=e||new ye({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[k];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 ye({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new S;for(let l of i)n.set(l.name,l);let s=e.extend({initArgsMap:n}),c=[];for(let[l,m]of n.entries())e.enter(`[${l}]`,()=>{if(!n.has(l))return;let T=this._createDataType(s,t,m);T&&c.push(T)});return c}static async _prepareAllInitArgs(e,t,r){let i=new S,n=new S,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[k])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let c=0;for(let l of r)await s.enterAsync(`$[${c++}]`,async()=>{l=await Z(l);let m=Reflect.getMetadata(y,l)||l[y];if(!(m&&m.name))return typeof l=="function"?s.addError(`Class "${l.name}" doesn't have a valid data type metadata`):s.addError("Object doesn't have a valid data type metadata");i.set(m.name,l)})}else{let c,l;for([l,c]of Object.entries(r))c=await Z(c),i.set(l,typeof c=="object"?{...c,name:l}:c)}for(let c of Array.from(i.keys())){if(!i.has(c))continue;let l=await this._importDataTypeArgs(s,t,c);l&&typeof l!="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,c=t.node.findDataType(r);if(c instanceof _)return c.name;let l,m,T;if(typeof r!="string"){let U=t.node.getDocument().types[Mr].get(r);U&&(r=U)}if(typeof r=="string"){let E=r;if(r=(n==null?void 0:n.get(E))||((g=e.initArgsMap)==null?void 0:g.get(E)),!r)return e.addError(`Unknown data type (${E})`)}if(typeof r=="function"){if(l=Reflect.getMetadata(y,r),!l)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);m=r}else if(typeof r=="object"){if(l=r[y],l)T=r,l.kind!==u.EnumType.Kind&&(l=void 0);else if(u.isDataType(r))l=r,m=l.ctor;else if(m=Object.getPrototypeOf(r).constructor,l=m&&Reflect.getMetadata(y,m),l&&l.kind===u.SimpleType.Kind){let E=await this._importDataTypeArgs(e,t,l.name);return E?typeof E=="object"&&E.kind!==u.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:u.SimpleType.Kind,name:void 0,base:E,properties:r}:void 0}}return l?e.enterAsync(l.name?`[${l.name}]`:"",async()=>{if(l.name){let U=s==null?void 0:s.get(l.name);if(U)return i&&U[ss]?e.addError("Circular reference detected"):l.name}let E={kind:l.kind,name:l.name};E[ss]=!0;try{if(E.name)if(n!=null&&n.has(E.name))s==null||s.set(l.name,E),E._instance={name:l.name},E[k]=t.node[k];else return e.addError(`Data Type (${E.name}) must be explicitly added to type list in the document scope`);switch(E.kind){case u.ArrayType.Kind:await this._prepareArrayTypeArgs(e,t,E,l);break;case u.ComplexType.Kind:E.ctor=m,await this._prepareComplexTypeArgs(e,t,E,l);break;case u.EnumType.Kind:E.instance=T,await this._prepareEnumTypeArgs(e,t,E,l);break;case u.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,E,l);break;case u.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,E,l);break;case u.SimpleType.Kind:E.ctor=m,await this._prepareSimpleTypeArgs(e,t,E,l);break;case u.UnionType.Kind:await this._prepareUnionTypeArgs(e,t,E,l);break;default:return e.addError(`Invalid data type kind ${l.kind}`)}}finally{E.name&&(n==null||n.delete(E.name)),delete E[ss]}return n&&E.name?E.name:E}):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=Re(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(y,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Re(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=Re(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 c=typeof s=="string"?{type:s}:s;if(c.isArray&&!c.type)return e.addError('"type" must be defined explicitly for array fields');let l=await this._importDataTypeArgs(e,t,c.type||"any");l&&(r.fields[n]={...c,type:Re(l)})})}))}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=Re(n))}),r.attributes=L(i.attributes)}static async _prepareSimpleTypeArgs(e,t,r,i){var n,s,c,l;await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let m;if(i.base)m=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let T=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(y,T)&&(m=await this._importDataTypeArgs(e,t,T))}m&&(r.base=Re(m),r.ctor=r.ctor||m.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=L(i.attributes)),typeof((n=r.properties)==null?void 0:n[x])=="function"&&(r.generateDecoder=(s=r.properties)==null?void 0:s[x].bind(r.properties)),typeof((c=r.properties)==null?void 0:c[w])=="function"&&(r.generateEncoder=(l=r.properties)==null?void 0:l[w].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(y,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Re(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 c of n)await e.enterAsync(`[${s++}]`,async()=>{let l=await this._importDataTypeArgs(e,t,c);l&&r.types.push(Re(l))})})}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 c of n)await e.enterAsync(`[${s++}]`,async()=>{let l=await this._importDataTypeArgs(e,t,c);l&&r.types.push(Re(l))})})}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 c=n[k];switch(c||delete n._instance,i=n._instance,i!=null&&i.name&&c&&c.set(i.name,i),n==null?void 0:n.kind){case u.ArrayType.Kind:return this._createArrayType(e,t,n);case u.ComplexType.Kind:return this._createComplexType(e,t,n);case u.EnumType.Kind:return this._createEnumType(e,t,n);case u.MappedType.Kind:return this._createMappedType(e,t,n);case u.MixinType.Kind:return this._createMixinType(e,t,n);case u.SimpleType.Kind:return this._createSimpleType(e,t,n);case u.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,ue.prototype);let n=L(r);return r.type&&e.enter(".type",()=>{n.type=this._createDataType(e,t,r.type)}),ue.apply(i,[t,n]),i}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ie.prototype);let n=L(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,c]of Object.entries(r.fields))e.enter(`[${s}]`,()=>{let l=this._createDataType(e,t,c.type);l&&(n.fields[s]={...c,name:s,type:l})})}),ie.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ee.prototype);let n=L(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,tt.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),tt.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Wt.prototype);let n=L(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let c of r.types)e.enter(`[${s++}]`,()=>{let l=this._createDataType(e,t,c);if(!(l instanceof C))throw new TypeError(`"${l==null?void 0:l.kind}" can't be set as base for a "${n.kind}"`);n.types.push(l)})}),Wt.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,d.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),d.apply(i,[t,n]),i}static _createUnionType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,zt.prototype);let n=L(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let c of r.types)e.enter(`[${s++}]`,()=>{let l=this._createDataType(e,t,c);n.types.push(l)})}),zt.apply(i,[t,n]),i}};a(ei,"DataTypeFactory");var M=ei;function Re(o){return typeof o=="object"&&o.name?o.name:o}a(Re,"preferName");import{isConstructor as Jl}from"@jsopen/objects";import{omitUndefined as Dl}from"@jsopen/objects";var as=class as extends O{constructor(t){super(t.owner);p(this,"name","OpraApi");p(this,"description");this.name=t.name,this.description=t.description}toJSON(t){return Dl({transport:this.transport,name:this.name,description:this.description})}async _initialize(t,r){if(!F.test(t.name))throw new TypeError(`Invalid api name (${t.name})`);this.name=t.name,this.description=t==null?void 0:t.description}};a(as,"ApiBase");var je=as;import Ml from"path-browserify";import{omitUndefined as vl}from"@jsopen/objects";import{asMutable as Il}from"ts-gems";import{merge as ps,omit as Nl}from"@jsopen/objects";var Sl=/^(.*)(Controller)$/;function cs(o){let e=[],t=a(function(r){var l;let i=o==null?void 0:o.name;i||(i=((l=Sl.exec(r.name))==null?void 0:l[1])||r.name);let n={},s=Reflect.getOwnMetadata(se,Object.getPrototypeOf(r));s&&ps(n,s,{deep:!0});let c=Reflect.getOwnMetadata(se,r);c&&ps(n,c,{deep:!0}),ps(n,{kind:u.HttpController.Kind,name:i,path:i,...Nl(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(se,n,r);for(let m of e)m(n,r);Reflect.defineMetadata(se,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 c;(c=n.path)!=null&&c.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(cs,"HttpControllerDecoratorFactory");var ne=a(function(...o){var i;if(!this)return ne[A].apply(void 0,o);let[e,t]=o;if(O.call(this,e),!F.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=Il(this);r.kind=u.HttpController.Kind,r.types=r.node[k]=new W,r.operations=new S,r.controllers=new S,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"),fs=class fs extends O{get isRoot(){return!(this.owner instanceof ne)}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 ne)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return Ml.posix.join(this.owner instanceof ne?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=vl({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}[Se](){return`[${Me}HttpController${ve+this.name+we}]`}};a(fs,"HttpControllerClass");var ls=fs;ne.prototype=ls.prototype;Object.assign(ne,cs);ne[A]=cs;var ms=class ms extends je{constructor(t){super(t);p(this,"_controllerReverseMap",new WeakMap);p(this,"transport","http");p(this,"controllers",new S);p(this,"url");this.url=t.url}findController(t){return ne.prototype.findController.call(this,t)}findOperation(t,r){let i=this.findController(t);return i==null?void 0:i.operations.get(r)}toJSON(t){let i={...super.toJSON(),transport:this.transport,url:this.url,controllers:{}};for(let n of this.controllers.values())i.controllers[n.name]=n.toJSON(t);return i}};a(ms,"HttpApi");var rt=ms;import kl from"@browsery/type-is";import{omitUndefined as Ll}from"@jsopen/objects";import{asMutable as Pl}from"ts-gems";import{isAny as Fl,vg as jl}from"valgen";var Ce=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');O.call(this,o);let t=Pl(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,t.designType=e.designType},"HttpMediaType"),ds=class ds extends O{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=Ll({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=>kl.is(s,["json"]))&&(i=this.node.findDataType("object").generateCodec(e,t,{...r,designType:this.designType})),i=i||Fl,this.isArray&&!(this.type instanceof ue)?jl.isArray(i):i}};a(ds,"HttpMediaTypeClass");var us=ds;Ce.prototype=us.prototype;import{omitUndefined as Cl}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 hs=class hs extends Ce{constructor(t,r){super(t,r);p(this,"fieldName");p(this,"fieldType");p(this,"required");this.fieldName=r.fieldName instanceof RegExp?r.fieldName:r.fieldName.startsWith("/")?Ue(r.fieldName):r.fieldName,this.fieldType=r.fieldType,this.required=r.required}toJSON(t){return Cl({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(t)})}};a(hs,"HttpMultipartField");var ti=hs;import{omitUndefined as $l}from"@jsopen/objects";var Ul=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,ys=class ys{constructor(e,t){p(this,"start",0);p(this,"end",0);if(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=Ul.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(ys,"HttpStatusRange");var gr=ys;var Ts=class Ts extends Ce{constructor(t,r){super(t,r);p(this,"statusCode");p(this,"parameters");p(this,"partial");this.parameters=[],this.statusCode=(Array.isArray(r.statusCode)?r.statusCode:[r.statusCode]).map(i=>typeof i=="object"?new gr(i.start,i.end):new gr(i)),this.partial=r.partial}findParameter(t,r){t=t.toLowerCase();for(let i of this.parameters)if((!r||r===i.location)&&(i.name instanceof RegExp&&i.name.test(t)||i.name===t))return i}toJSON(t){let r=this.statusCode.map(n=>n.toJSON()),i=$l({...super.toJSON(t),statusCode:r.length===1&&typeof r[0]=="number"?r[0]:r,partial:this.partial});if(this.parameters.length){i.parameters=[];for(let n of this.parameters)i.parameters.push(n.toJSON(t))}return i}};a(Ts,"HttpOperationResponse");var ri=Ts;import{omitUndefined as Kl}from"@jsopen/objects";import{asMutable as Vl}from"ts-gems";import{vg as Wl}from"valgen";import{omitUndefined as ql}from"@jsopen/objects";import{asMutable as Bl}from"ts-gems";var it=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');O.call(this,o);let t=Bl(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),_s=class _s extends O{constructor(){super(...arguments);p(this,"type");p(this,"description");p(this,"examples");p(this,"isArray")}toJSON(t){let r=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return ql({type:this.type?r||this.type.toJSON(t):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(_s,"ValueClass");var Es=_s;it.prototype=Es.prototype;var wr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');it.call(this,o,e);let t=Vl(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"),gs=class gs extends it{toJSON(e){return Kl({...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}))||Wl.isAny()}};a(gs,"HttpParameterClass");var xs=gs;wr.prototype=xs.prototype;import{omitUndefined as zl}from"@jsopen/objects";var ws=class ws extends O{constructor(t){super(t);p(this,"description");p(this,"content",[]);p(this,"required");p(this,"maxContentSize");p(this,"immediateFetch");p(this,"partial");p(this,"allowPatchOperators");p(this,"keepKeyFields")}toJSON(t){return zl({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(r=>r.toJSON(t)):[],partial:this.partial,allowPatchOperators:this.allowPatchOperators})}};a(ws,"HttpRequestBody");var ii=ws;var As=class As{static async createApi(e,t){let r=new rt(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 c=await this._createController(e,t,s.metadata,s.instance,s.ctor);c&&(t.controllers.get(c.name)&&e.addError(`Duplicate controller name (${s.name})`),t.controllers.set(c.name,c))})}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 c=await this._createController(e,t,{...s.metadata,name:i},s.instance,s.ctor);c&&(t.controllers.get(c.name)&&e.addError(`Duplicate controller name (${i})`),t.controllers.set(c.name,c))})}static async _resolveControllerMetadata(e,t,r){typeof r=="function"&&!Jl(r)&&(r=t instanceof ne?r(t.instance):r()),r=await Z(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(se,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(se,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 ne(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,s,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let c=0;for(let l of r.parameters)await e.enterAsync(`[${c++}]`,async()=>{let m={...l};await e.enterAsync(".type",async()=>{m.type=await M.resolveDataType(e,s,l.type)});let T=new wr(s,m);s.parameters.push(T)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[c,l]of Object.entries(r.operations))await e.enterAsync(`[${c}]`,async()=>{let m=new D(s,{name:c,method:"GET"});await this._initHttpOperation(e,m,l),s.operations.set(c,m)})}),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 D.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await M.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 c={...s};await e.enterAsync(".type",async()=>{c.type=await M.resolveDataType(e,t,s.type)});let l=new wr(t,c);t.parameters.push(l)})}),r.responses&&await e.enterAsync(".responses",async()=>{let n=0;for(let s of r.responses)await e.enterAsync(`[${n++}]`,async()=>{let c=new ri(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,c,s),t.responses.push(c)})}),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 M.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 M.resolveDataType(e,t,n.type)});let c=new wr(t,s);t.parameters.push(c)})})}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(As,"HttpApiFactory");var Jt=As;import{omitUndefined as Yl}from"@jsopen/objects";import{md5 as Gl}from"super-fast-md5";var Os=class Os extends je{constructor(t){super(t);p(this,"_controllerReverseMap",new WeakMap);p(this,"transport","mq");p(this,"platform");p(this,"controllers",new S);this.platform=t.platform}findController(t){if(typeof t=="function"){let r=this._controllerReverseMap.get(t);if(r!=null)return r;for(let i of this.controllers.values())if(i.ctor===t)return this._controllerReverseMap.set(t,i),i;this._controllerReverseMap.set(t,null);return}return this.controllers.get(t)}findOperation(t,r){let i=this.findController(t);return i==null?void 0:i.operations.get(r)}toJSON(){let r={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON();return r}};a(Os,"MQApi");var ot=Os;var Rs=class Rs extends je{constructor(t){super(t);p(this,"_controllerReverseMap",new WeakMap);p(this,"transport","ws");p(this,"controllers",new S)}findController(t){if(typeof t=="function"){let r=this._controllerReverseMap.get(t);if(r!=null)return r;for(let i of this.controllers.values())if(i.ctor===t)return this._controllerReverseMap.set(t,i),i;this._controllerReverseMap.set(t,null);return}return this.controllers.get(t)}findOperation(t,r){let i=this.findController(t);return i==null?void 0:i.operations.get(r)}toJSON(){let r={...super.toJSON(),transport:this.transport,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON();return r}};a(Rs,"WSApi");var nt=Rs;var Ka,Va,bs=class bs extends(Va=O,Ka=be,Va){constructor(){super(null);p(this,Ka,new WeakMap);p(this,"id","");p(this,"url");p(this,"info",{});p(this,"references",new S);p(this,"types",new W);p(this,"api");this.node[k]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(t){let r=t instanceof _?this._findDataType(t.name||""):this._findDataType(t);if(r)return this[be].get(r)}findDocument(t){if(this.id===t)return this;for(let r of this.references.values()){if(r.id===t)return r;let i=r.findDocument(t);if(i)return i}}get httpApi(){if(this.api&&this.api instanceof rt)return this.api}get mqApi(){if(this.api&&this.api instanceof ot)return this.api}get wsApi(){if(this.api&&this.api instanceof nt)return this.api}getHttpApi(){if(!(this.api&&this.api instanceof rt))throw new TypeError("The document do not contains HttpApi instance");return this.api}getMqApi(){if(!(this.api&&this.api instanceof ot))throw new TypeError("The document do not contains MQApi instance");return this.api}getWsApi(){if(!(this.api&&this.api instanceof nt))throw new TypeError("The document do not contains WSApi instance");return this.api}toJSON(){return this.export()}export(t){let r=Yl({spec:u.SpecVersion,id:this.id,url:this.url,info:L(this.info,!0)});if(this.references.size){let i=0,n={};for(let[s,c]of this.references.entries())c[Ke]||(n[s]={id:c.id,url:c.url,info:L(c.info,!0)},i++);i&&(r.references=n)}if(this.types.size){r.types={};for(let i of this.types.values())i.inScope(t==null?void 0:t.scope)&&(r.types[i.name]=i.toJSON(t))}return this.api&&(r.api=this.api.toJSON(t)),r}invalidate(){let t=this.export({});delete t.id,this.id=Gl(JSON.stringify(t)),this[be]=new WeakMap}_findDataType(t,r,i){let n=this.types.get(t);if(n&&n.inScope(r))return n;if(!this.references.size)return;if(typeof t=="string"){let c=oa.exec(t);if(c){let l=c[1];if(l){let m=this.references.get(l);return m?(i=i||new WeakMap,i.set(this,!0),i.set(m,!0),m._findDataType(c[2],r,i)):void 0}t=c[2]}}i=i||new WeakMap,i.set(this,!0);let s=Array.from(this.references.keys()).reverse();for(let c of s){let l=this.references.get(c);if(n=l==null?void 0:l.types.get(t),n)return this[be].set(n,l!=null&&l[Ke]?"":c),n}for(let c of s){let l=this.references.get(c);if(i.set(l,!0),n=l._findDataType(t,r,i),n)return this[be].set(n,l!=null&&l[Ke]?"":c),n}}};a(bs,"ApiDocument");var st=bs;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"&&Sr(this,o,r)}}}[n];if(typeof o=="function"&&Nr(s.prototype,o.prototype),typeof o=="function"){let l=Reflect.getOwnMetadata(y,o);if(!l)throw new TypeError(`Class "${o}" doesn't have datatype metadata information`);if(!(l.kind===u.ComplexType.Kind||l.kind===u.MappedType.Kind||l.kind===u.MixinType.Kind))throw new TypeError(`Class "${o}" is not a ${u.ComplexType.Kind}`)}let c={...t,kind:"MappedType",base:o};return e.pick&&(c.pick=e.pick),e.omit&&(c.omit=e.omit),e.partial&&(c.partial=e.partial),e.required&&(c.required=e.required),Reflect.defineMetadata(y,c,s),typeof o=="function"&&tt._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a($e,"createMappedClass");function xg(o,e,t){return $e(o,{omit:e},t)}a(xg,"OmitType");function Og(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(Og,"PartialType");function Ng(o,e,t){return $e(o,{pick:e},t)}a(Ng,"PickType");function Ig(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(Ig,"RequiredType");function Fg(o,e){return(t,r,i)=>{if(typeof r!="string")throw new TypeError("Un-named properties can not be decorated");if(!o&&(o=Reflect.getMetadata("design:paramtypes",t,r)[i],!o))throw new TypeError("Missing parameter type");let n=Reflect.getOwnMetadata(Xt,t,r);n||(n=[],Reflect.defineMetadata(Xt,n,t,r)),n.push({...e,type:o,parameterIndex:i})}}a(Fg,"WsParam");import{updateErrorMessage as mf}from"@jsopen/objects";import{isConstructor as sf}from"@jsopen/objects";import{omitUndefined as Xl}from"@jsopen/objects";import{asMutable as Zl}from"ts-gems";var at=a(function(...o){var i;if(!this)return at[A].apply(void 0,o);let[e,t]=o;if(O.call(this,e),!F.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=Zl(this);r.kind=u.MQController.Kind,r.types=r.node[k]=new W,r.operations=new S,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"),Ns=class Ns extends O{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 at)return this.node.parent.element.findHeader(e,t)}toString(){return`[MQController ${this.name}]`}toJSON(){let e=Xl({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}[Se](){return`[${Me}MQController${ve+this.name+we}]`}};a(Ns,"MQControllerClass");var Ds=Ns;at.prototype=Ds.prototype;Object.assign(at,Kt);at[A]=Kt;import{omitUndefined as Hl}from"@jsopen/objects";import{asMutable as ef}from"ts-gems";import{vg as tf}from"valgen";var Ar=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');it.call(this,o,e);let t=ef(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"),Ms=class Ms extends it{toJSON(){return Hl({...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}))||tf.isAny()}};a(Ms,"MQHeaderClass");var Ss=Ms;Ar.prototype=Ss.prototype;import{omitUndefined as rf}from"@jsopen/objects";import{asMutable as of}from"ts-gems";import{vg as Wa}from"valgen";var Or=a(function(...o){if(!this){let[i,n]=o,s=[];return Or[A].call(void 0,s,i,n)}let[e,t]=o;if(O.call(this,e),!F.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=of(this);r.headers=[],r.types=r.node[k]=new W,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.type:r.owner.node.getDataType(t.type)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof _?t.keyType:r.owner.node.getDataType(t.keyType)),r.designType=t.designType,r.keyDesignType=t.keyDesignType},"MQOperation"),Is=class Is extends O{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=rf({kind:u.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}))||Wa.isAny()}generateKeyCodec(e,t,r){var i;return((i=this.keyType)==null?void 0:i.generateCodec(e,t,{...r,designType:this.keyDesignType}))||Wa.isAny()}};a(Is,"MQOperationClass");var vs=Is;Or.prototype=vs.prototype;Or[A]=_r;import{omitUndefined as nf}from"@jsopen/objects";var ks=class ks extends O{constructor(t,r){super(t);p(this,"channel");p(this,"description");p(this,"type");p(this,"keyType");p(this,"headers",[]);p(this,"designType");p(this,"keyDesignType");this.channel=r==null?void 0:r.channel,this.description=r==null?void 0:r.description,r!=null&&r.type?this.type=(r==null?void 0:r.type)instanceof _?r.type:this.owner.node.getDataType(r.type):this.type=this.owner.node.getDataType("any"),r!=null&&r.keyType&&(this.keyType=(r==null?void 0:r.keyType)instanceof _?r.keyType:this.owner.node.getDataType(r.keyType)),this.designType=r==null?void 0:r.designType,this.keyDesignType=r==null?void 0:r.keyDesignType}findHeader(t){let r=t.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(t))return i}toJSON(){let t=nf({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){t.headers=[];for(let r of this.headers)t.headers.push(r.toJSON())}return t}};a(ks,"MQOperationResponse");var oi=ks;var Ls=class Ls{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"&&!sf(r)&&(r=r()),r=await Z(r);let n,s,c;if(typeof r=="function"){if(s=Reflect.getMetadata(ae,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(ae,n),s?c=r:(s=r,r.instance==="object"&&(c=r.instance,n=Object.getPrototypeOf(c).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 l=new at(t,{...s,name:i,instance:c,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,l,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let m=0;for(let T of s.headers)await e.enterAsync(`[${m++}]`,async()=>{let g={...T};await e.enterAsync(".type",async()=>{T.type&&(g.type=l.node.findDataType(T.type)),!g.type&&typeof T.type=="object"&&(g.type=await M.createDataType(e,l,T.type)),g.type||(g.type=l.node.getDataType("any"))});let E=new Ar(l,g);l.headers.push(E)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[m,T]of Object.entries(s.operations))await e.enterAsync(`[${m}]`,async()=>{let g=new Or(l,{...T,name:m,types:void 0,type:void 0,keyType:void 0});await this._initMQOperation(e,g,T),l.operations.set(g.name,g)})}),l}static async _initMQOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,t,r.types)}),t.type=await M.resolveDataType(e,t,r.type),r.keyType&&(t.keyType=await M.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 M.resolveDataType(e,t,n.type)});let c=new Ar(t,s);t.headers.push(c)})}),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 M.resolveDataType(e,t,r.type),r.keyType&&(t.keyType=await M.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 M.resolveDataType(e,t,n.type)});let c=new Ar(t,s);t.headers.push(c)})})}};a(Ls,"MQApiFactory");var ni=Ls;import{isConstructor as ff}from"@jsopen/objects";import{omitUndefined as af}from"@jsopen/objects";import{asMutable as pf}from"ts-gems";var Qt=a(function(...o){var i;if(!this)return Qt[A].apply(void 0,o);let[e,t]=o;if(O.call(this,e),!F.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=pf(this);r.kind=u.WSController.Kind,r.types=r.node[k]=new W,r.operations=new S,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"),Fs=class Fs extends O{toString(){return`[WSController ${this.name}]`}toJSON(){let e=af({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}[Se](){return`[${Me}WSController${ve+this.name+we}]`}};a(Fs,"WSControllerClass");var Ps=Fs;Qt.prototype=Ps.prototype;Object.assign(Qt,Vt);Qt[A]=Vt;import{omitUndefined as cf}from"@jsopen/objects";import{asMutable as lf}from"ts-gems";var Rr=a(function(...o){if(!this){let[i,n]=o,s=[];return Rr[A].call(void 0,s,i,n)}let[e,t]=o;if(O.call(this,e),!F.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=lf(this);r.types=r.node[k]=new W,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=>({type:i.type instanceof _?i.type:r.owner.node.getDataType(i.type),parameterIndex:i.parameterIndex})):r.arguments=[],t!=null&&t.response&&(r.response=t.response instanceof _?t.response:r.owner.node.getDataType(t.response))},"WSOperation"),Cs=class Cs extends O{toJSON(){var e;return cf({kind:u.WSOperation.Kind,description:this.description,event:this.event,arguments:(e=this.arguments)==null?void 0:e.map(t=>t.type.name?t.type.name:t.type.toJSON())})}};a(Cs,"WSOperationClass");var js=Cs;Rr.prototype=js.prototype;Rr[A]=xr;var Us=class Us{static async createApi(e,t){let r=new nt(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"&&!ff(r)&&(r=r()),r=await Z(r);let n,s,c;if(typeof r=="function"){if(s=Reflect.getMetadata(pe,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(pe,n),s?c=r:(s=r,r.instance==="object"&&(c=r.instance,n=Object.getPrototypeOf(c).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 l=new Qt(t,{...s,name:i,instance:c,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,l,s.types)}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[m,T]of Object.entries(s.operations))await e.enterAsync(`[${m}]`,async()=>{let g=Reflect.getMetadata(Xt,n.prototype,m),E=T;g&&(E={...E,arguments:g});let U=new Rr(l,{...E,name:m,types:void 0,type:void 0,keyType:void 0,arguments:void 0,response:void 0});await this._initWSOperation(e,U,E),l.operations.set(m,U)})}),l}static async _initWSOperation(e,t,r){var i;r.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,t,r.types)}),(i=r.arguments)!=null&&i.length&&(await e.enterAsync(".arguments",async()=>{var s;t.arguments=[];let n;for(n of r.arguments){let c={};typeof n=="object"&&n.type&&n.parameterIndex!==null?Object.assign(c,n):c.type=n;let l=await M.resolveDataType(e,t,c.type);(s=t.arguments)==null||s.push({type:l,parameterIndex:c.parameterIndex})}}),t.arguments.sort((n,s)=>n.parameterIndex-s.parameterIndex)),r.response&&await e.enterAsync(".response",async()=>{t.response=await M.resolveDataType(e,t,r.response)})}};a(Us,"WSApiFactory");var si=Us;var uf="https://oprajs.com/spec/v"+u.SpecVersion,ai=class ai{constructor(){p(this,"_allDocuments",{})}static async createDocument(e,t){let r=new ai,i=t instanceof ye?t:new ye(t);try{let n=new st;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof Nt||i.addError(n)}catch{}if(!i.error.message){let s=i.error.details.length,c=`(${s}) error${s>1?"s":""} found in document schema.`;i.showErrorDetails&&(c+=i.error.details.map(l=>`
6
+ var Ei=Object.defineProperty;var hp=(o,e,t)=>e in o?Ei(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var a=(o,e)=>Ei(o,"name",{value:e,configurable:!0});var Ir=(o,e)=>{for(var t in e)Ei(o,t,{get:e[t],enumerable:!0})};var p=(o,e,t)=>hp(o,typeof e!="symbol"?e+"":e,t);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 rc}from"@jsopen/objects";import{isString as ic}from"valgen";import{omitUndefined as wp}from"@jsopen/objects";import Ep from"@browsery/i18next";import{splitString as _p,tokenize as Hs}from"fast-tokenizer";var yp=/\\(.)/g,Tp=/(\\)/g;function Xs(o){return o.replace(Tp,"\\\\")}a(Xs,"escapeString");function Zs(o){return o.replace(yp,"$1")}a(Zs,"unescapeString");var xp=Object.getPrototypeOf(Ep.createInstance()).constructor,tr=class tr extends xp{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",(c,l)=>c.toLocaleLowerCase(l)),s.add("uppercase",(c,l)=>c.toLocaleUpperCase(l)),s.add("upperFirst",(c,l)=>c.charAt(0).toLocaleUpperCase(l)+c.substring(1)),r!=null&&r.resources)for(let c of Object.keys(r.resources)){let l=r.resources[c];for(let m of Object.keys(l))this.addResourceBundle(c,m,l[m],!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 tr(e,t)}static createInstance(e,t){return new tr(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 Hs(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=_p(n,{delimiters:"?",quotes:!0,brackets:{"{":"}"}}),c=Zs(n.substring((s[0]||"").length+1));n=s[0]||"";let l=[],m=null;for(let A of Hs(n,{delimiters:",",quotes:!0,brackets:{"{":"}"}})){if(A.startsWith("{")){m=JSON.parse(A);continue}l.push(A)}let E=l.length>1?"$t("+l.join(",")+")":l[0];i+=c?this.t(E,c,{...r,...m}):this.t(E,{...r,...m});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,c=n.length;s<c;s++){let l=n[s];i[l]=this._deepTranslate(e[l],t,r)}return t.delete(e),i}return e}static get defaultInstance(){return gp}};a(tr,"I18n");var rr=tr,gp=rr.createInstance();var Ap=/(\))/g;function Qf(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?"?"+Xs(i).replace(Ap,"\\$1"):"")+")"}a(Qf,"translate");var _i=rr.createInstance();_i.init().catch(()=>{});var xi=class xi extends Error{constructor(t,r){super("Unknown error");p(this,"cause");p(this,"severity","error");p(this,"system");p(this,"code");p(this,"details");r=r||(t instanceof Error?t:void 0),t instanceof Error&&(r=t),r&&r instanceof Error&&(this.cause=r,r.stack&&(this.stack=r.stack)),typeof t=="string"?this.initString(t):t instanceof Error?this.initError(t):this.init(t),this.message=this.message||this.constructor.name}toString(){return _i.deep(this.message)}toJSON(){return wp({message:this.message,severity:this.severity,system:this.system,code:this.code,details:this.details,stack:this.stack},!0)}init(t){this.message=(t==null?void 0:t.message)||this.constructor.name,this.severity=(t==null?void 0:t.severity)||"error",t&&(this.system=t.system,this.code=t.code,this.details=t.details)}initString(t){this.init({message:String(t||"")||this.constructor.name,severity:"error",code:this.constructor.name})}initError(t){let r="production";this.init({message:t.message,severity:t.severity||"error",code:t.code||t.constructor.name,stack:r==="dev"||r==="development"||r==="test"?t.stack:void 0})}};a(xi,"OpraException");var Ee=xi;var gi=class gi extends Ee{constructor(t,r,i){super(t,r instanceof Error?r:void 0);p(this,"status");this.status=(typeof r=="number"?r:Number(i))||500}setStatus(t){return this.status=t,this}initError(t){typeof t.status=="number"?this.status=t.status:typeof t.getStatus=="function"&&(this.status=t.getStatus()),super.initError(t)}};a(gi,"OpraHttpError");var v=gi;var Ai=class Ai extends v{constructor(){super(...arguments);p(this,"status",400)}init(t){super.init({message:"Bad request",code:"BAD_REQUEST",...t})}};a(Ai,"BadRequestError");var ea=Ai;var wi=class wi extends v{constructor(){super(...arguments);p(this,"status",409)}init(t){super.init({message:"Conflict",code:"CONFLICT",...t})}};a(wi,"ConflictError");var ta=wi;var Oi=class Oi extends v{constructor(){super(...arguments);p(this,"status",424)}init(t){super.init({message:"The request failed due to failure of a previous request",code:"FAILED_DEPENDENCY",...t})}};a(Oi,"FailedDependencyError");var ra=Oi;var ia;(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"})(ia||(ia={}));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 _m={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 b;(function(o){o.json="application/json",o.xml="application/xml",o.yaml="text/yaml",o.yaml2="application/yaml",o.toml="text/toml",o.toml2="application/toml",o.text="text/plain",o.html="text/html",o.markdown="text/markdown",o.binary="binary/octet-stream",o.opra_response_json="application/opra.response+json",o.opra_response_xml="application/opra.response+xml",o.opra_response_yaml="text/opra.response+yaml",o.opra_response_toml="text/opra.response+toml"})(b||(b={}));var Ri=class Ri extends v{constructor(){super(...arguments);p(this,"status",R.FORBIDDEN)}init(t){super.init({message:"You are not authorized to perform this action",code:"FORBIDDEN",...t})}};a(Ri,"ForbiddenError");var kr=Ri;var bi=class bi extends v{constructor(){super(...arguments);p(this,"status",500)}init(t){super.init({message:"Internal server error",code:"INTERNAL_SERVER_ERROR",severity:"fatal",...t})}};a(bi,"InternalServerError");var oa=bi;var Di=class Di extends v{constructor(){super(...arguments);p(this,"status",405)}init(t){super.init({message:"Method not allowed",code:"METHOD_NOT_ALLOWED",...t})}};a(Di,"MethodNotAllowedError");var na=Di;var Ni=class Ni extends v{constructor(){super(...arguments);p(this,"status",406)}init(t){super.init({message:"Not Acceptable",code:"NOT_ACCEPTABLE",...t})}};a(Ni,"NotAcceptableError");var sa=Ni;var Si=class Si extends v{constructor(){super(...arguments);p(this,"status",404)}init(t){super.init({message:"Not found",code:"NOT_FOUND",...t})}};a(Si,"NotFoundError");var aa=Si;var Mi=class Mi extends kr{init(e){super.init({message:"You dont have permission for this operation",code:"PERMISSION_ERROR",...e})}};a(Mi,"PermissionError");var pa=Mi;var vi=class vi extends v{constructor(t,r,i){super({message:`There is already an other "${t}" resource with same values for field(s) [${r}]`,severity:"error",code:"RESOURCE_CONFLICT",details:{resource:t,location:r}},i);p(this,"status",409)}};a(vi,"ResourceConflictError");var ca=vi;var Ii=class Ii extends v{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(Ii,"ResourceNotAvailableError");var la=Ii;var ki=class ki extends v{constructor(){super(...arguments);p(this,"status",401)}init(t){super.init({message:"You don't have permission to perform this action",code:"UNAUTHORIZED",...t})}};a(ki,"UnauthorizedError");var fa=ki;var Li=class Li extends v{constructor(){super(...arguments);p(this,"status",422)}init(t){super.init({message:"Unprocessable entity",severity:"error",code:"UNPROCESSABLE_ENTITY",...t})}};a(Li,"UnprocessableEntityError");var ma=Li;var ua;(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"}})(ua||(ua={}));BigInt.prototype.toJSON||(BigInt.prototype.toJSON=function(){return this.toString()});RegExp.prototype.toJSON||(RegExp.prototype.toJSON=function(){return this.toString()});import{isConstructor as Op}from"@jsopen/objects";import Rp from"putil-promisify";async function Z(o){return o=Rp.isPromise(o)?await o:o,typeof o=="function"?Op(o)?o:await o():o}a(Z,"resolveThunk");var da=/^(?:file:\/\/)?(.+)$/;function Nu(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?da.exec(r):void 0;return i?i[1]:""}return""}a(Nu,"getStackFileName");function Su(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?da.exec(r):void 0;return i?i[1]:""}return""}a(Su,"getErrorStack");function Lr(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(Lr,"mergePrototype");function Pr(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(Pr,"inheritPropertyInitializers");import{isPlainObject as ya,merge as bp}from"@jsopen/objects";var y=Symbol.for("opra.type.metadata"),se=Symbol("opra.http-controller.metadata"),ae=Symbol("opra.mq-controller.metadata"),pe=Symbol("opra.ws-controller.metadata"),ir=Symbol("opra.ws-param.metadata"),Lu=Symbol("opra.rpc-controller.metadata"),T=Symbol.for("opra.type.decoder"),x=Symbol("opra.type.encoder"),w=Symbol.for("DECORATOR"),Ve=Symbol.for("BUILTIN"),ha=/([a-z$_]\w+):(.+)/i,j=/^[a-z][\w_]*$/i,k=Symbol.for("kDataTypeMap"),jr=Symbol.for("kCtorMap"),be=Symbol.for("kTypeNSMap");function L(o,e){return bp({},o,{deep:a(t=>ya(t)&&!t[y],"deep"),symbolKeys:!0,copyDescriptors:!0,ignoreUndefined:!0,filter(t,r){let i=r[t];return!e||typeof i!="function"&&(typeof i!="object"||ya(i)||Array.isArray(i))}})}a(L,"cloneObject");import{splitString as Ta}from"fast-tokenizer";var Dp=/^([+-])?([a-z_$]\w*)$/i,Np=/[^.]\(/g,Pi=class Pi{};a(Pi,"FieldsProjection");var We=Pi;(function(o){let t=class t{constructor(){p(this,"sign");p(this,"projection")}};a(t,"Item");let e=t;o.Item=e})(We||(We={}));function Ea(o,e){let t=Array.isArray(o)?o:[o];if(!(t&&t.length))return;let r=new We;for(let i of t)e||(i=i.toLowerCase()),_a(i,r);return r}a(Ea,"parseFieldsProjection");function _a(o,e){o=o.replace(Np,r=>r.charAt(0)+"."+r.substring(1));let t=Ta(o,{delimiters:".",brackets:!0,keepBrackets:!1});for(let r=0;r<t.length;r++){let i=t[r];if(i.includes(",")){let l=Ta(i,{delimiters:",",brackets:!0,keepBrackets:!0});for(let m of l)_a(m,e);continue}let n=Dp.exec(i);if(!n)throw new TypeError(`Invalid field path (${o})`);let s=n[2],c=e[s]=e[s]||new We.Item;n[1]&&(c.sign=n[1]),r===t.length-1?delete c.projection:e=c.projection=c.projection||new We}}a(_a,"parse");function Sp(o){return o&&typeof o.forEach=="function"}a(Sp,"isMap");var Q=Symbol.for("kEntries"),ce=Symbol.for("kKeyMap"),Cr=Symbol.for("kWellKnownKeys"),ji=Symbol.for("kOptions"),ct=Symbol.for("kSize"),Ci=class Ci{constructor(e,t){Object.defineProperty(this,ct,{value:0,enumerable:!1,writable:!0}),Object.defineProperty(this,Q,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,ce,{value:{},enumerable:!1,writable:!0}),Object.defineProperty(this,Cr,{value:{},enumerable:!1,writable:!0});let r=!!(t!=null&&t.caseSensitive);Object.defineProperty(this,ji,{value:{caseSensitive:r},enumerable:!1}),t!=null&&t.wellKnownKeys&&t.wellKnownKeys.forEach(i=>{r?this[Cr][i]=i:this[Cr][i.toLowerCase()]=i}),this.clear(),e&&this.setAll(e)}get size(){return this[ct]}clear(){Object.keys(this[Q]).forEach(e=>delete this[Q][e]),Object.keys(this[ce]).forEach(e=>delete this[ce][e]),this[ct]=0}forEach(e,t){for(let[r,i]of this.entries())e.call(t,i,r,this)}get(e){if(e)return this[Q][this._getStoringKey(e)]}has(e){return e?Object.prototype.hasOwnProperty.call(this[Q],this._getStoringKey(e)):!1}set(e,t){let r=this._getStoringKey(e);e=this._getOriginalKey(e);let i=Object.prototype.hasOwnProperty.call(this[Q],r);return this[Q][r]=t,i||this[ct]++,this[ce][r]=e,this}setAll(e){return Sp(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[Q])[Symbol.iterator]()}entries(){return Object.entries(this[Q])[Symbol.iterator]()}delete(e){let t=this._getStoringKey(e),r=Object.prototype.hasOwnProperty.call(this[Q],t);return delete this[Q][t],delete this[ce][t],r||this[ct]--,r}sort(e){let t={...this[Q]},r={...this[ce]},i=Array.from(this.keys());e?i.sort(e):i.sort(),this.clear();for(let n of i)this[Q][n]=t[n],this[ce][n]=r[n];return this[ct]=i.length,this}toObject(){let e={};for(let[t,r]of Object.entries(this[ce]))e[r]=this[Q][t];return e}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"[Object ResponsiveMap]"}_getOriginalKey(e){if(!e||this[ji].caseSensitive)return e;let t=this._getStoringKey(e);return this[ce][t]??this[Cr][t]??e}_getStoringKey(e){return this[ji].caseSensitive?e:e.toLowerCase()}};a(Ci,"ResponsiveMap");var S=Ci;function Wu(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(Wu,"safeJsonStringify");function Fi(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}a(Fi,"isStream");function Qu(o){return Fi(o)&&typeof o._read=="function"&&typeof o._readableState=="object"}a(Qu,"isReadable");function Yu(o){return Fi(o)&&typeof o._write=="function"}a(Yu,"isWritable");function Gu(o){return Fi(o)&&typeof o.getReader=="function"&&typeof o.pipeThrough=="function"&&typeof o.pipeTo=="function"}a(Gu,"isReadableStream");function Xu(o){return o!==null&&typeof o=="object"&&typeof o.size=="number"&&typeof o.arrayBuffer=="function"&&typeof o.stream=="function"}a(Xu,"isBlob");function Zu(o){return o!==null&&typeof o.constructor=="function"&&o.constructor.name==="FormData"&&typeof o.append=="function"&&typeof o.getAll=="function"}a(Zu,"isFormData");function Hu(o){return o!==null&&typeof o=="object"&&typeof o.host=="string"&&typeof o.href=="string"}a(Hu,"isURL");var Ui=class Ui{constructor(){p(this,"kind");this.kind=Object.getPrototypeOf(this).constructor.name}};a(Ui,"Ast");var or=Ui;var $i=class $i extends or{};a($i,"Expression");var B=$i;var Bi=class Bi extends B{};a(Bi,"Term");var ze=Bi;var qi=class qi extends ze{constructor(e){super(),this.value=e}toString(){return""+this.value}};a(qi,"Literal");var P=qi;var Ki=class Ki extends B{constructor(){super();p(this,"items",[])}append(t,r){return this.items.push(new Fr({op:t,expression:r})),this}toString(){return this.items.map((t,r)=>(r>0?t.op:"")+t.expression).join("")}};a(Ki,"ArithmeticExpression");var Je=Ki,Vi=class Vi{constructor(e){p(this,"op");p(this,"expression");Object.assign(this,e)}};a(Vi,"ArithmeticExpressionItem");var Fr=Vi;var Wi=class Wi extends ze{constructor(t){super();p(this,"items");this.items=t}toString(){return"["+this.items.map(t=>""+t).join(",")+"]"}};a(Wi,"ArrayExpression");var _e=Wi;var Mp=/\w/,zi=class zi extends B{constructor(t){super();p(this,"op");p(this,"left");p(this,"right");p(this,"prepare");Object.assign(this,t)}toString(){return`${this.left}${Mp.test(this.op)?" "+this.op+" ":this.op}${this.right}`}};a(zi,"ComparisonExpression");var le=zi;var Ji=class Ji extends B{constructor(t){super();p(this,"op");p(this,"items");Object.assign(this,t),this.op==="&&"&&(this.op="and"),this.op==="||"&&(this.op="or")}toString(){return this.items.map(t=>""+t).join(" "+this.op+" ")}};a(Ji,"LogicalExpression");var fe=Ji;var Qi=class Qi extends B{constructor(t){super();p(this,"expression");this.expression=t}toString(){return`(${this.expression})`}};a(Qi,"NegativeExpression");var nr=Qi;var Yi=class Yi extends B{constructor(t){super();p(this,"expression");this.expression=t}toString(){return`(${this.expression})`}};a(Yi,"ParenthesizedExpression");var xe=Yi;var Gi=class Gi extends P{constructor(e){super(e)}};a(Gi,"BooleanLiteral");var Qe=Gi;import{toDateDef as jp}from"putil-varhelpers";var Xi=class Xi extends TypeError{};a(Xi,"SyntaxError");var Ur=Xi,Zi=class Zi extends TypeError{constructor(e){super(typeof e=="string"?e:e==null?void 0:e.message),typeof e=="object"&&Object.assign(this,e)}};a(Zi,"FilterValidationError");var me=Zi,Hi=class Hi extends Error{constructor(e,t){super(e),Object.assign(this,t)}};a(Hi,"FilterParseError");var $r=Hi;var vp=/'/g,Ip=/(\\)/g,kp=/\\(.)/g;function Lp(o){return o.replace(Ip,"\\\\")}a(Lp,"escapeString");function Pp(o){return o.replace(kp,"$1")}a(Pp,"unescapeString");function De(o){return"'"+Lp(o).replace(vp,"\\'")+"'"}a(De,"quoteFilterString");function sr(o){return o&&(o.startsWith("'")||o.startsWith('"'))&&o.endsWith(o.charAt(0))?Pp(o.substring(1,o.length-1)):o}a(sr,"unquoteFilterString");var xa=new Date(0),eo=class eo extends P{constructor(t){super("");p(this,"value");if(t instanceof Date){this.value=t.toISOString();return}if(typeof t=="string"&&jp(t,xa)!==xa){this.value=t;return}throw new me(`Invalid date value "${t}"`)}toString(){return De(this.value)}};a(eo,"DateLiteral");var Ne=eo;import{toDateDef as Cp}from"putil-varhelpers";var ga=new Date(0),to=class to extends P{constructor(t){super("");p(this,"value");if(t instanceof Date){this.value=t.toISOString();return}if(typeof t=="string"&&Cp(t,ga)!==ga){this.value=t;return}throw new me(`Invalid date-time value "${t}"`)}toString(){return De(this.value)}};a(to,"DateTimeLiteral");var ar=to;var ro=class ro extends P{constructor(){super(null);p(this,"value",null)}};a(ro,"NullLiteral");var Ye=ro;var io=class io extends P{constructor(t){super(0);p(this,"value");if(typeof t=="number"||typeof t=="bigint"){this.value=t;return}try{if(typeof t=="string"){if(t.includes(".")){this.value=parseFloat(t);return}let r=Number(t);""+r===t?this.value=r:this.value=BigInt(t);return}}catch{}throw new me(`Invalid number literal ${t}`)}toString(){return typeof this.value=="bigint"?(""+this.value).replace(/n$/,""):""+this.value}};a(io,"NumberLiteral");var ge=io;var oo=class oo extends P{constructor(e){super(""+e)}};a(oo,"QualifiedIdentifier");var H=oo;var no=class no extends P{constructor(e){super(""+e)}toString(){return De(this.value)}};a(no,"StringLiteral");var Ge=no;var Fp=/^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/,so=class so extends P{constructor(t){super("");p(this,"value");if(t instanceof Date){this.value=Br(t.getHours())+":"+Br(t.getMinutes())+(t.getSeconds()?":"+Br(t.getSeconds()):"")+(t.getMilliseconds()?"."+Br(t.getMilliseconds()):"");return}if(typeof t=="string"&&Fp.test(t)){this.value=t;return}throw new me(`Invalid time value "${t}"`)}toString(){return De(this.value)}};a(so,"TimeLiteral");var Xe=so;function Br(o){return o<=9?"0"+o:""+o}a(Br,"pad");import{CharStream as ec,CommonTokenStream as tc}from"@browsery/antlr4";import{ATNDeserializer as Up,DFA as $p,Lexer as Bp,LexerATNSimulator as qp,PredictionContextCache as Kp,Token as Vp}from"@browsery/antlr4";var h=class h extends Bp{constructor(e){super(e),this._interp=new qp(this,h._ATN,h.DecisionsToDFA,new Kp)}get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return h.literalNames}get symbolicNames(){return h.symbolicNames}get ruleNames(){return h.ruleNames}get serializedATN(){return h._serializedATN}get channelNames(){return h.channelNames}get modeNames(){return h.modeNames}static get _ATN(){return h.__ATN||(h.__ATN=new Up().deserialize(h._serializedATN)),h.__ATN}};a(h,"OpraFilterLexer"),p(h,"T__0",1),p(h,"T__1",2),p(h,"T__2",3),p(h,"T__3",4),p(h,"T__4",5),p(h,"T__5",6),p(h,"T__6",7),p(h,"T__7",8),p(h,"T__8",9),p(h,"T__9",10),p(h,"T__10",11),p(h,"T__11",12),p(h,"T__12",13),p(h,"T__13",14),p(h,"T__14",15),p(h,"T__15",16),p(h,"T__16",17),p(h,"T__17",18),p(h,"T__18",19),p(h,"T__19",20),p(h,"T__20",21),p(h,"T__21",22),p(h,"T__22",23),p(h,"T__23",24),p(h,"T__24",25),p(h,"T__25",26),p(h,"T__26",27),p(h,"T__27",28),p(h,"T__28",29),p(h,"T__29",30),p(h,"T__30",31),p(h,"T__31",32),p(h,"T__32",33),p(h,"T__33",34),p(h,"IDENTIFIER",35),p(h,"POLAR_OP",36),p(h,"DATE",37),p(h,"DATETIME",38),p(h,"TIME",39),p(h,"NUMBER",40),p(h,"INTEGER",41),p(h,"STRING",42),p(h,"WHITESPACE",43),p(h,"EOF",Vp.EOF),p(h,"channelNames",["DEFAULT_TOKEN_CHANNEL","HIDDEN"]),p(h,"literalNames",[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"]),p(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"]),p(h,"modeNames",["DEFAULT_MODE"]),p(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"]),p(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]),p(h,"__ATN"),p(h,"DecisionsToDFA",h._ATN.decisionToState.map((e,t)=>new $p(e,t)));var pr=h;import{ATN as Aa,ATNDeserializer as Wp,DFA as zp,FailedPredicateException as Jp,NoViableAltException as ao,Parser as Qp,ParserATNSimulator as Yp,ParserRuleContext as K,PredictionContextCache as Gp,RecognitionException as q,Token as Xp}from"@browsery/antlr4";var f=class f extends Qp{get grammarFileName(){return"OpraFilter.g4"}get literalNames(){return f.literalNames}get symbolicNames(){return f.symbolicNames}get ruleNames(){return f.ruleNames}get serializedATN(){return f._serializedATN}createFailedPredicateException(e,t){return new Jp(this,e,t)}constructor(e){super(e),this._interp=new Yp(this,f._ATN,f.DecisionsToDFA,new Gp)}root(){let e=new po(this,this._ctx,this.state);this.enterRule(e,0,f.RULE_root);try{this.enterOuterAlt(e,1),this.state=34,this.expression(0),this.state=35,this.match(f.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 X(this,this._ctx,r),n=i,s=2;this.enterRecursionRule(i,2,f.RULE_expression,e);let c;try{let l;this.enterOuterAlt(i,1);{switch(this.state=48,this._errHandler.sync(this),this._input.LA(1)){case 35:i=new fo(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 co(this,i),this._ctx=i,n=i,this.state=42,this.match(f.T__0),this.state=43,this.parenthesizedItem(),this.state=44,this.match(f.T__1);break;case 3:case 4:i=new lo(this,i),this._ctx=i,n=i,this.state=46,c=this._input.LA(1),c===3||c===4?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=47,this.expression(1);break;default:throw new ao(this)}for(this._ctx.stop=this._input.LT(-1),this.state=56,this._errHandler.sync(this),l=this._interp.adaptivePredict(this._input,1,this._ctx);l!==2&&l!==Aa.INVALID_ALT_NUMBER;){if(l===1){this._parseListeners!=null&&this.triggerExitRuleEvent(),n=i;{if(i=new cr(this,new X(this,t,r)),this.pushNewRecursionContext(i,s,f.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),l=this._interp.adaptivePredict(this._input,1,this._ctx)}}}catch(l){if(l instanceof q)i.exception=l,this._errHandler.reportError(this,l),this._errHandler.recover(this,l);else throw l}finally{this.unrollRecursionContexts(t)}return i}comparisonLeft(){let e=new qr(this,this._ctx,this.state);this.enterRule(e,4,f.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 Kr(this,this._ctx,this.state);this.enterRule(e,6,f.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 ao(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 Vr(this,this._ctx,this.state);this.enterRule(e,8,f.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 Y(this,this._ctx,this.state);this.enterRule(e,10,f.RULE_value);try{switch(this.state=77,this._errHandler.sync(this),this._input.LA(1)){case 40:e=new xo(this,e),this.enterOuterAlt(e,1),this.state=69,this.match(f.NUMBER);break;case 13:case 14:e=new Eo(this,e),this.enterOuterAlt(e,2),this.state=70,this.infinity();break;case 10:case 11:e=new _o(this,e),this.enterOuterAlt(e,3),this.state=71,this.boolean_();break;case 12:e=new uo(this,e),this.enterOuterAlt(e,4),this.state=72,this.null_();break;case 38:e=new ho(this,e),this.enterOuterAlt(e,5),this.state=73,this.match(f.DATETIME);break;case 37:e=new To(this,e),this.enterOuterAlt(e,6),this.state=74,this.match(f.DATE);break;case 39:e=new mo(this,e),this.enterOuterAlt(e,7),this.state=75,this.match(f.TIME);break;case 42:e=new yo(this,e),this.enterOuterAlt(e,8),this.state=76,this.match(f.STRING);break;default:throw new ao(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 lr(this,this._ctx,this.state);this.enterRule(e,12,f.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!==Aa.INVALID_ALT_NUMBER;)t===1&&(this.state=79,this.identifier(),this.state=80,this.match(f.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 Wr(this,this._ctx,this.state);this.enterRule(e,14,f.RULE_externalConstant);try{this.enterOuterAlt(e,1),this.state=89,this.match(f.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 lt(this,this._ctx,this.state);this.enterRule(e,16,f.RULE_identifier);try{this.enterOuterAlt(e,1),this.state=92,this.match(f.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 zr(this,this._ctx,this.state);this.enterRule(e,18,f.RULE_arrayValue);let t;try{this.enterOuterAlt(e,1);{for(this.state=94,this.match(f.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(f.T__7),this.state=97,this.value(),this.state=102,this._errHandler.sync(this),t=this._input.LA(1);this.state=103,this.match(f.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 Jr(this,this._ctx,this.state);this.enterRule(e,20,f.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 Qr(this,this._ctx,this.state);this.enterRule(e,22,f.RULE_null);try{this.enterOuterAlt(e,1),this.state=107,this.match(f.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 Yr(this,this._ctx,this.state);this.enterRule(e,24,f.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 go(this,this._ctx,this.state);this.enterRule(e,26,f.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 Gr(this,this._ctx,this.state);this.enterRule(e,28,f.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 Xr(this,this._ctx,this.state);this.enterRule(e,30,f.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 Ao(this,this._ctx,this.state);this.enterRule(e,32,f.RULE_polarityOperator);try{this.enterOuterAlt(e,1),this.state=117,this.match(f.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){return t===1?this.expression_sempred(e,r):!0}expression_sempred(e,t){return t===0?this.precpred(this._ctx,3):!0}static get _ATN(){return f.__ATN||(f.__ATN=new Wp().deserialize(f._serializedATN)),f.__ATN}};a(f,"OpraFilterParser"),p(f,"T__0",1),p(f,"T__1",2),p(f,"T__2",3),p(f,"T__3",4),p(f,"T__4",5),p(f,"T__5",6),p(f,"T__6",7),p(f,"T__7",8),p(f,"T__8",9),p(f,"T__9",10),p(f,"T__10",11),p(f,"T__11",12),p(f,"T__12",13),p(f,"T__13",14),p(f,"T__14",15),p(f,"T__15",16),p(f,"T__16",17),p(f,"T__17",18),p(f,"T__18",19),p(f,"T__19",20),p(f,"T__20",21),p(f,"T__21",22),p(f,"T__22",23),p(f,"T__23",24),p(f,"T__24",25),p(f,"T__25",26),p(f,"T__26",27),p(f,"T__27",28),p(f,"T__28",29),p(f,"T__29",30),p(f,"T__30",31),p(f,"T__31",32),p(f,"T__32",33),p(f,"T__33",34),p(f,"IDENTIFIER",35),p(f,"POLAR_OP",36),p(f,"DATE",37),p(f,"DATETIME",38),p(f,"TIME",39),p(f,"NUMBER",40),p(f,"INTEGER",41),p(f,"STRING",42),p(f,"WHITESPACE",43),p(f,"EOF",Xp.EOF),p(f,"RULE_root",0),p(f,"RULE_expression",1),p(f,"RULE_comparisonLeft",2),p(f,"RULE_comparisonRight",3),p(f,"RULE_parenthesizedItem",4),p(f,"RULE_value",5),p(f,"RULE_qualifiedIdentifier",6),p(f,"RULE_externalConstant",7),p(f,"RULE_identifier",8),p(f,"RULE_arrayValue",9),p(f,"RULE_boolean",10),p(f,"RULE_null",11),p(f,"RULE_infinity",12),p(f,"RULE_arithmeticOperator",13),p(f,"RULE_comparisonOperator",14),p(f,"RULE_logicalOperator",15),p(f,"RULE_polarityOperator",16),p(f,"literalNames",[null,"'('","')'","'not'","'!'","'.'","'@'","'['","','","']'","'true'","'false'","'null'","'Infinity'","'infinity'","'+'","'-'","'*'","'/'","'<='","'<'","'>'","'>='","'='","'!='","'in'","'!in'","'like'","'!like'","'ilike'","'!ilike'","'and'","'or'","'&&'","'||'"]),p(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"]),p(f,"ruleNames",["root","expression","comparisonLeft","comparisonRight","parenthesizedItem","value","qualifiedIdentifier","externalConstant","identifier","arrayValue","boolean","null","infinity","arithmeticOperator","comparisonOperator","logicalOperator","polarityOperator"]),p(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]),p(f,"__ATN"),p(f,"DecisionsToDFA",f._ATN.decisionToState.map((e,t)=>new zp(e,t)));var N=f,wo=class wo extends K{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(X,0)}EOF(){return this.getToken(N.EOF,0)}get ruleIndex(){return N.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(wo,"RootContext");var po=wo,Oo=class Oo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.RULE_expression}copyFrom(e){super.copyFrom(e)}};a(Oo,"ExpressionContext");var X=Oo,Ro=class Ro extends X{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}parenthesizedItem(){return this.getTypedRuleContext(Vr,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(Ro,"ParenthesizedExpressionContext");var co=Ro,bo=class bo 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(bo,"NegativeExpressionContext");var lo=bo,Do=class Do extends X{constructor(t,r){super(t,r.parentCtx,r.invokingState);p(this,"_left");p(this,"_operator");p(this,"_right");super.copyFrom(r)}comparisonLeft(){return this.getTypedRuleContext(qr,0)}comparisonOperator(){return this.getTypedRuleContext(Gr,0)}comparisonRight(){return this.getTypedRuleContext(Kr,0)}enterRule(t){t.enterComparisonExpression&&t.enterComparisonExpression(this)}exitRule(t){t.exitComparisonExpression&&t.exitComparisonExpression(this)}accept(t){return t.visitComparisonExpression?t.visitComparisonExpression(this):t.visitChildren(this)}};a(Do,"ComparisonExpressionContext");var fo=Do,No=class No extends X{constructor(t,r){super(t,r.parentCtx,r.invokingState);p(this,"_op");super.copyFrom(r)}expression_list(){return this.getTypedRuleContexts(X)}expression(t){return this.getTypedRuleContext(X,t)}logicalOperator(){return this.getTypedRuleContext(Xr,0)}enterRule(t){t.enterLogicalExpression&&t.enterLogicalExpression(this)}exitRule(t){t.exitLogicalExpression&&t.exitLogicalExpression(this)}accept(t){return t.visitLogicalExpression?t.visitLogicalExpression(this):t.visitChildren(this)}};a(No,"LogicalExpressionContext");var cr=No,So=class So extends K{constructor(e,t,r){super(t,r),this.parser=e}qualifiedIdentifier(){return this.getTypedRuleContext(lr,0)}get ruleIndex(){return N.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(So,"ComparisonLeftContext");var qr=So,Mo=class Mo extends K{constructor(e,t,r){super(t,r),this.parser=e}value(){return this.getTypedRuleContext(Y,0)}qualifiedIdentifier(){return this.getTypedRuleContext(lr,0)}externalConstant(){return this.getTypedRuleContext(Wr,0)}arrayValue(){return this.getTypedRuleContext(zr,0)}get ruleIndex(){return N.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(Mo,"ComparisonRightContext");var Kr=Mo,vo=class vo extends K{constructor(e,t,r){super(t,r),this.parser=e}expression(){return this.getTypedRuleContext(X,0)}get ruleIndex(){return N.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(vo,"ParenthesizedItemContext");var Vr=vo,Io=class Io extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.RULE_value}copyFrom(e){super.copyFrom(e)}};a(Io,"ValueContext");var Y=Io,ko=class ko extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}TIME(){return this.getToken(N.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(ko,"TimeLiteralContext");var mo=ko,Lo=class Lo extends Y{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(Lo,"NullLiteralContext");var uo=Lo,Po=class Po extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATETIME(){return this.getToken(N.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(Po,"DateTimeLiteralContext");var ho=Po,jo=class jo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}STRING(){return this.getToken(N.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(jo,"StringLiteralContext");var yo=jo,Co=class Co extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}DATE(){return this.getToken(N.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(Co,"DateLiteralContext");var To=Co,Fo=class Fo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}infinity(){return this.getTypedRuleContext(Yr,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(Fo,"InfinityLiteralContext");var Eo=Fo,Uo=class Uo extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}boolean_(){return this.getTypedRuleContext(Jr,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(Uo,"BooleanLiteralContext");var _o=Uo,$o=class $o extends Y{constructor(e,t){super(e,t.parentCtx,t.invokingState),super.copyFrom(t)}NUMBER(){return this.getToken(N.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($o,"NumberLiteralContext");var xo=$o,Bo=class Bo extends K{constructor(e,t,r){super(t,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(lt)}identifier(e){return this.getTypedRuleContext(lt,e)}get ruleIndex(){return N.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(Bo,"QualifiedIdentifierContext");var lr=Bo,qo=class qo extends K{constructor(e,t,r){super(t,r),this.parser=e}identifier(){return this.getTypedRuleContext(lt,0)}get ruleIndex(){return N.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(qo,"ExternalConstantContext");var Wr=qo,Ko=class Ko extends K{constructor(e,t,r){super(t,r),this.parser=e}IDENTIFIER(){return this.getToken(N.IDENTIFIER,0)}get ruleIndex(){return N.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(Ko,"IdentifierContext");var lt=Ko,Vo=class Vo extends K{constructor(e,t,r){super(t,r),this.parser=e}value_list(){return this.getTypedRuleContexts(Y)}value(e){return this.getTypedRuleContext(Y,e)}get ruleIndex(){return N.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(Vo,"ArrayValueContext");var zr=Vo,Wo=class Wo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(Wo,"BooleanContext");var Jr=Wo,zo=class zo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(zo,"NullContext");var Qr=zo,Jo=class Jo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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 Yr=Jo,Qo=class Qo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(Qo,"ArithmeticOperatorContext");var go=Qo,Yo=class Yo extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(Yo,"ComparisonOperatorContext");var Gr=Yo,Go=class Go extends K{constructor(e,t,r){super(t,r),this.parser=e}get ruleIndex(){return N.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(Go,"LogicalOperatorContext");var Xr=Go,Xo=class Xo extends K{constructor(e,t,r){super(t,r),this.parser=e}POLAR_OP(){return this.getToken(N.POLAR_OP,0)}get ruleIndex(){return N.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(Xo,"PolarityOperatorContext");var Ao=Xo;import{ParseTreeVisitor as Zp}from"@browsery/antlr4";var Zo=class Zo extends P{constructor(e){super(""+e)}toString(){return"@"+super.toString()}};a(Zo,"ExternalConstant");var Zr=Zo;var Ho=class Ho extends Zp{constructor(t){super();p(this,"_timeZone");this._timeZone=t==null?void 0:t.timeZone}visitChildren(t){let r=super.visitChildren(t);return Array.isArray(r)&&r.length<2?r[0]:r??t.getText()}defaultResult(){}visitRoot(t){return this.visit(t.expression())}visitParenthesizedExpression(t){let r=this.visit(t.parenthesizedItem());return new xe(r)}visitParenthesizedItem(t){return this.visit(t.expression())}visitNegativeExpression(t){let r=this.visit(t.expression());return new nr(r)}visitComparisonExpression(t){return new le({op:t.comparisonOperator().getText(),left:this.visit(t.comparisonLeft()),right:this.visit(t.comparisonRight())})}visitLogicalExpression(t){let r=[],i=a((n,s)=>{for(let c of n){if(c instanceof cr&&c.logicalOperator().getText()===s){i(c.expression_list(),c.logicalOperator().getText());continue}let l=this.visit(c);r.push(l)}},"wrapChildren");return i(t.expression_list(),t.logicalOperator().getText()),new fe({op:t.logicalOperator().getText(),items:r})}visitQualifiedIdentifier(t){return new H(t.getText())}visitExternalConstant(t){return new Zr(t.identifier().getText())}visitNullLiteral(){return new Ye}visitBooleanLiteral(t){return new Qe(t.getText()==="true")}visitNumberLiteral(t){return new ge(t.getText())}visitStringLiteral(t){return new Ge(sr(t.getText()))}visitInfinityLiteral(){return new ge(1/0)}visitDateLiteral(t){return new Ne(sr(t.getText()))}visitDateTimeLiteral(t){return new ar(sr(t.getText()))}visitTimeLiteral(t){return new Xe(sr(t.getText()))}visitArrayValue(t){return new _e(t.value_list().map(r=>this.visit(r)))}};a(Ho,"FilterTreeVisitor");var fr=Ho;import{ErrorListener as Hp}from"@browsery/antlr4";var en=class en extends Hp{constructor(t){super();p(this,"errors");this.errors=t}syntaxError(t,r,i,n,s,c){this.errors.push(new $r(s,{recognizer:t,offendingSymbol:r,line:i,column:n,e:c}))}};a(en,"OpraErrorListener");var mr=en;function tn(o,e){let t=new ec(o),r=new pr(t),i=new tc(r),n=new N(i);n.buildParseTrees=!0;let s=[],c=new mr(s);r.removeErrorListeners(),r.addErrorListener(c),n.removeErrorListeners(),n.addErrorListener(c);let l=n.root();if(s.length){let m=[];for(let A of s)m.push(A.message+(o.includes(`
7
+ `)?" at line: "+A.line+" column: "+A.column:" at column: "+A.column));let E=new Ur(m.join(`
8
+ `));throw E.errors=s,E}return e=e||new fr,e.visit(l)}a(tn,"parse");var rn=class rn{constructor(e,t){p(this,"_rules",new S);p(this,"_decoderCache",new WeakMap);if(Object.defineProperty(this,"_rules",{value:new S(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,rc({...t,operators:r}))}normalizeFilter(e,t,r){let i=typeof e=="string"?tn(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 Je)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 P){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 c;s.op==="like"||s.op==="!like"||s.op==="ilike"||s.op==="!ilike"?c=ic:c=this._decoderCache.get(s.left.field),c||(c=s.left.field.generateCodec("decode",{scope:i,projection:"*",ignoreReadonlyFields:!0,coerce:!0}),this._decoderCache.set(s.left.field,c)),e.value=c(e.value,{coerce:!0})}}}return e}toJSON(){return this._rules.toObject()}[Symbol.iterator](){return this._rules.entries()}};a(rn,"FilterRules");var ft=rn;import xc from"object-hash";import{asMutable as gc}from"ts-gems";import{validator as Ac,vg as G}from"valgen";import"reflect-metadata";import{omitUndefined as Tc}from"@jsopen/objects";import{asMutable as Ec}from"ts-gems";import{vg as ei}from"valgen";var u={};Ir(u,{ArrayType:()=>mt,ComplexType:()=>ut,EnumType:()=>dt,HttpController:()=>ur,HttpOperation:()=>on,MQController:()=>nn,MQOperation:()=>sn,MappedType:()=>ht,MixinType:()=>yt,SimpleType:()=>Tt,SpecVersion:()=>Dy,UnionType:()=>Et,WSController:()=>an,WSOperation:()=>pn,isArrayType:()=>fc,isComplexType:()=>nc,isDataType:()=>oc,isEnumType:()=>cc,isHttpController:()=>mc,isMappedType:()=>pc,isMixinType:()=>ac,isSimpleType:()=>sc,isUnionType:()=>lc});var Dy="1.0";var mt;(function(o){o.Kind="ArrayType"})(mt||(mt={}));var ut;(function(o){o.Kind="ComplexType"})(ut||(ut={}));var dt;(function(o){o.Kind="EnumType"})(dt||(dt={}));var ht;(function(o){o.Kind="MappedType"})(ht||(ht={}));var yt;(function(o){o.Kind="MixinType"})(yt||(yt={}));var Tt;(function(o){o.Kind="SimpleType"})(Tt||(Tt={}));var Et;(function(o){o.Kind="UnionType"})(Et||(Et={}));var ur;(function(o){o.Kind="HttpController"})(ur||(ur={}));var on;(function(o){o.Kind="HttpOperation"})(on||(on={}));var nn;(function(o){o.Kind="MQController"})(nn||(nn={}));var sn;(function(o){o.Kind="MQOperation"})(sn||(sn={}));function oc(o){return o&&typeof o=="object"&&(o.kind===mt.Kind||o.kind===ut.Kind||o.kind===dt.Kind||o.kind===ht.Kind||o.kind===Tt.Kind||o.kind===yt.Kind||o.kind===Et.Kind)}a(oc,"isDataType");function nc(o){return o&&typeof o=="object"&&o.kind===ut.Kind}a(nc,"isComplexType");function sc(o){return o&&typeof o=="object"&&o.kind===Tt.Kind}a(sc,"isSimpleType");function ac(o){return o&&typeof o=="object"&&o.kind===yt.Kind}a(ac,"isMixinType");function pc(o){return o&&typeof o=="object"&&o.kind===ht.Kind}a(pc,"isMappedType");function cc(o){return o&&typeof o=="object"&&o.kind===dt.Kind}a(cc,"isEnumType");function lc(o){return o&&typeof o=="object"&&o.kind===Et.Kind}a(lc,"isUnionType");function fc(o){return o&&typeof o=="object"&&o.kind===mt.Kind}a(fc,"isArrayType");function mc(o){return o&&typeof o=="object"&&o.kind===ur.Kind}a(mc,"isHttpController");var an;(function(o){o.Kind="WSController"})(an||(an={}));var pn;(function(o){o.Kind="WSOperation"})(pn||(pn={}));import{omitUndefined as hc}from"@jsopen/objects";import{asMutable as yc}from"ts-gems";import{asMutable as uc}from"ts-gems";import{uid as dc}from"uid";var wa;wa=k;var cn=class cn{constructor(e,t){p(this,wa);p(this,"_document");p(this,"parent");p(this,"element");this.element=e,this.parent=t}getDocument(){if(this._document)return this._document;if(this.element[be])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[k])==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(y,e).name;else if(typeof e=="object"){let n=e[y];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===u.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===u.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===u.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===u.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===u.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===u.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===u.UnionType.Kind)return r;throw new TypeError(`Data type "${r.name||r}" is not a UnionType`)}};a(cn,"DocumentNode");var Hr=cn;var O=a(function(o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let e=uc(this);e.id=dc(16),Object.defineProperty(e,"node",{value:new Hr(this,o==null?void 0:o.node),enumerable:!1,writable:!0}),o&&Object.defineProperty(e,"owner",{value:o,enumerable:!1,writable:!0})},"DocumentElement"),fn=class fn{};a(fn,"DocumentElementClass");var ln=fn;O.prototype=ln.prototype;var Se=Symbol.for("nodejs.util.inspect.custom"),Ae="\x1B[0m",Me="\x1B[33m",ve="\x1B[35m";function dr(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(dr,"testScopeMatch");var g=a(function(o,e,t){if(!this)throw new TypeError('"this" should be passed to call class constructor');if(e!=null&&e.name&&!j.test(e.name))throw new TypeError(`"${e.name}" is not a valid DataType name`);O.call(this,o);let r=yc(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"),un=class un extends O{get embedded(){return!this.name}inScope(e){return dr(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 hc({kind:this.kind,description:this.description,abstract:this.abstract,examples:this.examples})}toString(){return`[${Object.getPrototypeOf(this).constructor.name} ${this.name||"#Embedded"}]`}[Se](){return`[${Me+Object.getPrototypeOf(this).constructor.name+Ae} ${ve+this.name+Ae}]`}};a(un,"DataTypeClass");var mn=un;g.prototype=mn.prototype;var ue=a(function(...o){if(!this)return ue[w].apply(void 0,o);let[e,t,r]=o;g.call(this,e,t,r);let i=Ec(this);i.kind=u.ArrayType.Kind,i.type=t.type,i.minOccurs=t.minOccurs,i.maxOccurs=t.maxOccurs},"ArrayType"),hn=class hn extends g{toJSON(e){let t=super.toJSON(e),r=this.node.getDataTypeNameWithNs(this.type);return Tc({...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=ei.isArray(i);let n=[];return this.minOccurs&&n.push(ei.lengthMin(this.minOccurs)),this.maxOccurs&&n.push(ei.lengthMax(this.maxOccurs)),n.length>0?ei.pipe([i,...n],{returnIndex:0}):i}extendsFrom(){return!1}_locateBase(){}};a(hn,"ArrayTypeClass");var dn=hn;ue.prototype=dn.prototype;ue[w]=_c;function _c(o,e){let i=class i{};a(i,"ArrayClass");let t=i,r={...e,kind:u.ArrayType.Kind,type:o};return Reflect.defineMetadata(y,r,t),t}a(_c,"ArrayTypeFactory");var _t=/^([+-])?([a-z$_][\w.]*)$/i,F=a(function(...o){if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;g.call(this,e,t,r);let i=gc(this);i._fields=new S},"ComplexTypeBase"),Tn=class Tn extends g{constructor(){super(...arguments);p(this,"ctor");p(this,"additionalFields");p(this,"keyField")}fieldCount(t){if(t==="*")return this._fields.size;let r=0;for(let i of this.fields(t))r++;return r}fieldEntries(t){let r=this._fields.entries();if(t==="*")return r;let i;return{next(){for(;r&&(i=r.next(),!(i.done||i.value&&i.value[1].inScope(t))););return i.done?{done:i.done,value:void 0}:{done:i.done,value:[i.value[0],i.value[1].forScope(t)]}},return(n){return r=void 0,{done:!0,value:n}},[Symbol.iterator](){return this}}}fields(t){let r=this.fieldEntries(t),i;return{next(){var n;return r?(i=r.next(),{done:i.done,value:(n=i.value)==null?void 0:n[1]}):{done:!0,value:void 0}},return(n){return r=void 0,{done:!0,value:n}},[Symbol.iterator](){return this}}}fieldNames(t){if(t==="*")return this._fields.keys();let r=this.fieldEntries(t),i;return{next(){var n;return r?(i=r.next(),{done:i.done,value:(n=i.value)==null?void 0:n[0]}):{done:!0,value:void 0}},return(n){return r=void 0,{done:!0,value:n}},[Symbol.iterator](){return this}}}findField(t,r){if(t.includes(".")){let n=this.parseFieldPath(t,{scope:r});if(n.length===0)throw new Error(`Field "${t}" does not exist in scope "${r}"`);let s=n.pop();return s==null?void 0:s.field}let i=this._fields.get(t);if(i&&i.inScope(r))return i.forScope(r)}getField(t,r){let i=this.findField(t,"*");if(i&&!i.inScope(r))throw new Error(`Field "${t}" does not exist in scope "${r||"null"}"`);if(!i)throw new Error(`Field (${t}) does not exist`);return i.forScope(r)}parseFieldPath(t,r){var _,U,qe;let i=this,n,s=t.split("."),c=s.length,l=[],m=this.owner.node.getDataType("object"),E=r==null?void 0:r.allowSigns,A=a(()=>l.map(C=>C.fieldName).join("."),"getStrPath");for(let C=0;C<c;C++){let V={fieldName:s[C],dataType:m};l.push(V);let Ke=_t.exec(s[C]);if(!Ke)throw new TypeError(`Invalid field name (${A()})`);if(Ke[1]&&((C===0&&E==="first"||E==="each")&&(V.sign=Ke[1]),V.fieldName=Ke[2]),i){if(i instanceof F){if(n=i.findField(V.fieldName,r==null?void 0:r.scope),n){V.fieldName=n.name,V.field=n,V.dataType=n.type,i=n.type;continue}if(((_=i.additionalFields)==null?void 0:_[0])===!0){V.additionalField=!0,V.dataType=m,i=void 0;continue}if(((U=i.additionalFields)==null?void 0:U[0])==="type"&&((qe=i.additionalFields)==null?void 0:qe[1])instanceof g){V.additionalField=!0,V.dataType=i.additionalFields[1],i=i.additionalFields[1];continue}throw new Error(`Unknown field (${l.map(Ti=>Ti.fieldName).join(".")})`)}throw new TypeError(`"${l.map(Ti=>Ti.fieldName).join(".")}" field is not a complex type and has no child fields`)}V.additionalField=!0,V.dataType=m}return l}normalizeFieldPath(t,r){return this.parseFieldPath(t,r).map(i=>(i.sign||"")+i.fieldName).join(".")}generateCodec(t,r){var l;let i=r!=null&&r.cache?r:{...r,projection:Array.isArray(r==null?void 0:r.projection)?Ea(r.projection):r==null?void 0:r.projection,currentPath:""},n=this._generateSchema(t,i),s;if(this.additionalFields instanceof g)s=this.additionalFields.generateCodec(t,r);else if(typeof this.additionalFields=="boolean")s=this.additionalFields;else if(Array.isArray(this.additionalFields))if(this.additionalFields.length<2)s="error";else{let m=s[1];s=Ac((E,A,_)=>A.fail(_,m,E))}let c=G.isObject(n,{ctor:this.name==="object"?Object:this.ctor,additionalFields:s,name:this.name,coerce:!0,caseInSensitive:r==null?void 0:r.caseInSensitive,onFail:r==null?void 0:r.onFail});if(i.level===0&&((l=i.forwardCallbacks)!=null&&l.size))for(let m of i.forwardCallbacks)m();return c}_generateSchema(t,r){var m;r.fieldCache=r.fieldCache||new Map,r.level=r.level||0,r.forwardCallbacks=r.forwardCallbacks||new Set;let i={},{currentPath:n,projection:s}=r,c=!!(s&&Object.values(s).find(E=>!E.sign)),l;for(let E of this.fields("*")){if(!E.inScope(r.scope)||!(r.keepKeyFields&&this.keyField)&&(r.ignoreReadonlyFields&&E.readonly||r.ignoreWriteonlyFields&&E.writeonly)){i[E.name]=G.isUndefined({coerce:!0});continue}l=E.name;let A;if(s!=="*"&&(A=s==null?void 0:s[l.toLowerCase()],(A==null?void 0:A.sign)==="-"||c&&!A||!c&&E.exclusive&&!A)){i[E.name]=G.isUndefined({coerce:!0});continue}let _=typeof s=="object"?((m=s[l])==null?void 0:m.projection)||"*":s,U=r.fieldCache.get(E),qe=typeof _=="string"?_:xc(_||{});U||(U={},r.fieldCache.set(E,U));let C=U[qe];if(C===null)C=G.isAny(),r.forwardCallbacks.add(()=>{C=U[qe],i[l]=r.partial||!E.required?G.optional(C):G.required(C)});else if(!C){let V=a(()=>{U[qe]=null;let Ke=this._generateFieldCodec(t,E,{...r,partial:r.partial==="deep"?r.partial:void 0,projection:_,currentPath:n+(n?".":"")+l});return U[qe]=Ke,Ke},"defaultGenerator");r.fieldHook?C=r.fieldHook(E,r.currentPath,V):C=V()}i[l]=r.partial||!(E.required||C.id==="required")?G.optional(C):C.id==="required"?C:G.required(C)}return r.allowPatchOperators&&(i._$pull=G.optional(G.isAny()),i._$push=G.optional(G.isAny())),i}_generateFieldCodec(t,r,i){let n=r.generateCodec(t,{...i,level:i.level+1});return r.fixed&&(n=G.isEqual(r.fixed)),r.isArray&&!(r.type instanceof ue)&&(n=G.isArray(n)),n}};a(Tn,"ComplexTypeBaseClass");var yn=Tn;F.prototype=yn.prototype;import"reflect-metadata";import{omitUndefined as En}from"@jsopen/objects";import{asMutable as wc}from"ts-gems";import{vg as Oc}from"valgen";var ee=a(function(...o){if(!this)return ee[w].apply(void 0,o);let[e,t,r]=o;g.call(this,e,t,r);let i=wc(this);if(i.kind=u.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=L(t.attributes||{}),i.attributes=i.base?L(i.base.attributes):{};for(let[n,s]of Object.entries(i.ownAttributes))i.attributes[n]=s},"EnumType"),_n=class _n extends g{extendsFrom(e){var t;return e instanceof g||(e=this.node.getDataType(e)),e instanceof ee?e===this?!0:!!((t=this.base)!=null&&t.extendsFrom(e)):!1}generateCodec(){return Oc.isEnum(Object.keys(this.attributes))}toJSON(e){let t=super.toJSON(e),r=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return En({...t,kind:this.kind,base:r,attributes:L(this.ownAttributes)})}_locateBase(e){if(this.base){if(e(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(e)}}};a(_n,"EnumTypeClass");var hr=_n;ee.prototype=hr.prototype;Object.assign(ee,hr);function Rc(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(c=>{var m;if(!isNaN(Number(c)))return;let l=(m=r==null?void 0:r.meanings)==null?void 0:m[c];i[c]=En({description:l})})}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(c=>{var m;if(!isNaN(Number(c)))return;let l=(m=r==null?void 0:r.meanings)==null?void 0:m[c];i[o[c]]=En({alias:c,description:l})})}let s={kind:u.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,y,{value:s,enumerable:!1,configurable:!0,writable:!0}),n}a(Rc,"EnumTypeFactory");ee.prototype=hr.prototype;ee[w]=Rc;var Qn={};Ir(Qn,{Base64Type:()=>On,CreditCardType:()=>ti,DateTimeType:()=>Ze,DateTimeTypeTz:()=>_r,DateType:()=>yr,EanType:()=>Mn,EmailType:()=>te,FieldPathType:()=>J,FilterType:()=>et,IbanType:()=>Pn,IpType:()=>ii,MobilePhoneType:()=>oi,ObjectIdType:()=>jn,OperationResult:()=>Te,TimeType:()=>gr,UrlType:()=>Jn,UuidType:()=>si});import{__decorate as Dc,__metadata as Nc}from"tslib";import{isBase64 as Sc,validator as Rn,vg as wn}from"valgen";import"reflect-metadata";import{omitUndefined as Ra}from"@jsopen/objects";import{asMutable as bc}from"ts-gems";import{isAny as ba}from"valgen";function xn(o){let e=[],t=a(function(r){let i;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!j.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(y,r)||{};o&&Object.assign(n,o),n.kind=u.SimpleType.Kind,n.name=i,Reflect.defineMetadata(y,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(xn,"SimpleTypeDecoratorFactory");function Oa(o){return(e,t)=>{if(typeof t!="string")throw new TypeError("Symbol properties can't be decorated with Attribute");let r=Reflect.getOwnMetadata(y,e.constructor)||{},i=Reflect.getMetadata("design:type",e,t),n="string";i===Boolean?n="boolean":i===Number&&(n="number"),r.kind=u.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(y,r,e.constructor)}}a(Oa,"AttributeDecoratorFactory");var d=a(function(...o){var n,s;if(!this)return d[w](...o);let[e,t,r]=o;g.call(this,e,t,r);let i=bc(this);if(i.kind=u.SimpleType.Kind,t.base){if(!(t.base instanceof d))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=L(t.attributes||{}),i.attributes=i.base?L(i.base.attributes):{},i.ownAttributes)for(let[c,l]of Object.entries(i.ownAttributes)){if((s=i.attributes[c])!=null&&s.sealed)throw new TypeError(`Sealed attribute "${c}" can not be overwritten`);i.attributes[c]=l}i._generateDecoder=t.generateDecoder,i._generateEncoder=t.generateEncoder},"SimpleType"),An=class An extends g{constructor(){super(...arguments);p(this,"_generateDecoder");p(this,"_generateEncoder");p(this,"properties")}extend(t){return Object.setPrototypeOf(t,this),t}extendsFrom(t){var r;return t instanceof g||(t=this.node.getDataType(t)),t instanceof d?t===this?!0:!!((r=this.base)!=null&&r.extendsFrom(t)):!1}generateCodec(t,r,i){let n={...this.properties,...i};if(t==="decode"){let c=this;for(;c;){if(c._generateDecoder)return c._generateDecoder(n,{dataType:this,element:(r==null?void 0:r.documentElement)||this.owner,scope:r==null?void 0:r.scope});c=this.base}return ba}let s=this;for(;s;){if(s._generateEncoder)return s._generateEncoder(n,{dataType:this,element:(r==null?void 0:r.documentElement)||this.owner,scope:r==null?void 0:r.scope});s=this.base}return ba}toJSON(t){let r=super.toJSON(t),i=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,n=Ra(this.ownAttributes),s;this.properties&&typeof this.properties.toJSON=="function"?s=this.properties.toJSON(this.properties,this.owner,t):s=this.properties?L(this.properties):{};let c={...r,kind:this.kind,base:i,attributes:n&&Object.keys(n).length?n:void 0,properties:Object.keys(s).length?s:void 0};return Object.keys(this.ownNameMappings).length&&(c.nameMappings={...this.ownNameMappings}),Ra(c,!0)}_locateBase(t){if(this.base){if(t(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(t)}}};a(An,"SimpleTypeClass");var gn=An;d.prototype=gn.prototype;Object.assign(d,xn);d[w]=xn;d.Attribute=Oa;var xt,On=(xt=class{constructor(e){p(this,"designType");e&&Object.assign(this,e)}[T](e){let t=wn.isBase64({coerce:!0});return e.designType===Buffer?wn.pipe([t,Mc],{coerce:!0}):e.designType===Uint8Array?wn.pipe([t,vc],{coerce:!0}):t}[x](){return Ic}},a(xt,"Base64Type"),xt);On=Dc([d({name:"base64",description:"A stream of bytes, base64 encoded",nameMappings:{js:"string",json:"string"}}),Nc("design:paramtypes",[Object])],On);var Mc=Rn(o=>Buffer.from(o,"base64")),vc=Rn(o=>new Uint8Array(Buffer.from(o,"base64"))),Ic=Rn(o=>Buffer.isBuffer(o)?o.toString("base64"):Sc(o));import{__decorate as Na,__metadata as Sa}from"tslib";import{vg as Da}from"valgen";var gt,ti=(gt=class{constructor(e){p(this,"provider");e&&Object.assign(this,e)}[T](e){return Da.isCreditCard({coerce:!0,provider:e==null?void 0:e.provider})}[x](e){return Da.isCreditCard({coerce:!0,provider:e==null?void 0:e.provider})}},a(gt,"CreditCardType"),gt);Na([d.Attribute({description:"Locale to use for validation"}),Sa("design:type",Object)],ti.prototype,"provider",void 0);ti=Na([d({name:"creditcard",description:"A Credit Card value",nameMappings:{js:"string",json:"string"}}),Sa("design:paramtypes",[Object])],ti);import{__decorate as bn,__metadata as Dn}from"tslib";import{vg as Ie}from"valgen";var Ma=Ie.isDateString({precisionMin:"day",precisionMax:"day",trim:!0,coerce:!0}),kc=Ie.isDate({trim:"day",coerce:!0}),At,yr=(At=class{constructor(e){p(this,"designType");p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[T](e){let t;e.designType===Date?t=kc:t=Ma;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}[x](e){let t=Ma,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(At,"DateType"),At);bn([d.Attribute({description:"Minimum value"}),Dn("design:type",String)],yr.prototype,"minValue",void 0);bn([d.Attribute({description:"Maximum value"}),Dn("design:type",String)],yr.prototype,"maxValue",void 0);yr=bn([d({name:"date",description:"A date without time",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18","Full date value"),Dn("design:paramtypes",[Object])],yr);import{__decorate as Tr,__metadata as Er}from"tslib";import{vg as we}from"valgen";var wt,Ze=(wt=class{constructor(e){p(this,"designType");p(this,"precisionMin");p(this,"precisionMax");p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[T](e){let t;e.designType===Date?t=we.isDate({coerce:!0}):t=we.isDateString({precisionMin:e.precisionMin||"day",precisionMax:e.precisionMax||"ms",trim:!0,coerce:!0});let 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}[x](e){let t=we.isDateString({precisionMin:e.precisionMin||"day",precisionMax:e.precisionMax||"ms",trim:!0,coerce:!0}),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(wt,"DateTimeType"),wt);Tr([d.Attribute({description:'Determines the minimum precision, e.g. "year", "month", "hours", "minutes", "seconds" etc. Defaults to "day".'}),Er("design:type",String)],Ze.prototype,"precisionMin",void 0);Tr([d.Attribute({description:'Determines the minimum precision, e.g. "year", "month", "hours", "minutes", "seconds" etc. Defaults to "ms".'}),Er("design:type",String)],Ze.prototype,"precisionMax",void 0);Tr([d.Attribute({description:"Minimum value"}),Er("design:type",String)],Ze.prototype,"minValue",void 0);Tr([d.Attribute({description:"Maximum value"}),Er("design:type",String)],Ze.prototype,"maxValue",void 0);Ze=Tr([d({name:"datetime",description:"A full datetime value",nameMappings:{js:"string",json:"string"}}),Er("design:paramtypes",[Object])],Ze);import{__decorate as Nn,__metadata as Sn}from"tslib";import{vg as He}from"valgen";var va=He.isDateString({precisionMin:"tz",coerce:!0}),Ot,_r=(Ot=class{constructor(e){p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[T](e){let t=va,r=[t];return e.minValue!=null&&r.push(He.isGte(t(e.minValue))),e.maxValue!=null&&r.push(He.isLte(t(e.maxValue))),r.length>0?He.pipe(r,{returnIndex:0}):t}[x](e){let t=va,r=[t];return e.minValue!=null&&r.push(He.isGte(t(e.minValue))),e.maxValue!=null&&r.push(He.isLte(t(e.maxValue))),r.length>0?He.pipe(r,{returnIndex:0}):t}},a(Ot,"DateTimeTypeTz"),Ot);Nn([d.Attribute({description:"Minimum value"}),Sn("design:type",String)],_r.prototype,"minValue",void 0);Nn([d.Attribute({description:"Maximum value"}),Sn("design:type",String)],_r.prototype,"maxValue",void 0);_r=Nn([d({name:"datetimetz",description:"A full datetime value with time zone information",nameMappings:{js:"string",json:"string"}}).Example("2021-04-18T22:30:15+03:00"),Sn("design:paramtypes",[Object])],_r);import{__decorate as Lc,__metadata as Pc}from"tslib";import{vg as Ia}from"valgen";var Rt,Mn=(Rt=class{constructor(e){e&&Object.assign(this,e)}[T](){return Ia.isEAN({coerce:!0})}[x](){return Ia.isEAN({coerce:!0})}},a(Rt,"EanType"),Rt);Mn=Lc([d({name:"ean",description:"An EAN (European Article Number)",nameMappings:{js:"string",json:"string"}}),Pc("design:paramtypes",[Object])],Mn);import{__decorate as de,__metadata as he}from"tslib";import{vg as ka}from"valgen";var bt,te=(bt=class{constructor(e){p(this,"allowDisplayName");p(this,"requireDisplayName");p(this,"utf8LocalPart");p(this,"ignoreMaxLength");p(this,"allowIpDomain");p(this,"domainSpecificValidation");p(this,"hostBlacklist");p(this,"hostWhitelist");p(this,"blacklistedChars");e&&Object.assign(this,e)}[T](e){return ka.isEmail({...e,coerce:!0})}[x](e){return ka.isEmail({...e,coerce:!0})}},a(bt,"EmailType"),bt);de([d.Attribute({description:"If set to `true`, the validator will also match `Display Name <email-address>",default:!1}),he("design:type",Boolean)],te.prototype,"allowDisplayName",void 0);de([d.Attribute({description:"If set to `true`, the validator will reject strings without the format `Display Name <email-address>",default:!1}),he("design:type",Boolean)],te.prototype,"requireDisplayName",void 0);de([d.Attribute({description:"If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",default:!0}),he("design:type",Boolean)],te.prototype,"utf8LocalPart",void 0);de([d.Attribute({description:"If set to `true`, the validator will not check for the standard max length of an email",default:!1}),he("design:type",Boolean)],te.prototype,"ignoreMaxLength",void 0);de([d.Attribute({description:"If set to `true`, the validator will allow IP addresses in the host part",default:!1}),he("design:type",Boolean)],te.prototype,"allowIpDomain",void 0);de([d.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}),he("design:type",Boolean)],te.prototype,"domainSpecificValidation",void 0);de([d.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."}),he("design:type",Array)],te.prototype,"hostBlacklist",void 0);de([d.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."}),he("design:type",Array)],te.prototype,"hostWhitelist",void 0);de([d.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."}),he("design:type",String)],te.prototype,"blacklistedChars",void 0);te=de([d({name:"email",description:"An email value",nameMappings:{js:"string",json:"string"}}).Example("some.body@example.com"),he("design:paramtypes",[Object])],te);import{__decorate as vn,__metadata as In}from"tslib";import{toString as jc,validator as Cc,vg as Fc}from"valgen";var Dt,J=(Dt=class{constructor(e){p(this,"dataType");p(this,"allowSigns");e&&Object.assign(this,e)}[T](e,{element:t,scope:r}){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),n=e.allowSigns,s=Cc("decodeFieldPath",c=>i.normalizeFieldPath(c,{allowSigns:n,scope:r}));return Fc.pipe([jc,s])}[x](e,t){return this[T](e,t)}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");g.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),allowSigns:e.allowSigns}}},a(Dt,"FieldPathType"),Dt);vn([d.Attribute({description:"Data type which field belong to"}),In("design:type",Object)],J.prototype,"dataType",void 0);vn([d.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'}),In("design:type",String)],J.prototype,"allowSigns",void 0);J=vn([d({name:"fieldpath",description:"Field path",nameMappings:{js:"string",json:"string"}}),In("design:paramtypes",[Object])],J);import{__decorate as kn,__metadata as Ln}from"tslib";import{validator as Pa}from"valgen";var xr={};Ir(xr,{$and:()=>$c,$arithmetic:()=>ol,$array:()=>La,$date:()=>Bc,$eq:()=>Wc,$field:()=>Vc,$gt:()=>Jc,$gte:()=>Qc,$ilike:()=>tl,$in:()=>Xc,$like:()=>Hc,$lt:()=>Yc,$lte:()=>Gc,$ne:()=>zc,$notILike:()=>rl,$notIn:()=>Zc,$notLike:()=>el,$number:()=>Kc,$or:()=>Uc,$paren:()=>il,$time:()=>qc,ArithmeticExpression:()=>Je,ArithmeticExpressionItem:()=>Fr,ArrayExpression:()=>_e,Ast:()=>or,BooleanLiteral:()=>Qe,ComparisonExpression:()=>le,DateLiteral:()=>Ne,DateTimeLiteral:()=>ar,Expression:()=>B,FilterTreeVisitor:()=>fr,Literal:()=>P,LogicalExpression:()=>fe,NegativeExpression:()=>nr,NullLiteral:()=>Ye,NumberLiteral:()=>ge,OpraErrorListener:()=>mr,ParenthesizedExpression:()=>xe,QualifiedIdentifier:()=>H,StringLiteral:()=>Ge,Term:()=>ze,TimeLiteral:()=>Xe,parse:()=>tn});function Uc(...o){return new fe({op:"or",items:o})}a(Uc,"$or");function $c(...o){return new fe({op:"and",items:o})}a($c,"$and");function Bc(o){return new Ne(o)}a(Bc,"$date");function qc(o){return new Xe(o)}a(qc,"$time");function Kc(o){return new ge(o)}a(Kc,"$number");function La(...o){return new _e(o.map(ri))}a(La,"$array");function Vc(o){return new H(o)}a(Vc,"$field");function Wc(o,e){return re("=",o,e)}a(Wc,"$eq");function zc(o,e){return re("!=",o,e)}a(zc,"$ne");function Jc(o,e){return re(">",o,e)}a(Jc,"$gt");function Qc(o,e){return re(">=",o,e)}a(Qc,"$gte");function Yc(o,e){return re("<",o,e)}a(Yc,"$lt");function Gc(o,e){return re("<=",o,e)}a(Gc,"$lte");function Xc(o,e){return re("in",o,e)}a(Xc,"$in");function Zc(o,e){return re("!in",o,e)}a(Zc,"$notIn");function Hc(o,e){return re("like",o,e)}a(Hc,"$like");function el(o,e){return re("!like",o,e)}a(el,"$notLike");function tl(o,e){return re("ilike",o,e)}a(tl,"$ilike");function rl(o,e){return re("!ilike",o,e)}a(rl,"$notILike");function il(o){return new xe(o)}a(il,"$paren");function ol(o){let e=new Je;return e.add=t=>(e.append("+",Nt(t)),e),e.sub=t=>(e.append("-",Nt(t)),e),e.mul=t=>(e.append("*",Nt(t)),e),e.div=t=>(e.append("/",Nt(t)),e),e.append("+",ri(o)),e}a(ol,"$arithmetic");function re(o,e,t){let r=typeof e=="string"?new H(e):ri(e),i=ri(t);return new le({op:o,left:r,right:i})}a(re,"comparisonExpression");var ri=a(o=>Array.isArray(o)?La(...o.map(Nt)):Nt(o),"wrapEntryValue"),Nt=a(o=>o instanceof B?o:typeof o=="boolean"?new Qe(o):typeof o=="number"||typeof o=="bigint"?new ge(o):o==null?new Ye:o instanceof Date?new Ne(o):new Ge(""+o),"_wrapEntryValue");var St,et=(St=class{constructor(e){p(this,"dataType");p(this,"rules");e&&Object.assign(this,e)}[T](e,{element:t}){let r=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object"),i=e.rules?new ft(e.rules):void 0;return nl(r,i)}[x](){return sl}toJSON(e,t,r){let i=e.dataType?t.node.getComplexType(e.dataType):t.node.getComplexType("object");g.prototype.toJSON.call(i,r);let n=i?t.node.getDataTypeNameWithNs(i):void 0;return{dataType:n||i.toJSON(r),rules:e.rules}}},a(St,"FilterType"),St);kn([d.Attribute({description:"Data type which filtering fields belong to"}),Ln("design:type",Object)],et.prototype,"dataType",void 0);kn([d.Attribute({description:"Stringified JSON object defines filtering rules",format:"string"}),Ln("design:type",Object)],et.prototype,"rules",void 0);et=kn([d({name:"filter",description:"A query filter",nameMappings:{js:"object",json:"string"}}),Ln("design:paramtypes",[Object])],et);var nl=a((o,e,t)=>Pa("decodeFilter",(r,i,n)=>{if(typeof r=="string")try{let s=xr.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"),sl=Pa("encodeFilter",(o,e,t)=>{if(o instanceof xr.Ast)return o.toString();e.fail(t,"Not a valid filter expression",o)});import{__decorate as al,__metadata as pl}from"tslib";import{vg as ja}from"valgen";var Mt,Pn=(Mt=class{constructor(e){e&&Object.assign(this,e)}[T](){return ja.isIBAN({coerce:!0})}[x](){return ja.isIBAN({coerce:!0})}},a(Mt,"IbanType"),Mt);Pn=al([d({name:"iban",description:"An IBAN (International Bank Account Number)",nameMappings:{js:"string",json:"string"}}),pl("design:paramtypes",[Object])],Pn);import{__decorate as Ca,__metadata as Fa}from"tslib";import{vg as ke}from"valgen";var vt,ii=(vt=class{constructor(e){p(this,"version");e&&Object.assign(this,e)}[T](e){return e!=null&&e.version?ke.isIP(e==null?void 0:e.version,{coerce:!0}):ke.oneOf([ke.isIP("4",{coerce:!0}),ke.isIP("6",{coerce:!0})])}[x](e){return e!=null&&e.version?ke.isIP(e==null?void 0:e.version,{coerce:!0}):ke.oneOf([ke.isIP("4",{coerce:!0}),ke.isIP("6",{coerce:!0})])}},a(vt,"IpType"),vt);Ca([d.Attribute({description:"IP version to use for validation"}),Fa("design:type",Object)],ii.prototype,"version",void 0);ii=Ca([d({name:"ip",description:"An IP address",nameMappings:{js:"string",json:"string"}}),Fa("design:paramtypes",[Object])],ii);import{__decorate as $a,__metadata as Ba}from"tslib";import{vg as Ua}from"valgen";var It,oi=(It=class{constructor(e){p(this,"locale");e&&Object.assign(this,e)}[T](e){return Ua.isMobilePhone({coerce:!0,locale:(e==null?void 0:e.locale)||"any"})}[x](e){return Ua.isMobilePhone({coerce:!0,locale:(e==null?void 0:e.locale)||"any"})}},a(It,"MobilePhoneType"),It);$a([d.Attribute({description:"Locale to use for validation"}),Ba("design:type",String)],oi.prototype,"locale",void 0);oi=$a([d({name:"mobilephone",description:"A Mobile Phone Number value",nameMappings:{js:"string",json:"string"}}),Ba("design:paramtypes",[Object])],oi);import{__decorate as cl,__metadata as ll}from"tslib";import{vg as qa}from"valgen";var kt,jn=(kt=class{constructor(e){e&&Object.assign(this,e)}[T](){return qa.isObjectId({coerce:!0})}[x](){return qa.isObjectId({coerce:!0})}},a(kt,"ObjectIdType"),kt);jn=cl([d({name:"ObjectId",description:"A MongoDB ObjectID value",nameMappings:{js:"object",json:"string"}}),ll("design:paramtypes",[Object])],jn);import{__decorate as Le,__metadata as Pe}from"tslib";import{omitUndefined as Ka}from"@jsopen/objects";import{asMutable as ml}from"ts-gems";import{omitUndefined as fl}from"@jsopen/objects";function Cn(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(y,r.constructor)||{};n.kind=u.ComplexType.Kind,n.fields=n.fields||{};let s=Reflect.getMetadata("design:type",r,i),c=n.fields[i]={...o,designType:s};s===Array?c.isArray=!0:c.type=c.type||s,Reflect.defineMetadata(y,n,r.constructor);for(let l of e)l(c)},"decorator");return t.Override=(r,i)=>(e.push(n=>{n.override=n.override||[],n.override.push(fl({...i,scopePattern:Array.isArray(r)?r:[r],type:void 0,isArray:void 0,isNestedEntity:void 0}))}),t),t}a(Cn,"ApiFieldDecoratorFactory");var $=a(function(...o){if(!this){let[n]=o;return $[w](n)}let[e,t]=o;O.call(this,e);let r=ml(this);r.name=t.name;let i=t.origin||e;if(!(i instanceof F))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"),Un=class Un extends O{constructor(){super(...arguments);p(this,"origin")}inScope(t){return dr(t,this.scopePattern)}forScope(t){if(!(t&&this.override))return this;this._overrideCache=this._overrideCache||{};let r=this._overrideCache[t];if(r)return r;if(t!=="*"){for(let i of this.override)if(dr(t,i.scopePattern)){r=Ka({...i,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:i.scopePattern}),Object.setPrototypeOf(r,this);break}}return r=r||this,this._overrideCache[t]=r,r}toJSON(t){var i;let r=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return Ka({type:r||((i=this.type)==null?void 0:i.toJSON(t)),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(t,r,i){return this.type.generateCodec(t,r,{...i,designType:this.designType})}};a(Un,"ApiFieldClass");var Fn=Un;$.prototype=Fn.prototype;Object.assign($,Cn);$[w]=Cn;import"reflect-metadata";import{omitUndefined as dl}from"@jsopen/objects";import{asMutable as hl}from"ts-gems";var $n=class $n extends Ee{constructor(){super("");p(this,"details",[])}add(t){return this.details.push(t),this}};a($n,"OpraDocumentError");var Lt=$n;var Bn=class Bn{constructor(e){p(this,"path","");p(this,"error",new Lt);p(this,"maxErrors");p(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(Bn,"DocumentInitContext");var ye=Bn;import{omit as ul}from"@jsopen/objects";function qn(o){return function(e){let t;if(!(o!=null&&o.embedded))if(o!=null&&o.name){if(!j.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(y,e);r||(r={},Reflect.defineMetadata(y,r,e)),r.kind=u.ComplexType.Kind,r.name=t,o&&Object.assign(r,ul(o,["name"]))}}a(qn,"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 ye({maxErrors:0});F.call(this,e,t,r);let i=hl(this);i.kind=u.ComplexType.Kind,i.discriminatorField=t.discriminatorField,i.discriminatorValue=t.discriminatorValue,t.base&&r.enter(".base",()=>{if(!(t.base instanceof F))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 $(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,c]of Object.entries(t.fields)){let l=new $(this,{...c,name:s});this._fields.set(l.name,l)}})},"ComplexType"),Vn=class Vn extends F{constructor(){super(...arguments);p(this,"base")}extendsFrom(t){var r;return t instanceof g||(t=this.node.getDataType(t)),t instanceof F?t===this?!0:!!((r=this.base)!=null&&r.extendsFrom(t)):!1}toJSON(t){let r=super.toJSON(t),i=this.base?this.node.getDataTypeNameWithNs(this.base):void 0,n={...r,kind:this.kind,base:this.base?i||this.base.toJSON(t):void 0,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue};if(this.additionalFields)if(this.additionalFields instanceof g){let s=this.node.getDataTypeNameWithNs(this.additionalFields);n.additionalFields=s||this.additionalFields.toJSON(t)}else n.additionalFields=this.additionalFields;if(this._fields.size){let s={},c=0;for(let l of this._fields.values())l.origin===this&&l.inScope(t==null?void 0:t.scope)&&(s[l.name]=l.toJSON(t),c++);c&&(n.fields=s)}return dl(n)}_locateBase(t){if(this.base){if(t(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(t)}}};a(Vn,"ComplexTypeClass");var Kn=Vn;ie.prototype=Kn.prototype;Object.assign(ie,qn);ie[w]=qn;var Pt,Te=(Pt=class{constructor(e){e&&Object.assign(this,e)}},a(Pt,"OperationResult"),Pt);Le([$(),Pe("design:type",String)],Te.prototype,"context",void 0);Le([$(),Pe("design:type",String)],Te.prototype,"type",void 0);Le([$(),Pe("design:type",String)],Te.prototype,"message",void 0);Le([$({type:"any"}),Pe("design:type",Object)],Te.prototype,"payload",void 0);Le([$({type:"object"}),Pe("design:type",Array)],Te.prototype,"errors",void 0);Te=Le([ie({name:"OperationResult",description:"Operation result",additionalFields:!0}),Pe("design:paramtypes",[Object])],Te);(function(o){function e(t){var i;let r=(i=class extends o{constructor(...s){super(...s)}},a(i,"OperationResult_"),i);return Le([$({type:t,required:!0}),Pe("design:type",Object)],r.prototype,"payload",void 0),r=Le([ie({embedded:!0}),Pe("design:paramtypes",[Object])],r),r}a(e,"forPayload"),o.forPayload=e})(Te||(Te={}));import{__decorate as Wn,__metadata as zn}from"tslib";import{vg as ni}from"valgen";var yl=/^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/,jt,gr=(jt=class{constructor(e){p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[T](e){let t=ni.matches(yl,{formatName:"time",coerce:!0}),r=[];return e.minValue!=null&&r.push(ni.isGte(e.minValue)),e.maxValue!=null&&r.push(ni.isLte(e.maxValue)),r.length>0?ni.pipe([t,...r],{returnIndex:0}):t}[x](e){return this[T](e)}},a(jt,"TimeType"),jt);Wn([d.Attribute({description:"Minimum value"}),zn("design:type",String)],gr.prototype,"minValue",void 0);Wn([d.Attribute({description:"Maximum value"}),zn("design:type",String)],gr.prototype,"maxValue",void 0);gr=Wn([d({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"),zn("design:paramtypes",[Object])],gr);import{__decorate as Tl,__metadata as El}from"tslib";import{vg as Va}from"valgen";var Ct,Jn=(Ct=class{constructor(e){e&&Object.assign(this,e)}[T](){return Va.isURL({coerce:!0})}[x](){return Va.isURL({coerce:!0})}},a(Ct,"UrlType"),Ct);Jn=Tl([d({name:"url",description:"A Uniform Resource Identifier Reference (RFC 3986 icon) value",nameMappings:{js:"string",json:"string"}}).Example("http://tempuri.org"),El("design:paramtypes",[Object])],Jn);import{__decorate as za,__metadata as Ja}from"tslib";import{vg as Wa}from"valgen";var Ft,si=(Ft=class{constructor(e){p(this,"version");e&&Object.assign(this,e)}[T](e){return Wa.isUUID(e==null?void 0:e.version,{coerce:!0})}[x](e){return Wa.isUUID(e==null?void 0:e.version,{coerce:!0})}},a(Ft,"UuidType"),Ft);za([d.Attribute({description:"Version of the UUID"}),Ja("design:type",Object)],si.prototype,"version",void 0);si=za([d({name:"uuid",description:"A Universal Unique Identifier (UUID) value",nameMappings:{js:"string",json:"string"}}),Ja("design:paramtypes",[Object])],si);import xl from"path-browserify";import{omitUndefined as gl}from"@jsopen/objects";import{asMutable as Al}from"ts-gems";var oe=Symbol.for("kMap"),Ar=Symbol.for("kCtorMap"),Qa,Ya,Yn=class Yn{constructor(){p(this,Ya,new S);p(this,Qa,new WeakMap)}get size(){return this[oe].size}forEach(e,t){this[oe].forEach(e,t)}get(e){let t=typeof e=="string"?e:this[Ar].get(e);if(!t&&typeof e=="function"){let i=Reflect.getMetadata(y,e);t=i==null?void 0:i.name}if(!t&&typeof e=="object"){let i=e[y];t=i==null?void 0:i.name}if(!t)return;let r=this[oe].get(t);if(r){if(typeof e=="function"&&r.kind==="ComplexType"&&r.ctor!==e)throw new TypeError(`An other data type with same class (${e.name}) already exists.`);return r}}set(e,t){this[oe].set(e,t),t.ctor?this[Ar].set(t.ctor,e):t.instance&&this[Ar].set(t.instance,e)}has(e){if(e instanceof g)return!!e.name&&this[oe].has(e.name);let t=typeof e=="string"?e:this[Ar].get(e);return t?this[oe].has(t):!1}keys(){return this[oe].keys()}values(){return this[oe].values()}entries(){return this[oe].entries()}sort(e){return this[oe].sort(e),this}[(Ya=oe,Qa=Ar,Symbol.iterator)](){return this[oe][Symbol.iterator]()}};a(Yn,"DataTypeMap");var W=Yn;import _l from"@browsery/type-is";import{isConstructor as Ut}from"@jsopen/objects";function I(o,e){let t=a(((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={...e,kind:u.HttpOperation.Kind},s=Reflect.getOwnMetadata(se,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let c of o)c(n);Reflect.defineMetadata(se,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"};Ut(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="cookie"&&String(c.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"};Ut(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="header"&&String(c.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"};Ut(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="query"&&String(c.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"};Ut(s.type)&&(s.designType=s.type),n.parameters?n.parameters=n.parameters.filter(c=>!(c.location==="path"&&String(c.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??b.json),(n.contentType?Array.isArray(n.contentType)?n.contentType:[n.contentType]:[]).find(c=>c.endsWith("+json")||c.endsWith("+xml")||c.endsWith("+yaml")||c.endsWith("+toml")||_l.is(c,"json","html","text","xml"))&&(n.contentEncoding=n.contentEncoding??"utf-8"),Ut(n.type)&&(n.designType=n.type),o.push(c=>{c.responses=c.responses||[],c.responses.push(n)}),t},t.RequestContent=function(r){let i=typeof r=="object"?r:{type:r};return i.type&&(i.contentType=i.contentType||[b.json,b.yaml,b.yaml2,b.toml,b.toml2],i.contentEncoding=i.contentEncoding||"utf-8",Ut(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(c,l){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:c,fieldType:"field",...l}),s},File(c,l){return n.multipartFields=n.multipartFields||[],n.multipartFields.push({fieldName:c,fieldType:"file",...l}),s}};i(s)}return t},t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),t}a(I,"HttpOperationDecoratorFactory");var D=a(function(...o){if(!this){let[i]=o,n=[];return D[w].call(void 0,n,i)}let[e,t]=o;if(O.call(this,e),!j.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Al(this);r.parameters=[],r.responses=[],r.types=r.node[k]=new W,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?L(t.compositionOptions):void 0},"HttpOperation"),Xn=class Xn extends O{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:xl.posix.join(e,this.path):e:this.path||"/"}toJSON(e){var r;let t=gl({kind:u.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(Xn,"HttpOperationClass");var Gn=Xn;D.prototype=Gn.prototype;D[w]=I;D.GET=function(o){return I([],{...o,method:"GET"})};D.DELETE=function(o){return I([],{...o,method:"DELETE"})};D.HEAD=function(o){return I([],{...o,method:"HEAD"})};D.OPTIONS=function(o){return I([],{...o,method:"OPTIONS"})};D.PATCH=function(o){return I([],{...o,method:"PATCH"})};D.POST=function(o){return I([],{...o,method:"POST"})};D.PUT=function(o){return I([],{...o,method:"PUT"})};D.SEARCH=function(o){return I([],{...o,method:"SEARCH"})};D.Entity={};function z(o){if(typeof o=="string")return o;let e=Reflect.getMetadata(y,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 je(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(je,"createKeyParamDecorator");function Ga(o,e){return(...t)=>{let r=typeof t[0]=="object"?t[0]:t.reduce((s,c)=>{let l=c.split(":");return s[l[0]]=l[1]||l[0],s},{}),i=Object.keys(r).reduce((s,c)=>{let l=_t.exec(c),m=_t.exec(r[c]);return l&&m&&(s[l[2]]=m[2]),s},{}),n=Object.keys(r).reduce((s,c)=>{let l=_t.exec(c);return l&&(l[1]!="-"&&(s[l[2]]=l[2]),l[1]!="+"&&(s["-"+l[2]]="-"+l[2])),s},{});return e.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.sortFields=i}),o.QueryParam("sort",{description:"Determines sort fields",type:ee(n),isArray:!0,arraySeparator:",",parser:a(s=>s.map(c=>{let l=_t.exec(c);return l?(l[1]||"")+i[l[2]]:c}),"parser")}),o}}a(Ga,"createSortFieldsDecorator");function Ce(o,e,t){let r=Reflect.getMetadata("FilterRules",o);r||(r=new ft,Reflect.defineMetadata("FilterRules",r,o));let i=Reflect.getMetadata("FilterType",o);return i||(i=new et({dataType:t}),i.rules={},Reflect.defineMetadata("FilterType",i,o)),(n,s)=>{let c=(Array.isArray(s)?{operators:s}:typeof s=="string"?{operators:s.split(/\s*,\s*/)}:s)||{};if(c.operators=c.operators||["=","!="],n.includes(":")){let l=n.split(":");n=l[0],c.mappedField=l[1]}return e.push(()=>{r.set(n,c),i.rules=r.toJSON()}),o.QueryParam("filter",{type:i,description:"Determines filter fields"}),o}}a(Ce,"createFilterDecorator");D.Entity.Create=function(o,e){var n;let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.type=z(t.type)}),i};D.Entity.Delete=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"DELETE",...t,composition:"Entity.Delete"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=je(i,r),i};D.Entity.DeleteMany=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(r,{method:"DELETE",...t,composition:"Entity.DeleteMany"});return i.Response(R.OK,{description:'Operation is successful. Returns OperationResult with "affected" field.',contentType:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.Filter=Ce(i,r,t.type),i};var ps={};Ir(ps,{AnyType:()=>Zn,BigintType:()=>is,BooleanType:()=>os,IntegerType:()=>Wt,NullType:()=>ss,NumberType:()=>Oe,ObjectType:()=>as,StringType:()=>tt});import{__decorate as wl,__metadata as Ol}from"tslib";import{isAny as Xa}from"valgen";var $t,Zn=($t=class{constructor(e){e&&Object.assign(this,e)}[T](){return Xa}[x](){return Xa}},a($t,"AnyType"),$t);Zn=wl([d({name:"any",description:"Represents any value"}),Ol("design:paramtypes",[Object])],Zn);import{__decorate as Rl,__metadata as bl}from"tslib";import{toBigint as Ha,vg as rs}from"valgen";import{__decorate as es,__metadata as ts}from"tslib";import{toNumber as Za,vg as Hn}from"valgen";var Bt,Oe=(Bt=class{constructor(e){p(this,"minValue");p(this,"maxValue");e&&Object.assign(this,e)}[T](e){let t=[];return e.minValue!=null&&t.push(Hn.isGte(e.minValue)),e.maxValue!=null&&t.push(Hn.isLte(e.maxValue)),t.length>0?Hn.pipe([Za,...t],{returnIndex:0}):Za}[x](e){return this[T](e)}},a(Bt,"NumberType"),Bt);es([d.Attribute({description:"Determines the minimum value"}),ts("design:type",Number)],Oe.prototype,"minValue",void 0);es([d.Attribute({description:"Determines the maximum value"}),ts("design:type",Number)],Oe.prototype,"maxValue",void 0);Oe=es([d({name:"number",description:"Both Integer as well as Floating-Point numbers",nameMappings:{js:"number",json:"number"}}),ts("design:paramtypes",[Object])],Oe);var qt,is=(qt=class extends Oe{constructor(e){super(e)}[T](e){let t=[];return e.minValue!=null&&t.push(rs.isGte(e.minValue)),e.maxValue!=null&&t.push(rs.isLte(e.maxValue)),t.length>0?rs.pipe([Ha,...t],{returnIndex:0}):Ha}[x](e){return this[T](e)}},a(qt,"BigintType"),qt);is=Rl([d({name:"bigint",description:"BigInt number",nameMappings:{js:"bigint",json:"string"}}),bl("design:paramtypes",[Object])],is);import{__decorate as Dl,__metadata as Nl}from"tslib";import{toBoolean as ep}from"valgen";var Kt,os=(Kt=class{constructor(e){e&&Object.assign(this,e)}[T](){return ep}[x](){return ep}},a(Kt,"BooleanType"),Kt);os=Dl([d({name:"boolean",description:"Simple true/false value",nameMappings:{js:"boolean",json:"boolean"}}),Nl("design:paramtypes",[Object])],os);import{__decorate as Sl,__metadata as Ml}from"tslib";import{toInteger as tp,vg as ns}from"valgen";var Vt,Wt=(Vt=class extends Oe{constructor(e){super(e)}[T](e){let t=[];return e.minValue!=null&&t.push(ns.isGte(e.minValue)),e.maxValue!=null&&t.push(ns.isLte(e.maxValue)),t.length>0?ns.pipe([tp,...t],{returnIndex:0}):tp}[x](e){return this[T](e)}},a(Vt,"IntegerType"),Vt);Wt=Sl([d({name:"integer",description:"An integer number",nameMappings:{js:"number",json:"number"}}),Ml("design:paramtypes",[Object])],Wt);import{__decorate as vl,__metadata as Il}from"tslib";import{isNull as rp}from"valgen";var zt,ss=(zt=class{constructor(e){e&&Object.assign(this,e)}[T](){return rp}[x](){return rp}},a(zt,"NullType"),zt);ss=vl([d({name:"null",description:"A Null value",nameMappings:{js:"null",json:"null"}}),Il("design:paramtypes",[Object])],ss);import{__decorate as kl,__metadata as Ll}from"tslib";var Jt,as=(Jt=class{constructor(e){e&&Object.assign(this,e)}},a(Jt,"ObjectType"),Jt);as=kl([ie({name:"object",description:"A non modelled object",additionalFields:!0}),Ll("design:paramtypes",[Object])],as);import{__decorate as wr,__metadata as Or}from"tslib";import{toString as ip,vg as ai}from"valgen";var Qt,tt=(Qt=class{constructor(e){p(this,"pattern");p(this,"patternName");p(this,"minLength");p(this,"maxLength");e&&Object.assign(this,e)}[T](e){let t=[];if(e.pattern){let r=e.patternName;r||(r=Reflect.getMetadata(y,Object.getPrototypeOf(this).constructor).name),t.push(ai.matches(e.pattern,{formatName:r}))}return e.minLength&&t.push(ai.lengthMin(e.minLength)),e.maxLength&&t.push(ai.lengthMax(e.maxLength)),t.length>0?ai.pipe([ip,...t],{returnIndex:0}):ip}[x](e){return this[T](e)}},a(Qt,"StringType"),Qt);wr([d.Attribute({description:"Regex pattern to be used for validation"}),Or("design:type",Object)],tt.prototype,"pattern",void 0);wr([d.Attribute({description:"Name of the pattern"}),Or("design:type",String)],tt.prototype,"patternName",void 0);wr([d.Attribute({description:"Minimum number of characters"}),Or("design:type",Number)],tt.prototype,"minLength",void 0);wr([d.Attribute({description:"Minimum number of characters"}),Or("design:type",Number)],tt.prototype,"maxLength",void 0);tt=wr([d({name:"string",description:"A sequence of characters",nameMappings:{js:"string",json:"string"}}),Or("design:paramtypes",[Object])],tt);D.Entity.FindMany=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}).QueryParam("limit",{description:"Determines number of returning instances",type:new Wt({minValue:1,maxValue:t.maxLimit})}).QueryParam("skip",{description:"Determines number of returning instances",type:new Wt({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=z(t.type),t.defaultLimit&&(s.defaultLimit=t.defaultLimit),t.defaultProjection&&(s.defaultProjection=t.defaultProjection),t.maxLimit&&(s.maxLimit=t.maxLimit)}),i.Filter=Ce(i,r,t.type),i.DefaultSort=(...n)=>(r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.defaultSort=n}),i),i.SortFields=Ga(i,r),i};D.Entity.Get=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=je(i,r),i};D.Entity.Replace=function(o,e){let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(n=>{let s=n.compositionOptions=n.compositionOptions||{};s.type=z(t.type)}),i.KeyParam=je(i,r),i};D.Entity.Update=function(o,e){var n;let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.type=z(t.type)}),i.KeyParam=je(i,r),i.Filter=Ce(i,r,t.type),i};D.Entity.UpdateMany=function(o,e){var n;let t;typeof o=="object"&&!o[y]?t=o:t={...e,type:o};let r=[],i=I(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:b.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:b.opra_response_json}),r.push(s=>{let c=s.compositionOptions=s.compositionOptions||{};c.type=z(t.type)}),i.Filter=Ce(i,r,t.type),i};import{merge as cs}from"@jsopen/objects";var Pl=/^(.*)(Controller)$/,op=[];function Yt(o){let e=[],t=a(function(r){var l;let i=o==null?void 0:o.name;i||(i=((l=Pl.exec(r.name))==null?void 0:l[1])||r.name);let n={},s=Reflect.getOwnMetadata(ae,Object.getPrototypeOf(r));s&&cs(n,s,{deep:!0});let c=Reflect.getOwnMetadata(ae,r);c&&cs(n,c,{deep:!0}),cs(n,{...o,kind:u.MQController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(ae,n,r);for(let m of e)m(n,r);Reflect.defineMetadata(ae,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),op.forEach(r=>r(t,e,o)),t}a(Yt,"MQControllerDecoratorFactory");Yt.augment=function(o){op.push(o)};import{isConstructor as np,omit as Cl}from"@jsopen/objects";var sp=[];function Rr(o,e,t){let r=!1,i=a(((n,s)=>{if(typeof s!="string")throw new TypeError("Symbol properties can not be decorated");let c={kind:u.MQOperation.Kind,channel:s,type:e,...Cl(t,["kind","type"])},l=Reflect.getOwnMetadata(ae,n.constructor)||{};l.operations=l.operations||{},l.operations[s]=c;for(let m of o)m(c,n,s);Reflect.defineMetadata(ae,l,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(c=>{let l=typeof s=="string"||typeof s=="function"?{name:n,type:s}:{...s,name:n};np(l.type)&&(l.designType=l.type);let m=r?c.response:c;m.headers?m.headers=m.headers.filter(E=>String(E.name)!==String(n)):m.headers=[],m.headers.push(l)}),i),i.Response=(n,s)=>(o.push(c=>{r=!0,c.response={...s,type:n},np(n)&&(c.response.designType=n)}),i),sp.forEach(n=>n(i,o,e,t)),i}a(Rr,"MQOperationDecoratorFactory");Rr.augment=function(o){sp.push(o)};import{merge as ls}from"@jsopen/objects";var Ul=/^(.*)(Controller)$/,ap=[];function Gt(o){let e=[],t=a(function(r){var l;let i=o==null?void 0:o.name;i||(i=((l=Ul.exec(r.name))==null?void 0:l[1])||r.name);let n={},s=Reflect.getOwnMetadata(pe,Object.getPrototypeOf(r));s&&ls(n,s,{deep:!0});let c=Reflect.getOwnMetadata(pe,r);c&&ls(n,c,{deep:!0}),ls(n,{...o,kind:u.WSController.Kind,name:i,path:i},{deep:!0}),Reflect.defineMetadata(pe,n,r);for(let m of e)m(n,r);Reflect.defineMetadata(pe,n,r)},"decorator");return t.UseType=(...r)=>(e.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),ap.forEach(r=>r(t,e,o)),t}a(Gt,"WSControllerDecoratorFactory");Gt.augment=function(o){ap.push(o)};import{omit as Bl}from"@jsopen/objects";var pp=[];function br(o,e){let t=a(((r,i)=>{if(typeof i!="string")throw new TypeError("Symbol properties can not be decorated");let n={kind:u.WSOperation.Kind,event:i,...Bl(e,["kind"])},s=Reflect.getOwnMetadata(pe,r.constructor)||{};s.operations=s.operations||{},s.operations[i]=n;for(let c of o)c(n,r,i);Reflect.defineMetadata(pe,s,r.constructor)}),"decorator");return t.UseType=(...r)=>(o.push(i=>{i.types=i.types||[],i.types.push(...r)}),t),pp.forEach(r=>r(t,o,e)),t}a(br,"WSOperationDecoratorFactory");br.augment=function(o){pp.push(o)};import"reflect-metadata";import{omitUndefined as Kl}from"@jsopen/objects";import{asMutable as Vl}from"ts-gems";function pi(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(pi,"getIsInheritedPredicateFn");var rt=a(function(...o){var n;if(!this)throw new TypeError('"this" should be passed to call class constructor');let[e,t,r]=o;F.call(this,e,t,r);let i=Vl(this);if(i.kind=u.MappedType.Kind,t.base){if(!(t.base instanceof F))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(m=>i.base.normalizeFieldPath(m)):t.omit?i.omit=t.omit.map(m=>i.base.normalizeFieldPath(m)):t.partial?i.partial=Array.isArray(t.partial)?t.partial.map(m=>i.base.normalizeFieldPath(m)):t.partial:t.required&&(i.required=Array.isArray(t.required)?t.required.map(m=>i.base.normalizeFieldPath(m)):t.required);let s=pi(i.pick,i.omit),c=Array.isArray(i.partial)?i.partial.map(m=>m.toLowerCase()):i.partial,l=Array.isArray(i.required)?i.required.map(m=>m.toLowerCase()):i.required;for(let[m,E]of i.base.fieldEntries("*")){if(!s(m))continue;let A={...E};c===!0||Array.isArray(c)&&c.includes(E.name.toLowerCase())?A.required=!1:(l===!0||Array.isArray(l)&&l.includes(E.name.toLowerCase()))&&(A.required=!0);let _=new $(this,A);i._fields.set(_.name,_)}(!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"),ms=class ms extends F{constructor(){super(...arguments);p(this,"omit");p(this,"pick");p(this,"partial");p(this,"required")}extendsFrom(t){var r;return t instanceof g||(t=this.node.getDataType(t)),t instanceof F?t===this?!0:!!((r=this.base)!=null&&r.extendsFrom(t)):!1}toJSON(t){let r=super.toJSON(t),i=this.base?this.node.getDataTypeNameWithNs(this.base):void 0;return Kl({...r,base:i||this.base.toJSON(t),kind:this.kind,pick:this.pick,omit:this.omit,partial:this.partial,required:this.required,discriminatorField:this.discriminatorField,discriminatorValue:this.discriminatorValue})}_locateBase(t){if(this.base){if(t(this.base))return this.base;if(this.base._locateBase)return this.base._locateBase(t)}}};a(ms,"MappedTypeClass");var fs=ms;rt.prototype=fs.prototype;rt._applyMixin=()=>{};import"reflect-metadata";import{omitUndefined as Wl}from"@jsopen/objects";import{asMutable as zl}from"ts-gems";var Xt=a(function(...o){if(!this)return Xt[w].apply(void 0,o);let[e,t,r]=o;F.call(this,e,t,r);let i=zl(this);i.kind=u.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 c=new $(this,s);i._fields.set(c.name,c)}i.types.push(n),n.keyField&&(i.keyField=n.keyField)}},"MixinType"),ds=class ds extends F{extendsFrom(e){if(e instanceof g||(e=this.node.getDataType(e)),!(e instanceof F))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 Wl({...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(ds,"MixinTypeClass");var us=ds;Xt.prototype=us.prototype;Xt[w]=Jl;function Jl(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)Pr(this,n)}}}[t],i={...e,kind:u.MixinType.Kind,types:[]};Reflect.defineMetadata(y,i,r);for(let n of o){let s=Reflect.getMetadata(y,n);if(!(s&&(s.kind===u.ComplexType.Kind||s.kind===u.MixinType.Kind||s.kind===u.MappedType.Kind)))throw new TypeError(`Class "${n.name}" is not a ${u.ComplexType.Kind}, ${u.MixinType.Kind} or ${u.MappedType.Kind}`);i.types.push(n),Lr(r.prototype,n.prototype)}return r}a(Jl,"MixinTypeFactory");import"reflect-metadata";import{omitUndefined as Ql}from"@jsopen/objects";import{asMutable as Yl}from"ts-gems";import{vg as cp}from"valgen";var Zt=a(function(...o){if(!this)return Zt[w].apply(void 0,o);let[e,t,r]=o;g.call(this,e,t,r);let i=Yl(this);i.kind=u.UnionType.Kind,i.discriminator=t.discriminator,i.types=[];for(let n of t.types)i.types.push(n)},"UnionType"),ys=class ys extends g{toJSON(e){let t=super.toJSON(e);return Ql({...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===u.ComplexType.Kind||i.kind===u.MappedType.Kind)&&i.discriminatorField?[n,{[i.discriminatorField]:cp.isEqual(i.discriminatorValue)}]:n});return cp.oneOf(r)}extendsFrom(){return!1}_locateBase(){}};a(ys,"UnionTypeClass");var hs=ys;Zt.prototype=hs.prototype;Zt[w]=Gl;function Gl(o,e){let i=class i{};a(i,"UnionClass");let t=i,r={...e,kind:u.UnionType.Kind,types:o};return Reflect.defineMetadata(y,r,t),t}a(Gl,"UnionTypeFactory");var Ts=Symbol("initializing"),ci=class ci{static async createDataType(e,t,r){e=e||new ye({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 ci.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[k];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 ye({maxErrors:0});let i=await this._prepareAllInitArgs(e,t,r);if(!i)return;let n=new S;for(let l of i)n.set(l.name,l);let s=e.extend({initArgsMap:n}),c=[];for(let[l,m]of n.entries())e.enter(`[${l}]`,()=>{if(!n.has(l))return;let E=this._createDataType(s,t,m);E&&c.push(E)});return c}static async _prepareAllInitArgs(e,t,r){let i=new S,n=new S,s=e.extend({owner:t,importQueue:i,initArgsMap:n});if(!t.node[k])throw new TypeError("DocumentElement should has [kDataTypeMap] property");if(Array.isArray(r)){let c=0;for(let l of r)await s.enterAsync(`$[${c++}]`,async()=>{l=await Z(l);let m=Reflect.getMetadata(y,l)||l[y];if(!(m&&m.name))return typeof l=="function"?s.addError(`Class "${l.name}" doesn't have a valid data type metadata`):s.addError("Object doesn't have a valid data type metadata");i.set(m.name,l)})}else{let c,l;for([l,c]of Object.entries(r))c=await Z(c),i.set(l,typeof c=="object"?{...c,name:l}:c)}for(let c of Array.from(i.keys())){if(!i.has(c))continue;let l=await this._importDataTypeArgs(s,t,c);l&&typeof l!="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 A;r=await Z(r);let{importQueue:n,initArgsMap:s}=e,c=t.node.findDataType(r);if(c instanceof g)return c.name;let l,m,E;if(typeof r!="string"){let U=t.node.getDocument().types[jr].get(r);U&&(r=U)}if(typeof r=="string"){let _=r;if(r=(n==null?void 0:n.get(_))||((A=e.initArgsMap)==null?void 0:A.get(_)),!r)return e.addError(`Unknown data type (${_})`)}if(typeof r=="function"){if(l=Reflect.getMetadata(y,r),!l)return e.addError(`Class "${r.name}" doesn't have a valid DataType metadata`);m=r}else if(typeof r=="object"){if(l=r[y],l)E=r,l.kind!==u.EnumType.Kind&&(l=void 0);else if(u.isDataType(r))l=r,m=l.ctor;else if(m=Object.getPrototypeOf(r).constructor,l=m&&Reflect.getMetadata(y,m),l&&l.kind===u.SimpleType.Kind){let _=await this._importDataTypeArgs(e,t,l.name);return _?typeof _=="object"&&_.kind!==u.SimpleType.Kind?e.addError("Kind of base data type is not same"):{kind:u.SimpleType.Kind,name:void 0,base:_,properties:r}:void 0}}return l?e.enterAsync(l.name?`[${l.name}]`:"",async()=>{if(l.name){let U=s==null?void 0:s.get(l.name);if(U)return i&&U[Ts]?e.addError("Circular reference detected"):l.name}let _={kind:l.kind,name:l.name};_[Ts]=!0;try{if(_.name)if(n!=null&&n.has(_.name))s==null||s.set(l.name,_),_._instance={name:l.name},_[k]=t.node[k];else return e.addError(`Data Type (${_.name}) must be explicitly added to type list in the document scope`);switch(_.kind){case u.ArrayType.Kind:await this._prepareArrayTypeArgs(e,t,_,l);break;case u.ComplexType.Kind:_.ctor=m,await this._prepareComplexTypeArgs(e,t,_,l);break;case u.EnumType.Kind:_.instance=E,await this._prepareEnumTypeArgs(e,t,_,l);break;case u.MappedType.Kind:await this._prepareMappedTypeArgs(e,t,_,l);break;case u.MixinType.Kind:await this._prepareMixinTypeArgs(e,t,_,l);break;case u.SimpleType.Kind:_.ctor=m,await this._prepareSimpleTypeArgs(e,t,_,l);break;case u.UnionType.Kind:await this._prepareUnionTypeArgs(e,t,_,l);break;default:return e.addError(`Invalid data type kind ${l.kind}`)}}finally{_.name&&(n==null||n.delete(_.name)),delete _[Ts]}return n&&_.name?_.name:_}):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=Re(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(y,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Re(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=Re(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 c=typeof s=="string"?{type:s}:s;if(c.isArray&&!c.type)return e.addError('"type" must be defined explicitly for array fields');let l=await this._importDataTypeArgs(e,t,c.type||"any");l&&(r.fields[n]={...c,type:Re(l)})})}))}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=Re(n))}),r.attributes=L(i.attributes)}static async _prepareSimpleTypeArgs(e,t,r,i){var n,s,c,l;await this._prepareDataTypeArgs(e,r,i),await e.enterAsync(".base",async()=>{let m;if(i.base)m=await this._importDataTypeArgs(e,t,i.base,!0);else if(r.ctor){let E=Object.getPrototypeOf(r.ctor.prototype).constructor;Reflect.hasMetadata(y,E)&&(m=await this._importDataTypeArgs(e,t,E))}m&&(r.base=Re(m),r.ctor=r.ctor||m.ctor)}),r.properties=i.properties,r.nameMappings=i.nameMappings,!r.properties&&r.ctor&&(r.properties=new r.ctor),i.attributes&&(r.attributes=L(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((c=r.properties)==null?void 0:c[x])=="function"&&(r.generateEncoder=(l=r.properties)==null?void 0:l[x].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(y,s)&&(n=await this._importDataTypeArgs(e,t,s))}n&&(r.base=Re(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 c of n)await e.enterAsync(`[${s++}]`,async()=>{let l=await this._importDataTypeArgs(e,t,c);l&&r.types.push(Re(l))})})}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 c of n)await e.enterAsync(`[${s++}]`,async()=>{let l=await this._importDataTypeArgs(e,t,c);l&&r.types.push(Re(l))})})}static _createDataType(e,t,r){var s;let i=t.node.findDataType(typeof r=="string"?r:r.name||"");if(i instanceof g)return i;let n=typeof r=="string"?(s=e.initArgsMap)==null?void 0:s.get(r):r;if(n){let c=n[k];switch(c||delete n._instance,i=n._instance,i!=null&&i.name&&c&&c.set(i.name,i),n==null?void 0:n.kind){case u.ArrayType.Kind:return this._createArrayType(e,t,n);case u.ComplexType.Kind:return this._createComplexType(e,t,n);case u.EnumType.Kind:return this._createEnumType(e,t,n);case u.MappedType.Kind:return this._createMappedType(e,t,n);case u.MixinType.Kind:return this._createMixinType(e,t,n);case u.SimpleType.Kind:return this._createSimpleType(e,t,n);case u.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,ue.prototype);let n=L(r);return r.type&&e.enter(".type",()=>{n.type=this._createDataType(e,t,r.type)}),ue.apply(i,[t,n]),i}static _createComplexType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ie.prototype);let n=L(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,c]of Object.entries(r.fields))e.enter(`[${s}]`,()=>{let l=this._createDataType(e,t,c.type);l&&(n.fields[s]={...c,name:s,type:l})})}),ie.apply(i,[t,n]),i}static _createEnumType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,ee.prototype);let n=L(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,rt.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),rt.apply(i,[t,n]),i}static _createMixinType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Xt.prototype);let n=L(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let c of r.types)e.enter(`[${s++}]`,()=>{let l=this._createDataType(e,t,c);if(!(l instanceof F))throw new TypeError(`"${l==null?void 0:l.kind}" can't be set as base for a "${n.kind}"`);n.types.push(l)})}),Xt.apply(i,[t,n]),i}static _createSimpleType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,d.prototype);let n=L(r);return r.base&&e.enter(".base",()=>{n.base=this._createDataType(e,t,r.base)}),d.apply(i,[t,n]),i}static _createUnionType(e,t,r){let i=r._instance||{};Object.setPrototypeOf(i,Zt.prototype);let n=L(r);return r.types&&e.enter(".types",()=>{n.types=[];let s=0;for(let c of r.types)e.enter(`[${s++}]`,()=>{let l=this._createDataType(e,t,c);n.types.push(l)})}),Zt.apply(i,[t,n]),i}};a(ci,"DataTypeFactory");var M=ci;function Re(o){return typeof o=="object"&&o.name?o.name:o}a(Re,"preferName");import{isConstructor as _f}from"@jsopen/objects";import{omitUndefined as Zl}from"@jsopen/objects";var Es=class Es extends O{constructor(t){super(t.owner);p(this,"name","OpraApi");p(this,"description");this.name=t.name,this.description=t.description}toJSON(t){return Zl({transport:this.transport,name:this.name,description:this.description})}async _initialize(t,r){if(!j.test(t.name))throw new TypeError(`Invalid api name (${t.name})`);this.name=t.name,this.description=t==null?void 0:t.description}};a(Es,"ApiBase");var Fe=Es;import tf from"path-browserify";import{omitUndefined as rf}from"@jsopen/objects";import{asMutable as of}from"ts-gems";import{merge as _s,omit as Hl}from"@jsopen/objects";var ef=/^(.*)(Controller)$/;function xs(o){let e=[],t=a(function(r){var l;let i=o==null?void 0:o.name;i||(i=((l=ef.exec(r.name))==null?void 0:l[1])||r.name);let n={},s=Reflect.getOwnMetadata(se,Object.getPrototypeOf(r));s&&_s(n,s,{deep:!0});let c=Reflect.getOwnMetadata(se,r);c&&_s(n,c,{deep:!0}),_s(n,{kind:u.HttpController.Kind,name:i,path:i,...Hl(o,["kind","name","instance","endpoints","key"])},{deep:!0}),Reflect.defineMetadata(se,n,r);for(let m of e)m(n,r);Reflect.defineMetadata(se,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 c;(c=n.path)!=null&&c.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(xs,"HttpControllerDecoratorFactory");var ne=a(function(...o){var i;if(!this)return ne[w].apply(void 0,o);let[e,t]=o;if(O.call(this,e),!j.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=of(this);r.kind=u.HttpController.Kind,r.types=r.node[k]=new W,r.operations=new S,r.controllers=new S,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"),As=class As extends O{get isRoot(){return!(this.owner instanceof ne)}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 ne)return this.node.parent.element.findParameter(e,t)}getFullUrl(){return tf.posix.join(this.owner instanceof ne?this.owner.getFullUrl():"/",this.path)}toString(){return`[HttpController ${this.name}]`}toJSON(e){let t=rf({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}[Se](){return`[${Me}HttpController${ve+this.name+Ae}]`}};a(As,"HttpControllerClass");var gs=As;ne.prototype=gs.prototype;Object.assign(ne,xs);ne[w]=xs;var ws=class ws extends Fe{constructor(t){super(t);p(this,"_controllerReverseMap",new WeakMap);p(this,"transport","http");p(this,"controllers",new S);p(this,"url");this.url=t.url}findController(t){return ne.prototype.findController.call(this,t)}findOperation(t,r){let i=this.findController(t);return i==null?void 0:i.operations.get(r)}toJSON(t){let i={...super.toJSON(),transport:this.transport,url:this.url,controllers:{}};for(let n of this.controllers.values())i.controllers[n.name]=n.toJSON(t);return i}};a(ws,"HttpApi");var it=ws;import nf from"@browsery/type-is";import{omitUndefined as sf}from"@jsopen/objects";import{asMutable as af}from"ts-gems";import{isAny as pf,vg as cf}from"valgen";var Ue=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');O.call(this,o);let t=af(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 g?e.type:t.owner.node.getDataType(e.type)),t.isArray=e.isArray,t.designType=e.designType},"HttpMediaType"),Rs=class Rs extends O{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=sf({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=>nf.is(s,["json"]))&&(i=this.node.findDataType("object").generateCodec(e,t,{...r,designType:this.designType})),i=i||pf,this.isArray&&!(this.type instanceof ue)?cf.isArray(i):i}};a(Rs,"HttpMediaTypeClass");var Os=Rs;Ue.prototype=Os.prototype;import{omitUndefined as lf}from"@jsopen/objects";function $e(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($e,"parseRegExp");var bs=class bs extends Ue{constructor(t,r){super(t,r);p(this,"fieldName");p(this,"fieldType");p(this,"required");this.fieldName=r.fieldName instanceof RegExp?r.fieldName:r.fieldName.startsWith("/")?$e(r.fieldName):r.fieldName,this.fieldType=r.fieldType,this.required=r.required}toJSON(t){return lf({fieldName:this.fieldName,fieldType:this.fieldType,required:this.required,...super.toJSON(t)})}};a(bs,"HttpMultipartField");var li=bs;import{omitUndefined as mf}from"@jsopen/objects";var ff=/^([1-6]\d{2})(?:-([1-6]\d{2}))?$/,Ds=class Ds{constructor(e,t){p(this,"start",0);p(this,"end",0);if(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=ff.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(Ds,"HttpStatusRange");var Dr=Ds;var Ns=class Ns extends Ue{constructor(t,r){super(t,r);p(this,"statusCode");p(this,"parameters");p(this,"partial");this.parameters=[],this.statusCode=(Array.isArray(r.statusCode)?r.statusCode:[r.statusCode]).map(i=>typeof i=="object"?new Dr(i.start,i.end):new Dr(i)),this.partial=r.partial}findParameter(t,r){t=t.toLowerCase();for(let i of this.parameters)if((!r||r===i.location)&&(i.name instanceof RegExp&&i.name.test(t)||i.name===t))return i}toJSON(t){let r=this.statusCode.map(n=>n.toJSON()),i=mf({...super.toJSON(t),statusCode:r.length===1&&typeof r[0]=="number"?r[0]:r,partial:this.partial});if(this.parameters.length){i.parameters=[];for(let n of this.parameters)i.parameters.push(n.toJSON(t))}return i}};a(Ns,"HttpOperationResponse");var fi=Ns;import{omitUndefined as hf}from"@jsopen/objects";import{asMutable as yf}from"ts-gems";import{vg as Tf}from"valgen";import{omitUndefined as uf}from"@jsopen/objects";import{asMutable as df}from"ts-gems";var ot=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');O.call(this,o);let t=df(this);t.description=e.description,t.type=e.type,t.examples=e.examples,t.isArray=e.isArray},"Value"),Ms=class Ms extends O{constructor(){super(...arguments);p(this,"type");p(this,"description");p(this,"examples");p(this,"isArray")}toJSON(t){let r=this.type?this.node.getDataTypeNameWithNs(this.type):void 0;return uf({type:this.type?r||this.type.toJSON(t):"any",description:this.description,isArray:this.isArray,examples:this.examples})}};a(Ms,"ValueClass");var Ss=Ms;ot.prototype=Ss.prototype;var Nr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');ot.call(this,o,e);let t=yf(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?$e(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"),Is=class Is extends ot{toJSON(e){return hf({...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}))||Tf.isAny()}};a(Is,"HttpParameterClass");var vs=Is;Nr.prototype=vs.prototype;import{omitUndefined as Ef}from"@jsopen/objects";var ks=class ks extends O{constructor(t){super(t);p(this,"description");p(this,"content",[]);p(this,"required");p(this,"maxContentSize");p(this,"immediateFetch");p(this,"partial");p(this,"allowPatchOperators");p(this,"keepKeyFields")}toJSON(t){return Ef({description:this.description,required:this.required,maxContentSize:this.maxContentSize,content:this.content.length?this.content.map(r=>r.toJSON(t)):[],partial:this.partial,allowPatchOperators:this.allowPatchOperators})}};a(ks,"HttpRequestBody");var mi=ks;var Ls=class Ls{static async createApi(e,t){let r=new it(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 c=await this._createController(e,t,s.metadata,s.instance,s.ctor);c&&(t.controllers.get(c.name)&&e.addError(`Duplicate controller name (${s.name})`),t.controllers.set(c.name,c))})}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 c=await this._createController(e,t,{...s.metadata,name:i},s.instance,s.ctor);c&&(t.controllers.get(c.name)&&e.addError(`Duplicate controller name (${i})`),t.controllers.set(c.name,c))})}static async _resolveControllerMetadata(e,t,r){typeof r=="function"&&!_f(r)&&(r=t instanceof ne?r(t.instance):r()),r=await Z(r);let i,n,s;if(typeof r=="function"){if(n=Reflect.getMetadata(se,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(se,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 ne(t,{...r,instance:i,ctor:n});return r.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,s,r.types)}),r.parameters&&await e.enterAsync(".parameters",async()=>{let c=0;for(let l of r.parameters)await e.enterAsync(`[${c++}]`,async()=>{let m={...l};await e.enterAsync(".type",async()=>{m.type=await M.resolveDataType(e,s,l.type)});let E=new Nr(s,m);s.parameters.push(E)})}),r.operations&&await e.enterAsync(".operations",async()=>{for(let[c,l]of Object.entries(r.operations))await e.enterAsync(`[${c}]`,async()=>{let m=new D(s,{name:c,method:"GET"});await this._initHttpOperation(e,m,l),s.operations.set(c,m)})}),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 D.apply(t,[t.owner,i]),r.types&&await e.enterAsync(".types",async()=>{await M.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 c={...s};await e.enterAsync(".type",async()=>{c.type=await M.resolveDataType(e,t,s.type)});let l=new Nr(t,c);t.parameters.push(l)})}),r.responses&&await e.enterAsync(".responses",async()=>{let n=0;for(let s of r.responses)await e.enterAsync(`[${n++}]`,async()=>{let c=new fi(t,{statusCode:s.statusCode});await this._initHttpOperationResponse(e,c,s),t.responses.push(c)})}),r.requestBody&&await e.enterAsync(".requestBody",async()=>{let n=new mi(t);await this._initHttpRequestBody(e,n,r.requestBody),t.requestBody=n}),t}static async _initHttpMediaType(e,t,r){Ue.call(t,t.owner,{...r,type:void 0,multipartFields:void 0}),r.type&&await e.enterAsync(".type",async()=>{t.type=await M.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 li(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 M.resolveDataType(e,t,n.type)});let c=new Nr(t,s);t.parameters.push(c)})})}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 Ue(t,String(i));await this._initHttpMediaType(e,s,n),t.content.push(s)})})}};a(Ls,"HttpApiFactory");var Ht=Ls;import{omitUndefined as gf}from"@jsopen/objects";import{md5 as Af}from"super-fast-md5";var Ps=class Ps extends Fe{constructor(t){super(t);p(this,"_controllerReverseMap",new WeakMap);p(this,"transport","mq");p(this,"platform");p(this,"controllers",new S);this.platform=t.platform}findController(t){if(typeof t=="function"){let r=this._controllerReverseMap.get(t);if(r!=null)return r;for(let i of this.controllers.values())if(i.ctor===t)return this._controllerReverseMap.set(t,i),i;this._controllerReverseMap.set(t,null);return}return this.controllers.get(t)}findOperation(t,r){let i=this.findController(t);return i==null?void 0:i.operations.get(r)}toJSON(){let r={...super.toJSON(),transport:this.transport,platform:this.platform,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON();return r}};a(Ps,"MQApi");var nt=Ps;var js=class js extends Fe{constructor(t){super(t);p(this,"_controllerReverseMap",new WeakMap);p(this,"transport","ws");p(this,"controllers",new S)}findController(t){if(typeof t=="function"){let r=this._controllerReverseMap.get(t);if(r!=null)return r;for(let i of this.controllers.values())if(i.ctor===t)return this._controllerReverseMap.set(t,i),i;this._controllerReverseMap.set(t,null);return}return this.controllers.get(t)}findOperation(t,r){let i=this.findController(t);return i==null?void 0:i.operations.get(r)}toJSON(){let r={...super.toJSON(),transport:this.transport,controllers:{}};for(let i of this.controllers.values())r.controllers[i.name]=i.toJSON();return r}};a(js,"WSApi");var st=js;var lp,fp,Cs=class Cs extends(fp=O,lp=be,fp){constructor(){super(null);p(this,lp,new WeakMap);p(this,"id","");p(this,"url");p(this,"info",{});p(this,"references",new S);p(this,"types",new W);p(this,"api");this.node[k]=this.types,this.node.findDataType=this._findDataType.bind(this)}getDataTypeNs(t){let r=t instanceof g?this._findDataType(t.name||""):this._findDataType(t);if(r)return this[be].get(r)}findDocument(t){if(this.id===t)return this;for(let r of this.references.values()){if(r.id===t)return r;let i=r.findDocument(t);if(i)return i}}get httpApi(){if(this.api&&this.api instanceof it)return this.api}get mqApi(){if(this.api&&this.api instanceof nt)return this.api}get wsApi(){if(this.api&&this.api instanceof st)return this.api}getHttpApi(){if(!(this.api&&this.api instanceof it))throw new TypeError("The document do not contains HttpApi instance");return this.api}getMqApi(){if(!(this.api&&this.api instanceof nt))throw new TypeError("The document do not contains MQApi instance");return this.api}getWsApi(){if(!(this.api&&this.api instanceof st))throw new TypeError("The document do not contains WSApi instance");return this.api}toJSON(){return this.export()}export(t){let r=gf({spec:u.SpecVersion,id:this.id,url:this.url,info:L(this.info,!0)});if(this.references.size){let i=0,n={};for(let[s,c]of this.references.entries())c[Ve]||(n[s]={id:c.id,url:c.url,info:L(c.info,!0)},i++);i&&(r.references=n)}if(this.types.size){r.types={};for(let i of this.types.values())i.inScope(t==null?void 0:t.scope)&&(r.types[i.name]=i.toJSON(t))}return this.api&&(r.api=this.api.toJSON(t)),r}invalidate(){let t=this.export({});delete t.id,this.id=Af(JSON.stringify(t)),this[be]=new WeakMap}_findDataType(t,r,i){let n=this.types.get(t);if(n&&n.inScope(r))return n;if(!this.references.size)return;if(typeof t=="string"){let c=ha.exec(t);if(c){let l=c[1];if(l){let m=this.references.get(l);return m?(i=i||new WeakMap,i.set(this,!0),i.set(m,!0),m._findDataType(c[2],r,i)):void 0}t=c[2]}}i=i||new WeakMap,i.set(this,!0);let s=Array.from(this.references.keys()).reverse();for(let c of s){let l=this.references.get(c);if(n=l==null?void 0:l.types.get(t),n)return this[be].set(n,l!=null&&l[Ve]?"":c),n}for(let c of s){let l=this.references.get(c);if(i.set(l,!0),n=l._findDataType(t,r,i),n)return this[be].set(n,l!=null&&l[Ve]?"":c),n}}};a(Cs,"ApiDocument");var at=Cs;function Be(o,e,t){let r=pi(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"&&Pr(this,o,r)}}}[n];if(typeof o=="function"&&Lr(s.prototype,o.prototype),typeof o=="function"){let l=Reflect.getOwnMetadata(y,o);if(!l)throw new TypeError(`Class "${o}" doesn't have datatype metadata information`);if(!(l.kind===u.ComplexType.Kind||l.kind===u.MappedType.Kind||l.kind===u.MixinType.Kind))throw new TypeError(`Class "${o}" is not a ${u.ComplexType.Kind}`)}let c={...t,kind:"MappedType",base:o};return e.pick&&(c.pick=e.pick),e.omit&&(c.omit=e.omit),e.partial&&(c.partial=e.partial),e.required&&(c.required=e.required),Reflect.defineMetadata(y,c,s),typeof o=="function"&&rt._applyMixin(s,o,{...e,isInheritedPredicate:r}),s}a(Be,"createMappedClass");function bA(o,e,t){return Be(o,{omit:e},t)}a(bA,"OmitType");function MA(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Be(o,{partial:t},r)}a(MA,"PartialType");function LA(o,e,t){return Be(o,{pick:e},t)}a(LA,"PickType");function FA(o,...e){let t=Array.isArray(e[0])?e[0]:!0,r=Array.isArray(e[0])?e[1]:e[0];return Be(o,{required:t},r)}a(FA,"RequiredType");function qA(o,e){return(t,r,i)=>{if(typeof r!="string")throw new TypeError("Un-named properties can not be decorated");if(!o&&(o=Reflect.getMetadata("design:paramtypes",t,r)[i],!o))throw new TypeError("Missing parameter type");let n=Reflect.getOwnMetadata(ir,t,r);n||(n=[],Reflect.defineMetadata(ir,n,t,r)),n.push({...e,type:o,parameterIndex:i})}}a(qA,"WsParam");import{updateErrorMessage as Cf}from"@jsopen/objects";import{isConstructor as vf}from"@jsopen/objects";import{omitUndefined as wf}from"@jsopen/objects";import{asMutable as Of}from"ts-gems";var pt=a(function(...o){var i;if(!this)return pt[w].apply(void 0,o);let[e,t]=o;if(O.call(this,e),!j.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=Of(this);r.kind=u.MQController.Kind,r.types=r.node[k]=new W,r.operations=new S,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"),Us=class Us extends O{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 pt)return this.node.parent.element.findHeader(e,t)}toString(){return`[MQController ${this.name}]`}toJSON(){let e=wf({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}[Se](){return`[${Me}MQController${ve+this.name+Ae}]`}};a(Us,"MQControllerClass");var Fs=Us;pt.prototype=Fs.prototype;Object.assign(pt,Yt);pt[w]=Yt;import{omitUndefined as Rf}from"@jsopen/objects";import{asMutable as bf}from"ts-gems";import{vg as Df}from"valgen";var Sr=a(function(o,e){if(!this)throw new TypeError('"this" should be passed to call class constructor');ot.call(this,o,e);let t=bf(this);e.name&&(t.name=e.name instanceof RegExp?e.name:e.name.startsWith("/")?$e(e.name,{includeFlags:"i",excludeFlags:"m"}):e.name),t.deprecated=e.deprecated,t.required=e.required,t.designType=e.designType},"MQHeader"),Bs=class Bs extends ot{toJSON(){return Rf({...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}))||Df.isAny()}};a(Bs,"MQHeaderClass");var $s=Bs;Sr.prototype=$s.prototype;import{omitUndefined as Nf}from"@jsopen/objects";import{asMutable as Sf}from"ts-gems";import{vg as mp}from"valgen";var Mr=a(function(...o){if(!this){let[i,n]=o,s=[];return Mr[w].call(void 0,s,i,n)}let[e,t]=o;if(O.call(this,e),!j.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Sf(this);r.headers=[],r.types=r.node[k]=new W,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 g?t.type:r.owner.node.getDataType(t.type)),t!=null&&t.keyType&&(r.keyType=(t==null?void 0:t.keyType)instanceof g?t.keyType:r.owner.node.getDataType(t.keyType)),r.designType=t.designType,r.keyDesignType=t.keyDesignType},"MQOperation"),Ks=class Ks extends O{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=Nf({kind:u.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}))||mp.isAny()}generateKeyCodec(e,t,r){var i;return((i=this.keyType)==null?void 0:i.generateCodec(e,t,{...r,designType:this.keyDesignType}))||mp.isAny()}};a(Ks,"MQOperationClass");var qs=Ks;Mr.prototype=qs.prototype;Mr[w]=Rr;import{omitUndefined as Mf}from"@jsopen/objects";var Vs=class Vs extends O{constructor(t,r){super(t);p(this,"channel");p(this,"description");p(this,"type");p(this,"keyType");p(this,"headers",[]);p(this,"designType");p(this,"keyDesignType");this.channel=r==null?void 0:r.channel,this.description=r==null?void 0:r.description,r!=null&&r.type?this.type=(r==null?void 0:r.type)instanceof g?r.type:this.owner.node.getDataType(r.type):this.type=this.owner.node.getDataType("any"),r!=null&&r.keyType&&(this.keyType=(r==null?void 0:r.keyType)instanceof g?r.keyType:this.owner.node.getDataType(r.keyType)),this.designType=r==null?void 0:r.designType,this.keyDesignType=r==null?void 0:r.keyDesignType}findHeader(t){let r=t.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(t))return i}toJSON(){let t=Mf({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){t.headers=[];for(let r of this.headers)t.headers.push(r.toJSON())}return t}};a(Vs,"MQOperationResponse");var ui=Vs;var Ws=class Ws{static async createApi(e,t){let r=new nt(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"&&!vf(r)&&(r=r()),r=await Z(r);let n,s,c;if(typeof r=="function"){if(s=Reflect.getMetadata(ae,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(ae,n),s?c=r:(s=r,r.instance==="object"&&(c=r.instance,n=Object.getPrototypeOf(c).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 l=new pt(t,{...s,name:i,instance:c,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,l,s.types)}),s.headers&&await e.enterAsync(".headers",async()=>{let m=0;for(let E of s.headers)await e.enterAsync(`[${m++}]`,async()=>{let A={...E};await e.enterAsync(".type",async()=>{E.type&&(A.type=l.node.findDataType(E.type)),!A.type&&typeof E.type=="object"&&(A.type=await M.createDataType(e,l,E.type)),A.type||(A.type=l.node.getDataType("any"))});let _=new Sr(l,A);l.headers.push(_)})}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[m,E]of Object.entries(s.operations))await e.enterAsync(`[${m}]`,async()=>{let A=new Mr(l,{...E,name:m,types:void 0,type:void 0,keyType:void 0});await this._initMQOperation(e,A,E),l.operations.set(A.name,A)})}),l}static async _initMQOperation(e,t,r){r.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,t,r.types)}),t.type=await M.resolveDataType(e,t,r.type),r.keyType&&(t.keyType=await M.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 M.resolveDataType(e,t,n.type)});let c=new Sr(t,s);t.headers.push(c)})}),r.response&&await e.enterAsync(".response",async()=>{let i=new ui(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 M.resolveDataType(e,t,r.type),r.keyType&&(t.keyType=await M.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 M.resolveDataType(e,t,n.type)});let c=new Sr(t,s);t.headers.push(c)})})}};a(Ws,"MQApiFactory");var di=Ws;import{isConstructor as jf}from"@jsopen/objects";import{omitUndefined as If}from"@jsopen/objects";import{asMutable as kf}from"ts-gems";var er=a(function(...o){var i;if(!this)return er[w].apply(void 0,o);let[e,t]=o;if(O.call(this,e),!j.test(t.name))throw new TypeError(`Invalid resource name (${t.name})`);let r=kf(this);r.kind=u.WSController.Kind,r.types=r.node[k]=new W,r.operations=new S,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"),Js=class Js extends O{toString(){return`[WSController ${this.name}]`}toJSON(){let e=If({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}[Se](){return`[${Me}WSController${ve+this.name+Ae}]`}};a(Js,"WSControllerClass");var zs=Js;er.prototype=zs.prototype;Object.assign(er,Gt);er[w]=Gt;import{omitUndefined as Lf}from"@jsopen/objects";import{asMutable as Pf}from"ts-gems";var vr=a(function(...o){if(!this){let[i,n]=o,s=[];return vr[w].call(void 0,s,i,n)}let[e,t]=o;if(O.call(this,e),!j.test(t.name))throw new TypeError(`Invalid operation name (${t.name})`);let r=Pf(this);r.types=r.node[k]=new W,r.name=t.name,r.description=t.description,t.event?this.event=t.event instanceof RegExp?t.event:t.event.startsWith("/")?$e(t.event):t.event:r.event=this.name,t!=null&&t.arguments?r.arguments=t.arguments.map(i=>({type:i.type instanceof g?i.type:r.owner.node.getDataType(i.type),parameterIndex:i.parameterIndex})):r.arguments=[],t!=null&&t.response&&(r.response=t.response instanceof g?t.response:r.owner.node.getDataType(t.response))},"WSOperation"),Ys=class Ys extends O{toJSON(){var e;return Lf({kind:u.WSOperation.Kind,description:this.description,event:this.event,arguments:(e=this.arguments)==null?void 0:e.map(t=>t.type.name?t.type.name:t.type.toJSON())})}};a(Ys,"WSOperationClass");var Qs=Ys;vr.prototype=Qs.prototype;vr[w]=br;var Gs=class Gs{static async createApi(e,t){let r=new st(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"&&!jf(r)&&(r=r()),r=await Z(r);let n,s,c;if(typeof r=="function"){if(s=Reflect.getMetadata(pe,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(pe,n),s?c=r:(s=r,r.instance==="object"&&(c=r.instance,n=Object.getPrototypeOf(c).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 l=new er(t,{...s,name:i,instance:c,ctor:n});return s.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,l,s.types)}),s.operations&&await e.enterAsync(".operations",async()=>{for(let[m,E]of Object.entries(s.operations))await e.enterAsync(`[${m}]`,async()=>{let A=Reflect.getMetadata(ir,n.prototype,m),_=E;A&&(_={..._,arguments:A});let U=new vr(l,{..._,name:m,types:void 0,type:void 0,keyType:void 0,arguments:void 0,response:void 0});await this._initWSOperation(e,U,_),l.operations.set(m,U)})}),l}static async _initWSOperation(e,t,r){var i;r.types&&await e.enterAsync(".types",async()=>{await M.addDataTypes(e,t,r.types)}),(i=r.arguments)!=null&&i.length&&(await e.enterAsync(".arguments",async()=>{var s;t.arguments=[];let n;for(n of r.arguments){let c={};typeof n=="object"&&n.type&&n.parameterIndex!==null?Object.assign(c,n):c.type=n;let l=await M.resolveDataType(e,t,c.type);(s=t.arguments)==null||s.push({type:l,parameterIndex:c.parameterIndex})}}),t.arguments.sort((n,s)=>n.parameterIndex-s.parameterIndex)),r.response&&await e.enterAsync(".response",async()=>{t.response=await M.resolveDataType(e,t,r.response)})}};a(Gs,"WSApiFactory");var hi=Gs;var Ff="https://oprajs.com/spec/v"+u.SpecVersion,yi=class yi{constructor(){p(this,"_allDocuments",{})}static async createDocument(e,t){let r=new yi,i=t instanceof ye?t:new ye(t);try{let n=new at;if(await r.initDocument(n,i,e),i.error.details.length)throw i.error;return n}catch(n){try{n instanceof Lt||i.addError(n)}catch{}if(!i.error.message){let s=i.error.details.length,c=`(${s}) error${s>1?"s":""} found in document schema.`;i.showErrorDetails&&(c+=i.error.details.map(l=>`
9
9
 
10
10
  - ${l.message}`+(l.path?`
11
- @${l.path}`:"")).join("")),mf(i.error,c)}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[Ke]){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||u.SpecVersion,e.url=i.url,i.info&&(e.info={...i.info}),i.references&&await t.enterAsync(".references",async()=>{let s,c;for([s,c]of Object.entries(i.references))c=await Z(c),await t.enterAsync(`[${s}]`,async()=>{if(!F.test(s))throw new TypeError(`Invalid namespace (${s})`);if(c instanceof st){e.references.set(s,c);return}let l=new st;n&&l.references.set("opra",n),await this.initDocument(l,t,c),e.references.set(s,this._allDocuments[l.id])})}),i.types&&await t.enterAsync(".types",async()=>{await M.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:u.SpecVersion,url:uf,info:{version:u.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[...Object.values(Xn),...Object.values(jn)]},r=new st;r[Ke]=!0;let i=Object.getPrototypeOf(BigInt(0)).constructor,n=Object.getPrototypeOf(Buffer.from([])),s=r.types[Mr];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 za=ai;var Ja;(function(o){o.HttpApiFactory=Jt,o.DataTypeFactory=M,o.MQOperationDecoratorFactory=_r,o.MQControllerDecoratorFactory=Kt,o.WSOperationDecoratorFactory=xr,o.WSControllerDecoratorFactory=Vt})(Ja||(Ja={}));import{uid as NO}from"uid";export{qn as AnyType,je as ApiBase,st as ApiDocument,za as ApiDocumentFactory,$ as ApiField,ue as ArrayType,Ke as BUILTIN,Ks as BadRequestError,hn as Base64Type,Ha as BaseI18n,zn as BigintType,Jn as BooleanType,F as CLASS_NAME_PATTERN,ie as ComplexType,Vs as ConflictError,y as DATATYPE_METADATA,x as DECODER,A as DECORATOR,_ as DataType,W as DataTypeMap,Xe as DateTimeType,ur as DateTimeTypeTz,lr as DateType,O as DocumentElement,ye as DocumentInitContext,Jr as DocumentNode,w as ENCODER,te as EmailType,ee as EnumType,Ws as FailedDependencyError,J as FieldPathType,Ve as FieldsProjection,He as FilterType,Dr as ForbiddenError,se as HTTP_CONTROLLER_METADATA,rt as HttpApi,ne as HttpController,zs as HttpHeaderCodes,Ce as HttpMediaType,ti as HttpMultipartField,D as HttpOperation,ri as HttpOperationResponse,wr as HttpParameter,ii as HttpRequestBody,R as HttpStatusCode,Qf as HttpStatusMessages,gr as HttpStatusRange,Gt as I18n,Ut as IntegerType,Js as InternalServerError,ra as IssueSeverity,ot as MQApi,at as MQController,Ar as MQHeader,Or as MQOperation,ae as MQ_CONTROLLER_METADATA,tt as MappedType,Qs as MethodNotAllowedError,b as MimeTypes,Wt as MixinType,oa as NAMESPACE_PATTERN,Ys as NotAcceptableError,Gs as NotFoundError,Yn as NullType,Oe as NumberType,Rn as ObjectIdType,Gn as ObjectType,xg as OmitType,Te as OperationResult,Nt as OpraDocumentError,Ee as OpraException,dr as OpraFilter,v as OpraHttpError,u as OpraSchema,Og as PartialType,Xs as PermissionError,Ng as PickType,cu as RPC_CONTROLLER_METADATA,Ig as RequiredType,Zs as ResourceConflictError,Hs as ResourceNotAvailableError,S as ResponsiveMap,d as SimpleType,et as StringType,hr as TimeType,ea as UnauthorizedError,zt as UnionType,ta as UnprocessableEntityError,Fn as UrlType,Xr as UuidType,nt as WSApi,Qt as WSController,Rr as WSOperation,pe as WS_CONTROLLER_METADATA,Xt as WS_PARAM_METADATA,Fg as WsParam,Ja as classes,L as cloneObject,ou as getErrorStack,iu as getStackFileName,li as i18n,Sr as inheritPropertyInitializers,bu as isBlob,Du as isFormData,Au as isReadable,Ru as isReadableStream,Si as isStream,Nu as isURL,Ou as isWritable,Mr as kCtorMap,k as kDataTypeMap,be as kTypeNSMap,Nr as mergePrototype,pa as parse,aa as parseFieldsProjection,Z as resolveThunk,xu as safeJsonStringify,Af as translate,NO as uid};
11
+ @${l.path}`:"")).join("")),Cf(i.error,c)}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[Ve]){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||u.SpecVersion,e.url=i.url,i.info&&(e.info={...i.info}),i.references&&await t.enterAsync(".references",async()=>{let s,c;for([s,c]of Object.entries(i.references))c=await Z(c),await t.enterAsync(`[${s}]`,async()=>{if(!j.test(s))throw new TypeError(`Invalid namespace (${s})`);if(c instanceof at){e.references.set(s,c);return}let l=new at;n&&l.references.set("opra",n),await this.initDocument(l,t,c),e.references.set(s,this._allDocuments[l.id])})}),i.types&&await t.enterAsync(".types",async()=>{await M.addDataTypes(t,e,i.types)}),i.api&&await t.enterAsync(".api",async()=>{if(i.api&&i.api.transport==="http"){let s=await Ht.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="mq"){let s=await di.createApi(t,{...i.api,owner:e});s&&(e.api=s)}else if(i.api&&i.api.transport==="ws"){let s=await hi.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:u.SpecVersion,url:Ff,info:{version:u.SpecVersion,title:"Opra built-in types",license:{url:"https://github.com/oprajs/opra/blob/main/LICENSE",name:"MIT"}},types:[...Object.values(ps),...Object.values(Qn)]},r=new at;r[Ve]=!0;let i=Object.getPrototypeOf(BigInt(0)).constructor,n=Object.getPrototypeOf(Buffer.from([])),s=r.types[jr];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(yi,"ApiDocumentFactory");var up=yi;var dp;(function(o){o.HttpApiFactory=Ht,o.DataTypeFactory=M,o.MQOperationDecoratorFactory=Rr,o.MQControllerDecoratorFactory=Yt,o.WSOperationDecoratorFactory=br,o.WSControllerDecoratorFactory=Gt})(dp||(dp={}));import{uid as LR}from"uid";export{Zn as AnyType,Fe as ApiBase,at as ApiDocument,up as ApiDocumentFactory,$ as ApiField,ue as ArrayType,Ve as BUILTIN,ea as BadRequestError,On as Base64Type,xp as BaseI18n,is as BigintType,os as BooleanType,j as CLASS_NAME_PATTERN,ie as ComplexType,ta as ConflictError,ti as CreditCardType,y as DATATYPE_METADATA,T as DECODER,w as DECORATOR,g as DataType,W as DataTypeMap,Ze as DateTimeType,_r as DateTimeTypeTz,yr as DateType,O as DocumentElement,ye as DocumentInitContext,Hr as DocumentNode,x as ENCODER,Mn as EanType,te as EmailType,ee as EnumType,ra as FailedDependencyError,J as FieldPathType,We as FieldsProjection,et as FilterType,kr as ForbiddenError,se as HTTP_CONTROLLER_METADATA,it as HttpApi,ne as HttpController,ia as HttpHeaderCodes,Ue as HttpMediaType,li as HttpMultipartField,D as HttpOperation,fi as HttpOperationResponse,Nr as HttpParameter,mi as HttpRequestBody,R as HttpStatusCode,_m as HttpStatusMessages,Dr as HttpStatusRange,rr as I18n,Pn as IbanType,Wt as IntegerType,oa as InternalServerError,ii as IpType,ua as IssueSeverity,nt as MQApi,pt as MQController,Sr as MQHeader,Mr as MQOperation,ae as MQ_CONTROLLER_METADATA,rt as MappedType,na as MethodNotAllowedError,b as MimeTypes,Xt as MixinType,oi as MobilePhoneType,ha as NAMESPACE_PATTERN,sa as NotAcceptableError,aa as NotFoundError,ss as NullType,Oe as NumberType,jn as ObjectIdType,as as ObjectType,bA as OmitType,Te as OperationResult,Lt as OpraDocumentError,Ee as OpraException,xr as OpraFilter,v as OpraHttpError,u as OpraSchema,MA as PartialType,pa as PermissionError,LA as PickType,Lu as RPC_CONTROLLER_METADATA,FA as RequiredType,ca as ResourceConflictError,la as ResourceNotAvailableError,S as ResponsiveMap,d as SimpleType,tt as StringType,gr as TimeType,fa as UnauthorizedError,Zt as UnionType,ma as UnprocessableEntityError,Jn as UrlType,si as UuidType,st as WSApi,er as WSController,vr as WSOperation,pe as WS_CONTROLLER_METADATA,ir as WS_PARAM_METADATA,qA as WsParam,dp as classes,L as cloneObject,Su as getErrorStack,Nu as getStackFileName,_i as i18n,Pr as inheritPropertyInitializers,Xu as isBlob,Zu as isFormData,Qu as isReadable,Gu as isReadableStream,Fi as isStream,Hu as isURL,Yu as isWritable,jr as kCtorMap,k as kDataTypeMap,be as kTypeNSMap,Lr as mergePrototype,_a as parse,Ea as parseFieldsProjection,Z as resolveThunk,Wu as safeJsonStringify,Qf as translate,LR as uid};