@genome-spy/core 0.69.0 → 0.69.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15538,13 +15538,15 @@ function u6(t) {
15538
15538
  let i = () => 1, s = [];
15539
15539
  const o = () => {
15540
15540
  const u = Sm(
15541
- s.map((f) => f()),
15541
+ s.map((d) => d()),
15542
15542
  "opacity.unitsPerPixel",
15543
15543
  t
15544
- );
15545
- l6(u, r, t);
15546
- const l = Hd().domain(u).range(r).clamp(!0);
15547
- i = (f) => l(f);
15544
+ ), l = l6(
15545
+ u,
15546
+ r,
15547
+ t
15548
+ ), f = Hd().domain(l.unitsPerPixel).range(l.values).clamp(!0);
15549
+ i = (d) => f(d);
15548
15550
  };
15549
15551
  s = e.unitsPerPixel.map((u) => {
15550
15552
  if (ue(u)) {
@@ -15607,19 +15609,29 @@ function l6(t, e, n) {
15607
15609
  '"opacity.unitsPerPixel" and "opacity.values" must have the same length.',
15608
15610
  n
15609
15611
  );
15610
- t.forEach((r, i) => {
15611
- if (r <= 0)
15612
+ t.forEach((o, a) => {
15613
+ if (o <= 0)
15612
15614
  throw new Pe(
15613
- "Invalid opacity.unitsPerPixel value at index " + i + ". Stop values must be positive.",
15615
+ "Invalid opacity.unitsPerPixel value at index " + a + ". Stop values must be positive.",
15614
15616
  n
15615
15617
  );
15616
15618
  });
15617
- for (let r = 1; r < t.length; r++)
15618
- if (t[r - 1] <= t[r])
15619
+ const r = t.map((o, a) => ({
15620
+ stop: o,
15621
+ value: e[a]
15622
+ }));
15623
+ r.sort((o, a) => a.stop - o.stop);
15624
+ const i = r.map((o) => o.stop), s = r.map((o) => o.value);
15625
+ for (let o = 1; o < t.length; o++)
15626
+ if (i[o - 1] <= i[o])
15619
15627
  throw new Pe(
15620
15628
  '"opacity.unitsPerPixel" must be strictly decreasing.',
15621
15629
  n
15622
15630
  );
15631
+ return {
15632
+ unitsPerPixel: i,
15633
+ values: s
15634
+ };
15623
15635
  }
15624
15636
  function Sm(t, e, n) {
15625
15637
  if (!le(t))
@@ -651,7 +651,7 @@ chrM 16299`};function d6(n){if(!(n in zy))throw new Error(`Unknown assembly: ${n
651
651
  return !!(${e.code});
652
652
  } catch (e) {
653
653
  throw new Error("Error evaluating expression: " + ${JSON.stringify(n)} + ", " + e.message, e);
654
- }`)}catch(t){throw new Error(`Invalid expression: ${n}, ${t.message}`)}}function UM(n,t={}){return LM(n,t)}function R2(n,t){const e={},r=UM(n,e),i=new Map;for(const o of r.globals){if(i.has(o))continue;const a=t(o);if(!a)throw new Error('Unknown variable "'+o+'" in expression: '+n);i.set(o,a),Object.defineProperty(e,o,{enumerable:!0,get(){return a.get()}})}const s=new Set;return r.subscribe=o=>{const a=[];for(const u of i.values())a.push(u.subscribe(o));let l=!0;const c=()=>{l&&(l=!1,s.delete(c),a.forEach(u=>u()))};return s.add(c),c},r.invalidate=()=>{for(const o of s)o();s.clear()},r.identifier=()=>r.code+"|"+Array.from(i.values()).map(o=>o.id).join(","),{expression:r,dependencies:Array.from(i.values())}}class GM{constructor(){v(this,fs,new E5);v(this,er,new I5({lifecycleRegistry:g(this,fs)}));v(this,yt,new b5)}createScope(t){const e=g(this,fs).createOwner("scope",t??"root");return t?g(this,yt).createChildScope(e,t):g(this,yt).createRootScope(e)}disposeScope(t){const e=g(this,yt).getOwnerId(t);g(this,fs).disposeOwner(e),g(this,yt).clearScope(t)}addScopeDisposer(t,e){const r=g(this,yt).getOwnerId(t);g(this,fs).addDisposer(r,e)}registerBase(t,e,r,i){const s=g(this,yt).getOwnerId(t),o=g(this,er).createWritable(s,e,"base",r,i);return g(this,yt).register(t,e,o)}registerSelection(t,e,r,i){const s=g(this,yt).getOwnerId(t),o=g(this,er).createWritable(s,e,"selection",r,i);return g(this,yt).register(t,e,o)}registerDerived(t,e,r){const{expression:i,dependencies:s}=R2(r,l=>this.resolve(t,l)),o=g(this,yt).getOwnerId(t),a=g(this,er).computed(o,e,s,()=>i(null));return g(this,yt).register(t,e,a)}createExpression(t,e){const{expression:r}=R2(e,i=>this.resolve(t,i));return r}resolve(t,e){return g(this,yt).resolve(t,e)}runInTransaction(t){return g(this,er).runInTransaction(t)}flushNow(){g(this,er).flushNow()}whenPropagated(t){return g(this,er).whenPropagated(t)}}fs=new WeakMap,er=new WeakMap,yt=new WeakMap;class zM{constructor(t){v(this,Hl);v(this,Pe);v(this,Nt);v(this,Wt,new Map);v(this,un,new Map);v(this,Zr,new Map);v(this,ea);v(this,zl,!1);Q(this,ea,t??(()=>{}));const e=g(this,ea).call(this);e?(Q(this,Pe,g(e,Pe)),Q(this,Nt,g(this,Pe).createScope(g(e,Nt)))):(Q(this,Pe,new GM),Q(this,Nt,g(this,Pe).createScope()))}registerParam(t){const e=t.name;if(mn(e),g(this,Zr).has(e))throw new Error('Parameter "'+e+'" already registered in this scope.');if("value"in t&&"expr"in t)throw new Error(`The parameter "${e}" must not have both value and expr properties!`);let r,i;if(t.push=="outer"){const s=this.findRuntimeForParam(e);if(!s)throw new Error(`Parameter "${e}" not found in outer scope!`);const o=s.paramConfigs.get(e);if(!o)throw new Error(`Outer parameter "${e}" exists as a value but has no registered config.`);if("expr"in o||"select"in o)throw new Error(`The outer parameter "${e}" must not have expr or select properties!`);r=a=>{s.setValue(e,a)},g(this,Wt).set(e,r)}else if("value"in t)i=nd(t,this),r=F(this,Hl,Sp).call(this,e,i);else if("expr"in t){const s=g(this,Pe).registerDerived(g(this,Nt),e,t.expr);g(this,un).set(e,s),r=()=>{throw new Error('Cannot set derived parameter "'+e+'".')}}else i=nd(t,this),r=F(this,Hl,Sp).call(this,e,i);if("select"in t){if(i??(i=nd(t,this)),!g(this,Wt).has(e)){const s=g(this,Pe).registerSelection(g(this,Nt),e,i);g(this,un).set(e,s),g(this,Wt).set(e,o=>{s.set(o),g(this,Pe).flushNow()}),r=g(this,Wt).get(e)}r(i)}return g(this,Zr).set(e,t),r}allocateSetter(t,e,r=!1){if(mn(t),g(this,Wt).has(t))throw new Error("Setter already allocated for parameter: "+t);const i=g(this,Pe).registerBase(g(this,Nt),t,e,{notify:!r});g(this,un).set(t,i);const s=o=>{i.set(o),g(this,Pe).flushNow()};return g(this,Wt).set(t,s),s}setValue(t,e){mn(t);const r=g(this,Wt).get(t);if(!r)throw new Error("Writable parameter not found in this scope: "+t);r(e)}getValue(t){var e;return(e=g(this,un).get(t))==null?void 0:e.get()}subscribe(t,e){mn(t);const r=this.findRuntimeForParam(t);if(!r)throw new Error("Parameter not found: "+t);const i=g(r,un).get(t);if(!i)throw new Error("Parameter found without local reference: "+t);return i.subscribe(e)}findValue(t){const e=this.findRuntimeForParam(t);return e==null?void 0:e.getValue(t)}get paramConfigs(){return g(this,Zr)}findRuntimeForParam(t){var e;return g(this,un).has(t)?this:(e=g(this,ea).call(this))==null?void 0:e.findRuntimeForParam(t)}createExpression(t){return g(this,Pe).createExpression(g(this,Nt),t)}watchExpression(t,e,r={}){var o;const i=this.createExpression(t),s=i.subscribe(e);return(r.scopeOwned??!0)&&g(this,Pe).addScopeDisposer(g(this,Nt),s),(o=r.registerDisposer)==null||o.call(r,s),i}evaluateAndGet(t){return this.createExpression(t)()}runInTransaction(t){return g(this,Pe).runInTransaction(t)}flushNow(){g(this,Pe).flushNow()}whenPropagated(t){return g(this,Pe).whenPropagated(t)}dispose(){g(this,zl)||(Q(this,zl,!0),g(this,Pe).disposeScope(g(this,Nt)),g(this,Wt).clear(),g(this,un).clear(),g(this,Zr).clear())}hasPointSelections(){for(const t of g(this,Zr).values())if(td(t)){const e=t.select;if(we(e)){if(e=="point")return!0}else if(e.type=="point")return!0}return!1}}Pe=new WeakMap,Nt=new WeakMap,Wt=new WeakMap,un=new WeakMap,Zr=new WeakMap,ea=new WeakMap,zl=new WeakMap,Hl=new WeakSet,Sp=function(t,e){const r=g(this,Pe).registerBase(g(this,Nt),t,e);g(this,un).set(t,r);const i=s=>{r.set(s),g(this,Pe).flushNow()};return g(this,Wt).set(t,i),i};function Zc(n,t){return!t||/^(data:|([A-Za-z]+:)?\/\/)/.test(n)||n.startsWith("/")?n:(t.endsWith("/")||(t+="/"),t+n)}function HM(n){if(!n)return n;if(/[?#]/.test(n))throw new Error(`Invalid base URL: ${n} - cannot contain query or hash.`);return n.endsWith("/")?n:n+"/"}const on="VISIT_SKIP",Tr="VISIT_STOP",M2=n=>n;class N2{constructor(t,e,r,i,s,o={}){v(this,Tt);v(this,ta);v(this,As,{});v(this,na,{});v(this,ra,{});v(this,Vl);v(this,_l);v(this,ia,!1);X(this,"opacityFunction",M2);v(this,sa,[]);v(this,oa,"none");X(this,"facetCoords",new Tn([],JSON.stringify));var a;if(!t)throw new Error("View spec must be defined!");if(this.context=e,this.layoutParent=r,this.dataParent=i,Q(this,ta,s),this.spec=t,this.resolutions={scale:{},axis:{}},My(this),this.options={blockEncodingInheritance:!1,...o},this.flowHandle=void 0,this.needsAxes={x:!1,y:!1},this.paramRuntime=new zM(()=>{var l;return(l=this.dataParent)==null?void 0:l.paramRuntime}),t.params)for(const l of t.params)this.paramRuntime.registerParam(l);if(!((a=this.layoutParent)!=null&&a.options.layeredChildren)){const l=c=>this.paramRuntime.findRuntimeForParam(c)?void 0:this.paramRuntime.allocateSetter(c,0);Q(this,_l,l("height")),Q(this,Vl,l("width"))}}get name(){return this.spec.name??g(this,ta)}get explicitName(){return this.spec.name}get defaultName(){return g(this,ta)}get coords(){return this.facetCoords.values().next().value}getPadding(){return this._cache("size/padding",()=>ct.createFromConfig(this.spec.padding))}getOverhang(){return ct.zero()}isScrollable(){return this.spec.viewportWidth!=null||this.spec.viewportHeight!=null}getSize(){return this._cache("size/size",()=>this.isConfiguredVisible()?new Mr(F(this,Tt,vu).call(this,"width"),F(this,Tt,vu).call(this,"height")):o2)}getViewportSize(){if(!this.isScrollable())return this.getSize();if(!this.isConfiguredVisible())return o2;const t=this.getSize();return new Mr(F(this,Tt,vu).call(this,"viewportWidth")??t.width,F(this,Tt,vu).call(this,"viewportHeight")??t.height)}registerStepSizeInvalidation(){F(this,Tt,Qp).call(this,"width","x"),F(this,Tt,Qp).call(this,"height","y")}isConfiguredVisible(){return this.context.isViewConfiguredVisible(this)}isVisibleInSpec(){return this.spec.visible??!0}isVisible(){return this.getLayoutAncestors().every(t=>t.isConfiguredVisible())}isDomainInert(){if(this.spec.domainInert)return!0;const t=this.dataParent;return t?t.isDomainInert():!1}getDataInitializationState(){return g(this,oa)}_setDataInitializationState(t){Q(this,oa,t)}isDataInitialized(){return g(this,oa)==="ready"}getEffectiveOpacity(){var t;return this.opacityFunction(((t=this.layoutParent)==null?void 0:t.getEffectiveOpacity())??1)}getPathString(){return this.getLayoutAncestors().map(t=>t.name).reverse().join("/")}getLayoutAncestors(){return F(this,Tt,Dp).call(this,"layoutParent")}getDataAncestors(){return F(this,Tt,Dp).call(this,"dataParent")}handleBroadcast(t){for(const e of g(this,As)[t.type]||[])e(t)}_addBroadcastHandler(t,e){let r=g(this,As)[t];return r||(r=[],g(this,As)[t]=r),r.push(e),()=>{const i=g(this,As)[t];if(!i)return;const s=i.indexOf(e);s>=0&&i.splice(s,1)}}handleInteractionEvent(t,e,r){const i=r?g(this,na):g(this,ra);for(const s of i[e.type]||[])s(t,e)}addInteractionEventListener(t,e,r){const i=r?g(this,na):g(this,ra);let s=i[t];s||(s=[],i[t]=s),s.push(e)}removeInteractionEventListener(t,e,r){const i=r?g(this,na):g(this,ra);let s=i==null?void 0:i[t];if(s){const o=s.indexOf(e);o>=0&&s.splice(o,1)}}visit(t){try{const e=t(this);if(t.postOrder&&t.postOrder(this),e!==Tr)return e}catch(e){throw e.view=this,e}}getDescendants(){const t=[];return this.visit(e=>{t.push(e)}),t}dispose(){for(const e of g(this,sa))e();g(this,sa).length=0;const t=this.flowHandle;t!=null&&t.collector&&(this.context.dataFlow.pruneCollectorBranch(t.collector),this.context.dataFlow.removeCollector(t.collector)),t!=null&&t.dataSource&&t.dataSource.view===this&&!t.dataSource.identifier&&this.context.dataFlow.removeDataSource(t.dataSource),this.paramRuntime.dispose(),this.context.dataFlow.loadingStatusRegistry.delete(this),this.flowHandle=void 0}registerDisposer(t){g(this,sa).push(t)}disposeSubtree(){const t=()=>{};t.postOrder=e=>{e.dispose()},this.visit(t)}configureViewOpacity(){(!this.opacityFunction||this.opacityFunction===M2)&&(this.opacityFunction=_M(this))}onBeforeRender(){g(this,ia)||Q(this,ia,!0)}hasRendered(){return g(this,ia)}render(t,e,r={}){var i,s;r.firstFacet&&this.facetCoords.clear(),this.facetCoords.set(r.facetId,r.clipRect?e.intersect(r.clipRect):e),(i=g(this,Vl))==null||i.call(this,e.width),(s=g(this,_l))==null||s.call(this,e.height)}getEncoding(){const t=this.dataParent&&!this.options.blockEncodingInheritance?this.dataParent.getEncoding():{},e=this.spec.encoding||{},r={...t,...e};for(const[i,s]of Object.entries(r))s===null&&delete r[i];return r}getFacetAccessor(t){if(this.layoutParent)return this.layoutParent.getFacetAccessor(this)}getFacetFields(t){var r;const e=this.getEncoding().sample;return Gn(e)?[e.field]:(r=this.layoutParent)==null?void 0:r.getFacetFields(this)}getSampleFacetTexture(){}getScaleResolution(t){const e=wr(t);return this.getDataAncestors().map(r=>r.resolutions.scale[e]).find(r=>r)}getAxisResolution(t){const e=wr(t);return this.getDataAncestors().map(r=>r.resolutions.axis[e]).find(r=>r)}getConfiguredResolution(t,e){var r,i;return(i=(r=this.spec.resolve)==null?void 0:r[e])==null?void 0:i[t]}getConfiguredOrDefaultResolution(t,e){return this.getConfiguredResolution(t,e)??this.getConfiguredResolution("default",e)??this.getDefaultResolution(t,e)}getDefaultResolution(t,e){return"independent"}getBaseUrl(){return Ti(()=>{var t;return(t=this.dataParent)==null?void 0:t.getBaseUrl()},HM(this.spec.baseUrl))}isPickingSupported(){return!0}getTitleText(){const t=this.spec.title;if(t)return we(t)?t:Me(t.text)?this.paramRuntime.evaluateAndGet(t.text.expr):t.text}_cache(t,e){return jf(this,t,e)}_invalidateCacheByPrefix(t,e="self"){switch(e){case"self":Oc(this,t);break;case"ancestors":for(const r of this.getLayoutAncestors())Oc(r,t);break;case"progeny":this.visit(r=>Oc(r,t));break}}invalidateSizeCache(){Oc(this,"size"),this._invalidateCacheByPrefix("size","ancestors")}propagateInteractionEvent(t){}}ta=new WeakMap,As=new WeakMap,na=new WeakMap,ra=new WeakMap,Vl=new WeakMap,_l=new WeakMap,ia=new WeakMap,sa=new WeakMap,oa=new WeakMap,Tt=new WeakSet,vu=function(t){var s;let e=this.spec[t];const r=H0(e),i=t=="viewportWidth"||t=="viewportHeight";if(r){if(i)throw new rt(`Cannot use step-based size with "${t}"!`,this);const o=e.step,a=(s=this.getScaleResolution(t=="width"?"x":"y"))==null?void 0:s.getScale();if(a){let l=0;if(_n(a.type))l=a.domain().length;else if(["locus","index"].includes(a.type)){const u=a.domain();l=tf(u)-u[0]}else throw new rt(`Cannot use step-based size with "${a.type}" scale!`,this);const c=a;return l=f0(l,c.paddingInner(),c.paddingOuter()),{px:l*o,grow:0}}else throw new rt(`Cannot use step-based size with "${t}"!`,this)}else return(e&&a2(e))??(i?void 0:{px:0,grow:1})},Qp=function(t,e){const r=this.spec[t];if(!H0(r))return;const i=this.getScaleResolution(e);if(!i)throw new rt("Cannot use 'step' size without a scale!",this);const s=()=>this.invalidateSizeCache();i.addEventListener("domain",s),this.registerDisposer(()=>i.removeEventListener("domain",s))},Dp=function(t){const e=[];let r=this;do e.push(r),r=r[t];while(r);return e};function VM(n){return"unitsPerPixel"in n}function _M(n){const t="opacity"in n.spec?n.spec.opacity:void 0;if(t!==void 0){if(ot(t))return e=>e*t;if(VM(t)){const e=c=>{const u=n.getScaleResolution(c),f=u==null?void 0:u.getScale();if(["linear","index","locus"].includes(f==null?void 0:f.type))return{scale:f,scaleResolution:u}},r=T2(t.values,"opacity.values",n);if(!Re(t.unitsPerPixel))throw new rt('"opacity.unitsPerPixel" must be an array.',n);let i=()=>1,s=[];const o=()=>{const c=T2(s.map(f=>f()),"opacity.unitsPerPixel",n);YM(c,r,n);const u=r0().domain(c).range(r).clamp(!0);i=f=>u(f)};s=t.unitsPerPixel.map(c=>{if(Me(c)){const u=n.paramRuntime.watchExpression(c.expr,()=>{o(),n.context.animator.requestRender()});return()=>u(null)}else return()=>c}),o();const a=c=>{const f=c.scaleResolution.getAxisLength()||1e3;return Ga(c.scale.domain())/f};let l;if(t.channel==="auto"){const c=e("x"),u=e("y");if(c&&u)l=()=>(a(c)+a(u))/2;else if(c)l=()=>a(c);else if(u)l=()=>a(u);else throw new rt("Cannot find a resolved quantitative x or y scale for dynamic opacity!",n)}else{const c=t.channel?e(t.channel):e("x")??e("y");if(!c)throw new rt("Cannot find a resolved quantitative scale for dynamic opacity!",n);l=()=>a(c)}return c=>i(l())*c}else if(Me(t)){const e=n.paramRuntime.watchExpression(t.expr,()=>n.context.animator.requestRender());return r=>e(null)*r}}return e=>e}function YM(n,t,e){if(!n.length)throw new rt('"opacity.unitsPerPixel" must contain at least one stop.',e);if(n.length!==t.length)throw new rt('"opacity.unitsPerPixel" and "opacity.values" must have the same length.',e);n.forEach((r,i)=>{if(r<=0)throw new rt("Invalid opacity.unitsPerPixel value at index "+i+". Stop values must be positive.",e)});for(let r=1;r<n.length;r++)if(n[r-1]<=n[r])throw new rt('"opacity.unitsPerPixel" must be strictly decreasing.',e)}function T2(n,t,e){if(!Re(n))throw new rt('"'+t+'" must evaluate to an array.',e);return n.map((r,i)=>{if(!ot(r)||!Number.isFinite(r))throw new rt("Invalid "+t+" value at index "+i+". Expected a finite number.",e);return r})}const H0=n=>!!(n!=null&&n.step);function JM(n){return qM(n==null?void 0:n.search,"search")}function qM(n,t){if(!n)return;const e=Array.isArray(n)?n:[n];if(e.length===0)throw new Error("The "+t+" channel array must not be empty.");const r=[];for(const i of e){if(!i||typeof i!="object"||!("field"in i))throw new Error("The "+t+" channel must be a field definition or an array of field definitions.");const s=i.field;if(typeof s!="string")throw new Error("The "+t+" channel field definition must include a string field name.");r.push(s)}return r}const KM={point:KR,rect:HR,rule:ZR,link:s6,text:f6};class Ct extends N2{constructor(e,r,i,s,o,a){super(e,r,i,s,o,a);v(this,KA);v(this,Yl);v(this,Jl,!1);v(this,aa,null);this.spec=e;const l=KM[this.getMarkType()];if(l)this.mark=new l(this);else throw new Error(`No such mark: ${this.getMarkType()}`);this.resolve(),Q(this,Yl,this.paramRuntime.allocateSetter("zoomLevel",1));for(const c of["x","y"]){const u=this.getScaleResolution(c);if(u){const f=()=>{g(this,Yl).call(this,Math.sqrt(this.getZoomLevel()))};u.addEventListener("domain",f),this.registerDisposer(()=>u.removeEventListener("domain",f))}}this.needsAxes={x:!0,y:!0},F(this,KA,SB).call(this)}render(e,r,i={}){super.render(e,r,i),this.isConfiguredVisible()&&(e.pushView(this,r),e.renderMark(this.mark,i),e.popView(this))}getMarkType(){return typeof this.spec.mark=="object"?this.spec.mark.type:this.spec.mark}getEncoding(){const e=super.getEncoding(),r=this.mark.getSupportedChannels();for(const i of Object.keys(e))i!=="key"&&(r.includes(i)||delete e[i]);return e}resolve(e){if(!e){this.resolve("scale"),this.resolve("axis");return}const r=this.mark.encoding;for(const[i,s]of Object.entries(r)){if(!s||Array.isArray(s))continue;let o;if(zt(s))o=s;else if(Kh(s)){const c=s.condition;if(!Array.isArray(c)&&zt(c))o=c;else continue}else continue;const a=wr(o.resolutionChannel??i);if(!sf(a)||e=="axis"&&!dc(a))continue;let l=this;for(;(l.getConfiguredOrDefaultResolution(a,e)=="forced"||l.dataParent&&["shared","excluded","forced"].includes(l.dataParent.getConfiguredOrDefaultResolution(a,e)))&&l.getConfiguredOrDefaultResolution(a,e)!="excluded";)l=l.dataParent;if(e=="axis"&&dc(i)&&jh(a)){l.resolutions[e][a]||(l.resolutions[e][a]=new m5(a));const c=l.resolutions[e][a],u=c.registerMember({view:this,channel:i,channelDef:o});this.registerDisposer(()=>{u()&&l.resolutions[e][a]===c&&delete l.resolutions[e][a]})}else if(e=="scale"&&sf(i)){if(!l.resolutions[e][a]){const h=new p5(a);l.resolutions[e][a]=h;const A=d=>{var p;(p=this.context.glHelper)==null||p.createRangeTexture(d.scaleResolution,!0)};h.addEventListener("range",A),h.addEventListener("domain",A),this.registerDisposer(()=>{h.removeEventListener("range",A),h.removeEventListener("domain",A)})}const c=!this.isDomainInert(),u=l.resolutions[e][a],f=u.registerMember({view:this,channel:i,channelDef:o,contributesToDomain:c});this.registerDisposer(()=>{f()&&l.resolutions[e][a]===u&&(u.dispose(),delete l.resolutions[e][a])})}}}dispose(){super.dispose(),this.mark.dispose()}getDataAccessor(e){var i;const r=this.mark.encoders;if(r)return(i=r[e])==null?void 0:i.dataAccessor}getSearchAccessors(){if(!g(this,aa)){const e=JM(this.getEncoding())??[];Q(this,aa,e.map(r=>ue(r)))}return g(this,aa)}getFacetAccessor(e){const r=this.getDataAccessor("sample");return r||super.getFacetAccessor(this)}getCollector(){var e;return(e=this.flowHandle)==null?void 0:e.collector}registerDomainSubscriptions(){if(g(this,Jl)||this.isDomainInert())return;const e=this.getCollector();if(!e)return;const r=this.mark.encoders;if(!r)throw new Error("Encoders are not initialized!");Q(this,Jl,!0);const i=new Map;for(const s of Object.values(r)){if(!s)continue;const o=s.accessors??[];if(o.length!==0)for(const a of o){if(!m1(a)||a.channelDef.domainInert)continue;const l=this.getScaleResolution(a.scaleChannel);if(!l)throw new Error("Missing scale resolution for channel: "+a.scaleChannel);let c=i.get(l);c||(c=new Set,i.set(l,c)),c.add(a)}}for(const[s,o]of i){if(o.size===0)continue;const a=s.registerCollectorSubscriptions(e,o);this.registerDisposer(a)}}getZoomLevel(){const e=r=>{var i;return((i=this.getScaleResolution(r))==null?void 0:i.getZoomLevel())??1};return Ei.map(e).reduce((r,i)=>r*i,1)}propagateInteractionEvent(e){this.handleInteractionEvent(void 0,e,!0),e.target=this,!e.stopped&&this.handleInteractionEvent(void 0,e,!1)}getDefaultResolution(e,r){return e=="x"?"shared":"independent"}}Yl=new WeakMap,Jl=new WeakMap,aa=new WeakMap,KA=new WeakSet,SB=function(){for(const[e,r]of this.paramRuntime.paramConfigs){if(!("select"in r))continue;const i=of(r.select),s=i.on,o=i.clear;if(af(i)){let l=0;const c=A=>{this.paramRuntime.setValue(e,A)},u=()=>{var d;const A=this.context.getCurrentHover();return((d=A==null?void 0:A.mark)==null?void 0:d.unitView)===this?A.datum:null},f=s.filter?F2(s.filter):()=>!0,h=(A,d)=>{if(!f(d.proxiedMouseEvent))return;const p=u(),C=p?p[Gt]:0;let m;if(i.toggle)if(d.mouseEvent.shiftKey){if(p){const I=this.paramRuntime.getValue(e);m=kQ(I,{toggle:[p]})}}else m=$h(p?[p]:null);else C!=l&&(l=C,m=Zh(p));m!==void 0&&c(m)};if(this.addInteractionEventListener(["mouseover","pointerover"].includes(s.type)?"mousemove":s.type,h),o){const A=o.filter?F2(o.filter):()=>!0,d=(p,C)=>{if(!A(C.proxiedMouseEvent))return;l=0;const m=i.toggle?$h():Zh(null);c(m)};this.addInteractionEventListener(o.type,d)}}}};function jM(n){const t=new Set;n.visit(e=>{for(const r of Object.values(e.resolutions.scale)){const i=r.name;if(i&&t.has(i))throw new Error(`The same scale name "${i}" occurs in multiple scale resolutions!`);t.add(i)}})}function WM(n){for(const t of Ei){const e=n.getScaleResolution(t);e&&!e.name&&e.isZoomable()&&(e.name=`${t}_at_root`)}}function V0(n,t=()=>!0){return Promise.allSettled(n).then(e=>{if(t())for(const r of e)"value"in r?r.value.finalizeGraphicsInitialization():"reason"in r&&console.error(r.reason)})}async function XM(n,t,e){const r=n.import;if(!("url"in r))throw new Error("Not an url import: "+JSON.stringify(r));const i=Ti(t,r.url);let s;try{const o=await fetch(i);if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);s=await o.json()}catch(o){throw new Error(`Could not load imported view spec: ${i}. Reason: ${o.message}`)}if(e.isViewSpec(s))return s.baseUrl=Ti(Hy(r.url),s.baseUrl),s;throw new Error(`The imported spec "${i}" is not a view spec: ${JSON.stringify(n)}`)}function ZM(n){const t=n.getSize(),e=n.getPadding(),r=(i,s)=>i.grow>0?void 0:i.px+s;return{width:r(t.width,e.horizontalTotal),height:r(t.height,e.verticalTotal)}}function*_0(n,t=[]){for(const[e,r]of n.entries())if(r instanceof Map)for(const i of _0(r,[...t,e]))yield i;else yield[[...t,e],r]}const P2=2147483647,$M=L2([P2]);function L2(n){let t=0;for(let e=0,r=n.length;e<r;e++)t=Math.max(t,n[e]);return Math.floor(Math.log2(t)/4)+1}function eN(n){const t=L2(n);let e=Array.from({length:n.length},(s,o)=>o),r=new Array(n.length);const i=new Array(16);for(let s=0;s<t;s++){i.fill(0);const o=s*4,a=Math.pow(16,s),l=c=>{const u=n[e[c]];return s>=$M?u>P2?Math.floor(u/a)%16:0:u>>o&15};for(let c=0;c<n.length;c++)i[l(c)]++;for(let c=1;c<16;c++)i[c]+=i[c-1];for(let c=n.length-1;c>=0;c--)r[--i[l(c)]]=e[c];[e,r]=[r,e]}return e}const oA="|",Y0="\\";class tN{constructor(){v(this,la);v(this,hs,null);v(this,tr,null);v(this,ca,!1)}invalidate(){Q(this,hs,null),Q(this,tr,null),Q(this,ca,!1)}findDatum(t,e,r){if(!t||t.length===0)return;const i=t.join(", ");if(t.length!==e.length)throw new Error(`Key tuple length ${e.length} does not match fields [${i}]`);(!g(this,hs)||!F(this,la,DB).call(this,t))&&F(this,la,QB).call(this,t,r);const s=g(this,tr);let o;if(g(this,ca)){let a="";for(let l=0;l<e.length;l++){l>0&&(a+=oA);const c=s[l],u=aA(e[l],c);a+=O2(u)}o=a}else{const a=s[0];o=aA(e[0],a)}return g(this,hs).get(o)}}hs=new WeakMap,tr=new WeakMap,ca=new WeakMap,la=new WeakSet,QB=function(t,e){const r=t.map(a=>ue(a)),i=new Map,s=t.join(", "),o=t.length!==1;if(o)for(const a of e)for(let l=0,c=a.length;l<c;l++){const u=a[l];let f="";for(let A=0;A<r.length;A++){A>0&&(f+=oA);const d=t[A],p=aA(r[A](u),d);f+=O2(p)}if(i.get(f)!==void 0){const A=r.map(d=>d(u));throw new Error(`Duplicate key detected for fields [${s}]: ${JSON.stringify(A)}`)}i.set(f,u)}else{const a=r[0],l=t[0];for(const c of e)for(let u=0,f=c.length;u<f;u++){const h=c[u],A=aA(a(h),l);if(i.get(A)!==void 0)throw new Error(`Duplicate key detected for fields [${s}]: ${JSON.stringify(A)}`);i.set(A,h)}}Q(this,hs,i),Q(this,tr,[...t]),Q(this,ca,o)},DB=function(t){if(!g(this,tr)||g(this,tr).length!==t.length)return!1;for(let e=0;e<t.length;e++)if(g(this,tr)[e]!==t[e])return!1;return!0};function aA(n,t){if(n===void 0)throw new Error(`Key field "${t}" is undefined. Ensure all key fields are present in the data.`);if(n===null)throw new Error(`Key field "${t}" is null. Ensure all key fields are present in the data.`);if(typeof n!="string"&&typeof n!="number"&&typeof n!="boolean")throw new Error(`Key field "${t}" must be a scalar value (string, number, or boolean).`);return n}function nN(n){if(!(n.indexOf(Y0)!==-1||n.indexOf(oA)!==-1))return n;let e="";for(let r=0;r<n.length;r++){const i=n[r];(i===Y0||i===oA)&&(e+=Y0),e+=i}return e}function O2(n){return typeof n=="string"?nN(n):String(n)}class U2 extends Yh{constructor(e){var r;super();v(this,st);v(this,nr,[]);v(this,ql,ue(Gt));v(this,$r,[]);v(this,ua,new tN);v(this,ds);v(this,fa);v(this,ei,new rN);this.params=e??{type:"collect"},this.observers=new Set,this.facetBatches=new Tn([],JSON.stringify),Q(this,fa,sN((r=this.params)==null?void 0:r.sort)),F(this,st,kp).call(this)}get behavior(){return _h}get label(){return"collect"}reset(){super.reset(),F(this,st,kp).call(this)}handle(e){g(this,nr).push(e)}beginBatch(e){g(this,ua).invalidate(),CQ(e)&&(Q(this,nr,[]),this.facetBatches.set(Ke(e.facetId),g(this,nr)))}complete(){var e;if(Q(this,nr,[]),(e=this.params.groupby)!=null&&e.length){if(this.facetBatches.size>1)throw new Error("TODO: Support faceted data!");const r=this.facetBatches.get(void 0),i=this.params.groupby.map(o=>ue(o)),s=i.length>1?Uu(r,...i):iN(r,i[0]);this.facetBatches.clear();for(const[o,a]of _0(s))this.facetBatches.set(o,a)}if(g(this,fa))for(const r of this.facetBatches.values())r.sort(g(this,fa));F(this,st,kB).call(this),F(this,st,Fp).call(this),super.complete(),F(this,st,Rp).call(this);for(const r of this.observers)r(this)}observe(e){return this.observers.add(e),()=>{this.observers.delete(e)}}repropagate(){for(const e of this.children)e.reset();F(this,st,Fp).call(this);for(const e of this.children)e.complete();F(this,st,Rp).call(this)}getDomain(e,r,i){return g(this,ei).getDomain(e,()=>{const s=Zf(r);if(i.constant)s.extend(i({}));else if(this.completed)for(const o of this.facetBatches.values())for(let a=0,l=o.length;a<l;a++)s.extend(i(o[a]));return s})}subscribeDomainChanges(e,r){return g(this,ei).subscribe(e,r)}getData(){switch(F(this,st,ih).call(this),this.facetBatches.size){case 0:return[];case 1:return[...this.facetBatches.values()][0];default:{const e=this.facetBatches;return{[Symbol.iterator]:function*(){for(const i of e.values())yield*i}}}}}visitData(e){F(this,st,ih).call(this);for(const r of this.facetBatches.values())for(let i=0;i<r.length;i++)e(r[i])}getItemCount(){let e=0;for(const r of this.facetBatches.values())e+=r.length;return e}findDatumByUniqueId(e){if(!g(this,$r).length)return;const r=mi(l=>l.start).right,i=g(this,ql),s=mi(l=>i(o(l))).left,o=l=>{const c=r(g(this,ds),l),u=g(this,ds)[c-1];return!u||l>=u.stop?void 0:this.facetBatches.get(u.facetId)[l-u.start]},a=s(g(this,$r),e);if(a>=0){const l=o(g(this,$r)[a]);if(l&&i(l)===e)return l}}findDatumByKey(e,r){return F(this,st,ih).call(this),g(this,ua).findDatum(e,r,this.facetBatches.values())}}nr=new WeakMap,ql=new WeakMap,$r=new WeakMap,ua=new WeakMap,ds=new WeakMap,fa=new WeakMap,ei=new WeakMap,st=new WeakSet,kp=function(){Q(this,nr,[]),Q(this,$r,[]),g(this,ua).invalidate(),this.facetBatches.clear(),this.facetBatches.set(void 0,g(this,nr))},Fp=function(){if(this.children.length)for(const[e,r]of this.facetBatches.entries()){if(e){const i={type:"facet",facetId:e};for(const s of this.children)s.beginBatch(i)}for(let i=0,s=r.length;i<s;i++)this._propagate(r[i])}},ih=function(){if(!this.completed)throw new Error("Data propagation is not completed! No data are available.")},Rp=function(){g(this,ei).hasCachedDomains()&&g(this,ei).clear(),g(this,ei).notify()},kB=function(){var o;Q(this,ds,[]);const e=(o=this.facetBatches.values().next().value)==null?void 0:o[0];if(e==null||!(Gt in e))return;let r=0;const i=[],s=g(this,ql);for(const[a,l]of this.facetBatches){g(this,ds).push({start:r,stop:r+l.length,facetId:a}),r+=l.length;for(let c=0,u=l.length;c<u;c++)i.push(s(l[c]))}Q(this,$r,eN(i))};class rN{constructor(){v(this,gs,new Map);v(this,rr,new Map)}hasCachedDomains(){return g(this,gs).size>0}clear(){g(this,gs).clear()}getDomain(t,e){const r=g(this,gs).get(t);if(r)return r;{const i=e();return g(this,gs).set(t,i),i}}subscribe(t,e){let r=g(this,rr).get(t);return r||(r=new Set,g(this,rr).set(t,r)),r.add(e),()=>{const i=g(this,rr).get(t);i&&(i.delete(e),i.size===0&&g(this,rr).delete(t))}}notify(){if(g(this,rr).size===0)return;const t=new Set;for(const e of g(this,rr).values())for(const r of e)t.add(r);for(const e of t)e()}}gs=new WeakMap,rr=new WeakMap;function iN(n,t){const e=new Map;for(let r=0,i=n.length;r<i;r++){const s=n[r],o=t(s);let a=e.get(o);a||(a=[],e.set(o,a)),a.push(s)}return e}function sN(n){if(n!=null&&n.field){const t=Ke(n.field);if(t.length==1&&!t[0].includes(".")){const e=Ke(n.order)[0]??"ascending",r=JSON.stringify(t[0]);return new Function("a","b",`return a[${r}] ${e==="ascending"?"-":"+"} b[${r}];`)}return Wp(n.field,n.order)}}class oN extends ze{get behavior(){return pn}constructor(t){super(t),this.params=t,this.startAccessor=ue(t.start),this.endAccessor=ue(t.end),this.chromAccessor=t.chrom?ue(t.chrom):e=>{},this.weightAccessor=t.weight?ue(t.weight):e=>1,this.as={coverage:t.as??"coverage",start:t.asStart??t.start,end:t.asEnd??t.end,chrom:t.asChrom??t.chrom},this.createSegment=new Function("start","end","coverage","chrom","return {"+Object.entries(this.as).filter(([e,r])=>r).map(([e,r])=>`${JSON.stringify(r)}: ${e}`).join(", ")+"};"),this.ends=new go}reset(){super.reset(),this.initialize()}initialize(){const t=this.as.coverage,e=this.as.end,r=this.as.chrom,i=this.startAccessor,s=this.endAccessor,o=this.chromAccessor,a=this.weightAccessor;let l,c,u,f=0,h=NaN;const A=this.ends;A.clear();const d=m=>{this._propagate(m),l=null},p=(m,y,I)=>{if(m==y)return;let w=!1;l&&(l[t]===I?(l[e]=y,w=!0):l[t]!=0&&d(l)),w||(l=this.createSegment(m,y,I,u))},C=()=>{let m=0;for(;(m=A.peekValue())!==void 0;)p(h,m,f),h=m,f-=A.pop();h=NaN,l&&d(l)};this.handle=m=>{const y=i(m);let I=0;for(;(I=A.peekValue())!==void 0&&I<y;)p(h,I,f),h=I,f-=A.pop();if(r){let x=o(m);x!==c&&(C(),u=x,c=u)}isNaN(h)||p(h,y,f),h=y;const w=a(m);f+=w,A.push(w,s(m))},this.complete=()=>{C(),super.complete()},this.beginBatch=m=>{C(),c=null,super.beginBatch(m)}}}function aN(n,t,e=s=>+s,r=0,i=n.length){const s=new go,o=i-r;let a;for(a=0;a<t&&a<o;a++)s.push(a,e(n[r+a]));for(;a<o;a++){const u=e(n[r+a]);u>=s.peekValue()&&(s.push(a,u),s.pop())}const l=[];let c;for(;(c=s.pop())!==void 0;)l.push(n[r+c]);return l.reverse()}class cN{constructor(t,e=-1/0,r=1/0){this.maxSize=t,this.lowerLimit=e,this.upperLimit=r;const i=this.maxSize*2+1;this.lowerLimits=new Float64Array(i),this.upperLimits=new Float64Array(i),this.lowerChildren=new Int32Array(i),this.upperChildren=new Int32Array(i),this.reset()}reset(){this.lowerLimits.fill(0),this.upperLimits.fill(0),this.lowerChildren.fill(0),this.upperChildren.fill(0),this.n=1,this.lowerLimits[0]=this.lowerLimit,this.upperLimits[0]=this.upperLimit}_findSlot(t,e,r=0){if(t>=this.lowerLimits[r]&&e<=this.upperLimits[r]){const i=this.lowerChildren[r];if(i){const s=this._findSlot(t,e,i);return s>=0?s:this._findSlot(t,e,this.upperChildren[r])}else return r}else return-1}reserve(t,e){if(e-t<=0)throw new Error("Cannot reserve an empty or negative-size slot!");if(this.n+1>this.lowerLimits.length)return!1;const r=this._findSlot(t,e);if(r<0)return!1;const i=this.n++,s=this.n++;return this.lowerLimits[i]=this.lowerLimits[r],this.upperLimits[i]=t,this.lowerLimits[s]=e,this.upperLimits[s]=this.upperLimits[r],this.lowerChildren[r]=i,this.upperChildren[r]=s,!0}}class lN extends ze{get behavior(){return _h}constructor(t,e){if(super(t),this.params=t,this._data=[],this.channel=t.channel??"x",!["x","y"].includes(this.channel))throw new Error("Invalid channel: "+this.channel);this.startPosAccessor=ue(this.params.pos),this.endPosAccessor=ue(this.params.pos2??this.params.pos),this.startPosBisector=mi(this.startPosAccessor),this.endPosBisector=mi(this.endPosAccessor),this.scoreAccessor=ue(this.params.score),this.widthAccessor=ue(this.params.width),this.laneAccessor=this.params.lane?ue(this.params.lane):o=>0,this.padding=this.params.padding??0,this.reservationMaps=new Map,this.resolution=e.getScaleResolution(this.channel);const r=()=>this._filterAndPropagate();this.schedule=()=>e.context.animator.requestTransition(r);const i=()=>this.schedule();this.resolution.addEventListener("domain",i),this.registerDisposer(()=>this.resolution.removeEventListener("domain",i));const s=e._addBroadcastHandler("layoutComputed",()=>this.schedule());this.registerDisposer(s)}complete(){const t=this.startPosAccessor;this._data.sort((e,r)=>t(e)-t(r));for(const e of new Set(this._data.map(this.laneAccessor)))this.reservationMaps.set(e,new cN(200));this.schedule(),super.complete()}_filterAndPropagate(){super.reset();const t=this.resolution.getScale(),e=this.resolution.getAxisLength();if(!e)return;for(const o of this.reservationMaps.values())o.reset();const r=t.domain(),s=aN(this._data,70,this.scoreAccessor,this.endPosBisector.left(this._data,r[0]),this.startPosBisector.right(this._data,r[1]));for(const o of s){let a=t(this.startPosAccessor(o))*e,l=t(this.endPosAccessor(o))*e;const c=l-a,u=this.widthAccessor(o)+this.padding*2;let f=(a+l)/2;const h=Math.max(0,(c-u)/2);if(h>0){const A=Math.max(0,u/2-f);f+=Math.min(A,h);const d=Math.max(0,u/2+f-e);f-=Math.min(d,h)}if(this.reservationMaps.get(this.laneAccessor(o)).reserve(f-u/2,f+u/2))if(this.params.asMidpoint){const A=Object.assign({},o);A[this.params.asMidpoint]=t.invert(f/e),this._propagate(A)}else this._propagate(o)}super.complete()}reset(){super.reset(),this._data=[],this.groups=new Map}handle(t){this._data.push(t)}}class uN extends ze{constructor(t,e){super(t,e),this.params=t,this.predicate=void 0}initialize(){let t="";if(fN(this.params))t=this.params.expr;else if(AN(this.params)){const e=this.paramRuntime.findValue(this.params.param);if(!e)throw new Error(`Cannot initialize filter transform. Selection parameter "${this.params.param}" not found!`);t=FQ(this.params,e)}else throw new Error("Invalid filter params: "+JSON.stringify(this.params));this.predicate=this.paramRuntime.watchExpression(t,()=>this.repropagate(),{scopeOwned:!1,registerDisposer:e=>this.registerDisposer(e)})}handle(t){this.predicate(t)&&this._propagate(t)}}function fN(n){return"expr"in n}function AN(n){return"param"in n}class hN extends ze{get behavior(){return pn}constructor(t){super(t),this.params=t;const e=t.index;if(t.fields){const r=Ke(t.fields).map(s=>ue(s)),i=Ke(t.as||t.fields);if(r.length!==i.length)throw new Error(`Lengths of "fields" (${r.length}), and "as" (${i.length}) do not match!`);this.handle=s=>{const o=r.map((l,c)=>l(s)??[]),a=o[0].length;for(let l=0;l<a;l++){const c=Object.assign({},s);for(let u=0;u<r.length;u++)c[i[u]]=l<o[u].length?o[u][l]:null;e&&(c[e]=l),this._propagate(c)}}}else this.handle=r=>{for(let i=0;i<r.length;i++){const s=Object.assign({},r[i]);e&&(s[e]=i),this._propagate(s)}}}}const dN=48;function*gN(n,t=","){const e=t.charCodeAt(0);let r=0;for(let i=0;i<n.length;i++){const s=n.charCodeAt(i);s==e?(yield r,r=0):r=r*10+s-dN}yield r}class pN extends ze{get behavior(){return pn}constructor(t){super(t);const e=ue(t.exons??"exons"),r=ue(t.start??"start"),[i,s]=t.as||["exonStart","exonEnd"];this.handle=o=>{let a=r(o),l=a,c=!0;const u=e(o);for(const f of gN(u)){if(c)l=a+f;else{a=l+f;const h=Object.assign({},o);h[i]=l,h[s]=a,this._propagate(h)}c=!c}}}}class mN extends ze{get behavior(){return pn}constructor(t){super(t);const e=Ke(t.field).map(s=>ue(s)),r=Ke(t.separator),i=Ke(t.as||t.field);if(e.length!==r.length||e.length!==i.length)throw new Error(`Lengths of "separator" (${r.length}), "fields" (${e.length}), and "as" (${i.length}) do not match!`);this.handle=s=>{if(e.some(l=>!l(s)))return;const o=e.map((l,c)=>l(s).split(r[c]));CN(o,s);const a=o[0].length;for(let l=0;l<a;l++){const c=Object.assign({},s);for(let u=0;u<e.length;u++)c[i[u]]=o[u][l];this._propagate(c)}}}}function CN(n,t){const e=n.map(r=>r.length);if(!e.every(r=>r==e[0]))throw new Error("Mismatching number of elements in the fields to be split: "+JSON.stringify(t))}class wN extends ze{get behavior(){return Cr}constructor(t,e){super(t,e),this.params=t,this.as=t.as,this.fn=void 0}initialize(){this.fn=this.paramRuntime.watchExpression(this.params.expr,()=>this.repropagate(),{scopeOwned:!1,registerDisposer:t=>this.registerDisposer(t)})}handle(t){t[this.as]=this.fn(t),this._propagate(t)}}class G2 extends ze{get behavior(){return Cr}constructor(t,e){t={channel:"x",...t},super(t),this.params=t;const r=t.channel;if(!["x","y"].includes(r))throw new Error("Invalid channel: "+r);const i=e.getScaleResolution(r).getScale(),s="genome"in i?i.genome():void 0;if(!s)throw new Error("LinearizeGenomicCoordinate transform requires a locus scale!");const o=ue(t.chrom),a=Ke(t.pos).map(p=>ue(p)),l=Ke(t.as);if(a.length!=l.length)throw new Error('The number of "pos" and "as" elements must be equal!');const c=Ke(t.offset);let u;if(c.length==0)u=new Array(a.length).fill(0);else if(c.length==1)u=new Array(a.length).fill(c[0]);else if(c.length==a.length)u=c;else throw new Error(`Invalid "offset" parameter: ${JSON.stringify(t.offset)}!`);const f=new Function("datum","chromOffset","posAccessors",l.map((p,C)=>`datum[${JSON.stringify(p)}] = chromOffset + +posAccessors[${C}](datum) - ${u[C]};`).join(`
654
+ }`)}catch(t){throw new Error(`Invalid expression: ${n}, ${t.message}`)}}function UM(n,t={}){return LM(n,t)}function R2(n,t){const e={},r=UM(n,e),i=new Map;for(const o of r.globals){if(i.has(o))continue;const a=t(o);if(!a)throw new Error('Unknown variable "'+o+'" in expression: '+n);i.set(o,a),Object.defineProperty(e,o,{enumerable:!0,get(){return a.get()}})}const s=new Set;return r.subscribe=o=>{const a=[];for(const u of i.values())a.push(u.subscribe(o));let l=!0;const c=()=>{l&&(l=!1,s.delete(c),a.forEach(u=>u()))};return s.add(c),c},r.invalidate=()=>{for(const o of s)o();s.clear()},r.identifier=()=>r.code+"|"+Array.from(i.values()).map(o=>o.id).join(","),{expression:r,dependencies:Array.from(i.values())}}class GM{constructor(){v(this,fs,new E5);v(this,er,new I5({lifecycleRegistry:g(this,fs)}));v(this,yt,new b5)}createScope(t){const e=g(this,fs).createOwner("scope",t??"root");return t?g(this,yt).createChildScope(e,t):g(this,yt).createRootScope(e)}disposeScope(t){const e=g(this,yt).getOwnerId(t);g(this,fs).disposeOwner(e),g(this,yt).clearScope(t)}addScopeDisposer(t,e){const r=g(this,yt).getOwnerId(t);g(this,fs).addDisposer(r,e)}registerBase(t,e,r,i){const s=g(this,yt).getOwnerId(t),o=g(this,er).createWritable(s,e,"base",r,i);return g(this,yt).register(t,e,o)}registerSelection(t,e,r,i){const s=g(this,yt).getOwnerId(t),o=g(this,er).createWritable(s,e,"selection",r,i);return g(this,yt).register(t,e,o)}registerDerived(t,e,r){const{expression:i,dependencies:s}=R2(r,l=>this.resolve(t,l)),o=g(this,yt).getOwnerId(t),a=g(this,er).computed(o,e,s,()=>i(null));return g(this,yt).register(t,e,a)}createExpression(t,e){const{expression:r}=R2(e,i=>this.resolve(t,i));return r}resolve(t,e){return g(this,yt).resolve(t,e)}runInTransaction(t){return g(this,er).runInTransaction(t)}flushNow(){g(this,er).flushNow()}whenPropagated(t){return g(this,er).whenPropagated(t)}}fs=new WeakMap,er=new WeakMap,yt=new WeakMap;class zM{constructor(t){v(this,Hl);v(this,Pe);v(this,Nt);v(this,Wt,new Map);v(this,un,new Map);v(this,Zr,new Map);v(this,ea);v(this,zl,!1);Q(this,ea,t??(()=>{}));const e=g(this,ea).call(this);e?(Q(this,Pe,g(e,Pe)),Q(this,Nt,g(this,Pe).createScope(g(e,Nt)))):(Q(this,Pe,new GM),Q(this,Nt,g(this,Pe).createScope()))}registerParam(t){const e=t.name;if(mn(e),g(this,Zr).has(e))throw new Error('Parameter "'+e+'" already registered in this scope.');if("value"in t&&"expr"in t)throw new Error(`The parameter "${e}" must not have both value and expr properties!`);let r,i;if(t.push=="outer"){const s=this.findRuntimeForParam(e);if(!s)throw new Error(`Parameter "${e}" not found in outer scope!`);const o=s.paramConfigs.get(e);if(!o)throw new Error(`Outer parameter "${e}" exists as a value but has no registered config.`);if("expr"in o||"select"in o)throw new Error(`The outer parameter "${e}" must not have expr or select properties!`);r=a=>{s.setValue(e,a)},g(this,Wt).set(e,r)}else if("value"in t)i=nd(t,this),r=F(this,Hl,Sp).call(this,e,i);else if("expr"in t){const s=g(this,Pe).registerDerived(g(this,Nt),e,t.expr);g(this,un).set(e,s),r=()=>{throw new Error('Cannot set derived parameter "'+e+'".')}}else i=nd(t,this),r=F(this,Hl,Sp).call(this,e,i);if("select"in t){if(i??(i=nd(t,this)),!g(this,Wt).has(e)){const s=g(this,Pe).registerSelection(g(this,Nt),e,i);g(this,un).set(e,s),g(this,Wt).set(e,o=>{s.set(o),g(this,Pe).flushNow()}),r=g(this,Wt).get(e)}r(i)}return g(this,Zr).set(e,t),r}allocateSetter(t,e,r=!1){if(mn(t),g(this,Wt).has(t))throw new Error("Setter already allocated for parameter: "+t);const i=g(this,Pe).registerBase(g(this,Nt),t,e,{notify:!r});g(this,un).set(t,i);const s=o=>{i.set(o),g(this,Pe).flushNow()};return g(this,Wt).set(t,s),s}setValue(t,e){mn(t);const r=g(this,Wt).get(t);if(!r)throw new Error("Writable parameter not found in this scope: "+t);r(e)}getValue(t){var e;return(e=g(this,un).get(t))==null?void 0:e.get()}subscribe(t,e){mn(t);const r=this.findRuntimeForParam(t);if(!r)throw new Error("Parameter not found: "+t);const i=g(r,un).get(t);if(!i)throw new Error("Parameter found without local reference: "+t);return i.subscribe(e)}findValue(t){const e=this.findRuntimeForParam(t);return e==null?void 0:e.getValue(t)}get paramConfigs(){return g(this,Zr)}findRuntimeForParam(t){var e;return g(this,un).has(t)?this:(e=g(this,ea).call(this))==null?void 0:e.findRuntimeForParam(t)}createExpression(t){return g(this,Pe).createExpression(g(this,Nt),t)}watchExpression(t,e,r={}){var o;const i=this.createExpression(t),s=i.subscribe(e);return(r.scopeOwned??!0)&&g(this,Pe).addScopeDisposer(g(this,Nt),s),(o=r.registerDisposer)==null||o.call(r,s),i}evaluateAndGet(t){return this.createExpression(t)()}runInTransaction(t){return g(this,Pe).runInTransaction(t)}flushNow(){g(this,Pe).flushNow()}whenPropagated(t){return g(this,Pe).whenPropagated(t)}dispose(){g(this,zl)||(Q(this,zl,!0),g(this,Pe).disposeScope(g(this,Nt)),g(this,Wt).clear(),g(this,un).clear(),g(this,Zr).clear())}hasPointSelections(){for(const t of g(this,Zr).values())if(td(t)){const e=t.select;if(we(e)){if(e=="point")return!0}else if(e.type=="point")return!0}return!1}}Pe=new WeakMap,Nt=new WeakMap,Wt=new WeakMap,un=new WeakMap,Zr=new WeakMap,ea=new WeakMap,zl=new WeakMap,Hl=new WeakSet,Sp=function(t,e){const r=g(this,Pe).registerBase(g(this,Nt),t,e);g(this,un).set(t,r);const i=s=>{r.set(s),g(this,Pe).flushNow()};return g(this,Wt).set(t,i),i};function Zc(n,t){return!t||/^(data:|([A-Za-z]+:)?\/\/)/.test(n)||n.startsWith("/")?n:(t.endsWith("/")||(t+="/"),t+n)}function HM(n){if(!n)return n;if(/[?#]/.test(n))throw new Error(`Invalid base URL: ${n} - cannot contain query or hash.`);return n.endsWith("/")?n:n+"/"}const on="VISIT_SKIP",Tr="VISIT_STOP",M2=n=>n;class N2{constructor(t,e,r,i,s,o={}){v(this,Tt);v(this,ta);v(this,As,{});v(this,na,{});v(this,ra,{});v(this,Vl);v(this,_l);v(this,ia,!1);X(this,"opacityFunction",M2);v(this,sa,[]);v(this,oa,"none");X(this,"facetCoords",new Tn([],JSON.stringify));var a;if(!t)throw new Error("View spec must be defined!");if(this.context=e,this.layoutParent=r,this.dataParent=i,Q(this,ta,s),this.spec=t,this.resolutions={scale:{},axis:{}},My(this),this.options={blockEncodingInheritance:!1,...o},this.flowHandle=void 0,this.needsAxes={x:!1,y:!1},this.paramRuntime=new zM(()=>{var l;return(l=this.dataParent)==null?void 0:l.paramRuntime}),t.params)for(const l of t.params)this.paramRuntime.registerParam(l);if(!((a=this.layoutParent)!=null&&a.options.layeredChildren)){const l=c=>this.paramRuntime.findRuntimeForParam(c)?void 0:this.paramRuntime.allocateSetter(c,0);Q(this,_l,l("height")),Q(this,Vl,l("width"))}}get name(){return this.spec.name??g(this,ta)}get explicitName(){return this.spec.name}get defaultName(){return g(this,ta)}get coords(){return this.facetCoords.values().next().value}getPadding(){return this._cache("size/padding",()=>ct.createFromConfig(this.spec.padding))}getOverhang(){return ct.zero()}isScrollable(){return this.spec.viewportWidth!=null||this.spec.viewportHeight!=null}getSize(){return this._cache("size/size",()=>this.isConfiguredVisible()?new Mr(F(this,Tt,vu).call(this,"width"),F(this,Tt,vu).call(this,"height")):o2)}getViewportSize(){if(!this.isScrollable())return this.getSize();if(!this.isConfiguredVisible())return o2;const t=this.getSize();return new Mr(F(this,Tt,vu).call(this,"viewportWidth")??t.width,F(this,Tt,vu).call(this,"viewportHeight")??t.height)}registerStepSizeInvalidation(){F(this,Tt,Qp).call(this,"width","x"),F(this,Tt,Qp).call(this,"height","y")}isConfiguredVisible(){return this.context.isViewConfiguredVisible(this)}isVisibleInSpec(){return this.spec.visible??!0}isVisible(){return this.getLayoutAncestors().every(t=>t.isConfiguredVisible())}isDomainInert(){if(this.spec.domainInert)return!0;const t=this.dataParent;return t?t.isDomainInert():!1}getDataInitializationState(){return g(this,oa)}_setDataInitializationState(t){Q(this,oa,t)}isDataInitialized(){return g(this,oa)==="ready"}getEffectiveOpacity(){var t;return this.opacityFunction(((t=this.layoutParent)==null?void 0:t.getEffectiveOpacity())??1)}getPathString(){return this.getLayoutAncestors().map(t=>t.name).reverse().join("/")}getLayoutAncestors(){return F(this,Tt,Dp).call(this,"layoutParent")}getDataAncestors(){return F(this,Tt,Dp).call(this,"dataParent")}handleBroadcast(t){for(const e of g(this,As)[t.type]||[])e(t)}_addBroadcastHandler(t,e){let r=g(this,As)[t];return r||(r=[],g(this,As)[t]=r),r.push(e),()=>{const i=g(this,As)[t];if(!i)return;const s=i.indexOf(e);s>=0&&i.splice(s,1)}}handleInteractionEvent(t,e,r){const i=r?g(this,na):g(this,ra);for(const s of i[e.type]||[])s(t,e)}addInteractionEventListener(t,e,r){const i=r?g(this,na):g(this,ra);let s=i[t];s||(s=[],i[t]=s),s.push(e)}removeInteractionEventListener(t,e,r){const i=r?g(this,na):g(this,ra);let s=i==null?void 0:i[t];if(s){const o=s.indexOf(e);o>=0&&s.splice(o,1)}}visit(t){try{const e=t(this);if(t.postOrder&&t.postOrder(this),e!==Tr)return e}catch(e){throw e.view=this,e}}getDescendants(){const t=[];return this.visit(e=>{t.push(e)}),t}dispose(){for(const e of g(this,sa))e();g(this,sa).length=0;const t=this.flowHandle;t!=null&&t.collector&&(this.context.dataFlow.pruneCollectorBranch(t.collector),this.context.dataFlow.removeCollector(t.collector)),t!=null&&t.dataSource&&t.dataSource.view===this&&!t.dataSource.identifier&&this.context.dataFlow.removeDataSource(t.dataSource),this.paramRuntime.dispose(),this.context.dataFlow.loadingStatusRegistry.delete(this),this.flowHandle=void 0}registerDisposer(t){g(this,sa).push(t)}disposeSubtree(){const t=()=>{};t.postOrder=e=>{e.dispose()},this.visit(t)}configureViewOpacity(){(!this.opacityFunction||this.opacityFunction===M2)&&(this.opacityFunction=_M(this))}onBeforeRender(){g(this,ia)||Q(this,ia,!0)}hasRendered(){return g(this,ia)}render(t,e,r={}){var i,s;r.firstFacet&&this.facetCoords.clear(),this.facetCoords.set(r.facetId,r.clipRect?e.intersect(r.clipRect):e),(i=g(this,Vl))==null||i.call(this,e.width),(s=g(this,_l))==null||s.call(this,e.height)}getEncoding(){const t=this.dataParent&&!this.options.blockEncodingInheritance?this.dataParent.getEncoding():{},e=this.spec.encoding||{},r={...t,...e};for(const[i,s]of Object.entries(r))s===null&&delete r[i];return r}getFacetAccessor(t){if(this.layoutParent)return this.layoutParent.getFacetAccessor(this)}getFacetFields(t){var r;const e=this.getEncoding().sample;return Gn(e)?[e.field]:(r=this.layoutParent)==null?void 0:r.getFacetFields(this)}getSampleFacetTexture(){}getScaleResolution(t){const e=wr(t);return this.getDataAncestors().map(r=>r.resolutions.scale[e]).find(r=>r)}getAxisResolution(t){const e=wr(t);return this.getDataAncestors().map(r=>r.resolutions.axis[e]).find(r=>r)}getConfiguredResolution(t,e){var r,i;return(i=(r=this.spec.resolve)==null?void 0:r[e])==null?void 0:i[t]}getConfiguredOrDefaultResolution(t,e){return this.getConfiguredResolution(t,e)??this.getConfiguredResolution("default",e)??this.getDefaultResolution(t,e)}getDefaultResolution(t,e){return"independent"}getBaseUrl(){return Ti(()=>{var t;return(t=this.dataParent)==null?void 0:t.getBaseUrl()},HM(this.spec.baseUrl))}isPickingSupported(){return!0}getTitleText(){const t=this.spec.title;if(t)return we(t)?t:Me(t.text)?this.paramRuntime.evaluateAndGet(t.text.expr):t.text}_cache(t,e){return jf(this,t,e)}_invalidateCacheByPrefix(t,e="self"){switch(e){case"self":Oc(this,t);break;case"ancestors":for(const r of this.getLayoutAncestors())Oc(r,t);break;case"progeny":this.visit(r=>Oc(r,t));break}}invalidateSizeCache(){Oc(this,"size"),this._invalidateCacheByPrefix("size","ancestors")}propagateInteractionEvent(t){}}ta=new WeakMap,As=new WeakMap,na=new WeakMap,ra=new WeakMap,Vl=new WeakMap,_l=new WeakMap,ia=new WeakMap,sa=new WeakMap,oa=new WeakMap,Tt=new WeakSet,vu=function(t){var s;let e=this.spec[t];const r=H0(e),i=t=="viewportWidth"||t=="viewportHeight";if(r){if(i)throw new rt(`Cannot use step-based size with "${t}"!`,this);const o=e.step,a=(s=this.getScaleResolution(t=="width"?"x":"y"))==null?void 0:s.getScale();if(a){let l=0;if(_n(a.type))l=a.domain().length;else if(["locus","index"].includes(a.type)){const u=a.domain();l=tf(u)-u[0]}else throw new rt(`Cannot use step-based size with "${a.type}" scale!`,this);const c=a;return l=f0(l,c.paddingInner(),c.paddingOuter()),{px:l*o,grow:0}}else throw new rt(`Cannot use step-based size with "${t}"!`,this)}else return(e&&a2(e))??(i?void 0:{px:0,grow:1})},Qp=function(t,e){const r=this.spec[t];if(!H0(r))return;const i=this.getScaleResolution(e);if(!i)throw new rt("Cannot use 'step' size without a scale!",this);const s=()=>this.invalidateSizeCache();i.addEventListener("domain",s),this.registerDisposer(()=>i.removeEventListener("domain",s))},Dp=function(t){const e=[];let r=this;do e.push(r),r=r[t];while(r);return e};function VM(n){return"unitsPerPixel"in n}function _M(n){const t="opacity"in n.spec?n.spec.opacity:void 0;if(t!==void 0){if(ot(t))return e=>e*t;if(VM(t)){const e=c=>{const u=n.getScaleResolution(c),f=u==null?void 0:u.getScale();if(["linear","index","locus"].includes(f==null?void 0:f.type))return{scale:f,scaleResolution:u}},r=T2(t.values,"opacity.values",n);if(!Re(t.unitsPerPixel))throw new rt('"opacity.unitsPerPixel" must be an array.',n);let i=()=>1,s=[];const o=()=>{const c=T2(s.map(h=>h()),"opacity.unitsPerPixel",n),u=YM(c,r,n),f=r0().domain(u.unitsPerPixel).range(u.values).clamp(!0);i=h=>f(h)};s=t.unitsPerPixel.map(c=>{if(Me(c)){const u=n.paramRuntime.watchExpression(c.expr,()=>{o(),n.context.animator.requestRender()});return()=>u(null)}else return()=>c}),o();const a=c=>{const f=c.scaleResolution.getAxisLength()||1e3;return Ga(c.scale.domain())/f};let l;if(t.channel==="auto"){const c=e("x"),u=e("y");if(c&&u)l=()=>(a(c)+a(u))/2;else if(c)l=()=>a(c);else if(u)l=()=>a(u);else throw new rt("Cannot find a resolved quantitative x or y scale for dynamic opacity!",n)}else{const c=t.channel?e(t.channel):e("x")??e("y");if(!c)throw new rt("Cannot find a resolved quantitative scale for dynamic opacity!",n);l=()=>a(c)}return c=>i(l())*c}else if(Me(t)){const e=n.paramRuntime.watchExpression(t.expr,()=>n.context.animator.requestRender());return r=>e(null)*r}}return e=>e}function YM(n,t,e){if(!n.length)throw new rt('"opacity.unitsPerPixel" must contain at least one stop.',e);if(n.length!==t.length)throw new rt('"opacity.unitsPerPixel" and "opacity.values" must have the same length.',e);n.forEach((o,a)=>{if(o<=0)throw new rt("Invalid opacity.unitsPerPixel value at index "+a+". Stop values must be positive.",e)});const r=n.map((o,a)=>({stop:o,value:t[a]}));r.sort((o,a)=>a.stop-o.stop);const i=r.map(o=>o.stop),s=r.map(o=>o.value);for(let o=1;o<n.length;o++)if(i[o-1]<=i[o])throw new rt('"opacity.unitsPerPixel" must be strictly decreasing.',e);return{unitsPerPixel:i,values:s}}function T2(n,t,e){if(!Re(n))throw new rt('"'+t+'" must evaluate to an array.',e);return n.map((r,i)=>{if(!ot(r)||!Number.isFinite(r))throw new rt("Invalid "+t+" value at index "+i+". Expected a finite number.",e);return r})}const H0=n=>!!(n!=null&&n.step);function JM(n){return qM(n==null?void 0:n.search,"search")}function qM(n,t){if(!n)return;const e=Array.isArray(n)?n:[n];if(e.length===0)throw new Error("The "+t+" channel array must not be empty.");const r=[];for(const i of e){if(!i||typeof i!="object"||!("field"in i))throw new Error("The "+t+" channel must be a field definition or an array of field definitions.");const s=i.field;if(typeof s!="string")throw new Error("The "+t+" channel field definition must include a string field name.");r.push(s)}return r}const KM={point:KR,rect:HR,rule:ZR,link:s6,text:f6};class Ct extends N2{constructor(e,r,i,s,o,a){super(e,r,i,s,o,a);v(this,KA);v(this,Yl);v(this,Jl,!1);v(this,aa,null);this.spec=e;const l=KM[this.getMarkType()];if(l)this.mark=new l(this);else throw new Error(`No such mark: ${this.getMarkType()}`);this.resolve(),Q(this,Yl,this.paramRuntime.allocateSetter("zoomLevel",1));for(const c of["x","y"]){const u=this.getScaleResolution(c);if(u){const f=()=>{g(this,Yl).call(this,Math.sqrt(this.getZoomLevel()))};u.addEventListener("domain",f),this.registerDisposer(()=>u.removeEventListener("domain",f))}}this.needsAxes={x:!0,y:!0},F(this,KA,SB).call(this)}render(e,r,i={}){super.render(e,r,i),this.isConfiguredVisible()&&(e.pushView(this,r),e.renderMark(this.mark,i),e.popView(this))}getMarkType(){return typeof this.spec.mark=="object"?this.spec.mark.type:this.spec.mark}getEncoding(){const e=super.getEncoding(),r=this.mark.getSupportedChannels();for(const i of Object.keys(e))i!=="key"&&(r.includes(i)||delete e[i]);return e}resolve(e){if(!e){this.resolve("scale"),this.resolve("axis");return}const r=this.mark.encoding;for(const[i,s]of Object.entries(r)){if(!s||Array.isArray(s))continue;let o;if(zt(s))o=s;else if(Kh(s)){const c=s.condition;if(!Array.isArray(c)&&zt(c))o=c;else continue}else continue;const a=wr(o.resolutionChannel??i);if(!sf(a)||e=="axis"&&!dc(a))continue;let l=this;for(;(l.getConfiguredOrDefaultResolution(a,e)=="forced"||l.dataParent&&["shared","excluded","forced"].includes(l.dataParent.getConfiguredOrDefaultResolution(a,e)))&&l.getConfiguredOrDefaultResolution(a,e)!="excluded";)l=l.dataParent;if(e=="axis"&&dc(i)&&jh(a)){l.resolutions[e][a]||(l.resolutions[e][a]=new m5(a));const c=l.resolutions[e][a],u=c.registerMember({view:this,channel:i,channelDef:o});this.registerDisposer(()=>{u()&&l.resolutions[e][a]===c&&delete l.resolutions[e][a]})}else if(e=="scale"&&sf(i)){if(!l.resolutions[e][a]){const h=new p5(a);l.resolutions[e][a]=h;const A=d=>{var p;(p=this.context.glHelper)==null||p.createRangeTexture(d.scaleResolution,!0)};h.addEventListener("range",A),h.addEventListener("domain",A),this.registerDisposer(()=>{h.removeEventListener("range",A),h.removeEventListener("domain",A)})}const c=!this.isDomainInert(),u=l.resolutions[e][a],f=u.registerMember({view:this,channel:i,channelDef:o,contributesToDomain:c});this.registerDisposer(()=>{f()&&l.resolutions[e][a]===u&&(u.dispose(),delete l.resolutions[e][a])})}}}dispose(){super.dispose(),this.mark.dispose()}getDataAccessor(e){var i;const r=this.mark.encoders;if(r)return(i=r[e])==null?void 0:i.dataAccessor}getSearchAccessors(){if(!g(this,aa)){const e=JM(this.getEncoding())??[];Q(this,aa,e.map(r=>ue(r)))}return g(this,aa)}getFacetAccessor(e){const r=this.getDataAccessor("sample");return r||super.getFacetAccessor(this)}getCollector(){var e;return(e=this.flowHandle)==null?void 0:e.collector}registerDomainSubscriptions(){if(g(this,Jl)||this.isDomainInert())return;const e=this.getCollector();if(!e)return;const r=this.mark.encoders;if(!r)throw new Error("Encoders are not initialized!");Q(this,Jl,!0);const i=new Map;for(const s of Object.values(r)){if(!s)continue;const o=s.accessors??[];if(o.length!==0)for(const a of o){if(!m1(a)||a.channelDef.domainInert)continue;const l=this.getScaleResolution(a.scaleChannel);if(!l)throw new Error("Missing scale resolution for channel: "+a.scaleChannel);let c=i.get(l);c||(c=new Set,i.set(l,c)),c.add(a)}}for(const[s,o]of i){if(o.size===0)continue;const a=s.registerCollectorSubscriptions(e,o);this.registerDisposer(a)}}getZoomLevel(){const e=r=>{var i;return((i=this.getScaleResolution(r))==null?void 0:i.getZoomLevel())??1};return Ei.map(e).reduce((r,i)=>r*i,1)}propagateInteractionEvent(e){this.handleInteractionEvent(void 0,e,!0),e.target=this,!e.stopped&&this.handleInteractionEvent(void 0,e,!1)}getDefaultResolution(e,r){return e=="x"?"shared":"independent"}}Yl=new WeakMap,Jl=new WeakMap,aa=new WeakMap,KA=new WeakSet,SB=function(){for(const[e,r]of this.paramRuntime.paramConfigs){if(!("select"in r))continue;const i=of(r.select),s=i.on,o=i.clear;if(af(i)){let l=0;const c=A=>{this.paramRuntime.setValue(e,A)},u=()=>{var d;const A=this.context.getCurrentHover();return((d=A==null?void 0:A.mark)==null?void 0:d.unitView)===this?A.datum:null},f=s.filter?F2(s.filter):()=>!0,h=(A,d)=>{if(!f(d.proxiedMouseEvent))return;const p=u(),C=p?p[Gt]:0;let m;if(i.toggle)if(d.mouseEvent.shiftKey){if(p){const I=this.paramRuntime.getValue(e);m=kQ(I,{toggle:[p]})}}else m=$h(p?[p]:null);else C!=l&&(l=C,m=Zh(p));m!==void 0&&c(m)};if(this.addInteractionEventListener(["mouseover","pointerover"].includes(s.type)?"mousemove":s.type,h),o){const A=o.filter?F2(o.filter):()=>!0,d=(p,C)=>{if(!A(C.proxiedMouseEvent))return;l=0;const m=i.toggle?$h():Zh(null);c(m)};this.addInteractionEventListener(o.type,d)}}}};function jM(n){const t=new Set;n.visit(e=>{for(const r of Object.values(e.resolutions.scale)){const i=r.name;if(i&&t.has(i))throw new Error(`The same scale name "${i}" occurs in multiple scale resolutions!`);t.add(i)}})}function WM(n){for(const t of Ei){const e=n.getScaleResolution(t);e&&!e.name&&e.isZoomable()&&(e.name=`${t}_at_root`)}}function V0(n,t=()=>!0){return Promise.allSettled(n).then(e=>{if(t())for(const r of e)"value"in r?r.value.finalizeGraphicsInitialization():"reason"in r&&console.error(r.reason)})}async function XM(n,t,e){const r=n.import;if(!("url"in r))throw new Error("Not an url import: "+JSON.stringify(r));const i=Ti(t,r.url);let s;try{const o=await fetch(i);if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);s=await o.json()}catch(o){throw new Error(`Could not load imported view spec: ${i}. Reason: ${o.message}`)}if(e.isViewSpec(s))return s.baseUrl=Ti(Hy(r.url),s.baseUrl),s;throw new Error(`The imported spec "${i}" is not a view spec: ${JSON.stringify(n)}`)}function ZM(n){const t=n.getSize(),e=n.getPadding(),r=(i,s)=>i.grow>0?void 0:i.px+s;return{width:r(t.width,e.horizontalTotal),height:r(t.height,e.verticalTotal)}}function*_0(n,t=[]){for(const[e,r]of n.entries())if(r instanceof Map)for(const i of _0(r,[...t,e]))yield i;else yield[[...t,e],r]}const P2=2147483647,$M=L2([P2]);function L2(n){let t=0;for(let e=0,r=n.length;e<r;e++)t=Math.max(t,n[e]);return Math.floor(Math.log2(t)/4)+1}function eN(n){const t=L2(n);let e=Array.from({length:n.length},(s,o)=>o),r=new Array(n.length);const i=new Array(16);for(let s=0;s<t;s++){i.fill(0);const o=s*4,a=Math.pow(16,s),l=c=>{const u=n[e[c]];return s>=$M?u>P2?Math.floor(u/a)%16:0:u>>o&15};for(let c=0;c<n.length;c++)i[l(c)]++;for(let c=1;c<16;c++)i[c]+=i[c-1];for(let c=n.length-1;c>=0;c--)r[--i[l(c)]]=e[c];[e,r]=[r,e]}return e}const oA="|",Y0="\\";class tN{constructor(){v(this,la);v(this,hs,null);v(this,tr,null);v(this,ca,!1)}invalidate(){Q(this,hs,null),Q(this,tr,null),Q(this,ca,!1)}findDatum(t,e,r){if(!t||t.length===0)return;const i=t.join(", ");if(t.length!==e.length)throw new Error(`Key tuple length ${e.length} does not match fields [${i}]`);(!g(this,hs)||!F(this,la,DB).call(this,t))&&F(this,la,QB).call(this,t,r);const s=g(this,tr);let o;if(g(this,ca)){let a="";for(let l=0;l<e.length;l++){l>0&&(a+=oA);const c=s[l],u=aA(e[l],c);a+=O2(u)}o=a}else{const a=s[0];o=aA(e[0],a)}return g(this,hs).get(o)}}hs=new WeakMap,tr=new WeakMap,ca=new WeakMap,la=new WeakSet,QB=function(t,e){const r=t.map(a=>ue(a)),i=new Map,s=t.join(", "),o=t.length!==1;if(o)for(const a of e)for(let l=0,c=a.length;l<c;l++){const u=a[l];let f="";for(let A=0;A<r.length;A++){A>0&&(f+=oA);const d=t[A],p=aA(r[A](u),d);f+=O2(p)}if(i.get(f)!==void 0){const A=r.map(d=>d(u));throw new Error(`Duplicate key detected for fields [${s}]: ${JSON.stringify(A)}`)}i.set(f,u)}else{const a=r[0],l=t[0];for(const c of e)for(let u=0,f=c.length;u<f;u++){const h=c[u],A=aA(a(h),l);if(i.get(A)!==void 0)throw new Error(`Duplicate key detected for fields [${s}]: ${JSON.stringify(A)}`);i.set(A,h)}}Q(this,hs,i),Q(this,tr,[...t]),Q(this,ca,o)},DB=function(t){if(!g(this,tr)||g(this,tr).length!==t.length)return!1;for(let e=0;e<t.length;e++)if(g(this,tr)[e]!==t[e])return!1;return!0};function aA(n,t){if(n===void 0)throw new Error(`Key field "${t}" is undefined. Ensure all key fields are present in the data.`);if(n===null)throw new Error(`Key field "${t}" is null. Ensure all key fields are present in the data.`);if(typeof n!="string"&&typeof n!="number"&&typeof n!="boolean")throw new Error(`Key field "${t}" must be a scalar value (string, number, or boolean).`);return n}function nN(n){if(!(n.indexOf(Y0)!==-1||n.indexOf(oA)!==-1))return n;let e="";for(let r=0;r<n.length;r++){const i=n[r];(i===Y0||i===oA)&&(e+=Y0),e+=i}return e}function O2(n){return typeof n=="string"?nN(n):String(n)}class U2 extends Yh{constructor(e){var r;super();v(this,st);v(this,nr,[]);v(this,ql,ue(Gt));v(this,$r,[]);v(this,ua,new tN);v(this,ds);v(this,fa);v(this,ei,new rN);this.params=e??{type:"collect"},this.observers=new Set,this.facetBatches=new Tn([],JSON.stringify),Q(this,fa,sN((r=this.params)==null?void 0:r.sort)),F(this,st,kp).call(this)}get behavior(){return _h}get label(){return"collect"}reset(){super.reset(),F(this,st,kp).call(this)}handle(e){g(this,nr).push(e)}beginBatch(e){g(this,ua).invalidate(),CQ(e)&&(Q(this,nr,[]),this.facetBatches.set(Ke(e.facetId),g(this,nr)))}complete(){var e;if(Q(this,nr,[]),(e=this.params.groupby)!=null&&e.length){if(this.facetBatches.size>1)throw new Error("TODO: Support faceted data!");const r=this.facetBatches.get(void 0),i=this.params.groupby.map(o=>ue(o)),s=i.length>1?Uu(r,...i):iN(r,i[0]);this.facetBatches.clear();for(const[o,a]of _0(s))this.facetBatches.set(o,a)}if(g(this,fa))for(const r of this.facetBatches.values())r.sort(g(this,fa));F(this,st,kB).call(this),F(this,st,Fp).call(this),super.complete(),F(this,st,Rp).call(this);for(const r of this.observers)r(this)}observe(e){return this.observers.add(e),()=>{this.observers.delete(e)}}repropagate(){for(const e of this.children)e.reset();F(this,st,Fp).call(this);for(const e of this.children)e.complete();F(this,st,Rp).call(this)}getDomain(e,r,i){return g(this,ei).getDomain(e,()=>{const s=Zf(r);if(i.constant)s.extend(i({}));else if(this.completed)for(const o of this.facetBatches.values())for(let a=0,l=o.length;a<l;a++)s.extend(i(o[a]));return s})}subscribeDomainChanges(e,r){return g(this,ei).subscribe(e,r)}getData(){switch(F(this,st,ih).call(this),this.facetBatches.size){case 0:return[];case 1:return[...this.facetBatches.values()][0];default:{const e=this.facetBatches;return{[Symbol.iterator]:function*(){for(const i of e.values())yield*i}}}}}visitData(e){F(this,st,ih).call(this);for(const r of this.facetBatches.values())for(let i=0;i<r.length;i++)e(r[i])}getItemCount(){let e=0;for(const r of this.facetBatches.values())e+=r.length;return e}findDatumByUniqueId(e){if(!g(this,$r).length)return;const r=mi(l=>l.start).right,i=g(this,ql),s=mi(l=>i(o(l))).left,o=l=>{const c=r(g(this,ds),l),u=g(this,ds)[c-1];return!u||l>=u.stop?void 0:this.facetBatches.get(u.facetId)[l-u.start]},a=s(g(this,$r),e);if(a>=0){const l=o(g(this,$r)[a]);if(l&&i(l)===e)return l}}findDatumByKey(e,r){return F(this,st,ih).call(this),g(this,ua).findDatum(e,r,this.facetBatches.values())}}nr=new WeakMap,ql=new WeakMap,$r=new WeakMap,ua=new WeakMap,ds=new WeakMap,fa=new WeakMap,ei=new WeakMap,st=new WeakSet,kp=function(){Q(this,nr,[]),Q(this,$r,[]),g(this,ua).invalidate(),this.facetBatches.clear(),this.facetBatches.set(void 0,g(this,nr))},Fp=function(){if(this.children.length)for(const[e,r]of this.facetBatches.entries()){if(e){const i={type:"facet",facetId:e};for(const s of this.children)s.beginBatch(i)}for(let i=0,s=r.length;i<s;i++)this._propagate(r[i])}},ih=function(){if(!this.completed)throw new Error("Data propagation is not completed! No data are available.")},Rp=function(){g(this,ei).hasCachedDomains()&&g(this,ei).clear(),g(this,ei).notify()},kB=function(){var o;Q(this,ds,[]);const e=(o=this.facetBatches.values().next().value)==null?void 0:o[0];if(e==null||!(Gt in e))return;let r=0;const i=[],s=g(this,ql);for(const[a,l]of this.facetBatches){g(this,ds).push({start:r,stop:r+l.length,facetId:a}),r+=l.length;for(let c=0,u=l.length;c<u;c++)i.push(s(l[c]))}Q(this,$r,eN(i))};class rN{constructor(){v(this,gs,new Map);v(this,rr,new Map)}hasCachedDomains(){return g(this,gs).size>0}clear(){g(this,gs).clear()}getDomain(t,e){const r=g(this,gs).get(t);if(r)return r;{const i=e();return g(this,gs).set(t,i),i}}subscribe(t,e){let r=g(this,rr).get(t);return r||(r=new Set,g(this,rr).set(t,r)),r.add(e),()=>{const i=g(this,rr).get(t);i&&(i.delete(e),i.size===0&&g(this,rr).delete(t))}}notify(){if(g(this,rr).size===0)return;const t=new Set;for(const e of g(this,rr).values())for(const r of e)t.add(r);for(const e of t)e()}}gs=new WeakMap,rr=new WeakMap;function iN(n,t){const e=new Map;for(let r=0,i=n.length;r<i;r++){const s=n[r],o=t(s);let a=e.get(o);a||(a=[],e.set(o,a)),a.push(s)}return e}function sN(n){if(n!=null&&n.field){const t=Ke(n.field);if(t.length==1&&!t[0].includes(".")){const e=Ke(n.order)[0]??"ascending",r=JSON.stringify(t[0]);return new Function("a","b",`return a[${r}] ${e==="ascending"?"-":"+"} b[${r}];`)}return Wp(n.field,n.order)}}class oN extends ze{get behavior(){return pn}constructor(t){super(t),this.params=t,this.startAccessor=ue(t.start),this.endAccessor=ue(t.end),this.chromAccessor=t.chrom?ue(t.chrom):e=>{},this.weightAccessor=t.weight?ue(t.weight):e=>1,this.as={coverage:t.as??"coverage",start:t.asStart??t.start,end:t.asEnd??t.end,chrom:t.asChrom??t.chrom},this.createSegment=new Function("start","end","coverage","chrom","return {"+Object.entries(this.as).filter(([e,r])=>r).map(([e,r])=>`${JSON.stringify(r)}: ${e}`).join(", ")+"};"),this.ends=new go}reset(){super.reset(),this.initialize()}initialize(){const t=this.as.coverage,e=this.as.end,r=this.as.chrom,i=this.startAccessor,s=this.endAccessor,o=this.chromAccessor,a=this.weightAccessor;let l,c,u,f=0,h=NaN;const A=this.ends;A.clear();const d=m=>{this._propagate(m),l=null},p=(m,y,I)=>{if(m==y)return;let w=!1;l&&(l[t]===I?(l[e]=y,w=!0):l[t]!=0&&d(l)),w||(l=this.createSegment(m,y,I,u))},C=()=>{let m=0;for(;(m=A.peekValue())!==void 0;)p(h,m,f),h=m,f-=A.pop();h=NaN,l&&d(l)};this.handle=m=>{const y=i(m);let I=0;for(;(I=A.peekValue())!==void 0&&I<y;)p(h,I,f),h=I,f-=A.pop();if(r){let x=o(m);x!==c&&(C(),u=x,c=u)}isNaN(h)||p(h,y,f),h=y;const w=a(m);f+=w,A.push(w,s(m))},this.complete=()=>{C(),super.complete()},this.beginBatch=m=>{C(),c=null,super.beginBatch(m)}}}function aN(n,t,e=s=>+s,r=0,i=n.length){const s=new go,o=i-r;let a;for(a=0;a<t&&a<o;a++)s.push(a,e(n[r+a]));for(;a<o;a++){const u=e(n[r+a]);u>=s.peekValue()&&(s.push(a,u),s.pop())}const l=[];let c;for(;(c=s.pop())!==void 0;)l.push(n[r+c]);return l.reverse()}class cN{constructor(t,e=-1/0,r=1/0){this.maxSize=t,this.lowerLimit=e,this.upperLimit=r;const i=this.maxSize*2+1;this.lowerLimits=new Float64Array(i),this.upperLimits=new Float64Array(i),this.lowerChildren=new Int32Array(i),this.upperChildren=new Int32Array(i),this.reset()}reset(){this.lowerLimits.fill(0),this.upperLimits.fill(0),this.lowerChildren.fill(0),this.upperChildren.fill(0),this.n=1,this.lowerLimits[0]=this.lowerLimit,this.upperLimits[0]=this.upperLimit}_findSlot(t,e,r=0){if(t>=this.lowerLimits[r]&&e<=this.upperLimits[r]){const i=this.lowerChildren[r];if(i){const s=this._findSlot(t,e,i);return s>=0?s:this._findSlot(t,e,this.upperChildren[r])}else return r}else return-1}reserve(t,e){if(e-t<=0)throw new Error("Cannot reserve an empty or negative-size slot!");if(this.n+1>this.lowerLimits.length)return!1;const r=this._findSlot(t,e);if(r<0)return!1;const i=this.n++,s=this.n++;return this.lowerLimits[i]=this.lowerLimits[r],this.upperLimits[i]=t,this.lowerLimits[s]=e,this.upperLimits[s]=this.upperLimits[r],this.lowerChildren[r]=i,this.upperChildren[r]=s,!0}}class lN extends ze{get behavior(){return _h}constructor(t,e){if(super(t),this.params=t,this._data=[],this.channel=t.channel??"x",!["x","y"].includes(this.channel))throw new Error("Invalid channel: "+this.channel);this.startPosAccessor=ue(this.params.pos),this.endPosAccessor=ue(this.params.pos2??this.params.pos),this.startPosBisector=mi(this.startPosAccessor),this.endPosBisector=mi(this.endPosAccessor),this.scoreAccessor=ue(this.params.score),this.widthAccessor=ue(this.params.width),this.laneAccessor=this.params.lane?ue(this.params.lane):o=>0,this.padding=this.params.padding??0,this.reservationMaps=new Map,this.resolution=e.getScaleResolution(this.channel);const r=()=>this._filterAndPropagate();this.schedule=()=>e.context.animator.requestTransition(r);const i=()=>this.schedule();this.resolution.addEventListener("domain",i),this.registerDisposer(()=>this.resolution.removeEventListener("domain",i));const s=e._addBroadcastHandler("layoutComputed",()=>this.schedule());this.registerDisposer(s)}complete(){const t=this.startPosAccessor;this._data.sort((e,r)=>t(e)-t(r));for(const e of new Set(this._data.map(this.laneAccessor)))this.reservationMaps.set(e,new cN(200));this.schedule(),super.complete()}_filterAndPropagate(){super.reset();const t=this.resolution.getScale(),e=this.resolution.getAxisLength();if(!e)return;for(const o of this.reservationMaps.values())o.reset();const r=t.domain(),s=aN(this._data,70,this.scoreAccessor,this.endPosBisector.left(this._data,r[0]),this.startPosBisector.right(this._data,r[1]));for(const o of s){let a=t(this.startPosAccessor(o))*e,l=t(this.endPosAccessor(o))*e;const c=l-a,u=this.widthAccessor(o)+this.padding*2;let f=(a+l)/2;const h=Math.max(0,(c-u)/2);if(h>0){const A=Math.max(0,u/2-f);f+=Math.min(A,h);const d=Math.max(0,u/2+f-e);f-=Math.min(d,h)}if(this.reservationMaps.get(this.laneAccessor(o)).reserve(f-u/2,f+u/2))if(this.params.asMidpoint){const A=Object.assign({},o);A[this.params.asMidpoint]=t.invert(f/e),this._propagate(A)}else this._propagate(o)}super.complete()}reset(){super.reset(),this._data=[],this.groups=new Map}handle(t){this._data.push(t)}}class uN extends ze{constructor(t,e){super(t,e),this.params=t,this.predicate=void 0}initialize(){let t="";if(fN(this.params))t=this.params.expr;else if(AN(this.params)){const e=this.paramRuntime.findValue(this.params.param);if(!e)throw new Error(`Cannot initialize filter transform. Selection parameter "${this.params.param}" not found!`);t=FQ(this.params,e)}else throw new Error("Invalid filter params: "+JSON.stringify(this.params));this.predicate=this.paramRuntime.watchExpression(t,()=>this.repropagate(),{scopeOwned:!1,registerDisposer:e=>this.registerDisposer(e)})}handle(t){this.predicate(t)&&this._propagate(t)}}function fN(n){return"expr"in n}function AN(n){return"param"in n}class hN extends ze{get behavior(){return pn}constructor(t){super(t),this.params=t;const e=t.index;if(t.fields){const r=Ke(t.fields).map(s=>ue(s)),i=Ke(t.as||t.fields);if(r.length!==i.length)throw new Error(`Lengths of "fields" (${r.length}), and "as" (${i.length}) do not match!`);this.handle=s=>{const o=r.map((l,c)=>l(s)??[]),a=o[0].length;for(let l=0;l<a;l++){const c=Object.assign({},s);for(let u=0;u<r.length;u++)c[i[u]]=l<o[u].length?o[u][l]:null;e&&(c[e]=l),this._propagate(c)}}}else this.handle=r=>{for(let i=0;i<r.length;i++){const s=Object.assign({},r[i]);e&&(s[e]=i),this._propagate(s)}}}}const dN=48;function*gN(n,t=","){const e=t.charCodeAt(0);let r=0;for(let i=0;i<n.length;i++){const s=n.charCodeAt(i);s==e?(yield r,r=0):r=r*10+s-dN}yield r}class pN extends ze{get behavior(){return pn}constructor(t){super(t);const e=ue(t.exons??"exons"),r=ue(t.start??"start"),[i,s]=t.as||["exonStart","exonEnd"];this.handle=o=>{let a=r(o),l=a,c=!0;const u=e(o);for(const f of gN(u)){if(c)l=a+f;else{a=l+f;const h=Object.assign({},o);h[i]=l,h[s]=a,this._propagate(h)}c=!c}}}}class mN extends ze{get behavior(){return pn}constructor(t){super(t);const e=Ke(t.field).map(s=>ue(s)),r=Ke(t.separator),i=Ke(t.as||t.field);if(e.length!==r.length||e.length!==i.length)throw new Error(`Lengths of "separator" (${r.length}), "fields" (${e.length}), and "as" (${i.length}) do not match!`);this.handle=s=>{if(e.some(l=>!l(s)))return;const o=e.map((l,c)=>l(s).split(r[c]));CN(o,s);const a=o[0].length;for(let l=0;l<a;l++){const c=Object.assign({},s);for(let u=0;u<e.length;u++)c[i[u]]=o[u][l];this._propagate(c)}}}}function CN(n,t){const e=n.map(r=>r.length);if(!e.every(r=>r==e[0]))throw new Error("Mismatching number of elements in the fields to be split: "+JSON.stringify(t))}class wN extends ze{get behavior(){return Cr}constructor(t,e){super(t,e),this.params=t,this.as=t.as,this.fn=void 0}initialize(){this.fn=this.paramRuntime.watchExpression(this.params.expr,()=>this.repropagate(),{scopeOwned:!1,registerDisposer:t=>this.registerDisposer(t)})}handle(t){t[this.as]=this.fn(t),this._propagate(t)}}class G2 extends ze{get behavior(){return Cr}constructor(t,e){t={channel:"x",...t},super(t),this.params=t;const r=t.channel;if(!["x","y"].includes(r))throw new Error("Invalid channel: "+r);const i=e.getScaleResolution(r).getScale(),s="genome"in i?i.genome():void 0;if(!s)throw new Error("LinearizeGenomicCoordinate transform requires a locus scale!");const o=ue(t.chrom),a=Ke(t.pos).map(p=>ue(p)),l=Ke(t.as);if(a.length!=l.length)throw new Error('The number of "pos" and "as" elements must be equal!');const c=Ke(t.offset);let u;if(c.length==0)u=new Array(a.length).fill(0);else if(c.length==1)u=new Array(a.length).fill(c[0]);else if(c.length==a.length)u=c;else throw new Error(`Invalid "offset" parameter: ${JSON.stringify(t.offset)}!`);const f=new Function("datum","chromOffset","posAccessors",l.map((p,C)=>`datum[${JSON.stringify(p)}] = chromOffset + +posAccessors[${C}](datum) - ${u[C]};`).join(`
655
655
  `));let h,A=0;const d=p=>{if(p!==h){if(A=s.cumulativeChromPositions.get(p),A===void 0)return;h=p}return A};this.handle=p=>{const C=o(p),m=d(C);if(m===void 0)throw new Error(`Unknown chromosome/contig "${C}" in datum: ${JSON.stringify(p)}`);f(p,m,a),this._propagate(p)}}}const z2={chars:JSON.parse('[{"id":87,"width":53,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":43.491,"chnl":15,"x":0,"y":0,"page":0},{"id":124,"width":17,"height":50,"xoffset":0,"yoffset":-32.193000000000005,"xadvance":10.521,"chnl":15,"x":0,"y":42,"page":0},{"id":40,"width":20,"height":49,"xoffset":0,"yoffset":-32.571000000000005,"xadvance":11.214,"chnl":15,"x":0,"y":94,"page":0},{"id":41,"width":19,"height":49,"xoffset":0,"yoffset":-32.571000000000005,"xadvance":11.214,"chnl":15,"x":0,"y":145,"page":0},{"id":36,"width":32,"height":49,"xoffset":0,"yoffset":-34.419000000000004,"xadvance":24.360000000000003,"chnl":15,"x":0,"y":196,"page":0},{"id":125,"width":21,"height":48,"xoffset":0,"yoffset":-32.193000000000005,"xadvance":12.642000000000001,"chnl":15,"x":0,"y":247,"page":0},{"id":91,"width":22,"height":48,"xoffset":0,"yoffset":-32.193000000000005,"xadvance":12.852,"chnl":15,"x":0,"y":297,"page":0},{"id":93,"width":19,"height":48,"xoffset":0,"yoffset":-32.193000000000005,"xadvance":12.852,"chnl":15,"x":0,"y":347,"page":0},{"id":123,"width":21,"height":48,"xoffset":0,"yoffset":-32.193000000000005,"xadvance":12.642000000000001,"chnl":15,"x":0,"y":397,"page":0},{"id":106,"width":19,"height":48,"xoffset":0,"yoffset":-30.639000000000003,"xadvance":10.08,"chnl":15,"x":0,"y":447,"page":0},{"id":81,"width":43,"height":47,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":33.621,"chnl":15,"x":21,"y":447,"page":0},{"id":77,"width":45,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":38.997,"chnl":15,"x":66,"y":447,"page":0},{"id":64,"width":43,"height":44,"xoffset":0,"yoffset":-28.539,"xadvance":35.133,"chnl":15,"x":23,"y":397,"page":0},{"id":92,"width":28,"height":43,"xoffset":0,"yoffset":-30.933000000000003,"xadvance":18.984,"chnl":15,"x":68,"y":397,"page":0},{"id":47,"width":28,"height":43,"xoffset":0,"yoffset":-30.933000000000003,"xadvance":18.984,"chnl":15,"x":98,"y":397,"page":0},{"id":109,"width":42,"height":32,"xoffset":0,"yoffset":-21.609,"xadvance":34.545,"chnl":15,"x":113,"y":447,"page":0},{"id":119,"width":42,"height":31,"xoffset":0,"yoffset":-21.315,"xadvance":32.991,"chnl":15,"x":157,"y":447,"page":0},{"id":42,"width":25,"height":42,"xoffset":0,"yoffset":-31.626,"xadvance":17.85,"chnl":15,"x":128,"y":397,"page":0},{"id":37,"width":42,"height":41,"xoffset":0,"yoffset":-30.387,"xadvance":33.663000000000004,"chnl":15,"x":155,"y":397,"page":0},{"id":79,"width":42,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":33.621,"chnl":15,"x":199,"y":397,"page":0},{"id":102,"width":24,"height":41,"xoffset":0,"yoffset":-30.534000000000002,"xadvance":14.721,"chnl":15,"x":243,"y":397,"page":0},{"id":100,"width":31,"height":41,"xoffset":0,"yoffset":-30.933000000000003,"xadvance":23.520000000000003,"chnl":15,"x":269,"y":397,"page":0},{"id":98,"width":32,"height":41,"xoffset":0,"yoffset":-30.933000000000003,"xadvance":23.520000000000003,"chnl":15,"x":302,"y":397,"page":0},{"id":56,"width":32,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":24.360000000000003,"chnl":15,"x":336,"y":397,"page":0},{"id":38,"width":40,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":29.904000000000003,"chnl":15,"x":370,"y":397,"page":0},{"id":108,"width":17,"height":41,"xoffset":0,"yoffset":-30.933000000000003,"xadvance":9.912,"chnl":15,"x":412,"y":397,"page":0},{"id":107,"width":31,"height":41,"xoffset":0,"yoffset":-30.933000000000003,"xadvance":21.336000000000002,"chnl":15,"x":431,"y":397,"page":0},{"id":48,"width":33,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":24.360000000000003,"chnl":15,"x":464,"y":397,"page":0},{"id":71,"width":38,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":30.681,"chnl":15,"x":21,"y":347,"page":0},{"id":83,"width":31,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":22.785,"chnl":15,"x":61,"y":347,"page":0},{"id":63,"width":27,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":18.795,"chnl":15,"x":94,"y":347,"page":0},{"id":105,"width":18,"height":41,"xoffset":0,"yoffset":-30.639000000000003,"xadvance":10.08,"chnl":15,"x":123,"y":347,"page":0},{"id":51,"width":32,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":24.360000000000003,"chnl":15,"x":143,"y":347,"page":0},{"id":104,"width":31,"height":41,"xoffset":0,"yoffset":-30.933000000000003,"xadvance":23.436,"chnl":15,"x":177,"y":347,"page":0},{"id":67,"width":37,"height":41,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":28.056,"chnl":15,"x":210,"y":347,"page":0},{"id":88,"width":37,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":27.258000000000003,"chnl":15,"x":249,"y":347,"page":0},{"id":68,"width":40,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":31.941000000000003,"chnl":15,"x":288,"y":347,"page":0},{"id":70,"width":32,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":23.751,"chnl":15,"x":330,"y":347,"page":0},{"id":34,"width":23,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":15.561000000000002,"chnl":15,"x":364,"y":347,"page":0},{"id":72,"width":38,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":32.067,"chnl":15,"x":389,"y":347,"page":0},{"id":73,"width":18,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":11.760000000000002,"chnl":15,"x":429,"y":347,"page":0},{"id":74,"width":24,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":17.745,"chnl":15,"x":449,"y":347,"page":0},{"id":75,"width":38,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":27.825000000000003,"chnl":15,"x":24,"y":297,"page":0},{"id":76,"width":31,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":21.567,"chnl":15,"x":475,"y":347,"page":0},{"id":66,"width":35,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":27.153000000000002,"chnl":15,"x":64,"y":297,"page":0},{"id":78,"width":38,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":32.067,"chnl":15,"x":101,"y":297,"page":0},{"id":33,"width":18,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":11.298,"chnl":15,"x":141,"y":297,"page":0},{"id":80,"width":34,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":25.221,"chnl":15,"x":161,"y":297,"page":0},{"id":65,"width":38,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":28.434,"chnl":15,"x":197,"y":297,"page":0},{"id":82,"width":36,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":26.313000000000002,"chnl":15,"x":237,"y":297,"page":0},{"id":35,"width":33,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.360000000000003,"chnl":15,"x":275,"y":297,"page":0},{"id":84,"width":34,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.801000000000002,"chnl":15,"x":310,"y":297,"page":0},{"id":85,"width":37,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":30.891000000000002,"chnl":15,"x":346,"y":297,"page":0},{"id":86,"width":38,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":28.434,"chnl":15,"x":385,"y":297,"page":0},{"id":39,"width":16,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":8.568000000000001,"chnl":15,"x":425,"y":297,"page":0},{"id":69,"width":32,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.255000000000003,"chnl":15,"x":443,"y":297,"page":0},{"id":89,"width":36,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":26.208000000000002,"chnl":15,"x":23,"y":247,"page":0},{"id":90,"width":34,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":25.284000000000002,"chnl":15,"x":477,"y":297,"page":0},{"id":49,"width":31,"height":40,"xoffset":0,"yoffset":-30.156000000000002,"xadvance":24.360000000000003,"chnl":15,"x":61,"y":247,"page":0},{"id":50,"width":32,"height":40,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":24.360000000000003,"chnl":15,"x":94,"y":247,"page":0},{"id":57,"width":32,"height":40,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":24.360000000000003,"chnl":15,"x":128,"y":247,"page":0},{"id":94,"width":32,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.360000000000003,"chnl":15,"x":162,"y":247,"page":0},{"id":96,"width":21,"height":40,"xoffset":0,"yoffset":-30.429000000000002,"xadvance":16.8,"chnl":15,"x":196,"y":247,"page":0},{"id":55,"width":33,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.360000000000003,"chnl":15,"x":219,"y":247,"page":0},{"id":54,"width":33,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.360000000000003,"chnl":15,"x":254,"y":247,"page":0},{"id":53,"width":32,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.360000000000003,"chnl":15,"x":289,"y":247,"page":0},{"id":52,"width":33,"height":40,"xoffset":0,"yoffset":-30.093000000000004,"xadvance":24.360000000000003,"chnl":15,"x":323,"y":247,"page":0},{"id":103,"width":31,"height":39,"xoffset":0,"yoffset":-21.630000000000003,"xadvance":21.84,"chnl":15,"x":358,"y":247,"page":0},{"id":112,"width":32,"height":39,"xoffset":0,"yoffset":-21.651,"xadvance":23.541,"chnl":15,"x":391,"y":247,"page":0},{"id":113,"width":31,"height":39,"xoffset":0,"yoffset":-21.651,"xadvance":23.520000000000003,"chnl":15,"x":425,"y":247,"page":0},{"id":116,"width":25,"height":39,"xoffset":0,"yoffset":-28.182000000000002,"xadvance":15.057,"chnl":15,"x":458,"y":247,"page":0},{"id":121,"width":31,"height":38,"xoffset":0,"yoffset":-21.273,"xadvance":21.651,"chnl":15,"x":34,"y":196,"page":0},{"id":59,"width":18,"height":36,"xoffset":0,"yoffset":-20.706,"xadvance":10.983,"chnl":15,"x":485,"y":247,"page":0},{"id":43,"width":32,"height":34,"xoffset":0,"yoffset":-24.486,"xadvance":24.360000000000003,"chnl":15,"x":67,"y":196,"page":0},{"id":60,"width":30,"height":33,"xoffset":0,"yoffset":-23.331000000000003,"xadvance":24.360000000000003,"chnl":15,"x":101,"y":196,"page":0},{"id":62,"width":31,"height":33,"xoffset":0,"yoffset":-23.331000000000003,"xadvance":24.360000000000003,"chnl":15,"x":133,"y":196,"page":0},{"id":117,"width":30,"height":32,"xoffset":0,"yoffset":-21.273,"xadvance":23.415000000000003,"chnl":15,"x":166,"y":196,"page":0},{"id":99,"width":29,"height":32,"xoffset":0,"yoffset":-21.609,"xadvance":20.055,"chnl":15,"x":198,"y":196,"page":0},{"id":110,"width":31,"height":32,"xoffset":0,"yoffset":-21.609,"xadvance":23.436,"chnl":15,"x":229,"y":196,"page":0},{"id":111,"width":32,"height":32,"xoffset":0,"yoffset":-21.609,"xadvance":23.814,"chnl":15,"x":262,"y":196,"page":0},{"id":126,"width":32,"height":26,"xoffset":0,"yoffset":-16.128,"xadvance":24.360000000000003,"chnl":15,"x":201,"y":447,"page":0},{"id":101,"width":31,"height":32,"xoffset":0,"yoffset":-21.609,"xadvance":22.176000000000002,"chnl":15,"x":296,"y":196,"page":0},{"id":114,"width":25,"height":32,"xoffset":0,"yoffset":-21.651,"xadvance":15.288,"chnl":15,"x":329,"y":196,"page":0},{"id":115,"width":27,"height":32,"xoffset":0,"yoffset":-21.609,"xadvance":18.186,"chnl":15,"x":356,"y":196,"page":0},{"id":97,"width":28,"height":32,"xoffset":0,"yoffset":-21.651,"xadvance":20.874000000000002,"chnl":15,"x":385,"y":196,"page":0},{"id":118,"width":31,"height":31,"xoffset":0,"yoffset":-21.273,"xadvance":21.672,"chnl":15,"x":415,"y":196,"page":0},{"id":61,"width":31,"height":29,"xoffset":0,"yoffset":-19.089000000000002,"xadvance":24.360000000000003,"chnl":15,"x":448,"y":196,"page":0},{"id":120,"width":30,"height":31,"xoffset":0,"yoffset":-21.273,"xadvance":20.916,"chnl":15,"x":21,"y":145,"page":0},{"id":58,"width":18,"height":31,"xoffset":0,"yoffset":-20.706,"xadvance":10.5,"chnl":15,"x":53,"y":145,"page":0},{"id":122,"width":28,"height":31,"xoffset":0,"yoffset":-21.273,"xadvance":18.984,"chnl":15,"x":73,"y":145,"page":0},{"id":95,"width":28,"height":16,"xoffset":0,"yoffset":0,"xadvance":19.278000000000002,"chnl":15,"x":235,"y":447,"page":0},{"id":45,"width":23,"height":24,"xoffset":0,"yoffset":-14.175,"xadvance":15.603000000000002,"chnl":15,"x":481,"y":196,"page":0},{"id":44,"width":17,"height":21,"xoffset":0,"yoffset":-4.956,"xadvance":9.534,"chnl":15,"x":103,"y":145,"page":0},{"id":46,"width":18,"height":15,"xoffset":0,"yoffset":-4.956,"xadvance":9.912,"chnl":15,"x":0,"y":497,"page":0},{"id":32,"width":0,"height":0,"xoffset":0,"yoffset":0,"xadvance":10.752,"chnl":15,"x":20,"y":497,"page":0}]'),common:{lineHeight:50.400000000000006,base:41.454,scaleW:512,scaleH:512,pages:1,packed:0,alphaChnl:0,redChnl:0,greenChnl:0,blueChnl:0}};class yN extends ze{get behavior(){return Cr}constructor(t,e){super(t,e),this.params=t;const r=Nd(z2),i=ue(t.field),s=t.as;let o=0;if(Me(t.fontSize)){const a=e.paramRuntime.watchExpression(t.fontSize.expr,()=>{o=a(),this.repropagate()},{scopeOwned:!1,registerDisposer:l=>this.registerDisposer(l)});o=a()}else o=t.fontSize;this.handle=a=>{const l=i(a);l!==void 0?a[s]=r.measureWidth(l,o):a[s]=0,this._propagate(a)}}}const IN=65536;class EN extends ze{get behavior(){return Cr}constructor(t){super(t),this.params=t}reset(){super.reset(),this.initialize()}initialize(){const t=this.params,e=t.as||"lane",r=ot(t.spacing)?t.spacing:1,i=ue(t.start),s=ue(t.end);if(!t.preference!=!t.preferredOrder)throw new Error('Must specify both "preference" and "preferredOrder"');if(t.preference){const o=new Float64Array(IN),a=ue(t.preference),l=t.preferredOrder;let c=1/0;this.handle=u=>{const f=i(u);f<c&&o.fill(-1/0),c=f;const h=l.indexOf(a(u));let A=-1;if(h>=0&&o[h]<f)A=h;else{const d=i(u);for(A=0;A<o.length&&!(o[A]<d);A++);if(A>=o.length)throw new Error("Out of lanes!")}o[A]=s(u)+r,u[e]=A,this._propagate(u)}}else{const o=new go,a=new go;let l=-1/0,c=0;this.handle=u=>{const f=i(u);for(;o.length&&(o.peekValue()<=f||f<l);){const A=o.pop();a.push(A,A)}l=f;let h=a.pop();h===void 0&&(h=c++),u[e]=h,this._propagate(u),o.push(h,s(u)+r)}}}}class bN extends ze{get behavior(){return pn}constructor(t){if(super(t),this.params=t,t.as&&t.as.length!=t.fields.length)throw new Error('"fields" and "as" have unequal lengths!');const e=t.fields.map(i=>ue(i)),r=t.as?t.as:e.map(ke);this.handle=i=>{const s={};for(let o=0;o<e.length;o++)s[r[o]]=e[o](i);this._propagate(s)}}}class xN extends ze{get behavior(){return Cr}constructor(t){super(t),this.params=t;const e=new RegExp(t.regex),r=typeof t.as=="string"?[t.as]:t.as,i=ue(t.field);this.handle=s=>{const o=i(s);if(we(o)){const a=o.match(e);if(a){if(a.length-1!=r.length)throw new Error('The number of RegEx groups and the length of "as" do not match!');for(let l=0;l<r.length;l++)s[r[l]]=a[l+1]}else if(t.skipInvalidInput)for(let l=0;l<r.length;l++)s[r[l]]=void 0;else throw new Error(`"${o}" does not match the given regex: ${e.toString()}`)}else if(!t.skipInvalidInput)throw new Error(`Trying to match a non-string field. Encountered type: ${typeof o}, field content: "${o}".`);this._propagate(s)}}}class BN extends ze{get behavior(){return pn}constructor(t){super(t),this.params=t;const e=Ke(t.columnRegex).map(h=>new RegExp(h));for(const h of e)if(RegExp("|"+h.source).exec("").length-1!=1)throw new Error(`Regex ${h.toString()} must have exactly one capturing group!`);const r=Ke(t.asValue);if(e.length!=r.length)throw new Error('Lengths of "columnRegex" and "as" are not equal!');const i=t.skipRegex?new RegExp(t.skipRegex):void 0,s=t.asKey||"sample";let o,a,l;const c=h=>{var C;const A=Object.keys(h);for(const m of e)if(!A.some(y=>m.test(y)))throw new Error(`No columns matching the regex ${m.toString()} found in the data!`);const d=new Map;for(const[m,y]of e.entries())for(const I of A){const w=(C=y.exec(I))==null?void 0:C[1];if(w!==void 0){let x=d.get(w);x||(x=[],d.set(w,x)),x[m]=I}}o=[...d.entries()],a=A.filter(m=>!e.some(y=>y.test(m))&&!(i&&i.test(m)));const p=[...a.map(m=>JSON.stringify(m)+": datum["+JSON.stringify(m)+"]"),JSON.stringify(s)+": sampleId",...r.map((m,y)=>JSON.stringify(m)+`: datum[attrs[${y}]]`)];l=new Function("datum","sampleId","attrs",`return {
656
656
  `+p.join(`,
657
657
  `)+`
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/view/view.js"],"names":[],"mappings":"AA4BA,oBAAoB;AACpB,yBAA0B,YAAY,CAAC;AACvC,0BAA0B;AAC1B,yBAA0B,YAAY,CAAC;AAKvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IA6CI;;;;;;;;;OASG;IACH,kBARW,OAAO,iBAAiB,EAAE,QAAQ,WAClC,OAAO,yBAAyB,EAAE,OAAO,gBACzC,OAAO,oBAAoB,EAAE,OAAO,cACpC,OA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ACF,WAAW;sBAEX,eAAe,GAAG;IACvB,SAAS,CAAC,EAAE,CAAS,IAAI,EAAJ,IAAI,KAAE,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,CAAS,IAAI,EAAJ,IAAI,KAAE,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,CAAS,IAAI,EAAJ,IAAI,KAAE,IAAI,CAAA;CAAC;;;;;UAIlC,OAAO,iBAAiB,EAAE,kBAAkB;;;;cAC5C,GAAG;;gDAGF,OAAO,uBAAuB,EAAE,OAAO,SAEvC,OAAO,8BAA8B,EAAE,OAAO;;;;;+BAG/C,OAAO;;;;;qBAEP,OAAO;;6BA3CY,qCAAqC;oBAb9C,qBAAqB;+BADlC,wBAAwB"}
@@ -1009,17 +1009,21 @@ function createViewOpacityFunction(view) {
1009
1009
  let stopReaders = [];
1010
1010
 
1011
1011
  const updateInterpolator = () => {
1012
- const unitsPerPixel = asFiniteNumberArray(
1012
+ const rawUnitsPerPixel = asFiniteNumberArray(
1013
1013
  stopReaders.map((readStop) => readStop()),
1014
1014
  "opacity.unitsPerPixel",
1015
1015
  view
1016
1016
  );
1017
1017
 
1018
- validateDynamicOpacityStops(unitsPerPixel, opacityValues, view);
1018
+ const normalizedStops = normalizeDynamicOpacityStops(
1019
+ rawUnitsPerPixel,
1020
+ opacityValues,
1021
+ view
1022
+ );
1019
1023
 
1020
1024
  const scale = scaleLog()
1021
- .domain(unitsPerPixel)
1022
- .range(opacityValues)
1025
+ .domain(normalizedStops.unitsPerPixel)
1026
+ .range(normalizedStops.values)
1023
1027
  .clamp(true);
1024
1028
 
1025
1029
  interpolate = (value) => scale(value);
@@ -1105,7 +1109,7 @@ function createViewOpacityFunction(view) {
1105
1109
  * @param {number[]} values
1106
1110
  * @param {View} view
1107
1111
  */
1108
- function validateDynamicOpacityStops(unitsPerPixel, values, view) {
1112
+ function normalizeDynamicOpacityStops(unitsPerPixel, values, view) {
1109
1113
  if (!unitsPerPixel.length) {
1110
1114
  throw new ViewError(
1111
1115
  '"opacity.unitsPerPixel" must contain at least one stop.',
@@ -1131,14 +1135,28 @@ function validateDynamicOpacityStops(unitsPerPixel, values, view) {
1131
1135
  }
1132
1136
  });
1133
1137
 
1138
+ const pairs = unitsPerPixel.map((stop, index) => ({
1139
+ stop,
1140
+ value: values[index],
1141
+ }));
1142
+ pairs.sort((a, b) => b.stop - a.stop);
1143
+
1144
+ const sortedUnits = pairs.map((pair) => pair.stop);
1145
+ const sortedValues = pairs.map((pair) => pair.value);
1146
+
1134
1147
  for (let i = 1; i < unitsPerPixel.length; i++) {
1135
- if (unitsPerPixel[i - 1] <= unitsPerPixel[i]) {
1148
+ if (sortedUnits[i - 1] <= sortedUnits[i]) {
1136
1149
  throw new ViewError(
1137
1150
  '"opacity.unitsPerPixel" must be strictly decreasing.',
1138
1151
  view
1139
1152
  );
1140
1153
  }
1141
1154
  }
1155
+
1156
+ return {
1157
+ unitsPerPixel: sortedUnits,
1158
+ values: sortedValues,
1159
+ };
1142
1160
  }
1143
1161
 
1144
1162
  /**
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "contributors": [],
9
9
  "license": "MIT",
10
- "version": "0.69.0",
10
+ "version": "0.69.1",
11
11
  "jsdelivr": "dist/bundle/index.js",
12
12
  "unpkg": "dist/bundle/index.js",
13
13
  "browser": "dist/bundle/index.js",
@@ -67,5 +67,5 @@
67
67
  "devDependencies": {
68
68
  "@types/long": "^4.0.1"
69
69
  },
70
- "gitHead": "bfb9bd98ceb875f90a458b876208b15b6c12c9f3"
70
+ "gitHead": "bbbc1860a0730070d0a7c1ca7a9923d4a5d25366"
71
71
  }