var u=function(){var a=function(e,t){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o))r[o]=n[o]};return a(e,t)};return function(e,t){if(typeof t!=="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");a(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();var s=function(){s=Object.assign||function(a){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))a[n]=e[n]}return a};return s.apply(this,arguments)};var c=function(a,e,t){if(t||arguments.length===2)for(var r=0,n=e.length,o;r<n;r++){if(o||!(r in e)){if(!o)o=Array.prototype.slice.call(e,0,r);o[r]=e[r]}}return a.concat(o||Array.prototype.slice.call(e))};import{Sort as i}from"../../common/constant";import{UpdateArrayCommand as f}from"../AbstractCommand";var l=function(a){u(e,a);function e(t){var r=[];for(var n=1;n<arguments.length;n++){r[n-1]=arguments[n]}var o=a.call(this)||this;if(typeof o.value==="object"&&o.value.hasOwnProperty("each")){o.value=t}else if((r===null||r===void 0?void 0:r.length)>0){o.value=[].concat.apply([],c([t],r,false))}else{o.value=t}return o}Object.defineProperty(e.prototype,"operator",{get:function(){return"$push"},enumerable:false,configurable:true});e.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 r={$each:t.each};if(t.position!==void 0){r.$position=t.position}if(t.slice!==void 0){r.$slice=t.slice}if(t.sort!==void 0){if(typeof t.sort==="string"){r.$sort=t.sort===i.DESC?-1:1}else{r.$sort=t.sort}}return r}if(typeof this.value==="object"&&typeof this.value.$sort==="string"){return s(s({},this.value),{$sort:this.value.$sort===i.DESC?-1:1})}return this.value};return e}(f);export{l as PushCommand};