import Resolver from"../resolver.js";import{SearchResults,EnrichedSearchResults,IntermediateSearchResults,HighlightOptions}from"../type.js";Resolver.prototype.not=function(){return this.handler("not",return_result,arguments)};function return_result(a,b,c,d,e,f,g){if(!f&&!this.result.length)return e?this.result:this;let h;return a.length&&this.result.length&&(this.result=exclusion.call(this,a,b,c,e),h=!0),e&&(this.await=null),e?this.resolve(b,c,d,g,h):this}function exclusion(a,b,c,d){const e=[],f=new Set(a.flat().flat());for(let g,h=0,i=0;h<this.result.length;h++)if(g=this.result[h],g)for(let a,j=0;j<g.length;j++)if(a=g[j],!f.has(a)){if(c){c--;continue}if(d){if(e.push(a),e.length===b)return e;}else if(e[h]||(e[h]=[]),e[h].push(a),++i===b)return e}return e}