diff --git a/.gitignore b/.gitignore index a1536f1..66f3997 100644 --- a/.gitignore +++ b/.gitignore @@ -158,4 +158,5 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. esbuild -.DS_Stores \ No newline at end of file +.DS_Stores +uv.lock \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..73ed500 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,19 @@ +# Development Notes + +## Setup + +Run `make install` to install esbuild (for bundling JavaScript) and project dependencies. + +## Building JavaScript + +After modifying files in `js/`, rebuild the bundles: + +```bash +./esbuild --bundle --format=esm --outfile=drawdata/static/scatter_widget.js js/scatter_widget.js +``` + +Or use `make js` for watch mode during development. + +## Dependencies + +**NEVER add dev tools (ruff, pytest, etc.) or demo-only dependencies (altair, etc.) to the main `dependencies` list in pyproject.toml.** The library should only depend on what it actually needs at runtime: anywidget. Pandas, polars, and numpy are lazy imports - users install them if they want those features. diff --git a/Makefile b/Makefile index 7e27ff9..7f08306 100644 --- a/Makefile +++ b/Makefile @@ -18,4 +18,5 @@ clean: docs: - marimo -y export html-wasm --output docs --mode edit demo.py + rm -rf docs + uv run marimo -y export html-wasm --output docs --mode edit demo.py diff --git a/demo.py b/demo.py index bbe7bf8..f0794a0 100644 --- a/demo.py +++ b/demo.py @@ -10,7 +10,7 @@ import marimo -__generated_with = "0.13.6" +__generated_with = "0.19.6" app = marimo.App(width="medium") @@ -24,19 +24,17 @@ def _(): @app.cell(hide_code=True) def _(mo): - mo.md( - r""" + mo.md(r""" # Drawing a `ScatterChart` This notebook contains a demo of the `ScatterWidget` inside of the [drawdata](https://github.com/koaning/drawdata) library. You should see that as you draw data, that the chart below updates. - """ - ) + """) return @app.cell(hide_code=True) def _(ScatterWidget, mo): - widget = mo.ui.anywidget(ScatterWidget(height=350)) + widget = mo.ui.anywidget(ScatterWidget(height=400, width=400)) widget return (widget,) @@ -62,32 +60,23 @@ def _(mo, widget): color="color", ) - top_hist = ( - base_bar - .encode( - alt.X("x:Q") - # when using bins, the axis scale is set through - # the bin extent, so we do not specify the scale here - # (which would be ignored anyway) - .bin(maxbins=30, extent=xscale.domain).stack(None).title(""), - alt.Y("count()").stack(None).title(""), - alt.Color("color:N", scale=colscale), - ) - .properties(height=60) - ) - - right_hist = ( - base_bar - .encode( - alt.Y("y:Q") - .bin(maxbins=30, extent=yscale.domain) - .stack(None) - .title(""), - alt.X("count()").stack(None).title(""), - alt.Color("color:N"), - ) - .properties(width=60) - ) + top_hist = base_bar.encode( + alt.X("x:Q") + # when using bins, the axis scale is set through + # the bin extent, so we do not specify the scale here + # (which would be ignored anyway) + .bin(maxbins=30, extent=xscale.domain) + .stack(None) + .title(""), + alt.Y("count()").stack(None).title(""), + alt.Color("color:N", scale=colscale), + ).properties(height=60) + + right_hist = base_bar.encode( + alt.Y("y:Q").bin(maxbins=30, extent=yscale.domain).stack(None).title(""), + alt.X("count()").stack(None).title(""), + alt.Color("color:N"), + ).properties(width=60) out = top_hist & (points | right_hist) diff --git a/docs/assets/ConnectedDataExplorerComponent-FS-m-lCY.js b/docs/assets/ConnectedDataExplorerComponent-FS-m-lCY.js deleted file mode 100644 index ec2f938..0000000 --- a/docs/assets/ConnectedDataExplorerComponent-FS-m-lCY.js +++ /dev/null @@ -1,22 +0,0 @@ -import{u as e,y as t,dd as n,j as r,de as i,df as o,dg as a,dh as s,L as c,di as l,dj as u,aj as d,d as f,T as p,dk as h,dl as g,dm as m,dn as y,dp as v,dq as b,dr as x,bK as E,ds as T,dt as S,du as N,S as w,ag as C,a2 as A,dv as O,dw as k,dx as M,aE as I,af as U,aC as F,E as D,ap as _,dy as j,aJ as P,dz as R,R as $}from"./index-D3XtisvU.js";import{U as B,e as L,V as W}from"./compile-CsTNKzEk.js";import{a as H}from"./VegaLite-D07JSyC_.js";import"./time-CJGz9Moa.js";import"./timer-DFzT7np-.js";import"./linear-BuATvq_r.js";import"./init-DLRA0X12.js";import"./range-CtcPcB_L.js";import"./zoom-COrs4lFh.js";import"./ordinal-DDUp3AbE.js";import"./colors-bszWmPJw.js";import"./arc-Cuwikxov.js";import"./step-BwsUM5iJ.js";import"./index-BelAJDbG.js"; -/** - * @license lucide-react v0.503.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q=e("chart-column-big",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]),G=e("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -function z(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);it&&l(),a=t=n+1):"]"===r&&(a||ne("Access path missing open bracket: "+e),a>0&&l(),a=0,t=n+1):n>t?l():t=n+1}return a&&ne("Access path missing closing bracket: "+e),o&&ne("Access path missing closing quote: "+e),n>t&&(n++,l()),i}const ie=Array.isArray;function oe(e){return e===Object(e)}function ae(e){return"string"==typeof e}function se(e){return ie(e)?"["+e.map(se)+"]":oe(e)||ae(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}var ce,le,ue,de=[];function fe(e,t,n){var r=[t].concat([].slice.call(n));console[e](...r)}le=re(ce="id"),ue="return _["+le.map(se).join("][")+"];",te(Function("_",ue),[ce=1===le.length?le[0]:ce],ce),te((function(e){return e}),de,"identity"),te((function(){return 0}),de,"zero"),te((function(){return 1}),de,"one"),te((function(){return!0}),de,"true"),te((function(){return!1}),de,"false");function pe(e){return"boolean"==typeof e}function he(e){for(var t={},n=0,r=e.length;nee(e))).join(",")})`};const ge=ee;function me(e,t){return e.indexOf(t)>-1}const ye=Object.keys;const ve="row",be="column",xe="facet",Ee="x",Te="y",Se="x2",Ne="y2",we="latitude",Ce="longitude",Ae="latitude2",Oe="longitude2",ke="color",Me="fill",Ie="stroke",Ue="shape",Fe="size",De="opacity",_e="fillOpacity",je="strokeOpacity",Pe="strokeWidth",Re="text",$e="order",Be="detail",Le="key",We="tooltip",He="href",qe=Object.assign({},{x:1,y:1,x2:1,y2:1},{longitude:1,longitude2:1,latitude:1,latitude2:1},{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1});function Ge(e){return"color"===e||"fill"===e||"stroke"===e}const ze=Object.assign({},qe,{row:1,column:1,facet:1}),Ye=ye(ze),{order:Qe,detail:Ve}=ze;z(ze,["order","detail"]);const{order:Ke,detail:Je,row:Xe,column:Ze,facet:et}=ze;z(ze,["order","detail","row","column","facet"]);const{x:tt,y:nt,x2:rt,y2:it,latitude:ot,longitude:at,latitude2:st,longitude2:ct}=qe,lt=z(qe,["x","y","x2","y2","latitude","longitude","latitude2","longitude2"]),ut=ye(lt),{text:dt,tooltip:ft,href:pt,detail:ht,key:gt,order:mt}=lt,yt=z(lt,["text","tooltip","href","detail","key","order"]),vt=Object.assign({},{x:1,y:1},yt);function bt(e,t){return function(e){switch(e){case ke:case Me:case Ie:case Be:case Le:case We:case He:case $e:case De:case _e:case je:case Pe:case xe:case ve:case be:return xt;case Ee:case Te:case we:case Ce:return Tt;case Se:case Ne:case Ae:case Oe:return{rule:"always",bar:"always",rect:"always",area:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Fe:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Ue:return{point:"always",geoshape:"always"};case Re:return{text:"always"}}}(e)[t]}const xt={area:"always",bar:"always",circle:"always",geoshape:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:Et}=xt,Tt=z(xt,["geoshape"]);function St(e){switch(e){case Ee:case Te:case Fe:case Pe:case De:case _e:case je:case Se:case Ne:return;case xe:case ve:case be:case Ue:case Re:case We:case He:return"discrete";case ke:case Me:case Ie:return"flexible";case we:case Ce:case Ae:case Oe:case Be:case Le:case $e:return}throw new Error("rangeType not implemented for "+e)}const Nt={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,values:1,zindex:1},wt=Object.assign({},Nt,{encoding:1});Object.assign({gridScale:1,scale:1},Nt,{encode:1});const Ct=ye(wt),At={clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1};Object.assign({},At,{opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,encode:1});const Ot=ye(At);const kt=Object.freeze(Object.defineProperty({__proto__:null,BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL:"Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.",CANNOT_FIX_RANGE_STEP_WITH_FIT:'Cannot use a fixed value of "rangeStep" when "autosize" is "fit".',CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:"custom domain scale cannot be unioned with default field-based domain",CONCAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).",FIT_NON_SINGLE:'Autosize "fit" only works for single views and layered views.',INVALID_CHANNEL_FOR_AXIS:"Invalid channel for axis.",INVALID_SPEC:"Invalid spec",LINE_WITH_VARYING_SIZE:"Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.",MORE_THAN_ONE_SORT:"Domains that should be unioned has conflicting sort properties. Sort will be set to true.",NO_FIELDS_NEEDS_AS:'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.',NO_INIT_SCALE_BINDINGS:"Selections bound to scales cannot be separately initialized.",REPEAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).",SCALE_BINDINGS_CONTINUOUS:"Scale bindings are currently only supported for scales with unbinned, continuous domains.",UNABLE_TO_MERGE_DOMAINS:"Unable to merge domains",cannotApplySizeToNonOrientedMark:function(e){return`Cannot apply size to non-oriented mark "${e}".`},cannotProjectOnChannelWithoutField:function(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`},cannotStackNonLinearScale:function(e){return`Cannot stack non-linear scale (${e})`},cannotStackRangedMark:function(e){return`Cannot stack "${e}" if there is already "${e}2"`},cannotUseScalePropertyWithNonColor:function(e){return`Cannot use the scale property "${e}" with non-color channel.`},channelRequiredForBinned:function(e){return`Channel ${e} is required for "binned" bin`},columnsNotSupportByRowCol:function(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`},dayReplacedWithDate:function(e){return`Time unit "${e}" is not supported. We are replacing it with ${e.replace("day","date")}.`},differentParse:function(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`},discreteChannelCannotEncode:function(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`},domainRequiredForThresholdScale:function(e){return`Domain for ${e} is required for threshold scale`},domainSortDropped:function(e){return`Dropping sort property ${ge(e)} as unioned domains only support boolean or op 'count'.`},droppedDay:function(e){return`Dropping day from datetime ${ge(e)} as day cannot be combined with other units.`},droppingColor:function(e,t){const{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has `+(n&&r?"fill and stroke":n?"fill":"stroke")},emptyFieldDef:function(e,t){return`Dropping ${ge(e)} from channel "${t}" since it does not contain data field or value.`},encodingOverridden:function(e){return`Layer's shared ${e.join(",")} channel ${1===e.length?"is":"are"} overriden`},errorBand1DNotSupport:function(e){return`1D error band does not support ${e}`},errorBarCenterAndExtentAreNotNeeded:function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`},errorBarCenterIsNotNeeded:function(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`},errorBarCenterIsUsedWithWrongExtent:function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`},errorBarContinuousAxisHasCustomizedAggregate:function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`},facetChannelDropped:function(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`},facetChannelShouldBeDiscrete:function(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`},incompatibleChannel:function(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`},independentScaleMeansIndependentGuide:function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`},invalidAggregate:function(e){return`Invalid aggregation operator "${e}"`},invalidEncodingChannel:function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`},invalidFieldType:function(e){return`Invalid field type "${e}"`},invalidFieldTypeForCountAggregate:function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`},invalidTimeUnit:function(e,t){return`Invalid ${e}: ${ge(t)}`},invalidTransformIgnored:function(e){return`Ignoring an invalid transform: ${ge(e)}.`},latLongDeprecated:function(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`},lineWithRange:function(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`},mergeConflictingDomainProperty:function(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${ge(n)} and ${ge(r)}). Using the union of the two domains.`},mergeConflictingProperty:function(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${ge(n)} and ${ge(r)}). Using ${ge(n)}.`},missingFieldType:function(e,t){return`Missing type for channel "${e}", using "${t}" instead.`},nearestNotSupportForContinuous:function(e){return`The "nearest" transform is not supported for ${e} marks.`},noSuchRepeatedValue:function(e){return`Unknown repeated value "${e}".`},nonZeroScaleUsedWithLengthMark:function(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?"scale with zero=false":"scale with custom domain that excludes zero"} is used to encode ${e}'s ${t}. This can be misleading as the ${"x"===t?"width":"height"} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`},orientOverridden:function(e,t){return`Specified orient "${e}" overridden with "${t}"`},primitiveChannelDef:function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${ge(n)}}.`},projectionOverridden:function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${ge(t)} is overridden by a child projection ${ge(n)}.`},rangeStepDropped:function(e){return`rangeStep for "${e}" is dropped as top-level ${"x"===e?"width":"height"} is provided.`},scalePropertyNotWorkWithScaleType:function(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`},scaleTypeNotWorkWithChannel:function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`},scaleTypeNotWorkWithFieldDef:function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`},scaleTypeNotWorkWithMark:function(e,t){return`Scale type "${t}" does not work with mark "${e}".`},selectionNotFound:function(e){return`Cannot find a selection named "${e}"`},selectionNotSupported:function(e){return`Selection not supported for ${e} yet`},stackNonSummativeAggregate:function(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}")`},unaggregateDomainHasNoEffectForRawField:function(e){return`Using unaggregated domain with raw field has no effect (${ge(e)}).`},unaggregateDomainWithNonSharedDomainOp:function(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`},unaggregatedDomainWithLogScale:function(e){return`Unaggregated domain is currently unsupported for log scale (${ge(e)}).`},unrecognizedParse:function(e){return`Unrecognized parse "${e}".`}},Symbol.toStringTag,{value:"Module"})),Mt=kt;var It;let Ut=(It=2||0,{level:function(e){return arguments.length?(It=+e,this):It},error:function(){return It>=1&&fe("error","ERROR",arguments),this},warn:function(){return It>=2&&fe("warn","WARN",arguments),this},info:function(){return It>=3&&fe("log","INFO",arguments),this},debug:function(){return It>=4&&fe("log","DEBUG",arguments),this}});function Ft(...e){Ut.warn.apply(Ut,arguments)}const Dt={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},_t="quantitative",jt="ordinal",Pt="temporal",Rt="nominal";var $t,Bt;(Bt=$t||($t={})).LINEAR="linear",Bt.LOG="log",Bt.POW="pow",Bt.SQRT="sqrt",Bt.SYMLOG="symlog",Bt.TIME="time",Bt.UTC="utc",Bt.QUANTILE="quantile",Bt.QUANTIZE="quantize",Bt.THRESHOLD="threshold",Bt.BIN_ORDINAL="bin-ordinal",Bt.ORDINAL="ordinal",Bt.POINT="point",Bt.BAND="band";const Lt=ye({linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"}),Wt=["linear","log","pow","sqrt","symlog","time","utc"],Ht=he(Wt),qt=he(["quantile","quantize","threshold"]),Gt=he(Wt.concat(["quantile","quantize","threshold"])),zt=he(["ordinal","bin-ordinal","point","band"]);function Yt(e){return e in zt}function Qt(e){return e in Ht}const Vt={type:1,domain:1,align:1,range:1,rangeStep:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},Kt=ye(Vt),{type:Jt,domain:Xt,range:Zt,rangeStep:en,scheme:tn}=Vt;function nn(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!me(["point","band","identity"],e);case"bins":return!me(["point","band","identity","ordinal"],e);case"round":return Qt(e)||"band"===e||"point"===e;case"padding":return Qt(e)||me(["point","band"],e);case"paddingOuter":case"rangeStep":case"align":return me(["point","band"],e);case"paddingInner":return"band"===e;case"clamp":return Qt(e);case"nice":return Qt(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return e in Gt&&!me(["log","time","utc","threshold","quantile"],e)}}function rn(e,t){switch(t){case"interpolate":case"scheme":return Ge(e)?void 0:Mt.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeStep":case"reverse":case"round":case"clamp":case"zero":return}}function on(e,t){return me([jt,Rt],t)?void 0===e||Yt(e):t===Pt?me([$t.TIME,$t.UTC,void 0],e):t!==_t||me([$t.LOG,$t.POW,$t.SQRT,$t.SYMLOG,$t.QUANTILE,$t.QUANTIZE,$t.THRESHOLD,$t.LINEAR,void 0],e)}function an(e,t){switch(e){case Ee:case Te:return Qt(t)||me(["band","point"],t);case Fe:case Pe:case De:case _e:case je:return Qt(t)||t in qt||me(["band","point"],t);case ke:case Me:case Ie:return"band"!==t;case Ue:return"ordinal"===t}return!1}function sn(e,t){return e+"_"+t}z(Vt,["type","domain","range","rangeStep","scheme"]),function(){const e={};for(const t of Ye)for(const n of ye(Dt))for(const r of Lt){const i=sn(t,n);an(t,r)&&on(r,n)&&(e[i]=e[i]||[],e[i].push(r))}}();var cn,ln={exports:{}};function un(){return cn||(cn=1,function(){var e=ln.exports,t="__name__";e.namedfunc=function(e,n){return n[t]=e,n},e.name=function(e){return null==e?null:e[t]},e.identity=function(e){return e},e.true=e.namedfunc("true",(function(){return!0})),e.false=e.namedfunc("false",(function(){return!1})),e.duplicate=function(e){return JSON.parse(JSON.stringify(e))},e.equal=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},e.extend=function(e){for(var t,n,r=1,i=arguments.length;r1?function(e,t){for(var r=0;rt||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0)},e.numcmp=function(e,t){return e-t},e.stablesort=function(e,t,n){var r=e.reduce((function(e,t,r){return e[n(t)]=r,e}),{});return e.sort((function(e,i){var o=t(e),a=t(i);return oa?1:r[n(e)]-r[n(i)]})),e},e.permute=function(e){for(var t,n,r=e.length;r;)n=Math.floor(Math.random()*r--),t=e[r],e[r]=e[n],e[n]=t},e.pad=function(e,t,n,r){r=r||" ";var o=t-e.length;if(o<=0)return e;switch(n){case"left":return i(o,r)+e;case"middle":case"center":return i(Math.floor(o/2),r)+e+i(Math.ceil(o/2),r);default:return e+i(o,r)}},e.truncate=function(e,t,n,r,i){var a=e.length;if(a<=t)return e;i=void 0!==i?String(i):"…";var s=Math.max(0,t-i.length);switch(n){case"left":return i+(r?o(e,s,1):e.slice(a-s));case"middle":case"center":var c=Math.ceil(s/2),l=Math.floor(s/2);return(r?o(e,c):e.slice(0,c))+i+(r?o(e,l,1):e.slice(a-l));default:return(r?o(e,s):e.slice(0,s))+i}};var a=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/}()),ln.exports}var dn=un();function fn(e,t){return-1!==e.indexOf(t)}function pn(e,t){for(let n=0;n({parent:"bin",child:e}))),Sn=["field","op","order"].map((e=>({parent:"sort",child:e}))),Nn=Kt.map((e=>({parent:"scale",child:e}))),wn=Ct.map((e=>({parent:"axis",child:e}))),Cn=Ot.map((e=>({parent:"legend",child:e}))),An=[].concat(Tn,Sn,Nn,wn,Cn),On=["width","height","background","padding","title"];function kn(e){return mn(e)?e.parent+"."+e.child:e}const Mn=An.reduce(((e,t)=>(e[t.parent]=e[t.parent]||[],e[t.parent][t.child]=t,e)),{});function In(e,t){return(Mn[e]||{})[t]}function Un(e){return function(e){return e in yn}(e)||mn(e)}const Fn=[].concat(vn,An),Dn=["type","field","bin","timeUnit","aggregate","autoCount","channel","mark","stack","scale","sort","axis","legend"].concat(Tn,Nn,wn,Cn,Sn);var _n,jn;(jn=_n||(_n={})).MARK="mark",jn.TRANSFORM="transform",jn.STACK="stack",jn.FORMAT="format",jn.CHANNEL="channel",jn.AGGREGATE="aggregate",jn.AUTOCOUNT="autoCount",jn.BIN="bin",jn.HAS_FN="hasFn",jn.TIMEUNIT="timeUnit",jn.FIELD="field",jn.TYPE="type",jn.SORT="sort",jn.SCALE="scale",jn.AXIS="axis",jn.LEGEND="legend",jn.WIDTH="width",jn.HEIGHT="height",jn.BACKGROUND="background",jn.PADDING="padding",jn.TITLE="title";const Pn="area",Rn="bar",$n="line",Bn="point",Ln="rect",Wn="rule",Hn="text",qn="tick",Gn="circle",zn="square";function Yn(e){return me(["line","area","trail"],e)}he(ye({area:1,bar:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1}));["january","february","march","april","may","june","july","august","september","october","november","december"].map((e=>e.substr(0,3)));var Qn,Vn;["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].map((e=>e.substr(0,3))),(Vn=Qn||(Qn={})).YEAR="year",Vn.MONTH="month",Vn.DAY="day",Vn.DATE="date",Vn.HOURS="hours",Vn.MINUTES="minutes",Vn.SECONDS="seconds",Vn.MILLISECONDS="milliseconds",Vn.YEARMONTH="yearmonth",Vn.YEARMONTHDATE="yearmonthdate",Vn.YEARMONTHDATEHOURS="yearmonthdatehours",Vn.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",Vn.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",Vn.MONTHDATE="monthdate",Vn.MONTHDATEHOURS="monthdatehours",Vn.HOURSMINUTES="hoursminutes",Vn.HOURSMINUTESSECONDS="hoursminutesseconds",Vn.MINUTESSECONDS="minutesseconds",Vn.SECONDSMILLISECONDS="secondsmilliseconds",Vn.QUARTER="quarter",Vn.YEARQUARTER="yearquarter",Vn.QUARTERMONTH="quartermonth",Vn.YEARQUARTERMONTH="yearquartermonth",Vn.UTCYEAR="utcyear",Vn.UTCMONTH="utcmonth",Vn.UTCDAY="utcday",Vn.UTCDATE="utcdate",Vn.UTCHOURS="utchours",Vn.UTCMINUTES="utcminutes",Vn.UTCSECONDS="utcseconds",Vn.UTCMILLISECONDS="utcmilliseconds",Vn.UTCYEARMONTH="utcyearmonth",Vn.UTCYEARMONTHDATE="utcyearmonthdate",Vn.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",Vn.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",Vn.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",Vn.UTCMONTHDATE="utcmonthdate",Vn.UTCMONTHDATEHOURS="utcmonthdatehours",Vn.UTCHOURSMINUTES="utchoursminutes",Vn.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",Vn.UTCMINUTESSECONDS="utcminutesseconds",Vn.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",Vn.UTCQUARTER="utcquarter",Vn.UTCYEARQUARTER="utcyearquarter",Vn.UTCQUARTERMONTH="utcquartermonth",Vn.UTCYEARQUARTERMONTH="utcyearquartermonth";const Kn={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Jn=ye(Kn);const Xn={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};const Zn={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},er=Object.assign({},Xn,Zn);const tr=Object.assign({},Kn,Xn,{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1},Zn);const nr={year:"setFullYear",month:"setMonth",date:"setDate",hours:"setHours",minutes:"setMinutes",seconds:"setSeconds",milliseconds:"setMilliseconds",quarter:null,day:null};function rr(e,t){const n=!!er[e];const r=n?new Date(Date.UTC(1972,0,1,0,0,0,0)):new Date(1972,0,1,0,0,0,0);for(const i of Jn)if(or(e,i))switch(i){case Qn.DAY:throw new Error("Cannot convert to TimeUnits containing 'day'");case Qn.QUARTER:{const{getDateMethod:e,setDateMethod:i}=ir("month",n);r[i](3*Math.floor(t[e]()/3));break}default:{const{getDateMethod:e,setDateMethod:o}=ir(i,n);r[o](t[e]())}}return r}function ir(e,t){const n=nr[e];return{setDateMethod:t?"setUTC"+n.substr(3):n,getDateMethod:"get"+(t?"UTC":"")+n.substr(3)}}function or(e,t){const n=e.indexOf(t);return n>-1&&(t!==Qn.SECONDS||0===n||"i"!==e.charAt(n-1))}const ar="?";function sr(e){return cr(e)||function(e){return!(void 0===e||null==e||!e.enum&&!e.name||dn.isArray(e))}(e)}function cr(e){return e===ar}function lr(e,t,n){return dn.extend({},{name:t,enum:n},e===ar?{}:e)}function ur(e){let t={},n={};for(const r of e){const e=[0];for(let t=0;tr.charAt(e))).join("").toLowerCase();if(n[i])if(e[e.length-1]===r.length-1||(i=e.concat([r.length-1]).map((e=>r.charAt(e))).join("").toLowerCase(),n[i]))for(let o=1;!t[r];o++){let e=i+"_"+o;if(!n[e]){t[r]=e,n[e]=!0;break}}else t[r]=i,n[i]=!0;else t[r]=i,n[i]=!0}return t}const dr={mark:"m",channel:"c",aggregate:"a",autoCount:"#",hasFn:"h",bin:"b",sort:"so",stack:"st",scale:"s",format:"f",axis:"ax",legend:"l",value:"v",timeUnit:"tu",field:"f",type:"t",binProps:{maxbins:"mb",min:"mi",max:"ma",base:"b",step:"s",steps:"ss",minstep:"ms",divide:"d"},sortProps:{field:"f",op:"o",order:"or"},scaleProps:ur(Kt),axisProps:ur(Ct),legendProps:ur(Ot)};function fr(e){if(mn(e))return dr[e.parent]+"-"+dr[e.parent+"Props"][e.child];if(dr[e])return dr[e];throw new Error("Default name undefined for "+e)}const pr=[!1,!0],hr={type:[void 0,$t.LOG],domain:[void 0],base:[void 0],exponent:[1,2],constant:[void 0],bins:[void 0],clamp:pr,nice:pr,reverse:pr,round:pr,zero:pr,padding:[void 0],paddingInner:[void 0],paddingOuter:[void 0],interpolate:[void 0],range:[void 0],rangeStep:[17,21],scheme:[void 0]},gr={zindex:[1,0],offset:[void 0],orient:[void 0],values:[void 0],bandPosition:[void 0],encoding:[void 0],domain:pr,domainColor:[void 0],domainDash:[void 0],domainDashOffset:[void 0],domainOpacity:[void 0],domainWidth:[void 0],formatType:[void 0],grid:pr,gridColor:[void 0],gridDash:[void 0],gridDashOffset:[void 0],gridOpacity:[void 0],gridWidth:[void 0],format:[void 0],labels:pr,labelAlign:[void 0],labelAngle:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFlushOffset:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOpacity:[void 0],labelSeparation:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelBound:[void 0],labelFlush:[void 0],maxExtent:[void 0],minExtent:[void 0],position:[void 0],ticks:pr,tickColor:[void 0],tickCount:[void 0],tickDash:[void 0],tickExtra:[void 0],tickDashOffset:[void 0],tickMinStep:[void 0],tickOffset:[void 0],tickOpacity:[void 0],tickRound:[void 0],tickSize:[void 0],tickWidth:[void 0],title:[void 0],titleAlign:[void 0],titleAnchor:[void 0],titleAngle:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titlePadding:[void 0],titleX:[void 0],titleY:[void 0]},mr={mark:[Bn,Rn,$n,Pn,Ln,qn,Hn],channel:[Ee,Te,ve,be,Fe,ke],aggregate:[void 0,"mean"],autoCount:pr,bin:pr,hasFn:pr,timeUnit:[void 0,Qn.YEAR,Qn.MONTH,Qn.MINUTES,Qn.SECONDS],field:[void 0],type:[Rt,jt,_t,Pt],sort:["ascending","descending"],stack:["zero","normalize","center",null],value:[void 0],format:[void 0],title:[void 0],scale:[!0],axis:pr,legend:pr,binProps:{maxbins:[5,10,20],extent:[void 0],base:[10],step:[void 0],steps:[void 0],minstep:[void 0],divide:[[5,2]],binned:[!1],anchor:[void 0],nice:[!0]},sortProps:{field:[void 0],op:["min","mean"],order:["ascending","descending"]},scaleProps:hr,axisProps:gr,legendProps:{orient:["left","right"],format:[void 0],type:[void 0],values:[void 0],zindex:[void 0],clipHeight:[void 0],columnPadding:[void 0],columns:[void 0],cornerRadius:[void 0],direction:[void 0],encoding:[void 0],fillColor:[void 0],formatType:[void 0],gridAlign:[void 0],offset:[void 0],padding:[void 0],rowPadding:[void 0],strokeColor:[void 0],labelAlign:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOffset:[void 0],labelOpacity:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelSeparation:[void 0],legendX:[void 0],legendY:[void 0],gradientLength:[void 0],gradientOpacity:[void 0],gradientStrokeColor:[void 0],gradientStrokeWidth:[void 0],gradientThickness:[void 0],symbolDash:[void 0],symbolDashOffset:[void 0],symbolFillColor:[void 0],symbolOffset:[void 0],symbolOpacity:[void 0],symbolSize:[void 0],symbolStrokeColor:[void 0],symbolStrokeWidth:[void 0],symbolType:[void 0],tickCount:[void 0],tickMinStep:[void 0],title:[void 0],titleAnchor:[void 0],titleAlign:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titleOrient:[void 0],titlePadding:[void 0]}};function yr(e,t,n){if("field"===e||mn(e)&&"sort"===e.parent&&"field"===e.child)return t.fieldNames();let r;if(r=mn(e)?n.enum[e.parent+"Props"][e.child]:n.enum[e],void 0!==r)return r;throw new Error("No default enumValues for "+JSON.stringify(e))}const vr={verbose:!1,defaultSpecConfig:{line:{point:!0},scale:{useUnaggregatedDomain:!0}},propertyPrecedence:Dn.map(kn),enum:mr,numberNominalProportion:.05,numberNominalLimit:40,constraintManuallySpecifiedValue:!1,autoAddCount:!1,hasAppropriateGraphicTypeForMark:!0,omitAggregate:!1,omitAggregatePlotWithDimensionOnlyOnFacet:!0,omitAggregatePlotWithoutDimension:!1,omitBarLineAreaWithOcclusion:!0,omitBarTickWithSize:!0,omitMultipleNonPositionalChannels:!0,omitRaw:!1,omitRawContinuousFieldForAggregatePlot:!0,omitRepeatedField:!0,omitNonPositionalOrFacetOverPositionalChannels:!0,omitTableWithOcclusionIfAutoAddCount:!0,omitVerticalDotPlot:!1,omitInvalidStackSpec:!0,omitNonSumStack:!0,preferredBinAxis:Ee,preferredTemporalAxis:Ee,preferredOrdinalAxis:Te,preferredNominalAxis:Te,preferredFacet:ve,minCardinalityForBin:15,maxCardinalityForCategoricalColor:20,maxCardinalityForFacet:20,maxCardinalityForShape:6,timeUnitShouldHaveVariation:!0,typeMatchesSchemaType:!0,stylize:!0,smallRangeStepForHighCardinalityOrFacet:{maxCardinality:10,rangeStep:12},nominalColorScaleForHighCardinality:{maxCardinality:10,palette:"category20"},xAxisOnTopForHighYCardinalityWithoutColumn:{maxCardinality:30},maxGoodCardinalityForFacet:5,maxGoodCardinalityForColor:7,minPercentUniqueForKey:.8,minCardinalityForKey:50},br={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1};const xr=["count","sum","distinct","valid","missing"];function Er(e){return pe(e)&&(e=function(e,t){return pe(e)?{maxbins:Sr(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign({},e,{maxbins:Sr(t)})}(e,void 0)),"bin"+ye(e).map((t=>function(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}(`_${t}_${e[t]}`))).join("")}function Tr(e){return!0===e||function(e){return oe(e)}(e)&&!e.binned}function Sr(e){switch(e){case ve:case be:case Fe:case ke:case Me:case Ie:case Pe:case De:case _e:case je:case Ue:return 6;default:return 10}}function Nr(e){return!!e&&!!e.condition&&!ie(e.condition)&&wr(e.condition)}function wr(e){return!(!e||!e.field&&"count"!==e.aggregate)}function Cr(e){return wr(e)&&ae(e.field)}function Ar(e,t={}){let n=e.field;const r=t.prefix;let i=t.suffix,o="";if(function(e){return"count"===e.aggregate}(e))n=function(e){return 0===e.indexOf("__")}(s="count")?s:`__${s}`;else{let r;if(!t.nofn)if(function(e){return!!e.op}(e))r=e.op;else{const{bin:s,aggregate:c,timeUnit:l}=e;Tr(s)?(r=Er(s),i=(t.binSuffix||"")+(t.suffix||"")):c?(a=c)&&a.argmax?(o=`.${n}`,n=`argmax_${c.argmax}`):!function(e){return!!e&&!!e.argmin}(c)?r=String(c):(o=`.${n}`,n=`argmin_${c.argmin}`):l&&(r=String(l))}r&&(n=n?`${r}_${n}`:r)}var a,s;return i&&(n=`${n}_${i}`),r&&(n=`${r}_${n}`),t.forAs?n:t.expr?function(e,t="datum"){return`${t}[${se(re(e).join("."))}]`}(n,t.expr)+o:function(e){return`${re(e).map((e=>e.replace(".","\\."))).join("\\.")}`}(n)+o}function Or(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"temporal":return!1}throw new Error(Mt.invalidFieldType(e.type))}he(["mean","average","median","q1","q3","min","max"]);const kr={compatible:!0};function Mr(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case"row":case"column":case"facet":return function(e){return!Or(e)}(e)?{compatible:!1,warning:Mt.facetChannelShouldBeDiscrete(t)}:kr;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":return kr;case"longitude":case"longitude2":case"latitude":case"latitude2":return n!==_t?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:kr;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return"nominal"!==n||e.sort?kr:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"shape":return me(["ordinal","nominal","geojson"],e.type)?kr:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return"nominal"!==e.type||"sort"in e?kr:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+t)}function Ir(e,t,n,r){const i=function(e,t,n){switch(t.type){case"nominal":case"ordinal":return Ge(e)||"discrete"===St(e)?("shape"===e&&"ordinal"===t.type&&Ft(Mt.discreteChannelCannotEncode(e,"ordinal")),"ordinal"):me(["x","y"],e)&&me(["rect","bar","rule"],n)?"band":"point";case"temporal":return Ge(e)?"time":"discrete"===St(e)?(Ft(Mt.discreteChannelCannotEncode(e,"temporal")),"ordinal"):"time";case"quantitative":return Ge(e)?Tr(t.bin)?"bin-ordinal":"linear":"discrete"===St(e)?(Ft(Mt.discreteChannelCannotEncode(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(Mt.invalidFieldType(t.type))}(t,n,r),{type:o}=e;return function(e){return!!vt[e]}(t)?void 0!==o?an(t,o)?on(o,n.type)?o:(Ft(Mt.scaleTypeNotWorkWithFieldDef(o,i)),i):(Ft(Mt.scaleTypeNotWorkWithChannel(t,o,i)),i):i:null}var Ur,Fr;function Dr(e){return e===jt||e===Rt||e===Ur.KEY}(Fr=Ur||(Ur={})).QUANTITATIVE=_t,Fr.ORDINAL=jt,Fr.TEMPORAL=Pt,Fr.NOMINAL=Rt,Fr.KEY="key";class _r{constructor(e=null){this.index=e?Object.assign({},e):{}}has(e){return kn(e)in this.index}get(e){return this.index[kn(e)]}set(e,t){return this.index[kn(e)]=t,this}setByKey(e,t){this.index[e]=t}map(e){const t=new _r;for(const n in this.index)t.index[n]=e(this.index[n]);return t}size(){return dn.keys(this.index).length}duplicate(){return new _r(this.index)}}function jr(e,t){const n=e&&e[t];return!!n&&(ie(n)?function(e,t){let n=0;for(const[r,i]of e.entries())if(t(i,r,n++))return!0;return!1}(n,(e=>!!e.field)):wr(n)||Nr(n))}const Pr={zero:1,center:1,normalize:1};const Rr=[Rn,Pn,Wn,Bn,Gn,zn,$n,Hn,qn],$r=[Rn,Pn];function Br(e,t,n,r={}){const i=function(e){return e.type}(e)?e.type:e;if(!me(Rr,i))return null;const o=function(e){const t=e.x,n=e.y;if(wr(t)&&wr(n))if("quantitative"===t.type&&"quantitative"===n.type){if(t.stack)return"x";if(n.stack)return"y";if(!!t.aggregate!=!!n.aggregate)return t.aggregate?"x":"y"}else{if("quantitative"===t.type)return"x";if("quantitative"===n.type)return"y"}else{if(wr(t)&&"quantitative"===t.type)return"x";if(wr(n)&&"quantitative"===n.type)return"y"}}(t);if(!o)return null;const a=t[o],s=Cr(a)?Ar(a,{}):void 0,c="x"===o?"y":"x",l=t[c],u=Cr(l)?Ar(l,{}):void 0,d=ut.reduce(((e,n)=>{if("tooltip"!==n&&jr(t,n)){const r=t[n];(ie(r)?r:[r]).forEach((t=>{const r=function(e){return wr(e)?e:Nr(e)?e.condition:void 0}(t);if(r.aggregate)return;const i=Cr(r)?Ar(r,{}):void 0;(!i||i!==u&&i!==s)&&e.push({channel:n,fieldDef:r})}))}return e}),[]);let f;if(void 0!==a.stack?f=pe(a.stack)?a.stack?"zero":null:a.stack:d.length>0&&(f=me($r,i)?function(...e){for(const t of e)if(void 0!==t)return t}(n,"zero"):n),!f||!Pr[f])return null;if(a.scale&&a.scale.type&&a.scale.type!==$t.LINEAR){if(r.disallowNonLinearStack)return null;Ft(Mt.cannotStackNonLinearScale(a.scale.type))}return jr(t,o===Ee?Se:Ne)?(void 0!==a.stack&&Ft(Mt.cannotStackRangedMark(o)),null):(a.aggregate&&!me(xr,a.aggregate)&&Ft(Mt.stackNonSummativeAggregate(a.aggregate)),{groupbyChannel:l?c:void 0,fieldChannel:o,impute:Yn(i),stackBy:d,offset:f})}function Lr(e){if(!function(e){if(sr(e.mark))return!1;const t=[_n.STACK,_n.CHANNEL,_n.MARK,_n.FIELD,_n.AGGREGATE,_n.AUTOCOUNT,_n.SCALE,In("scale","type"),_n.TYPE],n=dn.toMap((i=Fn,o=t,i.filter((function(e){return!fn(o,e)})))),r=e.encodings.filter((e=>!ri(e)));var i,o;for(const a of r)if(Wr(a,{exclude:n}))return!1;return!0}(e))return null;const t=ai(e.encodings,{schema:null,wildcardMode:"null"});return Br(e.mark,t,void 0,{disallowNonLinearStack:!0})}function Wr(e,t={}){if(!dn.isObject(e))return!1;for(const n in e)if(e.hasOwnProperty(n)){if(sr(e[n])&&(!t.exclude||!t.exclude[n])||Wr(e[n],t))return!0}return!1}function Hr(e){return e.map((e=>{return t=e,e=>void 0!==t[e]?t[e]:e;var t}))}function qr(e,t){return sr(e)?!cr(e)&&e.enum?ar+JSON.stringify(e.enum):ar:t?t(e):e}function Gr(e,t){return t?t(e):e}const zr=new _r,Yr=[].concat(Dn,Sn,[_n.TRANSFORM,_n.STACK],On).reduce(((e,t)=>e.set(t,!0)),new _r),Qr={axis:{x:!0,y:!0,row:!0,column:!0},legend:{color:!0,opacity:!0,size:!0,shape:!0},scale:{x:!0,y:!0,color:!0,opacity:!0,row:!0,column:!0,size:!0,shape:!0},sort:{x:!0,y:!0,path:!0,order:!0},stack:{x:!0,y:!0}};function Vr(e,t=Yr,n=zr){const r=[];let i;if(t.get(_n.MARK)&&r.push(qr(e.mark,n.get(_n.MARK))),e.transform&&e.transform.length>0&&r.push("transform:"+JSON.stringify(e.transform)),t.get(_n.STACK)&&(i=Lr(e)),e.encodings){const o=e.encodings.reduce(((e,r)=>{if(!ri(r)){let o;o=i&&r.channel===i.fieldChannel?Kr(Object.assign({},r,{stack:i.offset}),t,n):Kr(r,t,n),o&&e.push(o)}return e}),[]).sort().join("|");o&&r.push(o)}for(let o of On){const n=o.toString();if(t.get(o)&&e[n]){const t=e[n];r.push(`${n}=${JSON.stringify(t)}`)}}return r.join("|")}function Kr(e,t=Yr,n=zr){const r=[];if(t.get(_n.CHANNEL)&&r.push(qr(e.channel,n.get(_n.CHANNEL))),ti(e)){const i=Jr(e,t,n);i&&r.push(i)}else ei(e)?r.push(e.value):ni(e)&&r.push("autocount()");return r.join(":")}function Jr(e,t=Yr,n=zr){if(t.get(_n.AGGREGATE)&&ri(e))return"-";const r=function(e,t,n){if(t.get(_n.AGGREGATE)&&e.aggregate&&!sr(e.aggregate))return Gr(e.aggregate,n.get(_n.AGGREGATE));if(t.get(_n.AGGREGATE)&&ii(e))return Gr("count",n.get(_n.AGGREGATE));if(t.get(_n.TIMEUNIT)&&e.timeUnit&&!sr(e.timeUnit))return Gr(e.timeUnit,n.get(_n.TIMEUNIT));if(t.get(_n.BIN)&&e.bin&&!sr(e.bin))return"bin";{let n=null;for(const r of[_n.AGGREGATE,_n.AUTOCOUNT,_n.TIMEUNIT,_n.BIN]){const i=e[r];t.get(r)&&e[r]&&sr(i)&&(n=n||{},n[r]=cr(i)?i:i.enum)}return n&&e.hasFn&&(n.hasFn=!0),n}}(e,t,n),i=function(e,t,n){const r=[];if(!dn.isBoolean(e.bin)&&!cr(e.bin)){const i=e.bin;for(const e in i){const o=In("bin",e);o&&t.get(o)&&void 0!==i[e]&&r.push({key:e,value:qr(i[e],n.get(o))})}r.sort(((e,t)=>e.key.localeCompare(t.key)))}for(const i of[_n.SCALE,_n.SORT,_n.STACK,_n.AXIS,_n.LEGEND])if((sr(e.channel)||Qr[i][e.channel])&&t.get(i)&&void 0!==e[i]){const o=e[i];if(dn.isBoolean(o)||null===o)r.push({key:i+"",value:o||!1});else if(dn.isString(o))r.push({key:i+"",value:Gr(JSON.stringify(o),n.get(i))});else{let e=[];for(const r in o){const a=In(i,r);a&&t.get(a)&&void 0!==o[r]&&e.push({key:r,value:qr(o[r],n.get(a))})}if(e.length>0){const t=e.sort(((e,t)=>e.key.localeCompare(t.key))).reduce(((e,t)=>(e[t.key]=t.value,e)),{});r.push({key:i+"",value:JSON.stringify(t)})}}}return r}(e,t,n);let o;if(ti(e)){if(o=t.get("field")?qr(e.field,n.get("field")):"...",t.get(_n.TYPE))if(sr(e.type))o+=","+qr(e.type,n.get(_n.TYPE));else{o+=","+qr(((e.type||_t)+"").substr(0,1),n.get(_n.TYPE))}o+=i.map((e=>{let t=e.value instanceof Array?"["+e.value+"]":e.value;return","+e.key+"="+t})).join("")}else ni(e)&&(o="*,q");if(!o)return null;if(r){return(dn.isString(r)?r:ar+(dn.keys(r).length>0?JSON.stringify(r):""))+"("+o+")"}return o}function Xr(e,t,n){let r=[],i=0;for(let o=0;o0))return o;for(t(n,1),e(n),n=0;)for(;t(e,1),!n(e););}))},n&&(i.count=function(t,r){return pi.setTime(+t),hi.setTime(+r),e(pi),e(hi),Math.floor(n(pi,hi))},i.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?function(t){return r(t)%e==0}:function(t){return i.count(0,t)%e==0}):i:null}),i}var mi=gi((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));mi.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?gi((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,n){t.setTime(+t+n*e)}),(function(t,n){return(n-t)/e})):mi:null};const yi=gi((function(e){e.setMilliseconds(0)}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getSeconds()})),vi=gi((function(e){e.setSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()})),bi=gi((function(e){e.setMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),xi=gi((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1}));function Ei(e){return gi((function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var Ti=Ei(0),Si=Ei(1),Ni=Ei(2),wi=Ei(3),Ci=Ei(4),Ai=Ei(5),Oi=Ei(6);const ki=gi((function(e){e.setHours(0,0,0,0),e.setDate(1)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),Mi=gi((function(e){e.setHours(0,0,0,0),e.setMonth(0,1)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()})),Ii=gi((function(e){e.setUTCMilliseconds(0)}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),Ui=gi((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()})),Fi=gi((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),Di=gi((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1}));function _i(e){return gi((function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var ji=_i(0),Pi=_i(1),Ri=_i(2),$i=_i(3),Bi=_i(4),Li=_i(5),Wi=_i(6);const Hi=gi((function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),qi=gi((function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));var Gi=mi.range,zi=yi.range,Yi=vi.range,Qi=bi.range,Vi=xi.range,Ki=Ti.range,Ji=Si.range,Xi=Ni.range,Zi=wi.range,eo=Ci.range,to=Ai.range,no=Oi.range,ro=Ti.range,io=ki.range,oo=Mi.range,ao=mi,so=Gi,co=Ii.range,lo=Ui.range,uo=Fi.range,fo=Di.range,po=ji.range,ho=Pi.range,go=Ri.range,mo=$i.range,yo=Bi.range,vo=Li.range,bo=Wi.range,xo=ji.range,Eo=Hi.range,To=qi.range;const So=n(Object.freeze(Object.defineProperty({__proto__:null,day:xi,days:Vi,friday:Ai,fridays:to,hour:bi,hours:Qi,interval:gi,millisecond:mi,milliseconds:Gi,minute:vi,minutes:Yi,monday:Si,mondays:Ji,month:ki,months:io,saturday:Oi,saturdays:no,second:yi,seconds:zi,sunday:Ti,sundays:Ki,thursday:Ci,thursdays:eo,tuesday:Ni,tuesdays:Xi,utcDay:Di,utcDays:fo,utcFriday:Li,utcFridays:vo,utcHour:Fi,utcHours:uo,utcMillisecond:ao,utcMilliseconds:so,utcMinute:Ui,utcMinutes:lo,utcMonday:Pi,utcMondays:ho,utcMonth:Hi,utcMonths:Eo,utcSaturday:Wi,utcSaturdays:bo,utcSecond:Ii,utcSeconds:co,utcSunday:ji,utcSundays:po,utcThursday:Bi,utcThursdays:yo,utcTuesday:Ri,utcTuesdays:go,utcWednesday:$i,utcWednesdays:mo,utcWeek:ji,utcWeeks:xo,utcYear:qi,utcYears:To,wednesday:wi,wednesdays:Zi,week:Ti,weeks:ro,year:Mi,years:oo},Symbol.toStringTag,{value:"Module"})));var No,wo,Co;function Ao(){if(No)return fi.exports;No=1;var e=So,t=new Date,n=new Date(0,0,1).setFullYear(0),r=new Date(Date.UTC(0,0,1)).setUTCFullYear(0);function i(e){return t.setTime(+e),t}function o(e,t,n,r,i,o){var a={type:e,date:t,unit:n};return r?a.step=r:a.minstep=1,null!=i&&(a.min=i),null!=o&&(a.max=o),a}function a(e,t,n,r,i,a){return o(e,(function(e){return t.offset(n,e)}),(function(e){return t.count(n,e)}),r,i,a)}var s=[a("second",e.second,n),a("minute",e.minute,n),a("hour",e.hour,n),a("day",e.day,n,[1,7]),a("month",e.month,n,[1,3,6]),a("year",e.year,n),o("seconds",(function(e){return new Date(1970,0,1,0,0,e)}),(function(e){return i(e).getSeconds()}),null,0,59),o("minutes",(function(e){return new Date(1970,0,1,0,e)}),(function(e){return i(e).getMinutes()}),null,0,59),o("hours",(function(e){return new Date(1970,0,1,e)}),(function(e){return i(e).getHours()}),null,0,23),o("weekdays",(function(e){return new Date(1970,0,4+e)}),(function(e){return i(e).getDay()}),[1],0,6),o("dates",(function(e){return new Date(1970,0,e)}),(function(e){return i(e).getDate()}),[1],1,31),o("months",(function(e){return new Date(1970,e%12,1)}),(function(e){return i(e).getMonth()}),[1],0,11)],c=[a("second",e.utcSecond,r),a("minute",e.utcMinute,r),a("hour",e.utcHour,r),a("day",e.utcDay,r,[1,7]),a("month",e.utcMonth,r,[1,3,6]),a("year",e.utcYear,r),o("seconds",(function(e){return new Date(Date.UTC(1970,0,1,0,0,e))}),(function(e){return i(e).getUTCSeconds()}),null,0,59),o("minutes",(function(e){return new Date(Date.UTC(1970,0,1,0,e))}),(function(e){return i(e).getUTCMinutes()}),null,0,59),o("hours",(function(e){return new Date(Date.UTC(1970,0,1,e))}),(function(e){return i(e).getUTCHours()}),null,0,23),o("weekdays",(function(e){return new Date(Date.UTC(1970,0,4+e))}),(function(e){return i(e).getUTCDay()}),[1],0,6),o("dates",(function(e){return new Date(Date.UTC(1970,0,e))}),(function(e){return i(e).getUTCDate()}),[1],1,31),o("months",(function(e){return new Date(Date.UTC(1970,e%12,1))}),(function(e){return i(e).getUTCMonth()}),[1],0,11)],l=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];function u(e){var t,n,r={};for(t=0,n=e.length;t(s=l[i])[0]){if((a=t/s[0])>r)return e[l[i-1][1]];if(a>=n)return e[s[1]]}return e[l[o-1][1]]}(e,t,n,r)},r}return fi.exports=u(s),fi.exports.utc=u(c),fi.exports}var Oo=function(){if(Co)return wo;Co=1;var e=un(),t=Ao();function n(t){if(!t)throw Error("Missing binning options.");var n,o,a,s,c,l,u,d=t.maxbins||15,f=t.base||10,p=Math.log(f),h=t.div||[5,2],g=t.min,m=t.max,y=m-g;if(t.step)n=t.step;else if(t.steps)n=t.steps[Math.min(t.steps.length-1,function(t,n,r,i){for(;r>>1;e.cmp(t[o],n)<0?r=o+1:i=o}return r}(t.steps,y/d,0,t.steps.length))];else{for(o=Math.ceil(Math.log(d)/p),a=t.minstep||0,n=Math.max(a,Math.pow(f,Math.round(Math.log(y)/p)-o));Math.ceil(y/n)>d;)n*=f;for(l=0;l=a&&y/c<=d&&(n=c)}return s=(c=Math.log(n))>=0?0:1+~~(-c/p),u=Math.pow(f,-s-1),{start:g=Math.min(g,Math.floor(g/n+u)*n),stop:m=Math.ceil(m/n)*n,step:n,unit:{precision:s},value:r,index:i}}function r(e){return this.step*Math.floor(e/this.step+1e-15)}function i(e){return Math.floor((e-this.start)/this.step+1e-15)}function o(e){return this.unit.date(r.call(this,e))}function a(e){return i.call(this,this.unit.unit(e))}return n.date=function(e){if(!e)throw Error("Missing date binning options.");var r=e.utc?t.utc:t,i=e.min,s=e.max,c=e.maxbins||20,l=e.minbins||4,u=+s-+i,d=e.unit?r[e.unit]:r.find(u,l,c),f=n({min:null!=d.min?d.min:d.unit(i),max:null!=d.max?d.max:d.unit(s),maxbins:c,minstep:d.minstep,steps:d.step});return f.unit=d,f.index=a,e.raw||(f.value=o),f},wo=n}();const ko=t(Oo);var Mo,Io;function Uo(){if(Io)return Mo;Io=1;var e=un(),t="__types__",n={boolean:e.boolean,integer:e.number,number:e.number,date:e.date,string:function(e){return null==e||""===e?null:e+""}},r={boolean:function(t){return"true"===t||"false"===t||e.isBoolean(t)},integer:function(e){return r.number(e)&&(e=+e)==~~e},number:function(t){return!isNaN(+t)&&!e.isDate(t)},date:function(e){return!isNaN(Date.parse(e))}};function i(t){return e.keys(t)}function o(e){return"["+e+"]"}function a(n,r){var i,o,a;if(n=e.array(n),r=e.$(r),n[t]&&(i=r(n[t]),e.isString(i)))return i;for(o=0,a=n.length;!e.isValid(i)&&ot;)i.push(r);else for(;(r=e+n*++o)=e&&n<=t?1/r:0},i.cdf=function(n){return nt?1:(n-e)/r},i.icdf=function(t){return t>=0&&t<=1?e+t*r:NaN},i},n.random.integer=function(e,t){void 0===t&&(t=e,e=0);var r=t-e,i=function(){return e+Math.floor(r*Math.random())};return i.samples=function(e){return n.zeros(e).map(i)},i.pdf=function(n){return n===Math.floor(n)&&n>=e&&n=t?1:(i-e+1)/r},i.icdf=function(t){return t>=0&&t<=1?e-1+Math.floor(t*r):NaN},i},n.random.normal=function(e,t){var r;e=e||0,t=t||1;var i=function(){var n,i,o=0,a=0;if(void 0!==r)return o=r,r=void 0,o;do{n=(o=2*Math.random()-1)*o+(a=2*Math.random()-1)*a}while(0===n||n>1);return i=Math.sqrt(-2*Math.log(n)/n),r=e+a*i*t,e+o*i*t};return i.samples=function(e){return n.zeros(e).map(i)},i.pdf=function(n){var r=Math.exp(Math.pow(n-e,2)/(-2*Math.pow(t,2)));return 1/(t*Math.sqrt(2*Math.PI))*r},i.cdf=function(n){var r,i=(n-e)/t,o=Math.abs(i);if(o>37)r=0;else{var a=Math.exp(-o*o/2);o<7.07106781186547?(r=a*((((((.0352624965998911*o+.700383064443688)*o+6.37396220353165)*o+33.912866078383)*o+112.079291497871)*o+221.213596169931)*o+220.206867912376),r/=((((((.0883883476483184*o+1.75566716318264)*o+16.064177579207)*o+86.7807322029461)*o+296.564248779674)*o+637.333633378831)*o+793.826512519948)*o+440.413735824752):r=a/(o+1/(o+2/(o+3/(o+4/(o+.65)))))/2.506628274631}return i>0?1-r:r},i.icdf=function(n){if(n<=0||n>=1)return NaN;var r=2*n-1,i=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),o=2/(Math.PI*i)+Math.log(1-Math.pow(r,2))/2,a=Math.log(1-r*r)/i,s=(r>0?1:-1)*Math.sqrt(Math.sqrt(o*o-a)-o);return e+t*Math.SQRT2*s},i},n.random.bootstrap=function(e,r){var i=e.filter(t.isValid),o=i.length,a=r?n.random.normal(0,r):null,s=function(){return i[~~(Math.random()*o)]+(a?a():0)};return s.samples=function(e){return n.zeros(e).map(s)},s}}(Po)),Po.exports),i=e.exports;function o(e,t,n){var o=e&&e.nullh||0,a=r.random.normal(0,1),s=i.mean(t,n),c=i.stdev(t,n)/Math.sqrt(i.count.valid(t,n));if(0===c)return s-o==0?1:0;var l=(s-o)/c;return 2*a.cdf(-Math.abs(l))}function a(e,n,r,o){var a,s=o?n.map(t.$(r)):n,c=o?n.map(t.$(o)):r,l=i.count(s),u=i.count(c),d=Array();if(l!==u)throw Error("Array lengths must match.");for(a=0;a0?Math.pow(s,1/r):0},i.mean.harmonic=function(e,n){n=t.$(n);var r,i,o,a,s=0;for(a=0,r=0,i=e.length;ai&&(i=o));return[r,i]},i.extent.index=function(e,n){n=t.$(n);var r,i,o,a,s=-1,c=-1,l=e.length;for(a=0;ai&&(i=o,c=a));return[s,c]},i.dot=function(e,n,r){var i,o,a=0;if(r)for(n=t.$(n),r=t.$(r),i=0;i-1&&u!==i){for(o=1+(r-1+l)/2;l-1)for(o=1+(s-1+l)/2;lg)&&(g=l),m+=(o=l-u)*(l-(u+=o/++d)),y.push(l));return m/=d-1,a=Math.sqrt(m),y.sort(t.cmp),{type:n(e,r),unique:v,count:e.length,valid:d,missing:f,distinct:p,min:h,max:g,mean:u,stdev:a,median:c=i.quantile(y,.5),q1:i.quantile(y,.25),q3:i.quantile(y,.75),modeskew:0===a?0:(u-c)/a}},i.summary=function(e,n){var r=(n=n||t.keys(e[0])).map((function(n){var r=i.profile(e,t.$(n));return r.field=n,r}));return r.__summary__=!0,r}}(jo)),jo.exports);const $o=ko;const Bo={nominal:0,key:1,ordinal:2,temporal:3,quantitative:4};class Lo{constructor(e){this._tableSchema=e,e.fields.sort((function(e,t){return Bo[e.vlType]Bo[t.vlType]?1:e.name.localeCompare(t.name)})),e.fields.forEach(((e,t)=>e.index=t)),this._fieldSchemaIndex=e.fields.reduce(((e,t)=>(e[t.name]=t,e)),{})}fieldNames(){return this._tableSchema.fields.map((e=>e.name))}get fieldSchemas(){return this._tableSchema.fields}fieldSchema(e){return this._fieldSchemaIndex[e]}tableSchema(){const e=dn.duplicate(this._tableSchema);return e.fields.sort(((e,t)=>e.originalIndex-t.originalIndex)),e}primitiveType(e){return this._fieldSchemaIndex[e]?this._fieldSchemaIndex[e].type:null}vlType(e){return this._fieldSchemaIndex[e]?this._fieldSchemaIndex[e].vlType:null}cardinality(e,t=!0,n=!1){const r=this._fieldSchemaIndex[e.field];if(e.aggregate||ni(e)&&e.autoCount)return 1;if(e.bin){let t;t="boolean"==typeof e.bin?{maxbins:Sr(e.channel)}:"?"===e.bin?{enum:[!0,!1]}:e.bin;const n=t.maxbins;return r.binStats[n]||(r.binStats[n]=Wo(n,r.stats)),r.binStats[n].distinct}if(e.timeUnit){if(t)switch(e.timeUnit){case Qn.SECONDS:case Qn.MINUTES:return 60;case Qn.HOURS:return 24;case Qn.DAY:return 7;case Qn.DATE:return 31;case Qn.MONTH:return 12;case Qn.QUARTER:return 4;case Qn.MILLISECONDS:return 1e3}let i=e.timeUnit,o=r.timeStats;return o&&o[i]||(o=Object.assign({},o,{[i]:Ho(e.timeUnit,r.stats)})),n?o[i].distinct-qo(o[i].unique,["Invalid Date",null]):o[i].distinct}return r?n?r.stats.distinct-qo(r.stats.unique,[NaN,null]):r.stats.distinct:null}timeUnitHasVariation(e){if(!e.timeUnit)return;if(e.timeUnit===Qn.DAY){const t=dn.extend({},e,{timeUnit:Qn.DATE});if(this.cardinality(t,!1,!0)<=1)return!1}let t=e.timeUnit;for(let n of Jn)if(or(t,n)){const t=dn.extend({},e,{timeUnit:n});if(this.cardinality(t,!1,!0)<=1)return!1}return!0}domain(e){const t=this._fieldSchemaIndex[e.field];let n=dn.keys(t.stats.unique);return t.vlType===_t?[+t.stats.min,+t.stats.max]:t.type===Go.DATETIME?[t.stats.min,t.stats.max]:t.type===Go.INTEGER||t.type===Go.NUMBER?(n=n.map((e=>+e)),n.sort(dn.cmp)):t.vlType===jt&&t.ordinalDomain?t.ordinalDomain:n.map((e=>"null"===e?null:e)).sort(dn.cmp)}stats(e){const t=this._fieldSchemaIndex[e.field];return t?t.stats:null}}function Wo(e,t){const n=$o({min:t.min,max:t.max,maxbins:e}),r=dn.extend({},t);return r.unique=function(e,t){const n={};for(let r in t){let i;i=null===r?null:isNaN(Number(r))?NaN:e.value(Number(r)),n[i]=(n[i]||0)+t[r]}return n}(n,t.unique),r.distinct=(n.stop-n.start)/n.step,r.min=n.start,r.max=n.stop,r}function Ho(e,t){const n=dn.extend({},t);let r={};return dn.keys(t.unique).forEach((function(n){let i,o="null"===n?null:new Date(n);i=null===o?null:isNaN(o.getTime())?"Invalid Date":(e===Qn.DAY?o.getDay():rr(e,o)).toString(),r[i]=(r[i]||0)+t.unique[n]})),n.unique=r,n.distinct=dn.keys(r).length,n}function qo(e,t){return t.reduce((function(t,n){return e[n]?t+1:t}),0)}var Go,zo;(zo=Go||(Go={}))[zo.STRING="string"]="STRING",zo[zo.NUMBER="number"]="NUMBER",zo[zo.INTEGER="integer"]="INTEGER",zo[zo.BOOLEAN="boolean"]="BOOLEAN",zo[zo.DATETIME="datetime"]="DATETIME";class Yo{constructor(e){this.constraint=e}name(){return this.constraint.name}description(){return this.constraint.description}properties(){return this.constraint.properties}strict(){return this.constraint.strict}}class Qo extends Yo{constructor(e){super(e)}hasAllRequiredPropertiesSpecific(e){return pn(this.constraint.properties,(t=>{if(mn(t)){let n=t.parent,r=t.child;return!e[n]||!sr(e[n][r])}return!e[t]||!sr(e[t])}))}satisfy(e,t,n,r){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(e)||this.constraint.satisfy(e,t,n,r)}}const Vo=[{name:"aggregateOpSupportedByType",description:"Aggregate function should be supported by data type.",properties:[_n.TYPE,_n.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.aggregate||!Dr(e.type)},{name:"asteriskFieldWithCountOnly",description:'Field="*" should be disallowed except aggregate="count"',properties:[_n.FIELD,_n.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>"*"===e.field==("count"===e.aggregate)},{name:"minCardinalityForBin",description:"binned quantitative field should not have too low cardinality",properties:[_n.BIN,_n.FIELD,_n.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.bin&&e.type===_t){let n={channel:e.channel,field:e.field,type:e.type};return t.cardinality(n)>=r.minCardinalityForBin}return!0}},{name:"binAppliedForQuantitative",description:"bin should be applied to quantitative field only.",properties:[_n.TYPE,_n.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.bin||e.type===_t},{name:"channelFieldCompatible",description:"encoding channel's range type be compatible with channel type.",properties:[_n.CHANNEL,_n.TYPE,_n.BIN,_n.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{const i=Object.assign({field:"f"},ci(e,{schema:t,props:["bin","timeUnit","type"]})),{compatible:o}=Mr(i,e.channel);if(o)return!0;return!("row"!==e.channel&&"column"!==e.channel||(a=i.timeUnit,!Kn[a]&&!function(e){return!!Xn[e]}(i.timeUnit)));var a}},{name:"hasFn",description:"A field with as hasFn flag should have one of aggregate, timeUnit, or bin.",properties:[_n.AGGREGATE,_n.BIN,_n.TIMEUNIT],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>!e.hasFn||(!!e.aggregate||!!e.bin||!!e.timeUnit)},{name:"omitScaleZeroWithBinnedField",description:"Do not use scale zero with binned field",properties:[_n.SCALE,In("scale","zero"),_n.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.bin||!e.scale||!0!==e.scale.zero},{name:"onlyOneTypeOfFunction",description:"Only of of aggregate, autoCount, timeUnit, or bin should be applied at the same time.",properties:[_n.AGGREGATE,_n.AUTOCOUNT,_n.TIMEUNIT,_n.BIN],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(ti(e)){return(!sr(e.aggregate)&&e.aggregate?1:0)+(!sr(e.bin)&&e.bin?1:0)+(!sr(e.timeUnit)&&e.timeUnit?1:0)<=1}return!0}},{name:"timeUnitAppliedForTemporal",description:"Time unit should be applied to temporal field only.",properties:[_n.TYPE,_n.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.timeUnit||e.type===Pt},{name:"timeUnitShouldHaveVariation",description:"A particular time unit should be applied only if they produce unique values.",properties:[_n.TIMEUNIT,_n.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>!e.timeUnit||e.type!==Pt||(!n.has("timeUnit")&&!r.constraintManuallySpecifiedValue||t.timeUnitHasVariation(e))},{name:"scalePropertiesSupportedByScaleType",description:"Scale properties must be supported by correct scale type",properties:[].concat(Nn,[_n.SCALE,_n.TYPE]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(e.scale){const t=e.scale,n=di(e);if(null==n)return!0;for(let e in t){if("type"===e||"name"===e||"enum"===e)continue;const t=e;if("point"===n){if(!nn("point",t)&&!nn("band",t))return!1}else if(!nn(n,t))return!1}}return!0}},{name:"scalePropertiesSupportedByChannel",description:"Not all scale properties are supported by all encoding channels",properties:[].concat(Nn,[_n.SCALE,_n.CHANNEL]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,r)=>{if(e){let t=e.channel,n=e.scale;if(t&&!sr(t)&&n){if("row"===t||"column"===t)return!1;for(let e in n){if(!n.hasOwnProperty(e))continue;if("type"===e||"name"===e||"enum"===e)continue;if(!(void 0===rn(t,e)))return!1}}}return!0}},{name:"typeMatchesPrimitiveType",description:"Data type should be supported by field's primitive type.",properties:[_n.FIELD,_n.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if("*"===e.field)return!0;const i=t.primitiveType(e.field),o=e.type;if(!n.has("field")&&!n.has("type")&&!r.constraintManuallySpecifiedValue)return!0;switch(i){case Go.BOOLEAN:case Go.STRING:return o!==_t&&o!==Pt;case Go.NUMBER:case Go.INTEGER:return o!==Pt;case Go.DATETIME:return o===Pt;case null:return!1}throw new Error("Not implemented")}},{name:"typeMatchesSchemaType",description:"Enumerated data type of a field should match the field's type in the schema.",properties:[_n.FIELD,_n.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>!(n.has("field")||n.has("type")||r.constraintManuallySpecifiedValue)||("*"===e.field?e.type===_t:t.vlType(e.field)===e.type)},{name:"maxCardinalityForCategoricalColor",description:"Categorical channel should not have too high cardinality",properties:[_n.CHANNEL,_n.FIELD],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel!==ke||e.type!==Rt&&e.type!==Ur.KEY||t.cardinality(e)<=r.maxCardinalityForCategoricalColor},{name:"maxCardinalityForFacet",description:"Row/column channel should not have too high cardinality",properties:[_n.CHANNEL,_n.FIELD,_n.BIN,_n.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel!==ve&&e.channel!==be||t.cardinality(e)<=r.maxCardinalityForFacet},{name:"maxCardinalityForShape",description:"Shape channel should not have too high cardinality",properties:[_n.CHANNEL,_n.FIELD,_n.BIN,_n.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,r)=>e.channel!==Ue||t.cardinality(e)<=r.maxCardinalityForShape},{name:"dataTypeAndFunctionMatchScaleType",description:"Scale type must match data type",properties:[_n.TYPE,_n.SCALE,In("scale","type"),_n.TIMEUNIT,_n.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>{if(e.scale){const t=e.type,n=di(e);if(Dr(t))return void 0===n||Yt(n);if(t===Pt)return e.timeUnit?fn([$t.TIME,$t.UTC,void 0],n)||Yt(n):fn([$t.TIME,$t.UTC,void 0],n);if(t===_t)return e.bin?fn([$t.LINEAR,void 0],n):fn([$t.LOG,$t.POW,$t.SQRT,$t.QUANTILE,$t.QUANTIZE,$t.LINEAR,void 0],n)}return!0}},{name:"stackIsOnlyUsedWithXY",description:"stack should only be allowed for x and y channels",properties:[_n.STACK,_n.CHANNEL],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!e.stack||(e.channel===Ee||e.channel===Te)}].map((e=>new Qo(e)));Vo.reduce(((e,t)=>(e[t.name()]=t,e)),{});const Ko=Vo.reduce(((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e}),new _r),Jo=[{name:"doesNotSupportConstantValue",description:"row, column, x, y, order, and detail should not work with constant values.",properties:[_n.TYPE,_n.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,r)=>!fn(["row","column","x","y","detail","order"],e.channel)}].map((e=>new Qo(e)));Jo.reduce(((e,t)=>(e[t.name()]=t,e)),{});const Xo=Jo.reduce(((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e}),new _r);const Zo=ut.reduce(((e,t)=>(e[t]=!0,e)),{});class ea extends Yo{constructor(e){super(e)}hasAllRequiredPropertiesSpecific(e){return pn(this.constraint.properties,(t=>{if(t===_n.MARK)return!sr(e.getMark());if(mn(t)){let n=t.parent,r=t.child;return pn(e.getEncodings(),(e=>!e[n]||!sr(e[n][r])))}if(!Un(t))throw new Error("UNIMPLEMENTED");return pn(e.getEncodings(),(e=>!e[t]||!sr(e[t])))}))}satisfy(e,t,n){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(e)||this.constraint.satisfy(e,t,n)}}const ta=[{name:"noRepeatedChannel",description:"Each encoding channel should only be used once.",properties:[_n.CHANNEL],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let r={};return pn(e.getEncodings(),(e=>!!sr(e.channel)||!r[e.channel]&&(r[e.channel]=!0,!0)))}},{name:"alwaysIncludeZeroInScaleWithBarMark",description:"Do not recommend bar mark if scale does not start at zero",properties:[_n.MARK,_n.SCALE,In("scale","zero"),_n.CHANNEL,_n.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const r=e.getMark(),i=e.getEncodings();if(r===Rn)for(let o of i)if(ti(o)&&(o.channel===Ee||o.channel===Te)&&o.type===_t&&o.scale&&!1===o.scale.zero)return!1;return!0}},{name:"autoAddCount",description:"Automatically adding count only for plots with only ordinal, binned quantitative, or temporal with timeunit fields.",properties:[_n.BIN,_n.TIMEUNIT,_n.TYPE,_n.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(gn(e.getEncodings(),(e=>ii(e))))return pn(e.getEncodings(),(e=>{if(ei(e))return!0;if(ni(e))return!0;switch(e.type){case _t:return!!e.bin;case Pt:return!!e.timeUnit;case jt:case Ur.KEY:case Rt:return!0}throw new Error("Unsupported Type")}));if(pn(e.wildcardIndex.encodingIndicesByProperty.get("autoCount")||[],(t=>{let n=e.getEncodingQueryByIndex(t);return ni(n)&&!sr(n.autoCount)})))return gn(e.getEncodings(),(e=>(ti(e)||ni(e))&&e.type===_t?!ri(e)&&(ti(e)&&(!e.bin||sr(e.bin))):!(!ti(e)||e.type!==Pt)&&(!e.timeUnit||sr(e.timeUnit))));return!0}},{name:"channelPermittedByMarkType",description:"Each encoding channel should be supported by the mark type",properties:[_n.CHANNEL,_n.MARK],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{const r=e.getMark();return!!sr(r)||pn(e.getEncodings(),(e=>!!sr(e.channel)||!!bt(e.channel,r)))}},{name:"hasAllRequiredChannelsForMark",description:"All required channels for the specified mark should be specified",properties:[_n.CHANNEL,_n.MARK],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const r=e.getMark();switch(r){case Pn:case $n:return e.channelUsed(Ee)&&e.channelUsed(Te);case Hn:return e.channelUsed(Re);case Rn:case Gn:case zn:case qn:case Wn:case Ln:return e.channelUsed(Ee)||e.channelUsed(Te);case Bn:return!e.wildcardIndex.hasProperty(_n.CHANNEL)||e.channelUsed(Ee)||e.channelUsed(Te)}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+JSON.stringify(r))}},{name:"omitAggregate",description:"Omit aggregate plots.",properties:[_n.AGGREGATE,_n.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()},{name:"omitAggregatePlotWithDimensionOnlyOnFacet",description:"Omit aggregate plots with dimensions only on facets as that leads to inefficient use of space.",properties:[_n.CHANNEL,_n.AGGREGATE,_n.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){let t=!1,r=!1,i=!1;if(e.specQuery.encodings.forEach(((n,o)=>{ei(n)||ri(n)||ti(n)&&!n.aggregate&&(r=!0,fn([ve,be],n.channel)?e.wildcardIndex.hasEncodingProperty(o,_n.CHANNEL)&&(i=!0):t=!0)})),r&&!t&&(i||n.constraintManuallySpecifiedValue))return!1}return!0}},{name:"omitAggregatePlotWithoutDimension",description:"Aggregate plots without dimension should be omitted",properties:[_n.AGGREGATE,_n.AUTOCOUNT,_n.BIN,_n.TIMEUNIT,_n.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()||gn(e.getEncodings(),(e=>!!(ui(e)||ti(e)&&"temporal"===e.type)))},{name:"omitBarLineAreaWithOcclusion",description:"Don't use bar, line or area to visualize raw plot as they often lead to occlusion.",properties:[_n.MARK,_n.AGGREGATE,_n.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!fn([Rn,$n,Pn],e.getMark())||e.isAggregate()},{name:"omitBarTickWithSize",description:"Do not map field to size channel with bar and tick mark",properties:[_n.CHANNEL,_n.MARK],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{const r=e.getMark();if(fn([qn,Rn],r)&&e.channelEncodingField(Fe)){if(n.constraintManuallySpecifiedValue)return!1;{const t=e.specQuery.encodings;for(let n=0;n{const r=e.getMark(),i=e.getEncodings();if(r===Pn||r===Rn)for(let o of i)if(ti(o)&&(o.channel===Ee||o.channel===Te)&&o.scale){if(di(o)===$t.LOG)return!1}return!0}},{name:"omitMultipleNonPositionalChannels",description:"Unless manually specified, do not use multiple non-positional encoding channel to avoid over-encoding.",properties:[_n.CHANNEL],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{const r=e.specQuery.encodings;let i=0,o=!1;for(let a=0;a1&&(o||n.constraintManuallySpecifiedValue)))return!1}return!0}},{name:"omitNonPositionalOrFacetOverPositionalChannels",description:"Do not use non-positional channels unless all positional channels are used",properties:[_n.CHANNEL],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{const r=e.specQuery.encodings;let i=!1,o=!1,a=!1,s=!1;for(let c=0;c!!e.isAggregate()},{name:"omitRawContinuousFieldForAggregatePlot",description:"Aggregate plot should not use raw continuous field as group by values. (Quantitative should be binned. Temporal should have time unit.)",properties:[_n.AGGREGATE,_n.AUTOCOUNT,_n.TIMEUNIT,_n.BIN,_n.TYPE],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){const t=e.specQuery.encodings;for(let r=0;r!!e.isAggregate()||pn(e.specQuery.encodings,((t,r)=>!(!ei(t)&&!ri(t))||(t.channel!==Be||!e.wildcardIndex.hasEncodingProperty(r,_n.CHANNEL)&&!n.constraintManuallySpecifiedValue)))},{name:"omitRepeatedField",description:"Each field should be mapped to only one channel",properties:[_n.FIELD],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let r={},i={};const o=e.specQuery.encodings;for(let a=0;a{const r=e.getEncodings();return 1!==r.length||r[0].channel!==Te}},{name:"hasAppropriateGraphicTypeForMark",description:"Has appropriate graphic type for mark",properties:[_n.CHANNEL,_n.MARK,_n.TYPE,_n.TIMEUNIT,_n.BIN,_n.AGGREGATE,_n.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{const r=e.getMark();switch(r){case Pn:case $n:if(e.isAggregate()){const t=e.getEncodingQueryByChannel(Ee),n=e.getEncodingQueryByChannel(Te),r=li(t),i=li(n);return t&&n&&r!==i&&!(ti(t)&&!r&&fn(["nominal","key"],t.type))&&!(ti(n)&&!i&&fn(["nominal","key"],n.type))}return!0;case Hn:return!0;case Rn:case qn:if(e.channelEncodingField(Fe))return!1;{const t=e.getEncodingQueryByChannel(Ee),n=e.getEncodingQueryByChannel(Te);return li(t)!==li(n)}case Ln:const t=e.getEncodingQueryByChannel(Ee),n=e.getEncodingQueryByChannel(Te),r=ui(t),i=ui(n),o=e.getEncodingQueryByChannel(ke),a=li(o),s=!!ti(o)&&o.type===jt;return(r&&i||r&&!e.channelUsed(Te)||i&&!e.channelUsed(Ee))&&(!o||o&&(a||s));case Gn:case Bn:case zn:case Wn:return!0}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+r)}},{name:"omitInvalidStackSpec",description:"If stack is specified, must follow Vega-Lite stack rules",properties:[_n.STACK,_n.FIELD,_n.CHANNEL,_n.MARK,_n.AGGREGATE,_n.AUTOCOUNT,_n.SCALE,In("scale","type"),_n.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{if(!e.wildcardIndex.hasProperty(_n.STACK))return!0;const r=e.getVlStack();return(null!==r||null===e.getStackOffset())&&r.fieldChannel===e.getStackChannel()}},{name:"omitNonSumStack",description:"Stack specifications that use non-summative aggregates should be omitted (even implicit ones)",properties:[_n.CHANNEL,_n.MARK,_n.AGGREGATE,_n.AUTOCOUNT,_n.SCALE,In("scale","type"),_n.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const r=e.getVlStack();if(null!=r){const t=e.getEncodingQueryByChannel(r.fieldChannel);if(!fn(xr,t.aggregate))return!1}return!0}},{name:"omitTableWithOcclusionIfAutoAddCount",description:"Plots without aggregation or autocount where x and y are both discrete should be omitted if autoAddCount is enabled as they often lead to occlusion",properties:[_n.CHANNEL,_n.TYPE,_n.TIMEUNIT,_n.BIN,_n.AGGREGATE,_n.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(n.autoAddCount){const t=e.getEncodingQueryByChannel("x"),n=e.getEncodingQueryByChannel("y");if((!ti(t)||ui(t))&&(!ti(n)||ui(n)))return!!e.isAggregate()&&pn(e.getEncodings(),(e=>{let t=e.channel;return!(t!==Ee&&t!==Te&&t!==ve&&t!==be&&ti(e)&&!e.aggregate)}))}return!0}}].map((e=>new ea(e)));ta.reduce(((e,t)=>(e[t.name()]=t,e)),{});const na=ta.reduce(((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e}),new _r);function ra(e,t,n,r,i){const o=na.get(e)||[];for(const a of o)if(a.strict()||i[a.name()]){if(!a.satisfy(n,r,i)){let e="(spec) "+a.name();return i.verbose&&console.log(e+" failed with "+n.toShorthand()+" for "+t.name),e}}return null}const ia=new _r;function oa(e){return(t,n,r)=>(i,o)=>{const a=t.encodingIndicesByProperty.get(e);return function s(c){if(c===a.length)return void i.push(o.duplicate());const l=a[c],u=t.encodings[l].get(e),d=o.getEncodingQueryByIndex(l),f=o.getEncodingProperty(l,e);ei(d)||ri(d)||!f?s(c+1):(u.enum.forEach((t=>{null===t&&(t=void 0),o.setEncodingProperty(l,e,t,u);const i=function(e,t,n,r,i,o){const a=Ko.get(e)||[],s=r.getEncodingQueryByIndex(n);for(const l of a)if((l.strict()||o[l.name()])&&!l.satisfy(s,i,r.wildcardIndex.encodings[n],o)){let e="(enc) "+l.name();return o.verbose&&console.log(e+" failed with "+r.toShorthand()+" for "+t.name),e}const c=Xo.get(e)||[];for(const l of c)if((l.strict()||o[l.name()])&&ei(s)&&!l.satisfy(s,i,r.wildcardIndex.encodings[n],o)){let e="(enc) "+l.name();return o.verbose&&console.log(e+" failed with "+r.toShorthand()+" for "+t.name),e}return null}(e,u,l,o,n,r);if(i)return;ra(e,u,o,n,r)||s(c+1)})),o.resetEncodingProperty(l,e,u))}(0),i}}function aa(e,t,n){return t=t||new _r,n=n||new _r,e.forEach((e=>{var r;r=e,dn.isObject(r)&&r.property?(t.setByKey(e.property,!0),n.setByKey(e.property,e.replace)):t.setByKey(e,!0)})),{include:t,replaceIndex:n,replacer:Hr(n)}}ia.set("mark",((e,t,n)=>(r,i)=>(i.getMark().enum.forEach((o=>{i.setMark(o);ra("mark",e.mark,i,t,n)||r.push(i.duplicate())})),i.resetMark(),r))),vn.forEach((e=>{ia.set(e,oa(e))})),An.forEach((e=>{ia.set(e,oa(e))}));const sa=[_n.FIELD,_n.TYPE,_n.AGGREGATE,_n.BIN,_n.TIMEUNIT,_n.STACK],ca=sa.concat([{property:_n.CHANNEL,replace:{x:"xy",y:"xy",color:"style",size:"style",shape:"style",opacity:"style",row:"facet",column:"facet"}}]);let la={};function ua(e,t){la[e]=t}const da=aa([_n.FIELD]);ua("field",(e=>Vr(e,da.include,da.replacer)));const fa=aa(sa);ua("fieldTransform",(e=>Vr(e,fa.include,fa.replacer)));const pa=aa(ca);ua("encoding",(e=>Vr(e,pa.include,pa.replacer))),ua("spec",(e=>JSON.stringify(e)));class ha{constructor(){this._mark=void 0,this._encodings={},this._encodingIndicesByProperty=new _r}setEncodingProperty(e,t,n){const r=this._encodings;(r[e]=r[e]||new _r).set(t,n);const i=this._encodingIndicesByProperty;return i.set(t,i.get(t)||[]),i.get(t).push(e),this}hasEncodingProperty(e,t){return!!this._encodings[e]&&this._encodings[e].has(t)}hasProperty(e){if(Un(e))return this.encodingIndicesByProperty.has(e);if("mark"===e)return!!this.mark;throw new Error("Unimplemented for property "+e)}isEmpty(){return!this.mark&&0===this.encodingIndicesByProperty.size()}setMark(e){return this._mark=e,this}get mark(){return this._mark}get encodings(){return this._encodings}get encodingIndicesByProperty(){return this._encodingIndicesByProperty}}class ga{constructor(e,t,n,r,i){this._rankingScore={},this._spec=e,this._channelFieldCount=e.encodings.reduce(((e,t)=>(sr(t.channel)||ni(t)&&!1===t.autoCount||(e[t.channel+""]=1),e)),{}),this._wildcardIndex=t,this._assignedWildcardIndex=i,this._opt=r,this._schema=n}static build(e,t,n){let r=new ha;if(sr(e.mark)){const t=fr(_n.MARK);e.mark=lr(e.mark,t,n.enum.mark),r.setMark(e.mark)}if(e.encodings.forEach(((e,i)=>{ni(e)&&(console.warn("A field with autoCount should not be included as autoCount meant to be an internal object."),e.type=_t),ti(e)&&void 0===e.type&&(e.type=ar),vn.forEach((o=>{if(sr(e[o])){const a=fr(o)+i,s=yr(o,t,n),c=e[o]=lr(e[o],a,s);r.setEncodingProperty(i,o,c)}})),An.forEach((o=>{const a=e[o.parent];if(a){const e=o.child;if(sr(a[e])){const s=fr(o)+i,c=yr(o,t,n),l=a[e]=lr(a[e],s,c);r.setEncodingProperty(i,o,l)}}}))})),n.autoAddCount){const i={name:fr(_n.CHANNEL)+e.encodings.length,enum:yr(_n.CHANNEL,t,n)},o={name:fr(_n.AUTOCOUNT)+e.encodings.length,enum:[!1,!0]},a={channel:i,autoCount:o,type:_t};e.encodings.push(a);const s=e.encodings.length-1;r.setEncodingProperty(s,_n.CHANNEL,i),r.setEncodingProperty(s,_n.AUTOCOUNT,o)}return new ga(e,r,t,n,{})}get wildcardIndex(){return this._wildcardIndex}get schema(){return this._schema}get specQuery(){return this._spec}duplicate(){return new ga(dn.duplicate(this._spec),this._wildcardIndex,this._schema,this._opt,dn.duplicate(this._assignedWildcardIndex))}setMark(e){const t=this._wildcardIndex.mark.name;this._assignedWildcardIndex[t]=this._spec.mark=e}resetMark(){const e=this._spec.mark=this._wildcardIndex.mark;delete this._assignedWildcardIndex[e.name]}getMark(){return this._spec.mark}getEncodingProperty(e,t){const n=this._spec.encodings[e];return mn(t)?n[t.parent][t.child]:n[t]}setEncodingProperty(e,t,n,r){const i=this._spec.encodings[e];t===_n.CHANNEL&&i.channel&&!sr(i.channel)&&this._channelFieldCount[i.channel]--,mn(t)?i[t.parent][t.child]=n:En(t)&&!0===n?i[t]=dn.extend({},i[t],{enum:void 0,name:void 0}):i[t]=n,this._assignedWildcardIndex[r.name]=n,t===_n.CHANNEL&&(this._channelFieldCount[n]=(this._channelFieldCount[n]||0)+1)}resetEncodingProperty(e,t,n){const r=this._spec.encodings[e];t===_n.CHANNEL&&this._channelFieldCount[r.channel]--,mn(t)?r[t.parent][t.child]=n:r[t]=n,delete this._assignedWildcardIndex[n.name]}channelUsed(e){return this._channelFieldCount[e]>0}channelEncodingField(e){return ti(this.getEncodingQueryByChannel(e))}getEncodings(){return this._spec.encodings.filter((e=>!ri(e)))}getEncodingQueryByChannel(e){for(let t of this._spec.encodings)if(t.channel===e)return t}getEncodingQueryByIndex(e){return this._spec.encodings[e]}isAggregate(){return gn(this._spec.encodings,(e=>ti(e)&&!sr(e.aggregate)&&!!e.aggregate||ii(e)))}getVlStack(){return Lr(this._spec)}getStackOffset(){return function(e){for(const t of e.encodings)if(void 0!==t[_n.STACK]&&!sr(t[_n.STACK]))return t[_n.STACK]}(this._spec)}getStackChannel(){return function(e){for(const t of e.encodings)if(void 0!==t[_n.STACK]&&!sr(t.channel))return t.channel;return null}(this._spec)}toShorthand(e){if(e){if(dn.isString(e))return function(e,t){return la[t](e)}(this.specQuery,e);const t=aa(e);return Vr(this._spec,t.include,t.replacer)}return Vr(this._spec)}toSpec(e){if(sr(this._spec.mark))return null;let t={};return(e=e||this._spec.data)&&(t.data=e),this._spec.transform&&(t.transform=this._spec.transform),t.mark=this._spec.mark,t.encoding=ai(this.specQuery.encodings,{schema:this._schema,wildcardMode:"null"}),this._spec.width&&(t.width=this._spec.width),this._spec.height&&(t.height=this._spec.height),this._spec.background&&(t.background=this._spec.background),this._spec.padding&&(t.padding=this._spec.padding),this._spec.title&&(t.title=this._spec.title),null===t.encoding?null:((this._spec.config||this._opt.defaultSpecConfig)&&(t.config=dn.extend({},this._opt.defaultSpecConfig,this._spec.config)),t)}getRankingScore(e){return this._rankingScore[e]}setRankingScore(e,t){this._rankingScore[e]=t}}function ma(e){return void 0!==e.items}function ya(e){let t=e.items[0];for(;t&&ma(t);)t=t.items[0];return t}class va{constructor(e){this.type=e,this.scoreIndex=this.initScore()}getFeatureScore(e){const t=this.type,n=this.scoreIndex[e];if(void 0!==n)return{type:t,feature:e,score:n}}}var ba,xa;(xa=ba||(ba={}))[xa.Q=_t]="Q",xa[xa.BIN_Q="bin_"+_t]="BIN_Q",xa[xa.T=Pt]="T",xa[xa.TIMEUNIT_T="timeUnit_time"]="TIMEUNIT_T",xa[xa.TIMEUNIT_O="timeUnit_"+jt]="TIMEUNIT_O",xa[xa.O=jt]="O",xa[xa.N=Rt]="N",xa[xa.K=Ur.KEY]="K",xa[xa.NONE="-"]="NONE";const Ea=ba.Q,Ta=ba.BIN_Q,Sa=ba.T,Na=ba.TIMEUNIT_T,wa=ba.TIMEUNIT_O,Ca=ba.O,Aa=ba.N,Oa=ba.K,ka=ba.NONE;function Ma(e){if(e.bin)return ba.BIN_Q;if(e.timeUnit){return Yt(di(e))?ba.TIMEUNIT_O:ba.TIMEUNIT_T}return e.type}const Ia=-10;function Ua(e,t,n,r){return e+"_"+t+"_"+n+"_"+r}const Fa=[new class extends va{constructor(){super("Axis")}initScore(e={}){e=Object.assign({},vr,e);let t={};return[{feature:Ta,opt:"preferredBinAxis"},{feature:Sa,opt:"preferredTemporalAxis"},{feature:Na,opt:"preferredTemporalAxis"},{feature:wa,opt:"preferredTemporalAxis"},{feature:Ca,opt:"preferredOrdinalAxis"},{feature:Aa,opt:"preferredNominalAxis"}].forEach((n=>{e[n.opt]===Ee?t[n.feature+"_"+Te]=-.01:e[n.opt]===Te&&(t[n.feature+"_"+Ee]=-.01)})),t}featurize(e,t){return e+"_"+t}getScore(e,t,n){return e.getEncodings().reduce(((e,t)=>{if(ti(t)||ni(t)){const n=Ma(t),r=this.featurize(n,t.channel),i=this.getFeatureScore(r);i&&e.push(i)}return e}),[])}},new class extends va{constructor(){super("Dimension")}initScore(){return{row:-2,column:-2,color:0,opacity:0,size:0,shape:0}}getScore(e,t,n){return e.isAggregate()&&e.getEncodings().reduce(((e,t)=>{if(ni(t)||ti(t)&&!t.aggregate){const n=this.getFeatureScore(t.channel+"");if(n&&n.score>e.score)return n}return e}),{type:"Dimension",feature:"No Dimension",score:-5}),[]}},new class extends va{constructor(){super("Facet")}initScore(e){let t={};return(e=Object.assign({},vr,e)).preferredFacet===ve?t[be]=-.01:e.preferredFacet===be&&(t[ve]=-.01),t}getScore(e,t,n){return e.getEncodings().reduce(((e,t)=>{if(ti(t)||ni(t)){const n=this.getFeatureScore(t.channel);n&&e.push(n)}return e}),[])}},new class extends va{constructor(){super("Mark")}initScore(){return function(){const e=[Ea,Sa],t=[Ta,wa,Ca,Aa,Oa].concat([ka]);let n={};e.forEach((t=>{e.forEach((e=>{hn({point:0,text:-.2,tick:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5},((r,i)=>{const o=Ua(t,e,!0,i);n[o]=r}));hn({point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5},((r,i)=>{const o=Ua(t,e,!1,i);n[o]=r}))}))})),e.forEach((e=>{t.forEach((t=>{hn({tick:0,point:-.2,text:-.5,bar:-2,line:-2,area:-2,rule:-2.5},((r,i)=>{const o=Ua(e,t,!0,i);n[o]=r;const a=Ua(t,e,!0,i);n[a]=r}))})),[Na].forEach((t=>{hn({point:0,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5},((r,i)=>{const o=Ua(e,t,!0,i);n[o]=r;const a=Ua(t,e,!0,i);n[a]=r}))})),[ka,Aa,Ca,Oa].forEach((t=>{hn({bar:0,point:-.2,tick:-.25,text:-.3,line:-2,area:-2,rule:-2.5},((r,i)=>{const o=Ua(e,t,!1,i);n[o]=r;const a=Ua(t,e,!1,i);n[a]=r}))})),[Ta].forEach((t=>{hn({bar:0,point:-.2,tick:-.25,text:-.3,line:-.5,area:-.5,rule:-2.5},((r,i)=>{const o=Ua(e,t,!1,i);n[o]=r;const a=Ua(t,e,!1,i);n[a]=r}))})),[Na,wa].forEach((t=>{hn({line:0,area:-.1,bar:-.2,point:-.3,tick:-.35,text:-.4,rule:-2.5},((r,i)=>{const o=Ua(e,t,!1,i);n[o]=r;const a=Ua(t,e,!1,i);n[a]=r}))}))})),[Na].forEach((e=>{[Na].forEach((t=>{const r={point:0,rect:-.1,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};hn(r,((r,i)=>{const o=Ua(e,t,!0,i);n[o]=r})),hn(r,((r,i)=>{const o=Ua(e,t,!1,i);n[o]=r}))})),t.forEach((t=>{const r={tick:0,point:-.2,text:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5};hn(r,((r,i)=>{const o=Ua(e,t,!0,i);n[o]=r})),hn(r,((r,i)=>{const o=Ua(t,e,!0,i);n[o]=r})),hn(r,((r,i)=>{const o=Ua(e,t,!1,i);n[o]=r})),hn(r,((r,i)=>{const o=Ua(t,e,!1,i);n[o]=r}))}))}));for(const r of t)for(const e of t){const t={point:0,rect:0,text:-.1,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};hn(t,((t,i)=>{const o=Ua(r,e,!0,i);n[o]=t})),hn(t,((t,i)=>{const o=Ua(r,e,!1,i);n[o]=t}))}return n}()}getScore(e,t,n){let r=e.getMark();r!==Gn&&r!==zn||(r=Bn);const i=e.getEncodingQueryByChannel(Ee),o=i?Ma(i):ka,a=e.getEncodingQueryByChannel(Te),s=o+"_"+(a?Ma(a):ka)+"_"+!e.isAggregate()+"_"+r,c=this.getFeatureScore(s);return c?[c]:(console.error("feature score missing for",s),[])}},new class extends va{constructor(){super("SizeChannel")}initScore(){return{bar_size:-2,tick_size:-2}}getScore(e,t,n){const r=e.getMark();return e.getEncodings().reduce(((e,t)=>{if(ti(t)||ni(t)){const n=r+"_"+t.channel,i=this.getFeatureScore(n);i&&e.push(i)}return e}),[])}},new class extends va{constructor(){super("TypeChannel")}initScore(){let e={};const t={x:0,y:0,size:-.575,color:-.725,text:-2,opacity:-3,shape:Ia,row:Ia,column:Ia,detail:-20};[Ea,Sa,Na].forEach((n=>{dn.keys(t).forEach((r=>{e[this.featurize(n,r)]=t[r]}))}));const n=dn.extend({},t,{row:-.75,column:-.75,shape:-3.1,text:-3.2,detail:-4});[Ta,wa,Ca].forEach((t=>{dn.keys(n).forEach((r=>{e[this.featurize(t,r)]=n[r]}))}));const r={x:0,y:0,color:-.6,shape:-.65,row:-.7,column:-.7,text:-.8,detail:-2,size:-3,opacity:-3.1};return dn.keys(r).forEach((t=>{e[this.featurize(Aa,t)]=r[t],e[this.featurize(Oa,t)]=fn(["x","y","detail"],t)?-1:r[t]-2})),e}featurize(e,t){return e+"_"+t}getScore(e,t,n){const r=e.getEncodings().reduce(((e,t)=>{if(ti(t)||ni(t)){const n=Jr(t);(e[n]=e[n]||[]).push(t)}return e}),{}),i=[];return hn(r,(e=>{const t=e.reduce(((e,t)=>{if(ti(t)||ni(t)){const n=Ma(t),r=this.featurize(n,t.channel),i=this.getFeatureScore(r);if(null===e||i.score>e.score)return i}return e}),null);i.push(t)})),i}}];const Da="aggregationQuality";let _a={};function ja(e,t){_a[e]=t}function Pa(e,t,n,r){return t.nest&&r!==t.nest.length?(e.items.forEach((e=>{Pa(e,t,n,r+1)})),t.nest[r].orderGroupBy&&e.items.sort(function(e,t,n){return(r,i)=>{const o=ya(r),a=ya(i);return Ra(e instanceof Array?e:[e],o,a,t,n)}}(t.nest[r].orderGroupBy,n,t.config))):(t.orderBy||t.chooseBy)&&(e.items.sort(function(e,t,n){return(r,i)=>Ra(e instanceof Array?e:[e],r,i,t,n)}(t.orderBy||t.chooseBy,n,t.config)),t.chooseBy&&e.items.length>0&&e.items.splice(1)),e}function Ra(e,t,n,r,i){for(let o of e){let e=$a(n,o,r,i).score-$a(t,o,r,i).score;if(0!==e)return e}return 0}function $a(e,t,n,r){if(void 0!==e.getRankingScore(t))return e.getRankingScore(t);const i=(0,_a[t])(e,n,r);return e.setRankingScore(t,i),i}function Ba(e,t,n){let r={};return e=e.map((function(e){return n.smallRangeStepForHighCardinalityOrFacet&&(e=function(e,t,n,r){[ve,Te,be,Ee].forEach((t=>{n[t]=e.getEncodingQueryByChannel(t)}));const i=n[Te];if(void 0!==i&&ti(i)&&(n[ve]||t.cardinality(i)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){void 0===i.scale&&(i.scale={});const e=di(i);i.scale&&(void 0===e||Yt(e))&&(i.scale.rangeStep||(i.scale.rangeStep=12))}const o=n[Ee];if(ti(o)&&(n[be]||t.cardinality(o)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){void 0===o.scale&&(o.scale={});const e=di(o);o.scale&&(void 0===e||Yt(e))&&(o.scale.rangeStep||(o.scale.rangeStep=12))}return e}(e,t,r,n)),n.nominalColorScaleForHighCardinality&&(e=function(e,t,n,r){n[ke]=e.getEncodingQueryByChannel(ke);const i=n[ke];ti(i)&&void 0!==i&&(i.type===Rt||i.type===Ur.KEY)&&t.cardinality(i)>r.nominalColorScaleForHighCardinality.maxCardinality&&(void 0===i.scale&&(i.scale={}),i.scale&&(i.scale.range||(i.scale.scheme=r.nominalColorScaleForHighCardinality.palette)));return e}(e,t,r,n)),n.xAxisOnTopForHighYCardinalityWithoutColumn&&(e=function(e,t,n,r){if([be,Ee,Te].forEach((t=>{n[t]=e.getEncodingQueryByChannel(t)})),void 0===n[be]){const e=n[Ee],i=n[Te];ti(e)&&ti(i)&&void 0!==i&&i.field&&Yt(di(i))&&void 0!==e&&t.cardinality(i)>r.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality&&(void 0===e.axis&&(e.axis={}),e.axis&&!e.axis.orient&&(e.axis.orient="top"))}return e}(e,t,r,n)),e})),e}function La(e,t,n=vr){const r=ga.build(e,t,n),i=r.wildcardIndex;let o=[r];return n.propertyPrecedence.forEach((e=>{const r=function(e){const t=e.split(".");if(1===t.length)return e;if(2===t.length)return{parent:t[0],child:t[1]};throw"Invalid property key with "+t.length+" dots: "+e}(e);if(i.hasProperty(r)){const e=function(e){return ia.get(e)}(r),a=e(i,t,n);o=o.reduce(a,[])}})),!n.stylize||null===n.nominalColorScaleForHighCardinality&&null===n.smallRangeStepForHighCardinalityOrFacet&&null===n.xAxisOnTopForHighYCardinalityWithoutColumn?o:Ba(o,t,n)}function Wa(e,t,n){const r=function(e,t){if(t){const n={name:"",path:"",items:[]};let r={},i=[],o=[],a=[];for(let e=0;e0?i[e-1].duplicate():new _r),o.push(e>0?o[e-1].duplicate():new _r);const n=t[e].groupBy;if(dn.isArray(n)){let t=aa(n,i[e],o[e]);a.push(t.replacer)}}return e.forEach((e=>{let o="",s=n;for(let n=0;n{const o=i.getScore(e,t,n);return r.concat(o)}),[]);return{score:r.reduce(((e,t)=>e+t.score),0),features:r}})),ja(Da,(function(e,t,n){const r=function(e){const t=e.getEncodings();if(e.isAggregate()){if(gn(t,(e=>ti(e)&&(e.type===_t&&!e.bin&&!e.aggregate||e.type===Pt&&!e.timeUnit))))return{type:Da,score:.1,feature:"Aggregate with raw continuous"};if(gn(t,(e=>ti(e)&&ui(e)))){let e=gn(t,(e=>ti(e)&&"count"===e.aggregate||ii(e))),n=gn(t,(e=>ti(e)&&!!e.bin));return e?{type:Da,score:.8,feature:"Aggregate with count"}:n?{type:Da,score:.7,feature:"Aggregate with bin but without count"}:{type:Da,score:.9,feature:"Aggregate without count and without bin"}}return{type:Da,score:.3,feature:"Aggregate without dimension"}}return gn(t,(e=>ti(e)&&!ui(e)))?{type:Da,score:1,feature:"Raw with measure"}:{type:Da,score:.2,feature:"Raw without measure"}}(e);return{score:r.score,features:[r]}})),ja("fieldOrder",(function(e,t,n){const r=e.wildcardIndex.encodingIndicesByProperty.get("field");if(!r)return{score:0,features:[]};const i=e.specQuery.encodings,o=t.fieldSchemas.length,a=[];let s=0,c=1;for(let l=r.length-1;l>=0;l--){const n=r[l],u=i[n];let d;if(!ti(u))continue;d=u.field;const f=e.wildcardIndex.encodings[n].get("field"),p=t.fieldSchema(d).index,h=-p*c;s+=h,a.push({score:h,type:"fieldOrder",feature:`field ${f.name} is ${d} (#${p} in the schema)`}),c*=o}return{score:s,features:a}}));const Ha={[Go.BOOLEAN]:r.jsx(s,{className:"h-5 w-5 inline-flex opacity-60"}),[Go.DATETIME]:r.jsx(a,{className:"h-5 w-5 inline-flex opacity-60"}),[Go.NUMBER]:r.jsx(o,{className:"h-5 w-5 inline-flex opacity-60"}),[Go.STRING]:r.jsx(i,{className:"h-5 w-5 inline-flex opacity-60"}),[Go.INTEGER]:r.jsx(G,{className:"h-5 w-5 inline-flex opacity-60"})};function qa(e){const{type:t,limit:n,additionalFieldQuery:r}=e;return{type:t,limit:n,createQuery:e=>({spec:{...e.spec,encodings:[...e.spec.encodings,r]},groupBy:"field",orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:{autoAddCount:!0}})}}const Ga=qa({type:"addCategoricalField",limit:4,additionalFieldQuery:{channel:ar,field:ar,type:"nominal"}}),za=qa({type:"addQuantitativeField",limit:4,additionalFieldQuery:{channel:ar,bin:ar,aggregate:ar,field:ar,type:"quantitative"}}),Ya=qa({type:"addTemporalField",limit:2,additionalFieldQuery:{channel:ar,hasFn:!0,timeUnit:ar,field:ar,type:"temporal"}});function Qa(e){return e?"bin"===e?{bin:!0}:B(e)?{aggregate:e}:function(e){if(!e)return!1;return Ka.includes(e)||Ja.includes(e)}(e)?{timeUnit:e}:{}:{}}const Va=["bin","min","max","mean","median","sum"],Ka=["year","month","date","day","hours","minutes","seconds","milliseconds"],Ja=["yearmonth","yearmonthdate","monthdate"];function Xa(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}function Za(e){const{aggregate:t,bin:n,timeUnit:r,field:i,scale:o,legend:a,axis:s,sort:u,description:d}=e;let{type:f}=e;if(sr(f))throw new Error("Wildcard not support");"ordinal"===f&&(c.warn("Ordinal type is not supported. Using nominal type instead."),f="nominal");const p=function(e){const{aggregate:t,bin:n,timeUnit:r}=e;return n?"bin":t?t.toString():r?r.toString():void 0}({aggregate:t,bin:n,timeUnit:r});return l(void 0!==i,"Field is required for fieldQ"),Xa({field:i,fn:p,type:f,sort:u,scale:o,axis:s,legend:a,description:d})}function es(e){return 0===e.encodings.length}function ts(e){let t=!1,n=!1,r=!1;for(const i of e.encodings)ei(i)||(ni(i)?sr(i.autoCount)&&(n=!0):(sr(i.field)&&(t=!0),(sr(i.aggregate)||sr(i.bin)||sr(i.timeUnit))&&(n=!0),sr(i.channel)&&(r=!0)));return{hasAnyWildcard:r||t||n,hasWildcardField:t,hasWildcardFn:n,hasWildcardChannel:r}}function ns(e){return{mark:e.mark,encodings:(t=e.encoding,Object.entries(t).map((([e,t])=>function(e,t){const{fn:n,...r}=e;return{channel:t,...Qa(n),...r}}(t,e)))),config:e.config};var t}const rs={name:"source"};function is(e,t){const n={},{hasOpenPosition:r,hasStyleChannel:i,hasOpenFacet:o}=function(e){let t=!1,n=!1,r=!1;return e.encodings.forEach((e=>{"x"===e.channel||"y"===e.channel?t=!0:"row"===e.channel||"column"===e.channel?r=!0:"string"==typeof e.channel&&L(W,e.channel)&&(n=!0)})),{hasOpenPosition:t,hasStyleChannel:n,hasOpenFacet:r}}(e.spec);return(r||i)&&(n.addQuantitativeField=as(za,e,t)),(r||i||o)&&(n.addCategoricalField=as(Ga,e,t)),r&&(n.addTemporalField=as(Ya,e,t)),n}function os(e,t){if(es(e.spec))return{plots:[],query:e,limit:1};return{plots:[ss(Wa(e,t).result,rs)[0]],query:e,limit:1}}function as(e,t,n){const r=e.createQuery(t);return{plots:ss(Wa(r,n).result,rs),query:r,limit:e.limit}}function ss(e,t){return e.items.map((e=>ma(e)?cs(t,ya(e)):cs(t,e)))}function cs(e,t){return{fieldInfos:t.getEncodings().filter(ti).map((e=>({fieldDef:Za(e),channel:e.channel}))),spec:t.toSpec(e)}}const ls={type:"histograms",limit:12,createQuery:e=>({spec:{data:e.spec.data,mark:ar,transform:e.spec.transform,encodings:[{channel:ar,bin:ar,timeUnit:ar,field:ar,type:ar},{channel:ar,aggregate:"count",field:"*",type:"quantitative"}]},groupBy:"fieldTransform",orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:{autoAddCount:!1}})};const{valueAtom:us,useActions:ds}=u((function(){return{mark:ar,encoding:{},config:{},schema:null}}),{setSchema:(e,t)=>({...e,schema:t}),setMark:(e,t)=>({...e,mark:t}),setEncoding:(e,t)=>{const n=Xa({...e.encoding,...t});return{...e,encoding:n}},set:(e,t)=>{const{schema:n,...r}=t;return{...e,...r}}});function fs(){return ds()}const ps=d((e=>{const t=e(us);if(!t.schema)return{};const n=function(e){const{spec:t,autoAddCount:n}=e,r=ns(t),{hasAnyWildcard:i,hasWildcardFn:o,hasWildcardField:a}=ts(r),s=function(e){const{hasWildcardFn:t,hasWildcardField:n}=e;return t?"fieldTransform":n?"field":"encoding"}({hasWildcardFn:o,hasWildcardField:a});return{spec:r,groupBy:s,orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:i?{autoAddCount:n}:void 0}}({spec:t,autoAddCount:!0});return es(n.spec)?{main:os(n,t.schema),histograms:as(ls,n,t.schema)}:function(e){return!ts(e).hasAnyWildcard}(n.spec)&&!function(e){const t=new Set(e.encodings.map((e=>e.channel))),n=["x","y","color"].every((e=>t.has(e))),r=["row","column"].some((e=>t.has(e)));return n&&r}(n.spec)?{main:os(n,t.schema),...is(n,t.schema)}:{main:os(n,t.schema)}})),hs=[ar,"area","bar","circle","geoshape","line","point","rect","rule","square","text","tick","trail"],gs=["x","y","row","column"],ms=["color","size","shape"],ys=e=>{const t=f.c(26),{schema:n,mark:i}=e,o=p(us),a=fs(),s=o.encoding.x&&o.encoding.y;let c;t[0]!==a||t[1]!==s||t[2]!==n||t[3]!==o.encoding?(c=e=>{const t=("row"===e||"column"===e)&&!s;return r.jsx(vs,{schema:n,label:e,disabled:t,fieldDefinition:o.encoding[e],onChange:t=>a.setEncoding({[e]:t})},e)},t[0]=a,t[1]=s,t[2]=n,t[3]=o.encoding,t[4]=c):c=t[4];const l=c;let u,d,x,E,T;t[5]!==i?(u=i.toString(),t[5]=i,t[6]=u):u=t[6],t[7]!==a?(d=e=>a.setMark(e),t[7]=a,t[8]=d):d=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(h,{children:r.jsx(g,{placeholder:"Mark"})}),t[9]=x):x=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx(m,{children:r.jsxs(y,{children:[r.jsx(v,{children:"Mark"}),hs.map(Es)]})}),t[10]=E):E=t[10],t[11]!==u||t[12]!==d?(T=r.jsxs(b,{"data-testid":"marimo-plugin-data-explorer-mark-select",value:u,onValueChange:d,children:[x,E]}),t[11]=u,t[12]=d,t[13]=T):T=t[13];const S=T;let N,w,C,A,O,k;return t[14]===Symbol.for("react.memo_cache_sentinel")?(N=r.jsx("span",{className:"col-span-2 flex items-center justify-between w-full",children:r.jsx("div",{className:"text-sm font-semibold",children:"Encodings"})}),t[14]=N):N=t[14],t[15]!==l?(w=gs.map(l),t[15]=l,t[16]=w):w=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx("div",{children:"Mark"}),t[17]=C):C=t[17],t[18]!==S?(A=r.jsxs("span",{className:"col-span-2 text-sm font-semibold w-full border-t border-divider flex items-center justify-between pt-2 pr-[30px]",children:[C,S]}),t[18]=S,t[19]=A):A=t[19],t[20]!==l?(O=ms.map(l),t[20]=l,t[21]=O):O=t[21],t[22]!==A||t[23]!==O||t[24]!==w?(k=r.jsxs("div",{className:"grid gap-x-2 gap-y-4 justify-items-start py-3 pl-4 pr-2 bg-[var(--slate-1)] border rounded items-center grid-template-columns-[repeat(2,_minmax(0,_min-content))] self-start",children:[N,w,A,O]}),t[22]=A,t[23]=O,t[24]=w,t[25]=k):k=t[25],k},vs=e=>{const t=f.c(43),{label:n,schema:i,fieldDefinition:o,disabled:a,onChange:s}=e;let c;t[0]!==o||t[1]!==i?(c=()=>{if(!o)return"--";if("*"===o.field)return r.jsxs("span",{className:"flex gap-2 flex-1",children:[Ha[Go.NUMBER],r.jsx("span",{className:"text-left flex-1",children:"Count"})]});const e=o.field.toString();return r.jsxs("span",{className:"flex gap-2 flex-1",children:[Ha[i.primitiveType(e)],r.jsx("span",{className:"text-left flex-1",children:o.fn?`${o.fn}(${o.field})`:e})]})},t[0]=o,t[1]=i,t[2]=c):c=t[2];const l=c;let u;t[3]!==s?(u=()=>{s(void 0)},t[3]=s,t[4]=u):u=t[4];const d=u;let p;t[5]!==(null==o?void 0:o.field)?(p=(null==o?void 0:o.field.toString())??"",t[5]=null==o?void 0:o.field,t[6]=p):p=t[6];const g=p;let v,S;t[7]!==n?(v=r.jsx(E,{className:"text-[var(--slate-11)] font-semibold",children:n}),t[7]=n,t[8]=v):v=t[8],t[9]!==s||t[10]!==i?(S=e=>{s("*"===e?{field:"*",fn:"count",type:"quantitative"}:{field:e,type:i.vlType(e)})},t[9]=s,t[10]=i,t[11]=S):S=t[11];const N=g?d:void 0;let w,C,A,O,k,M,I,U,F,D,_,j;return t[12]!==l?(w=l(),t[12]=l,t[13]=w):w=t[13],t[14]!==N||t[15]!==w?(C=r.jsx(h,{className:"min-w-[140px] lg:min-w-[210px] h-full",onClear:N,children:w}),t[14]=N,t[15]=w,t[16]=C):C=t[16],t[17]!==i?(A=i.fieldNames().map((e=>r.jsx(x,{value:e.toString(),children:r.jsxs("span",{className:"flex items-center gap-2 flex-1",children:[Ha[i.primitiveType(e)],r.jsx("span",{className:"flex-1",children:e}),r.jsxs("span",{className:"text-muted-foreground text-xs font-semibold",children:["(",i.vlType(e),")"]})]})},e))),t[17]=i,t[18]=A):A=t[18],t[19]!==i?(O=0===i.fieldNames().length&&r.jsx(x,{disabled:!0,value:"--",children:"No columns"}),t[19]=i,t[20]=O):O=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(T,{}),t[21]=k):k=t[21],t[22]===Symbol.for("react.memo_cache_sentinel")?(M=r.jsx(x,{value:"*",children:r.jsxs("span",{className:"flex items-center gap-1 flex-1",children:[Ha[Go.NUMBER],r.jsx("span",{className:"flex-1",children:"Count"})]})},"*"),t[22]=M):M=t[22],t[23]!==O||t[24]!==A?(I=r.jsx(m,{children:r.jsxs(y,{children:[A,O,k,M]})}),t[23]=O,t[24]=A,t[25]=I):I=t[25],t[26]!==a||t[27]!==g||t[28]!==I||t[29]!==S||t[30]!==C?(U=r.jsxs(b,{value:g,disabled:a,onValueChange:S,children:[C,I]}),t[26]=a,t[27]=g,t[28]=I,t[29]=S,t[30]=C,t[31]=U):U=t[31],t[32]!==o||t[33]!==s?(F=o&&r.jsx(xs,{field:o,onChange:s}),t[32]=o,t[33]=s,t[34]=F):F=t[34],t[35]!==F?(D=r.jsx("div",{className:"w-[26px]",children:F}),t[35]=F,t[36]=D):D=t[36],t[37]!==U||t[38]!==D?(_=r.jsxs("div",{className:"flex flex-row gap-1 h-[26px]",children:[U,D]}),t[37]=U,t[38]=D,t[39]=_):_=t[39],t[40]!==_||t[41]!==v?(j=r.jsxs(r.Fragment,{children:[v,_]}),t[40]=_,t[41]=v,t[42]=j):j=t[42],j},bs="__",xs=e=>{const t=f.c(15),{field:n,onChange:i}=e;if("*"===n.field)return null;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];let a=o;if(n.type===Ur.QUANTITATIVE){let e;t[1]===Symbol.for("react.memo_cache_sentinel")?(e=[["",Va]],t[1]=e):e=t[1],a=e}if(n.type===Ur.TEMPORAL){let e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=[["Single",Ka],["Multi",Ja]],t[2]=e):e=t[2],a=e}if(a.length>0){let e,o,s,c,l,u;return t[3]!==n||t[4]!==i?(e=e=>{i({...n,fn:e===bs?void 0:e})},t[3]=n,t[4]=i,t[5]=e):e=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(h,{className:"h-full px-1",hideChevron:!0,variant:"ghost",children:r.jsx(N,{size:14,strokeWidth:1.5})}),t[6]=o):o=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(s=r.jsx(y,{children:r.jsx(x,{value:bs,children:"None"})}),c=r.jsx(T,{}),t[7]=s,t[8]=c):(s=t[7],c=t[8]),t[9]!==a?(l=r.jsxs(m,{children:[s,c,a.map(Ss)]}),t[9]=a,t[10]=l):l=t[10],t[11]!==n.fn||t[12]!==e||t[13]!==l?(u=r.jsxs(b,{"data-testid":"marimo-plugin-data-explorer-field-options",value:n.fn,onValueChange:e,children:[o,l]}),t[11]=n.fn,t[12]=e,t[13]=l,t[14]=u):u=t[14],u}return null};function Es(e){return r.jsx(x,{value:e,children:e===ar?"auto":e},e)}function Ts(e){return r.jsx(x,{value:e??bs,children:S(e)},e)}function Ss(e){const[t,n]=e;return r.jsxs(y,{children:[t&&r.jsx(v,{children:t}),n.map(Ts)]},t)}const Ns=e=>{const t=f.c(26),{schema:n}=e,[i,o]=w.useState(),[a,s]=w.useState();let c;if(t[0]!==n||t[1]!==i||t[2]!==a){const e=n.fieldNames(),l=i?n.stats({field:i,channel:"x"}):void 0;let u;t[4]===Symbol.for("react.memo_cache_sentinel")?(u=r.jsx(q,{className:"text-muted-foreground",width:40,height:40,strokeWidth:1.5}),t[4]=u):u=t[4];const d=u,f=a?e:e.slice(0,12),p=e.length>12,v=e.length>0?e.length:"No";let E,T;t[5]!==v?(E=r.jsxs("span",{className:"text-muted-foreground font-semibold",children:[v," fields"]}),t[5]=v,t[6]=E):E=t[6],t[7]!==n||t[8]!==i?(T=e=>{const t=n.cardinality({channel:"x",field:e});return r.jsxs("span",{className:C("hover:bg-muted self-start px-2 py-2 rounded flex flex-row gap-1 items-center cursor-pointer lg:justify-center text-sm truncate flex-shrink-0 overflow-hidden",i===e&&"bg-muted"),onClick:()=>{o(i!==e?e:void 0)},children:[Ha[n.primitiveType(e)],e,t>1&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",t,")"]})]},e)},t[7]=n,t[8]=i,t[9]=T):T=t[9];const S=f.map(T);let N,w;t[10]!==p||t[11]!==a?(N=p&&r.jsx(A,{"data-testid":"marimo-plugin-data-explorer-show-more-columns",variant:"link",size:"sm",className:"self-center col-span-3 -mt-1",onClick:()=>s(As),children:a?"Show less":"Show more"}),t[10]=p,t[11]=a,t[12]=N):N=t[12],t[13]!==S||t[14]!==N?(w=r.jsxs("div",{className:"hidden lg:grid grid-cols-2 xl:grid-cols-3 gap-2 p-2 bg-[var(--slate-1)] border rounded lg:items-center items-start w-fit grid-flow-dense max-h-[300px] overflow-auto",children:[S,N]}),t[13]=S,t[14]=N,t[15]=w):w=t[15];const O=i||"",k=0===e.length;let M,I,U,F,D;t[16]===Symbol.for("react.memo_cache_sentinel")?(M=e=>{o(e)},t[16]=M):M=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(I=r.jsx(h,{className:"min-w-[210px] h-full",children:r.jsx(g,{placeholder:"Select a column"})}),t[17]=I):I=t[17],t[18]!==n?(U=n.fieldNames().map((e=>r.jsx(x,{value:e.toString(),children:r.jsxs("span",{className:"flex items-center gap-2 flex-1",children:[Ha[n.primitiveType(e)],r.jsx("span",{className:"flex-1",children:e}),r.jsxs("span",{className:"text-muted-foreground text-xs font-semibold",children:["(",n.vlType(e),")"]})]})},e))),t[18]=n,t[19]=U):U=t[19],t[20]!==U?(F=r.jsx(m,{children:r.jsx(y,{children:U})}),t[20]=U,t[21]=F):F=t[21],t[22]!==k||t[23]!==F||t[24]!==O?(D=r.jsx("div",{className:"lg:hidden",children:r.jsxs(b,{"data-testid":"marimo-plugin-data-explorer-column-select",value:O,disabled:k,onValueChange:M,children:[I,F]})}),t[22]=k,t[23]=F,t[24]=O,t[25]=D):D=t[25],c=r.jsxs("div",{className:"flex flex-col justify-center items-center h-full flex-1 gap-2",children:[d,E,w,D,i&&r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-2 p-2 text-sm",children:ws.map((e=>r.jsxs("div",{className:"flex flex-row gap-2 min-w-[100px]",children:[r.jsx("span",{className:"font-semibold",children:e}),r.jsx("span",{children:Cs(null==l?void 0:l[e])})]},e)))})]}),t[0]=n,t[1]=i,t[2]=a,t[3]=c}else c=t[3];return c},ws=["distinct","min","max","mean","median","q1","q3","stdev"];function Cs(e){return"number"==typeof e?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):"string"==typeof e?e:"object"==typeof e&&e instanceof Date?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(e):String(e)}function As(e){return!e}const Os=e=>{const t=f.c(5);let n,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=O(),t[0]=i):i=t[0],n=i;const o=n;let a,s;return t[1]!==e?(a=()=>{const t=o.sub(us,(()=>{const t=o.get(us),{schema:n,...r}=t;e.setValue(r)})),n=e.value;return n&&Object.keys(n).length>0&&o.set(us,n),t},t[1]=e,t[2]=a):a=t[2],k(a),t[3]!==e?(s=r.jsx(M,{store:o,children:r.jsx(Is,{...e})}),t[3]=e,t[4]=s):s=t[4],s},ks={export:{svg:!0,png:!0},source:!1,compiled:!1,editor:!1},Ms={left:20,right:20,top:20,bottom:20},Is=e=>{var t,n,i,o,a,s;const c=f.c(43),{data:l}=e,u=fs();let d,h;c[0]!==u||c[1]!==l?(d=async()=>{if(!l)return{};const e=await F(l,{type:"csv",parse:"auto"},{replacePeriod:!0}),t=function(e,t={},n={fields:[]}){t=dn.extend({},vr,t);let r=Ro.summary(e),i=_o.inferAll(e),o=n.fields.reduce(((e,t)=>(e[t.name]=t,e)),{}),a=r.map((function(n,r){const a=n.field,s="date"===i[a]?Go.DATETIME:i[a];let c,l=n.distinct;if(s===Go.NUMBER)c=_t;else if(s===Go.INTEGER)c=ln.max.getTime()&&(n.max=new Date(e))}}else c=Rt;c===Rt&&l/n.count>t.minPercentUniqueForKey&&n.count>t.minCardinalityForKey&&(c=Ur.KEY);let u={name:a,originalIndex:r,vlType:c,type:s,stats:n,timeStats:{},binStats:{}};const d=o[u.name];return u=dn.extend(u,d),u}));for(let c of a)if(c.vlType===_t)for(let e of t.enum.binProps.maxbins)c.binStats[e]=Wo(e,c.stats);else if(c.vlType===Pt)for(let e of t.enum.timeUnit)void 0!==e&&(c.timeStats[e]=Ho(e,c.stats));const s=Object.assign({},n,{fields:a});return new Lo(s)}(e);return u.setSchema(t),{chartData:e,schema:t}},c[0]=u,c[1]=l,c[2]=d):d=c[2],c[3]!==l?(h=[l],c[3]=l,c[4]=h):h=c[4];const{data:g,loading:m,error:y}=I(d,h),{mark:v}=p(us),b=p(ps),{theme:x}=U();if(y){let e;return c[5]!==y?(e=r.jsx(D,{error:y}),c[5]=y,c[6]=e):e=c[6],e}if(!g){let e;return c[7]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{}),c[7]=e):e=c[7],e}const{chartData:E,schema:T}=g;if(m||!T){let e;return c[8]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{}),c[8]=e):e=c[8],e}const S=null==(n=null==(t=b.main)?void 0:t.plots)?void 0:n[0];let N;c[9]!==(null==S?void 0:S.fieldInfos)?(N=new Set(null==S?void 0:S.fieldInfos.map(_s)),c[9]=null==S?void 0:S.fieldInfos,c[10]=N):N=c[10];const w=N;let C;c[11]!==E||c[12]!==S||c[13]!==T||c[14]!==x?(C=()=>S?r.jsx("div",{className:"flex overflow-y-auto justify-center items-center flex-1 w-[90%]",children:r.jsx(H,{data:{source:E},padding:Ms,actions:ks,spec:Ds(S.spec),theme:"dark"===x?"dark":void 0})}):r.jsx(Ns,{schema:T}),c[11]=E,c[12]=S,c[13]=T,c[14]=x,c[15]=C):C=c[15];const O=C;let k,M,$;c[16]!==v||c[17]!==T?(k=r.jsx(ys,{mark:v,schema:T}),c[16]=v,c[17]=T,c[18]=k):k=c[18],c[19]!==O?(M=O(),c[19]=O,c[20]=M):M=c[20],c[21]!==k||c[22]!==M?($=r.jsxs("div",{className:"flex items-center gap-2",children:[k,M]}),c[21]=k,c[22]=M,c[23]=$):$=c[23];const B=null==(i=b.histograms)?void 0:i.plots,L=null==(o=b.addCategoricalField)?void 0:o.plots,W=null==(a=b.addQuantitativeField)?void 0:a.plots,q=null==(s=b.addTemporalField)?void 0:s.plots;let G,z,Y;if(c[24]!==u||c[25]!==E||c[26]!==w||c[27]!==W||c[28]!==q||c[29]!==B||c[30]!==L||c[31]!==x){let e;c[33]!==u||c[34]!==E||c[35]!==w||c[36]!==x?(e=(e,t)=>r.jsx(Fs,{title:r.jsx("div",{className:"flex flex-row gap-1",children:e.fieldInfos.map((e=>{const t="*"===e.fieldDef.field?"Count":e.fieldDef.fn?`${e.fieldDef.fn}(${e.fieldDef.field})`:e.fieldDef.field.toString();return r.jsx(R,{variant:w.has(e.fieldDef.field)?"secondary":"defaultOutline",children:t},t)}))}),actions:r.jsx(_,{content:"Make main plot",children:r.jsx(A,{"data-testid":"marimo-plugin-data-explorer-make-main-plot",variant:"text",size:"icon",onClick:()=>{const t=P.fromEntries(e.fieldInfos.map(js));u.setEncoding(t)},children:r.jsx(j,{className:"w-4 h-4"})})}),children:r.jsx(H,{data:{source:E},actions:!1,spec:e.spec,theme:"dark"===x?"dark":void 0},t)},t),c[33]=u,c[34]=E,c[35]=w,c[36]=x,c[37]=e):e=c[37],G=[B,L,W,q].filter(Boolean).flat().map(e),c[24]=u,c[25]=E,c[26]=w,c[27]=W,c[28]=q,c[29]=B,c[30]=L,c[31]=x,c[32]=G}else G=c[32];return c[38]!==G?(z=r.jsx(Us,{children:G}),c[38]=G,c[39]=z):z=c[39],c[40]!==z||c[41]!==$?(Y=r.jsxs("div",{className:"flex flex-col gap-2",children:[$,z]}),c[40]=z,c[41]=$,c[42]=Y):Y=c[42],Y},Us=e=>{const t=f.c(2),{children:n}=e;if(0===$.Children.count(n))return null;let i;return t[0]!==n?(i=r.jsx("div",{className:"flex flex-row overflow-x-auto overflow-y-hidden gap-4 snap-x pb-4",children:n}),t[0]=n,t[1]=i):i=t[1],i},Fs=e=>{const t=f.c(10),{title:n,children:i,actions:o}=e;let a,s,c,l;return t[0]!==n?(a=r.jsx("div",{className:"text-sm font-medium",children:n}),t[0]=n,t[1]=a):a=t[1],t[2]!==o||t[3]!==a?(s=r.jsxs("div",{className:"flex flex-row justify-between items-center bg-[var(--slate-3)] py-0.5 px-2",children:[a,o]}),t[2]=o,t[3]=a,t[4]=s):s=t[4],t[5]!==i?(c=r.jsx("div",{className:"px-6 pt-2 max-h-[280px] overflow-y-auto",children:i}),t[5]=i,t[6]=c):c=t[6],t[7]!==s||t[8]!==c?(l=r.jsxs("div",{className:"flex-shrink-0 bg-card shadow-md border overflow-hidden rounded snap-start",children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l};function Ds(e){var t,n;return Boolean((null==(t=e.encoding)?void 0:t.row)||(null==(n=e.encoding)?void 0:n.column))||(e.width="container"),e}function _s(e){return e.fieldDef.field}function js(e){return[e.channel,e.fieldDef]}export{Is as DataExplorerComponent,Os as default}; diff --git a/docs/assets/VegaLite-D07JSyC_.js b/docs/assets/VegaLite-D07JSyC_.js deleted file mode 100644 index dfe9b86..0000000 --- a/docs/assets/VegaLite-D07JSyC_.js +++ /dev/null @@ -1,11 +0,0 @@ -var e;import{y as t,cy as n,cz as r,cA as i,cB as o,cC as a,cD as s,R as l,cE as c}from"./index-D3XtisvU.js";import{a as h,b as p,d as f,c as u,e as d,f as g,g as m,h as v,i as E,j as b,k as y,l as w,m as O,n as x,o as A,p as N,q as I,r as S,s as R,t as L,u as $,v as T,w as D,x as C,y as k,z as F,A as P,B as _,C as j,D as M,E as z,F as U,G,H as B,I as V,J as W,K as X,L as H,N as q,O as Y,P as J,Q,R as K,S as Z,T as ee}from"./compile-CsTNKzEk.js";import{e as te}from"./index-BelAJDbG.js";const ne={};function re(e,t){void 0===e&&(e=ne),void 0===t&&(t=ne);const n=Object.keys(e),r=Object.keys(t);return e===t||n.length===r.length&&n.every((n=>e[n]===t[n]))} -/*! - * https://github.com/Starcounter-Jack/JSON-Patch - * (c) 2017-2022 Joachim Wester - * MIT licensed - */var ie=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oe=Object.prototype.hasOwnProperty;function ae(e,t){return oe.call(e,t)}function se(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&t<=57))return!1;n++}return!0}function he(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function pe(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function fe(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t0&&"constructor"==s[c-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===p&&(void 0===l[f]?p=s.slice(0,c).join("/"):c==h-1&&(p=t.path),void 0!==p&&u(t,0,e,p)),c++,Array.isArray(l)){if("-"===f)f=l.length;else{if(n&&!ce(f))throw new ge("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);ce(f)&&(f=~~f)}if(c>=h){if(n&&"add"===t.op&&f>l.length)throw new ge("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);if(!1===(a=Ee[t.op].call(t,l,f,e)).test)throw new ge("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(c>=h){if(!1===(a=ve[t.op].call(t,l,f,e)).test)throw new ge("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[f],n&&c0)throw new ge('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new ge("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new ge("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&fe(e.value))throw new ge("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var i=e.path.split("/").length,o=r.split("/").length;if(i!==o+1&&i!==o)throw new ge("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new ge("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=xe([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new ge("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function xe(e,t,n){try{if(!Array.isArray(e))throw new ge("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)we(le(t),le(e),n||!0);else{n=n||Oe;for(var r=0;r0&&(e.patches=[],e.callback&&e.callback(r)),r}function $e(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=se(t),a=se(e),s=!1,l=a.length-1;l>=0;l--){var c=e[p=a[l]];if(!ae(t,p)||void 0===t[p]&&void 0!==c&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+he(p),value:le(c)}),n.push({op:"remove",path:r+"/"+he(p)}),s=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var h=t[p];"object"==typeof c&&null!=c&&"object"==typeof h&&null!=h&&Array.isArray(c)===Array.isArray(h)?$e(c,h,n,r+"/"+he(p),i):c!==h&&(i&&n.push({op:"test",path:r+"/"+he(p),value:le(c)}),n.push({op:"replace",path:r+"/"+he(p),value:le(h)}))}}if(s||o.length!=a.length)for(l=0;l0)return[v,r+h.join(",\n"+g),l].join("\n"+a)}return E}(t,"",0)}}());var Fe={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Pe={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},_e={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const je=Array.prototype.slice,Me=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,je.call(t,1))};var ze={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,r,i,o,a)=>new Date(e,t||0,null!=n?n:1,r||0,i||0,o||0,a||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return Me("join",arguments)},indexof:function(){return Me("indexOf",arguments)},lastindexof:function(){return Me("lastIndexOf",arguments)},slice:function(){return Me("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat:parseFloat,parseInt:parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return Me("substring",arguments,String)},split:function(){return Me("split",arguments,String)},replace:function(){return Me("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const Ue=["view","item","group","xy","x","y"],Ge=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&Ge.add(setImmediate);const Be={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:Fe[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);const i=e(t.property);if(n&&(e.memberDepth-=1),!Ge.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let r=t.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||ze[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>Pe[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>_e[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const r=e(n.key);return e.memberDepth-=1,Ge.has(e(n.value))?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):t[r]=e(n.value),t}),{})};function Ve(e,t,n,r,i,o){const a=e=>Be[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=r,a.event=i,a.item=o,Ue.forEach((e=>a.fn[e]=function(){return i.vega[e](...arguments)})),a(e)}var We={operator(e,t){const n=t.ast,r=e.functions;return e=>Ve(n,r,e)},parameter(e,t){const n=t.ast,r=e.functions;return(e,t)=>Ve(n,r,t,e)},event(e,t){const n=t.ast,r=e.functions;return e=>Ve(n,r,void 0,void 0,e)},handler(e,t){const n=t.ast,r=e.functions;return(e,t)=>{const i=t.item&&t.item.datum;return Ve(n,r,e,i,t)}},encode(e,t){const{marktype:n,channels:r}=t,i=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in r)s=Ve(r[n].ast,i,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,r,o),l}}};const Xe="5.23.0",He=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:h,accessPathWithDatum:p,accessWithDatumToUnescapedPath:f,compile:u,contains:d,deepEqual:g,deleteNestedProperty:m,duplicate:v,entries:E,every:b,fieldIntersection:y,flatAccessWithDatum:w,getFirstDefined:O,hasIntersection:x,hasProperty:A,hash:N,internalField:I,isBoolean:S,isEmpty:R,isEqual:L,isInternalField:$,isNullOrFalse:T,isNumeric:D,keys:C,logicalExpr:k,mergeDeep:F,never:P,normalize:_,normalizeAngle:j,omit:M,pick:z,prefixGenerator:U,removePathFromField:G,replaceAll:B,replacePathInField:V,resetIdCounter:W,setEqual:X,some:H,stringify:q,titleCase:Y,unique:J,uniqueId:Q,vals:K,varName:Z,version:Xe},Symbol.toStringTag,{value:"Module"}));function qe(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var Ye="2.14.0";const Je="#fff",Qe="#888",Ke={background:"#333",view:{stroke:Qe},title:{color:Je,subtitleColor:Je},style:{"guide-label":{fill:Je},"guide-title":{fill:Je}},axis:{domainColor:Je,gridColor:Qe,tickColor:Je}},Ze="#4572a7",et={background:"#fff",arc:{fill:Ze},area:{fill:Ze},line:{stroke:Ze,strokeWidth:2},path:{stroke:Ze},rect:{fill:Ze},shape:{stroke:Ze},symbol:{fill:Ze,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},tt="#30a2da",nt="#cbcbcb",rt="#f0f0f0",it="#333",ot={arc:{fill:tt},area:{fill:tt},axis:{domainColor:nt,grid:!0,gridColor:nt,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:nt,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:rt,group:{fill:rt},legend:{labelColor:it,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:it,titleFontSize:14,titlePadding:10},line:{stroke:tt,strokeWidth:2},path:{stroke:tt,strokeWidth:.5},rect:{fill:tt},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:tt},bar:{binSpacing:2,fill:tt,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},at="#000",st={group:{fill:"#e5e5e5"},arc:{fill:at},area:{fill:at},line:{stroke:at},path:{stroke:at},rect:{fill:at},shape:{stroke:at},symbol:{fill:at,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},lt="Benton Gothic, sans-serif",ct="#82c6df",ht="Benton Gothic Bold, sans-serif",pt="normal",ft={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},ut={background:"#ffffff",title:{anchor:"start",color:"#000000",font:ht,fontSize:22,fontWeight:"normal"},arc:{fill:ct},area:{fill:ct},line:{stroke:ct,strokeWidth:2},path:{stroke:ct},rect:{fill:ct},shape:{stroke:ct},symbol:{fill:ct,size:30},axis:{labelFont:lt,labelFontSize:11.5,labelFontWeight:"normal",titleFont:ht,titleFontSize:13,titleFontWeight:pt},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:lt,labelFontSize:11.5,symbolType:"square",titleFont:ht,titleFontSize:13,titleFontWeight:pt},range:{category:ft["category-6"],diverging:ft["fireandice-6"],heatmap:ft["fire-7"],ordinal:ft["fire-7"],ramp:ft["fire-7"]}},dt="#ab5787",gt="#979797",mt={background:"#f9f9f9",arc:{fill:dt},area:{fill:dt},line:{stroke:dt},path:{stroke:dt},rect:{fill:dt},shape:{stroke:dt},symbol:{fill:dt,size:30},axis:{domainColor:gt,domainWidth:.5,gridWidth:.2,labelColor:gt,tickColor:gt,tickWidth:.2,titleColor:gt},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},vt="#3e5c69",Et={background:"#fff",arc:{fill:vt},area:{fill:vt},line:{stroke:vt},path:{stroke:vt},rect:{fill:vt},shape:{stroke:vt},symbol:{fill:vt},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},bt="#1696d2",yt="#000000",wt="Lato",Ot="Lato",xt={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},At={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:wt},axisX:{domain:!0,domainColor:yt,domainWidth:1,grid:!1,labelFontSize:12,labelFont:Ot,labelAngle:0,tickColor:yt,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:wt},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:Ot,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:wt,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:Ot,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:wt,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:xt["six-groups-cat-1"],diverging:xt["diverging-colors"],heatmap:xt["diverging-colors"],ordinal:xt["six-groups-seq"],ramp:xt["shades-blue"]},area:{fill:bt},rect:{fill:bt},line:{color:bt,stroke:bt,strokeWidth:5},trail:{color:bt,stroke:bt,strokeWidth:0,size:1},path:{stroke:bt,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:bt,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:bt,stroke:null}},arc:{fill:bt},shape:{stroke:bt},symbol:{fill:bt,size:30}},Nt="#3366CC",It="#ccc",St="Arial, sans-serif",Rt={arc:{fill:Nt},area:{fill:Nt},path:{stroke:Nt},rect:{fill:Nt},shape:{stroke:Nt},symbol:{stroke:Nt},circle:{fill:Nt},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:St,fontSize:12},"guide-title":{font:St,fontSize:12},"group-title":{font:St,fontSize:12}},title:{font:St,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:It,tickColor:It,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},Lt=e=>e*(1/3+1),$t=Lt(9),Tt=Lt(10),Dt=Lt(12),Ct="Segoe UI",kt="wf_standard-font, helvetica, arial, sans-serif",Ft="#252423",Pt="#605E5C",_t="transparent",jt="#118DFF",Mt="#DEEFFF",zt=[Mt,jt],Ut={view:{stroke:_t},background:_t,font:Ct,header:{titleFont:kt,titleFontSize:Dt,titleColor:Ft,labelFont:Ct,labelFontSize:Tt,labelColor:Pt},axis:{ticks:!1,grid:!1,domain:!1,labelColor:Pt,labelFontSize:$t,titleFont:kt,titleColor:Ft,titleFontSize:Dt,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:jt},line:{stroke:jt,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:Ct,fontSize:$t,fill:Pt},arc:{fill:jt},area:{fill:jt,line:!0,opacity:.6},path:{stroke:jt},rect:{fill:jt},point:{fill:jt,filled:!0,size:75},shape:{stroke:jt},symbol:{fill:jt,strokeWidth:1.5,size:50},legend:{titleFont:Ct,titleFontWeight:"bold",titleColor:Pt,labelFont:Ct,labelFontSize:Tt,labelColor:Pt,symbolType:"circle",symbolSize:75},range:{category:[jt,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:zt,heatmap:zt,ordinal:[Mt,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",jt]}},Gt='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',Bt=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Vt=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Wt({type:e,background:t}){const n="dark"===e?"#161616":"#ffffff",r="dark"===e?"#f4f4f4":"#161616",i="dark"===e?"#d4bbff":"#6929c4";return{background:t,arc:{fill:i},area:{fill:i},path:{stroke:i},rect:{fill:i},shape:{stroke:i},symbol:{stroke:i},circle:{fill:i},view:{fill:n,stroke:n},group:{fill:n},title:{color:r,anchor:"start",dy:-15,fontSize:16,font:Gt,fontWeight:600},axis:{labelColor:r,labelFontSize:12,grid:!0,gridColor:"#525252",titleColor:r,labelAngle:0},style:{"guide-label":{font:Gt,fill:r,fontWeight:400},"guide-title":{font:Gt,fill:r,fontWeight:400}},range:{category:"dark"===e?Bt:Vt,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const Xt=Wt({type:"light",background:"#ffffff"}),Ht=Wt({type:"light",background:"#f4f4f4"}),qt=Wt({type:"dark",background:"#262626"}),Yt=Wt({type:"dark",background:"#161616"}),Jt=Ye,Qt=Object.freeze(Object.defineProperty({__proto__:null,carbong10:Ht,carbong100:Yt,carbong90:qt,carbonwhite:Xt,dark:Ke,excel:et,fivethirtyeight:ot,ggplot2:st,googlecharts:Rt,latimes:ut,powerbi:Ut,quartz:mt,urbaninstitute:At,version:Jt,vox:Et},Symbol.toStringTag,{value:"Module"}));function Kt(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,r){if("object"!=typeof r||null===r)return r;const i=t.indexOf(this)+1;return t.length=i,t.length>e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}(t))}var Zt="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";const en="vg-tooltip-element",tn={offsetX:10,offsetY:10,id:en,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t(r(e)?e:Kt(e,o)))).join(", ")}]`;if(i(e)){let n="";const{title:r,image:a,...s}=e;r&&(n+=`

${t(r)}

`),a&&(n+=``);const l=Object.keys(s);if(l.length>0){n+="";for(const e of l){let r=s[e];void 0!==r&&(i(r)&&(r=Kt(r,o)),n+=``)}n+="
${t(e)}${t(r)}
"}return n||"{}"}return t(e)}};class nn{constructor(e){this.options={...tn,...e};const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return Zt.toString().replace(en,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),!this.el){this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip");(document.fullscreenElement??document.body).appendChild(this.el)}if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}=function(e,t,n,r){let i=e.clientX+n;i+t.width>window.innerWidth&&(i=+e.clientX-n-t.width);let o=e.clientY+r;return o+t.height>window.innerHeight&&(o=+e.clientY-r-t.height),{x:i,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}var rn,on,an={};function sn(e){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ln(e){var t=function(e,t){if("object"!==sn(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!==sn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===sn(t)?t:String(t)}function cn(e,t,n){return(t=ln(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pn=fn;function fn(e){var t=this;if(t instanceof fn||(t=new fn),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,r=arguments.length;n1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},fn.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},fn.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},fn.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},fn.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new fn;if(tthis.length&&(t=this.length);for(var r=0,i=this.head;null!==i&&rthis.length&&(t=this.length);for(var r=this.length,i=this.tail;null!==i&&r>t;r--)i=i.prev;for(;null!==i&&r>e;r--,i=i.prev)n.push(i.value);return n},fn.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,i=this.head;null!==i&&r1;const Ln=(e,t,n)=>{const r=e[In].get(t);if(r){const t=r.value;if($n(e,t)){if(Dn(e,r),!e[wn])return}else n&&(e[Sn]&&(r.value.now=Date.now()),e[Nn].unshiftNode(r));return t.value}},$n=(e,t)=>{if(!t||!t.maxAge&&!e[On])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[On]&&n>e[On]},Tn=e=>{if(e[bn]>e[En])for(let t=e[Nn].tail;e[bn]>e[En]&&null!==t;){const n=t.prev;Dn(e,t),t=n}},Dn=(e,t)=>{if(t){const n=t.value;e[xn]&&e[xn](n.key,n.value),e[bn]-=n.length,e[In].delete(n.key),e[Nn].removeNode(t)}};class Cn{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const kn=(e,t,n,r)=>{let i=n.value;$n(e,i)&&(Dn(e,n),e[wn]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};var Fn=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[En]=e.max||1/0;const t=e.length||Rn;if(this[yn]="function"!=typeof t?Rn:t,this[wn]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[On]=e.maxAge||0,this[xn]=e.dispose,this[An]=e.noDisposeOnSet||!1,this[Sn]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[En]=e||1/0,Tn(this)}get max(){return this[En]}set allowStale(e){this[wn]=!!e}get allowStale(){return this[wn]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[On]=e,Tn(this)}get maxAge(){return this[On]}set lengthCalculator(e){"function"!=typeof e&&(e=Rn),e!==this[yn]&&(this[yn]=e,this[bn]=0,this[Nn].forEach((e=>{e.length=this[yn](e.value,e.key),this[bn]+=e.length}))),Tn(this)}get lengthCalculator(){return this[yn]}get length(){return this[bn]}get itemCount(){return this[Nn].length}rforEach(e,t){t=t||this;for(let n=this[Nn].tail;null!==n;){const r=n.prev;kn(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[Nn].head;null!==n;){const r=n.next;kn(this,e,n,t),n=r}}keys(){return this[Nn].toArray().map((e=>e.key))}values(){return this[Nn].toArray().map((e=>e.value))}reset(){this[xn]&&this[Nn]&&this[Nn].length&&this[Nn].forEach((e=>this[xn](e.key,e.value))),this[In]=new Map,this[Nn]=new vn,this[bn]=0}dump(){return this[Nn].map((e=>!$n(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[Nn]}set(e,t,n){if((n=n||this[On])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,i=this[yn](t,e);if(this[In].has(e)){if(i>this[En])return Dn(this,this[In].get(e)),!1;const o=this[In].get(e).value;return this[xn]&&(this[An]||this[xn](e,o.value)),o.now=r,o.maxAge=n,o.value=t,this[bn]+=i-o.length,o.length=i,this.get(e),Tn(this),!0}const o=new Cn(e,t,i,r,n);return o.length>this[En]?(this[xn]&&this[xn](e,t),!1):(this[bn]+=o.length,this[Nn].unshift(o),this[In].set(e,this[Nn].head),Tn(this),!0)}has(e){if(!this[In].has(e))return!1;const t=this[In].get(e).value;return!$n(this,t)}get(e){return Ln(this,e,!0)}peek(e){return Ln(this,e,!1)}pop(){const e=this[Nn].tail;return e?(Dn(this,e),e.value):null}del(e){Dn(this,this[In].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[In].forEach(((e,t)=>Ln(this,t,!1)))}};const Pn=Object.freeze({loose:!0}),_n=Object.freeze({});var jn=e=>e?"object"!=typeof e?Pn:e:_n,Mn={exports:{}};var zn={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var Un="object"==typeof process&&an&&an.NODE_DEBUG&&/\bsemver\b/i.test(an.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=zn,o=Un,a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],c=t.t={};let h=0;const p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",i],[p,r]],u=(e,t,n)=>{const r=(e=>{for(const[t,n]of f)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=h++;o(e,i,t),c[e]=i,l[i]=t,a[i]=new RegExp(t,n?"g":void 0),s[i]=new RegExp(r,n?"g":void 0)};u("NUMERICIDENTIFIER","0|[1-9]\\d*"),u("NUMERICIDENTIFIERLOOSE","\\d+"),u("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),u("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),u("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),u("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),u("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),u("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),u("BUILDIDENTIFIER",`${p}+`),u("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),u("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),u("FULL",`^${l[c.FULLPLAIN]}$`),u("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),u("LOOSE",`^${l[c.LOOSEPLAIN]}$`),u("GTLT","((?:<|>)?=?)"),u("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),u("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),u("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),u("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),u("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),u("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),u("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),u("COERCERTL",l[c.COERCE],!0),u("LONETILDE","(?:~>?)"),u("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",u("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),u("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),u("LONECARET","(?:\\^)"),u("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",u("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),u("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),u("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),u("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),u("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",u("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),u("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),u("STAR","(<|>)?=?\\s*\\*"),u("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),u("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Mn,Mn.exports);var Gn=Mn.exports;const Bn=/^[0-9]+$/;var Vn={compareIdentifiers:(e,t)=>{const n=Bn.test(e),r=Bn.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:eXn)throw new TypeError(`version is longer than ${Xn} characters`);Wn("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?qn[Yn.LOOSE]:qn[Yn.FULL]);if(!r)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Hn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Hn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Hn||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===Qn(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const Zn=Kn;var er=(e,t,n)=>new Zn(e,n).compare(new Zn(t,n));const tr=er;const nr=er;const rr=er;const ir=er;const or=er;const ar=er;const sr=(e,t,n)=>0===tr(e,t,n),lr=(e,t,n)=>0!==nr(e,t,n),cr=(e,t,n)=>rr(e,t,n)>0,hr=(e,t,n)=>ir(e,t,n)>=0,pr=(e,t,n)=>or(e,t,n)<0,fr=(e,t,n)=>ar(e,t,n)<=0;var ur,dr,gr,mr,vr=(e,t,n,r)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return sr(e,n,r);case"!=":return lr(e,n,r);case">":return cr(e,n,r);case">=":return hr(e,n,r);case"<":return pr(e,n,r);case"<=":return fr(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};function Er(){if(mr)return gr;mr=1;class e{constructor(t,i){if(i=n(i),t instanceof e)return t.loose===!!i.loose&&t.includePrerelease===!!i.includePrerelease?t:new e(t.raw,i);if(t instanceof r)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!u(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const t of this.set)if(1===t.length&&d(t[0])){this.set=[t];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const n=((this.options.includePrerelease&&p)|(this.options.loose&&f))+":"+e,o=t.get(n);if(o)return o;const d=this.options.loose,g=d?a[s.HYPHENRANGELOOSE]:a[s.HYPHENRANGE];e=e.replace(g,I(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(a[s.COMPARATORTRIM],l),i("comparator trim",e),e=e.replace(a[s.TILDETRIM],c),i("tilde trim",e),e=e.replace(a[s.CARETTRIM],h),i("caret trim",e);let v=e.split(" ").map((e=>m(e,this.options))).join(" ").split(/\s+/).map((e=>N(e,this.options)));d&&(v=v.filter((e=>(i("loose invalid filter",e,this.options),!!e.match(a[s.COMPARATORLOOSE]))))),i("range list",v);const E=new Map,b=v.map((e=>new r(e,this.options)));for(const t of b){if(u(t))return[t];E.set(t.value,t)}E.size>1&&E.has("")&&E.delete("");const y=[...E.values()];return t.set(n,y),y}intersects(t,n){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>g(e,n)&&t.set.some((t=>g(t,n)&&e.every((e=>t.every((t=>e.intersects(t,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new o(e,this.options)}catch(Zr){return!1}for(let t=0;t")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}ur=t;const n=jn,{safeRe:r,t:i}=Gn,o=vr,a=Un,s=Kn,l=Er();return ur}(),i=Un,o=Kn,{safeRe:a,t:s,comparatorTrimReplace:l,tildeTrimReplace:c,caretTrimReplace:h}=Gn,{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:f}=zn,u=e=>"<0.0.0-0"===e.value,d=e=>""===e.value,g=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every((e=>i.intersects(e,t))),i=r.pop();return n},m=(e,t)=>(i("comp",e,t),e=y(e,t),i("caret",e),e=E(e,t),i("tildes",e),e=O(e,t),i("xrange",e),e=A(e,t),i("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,E=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{const n=t.loose?a[s.TILDELOOSE]:a[s.TILDE];return e.replace(n,((t,n,r,o,a)=>{let s;return i("tilde",e,t,n,r,o,a),v(n)?s="":v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(o)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(i("replaceTilde pr",a),s=`>=${n}.${r}.${o}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${o} <${n}.${+r+1}.0-0`,i("tilde return",s),s}))},y=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{i("caret",e,t);const n=t.loose?a[s.CARETLOOSE]:a[s.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,o,a,s)=>{let l;return i("caret",e,t,n,o,a,s),v(n)?l="":v(o)?l=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${o}.0${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.0${r} <${+n+1}.0.0-0`:s?(i("replaceCaret pr",s),l="0"===n?"0"===o?`>=${n}.${o}.${a}-${s} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}-${s} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a}-${s} <${+n+1}.0.0-0`):(i("no pr"),l="0"===n?"0"===o?`>=${n}.${o}.${a}${r} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a} <${+n+1}.0.0-0`),i("caret return",l),l}))},O=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map((e=>x(e,t))).join(" ")),x=(e,t)=>{e=e.trim();const n=t.loose?a[s.XRANGELOOSE]:a[s.XRANGE];return e.replace(n,((n,r,o,a,s,l)=>{i("xRange",e,n,r,o,a,s,l);const c=v(o),h=c||v(a),p=h||v(s),f=p;return"="===r&&f&&(r=""),l=t.includePrerelease?"-0":"",c?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&f?(h&&(a=0),s=0,">"===r?(r=">=",h?(o=+o+1,a=0,s=0):(a=+a+1,s=0)):"<="===r&&(r="<",h?o=+o+1:a=+a+1),"<"===r&&(l="-0"),n=`${r+o}.${a}.${s}${l}`):h?n=`>=${o}.0.0${l} <${+o+1}.0.0-0`:p&&(n=`>=${o}.${a}.0${l} <${o}.${+a+1}.0-0`),i("xRange return",n),n}))},A=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[s.STAR],"")),N=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?s.GTE0PRE:s.GTE0],"")),I=e=>(t,n,r,i,o,a,s,l,c,h,p,f,u)=>`${n=v(r)?"":v(i)?`>=${r}.0.0${e?"-0":""}`:v(o)?`>=${r}.${i}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(c)?"":v(h)?`<${+c+1}.0.0-0`:v(p)?`<${c}.${+h+1}.0-0`:f?`<=${c}.${h}.${p}-${f}`:e?`<${c}.${h}.${+p+1}-0`:`<=${l}`}`.trim(),S=(e,t,n)=>{for(let r=0;r0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return gr}const br=Er();var yr=hn(((e,t,n)=>{try{t=new br(t,n)}catch(Zr){return!1}return t.test(e)}));var wr='.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n';function Or(e,...t){for(const n of t)xr(e,n);return e}function xr(e,t){for(const n of Object.keys(t))s(e,n,t[n],!0)}function Ar(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nr(e){for(var t=1;te,"vega-lite":(e,t)=>Sr.compile(e,{config:t}).spec},kr='\n\n \n \n \n',Fr="chart-wrapper";function Pr(e,t,n,r){const i=`${t}
`,o=`
${n}`,a=window.open("");a.document.write(i+e+o),a.document.title=`${Tr[r]} JSON Source`}function _r(e){return(t=e)&&"load"in t?e:Ir.loader(e);var t}async function jr(e,t,n={}){let s,l;r(t)?(l=_r(n.loader),s=JSON.parse(await l.load(t))):s=t;const c=function(e){var t;const n=(null==(t=e.usermeta)?void 0:t.embedOptions)??{};return r(n.defaultStyle)&&(n.defaultStyle=!1),n}(s),h=c.loader;l&&!h||(l=_r(n.loader??h));const p=await Mr(c,l),f=await Mr(n,l),u=Nr(Nr({},Or(f,p)),{},{config:o(f.config??{},p.config??{})});return await async function(e,t,n={},r){const s=n.theme?o(Qt[n.theme],n.config??{}):n.config,l=a(n.actions)?n.actions:Or({},Lr,n.actions??{}),c=Nr(Nr({},$r),n.i18n),h=n.renderer??"canvas",p=n.logLevel??Ir.Warn,f=n.downloadFileName??"visualization",u="string"==typeof e?document.querySelector(e):e;if(!u)throw new Error(`${e} does not exist`);if(!1!==n.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:r}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(u);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===n.defaultStyle||!0===n.defaultStyle?wr.toString():n.defaultStyle,r.appendChild(t)}}const d=function(e,t){if(e.$schema){const n=qe(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${Tr[n.library]}, but mode argument sets ${Tr[t]??t}.`);const r=n.library;return yr(Dr[r],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${Tr[r]} ${n.version}, but the current version of ${Tr[r]} is v${Dr[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}(t,n.mode);let g=Cr[d](t,s);if("vega-lite"===d&&g.$schema){const e=qe(g.$schema);yr(Dr.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${Dr.vega}.`)}u.classList.add("vega-embed"),l&&u.classList.add("has-actions");u.innerHTML="";let m=u;if(l){const e=document.createElement("div");e.classList.add(Fr),u.appendChild(e),m=e}const v=n.patch;v&&(g=v instanceof Function?v(g):we(g,v,!0,!1).newDocument);n.formatLocale&&Ir.formatLocale(n.formatLocale);n.timeFormatLocale&&Ir.timeFormatLocale(n.timeFormatLocale);if(n.expressionFunctions)for(const i in n.expressionFunctions){const e=n.expressionFunctions[i];"fn"in e?Ir.expressionFunction(i,e.fn,e.visitor):e instanceof Function&&Ir.expressionFunction(i,e)}const{ast:E}=n,b=Ir.parse(g,"vega-lite"===d?{}:s,{ast:E}),y=new(n.viewClass||Ir.View)(b,Nr({loader:r,logLevel:p,renderer:h},E?{expr:Ir.expressionInterpreter??n.expr??We}:{}));if(y.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(m.classList.add("fit-x"),m.classList.remove("fit-y")):"fit-y"==n?(m.classList.remove("fit-x"),m.classList.add("fit-y")):"fit"==n?m.classList.add("fit-x","fit-y"):m.classList.remove("fit-x","fit-y")})),!1!==n.tooltip){const e="function"==typeof n.tooltip?n.tooltip:new nn(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let w,{hover:O}=n;void 0===O&&(O="vega"===d);if(O){const{hoverSet:e,updateSet:t}="boolean"==typeof O?{}:O;y.hover(e,t)}n&&(null!=n.width&&y.width(n.width),null!=n.height&&y.height(n.height),null!=n.padding&&y.padding(n.padding));if(await y.initialize(m,n.bind).runAsync(),!1!==l){let e=u;if(!1!==n.defaultStyle||n.forceActionsMenu){const t=document.createElement("details");t.title=c.CLICK_TO_VIEW_ACTIONS,u.append(t),e=t;const n=document.createElement("summary");n.innerHTML=kr,t.append(n),w=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",w)}const r=document.createElement("div");if(e.append(r),r.classList.add("vega-actions"),!0===l||!1!==l.export)for(const t of["svg","png"])if(!0===l||!0===l.export||l.export[t]){const e=c[`${t.toUpperCase()}_ACTION`],o=document.createElement("a"),a=i(n.scaleFactor)?n.scaleFactor[t]:n.scaleFactor;o.text=e,o.href="#",o.target="_blank",o.download=`${f}.${t}`,o.addEventListener("mousedown",(async function(e){e.preventDefault();const n=await y.toImageURL(t,a);this.href=n})),r.append(o)}if(!0===l||!1!==l.source){const e=document.createElement("a");e.text=c.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){Pr(ke(t),n.sourceHeader??"",n.sourceFooter??"",d),e.preventDefault()})),r.append(e)}if("vega-lite"===d&&(!0===l||!1!==l.compiled)){const e=document.createElement("a");e.text=c.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){Pr(ke(g),n.sourceHeader??"",n.sourceFooter??"","vega"),e.preventDefault()})),r.append(e)}if(!0===l||!1!==l.editor){const e=n.editorUrl??"https://vega.github.io/editor/",i=document.createElement("a");i.text=c.EDITOR_ACTION,i.href="#",i.addEventListener("click",(function(n){!function(e,t,n){const r=e.open(t),{origin:i}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===r&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(r.postMessage(n,i),setTimeout(e,250),o-=1)}),250)}(window,e,{config:s,mode:d,renderer:h,spec:ke(t)}),n.preventDefault()})),r.append(i)}}function x(){w&&document.removeEventListener("click",w),y.finalize()}return{view:y,spec:t,vgSpec:g,finalize:x,embedOptions:n}}(e,s,u,l)}async function Mr(e,t){const n=r(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=r(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return Nr(Nr(Nr({},e),i?{patch:i}:{}),n?{config:n}:{})}function zr(e,t){Object.keys(t).forEach((n=>{!function(e,t,n){var r;n&&((r=n)&&"[object Function]"==={}.toString.call(r)?n(e.data(t)):e.change(t,Ir.changeset().remove((()=>!0)).insert(n)))}(e,n,t[n])}))}function Ur(e){const t=new Set;return e.forEach((e=>{Object.keys(e).forEach((e=>{t.add(e)}))})),t}const Gr=()=>{};function Br(e,t){const n=Object.keys(t);return n.forEach((n=>{try{e.addSignalListener(n,t[n])}catch(r){console.warn("Cannot add invalid signal listener.",r)}})),n.length>0}function Vr(e,t){const n=Object.keys(t);return n.forEach((n=>{try{e.removeSignalListener(n,t[n])}catch(r){console.warn("Cannot remove invalid signal listener.",r)}})),n.length>0}function Wr(e){const{spec:t,width:n,height:r}=e;return void 0!==n&&void 0!==r?{...t,width:n,height:r}:void 0!==n?{...t,width:n}:void 0!==r?{...t,height:r}:t}function Xr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Hr extends l.PureComponent{constructor(){super(...arguments),Xr(this,"containerRef",l.createRef()),Xr(this,"resultPromise",void 0),Xr(this,"handleError",(e=>{const{onError:t=Gr}=this.props;t(e,this.containerRef.current),console.warn(e)})),Xr(this,"modifyView",(e=>{this.resultPromise&&this.resultPromise.then((t=>(t&&e(t.view),!0))).catch(this.handleError)}))}componentDidMount(){this.createView()}componentDidUpdate(e){const t=Ur([this.props,e]);if(t.delete("className"),t.delete("signalListeners"),t.delete("spec"),t.delete("style"),t.delete("width"),t.delete("height"),Array.from(t).some((t=>this.props[t]!==e[t])))this.clearView(),this.createView();else{const t=function(e,t){if(e===t)return!1;const n={width:!1,height:!1,isExpensive:!1},r=Ur([e,t]);return!r.has("width")||"width"in e&&"width"in t&&e.width===t.width||("width"in e&&"number"==typeof e.width?n.width=e.width:n.isExpensive=!0),!r.has("height")||"height"in e&&"height"in t&&e.height===t.height||("height"in e&&"number"==typeof e.height?n.height=e.height:n.isExpensive=!0),r.delete("width"),r.delete("height"),[...r].some((n=>!(n in e)||!(n in t)||!te(e[n],t[n])))&&(n.isExpensive=!0),!(!1===n.width&&!1===n.height&&!n.isExpensive)&&n}(Wr(this.props),Wr(e)),{signalListeners:n}=this.props,{signalListeners:r}=e;if(t)if(t.isExpensive)this.clearView(),this.createView();else{const e=!re(n,r);this.modifyView((i=>{!1!==t.width&&i.width(t.width),!1!==t.height&&i.height(t.height),e&&(r&&Vr(i,r),n&&Br(i,n)),i.run()}))}else re(n,r)||this.modifyView((e=>{r&&Vr(e,r),n&&Br(e,n),e.run()}))}}componentWillUnmount(){this.clearView()}createView(){const{spec:e,onNewView:t,signalListeners:n={},width:r,height:i,...o}=this.props;if(this.containerRef.current){const e=Wr(this.props);this.resultPromise=jr(this.containerRef.current,e,o).then((e=>{if(e){const{view:t}=e;Br(t,n)&&t.run()}return e})).catch(this.handleError),t&&this.modifyView(t)}}clearView(){return this.resultPromise&&this.resultPromise.then((e=>{e&&e.finalize()})).catch(this.handleError),this.resultPromise=void 0,this}render(){const{className:e,style:t}=this.props;return l.createElement("div",{ref:this.containerRef,className:e,style:t})}}function qr(){return qr=Object.assign||function(e){for(var t=1;t{this.update();const{onNewView:t=Gr}=this.props;t(e)}))}componentDidMount(){this.update()}componentDidUpdate(e){re(this.props.data,e.data)||this.update()}update(){const{data:e}=this.props;this.vegaEmbed.current&&e&&Object.keys(e).length>0&&this.vegaEmbed.current.modifyView((t=>{zr(t,e),t.resize().run()}))}render(){const{data:e,...t}=this.props;return l.createElement(Hr,qr({ref:this.vegaEmbed},t,{onNewView:this.handleNewView}))}}function Qr(){return Qr=Object.assign||function(e){for(var t=1;t-1}var L=Object.getOwnPropertySymbols?function(t){for(var r=[];t;)c(r,n(t)),t=o(t);return r}:a;function W(t){return u(t,e,L)}var $=Object.prototype.hasOwnProperty;var _=/\w*$/;var H=i?i.prototype:void 0,J=H?H.valueOf:void 0;function K(t,r,e){var n,a,c,o=t.constructor;switch(r){case"[object ArrayBuffer]":return s(t);case"[object Boolean]":case"[object Date]":return new o(+t);case"[object DataView]":return function(t,r){var e=r?s(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return f(t,e);case"[object Map]":case"[object Set]":return new o;case"[object Number]":case"[object String]":return new o(t);case"[object RegExp]":return(c=new(a=t).constructor(a.source,_.exec(a))).lastIndex=a.lastIndex,c;case"[object Symbol]":return n=t,J?Object(J.call(n)):{}}}var Q=v&&v.isMap,T=Q?l(Q):function(t){return b(t)&&"[object Map]"==j(t)};var X=v&&v.isSet,Y=X?l(X):function(t){return b(t)&&"[object Set]"==j(t)},Z="[object Arguments]",q="[object Function]",z="[object Object]",tt={};function rt(a,c,o,u,s,i){var f,b=1&c,l=2&c,v=4&c;if(void 0!==f)return f;if(!y(a))return a;var O=m(a);if(O){if(f=function(t){var r=t.length,e=new t.constructor(r);return r&&"string"==typeof t[0]&&$.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(a),!b)return p(a,f)}else{var S=j(a),U=S==q||"[object GeneratorFunction]"==S;if(A(a))return h(a,b);if(S==z||S==Z||U&&!s){if(f=l||U?{}:g(a),!b)return l?function(r,e){return t(r,L(r),e)}(a,function(r,n){return r&&t(n,e(n),r)}(f,a)):function(r,e){return t(r,n(r),e)}(a,function(e,n){return e&&t(n,r(n),e)}(f,a))}else{if(!tt[S])return s?a:{};f=K(a,S,b)}}i||(i=new d);var I=i.get(a);if(I)return I;i.set(a,f),Y(a)?a.forEach((function(t){f.add(rt(t,c,o,t,a,i))})):T(a)&&a.forEach((function(t,r){f.set(r,rt(t,c,o,r,a,i))}));var F=O?void 0:(v?l?W:w:l?e:r)(a);return R(F||a,(function(t,r){F&&(t=a[r=t]),x(f,r,rt(t,c,o,r,a,i))})),f}function et(t){return"function"==typeof t?t:O}function nt(t,r){return(m(t)?R:D)(t,et(r))}function at(t,r){var e=[];return D(t,(function(t,n,a){r(t,n,a)&&e.push(t)})),e}function ct(t,r){return(m(t)?S:at)(t,P(r))}function ot(t){return null==t?[]:function(t,r){return U(r,(function(r){return t[r]}))}(t,r(t))}function ut(t){return void 0===t}function st(t,r,e,n,a){return a(t,(function(t,a,c){e=n?(n=!1,t):r(e,t,a,c)})),e}function it(t,r,e){var n=m(t)?I:st,a=arguments.length<3;return n(t,P(r),e,a,D)}tt[Z]=tt["[object Array]"]=tt["[object ArrayBuffer]"]=tt["[object DataView]"]=tt["[object Boolean]"]=tt["[object Date]"]=tt["[object Float32Array]"]=tt["[object Float64Array]"]=tt["[object Int8Array]"]=tt["[object Int16Array]"]=tt["[object Int32Array]"]=tt["[object Map]"]=tt["[object Number]"]=tt[z]=tt["[object RegExp]"]=tt["[object Set]"]=tt["[object String]"]=tt["[object Symbol]"]=tt["[object Uint8Array]"]=tt["[object Uint8ClampedArray]"]=tt["[object Uint16Array]"]=tt["[object Uint32Array]"]=!0,tt["[object Error]"]=tt[q]=tt["[object WeakMap]"]=!1;var ft=F&&1/E(new F([,-0]))[1]==1/0?function(t){return new F(t)}:N;function bt(t,r,e){var n=-1,a=G,c=t.length,o=!0,u=[],s=u;if(c>=200){var i=r?null:ft(t);if(i)return E(i);o=!1,a=B,s=new M}else s=r?[]:u;t:for(;++n{const a=t.c(26);let l,n,d,c,u;a[0]!==e?(({language:l,showCopyButton:d,extensions:c,...n}=e),a[0]=e,a[1]=l,a[2]=n,a[3]=d,a[4]=c):(l=a[1],n=a[2],d=a[3],c=a[4]),a[5]!==c?(u=void 0===c?[]:c,a[5]=c,a[6]=u):u=a[6];const x=u,f=l&&!(l in j);let g;f&&s.warn(`Language ${l} not found in CodeMirror.`);t:{if(!l){g=x;break t}const t=l;let s,i;a[7]!==t?(s=m(t),a[7]=t,a[8]=s):s=a[8],a[9]!==x||a[10]!==s?(i=[s,...x].filter(Boolean),a[9]=x,a[10]=s,a[11]=i):i=a[11],g=i}const h=g;let v,b,k,y;return a[12]!==f||a[13]!==l?(v=f&&i.jsx(o,{className:"mb-1 rounded-sm",error:`Language ${l} not supported. \n\nSupported languages are: ${Object.keys(j).join(", ")}`}),a[12]=f,a[13]=l,a[14]=v):v=a[14],a[15]!==f||a[16]!==n||a[17]!==d?(b=d&&!f&&i.jsx(r,{tooltip:!1,className:"absolute top-2 right-2 p-1 hover-action z-10 text-muted-foreground",value:n.value||"",toastTitle:"Copied to clipboard"}),a[15]=f,a[16]=n,a[17]=d,a[18]=b):b=a[18],a[19]!==h||a[20]!==n?(k=i.jsx(p,{...n,extensions:h}),a[19]=h,a[20]=n,a[21]=k):k=a[21],a[22]!==v||a[23]!==b||a[24]!==k?(y=i.jsxs("div",{className:"relative w-full group hover-actions-parent",children:[v,b,k]}),a[22]=v,a[23]=b,a[24]=k,a[25]=y):y=a[25],y};export{e as default}; diff --git a/docs/assets/apl-CXdQSnD-.js b/docs/assets/apl-CXdQSnD-.js deleted file mode 100644 index 3247810..0000000 --- a/docs/assets/apl-CXdQSnD-.js +++ /dev/null @@ -1 +0,0 @@ -var e={"+":["conjugate","add"],"−":["negate","subtract"],"×":["signOf","multiply"],"÷":["reciprocal","divide"],"⌈":["ceiling","greaterOf"],"⌊":["floor","lesserOf"],"∣":["absolute","residue"],"⍳":["indexGenerate","indexOf"],"?":["roll","deal"],"⋆":["exponentiate","toThePowerOf"],"⍟":["naturalLog","logToTheBase"],"○":["piTimes","circularFuncs"],"!":["factorial","binomial"],"⌹":["matrixInverse","matrixDivide"],"<":[null,"lessThan"],"≤":[null,"lessThanOrEqual"],"=":[null,"equals"],">":[null,"greaterThan"],"≥":[null,"greaterThanOrEqual"],"≠":[null,"notEqual"],"≡":["depth","match"],"≢":[null,"notMatch"],"∈":["enlist","membership"],"⍷":[null,"find"],"∪":["unique","union"],"∩":[null,"intersection"],"∼":["not","without"],"∨":[null,"or"],"∧":[null,"and"],"⍱":[null,"nor"],"⍲":[null,"nand"],"⍴":["shapeOf","reshape"],",":["ravel","catenate"],"⍪":[null,"firstAxisCatenate"],"⌽":["reverse","rotate"],"⊖":["axis1Reverse","axis1Rotate"],"⍉":["transpose",null],"↑":["first","take"],"↓":[null,"drop"],"⊂":["enclose","partitionWithAxis"],"⊃":["diclose","pick"],"⌷":[null,"index"],"⍋":["gradeUp",null],"⍒":["gradeDown",null],"⊤":["encode",null],"⊥":["decode",null],"⍕":["format","formatByExample"],"⍎":["execute",null],"⊣":["stop","left"],"⊢":["pass","right"]},n=/[\.\/⌿⍀¨⍣]/,t=/⍬/,l=/[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/,a=/←/,r=/[⍝#].*$/;const i={name:"apl",startState:function(){return{prev:!1,func:!1,op:!1,string:!1,escape:!1}},token:function(i,u){var o,s,c;return i.eatSpace()?null:'"'===(o=i.next())||"'"===o?(i.eatWhile((s=o,c=!1,function(e){return c=e,e!==s||"\\"===c})),i.next(),u.prev=!0,"string"):/[\[{\(]/.test(o)?(u.prev=!1,null):/[\]}\)]/.test(o)?(u.prev=!0,null):t.test(o)?(u.prev=!1,"atom"):/[¯\d]/.test(o)?(u.func?(u.func=!1,u.prev=!1):u.prev=!0,i.eatWhile(/[\w\.]/),"number"):n.test(o)||a.test(o)?"operator":l.test(o)?(u.func=!0,u.prev=!1,e[o]?"variableName.function.standard":"variableName.function"):r.test(o)?(i.skipToEnd(),"comment"):"∘"===o&&"."===i.peek()?(i.next(),"variableName.function"):(i.eatWhile(/[\w\$_]/),u.prev=!0,"keyword")}};export{i as apl}; diff --git a/docs/assets/arc-Cuwikxov.js b/docs/assets/arc-Cuwikxov.js deleted file mode 100644 index e56ef97..0000000 --- a/docs/assets/arc-Cuwikxov.js +++ /dev/null @@ -1 +0,0 @@ -import{w as n,p as t,c as r,s as c,a as e,h as a,e as u,t as i,b as o,m as y,d as l,f,g as s,i as p,j as x}from"./step-BwsUM5iJ.js";function h(n){return n.innerRadius}function v(n){return n.outerRadius}function g(n){return n.startAngle}function d(n){return n.endAngle}function m(n){return n&&n.padAngle}function T(n,t,r,c,e,a,u){var i=n-r,y=t-c,l=(u?a:-a)/o(i*i+y*y),f=l*y,s=-l*i,x=n+f,h=t+s,v=r+f,g=c+s,d=(x+v)/2,m=(h+g)/2,T=v-x,A=g-h,R=T*T+A*A,j=e-a,b=x*g-v*h,w=(A<0?-1:1)*o(p(0,j*j*R-b*b)),P=(b*A-T*w)/R,k=(-b*T-A*w)/R,q=(b*A+T*w)/R,z=(-b*T+A*w)/R,B=P-d,C=k-m,D=q-d,E=z-m;return B*B+C*C>D*D+E*E&&(P=q,k=z),{cx:P,cy:k,x01:-f,y01:-s,x11:P*(e/j-1),y11:k*(e/j-1)}}function A(){var p=h,A=v,R=e(0),j=null,b=g,w=d,P=m,k=null,q=n(z);function z(){var n,e,h=+p.apply(this,arguments),v=+A.apply(this,arguments),g=b.apply(this,arguments)-a,d=w.apply(this,arguments)-a,m=l(d-g),z=d>g;if(k||(k=n=q()),vu)if(m>i-u)k.moveTo(v*r(g),v*c(g)),k.arc(0,0,v,g,d,!z),h>u&&(k.moveTo(h*r(d),h*c(d)),k.arc(0,0,h,d,g,z));else{var B,C,D=g,E=d,F=g,G=d,H=m,I=m,J=P.apply(this,arguments)/2,K=J>u&&(j?+j.apply(this,arguments):o(h*h+v*v)),L=y(l(v-h)/2,+R.apply(this,arguments)),M=L,N=L;if(K>u){var O=s(K/h*c(J)),Q=s(K/v*c(J));(H-=2*O)>u?(F+=O*=z?1:-1,G-=O):(H=0,F=G=(g+d)/2),(I-=2*Q)>u?(D+=Q*=z?1:-1,E-=Q):(I=0,D=E=(g+d)/2)}var S=v*r(D),U=v*c(D),V=h*r(G),W=h*c(G);if(L>u){var X,Y=v*r(E),Z=v*c(E),$=h*r(F),_=h*c(F);if(mu?N>u?(B=T($,_,S,U,v,N,z),C=T(Y,Z,V,W,v,N,z),k.moveTo(B.cx+B.x01,B.cy+B.y01),Nu&&H>u?M>u?(B=T(V,W,Y,Z,h,-M,z),C=T(S,U,$,_,h,-M,z),k.lineTo(B.cx+B.x01,B.cy+B.y01),Me?(this.rect.x-=(this.labelWidth-e)/2,this.setWidth(this.labelWidth)):"right"==this.labelPosHorizontal&&this.setWidth(e+this.labelWidth)),this.labelHeight&&("top"==this.labelPosVertical?(this.rect.y-=this.labelHeight,this.setHeight(i+this.labelHeight)):"center"==this.labelPosVertical&&this.labelHeight>i?(this.rect.y-=(this.labelHeight-i)/2,this.setHeight(this.labelHeight)):"bottom"==this.labelPosVertical&&this.setHeight(i+this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==r.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},l.prototype.transform=function(t){var e=this.rect.x;e>a.WORLD_BOUNDARY?e=a.WORLD_BOUNDARY:e<-a.WORLD_BOUNDARY&&(e=-a.WORLD_BOUNDARY);var i=this.rect.y;i>a.WORLD_BOUNDARY?i=a.WORLD_BOUNDARY:i<-a.WORLD_BOUNDARY&&(i=-a.WORLD_BOUNDARY);var n=new h(e,i),r=t.inverseTransformPoint(n);this.setLocation(r.x,r.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},t.exports=l},function(t,e,i){var n=i(0);function r(){}for(var o in n)r[o]=n[o];r.MAX_ITERATIONS=2500,r.DEFAULT_EDGE_LENGTH=50,r.DEFAULT_SPRING_STRENGTH=.45,r.DEFAULT_REPULSION_STRENGTH=4500,r.DEFAULT_GRAVITY_STRENGTH=.4,r.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,r.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,r.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,r.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,r.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,r.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,r.COOLING_ADAPTATION_FACTOR=.33,r.ADAPTATION_LOWER_NODE_LIMIT=1e3,r.ADAPTATION_UPPER_NODE_LIMIT=5e3,r.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,r.MAX_NODE_DISPLACEMENT=3*r.MAX_NODE_DISPLACEMENT_INCREMENTAL,r.MIN_REPULSION_DIST=r.DEFAULT_EDGE_LENGTH/10,r.CONVERGENCE_CHECK_PERIOD=100,r.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,r.MIN_EDGE_LENGTH=1,r.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=r},function(t,e,i){function n(t,e){null==t&&null==e?(this.x=0,this.y=0):(this.x=t,this.y=e)}n.prototype.getX=function(){return this.x},n.prototype.getY=function(){return this.y},n.prototype.setX=function(t){this.x=t},n.prototype.setY=function(t){this.y=t},n.prototype.getDifference=function(t){return new DimensionD(this.x-t.x,this.y-t.y)},n.prototype.getCopy=function(){return new n(this.x,this.y)},n.prototype.translate=function(t){return this.x+=t.width,this.y+=t.height,this},t.exports=n},function(t,e,i){var n=i(2),r=i(10),o=i(0),a=i(7),s=i(3),h=i(1),l=i(13),d=i(12),c=i(11);function g(t,e,i){n.call(this,i),this.estimatedSize=r.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=t,null!=e&&e instanceof a?this.graphManager=e:null!=e&&e instanceof Layout&&(this.graphManager=e.graphManager)}for(var u in g.prototype=Object.create(n.prototype),n)g[u]=n[u];g.prototype.getNodes=function(){return this.nodes},g.prototype.getEdges=function(){return this.edges},g.prototype.getGraphManager=function(){return this.graphManager},g.prototype.getParent=function(){return this.parent},g.prototype.getLeft=function(){return this.left},g.prototype.getRight=function(){return this.right},g.prototype.getTop=function(){return this.top},g.prototype.getBottom=function(){return this.bottom},g.prototype.isConnected=function(){return this.isConnected},g.prototype.add=function(t,e,i){if(null==e&&null==i){var n=t;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(n)>-1)throw"Node already in graph!";return n.owner=this,this.getNodes().push(n),n}var r=t;if(!(this.getNodes().indexOf(e)>-1&&this.getNodes().indexOf(i)>-1))throw"Source or target not in graph!";if(e.owner!=i.owner||e.owner!=this)throw"Both owners must be this graph!";return e.owner!=i.owner?null:(r.source=e,r.target=i,r.isInterGraph=!1,this.getEdges().push(r),e.edges.push(r),i!=e&&i.edges.push(r),r)},g.prototype.remove=function(t){var e=t;if(t instanceof s){if(null==e)throw"Node is null!";if(null==e.owner||e.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var i=e.edges.slice(),n=i.length,r=0;r-1&&d>-1))throw"Source and/or target doesn't know this edge!";if(o.source.edges.splice(l,1),o.target!=o.source&&o.target.edges.splice(d,1),-1==(a=o.source.owner.getEdges().indexOf(o)))throw"Not in owner's edge list!";o.source.owner.getEdges().splice(a,1)}},g.prototype.updateLeftTop=function(){for(var t,e,i,n=r.MAX_VALUE,o=r.MAX_VALUE,a=this.getNodes(),s=a.length,h=0;h(t=l.getTop())&&(n=t),o>(e=l.getLeft())&&(o=e)}return n==r.MAX_VALUE?null:(i=null!=a[0].getParent().paddingLeft?a[0].getParent().paddingLeft:this.margin,this.left=o-i,this.top=n-i,new d(this.left,this.top))},g.prototype.updateBounds=function(t){for(var e,i,n,o,a,s=r.MAX_VALUE,h=-r.MAX_VALUE,d=r.MAX_VALUE,c=-r.MAX_VALUE,g=this.nodes,u=g.length,p=0;p(e=f.getLeft())&&(s=e),h<(i=f.getRight())&&(h=i),d>(n=f.getTop())&&(d=n),c<(o=f.getBottom())&&(c=o)}var v=new l(s,d,h-s,c-d);s==r.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),a=null!=g[0].getParent().paddingLeft?g[0].getParent().paddingLeft:this.margin,this.left=v.x-a,this.right=v.x+v.width+a,this.top=v.y-a,this.bottom=v.y+v.height+a},g.calculateBounds=function(t){for(var e,i,n,o,a=r.MAX_VALUE,s=-r.MAX_VALUE,h=r.MAX_VALUE,d=-r.MAX_VALUE,c=t.length,g=0;g(e=u.getLeft())&&(a=e),s<(i=u.getRight())&&(s=i),h>(n=u.getTop())&&(h=n),d<(o=u.getBottom())&&(d=o)}return new l(a,h,s-a,d-h)},g.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},g.prototype.getEstimatedSize=function(){if(this.estimatedSize==r.MIN_VALUE)throw"assert failed";return this.estimatedSize},g.prototype.calcEstimatedSize=function(){for(var t=0,e=this.nodes,i=e.length,n=0;n=this.nodes.length){var h=0;r.forEach((function(e){e.owner==t&&h++})),h==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},t.exports=g},function(t,e,i){var n,r=i(1);function o(t){n=i(6),this.layout=t,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var t=this.layout.newGraph(),e=this.layout.newNode(null),i=this.add(t,e);return this.setRootGraph(i),this.rootGraph},o.prototype.add=function(t,e,i,n,r){if(null==i&&null==n&&null==r){if(null==t)throw"Graph is null!";if(null==e)throw"Parent node is null!";if(this.graphs.indexOf(t)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(t),null!=t.parent)throw"Already has a parent!";if(null!=e.child)throw"Already has a child!";return t.parent=e,e.child=t,t}r=i,i=t;var o=(n=e).getOwner(),a=r.getOwner();if(null==o||o.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==a||a.getGraphManager()!=this)throw"Target not in this graph mgr!";if(o==a)return i.isInterGraph=!1,o.add(i,n,r);if(i.isInterGraph=!0,i.source=n,i.target=r,this.edges.indexOf(i)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(i),null==i.source||null==i.target)throw"Edge source and/or target is null!";if(-1!=i.source.edges.indexOf(i)||-1!=i.target.edges.indexOf(i))throw"Edge already in source and/or target incidency list!";return i.source.edges.push(i),i.target.edges.push(i),i},o.prototype.remove=function(t){if(t instanceof n){var e=t;if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(e!=this.rootGraph&&(null==e.parent||e.parent.graphManager!=this))throw"Invalid parent node!";for(var i,o=[],a=(o=o.concat(e.getEdges())).length,s=0;s=e.getRight()?i[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight()):e.getX()<=t.getX()&&e.getRight()>=t.getRight()&&(i[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight())),t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()?i[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()):e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()&&(i[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()));var o=Math.abs((e.getCenterY()-t.getCenterY())/(e.getCenterX()-t.getCenterX()));e.getCenterY()===t.getCenterY()&&e.getCenterX()===t.getCenterX()&&(o=1);var a=o*i[0],s=i[1]/o;i[0]a)return i[0]=n,i[1]=h,i[2]=o,i[3]=E,!1;if(ro)return i[0]=s,i[1]=r,i[2]=m,i[3]=a,!1;if(no?(i[0]=d,i[1]=c,w=!0):(i[0]=l,i[1]=h,w=!0):I===C&&(n>o?(i[0]=s,i[1]=h,w=!0):(i[0]=g,i[1]=c,w=!0)),-_===C?o>n?(i[2]=y,i[3]=E,L=!0):(i[2]=m,i[3]=v,L=!0):_===C&&(o>n?(i[2]=f,i[3]=v,L=!0):(i[2]=N,i[3]=E,L=!0)),w&&L)return!1;if(n>o?r>a?(M=this.getCardinalDirection(I,C,4),x=this.getCardinalDirection(_,C,2)):(M=this.getCardinalDirection(-I,C,3),x=this.getCardinalDirection(-_,C,1)):r>a?(M=this.getCardinalDirection(-I,C,1),x=this.getCardinalDirection(-_,C,3)):(M=this.getCardinalDirection(I,C,2),x=this.getCardinalDirection(_,C,4)),!w)switch(M){case 1:D=h,O=n+-p/C,i[0]=O,i[1]=D;break;case 2:O=g,D=r+u*C,i[0]=O,i[1]=D;break;case 3:D=c,O=n+p/C,i[0]=O,i[1]=D;break;case 4:O=d,D=r+-u*C,i[0]=O,i[1]=D}if(!L)switch(x){case 1:b=v,R=o+-A/C,i[2]=R,i[3]=b;break;case 2:R=N,b=a+T*C,i[2]=R,i[3]=b;break;case 3:b=E,R=o+A/C,i[2]=R,i[3]=b;break;case 4:R=y,b=a+-T*C,i[2]=R,i[3]=b}}return!1},r.getCardinalDirection=function(t,e,i){return t>e?i:1+i%4},r.getIntersection=function(t,e,i,r){if(null==r)return this.getIntersection2(t,e,i);var o,a,s,h,l,d,c,g=t.x,u=t.y,p=e.x,f=e.y,v=i.x,m=i.y,y=r.x,E=r.y;return 0==(c=(o=f-u)*(h=v-y)-(a=E-m)*(s=g-p))?null:new n((s*(d=y*m-v*E)-h*(l=p*u-g*f))/c,(a*l-o*d)/c)},r.angleOfVector=function(t,e,i,n){var r=void 0;return t!==i?(r=Math.atan((n-e)/(i-t)),i=0){var d=(-h+Math.sqrt(h*h-4*s*l))/(2*s),c=(-h-Math.sqrt(h*h-4*s*l))/(2*s);return d>=0&&d<=1?[d]:c>=0&&c<=1?[c]:null}return null},r.HALF_PI=.5*Math.PI,r.ONE_AND_HALF_PI=1.5*Math.PI,r.TWO_PI=2*Math.PI,r.THREE_PI=3*Math.PI,t.exports=r},function(t,e,i){function n(){}n.sign=function(t){return t>0?1:t<0?-1:0},n.floor=function(t){return t<0?Math.ceil(t):Math.floor(t)},n.ceil=function(t){return t<0?Math.floor(t):Math.ceil(t)},t.exports=n},function(t,e,i){function n(){}n.MAX_VALUE=2147483647,n.MIN_VALUE=-2147483648,t.exports=n},function(t,e,i){var n=function(){function t(t,e){for(var i=0;i0&&e;){for(s.push(l[0]);s.length>0&&e;){var d=s[0];s.splice(0,1),a.add(d);var c=d.getEdges();for(o=0;o-1&&l.splice(f,1)}a=new Set,h=new Map}else t=[]}return t},g.prototype.createDummyNodesForBendpoints=function(t){for(var e=[],i=t.source,n=this.graphManager.calcLowestCommonAncestor(t.source,t.target),r=0;r0){for(var r=this.edgeToDummyNodes.get(i),o=0;o=0&&e.splice(c,1),d.getNeighborsList().forEach((function(t){if(i.indexOf(t)<0){var e=n.get(t)-1;1==e&&h.push(t),n.set(t,e)}}))}i=i.concat(h),1!=e.length&&2!=e.length||(r=!0,o=e[0])}return o},g.prototype.setGraphManager=function(t){this.graphManager=t},t.exports=g},function(t,e,i){function n(){}n.seed=1,n.x=0,n.nextDouble=function(){return n.x=1e4*Math.sin(n.seed++),n.x-Math.floor(n.x)},t.exports=n},function(t,e,i){var n=i(5);function r(t,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}r.prototype.getWorldOrgX=function(){return this.lworldOrgX},r.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},r.prototype.getWorldOrgY=function(){return this.lworldOrgY},r.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},r.prototype.getWorldExtX=function(){return this.lworldExtX},r.prototype.setWorldExtX=function(t){this.lworldExtX=t},r.prototype.getWorldExtY=function(){return this.lworldExtY},r.prototype.setWorldExtY=function(t){this.lworldExtY=t},r.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},r.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},r.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},r.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},r.prototype.getDeviceExtX=function(){return this.ldeviceExtX},r.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},r.prototype.getDeviceExtY=function(){return this.ldeviceExtY},r.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},r.prototype.transformX=function(t){var e=0,i=this.lworldExtX;return 0!=i&&(e=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/i),e},r.prototype.transformY=function(t){var e=0,i=this.lworldExtY;return 0!=i&&(e=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/i),e},r.prototype.inverseTransformX=function(t){var e=0,i=this.ldeviceExtX;return 0!=i&&(e=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/i),e},r.prototype.inverseTransformY=function(t){var e=0,i=this.ldeviceExtY;return 0!=i&&(e=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/i),e},r.prototype.inverseTransformPoint=function(t){return new n(this.inverseTransformX(t.x),this.inverseTransformY(t.y))},t.exports=r},function(t,e,i){var n=i(15),r=i(4),o=i(0),a=i(8),s=i(9);function h(){n.call(this),this.useSmartIdealEdgeLengthCalculation=r.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=r.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=r.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=r.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=r.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*r.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=r.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=r.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=r.MAX_ITERATIONS}for(var l in h.prototype=Object.create(n.prototype),n)h[l]=n[l];h.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=r.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var t,e,i,n,a,s,h,l=this.getGraphManager().getAllEdges(),d=0;dr.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*r.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-r.ADAPTATION_LOWER_NODE_LIMIT)/(r.ADAPTATION_UPPER_NODE_LIMIT-r.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-r.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=r.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>r.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(r.COOLING_ADAPTATION_FACTOR,1-(t-r.ADAPTATION_LOWER_NODE_LIMIT)/(r.ADAPTATION_UPPER_NODE_LIMIT-r.ADAPTATION_LOWER_NODE_LIMIT)*(1-r.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=r.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*r.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var t,e=this.getAllEdges(),i=0;i0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],h=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%r.GRID_CALCULATION_CHECK_PERIOD==1&&a&&this.updateGrid(),o=new Set,t=0;t(h=e.getEstimatedSize()*this.gravityRangeFactor)||s>h)&&(t.gravitationForceX=-this.gravityConstant*r,t.gravitationForceY=-this.gravityConstant*o):(a>(h=e.getEstimatedSize()*this.compoundGravityRangeFactor)||s>h)&&(t.gravitationForceX=-this.gravityConstant*r*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*o*this.compoundGravityConstant)},h.prototype.isConverged=function(){var t,e=!1;return this.totalIterations>this.maxIterations/3&&(e=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=s.length||l>=s[0].length))for(var d=0;dt}}]),t}();t.exports=o},function(t,e,i){function n(){}n.svd=function(t){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=t.length,this.n=t[0].length;var e=Math.min(this.m,this.n);this.s=function(t){for(var e=[];t-- >0;)e.push(0);return e}(Math.min(this.m+1,this.n)),this.U=function t(e){if(0==e.length)return 0;for(var i=[],n=0;n0;)e.push(0);return e}(this.n),r=function(t){for(var e=[];t-- >0;)e.push(0);return e}(this.m),o=Math.min(this.m-1,this.n),a=Math.max(0,Math.min(this.n-2,this.m)),s=0;s=0;C--)if(0!==this.s[C]){for(var M=C+1;M=0;F--){if(function(t,e){return t&&e}(F0;){var B=void 0,V=void 0;for(B=L-2;B>=-1&&-1!==B;B--)if(Math.abs(i[B])<=z+X*(Math.abs(this.s[B])+Math.abs(this.s[B+1]))){i[B]=0;break}if(B===L-2)V=4;else{var W=void 0;for(W=L-1;W>=B&&W!==B;W--){var j=(W!==L?Math.abs(i[W]):0)+(W!==B+1?Math.abs(i[W-1]):0);if(Math.abs(this.s[W])<=z+X*j){this.s[W]=0;break}}W===B?V=3:W===L-1?V=1:(V=2,B=W)}switch(B++,V){case 1:var q=i[L-2];i[L-2]=0;for(var $=L-2;$>=B;$--){var Z=n.hypot(this.s[$],q),Q=this.s[$]/Z,J=q/Z;this.s[$]=Z,$!==B&&(q=-J*i[$-1],i[$-1]=Q*i[$-1]);for(var K=0;K=this.s[B+1]);){var Lt=this.s[B];if(this.s[B]=this.s[B+1],this.s[B+1]=Lt,BMath.abs(e)?(i=e/t,i=Math.abs(t)*Math.sqrt(1+i*i)):0!=e?(i=t/e,i=Math.abs(e)*Math.sqrt(1+i*i)):i=0,i},t.exports=n},function(t,e,i){var n=function(){function t(t,e){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequence1=e,this.sequence2=i,this.match_score=n,this.mismatch_penalty=r,this.gap_penalty=o,this.iMax=e.length+1,this.jMax=i.length+1,this.grid=new Array(this.iMax);for(var a=0;a=0;i--){var n=this.listeners[i];n.event===t&&n.callback===e&&this.listeners.splice(i,1)}},r.emit=function(t,e){for(var i=0;i{var n={};n.layoutBase=i(551),n.CoSEConstants=i(806),n.CoSEEdge=i(767),n.CoSEGraph=i(880),n.CoSEGraphManager=i(578),n.CoSELayout=i(765),n.CoSENode=i(991),n.ConstraintHandler=i(902),t.exports=n},806:(t,e,i)=>{var n=i(551).FDLayoutConstants;function r(){}for(var o in n)r[o]=n[o];r.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,r.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH,r.DEFAULT_COMPONENT_SEPERATION=60,r.TILE=!0,r.TILING_PADDING_VERTICAL=10,r.TILING_PADDING_HORIZONTAL=10,r.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,r.ENFORCE_CONSTRAINTS=!0,r.APPLY_LAYOUT=!0,r.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,r.TREE_REDUCTION_ON_INCREMENTAL=!0,r.PURE_INCREMENTAL=r.DEFAULT_INCREMENTAL,t.exports=r},767:(t,e,i)=>{var n=i(551).FDLayoutEdge;function r(t,e,i){n.call(this,t,e,i)}for(var o in r.prototype=Object.create(n.prototype),n)r[o]=n[o];t.exports=r},880:(t,e,i)=>{var n=i(551).LGraph;function r(t,e,i){n.call(this,t,e,i)}for(var o in r.prototype=Object.create(n.prototype),n)r[o]=n[o];t.exports=r},578:(t,e,i)=>{var n=i(551).LGraphManager;function r(t){n.call(this,t)}for(var o in r.prototype=Object.create(n.prototype),n)r[o]=n[o];t.exports=r},765:(t,e,i)=>{var n=i(551).FDLayout,r=i(578),o=i(880),a=i(991),s=i(767),h=i(806),l=i(902),d=i(551).FDLayoutConstants,c=i(551).LayoutConstants,g=i(551).Point,u=i(551).PointD,p=i(551).DimensionD,f=i(551).Layout,v=i(551).Integer,m=i(551).IGeometry,y=i(551).LGraph,E=i(551).Transform,N=i(551).LinkedList;function T(){n.call(this),this.toBeTiled={},this.constraints={}}for(var A in T.prototype=Object.create(n.prototype),n)T[A]=n[A];T.prototype.newGraphManager=function(){var t=new r(this);return this.graphManager=t,t},T.prototype.newGraph=function(t){return new o(null,this.graphManager,t)},T.prototype.newNode=function(t){return new a(this.graphManager,t)},T.prototype.newEdge=function(t){return new s(null,null,t)},T.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},T.prototype.initSpringEmbedder=function(){n.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},T.prototype.layout=function(){return c.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},T.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(i));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(i),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(l.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},T.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,n=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,n),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},T.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i0&&this.updateDisplacements(),e=0;e0&&(n.fixedNodeWeight=o)}if(this.constraints.relativePlacementConstraint){var a=new Map,s=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach((function(e){t.fixedNodesOnHorizontal.add(e),t.fixedNodesOnVertical.add(e)})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var l=this.constraints.alignmentConstraint.vertical;for(i=0;i=2*t.length/3;n--)e=Math.floor(Math.random()*(n+1)),i=t[n],t[n]=t[e],t[e]=i;return t},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach((function(e){if(e.left){var i=a.has(e.left)?a.get(e.left):e.left,n=a.has(e.right)?a.get(e.right):e.right;t.nodesInRelativeHorizontal.includes(i)||(t.nodesInRelativeHorizontal.push(i),t.nodeToRelativeConstraintMapHorizontal.set(i,[]),t.dummyToNodeForVerticalAlignment.has(i)?t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(i)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(i).getCenterX())),t.nodesInRelativeHorizontal.includes(n)||(t.nodesInRelativeHorizontal.push(n),t.nodeToRelativeConstraintMapHorizontal.set(n,[]),t.dummyToNodeForVerticalAlignment.has(n)?t.nodeToTempPositionMapHorizontal.set(n,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(n)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(n,t.idToNodeMap.get(n).getCenterX())),t.nodeToRelativeConstraintMapHorizontal.get(i).push({right:n,gap:e.gap}),t.nodeToRelativeConstraintMapHorizontal.get(n).push({left:i,gap:e.gap})}else{var r=s.has(e.top)?s.get(e.top):e.top,o=s.has(e.bottom)?s.get(e.bottom):e.bottom;t.nodesInRelativeVertical.includes(r)||(t.nodesInRelativeVertical.push(r),t.nodeToRelativeConstraintMapVertical.set(r,[]),t.dummyToNodeForHorizontalAlignment.has(r)?t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(r)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(r).getCenterY())),t.nodesInRelativeVertical.includes(o)||(t.nodesInRelativeVertical.push(o),t.nodeToRelativeConstraintMapVertical.set(o,[]),t.dummyToNodeForHorizontalAlignment.has(o)?t.nodeToTempPositionMapVertical.set(o,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(o)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(o,t.idToNodeMap.get(o).getCenterY())),t.nodeToRelativeConstraintMapVertical.get(r).push({bottom:o,gap:e.gap}),t.nodeToRelativeConstraintMapVertical.get(o).push({top:r,gap:e.gap})}}));else{var c=new Map,g=new Map;this.constraints.relativePlacementConstraint.forEach((function(t){if(t.left){var e=a.has(t.left)?a.get(t.left):t.left,i=a.has(t.right)?a.get(t.right):t.right;c.has(e)?c.get(e).push(i):c.set(e,[i]),c.has(i)?c.get(i).push(e):c.set(i,[e])}else{var n=s.has(t.top)?s.get(t.top):t.top,r=s.has(t.bottom)?s.get(t.bottom):t.bottom;g.has(n)?g.get(n).push(r):g.set(n,[r]),g.has(r)?g.get(r).push(n):g.set(r,[n])}}));var u=function(t,e){var i=[],n=[],r=new N,o=new Set,a=0;return t.forEach((function(s,h){if(!o.has(h)){i[a]=[],n[a]=!1;var l=h;for(r.push(l),o.add(l),i[a].push(l);0!=r.length;)l=r.shift(),e.has(l)&&(n[a]=!0),t.get(l).forEach((function(t){o.has(t)||(r.push(t),o.add(t),i[a].push(t))}));a++}})),{components:i,isFixed:n}},p=u(c,t.fixedNodesOnHorizontal);this.componentsOnHorizontal=p.components,this.fixedComponentsOnHorizontal=p.isFixed;var f=u(g,t.fixedNodesOnVertical);this.componentsOnVertical=f.components,this.fixedComponentsOnVertical=f.isFixed}}},T.prototype.updateDisplacements=function(){var t=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach((function(e){var i=t.idToNodeMap.get(e.nodeId);i.displacementX=0,i.displacementY=0})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var e=this.constraints.alignmentConstraint.vertical,i=0;i1)for(s=0;sn&&(n=Math.floor(a.y)),o=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new u(c.WORLD_CENTER_X-a.x/2,c.WORLD_CENTER_Y-a.y/2))},T.radialLayout=function(t,e,i){var n=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);T.branchRadialLayout(e,null,0,359,0,n);var r=y.calculateBounds(t),o=new E;o.setDeviceOrgX(r.getMinX()),o.setDeviceOrgY(r.getMinY()),o.setWorldOrgX(i.x),o.setWorldOrgY(i.y);for(var a=0;a1;){var v=f[0];f.splice(0,1);var y=d.indexOf(v);y>=0&&d.splice(y,1),p--,c--}g=null!=e?(d.indexOf(f[0])+1)%p:0;for(var E=Math.abs(n-i)/c,N=g;u!=c;N=++N%p){var A=d[N].getOtherEnd(t);if(A!=e){var w=(i+u*E)%360,L=(w+E)%360;T.branchRadialLayout(A,t,w,L,r+o,o),u++}}},T.maxDiagonalInTree=function(t){for(var e=v.MIN_VALUE,i=0;ie&&(e=n)}return e},T.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},T.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],n=this.graphManager.getAllNodes(),r=0;r1){var n="DummyCompound_"+i;t.memberGroups[n]=e[i];var r=e[i][0].getParent(),o=new a(t.graphManager);o.id=n,o.paddingLeft=r.paddingLeft||0,o.paddingRight=r.paddingRight||0,o.paddingBottom=r.paddingBottom||0,o.paddingTop=r.paddingTop||0,t.idToDummyNode[n]=o;var s=t.getGraphManager().add(t.newGraph(),o),h=r.getChild();h.add(o);for(var l=0;lr?(n.rect.x-=(n.labelWidth-r)/2,n.setWidth(n.labelWidth),n.labelMarginLeft=(n.labelWidth-r)/2):"right"==n.labelPosHorizontal&&n.setWidth(r+n.labelWidth)),n.labelHeight&&("top"==n.labelPosVertical?(n.rect.y-=n.labelHeight,n.setHeight(o+n.labelHeight),n.labelMarginTop=n.labelHeight):"center"==n.labelPosVertical&&n.labelHeight>o?(n.rect.y-=(n.labelHeight-o)/2,n.setHeight(n.labelHeight),n.labelMarginTop=(n.labelHeight-o)/2):"bottom"==n.labelPosVertical&&n.setHeight(o+n.labelHeight))}}))},T.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,n=e.paddingLeft,r=e.paddingTop,o=e.labelMarginLeft,a=e.labelMarginTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,n,r,o,a)}},T.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(i){var n=t.idToDummyNode[i],r=n.paddingLeft,o=n.paddingTop,a=n.labelMarginLeft,s=n.labelMarginTop;t.adjustLocations(e[i],n.rect.x,n.rect.y,r,o,a,s)}))},T.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var n=i.getNodes(),r=0;r0)return this.toBeTiled[e]=!1,!1;if(null!=o.getChild()){if(!this.getToBeTiled(o))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[o.id]=!1}return this.toBeTiled[e]=!0,!0},T.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,n=0;nd&&(d=g.rect.height)}i+=d+t.verticalPadding}},T.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(n){var r=e[n];if(i.tiledMemberPack[n]=i.tileNodes(t[n],r.paddingLeft+r.paddingRight),r.rect.width=i.tiledMemberPack[n].width,r.rect.height=i.tiledMemberPack[n].height,r.setCenter(i.tiledMemberPack[n].centerX,i.tiledMemberPack[n].centerY),r.labelMarginLeft=0,r.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var o=r.rect.width,a=r.rect.height;r.labelWidth&&("left"==r.labelPosHorizontal?(r.rect.x-=r.labelWidth,r.setWidth(o+r.labelWidth),r.labelMarginLeft=r.labelWidth):"center"==r.labelPosHorizontal&&r.labelWidth>o?(r.rect.x-=(r.labelWidth-o)/2,r.setWidth(r.labelWidth),r.labelMarginLeft=(r.labelWidth-o)/2):"right"==r.labelPosHorizontal&&r.setWidth(o+r.labelWidth)),r.labelHeight&&("top"==r.labelPosVertical?(r.rect.y-=r.labelHeight,r.setHeight(a+r.labelHeight),r.labelMarginTop=r.labelHeight):"center"==r.labelPosVertical&&r.labelHeight>a?(r.rect.y-=(r.labelHeight-a)/2,r.setHeight(r.labelHeight),r.labelMarginTop=(r.labelHeight-a)/2):"bottom"==r.labelPosVertical&&r.setHeight(a+r.labelHeight))}}))},T.prototype.tileNodes=function(t,e){var i=this.tileNodesByFavoringDim(t,e,!0),n=this.tileNodesByFavoringDim(t,e,!1),r=this.getOrgRatio(i);return this.getOrgRatio(n)s&&(s=t.getWidth())}));var l,d=o/r,c=a/r,g=Math.pow(i-n,2)+4*(d+n)*(c+i)*r,u=(n-i+Math.sqrt(g))/(2*(d+n));e?(l=Math.ceil(u))==u&&l++:l=Math.floor(u);var p=l*(d+n)-n;return s>p&&(p=s),p+=2*n},T.prototype.tileNodesByFavoringDim=function(t,e,i){var n=h.TILING_PADDING_VERTICAL,r=h.TILING_PADDING_HORIZONTAL,o=h.TILING_COMPARE_BY,a={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:n,horizontalPadding:r,centerX:0,centerY:0};o&&(a.idealRowWidth=this.calcIdealRowWidth(t,i));var s=function(t){return t.rect.width*t.rect.height},l=function(t,e){return s(e)-s(t)};t.sort((function(t,e){var i=l;return a.idealRowWidth?(i=o)(t.id,e.id):i(t,e)}));for(var d=0,c=0,g=0;g0&&(o+=t.horizontalPadding),t.rowWidth[i]=o,t.width0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[i]&&(s=t.rowHeight[i],t.rowHeight[i]=a,s=t.rowHeight[i]-s),t.height+=s,t.rows[i].push(e)},T.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,n=0;ni&&(e=n,i=t.rowWidth[n]);return e},T.prototype.canAddHorizontal=function(t,e,i){if(t.idealRowWidth){var n=t.rows.length-1;return t.rowWidth[n]+e+t.horizontalPadding<=t.idealRowWidth}var r=this.getShortestRowIndex(t);if(r<0)return!0;var o=t.rowWidth[r];if(o+t.horizontalPadding+e<=t.width)return!0;var a,s,h=0;return t.rowHeight[r]0&&(h=i+t.verticalPadding-t.rowHeight[r]),a=t.width-o>=e+t.horizontalPadding?(t.height+h)/(o+e+t.horizontalPadding):(t.height+h)/t.width,h=i+t.verticalPadding,(s=t.widtho&&e!=i){n.splice(-1,1),t.rows[i].push(r),t.rowWidth[e]=t.rowWidth[e]-o,t.rowWidth[i]=t.rowWidth[i]+o,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;sa&&(a=n[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=a,t.rowHeight[i]0)for(var c=r;c<=o;c++)l[0]+=this.grid[c][a-1].length+this.grid[c][a].length-1;if(o0)for(c=a;c<=s;c++)l[3]+=this.grid[r-1][c].length+this.grid[r][c].length-1;for(var g,u,p=v.MAX_VALUE,f=0;f{var n=i(551).FDLayoutNode,r=i(551).IMath;function o(t,e,i,r){n.call(this,t,e,i,r)}for(var a in o.prototype=Object.create(n.prototype),n)o[a]=n[a];o.prototype.calculateDisplacement=function(){var t=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*r.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*r.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},o.prototype.propogateDisplacementToChildren=function(t,e){for(var i,n=this.getChild().getNodes(),r=0;r{function n(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e0){var o=0;n.forEach((function(t){"horizontal"==e?(c.set(t,h.has(t)?l[h.get(t)]:r.get(t)),o+=c.get(t)):(c.set(t,h.has(t)?d[h.get(t)]:r.get(t)),o+=c.get(t))})),o/=n.length,t.forEach((function(t){i.has(t)||c.set(t,o)}))}else{var a=0;t.forEach((function(t){a+="horizontal"==e?h.has(t)?l[h.get(t)]:r.get(t):h.has(t)?d[h.get(t)]:r.get(t)})),a/=t.length,t.forEach((function(t){c.set(t,a)}))}}));for(var p=function(){var n=u.shift();t.get(n).forEach((function(t){if(c.get(t.id)a&&(a=y),Es&&(s=E)}}catch(C){u=!0,p=C}finally{try{!g&&v.return&&v.return()}finally{if(u)throw p}}var N=(n+a)/2-(o+s)/2,T=!0,A=!1,w=void 0;try{for(var L,I=t[Symbol.iterator]();!(T=(L=I.next()).done);T=!0){var _=L.value;c.set(_,c.get(_)+N)}}catch(C){A=!0,w=C}finally{try{!T&&I.return&&I.return()}finally{if(A)throw w}}}))}return c},m=function(t){var e=0,i=0,n=0,r=0;if(t.forEach((function(t){t.left?l[h.get(t.left)]-l[h.get(t.right)]>=0?e++:i++:d[h.get(t.top)]-d[h.get(t.bottom)]>=0?n++:r++})),e>i&&n>r)for(var o=0;oi)for(var a=0;ar)for(var s=0;s1)e.fixedNodeConstraint.forEach((function(t,e){T[e]=[t.position.x,t.position.y],A[e]=[l[h.get(t.nodeId)],d[h.get(t.nodeId)]]})),w=!0;else if(e.alignmentConstraint)!function(){var t=0;if(e.alignmentConstraint.vertical){for(var i=e.alignmentConstraint.vertical,r=function(e){var r=new Set;i[e].forEach((function(t){r.add(t)}));var o=new Set([].concat(n(r)).filter((function(t){return I.has(t)}))),a=void 0;a=o.size>0?l[h.get(o.values().next().value)]:f(r).x,i[e].forEach((function(e){T[t]=[a,d[h.get(e)]],A[t]=[l[h.get(e)],d[h.get(e)]],t++}))},o=0;o0?l[h.get(r.values().next().value)]:f(i).y,a[e].forEach((function(e){T[t]=[l[h.get(e)],o],A[t]=[l[h.get(e)],d[h.get(e)]],t++}))},c=0;cx&&(x=M[D].length,O=D);if(x0){var j={x:0,y:0};e.fixedNodeConstraint.forEach((function(t,e){var i,n,r={x:l[h.get(t.nodeId)],y:d[h.get(t.nodeId)]},o=t.position,a=(n=r,{x:(i=o).x-n.x,y:i.y-n.y});j.x+=a.x,j.y+=a.y})),j.x/=e.fixedNodeConstraint.length,j.y/=e.fixedNodeConstraint.length,l.forEach((function(t,e){l[e]+=j.x})),d.forEach((function(t,e){d[e]+=j.y})),e.fixedNodeConstraint.forEach((function(t){l[h.get(t.nodeId)]=t.position.x,d[h.get(t.nodeId)]=t.position.y}))}if(e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var q=e.alignmentConstraint.vertical,$=function(t){var e=new Set;q[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(n(e)).filter((function(t){return I.has(t)}))),r=void 0;r=i.size>0?l[h.get(i.values().next().value)]:f(e).x,e.forEach((function(t){I.has(t)||(l[h.get(t)]=r)}))},Z=0;Z0?d[h.get(i.values().next().value)]:f(e).y,e.forEach((function(t){I.has(t)||(d[h.get(t)]=r)}))},K=0;K{e.exports=t}},i={},function t(n){var r=i[n];if(void 0!==r)return r.exports;var o=i[n]={exports:{}};return e[n](o,o.exports,t),o.exports}(45);var e,i},I.exports=t(C()));var t}var O,D,R,b;const G=T(O?L.exports:(O=1,L.exports=(D=x(),R={658:t=>{t.exports=null!=Object.assign?Object.assign.bind(Object):function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;n{var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(i.push(a.value),!e||i.length!==e);n=!0);}catch(h){r=!0,o=h}finally{try{!n&&s.return&&s.return()}finally{if(r)throw o}}return i}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=i(140).layoutBase.LinkedList,o={getTopMostNodes:function(t){for(var e={},i=0;i0&&l.merge(t)}));for(var d=0;d1){l=s[0],d=l.connectedEdges().length,s.forEach((function(t){t.connectedEdges().length0&&n.set("dummy"+(n.size+1),u),p},relocateComponent:function(t,e,i){if(!i.fixedNodeConstraint){var r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;if("draft"==i.quality){var h=!0,l=!1,d=void 0;try{for(var c,g=e.nodeIndexes[Symbol.iterator]();!(h=(c=g.next()).done);h=!0){var u=c.value,p=n(u,2),f=p[0],v=p[1],m=i.cy.getElementById(f);if(m){var y=m.boundingBox(),E=e.xCoords[v]-y.w/2,N=e.xCoords[v]+y.w/2,T=e.yCoords[v]-y.h/2,A=e.yCoords[v]+y.h/2;Eo&&(o=N),Ts&&(s=A)}}}catch(C){l=!0,d=C}finally{try{!h&&g.return&&g.return()}finally{if(l)throw d}}var w=t.x-(o+r)/2,L=t.y-(s+a)/2;e.xCoords=e.xCoords.map((function(t){return t+w})),e.yCoords=e.yCoords.map((function(t){return t+L}))}else{Object.keys(e).forEach((function(t){var i=e[t],n=i.getRect().x,h=i.getRect().x+i.getRect().width,l=i.getRect().y,d=i.getRect().y+i.getRect().height;no&&(o=h),ls&&(s=d)}));var I=t.x-(o+r)/2,_=t.y-(s+a)/2;Object.keys(e).forEach((function(t){var i=e[t];i.setCenter(i.getCenterX()+I,i.getCenterY()+_)}))}}},calcBoundingBox:function(t,e,i,n){for(var r=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER,h=void 0,l=void 0,d=void 0,c=void 0,g=t.descendants().not(":parent"),u=g.length,p=0;p(h=e[n.get(f.id())]-f.width()/2)&&(r=h),o<(l=e[n.get(f.id())]+f.width()/2)&&(o=l),a>(d=i[n.get(f.id())]-f.height()/2)&&(a=d),s<(c=i[n.get(f.id())]+f.height()/2)&&(s=c)}var v={};return v.topLeftX=r,v.topLeftY=a,v.width=o-r,v.height=s-a,v},calcParentsWithoutChildren:function(t,e){var i=t.collection();return e.nodes(":parent").forEach((function(t){var e=!1;t.children().forEach((function(t){"none"!=t.css("display")&&(e=!0)})),e||i.merge(t)})),i}};t.exports=o},816:(t,e,i)=>{var n=i(548),r=i(140).CoSELayout,o=i(140).CoSENode,a=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,h=i(140).layoutBase.LayoutConstants,l=i(140).layoutBase.FDLayoutConstants,d=i(140).CoSEConstants;t.exports={coseLayout:function(t,e){var i=t.cy,c=t.eles,g=c.nodes(),u=c.edges(),p=void 0,f=void 0,v=void 0,m={};t.randomize&&(p=e.nodeIndexes,f=e.xCoords,v=e.yCoords);var y=function(t){return"function"==typeof t},E=function(t,e){return y(t)?t(e):t},N=n.calcParentsWithoutChildren(i,c);null!=t.nestingFactor&&(d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor),null!=t.gravity&&(d.DEFAULT_GRAVITY_STRENGTH=l.DEFAULT_GRAVITY_STRENGTH=t.gravity),null!=t.numIter&&(d.MAX_ITERATIONS=l.MAX_ITERATIONS=t.numIter),null!=t.gravityRange&&(d.DEFAULT_GRAVITY_RANGE_FACTOR=l.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange),null!=t.gravityCompound&&(d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound),null!=t.gravityRangeCompound&&(d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound),null!=t.initialEnergyOnIncremental&&(d.DEFAULT_COOLING_FACTOR_INCREMENTAL=l.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental),null!=t.tilingCompareBy&&(d.TILING_COMPARE_BY=t.tilingCompareBy),"proof"==t.quality?h.QUALITY=2:h.QUALITY=0,d.NODE_DIMENSIONS_INCLUDE_LABELS=l.NODE_DIMENSIONS_INCLUDE_LABELS=h.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,d.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!t.randomize,d.ANIMATE=l.ANIMATE=h.ANIMATE=t.animate,d.TILE=t.tile,d.TILING_PADDING_VERTICAL="function"==typeof t.tilingPaddingVertical?t.tilingPaddingVertical.call():t.tilingPaddingVertical,d.TILING_PADDING_HORIZONTAL="function"==typeof t.tilingPaddingHorizontal?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal,d.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!0,d.PURE_INCREMENTAL=!t.randomize,h.DEFAULT_UNIFORM_LEAF_NODE_SIZES=t.uniformNodeDimensions,"transformed"==t.step&&(d.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,d.ENFORCE_CONSTRAINTS=!1,d.APPLY_LAYOUT=!1),"enforced"==t.step&&(d.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,d.ENFORCE_CONSTRAINTS=!0,d.APPLY_LAYOUT=!1),"cose"==t.step&&(d.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,d.ENFORCE_CONSTRAINTS=!1,d.APPLY_LAYOUT=!0),"all"==t.step&&(t.randomize?d.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:d.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,d.ENFORCE_CONSTRAINTS=!0,d.APPLY_LAYOUT=!0),t.fixedNodeConstraint||t.alignmentConstraint||t.relativePlacementConstraint?d.TREE_REDUCTION_ON_INCREMENTAL=!1:d.TREE_REDUCTION_ON_INCREMENTAL=!0;var T,A,w=new r,L=w.newGraphManager();return function t(e,i,r,h){for(var l=i.length,d=0;d0&&t(r.getGraphManager().add(r.newGraph(),u),g,r,h)}}(L.addRoot(),n.getTopMostNodes(g),w,t),function(e,i,n){for(var r=0,o=0,a=0;a0?d.DEFAULT_EDGE_LENGTH=l.DEFAULT_EDGE_LENGTH=r/o:y(t.idealEdgeLength)?d.DEFAULT_EDGE_LENGTH=l.DEFAULT_EDGE_LENGTH=50:d.DEFAULT_EDGE_LENGTH=l.DEFAULT_EDGE_LENGTH=t.idealEdgeLength,d.MIN_REPULSION_DIST=l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,d.DEFAULT_RADIAL_SEPARATION=l.DEFAULT_EDGE_LENGTH)}(w,L,u),T=w,(A=t).fixedNodeConstraint&&(T.constraints.fixedNodeConstraint=A.fixedNodeConstraint),A.alignmentConstraint&&(T.constraints.alignmentConstraint=A.alignmentConstraint),A.relativePlacementConstraint&&(T.constraints.relativePlacementConstraint=A.relativePlacementConstraint),w.runLayout(),m}}},212:(t,e,i)=>{var n=function(){function t(t,e){for(var i=0;i0)if(c){var g=o.getTopMostNodes(t.eles.nodes());if((h=o.connectComponents(e,t.eles,g)).forEach((function(t){var e=t.boundingBox();l.push({x:e.x1+e.w/2,y:e.y1+e.h/2})})),t.randomize&&h.forEach((function(e){t.eles=e,n.push(a(t))})),"default"==t.quality||"proof"==t.quality){var u=e.collection();if(t.tile){var p=0,f={nodeIndexes:new Map,xCoords:[],yCoords:[]},v=[];if(h.forEach((function(t,e){0==t.edges().length&&(t.nodes().forEach((function(e,i){u.merge(t.nodes()[i]),e.isParent()||(f.nodeIndexes.set(t.nodes()[i].id(),p++),f.xCoords.push(t.nodes()[0].position().x),f.yCoords.push(t.nodes()[0].position().y))})),v.push(e))})),u.length>1){var m=u.boundingBox();l.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),h.push(u),n.push(f);for(var y=v.length-1;y>=0;y--)h.splice(v[y],1),n.splice(v[y],1),l.splice(v[y],1)}}h.forEach((function(e,i){t.eles=e,r.push(s(t,n[i])),o.relocateComponent(l[i],r[i],t)}))}else h.forEach((function(e,i){o.relocateComponent(l[i],n[i],t)}));var E=new Set;if(h.length>1){var N=[],T=i.filter((function(t){return"none"==t.css("display")}));h.forEach((function(e,i){var a=void 0;if("draft"==t.quality&&(a=n[i].nodeIndexes),e.nodes().not(T).length>0){var s={edges:[],nodes:[]},h=void 0;e.nodes().not(T).forEach((function(e){if("draft"==t.quality)if(e.isParent()){var l=o.calcBoundingBox(e,n[i].xCoords,n[i].yCoords,a);s.nodes.push({x:l.topLeftX,y:l.topLeftY,width:l.width,height:l.height})}else h=a.get(e.id()),s.nodes.push({x:n[i].xCoords[h]-e.boundingbox().w/2,y:n[i].yCoords[h]-e.boundingbox().h/2,width:e.boundingbox().w,height:e.boundingbox().h});else r[i][e.id()]&&s.nodes.push({x:r[i][e.id()].getLeft(),y:r[i][e.id()].getTop(),width:r[i][e.id()].getWidth(),height:r[i][e.id()].getHeight()})})),e.edges().forEach((function(e){var h=e.source(),l=e.target();if("none"!=h.css("display")&&"none"!=l.css("display"))if("draft"==t.quality){var d=a.get(h.id()),c=a.get(l.id()),g=[],u=[];if(h.isParent()){var p=o.calcBoundingBox(h,n[i].xCoords,n[i].yCoords,a);g.push(p.topLeftX+p.width/2),g.push(p.topLeftY+p.height/2)}else g.push(n[i].xCoords[d]),g.push(n[i].yCoords[d]);if(l.isParent()){var f=o.calcBoundingBox(l,n[i].xCoords,n[i].yCoords,a);u.push(f.topLeftX+f.width/2),u.push(f.topLeftY+f.height/2)}else u.push(n[i].xCoords[c]),u.push(n[i].yCoords[c]);s.edges.push({startX:g[0],startY:g[1],endX:u[0],endY:u[1]})}else r[i][h.id()]&&r[i][l.id()]&&s.edges.push({startX:r[i][h.id()].getCenterX(),startY:r[i][h.id()].getCenterY(),endX:r[i][l.id()].getCenterX(),endY:r[i][l.id()].getCenterY()})})),s.nodes.length>0&&(N.push(s),E.add(i))}}));var A=d.packComponents(N,t.randomize).shifts;if("draft"==t.quality)n.forEach((function(t,e){var i=t.xCoords.map((function(t){return t+A[e].dx})),n=t.yCoords.map((function(t){return t+A[e].dy}));t.xCoords=i,t.yCoords=n}));else{var w=0;E.forEach((function(t){Object.keys(r[t]).forEach((function(e){var i=r[t][e];i.setCenter(i.getCenterX()+A[w].dx,i.getCenterY()+A[w].dy)})),w++}))}}}else{var L=t.eles.boundingBox();if(l.push({x:L.x1+L.w/2,y:L.y1+L.h/2}),t.randomize){var I=a(t);n.push(I)}"default"==t.quality||"proof"==t.quality?(r.push(s(t,n[0])),o.relocateComponent(l[0],r[0],t)):o.relocateComponent(l[0],n[0],t)}var _=function(e,i){if("default"==t.quality||"proof"==t.quality){"number"==typeof e&&(e=i);var o=void 0,a=void 0,s=e.data("id");return r.forEach((function(t){s in t&&(o={x:t[s].getRect().getCenterX(),y:t[s].getRect().getCenterY()},a=t[s])})),t.nodeDimensionsIncludeLabels&&(a.labelWidth&&("left"==a.labelPosHorizontal?o.x+=a.labelWidth/2:"right"==a.labelPosHorizontal&&(o.x-=a.labelWidth/2)),a.labelHeight&&("top"==a.labelPosVertical?o.y+=a.labelHeight/2:"bottom"==a.labelPosVertical&&(o.y-=a.labelHeight/2))),null==o&&(o={x:e.position("x"),y:e.position("y")}),{x:o.x,y:o.y}}var h=void 0;return n.forEach((function(t){var i=t.nodeIndexes.get(e.id());null!=i&&(h={x:t.xCoords[i],y:t.yCoords[i]})})),null==h&&(h={x:e.position("x"),y:e.position("y")}),{x:h.x,y:h.y}};if("default"==t.quality||"proof"==t.quality||t.randomize){var C=o.calcParentsWithoutChildren(e,i),M=i.filter((function(t){return"none"==t.css("display")}));t.eles=i.not(M),i.nodes().not(":parent").not(M).layoutPositions(this,t,_),C.length>0&&C.forEach((function(t){t.position(_(t))}))}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),t}();t.exports=l},657:(t,e,i)=>{var n=i(548),r=i(140).layoutBase.Matrix,o=i(140).layoutBase.SVD;t.exports={spectralLayout:function(t){var e=t.cy,i=t.eles,a=i.nodes(),s=i.nodes(":parent"),h=new Map,l=new Map,d=new Map,c=[],g=[],u=[],p=[],f=[],v=[],m=[],y=[],E=void 0,N=1e8,T=1e-9,A=t.piTol,w=t.samplingType,L=t.nodeSeparation,I=void 0,_=function(t,e,i){for(var n=[],r=0,o=0,a=0,s=void 0,h=[],d=0,g=1,u=0;u=r;){a=n[r++];for(var p=c[a],m=0;md&&(d=f[T],g=T)}return g};n.connectComponents(e,i,n.getTopMostNodes(a),h),s.forEach((function(t){n.connectComponents(e,i,n.getTopMostNodes(t.descendants().intersection(i)),h)}));for(var C=0,M=0;M0&&(n.isParent()?c[e].push(d.get(n.id())):c[e].push(n.id()))}))}));var S=function(t){var i=l.get(t),n=void 0;h.get(t).forEach((function(r){n=e.getElementById(r).isParent()?d.get(r):r,c[i].push(n),c[l.get(n)].push(t)}))},P=!0,U=!1,Y=void 0;try{for(var k,H=h.keys()[Symbol.iterator]();!(P=(k=H.next()).done);P=!0)S(k.value)}catch(Z){U=!0,Y=Z}finally{try{!P&&H.return&&H.return()}finally{if(U)throw Y}}var X=void 0;if((E=l.size)>2){I=E=1)break;l=h}for(var p=0;p=1)break;l=h}for(var m=0;m{var n=i(212),r=function(t){t&&t("layout","fcose",n)};"undefined"!=typeof cytoscape&&r(cytoscape),t.exports=r},140:t=>{t.exports=D}},b={},function t(e){var i=b[e];if(void 0!==i)return i.exports;var n=b[e]={exports:{}};return R[e](n,n.exports,t),n.exports}(579))));var F={L:"left",R:"right",T:"top",B:"bottom"},S={L:t((t=>`${t},${t/2} 0,${t} 0,0`),"L"),R:t((t=>`0,${t/2} ${t},0 ${t},${t}`),"R"),T:t((t=>`0,0 ${t},0 ${t/2},${t}`),"T"),B:t((t=>`${t/2},0 ${t},${t} 0,${t}`),"B")},P={L:t(((t,e)=>t-e+2),"L"),R:t(((t,e)=>t-2),"R"),T:t(((t,e)=>t-e+2),"T"),B:t(((t,e)=>t-2),"B")},U=t((function(t){return k(t)?"L"===t?"R":"L":"T"===t?"B":"T"}),"getOppositeArchitectureDirection"),Y=t((function(t){return"L"===t||"R"===t||"T"===t||"B"===t}),"isArchitectureDirection"),k=t((function(t){return"L"===t||"R"===t}),"isArchitectureDirectionX"),H=t((function(t){return"T"===t||"B"===t}),"isArchitectureDirectionY"),X=t((function(t,e){const i=k(t)&&H(e),n=H(t)&&k(e);return i||n}),"isArchitectureDirectionXY"),z=t((function(t){const e=t[0],i=t[1],n=k(e)&&H(i),r=H(e)&&k(i);return n||r}),"isArchitecturePairXY"),B=t((function(t){return"LL"!==t&&"RR"!==t&&"TT"!==t&&"BB"!==t}),"isValidArchitectureDirectionPair"),V=t((function(t,e){const i=`${t}${e}`;return B(i)?i:void 0}),"getArchitectureDirectionPair"),W=t((function([t,e],i){const n=i[0],r=i[1];return k(n)?H(r)?[t+("L"===n?-1:1),e+("T"===r?1:-1)]:[t+("L"===n?-1:1),e]:k(r)?[t+("L"===r?1:-1),e+("T"===n?1:-1)]:[t,e+("T"===n?1:-1)]}),"shiftPositionByArchitectureDirectionPair"),j=t((function(t){return"LT"===t||"TL"===t?[1,1]:"BL"===t||"LB"===t?[1,-1]:"BR"===t||"RB"===t?[-1,-1]:[-1,1]}),"getArchitectureDirectionXYFactors"),q=t((function(t,e){return X(t,e)?"bend":k(t)?"horizontal":"vertical"}),"getArchitectureDirectionAlignment"),$=t((function(t){return"service"===t.type}),"isArchitectureService"),Z=t((function(t){return"junction"===t.type}),"isArchitectureJunction"),Q=t((t=>t.data()),"edgeData"),J=t((t=>t.data()),"nodeData"),K=p.architecture,tt=new y((()=>({nodes:{},groups:{},edges:[],registeredIds:{},config:K,dataStructures:void 0,elements:{}}))),et=t((()=>{tt.reset(),l()}),"clear"),it=t((function({id:t,icon:e,in:i,title:n,iconText:r}){if(void 0!==tt.records.registeredIds[t])throw new Error(`The service id [${t}] is already in use by another ${tt.records.registeredIds[t]}`);if(void 0!==i){if(t===i)throw new Error(`The service [${t}] cannot be placed within itself`);if(void 0===tt.records.registeredIds[i])throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if("node"===tt.records.registeredIds[i])throw new Error(`The service [${t}]'s parent is not a group`)}tt.records.registeredIds[t]="node",tt.records.nodes[t]={id:t,type:"service",icon:e,iconText:r,title:n,edges:[],in:i}}),"addService"),nt=t((()=>Object.values(tt.records.nodes).filter($)),"getServices"),rt=t((function({id:t,in:e}){tt.records.registeredIds[t]="node",tt.records.nodes[t]={id:t,type:"junction",edges:[],in:e}}),"addJunction"),ot=t((()=>Object.values(tt.records.nodes).filter(Z)),"getJunctions"),at=t((()=>Object.values(tt.records.nodes)),"getNodes"),st=t((t=>tt.records.nodes[t]),"getNode"),ht=t((function({id:t,icon:e,in:i,title:n}){if(void 0!==tt.records.registeredIds[t])throw new Error(`The group id [${t}] is already in use by another ${tt.records.registeredIds[t]}`);if(void 0!==i){if(t===i)throw new Error(`The group [${t}] cannot be placed within itself`);if(void 0===tt.records.registeredIds[i])throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if("node"===tt.records.registeredIds[i])throw new Error(`The group [${t}]'s parent is not a group`)}tt.records.registeredIds[t]="group",tt.records.groups[t]={id:t,icon:e,title:n,in:i}}),"addGroup"),lt=t((()=>Object.values(tt.records.groups)),"getGroups"),dt=t((function({lhsId:t,rhsId:e,lhsDir:i,rhsDir:n,lhsInto:r,rhsInto:o,lhsGroup:a,rhsGroup:s,title:h}){if(!Y(i))throw new Error(`Invalid direction given for left hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${i}`);if(!Y(n))throw new Error(`Invalid direction given for right hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${n}`);if(void 0===tt.records.nodes[t]&&void 0===tt.records.groups[t])throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(void 0===tt.records.nodes[e]&&void 0===tt.records.groups[t])throw new Error(`The right-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);const l=tt.records.nodes[t].in,d=tt.records.nodes[e].in;if(a&&l&&d&&l==d)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(s&&l&&d&&l==d)throw new Error(`The right-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const c={lhsId:t,lhsDir:i,lhsInto:r,lhsGroup:a,rhsId:e,rhsDir:n,rhsInto:o,rhsGroup:s,title:h};tt.records.edges.push(c),tt.records.nodes[t]&&tt.records.nodes[e]&&(tt.records.nodes[t].edges.push(tt.records.edges[tt.records.edges.length-1]),tt.records.nodes[e].edges.push(tt.records.edges[tt.records.edges.length-1]))}),"addEdge"),ct=t((()=>tt.records.edges),"getEdges"),gt=t((()=>{if(void 0===tt.records.dataStructures){const e={},i=Object.entries(tt.records.nodes).reduce(((t,[i,n])=>(t[i]=n.edges.reduce(((t,n)=>{var r,o;const a=null==(r=st(n.lhsId))?void 0:r.in,s=null==(o=st(n.rhsId))?void 0:o.in;if(a&&s&&a!==s){const t=q(n.lhsDir,n.rhsDir);"bend"!==t&&(e[a]??(e[a]={}),e[a][s]=t,e[s]??(e[s]={}),e[s][a]=t)}if(n.lhsId===i){const e=V(n.lhsDir,n.rhsDir);e&&(t[e]=n.rhsId)}else{const e=V(n.rhsDir,n.lhsDir);e&&(t[e]=n.lhsId)}return t}),{}),t)),{}),n=Object.keys(i)[0],r={[n]:1},o=Object.keys(i).reduce(((t,e)=>e===n?t:{...t,[e]:1}),{}),a=t((t=>{const e={[t]:[0,0]},n=[t];for(;n.length>0;){const t=n.shift();if(t){r[t]=1,delete o[t];const a=i[t],[s,h]=e[t];Object.entries(a).forEach((([t,i])=>{r[i]||(e[i]=W([s,h],t),n.push(i))}))}}return e}),"BFS"),s=[a(n)];for(;Object.keys(o).length>0;)s.push(a(Object.keys(o)[0]));tt.records.dataStructures={adjList:i,spatialMaps:s,groupAlignments:e}}return tt.records.dataStructures}),"getDataStructures"),ut={clear:et,setDiagramTitle:a,getDiagramTitle:o,setAccTitle:r,getAccTitle:n,setAccDescription:i,getAccDescription:e,addService:it,getServices:nt,addJunction:rt,getJunctions:ot,getNodes:at,getNode:st,addGroup:ht,getGroups:lt,addEdge:dt,getEdges:ct,setElementForId:t(((t,e)=>{tt.records.elements[t]=e}),"setElementForId"),getElementById:t((t=>tt.records.elements[t]),"getElementById"),getDataStructures:gt};function pt(t){const e=g().architecture;return(null==e?void 0:e[t])?e[t]:K[t]}t(pt,"getConfigField");var ft=t(((t,e)=>{m(t,e),t.groups.map(e.addGroup),t.services.map((t=>e.addService({...t,type:"service"}))),t.junctions.map((t=>e.addJunction({...t,type:"junction"}))),t.edges.map(e.addEdge)}),"populateDb"),vt={parse:t((async t=>{const e=await E("architecture",t);d.debug(e),ft(e,ut)}),"parse")},mt=t((t=>`\n .edge {\n stroke-width: ${t.archEdgeWidth};\n stroke: ${t.archEdgeColor};\n fill: none;\n }\n\n .arrow {\n fill: ${t.archEdgeArrowColor};\n }\n\n .node-bkg {\n fill: none;\n stroke: ${t.archGroupBorderColor};\n stroke-width: ${t.archGroupBorderWidth};\n stroke-dasharray: 8;\n }\n .node-icon-text {\n display: flex; \n align-items: center;\n }\n \n .node-icon-text > div {\n color: #fff;\n margin: 1px;\n height: fit-content;\n text-align: center;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n }\n`),"getStyles"),yt=t((t=>`${t}`),"wrapIcon"),Et={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:yt('')},server:{body:yt('')},disk:{body:yt('')},internet:{body:yt('')},cloud:{body:yt('')},unknown:v,blank:{body:yt("")}}},Nt=t((async function(t,e){const i=pt("padding"),n=pt("iconSize"),r=n/2,o=n/6,a=o/2;await Promise.all(e.edges().map((async e=>{var n,s;const{source:h,sourceDir:l,sourceArrow:d,sourceGroup:u,target:p,targetDir:f,targetArrow:v,targetGroup:m,label:y}=Q(e);let{x:E,y:N}=e[0].sourceEndpoint();const{x:T,y:A}=e[0].midpoint();let{x:w,y:L}=e[0].targetEndpoint();const I=i+4;if(u&&(k(l)?E+="L"===l?-I:I:N+="T"===l?-I:I+18),m&&(k(f)?w+="L"===f?-I:I:L+="T"===f?-I:I+18),u||"junction"!==(null==(n=ut.getNode(h))?void 0:n.type)||(k(l)?E+="L"===l?r:-r:N+="T"===l?r:-r),m||"junction"!==(null==(s=ut.getNode(p))?void 0:s.type)||(k(f)?w+="L"===f?r:-r:L+="T"===f?r:-r),e[0]._private.rscratch){const e=t.insert("g");if(e.insert("path").attr("d",`M ${E},${N} L ${T},${A} L${w},${L} `).attr("class","edge"),d){const t=k(l)?P[l](E,o):E-a,i=H(l)?P[l](N,o):N-a;e.insert("polygon").attr("points",S[l](o)).attr("transform",`translate(${t},${i})`).attr("class","arrow")}if(v){const t=k(f)?P[f](w,o):w-a,i=H(f)?P[f](L,o):L-a;e.insert("polygon").attr("points",S[f](o)).attr("transform",`translate(${t},${i})`).attr("class","arrow")}if(y){const t=X(l,f)?"XY":k(l)?"X":"Y";let i=0;i="X"===t?Math.abs(E-w):"Y"===t?Math.abs(N-L)/1.5:Math.abs(E-w)/2;const n=e.append("g");if(await c(n,y,{useHtmlLabels:!1,width:i,classes:"architecture-service-label"},g()),n.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),"X"===t)n.attr("transform","translate("+T+", "+A+")");else if("Y"===t)n.attr("transform","translate("+T+", "+A+") rotate(-90)");else if("XY"===t){const t=V(l,f);if(t&&z(t)){const e=n.node().getBoundingClientRect(),[i,r]=j(t);n.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*i*r*45})`);const o=n.node().getBoundingClientRect();n.attr("transform",`\n translate(${T}, ${A-e.height/2})\n translate(${i*o.width/2}, ${r*o.height/2})\n rotate(${-1*i*r*45}, 0, ${e.height/2})\n `)}}}}})))}),"drawEdges"),Tt=t((async function(t,e){const i=.75*pt("padding"),n=pt("fontSize"),r=pt("iconSize")/2;await Promise.all(e.nodes().map((async e=>{const o=J(e);if("group"===o.type){const{h:a,w:s,x1:h,y1:l}=e.boundingBox();t.append("rect").attr("x",h+r).attr("y",l+r).attr("width",s).attr("height",a).attr("class","node-bkg");const d=t.append("g");let p=h,f=l;if(o.icon){const t=d.append("g");t.html(`${await u(o.icon,{height:i,width:i,fallbackPrefix:Et.prefix})}`),t.attr("transform","translate("+(p+r+1)+", "+(f+r+1)+")"),p+=i,f+=n/2-1-2}if(o.label){const t=d.append("g");await c(t,o.label,{useHtmlLabels:!1,width:s,classes:"architecture-service-label"},g()),t.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),t.attr("transform","translate("+(p+r+4)+", "+(f+r+2)+")")}}})))}),"drawGroups"),At=t((async function(t,e,i){for(const n of i){const i=e.append("g"),r=pt("iconSize");if(n.title){const t=i.append("g");await c(t,n.title,{useHtmlLabels:!1,width:1.5*r,classes:"architecture-service-label"},g()),t.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),t.attr("transform","translate("+r/2+", "+r+")")}const o=i.append("g");if(n.icon)o.html(`${await u(n.icon,{height:r,width:r,fallbackPrefix:Et.prefix})}`);else if(n.iconText){o.html(`${await u("blank",{height:r,width:r,fallbackPrefix:Et.prefix})}`);const t=o.append("g").append("foreignObject").attr("width",r).attr("height",r).append("div").attr("class","node-icon-text").attr("style",`height: ${r}px;`).append("div").html(n.iconText),e=parseInt(window.getComputedStyle(t.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;t.attr("style",`-webkit-line-clamp: ${Math.floor((r-2)/e)};`)}else o.append("path").attr("class","node-bkg").attr("id","node-"+n.id).attr("d",`M0 ${r} v${-r} q0,-5 5,-5 h${r} q5,0 5,5 v${r} H0 Z`);i.attr("class","architecture-service");const{width:a,height:s}=i._groups[0][0].getBBox();n.width=a,n.height=s,t.setElementForId(n.id,i)}return 0}),"drawServices"),wt=t((function(t,e,i){i.forEach((i=>{const n=e.append("g"),r=pt("iconSize");n.append("g").append("rect").attr("id","node-"+i.id).attr("fill-opacity","0").attr("width",r).attr("height",r),n.attr("class","architecture-junction");const{width:o,height:a}=n._groups[0][0].getBBox();n.width=o,n.height=a,t.setElementForId(i.id,n)}))}),"drawJunctions");function Lt(t,e){t.forEach((t=>{e.add({group:"nodes",data:{type:"service",id:t.id,icon:t.icon,label:t.title,parent:t.in,width:pt("iconSize"),height:pt("iconSize")},classes:"node-service"})}))}function It(t,e){t.forEach((t=>{e.add({group:"nodes",data:{type:"junction",id:t.id,parent:t.in,width:pt("iconSize"),height:pt("iconSize")},classes:"node-junction"})}))}function _t(t,e){e.nodes().map((e=>{const i=J(e);if("group"===i.type)return;i.x=e.position().x,i.y=e.position().y;t.getElementById(i.id).attr("transform","translate("+(i.x||0)+","+(i.y||0)+")")}))}function Ct(t,e){t.forEach((t=>{e.add({group:"nodes",data:{type:"group",id:t.id,icon:t.icon,label:t.title,parent:t.in},classes:"node-group"})}))}function Mt(t,e){t.forEach((t=>{const{lhsId:i,rhsId:n,lhsInto:r,lhsGroup:o,rhsInto:a,lhsDir:s,rhsDir:h,rhsGroup:l,title:d}=t,c=X(t.lhsDir,t.rhsDir)?"segments":"straight",g={id:`${i}-${n}`,label:d,source:i,sourceDir:s,sourceArrow:r,sourceGroup:o,sourceEndpoint:"L"===s?"0 50%":"R"===s?"100% 50%":"T"===s?"50% 0":"50% 100%",target:n,targetDir:h,targetArrow:a,targetGroup:l,targetEndpoint:"L"===h?"0 50%":"R"===h?"100% 50%":"T"===h?"50% 0":"50% 100%"};e.add({group:"edges",data:g,classes:c})}))}function xt(e,i,n){const r=t(((t,e)=>Object.entries(t).reduce(((t,[i,r])=>{var o;let a=0;const s=Object.entries(r);if(1===s.length)return t[i]=s[0][1],t;for(let h=0;h{const i={},n={};return Object.entries(t).forEach((([t,[r,o]])=>{var a,s,h;const l=(null==(a=e.getNode(t))?void 0:a.in)??"default";i[o]??(i[o]={}),(s=i[o])[l]??(s[l]=[]),i[o][l].push(t),n[r]??(n[r]={}),(h=n[r])[l]??(h[l]=[]),n[r][l].push(t)})),{horiz:Object.values(r(i,"horizontal")).filter((t=>t.length>1)),vert:Object.values(r(n,"vertical")).filter((t=>t.length>1))}})),[a,s]=o.reduce((([t,e],{horiz:i,vert:n})=>[[...t,...i],[...e,...n]]),[[],[]]);return{horizontal:a,vertical:s}}function Ot(e){const i=[],n=t((t=>`${t[0]},${t[1]}`),"posToStr"),r=t((t=>t.split(",").map((t=>parseInt(t)))),"strToPos");return e.forEach((t=>{const e=Object.fromEntries(Object.entries(t).map((([t,e])=>[n(e),t]))),o=[n([0,0])],a={},s={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;o.length>0;){const t=o.shift();if(t){a[t]=1;const h=e[t];if(h){const l=r(t);Object.entries(s).forEach((([t,r])=>{const s=n([l[0]+r[0],l[1]+r[1]]),d=e[s];d&&!a[s]&&(o.push(s),i.push({[F[t]]:d,[F[U(t)]]:h,gap:1.5*pt("iconSize")}))}))}}}})),i}function Dt(e,i,n,r,o,{spatialMaps:a,groupAlignments:s}){return new Promise((h=>{const l=A("body").append("div").attr("id","cy").attr("style","display:none"),c=N({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${pt("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${pt("padding")}px`}}]});l.remove(),Ct(n,c),Lt(e,c),It(i,c),Mt(r,c);const g=xt(o,a,s),u=Ot(a),p=c.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(t){const[e,i]=t.connectedNodes(),{parent:n}=J(e),{parent:r}=J(i);return n===r?1.5*pt("iconSize"):.5*pt("iconSize")},edgeElasticity(t){const[e,i]=t.connectedNodes(),{parent:n}=J(e),{parent:r}=J(i);return n===r?.45:.001},alignmentConstraint:g,relativePlacementConstraint:u});p.one("layoutstop",(()=>{var e;function i(t,e,i,n){let r,o;const{x:a,y:s}=t,{x:h,y:l}=e;o=(n-s+(a-i)*(s-l)/(a-h))/Math.sqrt(1+Math.pow((s-l)/(a-h),2)),r=Math.sqrt(Math.pow(n-s,2)+Math.pow(i-a,2)-Math.pow(o,2));r/=Math.sqrt(Math.pow(h-a,2)+Math.pow(l-s,2));let d=(h-a)*(n-s)-(l-s)*(i-a);switch(!0){case d>=0:d=1;break;case d<0:d=-1}let c=(h-a)*(i-a)+(l-s)*(n-s);switch(!0){case c>=0:c=1;break;case c<0:c=-1}return o=Math.abs(o)*d,r*=c,{distances:o,weights:r}}t(i,"getSegmentWeights"),c.startBatch();for(const t of Object.values(c.edges()))if(null==(e=t.data)?void 0:e.call(t)){const{x:e,y:n}=t.source().position(),{x:r,y:o}=t.target().position();if(e!==r&&n!==o){const e=t.sourceEndpoint(),n=t.targetEndpoint(),{sourceDir:r}=Q(t),[o,a]=H(r)?[e.x,n.y]:[n.x,e.y],{weights:s,distances:h}=i(e,n,o,a);t.style("segment-distances",h),t.style("segment-weights",s)}}c.endBatch(),p.run()})),p.run(),c.ready((t=>{d.info("Ready",t),h(c)}))}))}f([{name:Et.prefix,icons:Et}]),N.use(G),t(Lt,"addServices"),t(It,"addJunctions"),t(_t,"positionNodes"),t(Ct,"addGroups"),t(Mt,"addEdges"),t(xt,"getAlignments"),t(Ot,"getRelativeConstraints"),t(Dt,"layoutArchitecture");var Rt={parser:vt,db:ut,renderer:{draw:t((async(t,e,i,n)=>{const r=n.db,o=r.getServices(),a=r.getJunctions(),l=r.getGroups(),d=r.getEdges(),c=r.getDataStructures(),g=s(e),u=g.append("g");u.attr("class","architecture-edges");const p=g.append("g");p.attr("class","architecture-services");const f=g.append("g");f.attr("class","architecture-groups"),await At(r,p,o),wt(r,p,a);const v=await Dt(o,a,l,d,r,c);await Nt(u,v),await Tt(f,v),_t(r,v),h(void 0,g,pt("padding"),pt("useMaxWidth"))}),"draw")},styles:mt};export{Rt as diagram}; diff --git a/docs/assets/asciiarmor-D5V0T9Cu.js b/docs/assets/asciiarmor-D5V0T9Cu.js deleted file mode 100644 index c83f396..0000000 --- a/docs/assets/asciiarmor-D5V0T9Cu.js +++ /dev/null @@ -1 +0,0 @@ -function t(t){var e=t.match(/^\s*\S/);return t.skipToEnd(),e?"error":null}const e={name:"asciiarmor",token:function(e,a){var r;if("top"==a.state)return e.sol()&&(r=e.match(/^-----BEGIN (.*)?-----\s*$/))?(a.state="headers",a.type=r[1],"tag"):t(e);if("headers"==a.state){if(e.sol()&&e.match(/^\w+:/))return a.state="header","atom";var s=t(e);return s&&(a.state="body"),s}return"header"==a.state?(e.skipToEnd(),a.state="headers","string"):"body"==a.state?e.sol()&&(r=e.match(/^-----END (.*)?-----\s*$/))?r[1]!=a.type?"error":(a.state="end","tag"):e.eatWhile(/[A-Za-z0-9+\/=]/)?null:(e.next(),"error"):"end"==a.state?t(e):void 0},blankLine:function(t){"headers"==t.state&&(t.state="body")},startState:function(){return{state:"top",type:null}}};export{e as asciiArmor}; diff --git a/docs/assets/asn1-DWPaVWf6.js b/docs/assets/asn1-DWPaVWf6.js deleted file mode 100644 index 52a0b35..0000000 --- a/docs/assets/asn1-DWPaVWf6.js +++ /dev/null @@ -1 +0,0 @@ -function e(e){for(var t={},n=e.split(" "),r=0;r?$/.test(r)?(i.extenExten=!0,i.extenStart=!1,"strong"):(i.extenStart=!1,a.skipToEnd(),"error")):i.extenExten?(i.extenExten=!1,i.extenPriority=!0,a.eatWhile(/[^,]/),i.extenInclude&&(a.skipToEnd(),i.extenPriority=!1,i.extenInclude=!1),i.extenSame&&(i.extenPriority=!1,i.extenSame=!1,i.extenApplication=!0),"tag"):i.extenPriority?(i.extenPriority=!1,i.extenApplication=!0,a.next(),i.extenSame?null:(a.eatWhile(/[^,]/),"number")):i.extenApplication?(a.eatWhile(/,/),","===(r=a.current())?null:(a.eatWhile(/\w/),r=a.current().toLowerCase(),i.extenApplication=!1,-1!==n.indexOf(r)?"def":null)):function(n,a){var i="",r=n.next();if(a.blockComment)return"-"==r&&n.match("-;",!0)?a.blockComment=!1:n.skipTo("--;")?(n.next(),n.next(),n.next(),a.blockComment=!1):n.skipToEnd(),"comment";if(";"==r)return n.match("--",!0)&&!n.match("-",!1)?(a.blockComment=!0,"comment"):(n.skipToEnd(),"comment");if("["==r)return n.skipTo("]"),n.eat("]"),"header";if('"'==r)return n.skipTo('"'),"string";if("'"==r)return n.skipTo("'"),"string.special";if("#"==r&&(n.eatWhile(/\w/),i=n.current(),-1!==t.indexOf(i)))return n.skipToEnd(),"strong";if("$"==r&&"{"==n.peek())return n.skipTo("}"),n.eat("}"),"variableName.special";if(n.eatWhile(/\w/),i=n.current(),-1!==e.indexOf(i)){switch(a.extenStart=!0,i){case"same":a.extenSame=!0;break;case"include":case"switch":case"ignorepat":a.extenInclude=!0}return"atom"}}(a,i)},languageData:{commentTokens:{line:";",block:{open:";--",close:"--;"}}}};export{a as asterisk}; diff --git a/docs/assets/blockDiagram-JOT3LUYC-3t7hQYZc.js b/docs/assets/blockDiagram-JOT3LUYC-3t7hQYZc.js deleted file mode 100644 index aa9d573..0000000 --- a/docs/assets/blockDiagram-JOT3LUYC-3t7hQYZc.js +++ /dev/null @@ -1 +0,0 @@ -var t,e;import{_ as r,F as a,d as i,l as s,y as n,A as o,c as l,a1 as c,a2 as d,a3 as h,a4 as g,u,j as y,a5 as p,a6 as x,a7 as b,h as f}from"./mermaid-BGnxfgCD.js";import{c as m}from"./clone-DZLovMrS.js";import{s as w}from"./transform-DjHZbYKP.js";import{G as k}from"./graph-D2OIoTg6.js";import{c as L}from"./channel-DT3LjMlT.js";import{l as S,k as _}from"./step-BwsUM5iJ.js";import"./index-D3XtisvU.js";import"./_baseUniq-BlNMZyiw.js";import"./_baseEach-DHNYGtOc.js";import"./timer-DFzT7np-.js";var v=function(){var t=r((function(t,e,r,a){for(r=r||{},a=t.length;a--;r[t[a]]=e);return r}),"o"),e=[1,7],a=[1,13],i=[1,14],s=[1,15],n=[1,19],o=[1,16],l=[1,17],c=[1,18],d=[8,30],h=[8,21,28,29,30,31,32,40,44,47],g=[1,23],u=[1,24],y=[8,15,16,21,28,29,30,31,32,40,44,47],p=[8,15,16,21,27,28,29,30,31,32,40,44,47],x=[1,49],b={trace:r((function(){}),"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,block:31,NODE_ID:32,nodeShapeNLabel:33,dirList:34,DIR:35,NODE_DSTART:36,NODE_DEND:37,BLOCK_ARROW_START:38,BLOCK_ARROW_END:39,classDef:40,CLASSDEF_ID:41,CLASSDEF_STYLEOPTS:42,DEFAULT:43,class:44,CLASSENTITY_IDS:45,STYLECLASS:46,style:47,STYLE_ENTITY_IDS:48,STYLE_DEFINITION_DATA:49,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"block",32:"NODE_ID",35:"DIR",36:"NODE_DSTART",37:"NODE_DEND",38:"BLOCK_ARROW_START",39:"BLOCK_ARROW_END",40:"classDef",41:"CLASSDEF_ID",42:"CLASSDEF_STYLEOPTS",43:"DEFAULT",44:"class",45:"CLASSENTITY_IDS",46:"STYLECLASS",47:"style",48:"STYLE_ENTITY_IDS",49:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[34,1],[34,2],[33,3],[33,4],[23,3],[23,3],[24,3],[25,3]],performAction:r((function(t,e,r,a,i,s,n){var o=s.length-1;switch(i){case 4:a.getLogger().debug("Rule: separator (NL) ");break;case 5:a.getLogger().debug("Rule: separator (Space) ");break;case 6:a.getLogger().debug("Rule: separator (EOF) ");break;case 7:a.getLogger().debug("Rule: hierarchy: ",s[o-1]),a.setHierarchy(s[o-1]);break;case 8:a.getLogger().debug("Stop NL ");break;case 9:a.getLogger().debug("Stop EOF ");break;case 10:a.getLogger().debug("Stop NL2 ");break;case 11:a.getLogger().debug("Stop EOF2 ");break;case 12:a.getLogger().debug("Rule: statement: ",s[o]),"number"==typeof s[o].length?this.$=s[o]:this.$=[s[o]];break;case 13:a.getLogger().debug("Rule: statement #2: ",s[o-1]),this.$=[s[o-1]].concat(s[o]);break;case 14:a.getLogger().debug("Rule: link: ",s[o],t),this.$={edgeTypeStr:s[o],label:""};break;case 15:a.getLogger().debug("Rule: LABEL link: ",s[o-3],s[o-1],s[o]),this.$={edgeTypeStr:s[o],label:s[o-1]};break;case 18:const e=parseInt(s[o]),r=a.generateId();this.$={id:r,type:"space",label:"",width:e,children:[]};break;case 23:a.getLogger().debug("Rule: (nodeStatement link node) ",s[o-2],s[o-1],s[o]," typestr: ",s[o-1].edgeTypeStr);const i=a.edgeStrToEdgeData(s[o-1].edgeTypeStr);this.$=[{id:s[o-2].id,label:s[o-2].label,type:s[o-2].type,directions:s[o-2].directions},{id:s[o-2].id+"-"+s[o].id,start:s[o-2].id,end:s[o].id,label:s[o-1].label,type:"edge",directions:s[o].directions,arrowTypeEnd:i,arrowTypeStart:"arrow_open"},{id:s[o].id,label:s[o].label,type:a.typeStr2Type(s[o].typeStr),directions:s[o].directions}];break;case 24:a.getLogger().debug("Rule: nodeStatement (abc88 node size) ",s[o-1],s[o]),this.$={id:s[o-1].id,label:s[o-1].label,type:a.typeStr2Type(s[o-1].typeStr),directions:s[o-1].directions,widthInColumns:parseInt(s[o],10)};break;case 25:a.getLogger().debug("Rule: nodeStatement (node) ",s[o]),this.$={id:s[o].id,label:s[o].label,type:a.typeStr2Type(s[o].typeStr),directions:s[o].directions,widthInColumns:1};break;case 26:a.getLogger().debug("APA123",this?this:"na"),a.getLogger().debug("COLUMNS: ",s[o]),this.$={type:"column-setting",columns:"auto"===s[o]?-1:parseInt(s[o])};break;case 27:a.getLogger().debug("Rule: id-block statement : ",s[o-2],s[o-1]),a.generateId(),this.$={...s[o-2],type:"composite",children:s[o-1]};break;case 28:a.getLogger().debug("Rule: blockStatement : ",s[o-2],s[o-1],s[o]);const n=a.generateId();this.$={id:n,type:"composite",label:"",children:s[o-1]};break;case 29:a.getLogger().debug("Rule: node (NODE_ID separator): ",s[o]),this.$={id:s[o]};break;case 30:a.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",s[o-1],s[o]),this.$={id:s[o-1],label:s[o].label,typeStr:s[o].typeStr,directions:s[o].directions};break;case 31:a.getLogger().debug("Rule: dirList: ",s[o]),this.$=[s[o]];break;case 32:a.getLogger().debug("Rule: dirList: ",s[o-1],s[o]),this.$=[s[o-1]].concat(s[o]);break;case 33:a.getLogger().debug("Rule: nodeShapeNLabel: ",s[o-2],s[o-1],s[o]),this.$={typeStr:s[o-2]+s[o],label:s[o-1]};break;case 34:a.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",s[o-3],s[o-2]," #3:",s[o-1],s[o]),this.$={typeStr:s[o-3]+s[o],label:s[o-2],directions:s[o-1]};break;case 35:case 36:this.$={type:"classDef",id:s[o-1].trim(),css:s[o].trim()};break;case 37:this.$={type:"applyClass",id:s[o-1].trim(),styleClass:s[o].trim()};break;case 38:this.$={type:"applyStyles",id:s[o-1].trim(),stylesStr:s[o].trim()}}}),"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{11:3,13:4,19:5,20:6,21:e,22:8,23:9,24:10,25:11,26:12,28:a,29:i,31:s,32:n,40:o,44:l,47:c},{8:[1,20]},t(d,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,21:e,28:a,29:i,31:s,32:n,40:o,44:l,47:c}),t(h,[2,16],{14:22,15:g,16:u}),t(h,[2,17]),t(h,[2,18]),t(h,[2,19]),t(h,[2,20]),t(h,[2,21]),t(h,[2,22]),t(y,[2,25],{27:[1,25]}),t(h,[2,26]),{19:26,26:12,32:n},{11:27,13:4,19:5,20:6,21:e,22:8,23:9,24:10,25:11,26:12,28:a,29:i,31:s,32:n,40:o,44:l,47:c},{41:[1,28],43:[1,29]},{45:[1,30]},{48:[1,31]},t(p,[2,29],{33:32,36:[1,33],38:[1,34]}),{1:[2,7]},t(d,[2,13]),{26:35,32:n},{32:[2,14]},{17:[1,36]},t(y,[2,24]),{11:37,13:4,14:22,15:g,16:u,19:5,20:6,21:e,22:8,23:9,24:10,25:11,26:12,28:a,29:i,31:s,32:n,40:o,44:l,47:c},{30:[1,38]},{42:[1,39]},{42:[1,40]},{46:[1,41]},{49:[1,42]},t(p,[2,30]),{18:[1,43]},{18:[1,44]},t(y,[2,23]),{18:[1,45]},{30:[1,46]},t(h,[2,28]),t(h,[2,35]),t(h,[2,36]),t(h,[2,37]),t(h,[2,38]),{37:[1,47]},{34:48,35:x},{15:[1,50]},t(h,[2,27]),t(p,[2,33]),{39:[1,51]},{34:52,35:x,39:[2,31]},{32:[2,15]},t(p,[2,34]),{39:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:r((function(t,e){if(!e.recoverable){var r=new Error(t);throw r.hash=e,r}this.trace(t)}),"parseError"),parse:r((function(t){var e=this,a=[0],i=[],s=[null],n=[],o=this.table,l="",c=0,d=0,h=n.slice.call(arguments,1),g=Object.create(this.lexer),u={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(u.yy[y]=this.yy[y]);g.setInput(t,u.yy),u.yy.lexer=g,u.yy.parser=this,void 0===g.yylloc&&(g.yylloc={});var p=g.yylloc;n.push(p);var x=g.options&&g.options.ranges;function b(){var t;return"number"!=typeof(t=i.pop()||g.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,r((function(t){a.length=a.length-2*t,s.length=s.length-t,n.length=n.length-t}),"popStack"),r(b,"lex");for(var f,m,w,k,L,S,_,v,E={};;){if(m=a[a.length-1],this.defaultActions[m]?w=this.defaultActions[m]:(null==f&&(f=b()),w=o[m]&&o[m][f]),void 0===w||!w.length||!w[0]){var D="";for(L in v=[],o[m])this.terminals_[L]&&L>2&&v.push("'"+this.terminals_[L]+"'");D=g.showPosition?"Parse error on line "+(c+1)+":\n"+g.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(D,{text:g.match,token:this.terminals_[f]||f,line:g.yylineno,loc:p,expected:v})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+f);switch(w[0]){case 1:a.push(f),s.push(g.yytext),n.push(g.yylloc),a.push(w[1]),f=null,d=g.yyleng,l=g.yytext,c=g.yylineno,p=g.yylloc;break;case 2:if(S=this.productions_[w[1]][1],E.$=s[s.length-S],E._$={first_line:n[n.length-(S||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(S||1)].first_column,last_column:n[n.length-1].last_column},x&&(E._$.range=[n[n.length-(S||1)].range[0],n[n.length-1].range[1]]),void 0!==(k=this.performAction.apply(E,[l,d,c,u.yy,w[1],s,n].concat(h))))return k;S&&(a=a.slice(0,-1*S*2),s=s.slice(0,-1*S),n=n.slice(0,-1*S)),a.push(this.productions_[w[1]][0]),s.push(E.$),n.push(E._$),_=o[a[a.length-2]][a[a.length-1]],a.push(_);break;case 3:return!0}}return!0}),"parse")},f=function(){return{EOF:1,parseError:r((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:r((function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this}),"setInput"),input:r((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:r((function(t){var e=t.length,r=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===a.length?this.yylloc.first_column:0)+a[a.length-r.length].length-r[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:r((function(){return this._more=!0,this}),"more"),reject:r((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:r((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:r((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:r((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:r((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:r((function(t,e){var r,a,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(a=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],r=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var s in i)this[s]=i[s];return!1}return!1}),"test_match"),next:r((function(){if(this.done)return this.EOF;var t,e,r,a;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),s=0;se[0].length)){if(e=r,a=s,this.options.backtrack_lexer){if(!1!==(t=this.test_match(r,i[s])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[a]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:r((function(){var t=this.next();return t||this.lex()}),"lex"),begin:r((function(t){this.conditionStack.push(t)}),"begin"),popState:r((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:r((function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}),"_currentRules"),topState:r((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:r((function(t){this.begin(t)}),"pushState"),stateStackSize:r((function(){return this.conditionStack.length}),"stateStackSize"),options:{},performAction:r((function(t,e,r,a){switch(r){case 0:return 10;case 1:return t.getLogger().debug("Found space-block"),31;case 2:return t.getLogger().debug("Found nl-block"),31;case 3:return t.getLogger().debug("Found space-block"),29;case 4:t.getLogger().debug(".",e.yytext);break;case 5:t.getLogger().debug("_",e.yytext);break;case 6:return 5;case 7:return e.yytext=-1,28;case 8:return e.yytext=e.yytext.replace(/columns\s+/,""),t.getLogger().debug("COLUMNS (LEX)",e.yytext),28;case 9:case 77:case 78:case 100:this.pushState("md_string");break;case 10:return"MD_STR";case 11:case 35:case 80:this.popState();break;case 12:this.pushState("string");break;case 13:t.getLogger().debug("LEX: POPPING STR:",e.yytext),this.popState();break;case 14:return t.getLogger().debug("LEX: STR end:",e.yytext),"STR";case 15:return e.yytext=e.yytext.replace(/space\:/,""),t.getLogger().debug("SPACE NUM (LEX)",e.yytext),21;case 16:return e.yytext="1",t.getLogger().debug("COLUMNS (LEX)",e.yytext),21;case 17:return 43;case 18:return"LINKSTYLE";case 19:return"INTERPOLATE";case 20:return this.pushState("CLASSDEF"),40;case 21:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 22:return this.popState(),this.pushState("CLASSDEFID"),41;case 23:return this.popState(),42;case 24:return this.pushState("CLASS"),44;case 25:return this.popState(),this.pushState("CLASS_STYLE"),45;case 26:return this.popState(),46;case 27:return this.pushState("STYLE_STMNT"),47;case 28:return this.popState(),this.pushState("STYLE_DEFINITION"),48;case 29:return this.popState(),49;case 30:return this.pushState("acc_title"),"acc_title";case 31:return this.popState(),"acc_title_value";case 32:return this.pushState("acc_descr"),"acc_descr";case 33:return this.popState(),"acc_descr_value";case 34:this.pushState("acc_descr_multiline");break;case 36:return"acc_descr_multiline_value";case 37:return 30;case 38:case 39:case 41:case 42:case 45:return this.popState(),t.getLogger().debug("Lex: (("),"NODE_DEND";case 40:return this.popState(),t.getLogger().debug("Lex: ))"),"NODE_DEND";case 43:return this.popState(),t.getLogger().debug("Lex: (-"),"NODE_DEND";case 44:return this.popState(),t.getLogger().debug("Lex: -)"),"NODE_DEND";case 46:return this.popState(),t.getLogger().debug("Lex: ]]"),"NODE_DEND";case 47:return this.popState(),t.getLogger().debug("Lex: ("),"NODE_DEND";case 48:return this.popState(),t.getLogger().debug("Lex: ])"),"NODE_DEND";case 49:case 50:return this.popState(),t.getLogger().debug("Lex: /]"),"NODE_DEND";case 51:return this.popState(),t.getLogger().debug("Lex: )]"),"NODE_DEND";case 52:return this.popState(),t.getLogger().debug("Lex: )"),"NODE_DEND";case 53:return this.popState(),t.getLogger().debug("Lex: ]>"),"NODE_DEND";case 54:return this.popState(),t.getLogger().debug("Lex: ]"),"NODE_DEND";case 55:return t.getLogger().debug("Lexa: -)"),this.pushState("NODE"),36;case 56:return t.getLogger().debug("Lexa: (-"),this.pushState("NODE"),36;case 57:return t.getLogger().debug("Lexa: ))"),this.pushState("NODE"),36;case 58:case 60:case 61:case 62:case 65:return t.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;case 59:return t.getLogger().debug("Lex: ((("),this.pushState("NODE"),36;case 63:return t.getLogger().debug("Lexc: >"),this.pushState("NODE"),36;case 64:return t.getLogger().debug("Lexa: (["),this.pushState("NODE"),36;case 66:case 67:case 68:case 69:case 70:case 71:case 72:return this.pushState("NODE"),36;case 73:return t.getLogger().debug("Lexa: ["),this.pushState("NODE"),36;case 74:return this.pushState("BLOCK_ARROW"),t.getLogger().debug("LEX ARR START"),38;case 75:return t.getLogger().debug("Lex: NODE_ID",e.yytext),32;case 76:return t.getLogger().debug("Lex: EOF",e.yytext),8;case 79:return"NODE_DESCR";case 81:t.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 82:t.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 83:return t.getLogger().debug("LEX: NODE_DESCR:",e.yytext),"NODE_DESCR";case 84:t.getLogger().debug("LEX POPPING"),this.popState();break;case 85:t.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 86:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (right): dir:",e.yytext),"DIR";case 87:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (left):",e.yytext),"DIR";case 88:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (x):",e.yytext),"DIR";case 89:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (y):",e.yytext),"DIR";case 90:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (up):",e.yytext),"DIR";case 91:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (down):",e.yytext),"DIR";case 92:return e.yytext="]>",t.getLogger().debug("Lex (ARROW_DIR end):",e.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 93:return t.getLogger().debug("Lex: LINK","#"+e.yytext+"#"),15;case 94:case 95:case 96:return t.getLogger().debug("Lex: LINK",e.yytext),15;case 97:case 98:case 99:return t.getLogger().debug("Lex: START_LINK",e.yytext),this.pushState("LLABEL"),16;case 101:return t.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 102:return this.popState(),t.getLogger().debug("Lex: LINK","#"+e.yytext+"#"),15;case 103:case 104:return this.popState(),t.getLogger().debug("Lex: LINK",e.yytext),15;case 105:return t.getLogger().debug("Lex: COLON",e.yytext),e.yytext=e.yytext.slice(1),27}}),"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block\s+)/,/^(?:block\n+)/,/^(?:block:)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[29],inclusive:!1},STYLE_STMNT:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[23],inclusive:!1},CLASSDEF:{rules:[21,22],inclusive:!1},CLASS_STYLE:{rules:[26],inclusive:!1},CLASS:{rules:[25],inclusive:!1},LLABEL:{rules:[100,101,102,103,104],inclusive:!1},ARROW_DIR:{rules:[86,87,88,89,90,91,92],inclusive:!1},BLOCK_ARROW:{rules:[77,82,85],inclusive:!1},NODE:{rules:[38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,78,81],inclusive:!1},md_string:{rules:[10,11,79,80],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[13,14,83,84],inclusive:!1},acc_descr_multiline:{rules:[35,36],inclusive:!1},acc_descr:{rules:[33],inclusive:!1},acc_title:{rules:[31],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,12,15,16,17,18,19,20,24,27,30,32,34,37,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,93,94,95,96,97,98,99,105],inclusive:!0}}}}();function m(){this.yy={}}return b.lexer=f,r(m,"Parser"),m.prototype=b,b.Parser=m,new m}();v.parser=v;var E=v,D=new Map,$=[],T=new Map,C="color",N="fill",I=l(),B=new Map,z=r((t=>y.sanitizeText(t,I)),"sanitizeText"),R=r((function(t,e=""){let r=B.get(t);r||(r={id:t,styles:[],textStyles:[]},B.set(t,r)),null!=e&&e.split(",").forEach((t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(RegExp(C).exec(t)){const t=e.replace(N,"bgFill").replace(C,N);r.textStyles.push(t)}r.styles.push(e)}))}),"addStyleClass"),O=r((function(t,e=""){const r=D.get(t);null!=e&&(r.styles=e.split(","))}),"addStyle2Node"),A=r((function(t,e){t.split(",").forEach((function(t){let r=D.get(t);if(void 0===r){const e=t.trim();r={id:e,type:"na",children:[]},D.set(e,r)}r.classes||(r.classes=[]),r.classes.push(e)}))}),"setCssClass"),M=r(((t,e)=>{const r=t.flat(),a=[];for(const i of r)if(i.label&&(i.label=z(i.label)),"classDef"!==i.type)if("applyClass"!==i.type)if("applyStyles"!==i.type)if("column-setting"===i.type)e.columns=i.columns??-1;else if("edge"===i.type){const t=(T.get(i.id)??0)+1;T.set(i.id,t),i.id=t+"-"+i.id,$.push(i)}else{i.label||("composite"===i.type?i.label="":i.label=i.id);const t=D.get(i.id);if(void 0===t?D.set(i.id,i):("na"!==i.type&&(t.type=i.type),i.label!==i.id&&(t.label=i.label)),i.children&&M(i.children,i),"space"===i.type){const t=i.width??1;for(let e=0;e{s.debug("Clear called"),n(),Y={id:"root",type:"composite",children:[],columns:-1},D=new Map([["root",Y]]),P=[],B=new Map,$=[],T=new Map}),"clear");function X(t){switch(s.debug("typeStr2Type",t),t){case"[]":return"square";case"()":return s.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}function F(t){return s.debug("typeStr2Type",t),"=="===t?"thick":"normal"}function j(t){switch(t.trim()){case"--x":return"arrow_cross";case"--o":return"arrow_circle";default:return"arrow_point"}}r(X,"typeStr2Type"),r(F,"edgeTypeStr2Type"),r(j,"edgeStrToEdgeData");var H=0,U=r((()=>(H++,"id-"+Math.random().toString(36).substr(2,12)+"-"+H)),"generateId"),K=r((t=>{Y.children=t,M(t,Y),P=Y.children}),"setHierarchy"),q=r((t=>{const e=D.get(t);return e?e.columns?e.columns:e.children?e.children.length:-1:-1}),"getColumns"),Z=r((()=>[...D.values()]),"getBlocksFlat"),G=r((()=>P||[]),"getBlocks"),J=r((()=>$),"getEdges"),V=r((t=>D.get(t)),"getBlock"),Q=r((t=>{D.set(t.id,t)}),"setBlock"),tt=r((()=>console),"getLogger"),et=r((function(){return B}),"getClasses"),rt={getConfig:r((()=>a().block),"getConfig"),typeStr2Type:X,edgeTypeStr2Type:F,edgeStrToEdgeData:j,getLogger:tt,getBlocksFlat:Z,getBlocks:G,getEdges:J,setHierarchy:K,getBlock:V,setBlock:Q,getColumns:q,getClasses:et,clear:W,generateId:U},at=r(((t,e)=>{const r=L,a=r(t,"r"),i=r(t,"g"),s=r(t,"b");return o(a,i,s,e)}),"fade"),it=r((t=>`.label {\n font-family: ${t.fontFamily};\n color: ${t.nodeTextColor||t.textColor};\n }\n .cluster-label text {\n fill: ${t.titleColor};\n }\n .cluster-label span,p {\n color: ${t.titleColor};\n }\n\n\n\n .label text,span,p {\n fill: ${t.nodeTextColor||t.textColor};\n color: ${t.nodeTextColor||t.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n .flowchart-label text {\n text-anchor: middle;\n }\n // .flowchart-label .text-outer-tspan {\n // text-anchor: middle;\n // }\n // .flowchart-label .text-inner-tspan {\n // text-anchor: start;\n // }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n }\n\n /* For html labels only */\n .labelBkg {\n background-color: ${at(t.edgeLabelBackground,.5)};\n // background-color:\n }\n\n .node .cluster {\n // fill: ${at(t.mainBkg,.5)};\n fill: ${at(t.clusterBkg,.5)};\n stroke: ${at(t.clusterBorder,.2)};\n box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n .cluster span,p {\n color: ${t.titleColor};\n }\n /* .cluster div {\n color: ${t.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${t.fontFamily};\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n`),"getStyles"),st=r(((t,e,r,a)=>{e.forEach((e=>{nt[e](t,r,a)}))}),"insertMarkers"),nt={extension:r(((t,e,r)=>{s.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")}),"extension"),composition:r(((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")}),"composition"),aggregation:r(((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")}),"aggregation"),dependency:r(((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")}),"dependency"),lollipop:r(((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)}),"lollipop"),point:r(((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")}),"point"),circle:r(((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")}),"circle"),cross:r(((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")}),"cross"),barb:r(((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")}),"barb")},ot=st,lt=(null==(e=null==(t=l())?void 0:t.block)?void 0:e.padding)??8;function ct(t,e){if(0===t||!Number.isInteger(t))throw new Error("Columns must be an integer !== 0.");if(e<0||!Number.isInteger(e))throw new Error("Position must be a non-negative integer."+e);if(t<0)return{px:e,py:0};if(1===t)return{px:0,py:e};return{px:e%t,py:Math.floor(e/t)}}r(ct,"calculateBlockPosition");var dt=r((t=>{let e=0,r=0;for(const a of t.children){const{width:i,height:n,x:o,y:l}=a.size??{width:0,height:0,x:0,y:0};s.debug("getMaxChildSize abc95 child:",a.id,"width:",i,"height:",n,"x:",o,"y:",l,a.type),"space"!==a.type&&(i>e&&(e=i/(t.widthInColumns??1)),n>r&&(r=n))}return{width:e,height:r}}),"getMaxChildSize");function ht(t,e,r=0,a=0){var i,n,o,l,c,d,h,g,u,y,p;s.debug("setBlockSizes abc95 (start)",t.id,null==(i=null==t?void 0:t.size)?void 0:i.x,"block width =",null==t?void 0:t.size,"sieblingWidth",r),(null==(n=null==t?void 0:t.size)?void 0:n.width)||(t.size={width:r,height:a,x:0,y:0});let x=0,b=0;if((null==(o=t.children)?void 0:o.length)>0){for(const r of t.children)ht(r,e);const i=dt(t);x=i.width,b=i.height,s.debug("setBlockSizes abc95 maxWidth of",t.id,":s children is ",x,b);for(const e of t.children)e.size&&(s.debug(`abc95 Setting size of children of ${t.id} id=${e.id} ${x} ${b} ${JSON.stringify(e.size)}`),e.size.width=x*(e.widthInColumns??1)+lt*((e.widthInColumns??1)-1),e.size.height=b,e.size.x=0,e.size.y=0,s.debug(`abc95 updating size of ${t.id} children child:${e.id} maxWidth:${x} maxHeight:${b}`));for(const r of t.children)ht(r,e,x,b);const n=t.columns??-1;let o=0;for(const e of t.children)o+=e.widthInColumns??1;let g=t.children.length;n>0&&n0?Math.min(t.children.length,n):t.children.length;if(e>0){const r=(y-e*lt-lt)/e;s.debug("abc95 (growing to fit) width",t.id,y,null==(h=t.size)?void 0:h.width,r);for(const e of t.children)e.size&&(e.size.width=r)}}t.size={width:y,height:p,x:0,y:0}}s.debug("setBlockSizes abc94 (done)",t.id,null==(g=null==t?void 0:t.size)?void 0:g.x,null==(u=null==t?void 0:t.size)?void 0:u.width,null==(y=null==t?void 0:t.size)?void 0:y.y,null==(p=null==t?void 0:t.size)?void 0:p.height)}function gt(t,e){var r,a,i,n,o,l,c,d,h,g,u,y,p,x,b,f,m;s.debug(`abc85 layout blocks (=>layoutBlocks) ${t.id} x: ${null==(r=null==t?void 0:t.size)?void 0:r.x} y: ${null==(a=null==t?void 0:t.size)?void 0:a.y} width: ${null==(i=null==t?void 0:t.size)?void 0:i.width}`);const w=t.columns??-1;if(s.debug("layoutBlocks columns abc95",t.id,"=>",w,t),t.children&&t.children.length>0){const e=(null==(o=null==(n=null==t?void 0:t.children[0])?void 0:n.size)?void 0:o.width)??0,r=t.children.length*e+(t.children.length-1)*lt;s.debug("widthOfChildren 88",r,"posX");let a=0;s.debug("abc91 block?.size?.x",t.id,null==(l=null==t?void 0:t.size)?void 0:l.x);let i=(null==(c=null==t?void 0:t.size)?void 0:c.x)?(null==(d=null==t?void 0:t.size)?void 0:d.x)+(-(null==(h=null==t?void 0:t.size)?void 0:h.width)/2||0):-lt,b=0;for(const n of t.children){const e=t;if(!n.size)continue;const{width:r,height:o}=n.size,{px:l,py:c}=ct(w,a);if(c!=b&&(b=c,i=(null==(g=null==t?void 0:t.size)?void 0:g.x)?(null==(u=null==t?void 0:t.size)?void 0:u.x)+(-(null==(y=null==t?void 0:t.size)?void 0:y.width)/2||0):-lt,s.debug("New row in layout for block",t.id," and child ",n.id,b)),s.debug(`abc89 layout blocks (child) id: ${n.id} Pos: ${a} (px, py) ${l},${c} (${null==(p=null==e?void 0:e.size)?void 0:p.x},${null==(x=null==e?void 0:e.size)?void 0:x.y}) parent: ${e.id} width: ${r}${lt}`),e.size){const t=r/2;n.size.x=i+lt+t,s.debug(`abc91 layout blocks (calc) px, pyid:${n.id} startingPos=X${i} new startingPosX${n.size.x} ${t} padding=${lt} width=${r} halfWidth=${t} => x:${n.size.x} y:${n.size.y} ${n.widthInColumns} (width * (child?.w || 1)) / 2 ${r*((null==n?void 0:n.widthInColumns)??1)/2}`),i=n.size.x+t,n.size.y=e.size.y-e.size.height/2+c*(o+lt)+o/2+lt,s.debug(`abc88 layout blocks (calc) px, pyid:${n.id}startingPosX${i}${lt}${t}=>x:${n.size.x}y:${n.size.y}${n.widthInColumns}(width * (child?.w || 1)) / 2${r*((null==n?void 0:n.widthInColumns)??1)/2}`)}n.children&>(n),a+=(null==n?void 0:n.widthInColumns)??1,s.debug("abc88 columnsPos",n,a)}}s.debug(`layout blocks (<==layoutBlocks) ${t.id} x: ${null==(b=null==t?void 0:t.size)?void 0:b.x} y: ${null==(f=null==t?void 0:t.size)?void 0:f.y} width: ${null==(m=null==t?void 0:t.size)?void 0:m.width}`)}function ut(t,{minX:e,minY:r,maxX:a,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(t.size&&"root"!==t.id){const{x:s,y:n,width:o,height:l}=t.size;s-o/2a&&(a=s+o/2),n+l/2>i&&(i=n+l/2)}if(t.children)for(const s of t.children)({minX:e,minY:r,maxX:a,maxY:i}=ut(s,{minX:e,minY:r,maxX:a,maxY:i}));return{minX:e,minY:r,maxX:a,maxY:i}}function yt(t){const e=t.getBlock("root");if(!e)return;ht(e,t,0,0),gt(e),s.debug("getBlocks",JSON.stringify(e,null,2));const{minX:r,minY:a,maxX:i,maxY:n}=ut(e);return{x:r,y:a,width:i-r,height:n-a}}function pt(t,e){e&&t.attr("style",e)}function xt(t){const e=w(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),r=e.append("xhtml:div"),a=t.label,i=t.isNode?"nodeLabel":"edgeLabel",s=r.append("span");return s.html(a),pt(s,t.labelStyle),s.attr("class",i),pt(r,t.labelStyle),r.style("display","inline-block"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),e.node()}r(ht,"setBlockSizes"),r(gt,"layoutBlocks"),r(ut,"findBounds"),r(yt,"layout"),r(pt,"applyStyle"),r(xt,"addHtmlLabel");var bt=r(((t,e,r,a)=>{let i=t||"";if("object"==typeof i&&(i=i[0]),d(l().flowchart.htmlLabels)){i=i.replace(/\\n|\n/g,"
"),s.debug("vertexText"+i);return xt({isNode:a,label:p(x(i)),labelStyle:e.replace("fill:","color:")})}{const t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",e.replace("color:","fill:"));let a=[];a="string"==typeof i?i.split(/\\n|\n|/gi):Array.isArray(i)?i:[];for(const e of a){const a=document.createElementNS("http://www.w3.org/2000/svg","tspan");a.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),a.setAttribute("dy","1em"),a.setAttribute("x","0"),r?a.setAttribute("class","title-row"):a.setAttribute("class","row"),a.textContent=e.trim(),t.appendChild(a)}return t}}),"createLabel"),ft=r(((t,e,r,a,i)=>{e.arrowTypeStart&&wt(t,"start",e.arrowTypeStart,r,a,i),e.arrowTypeEnd&&wt(t,"end",e.arrowTypeEnd,r,a,i)}),"addEdgeMarkers"),mt={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},wt=r(((t,e,r,a,i,n)=>{const o=mt[r];if(!o)return void s.warn(`Unknown arrow type: ${r}`);const l="start"===e?"Start":"End";t.attr(`marker-${e}`,`url(${a}#${i}_${n}-${o}${l})`)}),"addEdgeMarker"),kt={},Lt={},St=r(((t,e)=>{const r=l(),a=d(r.flowchart.htmlLabels),i="markdown"===e.labelType?h(t,e.label,{style:e.labelStyle,useHtmlLabels:a,addSvgBackground:!0},r):bt(e.label,e.labelStyle),s=t.insert("g").attr("class","edgeLabel"),n=s.insert("g").attr("class","label");n.node().appendChild(i);let o,c=i.getBBox();if(a){const t=i.children[0],e=w(i);c=t.getBoundingClientRect(),e.attr("width",c.width),e.attr("height",c.height)}if(n.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),kt[e.id]=s,e.width=c.width,e.height=c.height,e.startLabelLeft){const r=bt(e.startLabelLeft,e.labelStyle),a=t.insert("g").attr("class","edgeTerminals"),i=a.insert("g").attr("class","inner");o=i.node().appendChild(r);const s=r.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),Lt[e.id]||(Lt[e.id]={}),Lt[e.id].startLeft=a,_t(o,e.startLabelLeft)}if(e.startLabelRight){const r=bt(e.startLabelRight,e.labelStyle),a=t.insert("g").attr("class","edgeTerminals"),i=a.insert("g").attr("class","inner");o=a.node().appendChild(r),i.node().appendChild(r);const s=r.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),Lt[e.id]||(Lt[e.id]={}),Lt[e.id].startRight=a,_t(o,e.startLabelRight)}if(e.endLabelLeft){const r=bt(e.endLabelLeft,e.labelStyle),a=t.insert("g").attr("class","edgeTerminals"),i=a.insert("g").attr("class","inner");o=i.node().appendChild(r);const s=r.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),a.node().appendChild(r),Lt[e.id]||(Lt[e.id]={}),Lt[e.id].endLeft=a,_t(o,e.endLabelLeft)}if(e.endLabelRight){const r=bt(e.endLabelRight,e.labelStyle),a=t.insert("g").attr("class","edgeTerminals"),i=a.insert("g").attr("class","inner");o=i.node().appendChild(r);const s=r.getBBox();i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),a.node().appendChild(r),Lt[e.id]||(Lt[e.id]={}),Lt[e.id].endRight=a,_t(o,e.endLabelRight)}return i}),"insertEdgeLabel");function _t(t,e){l().flowchart.htmlLabels&&t&&(t.style.width=9*e.length+"px",t.style.height="12px")}r(_t,"setTerminalWidth");var vt=r(((t,e)=>{s.debug("Moving label abc88 ",t.id,t.label,kt[t.id],e);let r=e.updatedPath?e.updatedPath:e.originalPath;const a=l(),{subGraphTitleTotalMargin:i}=g(a);if(t.label){const a=kt[t.id];let n=t.x,o=t.y;if(r){const a=u.calcLabelPosition(r);s.debug("Moving label "+t.label+" from (",n,",",o,") to (",a.x,",",a.y,") abc88"),e.updatedPath&&(n=a.x,o=a.y)}a.attr("transform",`translate(${n}, ${o+i/2})`)}if(t.startLabelLeft){const e=Lt[t.id].startLeft;let a=t.x,i=t.y;if(r){const e=u.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);a=e.x,i=e.y}e.attr("transform",`translate(${a}, ${i})`)}if(t.startLabelRight){const e=Lt[t.id].startRight;let a=t.x,i=t.y;if(r){const e=u.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);a=e.x,i=e.y}e.attr("transform",`translate(${a}, ${i})`)}if(t.endLabelLeft){const e=Lt[t.id].endLeft;let a=t.x,i=t.y;if(r){const e=u.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);a=e.x,i=e.y}e.attr("transform",`translate(${a}, ${i})`)}if(t.endLabelRight){const e=Lt[t.id].endRight;let a=t.x,i=t.y;if(r){const e=u.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);a=e.x,i=e.y}e.attr("transform",`translate(${a}, ${i})`)}}),"positionEdgeLabel"),Et=r(((t,e)=>{const r=t.x,a=t.y,i=Math.abs(e.x-r),s=Math.abs(e.y-a),n=t.width/2,o=t.height/2;return i>=n||s>=o}),"outsideNode"),Dt=r(((t,e,r)=>{s.debug(`intersection calc abc89:\n outsidePoint: ${JSON.stringify(e)}\n insidePoint : ${JSON.stringify(r)}\n node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const a=t.x,i=t.y,n=Math.abs(a-r.x),o=t.width/2;let l=r.xMath.abs(a-e.x)*c){let t=r.y{s.debug("abc88 cutPathAtIntersect",t,e);let r=[],a=t[0],i=!1;return t.forEach((t=>{if(Et(e,t)||i)a=t,i||r.push(t);else{const s=Dt(e,a,t);let n=!1;r.forEach((t=>{n=n||t.x===s.x&&t.y===s.y})),r.some((t=>t.x===s.x&&t.y===s.y))||r.push(s),i=!0}})),r}),"cutPathAtIntersect"),Tt=r((function(t,e,r,a,i,n,o){let d=r.points;s.debug("abc88 InsertEdge: edge=",r,"e=",e);let h=!1;const g=n.node(e.v);var u=n.node(e.w);(null==u?void 0:u.intersect)&&(null==g?void 0:g.intersect)&&(d=d.slice(1,r.points.length-1),d.unshift(g.intersect(d[0])),d.push(u.intersect(d[d.length-1]))),r.toCluster&&(s.debug("to cluster abc88",a[r.toCluster]),d=$t(r.points,a[r.toCluster].node),h=!0),r.fromCluster&&(s.debug("from cluster abc88",a[r.fromCluster]),d=$t(d.reverse(),a[r.fromCluster].node).reverse(),h=!0);const y=d.filter((t=>!Number.isNaN(t.y)));let p=_;!r.curve||"graph"!==i&&"flowchart"!==i||(p=r.curve);const{x:x,y:b}=c(r),f=S().x(x).y(b).curve(p);let m;switch(r.thickness){case"normal":m="edge-thickness-normal";break;case"thick":case"invisible":m="edge-thickness-thick";break;default:m=""}switch(r.pattern){case"solid":m+=" edge-pattern-solid";break;case"dotted":m+=" edge-pattern-dotted";break;case"dashed":m+=" edge-pattern-dashed"}const w=t.append("path").attr("d",f(y)).attr("id",r.id).attr("class"," "+m+(r.classes?" "+r.classes:"")).attr("style",r.style);let k="";(l().flowchart.arrowMarkerAbsolute||l().state.arrowMarkerAbsolute)&&(k=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,k=k.replace(/\(/g,"\\("),k=k.replace(/\)/g,"\\)")),ft(w,r,k,o,i);let L={};return h&&(L.updatedPath=d),L.originalPath=r.points,L}),"insertEdge"),Ct=r((t=>{const e=new Set;for(const r of t)switch(r){case"x":e.add("right"),e.add("left");break;case"y":e.add("up"),e.add("down");break;default:e.add(r)}return e}),"expandAndDeduplicateDirections"),Nt=r(((t,e,r)=>{const a=Ct(t),i=e.height+2*r.padding,s=i/2,n=e.width+2*s+r.padding,o=r.padding/2;return a.has("right")&&a.has("left")&&a.has("up")&&a.has("down")?[{x:0,y:0},{x:s,y:0},{x:n/2,y:2*o},{x:n-s,y:0},{x:n,y:0},{x:n,y:-i/3},{x:n+2*o,y:-i/2},{x:n,y:-2*i/3},{x:n,y:-i},{x:n-s,y:-i},{x:n/2,y:-i-2*o},{x:s,y:-i},{x:0,y:-i},{x:0,y:-2*i/3},{x:-2*o,y:-i/2},{x:0,y:-i/3}]:a.has("right")&&a.has("left")&&a.has("up")?[{x:s,y:0},{x:n-s,y:0},{x:n,y:-i/2},{x:n-s,y:-i},{x:s,y:-i},{x:0,y:-i/2}]:a.has("right")&&a.has("left")&&a.has("down")?[{x:0,y:0},{x:s,y:-i},{x:n-s,y:-i},{x:n,y:0}]:a.has("right")&&a.has("up")&&a.has("down")?[{x:0,y:0},{x:n,y:-s},{x:n,y:-i+s},{x:0,y:-i}]:a.has("left")&&a.has("up")&&a.has("down")?[{x:n,y:0},{x:0,y:-s},{x:0,y:-i+s},{x:n,y:-i}]:a.has("right")&&a.has("left")?[{x:s,y:0},{x:s,y:-o},{x:n-s,y:-o},{x:n-s,y:0},{x:n,y:-i/2},{x:n-s,y:-i},{x:n-s,y:-i+o},{x:s,y:-i+o},{x:s,y:-i},{x:0,y:-i/2}]:a.has("up")&&a.has("down")?[{x:n/2,y:0},{x:0,y:-o},{x:s,y:-o},{x:s,y:-i+o},{x:0,y:-i+o},{x:n/2,y:-i},{x:n,y:-i+o},{x:n-s,y:-i+o},{x:n-s,y:-o},{x:n,y:-o}]:a.has("right")&&a.has("up")?[{x:0,y:0},{x:n,y:-s},{x:0,y:-i}]:a.has("right")&&a.has("down")?[{x:0,y:0},{x:n,y:0},{x:0,y:-i}]:a.has("left")&&a.has("up")?[{x:n,y:0},{x:0,y:-s},{x:n,y:-i}]:a.has("left")&&a.has("down")?[{x:n,y:0},{x:0,y:0},{x:n,y:-i}]:a.has("right")?[{x:s,y:-o},{x:s,y:-o},{x:n-s,y:-o},{x:n-s,y:0},{x:n,y:-i/2},{x:n-s,y:-i},{x:n-s,y:-i+o},{x:s,y:-i+o},{x:s,y:-i+o}]:a.has("left")?[{x:s,y:0},{x:s,y:-o},{x:n-s,y:-o},{x:n-s,y:-i+o},{x:s,y:-i+o},{x:s,y:-i},{x:0,y:-i/2}]:a.has("up")?[{x:s,y:-o},{x:s,y:-i+o},{x:0,y:-i+o},{x:n/2,y:-i},{x:n,y:-i+o},{x:n-s,y:-i+o},{x:n-s,y:-o}]:a.has("down")?[{x:n/2,y:0},{x:0,y:-o},{x:s,y:-o},{x:s,y:-i+o},{x:n-s,y:-i+o},{x:n-s,y:-o},{x:n,y:-o}]:[{x:0,y:0}]}),"getArrowPoints");function It(t,e){return t.intersect(e)}r(It,"intersectNode");var Bt=It;function zt(t,e,r,a){var i=t.x,s=t.y,n=i-a.x,o=s-a.y,l=Math.sqrt(e*e*o*o+r*r*n*n),c=Math.abs(e*r*n/l);a.x0}r(Mt,"intersectLine"),r(Pt,"sameSign");var Yt=Mt,Wt=Xt;function Xt(t,e,r){var a=t.x,i=t.y,s=[],n=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;"function"==typeof e.forEach?e.forEach((function(t){n=Math.min(n,t.x),o=Math.min(o,t.y)})):(n=Math.min(n,e.x),o=Math.min(o,e.y));for(var l=a-t.width/2-n,c=i-t.height/2-o,d=0;d1&&s.sort((function(t,e){var a=t.x-r.x,i=t.y-r.y,s=Math.sqrt(a*a+i*i),n=e.x-r.x,o=e.y-r.y,l=Math.sqrt(n*n+o*o);return s{var r,a,i=t.x,s=t.y,n=e.x-i,o=e.y-s,l=t.width/2,c=t.height/2;return Math.abs(o)*l>Math.abs(n)*c?(o<0&&(c=-c),r=0===o?0:c*n/o,a=c):(n<0&&(l=-l),r=l,a=0===n?0:l*o/n),{x:i+r,y:s+a}}),"intersectRect")},jt=r((async(t,e,a,i)=>{const s=l();let n;const o=e.useHtmlLabels||d(s.flowchart.htmlLabels);n=a||"node default";const c=t.insert("g").attr("class",n).attr("id",e.domId||e.id),g=c.insert("g").attr("class","label").attr("style",e.labelStyle);let u;u=void 0===e.labelText?"":"string"==typeof e.labelText?e.labelText:e.labelText[0];const y=g.node();let p;p="markdown"===e.labelType?h(g,f(x(u),s),{useHtmlLabels:o,width:e.width||s.flowchart.wrappingWidth,classes:"markdown-node-label"},s):y.appendChild(bt(f(x(u),s),e.labelStyle,!1,i));let b=p.getBBox();const m=e.padding/2;if(d(s.flowchart.htmlLabels)){const t=p.children[0],e=w(p),a=t.getElementsByTagName("img");if(a){const t=""===u.replace(/]*>/g,"").trim();await Promise.all([...a].map((e=>new Promise((a=>{function i(){if(e.style.display="flex",e.style.flexDirection="column",t){const t=s.fontSize?s.fontSize:window.getComputedStyle(document.body).fontSize,r=5,a=parseInt(t,10)*r+"px";e.style.minWidth=a,e.style.maxWidth=a}else e.style.width="100%";a(e)}r(i,"setupImage"),setTimeout((()=>{e.complete&&i()})),e.addEventListener("error",i),e.addEventListener("load",i)})))))}b=t.getBoundingClientRect(),e.attr("width",b.width),e.attr("height",b.height)}return o?g.attr("transform","translate("+-b.width/2+", "+-b.height/2+")"):g.attr("transform","translate(0, "+-b.height/2+")"),e.centerLabel&&g.attr("transform","translate("+-b.width/2+", "+-b.height/2+")"),g.insert("rect",":first-child"),{shapeSvg:c,bbox:b,halfPadding:m,label:g}}),"labelHelper"),Ht=r(((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height}),"updateNodeBounds");function Ut(t,e,r,a){return t.insert("polygon",":first-child").attr("points",a.map((function(t){return t.x+","+t.y})).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}r(Ut,"insertPolygonShape");var Kt=r((async(t,e)=>{e.useHtmlLabels||l().flowchart.htmlLabels||(e.centerLabel=!0);const{shapeSvg:r,bbox:a,halfPadding:i}=await jt(t,e,"node "+e.classes,!0);s.info("Classes = ",e.classes);const n=r.insert("rect",":first-child");return n.attr("rx",e.rx).attr("ry",e.ry).attr("x",-a.width/2-i).attr("y",-a.height/2-i).attr("width",a.width+e.padding).attr("height",a.height+e.padding),Ht(e,n),e.intersect=function(t){return Ft.rect(e,t)},r}),"note"),qt=r((t=>t?" "+t:""),"formatClass"),Zt=r(((t,e)=>`${e||"node default"}${qt(t.classes)} ${qt(t.class)}`),"getClassesFromNode"),Gt=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding+(a.height+e.padding),n=[{x:i/2,y:0},{x:i,y:-i/2},{x:i/2,y:-i},{x:0,y:-i/2}];s.info("Question main (Circle)");const o=Ut(r,i,i,n);return o.attr("style",e.style),Ht(e,o),e.intersect=function(t){return s.warn("Intersect called"),Ft.polygon(e,n,t)},r}),"question"),Jt=r(((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),a=[{x:0,y:14},{x:14,y:0},{x:0,y:-14},{x:-14,y:0}];return r.insert("polygon",":first-child").attr("points",a.map((function(t){return t.x+","+t.y})).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),e.width=28,e.height=28,e.intersect=function(t){return Ft.circle(e,14,t)},r}),"choice"),Vt=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.height+e.padding,s=i/4,n=a.width+2*s+e.padding,o=[{x:s,y:0},{x:n-s,y:0},{x:n,y:-i/2},{x:n-s,y:-i},{x:s,y:-i},{x:0,y:-i/2}],l=Ut(r,n,i,o);return l.attr("style",e.style),Ht(e,l),e.intersect=function(t){return Ft.polygon(e,o,t)},r}),"hexagon"),Qt=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,void 0,!0),i=a.height+2*e.padding,s=i/2,n=a.width+2*s+e.padding,o=Nt(e.directions,a,e),l=Ut(r,n,i,o);return l.attr("style",e.style),Ht(e,l),e.intersect=function(t){return Ft.polygon(e,o,t)},r}),"block_arrow"),te=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding,s=a.height+e.padding,n=[{x:-s/2,y:0},{x:i,y:0},{x:i,y:-s},{x:-s/2,y:-s},{x:0,y:-s/2}];return Ut(r,i,s,n).attr("style",e.style),e.width=i+s,e.height=s,e.intersect=function(t){return Ft.polygon(e,n,t)},r}),"rect_left_inv_arrow"),ee=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e),!0),i=a.width+e.padding,s=a.height+e.padding,n=[{x:-2*s/6,y:0},{x:i-s/6,y:0},{x:i+2*s/6,y:-s},{x:s/6,y:-s}],o=Ut(r,i,s,n);return o.attr("style",e.style),Ht(e,o),e.intersect=function(t){return Ft.polygon(e,n,t)},r}),"lean_right"),re=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding,s=a.height+e.padding,n=[{x:2*s/6,y:0},{x:i+s/6,y:0},{x:i-2*s/6,y:-s},{x:-s/6,y:-s}],o=Ut(r,i,s,n);return o.attr("style",e.style),Ht(e,o),e.intersect=function(t){return Ft.polygon(e,n,t)},r}),"lean_left"),ae=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding,s=a.height+e.padding,n=[{x:-2*s/6,y:0},{x:i+2*s/6,y:0},{x:i-s/6,y:-s},{x:s/6,y:-s}],o=Ut(r,i,s,n);return o.attr("style",e.style),Ht(e,o),e.intersect=function(t){return Ft.polygon(e,n,t)},r}),"trapezoid"),ie=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding,s=a.height+e.padding,n=[{x:s/6,y:0},{x:i-s/6,y:0},{x:i+2*s/6,y:-s},{x:-2*s/6,y:-s}],o=Ut(r,i,s,n);return o.attr("style",e.style),Ht(e,o),e.intersect=function(t){return Ft.polygon(e,n,t)},r}),"inv_trapezoid"),se=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding,s=a.height+e.padding,n=[{x:0,y:0},{x:i+s/2,y:0},{x:i,y:-s/2},{x:i+s/2,y:-s},{x:0,y:-s}],o=Ut(r,i,s,n);return o.attr("style",e.style),Ht(e,o),e.intersect=function(t){return Ft.polygon(e,n,t)},r}),"rect_right_inv_arrow"),ne=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding,s=i/2,n=s/(2.5+i/50),o=a.height+n+e.padding,l="M 0,"+n+" a "+s+","+n+" 0,0,0 "+i+" 0 a "+s+","+n+" 0,0,0 "+-i+" 0 l 0,"+o+" a "+s+","+n+" 0,0,0 "+i+" 0 l 0,"+-o,c=r.attr("label-offset-y",n).insert("path",":first-child").attr("style",e.style).attr("d",l).attr("transform","translate("+-i/2+","+-(o/2+n)+")");return Ht(e,c),e.intersect=function(t){const r=Ft.rect(e,t),a=r.x-e.x;if(0!=s&&(Math.abs(a)e.height/2-n)){let i=n*n*(1-a*a/(s*s));0!=i&&(i=Math.sqrt(i)),i=n-i,t.y-e.y>0&&(i=-i),r.y+=i}return r},r}),"cylinder"),oe=r((async(t,e)=>{const{shapeSvg:r,bbox:a,halfPadding:i}=await jt(t,e,"node "+e.classes+" "+e.class,!0),n=r.insert("rect",":first-child"),o=e.positioned?e.width:a.width+e.padding,l=e.positioned?e.height:a.height+e.padding,c=e.positioned?-o/2:-a.width/2-i,d=e.positioned?-l/2:-a.height/2-i;if(n.attr("class","basic label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",c).attr("y",d).attr("width",o).attr("height",l),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(de(n,e.props.borders,o,l),t.delete("borders")),t.forEach((t=>{s.warn(`Unknown node property ${t}`)}))}return Ht(e,n),e.intersect=function(t){return Ft.rect(e,t)},r}),"rect"),le=r((async(t,e)=>{const{shapeSvg:r,bbox:a,halfPadding:i}=await jt(t,e,"node "+e.classes,!0),n=r.insert("rect",":first-child"),o=e.positioned?e.width:a.width+e.padding,l=e.positioned?e.height:a.height+e.padding,c=e.positioned?-o/2:-a.width/2-i,d=e.positioned?-l/2:-a.height/2-i;if(n.attr("class","basic cluster composite label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",c).attr("y",d).attr("width",o).attr("height",l),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(de(n,e.props.borders,o,l),t.delete("borders")),t.forEach((t=>{s.warn(`Unknown node property ${t}`)}))}return Ht(e,n),e.intersect=function(t){return Ft.rect(e,t)},r}),"composite"),ce=r((async(t,e)=>{const{shapeSvg:r}=await jt(t,e,"label",!0);s.trace("Classes = ",e.class);const a=r.insert("rect",":first-child");if(a.attr("width",0).attr("height",0),r.attr("class","label edgeLabel"),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(de(a,e.props.borders,0,0),t.delete("borders")),t.forEach((t=>{s.warn(`Unknown node property ${t}`)}))}return Ht(e,a),e.intersect=function(t){return Ft.rect(e,t)},r}),"labelRect");function de(t,e,a,i){const n=[],o=r((t=>{n.push(t,0)}),"addBorder"),l=r((t=>{n.push(0,t)}),"skipBorder");e.includes("t")?(s.debug("add top border"),o(a)):l(a),e.includes("r")?(s.debug("add right border"),o(i)):l(i),e.includes("b")?(s.debug("add bottom border"),o(a)):l(a),e.includes("l")?(s.debug("add left border"),o(i)):l(i),t.attr("stroke-dasharray",n.join(" "))}r(de,"applyNodePropertyBorders");var he=r(((t,e)=>{let r;r=e.classes?"node "+e.classes:"node default";const a=t.insert("g").attr("class",r).attr("id",e.domId||e.id),i=a.insert("rect",":first-child"),n=a.insert("line"),o=a.insert("g").attr("class","label"),c=e.labelText.flat?e.labelText.flat():e.labelText;let h="";h="object"==typeof c?c[0]:c,s.info("Label text abc79",h,c,"object"==typeof c);const g=o.node().appendChild(bt(h,e.labelStyle,!0,!0));let u={width:0,height:0};if(d(l().flowchart.htmlLabels)){const t=g.children[0],e=w(g);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}s.info("Text 2",c);const y=c.slice(1,c.length);let p=g.getBBox();const x=o.node().appendChild(bt(y.join?y.join("
"):y,e.labelStyle,!0,!0));if(d(l().flowchart.htmlLabels)){const t=x.children[0],e=w(x);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}const b=e.padding/2;return w(x).attr("transform","translate( "+(u.width>p.width?0:(p.width-u.width)/2)+", "+(p.height+b+5)+")"),w(g).attr("transform","translate( "+(u.width{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.height+e.padding,s=a.width+i/4+e.padding,n=r.insert("rect",":first-child").attr("style",e.style).attr("rx",i/2).attr("ry",i/2).attr("x",-s/2).attr("y",-i/2).attr("width",s).attr("height",i);return Ht(e,n),e.intersect=function(t){return Ft.rect(e,t)},r}),"stadium"),ue=r((async(t,e)=>{const{shapeSvg:r,bbox:a,halfPadding:i}=await jt(t,e,Zt(e,void 0),!0),n=r.insert("circle",":first-child");return n.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",a.width/2+i).attr("width",a.width+e.padding).attr("height",a.height+e.padding),s.info("Circle main"),Ht(e,n),e.intersect=function(t){return s.info("Circle intersect",e,a.width/2+i,t),Ft.circle(e,a.width/2+i,t)},r}),"circle"),ye=r((async(t,e)=>{const{shapeSvg:r,bbox:a,halfPadding:i}=await jt(t,e,Zt(e,void 0),!0),n=r.insert("g",":first-child"),o=n.insert("circle"),l=n.insert("circle");return n.attr("class",e.class),o.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",a.width/2+i+5).attr("width",a.width+e.padding+10).attr("height",a.height+e.padding+10),l.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",a.width/2+i).attr("width",a.width+e.padding).attr("height",a.height+e.padding),s.info("DoubleCircle main"),Ht(e,o),e.intersect=function(t){return s.info("DoubleCircle intersect",e,a.width/2+i+5,t),Ft.circle(e,a.width/2+i+5,t)},r}),"doublecircle"),pe=r((async(t,e)=>{const{shapeSvg:r,bbox:a}=await jt(t,e,Zt(e,void 0),!0),i=a.width+e.padding,s=a.height+e.padding,n=[{x:0,y:0},{x:i,y:0},{x:i,y:-s},{x:0,y:-s},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-s},{x:-8,y:-s},{x:-8,y:0}],o=Ut(r,i,s,n);return o.attr("style",e.style),Ht(e,o),e.intersect=function(t){return Ft.polygon(e,n,t)},r}),"subroutine"),xe=r(((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),a=r.insert("circle",":first-child");return a.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),Ht(e,a),e.intersect=function(t){return Ft.circle(e,7,t)},r}),"start"),be=r(((t,e,r)=>{const a=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let i=70,s=10;"LR"===r&&(i=10,s=70);const n=a.append("rect").attr("x",-1*i/2).attr("y",-1*s/2).attr("width",i).attr("height",s).attr("class","fork-join");return Ht(e,n),e.height=e.height+e.padding/2,e.width=e.width+e.padding/2,e.intersect=function(t){return Ft.rect(e,t)},a}),"forkJoin"),fe={rhombus:Gt,composite:le,question:Gt,rect:oe,labelRect:ce,rectWithTitle:he,choice:Jt,circle:ue,doublecircle:ye,stadium:ge,hexagon:Vt,block_arrow:Qt,rect_left_inv_arrow:te,lean_right:ee,lean_left:re,trapezoid:ae,inv_trapezoid:ie,rect_right_inv_arrow:se,cylinder:ne,start:xe,end:r(((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),a=r.insert("circle",":first-child"),i=r.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),a.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),Ht(e,i),e.intersect=function(t){return Ft.circle(e,7,t)},r}),"end"),note:Kt,subroutine:pe,fork:be,join:be,class_box:r(((t,e)=>{var r;const a=e.padding/2;let i;i=e.classes?"node "+e.classes:"node default";const s=t.insert("g").attr("class",i).attr("id",e.domId||e.id),n=s.insert("rect",":first-child"),o=s.insert("line"),c=s.insert("line");let h=0,g=4;const u=s.insert("g").attr("class","label");let y=0;const p=null==(r=e.classData.annotations)?void 0:r[0],x=e.classData.annotations[0]?"«"+e.classData.annotations[0]+"»":"",b=u.node().appendChild(bt(x,e.labelStyle,!0,!0));let f=b.getBBox();if(d(l().flowchart.htmlLabels)){const t=b.children[0],e=w(b);f=t.getBoundingClientRect(),e.attr("width",f.width),e.attr("height",f.height)}e.classData.annotations[0]&&(g+=f.height+4,h+=f.width);let m=e.classData.label;void 0!==e.classData.type&&""!==e.classData.type&&(l().flowchart.htmlLabels?m+="<"+e.classData.type+">":m+="<"+e.classData.type+">");const k=u.node().appendChild(bt(m,e.labelStyle,!0,!0));w(k).attr("class","classTitle");let L=k.getBBox();if(d(l().flowchart.htmlLabels)){const t=k.children[0],e=w(k);L=t.getBoundingClientRect(),e.attr("width",L.width),e.attr("height",L.height)}g+=L.height+4,L.width>h&&(h=L.width);const S=[];e.classData.members.forEach((t=>{const r=t.getDisplayDetails();let a=r.displayText;l().flowchart.htmlLabels&&(a=a.replace(//g,">"));const i=u.node().appendChild(bt(a,r.cssStyle?r.cssStyle:e.labelStyle,!0,!0));let s=i.getBBox();if(d(l().flowchart.htmlLabels)){const t=i.children[0],e=w(i);s=t.getBoundingClientRect(),e.attr("width",s.width),e.attr("height",s.height)}s.width>h&&(h=s.width),g+=s.height+4,S.push(i)})),g+=8;const _=[];if(e.classData.methods.forEach((t=>{const r=t.getDisplayDetails();let a=r.displayText;l().flowchart.htmlLabels&&(a=a.replace(//g,">"));const i=u.node().appendChild(bt(a,r.cssStyle?r.cssStyle:e.labelStyle,!0,!0));let s=i.getBBox();if(d(l().flowchart.htmlLabels)){const t=i.children[0],e=w(i);s=t.getBoundingClientRect(),e.attr("width",s.width),e.attr("height",s.height)}s.width>h&&(h=s.width),g+=s.height+4,_.push(i)})),g+=8,p){let t=(h-f.width)/2;w(b).attr("transform","translate( "+(-1*h/2+t)+", "+-1*g/2+")"),y=f.height+4}let v=(h-L.width)/2;return w(k).attr("transform","translate( "+(-1*h/2+v)+", "+(-1*g/2+y)+")"),y+=L.height+4,o.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-g/2-a+8+y).attr("y2",-g/2-a+8+y),y+=8,S.forEach((t=>{w(t).attr("transform","translate( "+-h/2+", "+(-1*g/2+y+4)+")");const e=null==t?void 0:t.getBBox();y+=((null==e?void 0:e.height)??0)+4})),y+=8,c.attr("class","divider").attr("x1",-h/2-a).attr("x2",h/2+a).attr("y1",-g/2-a+8+y).attr("y2",-g/2-a+8+y),y+=8,_.forEach((t=>{w(t).attr("transform","translate( "+-h/2+", "+(-1*g/2+y)+")");const e=null==t?void 0:t.getBBox();y+=((null==e?void 0:e.height)??0)+4})),n.attr("style",e.style).attr("class","outer title-state").attr("x",-h/2-a).attr("y",-g/2-a).attr("width",h+e.padding).attr("height",g+e.padding),Ht(e,n),e.intersect=function(t){return Ft.rect(e,t)},s}),"class_box")},me={},we=r((async(t,e,r)=>{let a,i;if(e.link){let s;"sandbox"===l().securityLevel?s="_top":e.linkTarget&&(s=e.linkTarget||"_blank"),a=t.insert("svg:a").attr("xlink:href",e.link).attr("target",s),i=await fe[e.shape](a,e,r)}else i=await fe[e.shape](t,e,r),a=i;return e.tooltip&&i.attr("title",e.tooltip),e.class&&i.attr("class","node default "+e.class),me[e.id]=a,e.haveCallback&&me[e.id].attr("class",me[e.id].attr("class")+" clickable"),a}),"insertNode"),ke=r((t=>{const e=me[t.id];s.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const r=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+r-t.width/2)+", "+(t.y-t.height/2-8)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),r}),"positionNode");function Le(t,e,r=!1){var i,s,n;const o=t;let l="default";((null==(i=null==o?void 0:o.classes)?void 0:i.length)||0)>0&&(l=((null==o?void 0:o.classes)??[]).join(" ")),l+=" flowchart-label";let c,d=0,h="";switch(o.type){case"round":d=5,h="rect";break;case"composite":d=0,h="composite",c=0;break;case"square":case"group":default:h="rect";break;case"diamond":h="question";break;case"hexagon":h="hexagon";break;case"block_arrow":h="block_arrow";break;case"odd":case"rect_left_inv_arrow":h="rect_left_inv_arrow";break;case"lean_right":h="lean_right";break;case"lean_left":h="lean_left";break;case"trapezoid":h="trapezoid";break;case"inv_trapezoid":h="inv_trapezoid";break;case"circle":h="circle";break;case"ellipse":h="ellipse";break;case"stadium":h="stadium";break;case"subroutine":h="subroutine";break;case"cylinder":h="cylinder";break;case"doublecircle":h="doublecircle"}const g=b((null==o?void 0:o.styles)??[]),u=o.label,y=o.size??{width:0,height:0,x:0,y:0};return{labelStyle:g.labelStyle,shape:h,labelText:u,rx:d,ry:d,class:l,style:g.style,id:o.id,directions:o.directions,width:y.width,height:y.height,x:y.x,y:y.y,positioned:r,intersect:void 0,type:o.type,padding:c??(null==(n=null==(s=a())?void 0:s.block)?void 0:n.padding)??0}}async function Se(t,e,r){const i=Le(e,0,!1);if("group"===i.type)return;const s=a(),n=await we(t,i,{config:s}),o=n.node().getBBox(),l=r.getBlock(i.id);l.size={width:o.width,height:o.height,x:0,y:0,node:n},r.setBlock(l),n.remove()}async function _e(t,e,r){const i=Le(e,0,!0);if("space"!==r.getBlock(i.id).type){const r=a();await we(t,i,{config:r}),e.intersect=null==i?void 0:i.intersect,ke(i)}}async function ve(t,e,r,a){for(const i of e)await a(t,i,r),i.children&&await ve(t,i.children,r,a)}async function Ee(t,e,r){await ve(t,e,r,Se)}async function De(t,e,r){await ve(t,e,r,_e)}async function $e(t,e,r,a,i){const s=new k({multigraph:!0,compound:!0});s.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const n of r)n.size&&s.setNode(n.id,{width:n.size.width,height:n.size.height,intersect:n.intersect});for(const n of e)if(n.start&&n.end){const e=a.getBlock(n.start),r=a.getBlock(n.end);if((null==e?void 0:e.size)&&(null==r?void 0:r.size)){const a=e.size,o=r.size,l=[{x:a.x,y:a.y},{x:a.x+(o.x-a.x)/2,y:a.y+(o.y-a.y)/2},{x:o.x,y:o.y}];Tt(t,{v:n.start,w:n.end,name:n.id},{...n,arrowTypeEnd:n.arrowTypeEnd,arrowTypeStart:n.arrowTypeStart,points:l,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",s,i),n.label&&(await St(t,{...n,label:n.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:n.arrowTypeEnd,arrowTypeStart:n.arrowTypeStart,points:l,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),vt({...n,x:l[1].x,y:l[1].y},{originalPath:l}))}}}r(Le,"getNodeFromBlock"),r(Se,"calculateBlockSize"),r(_e,"insertBlockPositioned"),r(ve,"performOperations"),r(Ee,"calculateBlockSizes"),r(De,"insertBlocks"),r($e,"insertEdges");var Te=r((function(t,e){return e.db.getClasses()}),"getClasses"),Ce={parser:E,db:rt,renderer:{draw:r((async function(t,e,r,n){const{securityLevel:o,block:l}=a(),c=n.db;let d;"sandbox"===o&&(d=w("#i"+e));const h=w("sandbox"===o?d.nodes()[0].contentDocument.body:"body"),g="sandbox"===o?h.select(`[id="${e}"]`):w(`[id="${e}"]`);ot(g,["point","circle","cross"],n.type,e);const u=c.getBlocks(),y=c.getBlocksFlat(),p=c.getEdges(),x=g.insert("g").attr("class","block");await Ee(x,u,c);const b=yt(c);if(await De(x,u,c),await $e(x,p,y,c,e),b){const t=b,e=Math.max(1,Math.round(t.width/t.height*.125)),r=t.height+e+10,a=t.width+10,{useMaxWidth:n}=l;i(g,r,a,!!n),s.debug("Here Bounds",b,t),g.attr("viewBox",`${t.x-5} ${t.y-5} ${t.width+10} ${t.height+10}`)}}),"draw"),getClasses:Te},styles:it};export{Ce as diagram}; diff --git a/docs/assets/brainfuck-CtZaYBKt.js b/docs/assets/brainfuck-CtZaYBKt.js deleted file mode 100644 index 6b1f74a..0000000 --- a/docs/assets/brainfuck-CtZaYBKt.js +++ /dev/null @@ -1 +0,0 @@ -var e="><+-.,[]".split("");const t={name:"brainfuck",startState:function(){return{commentLine:!1,left:0,right:0,commentLoop:!1}},token:function(t,n){if(t.eatSpace())return null;t.sol()&&(n.commentLine=!1);var o=t.next().toString();return-1===e.indexOf(o)?(n.commentLine=!0,t.eol()&&(n.commentLine=!1),"comment"):!0===n.commentLine?(t.eol()&&(n.commentLine=!1),"comment"):"]"===o||"["===o?("["===o?n.left++:n.right++,"bracket"):"+"===o||"-"===o?"keyword":"<"===o||">"===o?"atom":"."===o||","===o?"def":void(t.eol()&&(n.commentLine=!1))}};export{t as brainfuck}; diff --git a/docs/assets/c4Diagram-VJAJSXHY-BmgDitDm.js b/docs/assets/c4Diagram-VJAJSXHY-BmgDitDm.js deleted file mode 100644 index 8fe362d..0000000 --- a/docs/assets/c4Diagram-VJAJSXHY-BmgDitDm.js +++ /dev/null @@ -1 +0,0 @@ -var t,e;import{g as n,d as a}from"./chunk-D6G4REZN-dBJjcl8S.js";import{_ as i,s,g as r,a as l,b as o,c as h,l as d,d as u,e as p,f as y,h as f,i as g,w as b,j as _,k as m}from"./mermaid-BGnxfgCD.js";import{s as x}from"./transform-DjHZbYKP.js";import"./index-D3XtisvU.js";import"./step-BwsUM5iJ.js";import"./timer-DFzT7np-.js";var E=function(){var t=i((function(t,e,n,a){for(n=n||{},a=t.length;a--;n[t[a]]=e);return n}),"o"),e=[1,24],n=[1,25],a=[1,26],s=[1,27],r=[1,28],l=[1,63],o=[1,64],h=[1,65],d=[1,66],u=[1,67],p=[1,68],y=[1,69],f=[1,29],g=[1,30],b=[1,31],_=[1,32],m=[1,33],x=[1,34],E=[1,35],S=[1,36],A=[1,37],C=[1,38],w=[1,39],O=[1,40],k=[1,41],T=[1,42],v=[1,43],R=[1,44],D=[1,45],N=[1,46],P=[1,47],B=[1,48],j=[1,50],M=[1,51],I=[1,52],L=[1,53],Y=[1,54],U=[1,55],F=[1,56],X=[1,57],z=[1,58],W=[1,59],Q=[1,60],$=[14,42],H=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],q=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],V=[1,82],G=[1,83],K=[1,84],J=[1,85],Z=[12,14,42],tt=[12,14,33,42],et=[12,14,33,42,76,77,79,80],nt=[12,33],at=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],it={trace:i((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:i((function(t,e,n,a,i,s,r){var l=s.length-1;switch(i){case 3:a.setDirection("TB");break;case 4:a.setDirection("BT");break;case 5:a.setDirection("RL");break;case 6:a.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:a.setC4Type(s[l-3]);break;case 19:a.setTitle(s[l].substring(6)),this.$=s[l].substring(6);break;case 20:a.setAccDescription(s[l].substring(15)),this.$=s[l].substring(15);break;case 21:this.$=s[l].trim(),a.setTitle(this.$);break;case 22:case 23:this.$=s[l].trim(),a.setAccDescription(this.$);break;case 28:s[l].splice(2,0,"ENTERPRISE"),a.addPersonOrSystemBoundary(...s[l]),this.$=s[l];break;case 29:s[l].splice(2,0,"SYSTEM"),a.addPersonOrSystemBoundary(...s[l]),this.$=s[l];break;case 30:a.addPersonOrSystemBoundary(...s[l]),this.$=s[l];break;case 31:s[l].splice(2,0,"CONTAINER"),a.addContainerBoundary(...s[l]),this.$=s[l];break;case 32:a.addDeploymentNode("node",...s[l]),this.$=s[l];break;case 33:a.addDeploymentNode("nodeL",...s[l]),this.$=s[l];break;case 34:a.addDeploymentNode("nodeR",...s[l]),this.$=s[l];break;case 35:a.popBoundaryParseStack();break;case 39:a.addPersonOrSystem("person",...s[l]),this.$=s[l];break;case 40:a.addPersonOrSystem("external_person",...s[l]),this.$=s[l];break;case 41:a.addPersonOrSystem("system",...s[l]),this.$=s[l];break;case 42:a.addPersonOrSystem("system_db",...s[l]),this.$=s[l];break;case 43:a.addPersonOrSystem("system_queue",...s[l]),this.$=s[l];break;case 44:a.addPersonOrSystem("external_system",...s[l]),this.$=s[l];break;case 45:a.addPersonOrSystem("external_system_db",...s[l]),this.$=s[l];break;case 46:a.addPersonOrSystem("external_system_queue",...s[l]),this.$=s[l];break;case 47:a.addContainer("container",...s[l]),this.$=s[l];break;case 48:a.addContainer("container_db",...s[l]),this.$=s[l];break;case 49:a.addContainer("container_queue",...s[l]),this.$=s[l];break;case 50:a.addContainer("external_container",...s[l]),this.$=s[l];break;case 51:a.addContainer("external_container_db",...s[l]),this.$=s[l];break;case 52:a.addContainer("external_container_queue",...s[l]),this.$=s[l];break;case 53:a.addComponent("component",...s[l]),this.$=s[l];break;case 54:a.addComponent("component_db",...s[l]),this.$=s[l];break;case 55:a.addComponent("component_queue",...s[l]),this.$=s[l];break;case 56:a.addComponent("external_component",...s[l]),this.$=s[l];break;case 57:a.addComponent("external_component_db",...s[l]),this.$=s[l];break;case 58:a.addComponent("external_component_queue",...s[l]),this.$=s[l];break;case 60:a.addRel("rel",...s[l]),this.$=s[l];break;case 61:a.addRel("birel",...s[l]),this.$=s[l];break;case 62:a.addRel("rel_u",...s[l]),this.$=s[l];break;case 63:a.addRel("rel_d",...s[l]),this.$=s[l];break;case 64:a.addRel("rel_l",...s[l]),this.$=s[l];break;case 65:a.addRel("rel_r",...s[l]),this.$=s[l];break;case 66:a.addRel("rel_b",...s[l]),this.$=s[l];break;case 67:s[l].splice(0,1),a.addRel("rel",...s[l]),this.$=s[l];break;case 68:a.updateElStyle("update_el_style",...s[l]),this.$=s[l];break;case 69:a.updateRelStyle("update_rel_style",...s[l]),this.$=s[l];break;case 70:a.updateLayoutConfig("update_layout_config",...s[l]),this.$=s[l];break;case 71:this.$=[s[l]];break;case 72:s[l].unshift(s[l-1]),this.$=s[l];break;case 73:case 75:this.$=s[l].trim();break;case 74:let t={};t[s[l-1].trim()]=s[l].trim(),this.$=t;break;case 76:this.$=""}}),"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:n,24:a,26:s,28:r,29:49,30:61,32:62,34:l,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q},{13:70,19:20,20:21,21:22,22:e,23:n,24:a,26:s,28:r,29:49,30:61,32:62,34:l,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q},{13:71,19:20,20:21,21:22,22:e,23:n,24:a,26:s,28:r,29:49,30:61,32:62,34:l,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q},{13:72,19:20,20:21,21:22,22:e,23:n,24:a,26:s,28:r,29:49,30:61,32:62,34:l,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q},{13:73,19:20,20:21,21:22,22:e,23:n,24:a,26:s,28:r,29:49,30:61,32:62,34:l,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q},{14:[1,74]},t($,[2,13],{43:23,29:49,30:61,32:62,20:75,34:l,36:o,37:h,38:d,39:u,40:p,41:y,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q}),t($,[2,14]),t(H,[2,16],{12:[1,76]}),t($,[2,36],{12:[1,77]}),t(q,[2,19]),t(q,[2,20]),{25:[1,78]},{27:[1,79]},t(q,[2,23]),{35:80,75:81,76:V,77:G,79:K,80:J},{35:86,75:81,76:V,77:G,79:K,80:J},{35:87,75:81,76:V,77:G,79:K,80:J},{35:88,75:81,76:V,77:G,79:K,80:J},{35:89,75:81,76:V,77:G,79:K,80:J},{35:90,75:81,76:V,77:G,79:K,80:J},{35:91,75:81,76:V,77:G,79:K,80:J},{35:92,75:81,76:V,77:G,79:K,80:J},{35:93,75:81,76:V,77:G,79:K,80:J},{35:94,75:81,76:V,77:G,79:K,80:J},{35:95,75:81,76:V,77:G,79:K,80:J},{35:96,75:81,76:V,77:G,79:K,80:J},{35:97,75:81,76:V,77:G,79:K,80:J},{35:98,75:81,76:V,77:G,79:K,80:J},{35:99,75:81,76:V,77:G,79:K,80:J},{35:100,75:81,76:V,77:G,79:K,80:J},{35:101,75:81,76:V,77:G,79:K,80:J},{35:102,75:81,76:V,77:G,79:K,80:J},{35:103,75:81,76:V,77:G,79:K,80:J},{35:104,75:81,76:V,77:G,79:K,80:J},t(Z,[2,59]),{35:105,75:81,76:V,77:G,79:K,80:J},{35:106,75:81,76:V,77:G,79:K,80:J},{35:107,75:81,76:V,77:G,79:K,80:J},{35:108,75:81,76:V,77:G,79:K,80:J},{35:109,75:81,76:V,77:G,79:K,80:J},{35:110,75:81,76:V,77:G,79:K,80:J},{35:111,75:81,76:V,77:G,79:K,80:J},{35:112,75:81,76:V,77:G,79:K,80:J},{35:113,75:81,76:V,77:G,79:K,80:J},{35:114,75:81,76:V,77:G,79:K,80:J},{35:115,75:81,76:V,77:G,79:K,80:J},{20:116,29:49,30:61,32:62,34:l,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q},{12:[1,118],33:[1,117]},{35:119,75:81,76:V,77:G,79:K,80:J},{35:120,75:81,76:V,77:G,79:K,80:J},{35:121,75:81,76:V,77:G,79:K,80:J},{35:122,75:81,76:V,77:G,79:K,80:J},{35:123,75:81,76:V,77:G,79:K,80:J},{35:124,75:81,76:V,77:G,79:K,80:J},{35:125,75:81,76:V,77:G,79:K,80:J},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t($,[2,15]),t(H,[2,17],{21:22,19:130,22:e,23:n,24:a,26:s,28:r}),t($,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:n,24:a,26:s,28:r,34:l,36:o,37:h,38:d,39:u,40:p,41:y,44:f,45:g,46:b,47:_,48:m,49:x,50:E,51:S,52:A,53:C,54:w,55:O,56:k,57:T,58:v,59:R,60:D,61:N,62:P,63:B,64:j,65:M,66:I,67:L,68:Y,69:U,70:F,71:X,72:z,73:W,74:Q}),t(q,[2,21]),t(q,[2,22]),t(Z,[2,39]),t(tt,[2,71],{75:81,35:132,76:V,77:G,79:K,80:J}),t(et,[2,73]),{78:[1,133]},t(et,[2,75]),t(et,[2,76]),t(Z,[2,40]),t(Z,[2,41]),t(Z,[2,42]),t(Z,[2,43]),t(Z,[2,44]),t(Z,[2,45]),t(Z,[2,46]),t(Z,[2,47]),t(Z,[2,48]),t(Z,[2,49]),t(Z,[2,50]),t(Z,[2,51]),t(Z,[2,52]),t(Z,[2,53]),t(Z,[2,54]),t(Z,[2,55]),t(Z,[2,56]),t(Z,[2,57]),t(Z,[2,58]),t(Z,[2,60]),t(Z,[2,61]),t(Z,[2,62]),t(Z,[2,63]),t(Z,[2,64]),t(Z,[2,65]),t(Z,[2,66]),t(Z,[2,67]),t(Z,[2,68]),t(Z,[2,69]),t(Z,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(nt,[2,28]),t(nt,[2,29]),t(nt,[2,30]),t(nt,[2,31]),t(nt,[2,32]),t(nt,[2,33]),t(nt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(H,[2,18]),t($,[2,38]),t(tt,[2,72]),t(et,[2,74]),t(Z,[2,24]),t(Z,[2,35]),t(at,[2,25]),t(at,[2,26],{12:[1,138]}),t(at,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:i((function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)}),"parseError"),parse:i((function(t){var e=this,n=[0],a=[],s=[null],r=[],l=this.table,o="",c=0,h=0,d=r.slice.call(arguments,1),u=Object.create(this.lexer),p={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p.yy[y]=this.yy[y]);u.setInput(t,p.yy),p.yy.lexer=u,p.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;r.push(f);var g=u.options&&u.options.ranges;function b(){var t;return"number"!=typeof(t=a.pop()||u.lex()||1)&&(t instanceof Array&&(t=(a=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,i((function(t){n.length=n.length-2*t,s.length=s.length-t,r.length=r.length-t}),"popStack"),i(b,"lex");for(var _,m,x,E,S,A,C,w,O={};;){if(m=n[n.length-1],this.defaultActions[m]?x=this.defaultActions[m]:(null==_&&(_=b()),x=l[m]&&l[m][_]),void 0===x||!x.length||!x[0]){var k="";for(S in w=[],l[m])this.terminals_[S]&&S>2&&w.push("'"+this.terminals_[S]+"'");k=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==_?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(k,{text:u.match,token:this.terminals_[_]||_,line:u.yylineno,loc:f,expected:w})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+_);switch(x[0]){case 1:n.push(_),s.push(u.yytext),r.push(u.yylloc),n.push(x[1]),_=null,h=u.yyleng,o=u.yytext,c=u.yylineno,f=u.yylloc;break;case 2:if(A=this.productions_[x[1]][1],O.$=s[s.length-A],O._$={first_line:r[r.length-(A||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(A||1)].first_column,last_column:r[r.length-1].last_column},g&&(O._$.range=[r[r.length-(A||1)].range[0],r[r.length-1].range[1]]),void 0!==(E=this.performAction.apply(O,[o,h,c,p.yy,x[1],s,r].concat(d))))return E;A&&(n=n.slice(0,-1*A*2),s=s.slice(0,-1*A),r=r.slice(0,-1*A)),n.push(this.productions_[x[1]][0]),s.push(O.$),r.push(O._$),C=l[n[n.length-2]][n[n.length-1]],n.push(C);break;case 3:return!0}}return!0}),"parse")},st=function(){return{EOF:1,parseError:i((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:i((function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this}),"setInput"),input:i((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:i((function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===a.length?this.yylloc.first_column:0)+a[a.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:i((function(){return this._more=!0,this}),"more"),reject:i((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:i((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:i((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:i((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:i((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:i((function(t,e){var n,a,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(a=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var s in i)this[s]=i[s];return!1}return!1}),"test_match"),next:i((function(){if(this.done)return this.EOF;var t,e,n,a;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),s=0;se[0].length)){if(e=n,a=s,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[s])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[a]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:i((function(){var t=this.next();return t||this.lex()}),"lex"),begin:i((function(t){this.conditionStack.push(t)}),"begin"),popState:i((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:i((function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}),"_currentRules"),topState:i((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:i((function(t){this.begin(t)}),"pushState"),stateStackSize:i((function(){return this.conditionStack.length}),"stateStackSize"),options:{},performAction:i((function(t,e,n,a){switch(n){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),26;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 73:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:case 16:case 70:break;case 14:c;break;case 15:return 12;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;case 23:return this.begin("person"),44;case 24:return this.begin("system_ext_queue"),51;case 25:return this.begin("system_ext_db"),50;case 26:return this.begin("system_ext"),49;case 27:return this.begin("system_queue"),48;case 28:return this.begin("system_db"),47;case 29:return this.begin("system"),46;case 30:return this.begin("boundary"),37;case 31:return this.begin("enterprise_boundary"),34;case 32:return this.begin("system_boundary"),36;case 33:return this.begin("container_ext_queue"),57;case 34:return this.begin("container_ext_db"),56;case 35:return this.begin("container_ext"),55;case 36:return this.begin("container_queue"),54;case 37:return this.begin("container_db"),53;case 38:return this.begin("container"),52;case 39:return this.begin("container_boundary"),38;case 40:return this.begin("component_ext_queue"),63;case 41:return this.begin("component_ext_db"),62;case 42:return this.begin("component_ext"),61;case 43:return this.begin("component_queue"),60;case 44:return this.begin("component_db"),59;case 45:return this.begin("component"),58;case 46:case 47:return this.begin("node"),39;case 48:return this.begin("node_l"),40;case 49:return this.begin("node_r"),41;case 50:return this.begin("rel"),64;case 51:return this.begin("birel"),65;case 52:case 53:return this.begin("rel_u"),66;case 54:case 55:return this.begin("rel_d"),67;case 56:case 57:return this.begin("rel_l"),68;case 58:case 59:return this.begin("rel_r"),69;case 60:return this.begin("rel_b"),70;case 61:return this.begin("rel_index"),71;case 62:return this.begin("update_el_style"),72;case 63:return this.begin("update_rel_style"),73;case 64:return this.begin("update_layout_config"),74;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 67:this.begin("attribute");break;case 68:case 79:this.popState(),this.popState();break;case 69:case 71:return 80;case 72:this.begin("string");break;case 74:case 80:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}}),"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}}}();function rt(){this.yy={}}return it.lexer=st,i(rt,"Parser"),rt.prototype=it,it.Parser=rt,new rt}();E.parser=E;var S,A=E,C=[],w=[""],O="global",k="",T=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],v=[],R="",D=!1,N=4,P=2,B=i((function(){return S}),"getC4Type"),j=i((function(t){let e=f(t,h());S=e}),"setC4Type"),M=i((function(t,e,n,a,i,s,r,l,o){if(null==t||null==e||null==n||null==a)return;let c={};const h=v.find((t=>t.from===e&&t.to===n));if(h?c=h:v.push(c),c.type=t,c.from=e,c.to=n,c.label={text:a},null==i)c.techn={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];c[t]={text:e}}else c.techn={text:i};if(null==s)c.descr={text:""};else if("object"==typeof s){let[t,e]=Object.entries(s)[0];c[t]={text:e}}else c.descr={text:s};if("object"==typeof r){let[t,e]=Object.entries(r)[0];c[t]=e}else c.sprite=r;if("object"==typeof l){let[t,e]=Object.entries(l)[0];c[t]=e}else c.tags=l;if("object"==typeof o){let[t,e]=Object.entries(o)[0];c[t]=e}else c.link=o;c.wrap=st()}),"addRel"),I=i((function(t,e,n,a,i,s,r){if(null===e||null===n)return;let l={};const o=C.find((t=>t.alias===e));if(o&&e===o.alias?l=o:(l.alias=e,C.push(l)),l.label=null==n?{text:""}:{text:n},null==a)l.descr={text:""};else if("object"==typeof a){let[t,e]=Object.entries(a)[0];l[t]={text:e}}else l.descr={text:a};if("object"==typeof i){let[t,e]=Object.entries(i)[0];l[t]=e}else l.sprite=i;if("object"==typeof s){let[t,e]=Object.entries(s)[0];l[t]=e}else l.tags=s;if("object"==typeof r){let[t,e]=Object.entries(r)[0];l[t]=e}else l.link=r;l.typeC4Shape={text:t},l.parentBoundary=O,l.wrap=st()}),"addPersonOrSystem"),L=i((function(t,e,n,a,i,s,r,l){if(null===e||null===n)return;let o={};const c=C.find((t=>t.alias===e));if(c&&e===c.alias?o=c:(o.alias=e,C.push(o)),o.label=null==n?{text:""}:{text:n},null==a)o.techn={text:""};else if("object"==typeof a){let[t,e]=Object.entries(a)[0];o[t]={text:e}}else o.techn={text:a};if(null==i)o.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];o[t]={text:e}}else o.descr={text:i};if("object"==typeof s){let[t,e]=Object.entries(s)[0];o[t]=e}else o.sprite=s;if("object"==typeof r){let[t,e]=Object.entries(r)[0];o[t]=e}else o.tags=r;if("object"==typeof l){let[t,e]=Object.entries(l)[0];o[t]=e}else o.link=l;o.wrap=st(),o.typeC4Shape={text:t},o.parentBoundary=O}),"addContainer"),Y=i((function(t,e,n,a,i,s,r,l){if(null===e||null===n)return;let o={};const c=C.find((t=>t.alias===e));if(c&&e===c.alias?o=c:(o.alias=e,C.push(o)),o.label=null==n?{text:""}:{text:n},null==a)o.techn={text:""};else if("object"==typeof a){let[t,e]=Object.entries(a)[0];o[t]={text:e}}else o.techn={text:a};if(null==i)o.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];o[t]={text:e}}else o.descr={text:i};if("object"==typeof s){let[t,e]=Object.entries(s)[0];o[t]=e}else o.sprite=s;if("object"==typeof r){let[t,e]=Object.entries(r)[0];o[t]=e}else o.tags=r;if("object"==typeof l){let[t,e]=Object.entries(l)[0];o[t]=e}else o.link=l;o.wrap=st(),o.typeC4Shape={text:t},o.parentBoundary=O}),"addComponent"),U=i((function(t,e,n,a,i){if(null===t||null===e)return;let s={};const r=T.find((e=>e.alias===t));if(r&&t===r.alias?s=r:(s.alias=t,T.push(s)),s.label=null==e?{text:""}:{text:e},null==n)s.type={text:"system"};else if("object"==typeof n){let[t,e]=Object.entries(n)[0];s[t]={text:e}}else s.type={text:n};if("object"==typeof a){let[t,e]=Object.entries(a)[0];s[t]=e}else s.tags=a;if("object"==typeof i){let[t,e]=Object.entries(i)[0];s[t]=e}else s.link=i;s.parentBoundary=O,s.wrap=st(),k=O,O=t,w.push(k)}),"addPersonOrSystemBoundary"),F=i((function(t,e,n,a,i){if(null===t||null===e)return;let s={};const r=T.find((e=>e.alias===t));if(r&&t===r.alias?s=r:(s.alias=t,T.push(s)),s.label=null==e?{text:""}:{text:e},null==n)s.type={text:"container"};else if("object"==typeof n){let[t,e]=Object.entries(n)[0];s[t]={text:e}}else s.type={text:n};if("object"==typeof a){let[t,e]=Object.entries(a)[0];s[t]=e}else s.tags=a;if("object"==typeof i){let[t,e]=Object.entries(i)[0];s[t]=e}else s.link=i;s.parentBoundary=O,s.wrap=st(),k=O,O=t,w.push(k)}),"addContainerBoundary"),X=i((function(t,e,n,a,i,s,r,l){if(null===e||null===n)return;let o={};const c=T.find((t=>t.alias===e));if(c&&e===c.alias?o=c:(o.alias=e,T.push(o)),o.label=null==n?{text:""}:{text:n},null==a)o.type={text:"node"};else if("object"==typeof a){let[t,e]=Object.entries(a)[0];o[t]={text:e}}else o.type={text:a};if(null==i)o.descr={text:""};else if("object"==typeof i){let[t,e]=Object.entries(i)[0];o[t]={text:e}}else o.descr={text:i};if("object"==typeof r){let[t,e]=Object.entries(r)[0];o[t]=e}else o.tags=r;if("object"==typeof l){let[t,e]=Object.entries(l)[0];o[t]=e}else o.link=l;o.nodeType=t,o.parentBoundary=O,o.wrap=st(),k=O,O=e,w.push(k)}),"addDeploymentNode"),z=i((function(){O=k,w.pop(),k=w.pop(),w.push(k)}),"popBoundaryParseStack"),W=i((function(t,e,n,a,i,s,r,l,o,c,h){let d=C.find((t=>t.alias===e));if(void 0!==d||(d=T.find((t=>t.alias===e)),void 0!==d)){if(null!=n)if("object"==typeof n){let[t,e]=Object.entries(n)[0];d[t]=e}else d.bgColor=n;if(null!=a)if("object"==typeof a){let[t,e]=Object.entries(a)[0];d[t]=e}else d.fontColor=a;if(null!=i)if("object"==typeof i){let[t,e]=Object.entries(i)[0];d[t]=e}else d.borderColor=i;if(null!=s)if("object"==typeof s){let[t,e]=Object.entries(s)[0];d[t]=e}else d.shadowing=s;if(null!=r)if("object"==typeof r){let[t,e]=Object.entries(r)[0];d[t]=e}else d.shape=r;if(null!=l)if("object"==typeof l){let[t,e]=Object.entries(l)[0];d[t]=e}else d.sprite=l;if(null!=o)if("object"==typeof o){let[t,e]=Object.entries(o)[0];d[t]=e}else d.techn=o;if(null!=c)if("object"==typeof c){let[t,e]=Object.entries(c)[0];d[t]=e}else d.legendText=c;if(null!=h)if("object"==typeof h){let[t,e]=Object.entries(h)[0];d[t]=e}else d.legendSprite=h}}),"updateElStyle"),Q=i((function(t,e,n,a,i,s,r){const l=v.find((t=>t.from===e&&t.to===n));if(void 0!==l){if(null!=a)if("object"==typeof a){let[t,e]=Object.entries(a)[0];l[t]=e}else l.textColor=a;if(null!=i)if("object"==typeof i){let[t,e]=Object.entries(i)[0];l[t]=e}else l.lineColor=i;if(null!=s)if("object"==typeof s){let[t,e]=Object.entries(s)[0];l[t]=parseInt(e)}else l.offsetX=parseInt(s);if(null!=r)if("object"==typeof r){let[t,e]=Object.entries(r)[0];l[t]=parseInt(e)}else l.offsetY=parseInt(r)}}),"updateRelStyle"),$=i((function(t,e,n){let a=N,i=P;if("object"==typeof e){const t=Object.values(e)[0];a=parseInt(t)}else a=parseInt(e);if("object"==typeof n){const t=Object.values(n)[0];i=parseInt(t)}else i=parseInt(n);a>=1&&(N=a),i>=1&&(P=i)}),"updateLayoutConfig"),H=i((function(){return N}),"getC4ShapeInRow"),q=i((function(){return P}),"getC4BoundaryInRow"),V=i((function(){return O}),"getCurrentBoundaryParse"),G=i((function(){return k}),"getParentBoundaryParse"),K=i((function(t){return null==t?C:C.filter((e=>e.parentBoundary===t))}),"getC4ShapeArray"),J=i((function(t){return C.find((e=>e.alias===t))}),"getC4Shape"),Z=i((function(t){return Object.keys(K(t))}),"getC4ShapeKeys"),tt=i((function(t){return null==t?T:T.filter((e=>e.parentBoundary===t))}),"getBoundaries"),et=tt,nt=i((function(){return v}),"getRels"),at=i((function(){return R}),"getTitle"),it=i((function(t){D=t}),"setWrap"),st=i((function(){return D}),"autoWrap"),rt=i((function(){C=[],T=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],k="",O="global",w=[""],v=[],w=[""],R="",D=!1,N=4,P=2}),"clear"),lt=i((function(t){let e=f(t,h());R=e}),"setTitle"),ot={addPersonOrSystem:I,addPersonOrSystemBoundary:U,addContainer:L,addContainerBoundary:F,addComponent:Y,addDeploymentNode:X,popBoundaryParseStack:z,addRel:M,updateElStyle:W,updateRelStyle:Q,updateLayoutConfig:$,autoWrap:st,setWrap:it,getC4ShapeArray:K,getC4Shape:J,getC4ShapeKeys:Z,getBoundaries:tt,getBoundarys:et,getCurrentBoundaryParse:V,getParentBoundaryParse:G,getRels:nt,getTitle:at,getC4Type:B,getC4ShapeInRow:H,getC4BoundaryInRow:q,setAccTitle:o,getAccTitle:l,getAccDescription:r,setAccDescription:s,getConfig:i((()=>h().c4),"getConfig"),clear:rt,LINETYPE:{SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},setTitle:lt,setC4Type:j},ct=i((function(t,e){return a(t,e)}),"drawRect"),ht=i((function(t,e,n,a,i,s){const r=t.append("image");r.attr("width",e),r.attr("height",n),r.attr("x",a),r.attr("y",i);let l=s.startsWith("data:image/png;base64")?s:g.sanitizeUrl(s);r.attr("xlink:href",l)}),"drawImage"),dt=i(((t,e,n)=>{const a=t.append("g");let i=0;for(let s of e){let t=s.textColor?s.textColor:"#444444",e=s.lineColor?s.lineColor:"#444444",r=s.offsetX?parseInt(s.offsetX):0,l=s.offsetY?parseInt(s.offsetY):0,o="";if(0===i){let t=a.append("line");t.attr("x1",s.startPoint.x),t.attr("y1",s.startPoint.y),t.attr("x2",s.endPoint.x),t.attr("y2",s.endPoint.y),t.attr("stroke-width","1"),t.attr("stroke",e),t.style("fill","none"),"rel_b"!==s.type&&t.attr("marker-end","url("+o+"#arrowhead)"),"birel"!==s.type&&"rel_b"!==s.type||t.attr("marker-start","url("+o+"#arrowend)"),i=-1}else{let t=a.append("path");t.attr("fill","none").attr("stroke-width","1").attr("stroke",e).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",s.startPoint.x).replaceAll("starty",s.startPoint.y).replaceAll("controlx",s.startPoint.x+(s.endPoint.x-s.startPoint.x)/2-(s.endPoint.x-s.startPoint.x)/4).replaceAll("controly",s.startPoint.y+(s.endPoint.y-s.startPoint.y)/2).replaceAll("stopx",s.endPoint.x).replaceAll("stopy",s.endPoint.y)),"rel_b"!==s.type&&t.attr("marker-end","url("+o+"#arrowhead)"),"birel"!==s.type&&"rel_b"!==s.type||t.attr("marker-start","url("+o+"#arrowend)")}let c=n.messageFont();At(n)(s.label.text,a,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+r,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+l,s.label.width,s.label.height,{fill:t},c),s.techn&&""!==s.techn.text&&(c=n.messageFont(),At(n)("["+s.techn.text+"]",a,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+r,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+n.messageFontSize+5+l,Math.max(s.label.width,s.techn.width),s.techn.height,{fill:t,"font-style":"italic"},c))}}),"drawRels"),ut=i((function(t,e,n){const a=t.append("g");let i=e.bgColor?e.bgColor:"none",s=e.borderColor?e.borderColor:"#444444",r=e.fontColor?e.fontColor:"black",l={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};e.nodeType&&(l={"stroke-width":1});let o={x:e.x,y:e.y,fill:i,stroke:s,width:e.width,height:e.height,rx:2.5,ry:2.5,attrs:l};ct(a,o);let c=n.boundaryFont();c.fontWeight="bold",c.fontSize=c.fontSize+2,c.fontColor=r,At(n)(e.label.text,a,e.x,e.y+e.label.Y,e.width,e.height,{fill:"#444444"},c),e.type&&""!==e.type.text&&(c=n.boundaryFont(),c.fontColor=r,At(n)(e.type.text,a,e.x,e.y+e.type.Y,e.width,e.height,{fill:"#444444"},c)),e.descr&&""!==e.descr.text&&(c=n.boundaryFont(),c.fontSize=c.fontSize-2,c.fontColor=r,At(n)(e.descr.text,a,e.x,e.y+e.descr.Y,e.width,e.height,{fill:"#444444"},c))}),"drawBoundary"),pt=i((function(t,e,a){var i;let s=e.bgColor?e.bgColor:a[e.typeC4Shape.text+"_bg_color"],r=e.borderColor?e.borderColor:a[e.typeC4Shape.text+"_border_color"],l=e.fontColor?e.fontColor:"#FFFFFF",o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(e.typeC4Shape.text){case"person":o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII="}const c=t.append("g");c.attr("class","person-man");const h=n();switch(e.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":h.x=e.x,h.y=e.y,h.fill=s,h.width=e.width,h.height=e.height,h.stroke=r,h.rx=2.5,h.ry=2.5,h.attrs={"stroke-width":.5},ct(c,h);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":c.append("path").attr("fill",s).attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2).replaceAll("height",e.height)),c.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":c.append("path").attr("fill",s).attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("width",e.width).replaceAll("half",e.height/2)),c.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",r).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",e.x+e.width).replaceAll("starty",e.y).replaceAll("half",e.height/2))}let d=St(a,e.typeC4Shape.text);switch(c.append("text").attr("fill",l).attr("font-family",d.fontFamily).attr("font-size",d.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",e.typeC4Shape.width).attr("x",e.x+e.width/2-e.typeC4Shape.width/2).attr("y",e.y+e.typeC4Shape.Y).text("<<"+e.typeC4Shape.text+">>"),e.typeC4Shape.text){case"person":case"external_person":ht(c,48,48,e.x+e.width/2-24,e.y+e.image.Y,o)}let u=a[e.typeC4Shape.text+"Font"]();return u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=l,At(a)(e.label.text,c,e.x,e.y+e.label.Y,e.width,e.height,{fill:l},u),u=a[e.typeC4Shape.text+"Font"](),u.fontColor=l,e.techn&&""!==(null==(i=e.techn)?void 0:i.text)?At(a)(e.techn.text,c,e.x,e.y+e.techn.Y,e.width,e.height,{fill:l,"font-style":"italic"},u):e.type&&""!==e.type.text&&At(a)(e.type.text,c,e.x,e.y+e.type.Y,e.width,e.height,{fill:l,"font-style":"italic"},u),e.descr&&""!==e.descr.text&&(u=a.personFont(),u.fontColor=l,At(a)(e.descr.text,c,e.x,e.y+e.descr.Y,e.width,e.height,{fill:l},u)),e.height}),"drawC4Shape"),yt=i((function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")}),"insertDatabaseIcon"),ft=i((function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")}),"insertComputerIcon"),gt=i((function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")}),"insertClockIcon"),bt=i((function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")}),"insertArrowHead"),_t=i((function(t){t.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")}),"insertArrowEnd"),mt=i((function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")}),"insertArrowFilledHead"),xt=i((function(t){t.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)}),"insertDynamicNumber"),Et=i((function(t){const e=t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);e.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),e.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")}),"insertArrowCrossHead"),St=i(((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]})),"getC4ShapeFont"),At=function(){function t(t,e,n,i,s,r,l){a(e.append("text").attr("x",n+s/2).attr("y",i+r/2+5).style("text-anchor","middle").text(t),l)}function e(t,e,n,i,s,r,l,o){const{fontSize:c,fontFamily:h,fontWeight:d}=o,u=t.split(_.lineBreakRegex);for(let p=0;p=this.data.widthLimit||n>=this.data.widthLimit||this.nextData.cnt>kt)&&(e=this.nextData.startx+t.margin+vt.nextLinePaddingX,a=this.nextData.stopy+2*t.margin,this.nextData.stopx=n=e+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=i=a+t.height,this.nextData.cnt=1),t.x=e,t.y=a,this.updateVal(this.data,"startx",e,Math.min),this.updateVal(this.data,"starty",a,Math.min),this.updateVal(this.data,"stopx",n,Math.max),this.updateVal(this.data,"stopy",i,Math.max),this.updateVal(this.nextData,"startx",e,Math.min),this.updateVal(this.nextData,"starty",a,Math.min),this.updateVal(this.nextData,"stopx",n,Math.max),this.updateVal(this.nextData,"stopy",i,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},Dt(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}},"Bounds"),t),Dt=i((function(t){p(vt,t),t.fontFamily&&(vt.personFontFamily=vt.systemFontFamily=vt.messageFontFamily=t.fontFamily),t.fontSize&&(vt.personFontSize=vt.systemFontSize=vt.messageFontSize=t.fontSize),t.fontWeight&&(vt.personFontWeight=vt.systemFontWeight=vt.messageFontWeight=t.fontWeight)}),"setConf"),Nt=i(((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]})),"c4ShapeFont"),Pt=i((t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight})),"boundaryFont"),Bt=i((t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight})),"messageFont");function jt(t,e,n,a,i){if(!e[t].width)if(n)e[t].text=b(e[t].text,i,a),e[t].textLines=e[t].text.split(_.lineBreakRegex).length,e[t].width=i,e[t].height=m(e[t].text,a);else{let n=e[t].text.split(_.lineBreakRegex);e[t].textLines=n.length;let i=0;e[t].height=0,e[t].width=0;for(const s of n)e[t].width=Math.max(y(s,a),e[t].width),i=m(s,a),e[t].height=e[t].height+i}}i(jt,"calcC4ShapeTextWH");var Mt=i((function(t,e,n){e.x=n.data.startx,e.y=n.data.starty,e.width=n.data.stopx-n.data.startx,e.height=n.data.stopy-n.data.starty,e.label.y=vt.c4ShapeMargin-35;let a=e.wrap&&vt.wrap,i=Pt(vt);i.fontSize=i.fontSize+2,i.fontWeight="bold",jt("label",e,a,i,y(e.label.text,i)),Ct.drawBoundary(t,e,vt)}),"drawBoundary"),It=i((function(t,e,n,a){let i=0;for(const s of a){i=0;const a=n[s];let r=Nt(vt,a.typeC4Shape.text);switch(r.fontSize=r.fontSize-2,a.typeC4Shape.width=y("«"+a.typeC4Shape.text+"»",r),a.typeC4Shape.height=r.fontSize+2,a.typeC4Shape.Y=vt.c4ShapePadding,i=a.typeC4Shape.Y+a.typeC4Shape.height-4,a.image={width:0,height:0,Y:0},a.typeC4Shape.text){case"person":case"external_person":a.image.width=48,a.image.height=48,a.image.Y=i,i=a.image.Y+a.image.height}a.sprite&&(a.image.width=48,a.image.height=48,a.image.Y=i,i=a.image.Y+a.image.height);let l=a.wrap&&vt.wrap,o=vt.width-2*vt.c4ShapePadding,c=Nt(vt,a.typeC4Shape.text);if(c.fontSize=c.fontSize+2,c.fontWeight="bold",jt("label",a,l,c,o),a.label.Y=i+8,i=a.label.Y+a.label.height,a.type&&""!==a.type.text){a.type.text="["+a.type.text+"]",jt("type",a,l,Nt(vt,a.typeC4Shape.text),o),a.type.Y=i+5,i=a.type.Y+a.type.height}else if(a.techn&&""!==a.techn.text){a.techn.text="["+a.techn.text+"]",jt("techn",a,l,Nt(vt,a.techn.text),o),a.techn.Y=i+5,i=a.techn.Y+a.techn.height}let h=i,d=a.label.width;if(a.descr&&""!==a.descr.text){jt("descr",a,l,Nt(vt,a.typeC4Shape.text),o),a.descr.Y=i+20,i=a.descr.Y+a.descr.height,d=Math.max(a.label.width,a.descr.width),h=i-5*a.descr.textLines}d+=vt.c4ShapePadding,a.width=Math.max(a.width||vt.width,d,vt.width),a.height=Math.max(a.height||vt.height,h,vt.height),a.margin=a.margin||vt.c4ShapeMargin,t.insert(a),Ct.drawC4Shape(e,a,vt)}t.bumpLastMargin(vt.c4ShapeMargin)}),"drawC4ShapeArray"),Lt=(i(e=class{constructor(t,e){this.x=t,this.y=e}},"Point"),e),Yt=i((function(t,e){let n=t.x,a=t.y,i=e.x,s=e.y,r=n+t.width/2,l=a+t.height/2,o=Math.abs(n-i),c=Math.abs(a-s),h=c/o,d=t.height/t.width,u=null;return a==s&&ni?u=new Lt(n,l):n==i&&as&&(u=new Lt(r,a)),n>i&&a=h?new Lt(n,l+h*t.width/2):new Lt(r-o/c*t.height/2,a+t.height):n=h?new Lt(n+t.width,l+h*t.width/2):new Lt(r+o/c*t.height/2,a+t.height):ns?u=d>=h?new Lt(n+t.width,l-h*t.width/2):new Lt(r+t.height/2*o/c,a):n>i&&a>s&&(u=d>=h?new Lt(n,l-t.width/2*h):new Lt(r-t.height/2*o/c,a)),u}),"getIntersectPoint"),Ut=i((function(t,e){let n={x:0,y:0};n.x=e.x+e.width/2,n.y=e.y+e.height/2;let a=Yt(t,n);return n.x=t.x+t.width/2,n.y=t.y+t.height/2,{startPoint:a,endPoint:Yt(e,n)}}),"getIntersectPoints"),Ft=i((function(t,e,n,a){let i=0;for(let s of e){i+=1;let t=s.wrap&&vt.wrap,e=Bt(vt);"C4Dynamic"===a.db.getC4Type()&&(s.label.text=i+": "+s.label.text);let r=y(s.label.text,e);jt("label",s,t,e,r),s.techn&&""!==s.techn.text&&(r=y(s.techn.text,e),jt("techn",s,t,e,r)),s.descr&&""!==s.descr.text&&(r=y(s.descr.text,e),jt("descr",s,t,e,r));let l=n(s.from),o=n(s.to),c=Ut(l,o);s.startPoint=c.startPoint,s.endPoint=c.endPoint}Ct.drawRels(t,e,vt)}),"drawRels");function Xt(t,e,n,a,i){let s=new Rt(i);s.data.widthLimit=n.data.widthLimit/Math.min(Tt,a.length);for(let[r,l]of a.entries()){let a=0;l.image={width:0,height:0,Y:0},l.sprite&&(l.image.width=48,l.image.height=48,l.image.Y=a,a=l.image.Y+l.image.height);let o=l.wrap&&vt.wrap,c=Pt(vt);if(c.fontSize=c.fontSize+2,c.fontWeight="bold",jt("label",l,o,c,s.data.widthLimit),l.label.Y=a+8,a=l.label.Y+l.label.height,l.type&&""!==l.type.text){l.type.text="["+l.type.text+"]",jt("type",l,o,Pt(vt),s.data.widthLimit),l.type.Y=a+5,a=l.type.Y+l.type.height}if(l.descr&&""!==l.descr.text){let t=Pt(vt);t.fontSize=t.fontSize-2,jt("descr",l,o,t,s.data.widthLimit),l.descr.Y=a+20,a=l.descr.Y+l.descr.height}if(0==r||r%Tt==0){let t=n.data.startx+vt.diagramMarginX,e=n.data.stopy+vt.diagramMarginY+a;s.setData(t,t,e,e)}else{let t=s.data.stopx!==s.data.startx?s.data.stopx+vt.diagramMarginX:s.data.startx,e=s.data.starty;s.setData(t,t,e,e)}s.name=l.alias;let h=i.db.getC4ShapeArray(l.alias),d=i.db.getC4ShapeKeys(l.alias);d.length>0&&It(s,t,h,d),e=l.alias;let u=i.db.getBoundarys(e);u.length>0&&Xt(t,e,s,u,i),"global"!==l.alias&&Mt(t,l,s),n.data.stopy=Math.max(s.data.stopy+vt.c4ShapeMargin,n.data.stopy),n.data.stopx=Math.max(s.data.stopx+vt.c4ShapeMargin,n.data.stopx),wt=Math.max(wt,n.data.stopx),Ot=Math.max(Ot,n.data.stopy)}}i(Xt,"drawInsideBoundary");var zt={drawPersonOrSystemArray:It,drawBoundary:Mt,setConf:Dt,draw:i((function(t,e,n,a){vt=h().c4;const i=h().securityLevel;let s;"sandbox"===i&&(s=x("#i"+e));const r=x("sandbox"===i?s.nodes()[0].contentDocument.body:"body");let l=a.db;a.db.setWrap(vt.wrap),kt=l.getC4ShapeInRow(),Tt=l.getC4BoundaryInRow(),d.debug(`C:${JSON.stringify(vt,null,2)}`);const o="sandbox"===i?r.select(`[id="${e}"]`):x(`[id="${e}"]`);Ct.insertComputerIcon(o),Ct.insertDatabaseIcon(o),Ct.insertClockIcon(o);let c=new Rt(a);c.setData(vt.diagramMarginX,vt.diagramMarginX,vt.diagramMarginY,vt.diagramMarginY),c.data.widthLimit=screen.availWidth,wt=vt.diagramMarginX,Ot=vt.diagramMarginY;const p=a.db.getTitle();Xt(o,"",c,a.db.getBoundarys(""),a),Ct.insertArrowHead(o),Ct.insertArrowEnd(o),Ct.insertArrowCrossHead(o),Ct.insertArrowFilledHead(o),Ft(o,a.db.getRels(),a.db.getC4Shape,a),c.data.stopx=wt,c.data.stopy=Ot;const y=c.data;let f=y.stopy-y.starty+2*vt.diagramMarginY;const g=y.stopx-y.startx+2*vt.diagramMarginX;p&&o.append("text").text(p).attr("x",(y.stopx-y.startx)/2-4*vt.diagramMarginX).attr("y",y.starty+vt.diagramMarginY),u(o,f,g,vt.useMaxWidth);const b=p?60:0;o.attr("viewBox",y.startx-vt.diagramMarginX+" -"+(vt.diagramMarginY+b)+" "+g+" "+(f+b)),d.debug("models:",y)}),"draw")},Wt={parser:A,db:ot,renderer:zt,styles:i((t=>`.person {\n stroke: ${t.personBorder};\n fill: ${t.personBkg};\n }\n`),"getStyles"),init:i((({c4:t,wrap:e})=>{zt.setConf(t),ot.setWrap(e)}),"init")};export{Wt as diagram}; diff --git a/docs/assets/channel-DT3LjMlT.js b/docs/assets/channel-DT3LjMlT.js deleted file mode 100644 index de3cdfe..0000000 --- a/docs/assets/channel-DT3LjMlT.js +++ /dev/null @@ -1 +0,0 @@ -import{U as a,C as r}from"./mermaid-BGnxfgCD.js";const s=(s,o)=>a.lang.round(r.parse(s)[o]);export{s as c}; diff --git a/docs/assets/chunk-4BMEZGHF-juS1ELLA.js b/docs/assets/chunk-4BMEZGHF-juS1ELLA.js deleted file mode 100644 index 9b21879..0000000 --- a/docs/assets/chunk-4BMEZGHF-juS1ELLA.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as c}from"./mermaid-BGnxfgCD.js";function l(c,l){var t,e,a;c.accDescr&&(null==(t=l.setAccDescription)||t.call(l,c.accDescr)),c.accTitle&&(null==(e=l.setAccTitle)||e.call(l,c.accTitle)),c.title&&(null==(a=l.setDiagramTitle)||a.call(l,c.title))}c(l,"populateCommonDb");export{l as p}; diff --git a/docs/assets/chunk-A2AXSNBT-Co8Zfrpr.js b/docs/assets/chunk-A2AXSNBT-Co8Zfrpr.js deleted file mode 100644 index d6156ee..0000000 --- a/docs/assets/chunk-A2AXSNBT-Co8Zfrpr.js +++ /dev/null @@ -1 +0,0 @@ -var t,e;import{g as s,s as i}from"./chunk-RZ5BOZE2-gqSVpaRG.js";import{_ as n,l as a,c as r,o as u,r as l,u as o,b as c,a as h,s as p,g as d,p as A,q as y,j as C,y as m,x as g,h as b,Q as E}from"./mermaid-BGnxfgCD.js";import{s as T}from"./transform-DjHZbYKP.js";var f=function(){var t=n((function(t,e,s,i){for(s=s||{},i=t.length;i--;s[t[i]]=e);return s}),"o"),e=[1,18],s=[1,19],i=[1,20],a=[1,41],r=[1,42],u=[1,26],l=[1,24],o=[1,25],c=[1,32],h=[1,33],p=[1,34],d=[1,45],A=[1,35],y=[1,36],C=[1,37],m=[1,38],g=[1,27],b=[1,28],E=[1,29],T=[1,30],f=[1,31],k=[1,44],F=[1,46],D=[1,43],B=[1,47],_=[1,9],S=[1,8,9],N=[1,58],L=[1,59],$=[1,60],x=[1,61],I=[1,62],O=[1,63],v=[1,64],w=[1,8,9,41],R=[1,76],P=[1,8,9,12,13,22,39,41,44,66,67,68,69,70,71,72,77,79],M=[1,8,9,12,13,17,20,22,39,41,44,48,58,66,67,68,69,70,71,72,77,79,84,99,101,102],G=[13,58,84,99,101,102],U=[13,58,71,72,84,99,101,102],z=[13,58,66,67,68,69,70,84,99,101,102],K=[1,98],Y=[1,115],j=[1,107],W=[1,113],Q=[1,108],X=[1,109],q=[1,110],H=[1,111],V=[1,112],Z=[1,114],J=[22,58,59,80,84,85,86,87,88,89],tt=[1,8,9,39,41,44],et=[1,8,9,22],st=[1,143],it=[1,8,9,59],nt=[1,8,9,22,58,59,80,84,85,86,87,88,89],at={trace:n((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,DOT:17,className:18,classLiteralName:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,CLASS:46,ANNOTATION_START:47,ANNOTATION_END:48,MEMBER:49,SEPARATOR:50,relation:51,NOTE_FOR:52,noteText:53,NOTE:54,CLASSDEF:55,classList:56,stylesOpt:57,ALPHA:58,COMMA:59,direction_tb:60,direction_bt:61,direction_rl:62,direction_lr:63,relationType:64,lineType:65,AGGREGATION:66,EXTENSION:67,COMPOSITION:68,DEPENDENCY:69,LOLLIPOP:70,LINE:71,DOTTED_LINE:72,CALLBACK:73,LINK:74,LINK_TARGET:75,CLICK:76,CALLBACK_NAME:77,CALLBACK_ARGS:78,HREF:79,STYLE:80,CSSCLASS:81,style:82,styleComponent:83,NUM:84,COLON:85,UNIT:86,SPACE:87,BRKT:88,PCT:89,commentToken:90,textToken:91,graphCodeTokens:92,textNoTagsToken:93,TAGSTART:94,TAGEND:95,"==":96,"--":97,DEFAULT:98,MINUS:99,keywords:100,UNICODE_TEXT:101,BQUOTE_STR:102,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",17:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"CLASS",47:"ANNOTATION_START",48:"ANNOTATION_END",49:"MEMBER",50:"SEPARATOR",52:"NOTE_FOR",54:"NOTE",55:"CLASSDEF",58:"ALPHA",59:"COMMA",60:"direction_tb",61:"direction_bt",62:"direction_rl",63:"direction_lr",66:"AGGREGATION",67:"EXTENSION",68:"COMPOSITION",69:"DEPENDENCY",70:"LOLLIPOP",71:"LINE",72:"DOTTED_LINE",73:"CALLBACK",74:"LINK",75:"LINK_TARGET",76:"CLICK",77:"CALLBACK_NAME",78:"CALLBACK_ARGS",79:"HREF",80:"STYLE",81:"CSSCLASS",84:"NUM",85:"COLON",86:"UNIT",87:"SPACE",88:"BRKT",89:"PCT",92:"graphCodeTokens",94:"TAGSTART",95:"TAGEND",96:"==",97:"--",98:"DEFAULT",99:"MINUS",100:"keywords",101:"UNICODE_TEXT",102:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,3],[15,2],[18,1],[18,3],[18,1],[18,2],[18,2],[18,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,6],[43,2],[43,3],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[56,1],[56,3],[32,1],[32,1],[32,1],[32,1],[51,3],[51,2],[51,2],[51,1],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[57,1],[57,3],[82,1],[82,2],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[90,1],[90,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[93,1],[93,1],[93,1],[93,1],[16,1],[16,1],[16,1],[16,1],[19,1],[53,1]],performAction:n((function(t,e,s,i,n,a,r){var u=a.length-1;switch(n){case 8:this.$=a[u-1];break;case 9:case 12:case 14:this.$=a[u];break;case 10:case 13:this.$=a[u-2]+"."+a[u];break;case 11:case 15:case 95:this.$=a[u-1]+a[u];break;case 16:case 17:this.$=a[u-1]+"~"+a[u]+"~";break;case 18:i.addRelation(a[u]);break;case 19:a[u-1].title=i.cleanupLabel(a[u]),i.addRelation(a[u-1]);break;case 30:this.$=a[u].trim(),i.setAccTitle(this.$);break;case 31:case 32:this.$=a[u].trim(),i.setAccDescription(this.$);break;case 33:i.addClassesToNamespace(a[u-3],a[u-1]);break;case 34:i.addClassesToNamespace(a[u-4],a[u-1]);break;case 35:this.$=a[u],i.addNamespace(a[u]);break;case 36:case 46:case 59:case 92:this.$=[a[u]];break;case 37:this.$=[a[u-1]];break;case 38:a[u].unshift(a[u-2]),this.$=a[u];break;case 40:i.setCssClass(a[u-2],a[u]);break;case 41:i.addMembers(a[u-3],a[u-1]);break;case 42:i.setCssClass(a[u-5],a[u-3]),i.addMembers(a[u-5],a[u-1]);break;case 43:this.$=a[u],i.addClass(a[u]);break;case 44:this.$=a[u-1],i.addClass(a[u-1]),i.setClassLabel(a[u-1],a[u]);break;case 45:i.addAnnotation(a[u],a[u-2]);break;case 47:a[u].push(a[u-1]),this.$=a[u];break;case 48:case 50:case 51:break;case 49:i.addMember(a[u-1],i.cleanupLabel(a[u]));break;case 52:this.$={id1:a[u-2],id2:a[u],relation:a[u-1],relationTitle1:"none",relationTitle2:"none"};break;case 53:this.$={id1:a[u-3],id2:a[u],relation:a[u-1],relationTitle1:a[u-2],relationTitle2:"none"};break;case 54:this.$={id1:a[u-3],id2:a[u],relation:a[u-2],relationTitle1:"none",relationTitle2:a[u-1]};break;case 55:this.$={id1:a[u-4],id2:a[u],relation:a[u-2],relationTitle1:a[u-3],relationTitle2:a[u-1]};break;case 56:i.addNote(a[u],a[u-1]);break;case 57:i.addNote(a[u]);break;case 58:this.$=a[u-2],i.defineClass(a[u-1],a[u]);break;case 60:this.$=a[u-2].concat([a[u]]);break;case 61:i.setDirection("TB");break;case 62:i.setDirection("BT");break;case 63:i.setDirection("RL");break;case 64:i.setDirection("LR");break;case 65:this.$={type1:a[u-2],type2:a[u],lineType:a[u-1]};break;case 66:this.$={type1:"none",type2:a[u],lineType:a[u-1]};break;case 67:this.$={type1:a[u-1],type2:"none",lineType:a[u]};break;case 68:this.$={type1:"none",type2:"none",lineType:a[u]};break;case 69:this.$=i.relationType.AGGREGATION;break;case 70:this.$=i.relationType.EXTENSION;break;case 71:this.$=i.relationType.COMPOSITION;break;case 72:this.$=i.relationType.DEPENDENCY;break;case 73:this.$=i.relationType.LOLLIPOP;break;case 74:this.$=i.lineType.LINE;break;case 75:this.$=i.lineType.DOTTED_LINE;break;case 76:case 82:this.$=a[u-2],i.setClickEvent(a[u-1],a[u]);break;case 77:case 83:this.$=a[u-3],i.setClickEvent(a[u-2],a[u-1]),i.setTooltip(a[u-2],a[u]);break;case 78:this.$=a[u-2],i.setLink(a[u-1],a[u]);break;case 79:this.$=a[u-3],i.setLink(a[u-2],a[u-1],a[u]);break;case 80:this.$=a[u-3],i.setLink(a[u-2],a[u-1]),i.setTooltip(a[u-2],a[u]);break;case 81:this.$=a[u-4],i.setLink(a[u-3],a[u-2],a[u]),i.setTooltip(a[u-3],a[u-1]);break;case 84:this.$=a[u-3],i.setClickEvent(a[u-2],a[u-1],a[u]);break;case 85:this.$=a[u-4],i.setClickEvent(a[u-3],a[u-2],a[u-1]),i.setTooltip(a[u-3],a[u]);break;case 86:this.$=a[u-3],i.setLink(a[u-2],a[u]);break;case 87:this.$=a[u-4],i.setLink(a[u-3],a[u-1],a[u]);break;case 88:this.$=a[u-4],i.setLink(a[u-3],a[u-1]),i.setTooltip(a[u-3],a[u]);break;case 89:this.$=a[u-5],i.setLink(a[u-4],a[u-2],a[u]),i.setTooltip(a[u-4],a[u-1]);break;case 90:this.$=a[u-2],i.setCssStyle(a[u-1],a[u]);break;case 91:i.setCssClass(a[u-1],a[u]);break;case 93:a[u-2].push(a[u]),this.$=a[u-2]}}),"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:e,35:s,37:i,38:22,42:a,43:23,46:r,47:u,49:l,50:o,52:c,54:h,55:p,58:d,60:A,61:y,62:C,63:m,73:g,74:b,76:E,80:T,81:f,84:k,99:F,101:D,102:B},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},t(_,[2,5],{8:[1,48]}),{8:[1,49]},t(S,[2,18],{22:[1,50]}),t(S,[2,20]),t(S,[2,21]),t(S,[2,22]),t(S,[2,23]),t(S,[2,24]),t(S,[2,25]),t(S,[2,26]),t(S,[2,27]),t(S,[2,28]),t(S,[2,29]),{34:[1,51]},{36:[1,52]},t(S,[2,32]),t(S,[2,48],{51:53,64:56,65:57,13:[1,54],22:[1,55],66:N,67:L,68:$,69:x,70:I,71:O,72:v}),{39:[1,65]},t(w,[2,39],{39:[1,67],44:[1,66]}),t(S,[2,50]),t(S,[2,51]),{16:68,58:d,84:k,99:F,101:D},{16:39,18:69,19:40,58:d,84:k,99:F,101:D,102:B},{16:39,18:70,19:40,58:d,84:k,99:F,101:D,102:B},{16:39,18:71,19:40,58:d,84:k,99:F,101:D,102:B},{58:[1,72]},{13:[1,73]},{16:39,18:74,19:40,58:d,84:k,99:F,101:D,102:B},{13:R,53:75},{56:77,58:[1,78]},t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),t(S,[2,64]),t(P,[2,12],{16:39,19:40,18:80,17:[1,79],20:[1,81],58:d,84:k,99:F,101:D,102:B}),t(P,[2,14],{20:[1,82]}),{15:83,16:84,58:d,84:k,99:F,101:D},{16:39,18:85,19:40,58:d,84:k,99:F,101:D,102:B},t(M,[2,118]),t(M,[2,119]),t(M,[2,120]),t(M,[2,121]),t([1,8,9,12,13,20,22,39,41,44,66,67,68,69,70,71,72,77,79],[2,122]),t(_,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,18:21,38:22,43:23,16:39,19:40,5:86,33:e,35:s,37:i,42:a,46:r,47:u,49:l,50:o,52:c,54:h,55:p,58:d,60:A,61:y,62:C,63:m,73:g,74:b,76:E,80:T,81:f,84:k,99:F,101:D,102:B}),{5:87,10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:e,35:s,37:i,38:22,42:a,43:23,46:r,47:u,49:l,50:o,52:c,54:h,55:p,58:d,60:A,61:y,62:C,63:m,73:g,74:b,76:E,80:T,81:f,84:k,99:F,101:D,102:B},t(S,[2,19]),t(S,[2,30]),t(S,[2,31]),{13:[1,89],16:39,18:88,19:40,58:d,84:k,99:F,101:D,102:B},{51:90,64:56,65:57,66:N,67:L,68:$,69:x,70:I,71:O,72:v},t(S,[2,49]),{65:91,71:O,72:v},t(G,[2,68],{64:92,66:N,67:L,68:$,69:x,70:I}),t(U,[2,69]),t(U,[2,70]),t(U,[2,71]),t(U,[2,72]),t(U,[2,73]),t(z,[2,74]),t(z,[2,75]),{8:[1,94],24:95,40:93,43:23,46:r},{16:96,58:d,84:k,99:F,101:D},{45:97,49:K},{48:[1,99]},{13:[1,100]},{13:[1,101]},{77:[1,102],79:[1,103]},{22:Y,57:104,58:j,80:W,82:105,83:106,84:Q,85:X,86:q,87:H,88:V,89:Z},{58:[1,116]},{13:R,53:117},t(S,[2,57]),t(S,[2,123]),{22:Y,57:118,58:j,59:[1,119],80:W,82:105,83:106,84:Q,85:X,86:q,87:H,88:V,89:Z},t(J,[2,59]),{16:39,18:120,19:40,58:d,84:k,99:F,101:D,102:B},t(P,[2,15]),t(P,[2,16]),t(P,[2,17]),{39:[2,35]},{15:122,16:84,17:[1,121],39:[2,9],58:d,84:k,99:F,101:D},t(tt,[2,43],{11:123,12:[1,124]}),t(_,[2,7]),{9:[1,125]},t(et,[2,52]),{16:39,18:126,19:40,58:d,84:k,99:F,101:D,102:B},{13:[1,128],16:39,18:127,19:40,58:d,84:k,99:F,101:D,102:B},t(G,[2,67],{64:129,66:N,67:L,68:$,69:x,70:I}),t(G,[2,66]),{41:[1,130]},{24:95,40:131,43:23,46:r},{8:[1,132],41:[2,36]},t(w,[2,40],{39:[1,133]}),{41:[1,134]},{41:[2,46],45:135,49:K},{16:39,18:136,19:40,58:d,84:k,99:F,101:D,102:B},t(S,[2,76],{13:[1,137]}),t(S,[2,78],{13:[1,139],75:[1,138]}),t(S,[2,82],{13:[1,140],78:[1,141]}),{13:[1,142]},t(S,[2,90],{59:st}),t(it,[2,92],{83:144,22:Y,58:j,80:W,84:Q,85:X,86:q,87:H,88:V,89:Z}),t(nt,[2,94]),t(nt,[2,96]),t(nt,[2,97]),t(nt,[2,98]),t(nt,[2,99]),t(nt,[2,100]),t(nt,[2,101]),t(nt,[2,102]),t(nt,[2,103]),t(nt,[2,104]),t(S,[2,91]),t(S,[2,56]),t(S,[2,58],{59:st}),{58:[1,145]},t(P,[2,13]),{15:146,16:84,58:d,84:k,99:F,101:D},{39:[2,11]},t(tt,[2,44]),{13:[1,147]},{1:[2,4]},t(et,[2,54]),t(et,[2,53]),{16:39,18:148,19:40,58:d,84:k,99:F,101:D,102:B},t(G,[2,65]),t(S,[2,33]),{41:[1,149]},{24:95,40:150,41:[2,37],43:23,46:r},{45:151,49:K},t(w,[2,41]),{41:[2,47]},t(S,[2,45]),t(S,[2,77]),t(S,[2,79]),t(S,[2,80],{75:[1,152]}),t(S,[2,83]),t(S,[2,84],{13:[1,153]}),t(S,[2,86],{13:[1,155],75:[1,154]}),{22:Y,58:j,80:W,82:156,83:106,84:Q,85:X,86:q,87:H,88:V,89:Z},t(nt,[2,95]),t(J,[2,60]),{39:[2,10]},{14:[1,157]},t(et,[2,55]),t(S,[2,34]),{41:[2,38]},{41:[1,158]},t(S,[2,81]),t(S,[2,85]),t(S,[2,87]),t(S,[2,88],{75:[1,159]}),t(it,[2,93],{83:144,22:Y,58:j,80:W,84:Q,85:X,86:q,87:H,88:V,89:Z}),t(tt,[2,8]),t(w,[2,42]),t(S,[2,89])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],83:[2,35],122:[2,11],125:[2,4],135:[2,47],146:[2,10],150:[2,38]},parseError:n((function(t,e){if(!e.recoverable){var s=new Error(t);throw s.hash=e,s}this.trace(t)}),"parseError"),parse:n((function(t){var e=this,s=[0],i=[],a=[null],r=[],u=this.table,l="",o=0,c=0,h=r.slice.call(arguments,1),p=Object.create(this.lexer),d={yy:{}};for(var A in this.yy)Object.prototype.hasOwnProperty.call(this.yy,A)&&(d.yy[A]=this.yy[A]);p.setInput(t,d.yy),d.yy.lexer=p,d.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var y=p.yylloc;r.push(y);var C=p.options&&p.options.ranges;function m(){var t;return"number"!=typeof(t=i.pop()||p.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,n((function(t){s.length=s.length-2*t,a.length=a.length-t,r.length=r.length-t}),"popStack"),n(m,"lex");for(var g,b,E,T,f,k,F,D,B={};;){if(b=s[s.length-1],this.defaultActions[b]?E=this.defaultActions[b]:(null==g&&(g=m()),E=u[b]&&u[b][g]),void 0===E||!E.length||!E[0]){var _="";for(f in D=[],u[b])this.terminals_[f]&&f>2&&D.push("'"+this.terminals_[f]+"'");_=p.showPosition?"Parse error on line "+(o+1)+":\n"+p.showPosition()+"\nExpecting "+D.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(_,{text:p.match,token:this.terminals_[g]||g,line:p.yylineno,loc:y,expected:D})}if(E[0]instanceof Array&&E.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(E[0]){case 1:s.push(g),a.push(p.yytext),r.push(p.yylloc),s.push(E[1]),g=null,c=p.yyleng,l=p.yytext,o=p.yylineno,y=p.yylloc;break;case 2:if(k=this.productions_[E[1]][1],B.$=a[a.length-k],B._$={first_line:r[r.length-(k||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(k||1)].first_column,last_column:r[r.length-1].last_column},C&&(B._$.range=[r[r.length-(k||1)].range[0],r[r.length-1].range[1]]),void 0!==(T=this.performAction.apply(B,[l,c,o,d.yy,E[1],a,r].concat(h))))return T;k&&(s=s.slice(0,-1*k*2),a=a.slice(0,-1*k),r=r.slice(0,-1*k)),s.push(this.productions_[E[1]][0]),a.push(B.$),r.push(B._$),F=u[s[s.length-2]][s[s.length-1]],s.push(F);break;case 3:return!0}}return!0}),"parse")},rt=function(){return{EOF:1,parseError:n((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:n((function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this}),"setInput"),input:n((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:n((function(t){var e=t.length,s=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),s.length-1&&(this.yylineno-=s.length-1);var n=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:s?(s.length===i.length?this.yylloc.first_column:0)+i[i.length-s.length].length-s[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:n((function(){return this._more=!0,this}),"more"),reject:n((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:n((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:n((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:n((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:n((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:n((function(t,e){var s,i,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],s=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var a in n)this[a]=n[a];return!1}return!1}),"test_match"),next:n((function(){if(this.done)return this.EOF;var t,e,s,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),a=0;ae[0].length)){if(e=s,i=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(s,n[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:n((function(){var t=this.next();return t||this.lex()}),"lex"),begin:n((function(t){this.conditionStack.push(t)}),"begin"),popState:n((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:n((function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}),"_currentRules"),topState:n((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:n((function(t){this.begin(t)}),"pushState"),stateStackSize:n((function(){return this.conditionStack.length}),"stateStackSize"),options:{},performAction:n((function(t,e,s,i){switch(s){case 0:return 60;case 1:return 61;case 2:return 62;case 3:return 63;case 4:case 5:case 14:case 31:case 36:case 40:case 47:break;case 6:return this.begin("acc_title"),33;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),35;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 19:case 22:case 24:case 58:case 61:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:case 35:return 8;case 15:case 16:return 7;case 17:case 37:case 45:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 77;case 23:return 78;case 25:return"STR";case 26:this.begin("string");break;case 27:return 80;case 28:return 55;case 29:return this.begin("namespace"),42;case 30:case 39:return this.popState(),8;case 32:return this.begin("namespace-body"),39;case 33:case 43:return this.popState(),41;case 34:case 44:return"EOF_IN_STRUCT";case 38:return this.begin("class"),46;case 41:return this.popState(),this.popState(),41;case 42:return this.begin("class-body"),39;case 46:return"OPEN_IN_STRUCT";case 48:return"MEMBER";case 49:return 81;case 50:return 73;case 51:return 74;case 52:return 76;case 53:return 52;case 54:return 54;case 55:return 47;case 56:return 48;case 57:return 79;case 59:return"GENERICTYPE";case 60:this.begin("generic");break;case 62:return"BQUOTE_STR";case 63:this.begin("bqstring");break;case 64:case 65:case 66:case 67:return 75;case 68:case 69:return 67;case 70:case 71:return 69;case 72:return 68;case 73:return 66;case 74:return 70;case 75:return 71;case 76:return 72;case 77:return 22;case 78:return 44;case 79:return 99;case 80:return 17;case 81:return"PLUS";case 82:return 85;case 83:return 59;case 84:case 85:return 88;case 86:return 89;case 87:case 88:return"EQUALS";case 89:return 58;case 90:return 12;case 91:return 14;case 92:return"PUNCTUATION";case 93:return 84;case 94:return 101;case 95:case 96:return 87;case 97:return 9}}),"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,33,34,35,36,37,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},namespace:{rules:[26,29,30,31,32,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},"class-body":{rules:[26,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},class:{rules:[26,39,40,41,42,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr:{rules:[9,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_title:{rules:[7,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_args:{rules:[22,23,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_name:{rules:[19,20,21,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},href:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},struct:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},generic:{rules:[26,49,50,51,52,53,54,55,56,57,58,59,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},bqstring:{rules:[26,49,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},string:{rules:[24,25,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],inclusive:!0}}}}();function ut(){this.yy={}}return at.lexer=rt,n(ut,"Parser"),ut.prototype=at,at.Parser=ut,new ut}();f.parser=f;var k=f,F=["#","+","~","-",""],D=(n(t=class{constructor(t,e){this.memberType=e,this.visibility="",this.classifier="",this.text="";const s=b(t,r());this.parseMember(s)}getDisplayDetails(){let t=this.visibility+E(this.id);"method"===this.memberType&&(t+=`(${E(this.parameters.trim())})`,this.returnType&&(t+=" : "+E(this.returnType))),t=t.trim();return{displayText:t,cssStyle:this.parseClassifier()}}parseMember(t){let e="";if("method"===this.memberType){const s=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(t);if(s){const t=s[1]?s[1].trim():"";if(F.includes(t)&&(this.visibility=t),this.id=s[2],this.parameters=s[3]?s[3].trim():"",e=s[4]?s[4].trim():"",this.returnType=s[5]?s[5].trim():"",""===e){const t=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(t)&&(e=t,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{const s=t.length,i=t.substring(0,1),n=t.substring(s-1);F.includes(i)&&(this.visibility=i),/[$*]/.exec(n)&&(e=n),this.id=t.substring(""===this.visibility?0:1,""===e?s:s-1)}this.classifier=e,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();const s=`${this.visibility?"\\"+this.visibility:""}${E(this.id)}${"method"===this.memberType?`(${E(this.parameters)})${this.returnType?" : "+E(this.returnType):""}`:""}`;this.text=s.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},"ClassMember"),t),B="classId-",_=0,S=n((t=>C.sanitizeText(t,r())),"sanitizeText"),N=(n(e=class{constructor(){this.relations=[],this.classes=new Map,this.styleClasses=new Map,this.notes=[],this.interfaces=[],this.namespaces=new Map,this.namespaceCounter=0,this.functions=[],this.lineType={LINE:0,DOTTED_LINE:1},this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},this.setupToolTips=n((t=>{let e=T(".mermaidTooltip");null===(e._groups||e)[0][0]&&(e=T("body").append("div").attr("class","mermaidTooltip").style("opacity",0));T(t).select("svg").selectAll("g.node").on("mouseover",(t=>{const s=T(t.currentTarget);if(null===s.attr("title"))return;const i=this.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.text(s.attr("title")).style("left",window.scrollX+i.left+(i.right-i.left)/2+"px").style("top",window.scrollY+i.top-14+document.body.scrollTop+"px"),e.html(e.html().replace(/<br\/>/g,"
")),s.classed("hover",!0)})).on("mouseout",(t=>{e.transition().duration(500).style("opacity",0);T(t.currentTarget).classed("hover",!1)}))}),"setupToolTips"),this.direction="TB",this.setAccTitle=c,this.getAccTitle=h,this.setAccDescription=p,this.getAccDescription=d,this.setDiagramTitle=A,this.getDiagramTitle=y,this.getConfig=n((()=>r().class),"getConfig"),this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}splitClassNameAndType(t){const e=C.sanitizeText(t,r());let s="",i=e;if(e.indexOf("~")>0){const t=e.split("~");i=S(t[0]),s=S(t[1])}return{className:i,type:s}}setClassLabel(t,e){const s=C.sanitizeText(t,r());e&&(e=S(e));const{className:i}=this.splitClassNameAndType(s);this.classes.get(i).label=e,this.classes.get(i).text=`${e}${this.classes.get(i).type?`<${this.classes.get(i).type}>`:""}`}addClass(t){const e=C.sanitizeText(t,r()),{className:s,type:i}=this.splitClassNameAndType(e);if(this.classes.has(s))return;const n=C.sanitizeText(s,r());this.classes.set(n,{id:n,type:i,label:n,text:`${n}${i?`<${i}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:B+n+"-"+_}),_++}addInterface(t,e){const s={id:`interface${this.interfaces.length}`,label:t,classId:e};this.interfaces.push(s)}lookUpDomId(t){const e=C.sanitizeText(t,r());if(this.classes.has(e))return this.classes.get(e).domId;throw new Error("Class not found: "+e)}clear(){this.relations=[],this.classes=new Map,this.notes=[],this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.direction="TB",m()}getClass(t){return this.classes.get(t)}getClasses(){return this.classes}getRelations(){return this.relations}getNotes(){return this.notes}addRelation(t){a.debug("Adding relation: "+JSON.stringify(t));const e=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];t.relation.type1!==this.relationType.LOLLIPOP||e.includes(t.relation.type2)?t.relation.type2!==this.relationType.LOLLIPOP||e.includes(t.relation.type1)?(this.addClass(t.id1),this.addClass(t.id2)):(this.addClass(t.id1),this.addInterface(t.id2,t.id1),t.id2="interface"+(this.interfaces.length-1)):(this.addClass(t.id2),this.addInterface(t.id1,t.id2),t.id1="interface"+(this.interfaces.length-1)),t.id1=this.splitClassNameAndType(t.id1).className,t.id2=this.splitClassNameAndType(t.id2).className,t.relationTitle1=C.sanitizeText(t.relationTitle1.trim(),r()),t.relationTitle2=C.sanitizeText(t.relationTitle2.trim(),r()),this.relations.push(t)}addAnnotation(t,e){const s=this.splitClassNameAndType(t).className;this.classes.get(s).annotations.push(e)}addMember(t,e){this.addClass(t);const s=this.splitClassNameAndType(t).className,i=this.classes.get(s);if("string"==typeof e){const t=e.trim();t.startsWith("<<")&&t.endsWith(">>")?i.annotations.push(S(t.substring(2,t.length-2))):t.indexOf(")")>0?i.methods.push(new D(t,"method")):t&&i.members.push(new D(t,"attribute"))}}addMembers(t,e){Array.isArray(e)&&(e.reverse(),e.forEach((e=>this.addMember(t,e))))}addNote(t,e){const s={id:`note${this.notes.length}`,class:e,text:t};this.notes.push(s)}cleanupLabel(t){return t.startsWith(":")&&(t=t.substring(1)),S(t.trim())}setCssClass(t,e){t.split(",").forEach((t=>{let s=t;/\d/.exec(t[0])&&(s=B+s);const i=this.classes.get(s);i&&(i.cssClasses+=" "+e)}))}defineClass(t,e){for(const s of t){let t=this.styleClasses.get(s);void 0===t&&(t={id:s,styles:[],textStyles:[]},this.styleClasses.set(s,t)),e&&e.forEach((e=>{if(/color/.exec(e)){const s=e.replace("fill","bgFill");t.textStyles.push(s)}t.styles.push(e)})),this.classes.forEach((t=>{t.cssClasses.includes(s)&&t.styles.push(...e.flatMap((t=>t.split(","))))}))}}setTooltip(t,e){t.split(",").forEach((t=>{void 0!==e&&(this.classes.get(t).tooltip=S(e))}))}getTooltip(t,e){return e&&this.namespaces.has(e)?this.namespaces.get(e).classes.get(t).tooltip:this.classes.get(t).tooltip}setLink(t,e,s){const i=r();t.split(",").forEach((t=>{let n=t;/\d/.exec(t[0])&&(n=B+n);const a=this.classes.get(n);a&&(a.link=o.formatUrl(e,i),"sandbox"===i.securityLevel?a.linkTarget="_top":a.linkTarget="string"==typeof s?S(s):"_blank")})),this.setCssClass(t,"clickable")}setClickEvent(t,e,s){t.split(",").forEach((t=>{this.setClickFunc(t,e,s),this.classes.get(t).haveCallback=!0})),this.setCssClass(t,"clickable")}setClickFunc(t,e,s){const i=C.sanitizeText(t,r());if("loose"!==r().securityLevel)return;if(void 0===e)return;const n=i;if(this.classes.has(n)){const t=this.lookUpDomId(n);let i=[];if("string"==typeof s){i=s.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let t=0;t{const s=document.querySelector(`[id="${t}"]`);null!==s&&s.addEventListener("click",(()=>{o.runFunc(e,...i)}),!1)}))}}bindFunctions(t){this.functions.forEach((e=>{e(t)}))}getDirection(){return this.direction}setDirection(t){this.direction=t}addNamespace(t){this.namespaces.has(t)||(this.namespaces.set(t,{id:t,classes:new Map,children:{},domId:B+t+"-"+this.namespaceCounter}),this.namespaceCounter++)}getNamespace(t){return this.namespaces.get(t)}getNamespaces(){return this.namespaces}addClassesToNamespace(t,e){if(this.namespaces.has(t))for(const s of e){const{className:e}=this.splitClassNameAndType(s);this.classes.get(e).parent=t,this.namespaces.get(t).classes.set(e,this.classes.get(e))}}setCssStyle(t,e){const s=this.classes.get(t);if(e&&s)for(const i of e)i.includes(",")?s.styles.push(...i.split(",")):s.styles.push(i)}getArrowMarker(t){let e;switch(t){case 0:e="aggregation";break;case 1:e="extension";break;case 2:e="composition";break;case 3:e="dependency";break;case 4:e="lollipop";break;default:e="none"}return e}getData(){var t;const e=[],s=[],i=r();for(const a of this.namespaces.keys()){const t=this.namespaces.get(a);if(t){const s={id:t.id,label:t.id,isGroup:!0,padding:i.class.padding??16,shape:"rect",cssStyles:["fill: none","stroke: black"],look:i.look};e.push(s)}}for(const a of this.classes.keys()){const t=this.classes.get(a);if(t){const s=t;s.parentId=t.parent,s.look=i.look,e.push(s)}}let n=0;for(const a of this.notes){n++;const r={id:a.id,label:a.text,isGroup:!1,shape:"note",padding:i.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${i.themeVariables.noteBkgColor}`,`stroke: ${i.themeVariables.noteBorderColor}`],look:i.look};e.push(r);const u=(null==(t=this.classes.get(a.class))?void 0:t.id)??"";if(u){const t={id:`edgeNote${n}`,start:a.id,end:u,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:i.look};s.push(t)}}for(const a of this.interfaces){const t={id:a.id,label:a.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:i.look};e.push(t)}n=0;for(const a of this.relations){n++;const t={id:g(a.id1,a.id2,{prefix:"id",counter:n}),start:a.id1,end:a.id2,type:"normal",label:a.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(a.relation.type1),arrowTypeEnd:this.getArrowMarker(a.relation.type2),startLabelRight:"none"===a.relationTitle1?"":a.relationTitle1,endLabelLeft:"none"===a.relationTitle2?"":a.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:a.style||"",pattern:1==a.relation.lineType?"dashed":"solid",look:i.look};s.push(t)}return{nodes:e,edges:s,other:{},config:i,direction:this.getDirection()}}},"ClassDB"),e),L=n((t=>`g.classGroup text {\n fill: ${t.nodeBorder||t.classText};\n stroke: none;\n font-family: ${t.fontFamily};\n font-size: 10px;\n\n .title {\n font-weight: bolder;\n }\n\n}\n\n.nodeLabel, .edgeLabel {\n color: ${t.classText};\n}\n.edgeLabel .label rect {\n fill: ${t.mainBkg};\n}\n.label text {\n fill: ${t.classText};\n}\n\n.labelBkg {\n background: ${t.mainBkg};\n}\n.edgeLabel .label span {\n background: ${t.mainBkg};\n}\n\n.classTitle {\n font-weight: bolder;\n}\n.node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n\n\n.divider {\n stroke: ${t.nodeBorder};\n stroke-width: 1;\n}\n\ng.clickable {\n cursor: pointer;\n}\n\ng.classGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.classGroup line {\n stroke: ${t.nodeBorder};\n stroke-width: 1;\n}\n\n.classLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.classLabel .label {\n fill: ${t.nodeBorder};\n font-size: 10px;\n}\n\n.relation {\n stroke: ${t.lineColor};\n stroke-width: 1;\n fill: none;\n}\n\n.dashed-line{\n stroke-dasharray: 3;\n}\n\n.dotted-line{\n stroke-dasharray: 1 2;\n}\n\n#compositionStart, .composition {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#compositionEnd, .composition {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ${t.lineColor} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#extensionStart, .extension {\n fill: transparent !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#extensionEnd, .extension {\n fill: transparent !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#aggregationStart, .aggregation {\n fill: transparent !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#aggregationEnd, .aggregation {\n fill: transparent !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#lollipopStart, .lollipop {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n#lollipopEnd, .lollipop {\n fill: ${t.mainBkg} !important;\n stroke: ${t.lineColor} !important;\n stroke-width: 1;\n}\n\n.edgeTerminals {\n font-size: 11px;\n line-height: initial;\n}\n\n.classTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n`),"getStyles"),$=n(((t,e="TB")=>{if(!t.doc)return e;let s=e;for(const i of t.doc)"dir"===i.stmt&&(s=i.value);return s}),"getDir"),x={getClasses:n((function(t,e){return e.db.getClasses()}),"getClasses"),draw:n((async function(t,e,n,c){a.info("REF0:"),a.info("Drawing class diagram (v3)",e);const{securityLevel:h,state:p,layout:d}=r(),A=c.db.getData(),y=s(e,h);A.type=c.type,A.layoutAlgorithm=u(d),A.nodeSpacing=(null==p?void 0:p.nodeSpacing)||50,A.rankSpacing=(null==p?void 0:p.rankSpacing)||50,A.markers=["aggregation","extension","composition","dependency","lollipop"],A.diagramId=e,await l(A,y);o.insertTitle(y,"classDiagramTitleText",(null==p?void 0:p.titleTopMargin)??25,c.db.getDiagramTitle()),i(y,8,"classDiagram",(null==p?void 0:p.useMaxWidth)??!0)}),"draw"),getDir:$};export{N as C,k as a,x as c,L as s}; diff --git a/docs/assets/chunk-AEK57VVT-Y72Hn9sV.js b/docs/assets/chunk-AEK57VVT-Y72Hn9sV.js deleted file mode 100644 index 32a0e0d..0000000 --- a/docs/assets/chunk-AEK57VVT-Y72Hn9sV.js +++ /dev/null @@ -1 +0,0 @@ -var t,e=Object.defineProperty,s=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);import{g as i,s as n}from"./chunk-RZ5BOZE2-gqSVpaRG.js";import{_ as r,l as o,c as a,r as l,u as c,R as h,j as d,y as u,a as p,b as y,g,s as m,p as f,q as S}from"./mermaid-BGnxfgCD.js";var _=function(){var t=r((function(t,e,s,i){for(s=s||{},i=t.length;i--;s[t[i]]=e);return s}),"o"),e=[1,2],s=[1,3],i=[1,4],n=[2,4],o=[1,9],a=[1,11],l=[1,16],c=[1,17],h=[1,18],d=[1,19],u=[1,32],p=[1,20],y=[1,21],g=[1,22],m=[1,23],f=[1,24],S=[1,26],_=[1,27],T=[1,28],b=[1,29],k=[1,30],E=[1,31],D=[1,34],x=[1,35],C=[1,36],v=[1,37],$=[1,33],I=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],L=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],A=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],O={trace:r((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"--\x3e":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,classDef:38,CLASSDEF_ID:39,CLASSDEF_STYLEOPTS:40,DEFAULT:41,style:42,STYLE_IDS:43,STYLEDEF_STYLEOPTS:44,class:45,CLASSENTITY_IDS:46,STYLECLASS:47,direction_tb:48,direction_bt:49,direction_rl:50,direction_lr:51,eol:52,";":53,EDGE_STATE:54,STYLE_SEPARATOR:55,left_of:56,right_of:57,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"--\x3e",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"classDef",39:"CLASSDEF_ID",40:"CLASSDEF_STYLEOPTS",41:"DEFAULT",42:"style",43:"STYLE_IDS",44:"STYLEDEF_STYLEOPTS",45:"class",46:"CLASSENTITY_IDS",47:"STYLECLASS",48:"direction_tb",49:"direction_bt",50:"direction_rl",51:"direction_lr",53:";",54:"EDGE_STATE",55:"STYLE_SEPARATOR",56:"left_of",57:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[52,1],[52,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:r((function(t,e,s,i,n,r,o){var a=r.length-1;switch(n){case 3:return i.setRootDoc(r[a]),r[a];case 4:this.$=[];break;case 5:"nl"!=r[a]&&(r[a-1].push(r[a]),this.$=r[a-1]);break;case 6:case 7:case 12:this.$=r[a];break;case 8:this.$="nl";break;case 13:const t=r[a-1];t.description=i.trimColon(r[a]),this.$=t;break;case 14:this.$={stmt:"relation",state1:r[a-2],state2:r[a]};break;case 15:const e=i.trimColon(r[a]);this.$={stmt:"relation",state1:r[a-3],state2:r[a-1],description:e};break;case 19:this.$={stmt:"state",id:r[a-3],type:"default",description:"",doc:r[a-1]};break;case 20:var l=r[a],c=r[a-2].trim();if(r[a].match(":")){var h=r[a].split(":");l=h[0],c=[c,h[1]]}this.$={stmt:"state",id:l,type:"default",description:c};break;case 21:this.$={stmt:"state",id:r[a-3],type:"default",description:r[a-5],doc:r[a-1]};break;case 22:this.$={stmt:"state",id:r[a],type:"fork"};break;case 23:this.$={stmt:"state",id:r[a],type:"join"};break;case 24:this.$={stmt:"state",id:r[a],type:"choice"};break;case 25:this.$={stmt:"state",id:i.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[a-1].trim(),note:{position:r[a-2].trim(),text:r[a].trim()}};break;case 29:this.$=r[a].trim(),i.setAccTitle(this.$);break;case 30:case 31:this.$=r[a].trim(),i.setAccDescription(this.$);break;case 32:case 33:this.$={stmt:"classDef",id:r[a-1].trim(),classes:r[a].trim()};break;case 34:this.$={stmt:"style",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 35:this.$={stmt:"applyClass",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 36:i.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 37:i.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 38:i.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 39:i.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 42:case 43:this.$={stmt:"state",id:r[a].trim(),type:"default",description:""};break;case 44:case 45:this.$={stmt:"state",id:r[a-2].trim(),classes:[r[a].trim()],type:"default",description:""}}}),"anonymous"),table:[{3:1,4:e,5:s,6:i},{1:[3]},{3:5,4:e,5:s,6:i},{3:6,4:e,5:s,6:i},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],n,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:_,37:T,38:b,42:k,45:E,48:D,49:x,50:C,51:v,54:$},t(I,[2,5]),{9:38,10:12,11:13,12:14,13:15,16:l,17:c,19:h,22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:_,37:T,38:b,42:k,45:E,48:D,49:x,50:C,51:v,54:$},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12],{14:[1,39],15:[1,40]}),t(I,[2,16]),{18:[1,41]},t(I,[2,18],{20:[1,42]}),{23:[1,43]},t(I,[2,22]),t(I,[2,23]),t(I,[2,24]),t(I,[2,25]),{30:44,31:[1,45],56:[1,46],57:[1,47]},t(I,[2,28]),{34:[1,48]},{36:[1,49]},t(I,[2,31]),{39:[1,50],41:[1,51]},{43:[1,52]},{46:[1,53]},t(L,[2,42],{55:[1,54]}),t(L,[2,43],{55:[1,55]}),t(I,[2,36]),t(I,[2,37]),t(I,[2,38]),t(I,[2,39]),t(I,[2,6]),t(I,[2,13]),{13:56,24:u,54:$},t(I,[2,17]),t(A,n,{7:57}),{24:[1,58]},{24:[1,59]},{23:[1,60]},{24:[2,46]},{24:[2,47]},t(I,[2,29]),t(I,[2,30]),{40:[1,61]},{40:[1,62]},{44:[1,63]},{47:[1,64]},{24:[1,65]},{24:[1,66]},t(I,[2,14],{14:[1,67]}),{4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,21:[1,68],22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:_,37:T,38:b,42:k,45:E,48:D,49:x,50:C,51:v,54:$},t(I,[2,20],{20:[1,69]}),{31:[1,70]},{24:[1,71]},t(I,[2,32]),t(I,[2,33]),t(I,[2,34]),t(I,[2,35]),t(L,[2,44]),t(L,[2,45]),t(I,[2,15]),t(I,[2,19]),t(A,n,{7:72}),t(I,[2,26]),t(I,[2,27]),{4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,21:[1,73],22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:_,37:T,38:b,42:k,45:E,48:D,49:x,50:C,51:v,54:$},t(I,[2,21])],defaultActions:{5:[2,1],6:[2,2],46:[2,46],47:[2,47]},parseError:r((function(t,e){if(!e.recoverable){var s=new Error(t);throw s.hash=e,s}this.trace(t)}),"parseError"),parse:r((function(t){var e=this,s=[0],i=[],n=[null],o=[],a=this.table,l="",c=0,h=0,d=o.slice.call(arguments,1),u=Object.create(this.lexer),p={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p.yy[y]=this.yy[y]);u.setInput(t,p.yy),p.yy.lexer=u,p.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var g=u.yylloc;o.push(g);var m=u.options&&u.options.ranges;function f(){var t;return"number"!=typeof(t=i.pop()||u.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,r((function(t){s.length=s.length-2*t,n.length=n.length-t,o.length=o.length-t}),"popStack"),r(f,"lex");for(var S,_,T,b,k,E,D,x,C={};;){if(_=s[s.length-1],this.defaultActions[_]?T=this.defaultActions[_]:(null==S&&(S=f()),T=a[_]&&a[_][S]),void 0===T||!T.length||!T[0]){var v="";for(k in x=[],a[_])this.terminals_[k]&&k>2&&x.push("'"+this.terminals_[k]+"'");v=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[S]||S)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==S?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(v,{text:u.match,token:this.terminals_[S]||S,line:u.yylineno,loc:g,expected:x})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+_+", token: "+S);switch(T[0]){case 1:s.push(S),n.push(u.yytext),o.push(u.yylloc),s.push(T[1]),S=null,h=u.yyleng,l=u.yytext,c=u.yylineno,g=u.yylloc;break;case 2:if(E=this.productions_[T[1]][1],C.$=n[n.length-E],C._$={first_line:o[o.length-(E||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(E||1)].first_column,last_column:o[o.length-1].last_column},m&&(C._$.range=[o[o.length-(E||1)].range[0],o[o.length-1].range[1]]),void 0!==(b=this.performAction.apply(C,[l,h,c,p.yy,T[1],n,o].concat(d))))return b;E&&(s=s.slice(0,-1*E*2),n=n.slice(0,-1*E),o=o.slice(0,-1*E)),s.push(this.productions_[T[1]][0]),n.push(C.$),o.push(C._$),D=a[s[s.length-2]][s[s.length-1]],s.push(D);break;case 3:return!0}}return!0}),"parse")},w=function(){return{EOF:1,parseError:r((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:r((function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this}),"setInput"),input:r((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:r((function(t){var e=t.length,s=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),s.length-1&&(this.yylineno-=s.length-1);var n=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:s?(s.length===i.length?this.yylloc.first_column:0)+i[i.length-s.length].length-s[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:r((function(){return this._more=!0,this}),"more"),reject:r((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:r((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:r((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:r((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:r((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:r((function(t,e){var s,i,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],s=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var r in n)this[r]=n[r];return!1}return!1}),"test_match"),next:r((function(){if(this.done)return this.EOF;var t,e,s,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;re[0].length)){if(e=s,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(s,n[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:r((function(){var t=this.next();return t||this.lex()}),"lex"),begin:r((function(t){this.conditionStack.push(t)}),"begin"),popState:r((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:r((function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}),"_currentRules"),topState:r((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:r((function(t){this.begin(t)}),"pushState"),stateStackSize:r((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:r((function(t,e,s,i){switch(s){case 0:return 41;case 1:case 42:return 48;case 2:case 43:return 49;case 3:case 44:return 50;case 4:case 45:return 51;case 5:case 6:case 8:case 9:case 10:case 11:case 54:case 56:case 62:break;case 7:case 77:return 5;case 12:case 32:return this.pushState("SCALE"),17;case 13:case 33:return 18;case 14:case 20:case 34:case 49:case 52:this.popState();break;case 15:return this.begin("acc_title"),33;case 16:return this.popState(),"acc_title_value";case 17:return this.begin("acc_descr"),35;case 18:return this.popState(),"acc_descr_value";case 19:this.begin("acc_descr_multiline");break;case 21:return"acc_descr_multiline_value";case 22:return this.pushState("CLASSDEF"),38;case 23:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 24:return this.popState(),this.pushState("CLASSDEFID"),39;case 25:return this.popState(),40;case 26:return this.pushState("CLASS"),45;case 27:return this.popState(),this.pushState("CLASS_STYLE"),46;case 28:return this.popState(),47;case 29:return this.pushState("STYLE"),42;case 30:return this.popState(),this.pushState("STYLEDEF_STYLES"),43;case 31:return this.popState(),44;case 35:this.pushState("STATE");break;case 36:case 39:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),25;case 37:case 40:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),26;case 38:case 41:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),27;case 46:this.pushState("STATE_STRING");break;case 47:return this.pushState("STATE_ID"),"AS";case 48:case 64:return this.popState(),"ID";case 50:return"STATE_DESCR";case 51:return 19;case 53:return this.popState(),this.pushState("struct"),20;case 55:return this.popState(),21;case 57:return this.begin("NOTE"),29;case 58:return this.popState(),this.pushState("NOTE_ID"),56;case 59:return this.popState(),this.pushState("NOTE_ID"),57;case 60:this.popState(),this.pushState("FLOATING_NOTE");break;case 61:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 63:return"NOTE_TEXT";case 65:return this.popState(),this.pushState("NOTE_TEXT"),24;case 66:return this.popState(),e.yytext=e.yytext.substr(2).trim(),31;case 67:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),31;case 68:case 69:return 6;case 70:return 16;case 71:return 54;case 72:return 24;case 73:return e.yytext=e.yytext.trim(),14;case 74:return 15;case 75:return 28;case 76:return 55;case 78:return"INVALID"}}),"anonymous"),rules:[/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[9,10],inclusive:!1},struct:{rules:[9,10,22,26,29,35,42,43,44,45,54,55,56,57,71,72,73,74,75],inclusive:!1},FLOATING_NOTE_ID:{rules:[64],inclusive:!1},FLOATING_NOTE:{rules:[61,62,63],inclusive:!1},NOTE_TEXT:{rules:[66,67],inclusive:!1},NOTE_ID:{rules:[65],inclusive:!1},NOTE:{rules:[58,59,60],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[31],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[30],inclusive:!1},CLASS_STYLE:{rules:[28],inclusive:!1},CLASS:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[25],inclusive:!1},CLASSDEF:{rules:[23,24],inclusive:!1},acc_descr_multiline:{rules:[20,21],inclusive:!1},acc_descr:{rules:[18],inclusive:!1},acc_title:{rules:[16],inclusive:!1},SCALE:{rules:[13,14,33,34],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[48],inclusive:!1},STATE_STRING:{rules:[49,50],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[9,10,36,37,38,39,40,41,46,47,51,52,53],inclusive:!1},ID:{rules:[9,10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,10,11,12,15,17,19,22,26,29,32,35,53,57,68,69,70,71,72,73,74,76,77,78],inclusive:!0}}}}();function N(){this.yy={}}return O.lexer=w,r(N,"Parser"),N.prototype=O,O.Parser=N,new N}();_.parser=_;var T=_,b="state",k="relation",E="default",D="divider",x="fill:none",C="fill: #333",v="text",$="normal",I="rect",L="rectWithTitle",A="divider",O="roundedWithTitle",w="statediagram",N=`${w}-state`,R="transition",B=`${R} note-edge`,F=`${w}-note`,P=`${w}-cluster`,Y=`${w}-cluster-alt`,G="parent",j="note",z="----",U=`${z}${j}`,M=`${z}${G}`,X=r(((t,e="TB")=>{if(!t.doc)return e;let s=e;for(const i of t.doc)"dir"===i.stmt&&(s=i.value);return s}),"getDir"),H={getClasses:r((function(t,e){return e.db.getClasses()}),"getClasses"),draw:r((async function(t,e,s,r){o.info("REF0:"),o.info("Drawing state diagram (v2)",e);const{securityLevel:h,state:d,layout:u}=a();r.db.extract(r.db.getRootDocV2());const p=r.db.getData(),y=i(e,h);p.type=r.type,p.layoutAlgorithm=u,p.nodeSpacing=(null==d?void 0:d.nodeSpacing)||50,p.rankSpacing=(null==d?void 0:d.rankSpacing)||50,p.markers=["barb"],p.diagramId=e,await l(p,y);c.insertTitle(y,"statediagramTitleText",(null==d?void 0:d.titleTopMargin)??25,r.db.getDiagramTitle()),n(y,8,w,(null==d?void 0:d.useMaxWidth)??!0)}),"draw"),getDir:X},V=new Map,W=0;function J(t="",e=0,s="",i=z){return`state-${t}${null!==s&&s.length>0?`${i}${s}`:""}-${e}`}r(J,"stateDomId");var K=r(((t,e,s,i,n,r,l,c)=>{o.trace("items",e),e.forEach((e=>{switch(e.stmt){case b:case E:et(t,e,s,i,n,r,l,c);break;case k:{et(t,e.state1,s,i,n,r,l,c),et(t,e.state2,s,i,n,r,l,c);const o={id:"edge"+W,start:e.state1.id,end:e.state2.id,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:x,labelStyle:"",label:d.sanitizeText(e.description,a()),arrowheadStyle:C,labelpos:"c",labelType:v,thickness:$,classes:R,look:l};n.push(o),W++}}}))}),"setupDoc"),Z=r(((t,e="TB")=>{let s=e;if(t.doc)for(const i of t.doc)"dir"===i.stmt&&(s=i.value);return s}),"getDir");function q(t,e,s){if(!e.id||""===e.id||""===e.id)return;e.cssClasses&&(Array.isArray(e.cssCompiledStyles)||(e.cssCompiledStyles=[]),e.cssClasses.split(" ").forEach((t=>{if(s.get(t)){const i=s.get(t);e.cssCompiledStyles=[...e.cssCompiledStyles,...i.styles]}})));const i=t.find((t=>t.id===e.id));i?Object.assign(i,e):t.push(e)}function Q(t){var e;return(null==(e=null==t?void 0:t.classes)?void 0:e.join(" "))??""}function tt(t){return(null==t?void 0:t.styles)??[]}r(q,"insertOrUpdateNode"),r(Q,"getClassesFromDbInfo"),r(tt,"getStylesFromDbInfo");var et=r(((t,e,s,i,n,r,l,c)=>{var h,u;const p=e.id,y=s.get(p),g=Q(y),m=tt(y);if(o.info("dataFetcher parsedItem",e,y,m),"root"!==p){let s=I;!0===e.start?s="stateStart":!1===e.start&&(s="stateEnd"),e.type!==E&&(s=e.type),V.get(p)||V.set(p,{id:p,shape:s,description:d.sanitizeText(p,a()),cssClasses:`${g} ${N}`,cssStyles:m});const y=V.get(p);e.description&&(Array.isArray(y.description)?(y.shape=L,y.description.push(e.description)):(null==(h=y.description)?void 0:h.length)>0?(y.shape=L,y.description===p?y.description=[e.description]:y.description=[y.description,e.description]):(y.shape=I,y.description=e.description),y.description=d.sanitizeTextOrArray(y.description,a())),1===(null==(u=y.description)?void 0:u.length)&&y.shape===L&&("group"===y.type?y.shape=O:y.shape=I),!y.type&&e.doc&&(o.info("Setting cluster for XCX",p,Z(e)),y.type="group",y.isGroup=!0,y.dir=Z(e),y.shape=e.type===D?A:O,y.cssClasses=`${y.cssClasses} ${P} ${r?Y:""}`);const f={labelStyle:"",shape:y.shape,label:y.description,cssClasses:y.cssClasses,cssCompiledStyles:[],cssStyles:y.cssStyles,id:p,dir:y.dir,domId:J(p,W),type:y.type,isGroup:"group"===y.type,padding:8,rx:10,ry:10,look:l};if(f.shape===A&&(f.label=""),t&&"root"!==t.id&&(o.trace("Setting node ",p," to be child of its parent ",t.id),f.parentId=t.id),f.centerLabel=!0,e.note){const t={labelStyle:"",shape:"note",label:e.note.text,cssClasses:F,cssStyles:[],cssCompilesStyles:[],id:p+U+"-"+W,domId:J(p,W,j),type:y.type,isGroup:"group"===y.type,padding:a().flowchart.padding,look:l,position:e.note.position},s=p+M,r={labelStyle:"",shape:"noteGroup",label:e.note.text,cssClasses:y.cssClasses,cssStyles:[],id:p+M,domId:J(p,W,G),type:"group",isGroup:!0,padding:16,look:l,position:e.note.position};W++,r.id=s,t.parentId=s,q(i,r,c),q(i,t,c),q(i,f,c);let o=p,h=t.id;"left of"===e.note.position&&(o=t.id,h=p),n.push({id:o+"-"+h,start:o,end:h,arrowhead:"none",arrowTypeEnd:"",style:x,labelStyle:"",classes:B,arrowheadStyle:C,labelpos:"c",labelType:v,thickness:$,look:l})}else q(i,f,c)}e.doc&&(o.trace("Adding nodes children "),K(e,e.doc,s,i,n,!r,l,c))}),"dataFetcher"),st=r((()=>{V.clear(),W=0}),"reset"),it="[*]",nt="start",rt=it,ot="color",at="fill";function lt(){return new Map}r(lt,"newClassesList");var ct=r((()=>({relations:[],states:new Map,documents:{}})),"newDoc"),ht=r((t=>JSON.parse(JSON.stringify(t))),"clone"),dt=(r(t=class{constructor(t){s(this,"version"),s(this,"nodes",[]),s(this,"edges",[]),s(this,"rootDoc",[]),s(this,"classes",lt()),s(this,"documents",{root:ct()}),s(this,"currentDocument",this.documents.root),s(this,"startEndCount",0),s(this,"dividerCnt",0),s(this,"getAccTitle",p),s(this,"setAccTitle",y),s(this,"getAccDescription",g),s(this,"setAccDescription",m),s(this,"setDiagramTitle",f),s(this,"getDiagramTitle",S),this.clear(),this.version=t,this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this)}setRootDoc(t){o.info("Setting root doc",t),this.rootDoc=t,1===this.version?this.extract(t):this.extract(this.getRootDocV2())}getRootDoc(){return this.rootDoc}docTranslator(t,e,s){if(e.stmt===k)this.docTranslator(t,e.state1,!0),this.docTranslator(t,e.state2,!1);else if(e.stmt===b&&("[*]"===e.id?(e.id=s?t.id+"_start":t.id+"_end",e.start=s):e.id=e.id.trim()),e.doc){const t=[];let s,i=[];for(s=0;s0&&i.length>0){const s={stmt:b,id:h(),type:"divider",doc:ht(i)};t.push(ht(s)),e.doc=t}e.doc.forEach((t=>this.docTranslator(e,t,!0)))}}getRootDocV2(){return this.docTranslator({id:"root"},{id:"root",doc:this.rootDoc},!0),{id:"root",doc:this.rootDoc}}extract(t){let e;e=t.doc?t.doc:t,o.info(e),this.clear(!0),o.info("Extract initial document:",e),e.forEach((t=>{switch(o.warn("Statement",t.stmt),t.stmt){case b:this.addState(t.id.trim(),t.type,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles);break;case k:this.addRelation(t.state1,t.state2,t.description);break;case"classDef":this.addStyleClass(t.id.trim(),t.classes);break;case"style":{const e=t.id.trim().split(","),s=t.styleClass.split(",");e.forEach((t=>{let e=this.getState(t);if(void 0===e){const s=t.trim();this.addState(s),e=this.getState(s)}e.styles=s.map((t=>{var e;return null==(e=t.replace(/;/g,""))?void 0:e.trim()}))}))}break;case"applyClass":this.setCssClass(t.id.trim(),t.styleClass)}}));const s=this.getStates(),i=a().look;st(),et(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,i,this.classes),this.nodes.forEach((t=>{if(Array.isArray(t.label)){if(t.description=t.label.slice(1),t.isGroup&&t.description.length>0)throw new Error("Group nodes can only have label. Remove the additional description for node ["+t.id+"]");t.label=t.label[0]}}))}addState(t,e=E,s=null,i=null,n=null,r=null,l=null,c=null){const h=null==t?void 0:t.trim();if(this.currentDocument.states.has(h)?(this.currentDocument.states.get(h).doc||(this.currentDocument.states.get(h).doc=s),this.currentDocument.states.get(h).type||(this.currentDocument.states.get(h).type=e)):(o.info("Adding state ",h,i),this.currentDocument.states.set(h,{id:h,descriptions:[],type:e,doc:s,note:n,classes:[],styles:[],textStyles:[]})),i&&(o.info("Setting state description",h,i),"string"==typeof i&&this.addDescription(h,i.trim()),"object"==typeof i&&i.forEach((t=>this.addDescription(h,t.trim())))),n){const t=this.currentDocument.states.get(h);t.note=n,t.note.text=d.sanitizeText(t.note.text,a())}if(r){o.info("Setting state classes",h,r);("string"==typeof r?[r]:r).forEach((t=>this.setCssClass(h,t.trim())))}if(l){o.info("Setting state styles",h,l);("string"==typeof l?[l]:l).forEach((t=>this.setStyle(h,t.trim())))}if(c){o.info("Setting state styles",h,l);("string"==typeof c?[c]:c).forEach((t=>this.setTextStyle(h,t.trim())))}}clear(t){this.nodes=[],this.edges=[],this.documents={root:ct()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=lt(),t||u()}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){o.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}startIdIfNeeded(t=""){let e=t;return t===it&&(this.startEndCount++,e=`${nt}${this.startEndCount}`),e}startTypeIfNeeded(t="",e=E){return t===it?nt:e}endIdIfNeeded(t=""){let e=t;return t===rt&&(this.startEndCount++,e=`end${this.startEndCount}`),e}endTypeIfNeeded(t="",e=E){return t===rt?"end":e}addRelationObjs(t,e,s){let i=this.startIdIfNeeded(t.id.trim()),n=this.startTypeIfNeeded(t.id.trim(),t.type),r=this.startIdIfNeeded(e.id.trim()),o=this.startTypeIfNeeded(e.id.trim(),e.type);this.addState(i,n,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(r,o,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.currentDocument.relations.push({id1:i,id2:r,relationTitle:d.sanitizeText(s,a())})}addRelation(t,e,s){if("object"==typeof t)this.addRelationObjs(t,e,s);else{const i=this.startIdIfNeeded(t.trim()),n=this.startTypeIfNeeded(t),r=this.endIdIfNeeded(e.trim()),o=this.endTypeIfNeeded(e);this.addState(i,n),this.addState(r,o),this.currentDocument.relations.push({id1:i,id2:r,title:d.sanitizeText(s,a())})}}addDescription(t,e){const s=this.currentDocument.states.get(t),i=e.startsWith(":")?e.replace(":","").trim():e;s.descriptions.push(d.sanitizeText(i,a()))}cleanupLabel(t){return":"===t.substring(0,1)?t.substr(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,"divider-id-"+this.dividerCnt}addStyleClass(t,e=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});const s=this.classes.get(t);null!=e&&e.split(",").forEach((t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(RegExp(ot).exec(t)){const t=e.replace(at,"bgFill").replace(ot,at);s.textStyles.push(t)}s.styles.push(e)}))}getClasses(){return this.classes}setCssClass(t,e){t.split(",").forEach((t=>{let s=this.getState(t);if(void 0===s){const e=t.trim();this.addState(e),s=this.getState(e)}s.classes.push(e)}))}setStyle(t,e){const s=this.getState(t);void 0!==s&&s.styles.push(e)}setTextStyle(t,e){const s=this.getState(t);void 0!==s&&s.textStyles.push(e)}getDirectionStatement(){return this.rootDoc.find((t=>"dir"===t.stmt))}getDirection(){var t;return(null==(t=this.getDirectionStatement())?void 0:t.value)??"TB"}setDirection(t){const e=this.getDirectionStatement();e?e.value=t:this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t&&":"===t[0]?t.substr(1).trim():t.trim()}getData(){const t=a();return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:X(this.getRootDocV2())}}getConfig(){return a().state}},"StateDB"),s(t,"relationType",{AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}),t),ut=r((t=>`\ndefs #statediagram-barbEnd {\n fill: ${t.transitionColor};\n stroke: ${t.transitionColor};\n }\ng.stateGroup text {\n fill: ${t.nodeBorder};\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ${t.textColor};\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ${t.stateLabelColor};\n}\n\ng.stateGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.stateGroup line {\n stroke: ${t.lineColor};\n stroke-width: 1;\n}\n\n.transition {\n stroke: ${t.transitionColor};\n stroke-width: 1;\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ${t.background};\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n\n text {\n fill: ${t.noteTextColor};\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ${t.labelBackgroundColor};\n opacity: 0.5;\n}\n.edgeLabel {\n background-color: ${t.edgeLabelBackground};\n p {\n background-color: ${t.edgeLabelBackground};\n }\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n}\n.edgeLabel .label text {\n fill: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n.label div .edgeLabel {\n color: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n\n.stateLabel text {\n fill: ${t.stateLabelColor};\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node .fork-join {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node circle.state-end {\n fill: ${t.innerEndBackground};\n stroke: ${t.background};\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ${t.compositeBackground||t.background};\n // stroke: ${t.background};\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ${t.stateBkg||t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: 1px;\n}\n.node polygon {\n fill: ${t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};;\n stroke-width: 1px;\n}\n#statediagram-barbEnd {\n fill: ${t.lineColor};\n}\n\n.statediagram-cluster rect {\n fill: ${t.compositeTitleBackground};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: 1px;\n}\n\n.cluster-label, .nodeLabel {\n color: ${t.stateLabelColor};\n // line-height: 1;\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ${t.stateBorder||t.nodeBorder};\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ${t.compositeBackground||t.background};\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ${t.noteTextColor};\n}\n\n.statediagram-note .nodeLabel {\n color: ${t.noteTextColor};\n}\n.statediagram .edgeLabel {\n color: red; // ${t.noteTextColor};\n}\n\n#dependencyStart, #dependencyEnd {\n fill: ${t.lineColor};\n stroke: ${t.lineColor};\n stroke-width: 1;\n}\n\n.statediagramTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n`),"getStyles");export{dt as S,T as a,H as b,ut as s}; diff --git a/docs/assets/chunk-D6G4REZN-dBJjcl8S.js b/docs/assets/chunk-D6G4REZN-dBJjcl8S.js deleted file mode 100644 index b3c3df9..0000000 --- a/docs/assets/chunk-D6G4REZN-dBJjcl8S.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,m as a,i as r}from"./mermaid-BGnxfgCD.js";var s=t(((t,a)=>{const r=t.append("rect");if(r.attr("x",a.x),r.attr("y",a.y),r.attr("fill",a.fill),r.attr("stroke",a.stroke),r.attr("width",a.width),r.attr("height",a.height),a.name&&r.attr("name",a.name),a.rx&&r.attr("rx",a.rx),a.ry&&r.attr("ry",a.ry),void 0!==a.attrs)for(const s in a.attrs)r.attr(s,a.attrs[s]);return a.class&&r.attr("class",a.class),r}),"drawRect"),e=t(((t,a)=>{const r={x:a.startx,y:a.starty,width:a.stopx-a.startx,height:a.stopy-a.starty,fill:a.fill,stroke:a.stroke,class:"rect"};s(t,r).lower()}),"drawBackgroundRect"),n=t(((t,r)=>{const s=r.text.replace(a," "),e=t.append("text");e.attr("x",r.x),e.attr("y",r.y),e.attr("class","legend"),e.style("text-anchor",r.anchor),r.class&&e.attr("class",r.class);const n=e.append("tspan");return n.attr("x",r.x+2*r.textMargin),n.text(s),e}),"drawText"),x=t(((t,a,s,e)=>{const n=t.append("image");n.attr("x",a),n.attr("y",s);const x=r.sanitizeUrl(e);n.attr("xlink:href",x)}),"drawImage"),i=t(((t,a,s,e)=>{const n=t.append("use");n.attr("x",a),n.attr("y",s);const x=r.sanitizeUrl(e);n.attr("xlink:href",`#${x}`)}),"drawEmbeddedImage"),c=t((()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0})),"getNoteRect"),o=t((()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0})),"getTextObj");export{e as a,o as b,i as c,s as d,x as e,n as f,c as g}; diff --git a/docs/assets/chunk-RZ5BOZE2-gqSVpaRG.js b/docs/assets/chunk-RZ5BOZE2-gqSVpaRG.js deleted file mode 100644 index e6018da..0000000 --- a/docs/assets/chunk-RZ5BOZE2-gqSVpaRG.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as t,d as e,l as i}from"./mermaid-BGnxfgCD.js";import{s as o}from"./transform-DjHZbYKP.js";var s=t(((t,e)=>{let i;"sandbox"===e&&(i=o("#i"+t));return o("sandbox"===e?i.nodes()[0].contentDocument.body:"body").select(`[id="${t}"]`)}),"getDiagramElement"),a=t(((t,o,s,a)=>{t.attr("class",s);const{width:n,height:h,x:g,y:c}=r(t,o);e(t,h,n,a);const m=d(g,c,n,h,o);t.attr("viewBox",m),i.debug(`viewBox configured: ${m} with padding: ${o}`)}),"setupViewPortForSVG"),r=t(((t,e)=>{var i;const o=(null==(i=t.node())?void 0:i.getBBox())||{width:0,height:0,x:0,y:0};return{width:o.width+2*e,height:o.height+2*e,x:o.x,y:o.y}}),"calculateDimensionsWithPadding"),d=t(((t,e,i,o,s)=>`${t-s} ${e-s} ${i} ${o}`),"createViewBox");export{s as g,a as s}; diff --git a/docs/assets/chunk-XZIHB7SX-C45uxqC9.js b/docs/assets/chunk-XZIHB7SX-C45uxqC9.js deleted file mode 100644 index 489e296..0000000 --- a/docs/assets/chunk-XZIHB7SX-C45uxqC9.js +++ /dev/null @@ -1 +0,0 @@ -var t;import{_ as i}from"./mermaid-BGnxfgCD.js";var r=(i(t=class{constructor(t){this.init=t,this.records=this.init()}reset(){this.records=this.init()}},"ImperativeState"),t);export{r as I}; diff --git a/docs/assets/circle-play-BsTGrgLY.js b/docs/assets/circle-play-BsTGrgLY.js deleted file mode 100644 index a952d91..0000000 --- a/docs/assets/circle-play-BsTGrgLY.js +++ /dev/null @@ -1,7 +0,0 @@ -import{u as c}from"./index-D3XtisvU.js"; -/** - * @license lucide-react v0.503.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o=c("circle-play",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);export{o as C}; diff --git a/docs/assets/classDiagram-GIVACNV2-qhF77njY.js b/docs/assets/classDiagram-GIVACNV2-qhF77njY.js deleted file mode 100644 index 9f82958..0000000 --- a/docs/assets/classDiagram-GIVACNV2-qhF77njY.js +++ /dev/null @@ -1 +0,0 @@ -import{s as r,c as s,a as t,C as a}from"./chunk-A2AXSNBT-Co8Zfrpr.js";import{_ as e}from"./mermaid-BGnxfgCD.js";import"./transform-DjHZbYKP.js";import"./chunk-RZ5BOZE2-gqSVpaRG.js";import"./index-D3XtisvU.js";import"./step-BwsUM5iJ.js";import"./timer-DFzT7np-.js";var o={parser:t,get db(){return new a},renderer:s,styles:r,init:e((r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute}),"init")};export{o as diagram}; diff --git a/docs/assets/classDiagram-v2-COTLJTTW-qhF77njY.js b/docs/assets/classDiagram-v2-COTLJTTW-qhF77njY.js deleted file mode 100644 index 9f82958..0000000 --- a/docs/assets/classDiagram-v2-COTLJTTW-qhF77njY.js +++ /dev/null @@ -1 +0,0 @@ -import{s as r,c as s,a as t,C as a}from"./chunk-A2AXSNBT-Co8Zfrpr.js";import{_ as e}from"./mermaid-BGnxfgCD.js";import"./transform-DjHZbYKP.js";import"./chunk-RZ5BOZE2-gqSVpaRG.js";import"./index-D3XtisvU.js";import"./step-BwsUM5iJ.js";import"./timer-DFzT7np-.js";var o={parser:t,get db(){return new a},renderer:s,styles:r,init:e((r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute}),"init")};export{o as diagram}; diff --git a/docs/assets/clike-BgBwzOhw.js b/docs/assets/clike-BgBwzOhw.js deleted file mode 100644 index da9def2..0000000 --- a/docs/assets/clike-BgBwzOhw.js +++ /dev/null @@ -1 +0,0 @@ -function e(e,t,n,r,a,o){this.indented=e,this.column=t,this.type=n,this.info=r,this.align=a,this.prev=o}function t(t,n,r,a){var o=t.indented;return t.context&&"statement"==t.context.type&&"statement"!=r&&(o=t.context.indented),t.context=new e(o,n,r,a,null,t.context)}function n(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function r(e,t,n){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function a(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function o(o){var i,s,c=o.statementIndentUnit,u=o.dontAlignCalls,d=o.keywords||{},f=o.types||{},p=o.builtin||{},m=o.blockKeywords||{},h=o.defKeywords||{},y=o.atoms||{},g=o.hooks||{},k=o.multiLineStrings,b=!1!==o.indentStatements,v=!1!==o.indentSwitch,w=o.namespaceSeparator,_=o.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,x=o.numberStart||/[\d\.]/,S=o.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,T=o.isOperatorChar||/[+\-*&%=<>!?|\/]/,N=o.isIdentifierChar||/[\w\$_\xa1-\uffff]/,I=o.isReservedIdentifier||!1;function D(e,t){var n,r=e.next();if(g[r]){var a=g[r](e,t);if(!1!==a)return a}if('"'==r||"'"==r)return t.tokenize=(n=r,function(e,t){for(var r,a=!1,o=!1;null!=(r=e.next());){if(r==n&&!a){o=!0;break}a=!a&&"\\"==r}return(o||!a&&!k)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(x.test(r)){if(e.backUp(1),e.match(S))return"number";e.next()}if(_.test(r))return i=r,null;if("/"==r){if(e.eat("*"))return t.tokenize=C,C(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(T.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(T););return"operator"}if(e.eatWhile(N),w)for(;e.match(w);)e.eatWhile(N);var o=e.current();return l(d,o)?(l(m,o)&&(i="newstatement"),l(h,o)&&(s=!0),"keyword"):l(f,o)?"type":l(p,o)||I&&I(o)?(l(m,o)&&(i="newstatement"),"builtin"):l(y,o)?"atom":"variable"}function C(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function z(e,t){o.typeFirstDefinitions&&e.eol()&&a(t.context)&&(t.typeAtEndOfLine=r(e,t,e.pos))}return{name:o.name,startState:function(t){return{tokenize:null,context:new e(-t,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,l){var c=l.context;if(e.sol()&&(null==c.align&&(c.align=!1),l.indented=e.indentation(),l.startOfLine=!0),e.eatSpace())return z(e,l),null;i=s=null;var u=(l.tokenize||D)(e,l);if("comment"==u||"meta"==u)return u;if(null==c.align&&(c.align=!0),";"==i||":"==i||","==i&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==l.context.type;)n(l);else if("{"==i)t(l,e.column(),"}");else if("["==i)t(l,e.column(),"]");else if("("==i)t(l,e.column(),")");else if("}"==i){for(;"statement"==c.type;)c=n(l);for("}"==c.type&&(c=n(l));"statement"==c.type;)c=n(l)}else i==c.type?n(l):b&&(("}"==c.type||"top"==c.type)&&";"!=i||"statement"==c.type&&"newstatement"==i)&&t(l,e.column(),"statement",e.current());if("variable"==u&&("def"==l.prevToken||o.typeFirstDefinitions&&r(e,l,e.start)&&a(l.context)&&e.match(/^\s*\(/,!1))&&(u="def"),g.token){var d=g.token(e,l,u);void 0!==d&&(u=d)}return"def"==u&&!1===o.styleDefs&&(u="variable"),l.startOfLine=!1,l.prevToken=s?"def":u||i,z(e,l),u},indent:function(e,t,n){if(e.tokenize!=D&&null!=e.tokenize||e.typeAtEndOfLine&&a(e.context))return null;var r=e.context,i=t&&t.charAt(0),l=i==r.type;if("statement"==r.type&&"}"==i&&(r=r.prev),o.dontIndentStatements)for(;"statement"==r.type&&o.dontIndentStatements.test(r.info);)r=r.prev;if(g.indent){var s=g.indent(e,r,t,n.unit);if("number"==typeof s)return s}var d=r.prev&&"switch"==r.prev.info;if(o.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==i?0:c||n.unit):!r.align||u&&")"==r.type?")"!=r.type||l?r.indented+(l?0:n.unit)+(l||!d||/^(?:case|default)\b/.test(t)?0:n.unit):r.indented+(c||n.unit):r.column+(l?0:1)},languageData:{indentOnInput:v?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}},autocomplete:Object.keys(d).concat(Object.keys(f)).concat(Object.keys(p)).concat(Object.keys(y)),...o.languageData}}}function i(e){for(var t={},n=e.split(" "),r=0;r!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=z,t.tokenize(e,t))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"character":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(t,n){var r=n.context;return!("}"!=r.type||!r.align||!t.eat(">"))&&(n.context=new e(r.indented,r.column,r.type,r.info,null,r.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=L(1),t.tokenize(e,t))}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});const E=o({name:"kotlin",keywords:i("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:i("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:i("catch class do else finally for if where try while enum"),defKeywords:i("class val var object interface fun"),atoms:i("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,t){return"."==t.prevToken?"variable":"operator"},'"':function(e,t){var n;return t.tokenize=(n=e.match('""'),function(e,t){for(var r,a=!1,o=!1;!e.eol();){if(!n&&!a&&e.match('"')){o=!0;break}if(n&&e.match('"""')){o=!0;break}r=e.next(),!a&&"$"==r&&e.match("{")&&e.skipTo("}"),a=!a&&"\\"==r&&!n}return!o&&n||(t.tokenize=null),"string"}),t.tokenize(e,t)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=L(1),t.tokenize(e,t))},indent:function(e,t,n,r){var a=n&&n.charAt(0);return"}"!=e.prevToken&&")"!=e.prevToken||""!=n?"operator"==e.prevToken&&"}"!=n&&"}"!=e.context.type||"variable"==e.prevToken&&"."==a||("}"==e.prevToken||")"==e.prevToken)&&"."==a?2*r+t.indented:t.align&&"}"==t.type?t.indented+(e.context.type==(n||"").charAt(0)?0:r):void 0:e.indented}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}}),F=o({name:"shader",keywords:i("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:i("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:i("for while do if else struct"),builtin:i("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:i("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":k}}),P=o({name:"nesc",keywords:i(s+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:m,blockKeywords:i(y),atoms:i("null true false"),hooks:{"#":k}}),R=o({name:"objectivec",keywords:i(s+" "+u),types:h,builtin:i(d),blockKeywords:i(y+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:i(g+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:i("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:v,hooks:{"#":k,"*":b}}),O=o({name:"objectivecpp",keywords:i(s+" "+u+" "+c),types:h,builtin:i(d),blockKeywords:i(y+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:i(g+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:i("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:v,hooks:{"#":k,"*":b,u:_,U:_,L:_,R:_,0:w,1:w,2:w,3:w,4:w,5:w,6:w,7:w,8:w,9:w,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&x(e.current()))return"def"}},namespaceSeparator:"::"}),A=o({name:"squirrel",keywords:i("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:m,blockKeywords:i("case catch class else for foreach if switch try while"),defKeywords:i("function local class"),typeFirstDefinitions:!0,atoms:i("true false null"),hooks:{"#":k}});var j=null;function U(e){return function(t,n){for(var r,a=!1,o=!1;!t.eol();){if(!a&&t.match('"')&&("single"==e||t.match('""'))){o=!0;break}if(!a&&t.match("``")){j=U(e),o=!0;break}r=t.next(),a="single"==e&&!a&&"\\"==r}return o&&(n.tokenize=null),"string"}}const $=o({name:"ceylon",keywords:i("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:i("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:i("class dynamic function interface module object package value"),builtin:i("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:i("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=U(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!j||!e.match("`"))&&(t.tokenize=j,j=null,t.tokenize(e,t))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"string.special":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},token:function(e,t,n){if(("variable"==n||"type"==n)&&"."==t.prevToken)return"variableName.special"}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function B(e){(e.interpolationStack||(e.interpolationStack=[])).push(e.tokenize)}function K(e){return(e.interpolationStack||(e.interpolationStack=[])).pop()}function q(e,t,n,r){var a=!1;if(t.eat(e)){if(!t.eat(e))return"string";a=!0}function o(t,n){for(var o=!1;!t.eol();){if(!r&&!o&&"$"==t.peek())return B(n),n.tokenize=V,"string";var i=t.next();if(i==e&&!o&&(!a||t.match(e+e))){n.tokenize=null;break}o=!r&&!o&&"\\"==i}return"string"}return n.tokenize=o,o(t,n)}function V(e,t){return e.eat("$"),e.eat("{")?t.tokenize=null:t.tokenize=W,null}function W(e,t){return e.eatWhile(/[\w_]/),t.tokenize=K(t),"variable"}const G=o({name:"dart",keywords:i("this super static final const abstract class extends external factory implements mixin get native set typedef with enum throw rethrow assert break case continue default in return new deferred async await covariant try catch finally do else for if switch while import library export part of show hide is as extension on yield late required sealed base interface when inline"),blockKeywords:i("try catch finally do else for if switch while"),builtin:i("void bool num int double dynamic var String Null Never"),atoms:i("true false null"),number:/^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_\.]/),"meta"},"'":function(e,t){return q("'",e,t,!1)},'"':function(e,t){return q('"',e,t,!1)},r:function(e,t){var n=e.peek();return("'"==n||'"'==n)&&q(e.next(),e,t,!0)},"}":function(e,t){return function(e){return e.interpolationStack?e.interpolationStack.length:0}(t)>0&&(t.tokenize=K(t),null)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=L(1),t.tokenize(e,t))},token:function(e,t,n){if("variable"==n&&RegExp("^[_$]*[A-Z][a-zA-Z0-9_$]*$","g").test(e.current()))return"type"}}});export{N as c,$ as ceylon,o as clike,I as cpp,C as csharp,G as dart,D as java,E as kotlin,P as nesC,R as objectiveC,O as objectiveCpp,M as scala,F as shader,A as squirrel}; diff --git a/docs/assets/clojure-DR_hEDJv.js b/docs/assets/clojure-DR_hEDJv.js deleted file mode 100644 index 5c56182..0000000 --- a/docs/assets/clojure-DR_hEDJv.js +++ /dev/null @@ -1 +0,0 @@ -var e=["false","nil","true"],t=[".","catch","def","do","if","monitor-enter","monitor-exit","new","quote","recur","set!","throw","try","var"],n=["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-namespace-maps*","*print-readably*","*read-eval*","*reader-resolver*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods","..","/","<","<=","=","==",">",">=","EMPTY-NODE","Inst","StackTraceElement->vec","Throwable->map","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","any?","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","boolean?","booleans","bound-fn","bound-fn*","bound?","bounded-count","butlast","byte","byte-array","bytes","bytes?","case","cast","cat","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","cond","cond->","cond->>","condp","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","dedupe","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","double?","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","halt-when","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","ident?","identical?","identity","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","indexed?","init-proxy","inst-ms","inst-ms*","inst?","instance?","int","int-array","int?","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","munge","name","namespace","namespace-munge","nat-int?","neg-int?","neg?","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos-int?","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","qualified-ident?","qualified-keyword?","qualified-symbol?","quot","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","reset-vals!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seqable?","seque","sequence","sequential?","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","simple-ident?","simple-keyword?","simple-symbol?","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","swap-vals!","symbol","symbol?","sync","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","time","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","uri?","use","uuid?","val","vals","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","vswap!","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"],r=f(e),a=f(t),o=f(n),s=f(["->","->>","as->","binding","bound-fn","case","catch","comment","cond","cond->","cond->>","condp","def","definterface","defmethod","defn","defmacro","defprotocol","defrecord","defstruct","deftype","do","doseq","dotimes","doto","extend","extend-protocol","extend-type","fn","for","future","if","if-let","if-not","if-some","let","letfn","locking","loop","ns","proxy","reify","struct-map","some->","some->>","try","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn"]),i=/^(?:[\\\[\]\s"(),;@^`{}~]|$)/,c=/^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/,d=/^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/,l=/^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/;function u(e,t){if(e.eatSpace()||e.eat(","))return["space",null];if(e.match(c))return[null,"number"];if(e.match(d))return[null,"string.special"];if(e.eat(/^"/))return(t.tokenize=p)(e,t);if(e.eat(/^[(\[{]/))return["open","bracket"];if(e.eat(/^[)\]}]/))return["close","bracket"];if(e.eat(/^;/))return e.skipToEnd(),["space","comment"];if(e.eat(/^[#'@^`~]/))return[null,"meta"];var n=e.match(l),s=n&&n[0];return s?"comment"===s&&"("===t.lastToken?(t.tokenize=m)(e,t):h(s,r)||":"===s.charAt(0)?["symbol","atom"]:h(s,a)||h(s,o)?["symbol","keyword"]:"("===t.lastToken?["symbol","builtin"]:["symbol","variable"]:(e.next(),e.eatWhile((function(e){return!h(e,i)})),[null,"error"])}function p(e,t){for(var n,r=!1;n=e.next();){if('"'===n&&!r){t.tokenize=u;break}r=!r&&"\\"===n}return[null,"string"]}function m(e,t){for(var n,r=1;n=e.next();)if(")"===n&&r--,"("===n&&r++,0===r){e.backUp(1),t.tokenize=u;break}return["space","comment"]}function f(e){for(var t={},n=0;n >= "),O={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,symbol:/[\w*+\-]/};const C={name:"cobol",startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(I,C){if(null==C.indentStack&&I.sol()&&(C.indentation=6),I.eatSpace())return null;var L=null;if("string"===C.mode){for(var D=!1;null!=(D=I.next());)if(('"'==D||"'"==D)&&!I.match(/['"]/,!1)){C.mode=!1;break}L=E}else{var S=I.next(),U=I.column();if(U>=0&&U<=5)L="def";else if(U>=72&&U<=79)I.skipToEnd(),L="header";else if("*"==S&&6==U)I.skipToEnd(),L="comment";else if('"'==S||"'"==S)C.mode="string",L=E;else if("'"!=S||O.digit_or_colon.test(I.peek()))if("."==S)L="link";else if(function(E,T){return"0"===E&&T.eat(/x/i)?(T.eatWhile(O.hex),!0):("+"!=E&&"-"!=E||!O.digit.test(T.peek())||(T.eat(O.sign),E=T.next()),!!O.digit.test(E)&&(T.eat(E),T.eatWhile(O.digit),"."==T.peek()&&(T.eat("."),T.eatWhile(O.digit)),T.eat(O.exponent)&&(T.eat(O.sign),T.eatWhile(O.digit)),!0))}(S,I))L="number";else{if(I.current().match(O.symbol))for(;U<71&&void 0!==I.eat(O.symbol);)U++;L=R&&R.propertyIsEnumerable(I.current().toUpperCase())?"keyword":A&&A.propertyIsEnumerable(I.current().toUpperCase())?"builtin":N&&N.propertyIsEnumerable(I.current().toUpperCase())?T:null}else L=T}return L},indent:function(E){return null==E.indentStack?E.indentation:E.indentStack.indent}};export{C as cobol}; diff --git a/docs/assets/coffeescript-BTDxI-eT.js b/docs/assets/coffeescript-BTDxI-eT.js deleted file mode 100644 index 1163fd9..0000000 --- a/docs/assets/coffeescript-BTDxI-eT.js +++ /dev/null @@ -1 +0,0 @@ -var e="error";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,r=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,o=/^[_A-Za-z$][_A-Za-z$0-9]*/,c=/^@[_A-Za-z$][_A-Za-z$0-9]*/,i=t(["and","or","not","is","isnt","in","instanceof","typeof"]),a=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],f=t(a.concat(["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"]));a=t(a);var p=/^('{3}|\"{3}|['\"])/,s=/^(\/{3}|\/)/,u=t(["Infinity","NaN","undefined","null","true","false","on","off","yes","no"]);function l(t,a){if(t.sol()){null===a.scope.align&&(a.scope.align=!1);var l=a.scope.offset;if(t.eatSpace()){var h=t.indentation();return h>l&&"coffee"==a.scope.type?"indent":h0&&v(t,a)}if(t.eatSpace())return null;var k=t.peek();if(t.match("####"))return t.skipToEnd(),"comment";if(t.match("###"))return a.tokenize=m,a.tokenize(t,a);if("#"===k)return t.skipToEnd(),"comment";if(t.match(/^-?[0-9\.]/,!1)){var g=!1;if(t.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(g=!0),t.match(/^-?\d+\.\d*/)&&(g=!0),t.match(/^-?\.\d+/)&&(g=!0),g)return"."==t.peek()&&t.backUp(1),"number";var y=!1;if(t.match(/^-?0x[0-9a-f]+/i)&&(y=!0),t.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(y=!0),t.match(/^-?0(?![\dx])/i)&&(y=!0),y)return"number"}if(t.match(p))return a.tokenize=d(t.current(),!1,"string"),a.tokenize(t,a);if(t.match(s)){if("/"!=t.current()||t.match(/^.*\//,!1))return a.tokenize=d(t.current(),!0,"string.special"),a.tokenize(t,a);t.backUp(1)}return t.match(n)||t.match(i)?"operator":t.match(r)?"punctuation":t.match(u)?"atom":t.match(c)||a.prop&&t.match(o)?"property":t.match(f)?"keyword":t.match(o)?"variable":(t.next(),e)}function d(e,t,n){return function(r,o){for(;!r.eol();)if(r.eatWhile(/[^'"\/\\]/),r.eat("\\")){if(r.next(),t&&r.eol())return n}else{if(r.match(e))return o.tokenize=l,n;r.eat(/['"\/]/)}return t&&(o.tokenize=l),n}}function m(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=l;break}e.eatWhile("#")}return"comment"}function h(e,t,n="coffee"){for(var r=0,o=!1,c=null,i=t.scope;i;i=i.prev)if("coffee"===i.type||"}"==i.type){r=i.offset+e.indentUnit;break}"coffee"!==n?(o=null,c=e.column()+e.current().length):t.scope.align&&(t.scope.align=!1),t.scope={offset:r,type:n,prev:t.scope,align:o,alignOffset:c}}function v(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var n=e.indentation(),r=!1,o=t.scope;o;o=o.prev)if(n===o.offset){r=!0;break}if(!r)return!0;for(;t.scope.prev&&t.scope.offset!==n;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}const k={name:"coffeescript",startState:function(){return{tokenize:l,scope:{offset:0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(t,n){var r=null===n.scope.align&&n.scope;r&&t.sol()&&(r.align=!1);var o=function(t,n){var r=n.tokenize(t,n),o=t.current();"return"===o&&(n.dedent=!0),(("->"===o||"=>"===o)&&t.eol()||"indent"===r)&&h(t,n);var c="[({".indexOf(o);if(-1!==c&&h(t,n,"])}".slice(c,c+1)),a.exec(o)&&h(t,n),"then"==o&&v(t,n),"dedent"===r&&v(t,n))return e;if(-1!==(c="])}".indexOf(o))){for(;"coffee"==n.scope.type&&n.scope.prev;)n.scope=n.scope.prev;n.scope.type==o&&(n.scope=n.scope.prev)}return n.dedent&&t.eol()&&("coffee"==n.scope.type&&n.scope.prev&&(n.scope=n.scope.prev),n.dedent=!1),"indent"==r||"dedent"==r?null:r}(t,n);return o&&"comment"!=o&&(r&&(r.align=!0),n.prop="punctuation"==o&&"."==t.current()),o},indent:function(e,t){if(e.tokenize!=l)return 0;var n=e.scope,r=t&&"])}".indexOf(t.charAt(0))>-1;if(r)for(;"coffee"==n.type&&n.prev;)n=n.prev;var o=r&&n.type===t.charAt(0);return n.align?n.alignOffset-(o?1:0):(o?n.prev:n).offset},languageData:{commentTokens:{line:"#"}}};export{k as coffeeScript}; diff --git a/docs/assets/colors-bszWmPJw.js b/docs/assets/colors-bszWmPJw.js deleted file mode 100644 index 9cc2e11..0000000 --- a/docs/assets/colors-bszWmPJw.js +++ /dev/null @@ -1 +0,0 @@ -function r(r){for(var e=r.length/6|0,n=new Array(e),t=0;t0){for(o=e[--r];r>0&&(t=o,n=e[--r],o=t+n,i=n-(o-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=o+n,n==t-o&&(o=t))}return o}}function ei(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(et?1:0)}function ti(t,n,i=0,r=1/0,o){if(n=Math.floor(n),i=Math.floor(Math.max(0,i)),r=Math.floor(Math.min(t.length-1,r)),!(i<=n&&n<=r))return t;for(o=void 0===o?ei:function(t=e){if(t===e)return ei;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,n)=>{const i=t(e,n);return i||0===i?i:(0===t(n,n))-(0===t(e,e))}}(o);r>i;){if(r-i>600){const e=r-i+1,a=n-i+1,s=Math.log(e),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(e-u)/e)*(a-e/2<0?-1:1);ti(t,n,Math.max(i,Math.floor(n-a*u/e+l)),Math.min(r,Math.floor(n+(e-a)*u/e+l)),o)}const e=t[n];let a=i,s=r;for(ni(t,i,n),o(t[r],e)>0&&ni(t,i,r);a0;)--s}0===o(t[i],e)?ni(t,i,s):(++s,ni(t,s,r)),s<=n&&(i=s+1),n<=s&&(r=s-1)}return t}function ni(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function ii(e,t,n){if((i=(e=Float64Array.from(Et(e,n))).length)&&!isNaN(t=+t)){if(t<=0||i<2)return mt(e);if(t>=1)return gt(e);var i,r=(i-1)*t,o=Math.floor(r),a=gt(ti(e,o).subarray(0,o+1));return a+(mt(e.subarray(o+1))-a)*(r-o)}}function ri(e,t,n=$t){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,o=Math.floor(r),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(r-o)}}function oi(e,t){return ii(e,.5,t)}function ai(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function si(e,t){let n=0;for(let i of e)(i=+i)&&(n+=i);return n}function ui(e){return e instanceof xn?e:new xn(e)}var li=-.14861,ci=1.78277,fi=-.29227,di=-.90649,hi=1.97294,pi=hi*di,mi=hi*ci,gi=ci*fi-di*li;function yi(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof vi)return new vi(e.h,e.s,e.l,e.opacity);e instanceof Gt||(e=Vt(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(gi*i+pi*t-mi*n)/(gi+pi-mi),o=i-r,a=(hi*(n-r)-fi*o)/di,s=Math.sqrt(a*a+o*o)/(hi*r*(1-r)),u=s?Math.atan2(a,o)*yt-120:NaN;return new vi(u<0?u+360:u,s,r,e.opacity)}(e):new vi(e,t,n,null==i?1:i)}function vi(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function bi(e){return function(t,n){var i=e((t=en(t)).h,(n=en(n)).h),r=tn(t.s,n.s),o=tn(t.l,n.l),a=tn(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=r(e),t.l=o(e),t.opacity=a(e),t+""}}}Yt(vi,yi,Xt(Qt,{brighter(e){return e=null==e?Kt:Math.pow(Kt,e),new vi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Jt:Math.pow(Jt,e),new vi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*vt,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new Gt(255*(t+n*(li*i+ci*r)),255*(t+n*(fi*i+di*r)),255*(t+n*(hi*i)),this.opacity)}}));const xi=bi(Zt);var wi=bi(tn);function _i(e){return function t(n){function i(t,i){var r=e((t=yi(t)).h,(i=yi(i)).h),o=tn(t.s,i.s),a=tn(t.l,i.l),s=tn(t.opacity,i.opacity);return function(e){return t.h=r(e),t.s=o(e),t.l=a(Math.pow(e,n)),t.opacity=s(e),t+""}}return n=+n,i.gamma=t,i}(1)}const Ai=_i(Zt);var ki=_i(tn);function Di(e,t){void 0===t&&(t=e,e=St);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);n{const r=t(e);return i[r]||(i[r]=1,n.push(e)),n},n.remove=e=>{const r=t(e);if(i[r]){i[r]=0;const t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function Ei(e,t){try{await t(e)}catch(n){e.error(n)}}const $i=Symbol("vega_id");let Si=1;function Mi(e){return!(!e||!Bi(e))}function Bi(e){return e[$i]}function zi(e,t){return e[$i]=t,e}function Oi(e){const t=e===Object(e)?e:{data:e};return Bi(t)?t:zi(t,Si++)}function Ni(e){return Ri(e,Oi({}))}function Ri(e,t){for(const n in e)t[n]=e[n];return t}function Ti(e,t){return zi(t,Bi(e))}function Pi(e,t){return e?t?(n,i)=>e(n,i)||Bi(t(n))-Bi(t(i)):(t,n)=>e(t,n)||Bi(t)-Bi(n):null}function ji(e){return e&&e.constructor===Li}function Li(){const e=[],t=[],n=[],i=[],r=[];let o=null,l=!1;return{constructor:Li,insert(t){const n=u(t),i=n.length;for(let r=0;r{p(e)&&(u[Bi(e)]=-1)}));for(f=0,d=e.length;f0&&(y(m,p,h.value),a.modifies(p));for(f=0,d=r.length;f{p(e)&&u[Bi(e)]>0&&y(e,h.field,h.value)})),a.modifies(h.field);if(l)a.mod=t.length||i.length?s.filter((e=>u[Bi(e)]>0)):s.slice();else for(g in c)a.mod.push(c[g]);return(o||null==o&&(t.length||i.length))&&a.clean(!0),a}}}const qi="_:mod:_";function Ui(){Object.defineProperty(this,qi,{writable:!0,value:{}})}Ui.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[qi];return null!=t&&t>=0?(o[t]!==n||i)&&(o[t]=n,a[t+":"+e]=-1,a[e]=-1):(o!==n||i)&&(r[e]=n,a[e]=f(n)?1+n.length:-1),r},modified(e,t){const n=this[qi];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(f(e)){for(let t=0;t=0?t+1{a instanceof Hi?(a!==this&&(t&&a.targets().add(this),o.push(a)),r.push({op:a,name:e,index:n})):i.set(e,n,a)};for(a in e)if(s=e[a],"pulse"===a)u(s).forEach((e=>{e instanceof Hi?e!==this&&(e.targets().add(this),o.push(e)):d("Pulse parameters must be operator instances.")})),this.source=s;else if(f(s))for(i.set(a,-1,Array(l=s.length)),c=0;c{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=Xi();return this.targets().add(Xi(null,null,b(e,(e=>{const n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},between(e,t){let n=!1;return e.targets().add(Xi(null,null,(()=>n=!0))),t.targets().add(Xi(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=p,this._targets=null}};const Ji={skip:!0};function Ki(e,t,n,i,r,o){const u=v({},o,Ji);let l,c;a(n)||(n=s(n)),void 0===i?l=t=>e.touch(n(t)):a(i)?(c=new Hi(null,i,r,!1),l=t=>{c.evaluate(t);const i=n(t),r=c.value;ji(r)?e.pulse(i,r,o):e.update(i,r,u)}):l=t=>e.update(n(t),i,u),t.apply(l)}function Qi(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const u=o||{},l=new Hi(null,function(e,t){return t=a(t)?t:s(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}(n,i),r,!1);l.modified(u.force),l.rank=t.rank,t.targets().add(l),n&&(l.skip(!0),l.value=n.value,l.targets().add(n),e.connect(n,[l]))}}const Zi={};function er(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function tr(e,t){const n=[];return m(e,t,(e=>n.push(e))),n}function nr(e,t){const n={};return e.visit(t,(e=>{n[Bi(e)]=1})),e=>n[Bi(e)]?null:e}function ir(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function rr(e,t,n,i){const r=this;let o=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const a of n)if(a.stamp===t){if(a.fields){const e=r.fields||(r.fields={});for(const t in a.fields)e[t]=1}a.changed(r.ADD)&&(o|=r.ADD),a.changed(r.REM)&&(o|=r.REM),a.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function or(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}er.prototype={StopPropagation:Zi,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new er(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new er(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,nr(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return f(e)?e.forEach((e=>t[e]=!0)):t[e]=!0,this},modified(e,t){const n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?f(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=ir(n.addF,t)),2&e&&(n.remF=ir(n.remF,t)),4&e&&(n.modF=ir(n.modF,t)),16&e&&(n.srcF=ir(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=tr(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=tr(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=tr(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(16&e)return m(n.source,n.srcF,i),n;1&e&&m(n.add,n.addF,i),2&e&&m(n.rem,n.remF,i),4&e&&m(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||m(r,e?nr(n,5):n.srcF,i)}return n}},t(rr,er,{fork(e){const t=new er(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(e=>t.add.push(e))),e&t.REM&&this.visit(t.REM,(e=>t.rem.push(e))),e&t.MOD&&this.visit(t.MOD,(e=>t.mod.push(e)))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?f(e)?e.some((e=>n[e])):n[e]:0},filter(){d("MultiPulse does not support filtering.")},materialize(){d("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let o=0;if(e&n.SOURCE)for(;ot=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),ur(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,function(e,t,n){const i=t,r=e.length,o=e[t];let a,s=1+(t<<1);for(;s=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,ur(e,i,t,n)}(t,0,e)):i=n,i}}}function ur(e,t,n,i){let r,o;const a=e[n];for(;n>t&&(o=n-1>>1,r=e[o],i(a,r)<0);)e[n]=r,n=o;return e[n]=a}function lr(){this.logger(n()),this.logLevel(i),this._clock=0,this._rank=0,this._locale=r();try{this._loader=o()}catch(e){}this._touched=Ci(h),this._input={},this._pulse=null,this._heap=sr(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function cr(e){return function(){return this._log[e].apply(this,arguments)}}function fr(e,t){Hi.call(this,e,null,t)}lr.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:cr("error"),warn:cr("warn"),info:cr("info"),debug:cr("debug"),logLevel:cr("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof Hi?r=e:e&&e.prototype instanceof Hi?r=new e:a(e)?r=new Hi(null,e):(o=0,r=new Hi(e,t)),this.rank(r),o&&(i=n,n=t),n&&this.connect(r,r.parameters(n,i)),this.touch(r),r},connect:function(e,t){const n=e.rank,i=t.length;for(let r=0;r=0;)t.push(n=i[r]),n===e&&d("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||ar);const i=new er(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this},touch:function(e,t){const n=t||ar;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||ar;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:Li,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const n=this.locale();return y(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){const i=this,r=i._pending||function(e){let t;const n=new Promise((e=>t=e));return n.requests=0,n.done=()=>{0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(i);r.requests+=1;const o=await i.request(t,n);return i.pulse(e,i.changeset().remove(p).insert(o.data||[])),r.done(),o},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:g(t&&t.type)});try{i=n.parse(i,t)}catch(o){r=-2,n.warn("Data ingestion failed",e,o)}}catch(o){r=-1,n.warn("Loading failed",e,o)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,o=Xi(n,i),a=function(e){e.dataflow=r;try{o.receive(e)}catch(t){r.error(t)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):u(e);const l=s.length;for(let u=0;ui._enqueue(e,!0))),i._touched=Ci(h);let a,s,u,l=0;try{for(;i._heap.size()>0;)a=i._heap.pop(),a.rank===a.qrank?(s=a.run(i._getPulse(a,e)),s.then?s=await s:s.async&&(r.push(s.async),s=Zi),s!==Zi&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++l):i._enqueue(a,!0)}catch(c){i._heap.clear(),u=c}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${l} operators`),u&&(i._postrun=[],i.error(u)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;ti.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(c){i.error(c)}}))})))),i},run:function(e,t,n){return this._pulse?or(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(i){this.error(i)}},_enqueue:function(e,t){const n=e.stampe.pulse)),t):this._input[e.id]||function(e,t){if(t&&t.stamp===e.stamp)return t;e=e.fork(),t&&t!==Zi&&(e.source=t.source);return e}(this._pulse,n&&n.pulse)}},t(fr,Hi,{run(e){if(e.stampthis.pulse=e)):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const dr={};function hr(e){const t=pr(e);return t&&t.Definition||null}function pr(e){return e=e&&e.toLowerCase(),c(dr,e)?dr[e]:null}function*mr(e,t){if(null==t)for(let n of e)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function gr(t,n,i){const r=Float64Array.from(mr(t,i));return r.sort(e),n.map((e=>ri(r,e)))}function yr(e,t){return gr(e,[.25,.5,.75],t)}function vr(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,o=0;if(void 0===t)for(let a of e)null!=a&&(a=+a)>=a&&(n=a-r,r+=n/++i,o+=n*(a-r));else{let a=-1;for(let s of e)null!=(s=t(s,++a,e))&&(s=+s)>=s&&(n=s-r,r+=n/++i,o+=n*(s-r))}if(i>1)return o/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=yr(e,t),o=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,o)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function br(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,u,l,c,f=e.extent[0],d=e.extent[1];const h=e.span||d-f||Math.abs(f)||1;if(e.step)o=e.step;else if(e.steps){for(u=h/t,l=0,c=e.steps.length;lt;)o*=n;for(l=0,c=r.length;l=s&&h/u<=t&&(o=u)}u=Math.log(o);const p=u>=0?0:1+~~(-u/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(u=Math.floor(f/o+m)*o,f=fe);const r=e.length,o=new Float64Array(r);let a,s=0,u=1,l=i(e[0]),c=l,f=l+t;for(;u=f){for(c=(l+c)/2;s>1);ra;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}const Ar=Math.sqrt(2*Math.PI),kr=Math.SQRT2;let Dr=NaN;function Fr(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(Dr==Dr)r=Dr,Dr=NaN;else{do{r=2*xr()-1,o=2*xr()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,Dr=o*i}return e+r*t}function Cr(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*Ar)}function Er(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let o;if(r>37)o=0;else{const e=Math.exp(-r*r/2);let t;r<7.07106781186547?(t=.0352624965998911*r+.700383064443688,t=t*r+6.37396220353165,t=t*r+33.912866078383,t=t*r+112.079291497871,t=t*r+221.213596169931,t=t*r+220.206867912376,o=e*t,t=.0883883476483184*r+1.75566716318264,t=t*r+16.064177579207,t=t*r+86.7807322029461,t=t*r+296.564248779674,t=t*r+637.333633378831,t=t*r+793.826512519948,t=t*r+440.413735824752,o/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,o=e/t/2.506628274631)}return i>0?1-o:o}function $r(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*kr*function(e){let t,n=-Math.log((1-e)*(1+e));n<6.25?(n-=3.125,t=-364441206401782e-35,t=t*n-16850591381820166e-35,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=t*n-1333171662854621e-31,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=t*n-4054566272975207e-29,t=t*n-8151934197605472e-29,t=26335093153082323e-28+t*n,t=t*n-12975133253453532e-27,t=t*n-5415412054294628e-26,t=1.0512122733215323e-9+t*n,t=t*n-4.112633980346984e-9,t=t*n-2.9070369957882005e-8,t=4.2347877827932404e-7+t*n,t=t*n-13654692000834679e-22,t=t*n-13882523362786469e-21,t=.00018673420803405714+t*n,t=t*n-.000740702534166267,t=t*n-.006033670871430149,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=2.2137376921775787e-9,t=9.075656193888539e-8+t*n,t=t*n-2.7517406297064545e-7,t=1.8239629214389228e-8+t*n,t=15027403968909828e-22+t*n,t=t*n-4013867526981546e-21,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=t*n-47318229009055734e-21,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=t*n-.0003550375203628475,t=.0009532893797373805+t*n,t=t*n-.0016882755560235047,t=.002491442096107851+t*n,t=t*n-.003751208507569241,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=t*n-2.555641816996525e-10,t=1.5076572693500548e-9+t*n,t=t*n-3.789465440126737e-9,t=7.61570120807834e-9+t*n,t=t*n-1.496002662714924e-8,t=2.914795345090108e-8+t*n,t=t*n-6.771199775845234e-8,t=2.2900482228026655e-7+t*n,t=t*n-9.9298272942317e-7,t=4526062597223154e-21+t*n,t=t*n-1968177810553167e-20,t=7599527703001776e-20+t*n,t=t*n-.00021503011930044477,t=t*n-.00013871931833623122,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0;return t*e}(2*e-1)}function Sr(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Fr(n,i),pdf:e=>Cr(e,n,i),cdf:e=>Er(e,n,i),icdf:e=>$r(e,n,i)};return r.mean(e).stdev(t)}function Mr(e,t){const n=Sr();let i=0;const r={data(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},bandwidth(n){return arguments.length?(!(t=n)&&e&&(t=vr(e)),r):t},sample:()=>e[~~(xr()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;aBr(n,i),pdf:e=>zr(e,n,i),cdf:e=>Or(e,n,i),icdf:e=>Nr(e,n,i)};return r.mean(e).stdev(t)}function Tr(e,t){let n,i=0;const r={weights(e){return arguments.length?(n=function(e){const t=[];let n,r=0;for(n=0;n=t&&e<=n?1/(n-t):0}function Lr(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function qr(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Ur(e,t){let n,i;const r={min(e){return arguments.length?(n=e||0,r):n},max(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Pr(n,i),pdf:e=>jr(e,n,i),cdf:e=>Lr(e,n,i),icdf:e=>qr(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function Ir(e,t,n){let i=0,r=0;for(const o of e){const e=n(o);null==t(o)||null==e||isNaN(e)||(i+=(e-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function Wr(e,t,n,i){const r=i-e*e,o=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-o*e,o]}function Hr(e,t,n,i){e=e.filter((e=>{let i=t(e),r=n(e);return null!=i&&(i=+i)>=i&&null!=r&&(r=+r)>=r})),i&&e.sort(((e,n)=>t(e)-t(n)));const r=e.length,o=new Float64Array(r),a=new Float64Array(r);let s,u,l,c=0,f=0,d=0;for(l of e)o[c]=s=+t(l),a[c]=u=+n(l),++c,f+=(s-f)/c,d+=(u-d)/c;for(c=0;c=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function Vr(e,t,n,i,r){let o=0,a=0;return Gr(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function Yr(e,t,n){let i=0,r=0,o=0,a=0,s=0;Gr(e,t,n,((e,t)=>{++s,i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const u=Wr(i,r,o,a),l=e=>u[0]+u[1]*e;return{coef:u,predict:l,rSquared:Vr(e,t,n,r,l)}}function Xr(e,t,n){let i=0,r=0,o=0,a=0,s=0;Gr(e,t,n,((e,t)=>{++s,e=Math.log(e),i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const u=Wr(i,r,o,a),l=e=>u[0]+u[1]*Math.log(e);return{coef:u,predict:l,rSquared:Vr(e,t,n,r,l)}}function Jr(e,t,n){const[i,r,o,a]=Hr(e,t,n);let s,u,l,c=0,f=0,d=0,h=0,p=0;Gr(e,t,n,((e,t)=>{s=i[p++],u=Math.log(t),l=s*t,c+=(t*u-c)/p,f+=(l-f)/p,d+=(l*u-d)/p,h+=(s*l-h)/p}));const[m,g]=Wr(f/a,c/a,d/a,h/a),y=e=>Math.exp(m+g*(e-o));return{coef:[Math.exp(m-g*o),g],predict:y,rSquared:Vr(e,t,n,a,y)}}function Kr(e,t,n){let i=0,r=0,o=0,a=0,s=0,u=0;Gr(e,t,n,((e,t)=>{const n=Math.log(e),l=Math.log(t);++u,i+=(n-i)/u,r+=(l-r)/u,o+=(n*l-o)/u,a+=(n*n-a)/u,s+=(t-s)/u}));const l=Wr(i,r,o,a),c=e=>l[0]*Math.pow(e,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Vr(e,t,n,s,c)}}function Qr(e,t,n){const[i,r,o,a]=Hr(e,t,n),s=i.length;let u,l,c,f,d=0,h=0,p=0,m=0,g=0;for(u=0;ub*(e-=o)*e+x*e+w+a;return{coef:[w-x*o+b*o*o+a,x-2*b*o,b],predict:_,rSquared:Vr(e,t,n,a,_)}}function Zr(e,t,n,i){if(0===i)return Ir(e,t,n);if(1===i)return Yr(e,t,n);if(2===i)return Qr(e,t,n);const[r,o,a,s]=Hr(e,t,n),u=r.length,l=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;dMath.abs(e[i][a])&&(a=r);for(o=i;o=i;o--)e[o][r]-=e[o][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(s=0,o=r+1;o{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d=0;--o)for(s=t[o],u=1,r[o]+=s,a=1;a<=o;++a)u*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*u;return r[0]+=i,r}function to(e,t,n,i){const[r,o,a,s]=Hr(e,t,n,!0),u=r.length,l=Math.max(2,~~(i*u)),c=new Float64Array(u),f=new Float64Array(u),d=new Float64Array(u).fill(1);for(let h=-1;++h<=2;){const e=[0,l-1];for(let n=0;nr[a]-t?i:a;let u=0,l=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-t||1);for(let e=i;e<=a;++e){const n=r[e],i=o[e],a=no(Math.abs(t-n)*g)*d[e],s=n*a;u+=a,l+=s,h+=i*a,p+=i*s,m+=n*s}const[y,v]=Wr(l/u,h/u,p/u,m/u);c[n]=y+v*t,f[n]=Math.abs(o[n]-c[n]),io(r,n+1,e)}if(2===h)break;const t=oi(f);if(Math.abs(t)<1e-12)break;for(let n,i,r=0;r=1?1e-12:(i=1-n*n)*i}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,u=0,l=[];for(;s=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const ro=.5*Math.PI/180;function oo(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],o=t[0],a=t[1],s=a-o,u=s/i,l=[r(o)],c=[];if(n===i){for(let e=1;e0;)c.push(r(o+m/n*s));let f=l[0],d=c[c.length-1];const h=1/s,p=function(e,t){let n=e,i=e;const r=t.length;for(let o=0;oi&&(i=e)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=u&&ao(f,e,d,h,p)>ro?c.push(e):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function ao(e,t,n,i,r){const o=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),a=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(o-a)}function so(e){return e&&e.length?1===e.length?e[0]:(t=e,e=>{const n=t.length;let i=1,r=String(t[0](e));for(;i{},co={init:lo,add:lo,rem:lo,idx:0},fo={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},ho=Object.keys(fo).filter((e=>"__count__"!==e));function po(e,t,n){return fo[e](n,t)}function mo(e,t){return e.idx-t.idx}function go(){this.valid=0,this.missing=0,this._ops.forEach((e=>null==e.aggregate_param?e.init(this):e.init(this,e.aggregate_param)))}function yo(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function vo(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function bo(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function xo(e,t){const n=t||l,i=function(e){const t={};e.forEach((e=>t[e.name]=e));const n=e=>{e.req&&e.req.forEach((e=>{t[e]||n(t[e]=fo[e]())}))};return e.forEach(n),Object.values(t).sort(mo)}(e),r=e.slice().sort(mo);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=go,o.prototype.add=yo,o.prototype.rem=vo,o.prototype.set=bo,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function wo(e){this._key=e?O(e):Bi,this.reset()}[...ho,"__count__"].forEach((e=>{fo[e]=function(e,t){return(n,i)=>v({name:e,aggregate_param:i,out:n||e},co,t)}(e,fo[e])}));const _o=wo.prototype;function Ao(e){fr.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}_o.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},_o.add=function(e){this._add.push(e)},_o.rem=function(e){this._rem.push(e)},_o.values=function(){if(this._get=null,0===this._rem.length)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,o=Array(i-r),a={};let s,u,l;for(s=0;s=0;)i=e(t[r])+"",c(n,i)||(n[i]=1,++o);return o},_o.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=q(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},_o.argmin=function(e){return this.extent(e)[0]||{}},_o.argmax=function(e){return this.extent(e)[1]||{}},_o.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},_o.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},_o.quartile=function(e){return this._get===e&&this._q||(this._q=yr(this.values(),e),this._get=e),this._q},_o.q1=function(e){return this.quartile(e)[0]},_o.q2=function(e){return this.quartile(e)[1]},_o.q3=function(e){return this.quartile(e)[2]},_o.ci=function(e){return this._get===e&&this._ci||(this._ci=wr(this.values(),1e3,.05,e),this._get=e),this._ci},_o.ci0=function(e){return this.ci(e)[0]},_o.ci1=function(e){return this.ci(e)[1]},Ao.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:ho},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},t(Ao,fr,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,(e=>n.add(e)))):(n.value=n.value||n.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter((()=>this.clean())),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map((()=>({}))),r=n.length;function o(e){let t,o,a,s;for(t in e)for(a=e[t].tuple,o=0;o{const t=x(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:so(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],a=e.ops||["count"],s=e.aggregate_params||[null],l=e.as||[],c=o.length,f={};let h,p,m,g,y,v,b;for(c!==a.length&&d("Unmatched number of fields and aggregate ops."),b=0;bxo(e,e.field))),Object.create(null)},cellkey:so(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stampo.push(e),remove:e=>a[i(e)]=++s,size:()=>r.length,data:(e,t)=>(s&&(r=r.filter((e=>!a[i(e)])),a={},s=0),t&&e&&r.sort(e),o.length&&(r=e?N(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function Fo(e){fr.call(this,[],e)}function Co(e){Hi.call(this,null,Eo,e)}function Eo(e){return this.value&&!e.modified()?this.value:P(e.fields,e.orders)}function $o(e){fr.call(this,null,e)}function So(e){fr.call(this,null,e)}ko.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},t(ko,fr,{transform(e,t){const n=!1!==e.interval,i=this._bins(e),r=i.start,o=i.step,a=e.as||["bin0","bin1"],s=a[0],u=a[1];let l;return l=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(w(e.field))?t.ADD_MOD:t.ADD,t.visit(l,n?e=>{const t=i(e);e[s]=t,e[u]=null==t?null:r+o*(1+(t-r)/o)}:e=>e[s]=i(e)),t.modifies(n?a:s)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=br(e),i=n.step;let r,o,a=n.start,s=a+Math.ceil((n.stop-a)/i)*i;null!=(r=e.anchor)&&(o=r-(a+i*Math.floor((r-a)/i)),a+=o,s+=o);const u=function(e){let n=A(t(e));return null==n?null:ns?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return u.start=a,u.stop=n.stop,u.step=i,this.value=_(u,w(t),e.name||"bin_"+x(t))}}),Fo.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},t(Fo,fr,{transform(e,t){const n=t.fork(t.ALL),i=Do(Bi,this.value,n.materialize(n.ADD).add),r=e.sort,o=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(o),this.value=n.source=i.data(Pi(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),t(Co,Hi),$o.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},t($o,fr,{transform(e,t){const n=t=>n=>{for(var i,r=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(s(n),e.case,o)||[],u=0,l=r.length;ur[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],o=t[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let s,u,l;for(s in n)u=i[s],l=n[s]||0,!u&&l?(i[s]=u=Oi({}),u[r]=s,u[o]=l,a.add.push(u)):0===l?(u&&a.rem.push(u),n[s]=null,i[s]=null):u[o]!==l&&(u[o]=l,a.mod.push(u));return a.modifies(t)}}),So.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},t(So,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],o=i[1],a=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,o,a=[],s={},u=e.length,l=0;lzo(e,t)))):typeof i[r]===Bo&&i[r](e[r]);return i}function Oo(e){fr.call(this,null,e)}const No=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Ro={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:No},{name:"weights",type:"number",array:!0}]};function To(e,t){return e?e.map(((e,n)=>t[n]||x(e))):null}function Po(e,t,n){const i=[],r=e=>e(u);let o,a,s,u,l,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;ae.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,o=e.steps||e.maxsteps||200;let a=e.method||"pdf";"pdf"!==a&&"cdf"!==a&&d("Invalid density method: "+a),e.extent||i.data||d("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],u=oo(a,e.extent||k(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],Oi(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});function jo(e){fr.call(this,null,e)}jo.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function Lo(e){Hi.call(this,null,qo,e),this.modified(!0)}function qo(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:_((n=>t(n,e)),w(t),x(t))}function Uo(e){fr.call(this,[void 0,void 0],e)}function Io(e,t){Hi.call(this,e),this.parent=t,this.count=0}function Wo(e){fr.call(this,{},e),this._keys=T();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;nO(e))):O(e.name,e.as)}function Vo(e){fr.call(this,T(),e)}function Yo(e){fr.call(this,[],e)}function Xo(e){fr.call(this,[],e)}function Jo(e){fr.call(this,null,e)}function Ko(e){fr.call(this,[],e)}t(jo,fr,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=Po(t.source,e.groupby,l),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>R(k(e,t))/30)(n,o),s=Pi(((e,t)=>o(e)-o(t))),u=e.as||"bin",c=i.length;let f,d=1/0,h=-1/0,p=0;for(;ph&&(h=t),e[++f][u]=t}return this.value={start:d,stop:h,step:a},t.reflow(!0).modifies(u)}}),t(Lo,Hi),Uo.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},t(Uo,fr,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let o=n[0],a=n[1];if((r||null==o)&&(o=1/0,a=-1/0),t.visit(r?t.SOURCE:t.ADD,(e=>{const t=A(i(e));null!=t&&(ta&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=x(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),t(Io,Hi,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),t(Wo,fr,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=c(r,e)&&r[e];return s?s.value.stampe&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;rthis.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=Bi(e),n=o.get(t);void 0!==n&&(o.delete(t),s(n).rem(e))})),t.visit(t.ADD,(e=>{const t=i(e);o.set(Bi(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=Bi(e),n=o.get(t),r=i(e);n===r?s(r).mod(e):(o.set(t,r),s(n).rem(e),s(r).add(e))})):t.changed(t.MOD)&&t.visit(t.MOD,(e=>{s(o.get(Bi(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=Bi(e),n=o.get(t),r=i(e);n!==r&&(o.set(t,r),s(n).rem(e),s(r).add(e))})),t.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),t}}),t(Ho,Hi),Vo.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},t(Vo,fr,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,u=e.expr;let l=!0;function c(t){const n=Bi(t),r=u(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?l&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=Bi(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{u(t,e)?o.push(t):i.set(Bi(t),1)})),t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),Yo.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},t(Yo,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=To(i,e.as||[]),o=e.index||null,a=r.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{const t=i.map((t=>t(e))),s=t.reduce(((e,t)=>Math.max(e,t.length)),0);let u,l,c,f=0;for(;f{for(let t,o=0;ot[i]=n(t,e)))}}),t(Ko,fr,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,u=e.size-s.length;if(u>0){for(r=[];--u>=0;)r.push(a=Oi(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-u),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-u);return n.source=this.value=s,n}});const Qo={value:"value",median:oi,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let r of e)null!=r&&(r=+r)>=r&&(++n,i+=r);else{let r=-1;for(let o of e)null!=(o=t(o,++r,e))&&(o=+o)>=o&&(++n,i+=o)}if(n)return i/n},min:mt,max:gt},Zo=[];function ea(e){fr.call(this,[],e)}function ta(e){Ao.call(this,e)}function na(e){fr.call(this,null,e)}function ia(e){Hi.call(this,null,ra,e)}function ra(e){return this.value&&!e.modified()?this.value:j(e.fields,e.flat)}function oa(e){fr.call(this,[],e),this._pending=null}function aa(e,t,n){n.forEach(Oi);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function sa(e){fr.call(this,{},e)}function ua(e){Hi.call(this,null,la,e)}function la(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,o=1/0,a=-1/0;for(i=0;ia&&(a=r[1]);return[o,a]}function ca(e){Hi.call(this,null,fa,e)}function fa(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function da(e){fr.call(this,null,e)}function ha(e){Ao.call(this,e)}function pa(e){Wo.call(this,e)}function ma(e){fr.call(this,null,e)}function ga(e){fr.call(this,null,e)}function ya(e){fr.call(this,null,e)}ea.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},t(ea,fr,{transform(e,t){var n,i,r,o,a,s,u,l,c,f,h=t.fork(t.ALL),p=function(e){var t,n=e.method||Qo.value;if(null!=Qo[n])return n===Qo.value?(t=void 0!==e.value?e.value:0,()=>t):Qo[n];d("Unrecognized imputation method: "+n)}(e),m=function(e){const t=e.field;return e=>e?t(e):NaN}(e),g=x(e.field),y=x(e.key),v=(e.groupby||[]).map(x),b=function(e,t,n,i){var r,o,a,s,u,l,c,f,d=e=>e(f),h=[],p=i?i.slice():[],m={},g={};for(p.forEach(((e,t)=>m[e]=t+1)),s=0,c=e.length;sn.add(e)))):(r=n.value=n.value||this.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),n.changes(),t.visit(t.SOURCE,(e=>{v(e,r[n.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n{const n=Mr(t,a)[s],i=e.counts?t.length:1;oo(n,c||k(t),f,h).forEach((e=>{const n={};for(let i=0;i(this._pending=u(e.data),e=>e.touch(this))))}}return n.request(e.url,e.format).then((e=>aa(this,t,u(e.data))))}}),sa.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},t(sa,fr,{transform(e,t){const n=e.fields,i=e.index,r=e.values,o=null==e.default?null:e.default,a=e.modified(),s=n.length;let u,l,c,f=a?t.SOURCE:t.ADD,h=t,p=e.as;return r?(l=r.length,s>1&&!p&&d('Multi-field lookup requires explicit "as" parameter.'),p&&p.length!==s*l&&d('The "as" parameter has too few output field names.'),p=p||r.map(x),u=function(e){for(var t,a,u=0,c=0;ut.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,u),h.modifies(p)}}),t(ua,Hi),t(ca,Hi),t(da,fr,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),ha.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:ho,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},t(ha,Ao,{_transform:Ao.prototype.transform,transform(e,t){return this._transform(function(e,t){const n=e.field,i=e.value,r=("count"===e.op?"__count__":e.op)||"sum",o=w(n).concat(w(i)),a=function(e,t,n){const i={},r=[];return n.visit(n.SOURCE,(t=>{const n=e(t);i[n]||(i[n]=1,r.push(n))})),r.sort(D),t?r.slice(0,t):r}(n,e.limit||0,t);t.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return _((i=>t(i)===e?n(i):NaN),i,e+"")}(e,n,i,o))),as:a.map((e=>e+"")),modified:e.modified.bind(e)}}(e,t),t)}}),t(pa,Wo,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(Bi(e),n,t,e);return(e.modified("field")||i&&t.modified(w(i)))&&d("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,(e=>{const t=r(e);i(e).forEach((e=>t.mod(e)))})),t.visit(t.ADD,(e=>{const t=r(e);i(e).forEach((e=>t.add(Oi(e))))})),t.visit(t.REM,(e=>{const t=r(e);i(e).forEach((e=>t.rem(e)))}))):(t.visit(t.MOD,(e=>r(e).mod(e))),t.visit(t.ADD,(e=>r(e).add(e))),t.visit(t.REM,(e=>r(e).rem(e)))),t.clean()&&t.runAfter((()=>this.clean())),t}}),ma.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},t(ma,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=To(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r{const t=Bi(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,Oi({}));a[Bi(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[Bi(e)]))})),n}}),t(ga,fr,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),ya.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function va(e){fr.call(this,null,e)}function ba(e){fr.call(this,[],e),this.count=0}function xa(e){fr.call(this,null,e)}function wa(e){fr.call(this,null,e),this.modified(!0)}function _a(e){fr.call(this,null,e)}t(ya,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=Po(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(x),a=[],s=e.step||.01,u=e.probs||Ht(s/2,1-1e-14,s),l=u.length;return r.forEach((e=>{const t=gr(e,u);for(let n=0;n{const t=Bi(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Ni(e);i[Bi(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[Bi(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),ba.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},t(ba,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[Bi(t)]=1,e)),{});let a=this.value,s=this.count,u=0;function l(e){let t,i;a.length=u&&(t=a[i],o[Bi(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=Bi(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[Bi(e)]))),(t.rem.length||i)&&a.length{o[Bi(e)]||l(e)})),u=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t{o[Bi(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=a.filter((e=>!o[Bi(e)]))),this.count=s,this.value=n.source=a,n}}),xa.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},t(xa,fr,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Ht(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,Oi(t)})),n.add=t.add.concat(this.value),n}}),t(wa,fr,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const Aa=["unit0","unit1"];function ka(e){fr.call(this,T(),e)}function Da(e){fr.call(this,null,e)}_a.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:U,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Aa}]},t(_a,fr,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?M:B)(o.unit).offset,s=e.as||Aa,u=s[0],l=s[1],c=o.step;let f=o.start||1/0,d=o.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(w(n)))&&(h=(t=t.reflow(!0)).SOURCE,f=1/0,d=-1/0),t.visit(h,(e=>{const t=n(e);let r,s;null==t?(e[u]=null,i&&(e[l]=null)):(e[u]=r=s=o(t),i&&(e[l]=s=a(r,c)),rd&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:u)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:F({extent:e.extent||k(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=C(i),a=this.value||{},s=(n?E:$)(o,r);return s.unit=S(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),t(ka,fr,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,o=e=>r.set(i(e),e);let a=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,o)):t.changed()?(t.visit(t.REM,(e=>r.delete(i(e)))),t.visit(t.ADD,o)):a=!1,this.modified(a),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),t(Da,fr,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(Pi(e.sort)):t.source).map(e.field))}});const Fa={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=Fa.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e0||d("ntile num must be greater than zero.");const n=Fa.cume_dist(),i=n.next;return{init:n.init,next:e=>Math.ceil(t*i(e))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return ie(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||d("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return it=null,next:n=>{const i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;nl[e]=1))}g(e.sort),t.forEach(((e,t)=>{const u=n[t],l=i[t],y=r[t]||null,v=x(u),b=uo(e,v,o[t]);if(g(u),a.push(b),c(Fa,e))s.push(function(e,t,n,i){const r=Fa[e](t,n);return{init:r.init||L,update:function(e,t){t[i]=r.next(e)}}}(e,u,l,b));else{if(null==u&&"count"!==e&&d("Null aggregate field specified."),"count"===e)return void h.push(b);m=!1;let t=f[v];t||(t=f[v]=[],t.field=u,p.push(t)),t.push(po(e,y,b))}})),(h.length||p.length)&&(this.cell=function(e,t,n){e=e.map((e=>xo(e,e.field)));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,o=i.agg=Array(r),a=0;a0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),ie.init())),this.cell&&this.cell.init()},$a.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,o=i&&i.length;let a;if(n){for(a=e.p0;athis.group(r(e));let a=this.state;a&&!n||(a=this.state=new Ea(e)),n||t.modified(a.inputs)?(this.value={},t.visit(t.SOURCE,(e=>o(e).add(e)))):(t.visit(t.REM,(e=>o(e).remove(e))),t.visit(t.ADD,(e=>o(e).add(e))));for(let s=0,u=this._mlen;s=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,l),v[c]=+t(h,c,l),s.point(i?+i(h,c,l):y[c],n?+n(h,c,l):v[c]))}if(p)return s=null,p+""||null}function c(){return Mn().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?$n:En(+e),t="function"==typeof t?t:En(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?Sn:En(+n),l.x=function(t){return arguments.length?(e="function"==typeof t?t:En(+t),i=null,l):e},l.x0=function(t){return arguments.length?(e="function"==typeof t?t:En(+t),l):e},l.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:En(+e),l):i},l.y=function(e){return arguments.length?(t="function"==typeof e?e:En(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t="function"==typeof e?e:En(+e),l):t},l.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:En(+e),l):n},l.lineX0=l.lineY0=function(){return c().x(e).y(t)},l.lineY1=function(){return c().x(e).y(n)},l.lineX1=function(){return c().x(i).y(t)},l.defined=function(e){return arguments.length?(r="function"==typeof e?e:En(!!e),l):r},l.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),l):a},l.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),l):o},l}const Ra={draw(e,t){const n=Bn(t/On);e.moveTo(n,0),e.arc(0,0,n,0,zn)}};function Ta(e,t){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}function Pa(e){return Math.log(e)}function ja(e){return Math.exp(e)}function La(e){return-Math.log(-e)}function qa(e){return-Math.exp(-e)}function Ua(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Ia(e){return(t,n)=>-e(-t,n)}function Wa(e){const t=e(Pa,ja),n=t.domain;let i,r,o=10;function a(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(o),r=function(e){return 10===e?Ua:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=Ia(i),r=Ia(r),e(La,qa)):e(Pa,ja),t}return t.base=function(e){return arguments.length?(o=+e,a()):o},t.domain=function(e){return arguments.length?(n(e),a()):n()},t.ticks=e=>{const t=n();let a=t[0],s=t[t.length-1];const u=s0){for(;f<=d;++f)for(l=1;ls)break;p.push(c)}}else for(;f<=d;++f)for(l=o-1;l>=1;--l)if(c=f>0?l/r(-f):l*r(f),!(cs)break;p.push(c)}2*p.length{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=W(n)).precision||(n.trim=!0),n=H(n)),e===1/0)return n;const a=Math.max(1,o*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*on(_t(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function Ha(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Ga(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Va(e){var t=1,n=e(Ha(t),Ga(t));return n.constant=function(n){return arguments.length?e(Ha(t=+n),Ga(t)):t},Tt(n)}function Ya(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Xa(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Ja(e){return e<0?-e*e:e*e}function Ka(e){var t=e(Lt,Lt),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(Lt,Lt):.5===n?e(Xa,Ja):e(Ya(n),Ya(1/n)):n},Tt(t)}function Qa(){var e=Ka(Pt());return e.copy=function(){return jt(e,Qa()).exponent(e.exponent())},vn.apply(e,arguments),e}function Za(){var e,t,n,i,r,o=0,a=1,s=Lt,u=!1;function l(t){return null==t||isNaN(t=+t)?r:s(0===n?.5:(t=(i(t)-e)*n,u?Math.max(0,Math.min(1,t)):t))}function c(e){return function(t){var n,i;return arguments.length?([n,i]=t,s=e(n,i),l):[s(0),s(1)]}}return l.domain=function(r){return arguments.length?([o,a]=r,e=i(o=+o),t=i(a=+a),n=e===t?0:1/(t-e),l):[o,a]},l.clamp=function(e){return arguments.length?(u=!!e,l):u},l.interpolator=function(e){return arguments.length?(s=e,l):s},l.range=c(St),l.rangeRound=c(Nt),l.unknown=function(e){return arguments.length?(r=e,l):r},function(r){return i=r,e=r(o),t=r(a),n=e===t?0:1/(t-e),l}}function es(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ts(){var e=Tt(Za()(Lt));return e.copy=function(){return es(e,ts())},bn.apply(e,arguments)}function ns(){var e=Ka(Za());return e.copy=function(){return es(e,ns()).exponent(e.exponent())},bn.apply(e,arguments)}function is(){var e,t,n,i,r,o,a,s=0,u=.5,l=1,c=1,f=Lt,d=!1;function h(e){return isNaN(e=+e)?a:(e=.5+((e=+o(e))-t)*(c*e0?i:1:0}const gs="linear",ys="log",vs="pow",bs="sqrt",xs="symlog",ws="time",_s="utc",As="sequential",ks="diverging",Ds="quantile",Fs="quantize",Cs="threshold",Es="ordinal",$s="point",Ss="band",Ms="bin-ordinal",Bs="continuous",zs="discrete",Os="discretizing",Ns="interpolating",Rs="temporal";function Ts(){const e=wn().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,u=0,l=.5;function c(){const e=t().length,c=o[1]h+i*e));return n(c?p.reverse():p)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(o=[+e[0],+e[1]],c()):o.slice()},e.rangeRound=function(e){return o=[+e[0],+e[1]],a=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(a=!!e,c()):a},e.padding=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),s=u,c()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),c()):s},e.paddingOuter=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]o[1-i])?void 0:(u=Math.max(0,qt(a,f)-1),l=f===d?u:qt(a,d)-1,f-a[u]>r+1e-10&&++u,i&&(c=u,u=s-l,l=s-c),u>l?void 0:t().slice(u,l+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Ts().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(u).align(l)},c()}function Ps(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Ps(t())},e}var js=Array.prototype.map;const Ls=Array.prototype.slice;const qs=new Map,Us=Symbol("vega_scale");function Is(e){return e[Us]=!0,e}function Ws(e){return e&&!0===e[Us]}function Hs(e,t,n){return arguments.length>1?(qs.set(e,function(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r=s&&n[o]<=u&&(l<0&&(l=o),i=o);if(!(l<0))return s=e.invertExtent(n[l]),u=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===u[1]?u[0]:u[1]]}}(n):void 0),n.type=e,Is(n)};return i.metadata=ee(u(n)),i}(e,t,n)),this):Gs(e)?qs.get(e):void 0}function Gs(e){return qs.has(e)}function Vs(e,t){const n=qs.get(e);return n&&n.metadata[t]}function Ys(e){return Vs(e,Bs)}function Xs(e){return Vs(e,zs)}function Js(e){return Vs(e,Os)}function Ks(e){return Vs(e,ys)}function Qs(e){return Vs(e,Ns)}function Zs(e){return Vs(e,Ds)}Hs("identity",(function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,Rt),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,Rt):[0,1],Tt(i)})),Hs(gs,Ut,Bs),Hs(ys,(function e(){const t=Wa(Pt()).domain([1,10]);return t.copy=()=>jt(t,e()).base(t.base()),vn.apply(t,arguments),t}),[Bs,ys]),Hs(vs,Qa,Bs),Hs(bs,(function(){return Qa.apply(null,arguments).exponent(.5)}),Bs),Hs(xs,(function e(){var t=Va(Pt());return t.copy=function(){return jt(t,e()).constant(t.constant())},vn.apply(t,arguments)}),Bs),Hs(ws,Ft,[Bs,Rs]),Hs(_s,(function(){return vn.apply(At(Dt,kt,Z,Q,K,J,X,Y,V,G).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Bs,Rs]),Hs(As,ts,[Bs,Ns]),Hs(`${As}-${gs}`,ts,[Bs,Ns]),Hs(`${As}-${ys}`,(function e(){var t=Wa(Za()).domain([1,10]);return t.copy=function(){return es(t,e()).base(t.base())},bn.apply(t,arguments)}),[Bs,Ns,ys]),Hs(`${As}-${vs}`,ns,[Bs,Ns]),Hs(`${As}-${bs}`,(function(){return ns.apply(null,arguments).exponent(.5)}),[Bs,Ns]),Hs(`${As}-${xs}`,(function e(){var t=Va(Za());return t.copy=function(){return es(t,e()).constant(t.constant())},bn.apply(t,arguments)}),[Bs,Ns]),Hs(`${ks}-${gs}`,(function e(){var t=Tt(is()(Lt));return t.copy=function(){return es(t,e())},bn.apply(t,arguments)}),[Bs,Ns]),Hs(`${ks}-${ys}`,(function e(){var t=Wa(is()).domain([.1,1,10]);return t.copy=function(){return es(t,e()).base(t.base())},bn.apply(t,arguments)}),[Bs,Ns,ys]),Hs(`${ks}-${vs}`,rs,[Bs,Ns]),Hs(`${ks}-${bs}`,(function(){return rs.apply(null,arguments).exponent(.5)}),[Bs,Ns]),Hs(`${ks}-${xs}`,(function e(){var t=Va(is());return t.copy=function(){return es(t,e()).constant(t.constant())},bn.apply(t,arguments)}),[Bs,Ns]),Hs(Ds,(function t(){var n,i=[],r=[],o=[];function a(){var e=0,t=Math.max(1,r.length);for(o=new Array(t-1);++e0?o[t-1]:i[0],t=r?[o[r-1],i]:[o[t-1],o[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return e().domain([n,i]).range(a).unknown(t)},vn.apply(Tt(s),arguments)}),Os),Hs(Cs,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[qt(n,e,0,r)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),o):n.slice()},o.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),o):i.slice()},o.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},o.unknown=function(e){return arguments.length?(t=e,o):t},o.copy=function(){return e().domain(n).range(i).unknown(t)},vn.apply(o,arguments)}),Os),Hs(Ms,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(qt(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return js.call(e,A)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Ls.call(e),i):n.slice()},i.tickFormat=function(e,n){return It(t[0],S(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[zs,Os]),Hs(Es,wn,zs),Hs(Ss,Ts,zs),Hs($s,(function(){return Ps(Ts().paddingInner(1))}),zs);const eu=["clamp","base","constant","exponent"];function tu(e,t){const n=t[0],i=S(t)-n;return function(t){return e(n+t*i)}}function nu(e,t,n){return Di(ou(t||"rgb",n),e)}function iu(e,t){const n=new Array(t),i=t+1;for(let r=0;re[t]?a[t](e[t]()):0)),a):s(.5)}function ou(e,t){const n=Fi[function(e){return"interpolate"+e.toLowerCase().split("-").map((e=>e[0].toUpperCase()+e.slice(1))).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function au(e){if(f(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;i1?(uu[e]=t,this):uu[e]}su({accent:as,category10:os,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:ss,observable10:us,paired:ls,pastel1:cs,pastel2:fs,set1:ds,set2:hs,set3:ps,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},au),su({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(e=>nu(au(e))));const cu="symbol",fu=e=>f(e)?e.map((e=>String(e))):String(e),du=(e,t)=>e[1]-t[1],hu=(e,t)=>t[1]-e[1];function pu(e,t,n){let i;return te(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(R(e.domain())/n||1)+1))),ne(t)&&(i=t.step,t=t.interval),ie(t)&&(t=e.type===ws?B(t):e.type==_s?M(t):d("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function mu(e,t,n){let i=e.range(),r=i[0],o=S(i),a=du;if(r>o&&(i=o,o=r,r=i,a=hu),r=Math.floor(r),o=Math.ceil(o),t=t.map((t=>[t,e(t)])).filter((e=>r<=e[1]&&e[1]<=o)).sort(a).map((e=>e[0])),n>0&&t.length>1){const e=[t[0],S(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function gu(e,t){return e.bins?mu(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function yu(e,t,n,i,r,o){const a=t.type;let s=fu;if(a===ws||r===ws)s=e.timeFormat(i);else if(a===_s||r===_s)s=e.utcFormat(i);else if(Ks(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=vu(t,n,!1);s=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();s=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(s=e.format(i));return s}function vu(e,t,n){const i=gu(e,t),r=e.base(),o=Math.log(r),a=Math.max(1,r*t/i.length),s=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/o));return t*r1?i[1]-i[0]:i[0];for(o=1;obu[e.type]||e.bins)(t)?Au(s):"discrete"===i?Du(s):Fu(s)}const Au=e=>(t,n,i)=>{const r=ku(i[n+1],ku(i.max,1/0)),o=Cu(t,e),a=Cu(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},ku=(e,t)=>null!=e?e:t,Du=e=>(t,n)=>n?e(t):null,Fu=e=>t=>e(t),Cu=(e,t)=>Number.isFinite(e)?t(e):null;function Eu(e,t,n,i){const r=i||t.type;return ie(n)&&Vs(r,Rs)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==ws?n||r!==_s?_u(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function $u(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=Eu(e,t,n.format,n.formatType);if(Js(t.type)){const e=wu(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(Xs(t.type)){const e=t.domain(),n=e.length;return`${n} value${1===n?"":"s"}: ${n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ")}`}{const e=t.domain();return`values from ${r(e[0])} to ${r(S(e))}`}}let Su=0;const Mu="p_";function Bu(e){return e&&e.gradient}function zu(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?Mu:"";return r||(r=e.id="gradient_"+Su++,"radial"===i?(e.x1=Ou(e.x1,.5),e.y1=Ou(e.y1,.5),e.r1=Ou(e.r1,0),e.x2=Ou(e.x2,.5),e.y2=Ou(e.y2,.5),e.r2=Ou(e.r2,.5),o=Mu):(e.x1=Ou(e.x1,0),e.y1=Ou(e.y1,0),e.x2=Ou(e.x2,1),e.y2=Ou(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Ou(e,t){return null!=e?e:t}function Nu(e,t){var n,i=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:i,stop:function(e,t){return i.push({offset:e,color:t}),n}}}const Ru={basis:{curve:Qn},"basis-closed":{curve:Kn},"basis-open":{curve:Jn},bundle:{curve:Xn,tension:"beta",value:.85},cardinal:{curve:Yn,tension:"tension",value:0},"cardinal-open":{curve:Vn,tension:"tension",value:0},"cardinal-closed":{curve:Gn,tension:"tension",value:0},"catmull-rom":{curve:Hn,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Wn,tension:"alpha",value:.5},"catmull-rom-open":{curve:In,tension:"alpha",value:.5},linear:{curve:Cn},"linear-closed":{curve:Un},monotone:{horizontal:qn,vertical:Ln},natural:{curve:jn},step:{curve:Pn},"step-after":{curve:Tn},"step-before":{curve:Rn}};function Tu(e,t,n){var i=c(Ru,e)&&Ru[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const Pu={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},ju=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Lu=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,qu=/^((\s+,?\s*)|(,\s*))/,Uu=/^[01]/;function Iu(e){const t=[];return(e.match(ju)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=Pu[i],o=function(e,t,n){const i=[];for(let r=0;t&&r1&&(m=Math.sqrt(m),n*=m,i*=m);const g=d/n,y=f/n,v=-f/i,b=d/i,x=g*s+y*u,w=v*s+b*u,_=g*e+y*t,A=v*e+b*t;let k=1/((_-x)*(_-x)+(A-w)*(A-w))-.25;k<0&&(k=0);let D=Math.sqrt(k);o==r&&(D=-D);const F=.5*(x+_)-D*(A-w),C=.5*(w+A)+D*(_-x),E=Math.atan2(w-C,x-F);let $=Math.atan2(A-C,_-F)-E;$<0&&1===o?$+=Gu:$>0&&0===o&&($-=Gu);const S=Math.ceil(Math.abs($/(Hu+.001))),M=[];for(let B=0;B+e}function dl(e,t,n){return Math.max(t,Math.min(e,n))}function hl(){var e=sl,t=ul,n=ll,i=cl,r=fl(0),o=r,a=r,s=r,u=null;function l(l,c,f){var d,h=null!=c?c:+e.call(this,l),p=null!=f?f:+t.call(this,l),m=+n.call(this,l),g=+i.call(this,l),y=Math.min(m,g)/2,v=dl(+r.call(this,l),0,y),b=dl(+o.call(this,l),0,y),x=dl(+a.call(this,l),0,y),w=dl(+s.call(this,l),0,y);if(u||(u=d=Nn()),v<=0&&b<=0&&x<=0&&w<=0)u.rect(h,p,m,g);else{var _=h+m,A=p+g;u.moveTo(h+v,p),u.lineTo(_-b,p),u.bezierCurveTo(_-al*b,p,_,p+al*b,_,p+b),u.lineTo(_,A-w),u.bezierCurveTo(_,A-al*w,_-al*w,A,_-w,A),u.lineTo(h+x,A),u.bezierCurveTo(h+al*x,A,h,A-al*x,h,A-x),u.lineTo(h,p+v),u.bezierCurveTo(h,p+al*v,h+al*v,p,h+v,p),u.closePath()}if(d)return u=null,d+""||null}return l.x=function(t){return arguments.length?(e=fl(t),l):e},l.y=function(e){return arguments.length?(t=fl(e),l):t},l.width=function(e){return arguments.length?(n=fl(e),l):n},l.height=function(e){return arguments.length?(i=fl(e),l):i},l.cornerRadius=function(e,t,n,i){return arguments.length?(r=fl(e),o=null!=t?fl(t):r,s=null!=n?fl(n):r,a=null!=i?fl(i):o,l):r},l.context=function(e){return arguments.length?(u=null==e?null:e,l):u},l}function pl(){var e,t,n,i,r,o,a,s,u=null;function l(e,t,n){const i=n/2;if(r){var l=a-t,c=e-o;if(l||c){var f=Math.hypot(l,c),d=(l/=f)*s,h=(c/=f)*s,p=Math.atan2(c,l);u.moveTo(o-d,a-h),u.lineTo(e-l*i,t-c*i),u.arc(e,t,i,p-Math.PI,p),u.lineTo(o+d,a+h),u.arc(o,a,s,p,p+Math.PI)}else u.arc(e,t,i,0,Gu);u.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==u&&(u=c=Nn()),a=0;a<=f;++a)!(ae.x||0,yl=e=>e.y||0,vl=e=>!(!1===e.defined),bl=kn().startAngle((e=>e.startAngle||0)).endAngle((e=>e.endAngle||0)).padAngle((e=>e.padAngle||0)).innerRadius((e=>e.innerRadius||0)).outerRadius((e=>e.outerRadius||0)).cornerRadius((e=>e.cornerRadius||0)),xl=Na().x(gl).y1(yl).y0((e=>(e.y||0)+(e.height||0))).defined(vl),wl=Na().y(yl).x1(gl).x0((e=>(e.x||0)+(e.width||0))).defined(vl),_l=Mn().x(gl).y(yl).defined(vl),Al=hl().x(gl).y(yl).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>ml(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>ml(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>ml(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>ml(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),kl=function(e,t){let n=null,i=Dn(r);function r(){let r;if(n||(n=r=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return e="function"==typeof e?e:En(e||Ra),t="function"==typeof t?t:En(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:En(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:En(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>rl(e.shape||"circle"))).size((e=>ml(e.size,64))),Dl=pl().x(gl).y(yl).defined(vl).size((e=>e.size||1));function Fl(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Cl(e,t,n,i){return Al.context(e)(t,n,i)}var El=1;function $l(){El=1}function Sl(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+El++),s=r.clipping[o]||(r.clipping[o]={id:o});return a(i)?s.path=i(null):Fl(n)?s.path=Cl(null,n,0,0):(s.width=n.width||0,s.height=n.height||0),"url(#"+o+")"}function Ml(e){this.clear(),e&&this.union(e)}function Bl(e){this.mark=e,this.bounds=this.bounds||new Ml}function zl(e){Bl.call(this,e),this.items=this.items||[]}Ml.prototype={clone(){return new Ml(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:o,y2:a}=this,s=Math.cos(e),u=Math.sin(e),l=t-t*s+n*u,c=n-t*u-n*s;return[s*i-u*r+l,u*i+s*r+c,s*i-u*a+l,u*i+s*a+c,s*o-u*r+l,u*o+s*r+c,s*o-u*a+l,u*o+s*a+c]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},t(zl,Bl);class Ol{constructor(e){this._pending=0,this._loader=e||o()}pending(){return this._pending}sanitizeURL(e){const t=this;return Nl(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Rl(t),e))).catch((()=>(Rl(t),null)))}loadImage(e){const t=this,n="undefined"!=typeof Image?Image:null;return Nl(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=c(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>Rl(t),r.onerror=()=>Rl(t),r.src=i,r})).catch((e=>(Rl(t),{complete:!1,width:0,height:0,src:e&&e.url||""})))}ready(){const e=this;return new Promise((t=>{!function n(i){e.pending()?setTimeout((()=>{n(!0)}),10):t(i)}(!1)}))}}function Nl(e){e._pending+=1}function Rl(e){e._pending-=1}function Tl(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}const Pl=Gu-1e-8;let jl,Ll,ql,Ul,Il,Wl,Hl,Gl;const Vl=(e,t)=>jl.add(e,t),Yl=(e,t)=>Vl(Ll=e,ql=t),Xl=e=>Vl(e,jl.y1),Jl=e=>Vl(jl.x1,e),Kl=(e,t)=>Il*e+Hl*t,Ql=(e,t)=>Wl*e+Gl*t,Zl=(e,t)=>Vl(Kl(e,t),Ql(e,t)),ec=(e,t)=>Yl(Kl(e,t),Ql(e,t));function tc(e,t){return jl=e,t?(Ul=t*Wu,Il=Gl=Math.cos(Ul),Wl=Math.sin(Ul),Hl=-Wl):(Il=Gl=1,Ul=Wl=Hl=0),nc}const nc={beginPath(){},closePath(){},moveTo:ec,lineTo:ec,rect(e,t,n,i){Ul?(Zl(e+n,t),Zl(e+n,t+i),Zl(e,t+i),ec(e,t)):(Vl(e+n,t+i),Yl(e,t))},quadraticCurveTo(e,t,n,i){const r=Kl(e,t),o=Ql(e,t),a=Kl(n,i),s=Ql(n,i);ic(Ll,r,a,Xl),ic(ql,o,s,Jl),Yl(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=Kl(e,t),s=Ql(e,t),u=Kl(n,i),l=Ql(n,i),c=Kl(r,o),f=Ql(r,o);rc(Ll,a,u,c,Xl),rc(ql,s,l,f,Jl),Yl(c,f)},arc(e,t,n,i,r,o){if(i+=Ul,r+=Ul,Ll=n*Math.cos(r)+e,ql=n*Math.sin(r)+t,Math.abs(r-i)>Pl)Vl(e-n,t-n),Vl(e+n,t+n);else{const a=i=>Vl(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,u;if(a(i),a(r),r!==i)if((i%=Gu)<0&&(i+=Gu),(r%=Gu)<0&&(r+=Gu),rr;++u,s-=Hu)a(s);else for(s=i-i%Hu+Hu,u=0;u<4&&s1e-14?(u=a*a+s*o,u>=0&&(u=Math.sqrt(u),l=(-a+u)/o,c=(-a-u)/o)):l=.5*s/a,0g)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(e.globalAlpha=n,e.fillStyle=gc(e,t,t.fill),!0)}var vc=[];function bc(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=gc(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||vc),e.lineDashOffset=t.strokeDashOffset||0),!0))}function xc(e,t){return e.zindex-t.zindex||e.index-t.index}function wc(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n=0;)if(n=t(r[i]))return n;if(r===o)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function kc(e){return function(t,n,i){_c(n,(n=>{i&&!i.intersects(n.bounds)||Dc(e,t,n,n)}))}}function Dc(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(hc(t,n),n.fill&&yc(t,n,r)&&t.fill(),n.stroke&&bc(t,n,r)&&t.stroke()))}function Fc(e){return e=e||p,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,Ac(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return e(t,n,i,r,o,a)?n:void 0}))}}function Cc(e,t){return function(n,i,r,o){var a,s,u=Array.isArray(i)?i[0]:i,l=null==t?u.fill:t,c=u.stroke&&n.isPointInStroke;return c&&(a=u.strokeWidth,s=u.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(l&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Ec(e){return Fc(Cc(e))}function $c(e,t){return"translate("+e+","+t+")"}function Sc(e){return"rotate("+e+")"}function Mc(e){return $c(e.x||0,e.y||0)}function Bc(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,o=n.angle||0;e.translate(i,r),o&&e.rotate(o*=Wu),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return $c(e.x||0,e.y||0)+(e.angle?" "+Sc(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(tc(e,n.angle),n),Tl(e,n).translate(n.x||0,n.y||0)},draw:kc(i),pick:Ec(i),isect:n||uc(i)}}var zc=Bc("arc",(function(e,t){return bl.context(e)(t)}));function Oc(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=Cc(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(tc(e),i),Tl(e,i[0]))},draw:(o=i,function(e,t,n){!t.items.length||n&&!n.intersects(t.bounds)||Dc(o,e,t.items[0],t.items)}),pick:function(e,t,n,i,o,a){var s=t.items,u=t.bounds;return!s||!s.length||u&&!u.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:lc,tip:n};var o}var Nc=Oc("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?wl:xl).curve(Tu(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,s=1/0;--a>=0;)!1!==e[a].defined&&(i=Math.abs(e[a][o]-r)).5&&t<1.5?.5-Math.abs(t-1):0}function Pc(e,t){const n=Tc(t);e("d",Cl(null,t,n,n))}function jc(e,t,n,i){const r=Tc(t);e.beginPath(),Cl(e,t,(n||0)+r,(i||0)+r)}const Lc=Cc(jc),qc=Cc(jc,!1),Uc=Cc(jc,!0);var Ic={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Mc(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t{const r=t.x||0,o=t.y||0,a=t.strokeForeground,s=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&s&&(jc(e,t,r,o),hc(e,t),t.fill&&yc(e,t,s)&&e.fill(),t.stroke&&!a&&bc(e,t,s)&&e.stroke()),e.save(),e.translate(r,o),t.clip&&Rc(e,t),n&&n.translate(-r,-o),_c(t,(t=>{("group"===t.marktype||null==i||i.includes(t.marktype))&&this.draw(e,t,n,i)})),n&&n.translate(r,o),e.restore(),a&&t.stroke&&s&&(jc(e,t,r,o),hc(e,t),bc(e,t,s)&&e.stroke())}))},pick:function(e,t,n,i,r,o){if(t.bounds&&!t.bounds.contains(r,o)||!t.items)return null;const a=n*e.pixelRatio,s=i*e.pixelRatio;return Ac(t,(u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(r,o))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),p=f+(u.height||0),m=u.clip;if(m&&(rh||op))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&Fl(u)&&!Uc(e,u,a,s))return e.restore(),null;const g=u.strokeForeground,y=!1!==t.interactive;return y&&g&&u.stroke&&qc(e,u,a,s)?(e.restore(),u):(l=Ac(u,(e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,f)?this.pick(e,n,i,c,f):null)),!l&&y&&(u.fill||!g&&u.stroke)&&Lc(e,u,a,s)&&(l=u),e.restore(),l||null)}))},isect:cc,content:function(e,t,n){e("clip-path",t.clip?Sl(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Pc(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Pc(e,t):e("d","")}},Wc={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Hc(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((t=>{e.image=t,e.image.url=e.url}))),n}function Gc(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function Vc(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function Yc(e,t){return"center"===e?t/2:"right"===e?t:0}function Xc(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var Jc={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=Hc(t,n),r=Gc(t,i),o=Vc(t,i),a=(t.x||0)-Yc(t.align,r),s=(t.y||0)-Xc(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",Wc["xmlns:xlink"],"xlink:href"),e("transform",$c(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=Gc(t,n),r=Vc(t,n),o=(t.x||0)-Yc(t.align,i),a=(t.y||0)-Xc(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){_c(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=Hc(t,this);let r=Gc(t,i),o=Vc(t,i);if(0===r||0===o)return;let a,s,u,l,c=(t.x||0)-Yc(t.align,r),f=(t.y||0)-Xc(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,u=t.width/t.height,s==s&&u==u&&s!==u&&(u=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&nf(e,t,i)&&(hc(e,t),e.stroke())}}))},pick:Fc((function(e,t,n,i){return!!e.isPointInStroke&&(nf(e,t,1)&&e.isPointInStroke(n,i))})),isect:fc},of=Bc("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),af=Bc("symbol",(function(e,t){return kl.context(e)(t)}),lc);const sf=re();var uf={height:pf,measureWidth:df,estimateWidth:cf,width:cf,canvas:lf};function lf(e){uf.width=e&&ac?df:cf}function cf(e,t){return ff(vf(e,t),pf(e))}function ff(e,t){return~~(.8*e.length*t)}function df(e,t){return pf(e)<=0||!(t=vf(e,t))?0:hf(t,xf(e))}function hf(e,t){const n=`(${t}) ${e}`;let i=sf.get(n);return void 0===i&&(ac.font=t,i=ac.measureText(e).width,sf.set(n,i)),i}function pf(e){return null!=e.fontSize?+e.fontSize||0:11}function mf(e){return null!=e.lineHeight?e.lineHeight:pf(e)+2}function gf(e){return t=e.lineBreak&&e.text&&!f(e.text)?e.text.split(e.lineBreak):e.text,f(t)?t.length>1?t:t[0]:t;var t}function yf(e){const t=gf(e);return(f(t)?t.length-1:0)*mf(e)}function vf(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(uf.width===df){const t=xf(e);return e=>hf(e,t)}if(uf.width===cf){const t=pf(e);return e=>ff(e,t)}return t=>uf.width(e,t)}(e);if(i(t)>>1,i(t.slice(r))>n?s=r+1:u=r;return o+t.slice(s)}for(;s>>1),i(t.slice(0,r))Math.max(e,uf.width(t,n))),0)):i=uf.width(t,d),"center"===o?l-=i/2:"right"===o&&(l-=i),e.set(l+=s,c+=u,l+i,c+r),t.angle&&!n)e.rotate(t.angle*Wu,s,u);else if(2===n)return e.rotatedPoints(t.angle*Wu,s,u);return e}var Ff={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+wf(t),o=kf(t),a=o.x1,s=o.y1,u=t.angle||0;e("text-anchor",_f[t.align]||"start"),u?(n=$c(a,s)+" "+Sc(u),(i||r)&&(n+=" "+$c(i,r))):n=$c(a+i,s+r),e("transform",n)},bound:Df,draw:function(e,t,n){_c(t,(t=>{var i,r,o,a,s,u,l,c=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===c||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=xf(t),e.textAlign=t.align||"left",r=(i=kf(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*Wu),r=o=0),r+=t.dx||0,o+=(t.dy||0)+wf(t),u=gf(t),hc(e,t),f(u))for(s=mf(t),a=0;a=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null}))};function Ef(e,t,n){var i=Cf[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new Ml),e,n)}var $f={mark:null};function Sf(e,t,n){var i,r,o,a,s=Cf[e.marktype],u=s.bound,l=e.items,c=l&&l.length;if(s.nested)return c?o=l[0]:($f.mark=e,o=$f),a=Ef(o,u,n),t=t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new Ml,c)for(i=0,r=l.length;it;)e.removeChild(n[--i]);return e}function qf(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Uf(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}class If{constructor(e,t){this._active=null,this._handlers={},this._loader=e||o(),this._tooltip=t||Wf}initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()}scene(e){return arguments.length?(this._scene=e,this):this._scene}on(){}off(){}_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1}handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const i in t)n.push(...t[i]);return n}eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then((t=>{const n=new MouseEvent(e.type,e),i=Tf(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)})).catch((()=>{}))}handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,o,a=e&&e.mark;if(a&&(r=Cf[a.marktype]).tip){for((o=Uf(t,n))[0]-=i[0],o[1]-=i[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=r.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}}getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,o=r.width(),a=r.height();let s=r.x1+i[0]+n.left,u=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,u+=e.y||0;return{x:s,y:u,width:o,height:a,left:s,top:u,right:s+o,bottom:u+a}}}function Wf(e,t,n,i){e.element().setAttribute("title",i||"")}class Hf{constructor(e){this._el=null,this._bgcolor=null,this._loader=new Ol(e)}initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this}dirty(){}render(e,t){const n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){const n=this.render(e,t);return this._ready?this._ready.then((()=>n)):Promise.resolve(n)}_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then((t=>{t&&e(),n._ready=null}))}return i}sanitizeURL(e){return this._load("sanitizeURL",e)}loadImage(e){return this._load("loadImage",e)}}const Gf="dragenter",Vf="dragleave",Yf="dragover",Xf="pointerdown",Jf="pointermove",Kf="pointerout",Qf="pointerover",Zf="mousedown",ed="mousemove",td="mouseout",nd="mouseover",id="click",rd="mousewheel",od="touchstart",ad="touchmove",sd="touchend",ud=["keydown","keypress","keyup",Gf,Vf,Yf,Xf,"pointerup",Jf,Kf,Qf,Zf,"mouseup",ed,td,nd,id,"dblclick","wheel",rd,od,ad,sd],ld=Jf,cd=td,fd=id;class dd extends If{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=ud,this.pointermove=gd([Jf,ed],[Qf,nd],[Kf,td]),this.dragover=gd([Yf],[Gf],[Vf]),this.pointerout=yd([Kf,td]),this.dragleave=yd([Vf])}initialize(e,t,n){return this._canvas=e&&Pf(e,"canvas"),[id,Zf,Xf,Jf,Kf,Vf].forEach((e=>pd(this,e))),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(e){this.fire(rd,e)}pointerdown(e){this._down=this._active,this.fire(Xf,e)}mousedown(e){this._down=this._active,this.fire(Zf,e)}click(e){this._down===this._active&&(this.fire(id,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(od,e,!0)}touchmove(e){this.fire(ad,e,!0)}touchend(e){this.fire(sd,e,!0),this._touch=null}fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===fd&&i&&i.href?this.handleHref(t,i,i.href):e!==ld&&e!==cd||this.handleTooltip(t,i,e!==cd),r)for(let o=0,a=r.length;o=0&&i.splice(r,1),this}pickEvent(e){const t=Uf(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,i,r){const o=this.context();return Cf[e.marktype].pick.call(this,o,e,t,n,i,r)}}const hd=e=>e===od||e===ad||e===sd?[od,ad,sd]:[e];function pd(e,t){hd(t).forEach((t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t)))}function md(e,t,n){t.forEach((t=>e.fire(t,n)))}function gd(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||md(this,n,i),this._active=o,md(this,t,i)),md(this,e,i)}}function yd(e){return function(t){md(this,e,t),this._active=null}}function vd(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),u=a?"undefined"!=typeof window&&window.devicePixelRatio||1:r;e.width=t*u,e.height=n*u;for(const l in o)s[l]=o[l];return a&&1!==u&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=u,s.setTransform(u,0,0,u,u*i[0],u*i[1]),e}class bd extends Hf{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new Ml,this._tempb=new Ml}initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:Ta(1,1,this._options.type),e&&this._canvas&&(Lf(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(e,t,n,i,r)}resize(e,t,n,i){if(super.resize(e,t,n,i),this._canvas)vd(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||d("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){const n=this.context(),i=this._origin,r=this._width,o=this._height,a=this._dirty,s=xd(i,r,o);n.save();const u=this._redraw||a.empty()?(this._redraw=!1,s.expand(1)):function(e,t,n){t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio);return t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(n,s.intersect(a),i);return this.clear(-i[0],-i[1],r,o),this.draw(n,e,u,t),n.restore(),a.clear(),this}draw(e,t,n,i){if("group"!==t.marktype&&null!=i&&!i.includes(t.marktype))return;const r=Cf[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),a(n)?(e.beginPath(),n(e),e.clip()):Rc(e,t.group)}(e,t),r.draw.call(this,e,t,n,i),t.clip&&e.restore()}clear(e,t,n,i){const r=this._options,o=this.context();"pdf"===r.type||r.externalContext||o.clearRect(e,t,n,i),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(e,t,n,i))}}const xd=(e,t,n)=>(new Ml).set(0,0,t,n).translate(-e[0],-e[1]);class wd extends If{constructor(e,t){super(e,t);const n=this;n._hrefHandler=_d(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=_d(n,((e,t)=>{n.handleTooltip(e,t,e.type!==cd)}))}initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(fd,this._hrefHandler),i.removeEventListener(ld,this._tooltipHandler),i.removeEventListener(cd,this._tooltipHandler)),this._svg=i=e&&Pf(e,"svg"),i&&(i.addEventListener(fd,this._hrefHandler),i.addEventListener(ld,this._tooltipHandler),i.addEventListener(cd,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:_d(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this}off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}}const _d=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)},Ad="aria-hidden",kd="aria-label",Dd="role",Fd="aria-roledescription",Cd="graphics-object",Ed="graphics-symbol",$d=(e,t,n)=>({[Dd]:e,[Fd]:t,[kd]:n||void 0}),Sd=ee(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Md={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Rd(e):null,r=e.context,o=r.scales[t.scale].value,a=r.dataflow.locale(),s=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(i?` titled '${i}'`:"")+` for a ${Xs(s)?"discrete":s} scale with ${$u(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Rd(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,u=a.dataflow.locale();return l=i,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+` for ${function(e){return e=e.map((e=>e+("fill"===e||"stroke"===e?" color":""))),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+S(e)}(o)} with ${$u(u,s,e)}`;var l}},"title-text":{desc:"title",caption:e=>`Title text '${Nd(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Nd(e)}'`}},Bd={ariaRole:Dd,ariaRoleDescription:Fd,description:kd};function zd(e,t){const n=!1===t.aria;if(e(Ad,n||void 0),n||null==t.description)for(const i in Bd)e(Bd[i],void 0);else{const n=t.mark.marktype;e(kd,t.description),e(Dd,t.ariaRole||("group"===n?Cd:Ed)),e(Fd,t.ariaRoleDescription||`${n} mark`)}}function Od(e){return!1===e.aria?{[Ad]:!0}:Sd[e.role]?null:Md[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return $d(t.role||Ed,t.desc,n.description||i(n))}catch(n){return null}}(e,Md[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return $d(n?Cd:Ed,`${t} mark container`,e.description)}(e)}function Nd(e){return u(e.text).join(" ")}function Rd(e){try{return u(S(e.items).items[0].text).join(" ")}catch(t){return null}}const Td=e=>(e+"").replace(/&/g,"&").replace(//g,">");function Pd(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>{var i;return null!=n&&(t+=` ${e}="${i=n,Td(i).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ")}"`),a},a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var u=arguments.length,l=new Array(u>1?u-1:0),c=1;c${n}`:"/>"):``,r(),a},attr:o,text:e=>(n+=Td(e),a),toString:()=>e};return a}const jd=e=>Ld(Pd(),e)+"";function Ld(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(u=i.items[0],u._svg&&this._update(o,u._svg,u)):n._svg&&(u=n._svg.parentNode,u&&u.removeChild(n._svg)),n._svg=null):(n=o.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,Vd(n,t)),n._update=t)));return!this._dirtyAll}mark(e,t,n,i){if(!this.isDirty(t))return t._svg;const r=this._svg,o=t.marktype,a=Cf[o],s=!1===t.interactive?"none":null,u="g"===a.tag,l=Jd(t,e,n,"g",r);if("group"!==o&&null!=i&&!i.includes(o))return Lf(l,0),t._svg;l.setAttribute("class",qf(t));const c=Od(t);for(const p in c)ih(l,p,c[p]);u||ih(l,"pointer-events",s),ih(l,"clip-path",t.clip?Sl(this,t,t.group):null);let f=null,d=0;const h=e=>{const t=this.isDirty(e),n=Jd(e,l,f,a.tag,r);t&&(this._update(a,n,e),u&&function(e,t,n,i){t=t.lastChild.previousSibling;let r,o=0;_c(n,(n=>{r=e.mark(t,n,r,i),++o})),Lf(t,1+o)}(this,n,e,i)),f=n,++d};return a.nested?t.items.length&&h(t.items[0]):_c(t,h),Lf(l,d),l}_update(e,t,n){Kd=t,Qd=t.__values__,zd(eh,n),e.attr(eh,n,this);const i=Zd[e.type];i&&i.call(this,e,t,n),Kd&&this.style(Kd,n)}style(e,t){if(null!=t){for(const n in qd){let i="font"===n?bf(t):t[n];if(i===Qd[n])continue;const r=qd[n];null==i?e.removeAttribute(r):(Bu(i)&&(i=zu(i,this._defs.gradient,rh())),e.setAttribute(r,i+"")),Qd[n]=i}for(const n in Ud)th(e,Ud[n],t[n])}}defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=jf(e,1,"defs",Hd)),i=Yd(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=jf(e,1,"defs",Hd)),i=Xd(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):Lf(n,i))}_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}}function Vd(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function Yd(e,t,n){let i,r,o;if("radial"===t.gradient){let i=jf(e,n++,"pattern",Hd);nh(i,{id:Mu+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=jf(i,0,"rect",Hd),nh(i,{width:1,height:1,fill:`url(${rh()}#${t.id})`}),nh(e=jf(e,n++,"radialGradient",Hd),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else nh(e=jf(e,n++,"linearGradient",Hd),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}let Kd=null,Qd=null;const Zd={group(e,t,n){const i=Kd=t.childNodes[2];Qd=i.__values__,e.foreground(eh,n,this),Qd=t.__values__,Kd=t.childNodes[1],e.content(eh,n,this);const r=Kd=t.childNodes[0];e.background(eh,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==Qd.events&&(ih(i,"pointer-events",o),ih(r,"pointer-events",o),Qd.events=o),n.strokeForeground&&n.stroke){const e=n.fill;ih(i,"display",null),this.style(r,n),ih(r,"stroke",null),e&&(n.fill=null),Qd=i.__values__,this.style(i,n),e&&(n.fill=e),Kd=null}else ih(i,"display","none")},image(e,t,n){!1===n.smooth?(th(t,"image-rendering","optimizeSpeed"),th(t,"image-rendering","pixelated")):th(t,"image-rendering",null)},text(e,t,n){const i=gf(n);let r,o,a,s;f(i)?(o=i.map((e=>vf(n,e))),r=o.join("\n"),r!==Qd.text&&(Lf(t,0),a=t.ownerDocument,s=mf(n),o.forEach(((e,i)=>{const r=Tf(a,"tspan",Hd);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),Qd.text=r)):(o=vf(n,i),o!==Qd.text&&(t.textContent=o,Qd.text=o)),ih(t,"font-family",bf(n)),ih(t,"font-size",pf(n)+"px"),ih(t,"font-style",n.fontStyle),ih(t,"font-variant",n.fontVariant),ih(t,"font-weight",n.fontWeight)}};function eh(e,t,n){t!==Qd[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(Kd,e,t,n):ih(Kd,e,t),Qd[e]=t)}function th(e,t,n){n!==Qd[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Qd[t]=n)}function nh(e,t){for(const n in t)ih(e,n,t[n])}function ih(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function rh(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class oh extends Hf{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){const t=Pd();t.open("svg",v({},Wc,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",Id,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this}mark(e,t){const n=Cf[t.marktype],i=n.tag,r=[zd,n.attr];e.open("g",{class:qf(t),"clip-path":t.clip?Sl(this,t,t.group):null},Od(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&e.open("a",a),e.open(i,this.attr(t,o,r,"g"!==i?i:null)),"text"===i){const t=gf(o);if(f(t)){const n={x:0,dy:mf(o)};for(let i=0;ithis.mark(e,t))),e.close(),i&&a?(r&&(o.fill=null),o.stroke=a,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),r&&(o.fill=r)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),a&&e.close()};return n.nested?t.items&&t.items.length&&o(t.items[0]):_c(t,o),e.close()}href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e}))}return null}attr(e,t,n,i){const r={},o=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach((e=>e(o,t,this))):n(o,t,this),i&&function(e,t,n,i,r){let o;if(null==t)return e;"bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none");if("bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===i&&(e["font-family"]=bf(t),e["font-size"]=pf(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const a in qd){let n=t[a];const i=qd[a];("transparent"!==n||"fill"!==i&&"stroke"!==i)&&null!=n&&(Bu(n)&&(n=zu(n,r.gradient,"")),e[i]=n)}for(const a in Ud){const e=t[a];null!=e&&(o=o||[],o.push(`${Ud[a]}: ${e};`))}o&&(e.style=o.join(" "))}(r,t,e,i,this._defs),r}defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:Mu+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t!ah.svgMarkTypes.includes(e)));this._svgRenderer.render(e,ah.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,i){return super.resize(e,t,n,i),this._svgRenderer.resize(e,t,n,i),this._canvasRenderer.resize(e,t,n,i),this}background(e){return ah.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}}class uh extends dd{constructor(e,t){super(e,t)}initialize(e,t,n){const i=jf(jf(e,0,"div"),ah.svgOnTop?0:1,"div");return super.initialize(i,t,n)}}const lh="canvas",ch="hybrid",fh="none",dh={Canvas:lh,PNG:"png",SVG:"svg",Hybrid:ch,None:fh},hh={};function ph(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(hh[e]=t,this):hh[e]}function mh(e,t,n){const i=[],r=(new Ml).union(t),o=e.marktype;return o?gh(e,r,n,i):"group"===o?yh(e,r,n,i):d("Intersect scene must be mark node or group item.")}function gh(e,t,n,i){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){const r=e.items,o=e.marktype,a=r.length;let s=0;if("group"===o)for(;s=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!wh(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function _h(e,t){return wh(Iu(e),Iu(t))}const Ah="top",kh="left",Dh="right",Fh="bottom",Ch="start",Eh="middle",$h="end",Sh="group",Mh="axis",Bh="title",zh="frame",Oh="scope",Nh="legend",Rh="row-header",Th="row-footer",Ph="row-title",jh="column-header",Lh="column-footer",qh="column-title",Uh="padding",Ih="fit",Wh="fit-x",Hh="fit-y",Gh="none",Vh="all",Yh="each",Xh="flush",Jh="column",Kh="row";function Qh(e){fr.call(this,null,e)}function Zh(e,t,n){return t(e.bounds.clear(),e,n)}t(Qh,fr,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=Cf[r],a=o.bound;let s,u=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),u=Zh(i,a),i.items.forEach((e=>{e.bounds.clear().union(u)}));else if(r===Sh||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),u.clear(),i.items.forEach((e=>u.union(Zh(e,a)))),i.role){case Mh:case Nh:case Bh:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{u.union(Zh(e,a))})),t.visit(t.MOD,(e=>{s=s||u.alignsWith(e.bounds),n.dirty(e),u.union(Zh(e,a))})),s&&(u.clear(),i.items.forEach((e=>u.union(e.bounds))));return xh(i),t.modifies("bounds")}});const ep=":vega_identifier:";function tp(e){fr.call(this,0,e)}function np(e){fr.call(this,null,e)}function ip(e){fr.call(this,null,e)}tp.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},t(tp,fr,{transform(e,t){const n=(r=t.dataflow)._signals[ep]||(r._signals[ep]=r.add(0)),i=e.as;var r;let o=n.value;return t.visit(t.ADD,(e=>e[i]=e[i]||++o)),n.set(this.value=o),t}}),t(np,fr,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,function(e){const t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===Sh?zl:Bl;return t.visit(t.ADD,(e=>i.call(e,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});const rp={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&op(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},op=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),ap=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i{const t=e.bounds;return t.width()>1&&t.height()>1},up=e=>(e.forEach((e=>e.opacity=1)),e),lp=(e,t)=>e.reflow(t.modified()).modifies("opacity");function cp(e){fr.call(this,null,e)}t(ip,fr,{transform(e,t){const n=rp[e.method]||rp.parity,i=e.separation||0;let r,o,a=t.materialize(t.SOURCE).source;if(!a||!a.length)return;if(!e.method)return e.modified("method")&&(up(a),t=lp(t,e)),t;if(a=a.filter(sp),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=up(a),t=lp(t,e),r.length>=3&&ap(r,i)){do{r=n(r,i)}while(r.length>=3&&ap(r,i));r.length<3&&!S(a).opacity&&(r.length>1&&(S(r).opacity=0),S(a).opacity=1)}var s,u,l,c,f;e.boundScale&&e.boundTolerance>=0&&(s=e.boundScale,u=e.boundOrient,l=+e.boundTolerance,c=s.range(),f=new Ml,u===Ah||u===Fh?f.set(c[0],-1/0,c[1],1/0):f.set(-1/0,c[0],1/0,c[1]),f.expand(l||1),o=e=>f.encloses(e.bounds),a.forEach((e=>{o(e)||(e.opacity=0)})));const d=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&d.union(e.bounds)})),t}}),t(cp,fr,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,(e=>n.dirty(e))),t.fields&&t.fields.zindex){const e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}});const fp=new Ml;function dp(e,t,n){return e[t]===n?0:(e[t]=n,1)}function hp(e){var t=e.items[0].orient;return t===kh||t===Dh}function pp(e,t,n,i){var r,o,a=t.items[0],s=a.datum,u=null!=a.translate?a.translate:.5,l=a.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(s),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,b=g&&yf(g),x=0,w=0;switch(fp.clear().union(v),v.clear(),(r=c[0])>-1&&v.union(a.items[r].bounds),(r=c[1])>-1&&v.union(a.items[r].bounds),l){case Ah:x=h||0,w=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&mp(e,g,o,y,b,0,-1,v);break;case kh:x=-d,w=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&mp(e,g,o,y,b,1,-1,v);break;case Dh:x=n+d,w=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&mp(e,g,o,y,b,1,1,v);break;case Fh:x=h||0,w=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&mp(e,g,o,y,0,0,1,v);break;default:x=a.x,w=a.y}return Tl(v.translate(x,w),a),dp(a,"x",x+u)|dp(a,"y",w+u)&&(a.bounds=fp,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function mp(e,t,n,i,r,o,a,s){const u=t.bounds;if(t.auto){const s=a*(n+r+i);let l=0,c=0;e.dirty(t),o?l=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(u.translate(-l,-c)),e.dirty(t)}s.union(u)}const gp=(e,t)=>Math.floor(Math.min(e,t)),yp=(e,t)=>Math.ceil(Math.max(e,t));function vp(e){return(new Ml).set(0,0,e.width||0,e.height||0)}function bp(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function xp(e,t,n){const i=ne(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function wp(e){return e<0?Math.ceil(-e):0}function _p(e,t,n){var i,r,o,a,s,u,l,c,f,d,h,p=!n.nodirty,m=n.bounds===Xh?vp:bp,g=fp.set(0,0,0,0),y=xp(n.align,Jh),v=xp(n.align,Kh),b=xp(n.padding,Jh),x=xp(n.padding,Kh),w=n.columns||t.length,_=w<=0?1:Math.ceil(t.length/w),A=t.length,k=Array(A),D=Array(w),F=0,C=Array(A),E=Array(_),$=0,S=Array(A),M=Array(A),B=Array(A);for(r=0;r1)for(r=0;r0&&(S[r]+=f/2);if(v&&xp(n.center,Kh)&&1!==w)for(r=0;r0&&(M[r]+=d/2);for(r=0;rr&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),k+=o,m=0,y=t.length;m=0&&null==(x=n[g]);g-=d);s?(w=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),_=k):(w=k,_=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(w-(b.x||0),_-(b.y||0))),b.x=w,b.y=_,e.dirty(b),D=a(D,v[l])}return D}function Cp(e,t,n,i,r,o){if(t){e.dirty(t);var a=n,s=n;i?a=Math.round(r.x1+o*r.width()):s=Math.round(r.y1+o*r.height()),t.bounds.translate(a-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=s,e.dirty(t)}}function Ep(e,t,n,i,r,o,a){const s=function(e,t){const n=e[t]||{};return(t,i)=>null!=n[t]?n[t]:null!=e[t]?e[t]:i}(n,t),u=function(e,t){let n=-1/0;return e.forEach((e=>{null!=e.offset&&(n=Math.max(n,e.offset))})),n>-1/0?n:t}(e,s("offset",0)),l=s("anchor",Ch),c=l===$h?1:l===Eh?.5:0,f={align:Yh,bounds:s("bounds",Xh),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case kh:f.anchor={x:Math.floor(i.x1)-u,column:$h,y:c*(a||i.height()+2*i.y1),row:l};break;case Dh:f.anchor={x:Math.ceil(i.x2)+u,y:c*(a||i.height()+2*i.y1),row:l};break;case Ah:f.anchor={y:Math.floor(r.y1)-u,row:$h,x:c*(o||r.width()+2*r.x1),column:l};break;case Fh:f.anchor={y:Math.ceil(r.y2)+u,x:c*(o||r.width()+2*r.x1),column:l};break;case"top-left":f.anchor={x:u,y:u};break;case"top-right":f.anchor={x:o-u,y:u,column:$h};break;case"bottom-left":f.anchor={x:u,y:a-u,row:$h};break;case"bottom-right":f.anchor={x:o-u,y:a-u,column:$h,row:$h}}return f}function $p(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,u=r.x,l=r.y;return r._bounds?r._bounds.clear().union(s):r._bounds=s.clone(),s.clear(),function(e,t,n){var i=t.padding,r=i-n.x,o=i-n.y;if(t.datum.title){var a=t.items[1].items[0],s=a.anchor,u=t.titlePadding||0,l=i-a.x,c=i-a.y;switch(a.orient){case kh:r+=Math.ceil(a.bounds.width())+u;break;case Dh:case Fh:break;default:o+=a.bounds.height()+u}switch((r||o)&&Mp(e,n,r,o),a.orient){case kh:c+=Sp(t,n,a,s,1,1);break;case Dh:l+=Sp(t,n,a,$h,0,0)+u,c+=Sp(t,n,a,s,1,1);break;case Fh:l+=Sp(t,n,a,s,0,0),c+=Sp(t,n,a,$h,-1,0,1)+u;break;default:l+=Sp(t,n,a,s,0,0)}(l||c)&&Mp(e,a,l,c),(l=Math.round(a.bounds.x1-i))<0&&(Mp(e,n,-l,0),Mp(e,a,-l,0))}else(r||o)&&Mp(e,n,r,o)}(e,r,r.items[0].items[0]),s=function(e,t){return e.items.forEach((e=>t.union(e.bounds))),t.x1=e.padding,t.y1=e.padding,t}(r,s),n=2*r.padding,i=2*r.padding,s.empty()||(n=Math.ceil(s.width()+n),i=Math.ceil(s.height()+i)),"symbol"===o.type&&function(e){const t=e.reduce(((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e)),{});e.forEach((e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y}))}(r.items[0].items[0].items[0].items),a!==Gh&&(r.x=u=0,r.y=l=0),r.width=n,r.height=i,Tl(s.set(u,l,u+n,l+i),r),r.mark.bounds.clear().union(s),r}function Sp(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,u=n.datum.vgrad,l=(!s||!o&&u||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=u&&o?l:0,f=u&&o?0:l,d=r<=0?0:yf(n);return Math.round(i===Ch?c:i===$h?f-d:.5*(l-d))}function Mp(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function Bp(e){fr.call(this,null,e)}t(Bp,fr,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&Ap(n,t,e.layout),function(e,t,n){var i,r,o,a,s,u=t.items,l=Math.max(0,t.width||0),c=Math.max(0,t.height||0),f=(new Ml).set(0,0,l,c),d=f.clone(),h=f.clone(),p=[];for(a=0,s=u.length;a{(o=e.orient||Dh)!==Gh&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];_p(e,r,Ep(r,i,n.legends,d,h,l,c))}p.forEach((t=>{const i=t.bounds;if(i.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=i,e.dirty(t)),!n.autosize||n.autosize.type!==Ih&&n.autosize.type!==Wh&&n.autosize.type!==Hh)f.union(i);else switch(t.orient){case kh:case Dh:f.add(i.x1,0).add(i.x2,0);break;case Ah:case Fh:f.add(0,i.y1).add(0,i.y2)}}))}f.union(d).union(h),i&&f.union(function(e,t,n,i,r){var o,a=t.items[0],s=a.frame,u=a.orient,l=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=u===kh||u===Dh?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Sh?u===kh?(m=r.y2,p=r.y1):u===Dh?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):u===kh&&(m=i,p=0),o=l===Ch?m:l===$h?p:(m+p)/2,h&&h.text){switch(u){case Ah:case Fh:b=d.bounds.height()+f;break;case kh:v=d.bounds.width()+f;break;case Dh:v=-d.bounds.width()-f}fp.clear().union(h.bounds),fp.translate(v-(h.x||0),b-(h.y||0)),dp(h,"x",v)|dp(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(fp),h.mark.bounds.clear().union(fp),e.dirty(h)),fp.clear().union(h.bounds)}else fp.clear();switch(fp.union(d.bounds),u){case Ah:g=o,y=r.y1-fp.height()-c;break;case kh:g=r.x1-fp.width()-c,y=o;break;case Dh:g=r.x2+fp.width()+c,y=o;break;case Fh:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return dp(a,"x",g)|dp(a,"y",y)&&(fp.translate(g,y),e.dirty(a),a.bounds.clear().union(fp),t.bounds.clear().union(fp),e.dirty(a)),a.bounds}(e,i,l,c,f));t.clip&&f.set(0,0,t.width||0,t.height||0);!function(e,t,n,i){const r=i.autosize||{},o=r.type;if(e._autosize<1||!o)return;let a=e._width,s=e._height,u=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-u)),h=Math.max(0,Math.ceil(n.y2-c));if(r.contains===Uh){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===Gh?(l=0,f=0,u=a,c=s):o===Ih?(u=Math.max(0,a-l-d),c=Math.max(0,s-f-h)):o===Wh?(u=Math.max(0,a-l-d),s=c+f+h):o===Hh?(a=u+l+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=u+l+d,s=c+f+h);e._resizeView(a,s,u,c,[l,f],r.resize)}(e,t,f,n)}(n,t,e)})),(i=e.mark.group)&&"legend-entry"!==i.mark.role?t.reflow():t;var i}});const zp=Object.freeze(Object.defineProperty({__proto__:null,bound:Qh,identifier:tp,mark:np,overlap:ip,render:cp,viewlayout:Bp},Symbol.toStringTag,{value:"Module"}));function Op(e){fr.call(this,null,e)}function Np(e){fr.call(this,null,e)}function Rp(){return Oi({})}function Tp(e){fr.call(this,null,e)}function Pp(e){fr.call(this,[],e)}t(Op,fr,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.scale,a=pu(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||yu(n,o,a,e.formatSpecifier,e.formatType,!!e.values),u=e.values?mu(o,e.values,a):gu(o,a);return r&&(i.rem=r),r=u.map(((e,t)=>Oi({index:t/(u.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(Oi({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),t(Np,fr,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||Rp,o=e.key||Bi,a=this.value;return f(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&d("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=T().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(o)),t.visit(t.ADD,(e=>{const t=o(e);let n=a.get(t);n?n.exit?(a.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),a.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(e=>{const t=o(e),n=a.get(t);n&&(n.datum=e,i.mod.push(n))})),t.visit(t.REM,(e=>{const t=o(e),n=a.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++a.empty)})),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),i}}),t(Tp,fr,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(f(o)){if(!n.changed()&&!o.every((e=>r[e])))return t.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,s=r.update||oe,u=r.enter||oe,l=r.exit||oe,c=(o&&!a?r[o]:s)||oe;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{u(t,e),s(t,e)})),n.modifies(u.output),n.modifies(s.output),c!==oe&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&l!==oe&&(t.visit(t.REM,(t=>{l(t,e)})),n.modifies(l.output)),a||c!==oe){const r=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(r,(t=>{const r=u(t,e)||i;(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(u.output)):t.visit(r,(t=>{(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}}),t(Pp,fr,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,o,u,l=t.dataflow.locale(),c=t.fork(t.NO_SOURCE|t.NO_FIELDS),f=this.value,d=e.type||cu,h=e.scale,p=+e.limit,m=pu(h,null==e.count?5:e.count,e.minstep),g=!!e.values||d===cu,y=e.format||_u(l,h,m,d,e.formatSpecifier,e.formatType,g),v=e.values||wu(h,m);return f&&(c.rem=f),d===cu?(p&&v.length>p?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),f=v.slice(0,p-1),u=!0):f=v,a(r=e.size)?(e.values||0!==h(f[0])||(f=f.slice(1)),o=f.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=s(o=r||8),f=f.map(((t,n)=>Oi({index:n,label:y(t,n,f),value:t,offset:o,size:r(t,e)}))),u&&(u=v[f.length],f.push(Oi({index:f.length,label:`…${v.length-f.length} entries`,value:u,offset:o,size:r(u,e)})))):"gradient"===d?(n=h.domain(),i=ru(h,n[0],S(n)),v.length<3&&!e.values&&n[0]!==S(n)&&(v=[n[0],S(n)]),f=v.map(((e,t)=>Oi({index:t,label:y(e,t,v),value:e,perc:i(e)})))):(r=v.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+S(t),o=r-i;if(e.type===Cs){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(h),f=v.map(((e,t)=>Oi({index:t,label:y(e,t,v),value:e,perc:t?i(e):0,perc2:t===r?1:i(v[t+1])})))),c.source=f,c.add=f,this.value=f,c}});const jp=e=>e.source.x,Lp=e=>e.source.y,qp=e=>e.target.x,Up=e=>e.target.y;function Ip(e){fr.call(this,{},e)}Ip.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},t(Ip,fr,{transform(e,t){var n=e.sourceX||jp,i=e.sourceY||Lp,r=e.targetX||qp,o=e.targetY||Up,a=e.as||"path",s=e.orient||"vertical",u=e.shape||"line",l=Vp.get(u+"-"+s)||Vp.get(u);return l||d("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=l(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const Wp=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,Hp=(e,t,n,i)=>{var r=n-e,o=i-t,a=Math.hypot(r,o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,r)/Math.PI+" 0 1 "+n+","+i},Gp=(e,t,n,i)=>{const r=n-e,o=i-t,a=.2*(r+o),s=.2*(o-r);return"M"+e+","+t+"C"+(e+a)+","+(t+s)+" "+(n+s)+","+(i-a)+" "+n+","+i},Vp=T({line:Wp,"line-radial":(e,t,n,i)=>Wp(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:Hp,"arc-radial":(e,t,n,i)=>Hp(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:Gp,"curve-radial":(e,t,n,i)=>Gp(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),"orthogonal-horizontal":(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,"orthogonal-vertical":(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,"orthogonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n);return"M"+t*r+","+t*o+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*a+","+t*s+"L"+i*a+","+i*s},"diagonal-horizontal":(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},"diagonal-vertical":(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},"diagonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),u=(t+i)/2;return"M"+t*r+","+t*o+"C"+u*r+","+u*o+" "+u*a+","+u*s+" "+i*a+","+i*s}});function Yp(e){fr.call(this,null,e)}Yp.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},t(Yp,fr,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],u=e.field||ae,l=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(u),h=d.length,p=l,m=(c-l)/si(d),g=Ht(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;ne+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+fe(t)));return t}function Zp(e,t,n){return a(e)&&(t||n)?tu(e,em(t||[0,1],n)):e}function em(e,t){return t?e.slice().reverse():e}function tm(e){fr.call(this,null,e)}t(Kp,fr,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";if(n===As)return As+"-"+gs;(function(e){const t=e.type;return Ys(t)&&t!==ws&&t!==_s&&(e.scheme||e.range&&e.range.length&&e.range.every(ie))})(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?As+"-":3===t?ks+"-":"");return(i+n||gs).toLowerCase()}(e);for(r in i&&r===i.type||(this.value=i=Hs(r)()),e)if(!Jp[r]){if("padding"===r&&Xp(i.type))continue;a(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return function(e,t,n){var i=e.type,r=t.round||!1,o=t.range;if(null!=t.rangeStep)o=function(e,t,n){e!==Ss&&e!==$s&&d("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===$s?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*ms(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;f(t.scheme)?i=nu(t.scheme,t.interpolate,t.interpolateGamma):(i=lu(t.scheme.toLowerCase()))||d(`Unrecognized scheme name: ${t.scheme}`);return n=e===Cs?n+1:e===Ms?n-1:e===Ds||e===Fs?+t.schemeCount||5:n,Qs(e)?Zp(i,r,t.reverse):a(i)?iu(Zp(i,r),n):e===Es?i:i.slice(0,n)}(i,t,n),a(o))){if(e.interpolator)return e.interpolator(o);d(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&Qs(i))return e.interpolator(nu(em(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(ou(t.interpolate,t.interpolateGamma)):a(e.round)?e.round(r):a(e.rangeRound)&&e.interpolate(r?Nt:St);o&&e.range(em(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!f(i)){const t=e.domain(),n=t[0],r=S(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||d("Scale bins parameter missing step property."),ar&&(s=o*Math.floor(r/o)),i=Ht(a,s+o/2,o)}i?e.bins=i:e.bins&&delete e.bins;e.type===Ms&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain());return n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(Qp(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,o,a=t.domain,s=e.type,u=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===gs||t===vs||t===bs)}(e);if(!a)return 0;if((u||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,u&&(a[0]>0&&(a[0]=0),a[r]<0&&(a[r]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[r]=t.domainMax),null!=t.domainMid)){const e=(o=t.domainMid)>a[r]?r+1:oe(u);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;od&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,l,c),i=0,r=n.length,o=n.max;i0?1:e<0?-1:0},Sm=Math.sqrt,Mm=Math.tan;function Bm(e){return e>1?0:e<-1?hm:Math.acos(e)}function zm(e){return e>1?pm:e<-1?-pm:Math.asin(e)}function Om(){}function Nm(e,t){e&&Tm.hasOwnProperty(e.type)&&Tm[e.type](e,t)}var Rm={Feature:function(e,t){Nm(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i=0?1:-1,r=i*n,o=_m(t=(t*=vm)/2+mm),a=Em(t),s=Hm*a,u=Wm*o+s*_m(r),l=s*i*Em(r);ig.add(wm(l,u)),Im=e,Wm=o,Hm=a}function cg(e){return[wm(e[1],e[0]),zm(e[2])]}function fg(e){var t=e[0],n=e[1],i=_m(n);return[i*_m(t),i*Em(t),Em(n)]}function dg(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function hg(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function pg(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function mg(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function gg(e){var t=Sm(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var yg,vg,bg,xg,wg,_g,Ag,kg,Dg,Fg,Cg,Eg,$g,Sg,Mg,Bg,zg={point:Og,lineStart:Rg,lineEnd:Tg,polygonStart:function(){zg.point=Pg,zg.lineStart=jg,zg.lineEnd=Lg,eg=new Zn,og.polygonStart()},polygonEnd:function(){og.polygonEnd(),zg.point=Og,zg.lineStart=Rg,zg.lineEnd=Tg,ig<0?(Gm=-(Ym=180),Vm=-(Xm=90)):eg>fm?Xm=90:eg<-1e-6&&(Vm=-90),ng[0]=Gm,ng[1]=Ym},sphere:function(){Gm=-(Ym=180),Vm=-(Xm=90)}};function Og(e,t){tg.push(ng=[Gm=e,Ym=e]),tXm&&(Xm=t)}function Ng(e,t){var n=fg([e*vm,t*vm]);if(Zm){var i=hg(Zm,n),r=hg([i[1],-i[0],0],i);gg(r),r=cg(r);var o,a=e-Jm,s=a>0?1:-1,u=r[0]*ym*s,l=bm(a)>180;l^(s*JmXm&&(Xm=o):l^(s*Jm<(u=(u+360)%360-180)&&uXm&&(Xm=t)),l?eqg(Gm,Ym)&&(Ym=e):qg(e,Ym)>qg(Gm,Ym)&&(Gm=e):Ym>=Gm?(eYm&&(Ym=e)):e>Jm?qg(Gm,e)>qg(Gm,Ym)&&(Ym=e):qg(e,Ym)>qg(Gm,Ym)&&(Gm=e)}else tg.push(ng=[Gm=e,Ym=e]);tXm&&(Xm=t),Zm=n,Jm=e}function Rg(){zg.point=Ng}function Tg(){ng[0]=Gm,ng[1]=Ym,zg.point=Og,Zm=null}function Pg(e,t){if(Zm){var n=e-Jm;eg.add(bm(n)>180?n+(n>0?360:-360):n)}else Km=e,Qm=t;og.point(e,t),Ng(e,t)}function jg(){og.lineStart()}function Lg(){Pg(Km,Qm),og.lineEnd(),bm(eg)>fm&&(Gm=-(Ym=180)),ng[0]=Gm,ng[1]=Ym,Zm=null}function qg(e,t){return(t-=e)<0?t+360:t}function Ug(e,t){return e[0]-t[0]}function Ig(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:thm&&(e-=Math.round(e/gm)*gm),[e,t]}function iy(e,t,n){return(e%=gm)?t||n?ty(oy(e),ay(t,n)):oy(e):t||n?ay(t,n):ny}function ry(e){return function(t,n){return bm(t+=e)>hm&&(t-=Math.round(t/gm)*gm),[t,n]}}function oy(e){var t=ry(e);return t.invert=ry(-e),t}function ay(e,t){var n=_m(e),i=Em(e),r=_m(t),o=Em(t);function a(e,t){var a=_m(t),s=_m(e)*a,u=Em(e)*a,l=Em(t),c=l*n+s*i;return[wm(u*r-c*o,s*n-l*i),zm(c*r+u*o)]}return a.invert=function(e,t){var a=_m(t),s=_m(e)*a,u=Em(e)*a,l=Em(t),c=l*r-u*o;return[wm(u*r+l*o,s*n+c*i),zm(c*n-s*i)]},a}function sy(e,t){(t=fg(t))[0]-=e,gg(t);var n=Bm(-t[1]);return((-t[2]<0?-n:n)+gm-fm)%gm}function uy(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Om,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function ly(e,t){return bm(e[0]-t[0])=0;--o)r.point((c=l[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}l=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function dy(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i=0?1:-1,F=D*k,C=F>hm,E=g*_;if(u.add(wm(E*D*Em(F),y*A+E*_m(F))),a+=C?k+D*gm:k,C^p>=n^x>=n){var $=hg(fg(h),fg(b));gg($);var S=hg(o,$);gg(S);var M=(C^k>=0?-1:1)*zm(S[2]);(i>M||i===M&&($[0]||$[1]))&&(s+=C^k>=0?1:-1)}}return(a<-1e-6||a0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e1&&2&u&&d.push(d.pop().concat(d.shift())),a.push(d.filter(my))}return d}}function my(e){return e.length>1}function gy(e,t){return((e=e.x)[0]<0?e[1]-pm-fm:pm-e[1])-((t=t.x)[0]<0?t[1]-pm-fm:pm-t[1])}ny.invert=ny;const yy=py((function(){return!0}),(function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?hm:-hm,u=bm(o-n);bm(u-hm)0?pm:-pm),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&u>=hm&&(bm(n-r)fm?xm((Em(t)*(o=_m(i))*Em(n)-Em(i)*(r=_m(t))*Em(e))/(r*o*a)):(t+i)/2}(n,i,o,a),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),t=0),e.point(n=o,i=a),r=s},lineEnd:function(){e.lineEnd(),n=i=NaN},clean:function(){return 2-t}}}),(function(e,t,n,i){var r;if(null==e)r=n*pm,i.point(-hm,r),i.point(0,r),i.point(hm,r),i.point(hm,0),i.point(hm,-r),i.point(0,-r),i.point(-hm,-r),i.point(-hm,0),i.point(-hm,r);else if(bm(e[0]-t[0])>fm){var o=e[0]0,r=bm(t)>fm;function o(e,n){return _m(e)*_m(n)>t}function a(e,n,i){var r=[1,0,0],o=hg(fg(e),fg(n)),a=dg(o,o),s=o[0],u=a-s*s;if(!u)return!i&&e;var l=t*a/u,c=-t*s/u,f=hg(r,o),d=mg(r,l);pg(d,mg(o,c));var h=f,p=dg(d,h),m=dg(h,h),g=p*p-m*(dg(d,d)-1);if(!(g<0)){var y=Sm(g),v=mg(h,(-p-y)/m);if(pg(v,d),v=cg(v),!i)return v;var b,x=e[0],w=n[0],_=e[1],A=n[1];w0^v[1]<(bm(v[0]-x)hm^(x<=v[0]&&v[0]<=w)){var F=mg(h,(-p+y)/m);return pg(F,d),[v,cg(F)]}}}function s(t,n){var r=i?e:hm-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return py(o,(function(e){var t,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=i?m?0:s(f,d):m?s(f+(f<0?hm:-hm),d):0;if(!t&&(l=u=m)&&e.lineStart(),m!==u&&(!(h=a(t,p))||ly(t,h)||ly(p,h))&&(p[2]=1),m!==u)c=0,m?(e.lineStart(),h=a(p,t),e.point(h[0],h[1])):(h=a(t,p),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(r&&t&&i^m){var y;g&n||!(y=a(p,t,!0))||(c=0,i?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&ly(t,p)||e.point(p[0],p[1]),t=p,u=m,n=g},lineEnd:function(){u&&e.lineEnd(),t=null},clean:function(){return c|(l&&u)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=_m(t),s=Em(t),u=i*n;null==r?(r=t+i*gm,o=t-u/2):(r=sy(a,r),o=sy(a,o),(i>0?ro)&&(r+=i*gm));for(var l,c=r;i>0?c>o:c0)do{l.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else l.point(o[0],o[1])}function a(i,r){return bm(i[0]-e)0?0:3:bm(i[0]-n)0?2:1:bm(i[1]-t)0?1:0:r>0?3:2}function s(e,t){return u(e.x,t.x)}function u(e,t){var n=a(e,1),i=a(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var u,l,c,f,d,h,p,m,g,y,v,b=a,x=uy(),w={point:_,lineStart:function(){w.point=A,l&&l.push(c=[]);y=!0,g=!1,p=m=NaN},lineEnd:function(){u&&(A(f,d),h&&g&&x.rejoin(),u.push(x.result()));w.point=_,g&&b.lineEnd()},polygonStart:function(){b=x,u=[],l=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=l.length;ni&&(d-o)*(i-a)>(h-a)*(e-o)&&++t:h<=i&&(d-o)*(i-a)<(h-a)*(e-o)&&--t;return t}(),n=v&&t,r=(u=ai(u)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&fy(u,s,t,o,a),a.polygonEnd());b=a,u=l=c=null}};function _(e,t){r(e,t)&&b.point(e,t)}function A(o,a){var s=r(o,a);if(l&&c.push([o,a]),y)f=o,d=a,h=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&g)b.point(o,a);else{var u=[p=Math.max(xy,Math.min(by,p)),m=Math.max(xy,Math.min(by,m))],x=[o=Math.max(xy,Math.min(by,o)),a=Math.max(xy,Math.min(by,a))];!function(e,t,n,i,r,o){var a,s=e[0],u=e[1],l=0,c=1,f=t[0]-s,d=t[1]-u;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a0)){if(a/=d,d<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-u,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>l&&(l=a)}else if(d>0){if(a0&&(e[0]=s+l*f,e[1]=u+l*d),c<1&&(t[0]=s+c*f,t[1]=u+c*d),!0}}}}}(u,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(u[0],u[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return w}}function _y(e,t,n){var i=Ht(e,t-fm,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function Ay(e,t,n){var i=Ht(e,t-fm,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}const ky=e=>e;var Dy,Fy,Cy,Ey,$y=new Zn,Sy=new Zn,My={point:Om,lineStart:Om,lineEnd:Om,polygonStart:function(){My.lineStart=By,My.lineEnd=Ny},polygonEnd:function(){My.lineStart=My.lineEnd=My.point=Om,$y.add(bm(Sy)),Sy=new Zn},result:function(){var e=$y/2;return $y=new Zn,e}};function By(){My.point=zy}function zy(e,t){My.point=Oy,Dy=Cy=e,Fy=Ey=t}function Oy(e,t){Sy.add(Ey*e-Cy*t),Cy=e,Ey=t}function Ny(){Oy(Dy,Fy)}var Ry=1/0,Ty=Ry,Py=-Ry,jy=Py,Ly={point:function(e,t){ePy&&(Py=e);tjy&&(jy=t)},lineStart:Om,lineEnd:Om,polygonStart:Om,polygonEnd:Om,result:function(){var e=[[Ry,Ty],[Py,jy]];return Py=jy=-(Ty=Ry=1/0),e}};var qy,Uy,Iy,Wy,Hy=0,Gy=0,Vy=0,Yy=0,Xy=0,Jy=0,Ky=0,Qy=0,Zy=0,ev={point:tv,lineStart:nv,lineEnd:ov,polygonStart:function(){ev.lineStart=av,ev.lineEnd=sv},polygonEnd:function(){ev.point=tv,ev.lineStart=nv,ev.lineEnd=ov},result:function(){var e=Zy?[Ky/Zy,Qy/Zy]:Jy?[Yy/Jy,Xy/Jy]:Vy?[Hy/Vy,Gy/Vy]:[NaN,NaN];return Hy=Gy=Vy=Yy=Xy=Jy=Ky=Qy=Zy=0,e}};function tv(e,t){Hy+=e,Gy+=t,++Vy}function nv(){ev.point=iv}function iv(e,t){ev.point=rv,tv(Iy=e,Wy=t)}function rv(e,t){var n=e-Iy,i=t-Wy,r=Sm(n*n+i*i);Yy+=r*(Iy+e)/2,Xy+=r*(Wy+t)/2,Jy+=r,tv(Iy=e,Wy=t)}function ov(){ev.point=tv}function av(){ev.point=uv}function sv(){lv(qy,Uy)}function uv(e,t){ev.point=lv,tv(qy=Iy=e,Uy=Wy=t)}function lv(e,t){var n=e-Iy,i=t-Wy,r=Sm(n*n+i*i);Yy+=r*(Iy+e)/2,Xy+=r*(Wy+t)/2,Jy+=r,Ky+=(r=Wy*e-Iy*t)*(Iy+e),Qy+=r*(Wy+t),Zy+=3*r,tv(Iy=e,Wy=t)}function cv(e){this._context=e}cv.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,gm)}},result:Om};var fv,dv,hv,pv,mv,gv=new Zn,yv={point:Om,lineStart:function(){yv.point=vv},lineEnd:function(){fv&&bv(dv,hv),yv.point=Om},polygonStart:function(){fv=!0},polygonEnd:function(){fv=null},result:function(){var e=+gv;return gv=new Zn,e}};function vv(e,t){yv.point=bv,dv=pv=e,hv=mv=t}function bv(e,t){pv-=e,mv-=t,gv.add(Sm(pv*pv+mv*mv)),pv=e,mv=t}let xv,wv,_v,Av;class kv{constructor(e){this._append=null==e?Dv:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Dv;if(t!==xv){const e=10**t;xv=t,wv=function(t){let n=1;this._+=t[0];for(const i=t.length;n=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new kv(r)),a},a.projection(e).digits(r).context(t)}function Cv(e){return function(t){var n=new Ev;for(var i in e)n[i]=e[i];return n.stream=t,n}}function Ev(){}function $v(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),Lm(n,e.stream(Ly)),t(Ly.result()),null!=i&&e.clipExtent(i),e}function Sv(e,t,n){return $v(e,(function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+t[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(r-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])}),n)}function Mv(e,t,n){return Sv(e,[[0,0],t],n)}function Bv(e,t,n){return $v(e,(function(n){var i=+t,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];e.scale(150*r).translate([o,a])}),n)}function zv(e,t,n){return $v(e,(function(n){var i=+t,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([o,a])}),n)}Ev.prototype={constructor:Ev,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Ov=_m(30*vm);function Nv(e,t){return+t?function(e,t){function n(i,r,o,a,s,u,l,c,f,d,h,p,m,g){var y=l-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,w=s+h,_=u+p,A=Sm(x*x+w*w+_*_),k=zm(_/=A),D=bm(bm(_)-1)t||bm((y*$+v*S)/b-.5)>.3||a*d+s*h+u*p2?e[2]%360*vm:0,$()):[g*ym,y*ym,v*ym]},C.angle=function(e){return arguments.length?(b=e%360*vm,$()):b*ym},C.reflectX=function(e){return arguments.length?(x=e?-1:1,$()):x<0},C.reflectY=function(e){return arguments.length?(w=e?-1:1,$()):w<0},C.precision=function(e){return arguments.length?(a=Nv(s,F=e*e),S()):Sm(F)},C.fitExtent=function(e,t){return Sv(C,e,t)},C.fitSize=function(e,t){return Mv(C,e,t)},C.fitWidth=function(e,t){return Bv(C,e,t)},C.fitHeight=function(e,t){return zv(C,e,t)},function(){return t=e.apply(this,arguments),C.invert=t.invert&&E,$()}}function Lv(e){var t=0,n=hm/3,i=jv(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*vm,n=e[1]*vm):[t*ym,n*ym]},r}function qv(e,t){var n=Em(e),i=(n+Em(t))/2;if(bm(i)2?e[2]*vm:0),t.invert=function(t){return(t=e.invert(t[0]*vm,t[1]*vm))[0]*=ym,t[1]*=ym,t},t}(r.rotate()).invert([0,0]));return u(null==l?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===Yv?[[Math.max(s[0]-o,l),t],[Math.min(s[0]+o,n),i]]:[[l,Math.max(s[1]-o,t)],[n,Math.min(s[1]+o,i)]])}return r.scale=function(e){return arguments.length?(a(e),c()):a()},r.translate=function(e){return arguments.length?(s(e),c()):s()},r.center=function(e){return arguments.length?(o(e),c()):o()},r.clipExtent=function(e){return arguments.length?(null==e?l=t=n=i=null:(l=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==l?null:[[l,t],[n,i]]},c()}function Jv(e){return Mm((pm+e)/2)}function Kv(e,t){var n=_m(e),i=e===t?Em(e):Fm(n/_m(t))/Fm(Jv(t)/Jv(e)),r=n*Cm(Jv(e),i)/i;if(!i)return Yv;function o(e,t){r>0?t<-pm+fm&&(t=-pm+fm):t>pm-fm&&(t=pm-fm);var n=r/Cm(Jv(t),i);return[n*Em(i*e),r-n*_m(i*e)]}return o.invert=function(e,t){var n=r-t,o=$m(i)*Sm(e*e+n*n),a=wm(e,bm(n))*$m(n);return n*i<0&&(a-=hm*$m(e)*$m(n)),[a/i,2*xm(Cm(r/o,1/i))-pm]},o}function Qv(e,t){return[e,t]}function Zv(e,t){var n=_m(e),i=e===t?Em(e):(n-_m(t))/(t-e),r=n/i+e;if(bm(i)fm&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},ub.invert=Hv(zm),lb.invert=Hv((function(e){return 2*xm(e)})),cb.invert=function(e,t){return[-t,2*xm(km(e))-pm]};var fb,db=Math.abs,hb=Math.cos,pb=Math.sin,mb=Math.PI,gb=mb/2,yb=(fb=2)>0?Math.sqrt(fb):0;function vb(e){return e>1?gb:e<-1?-gb:Math.asin(e)}function bb(e,t){var n,i=e*pb(t),r=30;do{t-=n=(t+pb(t)-i)/(1+hb(t))}while(db(n)>1e-6&&--r>0);return t/2}var xb=function(e,t,n){function i(i,r){return[e*i*hb(r=bb(n,r)),t*pb(r)]}return i.invert=function(i,r){return r=vb(r/t),[i/(e*hb(r)),vb((2*r+pb(2*r))/n)]},i}(yb/gb,yb,mb);const wb=Fv(),_b=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ab(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Db[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=Fv().projection(i),i.copy=i.copy||function(){const e=n();return _b.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},Is(i)}}(e,t),this):Db[e]||null}function kb(e){return e&&e.path||wb}const Db={albers:Iv,albersusa:function(){var e,t,n,i,r,o,a=Iv(),s=Uv().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=Uv().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(e,t){o=[e,t]}};function c(e){var t=e[0],a=e[1];return o=null,n.point(t,a),o||(i.point(t,a),o)||(r.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),i=(e[0]-n[0])/t,r=(e[1]-n[1])/t;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?s:r>=.166&&r<.234&&i>=-.214&&i<-.115?u:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),u.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const KV in Db)Ab(KV,Db[KV]);function Fb(){}const Cb=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Eb(){var e=1,t=1,n=a;function i(e,t){return t.map((t=>r(e,t)))}function r(i,r){var a=[],s=[];return function(n,i,r){var a,s,u,l,c,f,d=[],h=[];a=s=-1,l=n[0]>=i,Cb[l<<1].forEach(p);for(;++a=i,Cb[u|l<<1].forEach(p);Cb[l|0].forEach(p);for(;++s=i,c=n[s*e]>=i,Cb[l<<1|c<<2].forEach(p);++a=i,f=c,c=n[s*e+a+1]>=i,Cb[u|l<<1|c<<2|f<<3].forEach(p);Cb[l|c<<3].forEach(p)}a=-1,c=n[s*e]>=i,Cb[c<<2].forEach(p);for(;++a=i,Cb[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],u=[e[1][0]+a,e[1][1]+s],l=o(i),c=o(u);(t=h[l])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(u),r(t.ring)):d[t.start]=h[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete h[t.end],t.ring.push(u),h[t.end=c]=t):(t=d[c])?(n=h[l])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(u),r(t.ring)):d[n.start]=h[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete d[t.start],t.ring.unshift(i),d[t.start=l]=t):d[l]=h[c]={start:l,end:c,ring:[i,u]}}Cb[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n{var o,a=n[0],s=n[1],u=0|a,l=0|s,c=i[l*e+u];a>0&&a0&&s=0&&o>=0||d("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:Fb,i):n===a},i}function $b(e,t){for(var n,i=-1,r=t.length;++ii!=h>i&&n<(d-l)*(i-c)/(h-c)+l&&(r=-r)}return r}function Mb(e,t,n){var i,r,o,a;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(r=e[i=+(e[0]===t[0])],o=n[i],a=t[i],r<=o&&o<=a||a<=o&&o<=r)}function Bb(e,t,n){return function(i){var r=k(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,u=t?de(o,a,e):s/(e+1);return Ht(o+u,a,u)}}function zb(e){fr.call(this,null,e)}function Ob(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function u(e){e.forEach(l)}function l(e){s&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+i,e[1]=(e[1]-a)*n+r}return function(e){return e.coordinates.forEach(u),e}}function Nb(e,t,n){const i=e>=0?e:vr(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function Rb(e){return a(e)?e:s(+e)}function Tb(){var e=e=>e[0],t=e=>e[1],n=ae,i=[-1,-1],r=960,o=500,a=2;function s(s,u){const l=Nb(i[0],s,e)>>a,c=Nb(i[1],s,t)>>a,f=l?l+2:0,d=c?c+2:0,h=2*f+(r>>a),p=2*d+(o>>a),m=new Float32Array(h*p),g=new Float32Array(h*p);let y=m;s.forEach((i=>{const r=f+(+e(i)>>a),o=d+(+t(i)>>a);r>=0&&r=0&&o0&&c>0?(Pb(h,p,m,g,l),jb(h,p,g,m,c),Pb(h,p,m,g,l),jb(h,p,g,m,c),Pb(h,p,m,g,l),jb(h,p,g,m,c)):l>0?(Pb(h,p,m,g,l),Pb(h,p,g,m,l),Pb(h,p,m,g,l),y=g):c>0&&(jb(h,p,m,g,c),jb(h,p,g,m,c),jb(h,p,m,g,c),y=g);const v=u?Math.pow(2,-2*a):1/si(y);for(let e=0,t=h*p;e>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=Rb(t),s):e},s.y=function(e){return arguments.length?(t=Rb(e),s):t},s.weight=function(e){return arguments.length?(n=Rb(e),s):n},s.size=function(e){if(!arguments.length)return[r,o];var t=+e[0],n=+e[1];return t>=0&&n>=0||d("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||d("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),s):1<=r&&(t>=o&&(s-=n[t-o+a*e]),i[t-r+a*e]=s/Math.min(t+1,e-1+o-t,o))}function jb(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a=r&&(s>=o&&(u-=n[a+(s-o)*e]),i[a+(s-r)*e]=u/Math.min(s+1,t-1+o-s,o))}function Lb(e){fr.call(this,null,e)}zb.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},t(zb,fr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||l,o=Eb().smooth(!1!==e.smooth),s=e.thresholds||function(e,t,n){const i=Bb(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>gt(t(e).values))))}(i,r,e),u=null===e.as?null:e.as||"contour",c=[];return i.forEach((t=>{const n=r(t),i=o.size([n.width,n.height])(n.values,f(s)?s:s(n.values));!function(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;a(r)&&(r=r(n,i));a(o)&&(o=o(n,i));if((1===r||null==r)&&!o)return;const s=(te(r)?r:r[0])||1,u=(te(r)?r:r[1])||1,l=o&&o[0]||0,c=o&&o[1]||0;e.forEach(Ob(t,s,u,l,c))}(i,n,t,e),i.forEach((e=>{c.push(Ri(t,Oi(null!=u?{[u]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),Lb.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const qb=["x","y","weight","size","cellSize","bandwidth"];function Ub(e,t){return qb.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function Ib(e){fr.call(this,null,e)}t(Lb,fr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=function(e,t){var n,i,r,o,a,s,u=[],l=e=>e(o);if(null==t)u.push(e);else for(n={},i=0,r=e.length;iOi(function(e,t){for(let n=0;nfm})).map(u)).concat(Ht(Am(o/h)*h,r,h).filter((function(e){return bm(e%m)>fm})).map(l))}return y.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(i).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],i>n&&(e=i,i=n,n=e),s>a&&(e=s,s=a,a=e),y.precision(g)):[[i,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),o>r&&(n=o,o=r,r=n),y.precision(g)):[[t,o],[e,r]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],y):[p,m]},y.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],y):[d,h]},y.precision=function(d){return arguments.length?(g=+d,u=_y(o,r,90),l=Ay(t,e,g),c=_y(s,a,90),f=Ay(i,n,g),y):g},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Kb(e){fr.call(this,null,e)}function Qb(e){if(!a(e))return!1;const t=ee(w(e));return t.$x||t.$y||t.$value||t.$max}function Zb(e){fr.call(this,null,e),this.modified(!0)}function ex(e,t,n){a(e[t])&&e[t](n)}Gb.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},t(Gb,fr,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],u=e.geojson||!o&&l,c=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(w(u))||a&&t.modified(w(a))||s&&t.modified(w(s)),this.value&&!n||(c=t.SOURCE,this._features=i=[],this._points=r=[]),u&&t.visit(c,(e=>i.push(u(e)))),a&&s&&(t.visit(c,(e=>{var t=a(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])})),i=i.concat({type:Wb,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:Hb,features:i}}}),Vb.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},t(Vb,fr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||l,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=kb(e.projection),n.materialize().reflow()):a=r===l||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),Yb.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},t(Yb,fr,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],u=a[1];function l(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[u]=t[1]):(e[s]=void 0,e[u]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,l)),t.modifies(a)}}),Xb.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},t(Xb,fr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",o=n.ADD;return i&&!e.modified()||(this.value=i=function(e,t,n){const i=null==n?n=>e(t(n)):i=>{var r=e.pointRadius(),o=e.pointRadius(n)(t(i));return e.pointRadius(r),o};return i.context=t=>(e.context(t),i),i}(kb(e.projection),e.field||O("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),Jb.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},t(Jb,fr,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const o in e)a(r[o])&&r[o](e[o]);return n=r(),i.length?t.mod.push(Ti(i[0],n)):t.add.push(Oi(n)),i[0]=n,t}}),Kb.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},t(Kb,fr,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i="shared"===e.resolve,r=e.field||l,o=function(e,t){let n;a(e)?(n=n=>e(n,t),n.dep=Qb(e)):e?n=s(e):(n=e=>e.$value/e.$max||0,n.dep=!0);return n}(e.opacity,e),u=function(e,t){let n;a(e)?(n=n=>pn(e(n,t)),n.dep=Qb(e)):n=s(pn(e||"#888"));return n}(e.color,e),c=e.as||"image",f={$x:0,$y:0,$value:0,$max:i?gt(n.map((e=>gt(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=v({},e,f);i||(n.$max=gt(t.values||[])),e[c]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,u=e.x2||r,l=e.y2||o,c=e.values,f=c?e=>c[e]:L,d=Ta(u-a,l-s),h=d.getContext("2d"),p=h.getImageData(0,0,u-a,l-s),m=p.data;for(let g=s,y=0;g{null!=e[t]&&ex(n,t,e[t])}))):_b.forEach((t=>{e.modified(t)&&ex(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return e=u(e),1===e.length?e[0]:{type:Hb,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===Hb?e.features:u(e).filter((e=>null!=e)).map((e=>e.type===Wb?e:{type:Wb,geometry:e}))}(t))),[])}}(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});const tx=Object.freeze(Object.defineProperty({__proto__:null,contour:Ib,geojson:Gb,geopath:Vb,geopoint:Yb,geoshape:Xb,graticule:Jb,heatmap:Kb,isocontour:zb,kde2d:Lb,projection:Zb},Symbol.toStringTag,{value:"Module"}));function nx(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,u,l,c,f,d,h=e._root,p={data:i},m=e._x0,g=e._y0,y=e._x1,v=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((l=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a,r=h,!(h=h[f=c<<1|l]))return r[f]=p,e;if(s=+e._x.call(null,h.data),u=+e._y.call(null,h.data),t===s&&n===u)return p.next=h,r?r[f]=p:e._root=p,e;do{r=r?r[f]=new Array(4):e._root=new Array(4),(l=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|l)==(d=(u>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function ix(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function rx(e){return e[0]}function ox(e){return e[1]}function ax(e,t,n){var i=new sx(null==t?rx:t,null==n?ox:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function sx(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function ux(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var lx=ax.prototype=sx.prototype;function cx(e){return function(){return e}}function fx(e){return 1e-6*(e()-.5)}function dx(e){return e.x+e.vx}function hx(e){return e.y+e.vy}function px(e){return e.index}function mx(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}lx.copy=function(){var e,t,n=new sx(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=ux(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=ux(t));return n},lx.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return nx(this.cover(t,n),t,n,e)},lx.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=i),rf&&(f=r));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;ne||e>=r||i>t||t>=o;)switch(s=(td||(o=u.y0)>h||(a=u.x1)=y)<<1|e>=g)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=u)}else{var v=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=v*v+b*b;if(x=(s=(p+g)/2))?p=s:g=s,(c=a>=(u=(m+y)/2))?m=u:y=u,t=h,!(h=h[f=c<<1|l]))return this;if(!h.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(n=t,d=f)}for(;h.data!==e;)if(i=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,i?(r?i.next=r:delete i.next,this):t?(r?t[f]=r:delete t[f],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=r,this)},lx.removeAll=function(e){for(var t=0,n=e.length;t(e=(1664525*e+1013904223)%gx)/gx}();function f(){d(),l.call("tick",t),n1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,u,l=0,c=e.length;for(null==i?i=1/0:i*=i,l=0;l1?(l.on(e,n),t):l.on(e)}}}const wx={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,u=0;for(r=0;rl+p||oc+p||au.index){var m=l-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;ye.r&&(e.r=e[t].r)}function u(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=fx(n))*f),0===d&&(p+=(d=fx(n))*d),p[s(e,t,i),e])));for(a=0,r=new Array(l);at(e,n):t)}Fx.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:Dx}]},t(Fx,fr,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(Ax),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&Cx(r,e,0,t)):(this.value=r=function(e,t){const n=xx(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),Cx(n,t,!0).on("end",(()=>o=!0))}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(o=!0,r.tick()),t.modifies("index")),a||o||e.modified(kx)||t.changed()&&e.restart)if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/s)),e.static)for(r.stop();--s>=0;)r.tick();else if(r.stopped()&&r.restart(),!o)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let s,u=this._argops,l=0,c=u.length;l=0;)t+=n[i].value;else t=1;e.value=t}function Rx(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=Px)):void 0===t&&(t=Tx);for(var n,i,r,o,a,s=new qx(e),u=[s];n=u.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)u.push(i=r[o]=new qx(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(Lx)}function Tx(e){return e.children}function Px(e){return Array.isArray(e)?e[1]:null}function jx(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function Lx(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function qx(e){this.data=e,this.depth=this.height=0,this.parent=null}function Ux(e){return null==e?null:Ix(e)}function Ix(e){if("function"!=typeof e)throw new Error;return e}function Wx(){return 0}function Hx(e){return function(){return e}}qx.prototype=Rx.prototype={constructor:qx,count:function(){return this.eachAfter(Nx)},each:function(e,t){let n=-1;for(const i of this)e.call(t,i,++n,this);return this},eachAfter:function(e,t){for(var n,i,r,o=this,a=[o],s=[],u=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i=0;--i)o.push(n[i]);return this},find:function(e,t){let n=-1;for(const i of this)if(e.call(t,i,++n,this))return i},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,i=t.children,r=i&&i.length;--r>=0;)n+=i[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),i=t.ancestors(),r=null;e=n.pop(),t=i.pop();for(;e===t;)r=e,e=n.pop(),t=i.pop();return r}(t,e),i=[t];t!==n;)t=t.parent,i.push(t);for(var r=i.length;e!==n;)i.splice(r,0,e),e=e.parent;return i},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Rx(this).eachBefore(jx)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,o=[r];do{for(e=o.reverse(),o=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n0&&n*n>i*i+r*r}function Jx(e,t){for(var n=0;n1e-6?(C+Math.sqrt(C*C-4*F*E))/(2*F):E/C);return{x:i+_+A*$,y:r+k+D*$,r:$}}function ew(e,t,n){var i,r,o,a,s=e.x-t.x,u=e.y-t.y,l=s*s+u*u;l?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(l+a-r)/(2*l),o=Math.sqrt(Math.max(0,a/l-i*i)),n.x=e.x-i*s-o*u,n.y=e.y-i*u+o*s):(i=(l+r-a)/(2*l),o=Math.sqrt(Math.max(0,r/l-i*i)),n.x=t.x+i*s-o*u,n.y=t.y+i*u+o*s)):(n.x=t.x+n.r,n.y=t.y)}function tw(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function nw(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,o=(t.y*n.r+n.y*t.r)/i;return r*r+o*o}function iw(e){this._=e,this.next=null,this.previous=null}function rw(e,t){if(!(o=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var n,i,r,o,a,s,u,l,c,f,d;if((n=e[0]).x=0,n.y=0,!(o>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(o>2))return n.r+i.r;ew(i,n,r=e[2]),n=new iw(n),i=new iw(i),r=new iw(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(u=3;ufunction(e){e=`${e}`;let t=e.length;vw(e,t-1)&&!vw(e,t-2)&&(e=e.slice(0,-1));return"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(yw),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(yw(e)),d.push(hw));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a=0&&(l=d[e]).data===hw;--e)l.data=null}if(s.parent=fw,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(Lx),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=Ux(e),i):t},i.parentId=function(e){return arguments.length?(n=Ux(e),i):n},i.path=function(t){return arguments.length?(e=Ux(t),i):e},i}function yw(e){let t=e.length;if(t<2)return"";for(;--t>1&&!vw(e,t););return e.slice(0,t)}function vw(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(!(1&n))return!0}return!1}function bw(e,t){return e.parent===t.parent?1:2}function xw(e){var t=e.children;return t?t[0]:e.t}function ww(e){var t=e.children;return t?t[t.length-1]:e.t}function _w(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function Aw(e,t,n){return e.a.parent===t.parent?e.a:n}function kw(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function Dw(e,t,n,i,r){for(var o,a=e.children,s=-1,u=a.length,l=e.value&&(r-n)/e.value;++sd&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(a={value:c,dice:u1?t:1)},n}(Fw);const $w=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,u,l,c,f=-1,d=a.length,h=e.value;++f1?t:1)},n}(Fw);function Sw(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function Mw(e){fr.call(this,null,e)}Mw.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const Bw=e=>e.values;function zw(){const e=[],t={entries:e=>i(n(e,0),0),key:n=>(e.push(n),t)};function n(t,i){if(i>=e.length)return t;const r=t.length,o=e[i++],a={},s={};let u,l,c,f=-1;for(;++fe.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function Ow(e){fr.call(this,null,e)}t(Mw,fr,{transform(e,t){t.source||d("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),o=this.value;return(!o||i||t.changed())&&(o&&o.each((e=>{e.children&&Mi(e.data)&&r.rem.push(e.data)})),this.value=o=Rx({values:u(e.keys).reduce(((e,t)=>(e.key(t),e)),zw()).entries(r.source)},Bw),n&&o.each((e=>{e.children&&(e=Oi(e.data),r.add.push(e),r.source.push(e))})),Sw(o,Bi,Bi)),r.source.root=o,r}});const Nw=(e,t)=>e.parent===t.parent?1:2;t(Ow,fr,{transform(e,t){t.source&&t.source.root||d(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,o=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(Pi(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;rfunction(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o(e=(1664525*e+1013904223)%Gx)/Gx}();return r.x=t/2,r.y=n/2,e?r.eachBefore(aw(e)).eachAfter(sw(i,.5,o)).eachBefore(uw(1)):r.eachBefore(aw(ow)).eachAfter(sw(Wx,1,o)).eachAfter(sw(i,r.r/Math.min(t,n),o)).eachBefore(uw(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=Ux(t),r):e},r.size=function(e){return arguments.length?(t=+e[0],n=+e[1],r):[t,n]},r.padding=function(e){return arguments.length?(i="function"==typeof e?e:Hx(+e),r):i},r},params:["radius","size","padding"],fields:Rw});const Pw=["x0","y0","x1","y1","depth","children"];function jw(e){Ow.call(this,e)}function Lw(e){fr.call(this,null,e)}jw.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Pw.length,default:Pw}]},t(jw,Ow,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var o=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/o,r.eachBefore(function(e,t){return function(i){i.children&&cw(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,o=i.y0,a=i.x1-n,s=i.y1-n;a=0;--r)s.push(n=t.children[r]=new kw(i[r],r)),n.parent=t;return(a.parent=new kw(null,0)).children=[a],a}(r);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),i)r.eachBefore(s);else{var l=r,c=r,f=r;r.eachBefore((function(e){e.xc.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=l===c?1:e(l,c)/2,h=d-l.x,p=t/(c.x+d+h),m=n/(f.depth||1);r.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return r}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n){!function(e){for(var t,n=0,i=0,r=e.children,o=r.length;--o>=0;)(t=r[o]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,o=t,a=t,s=n,u=o.parent.children[0],l=o.m,c=a.m,f=s.m,d=u.m;s=ww(s),o=xw(o),s&&o;)u=xw(u),(a=ww(a)).a=t,(r=s.z+f-o.z-l+e(s._,o._))>0&&(_w(Aw(s,t,i),t,r),l+=r,c+=r),f+=s.m,l+=o.m,d+=u.m,c+=a.m;s&&!ww(a)&&(a.t=s,a.m+=f-c),o&&!xw(u)&&(u.t=o,u.m+=l-d,i=t)}return i}(t,r,t.parent.A||i[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r},cluster:function(){var e=Bx,t=1,n=1,i=!1;function r(r){var o,a=0;r.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(zx,0)/e.length}(n),t.y=function(e){return 1+e.reduce(Ox,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var s=function(e){for(var t;t=e.children;)e=t[0];return e}(r),u=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),l=s.x-e(s,u)/2,c=u.x+e(u,s)/2;return r.eachAfter(i?function(e){e.x=(e.x-r.x)*t,e.y=(r.y-e.y)*n}:function(e){e.x=(e.x-l)/(c-l)*t,e.y=(1-(r.y?e.y/r.y:1))*n})}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r}},Uw=["x","y","depth","children"];function Iw(e){Ow.call(this,e)}function Ww(e){fr.call(this,[],e)}Iw.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:Uw.length,default:Uw}]},t(Iw,Ow,{layout(e){const t=e||"tidy";if(c(qw,t))return qw[t]();d("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:Uw}),Ww.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},t(Ww,fr,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||d("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[Bi(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[Bi(t)]&&o[Bi(n)]&&r.add.push(Oi({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[Bi(e)]=1)),n.forEach((e=>{(o[Bi(e.source)]||o[Bi(e.target)])&&r.mod.push(e)}))),r}});const Hw={binary:function(e,t,n,i,r){var o,a,s=e.children,u=s.length,l=new Array(u+1);for(l[0]=a=o=0;o=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=u)}var f=l[t],d=i/2+f,h=t+1,p=n-1;for(;h>>1;l[m]u-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,u),e(h,n,y,v,o,a,u)}else{var b=i?(o*y+u*g)/i:u;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,u)}}(0,u,e.value,t,n,i,r)},dice:cw,slice:Dw,slicedice:function(e,t,n,i,r){(1&e.depth?Dw:cw)(e,t,n,i,r)},squarify:Ew,resquarify:$w},Gw=["x0","y0","x1","y1","depth","children"];function Vw(e){Ow.call(this,e)}Vw.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Gw.length,default:Gw}]},t(Vw,Ow,{layout(){const e=function(){var e=Ew,t=!1,n=1,i=1,r=[0],o=Wx,a=Wx,s=Wx,u=Wx,l=Wx;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(lw),e}function f(t){var n=r[t.depth],i=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{c(Hw,t)?e.tile(Hw[t]):d("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:Gw});const Yw=Object.freeze(Object.defineProperty({__proto__:null,nest:Mw,pack:Tw,partition:jw,stratify:Lw,tree:Iw,treelinks:Ww,treemap:Vw},Symbol.toStringTag,{value:"Module"})),Xw=4278190080;function Jw(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function Kw(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>Kw(e,t.items,n)))})):Cf[i].draw(e,{items:n?t.map(Qw):t})}function Qw(e){const t=Ri(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const Zw=31,e_=new Uint32Array(33),t_=new Uint32Array(33);t_[0]=0,e_[0]=~t_[0];for(let KV=1;KV<=32;++KV)t_[KV]=t_[KV-1]<<1|1,e_[KV]=~t_[KV];function n_(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),o=~~((t+2*n+i)/i),a=e=>~~((e+n)/i);return a.invert=e=>e*i-n,a.bitmap=()=>function(e,t){const n=new Uint32Array(~~((e*t+32)/32));function i(e,t){n[e]|=t}function r(e,t){n[e]&=t}return{array:n,get:(t,i)=>{const r=i*e+t;return n[r>>>5]&1<<(r&Zw)},set:(t,n)=>{const r=n*e+t;i(r>>>5,1<<(r&Zw))},clear:(t,n)=>{const i=n*e+t;r(i>>>5,~(1<<(i&Zw)))},getRange:(t,i,r,o)=>{let a,s,u,l,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,u=a>>>5,l=s>>>5,u===l){if(n[u]&e_[a&Zw]&t_[1+(s&Zw)])return!0}else{if(n[u]&e_[a&Zw])return!0;if(n[l]&t_[1+(s&Zw)])return!0;for(let e=u+1;e{let a,s,u,l,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,u=a>>>5,l=s>>>5,u===l)i(u,e_[a&Zw]&t_[1+(s&Zw)]);else for(i(u,e_[a&Zw]),i(l,t_[1+(s&Zw)]),c=u+1;c{let a,s,u,l,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,u=a>>>5,l=s>>>5,u===l)r(u,t_[a&Zw]|e_[1+(s&Zw)]);else for(r(u,t_[a&Zw]),r(l,e_[1+(s&Zw)]),c=u+1;cn<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}function i_(e,t,n,i,r,o){let a=n/2;return e-a<0||e+a>r||t-(a=i/2)<0||t+a>o}function r_(e,t,n,i,r,o,a,s){const u=r*o/(2*i),l=e(t-u),c=e(t+u),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(l,f,c,d)||a.getRange(l,f,c,d)||s&&s.getRange(l,f,c,d)}const o_=[-1,-1,1,1],a_=[-1,1,-1,1];const s_=["right","center","left"],u_=["bottom","middle","top"];function l_(e,t,n,i,r,o,a,s,u,l,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const c_={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},f_={naive:function(e,t,n,i){const r=e.width,o=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,a=e.datum.fontSize,s=uf.width(e.datum,e.datum.text);let u,l,c,f,d,h,p,m=0;for(let i=0;i=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,u=e.x-d,l=e.x+d,c=e.y-h,f=e.y+h,e.align="center",u<0&&l<=r?e.align="left":0<=u&&r=1;)d=(h+p)/2,r_(e,c,f,l,u,d,a,s)?p=d:h=d;if(h>i)return[c,f,h,!0]}}return function(t){const s=t.datum.datum.items[i].items,l=s.length,c=t.datum.fontSize,f=uf.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,w,_,A,k,D,F,C,E,$=n?c:0,S=!1,M=!1,B=0;for(let i=0;ih&&(E=d,d=h,h=E),p>m&&(E=p,p=m,m=E),x=e(d),_=e(h),w=~~((x+_)/2),A=e(p),D=e(m),k=~~((A+D)/2),v=w;v>=x;--v)for(b=k;b>=A;--b)C=u(v,b,$,f,c),C&&([t.x,t.y,$,S]=C);for(v=w;v<=_;++v)for(b=k;b<=D;++b)C=u(v,b,$,f,c),C&&([t.x,t.y,$,S]=C);S||n||(F=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,F>=B&&!i_(g,y,f,c,r,o)&&!r_(e,g,y,c,f,c,a,null)&&(B=F,t.x=g,t.y=y,M=!0))}return!(!S&&!M)&&(g=f/2,y=c/2,a.setRange(e(t.x-g),e(t.y-y),e(t.x+g),e(t.y+y)),t.align="center",t.baseline="middle",!0)}},floodfill:function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],u=e.bitmap();return function(t){const l=t.datum.datum.items[i].items,c=l.length,f=t.datum.fontSize,d=uf.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,w,_,A,k,D,F=n?f:0,C=!1,E=!1,$=0;for(let i=0;i=1;)k=(_+A)/2,r_(e,v,b,f,d,k,a,s)?A=k:_=k;_>F&&(t.x=v,t.y=b,F=_,C=!0)}}C||n||(D=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,D>=$&&!i_(v,b,d,f,r,o)&&!r_(e,v,b,f,d,f,a,null)&&($=D,t.x=v,t.y=b,E=!0))}return!(!C&&!E)&&(v=d/2,b=f/2,a.setRange(e(t.x-v),e(t.y-b),e(t.x+v),e(t.y+b)),t.align="center",t.baseline="middle",!0)}}};function d_(e,t,n,i,r,o,a,s,u,l,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=function(e,t){const n=new Float64Array(t),i=e.length;for(let r=0;r[e.x,e.x,e.x,e.y,e.y,e.y];return e?"line"===e||"area"===e?e=>r(e.datum):"line"===t?e=>{const t=e.datum.items[i].items;return r(t.length?t["start"===n?0:t.length-1]:{x:NaN,y:NaN})}:e=>{const t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:r}(p,m,s,u),v=null===l||l===1/0,b=g&&"naive"===c;var x;let w=-1,_=-1;const A=e.map((e=>{const t=v?uf.width(e,e.text):void 0;return w=Math.max(w,t),_=Math.max(_,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));l=null===l||l===1/0?Math.max(w,_)+Math.max(...i):l;const k=n_(t[0],t[1],l);let D;if(!b){n&&A.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;ee.datum));D=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,u=Ta(o,a).getContext("2d"),l=Ta(o,a).getContext("2d"),c=s&&Ta(o,a).getContext("2d");n.forEach((e=>Kw(u,e,!1))),Kw(l,t,!1),s&&Kw(c,t,!0);const f=Jw(u,o,a),d=Jw(l,o,a),h=s&&Jw(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,w,_,A;for(y=0;yn.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(k,a&&A)}const F=g?f_[c](k,D,a,u):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],u=i.length;return function(t){const l=t.boundary,c=t.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>r||l[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,w,_,A,k,D,F=t.textWidth??0;for(let r=0;r>>2&3)-1,h=0===f&&0===d||i[r]<0,p=f&&d?Math.SQRT1_2:1,m=i[r]<0?-1:1,g=l[1+f]+i[r]*f*p,w=l[4+d]+m*c*d/2+i[r]*d*p,v=w-c/2,b=w+c/2,_=e(g),k=e(v),D=e(b),!F){if(!l_(_,_,k,D,a,s,0,0,0,0,0,h))continue;F=uf.width(t.datum,t.datum.text)}if(x=g+m*F*f/2,g=x-F/2,y=x+F/2,_=e(g),A=e(y),l_(_,A,k,D,a,s,0,0,0,0,0,h))return t.x=f?f*m<0?y:g:x,t.y=d?d*m<0?b:v:w,t.align=s_[f*m+1],t.baseline=u_[d*m+1],a.setRange(_,k,A,D),!0}return!1}}(k,D,h,d);return A.forEach((e=>e.opacity=+F(e))),A}const h_=["x","y","opacity","align","baseline"],p_=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function m_(e){fr.call(this,null,e)}m_.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:p_},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:h_.length,default:h_}]},t(m_,fr,{transform(e,t){const n=e.modified();if(!(n||t.changed(t.ADD_REM)||function(n){const i=e[n];return a(i)&&t.modified(i.fields)}("sort")))return;e.size&&2===e.size.length||d("Size parameter should be specified as a [width, height] array.");const i=e.as||h_;return d_(t.materialize(t.SOURCE).source||[],e.size,e.sort,u(null==e.offset?1:e.offset),u(e.anchor||p_),e.avoidMarks||[],!1!==e.avoidBaseMark,e.lineAnchor||"end",e.markIndex||0,void 0===e.padding?0:e.padding,e.method||"naive").forEach((e=>{const t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline})),t.reflow(n).modifies(i)}});const g_=Object.freeze(Object.defineProperty({__proto__:null,label:m_},Symbol.toStringTag,{value:"Module"}));function y_(e,t){var n,i,r,o,a,s,u=[],l=function(e){return e(o)};if(null==t)u.push(e);else for(n={},i=0,r=e.length;i{to(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let i=0;i"poly"===e?t:"quad"===e?2:1)(o,a),u=e.as||[x(e.x),x(e.y)],l=b_[o],f=[];let h=e.extent;c(b_,o)||d("Invalid regression method: "+o),null!=h&&"log"===o&&h[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),h=null),i.forEach((n=>{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=l(n,e.x,e.y,a);if(e.params)return void f.push(Oi({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const c=h||k(n,e.x),d=e=>{const t={};for(let i=0;id([e,i.predict(e)]))):oo(i.predict,c,25,200).forEach(d)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const w_=Object.freeze(Object.defineProperty({__proto__:null,loess:v_,regression:x_},Symbol.toStringTag,{value:"Module"})),__=134217729;function A_(e,t,n,i,r){let o,a,s,u,l=t[0],c=i[0],f=0,d=0;c>l==c>-l?(o=l,l=t[++f]):(o=c,c=i[++d]);let h=0;if(fl==c>-l?(a=l+o,s=o-(a-l),l=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);fl==c>-l?(a=o+l,u=a-o,s=o-(a-u)+(l-u),l=t[++f]):(a=o+c,u=a-o,s=o-(a-u)+(c-u),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f=33306690738754716e-32*l?u:-function(e,t,n,i,r,o,a){let s,u,l,c,f,d,h,p,m,g,y,v,b,x,w,_,A,k;const D=e-r,F=n-r,C=t-o,E=i-o;x=D*E,d=__*D,h=d-(d-D),p=D-h,d=__*E,m=d-(d-E),g=E-m,w=p*g-(x-h*m-p*m-h*g),_=C*F,d=__*C,h=d-(d-C),p=C-h,d=__*F,m=d-(d-F),g=F-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,D_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,D_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,D_[2]=v-(k-f)+(y-f),D_[3]=k;let $=function(e,t){let n=t[0];for(let i=1;i=S||-$>=S)return $;if(f=e-D,s=e-(D+f)+(f-r),f=n-F,l=n-(F+f)+(f-r),f=t-C,u=t-(C+f)+(f-o),f=i-E,c=i-(E+f)+(f-o),0===s&&0===u&&0===l&&0===c)return $;if(S=11093356479670487e-47*a+33306690738754706e-32*Math.abs($),$+=D*c+E*s-(C*l+F*u),$>=S||-$>=S)return $;x=s*E,d=__*s,h=d-(d-s),p=s-h,d=__*E,m=d-(d-E),g=E-m,w=p*g-(x-h*m-p*m-h*g),_=u*F,d=__*u,h=d-(d-u),p=u-h,d=__*F,m=d-(d-F),g=F-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,$_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,$_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,$_[2]=v-(k-f)+(y-f),$_[3]=k;const M=A_(4,D_,4,$_,F_);x=D*c,d=__*D,h=d-(d-D),p=D-h,d=__*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=C*l,d=__*C,h=d-(d-C),p=C-h,d=__*l,m=d-(d-l),g=l-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,$_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,$_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,$_[2]=v-(k-f)+(y-f),$_[3]=k;const B=A_(M,F_,4,$_,C_);x=s*c,d=__*s,h=d-(d-s),p=s-h,d=__*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=u*l,d=__*u,h=d-(d-u),p=u-h,d=__*l,m=d-(d-l),g=l-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,$_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,$_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,$_[2]=v-(k-f)+(y-f),$_[3]=k;const z=A_(B,C_,4,$_,E_);return E_[z-1]}(e,t,n,i,r,o,l)}const M_=Math.pow(2,-52),B_=new Uint32Array(512);class z_{static from(e,t=j_,n=L_){const i=e.length,r=new Float64Array(2*i);for(let o=0;o>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=e.length>>1;let a=1/0,s=1/0,u=-1/0,l=-1/0;for(let D=0;Du&&(u=t),n>l&&(l=n),this._ids[D]=D}const c=(a+u)/2,f=(s+l)/2;let d,h,p,m=1/0;for(let D=0;D0&&(h=D,m=t)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let D=0;Di&&(t[n++]=r,i=this._dists[r])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(S_(g,y,v,b,w,_)<0){const e=h,t=v,n=b;h=p,v=w,b=_,p=e,w=t,_=n}const A=function(e,t,n,i,r,o){const a=n-e,s=i-t,u=r-e,l=o-t,c=a*a+s*s,f=u*u+l*l,d=.5/(a*l-s*u),h=e+(l*c-s*f)*d;return{x:h,y:t+(a*f-u*c)*d}}(g,y,v,b,w,_);this._cx=A.x,this._cy=A.y;for(let D=0;D0&&Math.abs(a-D)<=M_&&Math.abs(s-F)<=M_)continue;if(D=a,F=s,o===d||o===h||o===p)continue;let u=0;for(let e=0,t=this._hashKey(a,s);e=0;)if(c=l,c===u){c=-1;break}if(-1===c)continue;let f=this._addTriangle(c,o,n[c],-1,-1,i[c]);i[o]=this._legalize(f+2),i[c]=f,k++;let m=n[c];for(;l=n[m],S_(a,s,e[2*m],e[2*m+1],e[2*l],e[2*l+1])<0;)f=this._addTriangle(m,o,l,i[o],-1,i[m]),i[o]=this._legalize(f+2),n[m]=m,k--,m=l;if(c===u)for(;l=t[c],S_(a,s,e[2*l],e[2*l+1],e[2*c],e[2*c+1])<0;)f=this._addTriangle(l,o,c,-1,i[c],i[l]),this._legalize(f+2),i[l]=f,n[c]=c,k--,c=l;this._hullStart=t[o]=c,n[c]=t[m]=o,n[o]=m,r[this._hashKey(a,s)]=o,r[this._hashKey(e[2*c],e[2*c+1])]=c}this.hull=new Uint32Array(k);for(let D=0,F=this._hullStart;D0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const a=n[e],s=e-e%3;if(o=s+(e+2)%3,-1===a){if(0===r)break;e=B_[--r];continue}const u=a-a%3,l=s+(e+1)%3,c=u+(a+2)%3,f=t[o],d=t[e],h=t[l],p=t[c];if(N_(i[2*f],i[2*f+1],i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1])){t[e]=p,t[a]=f;const i=n[c];if(-1===i){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,i),this._link(a,n[o]),this._link(o,c);const s=u+(a+1)%3;r=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;P_(e,n+i>>1,r),t[e[n]]>t[e[i]]&&P_(e,n,i),t[e[r]]>t[e[i]]&&P_(e,r,i),t[e[n]]>t[e[r]]&&P_(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]s);if(o=o-n?(T_(e,t,r,i),T_(e,t,n,o-1)):(T_(e,t,n,o-1),T_(e,t,r,i))}}function P_(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function j_(e){return e[0]}function L_(e){return e[1]}const q_=1e-6;class U_{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const i=(e=+e)+(n=+n),r=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>q_||Math.abs(this._y1-r)>q_)&&(this._+="L"+i+","+r),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=i},${this._y1=r}`)}rect(e,t,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class I_{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}let W_=class{constructor(e,[t,n,i,r]=[0,0,960,500]){if(!((i=+i)>=(t=+t)&&(r=+r)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=i,this.xmin=t,this.ymax=r,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:i}=this;let r,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let p,m,g=0,y=0,v=n.length;g1;)r-=2;for(let o=2;o0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t2&&function(e){const{triangles:t,coords:n}=e;for(let i=0;i1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],i=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],r=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]);for(let o=0,a=t.length/2;o0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,2===i.length&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new W_(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:o,collinear:a}=this;if(a){const t=a.indexOf(e);return t>0&&(yield a[t-1]),void(t=0&&r!==n&&r!==i;)n=r;return r}_step(e,t,n){const{inedges:i,hull:r,_hullIndex:o,halfedges:a,triangles:s,points:u}=this;if(-1===i[e]||!u.length)return(e+1)%(u.length>>1);let l=e,c=G_(t-u[2*e],2)+G_(n-u[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=G_(t-u[2*i],2)+G_(n-u[2*i+1],2);if(f=h));)if(t.x=f+r,t.y=d+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1]||n&&oA(t,e,s[0])||n&&(l=n,!((a=t).x+a.x1>l[0].x&&a.x+a.x0l[0].y&&a.y+a.y0>5,x=s[0]>>5,w=t.x-(b<<4),_=127&w,A=32-_,k=t.y1-t.y0,D=(t.y+t.y0)*x+(w>>5),F=0;F>>_:0);D+=x}return t.sprite=null,!0}return!1}return f.layout=function(){for(var u=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=2048/t,e.height=nA/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(Ta()),f=function(e){var t=[],n=-1;for(;++n>5)*s[1]),h=null,p=l.length,m=-1,g=[],y=l.map((s=>({text:e(s),font:t(s),style:i(s),weight:r(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((e,t)=>t.size-e.size));++m>1,v.y=s[1]*(c()+.5)>>1,rA(u,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?aA(h,v):h=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return g},f.words=function(e){return arguments.length?(l=e,f):l},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=uA(e),f):t},f.fontStyle=function(e){return arguments.length?(i=uA(e),f):i},f.fontWeight=function(e){return arguments.length?(r=uA(e),f):r},f.rotate=function(e){return arguments.length?(o=uA(e),f):o},f.text=function(t){return arguments.length?(e=uA(t),f):e},f.spiral=function(e){return arguments.length?(u=lA[e]||e,f):u},f.fontSize=function(e){return arguments.length?(n=uA(e),f):n},f.padding=function(e){return arguments.length?(a=uA(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}function rA(e,t,n,i){if(!t.sprite){var r=e.context,o=e.ratio;r.clearRect(0,0,2048/o,nA/o);var a,s,u,l,c,f=0,d=0,h=0,p=n.length;for(--i;++i>5<<5,u=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(u>h&&(h=u),f+a>=2048&&(f=0,d+=h,h=0),d+u>=nA)break;r.translate((f+(a>>1))/o,(d+(u>>1))/o),t.rotate&&r.rotate(t.rotate*tA),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=a,t.height=u,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=u>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var w=r.getImageData(0,0,2048/o,nA/o).data,_=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,u=t.y1-t.y0,l=0;l>5),F=w[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;_[D]|=F,A|=F}A?k=c:(t.y0++,u--,c--,d++)}t.y1=t.y0+k,t.sprite=_.slice(0,(t.y1-t.y0)*s)}}}function oA(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,u=32-s,l=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f>>s:0))&t[c+d])return!0;c+=n}return!1}function aA(e,t){var n=e[0],i=e[1];t.x+t.x0i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function sA(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function uA(e){return"function"==typeof e?e:function(){return e}}var lA={archimedean:sA,rectangular:function(e){var t=4*e[0]/e[1],n=0,i=0;return function(e){var r=e<0?-1:1;switch(Math.sqrt(1+4*r*e)-r&3){case 0:n+=t;break;case 1:i+=4;break;case 2:n-=t;break;default:i-=4}return[n,i]}}};const cA=["x","y","font","fontSize","fontStyle","fontWeight","angle"],fA=["text","font","rotate","fontSize","fontStyle","fontWeight"];function dA(e){fr.call(this,iA(),e)}dA.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:cA}]},t(dA,fr,{transform(e,t){!e.size||e.size[0]&&e.size[1]||d("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||fA.some((function(n){const i=e[n];return a(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,o=e.as||cA;let u,l=e.fontSize||14;if(a(l)?u=e.fontSizeRange:l=s(l),u){const e=l,t=Hs("sqrt")().domain(k(i,e)).range(u);l=n=>t(e(n))}i.forEach((e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0}));const c=r.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(xr).layout(),f=r.size(),h=f[0]>>1,p=f[1]>>1,m=c.length;for(let a,s,d=0;dnew Uint8Array(e),mA=e=>new Uint16Array(e),gA=e=>new Uint32Array(e);function yA(e,t,n){const i=(t<257?pA:t<65537?mA:gA)(e);return n&&i.set(n),i}function vA(e,t,n){const i=1<{const i=e[t],r=e[n];return ir?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,u),a)l=t,c=e,t=Array(a+s),e=gA(a+s),function(e,t,n,i,r,o,a,s,u){let l,c=0,f=0;for(l=0;c0)for(f=0;fe,size:()=>n}}function xA(e){fr.call(this,function(){let e=8,t=[],n=gA(0),i=yA(0,e),r=yA(0,e);return{data:()=>t,seen:()=>{return e=n,i=t.length,n=e.length>=i?e:((r=r||new e.constructor(i)).set(e),r);var e,i,r},add(e){for(let n,i=0,r=t.length,o=e.length;it.length,curr:()=>i,prev:()=>r,reset:e=>r[e]=i[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){i[e]|=t},clear(e,t){i[e]&=~t},resize(t,n){(t>i.length||n>e)&&(e=Math.max(n,e),i=yA(t,e,i),r=yA(t,e))}}}(),e),this._indices=null,this._dims=null}function wA(e){fr.call(this,null,e)}xA.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},t(xA,fr,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((e=>t.modified(e.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},o=this._dims=[],a=i.length;let s,u,l=0;for(;l{const e=r.remove(t,n);for(const t in i)i[t].reindex(e)}))},update(e,t,n){const i=this._dims,r=e.query,o=t.stamp,a=i.length;let s,u,l=0;for(n.filters=0,u=0;uh)for(g=h,y=Math.min(f,p);gp)for(g=Math.max(f,p),y=d;gc)for(h=c,p=Math.min(u,f);hf)for(h=Math.max(u,f),p=l;hs[e]&n?null:a[e];return o.filter(o.MOD,l),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^u[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return t&&!(0^u[e]&n)?a[e]:null}))):(o.filter(o.ADD,l),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>l(e._index)))}});const _A=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:xA,resolvefilter:wA},Symbol.toStringTag,{value:"Module"})),AA="Literal",kA="Property",DA="ArrayExpression",FA="BinaryExpression",CA="CallExpression",EA="ConditionalExpression",$A="LogicalExpression",SA="MemberExpression",MA="ObjectExpression",BA="UnaryExpression";function zA(e){this.type=e}var OA,NA,RA,TA,PA;zA.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case DA:return e.elements;case FA:case $A:return[e.left,e.right];case CA:return[e.callee].concat(e.arguments);case EA:return[e.test,e.consequent,e.alternate];case SA:return[e.object,e.property];case MA:return e.properties;case kA:return[e.key,e.value];case BA:return[e.argument];default:return[]}}(this),n=0,i=t.length;n",OA[3]="Identifier",OA[4]="Keyword",OA[5]="Null",OA[6]="Numeric",OA[7]="Punctuator",OA[8]="String",OA[9]="RegularExpression";var jA="Identifier",LA="Unexpected token %0",qA="Invalid regular expression",UA="Invalid regular expression: missing /",IA="Octal literals are not allowed in strict mode.",WA="ILLEGAL",HA="Disabled.",GA=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),VA=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function YA(e,t){if(!e)throw new Error("ASSERT: "+t)}function XA(e){return e>=48&&e<=57}function JA(e){return"0123456789abcdefABCDEF".includes(e)}function KA(e){return"01234567".includes(e)}function QA(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function ZA(e){return 10===e||13===e||8232===e||8233===e}function ek(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&GA.test(String.fromCharCode(e))}function tk(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&VA.test(String.fromCharCode(e))}const nk={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function ik(){for(;RA1114111||"}"!==e)&&xk({},LA,WA),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function ak(){var e,t;for(e=NA.charCodeAt(RA++),t=String.fromCharCode(e),92===e&&(117!==NA.charCodeAt(RA)&&xk({},LA,WA),++RA,(e=rk("u"))&&"\\"!==e&&ek(e.charCodeAt(0))||xk({},LA,WA),t=e);RA>>="===(i=NA.substr(RA,4))?{type:7,value:i,start:r,end:RA+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:RA+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===t?{type:7,value:t,start:r,end:RA+=2}:("//"===t&&xk({},LA,WA),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:r,end:++RA}:void xk({},LA,WA))}function lk(){var e,t,n;if(YA(XA((n=NA[RA]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=RA,e="","."!==n){if(e=NA[RA++],n=NA[RA],"0"===e){if("x"===n||"X"===n)return++RA,function(e){let t="";for(;RA=0&&xk({},qA,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";xk({},qA)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(i){xk({},qA)}try{return new RegExp(e,t)}catch(r){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:RA}}function fk(){if(ik(),RA>=TA)return{type:2,start:RA,end:RA};const e=NA.charCodeAt(RA);return ek(e)?sk():40===e||41===e||59===e?uk():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(YA("'"===(e=NA[RA])||'"'===e,"String literal must starts with a quote"),t=RA,++RA;RA(YA(t":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function Tk(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,u,l;if(e=PA,u=Nk(),0===(r=Rk(i=PA)))return u;for(i.prec=r,dk(),t=[e,PA],o=[u,i,a=Nk()];(r=Rk(PA))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),t.pop(),n=pk(s,u,a),o.push(n);(i=dk()).prec=r,o.push(i),t.push(PA),n=Nk(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=pk(o[l-1].value,o[l-2],n),l-=2;return n}(),Ak("?")&&(dk(),t=Tk(),_k(":"),e=function(e,t,n){const i=new zA("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,Tk())),e}function Pk(){const e=Tk();if(Ak(","))throw new Error(HA);return e}function jk(e){RA=0,TA=(NA=e).length,PA=null,hk();const t=Pk();if(2!==PA.type)throw new Error("Unexpect token after expression.");return t}var Lk={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function qk(e){function t(t,n,i){return r=>function(t,n,i,r){let o=e(n[0]);return i&&(o=i+"("+o+")",0===i.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&d("Missing arguments to clamp function."),t.length>3&&d("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),btoa:"btoa",atob:"atob",regexp:r,test:t("test",r),if:function(t){t.length<3&&d("Missing arguments to if function."),t.length>3&&d("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function Uk(e){const t=(e=e||{}).allowed?ee(e.allowed):{},n=e.forbidden?ee(e.forbidden):{},i=e.constants||Lk,r=(e.functions||qk)(p),o=e.globalvar,s=e.fieldvar,u=a(o)?o:e=>`${o}["${e}"]`;let l={},f={},h=0;function p(e){if(ie(e))return e;const t=m[e.type];return null==t&&d("Unsupported type: "+e.type),t(e)}const m={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return h>0?r:c(n,r)?d("Illegal identifier: "+r):c(i,r)?i[r]:c(t,r)?r:(l[r]=1,u(r))},MemberExpression:e=>{const t=!e.computed,n=p(e.object);t&&(h+=1);const i=p(e.property);return n===s&&(f[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(h-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&d("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=c(r,t)&&r[t];return i||d("Unrecognized function: "+t),a(i)?i(n):i+"("+n.map(p).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(p).join(",")+"]",BinaryExpression:e=>"("+p(e.left)+" "+e.operator+" "+p(e.right)+")",UnaryExpression:e=>"("+e.operator+p(e.argument)+")",ConditionalExpression:e=>"("+p(e.test)+"?"+p(e.consequent)+":"+p(e.alternate)+")",LogicalExpression:e=>"("+p(e.left)+e.operator+p(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(p).join(",")+"}",Property:e=>{h+=1;const t=p(e.key);return h-=1,t+":"+p(e.value)}};function g(e){const t={code:p(e),globals:Object.keys(l),fields:Object.keys(f)};return l={},f={},t}return g.functions=r,g.constants=i,g}const Ik=Symbol("vega_selection_getter");function Wk(e){return e.getter&&e.getter[Ik]||(e.getter=O(e.field),e.getter[Ik]=!0),e.getter}const Hk="intersect",Gk="union",Vk="or",Yk="and",Xk="_vgsid_",Jk=O(Xk),Kk="index:unit";function Qk(e,t){for(var n,i,r=t.fields,o=t.values,a=r.length,s=0;s=o[s])return!1}else if("E-LTE"===i.type){if(n>o[s])return!1}else if("E-GT"===i.type){if(n<=o[s])return!1}else if("E-GTE"===i.type){if(nt.includes(e))):t},R_union:function(e,t){var n=A(t[0]),i=A(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]i&&(n=t[1],i=t[0]),e.length?ii&&(e[1]=i),e):[n,i]}};function iD(e,t,n,i){t[0].type!==AA&&d("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&S(t).value)!==Hk||c(i,a)||(i[a]=n.getData(r).indataRef(n,o)),c(i,s)||(i[s]=n.getData(r).tuplesRef())}function rD(e){const t=this.context.data[e];return t?t.values.value:[]}const oD=e=>function(t,n){const i=this.context.dataflow.locale();return null===t?"null":i[e](n)(t)},aD=oD("format"),sD=oD("timeFormat"),uD=oD("utcFormat"),lD=oD("timeParse"),cD=oD("utcParse"),fD=new Date(2e3,0,1);function dD(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(fD.setYear(2e3),fD.setMonth(e),fD.setDate(t),sD.call(this,fD,n)):""}function hD(e,t,n,i){t[0].type!==AA&&d("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!c(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(a){}}function pD(e,t,n,i){if(t[0].type===AA)mD(n,i,t[0].value);else for(e in n.scales)mD(n,i,e)}function mD(e,t,n){const i="%"+n;if(!c(t,i))try{t[i]=e.scaleRef(n)}catch(r){}}function gD(e,t){if(ie(e)){const n=t.scales[e];return n&&Ws(n.value)?n.value:void 0}if(a(e))return Ws(e)?e:void 0}function yD(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=pD,n._range=pD,n._scale=pD;const i=t=>"_["+(t.type===AA?fe("%"+t.value):fe("%")+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}function vD(e,t){return function(n,i,r){if(n){const t=gD(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const bD=vD("area",(function(e){return rg=new Zn,Lm(e,og),2*rg})),xD=vD("bounds",(function(e){var t,n,i,r,o,a,s;if(Xm=Ym=-(Gm=Vm=1/0),tg=[],Lm(e,zg),n=tg.length){for(tg.sort(Ug),t=1,o=[i=tg[0]];tqg(i[0],i[1])&&(i[1]=r[1]),qg(r[0],i[1])>qg(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,t=0,i=o[n=o.length-1];t<=n;i=r,++t)r=o[t],(s=qg(i[1],r[0]))>a&&(a=s,Gm=r[0],Ym=i[1])}return tg=ng=null,Gm===1/0||Vm===1/0?[[NaN,NaN],[NaN,NaN]]:[[Gm,Vm],[Ym,Xm]]})),wD=vD("centroid",(function(e){yg=vg=bg=xg=wg=_g=Ag=kg=0,Dg=new Zn,Fg=new Zn,Cg=new Zn,Lm(e,Wg);var t=+Dg,n=+Fg,i=+Cg,r=Dm(t,n,i);return rFD(e,t)}const ED={};function $D(e){return f(e)||ArrayBuffer.isView(e)?e:null}function SD(e){return $D(e)||(ie(e)?e:null)}const MD=e=>e.data;function BD(e,t){const n=rD.call(t,e);return n.root&&n.root.lookup||{}}const zD=()=>"undefined"!=typeof window&&window||null;function OD(e,t,n){if(!e)return[];const[i,r]=e,o=(new Ml).set(i[0],i[1],r[0],r[1]);return mh(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=u(e.marktype),i=u(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const ND={random:()=>xr(),cumulativeNormal:Er,cumulativeLogNormal:Or,cumulativeUniform:Lr,densityNormal:Cr,densityLogNormal:zr,densityUniform:jr,quantileNormal:$r,quantileLogNormal:Nr,quantileUniform:qr,sampleNormal:Fr,sampleLogNormal:Br,sampleUniform:Pr,isArray:f,isBoolean:Pe,isDate:he,isDefined:e=>void 0!==e,isNumber:te,isObject:ne,isRegExp:Te,isString:ie,isTuple:Mi,isValid:e=>null!=e&&e==e,toBoolean:Re,toDate:e=>je(e),toNumber:A,toString:Ne,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;ik(e),inScope:function(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:OD,clampRange:be,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=zD();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=zD();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return ms(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,i=this.context.data[e].input;return n.pulse(i,n.changeset().remove(p).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?el(n,t=t||Iu(e)):e}},panLinear:ve,panLog:ye,panPow:ge,panSymlog:me,zoomLinear:ce,zoomLog:se,zoomPow:ue,zoomSymlog:le,encode:function(e,t,n){if(e){const n=this.context.dataflow,i=e.mark.source;n.pulse(i,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,i,r,o){const a=this.context.dataflow,s=this.context.data[e],u=s.input,l=a.stamp();let c,d,h=s.changes;if(!1===a._trigger||!(u.value.length||t||i))return 0;if((!h||h.stamp{s.modified=!0,a.pulse(u,h).run()}),!0,1)),n&&(c=!0===n?p:f(n)||Mi(n)?n:CD(n),h.remove(c)),t&&h.insert(t),i&&(c=CD(i),u.value.some(c)?h.remove(c):h.insert(i)),r)for(d in o)h.modify(r,d,o[d]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=u(e))[e.length-1];return void 0===r||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e},lassoPath:function(e){return u(e).reduce(((t,n,i)=>{let[r,o]=n;return t+(0==i?`M ${r},${o} `:i===e.length-1?" Z":`L ${r},${o} `)}),"")},intersectLasso:function(e,t,n){const{x:i,y:r,mark:o}=n,a=(new Ml).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[s,u]of t)sa.x2&&(a.x2=s),ua.y2&&(a.y2=u);return a.translate(i,r),OD([[a.x1,a.y1],[a.x2,a.y2]],e,o).filter((e=>function(e,t,n){let i=0;for(let r=0,o=n.length-1;rt!=s>t&&e<(a-u)*(t-l)/(s-l)+u&&i++}return 1&i}(e.x,e.y,t)))}},RD=["view","item","group","xy","x","y"],TD="this.",PD={},jD={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${fe("$"+e)}]`,functions:function(e){const t=qk(e);RD.forEach((e=>t[e]="event.vega."+e));for(const n in ND)t[n]=TD+n;return v(t,yD(e,ND,PD)),t},constants:Lk,visitors:PD},LD=Uk(jD);function qD(e,t,n){return 1===arguments.length?ND[e]:(ND[e]=t,n&&(PD[e]=n),LD&&(LD.functions[e]=TD+e),this)}function UD(e,t){const n={};let i;try{i=jk(e=ie(e)?e:fe(e)+"")}catch(o){d("Expression parse error: "+e)}i.visit((e=>{if(e.type!==CA)return;const i=e.callee.name,r=jD.visitors[i];r&&r(i,e.arguments,t,n)}));const r=LD(i);return r.globals.forEach((e=>{const i="$"+e;!c(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:v({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}qD("bandwidth",(function(e,t){const n=gD(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),pD),qD("copy",(function(e,t){const n=gD(e,(t||this).context);return n?n.copy():void 0}),pD),qD("domain",(function(e,t){const n=gD(e,(t||this).context);return n?n.domain():[]}),pD),qD("range",(function(e,t){const n=gD(e,(t||this).context);return n&&n.range?n.range():[]}),pD),qD("invert",(function(e,t,n){const i=gD(e,(n||this).context);return i?f(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),pD),qD("scale",(function(e,t,n){const i=gD(e,(n||this).context);return i?i(t):void 0}),pD),qD("gradient",(function(e,t,n,i,r){e=gD(e,(r||this).context);const o=Nu(t,n);let a=e.domain(),s=a[0],u=S(a),c=l;return u-s?c=ru(e,s,u):e=(e.interpolator?Hs("sequential")().interpolator(e.interpolator()):Hs("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,u=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),u!==S(a)&&a.push(u)),a.forEach((t=>o.stop(c(t),e(t)))),o}),pD),qD("geoArea",bD,pD),qD("geoBounds",xD,pD),qD("geoCentroid",wD,pD),qD("geoShape",(function(e,t,n){const i=gD(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),pD),qD("geoScale",(function(e,t){const n=gD(e,(t||this).context);return n&&n.scale()}),pD),qD("indata",(function(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r?r.count:r}),(function(e,t,n,i){t[0].type!==AA&&d("First argument to indata must be a string literal."),t[1].type!==AA&&d("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;c(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),qD("data",rD,hD),qD("treePath",(function(e,t,n){const i=BD(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(MD):void 0}),hD),qD("treeAncestors",(function(e,t){const n=BD(e,this)[t];return n?n.ancestors().map(MD):void 0}),hD),qD("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,u=this.context.data[e],l=u?u.values.value:[],c=u?u[Kk]&&u[Kk].value:void 0,f=n===Hk,d=l.length,h=0;h(e[o[n].field]=t,e)),{}))}else l=Xk,c=Jk(r),(d=(f=b[l]||(b[l]={}))[s]||(f[s]=[])).push(c),n&&(d=x[s]||(x[s]=[])).push({[Xk]:c});if(t=t||Gk,b[Xk]?b[Xk]=nD[`${Xk}_${t}`](...Object.values(b[Xk])):Object.keys(b).forEach((e=>{b[e]=Object.keys(b[e]).map((t=>b[e][t])).reduce(((n,i)=>void 0===n?i:nD[`${w[e]}_${t}`](n,i)))})),v=Object.keys(x),n&&v.length){b[i?"vlPoint":"vlMulti"]=t===Gk?{[Vk]:v.reduce(((e,t)=>(e.push(...x[t]),e)),[])}:{[Yk]:v.map((e=>({[Vk]:x[e]})))}}return b}),iD),qD("vlSelectionTuples",(function(e,t){return e.map((e=>v(t.fields?{values:t.fields.map((t=>Wk(t)(e.datum)))}:{[Xk]:Jk(e.datum)},t)))}));const ID=ee(["rule"]),WD=ee(["group","image","rect"]);function HD(e){return(e+"").toLowerCase()}function GD(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var VD={operator:(e,t)=>GD(e,["_"],t.code),parameter:(e,t)=>GD(e,["datum","_"],t.code),event:(e,t)=>GD(e,["event"],t.code),handler:(e,t)=>GD(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const o in i){const e="o["+fe(o)+"]";r+=`$=${i[o].code};if(${e}!==$)${e}=$,m=1;`}return r+=function(e,t){let n="";return ID[t]||(e.x2&&(e.x?(WD[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(WD[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(i,n),r+="return m;",GD(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(fe).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=Function("a","b","var u, v; return "+e.map(((e,i)=>{const r=t[i];let o,a;return e.path?(o=`a${e.path}`,a=`b${e.path}`):((n=n||{})["f"+i]=e,o=`this.f${i}(a)`,a=`this.f${i}(b)`),function(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${i}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${i} : `}(o,a,-r,r)})).join("")+"0;");return n?i.bind(n):i}}};function YD(e,t,n){if(!e||!ne(e))return e;for(let i,r=0,o=XD.length;re&&e.$tupleid?Bi:e));return t.fn[n]||(t.fn[n]=P(i,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,i,r){const o=t.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(r),a.detachSubflow=()=>t.detach(o),a}}},{key:"$tupleid",parse:function(){return Bi}}];const JD={skip:!0};function KD(e,t,n,i){return new QD(e,t,n,i)}function QD(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||VD,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function ZD(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function eF(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}QD.prototype=ZD.prototype={fork(){const e=new ZD(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((t=>t!==e));const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),"collect"===HD(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let r=n.get(e.parent.$ref);r?(i.connect(r,[t]),t.targets().add(r)):(n.unresolved=n.unresolved||[]).push((()=>{r=n.get(e.parent.$ref),i.connect(r,[t]),t.targets().add(r)}))}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const o in e.data){const i=n.data[o]||(n.data[o]={});e.data[o].forEach((e=>i[e]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[HD(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach((e=>t.parseOperator(e))),n.forEach((e=>t.parseOperatorParameters(e))),(e.streams||[]).forEach((e=>t.parseStream(e))),(e.updates||[]).forEach((e=>t.parseUpdate(e))),t.resolve()},parseOperator:function(e){const t=this;"operator"!==HD(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const n=t.get(e.id);n||d("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=f(r)?r.map((e=>YD(e,n,t))):YD(r,n,t)}return t},parseStream:function(e){var t,n=this,i=null!=e.filter?n.eventExpression(e.filter):void 0,r=null!=e.stream?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,i):e.merge&&(r=(t=e.merge.map((e=>n.get(e))))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map((e=>n.get(e))),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(i)),null!=e.throttle&&(r=r.throttle(+e.throttle)),null!=e.debounce&&(r=r.debounce(+e.debounce)),null==r&&d("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=ne(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||d("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(e,r,t,o,a)},getState:function(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach((n=>{const r=t.signals[n];e.signals(n,r)&&(i[n]=r.value)}))}if(e.data){var r=n.data={};Object.keys(t.data).forEach((n=>{const i=t.data[n];e.data(n,i)&&(r[n]=i.input.value)}))}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map((t=>t.getState(e)))),n},setState:function(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach((e=>{n.update(t.signals[e],r[e],JD)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(p).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const tF="default";function nF(e,t){const n=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(n)return null==t?n.style.removeProperty("cursor"):n.style.cursor=t}function iF(e,t){var n=e._runtime.data;return c(n,t)||d("Unrecognized data set: "+t),n[t]}function rF(e,t){ji(t)||d("Second argument to changes must be a changeset.");const n=iF(this,e);return n.modified=!0,this.pulse(n.input,t)}function oF(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function aF(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function sF(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function uF(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=sF(e),(i=Uf(t.changedTouches?t.changedTouches[0]:t,a))[0]-=r[0],i[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const i=t?"group"===t.mark.marktype?t:t.mark.group:null;function r(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function o(e){if(!e)return n;ie(e)&&(e=r(e));const t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:s(e),item:s(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}const lF="view",cF={trap:!1};function fF(e,t,n,i){e._eventListeners.push({type:n,sources:u(t),handler:i})}function dF(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||ne(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function hF(e){return e.item}function pF(e){return e.item.mark.source}function mF(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function gF(e,t,n){const i=document.createElement(e);for(const r in t)i.setAttribute(r,t[r]);return null!=n&&(i.textContent=n),i}function yF(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),fF(i,t,r,o),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function vF(e,t,n,i){const r=i.signal(n.signal),o=gF("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(gF("label"));a.appendChild(gF("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=bF;switch(n.input){case"checkbox":s=xF;break;case"select":s=wF;break;case"radio":s=_F;break;case"range":s=AF}s(e,a,n,r)}function bF(e,t,n,i){const r=gF("input");for(const o in n)"signal"!==o&&"element"!==o&&r.setAttribute("input"===o?"type":o,n[o]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",(()=>e.update(r.value))),e.elements=[r],e.set=e=>r.value=e}function xF(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=gF("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function wF(e,t,n,i){const r=gF("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};kF(e,i)&&(n.selected=!0),r.appendChild(gF("option",n,(o[t]||e)+""))})),t.appendChild(r),r.addEventListener("change",(()=>{e.update(n.options[r.selectedIndex])})),e.elements=[r],e.set=e=>{for(let t=0,i=n.options.length;t{const s={type:"radio",name:n.signal,value:t};kF(t,i)&&(s.checked=!0);const u=gF("input",s);u.addEventListener("change",(()=>e.update(t)));const l=gF("label",{},(o[a]||t)+"");return l.prepend(u),r.appendChild(l),u})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e{u.textContent=s.value,e.update(+s.value)};s.addEventListener("input",l),s.addEventListener("change",l),e.elements=[s],e.set=e=>{s.value=e,u.textContent=e}}function kF(e,t){return e===t||e+""==t+""}function DF(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,oF(e),aF(e),sF(e),r,o).background(e.background())}function FF(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function CF(e,t,n){if("string"==typeof t){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.textContent=""}catch(i){t=null,e.error(i)}return t}const EF=e=>+e||0;function $F(e){return ne(e)?{top:EF(e.top),bottom:EF(e.bottom),left:EF(e.left),right:EF(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(EF(e))}async function SF(e,t,n,i){const r=ph(t),o=r&&r.headless;return o||d("Unrecognized renderer type: "+t),await e.runAsync(),DF(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var MF="width",BF="height",zF="padding",OF={skip:!0};function NF(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===zF?i.left+i.right:0)}function RF(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===zF?i.top+i.bottom:0)}function TF(e,t){return t.modified&&f(t.input.value)&&!e.startsWith("_:vega:_")}function PF(e,t){return!("parent"===e||t instanceof dr.proxy)}function jF(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":f(e)?LF(e):ne(e)&&!he(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(f(n)?LF(n):qF(n))})).join("\n")):e+"";var t}(i))}function LF(e){return"["+e.map(qF).join(", ")+"]"}function qF(e){return f(e)?"[…]":ne(e)&&!he(e)?"{…}":e}function UF(e,t){const n=this;if(t=t||{},lr.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),null!=t.logLevel&&n.logLevel(t.logLevel),t.locale||e.locale){const i=v({},e.locale,t.locale);n.locale(Le(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||dh.Canvas,n._scenegraph=new Nf;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||jF,n._redraw=!0,n._handler=(new dd).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=v({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{f(e[t])&&(e[t]=ee(e[t]))}))};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=function(e,t,n){return KD(e,dr,ND,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:v({},e)}))),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=NF(n,n._width),n._viewHeight=RF(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[MF],i=t[BF],r=t[zF];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=NF(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=RF(e,t.size),o()}),{size:i});const a=e.add(null,o,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,a.rank=r.rank+1}(n),function(e){e.add(null,(t=>(e._background=t.bg,e._resize=1,t.bg)),{bg:e._signals.background})}(n),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:tF,item:null}));e.on(e.events("view","pointermove"),t,((e,n)=>{const i=t.value,r=i?ie(i)?i:i.user:tF,o=n.item&&n.item.cursor||null;return i&&r===i.user&&o==i.item?i:{user:r,item:o}})),e.add(null,(function(t){let n=t.cursor,i=this.value;return ie(n)||(i=n.item,n=n.user),nF(e,n&&n!==tF?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function IF(e,t){return c(e._signals,t)?e._signals[t]:d("Unrecognized signal name: "+fe(t))}function WF(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function HF(e,t,n,i){let r=WF(n,i);return r||(r=FF(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function GF(e,t,n){const i=WF(t,n);return i&&t._targets.remove(i),e}t(UF,lr,{async evaluate(e,t,n){if(await lr.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=sF(i=this),o=oF(i),a=aF(i),i._renderer.background(i.background()),i._renderer.resize(o,a,r),i._handler.origin(r),i._resizeListeners.forEach((e=>{try{e(o,a)}catch(t){i.error(t)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(s){this.error(s)}var i,r,o,a;return n&&Ei(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=null!=e?e+"":null;return t!==this._desc&&eF(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=IF(this,e);return 1===arguments.length?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",$F(e)):$F(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(ph(e)||d("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(lr.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(IF(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(MF,n,OF),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(BF,i,OF),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==t&&(a._resize=1,a._viewHeight=t),a._origin[0]===r[0]&&a._origin[1]===r[1]||(a._resize=1,a._origin=r),s&&a.run("enter"),o&&a.runAfter((e=>e.resize()))}),!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=FF(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),o=r.length;--o>=0;)if(i=r[o].type,n=r[o].handler,e===i&&(t===n||t===n.raw)){this._handler.off(i,n);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return HF(this,e,IF(this,e),t)},removeSignalListener(e,t){return GF(this,IF(this,e),t)},addDataListener(e,t){return HF(this,e,iF(this,e).values,t)},removeDataListener(e,t){return GF(this,iF(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=nF(this,null);this._globalCursor=!!e,t&&nF(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(function(e,t,n){var i=new dn,r=t;return null==t?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(e,t,n){t=+t,n=null==n?hn():+n,i._restart((function o(a){a+=r,i._restart(o,r+=t,n),e(a)}),t,n)},i.restart(e,t,n),i)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},events:function(e,t,n){var i,r=this,o=new Yi(n),a=function(n,i){r.runAsync(null,(()=>{e===lF&&function(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return!1!==i&&!0!==r&&(!0===i||!1===r||(i?i[t]:r?!r[t]:e.preventDefault()))}(r,t)&&n.preventDefault(),o.receive(uF(r,n,i))}))};if("timer"===e)dF(r,"timer",t)&&r.timer(a,t);else if(e===lF)dF(r,"view",t)&&r.addEventListener(t,a,cF);else if("window"===e?dF(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&dF(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,u=i.length;s=0;)a[e].stop();for(e=u.length;--e>=0;)for(t=(n=u[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);for(o&&o.call(this,this._handler,null,null,null),e=s.length;--e>=0;)r=s[e].type,i=s[e].handler,this._handler.off(r,i);return this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","pointerover",hF),pF,mF(e)),this.on(this.events("view","pointerout",hF),pF,mF(t)),this},data:function(e,t){return arguments.length<2?iF(this,e).values.value:rF.call(this,e,Li().remove(p).insert(t))},change:rF,insert:function(e,t){return rF.call(this,e,Li().insert(t))},remove:function(e,t){return rF.call(this,e,Li().remove(t))},scale:function(e){var t=this._runtime.scales;return c(t,e)||d("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=ph(i);e=n._el=e?CF(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),eF(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||dd,s=e?o.renderer:o.headless;return n._renderer=s?DF(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),FF(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,sF(e),e);return t&&t.handlers().forEach((e=>{r.on(e.type,e.handler)})),r}(n,n._handler,e,a),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=CF(n,t,!0):e.appendChild(gF("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=CF(n,e.param.element,!!e.param.input))})),n._bind.forEach((e=>{!function(e,t,n){if(!t)return;const i=n.param;let r=n.state;r||(r=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(i.signal)&&e.runAsync(null,(()=>{r.source=!0,e.signal(i.signal,t)}))}},i.debounce&&(r.update=b(i.debounce,r.update))),(null==i.input&&i.element?yF:vF)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,(()=>{r.source?r.source=!1:r.set(e.signal(i.signal))})),r.active=!0)}(n,e.element||t,e)}))),n},toImageURL:async function(e,t){e!==dh.Canvas&&e!==dh.SVG&&e!==dh.PNG&&d("Unrecognized image type: "+e);const n=await SF(this,e,t);return e===dh.SVG?function(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await SF(this,dh.Canvas,e,t)).canvas()},toSVG:async function(e){return(await SF(this,dh.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:TF,signals:PF,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let e=null;const t=()=>{null!=e&&e();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}});const VF="[",YF="]",XF=/[[\]{}]/,JF={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let KF,QF;function ZF(e,t,n){return KF=t||"view",QF=n||JF,tC(e.trim()).map(nC)}function eC(e,t,n,i,r){const o=e.length;let a,s=0;for(;t=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function tC(e){const t=[],n=e.length;let i=0,r=0;for(;r"!==e[0])throw"Expected '>' after between selector: "+e;n=n.map(nC);const r=nC(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:KF},n=[];let i,r,o=[0,0],a=0,s=0,u=e.length,l=0;if("}"===e[u-1]){if(l=e.lastIndexOf("{"),!(l>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(l+1,u-1))}catch(f){throw"Invalid throttle specification: "+e}u=(e=e.slice(0,l).trim()).length,l=0}if(!u)throw e;"@"===e[0]&&(a=++l);i=eC(e,l,":"),i1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],QF[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0];var c;"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1));null!=r&&(t.filter=r);o[0]&&(t.throttle=o[0]);o[1]&&(t.debounce=o[1]);return t}(e)}function iC(e){return ne(e)?e:{type:e||"pad"}}const rC=e=>+e||0;function oC(e){return ne(e)?e.signal?e:{top:rC(e.top),bottom:rC(e.bottom),left:rC(e.left),right:rC(e.right)}:{top:t=rC(e),bottom:t,left:t,right:t};var t}const aC=e=>ne(e)&&!f(e)?v({},e):{value:e};function sC(e,t,n,i){if(null!=n){return ne(n)&&!f(n)||f(n)&&n.length&&ne(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1}return 0}function uC(e,t,n){for(const i in t)sC(e,i,t[i]);for(const i in n)sC(e,i,n[i],"update")}function lC(e,t,n){for(const i in t)n&&c(n,i)||(e[i]=v(e[i]||{},t[i]));return e}function cC(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const fC="mark",dC="frame",hC="scope",pC="legend-label",mC="title-text",gC="title-subtitle";function yC(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const vC=e=>ie(e)?fe(e):e.signal?`(${e.signal})`:_C(e);function bC(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:fe(e)));for(;t.length&&null==S(t);)t.pop();return t.unshift(vC(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?xC("hcl",e.h,e.c,e.l):e.h||e.s?xC("hsl",e.h,e.s,e.l):e.l||e.a?xC("lab",e.l,e.a,e.b):e.r||e.g||e.b?xC("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?_C(e.field):void 0!==e.value?fe(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=vC(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+wC(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${wC(e.exponent)})`),null!=e.mult&&(t+=`*${wC(e.mult)}`),null!=e.offset&&(t+=`+${wC(e.offset)}`),e.round&&(t=`round(${t})`),t}const xC=(e,t,n,i)=>`(${e}(${[t,n,i].map(bC).join(",")})+'')`;function wC(e){return ne(e)?"("+bC(e)+")":e}function _C(e){return AC(ne(e)?e:{datum:e})}function AC(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):d("Invalid field reference: "+fe(e));return e.signal||(i=ie(i)?Ue(i).map(fe).join("]["):AC(i)),t+"["+i+"]"}function kC(e,t,n,i,r,o){const a={};(o=o||{}).encoders={$encode:a},e=function(e,t,n,i,r){const o={},a={};let s,l,c,f;for(l in l="lineBreak","text"!==t||null==r[l]||cC(l,e)||yC(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),f=n===dC?r.group:n===fC?v({},r.mark,r[t]):null,f)c=cC(l,e)||("fill"===l||"stroke"===l)&&(cC("fill",e)||cC("stroke",e)),c||yC(o,l,f[l]);for(l in u(i).forEach((t=>{const n=r.style&&r.style[t];for(const i in n)cC(i,e)||yC(o,i,n[i])})),e=v({},e),o)f=o[l],f.signal?(s=s||{})[l]=f:a[l]=f;return e.enter=v(a,e.enter),s&&(e.update=v(s,e.update)),e}(e,t,n,i,r.config);for(const s in e)a[s]=DC(e[s],t,o,r);return o}function DC(e,t,n,i){const r={},o={};for(const s in e)null!=e[s]&&(r[s]=FC((a=e[s],f(a)?function(e){let t="";return e.forEach((e=>{const n=bC(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===S(t)&&(t+="null"),t}(a):bC(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function FC(e,t,n,i){const r=UD(e,t);return r.$fields.forEach((e=>i[e]=1)),v(n,r.$params),r.$expr}const CC=["value","update","init","react","bind"];function EC(e,t){d(e+' for "outer" push: '+fe(t))}function $C(e,t){const n=e.name;if("outer"===e.push)t.signals[n]||EC("No prior signal definition",n),CC.forEach((t=>{void 0!==e[t]&&EC("Invalid property ",t)}));else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function SC(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function MC(e,t,n,i){return new SC(e,t,n,i)}function BC(e,t){return MC("operator",e,t)}function zC(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function OC(e,t){return t?{$field:e,$name:t}:{$field:e}}const NC=OC("key");function RC(e,t){return{$compare:e,$order:t}}function TC(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const PC="scope",jC="view";function LC(e){return e&&e.signal}function qC(e){if(LC(e))return!0;if(ne(e))for(const t in e)if(qC(e[t]))return!0;return!1}function UC(e,t){return null!=e?e:t}function IC(e){return e&&e.signal||e}const WC="timer";function HC(e,t){return(e.merge?GC:e.stream?VC:e.type?YC:d("Invalid stream specification: "+fe(e)))(e,t)}function GC(e,t){const n=XC({merge:e.merge.map((e=>HC(e,t)))},e,t);return t.addStream(n).id}function VC(e,t){const n=XC({stream:HC(e.stream,t)},e,t);return t.addStream(n).id}function YC(e,t){let n;var i;e.type===WC?(n=t.event(WC,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===PC?jC:i||jC,e.type);const r=XC({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function XC(e,t,n){let i=t.between;return i&&(2!==i.length&&d('Stream "between" parameter must have 2 entries: '+fe(t)),e.between=[HC(i[0],n),HC(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===PC&&i.push("inScope(event.item)"),i.length&&(e.filter=UD("("+i.join(")&&(")+")",n).$expr),null!=(i=t.throttle)&&(e.throttle=+i),null!=(i=t.debounce)&&(e.debounce=+i),t.consume&&(e.consume=!0),e}const JC={code:"_.$value",ast:{type:"Identifier",value:"value"}};function KC(e,t,n){const i=e.encode,r={target:n};let o=e.events,a=e.update,s=[];o||d("Signal update missing events specification."),ie(o)&&(o=ZF(o,t.isSubscope()?PC:jC)),o=u(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[QC(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&d("Signal encode and update are mutually exclusive."),a="encode(item(),"+fe(i)+")"),r.update=ie(a)?UD(a,t):null!=a.expr?UD(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:JC,$params:{$value:t.signalRef(a.signal)}}:d("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(v(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):HC(e,t)}}(e,t),r))))}function QC(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const ZC=e=>(t,n,i)=>MC(e,n,t||void 0,i),eE=ZC("aggregate"),tE=ZC("axisticks"),nE=ZC("bound"),iE=ZC("collect"),rE=ZC("compare"),oE=ZC("datajoin"),aE=ZC("encode"),sE=ZC("expression"),uE=ZC("facet"),lE=ZC("field"),cE=ZC("key"),fE=ZC("legendentries"),dE=ZC("load"),hE=ZC("mark"),pE=ZC("multiextent"),mE=ZC("multivalues"),gE=ZC("overlap"),yE=ZC("params"),vE=ZC("prefacet"),bE=ZC("projection"),xE=ZC("proxy"),wE=ZC("relay"),_E=ZC("render"),AE=ZC("scale"),kE=ZC("sieve"),DE=ZC("sortitems"),FE=ZC("viewlayout"),CE=ZC("values");let EE=0;const $E={min:"min",max:"max",count:"sum"};function SE(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=OE(e.domain,e,t),null!=e.range&&(n.range=UE(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=ME(e.type||e),null!=e.gamma&&(t.interpolateGamma=ME(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e,t){return e.signal?t.signalRef(e.signal):ne(e)?{interval:ME(e.interval),step:ME(e.step)}:ME(e)}(e.nice,t)),null!=e.bins&&(n.bins=function(e,t){return e.signal||f(e)?BE(e,t):t.objectProperty(e)}(e.bins,t)),e)c(n,i)||"name"===i||(n[i]=ME(e[i],t))}function ME(e,t){return ne(e)?e.signal?t.signalRef(e.signal):d("Unsupported object: "+fe(e)):e}function BE(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>ME(e,t)))}function zE(e){d("Can not find data set: "+fe(e))}function OE(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(f(e)?NE:e.fields?TE:RE)(e,t,n);null==t.domainMin&&null==t.domainMax||d("No scale domain defined for domainMin/domainMax to override.")}function NE(e,t,n){return e.map((e=>ME(e,n)))}function RE(e,t,n){const i=n.getData(e.data);return i||zE(e.data),Xs(t.type)?i.valuesRef(n,e.field,jE(e.sort,!1)):Zs(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function TE(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=ie(t)?{data:i,field:t}:f(t)||t.signal?function(e,t){const n="_:vega:_"+EE++,i=iE({});if(f(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+fe(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,kE({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(Xs(t.type)?PE:Zs(t.type)?LE:qE)(e,n,r)}function PE(e,t,n){const i=jE(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||zE(e.data),n.countsRef(t,e.field,i)})),s={groupby:NC,pulse:a};i&&(r=i.op||"count",o=i.field?TC(r,i.field):"count",s.ops=[$E[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(eE(s));const u=t.add(iE({pulse:zC(r)}));return o=t.add(CE({field:NC,sort:t.sortRef(i),pulse:zC(u)})),zC(o)}function jE(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!$E[e.op]&&d("Multiple domain scales can not be sorted using "+e.op):d("No field provided for sort aggregate op: "+e.op):ne(e)?e.field="key":e={field:"key"}),e}function LE(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||zE(e.data),n.domainRef(t,e.field)}));return zC(t.add(mE({values:i})))}function qE(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||zE(e.data),n.extentRef(t,e.field)}));return zC(t.add(pE({extents:i})))}function UE(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(ie(r)){if(i&&c(i,r))return UE(e=v({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Xs(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:d("Unrecognized scale range value: "+fe(r))}else{if(r.scheme)return n.scheme=f(r.scheme)?BE(r.scheme,t):ME(r.scheme,t),r.extent&&(n.schemeExtent=BE(r.extent,t)),void(r.count&&(n.schemeCount=ME(r.count,t)));if(r.step)return void(n.rangeStep=ME(r.step,t));if(Xs(e.type)&&!f(r))return OE(r,e,t);f(r)||d("Unsupported range type: "+fe(r))}return r.map((e=>(f(e)?BE:ME)(e,t)))}function IE(e,t,n){return f(e)?e.map((e=>IE(e,t,n))):ne(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:d("Unsupported parameter object: "+fe(e)):e}const WE="top",HE="left",GE="right",VE="bottom",YE="center",XE="index",JE="label",KE="perc",QE="value",ZE="guide-label",e$="guide-title",t$="group-title",n$="group-subtitle",i$="symbol",r$="gradient",o$="discrete",a$="size",s$=[a$,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],u$={name:1,style:1,interactive:1},l$={value:0},c$={value:1},f$="group",d$="rect",h$="rule",p$="text";function m$(e){return e.type=f$,e.interactive=e.interactive||!1,e}function g$(e,t){const n=(n,i)=>UC(e[n],UC(t[n],i));return n.isVertical=n=>"vertical"===UC(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>UC(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>UC(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>UC(e.columns,UC(t.columns,+n.isVertical(!0))),n}function y$(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function v$(e,t,n){return`item.anchor === 'start' ? ${e} : item.anchor === 'end' ? ${t} : ${n}`}const b$=v$(fe(HE),fe(GE),fe(YE));function x$(e,t){return t?e?ne(e)?Object.assign({},e,{offset:x$(e.offset,t)}):{value:e,offset:t}:t:e}function w$(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=lC(e.encode,t,u$)):e.interactive=!1,e}function _$(e,t,n,i){const r=g$(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let u,l,c,f,d;o?(l=[0,1],c=[0,0],f=a,d=s):(l=[0,0],c=[1,0],f=s,d=a);const h={enter:u={opacity:l$,x:l$,y:l$,width:aC(f),height:aC(d)},update:v({},u,{opacity:c$,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:l$}};return uC(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),w$({type:d$,role:"legend-gradient",encode:h},i)}function A$(e,t,n,i,r){const o=g$(e,n),a=o.isVertical(),s=o.gradientThickness(),u=o.gradientLength();let l,c,f,d,h="";a?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const p={opacity:l$,fill:{scale:t,field:QE}};p[l]={signal:h+"datum."+KE,mult:u},p[c]=l$,p[f]={signal:h+"datum.perc2",mult:u},p[d]=aC(s);const m={enter:p,update:v({},p,{opacity:c$}),exit:{opacity:l$}};return uC(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),w$({type:d$,role:"legend-band",key:QE,from:r,encode:m},i)}const k$=`datum.${KE}<=0?"${HE}":datum.${KE}>=1?"${GE}":"${YE}"`,D$=`datum.${KE}<=0?"${VE}":datum.${KE}>=1?"${WE}":"middle"`;function F$(e,t,n,i){const r=g$(e,t),o=r.isVertical(),a=aC(r.gradientThickness()),s=r.gradientLength();let u,l,c,f,d=r("labelOverlap"),h="";const p={enter:u={opacity:l$},update:l={opacity:c$,text:{field:JE}},exit:{opacity:l$}};return uC(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:UC(e.labelLimit,t.gradientLabelLimit)}),o?(u.align={value:"left"},u.baseline=l.baseline={signal:D$},c="y",f="x",h="1-"):(u.align=l.align={signal:k$},u.baseline={value:"top"},c="x",f="y"),u[c]=l[c]={signal:h+"datum."+KE,mult:s},u[f]=l[f]=a,a.offset=UC(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+XE}:void 0,w$({type:p$,role:pC,style:ZE,key:QE,from:i,encode:p,overlap:d},n)}function C$(e,t,n,i,r){const o=g$(e,t),a=n.entries,s=!(!a||!a.interactive),u=a?a.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.offset : datum.${a$}`,h=l?aC(l):{field:a$},p=`datum.${XE}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:l$,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:c$,x:y.x,y:y.y},exit:{opacity:l$}};let w=null,_=null;e.fill||(w=t.symbolBaseFillColor,_=t.symbolBaseStrokeColor),uC(g,{fill:o("symbolFillColor",w),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",_),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),s$.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:QE})}));const A=w$({type:"symbol",role:"legend-symbol",key:QE,from:f,clip:!!l||void 0,encode:g},n.symbols),k=aC(c);k.offset=o("labelOffset"),g={enter:y={opacity:l$,x:{signal:d,offset:k},y:h},update:v={opacity:c$,text:{field:JE},x:y.x,y:y.y},exit:{opacity:l$}},uC(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const D=w$({type:p$,role:pC,style:ZE,key:QE,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!l},width:l$,height:l?aC(l):l$,opacity:l$},exit:{opacity:l$},update:v={opacity:c$,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${b}`,v.column.signal=`floor(${p} / ${b})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,x={field:p}),v.column.signal=`(${r})?${v.column.signal}:${p}`,m$({role:hC,from:i={facet:{data:i,name:"value",groupby:XE}},encode:lC(g,a,u$),marks:[A,D],name:u,interactive:s,sort:x})}const E$='item.orient === "left"',$$='item.orient === "right"',S$=`(${E$} || ${$$})`,M$=`datum.vgrad && ${S$}`,B$=v$('"top"','"bottom"','"middle"'),z$=`datum.vgrad && ${$$} ? (${v$('"right"','"left"','"center"')}) : (${S$} && !(datum.vgrad && ${E$})) ? "left" : ${b$}`,O$=`item._anchor || (${S$} ? "middle" : "start")`,N$=`${M$} ? (${E$} ? -90 : 90) : 0`,R$=`${S$} ? (datum.vgrad ? (${$$} ? "bottom" : "top") : ${B$}) : "top"`;function T$(e,t){let n;return ne(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+P$(e.path)+")":e.sphere&&(n="geoShape("+P$(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function P$(e){return ne(e)&&e.signal?e.signal:fe(e)}function j$(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===f$?hC:t||fC}function L$(e){return{marktype:e.type,name:e.name||void 0,role:e.role||j$(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function q$(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function U$(e,t){const n=hr(e.type);n||d("Unrecognized transform type: "+fe(e.type));const i=MC(n.type.toLowerCase(),null,I$(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function I$(e,t,n){const i={},r=e.params.length;for(let o=0;oG$(e,t,n)))):G$(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!LC(r)?r.map((t=>H$(e,t,n))):H$(e,r,n):void(e.required&&d("Missing required "+fe(t.type)+" parameter: "+fe(e.name)))}function H$(e,t,n){const i=e.type;if(LC(t))return J$(i)?d("Expression references can not be signals."):K$(i)?n.fieldRef(t):Q$(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||K$(i);return r&&V$(t)?n.exprRef(t.expr,t.as):r&&Y$(t)?OC(t.field,t.as):J$(i)?UD(t,n):X$(i)?zC(n.getData(t).values):K$(i)?OC(t):Q$(i)?n.compareRef(t):t}}function G$(e,t,n){const i=e.params.length;let r;for(let a=0;ae&&e.expr,Y$=e=>e&&e.field,X$=e=>"data"===e,J$=e=>"expr"===e,K$=e=>"field"===e,Q$=e=>"compare"===e;function Z$(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:zC(t.getData(e.data).output)}function eS(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function tS(e){return ie(e)?e:null}function nS(e,t,n){const i=TC(n.op,n.field);let r;if(t.ops){for(let o=0,a=t.as.length;onull==e?"null":e)).join(",")+"),0)",t);u.update=l.$expr,u.params=l.$params}function oS(e,t){const n=j$(e),i=e.type===f$,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,c,f,h,p,m=e.layout||n===hC||n===dC;const g=n===fC||m||r,y=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||d("Only group marks can be faceted."),null!=i.field?a=s=Z$(i,n):(e.data?s=zC(n.getData(e.data).aggregate):(o=U$(v({type:"aggregate",groupby:u(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=Z$(i,n),a=s=zC(n.add(o))),r=n.keyRef(i.groupby,!0))):a=zC(n.add(iE(null,[{}]))),a||(a=Z$(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(oE({key:y.key||(e.key?OC(e.key):void 0),pulse:y.pulse,clean:!i}));const b=zC(s);s=l=t.add(iE({pulse:b})),s=t.add(hE({markdef:L$(e),interactive:q$(e.interactive,t),clip:T$(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:zC(s)}));const x=zC(s);s=c=t.add(aE(kC(e.encode,e.type,n,e.style,t,{mod:!1,pulse:x}))),s.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=U$(e,t),i=n.metadata;(i.generates||i.changes)&&d("Mark transforms should not generate new data."),i.nomod||(c.params.mod=!0),n.params.pulse=zC(s),t.add(s=n)})),e.sort&&(s=t.add(DE({sort:t.compareRef(e.sort),pulse:zC(s)})));const w=zC(s);(r||m)&&(m=t.add(FE({layout:t.objectProperty(e.layout),legends:t.legends,mark:x,pulse:w})),h=zC(m));const _=t.add(nE({mark:x,pulse:h||w}));p=zC(_),i&&(g&&(a=t.operators,a.pop(),m&&a.pop()),t.pushState(w,h||p,b),r?function(e,t,n){const i=e.from.facet,r=i.name,o=Z$(i,t);let a;i.name||d("Facet must have a name: "+fe(i)),i.data||d("Facet must reference a data set: "+fe(i)),i.field?a=t.add(vE({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(uE({key:t.keyRef(i.groupby),group:zC(t.proxy(n.parent)),pulse:o})):d("Facet must specify groupby or field: "+fe(i));const s=t.fork(),u=s.add(iE()),l=s.add(kE({pulse:zC(u)}));s.addData(r,new eS(s,u,u,l)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(e).toRuntime()}}(e,t,y):g?function(e,t,n){const i=t.add(vE({pulse:n.pulse})),r=t.fork();r.add(kE()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,y):t.parse(e),t.popState(),g&&(m&&a.push(m),a.push(_))),o&&(p=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:LC(o)?n.signalRef(o.signal):o,method:LC(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(a.sort=n.compareRef({field:e.order}));if(r){const e=r.tolerance;a.boundTolerance=LC(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return zC(n.add(gE(a)))}(o,p,t));const A=t.add(_E({pulse:p})),k=t.add(kE({pulse:zC(A)},void 0,t.parent()));null!=e.name&&(f=e.name,t.addData(f,new eS(t,l,A,k)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&d("Marks only support modify triggers."),rS(e,t,f)})))}function aS(e,t){const n=t.config.legend,i=e.encode||{},r=g$(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,u=o.style,l={};let c,f,h,p=0;s$.forEach((t=>e[t]?(l[t]=e[t],p=p||e[t]):0)),p||d("Missing valid scale for legend.");const m=function(e,t){let n=e.type||i$;e.type||1!==function(e){return s$.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=Ys(t)?r$:Js(t)?o$:i$);return n!==r$?n:Js(t)?o$:r$}(e,t.scaleType(p)),g={title:null!=e.title,scales:l,type:m,vgrad:"symbol"!==m&&r.isVertical()},y=zC(t.add(iE(null,[g]))),v=zC(t.add(fE(f={type:m,scale:t.scaleRef(p),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return m===r$?(h=[_$(e,p,n,i.gradient),F$(e,n,i.labels,v)],f.count=f.count||t.signalRef(`max(2,2*floor((${IC(r.gradientLength())})/100))`)):m===o$?h=[A$(e,p,n,i.gradient,v),F$(e,n,i.labels,v)]:(c=function(e,t){const n=g$(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),h=[C$(e,n,i,v,IC(c.columns))],f.size=function(e,t,n){const i=IC(uS("size",e,n)),r=IC(uS("strokeWidth",e,n)),o=IC(function(e,t,n){return y$("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(n[1].encode,t,ZE));return UD(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,h[0].marks)),h=[m$({role:"legend-entry",from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:h,layout:c,interactive:s})],g.title&&h.push(function(e,t,n,i){const r=g$(e,t),o={enter:{opacity:l$},update:{opacity:c$,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:l$}};return uC(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:O$},angle:{signal:N$},align:{signal:z$},baseline:{signal:R$},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),w$({type:p$,role:"legend-title",style:e$,from:i,encode:o},n)}(e,n,i.title,y)),oS(m$({role:"legend",from:y,encode:lC(sS(r,e,n),o,u$),marks:h,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:s,style:u}),t)}function sS(e,t,n){const i={enter:{},update:{}};return uC(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function uS(e,t,n){return t[e]?`scale("${t[e]}",datum)`:y$(e,n[0].encode)}eS.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let o=t[0],a=null,s=1;for(o&&"load"===o.type&&(o=t[1]),e.add(t[0]);s{n.push(U$(e,t))})),e.on&&e.on.forEach((n=>{rS(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,o,a,s,l,c=null,f=!1,d=!1;e.values?LC(e.values)||qC(e.format)?(i.push(pS(t,e)),i.push(c=hS())):i.push(c=hS({$ingest:e.values,$format:e.format})):e.url?qC(e.url)||qC(e.format)?(i.push(pS(t,e)),i.push(c=hS())):i.push(c=hS({$request:e.url,$format:e.format})):e.source&&(c=r=u(e.source).map((e=>zC(t.getData(e).output))),i.push(null));for(o=0,a=n.length;oe===VE||e===WE,gS=(e,t,n)=>LC(e)?_S(e.signal,t,n):e===HE||e===WE?t:n,yS=(e,t,n)=>LC(e)?xS(e.signal,t,n):mS(e)?t:n,vS=(e,t,n)=>LC(e)?wS(e.signal,t,n):mS(e)?n:t,bS=(e,t,n)=>LC(e)?AS(e.signal,t,n):e===WE?{value:t}:{value:n},xS=(e,t,n)=>DS(`${e} === '${WE}' || ${e} === '${VE}'`,t,n),wS=(e,t,n)=>DS(`${e} !== '${WE}' && ${e} !== '${VE}'`,t,n),_S=(e,t,n)=>CS(`${e} === '${HE}' || ${e} === '${WE}'`,t,n),AS=(e,t,n)=>CS(`${e} === '${WE}'`,t,n),kS=(e,t,n)=>CS(`${e} === '${GE}'`,t,n),DS=(e,t,n)=>(t=null!=t?aC(t):t,n=null!=n?aC(n):n,FS(t)&&FS(n)?{signal:`${e} ? (${t=t?t.signal||fe(t.value):null}) : (${n=n?n.signal||fe(n.value):null})`}:[v({test:e},t)].concat(n||[])),FS=e=>null==e||1===Object.keys(e).length,CS=(e,t,n)=>({signal:`${e} ? (${ES(t)}) : (${ES(n)})`}),ES=e=>LC(e)?e.signal:null==e?null:fe(e),$S=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function SS(e,t,n,i){let r;if(t&&c(t,e))return t[e];if(c(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[e$][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[ZE][r]}return null}function MS(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function BS(e,t){return{scale:e.scale,range:t}}function zS(e,t,n,i,r){const o=g$(e,t),a=e.orient,s=e.gridScale,u=gS(a,1,-1),l=function(e,t){if(1===t);else if(ne(e)){let n=e=v({},e);for(;null!=n.mult;){if(!ne(n.mult))return n.mult=LC(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=v({},n.mult)}n.mult=t}else e=LC(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,u);let c,f,d;const h={enter:c={opacity:l$},update:d={opacity:c$},exit:f={opacity:l$}};uC(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:e.scale,field:QE,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=yS(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:u,offset:l}:{value:0,offset:l},y=s?{scale:s,range:1,mult:u,offset:l}:v(m,{mult:u,offset:l});return c.x=d.x=yS(a,p,g),c.y=d.y=vS(a,p,g),c.x2=d.x2=vS(a,y),c.y2=d.y2=yS(a,y),f.x=yS(a,p),f.y=vS(a,p),w$({type:h$,role:"axis-grid",key:QE,from:i,encode:h},n)}function OS(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function NS(e,t,n,i,r,o){const a=g$(e,t),s=e.orient,u=e.scale,l=gS(s,-1,1),c=IC(a("labelFlush")),f=IC(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=aC(r);g.mult=l,g.offset=aC(a("labelPadding")||0),g.offset.mult=l;const y={scale:u,field:QE,band:.5,offset:x$(o.offset,a("labelOffset"))},v=yS(s,m?OS(u,c,'"left"','"right"','"center"'):{value:"center"},((e,t,n)=>LC(e)?kS(e.signal,t,n):e===GE?{value:t}:{value:n})(s,"left","right")),b=yS(s,bS(s,"bottom","top"),m?OS(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=OS(u,c,`-(${f})`,f,0);m=m&&f;const w={opacity:l$,x:yS(s,y,g),y:vS(s,y,g)},_={enter:w,update:p={opacity:c$,text:{field:JE},x:w.x,y:w.y,align:v,baseline:b},exit:{opacity:l$,x:w.x,y:w.y}};uC(_,{dx:!d&&m?yS(s,x):null,dy:!h&&m?vS(s,x):null}),uC(_,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:d,baseline:h});const A=a("labelBound");let k=a("labelOverlap");return k=k||A?{separation:a("labelSeparation"),method:k,order:"datum.index",bound:A?{scale:u,orient:s,tolerance:A}:null}:void 0,p.align!==v&&(p.align=$S(p.align,v)),p.baseline!==b&&(p.baseline=$S(p.baseline,b)),w$({type:p$,role:"axis-label",style:ZE,key:QE,from:i,encode:_,overlap:k},n)}function RS(e,t,n,i){const r=g$(e,t),o=e.orient,a=gS(o,-1,1);let s,u;const l={enter:s={opacity:l$,anchor:aC(r("titleAnchor",null)),align:{signal:b$}},update:u=v({},s,{opacity:c$,text:aC(e.title)}),exit:{opacity:l$}},c={signal:`lerp(range("${e.scale}"), ${v$(0,1,.5)})`};return u.x=yS(o,c),u.y=vS(o,c),s.angle=yS(o,l$,((e,t)=>0===t?0:LC(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t})(a,90)),s.baseline=yS(o,bS(o,VE,WE),{value:VE}),u.angle=s.angle,u.baseline=s.baseline,uC(l,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const r=(e,t)=>null!=e?(n.update[t]=$S(aC(e),n.update[t]),!1):!cC(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?aC(a):yS(t,aC(a),aC(o))}(r,o,l,n),l.update.align=$S(l.update.align,s.align),l.update.angle=$S(l.update.angle,s.angle),l.update.baseline=$S(l.update.baseline,s.baseline),w$({type:p$,role:"axis-title",style:e$,from:i,encode:l},n)}function TS(e,t){const n=function(e,t){var n,i,r,o,a,s,u,l,c=t.config,f=c.style,d=c.axis,h="band"===t.scaleType(e.scale)&&c.axisBand,p=e.orient;if(LC(p)){const e=MS([c.axisX,c.axisY]),t=MS([c.axisTop,c.axisBottom,c.axisLeft,c.axisRight]);for(r of(n={},e))n[r]=yS(p,SS(r,c.axisX,d,f),SS(r,c.axisY,d,f));for(r of(i={},t))i[r]=(o=p.signal,a=SS(r,c.axisTop,d,f),s=SS(r,c.axisBottom,d,f),u=SS(r,c.axisLeft,d,f),l=SS(r,c.axisRight,d,f),{signal:(null!=u?`${o} === '${HE}' ? (${ES(u)}) : `:"")+(null!=s?`${o} === '${VE}' ? (${ES(s)}) : `:"")+(null!=l?`${o} === '${GE}' ? (${ES(l)}) : `:"")+(null!=a?`${o} === '${WE}' ? (${ES(a)}) : `:"")+"(null)"})}else n=p===WE||p===VE?c.axisX:c.axisY,i=c["axis"+p[0].toUpperCase()+p.slice(1)];return n||i||h?v({},d,n,i,h):d}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,u=g$(e,n),l=function(e){const t=e("tickBand");let n,i,r=e("tickOffset");return t?t.signal?(n={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},ne(r)||(r={signal:`(${t.signal}) === 'extent' ? 0 : ${r}`})):"extent"===t?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:null!=e.title},f=zC(t.add(iE({},[c]))),d=zC(t.add(tE({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let p;return c.grid&&h.push(zS(e,n,i.grid,d,l)),c.ticks&&(p=u("tickSize"),h.push(function(e,t,n,i,r,o){const a=g$(e,t),s=e.orient,u=gS(s,-1,1);let l,c,f;const d={enter:l={opacity:l$},update:f={opacity:c$},exit:c={opacity:l$}};uC(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=aC(r);h.mult=u;const p={scale:e.scale,field:QE,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=l.y=yS(s,l$,p),f.y2=l.y2=yS(s,h),c.x=yS(s,p),f.x=l.x=vS(s,l$,p),f.x2=l.x2=vS(s,h),c.y=vS(s,p),w$({type:h$,role:"axis-tick",key:QE,from:i,encode:d},n)}(e,n,i.ticks,d,p,l))),c.labels&&(p=c.ticks?p:0,h.push(NS(e,n,i.labels,d,p,l))),c.domain&&h.push(function(e,t,n,i){const r=g$(e,t),o=e.orient;let a,s;const u={enter:a={opacity:l$},update:s={opacity:c$},exit:{opacity:l$}};uC(u,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const l=BS(e,0),c=BS(e,1);return a.x=s.x=yS(o,l,l$),a.x2=s.x2=yS(o,c),a.y=s.y=vS(o,l,l$),a.y2=s.y2=vS(o,c),w$({type:h$,role:"axis-domain",from:i,encode:u},n)}(e,n,i.domain,f)),c.title&&h.push(RS(e,n,i.title,f)),oS(m$({role:"axis",from:f,encode:lC(PS(u,e),r,u$),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:o,interactive:a,style:s}),t)}function PS(e,t){const n={enter:{},update:{}};return uC(n,{orient:e("orient"),offset:e("offset")||0,position:UC(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function jS(e,t,n){const i=u(e.signals),r=u(e.scales);return n||i.forEach((e=>$C(e,t))),u(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const r in e)"name"!==r&&(i[r]=IE(e[r],r,t));for(const r in n)null==i[r]&&(i[r]=IE(n[r],r,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";Gs(n)||d("Unrecognized scale type: "+fe(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),u(e.data).forEach((e=>dS(e,t))),r.forEach((e=>SE(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?d("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=UD(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>KC(e,t,n.id)))}(e,t))),u(e.axes).forEach((e=>TS(e,t))),u(e.marks).forEach((e=>oS(e,t))),u(e.legends).forEach((e=>aS(e,t))),e.title&&cS(e.title,t),t.parseLambdas(),t}function LS(e,t){const n=t.config,i=zC(t.root=t.add(BC())),r=function(e,t){const n=n=>UC(e[n],t[n]),i=[qS("background",n("background")),qS("autosize",iC(n("autosize"))),qS("padding",oC(n("padding"))),qS("width",n("width")||0),qS("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return u(e.signals).forEach((e=>{c(r,e.name)?e=v(r[e.name],e):i.push(e),o[e.name]=e})),u(t.signals).forEach((e=>{c(o,e.name)||c(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>$C(e,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const o=t.add(iE()),a=t.add(aE(kC((e=>lC({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e))(e.encode),f$,dC,e.style,t,{pulse:zC(o)}))),s=t.add(FE({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:zC(a)}));t.operators.pop(),t.pushState(zC(a),zC(s),null),jS(e,t,r),t.operators.push(s);let l=t.add(nE({mark:i,pulse:zC(s)}));return l=t.add(_E({pulse:zC(l)})),l=t.add(kE({pulse:zC(l)})),t.addData("root",new eS(t,o,o,l)),t}function qS(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function US(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function IS(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function WS(e){return(f(e)?HS:GS)(e)}function HS(e){const t=e.length;let n="[";for(let i=0;i0?",":"")+(ne(t)?t.signal||WS(t):fe(t))}return n+"]"}function GS(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+fe(t)+":"+(ne(n)?n.signal||WS(n):fe(n));return i+"}"}US.prototype=IS.prototype={parse(e){return jS(e,this)},fork(){return new IS(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){const t=e instanceof SC?zC(e):e;return this.add(xE({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let i,r;e&&(i=e.data||(e.data={}),r=i[t]||(i[t]=[]),r.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(zC(this.add(kE({pulse:e})))),this._parent.push(t),this._lookup.push(n?zC(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return S(this._parent)},encode(){return S(this._encode)},lookup(){return S(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(ie(e))return OC(e,t);e.signal||d("Unsupported field reference: "+fe(e));const n=e.signal;let i=this.field[n];if(!i){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=i=zC(this.add(lE(e)))}return i},compareRef(e){let t=!1;const n=e=>LC(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=u(e.field).map(n),r=u(e.order).map(n);return t?zC(this.add(rE({fields:i,orders:r}))):RC(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=u(e).map((e=>LC(e)?(n=!0,zC(i[e.signal])):e)),n?zC(this.add(cE({fields:e,flat:t}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,t)},sortRef(e){if(!e)return e;const t=TC(e.op,e.field),n=e.order||"ascending";return n.signal?zC(this.add(rE({fields:t,orders:this.signalRef(n.signal)}))):RC(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return c(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&d("Duplicate signal name: "+fe(e));const n=t instanceof SC?t:this.add(BC(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||d("Unrecognized signal name: "+fe(e)),this.signals[e]},signalRef(e){return this.signals[e]?zC(this.signals[e]):(c(this.lambdas,e)||(this.lambdas[e]=this.add(BC(null))),zC(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;tn+Math.floor(r*xr()),pdf:e=>e===Math.floor(e)&&e>=n&&e=i?1:(t-n+1)/r},icdf:e=>e>=0&&e<=1?n-1+Math.floor(e*r):NaN};return o.min(e).max(t)},randomKDE:Mr,randomLCG:function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},randomLogNormal:Rr,randomMixture:Tr,randomNormal:Sr,randomUniform:Ur,read:y,regressionConstant:Ir,regressionExp:Jr,regressionLinear:Yr,regressionLoess:to,regressionLog:Xr,regressionPoly:Zr,regressionPow:Kr,regressionQuad:Qr,renderModule:ph,repeat:ct,resetDefaultLocale:ft,resetSVGClipId:$l,resetSVGDefIds:function(){$l(),Su=0},responseType:g,runtimeContext:KD,sampleCurve:oo,sampleLogNormal:Br,sampleNormal:Fr,sampleUniform:Pr,scale:Hs,sceneEqual:wh,sceneFromJSON:zf,scenePickVisit:Ac,sceneToJSON:Bf,sceneVisit:_c,sceneZOrder:wc,scheme:lu,serializeXML:jd,setHybridRendererOptions:function(e){ah.svgMarkTypes=e.svgMarkTypes??["text"],ah.svgOnTop=e.svgOnTop??!0,ah.debug=e.debug??!1},setRandom:function(e){xr=e},span:R,splitAccessPath:Ue,stringValue:fe,textMetrics:uf,timeBin:F,timeFloor:$,timeFormatLocale:dt,timeInterval:B,timeOffset:Ee,timeSequence:Ce,timeUnitSpecifier:Fe,timeUnits:C,toBoolean:Re,toDate:je,toNumber:A,toSet:ee,toString:Ne,transform:pr,transforms:dr,truncate:Me,truthy:p,tupleid:Bi,typeParsers:ht,utcFloor:E,utcInterval:M,utcOffset:Se,utcSequence:$e,utcdayofyear:xe,utcquarter:ke,utcweek:_e,version:"5.33.0",visitArray:m,week:Ae,writeConfig:pt,zero:L,zoomLinear:ce,zoomLog:se,zoomPow:ue,zoomSymlog:le},Symbol.toStringTag,{value:"Module"}));function YS(e){return WM(e,"or")}function XS(e){return WM(e,"and")}function JS(e){return WM(e,"not")}function KS(e,t){if(JS(e))KS(e.not,t);else if(XS(e))for(const n of e.and)KS(n,t);else if(YS(e))for(const n of e.or)KS(n,t);else t(e)}function QS(e,t){return JS(e)?{not:QS(e.not,t)}:XS(e)?{and:e.and.map((e=>QS(e,t)))}:YS(e)?{or:e.or.map((e=>QS(e,t)))}:t(e)}const ZS=structuredClone;function eM(e){throw new Error(e)}function tM(e,t){const n={};for(const i of t)c(e,i)&&(n[i]=e[i]);return n}function nM(e,t){const n={...e};for(const i of t)delete n[i];return n}function iM(e){if(te(e))return e;const t=ie(e)?e:IM(e);if(t.length<250)return t;let n=0;for(let i=0;i0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const n of i)t.add(n)}return t}function mM(e,t){return void 0===e||void 0===t||hM(pM(e),pM(t))}function gM(e){return 0===yM(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>IM(e))).join(",")})`};const yM=Object.keys,vM=Object.values,bM=Object.entries;function xM(e){return!0===e||!1===e}function wM(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function _M(e,t){return JS(e)?`!(${_M(e.not,t)})`:XS(e)?`(${e.and.map((e=>_M(e,t))).join(") && (")})`:YS(e)?`(${e.or.map((e=>_M(e,t))).join(") || (")})`:t(e)}function AM(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&AM(e[n],t)&&delete e[n],gM(e)}function kM(e){return e.charAt(0).toUpperCase()+e.substr(1)}function DM(e,t="datum"){const n=Ue(e),i=[];for(let r=1;r<=n.length;r++){const e=`[${n.slice(0,r).map(fe).join("][")}]`;i.push(`${t}${e}`)}return i.join(" && ")}function FM(e,t="datum"){return`${t}[${fe(Ue(e).join("."))}]`}function CM(e){return`datum['${e.replaceAll("'","\\'")}']`}function EM(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function $M(e){return`${Ue(e).map(EM).join("\\.")}`}function SM(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function MM(e){return`${Ue(e).join(".")}`}function BM(e){return e?Ue(e).length:0}function zM(...e){return e.find((e=>void 0!==e))}let OM=42;function NM(e){const t=++OM;return e?String(e)+t:t}function RM(){OM=42}function TM(e){return PM(e)?e:`__${e}`}function PM(e){return e.startsWith("__")}function jM(e){if(void 0!==e)return(e%360+360)%360}function LM(e){return!!te(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const qM=Object.getPrototypeOf(structuredClone({}));function UM(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(!UM(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!UM(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==qM.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==qM.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!=i--;){const n=r[i];if(!UM(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function IM(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;iuO(e[t])?wM(`_${t}_${bM(e[t])}`):wM(`_${t}_${e[t]}`))).join("")}function oO(e){return!0===e||sO(e)&&!e.binned}function aO(e){return"binned"===e||sO(e)&&!0===e.binned}function sO(e){return ne(e)}function uO(e){return WM(e,"param")}function lO(e){switch(e){case HM:case GM:case hB:case lB:case cB:case fB:case vB:case mB:case gB:case yB:case dB:return 6;case bB:return 4;default:return 10}}function cO(e){return WM(e,"expr")}function fO(e,{level:t}={level:0}){const n=yM(e||{}),i={};for(const r of n)i[r]=0===t?wO(e[r]):fO(e[r],{level:t-1});return i}function dO(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=e,g={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},y={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:tM(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function hO(e){return ie(e)||f(e)&&ie(e[0])}function pO(e){return WM(e,"signal")}function mO(e){return WM(e,"step")}function gO(e){return!f(e)&&(WM(e,"field")&&WM(e,"data"))}const yO=yM({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),vO={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},bO=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function xO(e){const t=f(e.condition)?e.condition.map(_O):_O(e.condition);return{...wO(e),condition:t}}function wO(e){if(cO(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function _O(e){if(cO(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function AO(e){if(cO(e)){const{expr:t,...n}=e;return{signal:t,...n}}return pO(e)?e:void 0!==e?{value:e}:void 0}function kO(e){return pO(e)?e.signal:fe(e.value)}function DO(e){return pO(e)?e.signal:null==e?null:fe(e)}function FO(e,t,n){for(const i of n){const n=$O(i,t.markDef,t.config);void 0!==n&&(e[i]=AO(n))}return e}function CO(e){return[].concat(e.type,e.style??[])}function EO(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&WM(t,r)?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?$O(e,t,n,i):void 0}function $O(e,t,n,{vgChannel:i}={}){const r=SO(e,t,n.style);return zM(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function SO(e,t,n){return MO(e,CO(t),n)}function MO(e,t,n){let i;t=u(t);for(const r of t){const t=n[r];WM(t,e)&&(i=t[e])}return i}function BO(e,t){return u(e).reduce(((e,n)=>(e.field.push(lP(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function zO(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(UM(t,e))return;n.push(e)})),n}function OO(e,t){return UM(e,t)||!t?e:e?[...u(e),...u(t)].join(", "):t}function NO(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((hO(n)||pO(n))&&(hO(i)||pO(i)))return{explicit:e.explicit,value:OO(n,i)};if(hO(n)||pO(n))return{explicit:e.explicit,value:n};if(hO(i)||pO(i))return{explicit:e.explicit,value:i};if(!(hO(n)||pO(n)||hO(i)||pO(i)))return{explicit:e.explicit,value:zO(n,i)};throw new Error("It should never reach here")}function RO(e){return`Invalid specification ${IM(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const TO='Autosize "fit" only works for single views and layered views.';function PO(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function jO(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function LO(e){return e?`Dropping "fit-${e}" because spec has discrete ${ez(e)}.`:'Dropping "fit" because spec has discrete size.'}function qO(e){return`Unknown field for ${e}. Cannot calculate view size.`}function UO(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function IO(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function WO(e){return`Selection not supported for ${e} yet.`}const HO="The same selection must be used to override scale domains in a layered view.";function GO(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const VO="Animation involving facet, layer, or concat is currently unsupported.";function YO(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function XO(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function JO(e){return`${e}Offset dropped because ${e} is continuous`}function KO(e){return`Invalid field type "${e}".`}function QO(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function ZO(e,t){return`Dropping ${IM(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function eN(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function tN(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function nN(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function iN(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function rN(e){return`Using unaggregated domain with raw field has no effect (${IM(e)}).`}function oN(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function aN(e){return`Unaggregated domain is currently unsupported for log scale (${IM(e)}).`}function sN(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function uN(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const lN="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function cN(e,t){return`Invalid ${e}: ${IM(t)}.`}function fN(e){return`1D error band does not support ${e}.`}function dN(e){return`Channel ${e} is required for "binned" bin.`}const hN=n(nt);let pN=hN;function mN(...e){pN.error(...e)}function gN(...e){pN.warn(...e)}function yN(e){if(e&&ne(e))for(const t of DN)if(WM(e,t))return!0;return!1}const vN=["january","february","march","april","may","june","july","august","september","october","november","december"],bN=vN.map((e=>e.substr(0,3))),xN=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],wN=xN.map((e=>e.substr(0,3)));function _N(e,t){const n=[];if(t&&void 0!==e.day&&yM(e).length>1&&(gN(function(e){return`Dropping day from datetime ${IM(e)} as day cannot be combined with other units.`}(e)),delete(e=ZS(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(LM(e)&&(e=+e),te(e))return e-1;{const t=e.toLowerCase(),n=vN.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=bN.indexOf(i);if(-1!==r)return r;throw new Error(cN("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(LM(e)&&(e=+e),te(e))return e>4&&gN(cN("quarter",e)),e-1;throw new Error(cN("quarter",e))}(e.quarter):e.quarter;n.push(te(i)?3*i:`${i}*3`)}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(LM(e)&&(e=+e),te(e))return e%7;{const t=e.toLowerCase(),n=xN.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=wN.indexOf(i);if(-1!==r)return r;throw new Error(cN("day",e))}}(e.day):e.day;n.push(te(i)?i+1:`${i}+1`)}else n.push(1);for(const i of["hours","minutes","seconds","milliseconds"]){const t=e[i];n.push(void 0===t?0:t)}return n}function AN(e){const t=_N(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const kN={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},DN=yM(kN);function FN(e){return ne(e)?e.binned:CN(e)}function CN(e){return e&&e.startsWith("binned")}function EN(e){return e.startsWith("utc")}const $N={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function SN(e){return DN.filter((t=>BN(e,t)))}function MN(e){const t=SN(e);return t[t.length-1]}function BN(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function zN(e,t,{end:n}={end:!1}){const i=DM(t),r=EN(e)?"utc":"";let o;const a={};for(const u of DN)BN(e,u)&&(a[u]="quarter"===(s=u)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=u);var s;return n&&(a[o]+="+1"),function(e){const t=_N(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}function ON(e){if(!e)return;return`timeUnitSpecifier(${IM(SN(e))}, ${IM($N)})`}function NN(e){if(!e)return;let t;return ie(e)?t=CN(e)?{unit:e.substring(6),binned:!0}:{unit:e}:ne(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),EN(t.unit)&&(t.utc=!0,t.unit=t.unit.substring(3)),t}function RN(e,t=e=>e){const n=NN(e),i=MN(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=PN(i,n.step);return`${t(AN({...e,[o]:+e[o]+r}))} - ${t(AN(e))}`}}const TN={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function PN(e,t=1){if(function(e){return c(TN,e)}(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:3*t};case"week":return{part:"date",step:7*t}}}function jN(e){return!!(null==e?void 0:e.field)&&void 0!==e.equal}function LN(e){return!!(null==e?void 0:e.field)&&void 0!==e.lt}function qN(e){return!!(null==e?void 0:e.field)&&void 0!==e.lte}function UN(e){return!!(null==e?void 0:e.field)&&void 0!==e.gt}function IN(e){return!!(null==e?void 0:e.field)&&void 0!==e.gte}function WN(e){if(null==e?void 0:e.field){if(f(e.range)&&2===e.range.length)return!0;if(pO(e.range))return!0}return!1}function HN(e){return!!(null==e?void 0:e.field)&&(f(e.oneOf)||f(e.in))}function GN(e){return HN(e)||jN(e)||WN(e)||LN(e)||UN(e)||qN(e)||IN(e)}function VN(e,t){return FP(e,{timeUnit:t,wrapTime:!0})}function YN(e,t=!0){const{field:n}=e,i=NN(e.timeUnit),{unit:r,binned:o}=i||{},a=lP(e,{expr:"datum"}),s=r?`time(${o?a:zN(r,n)})`:a;if(jN(e))return`${s}===${VN(e.equal,r)}`;if(LN(e)){return`${s}<${VN(e.lt,r)}`}if(UN(e)){return`${s}>${VN(e.gt,r)}`}if(qN(e)){return`${s}<=${VN(e.lte,r)}`}if(IN(e)){return`${s}>=${VN(e.gte,r)}`}if(HN(e))return`indexof([${(u=e.oneOf,l=r,u.map((e=>VN(e,l)))).join(",")}], ${s}) !== -1`;if(function(e){return!!(null==e?void 0:e.field)&&void 0!==e.valid}(e))return XN(s,e.valid);if(WN(e)){const{range:n}=fO(e),i=pO(n)?{signal:`${n.signal}[0]`}:n[0],o=pO(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+VN(i,r)+", "+VN(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${VN(i,r)}`),null!==o&&a.push(`${s} <= ${VN(o,r)}`),a.length>0?a.join(" && "):"true"}var u,l;throw new Error(`Invalid field predicate: ${IM(e)}`)}function XN(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function JN(e){return GN(e)&&e.timeUnit?{...e,timeUnit:NN(e.timeUnit)}:e}function KN(e){return"ordinal"===e||"nominal"===e}const QN="quantitative",ZN="ordinal",eR="temporal",tR="nominal",nR="geojson";const iR="linear",rR="log",oR="pow",aR="sqrt",sR="time",uR="utc",lR="point",cR="band",fR={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function dR(e,t){const n=fR[e],i=fR[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const hR={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function pR(e){return hR[e]}const mR=new Set(["linear","log","pow","sqrt","symlog"]),gR=new Set([...mR,"time","utc"]);function yR(e){return mR.has(e)}const vR=new Set(["quantile","quantize","threshold"]),bR=new Set([...gR,...vR,"sequential","identity"]),xR=new Set(["ordinal","bin-ordinal","point","band"]);function wR(e){return xR.has(e)}function _R(e){return bR.has(e)}function AR(e){return gR.has(e)}function kR(e){return vR.has(e)}function DR(e){return WM(e,"param")}const{type:FR,domain:CR,range:ER,rangeMax:$R,rangeMin:SR,scheme:MR,...BR}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},zR=yM(BR);function OR(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return AR(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return AR(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return AR(e);case"nice":return AR(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return _R(e)&&!oM(["log","time","utc","threshold","quantile"],e)}}function NR(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return NB(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const RR={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},TR=RR.arc,PR=RR.area,jR=RR.bar,LR=RR.image,qR=RR.line,UR=RR.point,IR=RR.rect,WR=RR.rule,HR=RR.text,GR=RR.tick,VR=RR.trail,YR=RR.circle,XR=RR.square,JR=RR.geoshape;function KR(e){return["line","area","trail"].includes(e)}function QR(e){return["rect","bar","image","arc","tick"].includes(e)}const ZR=new Set(yM(RR));function eT(e){return WM(e,"type")}const tT=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],nT=yM({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),iT=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rT={area:["line","point"],bar:iT,rect:iT,line:["point"],tick:["bandSize","thickness",...iT]},oT=yM({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function aT(e){return WM(e,"band")}const sT={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},uT={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},lT={...uT,binSpacing:1},cT={...uT,thickness:1};function fT(e,{isPath:t}){return void 0===e||"break-paths-show-path-domains"===e?t?"break-paths-show-domains":"filter":null===e?"show":e}function dT({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){var o,a;if(!i||!_R(i)||r)return"always-valid";const s=fT(EO("invalid",e,t),{isPath:KR(e.type)});return void 0!==(null==(a=null==(o=t.scale)?void 0:o.invalid)?void 0:a[n])?"show":s}function hT({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,o=`peek(${i})`,a=t.domainHasZero();if("definitely"===a)return{scale:e,value:0};if("maybe"===a){return{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${"zeroOrMin"===n?r:o})`}}return{signal:`scale('${e}', ${"zeroOrMin"===n?r:o})`}}function pT({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:o}){var a;const s=null==n?void 0:n.get("type"),u=vP(t),l=dT({scaleChannel:e,markDef:r,config:o,scaleType:s,isCountAggregate:tO(null==u?void 0:u.aggregate)});if(u&&"show"===l){const t=(null==(a=o.scale.invalid)?void 0:a[e])??"zero-or-min";return{test:XN(lP(u,{expr:"datum"}),!1),...mT(t,n,i)}}}function mT(e,t,n){if(ne(i=e)&&"value"in i){const{value:t}=e;return pO(t)?{signal:t.signal}:{value:t}}var i;return hT({scale:t,scaleName:n,mode:"zeroOrMin"})}function gT(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:o,config:a}=e,s=KB(t),u=bT(e),l=pT({scaleChannel:s,channelDef:n,scale:r,scaleName:o,markDef:i,config:a});return void 0!==l?[l,u]:u}function yT(e,t,n,i){const r={};if(t&&(r.scale=t),KT(e)){const{datum:t}=e;yN(t)?r.signal=AN(t):pO(t)?r.signal=t.signal:cO(t)?r.signal=t.expr:r.value=t}else r.field=lP(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function vT({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:o="end",bandPosition:a=.5}){const s=!pO(a)&&0wM(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+yM(n).map((e=>wM(`_${e}_${n[e]}`))).join("")}(u),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?MM(n):t.expr?FM(n,t.expr)+o:$M(n)+o}function cP(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return XT(e)&&!!e.bin;case"temporal":return!1}throw new Error(KO(e.type))}const fP=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(Qz(t))return`${r} for argmax(${t.argmax})`;if(Kz(t))return`${r} for argmin(${t.argmin})`;const o=i&&!FN(i)?NN(i):void 0,a=t||(null==o?void 0:o.unit)||(null==o?void 0:o.maxbins)&&"timeunit"||oO(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){var n;const{field:i,bin:r,timeUnit:o,aggregate:a}=e;if("count"===a)return t.countTitle;if(oO(r))return`${i} (binned)`;if(o&&!FN(o)){const e=null==(n=NN(o))?void 0:n.unit;if(e)return`${i} (${SN(e).join("-")})`}else if(a)return Qz(a)?`${i} for max ${a.argmax}`:Kz(a)?`${i} for min ${a.argmin}`:`${kM(a)} of ${i}`;return i}(e,t)}};let dP=fP;function hP(e){dP=e}function pP(e,t,{allowDisabling:n,includeDefault:i=!0}){var r;const o=null==(r=mP(e))?void 0:r.title;if(!XT(e))return o??e.title;const a=e,s=i?gP(a,t):void 0;return n?zM(o,a.title,s):o??a.title??s}function mP(e){return oP(e)&&e.axis?e.axis:aP(e)&&e.legend?e.legend:PT(e)&&e.header?e.header:void 0}function gP(e,t){return dP(e,t)}function yP(e){if(sP(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=mP(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function vP(e){return XT(e)?e:VT(e)?e.condition:void 0}function bP(e){return tP(e)?e:YT(e)?e.condition:void 0}function xP(e,t,n,i={}){if(ie(e)||te(e)||Pe(e)){return gN(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${IM(n)}}.`}(t,ie(e)?"string":te(e)?"number":"boolean",e)),{value:e}}return tP(e)?wP(e,t,n,i):YT(e)?{...e,condition:wP(e.condition,t,n,i)}:e}function wP(e,t,n,i){if(sP(e)){const{format:r,formatType:o,...a}=e;if(wT(o)&&!n.customFormatTypes)return gN(XO(t)),wP(a,t,n,i)}else{const r=oP(e)?"axis":aP(e)?"legend":PT(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(wT(a)&&!n.customFormatTypes)return gN(XO(t)),wP({...e,[r]:s},t,n,i)}}return XT(e)?_P(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=te(n)?"quantitative":ie(n)?"nominal":yN(n)?"temporal":void 0,{...e,type:t}}(e)}function _P(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||Zz(i)||Qz(i)||Kz(i)||(gN(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=NN(r)),a&&(s.field=`${a}`),oO(o)&&(s.bin=AP(o,t)),aO(o)&&!Az(t)&&gN(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),nP(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case QN:return"quantitative";case"t":case eR:return"temporal";case"o":case ZN:return"ordinal";case"n":case tR:return"nominal";case nR:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&tO(i)&&(gN(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!JB(t)){const e=function(e,t){var n;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(qT(e)&&f(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!Qz(i)&&!Kz(i))return"quantitative";if(rP(e)&&(null==(n=e.scale)?void 0:n.type))switch(fR[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(nP(s)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case HM:case GM:case VM:return cP(e)?kP:{compatible:!1,warning:tN(t)};case YM:case XM:case QM:case ZM:case lB:case cB:case fB:case xB:case _B:case AB:case kB:case DB:case FB:case pB:case nB:case eB:case CB:return kP;case oB:case sB:case rB:case aB:return n!==QN?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:kP;case mB:case gB:case yB:case vB:case hB:case iB:case tB:case JM:case KM:case uB:return"nominal"!==n||e.sort?kP:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case dB:case bB:return cP(e)||rP(i=e)&&kR(null==(r=i.scale)?void 0:r.type)?kP:{compatible:!1,warning:nN(t)};case wB:return"nominal"!==e.type||"sort"in e?kP:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i,r}(s,t)||{};!1===e&&gN(n)}if(qT(s)&&ie(s.sort)){const{sort:e}=s;if(OT(e))return{...s,sort:{encoding:e}};const t=e.substring(1);if("-"===e.charAt(0)&&OT(t))return{...s,sort:{encoding:t,order:"descending"}}}if(PT(s)){const{header:e}=s;if(e){const{orient:t,...n}=e;if(t)return{...s,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return s}function AP(e,t){return Pe(e)?{maxbins:lO(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:lO(t)}}const kP={compatible:!0};function DP(e){const{formatType:t}=yP(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||XT(n)&&!!n.timeUnit));var n}function FP(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){var o;const a=t&&(null==(o=NN(t))?void 0:o.unit);let s,u=a||"temporal"===n;return cO(e)?s=e.expr:pO(e)?s=e.signal:yN(e)?(u=!0,s=AN(e)):(ie(e)||te(e))&&u&&(s=`datetime(${IM(e)})`,function(e){return c(kN,e)}(a)&&(te(e)&&e<1e4||ie(e)&&isNaN(Date.parse(e)))&&(s=AN({[a]:e}))),s?i&&u?`time(${s})`:s:r?void 0:IM(e)}function CP(e,t){const{type:n}=e;return t.map((t=>{const i=FP(t,{timeUnit:XT(e)&&!FN(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function EP(e,t){return oO(e.bin)?Iz(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const $P={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function SP(e){return null==e?void 0:e.condition}const MP=["domain","grid","labels","ticks","title"],BP={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},zP={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},OP={...zP,style:1,labelExpr:1,encoding:1};function NP(e){return c(OP,e)}const RP=yM({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function TP(e){return WM(e,"mark")}class PP{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!TP(e)&&(eT(t=e.mark)?t.type:t)===this.name;var t}}function jP(e,t){const n=e&&e[t];return!!n&&(f(n)?aM(n,(e=>!!e.field)):XT(n)||VT(n))}function LP(e,t){const n=e&&e[t];return!!n&&(f(n)?aM(n,(e=>!!e.field)):XT(n)||KT(n)||YT(n))}function qP(e,t){if(Az(t)){const n=e[t];if((XT(n)||KT(n))&&(KN(n.type)||XT(n)&&n.timeUnit)){return LP(e,nz(t))}}return!1}function UP(e){return aM(jB,(t=>{if(jP(e,t)){const n=e[t];if(f(n))return aM(n,(e=>!!e.aggregate));{const e=vP(n);return e&&!!e.aggregate}}return!1}))}function IP(e,t){const n=[],i=[],r=[],o=[],a={};return GP(e,((s,u)=>{if(XT(s)){const{field:l,aggregate:f,bin:d,timeUnit:h,...p}=s;if(f||h||d){const e=mP(s),m=null==e?void 0:e.title;let g=lP(s,{forAs:!0});const y={...m?[]:{title:pP(s,t,{allowDisabling:!0})},...p,field:g};if(f){let e;if(Qz(f)?(e="argmax",g=lP({op:"argmax",field:f.argmax},{forAs:!0}),y.field=`${g}.${l}`):Kz(f)?(e="argmin",g=lP({op:"argmin",field:f.argmin},{forAs:!0}),y.field=`${g}.${l}`):"boxplot"!==f&&"errorbar"!==f&&"errorband"!==f&&(e=f),e){const t={op:e,as:g};l&&(t.field=l),o.push(t)}}else if(n.push(g),nP(s)&&oO(d)){if(i.push({bin:d,field:l,as:g}),n.push(lP(s,{binSuffix:"end"})),EP(s,u)&&n.push(lP(s,{binSuffix:"range"})),Az(u)){const e={field:`${g}_end`};a[`${u}2`]=e}y.bin="binned",JB(u)||(y.type=QN)}else if(h&&!FN(h)){r.push({timeUnit:h,field:l,as:g});const e=nP(s)&&s.type!==eR&&"time";e&&(u===xB||u===kB?y.formatType=e:!function(e){return c(bz,e)}(u)?Az(u)&&(y.axis={formatType:e,...y.axis}):y.legend={formatType:e,...y.legend})}a[u]=y}else n.push(l),a[u]=e[u]}else a[u]=e[u]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function WP(e,t,n){const i=Wz(t,n);if(!i)return!1;if("binned"===i){const n=e[t===JM?YM:XM];return!!(XT(n)&&XT(e[t])&&aO(n.bin))}return!0}function HP(e,t){const n={};for(const i of yM(e)){const r=xP(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function GP(e,t,n){if(e)for(const i of yM(e)){const r=e[i];if(f(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function VP(e,t){return yM(t).reduce(((n,i)=>{switch(i){case YM:case XM:case DB:case CB:case FB:case JM:case KM:case QM:case ZM:case nB:case iB:case eB:case tB:case uB:case rB:case oB:case aB:case sB:case xB:case dB:case pB:case kB:return n;case wB:if("line"===e||"trail"===e)return n;case _B:case AB:{const e=t[i];if(f(e)||XT(e))for(const t of u(e))t.aggregate||n.push(lP(t,{}));return n}case hB:if("trail"===e)return n;case lB:case cB:case fB:case mB:case gB:case yB:case bB:case vB:{const e=vP(t[i]);return e&&!e.aggregate&&n.push(lP(e,{})),n}}}),[])}function YP(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${XP(t)}`:"";return{field:e+t.field,type:t.type,title:pO(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),...cM(function(e){const t=[];for(const n of yM(e))if(jP(e,n)){const i=e[n],r=u(i);for(const e of r)XT(e)?t.push(e):VT(e)&&t.push(e.condition)}return t}(n).map(uP),iM)]}}function XP(e){const{title:t,field:n}=e;return zM(t,n)}function JP(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:u,positionPrefix:l,endPositionPrefix:c,extraEncoding:f={}})=>{const d=XP(n);return KP(e,s,r,{mark:u,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...ie(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function KP(e,t,n,i){const{clip:r,color:o,opacity:a}=e,s=e.type;return e[t]||void 0===e[t]&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...o?{color:o}:{},...a?{opacity:a}:{},...eT(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...Pe(e[t])?{}:e[t]}}]:[]}function QP(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],u=i[`${r}Error2`];return{continuousAxisChannelDef:ZP(o,n),continuousAxisChannelDef2:ZP(a,n),continuousAxisChannelDefError:ZP(s,n),continuousAxisChannelDefError2:ZP(u,n),continuousAxis:r}}function ZP(e,t){if(null==e?void 0:e.aggregate){const{aggregate:n,...i}=e;return n!==t&&gN(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function ej(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(eT(n)&&n.orient)return n.orient;if(QT(r)){if(QT(o)){const e=XT(r)&&r.aggregate,n=XT(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return DP(o)&&!DP(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(QT(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const tj="boxplot",nj=new PP(tj,rj);function ij(e){return te(e)?"tukey":e}function rj(e,{config:t}){e={...e,encoding:HP(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=eT(n)?n:{type:n};r&&gN(WO("boxplot"));const u=s.extent??t.boxplot.extent,l=EO("size",s,t),c=s.invalid,d=ij(u),{bins:h,timeUnits:p,transform:m,continuousAxisChannelDef:g,continuousAxis:y,groupby:v,aggregate:b,encodingWithoutContinuousAxis:x,ticksOrient:w,boxOrient:_,customTooltipWithoutAggregatedField:A}=function(e,t,n){const i=ej(e,tj),{continuousAxisChannelDef:r,continuousAxis:o}=QP(e,i,tj),a=r.field,s=MM(a),u=ij(t),l=[...oj(a),{op:"median",field:a,as:`mid_box_${s}`},{op:"min",field:a,as:("min-max"===u?"lower_whisker_":"min_")+s},{op:"max",field:a,as:("min-max"===u?"upper_whisker_":"max_")+s}],c="min-max"===u||"tukey"===u?[]:[{calculate:`${CM(`upper_box_${s}`)} - ${CM(`lower_box_${s}`)}`,as:`iqr_${s}`},{calculate:`min(${CM(`upper_box_${s}`)} + ${CM(`iqr_${s}`)} * ${t}, ${CM(`max_${s}`)})`,as:`upper_whisker_${s}`},{calculate:`max(${CM(`lower_box_${s}`)} - ${CM(`iqr_${s}`)} * ${t}, ${CM(`min_${s}`)})`,as:`lower_whisker_${s}`}],{[o]:d,...h}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(f(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return f(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(h),{bins:g,timeUnits:y,aggregate:v,groupby:b,encoding:x}=IP(m,n),w="vertical"===i?"horizontal":"vertical",_=i,A=[...g,...y,{aggregate:[...v,...l],groupby:b},...c];return{bins:g,timeUnits:y,transform:A,groupby:b,aggregate:v,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:x,ticksOrient:w,boxOrient:_,customTooltipWithoutAggregatedField:p}}(e,u,t),k=MM(g.field),{color:D,size:F,...C}=x,E=e=>JP(s,y,g,e,t.boxplot),$=E(C),S=E(x),M=(ne(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",B=E({...C,...F?{size:F}:{},color:{condition:{test:`${CM(`lower_box_${g.field}`)} >= ${CM(`upper_box_${g.field}`)}`,...D||{value:M}}}}),z=YP([{fieldPrefix:"min-max"===d?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===d?"lower_whisker_":"min_",titlePrefix:"Min"}],g,x),O={type:"tick",color:"black",opacity:1,orient:w,invalid:c,aria:!1},N="min-max"===d?z:YP([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],g,x),R=[...$({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...$({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...$({partName:"ticks",mark:O,positionPrefix:"lower_whisker",extraEncoding:N}),...$({partName:"ticks",mark:O,positionPrefix:"upper_whisker",extraEncoding:N})],T=[..."tukey"!==d?R:[],...S({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:z}),...B({partName:"median",mark:{type:"tick",invalid:c,...ne(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:z})];if("min-max"===d)return{...a,transform:(a.transform??[]).concat(m),layer:T};const P=CM(`lower_box_${g.field}`),j=CM(`upper_box_${g.field}`),L=`(${j} - ${P})`,q=`${P} - ${u} * ${L}`,U=`${j} + ${u} * ${L}`,I=CM(g.field),W={joinaggregate:oj(g.field),groupby:v},H={transform:[{filter:`(${q} <= ${I}) && (${I} <= ${U})`},{aggregate:[{op:"min",field:g.field,as:`lower_whisker_${k}`},{op:"max",field:g.field,as:`upper_whisker_${k}`},{op:"min",field:`lower_box_${g.field}`,as:`lower_box_${k}`},{op:"max",field:`upper_box_${g.field}`,as:`upper_box_${k}`},...b],groupby:v}],layer:R},{tooltip:G,...V}=C,{scale:Y,axis:X}=g,J=XP(g),K=nM(X,["title"]),Q=KP(s,"outliers",t.boxplot,{transform:[{filter:`(${I} < ${q}) || (${I} > ${U})`}],mark:"point",encoding:{[y]:{field:g.field,type:g.type,...void 0!==J?{title:J}:{},...void 0!==Y?{scale:Y}:{},...gM(K)?{}:{axis:K}},...V,...D?{color:D}:{},...A?{tooltip:A}:{}}})[0];let Z;const ee=[...h,...p,W];return Q?Z={transform:ee,layer:[Q,H]}:(Z=H,Z.transform.unshift(...ee)),{...a,layer:[Z,{transform:m,layer:T}]}}function oj(e){const t=MM(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}const aj="errorbar",sj=new PP(aj,uj);function uj(e,{config:t}){e={...e,encoding:HP(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:u,tooltipEncoding:l}=cj(e,aj,t);delete o.size;const c=JP(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function lj(e,t){const{encoding:n}=e;if(function(e){return(tP(e.x)||tP(e.y))&&!tP(e.x2)&&!tP(e.y2)&&!tP(e.xError)&&!tP(e.xError2)&&!tP(e.yError)&&!tP(e.yError2)}(n))return{orient:ej(e,t),inputType:"raw"};const i=function(e){return tP(e.x2)||tP(e.y2)}(n),r=function(e){return tP(e.xError)||tP(e.xError2)||tP(e.yError)||tP(e.yError2)}(n),o=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(tP(e)&&tP(i))throw new Error(`${t} cannot have both x2 and y2`);if(tP(e)){if(QT(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(tP(i)){if(QT(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,s=n.yError2;if(tP(i)&&!tP(e))throw new Error(`${t} cannot have xError2 without xError`);if(tP(s)&&!tP(r))throw new Error(`${t} cannot have yError2 without yError`);if(tP(e)&&tP(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(tP(e)){if(QT(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(tP(r)){if(QT(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function cj(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,u=eT(i)?i:{type:i};o&&gN(WO(t));const{orient:l,inputType:c}=lj(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=QP(e,l,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let u=[],l=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&gN(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)u=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],l=[{calculate:`${CM(`center_${c}`)} + ${CM(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${CM(`center_${c}`)} - ${CM(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:kM(t)},{fieldPrefix:"upper_",titlePrefix:fj(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:fj(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),u=[{op:t,field:c,as:`lower_${c}`},{op:i,field:c,as:`upper_${c}`},{op:e,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:pP({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:pP({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:pP({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&gN((h=e.center,`${(p=e.extent)?"extent ":""}${p&&h?"and ":""}${h?"center ":""}${p&&h?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],l=[{calculate:CM(n.field),as:`upper_${c}`},{calculate:CM(c),as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${CM(c)} + ${CM(i.field)}`,as:`upper_${c}`}],r?l.push({calculate:`${CM(c)} + ${CM(r.field)}`,as:`lower_${c}`}):l.push({calculate:`${CM(c)} - ${CM(i.field)}`,as:`lower_${c}`}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:SM(SM(e.calculate,"datum['",""),"']","")})}var h,p;return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}(u,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:w,["x"===m?"xError":"yError"]:_,["x"===m?"xError2":"yError2"]:A,...k}=r,{bins:D,timeUnits:F,aggregate:C,groupby:E,encoding:$}=IP(k,n),S=[...C,...g],M="raw"!==c?[]:E,B=YP(v,f,$,b);return{transform:[...s.transform??[],...D,...F,...0===S.length?[]:[{aggregate:S,groupby:M}],...y],groupby:M,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:$,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:u,outerSpec:s,tooltipEncoding:B}}function fj(e,t,n){return`${kM(e)} ${n} ${t}`}const dj="errorband",hj=new PP(dj,pj);function pj(e,{config:t}){e={...e,encoding:HP(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:u}=cj(e,dj,t),l=a,c=JP(l,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):l.interpolate?gN(fN("interpolate")):l.tension&&gN(fN("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const mj={};function gj(e,t,n){const i=new PP(e,t);mj[e]={normalizer:i,parts:n}}gj(tj,rj,["box","median","outliers","rule","ticks"]),gj(aj,uj,["ticks","rule"]),gj(dj,pj,["band","borders"]);const yj=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],vj={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},bj={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},xj=yM(vj),wj=yM(bj),_j=yM({header:1,headerRow:1,headerColumn:1,headerFacet:1}),Aj=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],kj="_vgsid_",Dj={point:{on:"click",fields:[kj],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Fj(e){return"legend"===e||!!(null==e?void 0:e.legend)}function Cj(e){return Fj(e)&&ne(e)}function Ej(e){return!!(null==e?void 0:e.select)}function $j(e){const t=[];for(const n of e||[]){if(Ej(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function Sj(e){return WM(e,"concat")}function Mj(e){return WM(e,"vconcat")}function Bj(e){return WM(e,"hconcat")}function zj({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function Oj(e){return WM(e,"step")}function Nj(e){return WM(e,"view")||WM(e,"width")||WM(e,"height")}const Rj=yM({align:1,bounds:1,center:1,columns:1,spacing:1});function Tj(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function Pj(e,t){const n=jj(e,t);return Oj(n)?n.step:Lj}function jj(e,t){return zM(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Lj=20,qj={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Lj},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:lT,circle:{},geoshape:{},image:{},line:{},point:{},rect:uT,rule:{color:"black"},square:{},text:{color:"black"},tick:cT,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Dj,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Uj=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Ij={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Wj={blue:Uj[0],orange:Uj[1],red:Uj[2],teal:Uj[3],green:Uj[4],yellow:Uj[5],purple:Uj[6],pink:Uj[7],brown:Uj[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Hj(e){const t=yM(e||{}),n={};for(const i of t){const t=e[i];n[i]=SP(t)?xO(t):wO(t)}return n}const Gj=[...oT,...RP,..._j,"background","padding","legend","lineBreak","scale","style","title","view"];function Vj(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=qe({},ZS(qj),n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:ne(e)?{...Wj,...e}:Wj}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:ne(e)?{...Ij,...e}:Ij}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},o||{});r&&pt(a,"selection",r,!0);const s=nM(a,Gj);for(const u of["background","lineBreak","padding"])a[u]&&(s[u]=wO(a[u]));for(const u of oT)a[u]&&(s[u]=fO(a[u]));for(const u of RP)a[u]&&(s[u]=Hj(a[u]));for(const u of _j)a[u]&&(s[u]=fO(a[u]));if(a.legend&&(s.legend=fO(a.legend)),a.scale){const{invalid:e,...t}=a.scale,n=fO(e,{level:1});s.scale={...fO(t),...yM(n).length>0?{invalid:n}:{}}}return a.style&&(s.style=function(e){const t=yM(e),n={};for(const i of t)n[i]=Hj(e[i]);return n}(a.style)),a.title&&(s.title=fO(a.title)),a.view&&(s.view=fO(a.view)),s}const Yj=new Set(["view",...ZR]),Xj=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Jj={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...rT};function Kj(e){e=ZS(e);for(const t of Xj)delete e[t];if(e.axis)for(const t in e.axis)SP(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of yj)delete e.legend[t];if(e.mark){for(const t of nT)delete e.mark[t];e.mark.tooltip&&ne(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat($j(e.params)),delete e.params);for(const t of Yj){for(const i of nT)delete e[t][i];const n=Jj[t];if(n)for(const i of n)delete e[t][i];Qj(e,t)}for(const t of yM(mj))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=dO(e.title);gM(t)||(e.style["group-title"]={...e.style["group-title"],...t});gM(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});gM(i)?delete e.title:e.title=i}(e);for(const t in e)ne(e[t])&&gM(e[t])&&delete e[t];return gM(e)?void 0:e}function Qj(e,t,n,i){"view"===t&&(n="cell");const r={...e[t],...e.style[n??t]};gM(r)||(e.style[n??t]=r),delete e[t]}function Zj(e){return WM(e,"layer")}class eL{map(e,t){return jT(e)?this.mapFacet(e,t):function(e){return WM(e,"repeat")}(e)?this.mapRepeat(e,t):Bj(e)?this.mapHConcat(e,t):Mj(e)?this.mapVConcat(e,t):Sj(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Zj(e))return this.mapLayer(e,t);if(TP(e))return this.mapUnit(e,t);throw new Error(RO(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const tL={zero:1,center:1,normalize:1};const nL=new Set([TR,jR,PR,WR,UR,YR,XR,qR,HR,GR]),iL=new Set([jR,PR,TR]);function rL(e){return XT(e)&&"quantitative"===JT(e)&&!e.bin}function oL(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t&&["bar","area"].includes(i),a=e[t],s=e[r];if(XT(a)&&XT(s))if(rL(a)&&rL(s)){if(a.stack)return t;if(s.stack)return r;const e=XT(a)&&!!a.aggregate;if(e!==(XT(s)&&!!s.aggregate))return e?t:r;if(o){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(rL(a))return t;if(rL(s))return r}else{if(rL(a)){if(o&&"vertical"===n)return;return t}if(rL(s)){if(o&&"horizontal"===n)return;return r}}}function aL(e,t){var n,i;const r=eT(e)?e:{type:e},o=r.type;if(!nL.has(o))return null;const a=oL(t,"x",r)||oL(t,"theta",r);if(!a)return null;const s=t[a],l=XT(s)?lP(s,{}):void 0,f=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(a),d=[],h=new Set;if(t[f]){const e=t[f],n=XT(e)?lP(e,{}):void 0;n&&n!==l&&(d.push(f),h.add(n))}const p="x"===f?"xOffset":"yOffset",m=t[p],g=XT(m)?lP(m,{}):void 0;g&&g!==l&&(d.push(p),h.add(g));const y=xz.reduce(((e,n)=>{if("tooltip"!==n&&jP(t,n)){const i=t[n];for(const t of u(i)){const i=vP(t);if(i.aggregate)continue;const r=lP(i,{});r&&h.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let v;return void 0!==s.stack?v=Pe(s.stack)?s.stack?"zero":null:s.stack:iL.has(o)&&(v="zero"),v&&c(tL,v)?UP(t)&&0===y.length?null:((null==(n=null==s?void 0:s.scale)?void 0:n.type)&&(null==(i=null==s?void 0:s.scale)?void 0:i.type)!==iR&&(null==s?void 0:s.stack)&&gN(`Stack is applied to a non-linear scale (${s.scale.type}).`),tP(t[ZB(a)])?(void 0!==s.stack&&gN(`Cannot stack "${b=a}" if there is already "${b}2".`),null):(XT(s)&&s.aggregate&&!nO.has(s.aggregate)&&gN(`Stacking is applied even though the aggregate function is non-summative ("${s.aggregate}").`),{groupbyChannels:d,groupbyFields:h,fieldChannel:a,impute:null!==s.impute&&KR(o),stackBy:y,offset:v})):null;var b}function sL(e,t,n){const i=fO(e),r=EO("orient",i,n);if(i.orient=function(e,t,n){switch(e){case UR:case YR:case XR:case HR:case IR:case LR:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case jR:if(XT(i)&&(aO(i.bin)||XT(r)&&r.aggregate&&!i.aggregate))return"vertical";if(XT(r)&&(aO(r.bin)||XT(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(XT(i)&&i.type===QN&&!oO(i.bin)||eP(i))&&XT(r)&&aO(r.bin)?"horizontal":"vertical";if(!a)return(XT(r)&&r.type===QN&&!oO(r.bin)||eP(r))&&XT(i)&&aO(i.bin)?"vertical":"horizontal"}case WR:if(o&&(!XT(i)||!aO(i.bin))&&a&&(!XT(r)||!aO(r.bin)))return;case PR:if(a)return XT(r)&&aO(r.bin)?"horizontal":"vertical";if(o)return XT(i)&&aO(i.bin)?"vertical":"horizontal";if(e===WR){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case qR:case GR:{const t=ZT(i),o=ZT(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=nP(i)&&i.type===eR,t=nP(r)&&r.type===eR;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&gN(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=EO("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:sT[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}const o=EO("opacity",i,n),a=EO("fillOpacity",i,n);void 0===o&&void 0===a&&(i.opacity=function(e,t){if(oM([UR,GR,YR,XR],e)&&!UP(t))return.7;return}(i.type,t));return void 0===EO("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||EO("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function uL(e){const{point:t,line:n,...i}=e;return yM(i).length>1?i:i.type}function lL(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:nM(e[t],["point","line"])});return e}function cL(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?ne(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?ne(t.point)?t.point:{}:void 0}function fL(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class dL{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(TP(e)){const{mark:n,encoding:i}=e,r=eT(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!cL(r,t[r.type],i);case"area":return!!cL(r,t[r.type],i)||!!fL(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:u,...l}=e,c=HP(u,i),f=eT(a)?a:{type:a},d=cL(f,i[f.type],c),h="area"===f.type&&fL(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:uL({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:nM(c,["shape"])}],m=aL(sL(f,c,i),c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=nM(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...tM(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...tM(f,["clip","tooltip"]),...d},encoding:g}),n({...l,layer:p},{...t,config:lL(i)})}}function hL(e,t){return t?TT(e)?bL(e,t):gL(e,t):e}function pL(e,t){return t?bL(e,t):e}function mL(e,t,n){const i=t[e];return!ie(r=i)&&WM(r,"repeat")?i.repeat in n?{...t,[e]:n[i.repeat]}:void gN(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t;var r}function gL(e,t){if(void 0!==(e=mL("field",e,t))){if(null===e)return null;if(qT(e)&&NT(e.sort)){const n=mL("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function yL(e,t){if(XT(e))return gL(e,t);{const n=mL("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function vL(e,t){if(!tP(e)){if(YT(e)){const n=yL(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=yL(e,t);if(n)return n;if(GT(e))return{condition:e.condition}}}function bL(e,t){const n={};for(const i in e)if(WM(e,i)){const r=e[i];if(f(r))n[i]=r.map((e=>vL(e,t))).filter((e=>e));else{const e=vL(r,t);void 0!==e&&(n[i]=e)}}return n}class xL{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(TP(e)){const{encoding:t,mark:n}=e;if("line"===n||eT(n)&&"line"===n.type)for(const e of XB){const n=t[KB(e)];if(t[e]&&(XT(n)&&!aO(n.bin)||KT(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return gN((o=!!i.x2,a=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&a?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n({...e,mark:ne(r)?{...r,type:"rule"}:"rule"},t)}}function wL({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...yM(e),...yM(t)]);for(const o of r){const r=t[o],a=e[o];if(tP(r)){const e={...a,...r};i[o]=e}else YT(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||iP(a)||pO(a)||tP(a)||f(a))&&(i[o]=a)}}else i=t;return!i||gM(i)?void 0:i}function _L(e){const{parentProjection:t,projection:n}=e;return t&&n&&gN(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${IM(t)} is overridden by a child projection ${IM(n)}.`}({parentProjection:t,projection:n})),n??t}function AL(e){return WM(e,"filter")}function kL(e){return WM(e,"lookup")}function DL(e){return WM(e,"pivot")}function FL(e){return WM(e,"density")}function CL(e){return WM(e,"quantile")}function EL(e){return WM(e,"regression")}function $L(e){return WM(e,"loess")}function SL(e){return WM(e,"sample")}function ML(e){return WM(e,"window")}function BL(e){return WM(e,"joinaggregate")}function zL(e){return WM(e,"flatten")}function OL(e){return WM(e,"calculate")}function NL(e){return WM(e,"bin")}function RL(e){return WM(e,"impute")}function TL(e){return WM(e,"timeUnit")}function PL(e){return WM(e,"aggregate")}function jL(e){return WM(e,"stack")}function LL(e){return WM(e,"fold")}function qL(e){return WM(e,"extent")&&!WM(e,"density")&&!WM(e,"regression")}function UL(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(AL(e))return{filter:HL(e,t)};if(NL(e)&&sO(e.bin))return{...e,bin:WL(e.bin)};if(kL(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function IL(e,t){var n,i;const r=ZS(e);if(XT(r)&&sO(r.bin)&&(r.bin=WL(r.bin)),rP(r)&&(null==(i=null==(n=r.scale)?void 0:n.domain)?void 0:i.selection)){const{selection:e,...t}=r.scale.domain;r.scale.domain={...t,...e?{param:e}:{}}}if(GT(r))if(f(r.condition))r.condition=r.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:HL(e,t)}}));else{const{selection:e,param:n,test:i,...o}=IL(r.condition,t);r.condition=n?r.condition:{...o,test:HL(r.condition,t)}}return r}function WL(e){const t=e.extent;if(null==t?void 0:t.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function HL(e,t){const n=e=>QS(e,(e=>{var n;const i={param:e,empty:t.emptySelections[e]??!0};return(n=t.selectionPredicates)[e]??(n[e]=[]),t.selectionPredicates[e].push(i),i}));return e.selection?n(e.selection):QS(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class GL extends eL{map(e,t){const n=t.selections??[];if(e.params&&!TP(e)){const t=[];for(const i of e.params)Ej(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){const n=t.selections;if(!n||!n.length)return e;const i=(t.path??[]).concat(e.name),r=[];for(const o of n)if(o.views&&o.views.length)for(const t of o.views)(ie(t)&&(t===e.name||i.includes(t))||f(t)&&t.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(o);else r.push(o);return r.length&&(e.params=r),e}}for(const KV of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const e=GL.prototype[KV];GL.prototype[KV]=function(t,n){return e.call(this,t,VL(t,n))}}function VL(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function YL(e,t){void 0===t&&(t=Vj(e.config));const n=function(e,t={}){const n={config:t};return KL.map(XL.map(JL.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=TP(e)||Zj(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(gN(PO("width")),i=void 0),"container"==r&&(gN(PO("height")),r=void 0));const s={type:"pad",...a,...n?QL(n.autosize):{},...QL(e.autosize)};"fit"!==s.type||o||(gN(TO),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&gN(jO("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&gN(jO("height"));if(UM(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const XL=new class extends eL{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[nj,sj,hj,new dL,new xL]}map(e,t){if(TP(e)){const n=jP(e.encoding,HM),i=jP(e.encoding,GM),r=jP(e.encoding,VM);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=pL(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const s of this.nonFacetUnitNormalizers)if(s.hasMatchingType(o,t.config))return s.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!f(e.repeat)&&WM(e.repeat,"layer")}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:u={},repeaterPrefix:l=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...u,layer:e},r=`${(i.name?`${i.name}_`:"")+l}child__layer_${wM(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,t){const{repeat:n,spec:i,data:r,...o}=e;!f(n)&&e.columns&&(e=nM(e,["columns"]),gN(GO("repeat")));const a=[],{repeater:s={},repeaterPrefix:u=""}=t,l=!f(n)&&n.row||[s?s.row:null],c=!f(n)&&n.column||[s?s.column:null],d=f(n)&&n||[s?s.repeat:null];for(const p of d)for(const e of l)for(const r of c){const o={repeat:p,row:e,column:r,layer:s.layer},l=(i.name?`${i.name}_`:"")+u+"child__"+(f(n)?`${wM(p)}`:(n.row?`row_${wM(e)}`:"")+(n.column?`column_${wM(r)}`:"")),c=this.map(i,{...t,repeater:o,repeaterPrefix:l});c.name=l,a.push(nM(c,["data"]))}const h=f(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:h,concat:a}}mapFacet(e,t){const{facet:n}=e;return TT(n)&&e.columns&&(e=nM(e,["columns"]),gN(GO("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=_L({parentProjection:o,projection:i}),u=wL({parentEncoding:r,encoding:pL(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...u?{encoding:u}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:u,height:l,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=pL(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...l?{height:l}:{},...c?{view:c}:{},...u?{projection:u}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&gN(`Facet encoding dropped as ${(o=[...n?[HM]:[],...i?[GM]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[HM,GM]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...u}=i;t[n]=u;for(const t of["align","center","spacing"])void 0!==i[t]&&(a[t]??(a[t]={}),a[t][n]=i[t])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:hL(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:wL({parentEncoding:t,encoding:r,layer:!0}),parentProjection:_L({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},JL=new class extends eL{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=UL(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=UL(e,t)).encoding){const n={};for(const[i,r]of bM(e.encoding))n[i]=IL(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:bM(n).map((([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const s of vM(t.selectionPredicates[e]??{}))s.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},KL=new GL;function QL(e){return ie(e)?{type:e}:e??{}}const ZL=["background","padding"];function eq(e,t){const n={};for(const i of ZL)e&&void 0!==e[i]&&(n[i]=wO(e[i]));return t&&(n.params=e.params),n}class tq{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new tq(ZS(this.explicit),ZS(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return zM(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of yM(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function nq(e){return{explicit:!0,value:e}}function iq(e){return{explicit:!1,value:e}}function rq(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:oq(t,n,i,r)}}function oq(e,t,n,i){return e.explicit&&t.explicit&&gN(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${IM(n)} and ${IM(i)}). Using ${IM(n)}.`}(n,i,e.value,t.value)),e}function aq(e,t,n,i,r=oq){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:UM(e.value,t.value)?e:r(e,t,n,i)}class sq extends tq{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function uq(e){return WM(e,"url")}function lq(e){return WM(e,"values")}function cq(e){return WM(e,"name")&&!uq(e)&&!lq(e)&&!fq(e)}function fq(e){return e&&(dq(e)||hq(e)||pq(e))}function dq(e){return WM(e,"sequence")}function hq(e){return WM(e,"sphere")}function pq(e){return WM(e,"graticule")}var mq,gq;function yq({invalid:e,isPath:t}){switch(fT(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}(gq=mq||(mq={}))[gq.Raw=0]="Raw",gq[gq.Main=1]="Main",gq[gq.Row=2]="Row",gq[gq.Column=3]="Column",gq[gq.Lookup=4]="Lookup",gq[gq.PreFilterInvalid=5]="PreFilterInvalid",gq[gq.PostFilterInvalid=6]="PostFilterInvalid";class vq{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.includes(e)?gN("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const i of this._children)i.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class bq extends vq{clone(){const e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${NM()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function xq(e){return void 0!==e.as}function wq(e){return`${e}_end`}class _q extends vq{clone(){return new _q(null,ZS(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(FN(o)){if(KG(t)){const{mark:e,markDef:i,config:s}=t,u=UT({fieldDef:n,markDef:i,config:s});(QR(e)||u)&&(a={timeUnit:NN(o),field:r})}}else a={as:lP(n,{forAs:!0}),field:r,timeUnit:o};if(KG(t)){const{mark:e,markDef:r,config:o}=t,s=UT({fieldDef:n,markDef:r,config:o});QR(e)&&Az(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[iM(a)]=a)}return e}),{});return gM(n)?null:new _q(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:NN(n)};return new _q(e,{[iM(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of bM(this.timeUnits)){const r=xq(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(vM(this.timeUnits).map((e=>xq(e)?e.as:wq(e.field))))}dependentFields(){return new Set(vM(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${iM(this.timeUnits)}`}assemble(){const e=[];for(const t of vM(this.timeUnits)){const{rectBandPosition:n}=t,i=NN(t.timeUnit);if(xq(t)){const{field:r,as:o}=t,{unit:a,utc:s,...u}=i,l=[o,`${o}_end`];e.push({field:$M(r),type:"timeunit",...a?{units:SN(a)}:{},...s?{timezone:"utc"}:{},...u,as:l}),e.push(...Fq(l,n,i))}else if(t){const{field:r}=t,o=r.replaceAll("\\.","."),a=Dq({timeUnit:i,field:o}),s=wq(o);e.push({type:"formula",expr:a,as:s}),e.push(...Fq([o,s],n,i))}}return e}}const Aq="offsetted_rect_start",kq="offsetted_rect_end";function Dq({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,o=MN(i),{part:a,step:s}=PN(o,e.step);return`${r?"utcOffset":"timeOffset"}('${a}', ${CM(t)}, ${n?-s:s})`}function Fq([e,t],n,i){if(void 0!==n&&.5!==n){const r=CM(e),o=CM(t);return[{type:"formula",expr:Cq([Dq({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${Aq}`},{type:"formula",expr:Cq([r,o],n+.5),as:`${e}_${kq}`}]}return[]}function Cq([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const Eq="_tuple_fields";class $q{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const Sq={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new $q),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=wM(`${i}_${n}`);for(let o=1;s.has(r);o++)r=wM(`${i}_${n}_${o}`);return s.add(r),{[t]:r}},f=t.type,d=e.config.selection[f],h=void 0!==n.value?u(n.value):null;let{fields:p,encodings:m}=ne(n.select)?n.select:{};if(!p&&!m&&h)for(const u of h)if(ne(u))for(const e of yM(u))c(VB,e)?(m||(m=[])).push(e):"interval"===f?(gN('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),m=d.encodings):(p??(p=[])).push(e);p||m||(m=d.encodings,"fields"in d&&(p=d.fields));for(const u of m??[]){const t=e.fieldDef(u);if(t){let n=t.field;if(t.aggregate){gN(IO(u,t.aggregate));continue}if(!n){gN(UO(u));continue}if(t.timeUnit&&!FN(t.timeUnit)){n=e.vgField(u);const i={timeUnit:t.timeUnit,as:n,field:t.field};a[iM(i)]=i}if(!o[n]){const i={field:n,channel:u,type:"interval"===f&&Iz(u)&&_R(e.getScaleComponent(u).get("type"))?"R":t.bin?"R-RE":"E",index:r.items.length};i.signals={...l(i,"data"),...l(i,"visual")},r.items.push(o[n]=i),r.hasField[n]=o[n],r.hasSelectionId=r.hasSelectionId||n===kj,BB(u)?(i.geoChannel=u,i.channel=MB(u),r.hasChannel[i.channel]=o[n]):r.hasChannel[u]=o[n]}}else gN(UO(u))}for(const u of p??[]){if(r.hasField[u])continue;const e={type:"E",field:u,index:r.items.length};e.signals={...l(e,"data")},r.items.push(e),r.hasField[u]=e,r.hasSelectionId=r.hasSelectionId||u===kj}h&&(t.init=h.map((e=>r.items.map((t=>ne(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),gM(a)||(r.timeUnit=new _q(null,a))},signals:(e,t,n)=>{const i=t.name+Eq;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(qq)})}},Mq="_curr",Bq="anim_value",zq="anim_clock",Oq="eased_anim_clock",Nq="min_extent",Rq="max_range_extent",Tq="last_tick_at",Pq="is_playing",jq=1/60*1e3,Lq={defined:e=>"point"===e.type,topLevelSignals:(e,t,n)=>(nI(t)&&(n=n.concat([{name:zq,init:"0",on:[{events:{type:"timer",throttle:jq},update:`${Pq} ? (${zq} + (now() - ${Tq}) > ${Rq} ? 0 : ${zq} + (now() - ${Tq})) : ${zq}`}]},{name:Tq,init:"now()",on:[{events:[{signal:zq},{signal:Pq}],update:"now()"}]},{name:Pq,init:"true"}])),n),signals:(e,t,n)=>{const i=t.name,r=i+Eq,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=vM(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+Jq):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),u="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let l=`unit: ${ZU(e)}, `;if(t.project.hasSelectionId)l+=`${kj}: ${a}[${fe(kj)}]`;else if(nI(t))l+=`fields: ${r}, values: [${Bq} ? ${Bq} : ${Nq}]`;else{l+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return(null==n?void 0:n.bin)?`[${a}[${fe(e.vgField(t.channel,{}))}], ${a}[${fe(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${fe(t.field)}]`})).join(", ")}]`}if(nI(t))return n.concat((c=t.name,f=e.scaleName(uB),[{name:Oq,update:zq},{name:`${c}_domain`,init:`domain('${f}')`},{name:Nq,init:`extent(${c}_domain)[0]`},{name:Rq,init:`extent(range('${f}'))[1]`},{name:Bq,update:`invert('${f}', ${Oq})`}]),[{name:i+XU,on:[{events:[{signal:Oq},{signal:Bq}],update:`{${l}}`,force:!0}]}]);{const e=t.events;return n.concat([{name:i+XU,on:e?[{events:e,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}var c,f}};function qq(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=$M(r.field),r}function Uq(e,t=!0,n=l){if(f(e)){const i=e.map((e=>Uq(e,t,n)));return t?`[${i.join(", ")}]`:i}return yN(e)?n(t?AN(e):function(e){const t=_N(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(IM(e)):e}function Iq(e,t){for(const n of vM(e.component.selection??{})){const i=n.name;let r=`${i}${XU}, ${"global"===n.resolve?"true":`{unit: ${ZU(e)}}`}`;for(const o of QU)o.defined(n)&&(o.signals&&(t=o.signals(e,n,t)),o.modifyExpr&&(r=o.modifyExpr(e,n,r)));t.push({name:i+JU,on:[{events:{signal:n.name+XU},update:`modify(${fe(n.name+YU)}, ${r})`}]})}return Gq(t)}function Wq(e,t){if(e.component.selection&&yM(e.component.selection).length){const n=fe(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:ZF("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return Gq(t)}function Hq(e,t){for(const n of vM(e.component.selection??{}))for(const i of QU)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function Gq(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}const Vq={defined:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!Iz(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;"sequential"==a&&gN("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&_R(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):gN("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter((e=>0===n.filter((t=>t.name===e.signals.data)).length));if(!e.parent||Xq(e)||0===i.length)return n;const r=n.find((e=>e.name===t.name));let o=r.update;if(o.includes(KU))r.update=`{${i.map((e=>`${fe($M(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${fe($M(e.field))}: ${e.signals.data}`;o.includes(t)||(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!Xq(e))for(const i of t.scales){const e=n.find((e=>e.name===i.signals.data));e.push="outer",delete e.value,delete e.update}return n}};function Yq(e,t){return`domain(${fe(e.scaleName(t))})`}function Xq(e){return e.parent&&eV(e.parent)&&(!e.parent.parent||Xq(e.parent.parent))}const Jq="_brush",Kq="_scale_trigger",Qq="geo_interval_init_tick",Zq="_init",eU={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...ne(n.select)?n.select:{}};e.fields=[kj],e.encodings||(e.encodings=n.value?yM(n.value):[oB,rB]),n.select={type:"interval",...e}}if(t.translate&&!Vq.defined(t)){const e=`!event.item || event.item.mark.name !== ${fe(t.name+Jq)}`;for(const n of t.events){if(!n.between){gN(`${n} is not an ordered event stream for interval selections.`);continue}const t=u((i=n.between[0]).filter??(i.filter=[]));t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+XU,o=vM(t.project.hasChannel).filter((e=>e.channel===YM||e.channel===XM)),a=t.init?t.init[0]:null;if(n.push(...o.reduce(((n,i)=>n.concat(function(e,t,n,i){const r=!e.hasProjection,o=n.channel,a=n.signals.visual,s=fe(r?e.scaleName(o):e.projectionName()),u=e=>`scale(${s}, ${e})`,l=e.getSizeSignalRef(o===YM?"width":"height").signal,c=`${o}(unit)`,f=t.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${c}, ${c}]`},{events:t,update:`[${a}[0], clamp(${c}, 0, ${l})]`}]),[]);if(r){const r=n.signals.data,l=Vq.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:Uq(i,!0,u)}:{value:[]};return f.push({events:{signal:t.name+Kq},update:_R(d)?`[${u(`${r}[0]`)}, ${u(`${r}[1]`)}]`:"[0, 0]"}),l?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:Uq(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===YM?0:1,n=t.name+Zq;return[{name:a,...i?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:f}]}}(e,t,i,a&&a[i.index]))),[])),e.hasProjection){const s=fe(e.projectionName()),u=e.projectionName()+"_center",{x:l,y:c}=t.project.hasChannel,f=l&&l.signals.visual,d=c&&c.signals.visual,h=l?a&&a[l.index]:`${u}[0]`,p=c?a&&a[c.index]:`${u}[1]`,m=t=>e.getSizeSignalRef(t).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;if(a&&(n.unshift({name:i+Zq,init:`[scale(${s}, [${l?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${l?h[1]:h}, ${c?p[1]:p}])]`}),!l||!c)){n.find((e=>e.name===u))||n.unshift({name:u,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(${`intersect(${g}, {markname: ${fe(e.getName("marks"))}}, unit.mark)`}, ${`{unit: ${ZU(e)}}`})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:Qq}]:[]],update:y}]})}{if(!Vq.defined(t)){const t=i+Kq,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=fe(e.scaleName(n)),a=_R(e.getScaleComponent(n).get("type"))?"+":"";return`(!isArray(${i}) || (${a}invert(${o}, ${r})[0] === ${a}${i}[0] && ${a}invert(${o}, ${r})[1] === ${a}${i}[1]))`}));r.length&&n.push({name:t,value:{},on:[{events:o.map((t=>({scale:e.scaleName(t.channel)}))),update:r.join(" && ")+` ? ${t} : {}`}]})}const s=o.map((e=>e.signals.data)),u=`unit: ${ZU(e)}, fields: ${i+Eq}, values`;return n.concat({name:r,...a?{init:`{${u}: ${Uq(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${u}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(KG(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===Qq)).length||n.unshift({name:Qq,value:null,on:[{events:"timer{1}",update:`${Qq} === null ? {} : ${Qq}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=null==r?void 0:r.signals.visual,s=null==o?void 0:o.signals.visual,u=`data(${fe(t.name+YU)})`;if(Vq.defined(t)||!r&&!o)return n;const l={x:void 0!==r?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${s}[0]`}:{value:0},x2:void 0!==r?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const g of yM(l))l[g]=[{test:`${u}.length && ${u}[0].unit === ${ZU(e)}`,...l[g]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=yM(h).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${s}[0] !== ${s}[1]`].filter((e=>e)).join(" && "),value:h[t]},{value:null}],e)),{}),m=d??(t.translate?"move":null);return[{name:`${i+Jq}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:i+Jq,type:"rect",clip:!0,encode:{enter:{...m?{cursor:{value:m}}:{},fill:{value:"transparent"}},update:{...l,...p}}}]}};function tU({model:e,channelDef:t,vgChannel:n,invalidValueRef:i,mainRefFn:r}){const o=GT(t)&&t.condition;let a=[];if(o){a=u(o).map((t=>{const n=r(t);if(function(e){return WM(e,"param")}(t)){const{param:i,empty:r}=t;return{test:_W(e,{param:i,empty:r}),...n}}return{test:kW(e,t.test),...n}}))}void 0!==i&&a.push(i);const s=r(t);return void 0!==s&&a.push(s),a.length>1||1===a.length&&Boolean(a[0].test)?{[n]:a}:1===a.length?{[n]:a[0]}:{}}function nU(e,t="text"){const n=e.encoding[t];return tU({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>iU(t,e.config),invalidValueRef:void 0})}function iU(e,t,n="datum"){if(e){if(iP(e))return AO(e.value);if(tP(e)){const{format:i,formatType:r}=yP(e);return AT({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function rU(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(f(a))return{tooltip:aU({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return tU({model:e,channelDef:a,vgChannel:"tooltip",mainRefFn:e=>{const a=iU(e,r,s);if(a)return a;if(null===e)return;let u=EO("tooltip",i,r);return!0===u&&(u={content:"encoding"}),ie(u)?{value:u}:ne(u)?pO(u)?u:"encoding"===u.content?aU(n,o,r,t):{signal:s}:void 0},invalidValueRef:void 0})}}function oU(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o=new Set,a=i?"datum.datum":"datum",s=[];function l(n,i){const l=KB(i),c=nP(n)?n:{...n,type:e[l].type},f=c.title||gP(c,r),d=u(f).join(", ").replaceAll(/"/g,'\\"');let h;if(Az(i)){const t="x"===i?"x2":"y2",n=vP(e[t]);if(aO(c.bin)&&n){const e=lP(c,{expr:a}),i=lP(n,{expr:a}),{format:s,formatType:u}=yP(c);h=MT(e,i,s,u,r),o.add(t)}}if((Az(i)||i===nB||i===eB)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=yP(c);h=AT({fieldOrDatumDef:c,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}h??(h=iU(c,r,a).signal),s.push({channel:i,key:d,value:h})}GP(e,((e,t)=>{XT(e)?l(e,t):VT(e)&&l(e.condition,t)}));const c={};for(const{channel:u,key:f,value:d}of s)o.has(u)||c[f]||(c[f]=d);return c}function aU(e,t,n,{reactiveGeom:i}={}){const r=oU(e,t,n,{reactiveGeom:i}),o=bM(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function sU(e){const{markDef:t,config:n}=e,i=EO("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...uU(e),...lU(e)}}function uU(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=EO("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:c(vO,t)?{}:{ariaRoleDescription:{value:t}}}function lU(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return tU({model:e,channelDef:o,vgChannel:"description",mainRefFn:t=>iU(t,e.config),invalidValueRef:void 0});const a=EO("description",n,i);if(null!=a)return{description:AO(a)};if(!1===i.aria)return{};const s=oU(t,r,i);return gM(s)?void 0:{description:{signal:bM(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function cU(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:u}=n;const l=r[e];void 0===s&&(u??(u=EO(e,i,o,{vgChannel:a,ignoreVgConfig:!GT(l)})),void 0!==u&&(s=AO(u)));const c={markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=pT({...c,scaleChannel:e,channelDef:l});return tU({model:t,channelDef:l,vgChannel:a??e,invalidValueRef:f,mainRefFn:t=>bT({...c,channel:e,channelDef:t,stack:null,defaultRef:s})})}function fU(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??EO("filled",n,r),s=oM(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,u=EO(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,l=EO(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...u?{fill:AO(u)}:{},...l?{stroke:AO(l)}:{}};return n.color&&(a?n.fill:n.stroke)&&gN(QO("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...cU("color",e,{vgChannel:c,defaultValue:a?u:l}),...cU("fill",e,{defaultValue:i.fill?u:void 0}),...cU("stroke",e,{defaultValue:i.stroke?l:void 0})}}function dU(e){const{encoding:t,mark:n}=e,i=t.order;return!KR(n)&&iP(i)?tU({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:e=>AO(e.value),invalidValueRef:void 0}):{}}function hU({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,a=t[o],s=n[o];if(("xOffset"===o||"yOffset"===o)&&s){return{offsetType:"encoding",offset:bT({channel:o,channelDef:s,markDef:t,config:null==i?void 0:i.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:AO(a),bandPosition:r})}}const u=t[o];return u?{offsetType:"visual",offset:u}:{}}function pU(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,u=r[e],l=r[ZB(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=hU({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=mU({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!u&&Az(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(tP(n)&&r&&t===r.fieldChannel){if(XT(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return vT({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return yT(n,i,{suffix:"end"},{offset:o})}return gT(e)}({channel:e,channelDef:u,channel2Def:l,markDef:o,config:a,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===h?0:void 0});return m?{[i||e]:m}:void 0}function mU({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=KB(n),u=QB(n),l=EO(n,o,a,{vgChannel:u});if(void 0!==l)return xT(n,l);switch(t){case"zeroOrMin":return gU({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:s,config:a});case"zeroOrMax":return gU({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:a});case"mid":return{...e[ez(n)],mult:.5}}}}function gU({mainChannel:e,config:t,...n}){const i=hT(n),{mode:r}=n;if(i)return i;switch(e){case"radius":{if("zeroOrMin"===r)return{value:0};const{widthSignal:e,heightSignal:t}=r.zeroOrMax;return{signal:`min(${e},${t})/2`}}case"theta":return"zeroOrMin"===r?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===r?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===r?{field:{group:"height"}}:{value:0}}}const yU={left:"x",center:"xc",right:"x2"},vU={top:"y",middle:"yc",bottom:"y2"};function bU(e,t,n,i="middle"){if("radius"===e||"theta"===e)return QB(e);const r="x"===e?"align":"baseline",o=EO(r,t,n);let a;return pO(o)?(gN(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?yU[a||("top"===i?"left":"center")]:vU[a||i]}function xU(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?wU(e,t,{defaultPos:n,defaultPos2:i}):pU(e,t,{defaultPos:n})}function wU(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=ZB(e),s=ez(e),u=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,u=KB(n),l=ez(n),c=QB(n),f=i[u],d=e.scaleName(u),h=e.getScaleComponent(u),{offset:p}=hU(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:u,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=ez(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[c]:{field:e.getName(n)}}}const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:u,defaultRef:l}){if(tP(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0))return yT(t,o,{suffix:"start"},{offset:u});return gT({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:u,defaultRef:l})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});if(void 0!==m)return{[c]:m};return _U(n,o)||_U(n,{[n]:SO(n,o,s.style),[l]:SO(l,o,s.style)})||_U(n,s[r])||_U(n,s.mark)||{[c]:mU({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...pU(e,t,{defaultPos:n,vgChannel:u[s]?bU(e,r,o):QB(e)}),...u}}function _U(e,t){const n=ez(e),i=QB(e);if(void 0!==t[i])return{[i]:xT(e,t[i])};if(void 0!==t[e])return{[i]:xT(e,t[e])};if(t[n]){const i=t[n];if(!aT(i))return{[n]:xT(e,i)};gN(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function AU(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=ZB(t),s=ez(t),u=i[t],l=i[a],c=e.getScaleComponent(t),d=c?c.get("type"):void 0,h=r.orient,p=i[s]??i.size??EO("size",r,n,{vgChannel:s}),m=tz(t),g="bar"===o&&("x"===t?"vertical"===h:"horizontal"===h)||"tick"===o&&("y"===t?"vertical"===h:"horizontal"===h);return!XT(u)||!(oO(u.bin)||aO(u.bin)||u.timeUnit&&!l)||p&&!aT(p)||i[m]||wR(d)?(tP(u)&&wR(d)||g)&&!l?function(e,t,n){var i,r;const{markDef:o,encoding:a,config:s,stack:u}=n,l=o.orient,c=n.scaleName(t),d=n.getScaleComponent(t),h=ez(t),p=ZB(t),m=tz(t),g=n.scaleName(m),y=n.getScaleComponent(nz(t)),v="tick"===o.type||"horizontal"===l&&"y"===t||"vertical"===l&&"x"===t;let b;(a.size||o.size)&&(v?b=cU("size",n,{vgChannel:h,defaultRef:AO(o.size)}):gN(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(o.type)));const x=!!b,w=IT({channel:t,fieldDef:e,markDef:o,config:s,scaleType:null==(i=d||y)?void 0:i.get("type"),useVlSizeChannel:v});b=b||{[h]:kU(h,g||c,y||d,s,w,!!e,o.type)};const _="band"===(null==(r=d||y)?void 0:r.get("type"))&&aT(w)&&!x?"top":"middle",A=bU(t,o,s,_),k="xc"===A||"yc"===A,{offset:D,offsetType:F}=hU({channel:t,markDef:o,encoding:a,model:n,bandPosition:k?.5:0}),C=gT({channel:t,channelDef:e,markDef:o,config:s,scaleName:c,scale:d,stack:u,offset:D,defaultRef:mU({model:n,defaultPos:"mid",channel:t,scaleName:c,scale:d}),bandPosition:k?"encoding"===F?0:.5:pO(w)?{signal:`(1-${w})/2`}:aT(w)?(1-w.band)/2:0});if(h)return{[A]:C,...b};{const e=QB(p),t=b[h],n=D?{...t,offset:D}:t;return{[A]:C,[e]:f(C)?[C[0],{...C[1],offset:n}]:{...C,offset:n}}}}(u,t,e):wU(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){var r;const{config:o,markDef:a,encoding:s}=i,u=i.getScaleComponent(n),l=i.scaleName(n),c=u?u.get("type"):void 0,f=u.get("reverse"),d=IT({channel:n,fieldDef:e,markDef:a,config:o,scaleType:c}),h=null==(r=i.component.axes[n])?void 0:r[0],p=(null==h?void 0:h.get("translate"))??.5,m=Az(n)?EO("binSpacing",a,o)??0:0,g=ZB(n),y=QB(n),v=QB(g),b=$O("minBandSize",a,o),{offset:x}=hU({channel:n,markDef:a,encoding:s,model:i,bandPosition:0}),{offset:w}=hU({channel:g,markDef:a,encoding:s,model:i,bandPosition:0}),_=function({scaleName:e,fieldDef:t}){const n=lP(t,{expr:"datum"});return`abs(scale("${e}", ${lP(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:l}),A=DU(n,m,f,p,x,b,_),k=DU(g,m,f,p,w??x,b,_),D=pO(d)?{signal:`(1-${d.signal})/2`}:aT(d)?(1-d.band)/2:.5,F=UT({fieldDef:e,fieldDef2:t,markDef:a,config:o});if(oO(e.bin)||e.timeUnit){const t=e.timeUnit&&.5!==F;return{[v]:FU({fieldDef:e,scaleName:l,bandPosition:D,offset:k,useRectOffsetField:t}),[y]:FU({fieldDef:e,scaleName:l,bandPosition:pO(D)?{signal:`1-${D.signal}`}:1-D,offset:A,useRectOffsetField:t})}}if(aO(e.bin)){const n=yT(e,l,{},{offset:k});if(XT(t))return{[v]:n,[y]:yT(t,l,{},{offset:A})};if(sO(e.bin)&&e.bin.step)return{[v]:n,[y]:{signal:`scale("${l}", ${lP(e,{expr:"datum"})} + ${e.bin.step})`,offset:A}}}return void gN(dN(g))}({fieldDef:u,fieldDef2:l,channel:t,model:e})}function kU(e,t,n,i,r,o,a){if(aT(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;1!==r.band&&(e=`${r.band} * ${e}`);const n=$O("minBandSize",{type:a},i);return{signal:n?`max(${DO(n)}, ${e})`:e}}1!==r.band&&(gN(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(pO(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(mO(e)&&te(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r,tickBandPaddingInner:o}=i.scale,s=zM(t,"tick"===a?o:"bar"===a?n:r);if(pO(s))return{signal:`(1 - (${s.signal})) * ${e}`};if(te(s))return{signal:`${1-s} * ${e}`}}return{value:Pj(i.view,e)-2}}function DU(e,t,n,i,r,o,a){if($B(e))return 0;const s="x"===e||"y2"===e,u=s?-t/2:t/2;if(pO(n)||pO(r)||pO(i)||o){const e=DO(n),t=DO(r),l=DO(i),c=DO(o),f=o?`(${a} < ${c} ? ${s?"":"-"}0.5 * (${c} - (${a})) : ${u})`:u;return{signal:(l?`${l} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-u:+r+u)}function FU({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return vT({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:Aq,endSuffix:kq}:{}})}const CU=new Set(["aria","width","height"]);function EU(e,t){const{fill:n,stroke:i}="include"===t.color?fU(e):{};return{...SU(e.markDef,t),...$U("fill",n),...$U("stroke",i),...cU("opacity",e),...cU("fillOpacity",e),...cU("strokeOpacity",e),...cU("strokeWidth",e),...cU("strokeDash",e),...dU(e),...rU(e),...nU(e,"href"),...sU(e)}}function $U(e,t){return t?{[e]:t}:{}}function SU(e,t){return yO.reduce(((n,i)=>(!CU.has(i)&&WM(e,i)&&"ignore"!==t[i]&&(n[i]=AO(e[i])),n)),{})}function MU(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef(((r,o)=>{var a;let s;if(!Iz(o)||!(s=e.getScaleType(o)))return;const u=tO(r.aggregate),l=dT({scaleChannel:o,markDef:n,config:t,scaleType:s,isCountAggregate:u});if("break-paths-filter-domains"===(c=l)||"break-paths-show-domains"===c){const t=e.vgField(o,{expr:"datum",binSuffix:(null==(a=e.stack)?void 0:a.impute)?"mid":void 0});t&&i.add(t)}var c})),i.size>0){return{defined:{signal:[...i].map((e=>XN(e,!0))).join(" && ")}}}}function BU(e,t){if(void 0!==t)return{[e]:AO(t)}}const zU="voronoi",OU={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(zU)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(KR(o))return gN(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(zU),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...rU(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,u=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.includes(zU)&&(u=!0)})),u||n.splice(s+1,0,a),n}},NU={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Fj(e.bind),parse:(e,t,n)=>tI(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=OU.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const u=wM(`${i}_${e.field}`);n.filter((e=>e.name===u)).length||n.unshift({name:u,...a?{init:Uq(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${fe(e.field)}] : null`}]:[],bind:o[e.field]??o[e.channel]??o})})),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+XU)),a=i+Eq,s=r.items.map((e=>wM(`${i}_${e.field}`))),u=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${u} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},RU="_toggle",TU={defined:e=>"point"===e.type&&!nI(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+RU,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+XU,i=t.name+RU;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${ZU(e)}}, `)+`${i} ? ${n} : null`}},PU={defined:e=>void 0!==e.clear&&!1!==e.clear&&!nI(e),parse:(e,t)=>{t.clear&&(t.clear=ie(t.clear)?ZF(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(NU.defined(t))for(const i of t.project.items){const e=n.findIndex((e=>e.name===wM(`${t.name}_${i.field}`)));-1!==e&&n[e].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const r of t.project.items){const e=n.findIndex((e=>e.name===r.signals.visual));if(i(e,"[0, 0]"),-1===e){i(n.findIndex((e=>e.name===r.signals.data)),"null")}}else{let e=n.findIndex((e=>e.name===t.name+XU));i(e,"null"),TU.defined(t)&&(e=n.findIndex((e=>e.name===t.name+RU)),i(e,"false"))}return n}},jU={defined:e=>{const t="global"===e.resolve&&e.bind&&Fj(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==kj;return t&&!n&&gN("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=ZS(n);if(i.select=ie(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},tI(t,i),ne(n.select)&&(n.select.on||n.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=u(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const r=Cj(t.bind)?t.bind.legend:"click",o=ie(r)?ZF(r,"view"):u(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Cj(t.bind)&&t.bind.legend,o=e=>t=>{const n=ZS(t);return n.markname=e,n};for(const a of t.project.items){if(!a.hasLegend)continue;const e=`${wM(a.field)}_legend`,s=`${i}_${e}`;if(0===n.filter((e=>e.name===s)).length){const i=r.merge.map(o(`${e}_symbols`)).concat(r.merge.map(o(`${e}_labels`))).concat(r.merge.map(o(`${e}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:i,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+XU)),a=i+Eq,s=r.items.filter((e=>e.hasLegend)).map((e=>wM(`${i}_${wM(e.field)}_legend`))),u=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:u}):s.length>0&&(o.update=u,delete o.value,delete o.on);const l=n.find((e=>e.name===i+RU)),c=Cj(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:c}):l.on[0].events=c),n}};const LU="_translate_anchor",qU="_translate_delta",UU={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Vq.defined(t),o=i+LU,{x:a,y:s}=t.project.hasChannel;let u=ZF(t.translate,"scope");return r||(u=u.map((e=>(e.between[0].markname=i+Jq,e)))),n.push({name:o,value:{},on:[{events:u.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?Yq(e,YM):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?Yq(e,XM):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+qU,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&IU(e,t,a,"width",n),void 0!==s&&IU(e,t,s,"height",n),n}};function IU(e,t,n,i,r){const o=t.name,a=o+LU,s=o+qU,u=n.channel,l=Vq.defined(t),c=r.find((e=>e.name===n.signals[l?"data":"visual"])),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(u),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${u}`,g=`${l&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${`${l?u===YM?p?"":"-":p?"-":"":""}${s}.${u} / ${l?`${f}`:`span(${m})`}`}${l?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:l?g:`clampRange(${g}, 0, ${f})`})}const WU="_zoom_anchor",HU="_zoom_delta",GU={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Vq.defined(t),o=i+HU,{x:a,y:s}=t.project.hasChannel,u=fe(e.scaleName(YM)),l=fe(e.scaleName(XM));let c=ZF(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+Jq,e)))),n.push({name:i+WU,on:[{events:c,update:r?"{"+[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&VU(e,t,a,"width",n),void 0!==s&&VU(e,t,s,"height",n),n}};function VU(e,t,n,i,r){const o=t.name,a=n.channel,s=Vq.defined(t),u=r.find((e=>e.name===n.signals[s?"data":"visual"])),l=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?Yq(e,a):u.name,h=o+HU,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${o}${WU}.${a}`}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;u.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${l})`})}const YU="_store",XU="_tuple",JU="_modify",KU="vlSelectionResolve",QU=[Lq,eU,Sq,TU,NU,Vq,jU,PU,UU,GU,OU];function ZU(e,{escape:t}={escape:!0}){let n=t?fe(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!QG(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of TB)e[t]&&(n+=` + '__facet_${t}_' + (facet[${fe(i.vgField(t))}])`)}return n}function eI(e){return vM(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function tI(e,t){!ie(t.select)&&t.select.on||delete e.events,!ie(t.select)&&t.select.clear||delete e.clear,!ie(t.select)&&t.select.toggle||delete e.toggle}function nI(e){var t;return null==(t=e.events)?void 0:t.find((e=>"type"in e&&"timer"===e.type))}const iI="Property",rI="ArrayExpression",oI="BinaryExpression",aI="CallExpression",sI="ConditionalExpression",uI="LogicalExpression",lI="MemberExpression",cI="ObjectExpression",fI="UnaryExpression";function dI(e){this.type=e}var hI,pI,mI,gI,yI;dI.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case rI:return e.elements;case oI:case uI:return[e.left,e.right];case aI:return[e.callee].concat(e.arguments);case sI:return[e.test,e.consequent,e.alternate];case lI:return[e.object,e.property];case cI:return e.properties;case iI:return[e.key,e.value];case fI:return[e.argument];default:return[]}}(this),n=0,i=t.length;n",hI[3]="Identifier",hI[4]="Keyword",hI[5]="Null",hI[6]="Numeric",hI[7]="Punctuator",hI[8]="String",hI[9]="RegularExpression";var vI="Identifier",bI="Unexpected token %0",xI="Invalid regular expression",wI="Invalid regular expression: missing /",_I="Octal literals are not allowed in strict mode.",AI="ILLEGAL",kI="Disabled.",DI=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),FI=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function CI(e,t){if(!e)throw new Error("ASSERT: "+t)}function EI(e){return e>=48&&e<=57}function $I(e){return"0123456789abcdefABCDEF".includes(e)}function SI(e){return"01234567".includes(e)}function MI(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function BI(e){return 10===e||13===e||8232===e||8233===e}function zI(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&DI.test(String.fromCharCode(e))}function OI(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&FI.test(String.fromCharCode(e))}const NI={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function RI(){for(;mI1114111||"}"!==e)&&ZI({},bI,AI),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function jI(){var e,t;for(e=pI.charCodeAt(mI++),t=String.fromCharCode(e),92===e&&(117!==pI.charCodeAt(mI)&&ZI({},bI,AI),++mI,(e=TI("u"))&&"\\"!==e&&zI(e.charCodeAt(0))||ZI({},bI,AI),t=e);mI>>="===(i=pI.substr(mI,4))?{type:7,value:i,start:r,end:mI+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:mI+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===t?{type:7,value:t,start:r,end:mI+=2}:("//"===t&&ZI({},bI,AI),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:r,end:++mI}:void ZI({},bI,AI))}function UI(){var e,t,n;if(CI(EI((n=pI[mI]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=mI,e="","."!==n){if(e=pI[mI++],n=pI[mI],"0"===e){if("x"===n||"X"===n)return++mI,function(e){let t="";for(;mI=0&&ZI({},xI,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";ZI({},xI)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(i){ZI({},xI)}try{return new RegExp(e,t)}catch(r){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:mI}}function WI(){if(RI(),mI>=gI)return{type:2,start:mI,end:mI};const e=pI.charCodeAt(mI);return zI(e)?LI():40===e||41===e||59===e?qI():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(CI("'"===(e=pI[mI])||'"'===e,"String literal must starts with a quote"),t=mI,++mI;mI(CI(t":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function gW(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,u,l;if(e=yI,u=pW(),0===(r=mW(i=yI)))return u;for(i.prec=r,HI(),t=[e,yI],o=[u,i,a=pW()];(r=mW(yI))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),t.pop(),n=VI(s,u,a),o.push(n);(i=HI()).prec=r,o.push(i),t.push(yI),n=pW(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=VI(o[l-1].value,o[l-2],n),l-=2;return n}(),nW("?")&&(HI(),t=gW(),tW(":"),e=function(e,t,n){const i=new dI("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,gW())),e}function yW(){const e=gW();if(nW(","))throw new Error(kI);return e}function vW(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...vW(e.object)),t.push(...vW(e.property))),t)}function bW(e){return"MemberExpression"===e.object.type?bW(e.object):"datum"===e.object.name}function xW(e){const t=function(e){mI=0,gI=(pI=e).length,yI=null,GI();const t=yW();if(2!==yI.type)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&bW(e)&&n.add(vW(e).slice(1).join("."))})),n}class wW extends vq{clone(){return new wW(null,this.model,ZS(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=kW(this.model,this.filter,this),this._dependentFields=xW(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function _W(e,t,n,i="datum"){const r=ie(t)?t:t.param,o=wM(r),a=fe(o+YU);let s;try{s=e.getSelectionComponent(o,r)}catch(c){return`!!${o}`}if(s.project.timeUnit){const t=n??e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}const u=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${fe(s.resolve)})`}`,l=`length(data(${a}))`;return!1===t.empty?`${l} && ${u}`:`!${l} || ${u}`}function AW(e,t,n){const i=wM(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(s){return i}if(r||a){if(r&&!a){const e=o.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(a=o.project.items[0].field,gN(function(e,t,n,i){return(e.length?"Multiple ":"No ")+`matching ${fe(t)} encoding found for selection ${fe(n.param)}. Using "field": ${fe(i)}.`}(e,r,n,a))):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&gN(function(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${fe(e)}.`}(a));return`${o.name}[${fe($M(a))}]`}function kW(e,t,n){return _M(t,(t=>ie(t)?t:function(e){return WM(e,"param")}(t)?_W(e,t,n):YN(t)))}function DW(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function FW(e,t,n,i={header:!1}){var r,o;const{disable:a,orient:s,scale:l,labelExpr:c,title:d,zindex:h,...p}=e.combine();if(!a){for(const e in p){const n=e,i=BP[n],r=p[n];if(i&&i!==t&&"both"!==i)delete p[n];else if(SP(r)){const{condition:e,...t}=r,i=u(e),o=$P[n];if(o){const{vgProp:e,part:r}=o;DW(p,r,e,[...i.map((e=>{const{test:t,...n}=e;return{test:kW(null,t),...n}})),t]),delete p[n]}else if(null===o){const e={signal:i.map((e=>{const{test:t,...n}=e;return`${kW(null,t)} ? ${kO(n)} : `})).join("")+kO(t)};p[n]=e}}else if(pO(r)){const e=$P[n];if(e){const{vgProp:t,part:i}=e;DW(p,i,t,r),delete p[n]}}oM(["labelAlign","labelBaseline"],n)&&null===p[n]&&delete p[n]}if("grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode={...e?{grid:e}:{}},gM(p.encode)&&delete p.encode}return{scale:l,orient:s,...p,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:zM(h,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==c){let e=c;(null==(o=null==(r=p.encode)?void 0:r.labels)?void 0:o.update)&&pO(p.encode.labels.update.text)&&(e=SM(c,"datum.label",p.encode.labels.update.text.signal)),DW(p,"labels","text",{signal:e})}if(null===p.labelAlign&&delete p.labelAlign,p.encode){for(const t of MP)e.hasAxisPart(t)||delete p.encode[t];gM(p.encode)&&delete p.encode}const t=function(e,t){if(e)return f(e)&&!hO(e)?e.map((e=>gP(e,t))).join(", "):e}(d,n);return{scale:l,orient:s,grid:!1,...t?{title:t}:{},...p,...!1===n.aria?{aria:!1}:{},zindex:zM(h,0)}}}}function CW(e){const{axes:t}=e.component,n=[];for(const i of _z)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function EW(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...yM(r),...yM(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${DO(r[t])} : ${DO(o[t])}`};return s}return t[e]}))])}function $W(e,t){var n;const i=[{}];for(const r of e){let e=null==(n=t[r])?void 0:n.style;if(e){e=u(e);for(const n of e)i.push(t.style[n])}}return Object.assign.apply(null,i)}function SW(e,t,n,i={}){var r;const o=MO(e,n,t);if(void 0!==o)return{configFrom:"style",configValue:o};for(const a of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==(null==(r=i[a])?void 0:r[e]))return{configFrom:a,configValue:i[a][e]};return{}}const MW={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??function(e,t){return!wR(e)&&XT(t)&&!oO(null==t?void 0:t.bin)&&!aO(null==t?void 0:t.bin)}(n,e),gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||OW(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||zW(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&oM(["quantitative","temporal"],e))return!0;return}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!ne(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy";return}(t.type,n,XT(t)&&!!t.timeUnit,XT(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!wR(t)&&"log"!==t){if(XT(e)){if(oO(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&oM(["month","hours","day","quarter"],null==(r=NN(e.timeUnit))?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(XT(t)){const{timeUnit:e}=t;if(e){const t=RN(e);if(t)return{signal:t}}}return},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=NW(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return zO(r?[LT(r)]:[],XT(a)?[LT(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;if(f(n))return CP(t,n);if(pO(n))return n;return}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){if("rect"===e&&cP(t))return 1;return 0}(n,t)};function BW(e){return`(((${e.signal} % 360) + 360) % 360)`}function zW(e,t,n,i){if(void 0!==e){if("x"===n){if(pO(e)){const n=BW(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${pO(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(rP(t)&&RT(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${YN({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new RW(e,{calculate:a,as:TW(t,n,{forAs:!0})})}})),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${iM(this.transform)}`}}function TW(e,t,n){return lP(e,{prefix:t,suffix:"sort_index",...n})}function PW(e,t){return oM(["top","bottom"],t)?"column":oM(["left","right"],t)||"row"===e?"row":"column"}function jW(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return zM((t||{})[e],r[e],n.header[e])}function LW(e,t,n,i){const r={};for(const o of e){const e=jW(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const qW=["row","column"],UW=["header","footer"];function IW(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:s}=LW(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),u=PW(t,s),l=jM(a);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...HW(l,u),...WW(u,l,o),...QW(i,r,t,xj,vj)}}}function WW(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=OW(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function HW(e,t){const n=zW(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function GW(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of UW)if(n[r])for(const o of n[r]){const a=XW(e,t,r,n,o);null!=a&&i.push(a)}return i}function VW(e,t){const{sort:n}=e;return NT(n)?{field:lP(n,{expr:"datum"}),order:n.order??"ascending"}:f(n)?{field:TW(e,t,{expr:"datum"}),order:"ascending"}:{field:lP(e,{expr:"datum"}),order:n??"ascending"}}function YW(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:u}=LW(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=AT({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=PW(t,s);return{text:{signal:u?SM(SM(u,"datum.label",l),"datum.value",lP(e,{expr:"parent"})):l},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...HW(o,c),...WW(c,o,a),...QW(n,e,t,wj,bj)}}function XW(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=LW(["labelOrient"],a.header,s,t);("row"===t&&!oM(["top","bottom"],e)||"column"===t&&!oM(["left","right"],e))&&(o=YW(a,t,s))}const u=QG(e)&&!TT(e.facet),l=r.axes,c=(null==l?void 0:l.length)>0;if(o||c){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:VW(a,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const JW={column:{start:0,end:1},row:{start:1,end:0}};function KW(e,t){return JW[t][e]}function QW(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=jW(a,null==t?void 0:t.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function ZW(e){return[...eH(e,"width"),...eH(e,"height"),...eH(e,"childWidth"),...eH(e,"childHeight")]}function eH(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(wR(i)&&mO(o)){const i=e.scaleName(n);if(QG(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[tH(i,o)]}return[tH(i,o),{name:r,update:nH(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${Tj(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function tH(e,t){const n=`${e}_step`;return pO(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function nH(e,t,n){const i=t.get("type"),r=t.get("padding"),o=zM(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${DO(a)}, ${DO(o)}) * ${e}_step`}function iH(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function rH(e,t){return yM(e).reduce(((n,i)=>({...n,...tU({model:t,channelDef:e[i],vgChannel:i,mainRefFn:e=>AO(e.value),invalidValueRef:void 0})})),{})}function oH(e,t){if(QG(t))return"theta"===e?"independent":"shared";if(eV(t))return"shared";if(ZG(t))return Az(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function aH(e,t){const n=e.scale[t],i=Az(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&gN(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const sH=yM({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class uH extends tq{}const lH={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:s,config:u,mark:l}=n,c=a.filled&&"trail"!==l;let d={...FO({},n,tT),...fU(n,{filled:c})};const h=r.get("symbolOpacity")??u.legend.symbolOpacity,p=r.get("symbolFillColor")??u.legend.symbolFillColor,m=r.get("symbolStrokeColor")??u.legend.symbolStrokeColor,g=void 0===h?cH(s.opacity)??a.opacity:void 0;if(d.fill)if("fill"===i||c&&i===lB)delete d.fill;else if(WM(d.fill,"field"))p?delete d.fill:(d.fill=AO(u.legend.symbolBaseFillColor??"black"),d.fillOpacity=AO(g??1));else if(f(d.fill)){const e=fH(s.fill??s.color)??a.fill??(c&&a.color);e&&(d.fill=AO(e))}if(d.stroke)if("stroke"===i||!c&&i===lB)delete d.stroke;else if(WM(d.stroke,"field")||m)delete d.stroke;else if(f(d.stroke)){const e=zM(fH(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(d.stroke={value:e})}if(i!==mB){const e=XT(t)&&hH(n,r,t);e?d.opacity=[{test:e,...AO(g??1)},AO(u.legend.unselectedOpacity)]:g&&(d.opacity=AO(g))}return d={...d,...e},gM(d)?void 0:d},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const u=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?cH(a.opacity)||o.opacity:void 0;u&&(s.opacity=AO(u));return s={...s,...e},gM(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=XT(t)?hH(n,r,t):void 0,u=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=o;let f;wT(c)?f=DT({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:a}):void 0===l&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=DT({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&XT(t)&&void 0===t.timeUnit&&(f=DT({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return gM(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return(null==n?void 0:n.length)?{...e,fill:{value:"transparent"}}:e}};function cH(e){return dH(e,((e,t)=>Math.max(e,t.value)))}function fH(e){return dH(e,((e,t)=>zM(e,t.value)))}function dH(e,t){return function(e){const t=null==e?void 0:e.condition;return!!t&&(f(t)||iP(t))}(e)?u(e.condition).reduce(t,e.value):iP(e)?e.value:void 0}function hH(e,t,n){const i=t.get("selections");if(!(null==i?void 0:i.length))return;const r=fe(n.field);return i.map((e=>`(!length(data(${fe(wM(e)+YU)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const pH={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return FT(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return CT(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:u}=e;if(AR(r))return"horizontal"===n?"top"===i||"bottom"===i?gH(t,"width",a,o):a:gH(t,"height",u,s);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(oM(["quantile","threshold","log","symlog"],e))return"greedy";return}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=fH(n)??i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>pP(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(NB(n)&&AR(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;if(f(n))return CP(t,n);if(pO(n))return n;return}(t,e)};function mH(e){const{legend:t}=e;return zM(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(NB(e)){if(oM(["quarter","month","day"],t))return"symbol";if(AR(n))return"gradient"}return"symbol"}(e))}function gH(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function yH(e){const t=KG(e)?function(e){const{encoding:t}=e,n={};for(const i of[lB,...Aj]){const r=bP(t[i]);r&&e.getScaleComponent(i)&&(i===dB&&XT(r)&&r.type===nR||(n[i]=bH(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){yH(i);for(const r of yM(i.component.legends))n.legend[r]=aH(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=xH(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of yM(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function vH(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!(null==n?void 0:n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function bH(e,t){var n;let i=e.legend(t);const{markDef:r,encoding:o,config:a}=e,s=a.legend,u=new uH({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){var i;const r=null==(i=e.fieldDef(t))?void 0:i.field;for(const o of vM(e.component.selection??{})){const e=o.project.hasField[r]??o.project.hasChannel[t];if(e&&jU.defined(o)){const t=n.get("selections")??[];t.push(o.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,u);const l=void 0!==i?!i:s.disable;if(u.set("disable",l,void 0!==i),l)return u;i=i||{};const c=e.getScaleComponent(t).get("type"),f=bP(o[t]),d=XT(f)?null==(n=NN(f.timeUnit))?void 0:n.unit:void 0,h=i.orient||a.legend.orient||"right",p=mH({legend:i,channel:t,timeUnit:d,scaleType:c}),m=function({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}({legend:i,legendType:p,orient:h,legendConfig:s}),g={legend:i,channel:t,model:e,markDef:r,encoding:o,fieldOrDatumDef:f,legendConfig:s,config:a,scaleType:c,orient:h,legendType:p,direction:m};for(const w of sH){if("gradient"===p&&w.startsWith("symbol")||"symbol"===p&&w.startsWith("gradient"))continue;const n=w in pH?pH[w](g):i[w];if(void 0!==n){const r=vH(n,w,i,e.fieldDef(t));(r||void 0===a.legend[w])&&u.set(w,n,r)}}const y=(null==i?void 0:i.encoding)??{},v=u.get("selections"),b={},x={fieldOrDatumDef:f,model:e,channel:t,legendCmpt:u,legendType:p};for(const w of["labels","legend","title","symbols","gradient","entries"]){const t=rH(y[w]??{},e),n=w in lH?lH[w](t,x):t;void 0===n||gM(n)||(b[w]={...(null==v?void 0:v.length)&&XT(f)?{name:`${wM(f.field)}_legend_${w}`}:{},...(null==v?void 0:v.length)?{interactive:!!v}:{},update:n})}return gM(b)||u.set("encode",b,!!(null==i?void 0:i.encoding)),u}function xH(e,t){var n,i,r,o;if(!e)return t.clone();const a=e.getWithExplicit("orient"),s=t.getWithExplicit("orient");if(a.explicit&&s.explicit&&a.value!==s.value)return;let u=!1;for(const l of sH){const n=aq(e.getWithExplicit(l),t.getWithExplicit(l),l,"legend",((e,t)=>{switch(l){case"symbolType":return wH(e,t);case"title":return NO(e,t);case"type":return u=!0,iq("symbol")}return oq(e,t,l,"legend")}));e.setWithExplicit(l,n)}return u&&((null==(i=null==(n=e.implicit)?void 0:n.encode)?void 0:i.gradient)&&AM(e.implicit,["encode","gradient"]),(null==(o=null==(r=e.explicit)?void 0:r.encode)?void 0:o.gradient)&&AM(e.explicit,["encode","gradient"])),e}function wH(e,t){return"circle"===t.value?t:e}function _H(e){const t=e.component.legends,n={};for(const i of yM(t)){const r=IM(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r]){xH(e,t[i])||n[r].push(t[i])}else n[r]=[t[i].clone()]}return vM(n).flat().map((t=>function(e,t){var n,i,r;const{disable:o,labelExpr:a,selections:s,...u}=e.combine();if(o)return;!1===t.aria&&null==u.aria&&(u.aria=!1);if(null==(n=u.encode)?void 0:n.symbols){const e=u.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||u.stroke||(e.stroke={value:"transparent"});for(const t of Aj)u[t]&&delete e[t]}u.title||delete u.title;if(void 0!==a){let e=a;(null==(r=null==(i=u.encode)?void 0:i.labels)?void 0:r.update)&&pO(u.encode.labels.update.text)&&(e=SM(a,"datum.label",u.encode.labels.update.text.signal)),function(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}(u,"labels","text",{signal:e})}return u}(t,e.config))).filter((e=>void 0!==e))}function AH(e){return eV(e)||ZG(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),kH(e))}(e):kH(e)}function kH(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=pO(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return oM(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const DH=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class FH extends tq{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function CH(e){e.component.projection=KG(e)?function(e){if(e.hasProjection){const t=fO(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[oB,rB],[sB,aB]])(bP(n[i[0]])||bP(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(dB)&&e.typedFieldDef(dB).type===nR&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(mq.Main));return t}(e):void 0,o=new FH(e.projectionName(!0),{...fO(e.config.projection),...t},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}return}(e):function(e){if(0===e.children.length)return;let t;for(const i of e.children)CH(i);const n=sM(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=sM(DH,(n=>!c(e.explicit,n)&&!c(t.explicit,n)||!!(c(e.explicit,n)&&c(t.explicit,n)&&UM(e.get(n),t.get(n)))));if(UM(e.size,t.size)){if(n)return e;if(UM(e.explicit,{}))return t;if(UM(t.explicit,{}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0}));if(t&&n){const n=e.projectionName(!0),i=new FH(n,t.specifiedProjection,t.size,ZS(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}return}(e)}function EH(e,t,n,i){if(EP(t,n)){const r=KG(e)?e.axis(n)??e.legend(n)??{}:{},o=lP(t,{expr:"datum"}),a=lP(t,{expr:"datum",binSuffix:"end"});return{formulaAs:lP(t,{binSuffix:"range",forAs:!0}),formula:MT(o,a,r.format,r.formatType,i)}}return{}}function $H(e,t){return`${rO(e)}_${t}`}function SH(e,t,n){const i=$H(AP(n,void 0)??{},t);return e.getName(`${i}_bins`)}function MH(e,t,n){let i,r;i=function(e){return"as"in e}(e)?ie(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[lP(e,{forAs:!0}),lP(e,{binSuffix:"end",forAs:!0})];const o={...AP(t,void 0)},a=$H(o,e.field),{signal:s,extentSignal:u}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(uO(o.extent)){const e=o.extent;r=AW(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...u?{extentSignal:u}:{},...r?{span:r}:{}}}}class BH extends vq{clone(){return new BH(null,ZS(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(nP(n)&&oO(n.bin)){const{key:r,binComponent:o}=MH(n,n.bin,t);e[r]={...o,...e[r],...EH(t,n,i,t.config)}}return e}),{});return gM(n)?null:new BH(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=MH(t,t.bin,n);return new BH(e,{[i]:r})}merge(e,t){for(const n of yM(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=cM([...this.bins[n].as,...e.bins[n].as],iM)):this.bins[n]=e.bins[n];for(const n of e.children)e.removeChild(n),n.parent=this;e.remove()}producedFields(){return new Set(vM(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(vM(this.bins).map((e=>e.field)))}hash(){return`Bin ${iM(this.bins)}`}assemble(){return vM(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:$M(e.field),as:n,signal:e.signal,...uO(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:$M(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const s of i)for(let e=0;e<2;e++)t.push({type:"formula",expr:lP({field:n[e]},{expr:"datum"}),as:s[e]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function zH(e,t,n,i){var r;const o=KG(i)?i.encoding[ZB(t)]:void 0;if(nP(n)&&KG(i)&&WT(n,o,i.markDef,i.config)){e.add(lP(n,{})),e.add(lP(n,{suffix:"end"}));const{mark:r,markDef:o,config:a}=i,s=UT({fieldDef:n,markDef:o,config:a});QR(r)&&.5!==s&&Az(t)&&(e.add(lP(n,{suffix:Aq})),e.add(lP(n,{suffix:kq}))),n.bin&&EP(n,t)&&e.add(lP(n,{binSuffix:"range"}))}else if(BB(t)){const n=MB(t);e.add(i.getName(n))}else e.add(lP(n));var a;return rP(n)&&(a=null==(r=n.scale)?void 0:r.range,ne(a)&&"field"in a)&&e.add(n.scale.range.field),e}class OH extends vq{clone(){return new OH(null,new Set(this.dimensions),ZS(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef((e=>{e.aggregate&&(n=!0)}));const i={},r=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??(i["*"]={}),i["*"].count=new Set([lP(e,{forAs:!0})]);else{if(Kz(o)||Qz(o)){const e=Kz(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([lP({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([lP(e,{forAs:!0})]);Iz(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([lP({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([lP({field:a,aggregate:"max"},{forAs:!0})]))}else zH(r,n,e,t)})),r.size+yM(i).length===0?null:new OH(e,r,i)):null}static makeFromTransform(e,t){var n;const i=new Set,r={};for(const o of t.aggregate){const{op:e,field:t,as:i}=o;e&&("count"===e?(r["*"]??(r["*"]={}),r["*"].count=new Set([i||lP(o,{forAs:!0})])):(r[t]??(r[t]={}),(n=r[t])[e]??(n[e]=new Set),r[t][e].add(i||lP(o,{forAs:!0}))))}for(const o of t.groupby??[])i.add(o);return i.size+yM(r).length===0?null:new OH(e,i,r)}merge(e){return dM(this.dimensions,e.dimensions)?(function(e,t){for(const n of yM(t)){const i=t[n];for(const t of yM(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){pN.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...yM(this.measures)])}producedFields(){const e=new Set;for(const t of yM(this.measures))for(const n of yM(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${iM({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of yM(this.measures))for(const r of yM(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:$M(i));return{type:"aggregate",groupby:[...this.dimensions].map($M),ops:e,fields:t,as:n}}}class NH extends vq{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const r of TB){const e=t.facet[r];if(e){const{bin:n,sort:i}=e;this[r]={name:t.getName(`${r}_domain`),fields:[lP(e),...oO(n)?[lP(e,{binSuffix:"end"})]:[]],...NT(i)?{sortField:i}:f(i)?{sortIndexField:TW(e,r)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of TB)this[t]&&(e+=` ${t.charAt(0)}:${iM(this[t])}`);return e}get fields(){var e;const t=[];for(const n of TB)(null==(e=this[n])?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of TB)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of _z){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(wR(i)&&mO(r)){const n=EG($G(this.childModel,t));n?e[t]=n:gN(qO(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:u}=this[e];if(s){const{op:e=BT,field:t}=s;r.push(t),o.push(e),a.push(lP(s,{forAs:!0}))}else u&&(r.push(u),o.push("max"),a.push(u));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){var t;const{columns:n}=this.model.layout,{layoutHeaders:i}=this.model.component,r=[],o={};for(const u of qW){for(const e of UW){const n=(i[u]&&i[u][e])??[];for(const e of n)if((null==(t=e.axes)?void 0:t.length)>0){o[u]=!0;break}}if(o[u]){const e=`length(data("${this.facet.name}"))`,t="row"===u?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e};r.push({name:`${this.facet.name}_${u}`,transform:[{type:"sequence",start:0,stop:t}]})}}const{row:a,column:s}=o;return(a||s)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,e)),r}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const a of[GM,HM])this[a]&&e.push(this.assembleRowColumnHeaderData(a,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function RH(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function TH(e){const t={};return KS(e.filter,(e=>{if(GN(e)){let n=null;jN(e)?n=wO(e.equal):qN(e)?n=wO(e.lte):LN(e)?n=wO(e.lt):UN(e)?n=wO(e.gt):IN(e)?n=wO(e.gte):WN(e)?n=e.range[0]:HN(e)&&(n=(e.oneOf??e.in)[0]),n&&(yN(n)?t[e.field]="date":te(n)?t[e.field]="number":ie(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}function PH(e){const t={};function n(e){var n;DP(e)?t[e.field]="date":"quantitative"===e.type&&(n=e.aggregate,ie(n)&&oM(["min","max"],n))?t[e.field]="number":BM(e.field)>1?e.field in t||(t[e.field]="flatten"):rP(e)&&NT(e.sort)&&BM(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((KG(e)||QG(e))&&e.forEachFieldDef(((t,i)=>{if(nP(t))n(t);else{const r=KB(i),o=e.fieldDef(r);n({...t,type:o.type})}})),KG(e)){const{mark:n,markDef:i,encoding:r}=e;if(KR(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];XT(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}class jH extends vq{clone(){return new jH(null,ZS(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${iM(this._parse)}`}static makeExplicit(e,t,n){var i;let r={};const o=t.data;return!fq(o)&&(null==(i=null==o?void 0:o.format)?void 0:i.parse)&&(r=o.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(e,t,n,i){for(const a of yM(n)){const e=i.getWithExplicit(a);void 0!==e.value&&(e.explicit||e.value===n[a]||"derived"===e.value||"flatten"===n[a]?delete n[a]:gN(YO(a,n[a],e.value)))}for(const a of yM(t)){const e=i.get(a);void 0!==e&&(e===t[a]?delete t[a]:gN(YO(a,t[a],e)))}const r=new tq(t,n);i.copyAll(r);const o={};for(const a of yM(r.combine())){const e=r.get(a);null!==e&&(o[a]=e)}return 0===yM(o).length||i.parseNothing?null:new jH(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of yM(this._parse)){const n=this._parse[t];1===BM(t)&&(e[t]=n)}return e}producedFields(){return new Set(yM(this._parse))}dependentFields(){return new Set(yM(this._parse))}assembleTransforms(e=!1){return yM(this._parse).filter((t=>!e||BM(t)>1)).map((e=>{const t=function(e,t){const n=DM(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(t.startsWith("date:"))return`timeParse(${n},'${RH(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${RH(t.slice(4,t.length))}')`;return gN(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:MM(e)}})).filter((e=>null!==e))}}class LH extends vq{clone(){return new LH(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([kj])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:kj}}}class qH extends vq{clone(){return new qH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${iM(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class UH extends vq{clone(){return new UH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${iM(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class IH extends vq{constructor(e){let t;if(super(null),e??(e={name:"source"}),fq(e)||(t=e.format?{...nM(e.format,["parse"])}:{}),lq(e))this._data={values:e.values};else if(uq(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];oM(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else hq(e)?this._data={values:[{type:"Sphere"}]}:(cq(e)||fq(e))&&(this._data={});this._generator=fq(e),e.name&&(this._name=e.name),t&&!gM(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var WH,HH=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};function GH(e){return e instanceof IH||e instanceof qH||e instanceof UH}class VH{constructor(){WH.set(this,void 0),HH(this,WH,!1,"f")}setModified(){HH(this,WH,!0,"f")}get modifiedFlag(){return function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}(this,WH,"f")}}WH=new WeakMap;class YH extends VH{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const n of t)this.run(n[0]);return this.modifiedFlag}}class XH extends VH{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class JH extends XH{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map((e=>e.hash())),n={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(e,n[i]))}}class KH extends XH{constructor(e){super(),this.requiresSelectionId=e&&eI(e)}run(e){e instanceof LH&&(this.requiresSelectionId&&(GH(e.parent)||e.parent instanceof OH||e.parent instanceof jH)||(this.setModified(),e.remove()))}}class QH extends VH{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof _q&&(n=e.producedFields(),hM(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class ZH extends XH{constructor(){super()}run(e){e instanceof bq&&!e.isRequired()&&(this.setModified(),e.remove())}}class eG extends YH{run(e){if(!(GH(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof jH)if(e instanceof jH)this.setModified(),e.merge(t);else{if(mM(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class tG extends YH{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof jH));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of yM(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!gM(i)){this.setModified();const n=new jH(e,i);for(const r of t){if(r instanceof jH)for(const e of yM(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof jH&&0===yM(r.parse).length&&r.remove()}}}}}class nG extends YH{run(e){e instanceof bq||e.numChildren()>0||e instanceof NH||e instanceof IH||(this.setModified(),e.remove())}}class iG extends YH{run(e){const t=e.children.filter((e=>e instanceof _q)),n=t.pop();for(const i of t)this.setModified(),n.merge(i)}}class rG extends YH{run(e){const t=e.children.filter((e=>e instanceof OH)),n={};for(const i of t){const e=iM(i.groupBy);e in n||(n[e]=[]),n[e].push(i)}for(const i of yM(n)){const t=n[i];if(t.length>1){const n=t.pop();for(const i of t)n.merge(i)&&(e.removeChild(i),i.parent=n,i.remove(),this.setModified())}}}}class oG extends YH{constructor(e){super(),this.model=e}run(e){const t=!(GH(e)||e instanceof wW||e instanceof jH||e instanceof LH),n=[],i=[];for(const r of e.children)r instanceof BH&&(t&&!mM(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof BH?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class aG extends YH{run(e){const t=[...e.children];if(!aM(t,(e=>e instanceof bq))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof bq){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof bq))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class sG extends vq{clone(){return new sG(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=cM(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??lP(e)}hash(){return`JoinAggregateTransform ${iM(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(void 0===r.field?null:r.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class uG extends vq{clone(){return new uG(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t,n){const{config:i,markDef:r}=t,{marks:o,scales:a}=n;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const s=t.reduceFieldDef(((e,n,o)=>{const a=Iz(o)&&t.getScaleComponent(o);if(a){const t=a.get("type"),{aggregate:s}=n,u=dT({scaleChannel:o,markDef:r,config:i,scaleType:t,isCountAggregate:tO(s)});"show"!==u&&"always-valid"!==u&&(e[n.field]=n)}return e}),{});return yM(s).length?new uG(e,s):null}dependentFields(){return new Set(yM(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${iM(this.filter)}`}assemble(){const e=yM(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=lP(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (${lG(i)}))`):"quantitative"===n.type&&e.push(lG(i))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}function lG(e){return`isValid(${e}) && isFinite(+${e})`}class cG extends vq{clone(){return new cG(null,ZS(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,a=[],s=[];if(void 0!==t.sort)for(const c of t.sort)a.push(c.field),s.push(zM(c.order,"ascending"));const u={field:a,order:s};let l;return l=function(e){return f(e)&&e.every((e=>ie(e)))&&e.length>1}(r)?r:ie(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new cG(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:u,facetby:[],as:l})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannels:r,fieldChannel:o,offset:a,impute:s}=n,u=r.map((e=>vP(i[e]))).filter((e=>!!e)),l=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=lP(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let d;if(f(c)||XT(c))d=BO(c);else{const e=HT(c)?c.sort:"y"===o?"descending":"ascending";d=l.reduce(((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t)),{field:[],order:[]})}return new cG(e,{dimensionFieldDefs:u,stackField:t.vgField(o),facetby:[],stackby:l,sort:d,offset:a,impute:s,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${iM(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[lP(e,{binSuffix:"mid"})]:[lP(e,{}),lP(e,{binSuffix:"end"})]:[lP(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:u}=this._stack;if(s)for(const l of n){const{bandPosition:n=.5,bin:o}=l;if(o){const t=lP(l,{expr:"datum"}),i=lP(l,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${lG(t)} ? ${n}*${t}+${1-n}*${i} : ${t}`,as:lP(l,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:lP(l,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:u,offset:a}),e}}class fG extends vq{clone(){return new fG(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=cM(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??lP(e)}hash(){return`WindowTransform ${iM(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const c of this.transform.window)t.push(c.op),n.push(this.getDefaultName(c)),i.push(void 0===c.param?null:c.param),e.push(void 0===c.field?null:c.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>Zz(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const c of this.transform.sort)a.push(c.field),s.push(c.order??"ascending");const u={field:a,order:s},l=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:u,...void 0!==l?{ignorePeers:l}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function dG(e){if(e instanceof NH)if(1!==e.numChildren()||e.children[0]instanceof bq){const n=e.model.component.data.main;hG(n);const i=(t=e,function e(n){if(!(n instanceof NH)){const i=n.clone();if(i instanceof bq){const e=pG+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof OH||i instanceof cG||i instanceof fG||i instanceof sG)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof OH||t instanceof cG||t instanceof fG||t instanceof sG)&&t.addDimensions(e.fields),t.swapWithParent(),dG(e)}else e.children.map(dG);var t}function hG(e){if(e instanceof bq&&e.type===mq.Main&&1===e.numChildren()){const t=e.children[0];t instanceof NH||(t.swapWithParent(),hG(e))}}const pG="scale_";function mG(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!mG(t.children))return!1}return!0}function gG(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function yG(e,t,n){let i=e.sources,r=!1;return r=gG(new ZH,i)||r,r=gG(new KH(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=gG(new nG,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=gG(new eG,i)||r,r=gG(new oG(t),i)||r,r=gG(new QH,i)||r,r=gG(new tG,i)||r,r=gG(new rG,i)||r,r=gG(new iG,i)||r,r=gG(new JH,i)||r,r=gG(new aG,i)||r),e.sources=i,r}class vG{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new vG((()=>e(t)))}}function bG(e){KG(e)?function(e){const t=e.component.scales;for(const n of yM(t)){const i=xG(e,n);if(t[n].setWithExplicit("domains",i),kG(e,n),e.component.data.isFaceted){let t=e;for(;!QG(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)gO(e)&&(e.data=pG+e.data.replace(pG,""))}}}(e):function(e){for(const n of e.children)bG(n);const t=e.component.scales;for(const n of yM(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):aq(i,e.getWithExplicit("domains"),"domains","scale",FG);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&gN(HO),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function xG(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=DG(t,n);if(!e)return void gN(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=DG(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&bP(i.x2)?bP(i.x)?aq(_G(n,r,e,"x"),_G(n,r,e,"x2"),"domain","scale",FG):_G(n,r,e,"x2"):"y"===t&&bP(i.y2)?bP(i.y)?aq(_G(n,r,e,"y"),_G(n,r,e,"y2"),"domain","scale",FG):_G(n,r,e,"y2"):_G(n,r,e,t)}function wG(e,t,n){var i;const r=null==(i=NN(n))?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map((e=>({signal:`{data: ${FP(e,{timeUnit:n,type:t})}}`})))}(e,t,r):[e]}function _G(e,t,n,i){const{encoding:r,markDef:o,mark:a,config:s,stack:u}=n,l=bP(r[i]),{type:c}=l,f=l.timeUnit,d=function(e){const{marks:t,scales:n}=yq(e);return t===n?mq.Main:"include-invalid-values"===n?mq.PreFilterInvalid:mq.PostFilterInvalid}({invalid:$O("invalid",o,s),isPath:KR(a)});if(function(e){return WM(e,"unionWith")}(t)){const r=_G(e,void 0,n,i);return nq([...wG(t.unionWith,c,f),...r.value])}if(pO(t))return nq([t]);if(t&&"unaggregated"!==t&&!DR(t))return nq(wG(t,c,f));if(u&&i===u.fieldChannel){if("normalize"===u.offset)return iq([[0,1]]);const e=n.requestDataName(d);return iq([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const h=Iz(i)&&XT(l)?function(e,t,n){if(!wR(n))return;const i=e.fieldDef(t),r=i.sort;if(RT(r))return{op:"min",field:TW(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(NT(r)){return AG(r,o&&!a.has(r.field))}if(function(e){return WM(e,"encoding")}(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:u}=i,l=o&&!a.has(u);if(Kz(s)||Qz(s))return AG({field:lP(i),order:n},l);if(Zz(s)||!s)return AG({op:s,field:u,order:n},l)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(oM(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if(KT(l)){return iq(wG([l.datum],c,f))}const p=l;if("unaggregated"===t){const{field:e}=l;return iq([{data:n.requestDataName(d),field:lP({field:e,aggregate:"min"})},{data:n.requestDataName(d),field:lP({field:e,aggregate:"max"})}])}if(oO(p.bin)){if(wR(e))return iq("bin-ordinal"===e?[]:[{data:xM(h)?n.requestDataName(d):n.requestDataName(mq.Raw),field:n.vgField(i,EP(p,i)?{binSuffix:"range"}:{}),sort:!0!==h&&ne(h)?h:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=p;if(oO(e)){const t=SH(n,p.field,e);return iq([new vG((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return iq([{data:n.requestDataName(d),field:n.vgField(i,{})}])}}if(p.timeUnit&&oM(["time","utc"],e)){const e=r[ZB(i)];if(WT(p,e,o,s)){const t=n.requestDataName(d),r=UT({fieldDef:p,fieldDef2:e,markDef:o,config:s}),u=QR(a)&&.5!==r&&Az(i);return iq([{data:t,field:n.vgField(i,u?{suffix:Aq}:{})},{data:t,field:n.vgField(i,{suffix:u?kq:"end"})}])}}return iq(h?[{data:xM(h)?n.requestDataName(d):n.requestDataName(mq.Raw),field:n.vgField(i),sort:h}]:[{data:n.requestDataName(d),field:n.vgField(i)}])}function AG(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":BT),...i?{field:$M(i)}:{},...r?{order:r}:{}}}function kG(e,t){var n;const i=e.component.scales[t],r=e.specifiedScales[t].domain,o=null==(n=e.fieldDef(t))?void 0:n.bin,a=DR(r)?r:void 0,s=sO(o)&&uO(o.extent)?o.extent:void 0;(a||s)&&i.set("selectionExtent",a??s,!0)}function DG(e,t){const{aggregate:n,type:i}=e;return n?ie(n)&&!iO.has(n)?{valid:!1,reason:oN(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:aN(e)}:{valid:!0}:{valid:!1,reason:rN(e)}}function FG(e,t,n,i){return e.explicit&&t.explicit&&gN(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${IM(n)} and ${IM(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function CG(e){const t=cM(e.map((e=>{if(gO(e)){const{sort:t,...n}=e;return n}return e})),iM),n=cM(e.map((e=>{if(gO(e)){const t=e.sort;return void 0===t||xM(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),iM);if(0===t.length)return;if(1===t.length){const t=e[0];if(gO(t)&&n.length>0){let e=n[0];if(n.length>1){gN(lN);const t=n.filter((e=>ne(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>ne(e)&&"op"in e))||1!==t.length||t[0]}else if(ne(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}const i=cM(n.map((e=>xM(e)||!("op"in e)||ie(e.op)&&c(Jz,e.op)?e:(gN(function(e){return`Dropping sort property ${IM(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),iM);let r;1===i.length?r=i[0]:i.length>1&&(gN(lN),r=!0);const o=cM(e.map((e=>gO(e)?e.data:null)),(e=>e));if(1===o.length&&null!==o[0]){return{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}}return{fields:t,...r?{sort:r}:{}}}function EG(e){if(gO(e)&&ie(e.field))return e.field;if(function(e){return!f(e)&&WM(e,"fields")&&!WM(e,"data")}(e)){let t;for(const n of e.fields)if(gO(n)&&ie(n.field))if(t){if(t!==n.field)return gN("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return gN("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!f(e)&&WM(e,"fields")&&WM(e,"data")}(e)){gN("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return ie(t)?t:void 0}}function $G(e,t){return CG(e.component.scales[t].get("domains").map((t=>(gO(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function SG(e){return eV(e)||ZG(e)?e.children.reduce(((e,t)=>e.concat(SG(t))),MG(e)):MG(e)}function MG(e){return yM(e.component.scales).reduce(((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:a,selectionExtent:s,domains:u,range:l,reverse:c,...d}=r,h=function(e,t,n,i){if(Az(n)){if(mO(e))return{step:{signal:`${t}_step`}}}else if(ne(e)&&gO(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),p=$G(e,n),m=s?function(e,t,n,i){const r=AW(e,t.param,t);return{signal:_R(n.get("type"))&&f(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,s,i,p):null;return t.push({name:o,type:a,...p?{domain:p}:{},...m?{domainRaw:m}:{},range:h,...void 0!==c?{reverse:c}:{},...d}),t}),[])}class BG extends tq{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainHasZero(){const e=this.get("type");if(oM([rR,sR,uR],e))return"definitely-not";const t=this.get("zero");if(!0===t||void 0===t&&oM([iR,aR,oR],e))return"definitely";const n=this.get("domains");if(n.length>0){let e=!1,t=!1,i=!1;for(const r of n){if(f(r)){const n=r[0],i=r[r.length-1];if(te(n)&&te(i)){if(n<=0&&i>=0){e=!0;continue}t=!0;continue}}i=!0}if(e)return"definitely";if(t&&!i)return"definitely-not"}return"maybe"}}const zG=["range","scheme"];function OG(e,t){const n=e.fieldDef(t);if(null==n?void 0:n.bin){const{bin:i,field:r}=n,o=ez(t),a=e.getName(o);if(ne(i)&&i.binned&&void 0!==i.step)return new vG((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(oO(i)){const t=SH(e,r,i);return new vG((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function NG(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const c of zG)if(void 0!==n[c]){const i=OR(r,c),o=NR(e,c);if(i)if(o)gN(o);else switch(c){case"range":{const i=n.range;if(f(i)){if(Az(e))return nq(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return vG.fromName(i,n)}return e})))}else if(ne(i))return nq({data:t.requestDataName(mq.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return nq(i)}case"scheme":return nq(RG(n[c]))}else gN(sN(r,c,e))}const o=e===YM||"xOffset"===e?"width":"height",a=i[o];if(Oj(a))if(Az(e))if(wR(r)){const n=PG(a,t,e);if(n)return nq({step:n})}else gN(uN(o));else if(Ez(e)){const n=e===QM?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=jG(a,r);if(e)return nq(e)}}const{rangeMin:s,rangeMax:u}=n,l=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,{type:a}=bP(o[e]),s=t.getScaleComponent(e),u=s.get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case YM:case XM:if(oM(["point","band"],u)){const r=LG(e,n,i.view);if(Oj(r)){return{step:PG(r,t,e)}}}return TG(e,t,u);case QM:case ZM:return function(e,t,n){const i=e===QM?"x":"y",r=t.getScaleComponent(i);if(!r)return TG(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:u}=t;if("band"===o){const e=LG(i,t.size,t.config.view);if(Oj(e)){const t=jG(e,n);if(t)return t}return[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(XT(n)&&n.timeUnit){const e=RN(n.timeUnit,(e=>`scale('${a}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=UT({fieldDef:n,markDef:s,config:u})-.5,o=0!==r?` + ${r}`:"";if(i){return[{signal:`${pO(i)?`${i.signal}/2`+o:`${i/2+r}`} * (${e})`},{signal:`${pO(i)?`(1 - ${i.signal}/2)`+o:`${1-i/2+r}`} * (${e})`}]}return[0,{signal:e}]}return eM(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,u);case hB:{const o=function(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(eN("size",e))}(r,i),a=function(e,t,n,i){const r={x:OG(n,"x"),y:OG(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=UG(t,r,i.view);return te(e)?e-1:new vG((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=UG(t,r,i.view);return te(e)?Math.pow(qG*e,2):new vG((()=>`pow(${qG} * ${e.signal}, 2)`))}}throw new Error(eN("size",e))}(r,n,t,i);return kR(u)?function(e,t,n){const i=()=>{const i=DO(t),r=DO(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return pO(t)?new vG(i):{signal:i()}}(o,a,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&f(n)?n.length+1:(gN(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(u,i,l,e)):[o,a]}case nB:return[0,2*Math.PI];case pB:return[0,360];case eB:return[0,new vG((()=>`min(${t.getSignalName(QG(t.parent)?"child_width":"width")},${t.getSignalName(QG(t.parent)?"child_height":"height")})/2`))];case uB:return{step:1e3/i.scale.framesPerSecond};case vB:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case bB:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case dB:return"symbol";case lB:case cB:case fB:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==c?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case mB:case gB:case yB:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==u)&&OR(r,"rangeMin")&&f(l)&&2===l.length?nq([s??l[0],u??l[1]]):iq(l)}function RG(e){return function(e){return!ie(e)&&WM(e,"name")}(e)?{scheme:e.name,...nM(e,["name"])}:{scheme:e}}function TG(e,t,n,{center:i}={}){const r=ez(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===XM&&_R(n)?i?[vG.fromName((e=>`${a(e)}/2`),o),vG.fromName((e=>`-${a(e)}/2`),o)]:[vG.fromName(a,o),0]:i?[vG.fromName((e=>`-${a(e)}/2`),o),vG.fromName((e=>`${a(e)}/2`),o)]:[0,vG.fromName(a,o)]}function PG(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=nz(n),a=i[o];if("offset"===zj({step:e,offsetIsDiscrete:tP(a)&&KN(a.type)})&&LP(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;if("band"===n.get("type")){i=`bandspace(${i}, ${n.get("paddingInner")??n.get("padding")??0}, ${n.get("paddingOuter")??n.get("padding")??0})`}const a=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${i} / (1-${s=a,pO(s)?s.signal:fe(s)})`}}return e.step;var s}function jG(e,t){if("offset"===zj({step:e,offsetIsDiscrete:wR(t)}))return{step:e.step}}function LG(e,t,n){const i=e===YM?"width":"height",r=t[i];return r||jj(n,i)}const qG=.95;function UG(e,t,n){const i=Oj(e.width)?e.width.step:Pj(n,"width"),r=Oj(e.height)?e.height.step:Pj(n,"height");return t.x||t.y?new vG((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function IG(e,t){KG(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of yM(n)){const u=a[s],l=n[s],c=e.getScaleComponent(s),f=bP(r[s]),d=u[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=OR(h,t),y=NR(s,t);if(void 0!==d&&(g?y&&gN(y):gN(sN(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":yN(u[t])||"temporal"===n||e?l.set(t,{signal:FP(u[t],{type:n,timeUnit:e})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const n=WM(WG,t)?WG[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:o,config:i,hasNestedOffsetScale:qP(r,s),hasSecondaryRangeChannel:!!r[ZB(s)]}):i.scale[t];void 0!==n&&l.set(t,n,!1)}}}(e,t):GG(e,t)}const WG={bins:({model:e,fieldOrDatumDef:t})=>XT(t)?function(e,t){const n=t.bin;if(oO(n)){const i=SH(e,t.field,n);return new vG((()=>e.getSignalName(i)))}if(aO(n)&&sO(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(oM([lB,cB,fB],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){var a;if((null==(a=vP(o))?void 0:a.bin)||f(n)||null!=r||null!=i||oM([sR,uR],e))return;return!!Az(t)||void 0}(e,t,n,i,r,o),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(Az(e)){if(AR(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!XT(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===lR)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(Az(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:s}=r;return o?s:zM(e,"bar"===n?t:"tick"===n?a:i)}if(Ez(t)&&i===cR)return r.offsetBandPaddingInner;return}(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(Az(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===cR)return zM(e,pO(i)?{signal:`${i.signal}/2`}:i/2)}else if(Ez(t)){if(n===lR)return.5;if(n===cR)return r.offsetBandPaddingOuter}return}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return _R(e)&&"descending"===t?pO(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(_R(e)&&"descending"===t)return!0;return}(t,XT(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:o,hasSecondaryRangeChannel:a})=>function(e,t,n,i,r,o,a){if(n&&"unaggregated"!==n&&_R(r)){if(f(n)){const e=n[0],t=n[n.length-1];if(te(e)&&e<=0&&te(t)&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!kR(r))return!0;if((!XT(t)||!t.bin)&&oM([..._z,...Dz],e)){const{orient:t,type:n}=i;return(!oM(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!oM(["bar","area"],n)||a)||(null==o?void 0:o.zero))}return!1}(e,t,n,i,r,o.scale,a)};function HG(e){KG(e)?function(e){const t=e.component.scales;for(const n of Uz){const i=t[n];if(!i)continue;const r=NG(n,e);i.setWithExplicit("range",r)}}(e):GG(e,"range")}function GG(e,t){const n=e.component.scales;for(const i of e.children)"range"===t?HG(i):IG(i,t);for(const i of yM(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=aq(r,e.getWithExplicit(t),t,"scale",rq(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0)))}}n[i].setWithExplicit(t,r)}}function VG(e,t,n,i,r=!1){const o=function(e,t,n,i){var r;switch(t.type){case"nominal":case"ordinal":if(NB(e)||"discrete"===Yz(e))return"shape"===e&&"ordinal"===t.type&&gN(iN(e,"ordinal")),"ordinal";if(Sz(e))return"band";if(Az(e)||Ez(e)){if(oM(["rect","bar","image","rule","tick"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in kz)return"band";return aT(n[ez(e)])||oP(t)&&(null==(r=t.axis)?void 0:r.tickBand)?"band":"point";case"temporal":return NB(e)?"time":"discrete"===Yz(e)?(gN(iN(e,"temporal")),"ordinal"):XT(t)&&t.timeUnit&&NN(t.timeUnit).utc?"utc":Sz(e)?"band":"time";case"quantitative":return NB(e)?XT(t)&&oO(t.bin)?"bin-ordinal":"linear":"discrete"===Yz(e)?(gN(iN(e,"quantitative")),"ordinal"):Sz(e)?"band":"linear";case"geojson":return}throw new Error(KO(t.type))}(t,n,i,r),{type:a}=e;return Iz(t)?void 0!==a?function(e,t,n=!1){if(!Iz(e))return!1;switch(e){case YM:case XM:case QM:case ZM:case nB:case eB:return!!AR(t)||"band"===t||"point"===t&&!n;case uB:return oM(["linear","band"],t);case hB:case vB:case mB:case gB:case yB:case pB:return AR(t)||kR(t)||oM(["band","point","ordinal"],t);case lB:case cB:case fB:return"band"!==t;case bB:case dB:return"ordinal"===t||kR(t)}}(t,a)?XT(n)&&(s=a,u=n.type,!(oM([ZN,tR],u)?void 0===s||wR(s):u===eR?oM([sR,uR,void 0],s):u!==QN||yR(s)||kR(s)||void 0===s))?(gN(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(gN(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,a,o)),o):o:null;var s,u}function YG(e){KG(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of Uz){const a=bP(t[o]);if(a&&n===JR&&o===dB&&a.type===nR)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??(s={});const n=VG(s,o,a,i,qP(t,o));r[o]=new BG(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const o of e.children){YG(o);for(const n of yM(o.component.scales))if((t=r.scale)[n]??(t[n]=oH(n,e)),"shared"===r.scale[n]){const e=i[n],t=o.component.scales[n].getWithExplicit("type");e?dR(e.value,t.value)?i[n]=aq(e,t,"type","scale",XG):(r.scale[n]="independent",delete i[n]):i[n]=t}}for(const o of yM(i)){const t=e.scaleName(o,!0),r=i[o];n[o]=new BG(t,r);for(const n of e.children){const e=n.component.scales[o];e&&(n.renameScale(e.get("name"),t),e.merged=!0)}}return n}(e)}const XG=rq(((e,t)=>pR(e)-pR(t)));class JG{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function KG(e){return"unit"===(null==e?void 0:e.type)}function QG(e){return"facet"===(null==e?void 0:e.type)}function ZG(e){return"concat"===(null==e?void 0:e.type)}function eV(e){return"layer"===(null==e?void 0:e.type)}class tV{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.parent=n,this.config=r,this.view=fO(a),this.name=e.name??i,this.title=hO(e.title)?{text:e.title}:e.title?fO(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new JG,this.projectionNameMap=n?n.projectionNameMap:new JG,this.signalNameMap=n?n.signalNameMap:new JG,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>AL(e)?{filter:QS(e.filter,JN)}:e)),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){const i=n[t],r={},{spacing:o,columns:a}=i;void 0!==o&&(r.spacing=o),void 0!==a&&(jT(e)&&!TT(e.facet)||Sj(e))&&(r.columns=a),Mj(e)&&(r.columns=1);for(const s of Rj)if(void 0!==e[s])if("spacing"===s){const t=e[s];r[s]=te(t)?t:{row:t.row??o,column:t.column??o}}else r[s]=e[s];return r}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:jT(e)||(null==n?void 0:n.component.data.isFaceted)&&void 0===e.data},layoutSize:new tq,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?ZS(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){YG(e),bG(e);for(const n of zR)IG(e,n);t||HG(e)}(this)}parseProjection(){CH(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){yH(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const r of yM(n)){const e=n[r];void 0!==e&&(i[r]=AO(e))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=AO(this.description)),"unit"!==this.type&&"layer"!==this.type)?gM(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of TB){const r=e[i];if(null==r?void 0:r.facetFieldDef){const{titleAnchor:e,titleOrient:o}=LW(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=PW(i,o),s=KW(e,a);void 0!==s&&(n[a]=s)}}return gM(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of TB)e[n].title&&t.push(IW(this,n));for(const n of qW)t=t.concat(GW(this,n));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>FW(e,"grid",t))),...i.map((e=>FW(e,"grid",t))),...n.map((e=>FW(e,"main",t))),...i.map((e=>FW(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return _H(this)}assembleProjections(){return AH(this)}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...dO(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return oM(["unit","layer"],this.type)?oM(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),gM(n)?void 0:n}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||QG(this.parent)?SG(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return wM((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(mq[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(QG(this.parent)){const t=Fz(iH(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(wR(e)&&mO(i)){const e=n.get("name"),i=EG($G(this,t));if(i){return{signal:nH(e,n,lP({aggregate:"distinct",field:i},{expr:"datum"}))}}return gN(qO(t)),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):YB(e)&&Iz(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getScaleType(e){const t=this.getScaleComponent(e);return t?t.get("type"):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){var e,t;return(null==(e=this.component.axes.x)?void 0:e.some((e=>e.hasOrientSignalRef())))||(null==(t=this.component.axes.y)?void 0:t.some((e=>e.hasOrientSignalRef())))}}class nV extends tV{vgField(e,t={}){const n=this.fieldDef(e);if(n)return lP(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?yM(e).reduce(((n,r)=>{const o=e[r];return f(o)?o.reduce(((e,n)=>t.call(i,e,n,r)),n):t.call(i,n,o,r)}),n):n}(this.getMapping(),((t,n,i)=>{const r=vP(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){GP(this.getMapping(),((t,n)=>{const i=vP(t);i&&e(i,n)}),t)}}class iV extends vq{clone(){return new iV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${iM(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return n.resolve=this.transform.resolve,n}}class rV extends vq{clone(){return new rV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${iM(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class oV extends vq{clone(){return new oV(this.parent,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${iM(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class aV extends vq{clone(){return new aV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${iM(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class sV extends vq{clone(){return new sV(null,ZS(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[oB,rB],[sB,aB]]){const r=i.map((e=>{const n=bP(t.encoding[e]);return XT(n)?n.field:KT(n)?{expr:`${n.datum}`}:iP(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new sV(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(dB)){const i=t.typedFieldDef(dB);i.type===nR&&(e=new sV(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(ie);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${iM(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class uV extends vq{clone(){return new uV(null,this.projection,ZS(this.fields),ZS(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[oB,rB],[sB,aB]]){const i=n.map((e=>{const n=bP(t.encoding[e]);return XT(n)?n.field:KT(n)?{expr:`${n.datum}`}:iP(n)?{expr:`${n.value}`}:void 0})),r=n[0]===sB?"2":"";(i[0]||i[1])&&(e=new uV(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(ie))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${iM(this.fields)} ${iM(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class lV extends vq{clone(){return new lV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new lV(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(XT(i)&&XT(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:u,frame:l,keyvals:c}=o.impute,f=VP(t.mark,n);return new lV(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==u?{value:u}:{},...l?{frame:l}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${iM(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(u=n,WM(u,"stop")?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};var u;if(i&&"value"!==i){return[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class cV extends vq{clone(){return new cV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${iM(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class fV extends vq{clone(){return new fV(null,ZS(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return WM(e,"data")}(o)){let e=DV(o.data,r);e||(e=new IH(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new bq(e,n,mq.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return WM(e,"param")}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(wM(e),e)}catch(s){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(function(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}(e))}return new fV(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?u(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${iM({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:u(this.transform.as)}:{}};else{let t=this.transform.as;ie(t)||(gN('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class dV extends vq{clone(){return new dV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${iM(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class hV extends vq{clone(){return new hV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${iM(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class pV extends vq{clone(){return new pV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=cM((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${iM(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class mV extends vq{clone(){return new mV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${iM(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function gV(e){let t=0;return function n(i,r){if(i instanceof IH&&!i.isGenerator&&!uq(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof jH&&(i.parent instanceof IH&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof NH)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());if((i instanceof qH||i instanceof UH||i instanceof uG||i instanceof wW||i instanceof RW||i instanceof uV||i instanceof OH||i instanceof fV||i instanceof fG||i instanceof sG||i instanceof aV||i instanceof oV||i instanceof iV||i instanceof cV||i instanceof dV||i instanceof hV||i instanceof LH||i instanceof mV||i instanceof pV||i instanceof rV)&&r.transform.push(i.assemble()),(i instanceof BH||i instanceof _q||i instanceof lV||i instanceof cG||i instanceof sV)&&r.transform.push(...i.assemble()),i instanceof bq)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof bq)i.setSource(r.name);else if(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()){e.push(r);r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof bq&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}function yV(e,t){var n;const{facet:i,config:r,child:o,component:a}=e;if(e.channelHasField(t)){const s=i[t],u=jW("title",null,r,t);let l=pP(s,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});o.component.layoutHeaders[t].title&&(l=f(l)?l.join(", "):l,l+=` / ${o.component.layoutHeaders[t].title}`,o.component.layoutHeaders[t].title=null);const c=jW("labelOrient",s.header,r,t),d=null!==s.header&&zM(null==(n=s.header)?void 0:n.labels,r.header.labels,!0),h=oM(["bottom","right"],c)?"footer":"header";a.layoutHeaders[t]={title:null!==s.header?l:null,facetFieldDef:s,[h]:"facet"===t?[]:[vV(e,t,d)]}}}function vV(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function bV(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=aH(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",a=r[o];for(const r of n.component.axes[t]){const t="top"===(i=r.get("orient"))||"left"===i||pO(i)?"header":"footer";a[t]??(a[t]=[vV(e,o,!1)]);const n=FW(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function xV(e){for(const t of e.children)t.parseLayoutSize()}function wV(e,t){const n=iH(t),i=Fz(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const s of e.children){const t=s.component.layoutSize.getWithExplicit(n),o=r.scale[i]??oH(i,e);if("independent"===o&&"step"===t.value){a=void 0;break}if(a){if("independent"===o&&a.value!==t.value){a=void 0;break}a=aq(a,t,n,"")}else a=t}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function _V(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(wR(e)){const e=jj(i.view,t);return mO(n)||Oj(e)?"step":e}return Tj(i.view,t)}if(e.hasProjection||"arc"===e.mark)return Tj(i.view,t);{const e=jj(i.view,t);return Oj(e)?e.step:e}}function AV(e,t,n){return lP(t,{suffix:`by_${lP(e)}`,...n})}class kV extends nV{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=XV(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!TT(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=yM(e),n={};for(const i of t){if(![HM,GM].includes(i)){gN(eN(i,"facet"));break}const t=e[i];if(void 0===t.field){gN(ZO(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=_P(e,t);return n.header?n.header=fO(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return WM(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=FV(this),this.child.parseData()}parseLayoutSize(){xV(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some((e=>nI(e)))&&mN(VO)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of TB)yV(e,t);bV(e,"x"),bV(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of TB)for(const n of UW){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=jW("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=PW(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(null==r?void 0:r[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??(e[o]={}),e[o][t]=.5),i.title&&(e.offset??(e.offset={}),e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof kV)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof kV?{...this.channelHasField("column")?{encode:{update:{columns:{field:lP(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof kV){if(this.child.channelHasField("column")){const i=lP(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of _z){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(wR(o)&&mO(a)){const r=EG($G(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):gN(qO(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:o,as:a}=this.getCardinalityAggregateForChild(),s=[];for(const l of TB){const e=this.facet[l];if(e){s.push(lP(e));const{bin:t,sort:u}=e;if(oO(t)&&s.push(lP(e,{binSuffix:"end"})),NT(u)){const{field:t,op:s=BT}=u,l=AV(e,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(t),o.push(s),a.push(l))}else if(f(u)){const t=TW(e,l);r.push(t),o.push("max"),a.push(t)}}}const u=!!n&&!!i;return{name:e,data:t,groupby:s,...u||r.length>0?{aggregate:{...u?{cross:u}:{},...r.length?{fields:r,ops:o,as:a}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?NT(n.sort)?[AV(n,n.sort,{expr:"datum"})]:f(n.sort)?[TW(n,e,{expr:"datum"})]:[lP(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(NT(e)?e.order:!f(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){var e;const{facet:t,config:n}=this;if(t.facet)return YW(t.facet,"facet",n);const i={row:["top","bottom"],column:["left","right"]};for(const r of qW)if(t[r]){const o=jW("labelOrient",null==(e=t[r])?void 0:e.header,n,r);if(i[r].includes(o))return YW(t[r],r,n)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=gV(t);for(const i of e.children)n(i,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:TB.map((e=>this.facetSortFields(e))).flat(),order:TB.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(Wq(this,[]))}]}getMapping(){return this.facet}}function DV(e,t){var n,i,r,o;for(const a of t){const t=a.data;if(e.name&&a.hasName()&&e.name!==a.dataName)continue;const s=null==(n=e.format)?void 0:n.mesh,u=null==(i=t.format)?void 0:i.feature;if(s&&u)continue;const l=null==(r=e.format)?void 0:r.feature;if((l||u)&&l!==u)continue;const c=null==(o=t.format)?void 0:o.mesh;if(!s&&!c||s===c)if(lq(e)&&lq(t)){if(UM(e.values,t.values))return a}else if(uq(e)&&uq(t)){if(e.url===t.url)return a}else if(cq(e)&&e.name===a.dataName)return a}return null}function FV(e){var t;let n=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new IH({values:[]});return t.push(e),e}const n=DV(e.data,t);if(n)return fq(e.data)||(n.data.format=uM({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new IH(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:i,outputNodeRefCounts:r}=e.component.data,o=e.data,a=!(o&&(fq(o)||uq(o)||lq(o)))&&e.parent?e.parent.component.data.ancestorParse.clone():new sq;fq(o)?(dq(o)?n=new UH(n,o.sequence):pq(o)&&(n=new qH(n,o.graticule)),a.parseNothing=!0):null===(null==(t=null==o?void 0:o.format)?void 0:t.parse)&&(a.parseNothing=!0),n=jH.makeExplicit(n,e,a)??n,n=new LH(n);const s=e.parent&&eV(e.parent);(KG(e)||QG(e))&&s&&(n=BH.makeFromEncoding(n,e)??n),e.transforms.length>0&&(n=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(OL(r))a=e=new RW(e,r),o="derived";else if(AL(r)){const i=TH(r);a=e=jH.makeWithAncestors(e,{},i,n)??e,e=new wW(e,t,r.filter)}else if(NL(r))a=e=BH.makeFromTransform(e,r,t),o="number";else if(TL(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new jH(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=_q.makeFromTransform(e,r);else if(PL(r))a=e=OH.makeFromTransform(e,r),o="number",eI(t)&&(e=new LH(e));else if(kL(r))a=e=fV.make(e,t,r,i++),o="derived";else if(ML(r))a=e=new fG(e,r),o="number";else if(BL(r))a=e=new sG(e,r),o="number";else if(jL(r))a=e=cG.makeFromTransform(e,r),o="derived";else if(LL(r))a=e=new aV(e,r),o="derived";else if(qL(r))a=e=new rV(e,r),o="derived";else if(zL(r))a=e=new oV(e,r),o="derived";else if(DL(r))a=e=new pV(e,r),o="derived";else if(SL(r))e=new mV(e,r);else if(RL(r))a=e=lV.makeFromTransform(e,r),o="derived";else if(FL(r))a=e=new iV(e,r),o="derived";else if(CL(r))a=e=new dV(e,r),o="derived";else if(EL(r))a=e=new hV(e,r),o="derived";else{if(!$L(r)){gN(`Ignoring an invalid transform: ${IM(r)}.`);continue}a=e=new cV(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(n,e,a));const u=function(e){const t={};if(KG(e)&&e.component.selection)for(const n of yM(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&BM(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=PH(e);n=jH.makeWithAncestors(n,{},{...u,...l},a)??n,KG(e)&&(n=sV.parseAll(n,e),n=uV.parseAll(n,e)),(KG(e)||QG(e))&&(s||(n=BH.makeFromEncoding(n,e)??n),n=_q.makeFromEncoding(n,e)??n,n=RW.parseAllForSortIndex(n,e));const c=n=CV(mq.Raw,e,n);if(KG(e)){const t=OH.makeFromEncoding(n,e);t&&(n=t,eI(e)&&(n=new LH(n))),n=lV.makeFromEncoding(n,e)??n,n=cG.makeFromEncoding(n,e)??n}let f,d;if(KG(e)){const{markDef:t,mark:i,config:r}=e,o=EO("invalid",t,r),{marks:a,scales:s}=d=yq({invalid:o,isPath:KR(i)});a!==s&&"include-invalid-values"===s&&(f=n=CV(mq.PreFilterInvalid,e,n)),"exclude-invalid-values"===a&&(n=uG.make(n,e,d)??n)}const h=n=CV(mq.Main,e,n);let p;if(KG(e)&&d){const{marks:t,scales:i}=d;"include-invalid-values"===t&&"exclude-invalid-values"===i&&(n=uG.make(n,e,d)??n,p=n=CV(mq.PostFilterInvalid,e,n))}KG(e)&&function(e,t){for(const[n,i]of bM(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new bq(new wW(t,e,{param:n}),r,mq.Lookup,e.component.data.outputNodeRefCounts)}}(e,h);let m=null;if(QG(e)){const t=e.getName("facet");n=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(NT(r.sort)){const{field:n,op:i=BT}=r.sort;e=t=new sG(e,{joinaggregate:[{op:i,field:n,as:AV(r,r.sort,{forAs:!0})}],groupby:[lP(r)]})}return t}return null}(n,e.facet)??n,m=new NH(n,e,t,h.getSource()),i[t]=m}return{...e.component.data,outputNodes:i,outputNodeRefCounts:r,raw:c,main:h,facetRoot:m,ancestorParse:a,preFilterInvalid:f,postFilterInvalid:p}}function CV(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,o=t.getDataName(e),a=new bq(n,o,e,r);return i[o]=a,a}class EV extends tV{constructor(e,t,n,i){var r,o,a,s;super(e,"concat",t,n,i,e.resolve),"shared"!==(null==(o=null==(r=e.resolve)?void 0:r.axis)?void 0:o.x)&&"shared"!==(null==(s=null==(a=e.resolve)?void 0:a.axis)?void 0:s.y)||gN("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>XV(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=FV(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of yM(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>nI(e)))&&mN(VO)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return Mj(e)?e.vconcat:Bj(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){xV(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";wV(e,t),wV(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=ZW(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleMarks(){return this.children.map((e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const $V={disable:1,gridScale:1,scale:1,...zP,labelExpr:1,encode:1},SV=yM($V);class MV extends tq{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new MV(ZS(this.explicit),ZS(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}hasOrientSignalRef(){return pO(this.explicit.orient)}}const BV={bottom:"top",top:"bottom",left:"right",right:"left"};function zV(e,t){if(!e)return t.map((e=>e.clone()));{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return NO(e,t);case"gridScale":return{explicit:e.explicit,value:zM(e.value,t.value)}}return oq(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function NV(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(pO(n.labelAngle)?n.labelAngle:jM(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===NW(i,r))return!0}return e===n[t]}const RV=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function TV(e,t){var n,i;let r=t.axis(e);const o=new MV,a=bP(t.encoding[e]),{mark:s,config:u}=t,l=(null==r?void 0:r.orient)||(null==(n=u["x"===e?"axisX":"axisY"])?void 0:n.orient)||(null==(i=u.axis)?void 0:i.orient)||function(e){return"x"===e?"bottom":"left"}(e),c=t.getScaleComponent(e).get("type"),f=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:yR(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=pO(n)?"axisOrient":`axis${kM(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],u=["axis",a,o];return{vlOnlyAxisConfig:EW(s,i,e,n),vgAxisConfig:EW(u,i,e,n),axisConfigStyle:$W([...u,...s],i)}}(e,c,l,t.config),d=void 0!==r?!r:SW("disable",u.style,null==r?void 0:r.style,f).configValue;if(o.set("disable",d,void 0!==r),d)return o;r=r||{};const h=function(e,t,n,i,r){const o=null==t?void 0:t.labelAngle;if(void 0!==o)return pO(o)?o:jM(o);{const{configValue:o}=SW("labelAngle",i,null==t?void 0:t.style,r);return void 0!==o?jM(o):n!==YM||!oM([tR,ZN],e.type)||XT(e)&&e.timeUnit?void 0:270}}(a,r,e,u.style,f),p=CT(r.formatType,a,c),m=FT(a,a.type,r.format,r.formatType,u,!0),g={fieldOrDatumDef:a,axis:r,channel:e,model:t,scaleType:c,orient:l,labelAngle:h,format:m,formatType:p,mark:s,config:u};for(const b of SV){const n=b in MW?MW[b](g):NP(b)?r[b]:void 0,i=void 0!==n,a=NV(n,b,r,t,e);if(i&&a)o.set(b,n,a);else{const{configValue:e,configFrom:t}=NP(b)&&"values"!==b?SW(b,u.style,r.style,f):{},s=void 0!==e;i&&!s?o.set(b,n,a):("vgAxisConfig"!==t||RV.has(b)&&s||SP(e)||pO(e))&&o.set(b,e,!1)}}const y=r.encoding??{},v=MP.reduce(((n,i)=>{if(!o.hasAxisPart(i))return n;const r=rH(y[i]??{},t),a="labels"===i?function(e,t,n){const{encoding:i,config:r}=e,o=bP(i[t])??bP(i[ZB(t)]),a=e.axis(t)||{},{format:s,formatType:u}=a;if(wT(u))return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:u,config:r}),...n};if(void 0===s&&void 0===u&&r.customFormatTypes){if("quantitative"===JT(o)){if(oP(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===JT(o)&&r.timeFormatType&&XT(o)&&!o.timeUnit)return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,r):r;return void 0===a||gM(a)||(n[i]={update:a}),n}),{});return gM(v)||o.set("encode",v,!!r.encoding||void 0!==r.labelAngle),o}function PV(e,t){const{config:n}=e;return{...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...cU("size",e),...cU("angle",e),...jV(e,n,t)}}function jV(e,t,n){return n?{shape:{value:n}}:cU("shape",e)}function LV(e,t,n){if(void 0===EO("align",e,n))return"center"}function qV(e,t,n){if(void 0===EO("baseline",e,n))return"middle"}const UV={arc:{vgMark:"arc",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...AU(e,"radius"),...AU(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...xU("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...xU("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...MU(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,"x"),...AU(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>PV(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&XT(n)&&n.type===nR?{field:lP(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,"x"),...AU(e,"y"),...nU(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...cU("size",e,{vgChannel:"strokeWidth"}),...MU(e)})},point:{vgMark:"symbol",encodeEntry:e=>PV(e)},rect:{vgMark:"rect",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,"x"),...AU(e,"y")})},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...xU("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...xU("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...cU("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>PV(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...EU(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...nU(e),...cU("size",e,{vgChannel:"fontSize"}),...cU("angle",e),...BU("align",LV(e.markDef,n,t)),...BU("baseline",qV(e.markDef,n,t)),...pU("radius",e,{defaultPos:null}),...pU("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"x":"y",o="horizontal"===i?"y":"x",a="horizontal"===i?"height":"width";return{...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,r),...pU(o,e,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:AO(EO("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...cU("size",e),...MU(e)})}};function IV(e){if(oM([qR,PR,VR],e.mark)){const t=VP(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:WV+e.requestDataName(mq.Main),data:e.requestDataName(mq.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:GV(e,{fromPrefix:WV})}]}(e,t)}else if(e.mark===jR){const t=bO.some((t=>EO(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){var t;const[n]=GV(e,{fromPrefix:HV}),i=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(e,t)=>`${e}(${[r({prefix:"min",suffix:"start",expr:t}),r({prefix:"max",suffix:"start",expr:t}),r({prefix:"min",suffix:"end",expr:t}),r({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${i}',${e})`)).join(",")})`;let a,s;"x"===e.stack.fieldChannel?(a={...tM(n.encode.update,["y","yc","y2","height",...bO]),x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...nM(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(a={...tM(n.encode.update,["x","xc","x2","width"]),y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...nM(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const l of bO){const t=$O(l,e.markDef,e.config);n.encode.update[l]?(a[l]=n.encode.update[l],delete n.encode.update[l]):t&&(a[l]=AO(t)),t&&(n.encode.update[l]={value:0})}const u=[];if((null==(t=e.stack.groupbyChannels)?void 0:t.length)>0)for(const l of e.stack.groupbyChannels){const t=e.fieldDef(l),n=lP(t);n&&u.push(n),((null==t?void 0:t.bin)||(null==t?void 0:t.timeUnit))&&u.push(lP(t,{binSuffix:"end"}))}a=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((t,i)=>{if(n.encode.update[i])return{...t,[i]:n.encode.update[i]};{const n=$O(i,e.markDef,e.config);return void 0!==n?{...t,[i]:AO(n)}:t}}),a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(mq.Main),name:HV+e.requestDataName(mq.Main),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:s},marks:[n]}]}]}(e)}return GV(e)}const WV="faceted_path_";const HV="stack_group_";function GV(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=zM(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!(null==t?void 0:t.get("selectionExtent"))&&!(null==n?void 0:n.get("selectionExtent")))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),s=CO(i),u=r.key,l=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!f(a)&&iP(a)&&rM(a.value)||!a&&rM(EO("order",r,o)))){if((f(a)||XT(a))&&!n)return BO(a,{expr:"datum"});if(KR(i)){const e="horizontal"===r.orient?"y":"x";if(XT(t[e]))return{field:e}}}}(e),c=function(e){if(!e.component.selection)return null;const t=yM(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=yM(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}(e),d=EO("aria",i,o),h=UV[n].postEncodingTransform?UV[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:UV[n].vgMark,...a?{clip:a}:{},...s?{style:s}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...!1===d?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(mq.Main)},encode:{update:UV[n].encodeEntry(e)},...h?{transform:h}:{}}]}class VV extends nV{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,Nj(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=e=>{var t,n,i;return(null==(t=e.from)?void 0:t.data)&&(e.from.data=this.lookupDataSource(e.from.data),"time"in this.encoding&&(e.from.data=e.from.data+Mq)),(null==(i=null==(n=e.from)?void 0:n.facet)?void 0:i.data)&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e};const o=eT(e.mark)?{...e.mark}:{type:e.mark},a=o.type;void 0===o.filled&&(o.filled=function(e,t,{graticule:n}){if(n)return!1;const i=$O("filled",e,t),r=e.type;return zM(i,r!==UR&&r!==qR&&r!==WR)}(o,r,{graticule:e.data&&pq(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const s of yM(e))YB(s)||gN(`${o=s}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let s of rz){if(!e[s])continue;const o=e[s];if(Ez(s)){const e=iz(s),t=r[e];if(XT(t)&&("quantitative"===(a=t.type)||"temporal"===a)&&XT(o)&&!t.timeUnit){gN(JO(e));continue}}if("angle"!==s||"arc"!==t||e.theta||(gN("Arc marks uses theta channel rather than angle, replacing angle with theta."),s=nB),WP(e,s,t)){if(s===hB&&"line"===t){const t=vP(e[s]);if(null==t?void 0:t.aggregate){gN("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(s===lB&&(n?"fill"in e:"stroke"in e))gN(QO("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(s===_B||s===wB&&!f(o)&&!iP(o)||s===kB&&f(o)){if(o){if(s===wB){const t=e[s];if(HT(t)){r[s]=t;continue}}r[s]=u(o).reduce(((e,t)=>(XT(t)?e.push(_P(t,s)):gN(ZO(t,s)),e)),[])}}else{if(s===kB&&null===o)r[s]=null;else if(!(XT(o)||KT(o)||iP(o)||GT(o)||pO(o))){gN(ZO(o,s));continue}r[s]=xP(o,s,i)}}else gN(eN(s,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=sL(o,s,r),this.size=function({encoding:e,size:t}){for(const n of _z){const i=ez(n);Oj(t[i])&&QT(e[n])&&(delete t[i],gN(uN(i)))}return t}({encoding:s,size:Nj(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=aL(this.markDef,s),this.specifiedScales=this.initScales(a,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>Ej(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===JR,n=e&&zB.some((t=>tP(e[t])));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return Uz.reduce(((e,n)=>{const i=bP(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=fO(e);return f(t)&&(i.domain=t.map(wO)),f(n)&&(i.range=n.map(wO)),i}initAxes(e){return _z.reduce(((t,n)=>{const i=e[n];if(tP(i)||n===YM&&tP(e.x2)||n===XM&&tP(e.y2)){const e=tP(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=yM(e),n={};for(const i of t){const t=e[i];n[i]=SP(t)?xO(t):wO(t)}return n}initLegends(e){return Lz.reduce(((t,n)=>{const i=bP(e[n]);if(i&&function(e){switch(e){case lB:case cB:case fB:case hB:case dB:case mB:case vB:case bB:return!0;case gB:case yB:case pB:case uB:return!1}}(n)){const e=i.legend;t[n]=e?fO(e):e}return t}),{})}parseData(){this.component.data=FV(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of _z){const r=ez(i);if(t[r]){const e=t[r];n.layoutSize.set(r,Oj(e)?"step":e,!0)}else{const t=_V(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;let r=0;for(const o of t){const t=wM(o.name),a=o.select,s=ie(a)?a:a.type,l=ne(a)?ZS(a):{type:s},c=i[s];for(const e in c)"fields"!==e&&"encodings"!==e&&("mark"===e&&(l.mark={...c.mark,...l.mark}),void 0!==l[e]&&!0!==l[e]||(l[e]=ZS(c[e]??l[e])));const f=n[t]={...l,name:t,type:s,init:o.value,bind:o.bind,events:ie(l.on)?ZF(l.on,"scope"):u(ZS(l.on))};if(nI(f)&&(r++,r>1)){delete n[t];continue}const d=ZS(o);for(const n of QU)n.defined(f)&&n.parse&&n.parse(e,f,d)}return r>1&&gN("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),n}(this,this.selection)}parseMarkGroup(){this.component.mark=IV(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,_z.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[TV(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of vM(e.component.selection??{})){const r=i.name,o=fe(r+YU);if(0===t.filter((e=>e.name===r)).length){const e="global"===i.resolve?"union":i.resolve,n="point"===i.type?", true, true)":")";t.push({name:i.name,update:`${KU}(${o}, ${fe(e)}${n}`})}n=!0;for(const n of QU)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}n&&0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]});return Gq(t)}(this,e)}assembleSignals(){return[...CW(this),...Iq(this,[])]}assembleSelectionData(e){return function(e,t){const n=[],i=[],r=ZU(e,{escape:!1});for(const o of vM(e.component.selection??{})){const a={name:o.name+YU};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:kj}}]),o.init){const e=o.project.items.map(qq);a.values=o.project.hasSelectionId?o.init.map((e=>({unit:r,[kj]:Uq(e,!1)[0]}))):o.init.map((t=>({unit:r,fields:e,values:Uq(t,!1)})))}if([...n,...t].filter((e=>e.name===o.name+YU)).length||n.push(a),nI(o)&&t.length){const n=e.lookupDataSource(e.getDataName(mq.Main)),r=t.find((e=>e.name===n)),o=r.transform.find((e=>"filter"===e.type&&e.expr.includes("vlSelectionTest")));if(o){r.transform=r.transform.filter((e=>e!==o));const e={name:r.name+Mq,source:r.name,transform:[o]};i.push(e)}}}return n.concat(t,i)}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return ZW(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&eV(this.parent)||(e=Hq(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return jP(this.encoding,e)}fieldDef(e){return vP(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return nP(t)?t:null}}class YV extends tV{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(Zj(e))return new YV(e,this,this.getName(`layer_${t}`),o,r);if(TP(e))return new VV(e,this,this.getName(`layer_${t}`),o,r);throw new Error(RO(e))}))}parseData(){this.component.data=FV(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;xV(e=this),wV(e,"width"),wV(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of yM(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>nI(e)))&&mN(VO)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const r of e.children){r.parseAxesAndHeaders();for(const i of yM(r.component.axes))n.axis[i]=aH(e.component.resolve,i),"shared"===n.axis[i]&&(t[i]=zV(t[i],r.component.axes[i]),t[i]||(n.axis[i]="independent",delete t[i]))}for(const r of _z){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!pO(t)){if(i[t]>0&&!n){const n=BV[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),CW(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),ZW(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const n of this.children)for(const t of u(n.assembleGroupStyle()))e.add(t);const t=Array.from(e);return t.length>1?t:1===t.length?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)KG(n)&&(t=Hq(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),_H(this))}}function XV(e,t,n,i,r){if(jT(e))return new kV(e,t,n,r);if(Zj(e))return new YV(e,t,n,i,r);if(TP(e))return new VV(e,t,n,i,r);if(function(e){return Mj(e)||Bj(e)||Sj(e)}(e))return new EV(e,t,n,r);throw new Error(RO(e))}function JV(e,t={}){var n;t.logger&&(n=t.logger,pN=n),t.fieldTitle&&hP(t.fieldTitle);try{const n=Vj(qe(t.config,e.config)),i=YL(e,n),r=XV(i,null,"",void 0,n);r.parse(),function(e,t){mG(e.sources);let n=0,i=0;for(let r=0;r<5&&yG(e,t,!0);r++)n++;e.sources.map(dG);for(let r=0;r<5&&yG(e,t,!1);r++)i++;mG(e.sources),5===Math.max(n,i)&&gN("Maximum optimization runs(5) reached.")}(r.component.data,r);const o=function(e,t,n={},i){const r=e.config?Kj(e.config):void 0,o=function(e,t){const n=[],i=gV(n);let r=0;for(const a of e.sources){a.hasName()||(a.dataName="source_"+r++);const e=a.assemble();i(a,e)}for(const a of n)0===a.transform.length&&delete a.transform;let o=0;for(const[a,s]of n.entries())0!==(s.transform??[]).length||s.source||n.splice(o++,0,n.splice(a,1)[0]);for(const a of n)for(const t of a.transform??[])"lookup"===t.type&&(t.from=e.outputNodes[t.from].getSource());for(const a of n)a.name in t&&(a.values=t[a.name]);return n}(e.component.data,n),a=e.assembleSelectionData(o),s=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:d,...h}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...h,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:a,...s.length>0?{projections:s}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...$j(d)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):ie(t)&&(t={type:t});if(r&&o&&(a=t.type,["fit","fit-x","fit-y"].includes(a)))if("step"===r&&"step"===o)gN(LO()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";gN(LO(Fz(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${Fz(e)}`:"fit"}(n)}var a;return{...1===yM(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...eq(n,!1),...eq(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(pN=hN),t.fieldTitle&&hP(fP)}}export{eM as A,YL as B,jM as C,nM as D,tM as E,pM as F,MM as G,SM as H,$M as I,RM as J,dM as K,aM as L,RR as M,IM as N,kM as O,cM as P,NM as Q,vM as R,wM as S,VS as T,Zz as U,Lz as V,BM as a,DM as b,JV as c,CM as d,oM as e,UM as f,AM as g,ZS as h,bM as i,sM as j,mM as k,FM as l,zM as m,hM as n,WM as o,iM as p,TM as q,xM as r,gM as s,fM as t,PM as u,rM as v,LM as w,yM as x,_M as y,uM as z}; diff --git a/docs/assets/crystal-CRzZ78HM.js b/docs/assets/crystal-CRzZ78HM.js deleted file mode 100644 index 54f1bc2..0000000 --- a/docs/assets/crystal-CRzZ78HM.js +++ /dev/null @@ -1 +0,0 @@ -function e(e,t){return new RegExp((t?"":"^")+"(?:"+e.join("|")+")"+(t?"$":"\\b"))}function t(e,t,n){return n.tokenize.push(e),e(t,n)}var n=/^(?:[-+/%|&^]|\*\*?|[<>]{2})/,r=/^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/,a=/^(?:\[\][?=]?)/,u=/^(?:\.(?:\.{2})?|->|[?:])/,i=/^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,o=/^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,c=e(["abstract","alias","as","asm","begin","break","case","class","def","do","else","elsif","end","ensure","enum","extend","for","fun","if","include","instance_sizeof","lib","macro","module","next","of","out","pointerof","private","protected","rescue","return","require","select","sizeof","struct","super","then","type","typeof","uninitialized","union","unless","until","when","while","with","yield","__DIR__","__END_LINE__","__FILE__","__LINE__"]),s=e(["true","false","nil","self"]),f=e(["def","fun","macro","class","module","struct","lib","enum","union","do","for"]),l=e(["if","unless","case","while","until","begin","then"]),m=["end","else","elsif","rescue","ensure"],h=e(m),p=["\\)","\\}","\\]"],k=new RegExp("^(?:"+p.join("|")+")$"),d={def:g,fun:g,macro:function(e,t){if(e.eatSpace())return null;var n;if(n=e.match(i)){if("def"==n)return"keyword";e.eat(/[?!]/)}return t.tokenize.pop(),"def"},class:x,module:x,struct:x,lib:x,enum:x,union:x},F={"[":"]","{":"}","(":")","<":">"};function z(e,m){if(e.eatSpace())return null;if("\\"!=m.lastToken&&e.match("{%",!1))return t(b("%","%"),e,m);if("\\"!=m.lastToken&&e.match("{{",!1))return t(b("{","}"),e,m);if("#"==e.peek())return e.skipToEnd(),"comment";var h;if(e.match(i))return e.eat(/[?!]/),h=e.current(),e.eat(":")?"atom":"."==m.lastToken?"property":c.test(h)?(f.test(h)?"fun"==h&&m.blocks.indexOf("lib")>=0||"def"==h&&"abstract"==m.lastToken||(m.blocks.push(h),m.currentIndent+=1):"operator"!=m.lastStyle&&m.lastStyle||!l.test(h)?"end"==h&&(m.blocks.pop(),m.currentIndent-=1):(m.blocks.push(h),m.currentIndent+=1),d.hasOwnProperty(h)&&m.tokenize.push(d[h]),"keyword"):s.test(h)?"atom":"variable";if(e.eat("@"))return"["==e.peek()?t(_("[","]","meta"),e,m):(e.eat("@"),e.match(i)||e.match(o),"propertyName");if(e.match(o))return"tag";if(e.eat(":"))return e.eat('"')?t(I('"',"atom",!1),e,m):e.match(i)||e.match(o)||e.match(n)||e.match(r)||e.match(a)?"atom":(e.eat(":"),"operator");if(e.eat('"'))return t(I('"',"string",!0),e,m);if("%"==e.peek()){var p,k="string",z=!0;if(e.match("%r"))k="string.special",p=e.next();else if(e.match("%w"))z=!1,p=e.next();else if(e.match("%q"))z=!1,p=e.next();else if(p=e.match(/^%([^\w\s=])/))p=p[1];else{if(e.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/))return"meta";if(e.eat("%"))return"operator"}return F.hasOwnProperty(p)&&(p=F[p]),t(I(p,k,z),e,m)}return(h=e.match(/^<<-('?)([A-Z]\w*)\1/))?t(function(e,t){return function(n,r){if(n.sol()&&(n.eatSpace(),n.match(e)))return r.tokenize.pop(),"string";for(var a=!1;n.peek();)if(a)n.next(),a=!1;else{if(n.match("{%",!1))return r.tokenize.push(b("%","%")),"string";if(n.match("{{",!1))return r.tokenize.push(b("{","}")),"string";if(t&&n.match("#{",!1))return r.tokenize.push(_("#{","}","meta")),"string";a="\\"==n.next()&&t}return"string"}}(h[2],!h[1]),e,m):e.eat("'")?(e.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/),e.eat("'"),"atom"):e.eat("0")?(e.eat("x")?e.match(/^[0-9a-fA-F_]+/):e.eat("o")?e.match(/^[0-7_]+/):e.eat("b")&&e.match(/^[01_]+/),"number"):e.eat(/^\d/)?(e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/),"number"):e.match(n)?(e.eat("="),"operator"):e.match(r)||e.match(u)?"operator":(h=e.match(/[({[]/,!1))?t(_(h=h[0],F[h],null),e,m):e.eat("\\")?(e.next(),"meta"):(e.next(),null)}function _(e,t,n,r){return function(a,u){if(!r&&a.match(e))return u.tokenize[u.tokenize.length-1]=_(e,t,n,!0),u.currentIndent+=1,n;var i=z(a,u);return a.current()===t&&(u.tokenize.pop(),u.currentIndent-=1,i=n),i}}function b(e,t,n){return function(r,a){return!n&&r.match("{"+e)?(a.currentIndent+=1,a.tokenize[a.tokenize.length-1]=b(e,t,!0),"meta"):r.match(t+"}")?(a.currentIndent-=1,a.tokenize.pop(),"meta"):z(r,a)}}function g(e,t){return e.eatSpace()?null:(e.match(i)?e.eat(/[!?]/):e.match(n)||e.match(r)||e.match(a),t.tokenize.pop(),"def")}function x(e,t){return e.eatSpace()?null:(e.match(o),t.tokenize.pop(),"def")}function I(e,t,n){return function(r,a){for(var u=!1;r.peek();)if(u)r.next(),u=!1;else{if(r.match("{%",!1))return a.tokenize.push(b("%","%")),t;if(r.match("{{",!1))return a.tokenize.push(b("{","}")),t;if(n&&r.match("#{",!1))return a.tokenize.push(_("#{","}","meta")),t;var i=r.next();if(i==e)return a.tokenize.pop(),t;u=n&&"\\"==i}return t}}const w={name:"crystal",startState:function(){return{tokenize:[z],currentIndent:0,lastToken:null,lastStyle:null,blocks:[]}},token:function(e,t){var n=t.tokenize[t.tokenize.length-1](e,t),r=e.current();return n&&"comment"!=n&&(t.lastToken=r,t.lastStyle=n),n},indent:function(e,t,n){return t=t.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g,""),h.test(t)||k.test(t)?n.unit*(e.currentIndent-1):n.unit*e.currentIndent},languageData:{indentOnInput:e(p.concat(m),!0),commentTokens:{line:"#"}}};export{w as crystal}; diff --git a/docs/assets/css-ZjFoif2m.js b/docs/assets/css-ZjFoif2m.js deleted file mode 100644 index 40ea638..0000000 --- a/docs/assets/css-ZjFoif2m.js +++ /dev/null @@ -1 +0,0 @@ -function e(e){var t,r,o=(e={...z,...e}).inline,i=e.tokenHooks,a=e.documentTypes||{},n=e.mediaTypes||{},l=e.mediaFeatures||{},s=e.mediaValueKeywords||{},c=e.propertyKeywords||{},d=e.nonStandardPropertyKeywords||{},p=e.fontProperties||{},u=e.counterDescriptors||{},m=e.colorKeywords||{},g=e.valueKeywords||{},h=e.allowNested,b=e.lineComment,f=!0===e.supportsAtComponent,k=!1!==e.highlightNonStandardPropertyKeywords;function y(e,r){return t=r,e}function w(e,t){var r=e.next();if(i[r]){var o=i[r](e,t);if(!1!==o)return o}return"@"==r?(e.eatWhile(/[\w\\\-]/),y("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?y(null,"compare"):'"'==r||"'"==r?(t.tokenize=x(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),y("atom","hash")):"!"==r?(e.match(/^\s*\w*/),y("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),y("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?y(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?y("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?y(null,r):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(t.tokenize=P),y("variableName.function","variable")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),y("property","word")):y(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),y("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?y("def","variable-definition"):y("variableName","variable")):e.match(/^\w+-/)?y("meta","meta"):void 0}function x(e){return function(t,r){for(var o,i=!1;null!=(o=t.next());){if(o==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==o}return(o==e||!i&&")"!=e)&&(r.tokenize=null),y("string","string")}}function P(e,t){return e.next(),e.match(/^\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=x(")"),y(null,"(")}function j(e,t,r){this.type=e,this.indent=t,this.prev=r}function q(e,t,r,o){return e.context=new j(r,t.indentation()+(!1===o?0:t.indentUnit),e.context),r}function K(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function B(e,t,r){return A[r.context.type](e,t,r)}function _(e,t,r,o){for(var i=o||1;i>0;i--)r.context=r.context.prev;return B(e,t,r)}function O(e){var t=e.current().toLowerCase();r=g.hasOwnProperty(t)?"atom":m.hasOwnProperty(t)?"keyword":"variable"}var A={top:function(e,t,o){if("{"==e)return q(o,t,"block");if("}"==e&&o.context.prev)return K(o);if(f&&/@component/i.test(e))return q(o,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return q(o,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return q(o,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return o.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return q(o,t,"at");if("hash"==e)r="builtin";else if("word"==e)r="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return q(o,t,"interpolation");if(":"==e)return"pseudo";if(h&&"("==e)return q(o,t,"parens")}return o.context.type},block:function(e,t,o){if("word"==e){var i=t.current().toLowerCase();return c.hasOwnProperty(i)?(r="property","maybeprop"):d.hasOwnProperty(i)?(r=k?"string.special":"property","maybeprop"):h?(r=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(r="error","maybeprop")}return"meta"==e?"block":h||"hash"!=e&&"qualifier"!=e?A.top(e,t,o):(r="error","block")},maybeprop:function(e,t,r){return":"==e?q(r,t,"prop"):B(e,t,r)},prop:function(e,t,o){if(";"==e)return K(o);if("{"==e&&h)return q(o,t,"propBlock");if("}"==e||"{"==e)return _(e,t,o);if("("==e)return q(o,t,"parens");if("hash"!=e||/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(t.current())){if("word"==e)O(t);else if("interpolation"==e)return q(o,t,"interpolation")}else r="error";return"prop"},propBlock:function(e,t,o){return"}"==e?K(o):"word"==e?(r="property","maybeprop"):o.context.type},parens:function(e,t,r){return"{"==e||"}"==e?_(e,t,r):")"==e?K(r):"("==e?q(r,t,"parens"):"interpolation"==e?q(r,t,"interpolation"):("word"==e&&O(t),"parens")},pseudo:function(e,t,o){return"meta"==e?"pseudo":"word"==e?(r="variableName.constant",o.context.type):B(e,t,o)},documentTypes:function(e,t,o){return"word"==e&&a.hasOwnProperty(t.current())?(r="tag",o.context.type):A.atBlock(e,t,o)},atBlock:function(e,t,o){if("("==e)return q(o,t,"atBlock_parens");if("}"==e||";"==e)return _(e,t,o);if("{"==e)return K(o)&&q(o,t,h?"block":"top");if("interpolation"==e)return q(o,t,"interpolation");if("word"==e){var i=t.current().toLowerCase();r="only"==i||"not"==i||"and"==i||"or"==i?"keyword":n.hasOwnProperty(i)?"attribute":l.hasOwnProperty(i)?"property":s.hasOwnProperty(i)?"keyword":c.hasOwnProperty(i)?"property":d.hasOwnProperty(i)?k?"string.special":"property":g.hasOwnProperty(i)?"atom":m.hasOwnProperty(i)?"keyword":"error"}return o.context.type},atComponentBlock:function(e,t,o){return"}"==e?_(e,t,o):"{"==e?K(o)&&q(o,t,h?"block":"top",!1):("word"==e&&(r="error"),o.context.type)},atBlock_parens:function(e,t,r){return")"==e?K(r):"{"==e||"}"==e?_(e,t,r,2):A.atBlock(e,t,r)},restricted_atBlock_before:function(e,t,o){return"{"==e?q(o,t,"restricted_atBlock"):"word"==e&&"@counter-style"==o.stateArg?(r="variable","restricted_atBlock_before"):B(e,t,o)},restricted_atBlock:function(e,t,o){return"}"==e?(o.stateArg=null,K(o)):"word"==e?(r="@font-face"==o.stateArg&&!p.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==o.stateArg&&!u.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,o){return"word"==e?(r="variable","keyframes"):"{"==e?q(o,t,"top"):B(e,t,o)},at:function(e,t,o){return";"==e?K(o):"{"==e||"}"==e?_(e,t,o):("word"==e?r="tag":"hash"==e&&(r="builtin"),"at")},interpolation:function(e,t,o){return"}"==e?K(o):"{"==e||";"==e?_(e,t,o):("word"==e?r="variable":"variable"!=e&&"("!=e&&")"!=e&&(r="error"),"interpolation")}};return{name:e.name,startState:function(){return{tokenize:null,state:o?"block":"top",stateArg:null,context:new j(o?"block":"top",0,null)}},token:function(e,o){if(!o.tokenize&&e.eatSpace())return null;var i=(o.tokenize||w)(e,o);return i&&"object"==typeof i&&(t=i[1],i=i[0]),r=i,"comment"!=t&&(o.state=A[o.state](t,e,o)),r},indent:function(e,t,r){var o=e.context,i=t&&t.charAt(0),a=o.indent;return"prop"!=o.type||"}"!=i&&")"!=i||(o=o.prev),o.prev&&("}"!=i||"block"!=o.type&&"top"!=o.type&&"interpolation"!=o.type&&"restricted_atBlock"!=o.type?(")"!=i||"parens"!=o.type&&"atBlock_parens"!=o.type)&&("{"!=i||"at"!=o.type&&"atBlock"!=o.type)||(a=Math.max(0,o.indent-r.unit)):a=(o=o.prev).indent),a},languageData:{indentOnInput:/^\s*\}$/,commentTokens:{line:b,block:{open:"/*",close:"*/"}},autocomplete:v}}}function t(e){for(var t={},r=0;r=&|~%^]/;const d={name:"cypher",startState:function(){return{tokenize:n,context:null,indent:0,col:0}},token:function(t,n){if(t.sol()&&(n.context&&null==n.context.align&&(n.context.align=!1),n.indent=t.indentation()),t.eatSpace())return null;var o=n.tokenize(t,n);if("comment"!==o&&n.context&&null==n.context.align&&"pattern"!==n.context.type&&(n.context.align=!0),"("===e)r(n,")",t.column());else if("["===e)r(n,"]",t.column());else if("{"===e)r(n,"}",t.column());else if(/[\]\}\)]/.test(e)){for(;n.context&&"pattern"===n.context.type;)a(n);n.context&&e===n.context.type&&a(n)}else"."===e&&n.context&&"pattern"===n.context.type?a(n):/atom|string|variable/.test(o)&&n.context&&(/[\}\]]/.test(n.context.type)?r(n,"pattern",t.column()):"pattern"!==n.context.type||n.context.align||(n.context.align=!0,n.context.col=t.column()));return o},indent:function(e,t,n){var r=t&&t.charAt(0),a=e.context;if(/[\]\}]/.test(r))for(;a&&"pattern"===a.type;)a=a.prev;var o=a&&r===a.type;return a?"keywords"===a.type?null:a.align?a.col+(o?0:1):a.indent+(o?0:n.unit):0}};export{d as cypher}; diff --git a/docs/assets/cytoscape.esm-bH-fs5wT.js b/docs/assets/cytoscape.esm-bH-fs5wT.js deleted file mode 100644 index 78956f2..0000000 --- a/docs/assets/cytoscape.esm-bH-fs5wT.js +++ /dev/null @@ -1,9 +0,0 @@ -function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t,n){return t&&function(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}var l="undefined"==typeof window?null:window,u=l?l.navigator:null;l&&l.document;var c=e(""),d=e({}),h=e((function(){})),p="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),f=function(e){return e&&e.instanceString&&v(e.instanceString)?e.instanceString():null},g=function(t){return null!=t&&e(t)==c},v=function(t){return null!=t&&e(t)===h},y=function(e){return!w(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},m=function(t){return null!=t&&e(t)===d&&!y(t)&&t.constructor===Object},b=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},x=function(e){return"undefined"===p?void 0:null!=e&&e instanceof HTMLElement},w=function(e){return E(e)||k(e)},E=function(e){return"collection"===f(e)&&e._private.single},k=function(e){return"collection"===f(e)&&!e._private.single},C=function(e){return"core"===f(e)},S=function(e){return"stylesheet"===f(e)},P=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},D=function(t){return function(t){return null!=t&&e(t)===d}(t)&&v(t.then)},T=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},V=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(i))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,a,i,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+L+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(i=c[4])&&((i=parseFloat(i))<0||i>1))return;if(0===r)o=s=l=Math.round(255*a);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,i]}return t}(e)},j={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},q=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a=t||n<0||d&&e-u>=i}function g(){var e=U();if(f(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return d?me(n,i-(e-u)):n}(e))}function v(e){return s=void 0,h&&r?p(e):(r=a=void 0,o)}function y(){var e=U(),n=f(e);if(r=arguments,a=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),c?p(e):o}(l);if(d)return clearTimeout(s),s=setTimeout(g,t),p(l)}return void 0===s&&(s=setTimeout(g,t)),o}return t=ve(t)||0,X(n)&&(c=!!n.leading,i=(d="maxWait"in n)?ye(ve(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=a=s=void 0},y.flush=function(){return void 0===s?o:v(U())},y},xe=l?l.performance:null,we=xe&&xe.now?function(){return xe.now()}:function(){return Date.now()},Ee=function(){if(l){if(l.requestAnimationFrame)return function(e){l.requestAnimationFrame(e)};if(l.mozRequestAnimationFrame)return function(e){l.mozRequestAnimationFrame(e)};if(l.webkitRequestAnimationFrame)return function(e){l.webkitRequestAnimationFrame(e)};if(l.msRequestAnimationFrame)return function(e){l.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(we())}),1e3/60)}}(),ke=function(e){return Ee(e)},Ce=we,Se=9261,Pe=5381,De=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Se;!(t=e.next()).done;)n=65599*n+t.value|0;return n},Te=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Se)+e|0},_e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pe;return(t<<5)+t+e|0},Me=function(e){return 2097152*e[0]+e[1]},Be=function(e,t){return[Te(e[0],t[0]),_e(e[1],t[1])]},Ne=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return De({next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},Qe=function(e){e.splice(0,e.length)},Je=function(e,t,n){return n&&(t=B(n,t)),e[t]},et=function(e,t,n,r){n&&(t=B(n,t)),e[t]=r},tt="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return n(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),nt=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var a=0;a2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&C(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new rt,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==a.position.x&&(a.position.x=0),null==a.position.y&&(a.position.y=0),t.renderedPosition){var i=t.renderedPosition,o=e.pan(),s=e.zoom();a.position={x:(i.x-o.x)/s,y:(i.y-o.y)/s}}var l=[];y(t.classes)?l=t.classes:g(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,a,i,o){var s;if(null==a&&(a=0),null==o&&(o=n),a<0)throw new Error("lo must be non-negative");for(null==i&&(i=e.length);an;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;ig;0<=g?++h:--h)v.push(i(e,r));return v},f=function(e,t,r,a){var i,o,s;for(null==a&&(a=n),i=e[r];r>t&&a(i,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=i},g=function(e,t,r){var a,i,o,s,l;for(null==r&&(r=n),i=e.length,l=t,o=e[t],a=2*t+1;a0;){var C=y.pop(),S=v(C),P=C.id();if(d[P]=S,S!==1/0)for(var D=C.neighborhood().intersect(p),T=0;T0)for(n.unshift(t);c[a];){var i=c[a];n.unshift(i.edge),n.unshift(i.node),a=(r=i.node).id()}return o.spawn(n)}}}},pt={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,i=new Array(a),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===d){for(var E=[],k=a,C=d,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var P=l._private.edges,D=0;DD&&(p[P]=D,m[P]=S,b[P]=w),!a){var T=S*u+C;!a&&p[T]>D&&(p[T]=D,m[T]=C,b[T]=w)}}}for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:i,r=[],a=b(e);;){if(null==a)return t.spawn();var o=m(a),l=o.edge,u=o.pred;if(r.unshift(a[0]),a.same(n)&&r.length>0)break;null!=l&&r.unshift(l),a=u}return s.spawn(r)},hasNegativeWeightCycle:f,negativeWeightCycles:v}}},xt=Math.sqrt(2),wt=function(e,t,n){0===n.length&&Ye("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],i=r[2],o=t[a],s=t[i],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;pr;){var a=Math.floor(Math.random()*t.length);t=wt(a,e,t),n--}return t},kt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var a=n.length,i=r.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/xt);if(!(a<2)){for(var l=[],u=0;u0?1:e<0?-1:0},Mt=function(e,t){return Math.sqrt(Bt(e,t))},Bt=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Nt=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Ot=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Rt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Vt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ft=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var s=a(o,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},jt=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},qt=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},Yt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Xt=function(e,t){return Yt(e,t.x1,t.y1)&&Yt(e,t.x2,t.y2)},Wt=function(e,t,n,r,a,i,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?cn(a,i):u,d=a/2,h=i/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=r-h-o;if((s=rn(e,t,n,r,n-d+c-o,g,n+d-c+o,g,!1)).length>0)return s}if(f){var v=n+d+o;if((s=rn(e,t,n,r,v,r-h+c-o,v,r+h-c+o,!1)).length>0)return s}if(p){var y=r+h+o;if((s=rn(e,t,n,r,n-d+c-o,y,n+d-c+o,y,!1)).length>0)return s}if(f){var m=n-d-o;if((s=rn(e,t,n,r,m,r-h+c-o,m,r+h-c+o,!1)).length>0)return s}var b=n-d+c,x=r-h+c;if((l=tn(e,t,n,r,b,x,c+o)).length>0&&l[0]<=b&&l[1]<=x)return[l[0],l[1]];var w=n+d-c,E=r-h+c;if((l=tn(e,t,n,r,w,E,c+o)).length>0&&l[0]>=w&&l[1]<=E)return[l[0],l[1]];var k=n+d-c,C=r+h-c;if((l=tn(e,t,n,r,k,C,c+o)).length>0&&l[0]>=k&&l[1]>=C)return[l[0],l[1]];var S=n-d+c,P=r+h-c;return(l=tn(e,t,n,r,S,P,c+o)).length>0&&l[0]<=S&&l[1]>=P?[l[0],l[1]]:[]},Ht=function(e,t,n,r,a,i,o){var s=o,l=Math.min(n,a),u=Math.max(n,a),c=Math.min(r,i),d=Math.max(r,i);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Kt=function(e,t,n,r,a,i,o,s,l){var u=Math.min(n,o,a)-l,c=Math.max(n,o,a)+l,d=Math.min(r,s,i)-l,h=Math.max(r,s,i)+l;return!(ec||th)},Gt=function(e,t,n,r,a,i,o,s){var l=[];!function(e,t,n,r,a){var i,o,s,l,u,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),i=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,a[1]=0,d=t/3,i>0?(u=(u=s+Math.sqrt(i))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(i))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),a[0]=-d+u+c,d+=(u+c)/2,a[4]=a[2]=-d,d=Math.sqrt(3)*(-c+u)/2,a[3]=d,a[5]=-d):(a[5]=a[3]=0,0===i?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),a[0]=2*h-d,a[4]=a[2]=-(h+d)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),a[0]=-d+h*Math.cos(l/3),a[2]=-d+h*Math.cos((l+2*Math.PI)/3),a[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+r*r-4*r*i+2*r*s+4*i*i-4*i*s+s*s,9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*r*i-3*r*r-3*r*s-6*i*i+3*i*s,3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*r*r-6*r*i+r*s-r*t+2*i*i+2*i*t-s*t,1*n*a-n*n+n*e-a*e+r*i-r*r+r*t-i*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g=0?pl?(e-a)*(e-a)+(t-i)*(t-i):u-d},Zt=function(e,t,n){for(var r,a,i,o,s=0,l=0;l=e&&e>=i||r<=e&&e<=i))continue;(e-r)/(i-r)*(o-a)+a>t&&s++}return s%2!=0},$t=function(e,t,n,r,a,i,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f0){var g=Jt(c,-l);d=Qt(g)}else d=c;return Zt(e,t,d)},Qt=function(e){for(var t,n,r,a,i,o,s,l,u=new Array(e.length/2),c=0;c=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},nn=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},rn=function(e,t,n,r,a,i,o,s,l){var u=e-a,c=n-e,d=o-a,h=t-i,p=r-t,f=s-i,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?nn(e,n,o)===o?[o,s]:nn(e,n,a)===a?[a,i]:nn(a,o,n)===n?[n,r]:[]:[]},an=function(e,t,n,r,a,i,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==i&&(v=!1),v){for(var y=0;y0){var m=Jt(g,-s);u=Qt(m)}else u=g}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),h[m]>h[v]+w&&(h[m]=h[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),h[m]==h[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E0;){for(var P=n.pop(),D=0;D0&&o.push(n[s]);0!==o.length&&a.push(r.collection(o))}return a}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Bn,o=r,s=0;s=2?On(e,t,n,0,In,An):On(e,t,n,0,zn)},squaredEuclidean:function(e,t,n){return On(e,t,n,0,In)},manhattan:function(e,t,n){return On(e,t,n,0,zn)},max:function(e,t,n){return On(e,t,n,-1/0,Ln)}};function Vn(e,t,n,r,a,i){var o;return o=v(e)?e:Rn[e]||Rn.euclidean,0===t&&v(e)?o(a,i):o(t,n,r,a,i)}Rn["squared-euclidean"]=Rn.squaredEuclidean,Rn.squaredeuclidean=Rn.squaredEuclidean;var Fn=Ze({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),jn=function(e){return Fn(e)},qn=function(e,t,n,r,a){var i="kMedoids"!==a?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Vn(e,r.length,i,(function(e){return r[e](t)}),o,s)},Yn=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},Kn=function(e,t,n){for(var r=0;ra&&(a=t[l][u],i=u);o[i].push(e[l])}for(var c=0;c=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===a.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;vn[g.key][y.key]&&(i=n[g.key][y.key])):"max"===a.linkage?(i=n[f.key][y.key],n[f.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var i=0,o=e.length-1;o>=0;o--){var s=e[o];a?isFinite(s)||(e[o]=-1/0,i++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!=0?e[u+1+i]:(e[u-1+i]+e[u+i])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,a=0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,a=t;ao&&(i=l,o=t[a*e+l])}i>0&&r.push(i)}for(var u=0;u=D?(T=D,D=M,_=B):M>T&&(T=M);for(var N=0;N0?1:0;C[k%u.minIterations*t+R]=V,O+=V}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var F=0,j=0;j0&&r.push(a);return r}(t,i,o),X=function(e,t,n){for(var r=dr(e,t,n),a=0;al&&(s=u,l=c)}n[a]=i[s]}return dr(e,t,n)}(t,r,Y),W={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:a}},vr=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function o(s){if(a.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=a.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),i=i.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:i,components:r}},yr={};[ot,ht,pt,gt,yt,bt,kt,fn,vn,mn,xn,Mn,Jn,sr,pr,{hierholzer:function(e){if(!m(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,a,i=fr(e),o=i.root,s=i.directed,l=this,u=!1;o&&(a=g(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var a=e.indegree(!0),i=e.outdegree(!0),o=a-i,s=i-a;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=l[0].id());var p=function(e){for(var t,n,r,a=e,i=[e];c[a].length;)t=c[a].shift(),n=d[t][0],a!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),a=r):s||a==n||(c[n]=c[n].filter((function(e){return e!=t})),a=n),i.unshift(t),i.unshift(a);return i},f=[],v=[];for(v=p(a);1!=v.length;)0==c[v[0]].length?(f.unshift(l.getElementById(v.shift())),f.unshift(l.getElementById(v.shift()))):v=p(v.shift()).concat(v);for(var y in f.unshift(l.getElementById(v.shift())),c)if(c[y].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:gr,htbc:gr,htb:gr,hopcroftTarjanBiconnectedComponents:gr},{tarjanStronglyConnected:vr,tsc:vr,tscc:vr,tarjanStronglyConnectedComponents:vr}].forEach((function(e){V(yr,e)})); -/*! -Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable -Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) -Licensed under The MIT License (http://opensource.org/licenses/MIT) -*/ -var mr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};mr.prototype={fulfill:function(e){return br(this,1,"fulfillValue",e)},reject:function(e){return br(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new mr;return n.onFulfilled.push(Er(e,r,"fulfill")),n.onRejected.push(Er(t,r,"reject")),xr(n),r.proxy}};var br=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,xr(e)),e},xr=function(e){1===e.state?wr(e,"onFulfilled",e.fulfillValue):2===e.state&&wr(e,"onRejected",e.rejectReason)},wr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var a=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n-1};var da=function(e,t){var n=this.__data__,r=oa(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ha(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){y(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,a=[],i=0,o=n.length;i0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};$a.className=$a.classNames=$a.classes;var Qa={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:z,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Qa.variable="(?:[\\w-.]|(?:\\\\"+Qa.metaChar+"))+",Qa.className="(?:[\\w-]|(?:\\\\"+Qa.metaChar+"))+",Qa.value=Qa.string+"|"+Qa.number,Qa.id=Qa.variable,function(){var e,t,n;for(e=Qa.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Qa.comparatorOp+="|\\!"+t)}();var Ja=0,ei=1,ti=2,ni=3,ri=4,ai=5,ii=6,oi=7,si=8,li=9,ui=10,ci=11,di=12,hi=13,pi=14,fi=15,gi=16,vi=17,yi=18,mi=19,bi=20,xi=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*R(e,t)}(e.selector,t.selector)})),wi=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return We("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return We("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&We("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return g(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(a,i){return a.checks.reduce((function(o,s,l){return o+(i===a&&0===l?"$":"")+function(a,i){var o=a.type,s=a.value;switch(o){case Ja:var l=e(s);return l.substring(0,l.length-1);case ni:var u=a.field,c=a.operator;return"["+u+n(e(c))+t(s)+"]";case ai:var d=a.operator,h=a.field;return"["+e(d)+h+"]";case ri:return"["+a.field+"]";case ii:var p=a.operator;return"[["+a.field+n(e(p))+t(s)+"]]";case oi:return s;case si:return"#"+s;case li:return"."+s;case vi:case fi:return r(a.parent,i)+n(">")+r(a.child,i);case yi:case gi:return r(a.ancestor,i)+" "+r(a.descendant,i);case mi:var f=r(a.left,i),g=r(a.subject,i),v=r(a.right,i);return f+(f.length>0?" ":"")+g+v;case bi:return""}}(s,i)}),"")},a="",i=0;i1&&i=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(a=o||s?""+e:"",i=""+n),u&&(e=a=a.toLowerCase(),n=i=i.toLowerCase()),t){case"*=":r=a.indexOf(i)>=0;break;case"$=":r=a.indexOf(i,a.length-i.length)>=0;break;case"^=":r=0===a.indexOf(i);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=a.shift();t(u),i.add(u.id()),o&&r(a,i,u)}return e}function Fi(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a1&&void 0!==arguments[1])||arguments[1],Fi)},Ri.forEachUp=function(e){return Vi(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ji)},Ri.forEachUpAndDown=function(e){return Vi(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],qi)},Ri.ancestors=Ri.parents,(Ai=Li={data:Ua.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ua.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ua.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ua.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ua.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ua.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Ai.data,Ai.removeAttr=Ai.removeData;var Yi,Xi,Wi=Li,Hi={};function Ki(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;ot})),minIndegree:Gi("indegree",(function(e,t){return et})),minOutdegree:Gi("outdegree",(function(e,t){return et}))}),V(Hi,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},void 0===e?a:a[e]}for(var h=0;h0,y=v;v&&(f=f[0]);var b=y?f.position():{x:0,y:0};void 0!==t?p.position(e,t+b[e]):void 0!==a&&p.position({x:a.x+b.x,y:a.y+b.y})}}else if(!i)return;return this}},Yi.modelPosition=Yi.point=Yi.position,Yi.modelPositions=Yi.points=Yi.positions,Yi.renderedPoint=Yi.renderedPosition,Yi.relativePoint=Yi.relativePosition;var $i,Qi,Ji=Xi;$i=Qi={},Qi.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,s=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}},Qi.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Qi.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,a={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},i=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==i.w&&0!==i.h||((i={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-i.w/2,i.x2=o.x+i.w/2,i.y1=o.y-i.h/2,i.y2=o.y+i.h/2);var s=a.width.left.value;"px"===a.width.left.units&&a.width.val>0&&(s=100*s/a.width.val);var l=a.width.right.value;"px"===a.width.right.units&&a.width.val>0&&(l=100*l/a.width.val);var u=a.height.top.value;"px"===a.height.top.units&&a.height.val>0&&(u=100*u/a.height.val);var c=a.height.bottom.value;"px"===a.height.bottom.units&&a.height.val>0&&(c=100*c/a.height.val);var d=y(a.width.val-i.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(a.height.val-i.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(i.w,i.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(i.w,a.width.val),o.x=(-h+i.x1+i.x2+p)/2,t.autoHeight=Math.max(i.h,a.height.val),o.y=(-g+i.y1+i.y2+v)/2}function y(e,t,n){var r=0,a=0,i=t+n;return e>0&&i>0&&(r=t/i*e,a=n/i*e),{biasDiff:r,biasComplementDiff:a}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},no=function(e,t){return null==t?e:to(e,t.x1,t.y1,t.x2,t.y2)},ro=function(e,t,n){return Je(e,t,n)},ao=function(e,t,n){if(!t.cy().headless()){var r,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,a=o.srcY):"target"===n?(r=o.tgtX,a=o.tgtY):(r=o.midX,a=o.midY);var l=i.arrowBounds=i.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=a-s,u.x2=r+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Vt(u,1),to(e,u.x1,u.y1,u.x2,u.y2)}}},io=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,i=a.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=ro(i,"labelWidth",n),p=ro(i,"labelHeight",n),f=ro(i,"labelX",n),g=ro(i,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=h,S=C/2,P=k/2;if(m)o=f-S,s=f+S,l=g-P,u=g+P;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-P,u=g+P;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var D=n||"main",T=a.labelBounds,_=T[D]=T[D]||{};_.x1=o,_.y1=l,_.x2=s,_.y2=u,_.w=s-o,_.h=u-l;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?ro(a.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(N),I=Math.sin(N),A=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var O=function(e,t){return{x:(e-=A)*z-(t-=L)*I+A,y:e*I+t*z+L}},R=O(o,l),V=O(o,u),F=O(s,l),j=O(s,u);o=Math.min(R.x,V.x,F.x,j.x),s=Math.max(R.x,V.x,F.x,j.x),l=Math.min(R.y,V.y,F.y,j.y),u=Math.max(R.y,V.y,F.y,j.y)}var q=D+"Rot",Y=T[q]=T[q]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,to(e,o,l,s,u),to(a.labelBounds.all,o,l,s,u)}return e}},oo=function(e,t){var n,r,a,i,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=Lt(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,P=e.outerHeight()/2;to(h,n=o-S,a=s-P,r=o+S,i=s+P),c&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var n,r,a,i=t.pstyle("outline-opacity").value,o=t.pstyle("outline-width").value;if(i>0&&o>0){var s=t.pstyle("outline-offset").value,l=t.pstyle("shape").value,u=o+s,c=(e.w+2*u)/e.w,d=(e.h+2*u)/e.h,h=0;["diamond","pentagon","round-triangle"].includes(l)?(c=(e.w+2.4*u)/e.w,h=-u/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(l)?c=(e.w+2.4*u)/e.w:"star"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.6*u)/e.h,h=-u/3.8):"triangle"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.4*u)/e.h,h=-u/1.4):"vee"===l&&(c=(e.w+4.4*u)/e.w,d=(e.h+3.8*u)/e.h,h=.5*-u);var p=e.h*d-e.h,f=e.w*c-e.w;if(Ft(e,[Math.ceil(p/2),Math.ceil(f/2)]),0!==h){var g=(r=0,a=h,{x1:(n=e).x1+r,x2:n.x2+r,y1:n.y1+a,y2:n.y2+a,w:n.w,h:n.h});Ot(e,g)}}}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),a=Math.min(v.srcY,v.midY,v.tgtY),i=Math.max(v.srcY,v.midY,v.tgtY),to(h,n-=k,a-=k,r+=k,i+=k),"haystack"===D){var T=v.haystackPts;if(T&&2===T.length){if(n=T[0].x,a=T[0].y,n>(r=T[1].x)){var _=n;n=r,r=_}if(a>(i=T[1].y)){var M=a;a=i,i=M}to(h,n-k,a-k,r+k,i+k)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){var B;switch(D){case"bezier":case"unbundled-bezier":B=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":B=v.linePts}if(null!=B)for(var N=0;N(r=A.x)){var L=n;n=r,r=L}if((a=I.y)>(i=A.y)){var O=a;a=i,i=O}to(h,n-=k,a-=k,r+=k,i+=k)}if(c&&t.includeEdges&&g&&(ao(h,e,"mid-source"),ao(h,e,"mid-target"),ao(h,e,"source"),ao(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var R=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;to(h,h.x1+R,h.y1+V,h.x2+R,h.y2+V)}var F=p.bodyBounds=p.bodyBounds||{};jt(F,h),Ft(F,y),Vt(F,1),c&&(n=h.x1,r=h.x2,a=h.y1,i=h.y2,to(h,n-E,a-E,r+E,i+E));var j=p.overlayBounds=p.overlayBounds||{};jt(j,h),Ft(j,y),Vt(j,1);var q=p.labelBounds=p.labelBounds||{};null!=q.all?((l=q.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):q.all=Lt(),c&&t.includeLabels&&(t.includeMainLabels&&io(h,e,null),g&&(t.includeSourceLabels&&io(h,e,"source"),t.includeTargetLabels&&io(h,e,"target")))}return h.x1=eo(h.x1),h.y1=eo(h.y1),h.x2=eo(h.x2),h.y2=eo(h.y2),h.w=eo(h.x2-h.x1),h.h=eo(h.y2-h.y1),h.w>0&&h.h>0&&b&&(Ft(h,y),Vt(h,1)),h},so=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:To,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},Mo.removeAllListeners=function(){return this.removeListener("*")},Mo.emit=Mo.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,y(t)||(t=[t]),zo(this,(function(e,i){null!=n&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var o=function(n){var a=r[n];if(a.type===i.type&&(!a.namespace||a.namespace===i.namespace||".*"===a.namespace)&&e.eventMatches(e.context,a,i)){var o=[i];null!=t&&function(e,t){for(var n=0;n1&&!r){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,n.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&g(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,a=0;ar&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,i=0;i=0&&a1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return null!=a?a:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(m(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(g(e)){if(void 0===t){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(void 0===e)for(var i=0;i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),as.neighbourhood=as.neighborhood,as.closedNeighbourhood=as.closedNeighborhood,as.openNeighbourhood=as.openNeighborhood,V(as,{source:Oi((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Oi((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:ls({attr:"source"}),targets:ls({attr:"target"})}),V(as,{edgesWith:Oi(us(),"edgesWith"),edgesTo:Oi(us({thisIsSrc:!0}),"edgesTo")}),V(as,{connectedEdges:Oi((function(e){for(var t=[],n=0;n0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),as.componentsOf=as.components;var ds=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var a=new tt,i=!1;if(t){if(t.length>0&&m(t[0])&&!E(t[0])){i=!0;for(var o=[],s=new rt,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,i=a.cy(),o=i._private,s=[],l=[],u=0,c=a.length;u0){for(var O=e.length===a.length?a:new ds(i,e),R=0;R0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],a={},i=n._private.cy;function o(e){var n=a[e.id()];t&&e.removed()||n||(a[e.id()]=!0,e.isNode()?(r.push(e),function(e){for(var t=e._private.edges,n=0;n0&&(e?E.emitAndNotify("remove"):t&&E.emit("remove"));for(var k=0;k=.001?function(t,r){for(var a=0;a<4;++a){var i=h(r,e,n);if(0===i)return r;r-=(d(r,e,n)-t)/i}return r}(t,o):0===l?o:function(t,r,a){var i,o,s=0;do{(i=d(o=r+(a-r)/2,e,n)-t)>0?a=o:r=o}while(Math.abs(i)>1e-7&&++s<10);return o}(t,r,r+a)}var f=!1;function g(){f=!0,e===t&&n===r||function(){for(var t=0;t<11;++t)s[t]=d(t*a,e,n)}()}var v=function(a){return f||g(),e===t&&n===r?a:0===a?0:1===a?1:d(p(a),t,r)};v.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var y="generateBezier("+[e,t,n,r]+")";return v.toString=function(){return y},v} -/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var gs=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var a={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function n(n,r){var a={dx:n.v,dv:e(n)},i=t(n,.5*r,a),o=t(n,.5*r,i),s=t(n,r,o),l=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),u=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,a){var i,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1e-4;for(t=parseFloat(t)||500,r=parseFloat(r)||20,a=a||null,l.tension=t,l.friction=r,o=(i=null!==a)?(c=e(t,r))/a*.016:.016;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return i?function(e){return u[e*(u.length-1)|0]}:c}}(),vs=function(e,t,n,r){var a=fs(e,t,n,r);return function(e,t,n){return e+(t-e)*a(n)}},ys={linear:function(e,t,n){return e+(t-e)*n},ease:vs(.25,.1,.25,1),"ease-in":vs(.42,0,1,1),"ease-out":vs(0,0,.58,1),"ease-in-out":vs(.42,0,.58,1),"ease-in-sine":vs(.47,0,.745,.715),"ease-out-sine":vs(.39,.575,.565,1),"ease-in-out-sine":vs(.445,.05,.55,.95),"ease-in-quad":vs(.55,.085,.68,.53),"ease-out-quad":vs(.25,.46,.45,.94),"ease-in-out-quad":vs(.455,.03,.515,.955),"ease-in-cubic":vs(.55,.055,.675,.19),"ease-out-cubic":vs(.215,.61,.355,1),"ease-in-out-cubic":vs(.645,.045,.355,1),"ease-in-quart":vs(.895,.03,.685,.22),"ease-out-quart":vs(.165,.84,.44,1),"ease-in-out-quart":vs(.77,0,.175,1),"ease-in-quint":vs(.755,.05,.855,.06),"ease-out-quint":vs(.23,1,.32,1),"ease-in-out-quint":vs(.86,0,.07,1),"ease-in-expo":vs(.95,.05,.795,.035),"ease-out-expo":vs(.19,1,.22,1),"ease-in-out-expo":vs(1,0,0,1),"ease-in-circ":vs(.6,.04,.98,.335),"ease-out-circ":vs(.075,.82,.165,1),"ease-in-out-circ":vs(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return ys.linear;var r=gs(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":vs};function ms(e,t,n,r,a){if(1===r)return n;if(t===n)return n;var i=a(t,n,r);return null==e||((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max&&(i=Math.min(i,e.max))),i}function bs(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function xs(e,t,n,r,a){var i=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var o=bs(e,a),s=bs(t,a);if(b(o)&&b(s))return ms(i,o,s,n,r);if(y(o)&&y(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=ys[d].apply(null,h)):o.easingImpl=ys[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var v=o.startPosition,y=o.position;if(y&&a&&!e.locked()){var m={};Es(v.x,y.x)&&(m.x=xs(v.x,y.x,p,f)),Es(v.y,y.y)&&(m.y=xs(v.y,y.y,p,f)),e.position(m)}var b=o.startPan,x=o.pan,w=i.pan,E=null!=x&&r;E&&(Es(b.x,x.x)&&(w.x=xs(b.x,x.x,p,f)),Es(b.y,x.y)&&(w.y=xs(b.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(Es(k,C)&&(i.zoom=At(i.minZoom,xs(k,C,p,f),i.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&a){for(var D=0;D=0;t--){(0,e[t])()}e.splice(0,e.length)},c=i.length-1;c>=0;c--){var d=i[c],h=d._private;h.stopped?(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||ks(0,d,e),ws(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==i.length||0!==o.length||r.push(t),s}for(var i=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Ss={animate:Ua.animate(),animation:Ua.animation(),animated:Ua.animated(),clearQueue:Ua.clearQueue(),delay:Ua.delay(),delayAnimation:Ua.delayAnimation(),stop:Ua.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){Cs(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&ke((function(n){Cs(n,e),t()}))}()}}},Ps={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&E(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Ds=function(e){return g(e)?new Ni(e):e},Ts={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new _o(Ps,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Ds(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Ds(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Ds(t),n),this},once:function(e,t,n){return this.emitter().one(e,Ds(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Ua.eventAliasesOn(Ts);var _s={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};_s.jpeg=_s.jpg;var Ms={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n,r=e.name,a=t.extension("layout",r);if(null!=a)return n=g(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new a(V({},e,{cy:t,eles:n}));Ye("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ye("A `name` must be specified to make a layout");else Ye("Layout options must be specified to make a layout")}};Ms.createLayout=Ms.makeLayout=Ms.layout;var Bs={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};zs.invalidateDimensions=zs.resize;var Is={collection:function(e,t){return g(e)?this.$(e):w(e)?e.collection():y(e)?(t||(t={}),new ds(this,e,t.unique,t.removed)):new ds(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Is.elements=Is.filter=Is.$;var As={},Ls="t";As.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(h||d&&p){var f=void 0;h&&p||h?f=u.properties:p&&(f=u.mappedProperties);for(var g=0;g1&&(v=1),s.color){var E=a.valueMin[0],k=a.valueMax[0],C=a.valueMin[1],S=a.valueMax[1],P=a.valueMin[2],D=a.valueMax[2],T=null==a.valueMin[3]?1:a.valueMin[3],_=null==a.valueMax[3]?1:a.valueMax[3],M=[Math.round(E+(k-E)*v),Math.round(C+(S-C)*v),Math.round(P+(D-P)*v),Math.round(T+(_-T)*v)];n={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else{if(!s.number)return!1;var B=a.valueMin+(a.valueMax-a.valueMin)*v;n=this.parse(a.name,B,a.bypass,h)}if(!n)return g(),!1;n.mapping=a,a=n;break;case o.data:for(var N=a.field.split("."),z=d.data,I=0;I0&&i>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},As.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],s=a(o);null!=s&&s(n,r)&&i(o)},As.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){a._private.cy.notify("zorder",e)}))},As.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!a.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()})),!a.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},As.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Os={applyBypass:function(e,t,n,r){var a=[];if("*"===t||"**"===t){if(void 0!==n)for(var i=0;it.length?i.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var l=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){We("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=l[0];var u=l[1];if("core"!==u)if(new Ni(u).invalid){We("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),o();continue}var c=l[2],d=!1;n=c;for(var h=[];;){if(n.match(/^\s*$/))break;var p=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){We("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=p[0];var f=p[1],g=p[2];if(this.properties[f])a.parse(f,g)?(h.push({name:f,val:g}),s()):(We("Skipping property: Invalid property definition in: "+r),s());else We("Skipping property: Invalid property name in: "+r),s()}if(d){o();break}a.selector(u);for(var v=0;v=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var p=s.mapData;if(!d.color&&!d.number)return!1;var f=this.parse(e,c[4]);if(!f||f.mapped)return!1;var m=this.parse(e,c[5]);if(!m||m.mapped)return!1;if(f.pfValue===m.pfValue||f.strValue===m.strValue)return We("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(d.color){var x=f.value,w=m.value;if(!(x[0]!==w[0]||x[1]!==w[1]||x[2]!==w[2]||x[3]!==w[3]&&(null!=x[3]&&1!==x[3]||null!=w[3]&&1!==w[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:f.value,valueMax:m.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var E;if(E=l?t.split(/\s+/):y(t)?t:[t],d.evenMultiple&&E.length%2!=0)return null;for(var k=[],C=[],S=[],P="",D=!1,T=0;T0?" ":"")+M.strValue}return d.validate&&!d.validate(k,C)?null:d.singleEnum&&D?1===k.length&&g(k[0])?{name:e,value:k[0],strValue:k[0],bypass:n}:null:{name:e,value:k,pfValue:S,strValue:P,bypass:n,units:C}}var B,N,I=function(){for(var r=0;rd.max||d.strictMax&&t===d.max))return null;var V={name:e,value:t,strValue:""+t+(A||""),units:A,bypass:n};return d.unitless||"px"!==A&&"em"!==A?V.pfValue=t:V.pfValue="px"!==A&&A?this.getEmSizeInPixels()*t:t,"ms"!==A&&"s"!==A||(V.pfValue="ms"===A?t:1e3*t),"deg"!==A&&"rad"!==A||(V.pfValue="rad"===A?t:(B=t,Math.PI*B/180)),"%"===A&&(V.pfValue=t/100),V}if(d.propList){var j=[],q=""+t;if("none"===q);else{for(var Y=q.split(/\s*,\s*|\s+/),X=0;X0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,i=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),b(e)?n=e:m(e)&&(n=e.level,null!=e.position?t=Ct(e.position,i,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;b(l.x)&&(t.pan.x=l.x,o=!1),b(l.y)&&(t.pan.y=l.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(g(e)){var n=e;e=this.mutableElements().filter(n)}else w(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,a=this;return n.sizeCache=n.sizeCache||(r?(e=a.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Ks.centre=Ks.center,Ks.autolockNodes=Ks.autolock,Ks.autoungrabifyNodes=Ks.autoungrabify;var Gs={data:Ua.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ua.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ua.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ua.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Gs.attr=Gs.data,Gs.removeAttr=Gs.removeData;var Us=function(e){var t=this,n=(e=V({},e)).container;n&&!x(n)&&x(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=void 0!==l&&void 0!==n&&!e.headless,o=e;o.layout=V({name:i?"grid":"null"},o.layout),o.renderer=V({name:i?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:o,elements:new ds(this),listeners:[],aniEles:new ds(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?i:o.styleEnabled,zoom:b(o.zoom)?o.zoom:1,pan:{x:m(o.pan)&&b(o.pan.x)?o.pan.x:0,y:m(o.pan)&&b(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});u.styleEnabled&&t.setStyle([]);var c=V({},o,o.renderer);t.initRenderer(c);!function(e,t){if(e.some(D))return Cr.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],i=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(m(e)||y(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var i=V({},t._private.options.layout);i.eles=t.elements(),t.layout(i).run()}(i,(function(){t.startAnimationLoop(),u.ready=!0,v(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=Lt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(w(n.roots))e=n.roots;else if(y(n.roots)){for(var c=[],d=0;d0;){var N=_.shift(),z=T(N,M);if(z)N.outgoers().filter((function(e){return e.isNode()&&a.has(e)})).forEach(B);else if(null===z){We("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var I=0;if(n.avoidOverlap)for(var A=0;A0&&b[0].length<=3?l/2:0),d=2*Math.PI/b[r].length*a;return 0===r&&1===b[0].length&&(c=1),{x:G+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:G+(a+1-(i+1)/2)*o,y:(r+1)*s}})),this};var nl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function rl(e){this.options=V({},nl,e)}rl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o,s=Lt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/i.length:t.sweep)/Math.max(1,i.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(a?1:-1),i=o*Math.cos(r),s=o*Math.sin(r);return{x:l+i,y:u+s}})),this};var al,il={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ol(e){this.options=V({},il,e)}ol.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=Lt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S1&&t.avoidOverlap){var _=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(_*_+M*M));C=Math.max(B,C)}P.r=C,C+=w}if(t.equidistant){for(var N=0,z=0,I=0;I=e.numIter)&&(gl(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&i(),ke(t)):(Dl(r,e),s())}()}else{for(;u;)u=o(l),l++;Dl(r,e),s()}return this},ll.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},ll.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ul=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=Lt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(E);for(u=0;ur.count?0:r.graph},dl=function e(t,n,r,a){var i=a.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*a/(g=Math.sqrt(a*a+i*i)),l=u*i/g;else{var u,c=xl(e,a,i),d=xl(t,-1*a,-1*i),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},bl=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},xl=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=n/t,l=i/o,u={};return 0===t&&0n?(u.x=r,u.y=a+i/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=a-o*n/2/t,u):0=l)?(u.x=r+i*t/2/n,u.y=a+i/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-i*t/2/n,u.y=a-i/2,u):u},wl=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},kl=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],o=e.idToIndex[i],s=e.layoutNodes[o],l=s.children;if(0n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},Pl=function e(t,n){var r=t.parentId;if(null!=r){var a=n.layoutNodes[n.idToIndex[r]],i=!1;return(null==a.maxX||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,i=!0),(null==a.minX||t.minX-a.padLefta.maxY)&&(a.maxY=t.maxY+a.padBottom,i=!0),(null==a.minY||t.minY-a.padTopf&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},Tl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function _l(e){this.options=V({},Tl,e)}_l.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=Lt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,t,(function(e){return{x:i.x1,y:i.y1}}));else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l=o?d(y+1):c(v+1)}var m=i.w/u,b=i.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(B=0,M++)},z={},I=0;I(r=Ut(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===i.edgeType||"multibezier"===i.edgeType||"self"===i.edgeType||"compound"===i.edgeType)for(x=i.allpts,w=0;w+5(r=Gt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||a.source,b=b||a.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:i.arrowStartX,y:i.arrowStartY,angle:i.srcArrowAngle},{name:"target",x:i.arrowEndX,y:i.arrowEndY,angle:i.tgtArrowAngle},{name:"mid-source",x:i.midX,y:i.midY,angle:i.midsrcArrowAngle},{name:"mid-target",x:i.midX,y:i.midY,angle:i.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Je(e,t,n)}function x(n,r){var a,i=n._private,o=f;a=r?r+"-":"",n.boundingBox();var s=i.labelBounds[r||"main"],l=n.pstyle(a+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(i.rscratch,"labelX",r),c=b(i.rscratch,"labelY",r),d=b(i.rscratch,"labelAngle",r),h=n.pstyle(a+"text-margin-x").pfValue,p=n.pstyle(a+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),P=k(y,m),D=k(y,x),T=[C.x+h,C.y+p,P.x+h,P.y+p,D.x+h,D.y+p,S.x+h,S.y+p];if(Zt(e,t,T))return v(n),!0}else if(Yt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var a,i,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=Lt({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p0?-(Math.PI-i.ang):Math.PI+i.ang),lu(t,n,su),Wl=ou.nx*su.ny-ou.ny*su.nx,Hl=ou.nx*su.nx-ou.ny*-su.ny,Ul=Math.asin(Math.max(-1,Math.min(1,Wl))),Math.abs(Ul)<1e-6)return Yl=t.x,Xl=t.y,void($l=Jl=0);Kl=1,Gl=!1,Hl<0?Ul<0?Ul=Math.PI+Ul:(Ul=Math.PI-Ul,Kl=-1,Gl=!0):Ul>0&&(Kl=-1,Gl=!0),Jl=void 0!==t.radius?t.radius:r,Zl=Ul/2,eu=Math.min(ou.len/2,su.len/2),a?(Ql=Math.abs(Math.cos(Zl)*Jl/Math.sin(Zl)))>eu?(Ql=eu,$l=Math.abs(Ql*Math.sin(Zl)/Math.cos(Zl))):$l=Jl:(Ql=Math.min(eu,Jl),$l=Math.abs(Ql*Math.sin(Zl)/Math.cos(Zl))),ru=t.x+su.nx*Ql,au=t.y+su.ny*Ql,Yl=ru-su.ny*$l*Kl,Xl=au+su.nx*$l*Kl,tu=t.x+ou.nx*Ql,nu=t.y+ou.ny*Ql,iu=t};function cu(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function du(e,t,n,r){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(uu(e,t,n,r,a),{cx:Yl,cy:Xl,radius:$l,startX:tu,startY:nu,stopX:ru,stopY:au,startAngle:ou.ang+Math.PI/2*Kl,endAngle:su.ang-Math.PI/2*Kl,counterClockwise:Gl})}var hu={};function pu(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},D=P(C,E),T=P(S,k),_=!1;"auto"===v?g=Math.abs(D)>Math.abs(T)?a:r:v===l||v===s?(g=r,_=!0):v!==i&&v!==o||(g=a,_=!0);var M,B=g===r,N=B?T:D,z=B?S:C,I=_t(z),A=!1;(_&&(m||x)||!(v===s&&z<0||v===l&&z>0||v===i&&z>0||v===o&&z<0)||(N=(I*=-1)*Math.abs(N),A=!0),m)?M=(b<0?1+b:b)*N:M=(b<0?N:0)+b*I;var L=function(e){return Math.abs(e)=Math.abs(N)},O=L(M),R=L(Math.abs(N)-Math.abs(M));if((O||R)&&!A)if(B){var V=Math.abs(z)<=d/2,F=Math.abs(C)<=h/2;if(V){var j=(u.x1+u.x2)/2,q=u.y1,Y=u.y2;n.segpts=[j,q,j,Y]}else if(F){var X=(u.y1+u.y2)/2,W=u.x1,H=u.x2;n.segpts=[W,X,H,X]}else n.segpts=[u.x1,u.y2]}else{var K=Math.abs(z)<=c/2,G=Math.abs(S)<=p/2;if(K){var U=(u.y1+u.y2)/2,Z=u.x1,$=u.x2;n.segpts=[Z,U,$,U]}else if(G){var Q=(u.x1+u.x2)/2,J=u.y1,ee=u.y2;n.segpts=[Q,J,Q,ee]}else n.segpts=[u.x2,u.y1]}else if(B){var te=u.y1+M+(f?d/2*I:0),ne=u.x1,re=u.x2;n.segpts=[ne,te,re,te]}else{var ae=u.x1+M+(f?c/2*I:0),ie=u.y1,oe=u.y2;n.segpts=[ae,ie,ae,oe]}if(n.isRound){var se=e.pstyle("taxi-radius").value,le="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(se),n.isArcRadius=new Array(n.segpts.length/2).fill(le)}},hu.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!b(n.startX)||!b(n.startY),v=!b(n.arrowStartX)||!b(n.arrowStartY),y=!b(n.endX)||!b(n.endY),m=!b(n.arrowEndX)||!b(n.arrowEndY),x=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=Mt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wh.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),x=s.tgtH=h.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(d)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(h)],k=s.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,S=s.tgtRs=h._private.rscratch,P=s.srcRs=d._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D0){var H=u,K=Bt(H,Pt(t)),G=Bt(H,Pt(W)),U=K;if(G2)Bt(H,{x:W[2],y:W[3]})0){var le=c,ue=Bt(le,Pt(t)),ce=Bt(le,Pt(se)),de=ue;if(ce2)Bt(le,{x:se[2],y:se[3]})=u||m){c={cp:g,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-h)/x.length,E=x.t1-x.t0,k=s?x.t0+E*w:x.t1-E*w;k=At(0,k,1),t=It(b.p0,b.p1,b.p2,k),a=function(e,t,n,r){var a=At(0,r-.001,1),i=At(0,r+.001,1),o=It(e,t,n,a),s=It(e,t,n,i);return bu(o,s)}(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var C,S,P,D,T=0,_=r.allpts.length,M=0;M+3<_&&(s?(P={x:r.allpts[M],y:r.allpts[M+1]},D={x:r.allpts[M+2],y:r.allpts[M+3]}):(P={x:r.allpts[_-2-M],y:r.allpts[_-1-M]},D={x:r.allpts[_-4-M],y:r.allpts[_-3-M]}),S=T,!((T+=C=Mt(P,D))>=u));M+=2);var B=(u-S)/C;B=At(0,B,1),t=function(e,t,n,r){var a=t.x-e.x,i=t.y-e.y,o=Mt(e,t),s=a/o,l=i/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(P,D,B),a=bu(P,D)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,a)}};u("source"),u("target"),this.applyLabelDimensions(e)}},yu.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},yu.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),i=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Je(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=a.height/l,c=u*i,d=a.width,h=a.height+(l-1)*(i-1)*u;et(n.rstyle,"labelWidth",t,d),et(n.rscratch,"labelWidth",t,d),et(n.rstyle,"labelHeight",t,h),et(n.rscratch,"labelHeight",t,h),et(n.rscratch,"labelLineHeight",t,c)},yu.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,o=function(e,r){return r?(et(n.rscratch,e,t,r),r):Je(n.rscratch,e,t)};if(!a)return"";"none"==i||("uppercase"==i?a=a.toUpperCase():"lowercase"==i&&(a=a.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c=a.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;gd){var b,x="",w=0,E=s(v.matchAll(f));try{for(E.s();!(b=E.n()).done;){var k=b.value,C=k[0],S=v.substring(w,k.index);w=k.index+C.length;var P=0===x.length?S:x+S+C;this.calculateLabelDimensions(e,P).width<=d?x+=S+C:(x&&p.push(x),x=S+C)}}catch(B){E.e(B)}finally{E.f()}x.match(/^[\s\u200b]+$/)||p.push(x)}else p.push(v)}o("labelWrapCachedLines",p),a=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",u)}else if("ellipsis"===l){var D=e.pstyle("text-max-width").pfValue,T="",_=!1;if(this.calculateLabelDimensions(e,a).widthD)break;T+=a[M],M===a.length-1&&(_=!0)}return _||(T+="…"),T}return a},yu.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},yu.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,a=Ne(t,e._private.labelDimsKey),i=n.labelDimCache||(n.labelDimCache=[]),o=i[a];if(null!=o)return o;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var D=a(t);v&&(e.hoverData.tapholdCancelled=!0);n=!0,r(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T,_=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var M={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};m?m.emit(M):o.emit(M),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var B;if(e.hoverData.justStartedPan){var N=e.hoverData.mdownPos;B={x:(c[0]-N[0])*s,y:(c[1]-N[1])*s},e.hoverData.justStartedPan=!1}else B={x:x[0]*s,y:x[1]*s};o.panBy(B),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&r(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),m)if(v){if(o.boxSelectionEnabled()&&D)m&&m.grabbed()&&(d(w),m.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),w.emit("dragfree"))),_();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var z=!e.dragData.didDrag;z&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var I={x:0,y:0};if(b(x[0])&&b(x[1])&&(I.x+=x[0],I.y+=x[1],z)){var A=e.hoverData.dragDelta;A&&b(A[0])&&b(A[1])&&(I.x+=A[0],I.y+=A[1])}e.hoverData.draggingEles=!0,w.silentShift(I).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else 0===(T=e.hoverData.dragDelta=e.hoverData.dragDelta||[]).length?(T.push(x[0]),T.push(x[1])):(T[0]+=x[0],T[1]+=x[1]);n=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){i(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=Pt(h),e.redrawHint("select",!0),e.redraw())}}else _();m&&m.pannable()&&m.active()&&m.unactivate()}return f[2]=c[0],f[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var i=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=a(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):i.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(f):i.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),x=!1,t.timeStamp-w<=i.multiClickDebounceTime()?(m&&clearTimeout(m),x=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(m=setTimeout((function(){x||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),i.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(i.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=i.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(i.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=i.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===i.selectionType()||h||i.$(n).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var k,C,S,P,D,T,_,M,B,N,z,I,A,L=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),a=n.pan(),i=e.projectIntoViewport(t.clientX,t.clientY),o=[i[0]*r+a.x,i[1]*r+a.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",L,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||L(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var O,R,V,F,j,q,Y,X=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},W=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",O=function(t){if(e.hasTouchStarted=!0,E(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,a=e.touchData.now,i=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);a[0]=o[0],a[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);a[2]=o[0],a[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);a[4]=o[0],a[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var l=e.findContainerClientCoords();B=l[0],N=l[1],z=l[2],I=l[3],k=t.touches[0].clientX-B,C=t.touches[0].clientY-N,S=t.touches[1].clientX-B,P=t.touches[1].clientY-N,A=0<=k&&k<=z&&0<=S&&S<=z&&0<=C&&C<=I&&0<=P&&P<=I;var h=n.pan(),f=n.zoom();D=X(k,C,S,P),T=W(k,C,S,P),M=[((_=[(k+S)/2,(C+P)/2])[0]-h.x)/f,(_[1]-h.y)/f];if(T<4e4&&!t.touches[2]){var g=e.findNearestElement(a[0],a[1],!0,!0),v=e.findNearestElement(a[2],a[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start=v):n.emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(a[0],a[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=n.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(x,{addToList:b})):c(m,{addToList:b}),s(m);var w=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};m.emit(w("grabon")),x?x.forEach((function(e){e.emit(w("grab"))})):m.emit(w("grab"))}r(m,["touchstart","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==m&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:a[0],y:a[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var L=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-B,_=t.touches[0].clientY-N,z=t.touches[1].clientX-B,I=t.touches[1].clientY-N,L=W(w,_,z,I);if(L/T>=2.25||L>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",V=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",F=function(t){var a=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var i=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);u[2]=h[0],u[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);u[4]=h[0],u[5]=h[1]}if(a&&a.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},a?a.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};a?a.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(i[0],i[1],i[2],i[3]));i[0]=void 0,i[1]=void 0,i[2]=void 0,i[3]=void 0,i[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=a&&a.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=a){var v=a._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(a.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(a.emit("dragfreeon"),g.emit("dragfree"))),r(a,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),a.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);r(y,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(a||s.$(":selected").unselect(["tapunselect"]),r(a,["tap","vclick"],t,{x:u[0],y:u[1]}),j=!1,t.timeStamp-Y<=s.multiClickDebounceTime()?(q&&clearTimeout(q),j=!0,Y=null,r(a,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(q=setTimeout((function(){j||r(a,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),Y=t.timeStamp)),null!=a&&!e.dragData.didDrag&&a._private.selectable&&w2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g0)return g[0]}return null},p=Object.keys(d),f=0;f0?u:Wt(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var l=2*(s="auto"===s?cn(r,a):s);if($t(e,t,this.points,i,o,r,a-l,[0,-1],n))return!0;if($t(e,t,this.points,i,o,r-l,a,[0,-1],n))return!0;var u=r/2+2*n,c=a/2+2*n;return!!Zt(e,t,[i-u,o-c,i-u,o,i+u,o,i+u,o-c])||(!!en(e,t,l,l,i+r/2-s,o+a/2-s,n)||!!en(e,t,l,l,i-r/2+s,o+a/2-s,n))}}},Du.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",sn(3,0)),this.generateRoundPolygon("round-triangle",sn(3,0)),this.generatePolygon("rectangle",sn(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",sn(5,0)),this.generateRoundPolygon("round-pentagon",sn(5,0)),this.generatePolygon("hexagon",sn(6,0)),this.generateRoundPolygon("round-hexagon",sn(6,0)),this.generatePolygon("heptagon",sn(7,0)),this.generateRoundPolygon("round-heptagon",sn(7,0)),this.generatePolygon("octagon",sn(8,0)),this.generateRoundPolygon("round-octagon",sn(8,0));var r=new Array(20),a=un(5,0),i=un(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(a){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*Nu)break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!a&&e.shouldRedraw(t,u,d,c)&&r())}),a(t))}}},Iu=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe;t(this,e),this.idsByKey=new tt,this.keyForId=new tt,this.cachesByLvl=new tt,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return n(e,[{key:"getIdsFor",value:function(e){null==e&&Ye("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new rt,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new tt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Au={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Lu=Ze({getKey:null,doesEleInvalidateKey:Fe,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ve,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ou=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Lu(t);V(n,r),n.lookup=new Iu(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Ru=Ou.prototype;Ru.reasons=Au,Ru.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Ru.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Ru.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new ct((function(e,t){return t.reqs-e.reqs}))},Ru.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Ru.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Tt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=i.getTextureQueue(p),v=g[g.length-2],y=function(){return i.recycleTexture(p,d)||i.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)S=i.getElement(e,t,n,D,Au.downscale);P()}else{var T;if(!x&&!w&&!E)for(var _=r-1;_>=-4;_--){var M=l.get(e,_);if(M){T=M;break}}if(b(T))return i.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),i.checkTextureFullness(v),f},Ru.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Ru.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?$e(t,e):e.fullnessChecks++},Ru.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;$e(n,e),e.retired=!0;for(var a=e.eleCaches,i=0;i=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,Qe(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),$e(r,i),n.push(i),i}},Ru.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),i=r[a];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,n.updateItem(i);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),r[a]=o}},Ru.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=i.hasCache(u,s.level);if(r[l]=null,!c){a.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,Au.dequeue)}}return a},Ru.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];null!=a&&(1===a.eles.length?(a.reqs=Re,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},Ru.onDequeue=function(e){this.onDequeues.push(e)},Ru.offDequeue=function(e){$e(this.onDequeues,e)},Ru.setupDequeueing=zu({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},a=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var i=c.length-1;i>=0;i--){var o=c[i];o.invalid&&$e(c,o)}}();var d=function(t){var a=(t=t||{}).after;if(function(){if(!o){o=Lt();for(var t=0;t16e6)return null;var i=r.makeLayer(o,n);if(null!=a){var s=c.indexOf(a)+1;c.splice(s,0,i)}else(void 0===t.insert||t.insert)&&c.unshift(i);return i};if(r.skipping&&!i)return null;for(var h=null,p=e.length/1,f=!i,g=0;g=p||!Xt(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Fu.getEleLevelForLayerLevel=function(e,t){return e},Fu.drawEleInLayer=function(e,t,n,r){var a=this.renderer,i=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(i,!1),a.drawCachedElement(i,t,null,null,n,true),a.setImgSmoothing(i,!0))},Fu.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,a=0;a0)return!1;if(i.invalid)return!1;r+=i.eles.length}return r===t.length},Fu.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Fu.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=Ce(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Fu.invalidateLayer=function(e){if(this.lastInvalidationTime=Ce(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];$e(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!i||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var w=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,k=t.pstyle("ghost-opacity").value,C=y*k;e.translate(w,E),b(C),x(C),e.translate(-w,-E)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"}();a&&o.drawEdgeUnderlay(e,t),b(),x(),a&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},ac=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var a=this,i=a.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||i?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,l[0],l[1],l[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};rc.drawEdgeOverlay=ac("overlay"),rc.drawEdgeUnderlay=ac("underlay"),rc.drawEdgePath=function(e,t,n,r){var a,i=e._private.rscratch,o=t,l=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");i.pathCacheKey&&i.pathCacheKey===h?(a=t=i.pathCache,l=!0):(a=t=new Path2D,i.pathCacheKey=h,i.pathCache=a)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(c),o.lineDashOffset=d;break;case"solid":o.setLineDash([])}if(!l&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+r-i,n),e.quadraticCurveTo(t+r,n,t+r,n+i),e.lineTo(t+r,n+a-i),e.quadraticCurveTo(t+r,n+a,t+r-i,n+a),e.lineTo(t+i,n+a),e.quadraticCurveTo(t,n+a,t,n+a-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath(),o?e.stroke():e.fill()}oc.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(Tt(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(i&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==a?(o.drawText(e,t,null,f,i),t.isEdge()&&(o.drawText(e,t,"source",f,i),o.drawText(e,t,"target",f,i))):o.drawText(e,t,a,f,i),n&&e.translate(p.x1,p.y1)},oc.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},oc.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",a=e.pstyle(r+"text-rotation"),i=Je(n,"labelAngle",t);return"autorotate"===a.strValue?e.isEdge()?i:0:"none"===a.strValue?0:a.pfValue},oc.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=t._private.rscratch,o=a?t.effectiveOpacity():1;if(!a||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Je(i,"labelX",n),c=Je(i,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,p=n?n+"-":"",f=Je(i,"labelWidth",n),g=Je(i,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),u+=v,c+=y,0!==(h=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(h),u=0,c=0),x){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue,S=0===t.pstyle("text-background-shape").strValue.indexOf("round");if(w>0||k>0&&E>0){var P=u-C;switch(b){case"left":P-=f;break;case"center":P-=f/2}var D=c-g-C,T=f+2*C,_=g+2*C;if(w>0){var M=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+w*o+")",S?sc(e,P,D,T,_,2):e.fillRect(P,D,T,_),e.fillStyle=M}if(k>0&&E>0){var N=e.strokeStyle,z=e.lineWidth,I=t.pstyle("text-border-color").value,A=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*o+")",e.lineWidth=k,e.setLineDash)switch(A){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(S?sc(e,P,D,T,_,2,"stroke"):e.strokeRect(P,D,T,_),"double"===A){var L=k/2;S?sc(e,P+L,D+L,T-2*L,_-2*L,2,"stroke"):e.strokeRect(P+L,D+L,T-2*L,_-2*L)}e.setLineDash&&e.setLineDash([]),e.lineWidth=z,e.strokeStyle=N}}var O=2*t.pstyle("text-outline-width").pfValue;if(O>0&&(e.lineWidth=O),"wrap"===t.pstyle("text-wrap").value){var R=Je(i,"labelWrapCachedLines",n),V=Je(i,"labelLineHeight",n),F=f/2,j=this.getLabelJustification(t);switch("auto"===j||("left"===b?"left"===j?u+=-f:"center"===j&&(u+=-F):"center"===b?"left"===j?u+=-F:"right"===j&&(u+=F):"right"===b&&("center"===j?u+=F:"right"===j&&(u+=f))),x){case"top":case"center":case"bottom":c-=(R.length-1)*V}for(var q=0;q0&&e.strokeText(R[q],u,c),e.fillText(R[q],u,c),c+=V}else O>0&&e.strokeText(d,u,c),e.fillText(d,u,c);0!==h&&(e.rotate(-h),e.translate(-s,-l))}}};var lc={drawNode:function(e,t,n){var r,a,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(b(d.x)&&b(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,a=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image").value,x=new Array(m.length),w=new Array(m.length),E=0,k=0;k0&&void 0!==arguments[0]?arguments[0]:T;l.eleFillStyle(e,t,n)},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L;l.colorStrokeStyle(e,_[0],_[1],_[2],t)},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:F;l.colorStrokeStyle(e,R[0],R[1],R[2],t)},H=function(e,t,n,r){var a,i=l.nodePathCache=l.nodePathCache||[],o=ze("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+q),s=i[o],u=!1;return null!=s?(a=s,u=!0,c.pathCache=a):(a=new Path2D,i[o]=c.pathCache=a),{path:a,cacheHit:u}},K=t.pstyle("shape").strValue,G=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var U=H(r,a,K,G);h=U.path,v=U.cacheHit}var Z=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,a,q,c)}g?e.fill(h):e.fill()},$=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=u.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,i),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,q,c)))},J=function(){var t=(P>0?P:-P)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:f),n=P>0?0:255;0!==P&&(l.colorFillStyle(e,n,n,n,t),g?e.fill(h):e.fill())},ee=function(){if(D>0){if(e.lineWidth=D,e.lineCap=N,e.lineJoin=B,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(I),e.lineDashOffset=A;break;case"solid":case"double":e.setLineDash([])}if("center"!==z){if(e.save(),e.lineWidth*=2,"inside"===z)g?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-D,-a/2-D,r+2*D,a+2*D),t.addPath(h),e.clip(t,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if("double"===M){e.lineWidth=D/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},te=function(){if(O>0){if(e.lineWidth=O,e.lineCap="butt",e.setLineDash)switch(V){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;g&&(n={x:0,y:0});var i=l.getNodeShape(t),o=D;"inside"===z&&(o=0),"outside"===z&&(o*=2);var s,u=(r+o+(O+j))/r,c=(a+o+(O+j))/a,h=r*u,p=a*c,f=l.nodeShapes[i].points;if(g)s=H(h,p,i,f).path;if("ellipse"===i)l.drawEllipsePath(s||e,n.x,n.y,h,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(i)){var v=0,y=0,m=0;"round-diamond"===i?v=1.4*(o+j+O):"round-heptagon"===i?(v=1.075*(o+j+O),m=-(o/2+j+O)/35):"round-hexagon"===i?v=1.12*(o+j+O):"round-pentagon"===i?(v=1.13*(o+j+O),m=-(o/2+j+O)/15):"round-tag"===i?(v=1.12*(o+j+O),y=.07*(o/2+O+j)):"round-triangle"===i&&(v=(o+j+O)*(Math.PI/2),m=-(o+j/2+O)/Math.PI),0!==v&&(h=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(i)||(p=a*(c=(a+v)/a)));for(var b=h/2,x=p/2,w=(q="auto"===q?dn(h,p):q)+(o+O+j)/2,E=new Array(f.length/2),k=new Array(f.length/2),C=0;C0){if(r=r||n.position(),null==a||null==i){var d=n.padding();a=n.width()+2*d,i=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,a+2*o,i+2*o,c),t.fill()}}}};lc.drawNodeOverlay=uc("overlay"),lc.drawNodeUnderlay=uc("underlay"),lc.hasPie=function(e){return(e=e[0])._private.hasPie},lc.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===i.units?c*=i.pfValue:void 0!==i.pfValue&&(c=i.pfValue/2);for(var h=1;h<=a.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var cc={};cc.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},cc.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,a=0;ao.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==a?a:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),i&&(E=i),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function P(e,t,n,r,a){var i=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,a),e.globalCompositeOperation=i}function D(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),i&&e.translate(i.x,i.y),a&&e.scale(a,a)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?P(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height);b=l.zoom();D(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var z=l.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&I,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.nondrag,s,z):o.drawLayeredElements(_,S.nondrag,s,z),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])){O=h&&!L[o.DRAG]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.drag,s,z):o.drawCachedElements(_,S.drag,s,z),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(D(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var dc={drawPolygonPath:function(e,t,n,r,a,i){var o=r/2,s=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*i[0],n+s*i[1]);for(var l=1;l0&&i>0){h.clearRect(0,0,a,i),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,i),h.fill())}return d},mc.png=function(e){return xc(e,this.bufferCanvasImage(e),"image/png")},mc.jpg=function(e){return xc(e,this.bufferCanvasImage(e),"image/jpeg")};var wc={nodeShapeImpl:function(e,t,n,r,a,i,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,s);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}}},Ec=Cc,kc=Cc.prototype;function Cc(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(kc.CANVAS_LAYERS),contexts:new Array(kc.CANVAS_LAYERS),canvasNeedsRedraw:new Array(kc.CANVAS_LAYERS),bufferCanvases:new Array(kc.BUFFER_COUNT),bufferContexts:new Array(kc.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};u&&u.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l!?|\/]/;function d(e,t){var n,i=e.next();if(s[i]){var d=s[i](e,t);if(!1!==d)return d}if('"'==i||"'"==i||"`"==i)return t.tokenize=(n=i,function(e,t){for(var r,i=!1,o=!1;null!=(r=e.next());){if(r==n&&!i){o=!0;break}i=!i&&"\\"==r}return(o||!i&&!c)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(i))return r=i,null;if(/\d/.test(i))return e.eatWhile(/[\w\.]/),"number";if("/"==i){if(e.eat("+"))return t.tokenize=p,p(e,t);if(e.eat("*"))return t.tokenize=m,m(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(f.test(i))return e.eatWhile(f),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var y=e.current();return o.propertyIsEnumerable(y)?(l.propertyIsEnumerable(y)&&(r="newstatement"),"keyword"):a.propertyIsEnumerable(y)?(l.propertyIsEnumerable(y)&&(r="newstatement"),"builtin"):u.propertyIsEnumerable(y)?"atom":"variable"}function m(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function p(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="+"==n}return"comment"}function y(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function h(e,t,n){var r=e.indented;return e.context&&"statement"==e.context.type&&(r=e.context.indented),e.context=new y(r,t,n,null,e.context)}function b(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}const k={name:"d",startState:function(e){return{tokenize:null,context:new y(-e,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;r=null;var i=(t.tokenize||d)(e,t);if("comment"==i||"meta"==i)return i;if(null==n.align&&(n.align=!0),";"!=r&&":"!=r&&","!=r||"statement"!=n.type)if("{"==r)h(t,e.column(),"}");else if("["==r)h(t,e.column(),"]");else if("("==r)h(t,e.column(),")");else if("}"==r){for(;"statement"==n.type;)n=b(t);for("}"==n.type&&(n=b(t));"statement"==n.type;)n=b(t)}else r==n.type?b(t):(("}"==n.type||"top"==n.type)&&";"!=r||"statement"==n.type&&"newstatement"==r)&&h(t,e.column(),"statement");else b(t);return t.startOfLine=!1,i},indent:function(e,t,n){if(e.tokenize!=d&&null!=e.tokenize)return null;var r=e.context,o=t&&t.charAt(0);"statement"==r.type&&"}"==o&&(r=r.prev);var a=o==r.type;return"statement"==r.type?r.indented+("{"==o?0:i||n.unit):r.align?r.column+(a?0:1):r.indented+(a?0:n.unit)},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}};export{k as d}; diff --git a/docs/assets/dagre-OKDRZEBW-Cab55Kbx.js b/docs/assets/dagre-OKDRZEBW-Cab55Kbx.js deleted file mode 100644 index ba0b443..0000000 --- a/docs/assets/dagre-OKDRZEBW-Cab55Kbx.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e,aa as n,ab as t,ac as r,ad as a,l as i,c as o,ae as s,af as d,$ as c,a4 as l,a0 as g,Y as f,ag as p,ah as u,ai as h}from"./mermaid-BGnxfgCD.js";import{G as w}from"./graph-D2OIoTg6.js";import{l as v}from"./layout-D5y2-fEf.js";import{i as m}from"./_baseUniq-BlNMZyiw.js";import{c as y}from"./clone-DZLovMrS.js";import{m as X}from"./min-DUpp_rh3.js";import"./index-D3XtisvU.js";import"./transform-DjHZbYKP.js";import"./timer-DFzT7np-.js";import"./step-BwsUM5iJ.js";import"./_baseEach-DHNYGtOc.js";import"./sortBy-CK8BMETd.js";import"./_baseMap-BXW0_SVK.js";function b(e){var n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:E(e),edges:N(e)};return m(e.graph())||(n.value=y(e.graph())),n}function E(e){return X(e.nodes(),(function(n){var t=e.node(n),r=e.parent(n),a={v:n};return m(t)||(a.value=t),m(r)||(a.parent=r),a}))}function N(e){return X(e.edges(),(function(n){var t=e.edge(n),r={v:n.v,w:n.w};return m(n.name)||(r.name=n.name),m(t)||(r.value=t),r}))}var C=new Map,x=new Map,S=new Map,I=e((()=>{x.clear(),S.clear(),C.clear()}),"clear"),D=e(((e,n)=>{const t=x.get(n)||[];return i.trace("In isDescendant",n," ",e," = ",t.includes(e)),t.includes(e)}),"isDescendant"),O=e(((e,n)=>{const t=x.get(n)||[];return i.info("Descendants of ",n," is ",t),i.info("Edge is ",e),e.v!==n&&e.w!==n&&(t?t.includes(e.v)||D(e.v,n)||D(e.w,n)||t.includes(e.w):(i.debug("Tilt, ",n,",not in descendants"),!1))}),"edgeInCluster"),j=e(((e,n,t,r)=>{i.warn("Copying children of ",e,"root",r,"data",n.node(e),r);const a=n.children(e)||[];e!==r&&a.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",a),a.forEach((a=>{if(n.children(a).length>0)j(a,n,t,r);else{const o=n.node(a);i.info("cp ",a," to ",r," with parent ",e),t.setNode(a,o),r!==n.parent(a)&&(i.warn("Setting parent",a,n.parent(a)),t.setParent(a,n.parent(a))),e!==r&&a!==e?(i.debug("Setting parent",a,e),t.setParent(a,e)):(i.info("In copy ",e,"root",r,"data",n.node(e),r),i.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));const s=n.edges(a);i.debug("Copying Edges",s),s.forEach((a=>{i.info("Edge",a);const o=n.edge(a.v,a.w,a.name);i.info("Edge data",o,r);try{O(a,r)?(i.info("Copying as ",a.v,a.w,o,a.name),t.setEdge(a.v,a.w,o,a.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",a.v,"--\x3e",a.w," rootId: ",r," clusterId:",e)}catch(s){i.error(s)}}))}i.debug("Removing node",a),n.removeNode(a)}))}),"copy"),G=e(((e,n)=>{const t=n.children(e);let r=[...t];for(const a of t)S.set(a,e),r=[...r,...G(a,n)];return r}),"extractDescendants"),k=e(((e,n,t)=>{const r=e.edges().filter((e=>e.v===n||e.w===n)),a=e.edges().filter((e=>e.v===t||e.w===t)),i=r.map((e=>({v:e.v===n?t:e.v,w:e.w===n?n:e.w}))),o=a.map((e=>({v:e.v,w:e.w})));return i.filter((e=>o.some((n=>e.v===n.v&&e.w===n.w))))}),"findCommonEdges"),B=e(((e,n,t)=>{const r=n.children(e);if(i.trace("Searching children of id ",e,r),r.length<1)return e;let a;for(const i of r){const e=B(i,n,t),r=k(n,t,e);if(e){if(!(r.length>0))return e;a=e}}return a}),"findNonClusterChild"),P=e((e=>C.has(e)&&C.get(e).externalConnections&&C.has(e)?C.get(e).id:e),"getAnchorId"),J=e(((e,n)=>{if(!e||n>10)i.debug("Opting out, no graph ");else{i.debug("Opting in, graph "),e.nodes().forEach((function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",B(n,e,n)),x.set(n,G(n,e)),C.set(n,{id:B(n,e,n),clusterData:e.node(n)}))})),e.nodes().forEach((function(n){const t=e.children(n),r=e.edges();t.length>0?(i.debug("Cluster identified",n,x),r.forEach((e=>{D(e.v,n)^D(e.w,n)&&(i.warn("Edge: ",e," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",x.get(n)),C.get(n).externalConnections=!0)}))):i.debug("Not a cluster ",n,x)}));for(let n of C.keys()){const t=C.get(n).id,r=e.parent(t);r!==n&&C.has(r)&&!C.get(r).externalConnections&&(C.get(n).id=r)}e.edges().forEach((function(n){const t=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let r=n.v,a=n.w;if(i.warn("Fix XXX",C,"ids:",n.v,n.w,"Translating: ",C.get(n.v)," --- ",C.get(n.w)),C.get(n.v)||C.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),r=P(n.v),a=P(n.w),e.removeEdge(n.v,n.w,n.name),r!==n.v){const a=e.parent(r);C.get(a).externalConnections=!0,t.fromCluster=n.v}if(a!==n.w){const r=e.parent(a);C.get(r).externalConnections=!0,t.toCluster=n.w}i.warn("Fix Replacing with XXX",r,a,n.name),e.setEdge(r,a,t,n.name)}})),i.warn("Adjusted Graph",b(e)),T(e,0),i.trace(C)}}),"adjustClustersAndEdges"),T=e(((e,n)=>{var t,r;if(i.warn("extractor - ",n,b(e),e.children("D")),n>10)return void i.error("Bailing out");let a=e.nodes(),o=!1;for(const i of a){const n=e.children(i);o=o||n.length>0}if(o){i.debug("Nodes = ",a,n);for(const o of a)if(i.debug("Extracting node",o,C,C.has(o)&&!C.get(o).externalConnections,!e.parent(o),e.node(o),e.children("D")," Depth ",n),C.has(o))if(!C.get(o).externalConnections&&e.children(o)&&e.children(o).length>0){i.warn("Cluster without external connections, without a parent and with children",o,n);let a="TB"===e.graph().rankdir?"LR":"TB";(null==(r=null==(t=C.get(o))?void 0:t.clusterData)?void 0:r.dir)&&(a=C.get(o).clusterData.dir,i.warn("Fixing dir",C.get(o).clusterData.dir,a));const s=new w({multigraph:!0,compound:!0}).setGraph({rankdir:a,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}}));i.warn("Old graph before copy",b(e)),j(o,e,s,o),e.setNode(o,{clusterNode:!0,id:o,clusterData:C.get(o).clusterData,label:C.get(o).label,graph:s}),i.warn("New graph after copy node: (",o,")",b(s)),i.debug("Old graph after copy",b(e))}else i.warn("Cluster ** ",o," **not meeting the criteria !externalConnections:",!C.get(o).externalConnections," no parent: ",!e.parent(o)," children ",e.children(o)&&e.children(o).length>0,e.children("D"),n),i.debug(C);else i.debug("Not a cluster",o,n);a=e.nodes(),i.warn("New list of nodes",a);for(const t of a){const r=e.node(t);i.warn(" Now next level",t,r),(null==r?void 0:r.clusterNode)&&T(r.graph,n+1)}}else i.debug("Done, no node has children",e.nodes())}),"extractor"),A=e(((e,n)=>{if(0===n.length)return[];let t=Object.assign([],n);return n.forEach((n=>{const r=e.children(n),a=A(e,r);t=[...t,...a]})),t}),"sorter"),R=e((e=>A(e,e.children())),"sortNodesByHierarchy"),M=e((async(n,t,r,a,o,w)=>{i.warn("Graph in recursive render:XAX",b(t),o);const m=t.graph().rankdir;i.trace("Dir in recursive render - dir:",m);const y=n.insert("g").attr("class","root");t.nodes()?i.info("Recursive render XXX",t.nodes()):i.info("No nodes found for",t),t.edges().length>0&&i.info("Recursive edges",t.edge(t.edges()[0]));const X=y.insert("g").attr("class","clusters"),E=y.insert("g").attr("class","edgePaths"),N=y.insert("g").attr("class","edgeLabels"),x=y.insert("g").attr("class","nodes");await Promise.all(t.nodes().map((async function(e){const n=t.node(e);if(void 0!==o){const n=JSON.parse(JSON.stringify(o.clusterData));i.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",n.height,"\nParent cluster",o.height),t.setNode(o.id,n),t.parent(e)||(i.trace("Setting parent",e,o.id),t.setParent(e,o.id,n))}if(i.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),null==n?void 0:n.clusterNode){i.info("Cluster identified XBX",e,n.width,t.node(e));const{ranksep:o,nodesep:c}=t.graph();n.graph.setGraph({...n.graph.graph(),ranksep:o+25,nodesep:c});const l=await M(x,n.graph,r,a,t.node(e),w),g=l.elem;s(n,g),n.diff=l.diff||0,i.info("New compound node after recursive render XAX",e,"width",n.width,"height",n.height),d(g,n)}else t.children(e).length>0?(i.trace("Cluster - the non recursive path XBX",e,n.id,n,n.width,"Graph:",t),i.trace(B(n.id,t)),C.set(n.id,{id:B(n.id,t),node:n})):(i.trace("Node - the non recursive path XAX",e,x,t.node(e),m),await c(x,t.node(e),{config:w,dir:m}))})));const S=e((async()=>{const e=t.edges().map((async function(e){const n=t.edge(e.v,e.w,e.name);i.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),i.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),i.info("Fix",C,"ids:",e.v,e.w,"Translating: ",C.get(e.v),C.get(e.w)),await h(N,n)}));await Promise.all(e)}),"processEdges");await S(),i.info("Graph before layout:",JSON.stringify(b(t))),i.info("############################################# XXX"),i.info("### Layout ### XXX"),i.info("############################################# XXX"),v(t),i.info("Graph after layout:",JSON.stringify(b(t)));let I=0,{subGraphTitleTotalMargin:D}=l(w);return await Promise.all(R(t).map((async function(e){var n;const r=t.node(e);if(i.info("Position XBX => "+e+": ("+r.x,","+r.y,") width: ",r.width," height: ",r.height),null==r?void 0:r.clusterNode)r.y+=D,i.info("A tainted cluster node XBX1",e,r.id,r.width,r.height,r.x,r.y,t.parent(e)),C.get(r.id).node=r,g(r);else if(t.children(e).length>0){i.info("A pure cluster node XBX1",e,r.id,r.x,r.y,r.width,r.height,t.parent(e)),r.height+=D,t.node(r.parentId);const a=(null==r?void 0:r.padding)/2||0,o=(null==(n=null==r?void 0:r.labelBBox)?void 0:n.height)||0,s=o-a||0;i.debug("OffsetY",s,"labelHeight",o,"halfPadding",a),await f(X,r),C.get(r.id).node=r}else{const e=t.node(r.parentId);r.y+=D/2,i.info("A regular node XBX1 - using the padding",r.id,"parent",r.parentId,r.width,r.height,r.x,r.y,"offsetY",r.offsetY,"parent",e,null==e?void 0:e.offsetY,r),g(r)}}))),t.edges().forEach((function(e){const n=t.edge(e);i.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(n),n),n.points.forEach((e=>e.y+=D/2));const o=t.node(e.v);var s=t.node(e.w);const d=p(E,n,C,r,o,s,a);u(n,d)})),t.nodes().forEach((function(e){const n=t.node(e);i.info(e,n.type,n.diff),n.isGroup&&(I=n.diff)})),i.warn("Returning from recursive render XAX",y,I),{elem:y,diff:I}}),"recursiveRender"),F=e((async(e,s)=>{var d,c,l,g,f,p;const u=new w({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:(null==(d=e.config)?void 0:d.nodeSpacing)||(null==(l=null==(c=e.config)?void 0:c.flowchart)?void 0:l.nodeSpacing)||e.nodeSpacing,ranksep:(null==(g=e.config)?void 0:g.rankSpacing)||(null==(p=null==(f=e.config)?void 0:f.flowchart)?void 0:p.rankSpacing)||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel((function(){return{}})),h=s.select("g");n(h,e.markers,e.type,e.diagramId),t(),r(),a(),I(),e.nodes.forEach((e=>{u.setNode(e.id,{...e}),e.parentId&&u.setParent(e.id,e.parentId)})),i.debug("Edges:",e.edges),e.edges.forEach((e=>{if(e.start===e.end){const n=e.start,t=n+"---"+n+"---1",r=n+"---"+n+"---2",a=u.node(n);u.setNode(t,{domId:t,id:t,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),u.setParent(t,a.parentId),u.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),u.setParent(r,a.parentId);const i=structuredClone(e),o=structuredClone(e),s=structuredClone(e);i.label="",i.arrowTypeEnd="none",i.id=n+"-cyclic-special-1",o.arrowTypeStart="none",o.arrowTypeEnd="none",o.id=n+"-cyclic-special-mid",s.label="",a.isGroup&&(i.fromCluster=n,s.toCluster=n),s.id=n+"-cyclic-special-2",s.arrowTypeStart="none",u.setEdge(n,t,i,n+"-cyclic-special-0"),u.setEdge(t,r,o,n+"-cyclic-special-1"),u.setEdge(r,n,s,n+"-cyci.forEach((i=>{if(!s.has(i))return;const o=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming((()=>i(e))):()=>i(e);t?this.dispatchAsync(o):o()})),o=this.getListeners(i,t,!1)??new Set,n=new Set(o);n.size>0&&s(n,o);new Set(t?this.globalAsyncListeners:this.globalSyncListeners).forEach((s=>{const o=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming((()=>s(i,e))):()=>s(i,e);t?this.dispatchAsync(o):o()}))}dispatchAsync(e){if(this.asyncFunctionsQueue.push(e),!this.scheduled){const e=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)};this.frameworkOverrides?this.frameworkOverrides.wrapIncoming(e):e(),this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;const e=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[],e.forEach((e=>e()))}},u=(e=>(e.CommunityCoreModule="@ag-grid-community/core",e.InfiniteRowModelModule="@ag-grid-community/infinite-row-model",e.ClientSideRowModelModule="@ag-grid-community/client-side-row-model",e.CsvExportModule="@ag-grid-community/csv-export",e.EnterpriseCoreModule="@ag-grid-enterprise/core",e.RowGroupingModule="@ag-grid-enterprise/row-grouping",e.ColumnsToolPanelModule="@ag-grid-enterprise/column-tool-panel",e.FiltersToolPanelModule="@ag-grid-enterprise/filter-tool-panel",e.MenuModule="@ag-grid-enterprise/menu",e.SetFilterModule="@ag-grid-enterprise/set-filter",e.MultiFilterModule="@ag-grid-enterprise/multi-filter",e.StatusBarModule="@ag-grid-enterprise/status-bar",e.SideBarModule="@ag-grid-enterprise/side-bar",e.RangeSelectionModule="@ag-grid-enterprise/range-selection",e.MasterDetailModule="@ag-grid-enterprise/master-detail",e.RichSelectModule="@ag-grid-enterprise/rich-select",e.GridChartsModule="@ag-grid-enterprise/charts",e.ViewportRowModelModule="@ag-grid-enterprise/viewport-row-model",e.ServerSideRowModelModule="@ag-grid-enterprise/server-side-row-model",e.ExcelExportModule="@ag-grid-enterprise/excel-export",e.ClipboardModule="@ag-grid-enterprise/clipboard",e.SparklinesModule="@ag-grid-enterprise/sparklines",e.AdvancedFilterModule="@ag-grid-enterprise/advanced-filter",e.AngularModule="@ag-grid-community/angular",e.ReactModule="@ag-grid-community/react",e.VueModule="@ag-grid-community/vue",e))(u||{}),c={};function g(e,t){c[t]||(e(),c[t]=!0)}function p(e,...t){console.log("AG Grid: "+e,...t)}function m(e,...t){g((()=>console.warn("AG Grid: "+e,...t)),e+(null==t?void 0:t.join("")))}function v(e,...t){g((()=>console.error("AG Grid: "+e,...t)),e+(null==t?void 0:t.join("")))}function C(e){return!!(e&&e.constructor&&e.call&&e.apply)}function f(e){!function(e,t=0){e.length>0&&window.setTimeout((()=>e.forEach((e=>e()))),t)}(e,400)}var w=[],S=!1;function y(e){w.push(e),S||(S=!0,window.setTimeout((()=>{const e=w.slice();w.length=0,S=!1,e.forEach((e=>e()))}),0))}function b(e,t){let i;return function(...s){const o=this;window.clearTimeout(i),i=window.setTimeout((function(){e.apply(o,s)}),t)}}function R(e,t){let i=0;return function(...s){const o=(new Date).getTime();o-it?1:et.push(e))),t}return Object.values(e)}function O(e,t){return e.get("rowModelType")===t}function G(e){return O(e,"clientSide")}function N(e){return O(e,"serverSide")}function H(e,t){return e.get("domLayout")===t}function B(e){return void 0!==pe(e)}function V(e){return!e.get("suppressAsyncEvents")}function W(e){return"function"==typeof e.get("getRowHeight")}function z(e,t,i=!1,s){if(null==s&&(s=e.environment.getDefaultRowHeight()),W(e)){if(i)return{height:s,estimated:!0};const o={node:t,data:t.data},n=e.getCallback("getRowHeight")(o);if(K(n))return 0===n&&m("The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead."),{height:Math.max(1,n),estimated:!1}}if(t.detail&&e.get("masterDetail"))return function(e){if(e.get("detailRowAutoHeight"))return{height:1,estimated:!1};const t=e.get("detailRowHeight");if(K(t))return{height:t,estimated:!1};return{height:300,estimated:!1}}(e);const o=e.get("rowHeight");return{height:o&&K(o)?o:s,estimated:!1}}function U(e){const{environment:t}=e,i=e.get("rowHeight");if(!i||D(i))return t.getDefaultRowHeight();const s=t.refreshRowHeightVariable();return-1!==s?s:(m("row height must be a number if not using standard row model"),t.getDefaultRowHeight())}function K(e){return!isNaN(e)&&"number"==typeof e&&isFinite(e)}function _(e,t,i){const s=t[e.getDomDataKey()];return s?s[i]:void 0}function $(e,t,i,s){const o=e.getDomDataKey();let n=t[o];D(n)&&(n={},t[o]=n),n[i]=s}function j(e){let t=null;const i=e.get("getDocument");return i&&P(i)?t=i():e.eGridDiv&&(t=e.eGridDiv.ownerDocument),t&&P(t)?t:document}function q(e){return j(e).defaultView||window}function Q(e){return e.eGridDiv.getRootNode()}function Y(e){return Q(e).activeElement}function X(e){const t=j(e),i=Y(e);return null===i||i===t.body}function J(e){return!e.get("ensureDomOrder")&&e.get("animateRows")}function Z(e){return!(e.get("paginateChildRows")||e.get("groupHideOpenParents")||H(e,"print"))}function ee(e){const t=e.get("autoGroupColumnDef");return!(null==t?void 0:t.comparator)&&!e.get("treeData")}function te(e){const t=e.get("groupAggFiltering");return"function"==typeof t?e.getCallback("groupAggFiltering"):!0===t?()=>!0:void 0}function ie(e){const t=e.get("grandTotalRow");if(t)return t;return e.get("groupIncludeTotalFooter")?"bottom":void 0}function se(e){const t=e.get("groupTotalRow");if("function"==typeof t)return e.getCallback("groupTotalRow");if(t)return()=>t;const i=e.get("groupIncludeFooter");if("function"==typeof i){const t=e.getCallback("groupIncludeFooter");return e=>t(e)?"bottom":void 0}return()=>i?"bottom":void 0}function oe(e){return e.exists("groupDisplayType")?"multipleColumns"===e.get("groupDisplayType"):e.get("groupHideOpenParents")}function ne(e,t){return!t&&"groupRows"===e.get("groupDisplayType")}function re(e){const t=e.getCallback("getRowId");return void 0===t?t:e=>{let i=t(e);return"string"!=typeof i&&(m("The getRowId callback must return a string. The ID ",i," is being cast to a string."),i=String(i)),i}}function le(e){return(null==e?void 0:e.checkboxes)??!0}function ae(e){return"multiRow"===(null==e?void 0:e.mode)&&(e.headerCheckbox??!0)}function de(e){const t=e.get("cellSelection");return void 0!==t?!!t:e.get("enableRangeSelection")}function he(e){var t;const i=e.get("cellSelection");return void 0!==i?"boolean"!=typeof i&&"fill"===(null==(t=i.handle)?void 0:t.mode):e.get("enableFillHandle")}function ue(e){const t=e.get("rowSelection")??"single";if("string"==typeof t){const t=e.get("suppressRowClickSelection"),i=e.get("suppressRowDeselection");return(!t||!i)&&(t?"enableDeselection":!i||"enableSelection")}return("singleRow"===t.mode||"multiRow"===t.mode)&&(t.enableClickSelection??!1)}function ce(e){const t=ue(e);return!0===t||"enableDeselection"===t}function ge(e){const t=e.get("rowSelection");return"string"==typeof t?e.get("isRowSelectable"):null==t?void 0:t.isRowSelectable}function pe(e){const t=e.get("rowSelection");if("string"==typeof t)switch(t){case"multiple":return"multiRow";case"single":return"singleRow";default:return}return null==t?void 0:t.mode}function me(e){return"multiRow"===pe(e)}function ve(e){const t=e.get("rowSelection");if("string"==typeof t){const t=e.get("groupSelectsChildren"),i=e.get("groupSelectsFiltered");return t&&i?"filteredDescendants":t?"descendants":"self"}return"multiRow"===(null==t?void 0:t.mode)?t.groupSelects:void 0}function Ce(e){const t=ve(e);return"descendants"===t||"filteredDescendants"===t}function fe(e){return e.isModuleRegistered("@ag-grid-enterprise/set-filter")&&!e.get("suppressSetFilterByDefault")}function we(e){if(e&&e.length)return e[e.length-1]}function Se(e,t,i){return null==e&&null==t||null!=e&&null!=t&&e.length===t.length&&e.every(((e,s)=>i?i(e,t[s]):t[s]===e))}function ye(e,t){const i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],e.pop())}function be(e,t){const i=e.indexOf(t);i>=0&&e.splice(i,1)}function Re(e,t,i){e.splice(i,0,t)}function Fe(e,t,i){!function(e,t){for(let i=0;iRe(e,t,i)))}function Pe(e,t){return e.indexOf(t)>-1}function De(e,t){null!=t&&null!=e&&t.forEach((t=>e.push(t)))}var Ee="__ag_Grid_Stop_Propagation",Me=["touchstart","touchend","touchmove","touchcancel","scroll"],xe={};function Ae(e){e[Ee]=!0}function Te(e){return!0===e[Ee]}var Ie=(()=>{const e={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return t=>{if("boolean"==typeof xe[t])return xe[t];const i=document.createElement(e[t]||"div");return xe[t="on"+t]=t in i}})();function Le(e,t,i){let s=t;for(;s;){const t=_(e,s,i);if(t)return t;s=s.parentElement}return null}function ke(e,t){return!(!t||!e)&&function(e){const t=e;if(t.path)return t.path;if(t.composedPath)return t.composedPath();return function(e){const t=[];let i=e.target;for(;i;)t.push(i),i=i.parentElement;return t}(t)}(t).indexOf(e)>=0}var Oe=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans(e){this.frameworkOverrides=e.frameworkOverrides,this.stubContext=e.context,this.eventService=e.eventService,this.gos=e.gos,this.localeService=e.localeService}getFrameworkOverrides(){return this.frameworkOverrides}destroy(){for(let e=0;enull;e instanceof HTMLElement?function(e,t,i,s){const o=Pe(Me,i)?{passive:!0}:void 0;e&&e.addEventListener&&e.addEventListener(t,i,s,o)}(this.getFrameworkOverrides(),e,t,i):e.addEventListener(t,i);const s=()=>(e.removeEventListener(t,i),null);return this.destroyFunctions.push(s),()=>(s(),this.destroyFunctions=this.destroyFunctions.filter((e=>e!==s)),null)}setupGridOptionListener(e,t){this.gos.addPropertyEventListener(e,t);const i=()=>(this.gos.removePropertyEventListener(e,t),null);return this.destroyFunctions.push(i),()=>(i(),this.destroyFunctions=this.destroyFunctions.filter((e=>e!==i)),null)}addManagedPropertyListener(e,t){return this.destroyed?()=>null:this.setupGridOptionListener(e,t)}addManagedPropertyListeners(e,t){if(this.destroyed)return;const i=e.join("-")+this.propertyListenerId++,s=e=>{if(e.changeSet){if(e.changeSet&&e.changeSet.id===this.lastChangeSetIdLookup[i])return;this.lastChangeSetIdLookup[i]=e.changeSet.id}const s={type:"gridPropertyChanged",changeSet:e.changeSet,source:e.source};t(s)};e.forEach((e=>this.setupGridOptionListener(e,s)))}addDestroyFunc(e){this.isAlive()?this.destroyFunctions.push(e):e()}createManagedBean(e,t){const i=this.createBean(e,t);return this.addDestroyFunc(this.destroyBean.bind(this,e,t)),i}createBean(e,t,i){return(t||this.stubContext).createBean(e,i)}destroyBean(e,t){return(t||this.stubContext).destroyBean(e)}destroyBeans(e,t){return(t||this.stubContext).destroyBeans(e)}};function Ge(e){return e instanceof Ne}var Ne=class extends Oe{constructor(e,t,i,s){super(),this.isColumn=!1,this.expandable=!1,this.instanceId=ot(),this.expandableListenerRemoveCallback=null,this.colGroupDef=e,this.groupId=t,this.expanded=!!e&&!!e.openByDefault,this.padding=i,this.level=s}destroy(){this.expandableListenerRemoveCallback&&this.reset(null,void 0),super.destroy()}reset(e,t){this.colGroupDef=e,this.level=t,this.originalParent=null,this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback(),this.children=void 0,this.expandable=void 0}getInstanceId(){return this.instanceId}setOriginalParent(e){this.originalParent=e}getOriginalParent(){return this.originalParent}getLevel(){return this.level}isVisible(){return!!this.children&&this.children.some((e=>e.isVisible()))}isPadding(){return this.padding}setExpanded(e){this.expanded=void 0!==e&&e,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren(e){this.children=e}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}addLeafColumns(e){this.children&&this.children.forEach((t=>{nt(t)?e.push(t):Ge(t)&&t.addLeafColumns(e)}))}getColumnGroupShow(){const e=this.colGroupDef;if(e)return e.columnGroupShow}setupExpandable(){this.setExpandable(),this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback();const e=this.onColumnVisibilityChanged.bind(this);this.getLeafColumns().forEach((t=>t.addEventListener("visibleChanged",e))),this.expandableListenerRemoveCallback=()=>{this.getLeafColumns().forEach((t=>t.removeEventListener("visibleChanged",e))),this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let e=!1,t=!1,i=!1;const s=this.findChildrenRemovingPadding();for(let n=0,r=s.length;n{i.forEach((i=>{Ge(i)&&i.isPadding()?t(i.children):e.push(i)}))};return t(this.children),e}onColumnVisibilityChanged(){this.setExpandable()}},He="ag-Grid-ControlsColumn",Be=class extends Oe{constructor(){super(...arguments),this.beanName="controlsColService"}createControlsCols(){const{gos:e}=this,t=e.get("rowSelection");if(!t||"object"!=typeof t)return[];const i=le(t),s=ae(t);if(i||s){const t=e.get("selectionColumnDef"),i={maxWidth:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:e.get("enableRtl")?"right":"left",comparator(e,t,i,s){const o=i.isSelected(),n=s.isSelected();return o&&n?0:o?1:-1},editable:!1,suppressFillHandle:!0,...t,colId:`${He}`},s=new rt(i,null,i.colId,!1);return this.createBean(s),[s]}return[]}},Ve="ag-Grid-AutoColumn";function We(e){const t=[],i=e=>{for(let s=0;se+t.getActualWidth()),0)}function Ue(e,t,i){const s={};if(!t)return;ht(null,t,(e=>{s[e.getInstanceId()]=e})),i&&ht(null,i,(e=>{s[e.getInstanceId()]=null}));const o=Object.values(s).filter((e=>null!=e));e.destroyBeans(o)}function Ke(e){return e.getId().startsWith(Ve)}function _e(e){return e.getColId().startsWith(He)}function $e(e){let t=[];if(e instanceof Array){e.some((e=>"string"!=typeof e))?m("if colDef.type is supplied an array it should be of type 'string[]'"):t=e}else"string"==typeof e?t=e.split(","):m("colDef.type should be of type 'string' | 'string[]'");return t}var je=class{constructor(e){this.frameworkOverrides=e,this.wrappedListeners=new Map,this.wrappedGlobalListeners=new Map}wrap(e,t){const{frameworkOverrides:i,wrappedListeners:s}=this;let o=t;if(i.shouldWrapOutgoing){o=e=>{i.wrapOutgoing((()=>t(e)))};let n=s.get(e);n||(n=new Map,s.set(e,n)),n.set(t,o)}return o}wrapGlobal(e){const{frameworkOverrides:t,wrappedGlobalListeners:i}=this;let s=e;return t.shouldWrapOutgoing&&(s=(i,s)=>{t.wrapOutgoing((()=>e(i,s)))},i.set(e,s)),s}unwrap(e,t){const{wrappedListeners:i}=this,s=i.get(e);if(s){const o=s.get(t);if(o)return s.delete(t),0===s.size&&i.delete(e),o}return t}unwrapGlobal(e){const{wrappedGlobalListeners:t}=this,i=t.get(e);return i?(t.delete(e),i):e}},qe=new Set(["__proto__","constructor","prototype"]);function Qe(e,t){if(null!=e)if(Array.isArray(e))for(let i=0;i{if(t&&t.indexOf(e)>=0||qe.has(e))return;const o=i[e],n=tt(o)&&o.constructor===Object;s[e]=n?Xe(o):o})),s}function Je(e){if(!e)return[];const t=Object;if("function"==typeof t.values)return t.values(e);const i=[];for(const s in e)e.hasOwnProperty(s)&&e.propertyIsEnumerable(s)&&i.push(e[s]);return i}function Ze(e,t,i=!0,s=!1){P(t)&&Qe(t,((t,o)=>{if(qe.has(t))return;let n=e[t];if(n!==o){if(s){if(null==n&&null!=o){"object"==typeof o&&o.constructor===Object&&(n={},e[t]=n)}}tt(o)&&tt(n)&&!Array.isArray(n)?Ze(n,o,i,s):(i||void 0!==o)&&(e[t]=o)}}))}function et(e,t,i){if(!t||!e)return;if(!i)return e[t];const s=t.split(".");let o=e;for(let n=0;n=0&&!e,this.tooltipFieldContainsDots=P(this.colDef.tooltipField)&&this.colDef.tooltipField.indexOf(".")>=0&&!e}initMinAndMaxWidths(){const e=this.colDef;this.minWidth=e.minWidth??this.gos.environment.getDefaultColumnMinWidth(),this.maxWidth=e.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.tooltipEnabled=P(this.colDef.tooltipField)||P(this.colDef.tooltipValueGetter)||P(this.colDef.tooltipComponent)}resetActualWidth(e){const t=this.calculateColInitialWidth(this.colDef);this.setActualWidth(t,e,!0)}calculateColInitialWidth(e){let t;const i=x(e.width),s=x(e.initialWidth);return t=null!=i?i:null!=s?s:200,Math.max(Math.min(t,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed(e){if(D(this.colDef)||D(this.colDef.showRowGroup))return!1;const t=!0===this.colDef.showRowGroup,i=this.colDef.showRowGroup===e;return t||i}isPrimary(){return this.primary}isFilterAllowed(){return!!this.colDef.filter}isFieldContainsDots(){return this.fieldContainsDots}isTooltipEnabled(){return this.tooltipEnabled}isTooltipFieldContainsDots(){return this.tooltipFieldContainsDots}getHighlighted(){return this.highlighted}addEventListener(e,t){var i;this.frameworkOverrides.shouldWrapOutgoing&&!this.frameworkEventListenerService&&(this.columnEventService.setFrameworkOverrides(this.frameworkOverrides),this.frameworkEventListenerService=new je(this.frameworkOverrides));const s=(null==(i=this.frameworkEventListenerService)?void 0:i.wrap(e,t))??t;this.columnEventService.addEventListener(e,s)}removeEventListener(e,t){var i;const s=(null==(i=this.frameworkEventListenerService)?void 0:i.unwrap(e,t))??t;this.columnEventService.removeEventListener(e,s)}createColumnFunctionCallbackParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,column:this,colDef:this.colDef})}isSuppressNavigable(e){if("boolean"==typeof this.colDef.suppressNavigable)return this.colDef.suppressNavigable;if("function"==typeof this.colDef.suppressNavigable){const t=this.createColumnFunctionCallbackParams(e);return(0,this.colDef.suppressNavigable)(t)}return!1}isCellEditable(e){if(e.group)if(this.gos.get("treeData")){if(!e.data&&!this.gos.get("enableGroupEdit"))return!1}else if(!this.gos.get("enableGroupEdit"))return!1;return this.isColumnFunc(e,this.colDef.editable)}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag(e){return this.isColumnFunc(e,this.colDef.rowDrag)}isDndSource(e){return this.isColumnFunc(e,this.colDef.dndSource)}isCellCheckboxSelection(e){const t=this.gos.get("rowSelection");if(t&&"string"!=typeof t){const i=_e(this)&&le(t);return this.isColumnFunc(e,i)}return this.isColumnFunc(e,this.colDef.checkboxSelection)}isSuppressPaste(e){return this.isColumnFunc(e,this.colDef?this.colDef.suppressPaste:null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue(e){return this.colDef[e]??it[e]}isColumnFunc(e,t){if("boolean"==typeof t)return t;if("function"==typeof t){return t(this.createColumnFunctionCallbackParams(e))}return!1}setHighlighted(e){this.highlighted!==e&&(this.highlighted=e,this.columnEventService.dispatchEvent(this.createColumnEvent("headerHighlightChanged","uiColumnMoved")))}setMoving(e,t){this.moving=e,this.columnEventService.dispatchEvent(this.createColumnEvent("movingChanged",t))}createColumnEvent(e,t){return this.gos.addGridCommonParams({type:e,column:this,columns:[this],source:t})}isMoving(){return this.moving}getSort(){return this.sort}setSort(e,t){this.sort!==e&&(this.sort=e,this.columnEventService.dispatchEvent(this.createColumnEvent("sortChanged",t))),this.dispatchStateUpdatedEvent("sort")}isSortable(){return!!this.getColDefValue("sortable")}isSortAscending(){return"asc"===this.sort}isSortDescending(){return"desc"===this.sort}isSortNone(){return D(this.sort)}isSorting(){return P(this.sort)}getSortIndex(){return this.sortIndex}setSortIndex(e){this.sortIndex=e,this.dispatchStateUpdatedEvent("sortIndex")}setMenuVisible(e,t){this.menuVisible!==e&&(this.menuVisible=e,this.columnEventService.dispatchEvent(this.createColumnEvent("menuVisibleChanged",t)))}isMenuVisible(){return this.menuVisible}setAggFunc(e){this.aggFunc=e,this.dispatchStateUpdatedEvent("aggFunc")}getAggFunc(){return this.aggFunc}getLeft(){return this.left}getOldLeft(){return this.oldLeft}getRight(){return this.left+this.actualWidth}setLeft(e,t){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.columnEventService.dispatchEvent(this.createColumnEvent("leftChanged",t)))}isFilterActive(){return this.filterActive}setFilterActive(e,t,i){this.filterActive!==e&&(this.filterActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("filterActiveChanged",t)));const s=this.createColumnEvent("filterChanged",t);i&&Ze(s,i),this.columnEventService.dispatchEvent(s)}isHovered(){return this.columnHoverService.isHovered(this)}setPinned(e){this.pinned=!0===e||"left"===e?"left":"right"===e?"right":null,this.dispatchStateUpdatedEvent("pinned")}setFirstRightPinned(e,t){this.firstRightPinned!==e&&(this.firstRightPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("firstRightPinnedChanged",t)))}setLastLeftPinned(e,t){this.lastLeftPinned!==e&&(this.lastLeftPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("lastLeftPinnedChanged",t)))}isFirstRightPinned(){return this.firstRightPinned}isLastLeftPinned(){return this.lastLeftPinned}isPinned(){return"left"===this.pinned||"right"===this.pinned}isPinnedLeft(){return"left"===this.pinned}isPinnedRight(){return"right"===this.pinned}getPinned(){return this.pinned}setVisible(e,t){const i=!0===e;this.visible!==i&&(this.visible=i,this.columnEventService.dispatchEvent(this.createColumnEvent("visibleChanged",t))),this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getColumnGroupPaddingInfo(){let e=this.getParent();if(!e||!e.isPadding())return{numberOfParents:0,isSpanningTotal:!1};const t=e.getPaddingLevel()+1;let i=!0;for(;e;){if(!e.isPadding()){i=!1;break}e=e.getParent()}return{numberOfParents:t,isSpanningTotal:i}}getColDef(){return this.colDef}getDefinition(){return this.colDef}getColumnGroupShow(){return this.colDef.columnGroupShow}getColId(){return this.colId}getId(){return this.colId}getUniqueId(){return this.colId}getActualWidth(){return this.actualWidth}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}createBaseColDefParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,colDef:this.colDef,column:this})}getColSpan(e){if(D(this.colDef.colSpan))return 1;const t=this.createBaseColDefParams(e),i=this.colDef.colSpan(t);return Math.max(i,1)}getRowSpan(e){if(D(this.colDef.rowSpan))return 1;const t=this.createBaseColDefParams(e),i=this.colDef.rowSpan(t);return Math.max(i,1)}setActualWidth(e,t,i=!1){e=Math.max(e,this.minWidth),e=Math.min(e,this.maxWidth),this.actualWidth!==e&&(this.actualWidth=e,this.flex&&"flex"!==t&&"gridInitializing"!==t&&(this.flex=null),i||this.fireColumnWidthChangedEvent(t)),this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent(e){this.columnEventService.dispatchEvent(this.createColumnEvent("widthChanged",e))}isGreaterThanMax(e){return e>this.maxWidth}getMinWidth(){return this.minWidth}getMaxWidth(){return this.maxWidth}getFlex(){return this.flex||0}setFlex(e){this.flex!==e&&(this.flex=e),this.dispatchStateUpdatedEvent("flex")}setMinimum(e){this.setActualWidth(this.minWidth,e)}setRowGroupActive(e,t){this.rowGroupActive!==e&&(this.rowGroupActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnRowGroupChanged",t))),this.dispatchStateUpdatedEvent("rowGroup")}isRowGroupActive(){return this.rowGroupActive}setPivotActive(e,t){this.pivotActive!==e&&(this.pivotActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnPivotChanged",t))),this.dispatchStateUpdatedEvent("pivot")}isPivotActive(){return this.pivotActive}isAnyFunctionActive(){return this.isPivotActive()||this.isRowGroupActive()||this.isValueActive()}isAnyFunctionAllowed(){return this.isAllowPivot()||this.isAllowRowGroup()||this.isAllowValue()}setValueActive(e,t){this.aggregationActive!==e&&(this.aggregationActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnValueChanged",t)))}isValueActive(){return this.aggregationActive}isAllowPivot(){return!0===this.colDef.enablePivot}isAllowValue(){return!0===this.colDef.enableValue}isAllowRowGroup(){return!0===this.colDef.enableRowGroup}dispatchStateUpdatedEvent(e){this.columnEventService.dispatchEvent({type:"columnStateUpdated",key:e})}},lt={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}},at=class{constructor(){this.existingKeys={}}addExistingKeys(e){for(let t=0;t{Ge(e)&&e.setupExpandable(),e.setOriginalParent(t)})),{columnTree:h,treeDept:d}}extractExistingTreeData(e){const t=[],i=[],s=[];return e&&ht(null,e,(e=>{if(Ge(e)){const t=e;i.push(t)}else{const i=e;s.push(i.getId()),t.push(i)}})),{existingCols:t,existingGroups:i,existingColKeys:s}}balanceTreeForAutoCols(e,t){const i=[],s=this.findDepth(t);return e.forEach((e=>{let t=e;for(let i=s-1;i>=0;i--){const s=new Ne(null,`FAKE_PATH_${e.getId()}}_${i}`,!0,i);this.createBean(s),s.setChildren([t]),t.setOriginalParent(s),t=s}0===s&&e.setOriginalParent(null),i.push(t)})),[i,s]}findDepth(e){let t=0,i=e;for(;i&&i[0]&&Ge(i[0]);)t++,i=i[0].getChildren();return t}balanceColumnTree(e,t,i,s){const o=[];for(let n=0;n=t;e--){const e=s.getUniqueKey(null,null),i=this.createMergedColGroupDef(null),o=new Ne(i,e,!0,t);this.createBean(o),l&&l.setChildren([o]),l=o,n||(n=l)}if(n&&l){o.push(n);if(e.some((e=>Ge(e)))){l.setChildren([r]);continue}l.setChildren(e);break}o.push(r)}}return o}findMaxDept(e,t){let i=t;for(let s=0;s{if(e in i)m(`the column type '${e}' is a default column type and cannot be overridden.`);else{t.type&&m("Column type definitions 'columnTypes' with a 'type' attribute are not supported because a column type cannot refer to another column type. Only column definitions 'columnDefs' can use the 'type' attribute to refer to a column type."),i[e]=t}})),e.forEach((e=>{const s=i[e.trim()];s?Ze(t,s,!1,!0):m("colDef.type '"+e+"' does not correspond to defined gridOptions.columnTypes")}))}isColumnGroup(e){return void 0!==e.children}};function ht(e,t,i){if(t)for(let s=0;sthis.refreshAll(ct(e.source)))),this.addManagedPropertyListener("rowSelection",(e=>{this.onSelectionOptionsChanged(e.currentValue,e.previousValue,ct(e.source))})),this.addManagedPropertyListener("autoGroupColumnDef",(e=>this.onAutoGroupColumnDefChanged(ct(e.source)))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],(e=>this.recreateColumnDefs(ct(e.source)))),this.addManagedPropertyListener("pivotMode",(e=>this.setPivotMode(this.gos.get("pivotMode"),ct(e.source)))),this.addManagedEventListeners({firstDataRendered:()=>this.onFirstDataRendered()})}createColsFromColDefs(e){var t,i,s;const o=this.colDefs?this.columnApplyStateService.compareColumnStatesAndDispatchEvents(e):void 0;this.valueCache.expire();const n=null==(t=this.colDefCols)?void 0:t.list,r=null==(i=this.colDefCols)?void 0:i.tree,l=this.columnFactory.createColumnTree(this.colDefs,!0,r,e);Ue(this.context,null==(s=this.colDefCols)?void 0:s.tree,l.columnTree);const a=l.columnTree,d=l.treeDept,h=We(a),u={};h.forEach((e=>u[e.getId()]=e)),this.colDefCols={tree:a,treeDepth:d,list:h,map:u},this.funcColsService.extractCols(e,n),this.ready=!0,this.refreshCols(!0),this.visibleColsService.refresh(e),this.columnViewportService.checkViewportColumns(),this.eventDispatcher.everythingChanged(e),o&&(this.changeEventsDispatching=!0,o(),this.changeEventsDispatching=!1),this.eventDispatcher.newColumnsLoaded(e),"gridInitializing"===e&&this.columnSizeService.applyAutosizeStrategy()}refreshCols(e){var t,i,s;if(!this.colDefCols)return;const o=null==(t=this.cols)?void 0:t.tree;this.saveColOrder(),this.selectCols(),this.createAutoCols(),this.addAutoCols(),this.createControlsCols(),this.addControlsCols();const n=(r=this.gos,this.showingPivotResult?!r.get("enableStrictPivotColumnOrder"):r.get("maintainColumnOrder"));var r;e&&!n||this.restoreColOrder(),this.positionLockedCols(),null==(i=this.showRowGroupColsService)||i.refresh(),null==(s=this.quickFilterService)||s.refreshQuickFilterCols(),this.setColSpanActive(),this.setAutoHeightActive(),this.visibleColsService.clear(),this.columnViewportService.clear();!Se(o,this.cols.tree)&&this.eventDispatcher.gridColumns()}selectCols(){const e=this.pivotResultColsService.getPivotResultCols();if(this.showingPivotResult=null!=e,e){const{map:t,list:i,tree:s,treeDepth:o}=e;this.cols={list:i.slice(),map:{...t},tree:s.slice(),treeDepth:o};e.list.some((e=>{var t;return void 0!==(null==(t=this.cols)?void 0:t.map[e.getColId()])}))||(this.lastPivotOrder=null)}else{const{map:e,list:t,tree:i,treeDepth:s}=this.colDefCols;this.cols={list:t.slice(),map:{...e},tree:i.slice(),treeDepth:s}}}getColsToShow(){const e=this.isPivotMode()&&!this.isShowingPivotResult(),t=this.funcColsService.getValueColumns();return this.cols.list.filter((i=>{const s=Ke(i);if(e){const e=t&&Pe(t,i);return s||e}return s||i.isVisible()}))}addAutoCols(){null!=this.autoCols&&(this.cols.list=this.autoCols.list.concat(this.cols.list),this.cols.tree=this.autoCols.tree.concat(this.cols.tree),gt(this.cols))}createAutoCols(){var e;const t=ne(this.gos,this.pivotMode),i=this.pivotMode?this.gos.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),s=this.funcColsService.getRowGroupColumns(),o=()=>{this.autoCols&&(Ue(this.context,this.autoCols.tree),this.autoCols=null)};if(!(s.length>0||this.gos.get("treeData"))||i||t||!this.autoColService)return void o();const n=this.autoColService.createAutoCols(s)??[],r=mt(n,(null==(e=this.autoCols)?void 0:e.list)||null),l=this.cols.treeDepth,a=this.autoCols?this.autoCols.treeDepth:-1;if(r&&a==l)return;o();const[d,h]=this.columnFactory.balanceTreeForAutoCols(n,this.cols.tree);this.autoCols={list:n,tree:d,treeDepth:h,map:{}};const u=e=>{if(!e)return null;const t=e.filter((e=>!Ke(e)));return[...n,...t]};this.lastOrder=u(this.lastOrder),this.lastPivotOrder=u(this.lastPivotOrder)}createControlsCols(){var e,t,i;const s=()=>{var e;Ue(this.context,null==(e=this.controlsCols)?void 0:e.tree),this.controlsCols=null};this.controlsColService||s();const o=this.cols.treeDepth,n=((null==(e=this.controlsCols)?void 0:e.treeDepth)??-1)==o,r=(null==(t=this.controlsColService)?void 0:t.createControlsCols())??[];if(mt(r,(null==(i=this.controlsCols)?void 0:i.list)??[])&&n)return;s();const[l,a]=this.columnFactory.balanceTreeForAutoCols(r,this.cols.tree);this.controlsCols={list:r,tree:l,treeDepth:a,map:{}};const d=e=>{if(!e)return null;const t=e.filter((e=>!_e(e)));return[...r,...t]};this.lastOrder=d(this.lastOrder),this.lastPivotOrder=d(this.lastPivotOrder)}addControlsCols(){null!=this.controlsCols&&(this.cols.list=this.controlsCols.list.concat(this.cols.list),this.cols.tree=this.controlsCols.tree.concat(this.cols.tree),gt(this.cols))}refreshAll(e){this.isReady()&&(this.refreshCols(!1),this.visibleColsService.refresh(e))}setColsVisible(e,t=!1,i){this.columnApplyStateService.applyColumnState({state:e.map((e=>({colId:"string"==typeof e?e:e.getColId(),hide:!t})))},i)}setColsPinned(e,t,i){if(!this.cols)return;if(E(e))return;if(H(this.gos,"print"))return void m("Changing the column pinning status is not allowed with domLayout='print'");let s;this.columnAnimationService.start(),s=!0===t||"left"===t?"left":"right"===t?"right":null;const o=[];e.forEach((e=>{if(!e)return;const t=this.getCol(e);t&&t.getPinned()!==s&&(t.setPinned(s),o.push(t))})),o.length&&(this.visibleColsService.refresh(i),this.eventDispatcher.columnPinned(o,i)),this.columnAnimationService.finish()}setColumnGroupOpened(e,t,i){let s;s=Ge(e)?e.getId():e||"",this.columnGroupStateService.setColumnGroupState([{groupId:s,open:t}],i)}getProvidedColGroup(e){var t;let i=null;return ht(null,null==(t=this.cols)?void 0:t.tree,(t=>{Ge(t)&&t.getId()===e&&(i=t)})),i}isColGroupLocked(e){const t=this.gos.get("groupLockGroupColumns");if(!e.isRowGroupActive()||0===t)return!1;if(-1===t)return!0;return t>this.funcColsService.getRowGroupColumns().findIndex((t=>t.getColId()===e.getColId()))}isSuppressAutoCol(){if("custom"===this.gos.get("groupDisplayType"))return!0;return"custom"===this.gos.get("treeDataDisplayType")}setAutoHeightActive(){if(this.autoHeightActive=this.cols.list.some((e=>e.isVisible()&&e.isAutoHeight())),this.autoHeightActive){this.autoHeightActiveAtLeastOnce=!0;G(this.gos)||N(this.gos)||m("autoHeight columns only work with Client Side Row Model and Server Side Row Model.")}}restoreColOrder(){const e=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!e)return;const t=new Map(e.map(((e,t)=>[e,t])));if(!this.cols.list.some((e=>t.has(e))))return;const i=new Map(this.cols.list.map((e=>[e,!0]))),s=e.filter((e=>i.has(e))),o=new Map(s.map((e=>[e,!0]))),n=this.cols.list.filter((e=>!o.has(e))),r=s.slice();n.forEach((e=>{let t=e.getOriginalParent();if(!t)return void r.push(e);const i=[];for(;!i.length&&t;){t.getLeafColumns().forEach((e=>{const t=r.indexOf(e)>=0,s=i.indexOf(e)<0;t&&s&&i.push(e)})),t=t.getOriginalParent()}if(!i.length)return void r.push(e);const s=i.map((e=>r.indexOf(e))),o=Math.max(...s);Re(r,e,o+1)})),this.cols.list=r}sortColsLikeKeys(e){if(null==this.cols)return;let t=[];const i={};e.forEach((e=>{if(i[e])return;const s=this.cols.map[e];s&&(t.push(s),i[e]=!0)}));let s=0;this.cols.list.forEach((e=>{const o=e.getColId();if(null!=i[o])return;o.startsWith(Ve)?Re(t,e,s++):t.push(e)})),t=this.columnMoveService.placeLockedColumns(t),this.columnMoveService.doesMovePassMarryChildren(t)?this.cols.list=t:m("Applying column order broke a group where columns should be married together. Applying new order has been discarded.")}sortColsLikeCols(e){if(!e||e.length<=1)return;e.filter((e=>this.cols.list.indexOf(e)<0)).length>0||e.sort(((e,t)=>this.cols.list.indexOf(e)-this.cols.list.indexOf(t)))}resetColDefIntoCol(e,t){const i=e.getUserProvidedColDef();if(!i)return!1;const s=this.columnFactory.addColumnDefaultAndTypes(i,e.getColId());return e.setColDef(s,i,t),!0}queueResizeOperations(){this.shouldQueueResizeOperations=!0}isShouldQueueResizeOperations(){return this.shouldQueueResizeOperations}processResizeOperations(){this.shouldQueueResizeOperations=!1,this.resizeOperationQueue.forEach((e=>e())),this.resizeOperationQueue=[]}pushResizeOperation(e){this.resizeOperationQueue.push(e)}moveInCols(e,t,i){var s;Fe(null==(s=this.cols)?void 0:s.list,e,t),this.visibleColsService.refresh(i)}positionLockedCols(){this.cols.list=this.columnMoveService.placeLockedColumns(this.cols.list)}saveColOrder(){var e,t;this.showingPivotResult?this.lastPivotOrder=null==(e=this.cols)?void 0:e.list:this.lastOrder=null==(t=this.cols)?void 0:t.list}getColumnDefs(){if(!this.colDefCols)return;const e=this.colDefCols.list.slice();this.showingPivotResult?e.sort(((e,t)=>this.lastOrder.indexOf(e)-this.lastOrder.indexOf(t))):this.lastOrder&&e.sort(((e,t)=>this.cols.list.indexOf(e)-this.cols.list.indexOf(t)));const t=this.funcColsService.getRowGroupColumns(),i=this.funcColsService.getPivotColumns();return this.columnDefFactory.buildColumnDefs(e,t,i)}isShowingPivotResult(){return this.showingPivotResult}isChangeEventsDispatching(){return this.changeEventsDispatching}isColSpanActive(){return this.colSpanActive}isProvidedColGroupsPresent(){var e;return(null==(e=this.colDefCols)?void 0:e.treeDepth)>0}setColSpanActive(){this.colSpanActive=this.cols.list.some((e=>null!=e.getColDef().colSpan))}isAutoRowHeightActive(){return this.autoHeightActive}wasAutoRowHeightEverActive(){return this.autoHeightActiveAtLeastOnce}getHeaderRowCount(){return this.cols?this.cols.treeDepth+1:-1}isReady(){return this.ready}isPivotMode(){return this.pivotMode}setPivotMode(e,t){e!==this.pivotMode&&this.isPivotSettingAllowed(this.pivotMode)&&(this.pivotMode=e,this.ready&&(this.refreshCols(!1),this.visibleColsService.refresh(t),this.eventDispatcher.pivotModeChanged()))}isPivotSettingAllowed(e){return!e||!this.gos.get("treeData")||(m("Pivot mode not available with treeData."),!1)}isPivotActive(){const e=this.funcColsService.getPivotColumns();return this.pivotMode&&!E(e)}recreateColumnDefs(e){this.cols&&(this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e),this.createColsFromColDefs(e))}setColumnDefs(e,t){this.colDefs=e,this.createColsFromColDefs(t)}destroy(){var e,t,i;Ue(this.context,null==(e=this.colDefCols)?void 0:e.tree),Ue(this.context,null==(t=this.autoCols)?void 0:t.tree),Ue(this.context,null==(i=this.controlsCols)?void 0:i.tree),super.destroy()}getColTree(){return this.cols.tree}getColDefColTree(){return this.colDefCols.tree}getColDefCols(){var e;return(null==(e=this.colDefCols)?void 0:e.list)?this.colDefCols.list:null}getCols(){var e;return(null==(e=this.cols)?void 0:e.list)??[]}getAllCols(){var e,t,i;const s=this.pivotResultColsService.getPivotResultCols(),o=null==s?void 0:s.list;return[(null==(e=this.colDefCols)?void 0:e.list)??[],(null==(t=this.autoCols)?void 0:t.list)??[],(null==(i=this.controlsCols)?void 0:i.list)??[],o??[]].flat()}getColsForKeys(e){return e?e.map((e=>this.getCol(e))).filter((e=>null!=e)):[]}getColDefCol(e){var t;return(null==(t=this.colDefCols)?void 0:t.list)?this.getColFromCollection(e,this.colDefCols):null}getCol(e){return null==e?null:this.getColFromCollection(e,this.cols)}getColFromCollection(e,t){if(null==t)return null;const{map:i,list:s}=t;if("string"==typeof e&&i[e])return i[e];for(let o=0;opt(t,e))))??null}getAutoCols(){var e;return(null==(e=this.autoCols)?void 0:e.list)??null}setColHeaderHeight(e,t){e.setAutoHeaderHeight(t)&&(e.isColumn?this.eventDispatcher.headerHeight(e):this.eventDispatcher.groupHeaderHeight(e))}getGroupRowsHeight(){const e=[],t=this.ctrlsService.getHeaderRowContainerCtrls();for(const i of t){if(!i)continue;const t=i.getGroupRowCount()||0;for(let s=0;so)&&(e[s]=i)}}}return e}getColumnGroupHeaderRowHeight(e){const t=this.isPivotMode()?this.getPivotGroupHeaderHeight():this.getGroupHeaderHeight();let i=0;const s=e.getHeaderCtrls();for(const o of s){const e=o.getColumn();if(e.isAutoHeaderHeight()){const t=e.getAutoHeaderHeight();null!=t&&t>i&&(i=t)}}return Math.max(t,i)}getColumnHeaderRowHeight(){const e=this.isPivotMode()?this.getPivotHeaderHeight():this.getHeaderHeight(),t=this.visibleColsService.getAllCols().filter((e=>e.isAutoHeaderHeight())).map((e=>e.getAutoHeaderHeight()||0));return Math.max(e,...t)}getHeaderHeight(){return this.gos.get("headerHeight")??this.environment.getDefaultHeaderHeight()}getFloatingFiltersHeight(){return this.gos.get("floatingFiltersHeight")??this.getHeaderHeight()}getGroupHeaderHeight(){return this.gos.get("groupHeaderHeight")??this.getHeaderHeight()}getPivotHeaderHeight(){return this.gos.get("pivotHeaderHeight")??this.getHeaderHeight()}getPivotGroupHeaderHeight(){return this.gos.get("pivotGroupHeaderHeight")??this.getGroupHeaderHeight()}onFirstDataRendered(){const e=this.gos.get("autoSizeStrategy");if("fitCellContents"!==(null==e?void 0:e.type))return;const{colIds:t,skipHeader:i}=e;setTimeout((()=>{t?this.columnAutosizeService.autoSizeCols({colKeys:t,skipHeader:i,source:"autosizeColumns"}):this.columnAutosizeService.autoSizeAllColumns("autosizeColumns",i)}))}onAutoGroupColumnDefChanged(e){this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e)}onSelectionOptionsChanged(e,t,i){const s=(t&&"string"!=typeof t?le(t):void 0)!==(e&&"string"!=typeof e?le(e):void 0),o=t&&"string"!=typeof t?ae(t):void 0,n=e&&"string"!=typeof e?ae(e):void 0;(s||o!==n)&&this.refreshAll(i)}};function ct(e){return"gridOptionsUpdated"===e?"gridOptionsChanged":e}function gt(e){e.map={},e.list.forEach((t=>e.map[t.getId()]=t))}function pt(e,t){const i=e===t,s=e.getColDef()===t,o=e.getColId()==t;return i||s||o}function mt(e,t){return Se(e,t,((e,t)=>e.getColId()===t.getColId()))}var vt=class extends Oe{constructor(){super(...arguments),this.beanName="columnAutosizeService",this.timesDelayed=0}wireBeans(e){this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.animationFrameService=e.animationFrameService,this.autoWidthCalculator=e.autoWidthCalculator,this.eventDispatcher=e.columnEventDispatcher,this.ctrlsService=e.ctrlsService,this.renderStatusService=e.renderStatusService}autoSizeCols(e){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation((()=>this.autoSizeCols(e)));const{colKeys:t,skipHeader:i,skipHeaderGroups:s,stopAtGroup:o,source:n="api"}=e;if(this.animationFrameService.flushAllFrames(),this.timesDelayed<5&&this.renderStatusService&&!this.renderStatusService.areHeaderCellsRendered())return this.timesDelayed++,void setTimeout((()=>this.autoSizeCols(e)));this.timesDelayed=0;const r=[];let l=-1;const a=null!=i?i:this.gos.get("skipHeaderOnAutoSize"),d=null!=s?s:a;for(;0!==l;){l=0;const e=[];t.forEach((t=>{if(!t)return;const i=this.columnModel.getCol(t);if(!i)return;if(r.indexOf(i)>=0)return;const s=this.autoWidthCalculator.getPreferredWidthForColumn(i,a);if(s>0){const e=this.normaliseColumnWidth(i,s);i.setActualWidth(e,n),r.push(i),l++}e.push(i)})),e.length&&this.visibleColsService.refresh(n)}d||this.autoSizeColumnGroupsByColumns(t,n,o),this.eventDispatcher.columnResized(r,!0,"autosizeColumns")}autoSizeColumn(e,t,i){e&&this.autoSizeCols({colKeys:[e],skipHeader:i,skipHeaderGroups:!0,source:t})}autoSizeColumnGroupsByColumns(e,t,i){const s=new Set;let o;this.columnModel.getColsForKeys(e).forEach((e=>{let t=e.getParent();for(;t&&t!=i;)t.isPadding()||s.add(t),t=t.getParent()}));for(const n of s){for(const e of this.ctrlsService.getHeaderRowContainerCtrls())if(o=e.getHeaderCtrlForColumn(n),o)break;o&&o.resizeLeafColumnsToFit(t)}return[]}autoSizeAllColumns(e,t){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation((()=>this.autoSizeAllColumns(e,t)));const i=this.visibleColsService.getAllCols();this.autoSizeCols({colKeys:i,skipHeader:t,source:e})}normaliseColumnWidth(e,t){const i=e.getMinWidth();tthis.rowGroupCols.push(e),removeGroupCol:e=>be(this.rowGroupCols,e),addPivotCol:e=>this.pivotCols.push(e),removePivotCol:e=>be(this.pivotCols,e),addValueCol:e=>this.valueCols.push(e),removeValueCol:e=>be(this.valueCols,e)}}getSourceColumnsForGroupColumn(e){const t=e.getColDef().showRowGroup;if(!t)return null;if(!0===t)return this.rowGroupCols.slice(0);const i=this.columnModel.getColDefCol(t);return i?[i]:null}sortRowGroupColumns(e){this.rowGroupCols.sort(e)}sortPivotColumns(e){this.pivotCols.sort(e)}getValueColumns(){return this.valueCols?this.valueCols:[]}getPivotColumns(){return this.pivotCols?this.pivotCols:[]}getRowGroupColumns(){return this.rowGroupCols?this.rowGroupCols:[]}isRowGroupEmpty(){return E(this.rowGroupCols)}setColumnAggFunc(e,t,i){if(!e)return;const s=this.columnModel.getColDefCol(e);s&&(s.setAggFunc(t),this.eventDispatcher.columnChanged("columnValueChanged",[s],i))}setRowGroupColumns(e,t){this.setColList(e,this.rowGroupCols,"columnRowGroupChanged",!0,!0,((e,i)=>this.setRowGroupActive(e,i,t)),t)}setRowGroupActive(e,t,i){e!==t.isRowGroupActive()&&(t.setRowGroupActive(e,i),e&&!this.gos.get("suppressRowGroupHidesColumns")&&this.columnModel.setColsVisible([t],!1,i),e||this.gos.get("suppressMakeColumnVisibleAfterUnGroup")||this.columnModel.setColsVisible([t],!0,i))}addRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!0,!0,(e=>this.setRowGroupActive(!0,e,t)),"columnRowGroupChanged",t)}removeRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!1,!0,(e=>this.setRowGroupActive(!1,e,t)),"columnRowGroupChanged",t)}addPivotColumns(e,t){this.updateColList(e,this.pivotCols,!0,!1,(e=>e.setPivotActive(!0,t)),"columnPivotChanged",t)}setPivotColumns(e,t){this.setColList(e,this.pivotCols,"columnPivotChanged",!0,!1,((e,i)=>{i.setPivotActive(e,t)}),t)}removePivotColumns(e,t){this.updateColList(e,this.pivotCols,!1,!1,(e=>e.setPivotActive(!1,t)),"columnPivotChanged",t)}setValueColumns(e,t){this.setColList(e,this.valueCols,"columnValueChanged",!1,!1,((e,i)=>this.setValueActive(e,i,t)),t)}setValueActive(e,t,i){if(e!==t.isValueActive()&&(t.setValueActive(e,i),e&&!t.getAggFunc()&&this.aggFuncService)){const e=this.aggFuncService.getDefaultAggFunc(t);t.setAggFunc(e)}}addValueColumns(e,t){this.updateColList(e,this.valueCols,!0,!1,(e=>this.setValueActive(!0,e,t)),"columnValueChanged",t)}removeValueColumns(e,t){this.updateColList(e,this.valueCols,!1,!1,(e=>this.setValueActive(!1,e,t)),"columnValueChanged",t)}moveRowGroupColumn(e,t,i){if(this.isRowGroupEmpty())return;const s=this.rowGroupCols[e],o=this.rowGroupCols.slice(e,t);this.rowGroupCols.splice(e,1),this.rowGroupCols.splice(t,0,s),this.eventDispatcher.rowGroupChanged(o,i)}setColList(e,t,i,s,o,n,r){if(!this.columnModel.getCols())return;const l=new Map;t.forEach(((e,t)=>l.set(e,t))),t.length=0,P(e)&&e.forEach((e=>{const i=this.columnModel.getColDefCol(e);i&&t.push(i)})),t.forEach(((e,t)=>{const i=l.get(e);void 0!==i?s&&i!==t||l.delete(e):l.set(e,0)}));(this.columnModel.getColDefCols()||[]).forEach((e=>{const i=t.indexOf(e)>=0;n(i,e)})),o&&this.columnModel.refreshCols(!1),this.visibleColsService.refresh(r),this.eventDispatcher.columnChanged(i,[...l.keys()],r)}updateColList(e,t,i,s,o,n,r){if(!e||E(e))return;let l=!1;const a=new Set;e.forEach((e=>{if(!e)return;const s=this.columnModel.getColDefCol(e);if(s){if(a.add(s),i){if(t.indexOf(s)>=0)return;t.push(s)}else{const e=t.indexOf(s);if(e<0)return;for(let i=e+1;it.setValueActive(i,e)),(()=>{}),(()=>{}),(e=>{const t=e.aggFunc;return null===t||""===t?null:void 0!==t?!!t:void 0}),(e=>null!=e.initialAggFunc&&""!=e.initialAggFunc)),this.valueCols.forEach((e=>{const t=e.getColDef();null!=t.aggFunc&&""!=t.aggFunc?e.setAggFunc(t.aggFunc):e.getAggFunc()||e.setAggFunc(t.initialAggFunc)}))}extractRowGroupCols(e,t){this.rowGroupCols=this.extractColsCommon(t,this.rowGroupCols,((t,i)=>t.setRowGroupActive(i,e)),(e=>e.rowGroupIndex),(e=>e.initialRowGroupIndex),(e=>e.rowGroup),(e=>e.initialRowGroup))}extractPivotCols(e,t){this.pivotCols=this.extractColsCommon(t,this.pivotCols,((t,i)=>t.setPivotActive(i,e)),(e=>e.pivotIndex),(e=>e.initialPivotIndex),(e=>e.pivot),(e=>e.initialPivot))}extractColsCommon(e=[],t=[],i,s,o,n,r){const l=[],a=[];(this.columnModel.getColDefCols()||[]).forEach((i=>{const d=e.indexOf(i)<0,h=i.getColDef(),u=A(n(h)),c=A(r(h)),g=x(s(h)),p=x(o(h));let m;if(m=void 0!==u?u:void 0!==g?null!==g&&g>=0:d?void 0!==c?c:!!(void 0!==p)&&(null!=p&&p>=0):t.indexOf(i)>=0,m){(d?null!=g||null!=p:null!=g)?l.push(i):a.push(i)}}));const d=e=>{const t=s(e.getColDef()),i=o(e.getColDef());return null!=t?t:i};l.sort(((e,t)=>{const i=d(e),s=d(t);return i===s?0:i{a.indexOf(e)>=0&&h.push(e)})),a.forEach((e=>{h.indexOf(e)<0&&h.push(e)})),t.forEach((e=>{h.indexOf(e)<0&&i(e,!1)})),h.forEach((e=>{t.indexOf(e)<0&&i(e,!0)})),h}generateColumnStateForRowGroupAndPivotIndexes(e,t){const i={},s=(e,t,s,o,n,r)=>{const l=this.columnModel.getColDefCols();if(!t.length||!l)return[];const a=Object.keys(e),d=new Set(a),h=new Set(a),u=new Set(t.map((e=>{const t=e.getColId();return h.delete(t),t})).concat(a)),c=[],g={};let p=0;for(let i=0;i{const i=g[t];for(let s=C;s{const l=t.getColId();if(d.has(l))f(l),e[l][n]=m++;else{const a=t.getColDef();if(null===a[n]||void 0===a[n]&&null==a[r]){if(!v){a[s]||void 0===a[s]&&a[o]?f(l):(h.forEach((t=>{e[t][n]=m+g[t]})),m+=c.length,v=!0)}i[l]||(i[l]={colId:l}),i[l][n]=m++}}}))};return s(e,this.rowGroupCols,"rowGroup","initialRowGroup","rowGroupIndex","initialRowGroupIndex"),s(t,this.pivotCols,"pivot","initialPivot","pivotIndex","initialPivotIndex"),Object.values(i)}},ft=class extends Oe{constructor(){super(...arguments),this.beanName="columnApplyStateService"}wireBeans(e){this.columnModel=e.columnModel,this.eventDispatcher=e.columnEventDispatcher,this.sortController=e.sortController,this.columnGetStateService=e.columnGetStateService,this.funcColsService=e.funcColsService,this.visibleColsService=e.visibleColsService,this.columnAnimationService=e.columnAnimationService,this.pivotResultColsService=e.pivotResultColsService}applyColumnState(e,t){const i=this.columnModel.getColDefCols()||[];if(E(i))return!1;if(e&&e.state&&!e.state.forEach)return m("applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state."),!1;const s=this.funcColsService.getModifyColumnsNoEventsCallbacks(),o=(i,o,n)=>{const r=this.compareColumnStatesAndDispatchEvents(t),l=o.slice(),a={},d={},h=[],u=[];let c=0;const g=this.funcColsService.getRowGroupColumns().slice(),p=this.funcColsService.getPivotColumns().slice();i.forEach((i=>{const o=i.colId||"";if(o.startsWith(Ve))return h.push(i),void u.push(i);const r=n(o);r?(this.syncColumnWithStateItem(r,i,e.defaultState,a,d,!1,t,s),be(l,r)):(u.push(i),c+=1)}));const m=i=>this.syncColumnWithStateItem(i,null,e.defaultState,a,d,!1,t,s);l.forEach(m),this.funcColsService.sortRowGroupColumns(wt.bind(this,a,g)),this.funcColsService.sortPivotColumns(wt.bind(this,d,p)),this.columnModel.refreshCols(!1);const v=(this.columnModel.getAutoCols()||[]).slice();return h.forEach((i=>{const o=this.columnModel.getAutoCol(i.colId);be(v,o),this.syncColumnWithStateItem(o,i,e.defaultState,null,null,!0,t,s)})),v.forEach(m),this.orderLiveColsLikeState(e),this.visibleColsService.refresh(t),this.eventDispatcher.everythingChanged(t),r(),{unmatchedAndAutoStates:u,unmatchedCount:c}};this.columnAnimationService.start();let{unmatchedAndAutoStates:n,unmatchedCount:r}=o(e.state||[],i,(e=>this.columnModel.getColDefCol(e)));if(n.length>0||P(e.defaultState)){const e=this.pivotResultColsService.getPivotResultCols();r=o(n,(null==e?void 0:e.list)||[],(e=>this.pivotResultColsService.getPivotResultCol(e))).unmatchedCount}return this.columnAnimationService.finish(),0===r}resetColumnState(e){if(E(this.columnModel.getColDefCols()))return;const t=We(this.columnModel.getColDefColTree()),i=[];let s=1e3,o=1e3,n=[];const r=this.columnModel.getAutoCols();r&&(n=n.concat(r)),t&&(n=n.concat(t)),n.forEach((e=>{const t=this.getColumnStateFromColDef(e);D(t.rowGroupIndex)&&t.rowGroup&&(t.rowGroupIndex=s++),D(t.pivotIndex)&&t.pivot&&(t.pivotIndex=o++),i.push(t)})),this.applyColumnState({state:i,applyOrder:!0},e)}getColumnStateFromColDef(e){const t=(e,t)=>null!=e?e:null!=t?t:null,i=e.getColDef(),s=t(i.sort,i.initialSort),o=t(i.sortIndex,i.initialSortIndex),n=t(i.hide,i.initialHide),r=t(i.pinned,i.initialPinned),l=t(i.width,i.initialWidth),a=t(i.flex,i.initialFlex);let d=t(i.rowGroupIndex,i.initialRowGroupIndex),h=t(i.rowGroup,i.initialRowGroup);null!=d||null!=h&&0!=h||(d=null,h=null);let u=t(i.pivotIndex,i.initialPivotIndex),c=t(i.pivot,i.initialPivot);null!=u||null!=c&&0!=c||(u=null,c=null);const g=t(i.aggFunc,i.initialAggFunc);return{colId:e.getColId(),sort:s,sortIndex:o,hide:n,pinned:r,width:l,flex:a,rowGroup:h,rowGroupIndex:d,pivot:c,pivotIndex:u,aggFunc:g}}syncColumnWithStateItem(e,t,i,s,o,n,r,l){if(!e)return;const a=(e,s)=>{const o={value1:void 0,value2:void 0};let n=!1;return t&&(void 0!==t[e]&&(o.value1=t[e],n=!0),P(s)&&void 0!==t[s]&&(o.value2=t[s],n=!0)),!n&&i&&(void 0!==i[e]&&(o.value1=i[e]),P(s)&&void 0!==i[s]&&(o.value2=i[s])),o},d=a("hide").value1;void 0!==d&&e.setVisible(!d,r);const h=a("pinned").value1;void 0!==h&&e.setPinned(h);const u=e.getColDef().minWidth??this.gos.environment.getDefaultColumnMinWidth(),c=a("flex").value1;if(void 0!==c&&e.setFlex(c),null==c){const t=a("width").value1;null!=t&&null!=u&&t>=u&&e.setActualWidth(t,r)}const g=a("sort").value1;void 0!==g&&("desc"===g||"asc"===g?e.setSort(g,r):e.setSort(void 0,r));const p=a("sortIndex").value1;if(void 0!==p&&e.setSortIndex(p),n||!e.isPrimary())return;const v=a("aggFunc").value1;void 0!==v&&("string"==typeof v?(e.setAggFunc(v),e.isValueActive()||(e.setValueActive(!0,r),l.addValueCol(e))):(P(v)&&m("stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON."),e.isValueActive()&&(e.setValueActive(!1,r),l.removeValueCol(e))));const{value1:C,value2:f}=a("rowGroup","rowGroupIndex");void 0===C&&void 0===f||("number"==typeof f||C?(e.isRowGroupActive()||(e.setRowGroupActive(!0,r),l.addGroupCol(e)),s&&"number"==typeof f&&(s[e.getId()]=f)):e.isRowGroupActive()&&(e.setRowGroupActive(!1,r),l.removeGroupCol(e)));const{value1:w,value2:S}=a("pivot","pivotIndex");void 0===w&&void 0===S||("number"==typeof S||w?(e.isPivotActive()||(e.setPivotActive(!0,r),l.addPivotCol(e)),o&&"number"==typeof S&&(o[e.getId()]=S)):e.isPivotActive()&&(e.setPivotActive(!1,r),l.removePivotCol(e)))}orderLiveColsLikeState(e){if(!e.applyOrder||!e.state)return;const t=[];e.state.forEach((e=>{null!=e.colId&&t.push(e.colId)})),this.columnModel.sortColsLikeKeys(t)}compareColumnStatesAndDispatchEvents(e){const t={rowGroupColumns:this.funcColsService.getRowGroupColumns().slice(),pivotColumns:this.funcColsService.getPivotColumns().slice(),valueColumns:this.funcColsService.getValueColumns().slice()},i=this.columnGetStateService.getColumnState(),s={};return i.forEach((e=>{s[e.colId]=e})),()=>{const o=this.columnModel.getAllCols(),n=(t,i,s,o)=>{if(Se(i.map(o),s.map(o)))return;const n=new Set(i);s.forEach((e=>{n.delete(e)||n.add(e)}));const r=[...n];this.eventService.dispatchEvent({type:t,columns:r,column:1===r.length?r[0]:null,source:e})},r=e=>{const t=[];return o.forEach((i=>{const o=s[i.getColId()];o&&e(o,i)&&t.push(i)})),t},l=e=>e.getColId();n("columnRowGroupChanged",t.rowGroupColumns,this.funcColsService.getRowGroupColumns(),l),n("columnPivotChanged",t.pivotColumns,this.funcColsService.getPivotColumns(),l);const a=r(((e,t)=>{const i=null!=e.aggFunc,s=i!=t.isValueActive(),o=i&&e.aggFunc!=t.getAggFunc();return s||o}));a.length>0&&this.eventDispatcher.columnChanged("columnValueChanged",a,e);this.eventDispatcher.columnResized(r(((e,t)=>e.width!=t.getActualWidth())),!0,e);this.eventDispatcher.columnPinned(r(((e,t)=>e.pinned!=t.getPinned())),e);this.eventDispatcher.columnVisible(r(((e,t)=>e.hide==t.isVisible())),e);const d=r(((e,t)=>e.sort!=t.getSort()||e.sortIndex!=t.getSortIndex()));d.length>0&&this.sortController.dispatchSortChangedEvents(e,d),this.normaliseColumnMovedEventForColumnState(i,e)}}normaliseColumnMovedEventForColumnState(e,t){const i=this.columnGetStateService.getColumnState(),s={};i.forEach((e=>s[e.colId]=e));const o={};e.forEach((e=>{s[e.colId]&&(o[e.colId]=!0)}));const n=e.filter((e=>o[e.colId])),r=i.filter((e=>o[e.colId])),l=[];r.forEach(((e,t)=>{const i=n&&n[t];if(i&&i.colId!==e.colId){const e=this.columnModel.getCol(i.colId);e&&l.push(e)}})),l.length&&this.eventDispatcher.columnMoved({movedColumns:l,source:t,finished:!0})}},wt=(e,t,i,s)=>{const o=e[i.getId()],n=e[s.getId()],r=null!=o,l=null!=n;if(r&&l)return o-n;if(r)return-1;if(l)return 1;const a=t.indexOf(i),d=t.indexOf(s),h=a>=0;return h&&d>=0?a-d:h?-1:1},St=class extends Oe{constructor(){super(...arguments),this.beanName="columnMoveService"}wireBeans(e){this.columnModel=e.columnModel,this.columnAnimationService=e.columnAnimationService,this.eventDispatcher=e.columnEventDispatcher}moveColumnByIndex(e,t,i){const s=this.columnModel.getCols();if(!s)return;const o=s[e];this.moveColumns([o],t,i)}moveColumns(e,t,i,s=!0){const o=this.columnModel.getCols();if(!o)return;if(t>o.length-e.length)return m("tried to insert columns in invalid location, toIndex = ",t),void m("remember that you should not count the moving columns when calculating the new index");this.columnAnimationService.start();const n=this.columnModel.getColsForKeys(e);this.doesMovePassRules(n,t)&&(this.columnModel.moveInCols(n,t,i),this.eventDispatcher.columnMoved({movedColumns:n,source:i,toIndex:t,finished:s})),this.columnAnimationService.finish()}doesMovePassRules(e,t){const i=this.getProposedColumnOrder(e,t);return this.doesOrderPassRules(i)}doesOrderPassRules(e){return!!this.doesMovePassMarryChildren(e)&&!!this.doesMovePassLockedPositions(e)}getProposedColumnOrder(e,t){const i=this.columnModel.getCols().slice();return Fe(i,e,t),i}doesMovePassLockedPositions(e){const t=this.gos.get("enableRtl");let i=t?1:-1,s=!0;return e.forEach((e=>{const o=(n=e.getColDef().lockPosition)?"left"===n||!0===n?-1:1:0;var n;t?o>i&&(s=!1):o{if(!Ge(i))return;const s=i,o=s.getColGroupDef();if(!(o&&o.marryChildren))return;const n=[];s.getLeafColumns().forEach((t=>{const i=e.indexOf(t);n.push(i)}));Math.max.apply(Math,n)-Math.min.apply(Math,n)>s.getLeafColumns().length-1&&(t=!1)})),t}placeLockedColumns(e){const t=[],i=[],s=[];e.forEach((e=>{const o=e.getColDef().lockPosition;"right"===o?s.push(e):"left"===o||!0===o?t.push(e):i.push(e)}));return this.gos.get("enableRtl")?[...s,...i,...t]:[...t,...i,...s]}},yt=/[&<>"']/g,bt={"&":"&","<":"<",">":">",'"':""","'":"'"};function Rt(e,t){if(null==e)return null;const i=e.toString().toString();return t?i:i.replace(yt,(e=>bt[e]))}var Ft=class extends Oe{constructor(){super(...arguments),this.beanName="columnNameService"}wireBeans(e){this.expressionService=e.expressionService,this.funcColsService=e.funcColsService,this.columnModel=e.columnModel}getDisplayNameForColumn(e,t,i=!1){if(!e)return null;const s=this.getHeaderName(e.getColDef(),e,null,null,t);return i?this.wrapHeaderNameWithAggFunc(e,s):s}getDisplayNameForProvidedColumnGroup(e,t,i){const s=t?t.getColGroupDef():null;return s?this.getHeaderName(s,null,e,t,i):null}getDisplayNameForColumnGroup(e,t){return this.getDisplayNameForProvidedColumnGroup(e,e.getProvidedColumnGroup(),t)}getHeaderName(e,t,i,s,o){const n=e.headerValueGetter;if(n){const r=this.gos.addGridCommonParams({colDef:e,column:t,columnGroup:i,providedColumnGroup:s,location:o});return"function"==typeof n?n(r):"string"==typeof n?this.expressionService.evaluate(n,r):(m("headerValueGetter must be a function or a string"),"")}return null!=e.headerName?e.headerName:e.field?(r=e.field)&&null!=r?r.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z])([a-z])/g,"$1 $2$3").replace(/\./g," ").split(" ").map((e=>e.substring(0,1).toUpperCase()+(e.length>1?e.substring(1,e.length):""))).join(" "):null:"";var r}wrapHeaderNameWithAggFunc(e,t){if(this.gos.get("suppressAggFuncInHeader"))return t;const i=e.getColDef().pivotValueColumn;let s,o=null;if(P(i)){const n=this.funcColsService.getValueColumns(),r=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&1===n.length,l=void 0!==e.getColDef().pivotTotalColumnIds;if(r&&!l)return t;o=i?i.getAggFunc():null,s=!0}else{const t=e.isValueActive(),i=this.columnModel.isPivotMode()||!this.funcColsService.isRowGroupEmpty();t&&i?(o=e.getAggFunc(),s=!0):s=!1}if(s){const e="string"==typeof o?o:"func";return`${this.localeService.getLocaleTextFunc()(e,e)}(${t})`}return t}},Pt=class extends Oe{constructor(){super(...arguments),this.beanName="pivotResultColsService"}wireBeans(e){this.context=e.context,this.columnModel=e.columnModel,this.columnFactory=e.columnFactory,this.visibleColsService=e.visibleColsService}destroy(){var e;Ue(this.context,null==(e=this.pivotResultCols)?void 0:e.tree),super.destroy()}isPivotResultColsPresent(){return null!=this.pivotResultCols}lookupPivotResultCol(e,t){if(null==this.pivotResultCols)return null;const i=this.columnModel.getColDefCol(t);let s=null;return this.pivotResultCols.list.forEach((t=>{const o=t.getColDef().pivotKeys,n=t.getColDef().pivotValueColumn;Se(o,e)&&n===i&&(s=t)})),s}getPivotResultCols(){return this.pivotResultCols}getPivotResultCol(e){return this.pivotResultCols?this.columnModel.getColFromCollection(e,this.pivotResultCols):null}setPivotResultCols(e,t){var i,s;if(this.columnModel.isReady()&&(null!=e||null!=this.pivotResultCols)){if(e){this.processPivotResultColDef(e);const o=this.columnFactory.createColumnTree(e,!1,(null==(i=this.pivotResultCols)?void 0:i.tree)||this.previousPivotResultCols||void 0,t);Ue(this.context,null==(s=this.pivotResultCols)?void 0:s.tree,o.columnTree);const n=o.columnTree,r=o.treeDept,l=We(n),a={};this.pivotResultCols={tree:n,treeDepth:r,list:l,map:a},this.pivotResultCols.list.forEach((e=>this.pivotResultCols.map[e.getId()]=e));const d=!!this.previousPivotResultCols;this.previousPivotResultCols=null,this.columnModel.refreshCols(!d)}else this.previousPivotResultCols=this.pivotResultCols?this.pivotResultCols.tree:null,this.pivotResultCols=null,this.columnModel.refreshCols(!1);this.visibleColsService.refresh(t)}}processPivotResultColDef(e){const t=this.gos.get("processPivotResultColDef"),i=this.gos.get("processPivotResultColGroupDef");if(!t&&!i)return;const s=e=>{e.forEach((e=>{if(P(e.children)){const t=e;i&&i(t),s(t.children)}else{t&&t(e)}}))};e&&s(e)}},Dt=class extends Oe{constructor(){super(...arguments),this.beanName="columnSizeService"}wireBeans(e){this.columnModel=e.columnModel,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher,this.visibleColsService=e.visibleColsService,this.ctrlsService=e.ctrlsService}setColumnWidths(e,t,i,s){const o=[];e.forEach((e=>{const i=this.columnModel.getColDefCol(e.key)||this.columnModel.getCol(e.key);if(!i)return;o.push({width:e.newWidth,ratios:[1],columns:[i]});if("shift"===this.gos.get("colResizeDefault")&&(t=!t),t){const t=this.visibleColsService.getColAfter(i);if(!t)return;const s=i.getActualWidth()-e.newWidth,n=t.getActualWidth()+s;o.push({width:n,ratios:[1],columns:[t]})}})),0!==o.length&&this.resizeColumnSets({resizeSets:o,finished:i,source:s})}resizeColumnSets(e){const{resizeSets:t,finished:i,source:s}=e;if(!(!t||t.every((e=>this.checkMinAndMaxWidthsForSet(e))))){if(i){const e=t&&t.length>0?t[0].columns:null;this.eventDispatcher.columnResized(e,i,s)}return}const o=[],n=[];t.forEach((e=>{const{width:t,columns:i,ratios:r}=e,l={},a={};i.forEach((e=>n.push(e)));let d=!0,h=0;for(;d;){if(h++,h>1e3){v("infinite loop in resizeColumnSets");break}d=!1;const e=[];let s=0,o=t;i.forEach(((t,i)=>{if(a[t.getId()])o-=l[t.getId()];else{e.push(t);const o=r[i];s+=o}}));const n=1/s;e.forEach(((i,s)=>{let h;s===e.length-1?h=o:(h=Math.round(r[s]*t*n),o-=h);const u=i.getMinWidth(),c=i.getMaxWidth();h0&&h>c&&(h=c,a[i.getId()]=!0,d=!0),l[i.getId()]=h}))}i.forEach((e=>{const t=l[e.getId()];e.getActualWidth()!==t&&(e.setActualWidth(t,s),o.push(e))}))}));const r=o.length>0;let l=[];r&&(l=this.refreshFlexedColumns({resizingCols:n,skipSetLeft:!0}),this.visibleColsService.setLeftValues(s),this.visibleColsService.updateBodyWidths(),this.columnViewportService.checkViewportColumns());const a=n.concat(l);(r||i)&&this.eventDispatcher.columnResized(a,i,s,l)}checkMinAndMaxWidthsForSet(e){const{columns:t,width:i}=e;let s=0,o=0,n=!0;t.forEach((e=>{const t=e.getMinWidth();s+=t||0;const i=e.getMaxWidth();i>0?o+=i:n=!1}));return i>=s&&(!n||i<=o)}refreshFlexedColumns(e={}){const t=e.source?e.source:"flex";if(null!=e.viewportWidth&&(this.flexViewportWidth=e.viewportWidth),!this.flexViewportWidth)return[];const i=this.visibleColsService.getCenterCols();let s=-1;if(e.resizingCols){const t=new Set(e.resizingCols);for(let e=i.length-1;e>=0;e--)if(t.has(i[e])){s=e;break}}let o=0,n=[],r=0,l=0;for(let c=0;cs?(n.push(i[c]),l+=i[c].getFlex(),r+=i[c].getMinWidth()):o+=i[c].getActualWidth()}if(!n.length)return[];let a=[];o+r>this.flexViewportWidth&&(n.forEach((e=>e.setActualWidth(e.getMinWidth(),t))),a=n,n=[]);const d=[];let h;e:for(;;){h=this.flexViewportWidth-o;const e=h/l;for(let i=0;ic&&(h=c),h){s.setActualWidth(h,t),ye(n,s),l-=s.getFlex(),a.push(s),o+=s.getActualWidth();continue e}d[i]=Math.floor(r)}break}let u=h;return n.forEach(((e,i)=>{const s=ithis.sizeColumnsToFit(e,t,i,s)));const n={};s&&(null==(o=null==s?void 0:s.columnLimits)||o.forEach((({key:e,...t})=>{n["string"==typeof e?e:e.getColId()]=t})));const r=this.visibleColsService.getAllCols(),l=e===ze(r);if(e<=0||!r.length||l)return;const a=[],d=[];r.forEach((e=>{!0===e.getColDef().suppressSizeToFit?d.push(e):a.push(e)}));const h=a.slice(0);let u=!1;const c=e=>{be(a,e),d.push(e)};for(a.forEach((e=>{e.resetActualWidth(t);const i=null==n?void 0:n[e.getId()],o=(null==i?void 0:i.minWidth)??(null==s?void 0:s.defaultMinWidth),r=(null==i?void 0:i.maxWidth)??(null==s?void 0:s.defaultMaxWidth),l=e.getActualWidth();"number"==typeof o&&lr&&e.setActualWidth(r,t,!0)}));!u;){u=!0;const i=e-ze(d);if(i<=0)a.forEach((e=>{var i;const o=(null==(i=null==n?void 0:n[e.getId()])?void 0:i.minWidth)??(null==s?void 0:s.defaultMinWidth);"number"!=typeof o?e.setMinimum(t):e.setActualWidth(o,t,!0)}));else{const e=i/ze(a);let o=i;for(let i=a.length-1;i>=0;i--){const r=a[i],l=null==n?void 0:n[r.getId()],d=(null==l?void 0:l.minWidth)??(null==s?void 0:s.defaultMinWidth),h=(null==l?void 0:l.maxWidth)??(null==s?void 0:s.defaultMaxWidth),g=r.getMinWidth(),p=r.getMaxWidth(),m="number"==typeof d&&d>g?d:g,v="number"==typeof h&&hv?(C=v,c(r),u=!1):0===i&&(C=o),r.setActualWidth(C,t,!0),o-=C}}}h.forEach((e=>{e.fireColumnWidthChangedEvent(t)})),this.visibleColsService.setLeftValues(t),this.visibleColsService.updateBodyWidths(),i||this.eventDispatcher.columnResized(h,!0,t)}applyAutosizeStrategy(){const e=this.gos.get("autoSizeStrategy");if(!e)return;const{type:t}=e;setTimeout((()=>{if("fitGridWidth"===t){const{columnLimits:t,defaultMinWidth:i,defaultMaxWidth:s}=e,o=null==t?void 0:t.map((({colId:e,minWidth:t,maxWidth:i})=>({key:e,minWidth:t,maxWidth:i})));this.ctrlsService.getGridBodyCtrl().sizeColumnsToFit({defaultMinWidth:i,defaultMaxWidth:s,columnLimits:o})}else"fitProvidedWidth"===t&&this.sizeColumnsToFit(e.width,"sizeColumnsToFit")}))}};function Et(e,t){return e+"_"+t}function Mt(e){return e instanceof xt}var xt=class extends Oe{constructor(e,t,i,s){super(),this.isColumn=!1,this.displayedChildren=[],this.autoHeaderHeight=null,this.parent=null,this.groupId=t,this.partId=i,this.providedColumnGroup=e,this.pinned=s}reset(){this.parent=null,this.children=null,this.displayedChildren=null}getParent(){return this.parent}setParent(e){this.parent=e}getUniqueId(){return Et(this.groupId,this.partId)}isEmptyGroup(){return 0===this.displayedChildren.length}isMoving(){const e=this.getProvidedColumnGroup().getLeafColumns();return!(!e||0===e.length)&&e.every((e=>e.isMoving()))}checkLeft(){if(this.displayedChildren.forEach((e=>{Mt(e)&&e.checkLeft()})),this.displayedChildren.length>0)if(this.gos.get("enableRtl")){const e=we(this.displayedChildren).getLeft();this.setLeft(e)}else{const e=this.displayedChildren[0].getLeft();this.setLeft(e)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft(e){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.dispatchLocalEvent({type:"leftChanged"}))}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let e=0;return this.displayedChildren&&this.displayedChildren.forEach((t=>{e+=t.getActualWidth()})),e}isResizable(){if(!this.displayedChildren)return!1;let e=!1;return this.displayedChildren.forEach((t=>{t.isResizable()&&(e=!0)})),e}getMinWidth(){let e=0;return this.displayedChildren.forEach((t=>{e+=t.getMinWidth()})),e}addChild(e){this.children||(this.children=[]),this.children.push(e)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}getDisplayedLeafColumns(){const e=[];return this.addDisplayedLeafColumns(e),e}getDefinition(){return this.providedColumnGroup.getColGroupDef()}getColGroupDef(){return this.providedColumnGroup.getColGroupDef()}isPadding(){return this.providedColumnGroup.isPadding()}isExpandable(){return this.providedColumnGroup.isExpandable()}isExpanded(){return this.providedColumnGroup.isExpanded()}setExpanded(e){this.providedColumnGroup.setExpanded(e)}isAutoHeaderHeight(){var e;return!!(null==(e=this.getColGroupDef())?void 0:e.autoHeaderHeight)}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}addDisplayedLeafColumns(e){this.displayedChildren.forEach((t=>{nt(t)?e.push(t):Mt(t)&&t.addDisplayedLeafColumns(e)}))}addLeafColumns(e){this.children.forEach((t=>{nt(t)?e.push(t):Mt(t)&&t.addLeafColumns(e)}))}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){const e=this.getParent();return this.isPadding()&&e&&e.isPadding()?1+e.getPaddingLevel():0}calculateDisplayedColumns(){this.displayedChildren=[];let e=this;for(;null!=e&&e.isPadding();)e=e.getParent();if(!(!!e&&e.getProvidedColumnGroup().isExpandable()))return this.displayedChildren=this.children,void this.dispatchLocalEvent({type:"displayedChildrenChanged"});this.children.forEach((t=>{if(Mt(t)&&(!t.displayedChildren||!t.displayedChildren.length))return;switch(t.getColumnGroupShow()){case"open":e.getProvidedColumnGroup().isExpanded()&&this.displayedChildren.push(t);break;case"closed":e.getProvidedColumnGroup().isExpanded()||this.displayedChildren.push(t);break;default:this.displayedChildren.push(t)}})),this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},At=class{constructor(){this.existingIds={}}getInstanceIdForKey(e){const t=this.existingIds[e];let i;return i="number"!=typeof t?0:t+1,this.existingIds[e]=i,i}},Tt=class extends Oe{constructor(){super(...arguments),this.beanName="visibleColsService",this.colsAndGroupsMap={},this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.bodyWidth=0,this.leftWidth=0,this.rightWidth=0,this.bodyWidthDirty=!0}wireBeans(e){this.columnModel=e.columnModel,this.columnSizeService=e.columnSizeService,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher}refresh(e,t=!1){t||this.buildTrees(),this.updateOpenClosedVisibilityInColumnGroups(),this.columnsLeft=Lt(this.treeLeft),this.columnsCenter=Lt(this.treeCenter),this.columnsRight=Lt(this.treeRight),this.joinColsAriaOrder(),this.joinCols(),this.setLeftValues(e),this.autoHeightCols=this.columns.filter((e=>e.isAutoHeight())),this.columnSizeService.refreshFlexedColumns(),this.updateBodyWidths(),this.columnViewportService.checkViewportColumns(!1),this.setFirstRightAndLastLeftPinned(e),this.eventDispatcher.visibleCols(e)}updateBodyWidths(){const e=ze(this.columnsCenter),t=ze(this.columnsLeft),i=ze(this.columnsRight);this.bodyWidthDirty=this.bodyWidth!==e;(this.bodyWidth!==e||this.leftWidth!==t||this.rightWidth!==i)&&(this.bodyWidth=e,this.leftWidth=t,this.rightWidth=i,this.eventService.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventService.dispatchEvent({type:"displayedColumnsWidthChanged"}))}setLeftValues(e){this.setLeftValuesOfCols(e),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned(e){let t,i;this.gos.get("enableRtl")?(t=this.columnsLeft?this.columnsLeft[0]:null,i=this.columnsRight?we(this.columnsRight):null):(t=this.columnsLeft?we(this.columnsLeft):null,i=this.columnsRight?this.columnsRight[0]:null),this.columnModel.getCols().forEach((s=>{s.setLastLeftPinned(s===t,e),s.setFirstRightPinned(s===i,e)}))}buildTrees(){const e=this.columnModel.getColsToShow(),t=e.filter((e=>"left"==e.getPinned())),i=e.filter((e=>"right"==e.getPinned())),s=e.filter((e=>"left"!=e.getPinned()&&"right"!=e.getPinned())),o=new At;this.treeLeft=this.createGroups({columns:t,idCreator:o,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=this.createGroups({columns:i,idCreator:o,pinned:"right",oldDisplayedGroups:this.treeRight}),this.treeCenter=this.createGroups({columns:s,idCreator:o,pinned:null,oldDisplayedGroups:this.treeCenter}),this.updateColsAndGroupsMap()}clear(){this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.ariaOrderColumns=[]}joinColsAriaOrder(){const e=this.columnModel.getCols(),t=[],i=[],s=[];for(const o of e){const e=o.getPinned();e?!0===e||"left"===e?t.push(o):s.push(o):i.push(o)}this.ariaOrderColumns=t.concat(i).concat(s)}getAriaColIndex(e){let t;return t=Mt(e)?e.getLeafColumns()[0]:e,this.ariaOrderColumns.indexOf(t)+1}getAllAutoHeightCols(){return this.autoHeightCols}setLeftValuesOfGroups(){[this.treeLeft,this.treeRight,this.treeCenter].forEach((e=>{e.forEach((e=>{if(Mt(e)){e.checkLeft()}}))}))}setLeftValuesOfCols(e){if(!this.columnModel.getColDefCols())return;const t=this.columnModel.getCols().slice(0),i=this.gos.get("enableRtl");[this.columnsLeft,this.columnsRight,this.columnsCenter].forEach((s=>{if(i){let t=ze(s);s.forEach((i=>{t-=i.getActualWidth(),i.setLeft(t,e)}))}else{let t=0;s.forEach((i=>{i.setLeft(t,e),t+=i.getActualWidth()}))}!function(e,t){for(let i=0;i{t.setLeft(null,e)}))}joinCols(){this.gos.get("enableRtl")?this.columns=this.columnsRight.concat(this.columnsCenter).concat(this.columnsLeft):this.columns=this.columnsLeft.concat(this.columnsCenter).concat(this.columnsRight)}getColsCenter(){return this.columnsCenter}getAllTrees(){return this.treeLeft&&this.treeRight&&this.treeCenter?this.treeLeft.concat(this.treeCenter).concat(this.treeRight):null}getTreeLeft(){return this.treeLeft}getTreeRight(){return this.treeRight}getTreeCenter(){return this.treeCenter}getAllCols(){return this.columns}isColDisplayed(e){return this.getAllCols().indexOf(e)>=0}getLeftColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsLeft):this.columnsLeft}getRightColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsRight):this.columnsRight}getColsForRow(e,t,i,s){const o=[];let n=null;for(let r=0;r1){const e=d-1;for(let i=1;i<=e;i++)h.push(t[r+i]);r+=e}let u;if(i?(u=!1,h.forEach((e=>{i(e)&&(u=!0)}))):u=!0,u){if(0===o.length&&n){!!s&&s(l)&&o.push(n)}o.push(l)}n=l}return o}getBodyContainerWidth(){return this.bodyWidth}getContainerWidth(e){switch(e){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getCenterCols(){return this.columnsCenter}getLeftCols(){return this.columnsLeft}getRightCols(){return this.columnsRight}getColBefore(e){const t=this.getAllCols(),i=t.indexOf(e);return i>0?t[i-1]:null}getGroupAtDirection(e,t){const i=e.getProvidedColumnGroup().getLevel()+e.getPaddingLevel(),s=e.getDisplayedLeafColumns(),o="After"===t?we(s):s[0],n=`getCol${t}`;for(;;){const t=this[n](o);if(!t)return null;const s=this.getColGroupAtLevel(t,i);if(s!==e)return s}}getColGroupAtLevel(e,t){let i,s,o=e.getParent();for(;;){if(i=o.getProvidedColumnGroup().getLevel(),s=o.getPaddingLevel(),i+s<=t)break;o=o.getParent()}return o}isPinningLeft(){return this.columnsLeft.length>0}isPinningRight(){return this.columnsRight.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};const e=e=>{this.colsAndGroupsMap[e.getUniqueId()]=e};It(this.treeCenter,!1,e),It(this.treeLeft,!1,e),It(this.treeRight,!1,e)}isVisible(e){return this.colsAndGroupsMap[e.getUniqueId()]===e}updateOpenClosedVisibilityInColumnGroups(){It(this.getAllTrees(),!1,(e=>{Mt(e)&&e.calculateDisplayedColumns()}))}getFirstColumn(){const e=this.gos.get("enableRtl"),t=["getLeftCols","getCenterCols","getRightCols"];e&&t.reverse();for(let i=0;i{if(Mt(i)){const n=i;let r;r=s?e===n.getGroupId()&&t===n.getPartId():e===n.getGroupId(),r&&(o=n)}})),o}getColAfter(e){const t=this.getAllCols(),i=t.indexOf(e);return i{const d=t;t=o;const h=e[d],u=(Mt(h)?h.getProvidedColumnGroup():h).getOriginalParent();if(null==u){for(let t=d;t{e.forEach((e=>{if(Mt(e)){const s=e;t[e.getUniqueId()]=s,i(s.getChildren())}}))};return e&&i(e),t}setupParentsIntoCols(e,t){e.forEach((e=>{if(e.setParent(t),Mt(e)){const t=e;this.setupParentsIntoCols(t.getChildren(),t)}}))}};function It(e,t,i){if(e)for(let s=0;s{nt(e)&&t.push(e)})),t}var kt=["columnEverythingChanged","newColumnsLoaded","columnPivotModeChanged","pivotMaxColumnsExceeded","columnRowGroupChanged","expandOrCollapseAll","columnPivotChanged","gridColumnsChanged","columnValueChanged","columnMoved","columnVisible","columnPinned","columnGroupOpened","columnResized","displayedColumnsChanged","virtualColumnsChanged","columnHeaderMouseOver","columnHeaderMouseLeave","columnHeaderClicked","columnHeaderContextMenu","asyncTransactionsFlushed","rowGroupOpened","rowDataUpdated","pinnedRowDataChanged","rangeSelectionChanged","cellSelectionChanged","chartCreated","chartRangeSelectionChanged","chartOptionsChanged","chartDestroyed","toolPanelVisibleChanged","toolPanelSizeChanged","modelUpdated","cutStart","cutEnd","pasteStart","pasteEnd","fillStart","fillEnd","cellSelectionDeleteStart","cellSelectionDeleteEnd","rangeDeleteStart","rangeDeleteEnd","undoStarted","undoEnded","redoStarted","redoEnded","cellClicked","cellDoubleClicked","cellMouseDown","cellContextMenu","cellValueChanged","cellEditRequest","rowValueChanged","headerFocused","cellFocused","rowSelected","selectionChanged","tooltipShow","tooltipHide","cellKeyDown","cellMouseOver","cellMouseOut","filterChanged","filterModified","filterOpened","advancedFilterBuilderVisibleChanged","sortChanged","virtualRowRemoved","rowClicked","rowDoubleClicked","gridReady","gridPreDestroyed","gridSizeChanged","viewportChanged","firstDataRendered","dragStarted","dragStopped","dragCancelled","rowEditingStarted","rowEditingStopped","cellEditingStarted","cellEditingStopped","bodyScroll","bodyScrollEnd","paginationChanged","componentStateChanged","storeRefreshed","stateUpdated","columnMenuVisibleChanged","contextMenuVisibleChanged","rowDragEnter","rowDragMove","rowDragLeave","rowDragEnd","rowDragCancel"],Ot=[...kt,"scrollbarWidthChanged","keyShortcutChangedCellStart","keyShortcutChangedCellEnd","pinnedHeightChanged","cellFocusCleared","fullWidthRowFocused","checkboxChanged","heightScaleChanged","suppressMovableColumns","suppressMenuHide","suppressFieldDotNotation","columnPanelItemDragStart","columnPanelItemDragEnd","bodyHeightChanged","columnContainerWidthChanged","displayedColumnsWidthChanged","scrollVisibilityChanged","scrollGapChanged","columnHoverChanged","flashCells","paginationPixelOffsetChanged","displayedRowsChanged","leftPinnedWidthChanged","rightPinnedWidthChanged","rowContainerHeightChanged","headerHeightChanged","columnGroupHeaderHeightChanged","columnHeaderHeightChanged","gridStylesChanged","storeUpdated","filterDestroyed","rowDataUpdateStarted","rowCountReady","advancedFilterEnabledChanged","dataTypesInferred","fieldValueChanged","fieldPickerValueSelected","richSelectListRowSelected","sideBarUpdated","alignedGridScroll","alignedGridColumn","gridOptionsChanged","chartTitleEdit","recalculateRowBounds","stickyTopOffsetChanged","overlayExclusiveChanged"],Gt={enableBrowserTooltips:!0,tooltipTrigger:!0,tooltipMouseTrack:!0,tooltipShowMode:!0,tooltipInteraction:!0,defaultColGroupDef:!0,suppressAutoSize:!0,skipHeaderOnAutoSize:!0,autoSizeStrategy:!0,components:!0,stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,undoRedoCellEditingLimit:!0,excelStyles:!0,cacheQuickFilter:!0,advancedFilterModel:!0,customChartThemes:!0,chartThemeOverrides:!0,chartToolPanelsDef:!0,loadingCellRendererSelector:!0,localeText:!0,keepDetailRows:!0,keepDetailRowsCount:!0,detailRowHeight:!0,detailRowAutoHeight:!0,tabIndex:!0,valueCache:!0,valueCacheNeverExpires:!0,enableCellExpressions:!0,suppressTouch:!0,suppressAsyncEvents:!0,suppressBrowserResizeObserver:!0,suppressPropertyNamesCheck:!0,debug:!0,dragAndDropImageComponent:!0,loadingOverlayComponent:!0,suppressLoadingOverlay:!0,noRowsOverlayComponent:!0,paginationPageSizeSelector:!0,paginateChildRows:!0,pivotPanelShow:!0,pivotSuppressAutoColumn:!0,suppressExpandablePivotGroups:!0,aggFuncs:!0,suppressAggFuncInHeader:!0,allowShowChangeAfterFilter:!0,ensureDomOrder:!0,enableRtl:!0,suppressColumnVirtualisation:!0,suppressMaxRenderedRowRestriction:!0,suppressRowVirtualisation:!0,rowDragText:!0,suppressGroupMaintainValueType:!0,groupLockGroupColumns:!0,rowGroupPanelSuppressSort:!0,suppressGroupRowsSticky:!0,rowModelType:!0,cacheOverflowSize:!0,infiniteInitialRowCount:!0,serverSideInitialRowCount:!0,suppressServerSideInfiniteScroll:!0,maxBlocksInCache:!0,maxConcurrentDatasourceRequests:!0,blockLoadDebounceMillis:!0,serverSideOnlyRefreshFilteredGroups:!0,serverSidePivotResultFieldSeparator:!0,viewportRowModelPageSize:!0,viewportRowModelBufferSize:!0,debounceVerticalScrollbar:!0,suppressAnimationFrame:!0,suppressPreventDefaultOnMouseWheel:!0,scrollbarWidth:!0,icons:!0,suppressRowTransform:!0,gridId:!0,enableGroupEdit:!0,initialState:!0,processUnpinnedColumns:!0,createChartContainer:!0,getLocaleText:!0,getRowId:!0,reactiveCustomComponents:!0,columnMenu:!0,suppressSetFilterByDefault:!0},Nt=class{};Nt.STRING_PROPERTIES=["overlayLoadingTemplate","overlayNoRowsTemplate","gridId","quickFilterText","rowModelType","editType","domLayout","clipboardDelimiter","rowGroupPanelShow","multiSortKey","pivotColumnGroupTotals","pivotRowTotals","pivotPanelShow","fillHandleDirection","groupDisplayType","treeDataDisplayType","colResizeDefault","tooltipTrigger","serverSidePivotResultFieldSeparator","columnMenu","tooltipShowMode","grandTotalRow"],Nt.OBJECT_PROPERTIES=["components","rowStyle","context","autoGroupColumnDef","localeText","icons","datasource","dragAndDropImageComponentParams","serverSideDatasource","viewportDatasource","groupRowRendererParams","aggFuncs","fullWidthCellRendererParams","defaultColGroupDef","defaultColDef","defaultCsvExportParams","defaultExcelExportParams","columnTypes","rowClassRules","detailCellRendererParams","loadingCellRendererParams","loadingOverlayComponentParams","noRowsOverlayComponentParams","popupParent","statusBar","sideBar","theme","chartThemeOverrides","customChartThemes","chartToolPanelsDef","dataTypeDefinitions","advancedFilterModel","advancedFilterParent","advancedFilterBuilderParams","initialState","autoSizeStrategy","cellSelection","selectionColumnDef"],Nt.ARRAY_PROPERTIES=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector"],Nt.NUMBER_PROPERTIES=["rowHeight","detailRowHeight","rowBuffer","headerHeight","groupHeaderHeight","groupLockGroupColumns","floatingFiltersHeight","pivotHeaderHeight","pivotGroupHeaderHeight","groupDefaultExpanded","pivotDefaultExpanded","viewportRowModelPageSize","viewportRowModelBufferSize","autoSizePadding","maxBlocksInCache","maxConcurrentDatasourceRequests","tooltipShowDelay","tooltipHideDelay","cacheOverflowSize","paginationPageSize","cacheBlockSize","infiniteInitialRowCount","serverSideInitialRowCount","scrollbarWidth","asyncTransactionWaitMillis","blockLoadDebounceMillis","keepDetailRowsCount","undoRedoCellEditingLimit","cellFlashDelay","cellFadeDelay","cellFlashDuration","cellFadeDuration","tabIndex","pivotMaxGeneratedColumns"],Nt.BOOLEAN_PROPERTIES=["suppressMakeColumnVisibleAfterUnGroup","suppressRowClickSelection","suppressCellFocus","suppressHeaderFocus","suppressHorizontalScroll","groupSelectsChildren","alwaysShowHorizontalScroll","alwaysShowVerticalScroll","debug","enableBrowserTooltips","enableCellExpressions","groupIncludeTotalFooter","groupSuppressBlankHeader","suppressMenuHide","suppressRowDeselection","unSortIcon","suppressMultiSort","alwaysMultiSort","singleClickEdit","suppressLoadingOverlay","suppressNoRowsOverlay","suppressAutoSize","skipHeaderOnAutoSize","suppressColumnMoveAnimation","suppressMoveWhenColumnDragging","suppressMovableColumns","suppressFieldDotNotation","enableRangeSelection","enableRangeHandle","enableFillHandle","suppressClearOnFillReduction","deltaSort","suppressTouch","suppressAsyncEvents","allowContextMenuWithControlKey","suppressContextMenu","enableCellChangeFlash","suppressDragLeaveHidesColumns","suppressRowGroupHidesColumns","suppressMiddleClickScrolls","suppressPreventDefaultOnMouseWheel","suppressCopyRowsToClipboard","copyHeadersToClipboard","copyGroupHeadersToClipboard","pivotMode","suppressAggFuncInHeader","suppressColumnVirtualisation","alwaysAggregateAtRootLevel","suppressFocusAfterRefresh","functionsReadOnly","animateRows","groupSelectsFiltered","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","enableRtl","suppressClickEdit","rowDragEntireRow","rowDragManaged","suppressRowDrag","suppressMoveWhenRowDragging","rowDragMultiRow","enableGroupEdit","embedFullWidthRows","suppressPaginationPanel","groupHideOpenParents","groupAllowUnbalanced","pagination","paginationAutoPageSize","suppressScrollOnNewData","suppressScrollWhenPopupsAreOpen","purgeClosedRowNodes","cacheQuickFilter","includeHiddenColumnsInQuickFilter","ensureDomOrder","accentedSort","suppressChangeDetection","valueCache","valueCacheNeverExpires","aggregateOnlyChangedColumns","suppressAnimationFrame","suppressExcelExport","suppressCsvExport","includeHiddenColumnsInAdvancedFilter","suppressMultiRangeSelection","enterNavigatesVerticallyAfterEdit","enterNavigatesVertically","suppressPropertyNamesCheck","rowMultiSelectWithClick","suppressRowHoverHighlight","suppressRowTransform","suppressClipboardPaste","suppressLastEmptyLineOnPaste","enableCharts","suppressMaintainUnsortedOrder","enableCellTextSelection","suppressBrowserResizeObserver","suppressMaxRenderedRowRestriction","excludeChildrenWhenTreeDataFiltering","tooltipMouseTrack","tooltipInteraction","keepDetailRows","paginateChildRows","preventDefaultOnContextMenu","undoRedoCellEditing","allowDragFromColumnsToolPanel","pivotSuppressAutoColumn","suppressExpandablePivotGroups","debounceVerticalScrollbar","detailRowAutoHeight","serverSideSortAllLevels","serverSideEnableClientSideSort","serverSideOnlyRefreshFilteredGroups","serverSideSortOnServer","serverSideFilterOnServer","suppressAggFilteredOnly","showOpenedGroup","suppressClipboardApi","suppressModelUpdateAfterUpdateTransaction","stopEditingWhenCellsLoseFocus","groupMaintainOrder","columnHoverHighlight","readOnlyEdit","suppressRowVirtualisation","enableCellEditingOnBackspace","resetRowDataOnUpdate","removePivotHeaderRowWhenSingleValueColumn","suppressCopySingleCellRanges","suppressGroupRowsSticky","suppressCutToClipboard","suppressServerSideInfiniteScroll","rowGroupPanelSuppressSort","allowShowChangeAfterFilter","enableAdvancedFilter","masterDetail","treeData","suppressGroupMaintainValueType","reactiveCustomComponents","applyQuickFilterBeforePivotOrAgg","suppressServerSideFullWidthLoadingRow","suppressAdvancedFilterEval","loading","maintainColumnOrder","enableStrictPivotColumnOrder","suppressSetFilterByDefault"],Nt.OTHER_PROPERTIES=["suppressStickyTotalRow","loadThemeGoogleFonts","rowSelection"],Nt.FUNCTION_PROPERTIES=["doesExternalFilterPass","processPivotResultColDef","processPivotResultColGroupDef","getBusinessKeyForNode","isRowSelectable","rowDragText","groupRowRenderer","dragAndDropImageComponent","fullWidthCellRenderer","loadingCellRenderer","loadingOverlayComponent","noRowsOverlayComponent","detailCellRenderer","quickFilterParser","quickFilterMatcher","getLocaleText","isExternalFilterPresent","getRowHeight","getRowClass","getRowStyle","getContextMenuItems","getMainMenuItems","processRowPostCreate","processCellForClipboard","getGroupRowAgg","isFullWidthRow","sendToClipboard","focusGridInnerElement","navigateToNextHeader","tabToNextHeader","navigateToNextCell","tabToNextCell","processCellFromClipboard","getDocument","postProcessPopup","getChildCount","getDataPath","isRowMaster","postSortRows","processHeaderForClipboard","processUnpinnedColumns","processGroupHeaderForClipboard","paginationNumberFormatter","processDataFromClipboard","getServerSideGroupKey","isServerSideGroup","createChartContainer","getChartToolbarItems","fillOperation","isApplyServerSideTransaction","getServerSideGroupLevelParams","isServerSideGroupOpenByDefault","isGroupOpenByDefault","initialGroupOrderComparator","groupIncludeFooter","loadingCellRendererSelector","getRowId","groupAggFiltering","chartMenuItems","groupTotalRow"],Nt.ALL_PROPERTIES=[...Nt.ARRAY_PROPERTIES,...Nt.OBJECT_PROPERTIES,...Nt.STRING_PROPERTIES,...Nt.NUMBER_PROPERTIES,...Nt.FUNCTION_PROPERTIES,...Nt.BOOLEAN_PROPERTIES,...Nt.OTHER_PROPERTIES];var Ht=Nt,Bt=class{static getCallbackForEvent(e){return!e||e.length<2?e:"on"+e[0].toUpperCase()+e.substring(1)}};Bt.VUE_OMITTED_PROPERTY="AG-VUE-OMITTED-PROPERTY",Bt.PUBLIC_EVENTS=kt,Bt.EVENT_CALLBACKS=Ot.map((e=>Bt.getCallbackForEvent(e))),Bt.BOOLEAN_PROPERTIES=Ht.BOOLEAN_PROPERTIES,Bt.ALL_PROPERTIES=Ht.ALL_PROPERTIES,Bt.ALL_PROPERTIES_AND_CALLBACKS=[...Bt.ALL_PROPERTIES,...Bt.EVENT_CALLBACKS],Bt.ALL_PROPERTIES_AND_CALLBACKS_SET=new Set(Bt.ALL_PROPERTIES_AND_CALLBACKS);var Vt=Bt;var Wt=class extends Oe{};function zt(e,t,i){return i&&e.addDestroyFunc((()=>t.destroyBean(i))),i??e}var Ut=class{constructor(e){this.cssClassStates={},this.getGui=e}addCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach((e=>this.addCssClass(e)));if(!0!==this.cssClassStates[e]&&e.length){const t=this.getGui();t&&t.classList.add(e),this.cssClassStates[e]=!0}}removeCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach((e=>this.removeCssClass(e)));if(!1!==this.cssClassStates[e]&&e.length){const t=this.getGui();t&&t.classList.remove(e),this.cssClassStates[e]=!1}}containsCssClass(e){const t=this.getGui();return!!t&&t.classList.contains(e)}addOrRemoveCssClass(e,t){if(!e)return;if(e.indexOf(" ")>=0){const i=(e||"").split(" ");if(i.length>1)return void i.forEach((e=>this.addOrRemoveCssClass(e,t)))}if(this.cssClassStates[e]!==t&&e.length){const i=this.getGui();i&&i.classList.toggle(e,t),this.cssClassStates[e]=t}}};function Kt(e,t,i){null==i||"string"==typeof i&&""==i?$t(e,t):_t(e,t,i)}function _t(e,t,i){e.setAttribute(jt(t),i.toString())}function $t(e,t){e.removeAttribute(jt(t))}function jt(e){return`aria-${e}`}function qt(e,t){t?e.setAttribute("role",t):e.removeAttribute("role")}function Qt(e,t){Kt(e,"label",t)}function Yt(e,t){Kt(e,"labelledby",t)}function Xt(e,t){Kt(e,"live",t)}function Jt(e,t){Kt(e,"hidden",t)}function Zt(e,t){_t(e,"expanded",t)}function ei(e,t){_t(e,"colindex",t)}function ti(e,t){Kt(e,"selected",t)}function ii(e,t){return void 0===t?e("ariaIndeterminate","indeterminate"):!0===t?e("ariaChecked","checked"):e("ariaUnchecked","unchecked")}var si="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function oi(e){const t=Element.prototype.matches||Element.prototype.msMatchesSelector,i=t.call(e,"input, select, button, textarea"),s=t.call(e,si),o=wi(e);return i&&!s&&o}function ni(e,t,i={}){const{skipAriaHidden:s}=i;e.classList.toggle("ag-hidden",!t),s||Jt(e,!t)}function ri(e,t){const i="disabled",s=t?e=>e.setAttribute(i,""):e=>e.removeAttribute(i);s(e),Ei(e.querySelectorAll("input"),(e=>s(e)))}function li(e,t,i){let s=0;for(;e;){if(e.classList.contains(t))return!0;if(e=e.parentElement,"number"==typeof i){if(++s>i)break}else if(e===i)break}return!1}function ai(e){const{height:t,width:i,borderTopWidth:s,borderRightWidth:o,borderBottomWidth:n,borderLeftWidth:r,paddingTop:l,paddingRight:a,paddingBottom:d,paddingLeft:h,marginTop:u,marginRight:c,marginBottom:g,marginLeft:p,boxSizing:m}=window.getComputedStyle(e);return{height:parseFloat(t||"0"),width:parseFloat(i||"0"),borderTopWidth:parseFloat(s||"0"),borderRightWidth:parseFloat(o||"0"),borderBottomWidth:parseFloat(n||"0"),borderLeftWidth:parseFloat(r||"0"),paddingTop:parseFloat(l||"0"),paddingRight:parseFloat(a||"0"),paddingBottom:parseFloat(d||"0"),paddingLeft:parseFloat(h||"0"),marginTop:parseFloat(u||"0"),marginRight:parseFloat(c||"0"),marginBottom:parseFloat(g||"0"),marginLeft:parseFloat(p||"0"),boxSizing:m}}function di(e){const t=ai(e);return"border-box"===t.boxSizing?t.height-t.paddingTop-t.paddingBottom:t.height}function hi(e){const t=ai(e);return"border-box"===t.boxSizing?t.width-t.paddingLeft-t.paddingRight:t.width}function ui(e){const{height:t,marginBottom:i,marginTop:s}=ai(e);return Math.floor(t+i+s)}function ci(e){const{width:t,marginLeft:i,marginRight:s}=ai(e);return Math.floor(t+i+s)}function gi(e){const t=e.getBoundingClientRect(),{borderTopWidth:i,borderLeftWidth:s,borderRightWidth:o,borderBottomWidth:n}=ai(e);return{top:t.top+(i||0),left:t.left+(s||0),right:t.right+(o||0),bottom:t.bottom+(n||0)}}function pi(e,t){let i=e.scrollLeft;return t&&(i=Math.abs(i)),i}function mi(e,t,i){i&&(t*=-1),e.scrollLeft=t}function vi(e){for(;e&&e.firstChild;)e.removeChild(e.firstChild)}function Ci(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function fi(e){return!!e.offsetParent}function wi(e){const t=e;if(t.checkVisibility)return t.checkVisibility({checkVisibilityCSS:!0});return!(!fi(e)||"visible"!==window.getComputedStyle(e).visibility)}function Si(e){const t=document.createElement("div");return t.innerHTML=(e||"").trim(),t.firstChild}function yi(e,t){"flex"===t?(e.style.removeProperty("width"),e.style.removeProperty("minWidth"),e.style.removeProperty("maxWidth"),e.style.flex="1 1 auto"):bi(e,t)}function bi(e,t){t=Fi(t),e.style.width=t.toString(),e.style.maxWidth=t.toString(),e.style.minWidth=t.toString()}function Ri(e,t){t=Fi(t),e.style.height=t.toString(),e.style.maxHeight=t.toString(),e.style.minHeight=t.toString()}function Fi(e){return"number"==typeof e?`${e}px`:e}function Pi(e){return e instanceof Node||e instanceof HTMLElement}function Di(e,t,i){null==i||""===i?e.removeAttribute(t):e.setAttribute(t,i.toString())}function Ei(e,t){if(null!=e)for(let i=0;i1),Li}function Ui(){return!Hi()||Bi()>=15}function Ki(e){if(!e)return null;const t=e.tabIndex,i=e.getAttribute("tabIndex");return-1!==t||null!==i&&(""!==i||Vi())?t.toString():null}function _i(){const e=document.body,t=document.createElement("div");t.style.width=t.style.height="100px",t.style.opacity="0",t.style.overflow="scroll",t.style.msOverflowStyle="scrollbar",t.style.position="absolute",e.appendChild(t);let i=t.offsetWidth-t.clientWidth;0===i&&0===t.clientWidth&&(i=null),t.parentNode&&t.parentNode.removeChild(t),null!=i&&(Oi=i,ki=0===i)}function $i(){return null==ki&&_i(),ki}var ji=class e extends Oe{constructor(e,t,i,s){super(),this.parentComp=e,this.tooltipShowDelayOverride=t,this.tooltipHideDelayOverride=i,this.shouldDisplayTooltip=s,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans(e){this.popupService=e.popupService,this.userComponentFactory=e.userComponentFactory}postConstruct(){this.gos.get("tooltipInteraction")&&(this.interactionEnabled=!0),this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");const e=this.parentComp.getGui();0===this.tooltipTrigger&&this.addManagedListeners(e,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)}),1===this.tooltipTrigger&&this.addManagedListeners(e,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)}),this.addManagedListeners(e,{mousemove:this.onMouseMove.bind(this)}),this.interactionEnabled||this.addManagedListeners(e,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay(e){const t=this.gos.get(e);return t<0&&m(`${e} should not be lower than 0`),Math.max(200,t)}getTooltipDelay(e){return"show"===e?this.tooltipShowDelayOverride??this.getGridOptionsTooltipDelay("tooltipShowDelay"):this.tooltipHideDelayOverride??this.getGridOptionsTooltipDelay("tooltipHideDelay")}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){const e=this.gos.get("tooltipTrigger");return e&&"hover"!==e?1:0}onMouseEnter(t){this.interactionEnabled&&this.interactiveTooltipTimeoutId&&(this.unlockService(),this.startHideTimeout()),zi()||(e.isLocked?this.showTooltipTimeoutId=window.setTimeout((()=>{this.prepareToShowTooltip(t)}),100):this.prepareToShowTooltip(t))}onMouseMove(e){this.lastMouseEvent&&(this.lastMouseEvent=e),this.tooltipMouseTrack&&2===this.state&&this.tooltipComp&&this.positionTooltip()}onMouseDown(){this.setToDoNothing()}onMouseLeave(){this.interactionEnabled?this.lockService():this.setToDoNothing()}onFocusIn(){this.prepareToShowTooltip()}onFocusOut(e){var t;const i=e.relatedTarget,s=this.parentComp.getGui(),o=null==(t=this.tooltipComp)?void 0:t.getGui();this.isInteractingWithTooltip||s.contains(i)||this.interactionEnabled&&(null==o?void 0:o.contains(i))||this.setToDoNothing()}onKeyDown(){this.isInteractingWithTooltip&&(this.isInteractingWithTooltip=!1),this.setToDoNothing()}prepareToShowTooltip(t){if(0!=this.state||e.isLocked)return;let i=0;t&&(i=this.isLastTooltipHiddenRecently()?200:this.getTooltipDelay("show")),this.lastMouseEvent=t||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),i),this.state=1}isLastTooltipHiddenRecently(){return(new Date).getTime()-e.lastTooltipHideTime<1e3}setToDoNothing(e){e||2!==this.state||this.hideTooltip(),this.onBodyScrollEventCallback&&(this.onBodyScrollEventCallback(),this.onBodyScrollEventCallback=void 0),this.onColumnMovedEventCallback&&(this.onColumnMovedEventCallback(),this.onColumnMovedEventCallback=void 0),this.onDocumentKeyDownCallback&&(this.onDocumentKeyDownCallback(),this.onDocumentKeyDownCallback=void 0),this.clearTimeouts(),this.state=0,this.lastMouseEvent=null}showTooltip(){const e={...this.parentComp.getTooltipParams()};if(!P(e.value)||this.shouldDisplayTooltip&&!this.shouldDisplayTooltip())return void this.setToDoNothing();this.state=2,this.tooltipInstanceCount++;const t=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.userComponentFactory.getTooltipCompDetails(e).newAgStackInstance().then(t)}hideTooltip(t){!t&&this.isInteractingWithTooltip||(this.tooltipComp&&(this.destroyTooltipComp(),e.lastTooltipHideTime=(new Date).getTime()),this.eventService.dispatchEvent({type:"tooltipHide",parentGui:this.parentComp.getGui()}),t&&(this.isInteractingWithTooltip=!1),this.setToDoNothing(!0))}newTooltipComponentCallback(e,t){if(2!==this.state||this.tooltipInstanceCount!==e)return void this.destroyBean(t);const i=t.getGui();this.tooltipComp=t,i.classList.contains("ag-tooltip")||i.classList.add("ag-tooltip-custom"),0===this.tooltipTrigger&&i.classList.add("ag-tooltip-animate"),this.interactionEnabled&&i.classList.add("ag-tooltip-interactive");const s=this.localeService.getLocaleTextFunc(),o=this.popupService.addPopup({eChild:i,ariaLabel:s("ariaLabelTooltip","Tooltip")});if(o&&(this.tooltipPopupDestroyFunc=o.hideFunc),this.positionTooltip(),1===this.tooltipTrigger){const e=()=>this.setToDoNothing();[this.onBodyScrollEventCallback,this.onColumnMovedEventCallback]=this.addManagedEventListeners({bodyScroll:e,columnMoved:e})}this.interactionEnabled&&([this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener]=this.addManagedElementListeners(i,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(j(this.gos),{keydown:e=>{i.contains(null==e?void 0:e.target)||this.onKeyDown()}}),1===this.tooltipTrigger&&([this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(i,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)}))),this.eventService.dispatchEvent({type:"tooltipShow",tooltipGui:i,parentGui:this.parentComp.getGui()}),this.startHideTimeout()}onTooltipMouseEnter(){this.isInteractingWithTooltip=!0,this.unlockService()}onTooltipMouseLeave(){this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,this.lockService())}onTooltipFocusIn(){this.isInteractingWithTooltip=!0}isTooltipFocused(){var e;const t=null==(e=this.tooltipComp)?void 0:e.getGui(),i=Y(this.gos);return!!t&&t.contains(i)}onTooltipFocusOut(e){const t=this.parentComp.getGui();this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,t.contains(e.relatedTarget)?this.startHideTimeout():this.hideTooltip())}positionTooltip(){const e={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};this.lastMouseEvent?this.popupService.positionPopupUnderMouseEvent({...e,mouseEvent:this.lastMouseEvent}):this.popupService.positionPopupByComponent({...e,eventSource:this.parentComp.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");const e=this.tooltipPopupDestroyFunc,t=this.tooltipComp,i=0===this.tooltipTrigger?1e3:0;window.setTimeout((()=>{e(),this.destroyBean(t)}),i),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener].forEach((e=>{e&&e()})),this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){e.isLocked=!0,this.interactiveTooltipTimeoutId=window.setTimeout((()=>{this.unlockService(),this.setToDoNothing()}),100)}unlockService(){e.isLocked=!1,this.clearInteractiveTimeout()}startHideTimeout(){this.clearHideTimeout(),this.hideTooltipTimeoutId=window.setTimeout(this.hideTooltip.bind(this),this.getTooltipDelay("hide"))}clearShowTimeout(){this.showTooltipTimeoutId&&(window.clearTimeout(this.showTooltipTimeoutId),this.showTooltipTimeoutId=void 0)}clearHideTimeout(){this.hideTooltipTimeoutId&&(window.clearTimeout(this.hideTooltipTimeoutId),this.hideTooltipTimeoutId=void 0)}clearInteractiveTimeout(){this.interactiveTooltipTimeoutId&&(window.clearTimeout(this.interactiveTooltipTimeoutId),this.interactiveTooltipTimeoutId=void 0)}clearTimeouts(){this.clearShowTimeout(),this.clearHideTimeout(),this.clearInteractiveTimeout()}};ji.isLocked=!1;var qi=ji,Qi=class extends Oe{constructor(e,t){super(),this.ctrl=e,t&&(this.beans=t)}wireBeans(e){this.beans=e}postConstruct(){this.refreshToolTip()}setBrowserTooltip(e){const t="title",i=this.ctrl.getGui();i&&(null!=e&&""!=e?i.setAttribute(t,e):i.removeAttribute(t))}updateTooltipText(){this.tooltip=this.ctrl.getTooltipValue()}createTooltipFeatureIfNeeded(){var e,t,i,s;if(null!=this.tooltipManager)return;const o={getTooltipParams:()=>this.getTooltipParams(),getGui:()=>this.ctrl.getGui()};this.tooltipManager=this.createBean(new qi(o,null==(t=(e=this.ctrl).getTooltipShowDelayOverride)?void 0:t.call(e),null==(s=(i=this.ctrl).getTooltipHideDelayOverride)?void 0:s.call(i),this.ctrl.shouldDisplayTooltip),this.beans.context)}refreshToolTip(){this.browserTooltips=this.beans.gos.get("enableBrowserTooltips"),this.updateTooltipText(),this.browserTooltips?(this.setBrowserTooltip(this.tooltip),this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context))):(this.setBrowserTooltip(null),this.createTooltipFeatureIfNeeded())}getTooltipParams(){var e,t,i,s,o;const n=this.ctrl,r=null==(e=n.getColumn)?void 0:e.call(n),l=null==(t=n.getColDef)?void 0:t.call(n),a=null==(i=n.getRowNode)?void 0:i.call(n);return{location:n.getLocation(),colDef:l,column:r,rowIndex:null==(s=n.getRowIndex)?void 0:s.call(n),node:a,data:null==a?void 0:a.data,value:this.getTooltipText(),valueFormatted:null==(o=n.getValueFormatted)?void 0:o.call(n),hideTooltipCallback:()=>{var e;return null==(e=this.tooltipManager)?void 0:e.hideTooltip(!0)}}}getTooltipText(){return this.tooltip}destroy(){this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context)),super.destroy()}},Yi=new Ni,Xi=null,Ji=class e extends Oe{constructor(e,t){super(),this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=Yi.next(),this.cssClassManager=new Ut((()=>this.eGui)),this.componentSelectors=new Map((t??[]).map((e=>[e.selector,e]))),e&&this.setTemplate(e)}preWireBeans(e){super.preWireBeans(e)}preConstruct(){this.usingBrowserTooltips=this.gos.get("enableBrowserTooltips"),this.wireTemplate(this.getGui())}wireTemplate(e,t){e&&this.gos&&(this.applyElementsToComponent(e),this.createChildComponentsFromTags(e,t))}getCompId(){return this.compId}getTooltipParams(){return{value:this.tooltipText,location:"UNKNOWN"}}setTooltip(e){const{newTooltipText:t,showDelayOverride:i,hideDelayOverride:s,location:o,shouldDisplayTooltip:n}=e||{};this.tooltipFeature&&(this.tooltipFeature=this.destroyBean(this.tooltipFeature)),this.tooltipText!==t&&(this.tooltipText=t);const r=()=>this.tooltipText;null!=t&&(this.tooltipFeature=this.createBean(new Qi({getTooltipValue:r,getGui:()=>this.getGui(),getLocation:()=>o??"UNKNOWN",getColDef:null==e?void 0:e.getColDef,getColumn:null==e?void 0:e.getColumn,getTooltipShowDelayOverride:null!=i?()=>i:void 0,getTooltipHideDelayOverride:null!=s?()=>s:void 0,shouldDisplayTooltip:n})))}getDataRefAttribute(e){return e.getAttribute?e.getAttribute("data-ref"):null}applyElementsToComponent(e,t,i,s=null){if(void 0===t&&(t=this.getDataRefAttribute(e)),t){const o=this[t];if(o===Xi)this[t]=s??e;else{const e=i&&i[t];this.suppressDataRefValidation||e||m(`Issue with data-ref: ${t} on ${this.constructor.name} with ${o}`)}}}createChildComponentsFromTags(e,t){(function(e){if(null==e)return[];const t=[];return Ei(e,(e=>t.push(e))),t})(e.childNodes).forEach((i=>{if(!(i instanceof HTMLElement))return;const s=this.createComponentFromElement(i,(e=>{e.getGui()&&this.copyAttributesFromNode(i,e.getGui())}),t);if(s){if(s.addItems&&i.children.length){this.createChildComponentsFromTags(i,t);const e=Array.prototype.slice.call(i.children);s.addItems(e)}this.swapComponentForNode(s,e,i)}else i.childNodes&&this.createChildComponentsFromTags(i,t)}))}createComponentFromElement(t,i,s){const o=t.nodeName,n=this.getDataRefAttribute(t),r=0===o.indexOf("AG-"),l=r?this.componentSelectors.get(o):null;let a=null;if(l){e.elementGettingCreated=t;const o=s&&n?s[n]:void 0;a=new l.component(o),a.setParentComponent(this),this.createBean(a,null,i)}else r&&m(`Missing selector: ${o}`);return this.applyElementsToComponent(t,n,s,a),a}copyAttributesFromNode(e,t){!function(e,t){if(e)for(let i=0;it.setAttribute(e,i)))}swapComponentForNode(e,t,i){const s=e.getGui();t.replaceChild(s,i),t.insertBefore(document.createComment(i.nodeName),s),this.addDestroyFunc(this.destroyBean.bind(this,e))}activateTabIndex(e){const t=this.gos.get("tabIndex");e||(e=[]),e.length||e.push(this.getGui()),e.forEach((e=>e.setAttribute("tabindex",t.toString())))}setTemplate(e,t,i){const s=Si(e);this.setTemplateFromElement(s,t,i)}setTemplateFromElement(e,t,i,s=!1){if(this.eGui=e,this.suppressDataRefValidation=s,t)for(let o=0;othis.eGui.removeEventListener(e,t)))}addCssClass(e){this.cssClassManager.addCssClass(e)}removeCssClass(e){this.cssClassManager.removeCssClass(e)}containsCssClass(e){return this.cssClassManager.containsCssClass(e)}addOrRemoveCssClass(e,t){this.cssClassManager.addOrRemoveCssClass(e,t)}},Zi={columnGroupOpened:"expanded",columnGroupClosed:"contracted",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate",columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",groupContracted:"tree-closed",groupExpanded:"tree-open",setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",chart:"chart",close:"cross",cancel:"cancel",check:"tick",first:"first",previous:"previous",next:"next",last:"last",linked:"linked",unlinked:"unlinked",colorPicker:"color-picker",groupLoading:"loading",menu:"menu",menuAlt:"menu-alt",filter:"filter",columns:"columns",maximize:"maximize",minimize:"minimize",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnDrag:"grip",rowDrag:"grip",save:"save",csvExport:"csv",excelExport:"excel",smallDown:"small-down",smallLeft:"small-left",smallRight:"small-right",smallUp:"small-up",sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",advancedFilterBuilder:"group",advancedFilterBuilderDrag:"grip",advancedFilterBuilderInvalid:"not-allowed",advancedFilterBuilderMoveUp:"up",advancedFilterBuilderMoveDown:"down",advancedFilterBuilderAdd:"plus",advancedFilterBuilderRemove:"minus",chartsMenuEdit:"chart",chartsMenuAdvancedSettings:"settings",chartsMenuAdd:"plus",checkboxChecked:"checkbox-checked",checkboxIndeterminate:"checkbox-indeterminate",checkboxUnchecked:"checkbox-unchecked",radioButtonOn:"radio-button-on",radioButtonOff:"radio-button-off"},es=(()=>{const e=new Set(Object.values(Zi));return e.add("eye"),e})();function ts(e,t,i,s){let o=null;const n=i&&i.getColDef().icons;if(n&&(o=n[e]),t&&!o){const i=t.get("icons");i&&(o=i[e])}if(!o){const t=document.createElement("span");let i=Zi[e]??(es.has(e)?e:void 0);return i||(m(`Did not find icon ${e}`),i=""),t.setAttribute("class",`ag-icon ag-icon-${i}`),t.setAttribute("unselectable","on"),qt(t,"presentation"),t}{let e;if("function"==typeof o)e=o();else{if("string"!=typeof o)throw new Error("icon from grid options needs to be a string or a function");e=o}if("string"==typeof e)return Si(e);if(Pi(e))return e;m("iconRenderer should return back a string or a dom object")}}var is=class extends Ji{constructor(){super(...arguments),this.dragSource=null,this.eIcon=Xi,this.eLabel=Xi}postConstruct(){const e=e=>function(e,t,i){const s=ts(e,t,i);if(s){const{className:e}=s;if("string"==typeof e&&e.indexOf("ag-icon")>-1||"object"==typeof e&&e["ag-icon"])return s}const o=document.createElement("span");return o.appendChild(s),o}(e,this.gos,null);this.dropIconMap={pinned:e("columnMovePin"),hide:e("columnMoveHide"),move:e("columnMoveMove"),left:e("columnMoveLeft"),right:e("columnMoveRight"),group:e("columnMoveGroup"),aggregate:e("columnMoveValue"),pivot:e("columnMovePivot"),notAllowed:e("dropNotAllowed")}}init(e){this.dragSource=e.dragSource,this.setTemplate('
\n \n
\n
')}destroy(){this.dragSource=null,super.destroy()}setIcon(e,t=!1){var i,s;vi(this.eIcon);let o=null;e||(e=(null==(i=this.dragSource)?void 0:i.getDefaultIconName)?null==(s=this.dragSource)?void 0:s.getDefaultIconName():"notAllowed"),o=this.dropIconMap[e],this.eIcon.classList.toggle("ag-shake-left-to-right",t),o===this.dropIconMap.hide&&this.gos.get("suppressDragLeaveHidesColumns")||o&&this.eIcon.appendChild(o)}setLabel(e){this.eLabel.textContent=Rt(e)}};function ss(e,t,i){if(0===i)return!1;const s=Math.abs(e.clientX-t.clientX),o=Math.abs(e.clientY-t.clientY);return Math.max(s,o)<=i}var os=class{constructor(e,t=!1){this.DOUBLE_TAP_MILLIS=500,this.destroyFuncs=[],this.touching=!1,this.localEventService=new h,this.eElement=e,this.preventMouseClick=t;const i=this.onTouchStart.bind(this),s=this.onTouchMove.bind(this),o=this.onTouchEnd.bind(this);this.eElement.addEventListener("touchstart",i,{passive:!0}),this.eElement.addEventListener("touchmove",s,{passive:!0}),this.eElement.addEventListener("touchend",o,{passive:!1}),this.destroyFuncs.push((()=>{this.eElement.removeEventListener("touchstart",i,{passive:!0}),this.eElement.removeEventListener("touchmove",s,{passive:!0}),this.eElement.removeEventListener("touchend",o,{passive:!1})}))}getActiveTouch(e){for(let t=0;t{const i=this.touchStart===t;if(this.touching&&i&&!this.moved){this.moved=!0;const t={type:"longTap",touchStart:this.touchStart,touchEvent:e};this.localEventService.dispatchEvent(t)}}),500)}onTouchMove(e){if(!this.touching)return;const t=this.getActiveTouch(e.touches);if(!t)return;!ss(t,this.touchStart,4)&&(this.moved=!0)}onTouchEnd(e){if(this.touching){if(!this.moved){const e={type:"tap",touchStart:this.touchStart};this.localEventService.dispatchEvent(e),this.checkForDoubleTap()}this.preventMouseClick&&e.cancelable&&e.preventDefault(),this.touching=!1}}checkForDoubleTap(){const e=(new Date).getTime();if(this.lastTapTime&&this.lastTapTime>0){if(e-this.lastTapTime>this.DOUBLE_TAP_MILLIS){const e={type:"doubleTap",touchStart:this.touchStart};this.localEventService.dispatchEvent(e),this.lastTapTime=null}else this.lastTapTime=e}else this.lastTapTime=e}destroy(){this.destroyFuncs.forEach((e=>e()))}};function ns(e,t){return``}var rs=`\n ${ns("Order","order")}\n ${ns("Asc","ascending-icon")}\n ${ns("Desc","descending-icon")}\n ${ns("Mixed","mixed-icon")}\n ${ns("None","none-icon")}\n `,ls=class extends Ji{constructor(e){super(),this.eSortOrder=Xi,this.eSortAsc=Xi,this.eSortDesc=Xi,this.eSortMixed=Xi,this.eSortNone=Xi,e||this.setTemplate(rs)}wireBeans(e){this.sortController=e.sortController}attachCustomElements(e,t,i,s,o){this.eSortOrder=e,this.eSortAsc=t,this.eSortDesc=i,this.eSortMixed=s,this.eSortNone=o}setupSort(e,t=!1){if(this.column=e,this.suppressOrder=t,this.setupMultiSortIndicator(),!this.column.isSortable()&&!this.column.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,e),this.addInIcon("sortDescending",this.eSortDesc,e),this.addInIcon("sortUnSort",this.eSortNone,e);const i=this.updateIcons.bind(this),s=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",i),this.addManagedEventListeners({newColumnsLoaded:i,sortChanged:s,columnRowGroupChanged:s}),this.onSortChanged()}addInIcon(e,t,i){if(null==t)return;const s=ts(e,this.gos,i);s&&t.appendChild(s)}onSortChanged(){this.updateIcons(),this.suppressOrder||this.updateSortOrder()}updateIcons(){const e=this.sortController.getDisplaySortForColumn(this.column);if(this.eSortAsc){const t="asc"===e;ni(this.eSortAsc,t,{skipAriaHidden:!0})}if(this.eSortDesc){const t="desc"===e;ni(this.eSortDesc,t,{skipAriaHidden:!0})}if(this.eSortNone){const t=!this.column.getColDef().unSortIcon&&!this.gos.get("unSortIcon"),i=null==e;ni(this.eSortNone,!t&&i,{skipAriaHidden:!0})}}setupMultiSortIndicator(){this.addInIcon("sortUnSort",this.eSortMixed,this.column);const e=this.column.getColDef().showRowGroup;ee(this.gos)&&e&&(this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator())}updateMultiSortIndicator(){if(this.eSortMixed){const e="mixed"===this.sortController.getDisplaySortForColumn(this.column);ni(this.eSortMixed,e,{skipAriaHidden:!0})}}updateSortOrder(){if(!this.eSortOrder)return;const e=this.sortController.getColumnsWithSortingOrdered(),t=this.sortController.getDisplaySortIndexForColumn(this.column)??-1,i=e.some((e=>this.sortController.getDisplaySortIndexForColumn(e)??!1)),s=t>=0&&i;ni(this.eSortOrder,s,{skipAriaHidden:!0}),t>=0?this.eSortOrder.textContent=(t+1).toString():vi(this.eSortOrder)}},as={selector:"AG-SORT-INDICATOR",component:ls},ds=class extends Ji{constructor(){super(...arguments),this.eFilter=Xi,this.eFilterButton=Xi,this.eSortIndicator=Xi,this.eMenu=Xi,this.eLabel=Xi,this.eText=Xi,this.eSortOrder=Xi,this.eSortAsc=Xi,this.eSortDesc=Xi,this.eSortMixed=Xi,this.eSortNone=Xi,this.lastMovingChanged=0}wireBeans(e){this.sortController=e.sortController,this.menuService=e.menuService,this.funcColsService=e.funcColsService}destroy(){super.destroy()}refresh(e){const t=this.params;return this.params=e,this.workOutTemplate()==this.currentTemplate&&this.workOutShowMenu()==this.currentShowMenu&&this.workOutSort()==this.currentSort&&this.shouldSuppressMenuHide()==this.currentSuppressMenuHide&&t.enableFilterButton==e.enableFilterButton&&t.enableFilterIcon==e.enableFilterIcon&&(this.setDisplayName(e),!0)}workOutTemplate(){let e=this.params.template??'';return e=e&&e.trim?e.trim():e,e}init(e){this.params=e,this.currentTemplate=this.workOutTemplate(),this.setTemplate(this.currentTemplate,[as]),this.setupTap(),this.setMenu(),this.setupSort(),this.setupFilterIcon(),this.setupFilterButton(),this.setDisplayName(e)}setDisplayName(e){if(this.currentDisplayName!=e.displayName){this.currentDisplayName=e.displayName;const t=Rt(this.currentDisplayName,!0);this.eText&&(this.eText.textContent=t)}}addInIcon(e,t,i){if(null==t)return;const s=ts(e,this.gos,i);s&&t.appendChild(s)}setupTap(){const{gos:e}=this;if(e.get("suppressTouch"))return;const t=new os(this.getGui(),!0),i=this.shouldSuppressMenuHide(),s=i&&P(this.eMenu),o=s?new os(this.eMenu,!0):t;if(this.params.enableMenu){const e=s?"tap":"longTap",t=e=>this.params.showColumnMenuAfterMouseClick(e.touchStart);this.addManagedListeners(o,{[e]:t})}if(this.params.enableSorting){const e=e=>{var t,s;const o=e.touchStart.target;i&&((null==(t=this.eMenu)?void 0:t.contains(o))||(null==(s=this.eFilterButton)?void 0:s.contains(o)))||this.sortController.progressSort(this.params.column,!1,"uiColumnSorted")};this.addManagedListeners(t,{tap:e})}if(this.params.enableFilterButton){const e=new os(this.eFilterButton,!0);this.addManagedListeners(e,{tap:()=>this.params.showFilter(this.eFilterButton)}),this.addDestroyFunc((()=>e.destroy()))}this.addDestroyFunc((()=>t.destroy())),s&&this.addDestroyFunc((()=>o.destroy()))}workOutShowMenu(){return this.params.enableMenu&&this.menuService.isHeaderMenuButtonEnabled()}shouldSuppressMenuHide(){return this.menuService.isHeaderMenuButtonAlwaysShowEnabled()}setMenu(){if(!this.eMenu)return;if(this.currentShowMenu=this.workOutShowMenu(),!this.currentShowMenu)return Ci(this.eMenu),void(this.eMenu=void 0);const e=this.menuService.isLegacyMenuEnabled();this.addInIcon(e?"menu":"menuAlt",this.eMenu,this.params.column),this.eMenu.classList.toggle("ag-header-menu-icon",!e),this.currentSuppressMenuHide=this.shouldSuppressMenuHide(),this.addManagedElementListeners(this.eMenu,{click:()=>this.params.showColumnMenu(this.eMenu)}),this.eMenu.classList.toggle("ag-header-menu-always-show",this.currentSuppressMenuHide)}onMenuKeyboardShortcut(e){const t=this.params.column,i=this.menuService.isLegacyMenuEnabled();if(e&&!i){if(this.menuService.isFilterMenuInHeaderEnabled(t))return this.params.showFilter(this.eFilterButton??this.eMenu??this.getGui()),!0}else if(this.params.enableMenu)return this.params.showColumnMenu(this.eMenu??this.eFilterButton??this.getGui()),!0;return!1}workOutSort(){return this.params.enableSorting}setupSort(){if(this.currentSort=this.params.enableSorting,this.eSortIndicator||(this.eSortIndicator=this.createBean(new ls(!0)),this.eSortIndicator.attachCustomElements(this.eSortOrder,this.eSortAsc,this.eSortDesc,this.eSortMixed,this.eSortNone)),this.eSortIndicator.setupSort(this.params.column),!this.currentSort)return;this.addManagedListeners(this.params.column,{movingChanged:()=>{this.lastMovingChanged=(new Date).getTime()}}),this.eLabel&&this.addManagedElementListeners(this.eLabel,{click:e=>{const t=this.params.column.isMoving(),i=(new Date).getTime()-this.lastMovingChanged<50;if(!(t||i)){const t="ctrl"===this.gos.get("multiSortKey")?e.ctrlKey||e.metaKey:e.shiftKey;this.params.progressSort(t)}}});const e=()=>{const e=this.params.column.getSort();if(this.addOrRemoveCssClass("ag-header-cell-sorted-asc","asc"===e),this.addOrRemoveCssClass("ag-header-cell-sorted-desc","desc"===e),this.addOrRemoveCssClass("ag-header-cell-sorted-none",!e),this.params.column.getColDef().showRowGroup){const e=this.funcColsService.getSourceColumnsForGroupColumn(this.params.column),t=!(null==e?void 0:e.every((e=>this.params.column.getSort()==e.getSort())));this.addOrRemoveCssClass("ag-header-cell-sorted-mixed",t)}};this.addManagedEventListeners({sortChanged:e,columnRowGroupChanged:e})}setupFilterIcon(){this.eFilter&&this.configureFilter(this.params.enableFilterIcon,this.eFilter,this.onFilterChangedIcon.bind(this))}setupFilterButton(){if(!this.eFilterButton)return;this.configureFilter(this.params.enableFilterButton,this.eFilterButton,this.onFilterChangedButton.bind(this))?this.addManagedElementListeners(this.eFilterButton,{click:()=>this.params.showFilter(this.eFilterButton)}):this.eFilterButton=void 0}configureFilter(e,t,i){if(!e)return Ci(t),!1;const s=this.params.column;return this.addInIcon("filter",t,s),this.addManagedListeners(s,{filterChanged:i}),i(),!0}onFilterChangedIcon(){const e=this.params.column.isFilterActive();ni(this.eFilter,e,{skipAriaHidden:!0})}onFilterChangedButton(){const e=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",e)}getAnchorElementForMenu(e){return e?this.eFilterButton??this.eMenu??this.getGui():this.eMenu??this.eFilterButton??this.getGui()}},hs=class extends Ji{constructor(){super(''),this.agOpened=Xi,this.agClosed=Xi,this.agLabel=Xi}wireBeans(e){this.columnModel=e.columnModel}destroy(){super.destroy()}init(e){this.params=e,this.checkWarnings(),this.setupLabel(),this.addGroupExpandIcon(),this.setupExpandIcons()}checkWarnings(){this.params.template&&m("A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)")}setupExpandIcons(){this.addInIcon("columnGroupOpened",this.agOpened),this.addInIcon("columnGroupClosed",this.agClosed);const e=e=>{if(Te(e))return;const t=!this.params.columnGroup.isExpanded();this.columnModel.setColumnGroupOpened(this.params.columnGroup.getProvidedColumnGroup(),t,"uiColumnExpanded")};this.addTouchAndClickListeners(this.agClosed,e),this.addTouchAndClickListeners(this.agOpened,e);const t=e=>{Ae(e)};this.addManagedElementListeners(this.agClosed,{dblclick:t}),this.addManagedElementListeners(this.agOpened,{dblclick:t}),this.addManagedElementListeners(this.getGui(),{dblclick:e}),this.updateIconVisibility();const i=this.params.columnGroup.getProvidedColumnGroup(),s=this.updateIconVisibility.bind(this);this.addManagedListeners(i,{expandedChanged:s,expandableChanged:s})}addTouchAndClickListeners(e,t){const i=new os(e,!0);this.addManagedListeners(i,{tap:t}),this.addDestroyFunc((()=>i.destroy())),this.addManagedElementListeners(e,{click:t})}updateIconVisibility(){if(this.params.columnGroup.isExpandable()){const e=this.params.columnGroup.isExpanded();ni(this.agOpened,e),ni(this.agClosed,!e)}else ni(this.agOpened,!1),ni(this.agClosed,!1)}addInIcon(e,t){const i=ts(e,this.gos,null);i&&t.appendChild(i)}addGroupExpandIcon(){if(!this.params.columnGroup.isExpandable())return ni(this.agOpened,!1),void ni(this.agClosed,!1)}setupLabel(){var e;const{displayName:t,columnGroup:i}=this.params;if(P(t)){const e=Rt(t,!0);this.agLabel.textContent=e}this.addOrRemoveCssClass("ag-sticky-label",!(null==(e=i.getColGroupDef())?void 0:e.suppressStickyLabel))}},us=class extends Ji{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-change-delta");const i=document.createElement("span");i.setAttribute("class","ag-value-change-value"),e.appendChild(t),e.appendChild(i),this.setTemplateFromElement(e)}wireBeans(e){this.filterManager=e.filterManager}init(e){this.eValue=this.queryForHtmlElement(".ag-value-change-value"),this.eDelta=this.queryForHtmlElement(".ag-value-change-delta"),this.refresh(e,!0)}showDelta(e,t){const i=Math.abs(t),s=e.formatValue(i),o=P(s)?s:i,n=t>=0;this.eDelta.textContent=n?"↑"+o:"↓"+o,this.eDelta.classList.toggle("ag-value-change-delta-up",n),this.eDelta.classList.toggle("ag-value-change-delta-down",!n)}setTimerToRemoveDelta(){this.refreshCount++;const e=this.refreshCount;this.getFrameworkOverrides().wrapIncoming((()=>{window.setTimeout((()=>{e===this.refreshCount&&this.hideDeltaValue()}),2e3)}))}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),vi(this.eDelta)}refresh(e,t=!1){var i;const s=e.value;if(s===this.lastValue)return!1;if(P(e.valueFormatted)?this.eValue.textContent=e.valueFormatted:P(e.value)?this.eValue.textContent=s:vi(this.eValue),null==(i=this.filterManager)?void 0:i.isSuppressFlashingCellsBecauseFiltering())return!1;if("number"==typeof s&&"number"==typeof this.lastValue){const t=s-this.lastValue;this.showDelta(e,t)}return this.lastValue&&this.eValue.classList.add("ag-value-change-value-highlight"),t||this.setTimerToRemoveDelta(),this.lastValue=s,!0}},cs=class extends Ji{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-slide-current"),e.appendChild(t),this.setTemplateFromElement(e),this.eCurrent=this.queryForHtmlElement(".ag-value-slide-current")}wireBeans(e){this.filterManager=e.filterManager}init(e){this.refresh(e,!0)}addSlideAnimation(){this.refreshCount++;const e=this.refreshCount;this.ePrevious&&this.getGui().removeChild(this.ePrevious);const t=document.createElement("span");t.setAttribute("class","ag-value-slide-previous ag-value-slide-out"),this.ePrevious=t,this.ePrevious.textContent=this.eCurrent.textContent,this.getGui().insertBefore(this.ePrevious,this.eCurrent),this.getFrameworkOverrides().wrapIncoming((()=>{window.setTimeout((()=>{e===this.refreshCount&&this.ePrevious.classList.add("ag-value-slide-out-end")}),50),window.setTimeout((()=>{e===this.refreshCount&&(this.getGui().removeChild(this.ePrevious),this.ePrevious=null)}),3e3)}))}refresh(e,t=!1){var i;let s=e.value;return D(s)&&(s=""),s!==this.lastValue&&(!(null==(i=this.filterManager)?void 0:i.isSuppressFlashingCellsBecauseFiltering())&&(t||this.addSlideAnimation(),this.lastValue=s,P(e.valueFormatted)?this.eCurrent.textContent=e.valueFormatted:P(e.value)?this.eCurrent.textContent=s:vi(this.eCurrent),!0))}},gs=class{};gs.BACKSPACE="Backspace",gs.TAB="Tab",gs.ENTER="Enter",gs.ESCAPE="Escape",gs.SPACE=" ",gs.LEFT="ArrowLeft",gs.UP="ArrowUp",gs.RIGHT="ArrowRight",gs.DOWN="ArrowDown",gs.DELETE="Delete",gs.F2="F2",gs.PAGE_UP="PageUp",gs.PAGE_DOWN="PageDown",gs.PAGE_HOME="Home",gs.PAGE_END="End",gs.A="KeyA",gs.C="KeyC",gs.D="KeyD",gs.V="KeyV",gs.X="KeyX",gs.Y="KeyY",gs.Z="KeyZ";var ps=class extends Ji{constructor(e,t,i){super(t,i),this.labelSeparator="",this.labelAlignment="left",this.disabled=!1,this.label="",this.config=e||{}}postConstruct(){this.addCssClass("ag-labeled"),this.eLabel.classList.add("ag-label");const{labelSeparator:e,label:t,labelWidth:i,labelAlignment:s,disabled:o}=this.config;null!=o&&this.setDisabled(o),null!=e&&this.setLabelSeparator(e),null!=t&&this.setLabel(t),null!=i&&this.setLabelWidth(i),this.setLabelAlignment(s||this.labelAlignment),this.refreshLabel()}refreshLabel(){vi(this.eLabel),"string"==typeof this.label?this.eLabel.innerText=this.label+this.labelSeparator:this.label&&this.eLabel.appendChild(this.label),""===this.label?(ni(this.eLabel,!1),qt(this.eLabel,"presentation")):(ni(this.eLabel,!0),qt(this.eLabel,null))}setLabelSeparator(e){return this.labelSeparator===e||(this.labelSeparator=e,null!=this.label&&this.refreshLabel()),this}getLabelId(){return this.eLabel.id=this.eLabel.id||`ag-${this.getCompId()}-label`,this.eLabel.id}getLabel(){return this.label}setLabel(e){return this.label===e||(this.label=e,this.refreshLabel()),this}setLabelAlignment(e){const t=this.getGui().classList;return t.toggle("ag-label-align-left","left"===e),t.toggle("ag-label-align-right","right"===e),t.toggle("ag-label-align-top","top"===e),this}setLabelEllipsis(e){return this.eLabel.classList.toggle("ag-label-ellipsis",e),this}setLabelWidth(e){return null==this.label||yi(this.eLabel,e),this}setDisabled(e){e=!!e;const t=this.getGui();return ri(t,e),t.classList.toggle("ag-disabled",e),this.disabled=e,this}isDisabled(){return!!this.disabled}},ms=class extends ps{constructor(e,t,i,s){super(e,t,i),this.className=s}postConstruct(){super.postConstruct();const{width:e,value:t,onValueChange:i}=this.config;null!=e&&this.setWidth(e),null!=t&&this.setValue(t),null!=i&&this.onValueChange(i),this.className&&this.addCssClass(this.className),this.refreshAriaLabelledBy()}setLabel(e){return super.setLabel(e),this.refreshAriaLabelledBy(),this}refreshAriaLabelledBy(){const e=this.getAriaElement(),t=this.getLabelId(),i=this.getLabel();null==i||""==i||null!==e.getAttribute("aria-label")?Yt(e,""):Yt(e,t??"")}setAriaLabel(e){return Qt(this.getAriaElement(),e),this.refreshAriaLabelledBy(),this}onValueChange(e){return this.addManagedListeners(this,{fieldValueChanged:()=>e(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth(e){return bi(this.getGui(),e),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue(e,t){return this.value===e||(this.previousValue=this.value,this.value=e,t||this.dispatchLocalEvent({type:"fieldValueChanged"})),this}},vs=class extends ms{constructor(e,t,i="text",s="input"){super(e,(null==e?void 0:e.template)??`\n
\n
\n \n
`,[],t),this.inputType=i,this.displayFieldTag=s,this.eLabel=Xi,this.eWrapper=Xi,this.eInput=Xi}postConstruct(){super.postConstruct(),this.setInputType(),this.eLabel.classList.add(`${this.className}-label`),this.eWrapper.classList.add(`${this.className}-input-wrapper`),this.eInput.classList.add(`${this.className}-input`),this.addCssClass("ag-input-field"),this.eInput.id=this.eInput.id||`ag-${this.getCompId()}-input`;const{inputName:e,inputWidth:t}=this.config;null!=e&&this.setInputName(e),null!=t&&this.setInputWidth(t),this.addInputListeners(),this.activateTabIndex([this.eInput])}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:e=>this.setValue(e.target.value)})}setInputType(){"input"===this.displayFieldTag&&this.eInput.setAttribute("type",this.inputType)}getInputElement(){return this.eInput}setInputWidth(e){return yi(this.eWrapper,e),this}setInputName(e){return this.getInputElement().setAttribute("name",e),this}getFocusableElement(){return this.eInput}setMaxLength(e){return this.eInput.maxLength=e,this}setInputPlaceholder(e){return Di(this.eInput,"placeholder",e),this}setInputAriaLabel(e){return Qt(this.eInput,e),this.refreshAriaLabelledBy(),this}setDisabled(e){return ri(this.eInput,e),super.setDisabled(e)}setAutoComplete(e){if(!0===e)Di(this.eInput,"autocomplete",null);else{const t="string"==typeof e?e:"off";Di(this.eInput,"autocomplete",t)}return this}},Cs=class extends vs{constructor(e,t="ag-checkbox",i="checkbox"){super(e,t,i),this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();const{readOnly:e,passive:t}=this.config;"boolean"==typeof e&&this.setReadOnly(e),"boolean"==typeof t&&this.setPassive(t)}addInputListeners(){this.addManagedElementListeners(this.eInput,{click:this.onCheckboxClick.bind(this)}),this.addManagedElementListeners(this.eLabel,{click:this.toggle.bind(this)})}getNextValue(){return void 0===this.selected||!this.selected}setPassive(e){this.passive=e}isReadOnly(){return this.readOnly}setReadOnly(e){this.eWrapper.classList.toggle("ag-disabled",e),this.eInput.disabled=e,this.readOnly=e}setDisabled(e){return this.eWrapper.classList.toggle("ag-disabled",e),super.setDisabled(e)}toggle(){if(this.eInput.disabled)return;const e=this.isSelected(),t=this.getNextValue();this.passive?this.dispatchChange(t,e):this.setValue(t)}getValue(){return this.isSelected()}setValue(e,t){return this.refreshSelectedClass(e),this.setSelected(e,t),this}setName(e){return this.getInputElement().name=e,this}isSelected(){return this.selected}setSelected(e,t){this.isSelected()!==e&&(this.previousValue=this.isSelected(),e=this.selected="boolean"==typeof e?e:void 0,this.eInput.checked=e,this.eInput.indeterminate=void 0===e,t||this.dispatchChange(this.selected,this.previousValue))}dispatchChange(e,t,i){this.dispatchLocalEvent({type:"fieldValueChanged",selected:e,previousValue:t,event:i});const s=this.getInputElement();this.eventService.dispatchEvent({type:"checkboxChanged",id:s.id,name:s.name,selected:e,previousValue:t})}onCheckboxClick(e){if(this.passive||this.eInput.disabled)return;const t=this.isSelected(),i=this.selected=e.target.checked;this.refreshSelectedClass(i),this.dispatchChange(i,t,e)}refreshSelectedClass(e){this.eWrapper.classList.toggle("ag-checked",!0===e),this.eWrapper.classList.toggle("ag-indeterminate",null==e)}},fs={selector:"AG-CHECKBOX",component:Cs},ws=class extends Ji{constructor(){super('\n ',[fs]),this.eCheckbox=Xi}init(e){this.refresh(e);const t=this.eCheckbox.getInputElement();t.setAttribute("tabindex","-1"),Xt(t,"polite"),this.addManagedListeners(t,{click:e=>{if(Ae(e),this.eCheckbox.isDisabled())return;const t=this.eCheckbox.getValue();this.onCheckboxChanged(t)},dblclick:e=>{Ae(e)}}),this.addManagedElementListeners(this.params.eGridCell,{keydown:e=>{if(e.key===gs.SPACE&&!this.eCheckbox.isDisabled()){this.params.eGridCell===Y(this.gos)&&this.eCheckbox.toggle();const t=this.eCheckbox.getValue();this.onCheckboxChanged(t),e.preventDefault()}}})}refresh(e){return this.params=e,this.updateCheckbox(e),!0}updateCheckbox(e){var t;let i,s=!0;if(e.node.group&&e.column)if("boolean"==typeof e.value)i=e.value;else{const t=e.column.getColId();t.startsWith(Ve)?i=null==e.value||""===e.value?void 0:"true"===e.value:e.node.aggData&&void 0!==e.node.aggData[t]?i=e.value??void 0:s=!1}else i=e.value??void 0;if(!s)return void this.eCheckbox.setDisplayed(!1);this.eCheckbox.setValue(i);const o=null!=e.disabled?e.disabled:!(null==(t=e.column)?void 0:t.isCellEditable(e.node));this.eCheckbox.setDisabled(o);const n=this.localeService.getLocaleTextFunc(),r=ii(n,i),l=o?r:`${n("ariaToggleCellValue","Press SPACE to toggle cell value")} (${r})`;this.eCheckbox.setInputAriaLabel(l)}onCheckboxChanged(e){const{column:t,node:i,value:s}=this.params;this.eventService.dispatchEvent({type:"cellEditingStarted",column:t,colDef:null==t?void 0:t.getColDef(),data:i.data,node:i,rowIndex:i.rowIndex,rowPinned:i.rowPinned,value:s});const o=this.params.node.setDataValue(this.params.column,e,"edit");this.eventService.dispatchEvent({type:"cellEditingStopped",column:t,colDef:null==t?void 0:t.getColDef(),data:i.data,node:i,rowIndex:i.rowIndex,rowPinned:i.rowPinned,value:s,oldValue:s,newValue:e,valueChanged:o}),o||this.updateCheckbox(this.params)}},Ss=class extends Ji{constructor(){super('
\n \n \n
'),this.eLoadingIcon=Xi,this.eLoadingText=Xi}init(e){e.node.failedLoad?this.setupFailed():this.setupLoading()}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=e("loadingError","ERR")}setupLoading(){const e=ts("groupLoading",this.gos,null);e&&this.eLoadingIcon.appendChild(e);const t=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=t("loadingOoo","Loading")}refresh(e){return!1}destroy(){super.destroy()}},ys=class extends Ji{constructor(){super('
')}init(e){const t=`ag-cell-skeleton-renderer-${this.getCompId()}`;this.getGui().setAttribute("id",t),this.addDestroyFunc((()=>Yt(e.eParentOfValue))),Yt(e.eParentOfValue,t),e.node.failedLoad?this.setupFailed():this.setupLoading(e)}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.getGui().innerText=e("loadingError","ERR");const t=e("ariaSkeletonCellLoadingFailed","Row failed to load");Qt(this.getGui(),t)}setupLoading(e){const t=j(this.gos).createElement("div");t.classList.add("ag-skeleton-effect");const i=e.node.rowIndex;if(null!=i){const e=75+25*(i%2==0?Math.sin(i):Math.cos(i));t.style.width=`${e}%`}this.getGui().appendChild(t);const s=this.localeService.getLocaleTextFunc()("ariaSkeletonCellLoading","Row data is loading");Qt(this.getGui(),s)}refresh(e){return!1}destroy(){super.destroy()}},bs=class extends Ji{constructor(){super()}destroy(){super.destroy()}},Rs=class extends bs{init(){var e;const t=F(null==(e=this.gos.get("overlayLoadingTemplate"))?void 0:e.trim());if(this.setTemplate(t??''),!t){const e=this.localeService.getLocaleTextFunc();setTimeout((()=>{this.getGui().textContent=e("loadingOoo","Loading...")}))}}},Fs=class extends bs{init(){var e;const t=F(null==(e=this.gos.get("overlayNoRowsTemplate"))?void 0:e.trim());if(this.setTemplate(t??''),!t){const e=this.localeService.getLocaleTextFunc();setTimeout((()=>{this.getGui().textContent=e("noRowsToShow","No Rows To Show")}))}}},Ps=class extends Ji{isPopup(){return!0}setParentComponent(e){e.addCssClass("ag-has-popup"),super.setParentComponent(e)}destroy(){const e=this.parentComponent;e&&e.isAlive()&&e.getGui().classList.remove("ag-has-popup"),super.destroy()}},Ds=class extends Ps{constructor(){super('
')}init(e){const{value:t}=e;this.getGui().textContent=Rt(t,!0)}};function Es(e){const{inputValue:t,allSuggestions:i,hideIrrelevant:s,filterByPercentageOfBestMatch:o,addSequentialWeight:n}=e;let r=i.map(((e,i)=>({value:e,relevance:Ms(t.toLowerCase(),e.toLocaleLowerCase(),n),idx:i})));if(r.sort(((e,t)=>t.relevance-e.relevance)),s&&(r=r.filter((e=>0!==e.relevance))),r.length>0&&o&&o>0){const e=r[0].relevance*o;r=r.filter((t=>e-t.relevance<0))}const l=[],a=[];for(const d of r)l.push(d.value),a.push(d.idx);return{values:l,indices:a}}function Ms(e,t,i=!1){const s=e.replace(/\s/g,""),o=t.replace(/\s/g,""),n=s.length,r=o.length,l=new Array(n+1).fill(null).map((()=>new Array(r+1).fill(0)));for(let h=0;h<=n;h+=1)l[h][0]=h;for(let h=0;h<=r;h+=1)l[0][h]=h;for(let h=1;h<=n;h++)for(let e=1;e<=r;e++)s[h-1]===o[e-1]?l[h][e]=l[h-1][e-1]:l[h][e]=1+Math.min(l[h][e-1],Math.min(l[h-1][e],l[h-1][e-1]));const a=l[n][r];let d=Math.max(n,r)-a;if(i){const e=function(e){const t=[],i=e.length;for(let s=1;s<=i;s++)for(let o=0;o<=i-s;o++){const i=o+s-1;t.push(e.slice(o,i+1))}return t}(s);for(let t=0;tthis.registerJsComponent(e,t)))}registerDefaultComponent(e,t,i){this.agGridDefaults[e]=t,i&&(this.agGridDefaultParams[e]=i)}registerJsComponent(e,t){this.jsComps[e]=t}retrieve(e,t){const i=(e,t,i)=>({componentFromFramework:t,component:e,params:i}),s=this.getFrameworkOverrides().frameworkComponent(t,this.gos.get("components"));if(null!=s)return i(s,!0);const o=this.jsComps[t];if(o){return i(o,this.getFrameworkOverrides().isFrameworkComponent(o))}const n=this.agGridDefaults[t];if(n)return i(n,!1,this.agGridDefaultParams[t]);const r=this.enterpriseAgDefaultCompsModule[t];return r?this.gos.assertModuleRegistered(r,`AG Grid '${e}' component: ${t}`):g((()=>{this.warnAboutMissingComponent(e,t)}),"MissingComp"+t),null}warnAboutMissingComponent(e,t){const i=Es({inputValue:t,allSuggestions:[...Object.keys(this.agGridDefaults).filter((e=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(e))),...Object.keys(this.jsComps)],hideIrrelevant:!0,filterByPercentageOfBestMatch:.8}).values;m(`Could not find '${t}' component. It was configured as "${e}: '${t}'" but it wasn't found in the list of registered components.`),i.length>0&&m(` Did you mean: [${i.slice(0,3)}]?`),m(`If using a custom component check it has been registered as described in: ${this.getFrameworkOverrides().getDocLink("components/")}`)}},As=class e{constructor(e){this.status=0,this.resolution=null,this.waiters=[],e((e=>this.onDone(e)),(e=>this.onReject(e)))}static all(t){return t.length?new e((e=>{let i=t.length;const s=new Array(i);t.forEach(((t,o)=>{t.then((t=>{s[o]=t,i--,0===i&&e(s)}))}))})):e.resolve()}static resolve(t=null){return new e((e=>e(t)))}then(t){return new e((e=>{1===this.status?e(t(this.resolution)):this.waiters.push((i=>e(t(i))))}))}onDone(e){this.status=1,this.resolution=e,this.waiters.forEach((t=>t(e)))}onReject(e){}},Ts={propertyName:"dateComponent",cellRenderer:!1},Is={propertyName:"dragAndDropImageComponent",cellRenderer:!1},Ls={propertyName:"headerComponent",cellRenderer:!1},ks={propertyName:"headerGroupComponent",cellRenderer:!1},Os={propertyName:"cellRenderer",cellRenderer:!0},Gs={propertyName:"cellRenderer",cellRenderer:!1},Ns={propertyName:"loadingCellRenderer",cellRenderer:!0},Hs={propertyName:"cellEditor",cellRenderer:!1},Bs={propertyName:"innerRenderer",cellRenderer:!0},Vs={propertyName:"loadingOverlayComponent",cellRenderer:!1},Ws={propertyName:"noRowsOverlayComponent",cellRenderer:!1},zs={propertyName:"tooltipComponent",cellRenderer:!1},Us={propertyName:"filter",cellRenderer:!1},Ks={propertyName:"floatingFilterComponent",cellRenderer:!1},_s={propertyName:"toolPanel",cellRenderer:!1},$s={propertyName:"statusPanel",cellRenderer:!1},js={propertyName:"fullWidthCellRenderer",cellRenderer:!0},qs={propertyName:"loadingCellRenderer",cellRenderer:!0},Qs={propertyName:"groupRowRenderer",cellRenderer:!0},Ys={propertyName:"detailCellRenderer",cellRenderer:!0},Xs={propertyName:"menuItem",cellRenderer:!1},Js=class e extends Oe{constructor(){super(...arguments),this.beanName="userComponentFactory"}wireBeans(e){this.agComponentUtils=e.agComponentUtils,this.componentMetadataProvider=e.componentMetadataProvider,this.userComponentRegistry=e.userComponentRegistry,this.frameworkComponentWrapper=e.frameworkComponentWrapper,this.gridOptions=e.gridOptions}getDragAndDropImageCompDetails(e){return this.getCompDetails(this.gridOptions,Is,"agDragAndDropImage",e,!0)}getHeaderCompDetails(e,t){return this.getCompDetails(e,Ls,"agColumnHeader",t)}getHeaderGroupCompDetails(e){const t=e.columnGroup.getColGroupDef();return this.getCompDetails(t,ks,"agColumnGroupHeader",e)}getFullWidthCellRendererDetails(e){return this.getCompDetails(this.gridOptions,js,null,e,!0)}getFullWidthLoadingCellRendererDetails(e){return this.getCompDetails(this.gridOptions,qs,"agLoadingCellRenderer",e,!0)}getFullWidthGroupCellRendererDetails(e){return this.getCompDetails(this.gridOptions,Qs,"agGroupRowRenderer",e,!0)}getFullWidthDetailCellRendererDetails(e){return this.getCompDetails(this.gridOptions,Ys,"agDetailCellRenderer",e,!0)}getInnerRendererDetails(e,t){return this.getCompDetails(e,Bs,null,t)}getFullWidthGroupRowInnerCellRenderer(e,t){return this.getCompDetails(e,Bs,null,t)}getCellRendererDetails(e,t){return this.getCompDetails(e,Os,null,t)}getEditorRendererDetails(e,t){return this.getCompDetails(e,Gs,null,t)}getLoadingCellRendererDetails(e,t){return this.getCompDetails(e,Ns,"agSkeletonCellRenderer",t,!0)}getCellEditorDetails(e,t){return this.getCompDetails(e,Hs,"agCellEditor",t,!0)}getFilterDetails(e,t,i){return this.getCompDetails(e,Us,i,t,!0)}getDateCompDetails(e){return this.getCompDetails(this.gridOptions,Ts,"agDateInput",e,!0)}getLoadingOverlayCompDetails(e){return this.getCompDetails(this.gridOptions,Vs,"agLoadingOverlay",e,!0)}getNoRowsOverlayCompDetails(e){return this.getCompDetails(this.gridOptions,Ws,"agNoRowsOverlay",e,!0)}getTooltipCompDetails(e){return this.getCompDetails(e.colDef,zs,"agTooltipComponent",e,!0)}getSetFilterCellRendererDetails(e,t){return this.getCompDetails(e,Os,null,t)}getFloatingFilterCompDetails(e,t,i){return this.getCompDetails(e,Ks,i,t)}getToolPanelCompDetails(e,t){return this.getCompDetails(e,_s,null,t,!0)}getStatusPanelCompDetails(e,t){return this.getCompDetails(e,$s,null,t,!0)}getMenuItemCompDetails(e,t){return this.getCompDetails(e,Xs,"agMenuItem",t,!0)}getCompDetails(t,i,s,o,n=!1){const{propertyName:r,cellRenderer:l}=i;let a,{compName:d,jsComp:h,fwComp:u,paramsFromSelector:c,popupFromSelector:g,popupPositionFromSelector:p}=e.getCompKeys(this.frameworkOverrides,t,i,o);const m=e=>{const t=this.userComponentRegistry.retrieve(r,e);t&&(h=t.componentFromFramework?void 0:t.component,u=t.componentFromFramework?t.component:void 0,a=t.params)};if(null!=d&&m(d),null==h&&null==u&&null!=s&&m(s),h&&l&&!this.agComponentUtils.doesImplementIComponent(h)&&(h=this.agComponentUtils.adaptFunction(r,h)),!h&&!u)return void(n&&v(`Could not find component ${d}, did you forget to configure this component?`));const C=this.mergeParamsWithApplicationProvidedParams(t,i,o,c,a),f=null==h,w=h||u;return{componentFromFramework:f,componentClass:w,params:C,type:i,popupFromSelector:g,popupPositionFromSelector:p,newAgStackInstance:()=>this.newAgStackInstance(w,f,C,i)}}static getCompKeys(e,t,i,s){const{propertyName:o}=i;let n,r,l,a,d,h;if(t){const i=t,u=i[o+"Selector"],c=u?u(s):null,g=t=>{if("string"==typeof t)n=t;else if(null!=t&&!0!==t){e.isFrameworkComponent(t)?l=t:r=t}};c?(g(c.component),a=c.params,d=c.popup,h=c.popupPosition):g(i[o])}return{compName:n,jsComp:r,fwComp:l,paramsFromSelector:a,popupFromSelector:d,popupPositionFromSelector:h}}newAgStackInstance(e,t,i,s){const o=s.propertyName;let n;if(!t)n=new e;else{const t=this.componentMetadataProvider.retrieve(o);n=this.frameworkComponentWrapper.wrap(e,t.mandatoryMethodList,t.optionalMethodList,s)}const r=this.initComponent(n,i);return null==r?As.resolve(n):r.then((()=>n))}mergeParamsWithApplicationProvidedParams(e,t,i,s=null,o){const n=this.gos.getGridCommonParams();Ze(n,i),o&&Ze(n,o);const r=e&&e[t.propertyName+"Params"];if("function"==typeof r){Ze(n,r(i))}else"object"==typeof r&&Ze(n,r);return Ze(n,s),n}initComponent(e,t){if(this.createBean(e),null!=e.init)return e.init(t)}};function Zs(e){const t=e;return null!=t&&null!=t.getFrameworkComponentInstance?t.getFrameworkComponentInstance():e}var eo=class e{static register(t){e.__register(t,!0,void 0)}static registerModules(t){e.__registerModules(t,!0,void 0)}static __register(t,i,s){e.runVersionChecks(t),void 0!==s?(e.areGridScopedModules=!0,void 0===e.gridModulesMap[s]&&(e.gridModulesMap[s]={}),e.gridModulesMap[s][t.moduleName]=t):e.globalModulesMap[t.moduleName]=t,e.setModuleBased(i)}static __unRegisterGridModules(t){delete e.gridModulesMap[t]}static __registerModules(t,i,s){e.setModuleBased(i),t&&t.forEach((t=>e.__register(t,i,s)))}static isValidModuleVersion(t){const[i,s]=t.version.split(".")||[],[o,n]=e.currentModuleVersion.split(".")||[];return i===o&&s===n}static runVersionChecks(t){e.currentModuleVersion||(e.currentModuleVersion=t.version);const i=e=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${e} Please update all modules to the same version.`;if(t.version?e.isValidModuleVersion(t)||v(i(`'${t.moduleName}' is version ${t.version} but the other modules are version ${e.currentModuleVersion}.`)):v(i(`'${t.moduleName}' is incompatible.`)),t.validate){const e=t.validate();if(!e.isValid){v(`${e.message}`)}}}static setModuleBased(t){void 0===e.moduleBased?e.moduleBased=t:e.moduleBased!==t&&(v("AG Grid: You are mixing modules (i.e. @ag-grid-community/core) and packages (ag-grid-community) - you can only use one or the other of these mechanisms."),v("Please see https://www.ag-grid.com/javascript-grid/modules/ for more information."))}static __setIsBundled(){e.isBundled=!0}static __assertRegistered(t,i,s){var o;if(this.__isRegistered(t,s))return!0;let n;if(e.isBundled)n=`AG Grid: unable to use ${i} as 'ag-grid-enterprise' has not been loaded. Check you are using the Enterprise bundle:\n \n