const t=function(t,e){let s=[];return t.forEach((t=>{let r=e(t);r.found&&(s=s.concat(r.ptrs))})),t[0].update(s)};var e={api:function(e){class Paragraphs{constructor(t){this.viewType="Paragraphs",this.views=t}get found(){return this.views.length>0}get length(){return this.views.length}text(t){return function(t,e){let s=[];return t.forEach((t=>{s+=e(t)})),s}(this.views,(e=>e.text(t)))}json(){return function(t,e){let s=[];return t.forEach((t=>{s.push(t[e]())})),s}(this.views,"json")}match(e){return t(this.views,(t=>t.match(e)))}not(e){return t(this.views,(t=>t.match(e)))}sentences(){return t(this.views,(t=>t))}terms(){return t(this.views,(t=>t.terms()))}filter(t){let e=this.views.filter((e=>e.some(t)));return this.update(e)}forEach(t){return this.views.forEach((e=>{e.forEach(t)})),this}map(t){let e=this.views.map((e=>t(e)));return this.update(e)}has(t){return this.views.some((e=>e.has(t)))}if(t){let e=this.views.filter((e=>e.has(t)));return this.update(e)}ifNo(t){let e=this.views.filter((e=>!e.has(t)));return this.update(e)}eq(t){let e=this.views[t];return e?this.update([e]):this.update([])}first(){return this.eq(0)}last(){return this.eq(this.length-1)}debug(){this.views.forEach((t=>{console.log("\n=-=-=-=-"),t.debug()}))}update(t){return new Paragraphs(t)}}e.prototype.paragraphs=function(){const t=/\n\n/;let e=[],s=[];this.all().forEach((r=>{let i=r.lastTerm();s.push(r.ptrs[0]),t.test(i.post())&&(e.push(s),s=[])})),s.length&&e.push(s);let r=e.map((t=>this.update(t)));return new Paragraphs(r)}}};export{e as default};
