/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@ucast/mongo@2.4.3/dist/es6c/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@ucast/core");function t(e,t){if(!Array.isArray(t))throw new Error(`"${e.name}" expects value to be an array`)}function r(e,r){if(t(e,r),!r.length)throw new Error(`"${e.name}" expects to have at least one element in array`)}const o=e=>(t,r)=>{if(typeof r!==e)throw new Error(`"${t.name}" expects value to be a "${e}"`)},s={type:"compound",validate:r,parse(t,r,{parse:o}){const s=r.map(e=>o(e));return e.optimizedCompoundCondition(t.name,s)}},a=s,n={type:"compound",validate:r},p={type:"field",validate(e,t){if(!(t&&(t instanceof RegExp||t.constructor===Object)))throw new Error(`"${e.name}" expects to receive either regular expression or object of field operators`)},parse(t,r,o){const s=r instanceof RegExp?new e.FieldCondition("regex",o.field,r):o.parse(r,o);return new e.CompoundCondition(t.name,[s])}},i={type:"field",validate(e,t){if(!t||t.constructor!==Object)throw new Error(`"${e.name}" expects to receive an object with nested query or field level operators`)},parse(t,r,{parse:o,field:s,hasOperators:a}){const n=a(r)?o(r,{field:e.ITSELF}):o(r);return new e.FieldCondition(t.name,s,n)}},l={type:"field",validate:o("number")},c={type:"field",validate:t},x=c,f=c,u={type:"field",validate(e,t){if(!Array.isArray(t)||2!==t.length)throw new Error(`"${e.name}" expects an array with 2 numeric elements`)}},d={type:"field",validate:o("boolean")},$={type:"field",validate:function(e,t){if(!("string"==typeof t||"number"==typeof t||t instanceof Date))throw new Error(`"${e.name}" expects value to be comparable (i.e., string, number or date)`)}},w=$,y=w,v=w,b={type:"field"},g=b,h={type:"field",validate(e,t){if(!(t instanceof RegExp)&&"string"!=typeof t)throw new Error(`"${e.name}" expects value to be a regular expression or a string that represents regular expression`)},parse(t,r,o){const s="string"==typeof r?new RegExp(r,o.query.$options||""):r;return new e.FieldCondition(t.name,o.field,s)}},m={type:"field",parse:()=>e.NULL_CONDITION},E={type:"document",validate:o("function")};var j=Object.freeze({__proto__:null,$and:s,$or:a,$nor:n,$not:p,$elemMatch:i,$size:l,$in:c,$nin:x,$all:f,$mod:u,$exists:d,$gte:$,$gt:w,$lt:y,$lte:v,$eq:b,$ne:g,$regex:h,$options:m,$where:E});class O extends e.ObjectQueryParser{constructor(e){super(e,{defaultOperatorName:"$eq",operatorToConditionName:e=>e.slice(1)})}parse(t,r){return r&&r.field?e.buildAnd(this.parseFieldOperators(r.field,t)):super.parse(t)}}const _=j;Object.defineProperty(exports,"defaultParsers",{enumerable:!0,get:function(){return e.defaultInstructionParsers}}),exports.$all=f,exports.$and=s,exports.$elemMatch=i,exports.$eq=b,exports.$exists=d,exports.$gt=w,exports.$gte=$,exports.$in=c,exports.$lt=y,exports.$lte=v,exports.$mod=u,exports.$ne=g,exports.$nin=x,exports.$nor=n,exports.$not=p,exports.$options=m,exports.$or=a,exports.$regex=h,exports.$size=l,exports.$where=E,exports.MongoQueryParser=O,exports.allParsingInstructions=_;
//# sourceMappingURL=index.js.map
