"use strict";var __extends=this&&this.__extends||function(){var a=function(r,t){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o))e[o]=n[o]};return a(r,t)};return function(r,t){if(typeof t!=="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");a(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}}();var __assign=this&&this.__assign||function(){__assign=Object.assign||function(a){for(var r,t=1,e=arguments.length;t<e;t++){r=arguments[t];for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n))a[n]=r[n]}return a};return __assign.apply(this,arguments)};var __spreadArray=this&&this.__spreadArray||function(a,r,t){if(t||arguments.length===2)for(var e=0,n=r.length,o;e<n;e++){if(o||!(e in r)){if(!o)o=Array.prototype.slice.call(r,0,e);o[e]=r[e]}}return a.concat(o||Array.prototype.slice.call(r))};Object.defineProperty(exports,"__esModule",{value:true});exports.PushCommand=void 0;var constant_1=require("../../common/constant");var AbstractCommand_1=require("../AbstractCommand");var PushCommand=function(a){__extends(r,a);function r(t){var e=[];for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}var o=a.call(this)||this;if(typeof o.value==="object"&&o.value.hasOwnProperty("each")){o.value=t}else if((e===null||e===void 0?void 0:e.length)>0){o.value=[].concat.apply([],__spreadArray([t],e,false))}else{o.value=t}return o}Object.defineProperty(r.prototype,"operator",{get:function(){return"$push"},enumerable:false,configurable:true});r.prototype.stringify=function(){if(Array.isArray(this.value)){return{$each:this.value}}if(typeof this.value==="object"&&this.value.hasOwnProperty("each")){var t=this.value;var e={$each:t.each};if(t.position!==void 0){e.$position=t.position}if(t.slice!==void 0){e.$slice=t.slice}if(t.sort!==void 0){if(typeof t.sort==="string"){e.$sort=t.sort===constant_1.Sort.DESC?-1:1}else{e.$sort=t.sort}}return e}if(typeof this.value==="object"&&typeof this.value.$sort==="string"){return __assign(__assign({},this.value),{$sort:this.value.$sort===constant_1.Sort.DESC?-1:1})}return this.value};return r}(AbstractCommand_1.UpdateArrayCommand);exports.PushCommand=PushCommand;