import{bisector as X,union as q,intersection as J}from"/-/d3-array@v3.2.4-G4hy00bPnjF6FrSYpT32/dist=es2020,mode=imports,min/optimized/d3-array.js";import{field as z,extend as Q,array as D,toNumber as _,error as W,peek as B,hasOwnProperty as G,isDate as O,isArray as L,inrange as P}from"/-/vega-util@v1.17.2-LUfkDhormMyfWqy3Ts6U/dist=es2020,mode=imports,min/optimized/vega-util.js";import{Literal as H}from"/-/vega-expression@v5.1.1-K4clrYr2THuj5KncykTn/dist=es2020,mode=imports,min/optimized/vega-expression.js";const U=Symbol("vega_selection_getter");function S(t){return(!t.getter||!t.getter[U])&&(t.getter=z(t.field),t.getter[U]=!0),t.getter}const j="intersect",V="union",K="vlMulti",Z="vlPoint",C="or",b="and",g="_vgsid_",R=z(g),ee="E",te="R",ie="R-E",ne="R-LE",re="R-RE",T="index:unit";function F(t,i){for(var n=i.fields,e=i.values,u=n.length,r=0,s,f;rQ(i.fields?{values:i.fields.map(e=>S(e)(n.datum))}:{[g]:R(n.datum)},i))}function de(t,i,n,e){for(var u=this.context.data[t],r=u?u.values.value:[],s={},f={},d={},c,m,p,l,o,N,E,v,A,Y,M=r.length,I=0,x,k;I(h[m[y].field]=a,h),{})))}else o=g,N=R(c),E=s[o]||(s[o]={}),v=E[l]||(E[l]=[]),v.push(N),n&&(v=f[l]||(f[l]=[]),v.push({[g]:N}));if(i=i||V,s[g]?s[g]=$[`${g}_${i}`](...Object.values(s[g])):Object.keys(s).forEach(h=>{s[h]=Object.keys(s[h]).map(a=>s[h][a]).reduce((a,y)=>a===void 0?y:$[`${d[h]}_${i}`](a,y))}),r=Object.keys(f),n&&r.length){const h=e?Z:K;s[h]=i===V?{[C]:r.reduce((a,y)=>(a.push(...f[y]),a),[])}:{[b]:r.map(a=>({[C]:f[a]}))}}return s}var $={[`${g}_union`]:q,[`${g}_intersect`]:J,E_union:function(t,i){if(!t.length)return i;for(var n=0,e=i.length;ni.indexOf(n)>=0):i},R_union:function(t,i){var n=_(i[0]),e=_(i[1]);return n>e&&(n=i[1],e=i[0]),t.length?(t[0]>n&&(t[0]=n),t[1]e&&(n=i[1],e=i[0]),t.length?ee&&(t[1]=e),t):[n,e]}};const ae=":",ce="@";function me(t,i,n,e){i[0].type!==H&&W("First argument to selection functions must be a string literal.");const u=i[0].value,r=i.length>=2&&B(i).value,s="unit",f=ce+s,d=ae+u;r===j&&!G(e,f)&&(e[f]=n.getData(u).indataRef(n,s)),G(e,d)||(e[d]=n.getData(u).tuplesRef())}export{oe as selectionIdTest,de as selectionResolve,se as selectionTest,le as selectionTuples,me as selectionVisitor};export default null;