import{clone as i,create as o}from"@bufbuild/protobuf";import{AccountIdSchema as f,SearchQuerySchema as d,UUIDSchema as Q}from"@orderlyshop/core-client";var c;function s(r){c=r?i(d,r):void 0}function A(){return c?i(d,c):void 0}function B(r){return o(d,{SourceAccountId:o(f,{Id:o(Q,{Value:r})})})}function F(r,n){let e=r?i(d,r):o(d),t=g(A(),n);if(!t)return e;let u=i(d,t),h=S(t.HiddenQuery,e.HiddenQuery,e.Query!==void 0?t.Query:void 0);return u.Query=e.Query??t.Query,u.HiddenQuery=h||void 0,u.Tags=[...t.Tags,...e.Tags],u.SourceAccountId=t.SourceAccountId??e.SourceAccountId,u.ExcludeAccountId=t.ExcludeAccountId??e.ExcludeAccountId,u.PriceFrom=e.PriceFrom??t.PriceFrom,u.PriceTo=e.PriceTo??t.PriceTo,u.OrderBy=e.OrderBy.length?[...e.OrderBy]:[...t.OrderBy],u.Facets=a([...t.Facets,...e.Facets]),u.Barcode=e.Barcode??t.Barcode,u.ConditionAbove=e.ConditionAbove??t.ConditionAbove,u.SaveAsLatest=t.SaveAsLatest||e.SaveAsLatest,u.Featured=t.Featured||e.Featured,u.ShareUrl=e.ShareUrl??t.ShareUrl,u.StoreId=t.StoreId??e.StoreId,u.WithBadge=y([...t.WithBadge,...e.WithBadge]),u.RelatedUrl=e.RelatedUrl??t.RelatedUrl,u.Continuation=e.Continuation,u}function g(r,n){if(!r&&!n)return;if(!r)return i(d,n);if(!n)return i(d,r);let e=i(d,r);return e.Query=S(r.Query,n.Query)||void 0,e.HiddenQuery=S(r.HiddenQuery,n.HiddenQuery)||void 0,e.Tags=[...r.Tags,...n.Tags],e.SourceAccountId=n.SourceAccountId??r.SourceAccountId,e.ExcludeAccountId=n.ExcludeAccountId??r.ExcludeAccountId,e.PriceFrom=n.PriceFrom??r.PriceFrom,e.PriceTo=n.PriceTo??r.PriceTo,e.OrderBy=n.OrderBy.length?[...n.OrderBy]:[...r.OrderBy],e.Facets=a([...r.Facets,...n.Facets]),e.Barcode=n.Barcode??r.Barcode,e.ConditionAbove=n.ConditionAbove??r.ConditionAbove,e.SaveAsLatest=r.SaveAsLatest||n.SaveAsLatest,e.Featured=r.Featured||n.Featured,e.ShareUrl=n.ShareUrl??r.ShareUrl,e.StoreId=n.StoreId??r.StoreId,e.WithBadge=y([...r.WithBadge,...n.WithBadge]),e.RelatedUrl=n.RelatedUrl??r.RelatedUrl,e.Continuation=n.Continuation??r.Continuation,e}function S(...r){return a(r.map(n=>n?.trim()).filter(n=>!!n)).join(" ")}function a(r){return[...new Set(r)]}function y(r){return[...new Set(r)]}export{s as configureShopSearchQuery,B as createAccountShopQuery,F as mergeShopSearchQuery,A as shopSearchQuery};
//# sourceMappingURL=shop-query.js.map