function m(c,s=[]){const n=Array.from({length:s.length},()=>new Set),r=decodeURIComponent(c);if(!r)return n;const o=r.split(/\s+(?:AND|OR)\s+|\(|\)/).reduce((t,e)=>{const l=e.trim();return l.length>0&&t.push(l),t},[]);for(const t of o){const e=Math.max(t.indexOf(":"),t.indexOf("~"));if(e===-1)continue;const l=t.slice(0,e);let a=t.slice(e+1);const i=s.findIndex(f=>f.property===l);if(i===-1)continue;if(s[i].type==="date-range"&&a.includes("..")){const[f,u]=a.split("..");n[i]={from:f,to:u}}else{const f=d(a.toLowerCase()),u=n[i]instanceof Set?n[i]:new Set;f.forEach(p=>u.add(p))}}return n}function d(c){const s=[];let n="",r=!1,o="";for(let t=0;t<c.length;t++){const e=c[t];!r&&(e==='"'||e==="'")?(r=!0,o=e):r&&e===o?(r=!1,o=""):!r&&e===","?(s.push(n.trim()),n=""):n+=e}return n.trim()&&s.push(n.trim()),s.map(t=>t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t)}export{m as parseFilterQuery};
