import{DbBuildError as m}from"../common/error";import{AbstractCommand as c,QueryUpdateCommand as u,UpdateCommand as h}from"./AbstractCommand";import{Operator as r}from"./Operator";import{Geometry as g}from"../mongo-builder/Geo";var b=function(){function e(n,s){if(s===void 0){s=""}this.data=n;this.prefix=s}e.prototype.stringify=function(n){n=n||new r;for(var s in this.data){var t=this.prefix?"".concat(this.prefix,".").concat(s):s;var i=this.data[s];var f=typeof i;if(i instanceof c){if(!(i instanceof h)){throw m.invalidCommand("Command \u4E0D\u662F\u66F4\u65B0\u64CD\u4F5C")}if(i instanceof u){n.mergeOperator(i.operator,i.stringifyWithKey(t))}else{n.applyOperator(i.operator,t,i.stringify())}}else if(i instanceof g){n.set(t,i.toJSON())}else if(i instanceof Date){n.set(t,i)}else if(f==="number"){n.set(t,i)}else if(f==="boolean"){n.set(t,i)}else if(f==="string"){n.set(t,i)}else if(f==="bigint"){n.set(t,i)}else if(f==="function"){throw m.invalidParam(t,"\u4E0D\u652F\u6301\u51FD\u6570")}else if(f==="symbol"){throw m.invalidParam(t,"\u4E0D\u652F\u6301 symbol")}else if(f==="undefined"){}else if(i===null){n.set(t,i)}else if(Array.isArray(i)){n.set(t,i)}else{var d=new e(i,t);d.stringify(n)}}return n};e.prototype.toJSON=function(){var n=this.stringify();return n.emit()};return e}();export{b as UpdateRequest};