notebook 7.0.0b4__py3-none-any.whl → 7.0.0rc0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of notebook might be problematic. Click here for more details.

Files changed (205) hide show
  1. notebook/_version.py +1 -1
  2. notebook/app.py +17 -13
  3. notebook/static/1018.bundle.js +1 -1
  4. notebook/static/1198.bundle.js +1 -1
  5. notebook/static/1337.bundle.js +1 -1
  6. notebook/static/134.bundle.js +1 -0
  7. notebook/static/1408.bundle.js +1 -1
  8. notebook/static/1584.bundle.js +1 -1
  9. notebook/static/162.bundle.js +1 -1
  10. notebook/static/1647.bundle.js +1 -1
  11. notebook/static/1650.bundle.js +1 -1
  12. notebook/static/1682.bundle.js +1 -1
  13. notebook/static/1684.bundle.js +1 -1
  14. notebook/static/1809.bundle.js +1 -1
  15. notebook/static/1827.bundle.js +1 -1
  16. notebook/static/1833.bundle.js +1 -1
  17. notebook/static/1835.bundle.js +1 -1
  18. notebook/static/1950.bundle.js +1 -1
  19. notebook/static/1958.bundle.js +1 -1
  20. notebook/static/2007.bundle.js +1 -1
  21. notebook/static/2067.bundle.js +1 -1
  22. notebook/static/2088.bundle.js +1 -1
  23. notebook/static/2089.bundle.js +1 -1
  24. notebook/static/2122.bundle.js +1 -1
  25. notebook/static/2167.bundle.js +1 -1
  26. notebook/static/2184.bundle.js +1 -1
  27. notebook/static/2251.bundle.js +1 -1
  28. notebook/static/2311.bundle.js +1 -1
  29. notebook/static/2323.bundle.js +1 -1
  30. notebook/static/2330.bundle.js +1 -1
  31. notebook/static/2401.bundle.js +1 -1
  32. notebook/static/2479.bundle.js +1 -0
  33. notebook/static/2512.bundle.js +1 -1
  34. notebook/static/2607.bundle.js +1 -1
  35. notebook/static/2913.bundle.js +1 -1
  36. notebook/static/2924.bundle.js +1 -1
  37. notebook/static/2955.bundle.js +1 -0
  38. notebook/static/2979.bundle.js +1 -1
  39. notebook/static/3146.bundle.js +1 -1
  40. notebook/static/3213.bundle.js +1 -1
  41. notebook/static/3340.bundle.js +1 -1
  42. notebook/static/3360.bundle.js +1 -1
  43. notebook/static/3466.bundle.js +1 -1
  44. notebook/static/35.bundle.js +1 -1
  45. notebook/static/3676.bundle.js +1 -1
  46. notebook/static/3680.bundle.js +1 -1
  47. notebook/static/3768.bundle.js +1 -1
  48. notebook/static/377.bundle.js +1 -1
  49. notebook/static/3797.bundle.js +1 -1
  50. notebook/static/3863.bundle.js +1 -1
  51. notebook/static/3881.bundle.js +1 -1
  52. notebook/static/4042.bundle.js +1 -0
  53. notebook/static/4131.bundle.js +1 -1
  54. notebook/static/4205.bundle.js +1 -1
  55. notebook/static/4212.bundle.js +1 -1
  56. notebook/static/4234.bundle.js +1 -1
  57. notebook/static/4382.bundle.js +1 -1
  58. notebook/static/4558.bundle.js +1 -1
  59. notebook/static/4645.bundle.js +1 -1
  60. notebook/static/4746.bundle.js +1 -0
  61. notebook/static/4785.bundle.js +1 -1
  62. notebook/static/4810.bundle.js +1 -1
  63. notebook/static/4811.bundle.js +1 -1
  64. notebook/static/4837.bundle.js +1 -0
  65. notebook/static/5016.bundle.js +1 -1
  66. notebook/static/5088.bundle.js +1 -1
  67. notebook/static/5099.bundle.js +1 -1
  68. notebook/static/5125.bundle.js +2 -0
  69. notebook/static/5135.bundle.js +1 -1
  70. notebook/static/5261.bundle.js +1 -0
  71. notebook/static/5313.bundle.js +1 -1
  72. notebook/static/5325.bundle.js +1 -1
  73. notebook/static/5346.bundle.js +1 -1
  74. notebook/static/5426.bundle.js +1 -1
  75. notebook/static/5573.bundle.js +1 -1
  76. notebook/static/5601.bundle.js +1 -1
  77. notebook/static/5678.bundle.js +1 -1
  78. notebook/static/5733.bundle.js +1 -1
  79. notebook/static/5765.bundle.js +1 -1
  80. notebook/static/5777.bundle.js +1 -1
  81. notebook/static/5828.bundle.js +1 -1
  82. notebook/static/5912.bundle.js +1 -1
  83. notebook/static/5921.bundle.js +1 -1
  84. notebook/static/6017.bundle.js +1 -1
  85. notebook/static/6027.bundle.js +1 -1
  86. notebook/static/6139.bundle.js +1 -1
  87. notebook/static/62.bundle.js +1 -1
  88. notebook/static/6256.bundle.js +1 -1
  89. notebook/static/6271.bundle.js +1 -1
  90. notebook/static/6345.bundle.js +1 -1
  91. notebook/static/6604.bundle.js +1 -1
  92. notebook/static/6621.bundle.js +1 -1
  93. notebook/static/6627.bundle.js +1 -1
  94. notebook/static/6774.bundle.js +1 -0
  95. notebook/static/6815.bundle.js +1 -1
  96. notebook/static/6853.bundle.js +1 -1
  97. notebook/static/6893.bundle.js +1 -1
  98. notebook/static/690.bundle.js +1 -0
  99. notebook/static/6919.bundle.js +3 -3
  100. notebook/static/6962.bundle.js +1 -1
  101. notebook/static/6999.bundle.js +1 -1
  102. notebook/static/7226.bundle.js +1 -1
  103. notebook/static/7252.bundle.js +1 -0
  104. notebook/static/7302.bundle.js +1 -1
  105. notebook/static/7369.bundle.js +1 -1
  106. notebook/static/7386.bundle.js +1 -1
  107. notebook/static/7391.bundle.js +1 -1
  108. notebook/static/7394.bundle.js +1 -1
  109. notebook/static/7427.bundle.js +1 -0
  110. notebook/static/7439.bundle.js +1 -1
  111. notebook/static/7450.bundle.js +1 -1
  112. notebook/static/7603.bundle.js +1 -1
  113. notebook/static/7639.bundle.js +1 -1
  114. notebook/static/7679.bundle.js +1 -0
  115. notebook/static/7684.bundle.js +1 -1
  116. notebook/static/7819.bundle.js +1 -1
  117. notebook/static/7900.bundle.js +1 -0
  118. notebook/static/7906.bundle.js +1 -1
  119. notebook/static/7957.bundle.js +1 -1
  120. notebook/static/7997.bundle.js +1 -1
  121. notebook/static/8010.bundle.js +1 -1
  122. notebook/static/8136.bundle.js +1 -1
  123. notebook/static/8578.bundle.js +1 -1
  124. notebook/static/8579.bundle.js +1 -1
  125. notebook/static/8633.bundle.js +1 -1
  126. notebook/static/8771.bundle.js +1 -1
  127. notebook/static/880.bundle.js +1 -1
  128. notebook/static/8845.bundle.js +1 -1
  129. notebook/static/8845.bundle.js.LICENSE.txt +2 -2
  130. notebook/static/8875.bundle.js +1 -1
  131. notebook/static/8907.bundle.js +1 -1
  132. notebook/static/8914.bundle.js +1 -1
  133. notebook/static/8928.bundle.js +1 -0
  134. notebook/static/893.bundle.js +1 -1
  135. notebook/static/901.bundle.js +1 -1
  136. notebook/static/9068.bundle.js +1 -1
  137. notebook/static/9086.bundle.js +1 -1
  138. notebook/static/9151.bundle.js +1 -1
  139. notebook/static/9268.bundle.js +1 -1
  140. notebook/static/9335.bundle.js +1 -1
  141. notebook/static/9341.bundle.js +1 -1
  142. notebook/static/9380.bundle.js +1 -1
  143. notebook/static/9605.bundle.js +1 -1
  144. notebook/static/9609.bundle.js +1 -1
  145. notebook/static/9638.bundle.js +1 -1
  146. notebook/static/9680.bundle.js +1 -0
  147. notebook/static/9685.bundle.js +1 -0
  148. notebook/static/9752.bundle.js +1 -1
  149. notebook/static/9799.bundle.js +1 -1
  150. notebook/static/9852.bundle.js +1 -1
  151. notebook/static/9854.bundle.js +2 -0
  152. notebook/static/bundle.js +1 -1
  153. notebook/static/third-party-licenses.json +151 -127
  154. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +14 -14
  155. notebook-7.0.0rc0.data/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +34 -0
  156. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +4 -4
  157. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  158. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +9 -9
  159. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +15 -15
  160. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +11 -11
  161. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +10 -10
  162. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.a7e9e50b675118021681.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.1b31bd587bea2c1816b1.js +1 -1
  163. notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.d4d2f899a93808dccf3d.js +1 -0
  164. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.2aa8888b3e6b5670842f.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.a832439d17633285a072.js +1 -1
  165. notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.b00379f3c5b2b5eb657f.js +1 -0
  166. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  167. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/METADATA +2 -2
  168. notebook-7.0.0rc0.dist-info/RECORD +389 -0
  169. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/WHEEL +1 -1
  170. notebook/static/2274.bundle.js +0 -1
  171. notebook/static/3063.bundle.js +0 -2
  172. notebook/static/3344.bundle.js +0 -1
  173. notebook/static/4190.bundle.js +0 -1
  174. notebook/static/435.bundle.js +0 -1
  175. notebook/static/4964.bundle.js +0 -1
  176. notebook/static/5282.bundle.js +0 -1
  177. notebook/static/5975.bundle.js +0 -1
  178. notebook/static/6695.bundle.js +0 -1
  179. notebook/static/771.bundle.js +0 -1
  180. notebook/static/7827.bundle.js +0 -2
  181. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.9bd87123f72aaa959984.js +0 -1
  182. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.ed19884b54327368a389.js +0 -1
  183. notebook-7.0.0b4.dist-info/RECORD +0 -381
  184. /notebook/static/{3063.bundle.js.LICENSE.txt → 5125.bundle.js.LICENSE.txt} +0 -0
  185. /notebook/static/{7827.bundle.js.LICENSE.txt → 9854.bundle.js.LICENSE.txt} +0 -0
  186. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  187. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  188. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  189. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  190. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  191. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  192. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  193. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  194. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  195. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  196. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  197. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  198. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  199. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  200. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  201. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  202. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/776.c7baadfaddfd4518c935.js +0 -0
  203. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  204. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/entry_points.txt +0 -0
  205. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/licenses/LICENSE +0 -0
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 8914.bundle.js.LICENSE.txt */
2
- (self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[8914],{66471:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;0!=r--;){var a=o[r];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}},56440:e=>{"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(n=t.cmp,function(e){return function(t,i){var r={key:t,value:e[t]},o={key:i,value:e[i]};return n(r,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,a;if(Array.isArray(t)){for(a="[",n=0;n<t.length;n++)n&&(a+=","),a+=e(t[n])||"null";return a+"]"}if(null===t)return"null";if(-1!==o.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=o.push(t)-1,l=Object.keys(t).sort(r&&r(t));for(a="",n=0;n<l.length;n++){var u=l[n],c=e(t[u]);c&&(a&&(a+=","),a+=JSON.stringify(u)+":"+c)}return o.splice(s,1),"{"+a+"}"}}(e)}},72759:e=>{"use strict";var t=/("(?:[^\\"]|\\.)*")|[:,]/g;e.exports=function(e,n){var i,r,o;return n=n||{},i=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===i?1/0:void 0===n.maxLength?80:n.maxLength,o=n.replacer,function e(n,a,s){var l,u,c,f,d,h,p,m,g,y,v,b;if(n&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===(v=JSON.stringify(n,o)))return v;if(p=r-a.length-s,v.length<=p&&(g=v.replace(t,(function(e,t){return t||e+" "}))).length<=p)return g;if(null!=o&&(n=JSON.parse(v),o=void 0),"object"==typeof n&&null!==n){if(m=a+i,c=[],u=0,Array.isArray(n))for(y="[",l="]",p=n.length;u<p;u++)c.push(e(n[u],m,u===p-1?0:1)||"null");else for(y="{",l="}",p=(h=Object.keys(n)).length;u<p;u++)f=h[u],d=JSON.stringify(f)+": ",void 0!==(b=e(n[f],m,d.length+(u===p-1?0:1)))&&c.push(d+b);if(c.length>0)return[y,i+c.join(",\n"+m),l].join("\n"+a)}return v}(e,"",0)}},27061:e=>{var t,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,l=[],u=!1,c=-1;function f(){u&&s&&(u=!1,s.length?l=s.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=a(f);u=!0;for(var t=l.length;t;){for(s=l,l=[];++c<t;)s&&s[c].run();c=-1,t=l.length}s=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),1!==l.length||u||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},58914:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DEFAULT_ACTIONS:()=>z2,default:()=>H2,guessMode:()=>q2,vega:()=>O2,vegaLite:()=>N2,version:()=>F2});var i={};n.r(i),n.d(i,{JsonPatchError:()=>O,_areEquals:()=>U,applyOperation:()=>P,applyPatch:()=>L,applyReducer:()=>B,deepClone:()=>N,getValueByPointer:()=>R,validate:()=>I,validator:()=>j});var r={};n.r(r),n.d(r,{compare:()=>J,generate:()=>V,observe:()=>Y,unobserve:()=>G});var o={};n.r(o),n.d(o,{aggregate:()=>jl,bin:()=>Il,collect:()=>ql,compare:()=>Wl,countpattern:()=>Gl,cross:()=>Yl,density:()=>Ql,dotbin:()=>nu,expression:()=>iu,extent:()=>ou,facet:()=>su,field:()=>lu,filter:()=>cu,flatten:()=>fu,fold:()=>du,formula:()=>hu,generate:()=>pu,impute:()=>yu,joinaggregate:()=>vu,kde:()=>bu,key:()=>xu,load:()=>wu,lookup:()=>Eu,multiextent:()=>Au,multivalues:()=>Du,params:()=>Mu,pivot:()=>Cu,prefacet:()=>Fu,project:()=>Ou,proxy:()=>Nu,quantile:()=>Tu,relay:()=>zu,sample:()=>Ru,sequence:()=>Pu,sieve:()=>Lu,subflow:()=>au,timeunit:()=>Bu,tupleindex:()=>Iu,values:()=>Uu,window:()=>Yu});var a={};n.r(a),n.d(a,{interpolate:()=>xd,interpolateArray:()=>dd,interpolateBasis:()=>ed,interpolateBasisClosed:()=>td,interpolateCubehelix:()=>pp,interpolateCubehelixLong:()=>mp,interpolateDate:()=>pd,interpolateDiscrete:()=>xh,interpolateHcl:()=>tp,interpolateHclLong:()=>np,interpolateHsl:()=>Oh,interpolateHslLong:()=>Nh,interpolateHue:()=>_h,interpolateLab:()=>Kh,interpolateNumber:()=>md,interpolateNumberArray:()=>cd,interpolateObject:()=>gd,interpolateRgb:()=>ad,interpolateRgbBasis:()=>ld,interpolateRgbBasisClosed:()=>ud,interpolateRound:()=>_d,interpolateString:()=>bd,interpolateTransformCss:()=>Dh,interpolateTransformSvg:()=>Sh,interpolateZoom:()=>Ch,piecewise:()=>uh,quantize:()=>gp});var s={};n.r(s),n.d(s,{bound:()=>Gx,identifier:()=>Xx,mark:()=>Jx,overlap:()=>Qx,render:()=>r_,viewlayout:()=>A_});var l={};n.r(l),n.d(l,{axisticks:()=>D_,datajoin:()=>S_,encode:()=>C_,legendentries:()=>F_,linkpath:()=>R_,pie:()=>I_,scale:()=>W_,sortitems:()=>V_,stack:()=>K_});var u={};n.r(u),n.d(u,{contour:()=>zA,geojson:()=>LA,geopath:()=>BA,geopoint:()=>jA,geoshape:()=>IA,graticule:()=>UA,heatmap:()=>qA,isocontour:()=>AA,kde2d:()=>OA,projection:()=>HA});var c={};n.r(c),n.d(c,{force:()=>j$});var f={};n.r(f),n.d(f,{nest:()=>WD,pack:()=>JD,partition:()=>ZD,stratify:()=>KD,tree:()=>nS,treelinks:()=>iS,treemap:()=>aS});var d={};n.r(d),n.d(d,{label:()=>SS});var h={};n.r(h),n.d(h,{loess:()=>CS,regression:()=>OS});var p={};n.r(p),n.d(p,{voronoi:()=>lM});var m={};n.r(m),n.d(m,{wordcloud:()=>kM});var g={};n.r(g),n.d(g,{crossfilter:()=>CM,resolvefilter:()=>FM});var y={};n.r(y),n.d(y,{Bounds:()=>Ng,CanvasHandler:()=>cb,CanvasRenderer:()=>mb,DATE:()=>mi,DAY:()=>gi,DAYOFYEAR:()=>yi,Dataflow:()=>ds,Debug:()=>be,Error:()=>ge,EventStream:()=>Za,Gradient:()=>Pm,GroupItem:()=>zg,HOURS:()=>vi,Handler:()=>Gv,Info:()=>ve,Item:()=>Tg,MILLISECONDS:()=>_i,MINUTES:()=>bi,MONTH:()=>hi,Marks:()=>Cv,MultiPulse:()=>ls,None:()=>me,Operator:()=>Xa,Parameters:()=>Ga,Pulse:()=>rs,QUARTER:()=>di,RenderType:()=>ax,Renderer:()=>Vv,ResourceLoader:()=>Rg,SECONDS:()=>xi,SVGHandler:()=>yb,SVGRenderer:()=>qb,SVGStringRenderer:()=>ix,Scenegraph:()=>Lv,TIME_UNITS:()=>wi,Transform:()=>ps,View:()=>yT,WEEK:()=>pi,Warn:()=>ye,YEAR:()=>fi,accessor:()=>K,accessorFields:()=>te,accessorName:()=>ee,array:()=>Ge,ascending:()=>Qe,bandwidthNRD:()=>Cs,bin:()=>Fs,bootstrapCI:()=>Ts,boundClip:()=>px,boundContext:()=>iy,boundItem:()=>Fv,boundMark:()=>Nv,boundStroke:()=>Bg,changeset:()=>Wa,clampRange:()=>Ye,codegenExpression:()=>uF,compare:()=>Je,constant:()=>tt,cumulativeLogNormal:()=>Xs,cumulativeNormal:()=>qs,cumulativeUniform:()=>tl,dayofyear:()=>Mi,debounce:()=>nt,defaultLocale:()=>na,definition:()=>gs,densityLogNormal:()=>Vs,densityNormal:()=>Us,densityUniform:()=>el,domChild:()=>Uv,domClear:()=>qv,domCreate:()=>jv,domFind:()=>Iv,dotbin:()=>zs,error:()=>oe,expressionFunction:()=>gN,extend:()=>it,extent:()=>rt,extentIndex:()=>ot,falsy:()=>he,fastmap:()=>ut,field:()=>se,flush:()=>ct,font:()=>wv,fontFamily:()=>_v,fontSize:()=>gv,format:()=>$a,formatLocale:()=>Vo,formats:()=>Da,hasOwnProperty:()=>st,id:()=>le,identity:()=>ue,inferType:()=>ba,inferTypes:()=>xa,ingest:()=>La,inherits:()=>ft,inrange:()=>dt,interpolate:()=>am,interpolateColors:()=>im,interpolateRange:()=>nm,intersect:()=>ux,intersectBoxLine:()=>py,intersectPath:()=>cy,intersectPoint:()=>fy,intersectRule:()=>hy,isArray:()=>_e,isBoolean:()=>ht,isDate:()=>pt,isFunction:()=>Ve,isIterable:()=>mt,isNumber:()=>gt,isObject:()=>we,isRegExp:()=>yt,isString:()=>vt,isTuple:()=>za,key:()=>bt,lerp:()=>xt,lineHeight:()=>yv,loader:()=>Ca,locale:()=>ta,logger:()=>xe,lruCache:()=>wt,markup:()=>zb,merge:()=>kt,mergeConfig:()=>Ee,multiLineOffset:()=>bv,one:()=>fe,pad:()=>At,panLinear:()=>ze,panLog:()=>Re,panPow:()=>Pe,panSymlog:()=>Le,parse:()=>GL,parseExpression:()=>aF,parseSelector:()=>zT,path:()=>Jc,pathCurves:()=>Bm,pathEqual:()=>yx,pathParse:()=>Hm,pathRectangle:()=>mg,pathRender:()=>ng,pathSymbols:()=>ag,pathTrail:()=>gg,peek:()=>De,point:()=>Hv,projection:()=>hA,quantileLogNormal:()=>Js,quantileNormal:()=>Ws,quantileUniform:()=>nl,quantiles:()=>Ss,quantizeInterpolator:()=>rm,quarter:()=>We,quartiles:()=>Ms,random:()=>Os,randomInteger:()=>Ps,randomKDE:()=>Gs,randomLCG:()=>Rs,randomLogNormal:()=>Qs,randomMixture:()=>Zs,randomNormal:()=>Hs,randomUniform:()=>il,read:()=>Ma,regressionConstant:()=>rl,regressionExp:()=>fl,regressionLinear:()=>ul,regressionLoess:()=>vl,regressionLog:()=>cl,regressionPoly:()=>pl,regressionPow:()=>dl,regressionQuad:()=>hl,renderModule:()=>lx,repeat:()=>Et,resetDefaultLocale:()=>ia,resetSVGClipId:()=>Fg,resetSVGDefIds:()=>vx,responseType:()=>Sa,runtimeContext:()=>$N,sampleCurve:()=>wl,sampleLogNormal:()=>Ys,sampleNormal:()=>Is,sampleUniform:()=>Ks,scale:()=>Gp,sceneEqual:()=>gx,sceneFromJSON:()=>Rv,scenePickVisit:()=>Ay,sceneToJSON:()=>zv,sceneVisit:()=>Ey,sceneZOrder:()=>ky,scheme:()=>cm,serializeXML:()=>Rb,setRandom:()=>Ns,span:()=>$t,splitAccessPath:()=>ae,stringValue:()=>Dt,textMetrics:()=>cv,timeBin:()=>pr,timeFloor:()=>Hi,timeFormatLocale:()=>Ko,timeInterval:()=>Qi,timeOffset:()=>er,timeSequence:()=>ir,timeUnitSpecifier:()=>$i,timeUnits:()=>Ei,toBoolean:()=>St,toDate:()=>Ct,toNumber:()=>Se,toSet:()=>Ot,toString:()=>Ft,transform:()=>ys,transforms:()=>ms,truncate:()=>Nt,truthy:()=>de,tupleid:()=>Ra,typeParsers:()=>ga,utcFloor:()=>Vi,utcInterval:()=>Zi,utcOffset:()=>tr,utcSequence:()=>rr,utcdayofyear:()=>zi,utcquarter:()=>He,utcweek:()=>Ri,version:()=>YL,visitArray:()=>Tt,week:()=>Ci,writeConfig:()=>Ae,zero:()=>ce,zoomLinear:()=>je,zoomLog:()=>Ie,zoomPow:()=>Ue,zoomSymlog:()=>qe});var v={};n.r(v),n.d(v,{accessPathDepth:()=>JB,accessPathWithDatum:()=>WB,compile:()=>o0,contains:()=>EB,deepEqual:()=>gB,deleteNestedProperty:()=>UB,duplicate:()=>yB,entries:()=>LB,every:()=>$B,fieldIntersection:()=>TB,flatAccessWithDatum:()=>HB,getFirstDefined:()=>QB,hasIntersection:()=>OB,hash:()=>wB,internalField:()=>tj,isBoolean:()=>BB,isEmpty:()=>zB,isEqual:()=>CB,isInternalField:()=>nj,isNullOrFalse:()=>kB,isNumeric:()=>rj,keys:()=>RB,logicalExpr:()=>IB,mergeDeep:()=>DB,never:()=>vB,normalize:()=>LV,normalizeAngle:()=>ij,omit:()=>xB,pick:()=>bB,prefixGenerator:()=>NB,removePathFromField:()=>XB,replaceAll:()=>VB,replacePathInField:()=>YB,resetIdCounter:()=>ej,setEqual:()=>FB,some:()=>AB,stringify:()=>_B,titleCase:()=>qB,unique:()=>MB,uniqueId:()=>KB,vals:()=>PB,varName:()=>jB,version:()=>a0});var b={};n.r(b),n.d(b,{dark:()=>c0,excel:()=>d0,fivethirtyeight:()=>y0,ggplot2:()=>b0,googlecharts:()=>j0,latimes:()=>A0,powerbi:()=>K0,quartz:()=>S0,urbaninstitute:()=>R0,version:()=>e1,vox:()=>C0});var x,_=(x=function(e,t){return x=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])},x(e,t)},function(e,t){function n(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),w=Object.prototype.hasOwnProperty;function k(e,t){return w.call(e,t)}function E(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var i=[];for(var r in e)k(e,r)&&i.push(r);return i}function A(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function $(e){for(var t,n=0,i=e.length;n<i;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function D(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function S(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function M(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(M(e[t]))return!0}else if("object"==typeof e)for(var i=E(e),r=i.length,o=0;o<r;o++)if(M(e[i[o]]))return!0;return!1}function C(e,t){var n=[e];for(var i in t){var r="object"==typeof t[i]?JSON.stringify(t[i],null,2):t[i];void 0!==r&&n.push(i+": "+r)}return n.join("\n")}var F=function(e){function t(t,n,i,r,o){var a=this.constructor,s=e.call(this,C(t,{name:n,index:i,operation:r,tree:o}))||this;return s.name=n,s.index=i,s.operation=r,s.tree=o,Object.setPrototypeOf(s,a.prototype),s.message=C(t,{name:n,index:i,operation:r,tree:o}),s}return _(t,e),t}(Error),O=F,N=A,T={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var i=e[t];return delete e[t],{newDocument:n,removed:i}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:function(e,t,n){var i=R(n,this.path);i&&(i=A(i));var r=P(n,{op:"remove",path:this.from}).removed;return P(n,{op:"add",path:this.path,value:r}),{newDocument:n,removed:i}},copy:function(e,t,n){var i=R(n,this.from);return P(n,{op:"add",path:this.path,value:A(i)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:U(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},z={add:function(e,t,n){return $(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:T.move,copy:T.copy,test:T.test,_get:T._get};function R(e,t){if(""==t)return e;var n={op:"_get",path:t};return P(e,n),n.value}function P(e,t,n,i,r,o){if(void 0===n&&(n=!1),void 0===i&&(i=!0),void 0===r&&(r=!0),void 0===o&&(o=0),n&&("function"==typeof n?n(t,0,e,t.path):j(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=R(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=U(e,t.value),!1===a.test)throw new O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(n)throw new O("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return a}i||(e=A(e));var s=(t.path||"").split("/"),l=e,u=1,c=s.length,f=void 0,d=void 0,h=void 0;for(h="function"==typeof n?n:j;;){if((d=s[u])&&-1!=d.indexOf("~")&&(d=S(d)),r&&("__proto__"==d||"prototype"==d&&u>0&&"constructor"==s[u-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===f&&(void 0===l[d]?f=s.slice(0,u).join("/"):u==c-1&&(f=t.path),void 0!==f&&h(t,0,e,f)),u++,Array.isArray(l)){if("-"===d)d=l.length;else{if(n&&!$(d))throw new O("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);$(d)&&(d=~~d)}if(u>=c){if(n&&"add"===t.op&&d>l.length)throw new O("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=z[t.op].call(t,l,d,e)).test)throw new O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(u>=c){if(!1===(a=T[t.op].call(t,l,d,e)).test)throw new O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[d],n&&u<c&&(!l||"object"!=typeof l))throw new O("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}function L(e,t,n,i,r){if(void 0===i&&(i=!0),void 0===r&&(r=!0),n&&!Array.isArray(t))throw new O("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");i||(e=A(e));for(var o=new Array(t.length),a=0,s=t.length;a<s;a++)o[a]=P(e,t[a],n,!0,r,a),e=o[a].newDocument;return o.newDocument=e,o}function B(e,t,n){var i=P(e,t);if(!1===i.test)throw new O("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return i.newDocument}function j(e,t,n,i){if("object"!=typeof e||null===e||Array.isArray(e))throw new O("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!T[e.op])throw new O("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new O("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new O('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 O("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 O("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)&&M(e.value))throw new O("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 r=e.path.split("/").length,o=i.split("/").length;if(r!==o+1&&r!==o)throw new O("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!==i)throw new O("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=I([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new O("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function I(e,t,n){try{if(!Array.isArray(e))throw new O("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)L(A(t),A(e),n||!0);else{n=n||j;for(var i=0;i<e.length;i++)n(e[i],i,t,void 0)}}catch(e){if(e instanceof O)return e;throw e}}function U(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,i,r,o=Array.isArray(e),a=Array.isArray(t);if(o&&a){if((i=e.length)!=t.length)return!1;for(n=i;0!=n--;)if(!U(e[n],t[n]))return!1;return!0}if(o!=a)return!1;var s=Object.keys(e);if((i=s.length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=i;0!=n--;)if(!U(e[r=s[n]],t[r]))return!1;return!0}return e!=e&&t!=t}var q=new WeakMap,W=function(e){this.observers=new Map,this.obj=e},H=function(e,t){this.callback=e,this.observer=t};function G(e,t){t.unobserve()}function Y(e,t){var n,i=function(e){return q.get(e)}(e);if(i){var r=function(e,t){return e.observers.get(t)}(i,t);n=r&&r.observer}else i=new W(e),q.set(e,i);if(n)return n;if(n={},i.value=A(e),t){n.callback=t,n.next=null;var o=function(){V(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=e,n.unobserve=function(){V(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(i,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new H(t,n)),n}function V(e,t){void 0===t&&(t=!1);var n=q.get(e.object);X(n.value,e.object,e.patches,"",t),e.patches.length&&L(n.value,e.patches);var i=e.patches;return i.length>0&&(e.patches=[],e.callback&&e.callback(i)),i}function X(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=E(t),a=E(e),s=!1,l=a.length-1;l>=0;l--){var u=e[f=a[l]];if(!k(t,f)||void 0===t[f]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+D(f),value:A(u)}),n.push({op:"remove",path:i+"/"+D(f)}),s=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}));else{var c=t[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?X(u,c,n,i+"/"+D(f),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+D(f),value:A(u)}),n.push({op:"replace",path:i+"/"+D(f),value:A(c)}))}}if(s||o.length!=a.length)for(l=0;l<o.length;l++){var f;k(e,f=o[l])||void 0===t[f]||n.push({op:"add",path:i+"/"+D(f),value:A(t[f])})}}}function J(e,t,n){void 0===n&&(n=!1);var i=[];return X(e,t,i,"",n),i}Object.assign({},i,r,{JsonPatchError:F,deepClone:A,escapePathComponent:D,unescapePathComponent:S});var Q=n(72759),Z=n.n(Q);function K(e,t,n){return e.fields=t||[],e.fname=n,e}function ee(e){return null==e?null:e.fname}function te(e){return null==e?null:e.fields}function ne(e){return 1===e.length?ie(e[0]):re(e)}const ie=e=>function(t){return t[e]},re=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function oe(e){throw Error(e)}function ae(e){const t=[],n=e.length;let i,r,o,a=null,s=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(o=e[r],"\\"===o)l+=e.substring(i,r++),i=r;else if(o===a)u(),a=null,s=-1;else{if(a)continue;i===s&&'"'===o||i===s&&"'"===o?(i=r+1,a=o):"."!==o||s?"["===o?(r>i&&u(),s=i=r+1):"]"===o&&(s||oe("Access path missing open bracket: "+e),s>0&&u(),s=0,i=r+1):r>i?u():i=r+1}return s&&oe("Access path missing closing bracket: "+e),a&&oe("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function se(e,t,n){const i=ae(e);return e=1===i.length?i[0]:e,K((n&&n.get||ne)(i),[e],t||e)}const le=se("id"),ue=K((e=>e),[],"identity"),ce=K((()=>0),[],"zero"),fe=K((()=>1),[],"one"),de=K((()=>!0),[],"true"),he=K((()=>!1),[],"false");function pe(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const me=0,ge=1,ye=2,ve=3,be=4;function xe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pe,i=e||me;return{level(e){return arguments.length?(i=+e,this):i},error(){return i>=ge&&n(t||"error","ERROR",arguments),this},warn(){return i>=ye&&n(t||"warn","WARN",arguments),this},info(){return i>=ve&&n(t||"log","INFO",arguments),this},debug(){return i>=be&&n(t||"log","DEBUG",arguments),this}}}var _e=Array.isArray;function we(e){return e===Object(e)}const ke=e=>"__proto__"!==e;function Ee(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(((e,t)=>{for(const n in t)if("signals"===n)e.signals=$e(e.signals,t.signals);else{const i="legend"===n?{layout:1}:"style"===n||null;Ae(e,n,t[n],i)}return e}),{})}function Ae(e,t,n,i){if(!ke(t))return;let r,o;if(we(n)&&!_e(n))for(r in o=we(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?Ae(o,r,n[r]):ke(r)&&(o[r]=n[r]);else e[t]=n}function $e(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function De(e){return e[e.length-1]}function Se(e){return null==e||""===e?null:+e}const Me=e=>t=>e*Math.exp(t),Ce=e=>t=>Math.log(e*t),Fe=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Oe=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Ne=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function Te(e,t,n,i){const r=n(e[0]),o=n(De(e)),a=(o-r)*t;return[i(r-a),i(o-a)]}function ze(e,t){return Te(e,t,Se,ue)}function Re(e,t){var n=Math.sign(e[0]);return Te(e,t,Ce(n),Me(n))}function Pe(e,t,n){return Te(e,t,Ne(n),Ne(1/n))}function Le(e,t,n){return Te(e,t,Fe(n),Oe(n))}function Be(e,t,n,i,r){const o=i(e[0]),a=i(De(e)),s=null!=t?i(t):(o+a)/2;return[r(s+(o-s)*n),r(s+(a-s)*n)]}function je(e,t,n){return Be(e,t,n,Se,ue)}function Ie(e,t,n){const i=Math.sign(e[0]);return Be(e,t,n,Ce(i),Me(i))}function Ue(e,t,n,i){return Be(e,t,n,Ne(i),Ne(1/i))}function qe(e,t,n,i){return Be(e,t,n,Fe(i),Oe(i))}function We(e){return 1+~~(new Date(e).getMonth()/3)}function He(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Ge(e){return null!=e?_e(e)?e:[e]:[]}function Ye(e,t,n){let i,r=e[0],o=e[1];return o<r&&(i=o,o=r,r=i),i=o-r,i>=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-i),r+i]}function Ve(e){return"function"==typeof e}const Xe="descending";function Je(e,t,n){n=n||{},t=Ge(t)||[];const i=[],r=[],o={},a=n.comparator||Ze;return Ge(e).forEach(((e,a)=>{null!=e&&(i.push(t[a]===Xe?-1:1),r.push(e=Ve(e)?e:se(e,null,n)),(te(e)||[]).forEach((e=>o[e]=1)))})),0===r.length?null:K(a(r,i),Object.keys(o))}const Qe=(e,t)=>(e<t||null==e)&&null!=t?-1:(e>t||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),Ze=(e,t)=>1===e.length?Ke(e[0],t[0]):et(e,t,e.length),Ke=(e,t)=>function(n,i){return Qe(e(n),e(i))*t},et=(e,t,n)=>(t.push(0),function(i,r){let o,a=0,s=-1;for(;0===a&&++s<n;)o=e[s],a=Qe(o(i),o(r));return a*t[s]});function tt(e){return Ve(e)?e:()=>e}function nt(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout((()=>(t(i),n=null)),e)}}function it(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n];return e}function rt(e,t){let n,i,r,o,a=0;if(e&&(n=e.length))if(null==t){for(i=e[a];a<n&&(null==i||i!=i);i=e[++a]);for(r=o=i;a<n;++a)i=e[a],null!=i&&(i<r&&(r=i),i>o&&(o=i))}else{for(i=t(e[a]);a<n&&(null==i||i!=i);i=t(e[++a]));for(r=o=i;a<n;++a)i=t(e[a]),null!=i&&(i<r&&(r=i),i>o&&(o=i))}return[r,o]}function ot(e,t){const n=e.length;let i,r,o,a,s,l=-1;if(null==t){for(;++l<n;)if(r=e[l],null!=r&&r>=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++l<n;)r=e[l],null!=r&&(i>r&&(i=r,a=l),o<r&&(o=r,s=l))}else{for(;++l<n;)if(r=t(e[l],l,e),null!=r&&r>=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++l<n;)r=t(e[l],l,e),null!=r&&(i>r&&(i=r,a=l),o<r&&(o=r,s=l))}return[a,s]}const at=Object.prototype.hasOwnProperty;function st(e,t){return at.call(e,t)}const lt={};function ut(e){let t,n={};function i(e){return st(n,e)&&n[e]!==lt}const r={size:0,empty:0,object:n,has:i,get:e=>i(e)?n[e]:void 0,set(e,t){return i(e)||(++r.size,n[e]===lt&&--r.empty),n[e]=t,this},delete(e){return i(e)&&(--r.size,++r.empty,n[e]=lt),this},clear(){r.size=r.empty=0,r.object=n={}},test(e){return arguments.length?(t=e,r):t},clean(){const e={};let i=0;for(const r in n){const o=n[r];o===lt||t&&t(o)||(e[r]=o,++i)}r.size=i,r.empty=0,r.object=n=e}};return e&&Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}function ct(e,t,n,i,r,o){if(!n&&0!==n)return o;const a=+n;let s,l=e[0],u=De(e);u<l&&(s=l,l=u,u=s),s=Math.abs(t-l);const c=Math.abs(u-t);return s<c&&s<=a?i:c<=a?r:o}function ft(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),it(i,n)}function dt(e,t,n,i){let r,o=t[0],a=t[t.length-1];return o>a&&(r=o,o=a,a=r),i=void 0===i||i,((n=void 0===n||n)?o<=e:o<e)&&(i?e<=a:e<a)}function ht(e){return"boolean"==typeof e}function pt(e){return"[object Date]"===Object.prototype.toString.call(e)}function mt(e){return e&&Ve(e[Symbol.iterator])}function gt(e){return"number"==typeof e}function yt(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function vt(e){return"string"==typeof e}function bt(e,t,n){e&&(e=t?Ge(e).map((e=>e.replace(/\\(.)/g,"$1"))):Ge(e));const i=e&&e.length,r=n&&n.get||ne,o=e=>r(t?[e]:ae(e));let a;if(i)if(1===i){const t=o(e[0]);a=function(e){return""+t(e)}}else{const t=e.map(o);a=function(e){let n=""+t[0](e),r=0;for(;++r<i;)n+="|"+t[r](e);return n}}else a=function(){return""};return K(a,e,"key")}function xt(e,t){const n=e[0],i=De(e),r=+t;return r?1===r?i:n+r*(i-n):n}const _t=1e4;function wt(e){let t,n,i;e=+e||_t;const r=()=>{t={},n={},i=0},o=(r,o)=>(++i>e&&(n=t,t={},i=1),t[r]=o);return r(),{clear:r,has:e=>st(t,e)||st(n,e),get:e=>st(t,e)?t[e]:st(n,e)?o(e,n[e]):void 0,set:(e,n)=>st(t,e)?t[e]=n:o(e,n)}}function kt(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const a=i||new t.constructor(r+o);let s=0,l=0,u=0;for(;s<r&&l<o;++u)a[u]=e(t[s],n[l])>0?n[l++]:t[s++];for(;s<r;++s,++u)a[u]=t[s];for(;l<o;++l,++u)a[u]=n[l];return a}function Et(e,t){let n="";for(;--t>=0;)n+=e;return n}function At(e,t,n,i){const r=n||" ",o=e+"",a=t-o.length;return a<=0?o:"left"===i?Et(r,a)+o:"center"===i?Et(r,~~(a/2))+o+Et(r,Math.ceil(a/2)):o+Et(r,a)}function $t(e){return e&&De(e)-e[0]||0}function Dt(e){return _e(e)?"["+e.map(Dt)+"]":we(e)||vt(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function St(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e||!e)}const Mt=e=>gt(e)||pt(e)?e:Date.parse(e);function Ct(e,t){return t=t||Mt,null==e||""===e?null:t(e)}function Ft(e){return null==e||""===e?null:e+""}function Ot(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}function Nt(e,t,n,i){const r=null!=i?i:"…",o=e+"",a=o.length,s=Math.max(0,t-r.length);return a<=t?o:"left"===n?r+o.slice(a-s):"center"===n?o.slice(0,Math.ceil(s/2))+r+o.slice(a-~~(s/2)):o.slice(0,s)+r}function Tt(e,t,n){if(e)if(t){const i=e.length;for(let r=0;r<i;++r){const i=t(e[r]);i&&n(i,r,e)}}else e.forEach(n)}var zt={},Rt={},Pt=34,Lt=10,Bt=13;function jt(e){return new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'})).join(",")+"}")}function It(e){var t=Object.create(null),n=[];return e.forEach((function(e){for(var i in e)i in t||n.push(t[i]=i)})),n}function Ut(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function qt(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function i(e,t){var i,r=[],o=e.length,a=0,s=0,l=o<=0,u=!1;function c(){if(l)return Rt;if(u)return u=!1,zt;var t,i,r=a;if(e.charCodeAt(r)===Pt){for(;a++<o&&e.charCodeAt(a)!==Pt||e.charCodeAt(++a)===Pt;);return(t=a)>=o?l=!0:(i=e.charCodeAt(a++))===Lt?u=!0:i===Bt&&(u=!0,e.charCodeAt(a)===Lt&&++a),e.slice(r+1,t-1).replace(/""/g,'"')}for(;a<o;){if((i=e.charCodeAt(t=a++))===Lt)u=!0;else if(i===Bt)u=!0,e.charCodeAt(a)===Lt&&++a;else if(i!==n)continue;return e.slice(r,t)}return l=!0,e.slice(r,o)}for(e.charCodeAt(o-1)===Lt&&--o,e.charCodeAt(o-1)===Bt&&--o;(i=c())!==Rt;){for(var f=[];i!==zt&&i!==Rt;)f.push(i),i=c();t&&null==(f=t(f,s++))||r.push(f)}return r}function r(t,n){return t.map((function(t){return n.map((function(e){return a(t[e])})).join(e)}))}function o(t){return t.map(a).join(e)}function a(e){return null==e?"":e instanceof Date?function(e){var t,n=e.getUTCHours(),i=e.getUTCMinutes(),r=e.getUTCSeconds(),o=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+Ut(-t,6):t>9999?"+"+Ut(t,6):Ut(t,4))+"-"+Ut(e.getUTCMonth()+1,2)+"-"+Ut(e.getUTCDate(),2)+(o?"T"+Ut(n,2)+":"+Ut(i,2)+":"+Ut(r,2)+"."+Ut(o,3)+"Z":r?"T"+Ut(n,2)+":"+Ut(i,2)+":"+Ut(r,2)+"Z":i||n?"T"+Ut(n,2)+":"+Ut(i,2)+"Z":"")}(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,r,o=i(e,(function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=jt(e);return function(i,r){return t(n(i),r,e)}}(e,t):jt(e)}));return o.columns=r||[],o},parseRows:i,format:function(t,n){return null==n&&(n=It(t)),[n.map(a).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=It(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(o).join("\n")},formatRow:o,formatValue:a}}function Wt(e){return e}function Ht(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return Gt(e,t)}))}:Gt(e,t)}function Gt(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,o=Yt(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:o}:null==i?{type:"Feature",id:n,properties:r,geometry:o}:{type:"Feature",id:n,bbox:i,properties:r,geometry:o}}function Yt(e,t){var n=function(e){if(null==e)return Wt;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,u=e.length,c=new Array(u);for(c[0]=(t+=e[0])*i+o,c[1]=(n+=e[1])*r+a;l<u;)c[l]=e[l],++l;return c}}(e.transform),i=e.arcs;function r(e,t){t.length&&t.pop();for(var r=i[e<0?~e:e],o=0,a=r.length;o<a;++o)t.push(n(r[o],o));e<0&&function(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}(t,a)}function o(e){return n(e)}function a(e){for(var t=[],n=0,i=e.length;n<i;++n)r(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0]);return t}function l(e){return e.map(s)}return function e(t){var n,i=t.type;switch(i){case"GeometryCollection":return{type:i,geometries:t.geometries.map(e)};case"Point":n=o(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(o);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:i,coordinates:n}}(t)}function Vt(e,t){var n={},i={},r={},o=[],a=-1;function s(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach((function(e){n[e<0?~e:e]=1})),o.push(r)}}return t.forEach((function(n,i){var r,o=e.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(r=t[++a],t[a]=n,t[i]=r)})),t.forEach((function(t){var n,o,a=function(t){var n,i=e.arcs[t<0?~t:t],r=i[0];return e.transform?(n=[0,0],i.forEach((function(e){n[0]+=e[0],n[1]+=e[1]}))):n=i[i.length-1],t<0?[n,r]:[r,n]}(t),s=a[0],l=a[1];if(n=r[s])if(delete r[n.end],n.push(t),n.end=l,o=i[l]){delete i[o.start];var u=o===n?n:n.concat(o);i[u.start=n.start]=r[u.end=o.end]=u}else i[n.start]=r[n.end]=n;else if(n=i[l])if(delete i[n.start],n.unshift(t),n.start=s,o=r[s]){delete r[o.end];var c=o===n?n:o.concat(n);i[c.start=o.start]=r[c.end=n.end]=c}else i[n.start]=r[n.end]=n;else i[(n=[t]).start=s]=r[n.end=l]=n})),s(r,i),s(i,r),t.forEach((function(e){n[e<0?~e:e]||o.push([e])})),o}function Xt(e){return Yt(e,Jt.apply(this,arguments))}function Jt(e,t,n){var i,r,o;if(arguments.length>1)i=function(e,t,n){var i,r=[],o=[];function a(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:i})}function s(e){e.forEach(a)}function l(e){e.forEach(s)}return function e(t){switch(i=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(l)}(t.arcs)}}(t),o.forEach(null==n?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}(0,t,n);else for(r=0,i=new Array(o=e.arcs.length);r<o;++r)i[r]=r;return{type:"MultiLineString",arcs:Vt(e,i)}}const Qt=Math.sqrt(50),Zt=Math.sqrt(10),Kt=Math.sqrt(2);function en(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),a=o>=Qt?10:o>=Zt?5:o>=Kt?2:1;let s,l,u;return r<0?(u=Math.pow(10,-r)/a,s=Math.round(e*u),l=Math.round(t*u),s/u<e&&++s,l/u>t&&--l,u=-u):(u=Math.pow(10,r)*a,s=Math.round(e/u),l=Math.round(t/u),s*u<e&&++s,l*u>t&&--l),l<s&&.5<=n&&n<2?en(e,t,2*n):[s,l,u]}function tn(e,t,n){if(!((n=+n)>0))return[];if((e=+e)==(t=+t))return[e];const i=t<e,[r,o,a]=i?en(t,e,n):en(e,t,n);if(!(o>=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let e=0;e<s;++e)l[e]=(o-e)/-a;else for(let e=0;e<s;++e)l[e]=(o-e)*a;else if(a<0)for(let e=0;e<s;++e)l[e]=(r+e)/-a;else for(let e=0;e<s;++e)l[e]=(r+e)*a;return l}function nn(e,t,n){return en(e=+e,t=+t,n=+n)[2]}function rn(e,t,n){n=+n;const i=(t=+t)<(e=+e),r=i?nn(t,e,n):nn(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}var on,an=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sn(e){if(!(t=an.exec(e)))throw new Error("invalid format: "+e);var t;return new ln({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function ln(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function un(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function cn(e){return(e=un(Math.abs(e)))?e[1]:NaN}function fn(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(cn(t)/3)))-cn(Math.abs(e)))}function dn(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,cn(t)-cn(e))+1}function hn(e){return Math.max(0,-cn(Math.abs(e)))}function pn(e,t){var n=un(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}sn.prototype=ln.prototype,ln.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const mn={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>pn(100*e,t),r:pn,s:function(e,t){var n=un(e,t);if(!n)return e+"";var i=n[0],r=n[1],o=r-(on=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+un(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function gn(e){return e}var yn,vn,bn,xn=Array.prototype.map,_n=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function wn(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?gn:(t=xn.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,o=[],a=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(e.substring(r-=s,r+s)),!((l+=s+1)>i));)s=t[a=(a+1)%t.length];return o.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?gn:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(xn.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=sn(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,y=e.trim,v=e.type;"n"===v?(m=!0,v="g"):mn[v]||(void 0===g&&(g=12),y=!0,v="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===d?o:/[%p]/.test(v)?l:"",_=mn[v],w=/[defgprs%]/.test(v);function k(e){var r,o,l,d=b,k=x;if("c"===v)k=_(e)+k,e="";else{var E=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:_(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i<n;++i)switch(e[i]){case".":r=t=i;break;case"0":0===r&&(r=i),t=i;break;default:if(!+e[i])break e;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==f&&(E=!1),d=(E?"("===f?f:u:"-"===f||"("===f?"":f)+d,k=("s"===v?_n[8+on/3]:"")+k+(E&&"("===f?")":""),w)for(r=-1,o=e.length;++r<o;)if(48>(l=e.charCodeAt(r))||l>57){k=(46===l?a+e.slice(r+1):e.slice(r))+k,e=e.slice(0,r);break}}m&&!h&&(e=i(e,1/0));var A=d.length+e.length+k.length,$=A<p?new Array(p-A+1).join(t):"";switch(m&&h&&(e=i($+e,$.length?p-k.length:1/0),$=""),n){case"<":e=d+e+k+$;break;case"=":e=d+$+e+k;break;case"^":e=$.slice(0,A=$.length>>1)+d+e+k+$.slice(A);break;default:e=$+d+e+k}return s(e)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return e+""},k}return{format:f,formatPrefix:function(e,t){var n=f(((e=sn(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(cn(t)/3))),r=Math.pow(10,-i),o=_n[8+i/3];return function(e){return n(r*e)+o}}}}yn=wn({thousands:",",grouping:[3],currency:["$",""]}),vn=yn.format,bn=yn.formatPrefix;const kn=new Date,En=new Date;function An(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t<n-e?t:n},r.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n<i&&o>0))return a;let s;do{a.push(s=new Date(+n)),t(n,o),e(n)}while(s<n&&n<i);return a},r.filter=n=>An((t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),((e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););})),n&&(r.count=(t,i)=>(kn.setTime(+t),En.setTime(+i),e(kn),e(En),Math.floor(n(kn,En))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e==0:t=>r.count(0,t)%e==0):r:null)),r}const $n=1e3,Dn=6e4,Sn=36e5,Mn=864e5,Cn=6048e5,Fn=31536e6,On=An((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Dn)/Mn),(e=>e.getDate()-1)),Nn=(On.range,An((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Mn),(e=>e.getUTCDate()-1))),Tn=(Nn.range,An((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Mn),(e=>Math.floor(e/Mn))));function zn(e){return An((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Dn)/Cn))}Tn.range;const Rn=zn(0),Pn=zn(1),Ln=zn(2),Bn=zn(3),jn=zn(4),In=zn(5),Un=zn(6);function qn(e){return An((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/Cn))}Rn.range,Pn.range,Ln.range,Bn.range,jn.range,In.range,Un.range;const Wn=qn(0),Hn=qn(1),Gn=qn(2),Yn=qn(3),Vn=qn(4),Xn=qn(5),Jn=qn(6),Qn=(Wn.range,Hn.range,Gn.range,Yn.range,Vn.range,Xn.range,Jn.range,An((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear())));Qn.every=e=>isFinite(e=Math.floor(e))&&e>0?An((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null,Qn.range;const Zn=An((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));Zn.every=e=>isFinite(e=Math.floor(e))&&e>0?An((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null,Zn.range;const Kn=An((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth())),ei=(Kn.range,An((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()))),ti=(ei.range,An((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*$n-e.getMinutes()*Dn)}),((e,t)=>{e.setTime(+e+t*Sn)}),((e,t)=>(t-e)/Sn),(e=>e.getHours()))),ni=(ti.range,An((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*Sn)}),((e,t)=>(t-e)/Sn),(e=>e.getUTCHours()))),ii=(ni.range,An((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*$n)}),((e,t)=>{e.setTime(+e+t*Dn)}),((e,t)=>(t-e)/Dn),(e=>e.getMinutes()))),ri=(ii.range,An((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*Dn)}),((e,t)=>(t-e)/Dn),(e=>e.getUTCMinutes()))),oi=(ri.range,An((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*$n)}),((e,t)=>(t-e)/$n),(e=>e.getUTCSeconds()))),ai=(oi.range,An((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e)));function si(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function li(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ui(e){let t,n,i;function r(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<0?r=t+1:o=t}while(r<o)}return r}return 2!==e.length?(t=si,n=(t,n)=>si(e(t),n),i=(t,n)=>e(t)-n):(t=e===si||e===li?e:ci,n=e,i=e),{left:r,center:function(e,t,n=0,o=e.length){const a=r(e,t,n,o-1);return a>n&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<=0?r=t+1:o=t}while(r<o)}return r}}}function ci(){return 0}ai.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?An((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):ai:null),ai.range;const fi="year",di="quarter",hi="month",pi="week",mi="date",gi="day",yi="dayofyear",vi="hours",bi="minutes",xi="seconds",_i="milliseconds",wi=[fi,di,hi,pi,mi,gi,yi,vi,bi,xi,_i],ki=wi.reduce(((e,t,n)=>(e[t]=1+n,e)),{});function Ei(e){const t=Ge(e).slice(),n={};return t.length||oe("Missing time unit."),t.forEach((e=>{st(ki,e)?n[e]=1:oe(`Invalid time unit: ${e}.`)})),(n[pi]||n[gi]?1:0)+(n[di]||n[hi]||n[mi]?1:0)+(n[yi]?1:0)>1&&oe(`Incompatible time units: ${e}`),t.sort(((e,t)=>ki[e]-ki[t])),t}const Ai={[fi]:"%Y ",[di]:"Q%q ",[hi]:"%b ",[mi]:"%d ",[pi]:"W%U ",[gi]:"%a ",[yi]:"%j ",[vi]:"%H:00",[bi]:"00:%M",[xi]:":%S",[_i]:".%L",[`${fi}-${hi}`]:"%Y-%m ",[`${fi}-${hi}-${mi}`]:"%Y-%m-%d ",[`${vi}-${bi}`]:"%H:%M"};function $i(e,t){const n=it({},Ai,t),i=Ei(e),r=i.length;let o,a,s="",l=0;for(l=0;l<r;)for(o=i.length;o>l;--o)if(a=i.slice(l,o).join("-"),null!=n[a]){s+=n[a],l=o;break}return s.trim()}const Di=new Date;function Si(e){return Di.setFullYear(e),Di.setMonth(0),Di.setDate(1),Di.setHours(0,0,0,0),Di}function Mi(e){return Fi(new Date(e))}function Ci(e){return Oi(new Date(e))}function Fi(e){return On.count(Si(e.getFullYear())-1,e)}function Oi(e){return Rn.count(Si(e.getFullYear())-1,e)}function Ni(e){return Si(e).getDay()}function Ti(e,t,n,i,r,o,a){if(0<=e&&e<100){const s=new Date(-1,t,n,i,r,o,a);return s.setFullYear(e),s}return new Date(e,t,n,i,r,o,a)}function zi(e){return Pi(new Date(e))}function Ri(e){return Li(new Date(e))}function Pi(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Nn.count(t-1,e)}function Li(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Wn.count(t-1,e)}function Bi(e){return Di.setTime(Date.UTC(e,0,1)),Di.getUTCDay()}function ji(e,t,n,i,r,o,a){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,i,r,o,a));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,i,r,o,a))}function Ii(e,t,n,i,r){const o=t||1,a=De(e),s=(e,t,r)=>function(e,t,n,i){const r=n<=1?e:i?(t,r)=>i+n*Math.floor((e(t,r)-i)/n):(t,i)=>n*Math.floor(e(t,i)/n);return t?(e,n)=>t(r(e,n),n):r}(n[r=r||e],i[r],e===a&&o,t),l=new Date,u=Ot(e),c=u[fi]?s(fi):tt(2012),f=u[hi]?s(hi):u[di]?s(di):ce,d=u[pi]&&u[gi]?s(gi,1,pi+gi):u[pi]?s(pi,1):u[gi]?s(gi,1):u[mi]?s(mi,1):u[yi]?s(yi,1):fe,h=u[vi]?s(vi):ce,p=u[bi]?s(bi):ce,m=u[xi]?s(xi):ce,g=u[_i]?s(_i):ce;return function(e){l.setTime(+e);const t=c(l);return r(t,f(l),d(l,t),h(l),p(l),m(l),g(l))}}function Ui(e,t,n){return t+7*e-(n+6)%7}const qi={[fi]:e=>e.getFullYear(),[di]:e=>Math.floor(e.getMonth()/3),[hi]:e=>e.getMonth(),[mi]:e=>e.getDate(),[vi]:e=>e.getHours(),[bi]:e=>e.getMinutes(),[xi]:e=>e.getSeconds(),[_i]:e=>e.getMilliseconds(),[yi]:e=>Fi(e),[pi]:e=>Oi(e),[pi+gi]:(e,t)=>Ui(Oi(e),e.getDay(),Ni(t)),[gi]:(e,t)=>Ui(1,e.getDay(),Ni(t))},Wi={[di]:e=>3*e,[pi]:(e,t)=>Ui(e,0,Ni(t))};function Hi(e,t){return Ii(e,t||1,qi,Wi,Ti)}const Gi={[fi]:e=>e.getUTCFullYear(),[di]:e=>Math.floor(e.getUTCMonth()/3),[hi]:e=>e.getUTCMonth(),[mi]:e=>e.getUTCDate(),[vi]:e=>e.getUTCHours(),[bi]:e=>e.getUTCMinutes(),[xi]:e=>e.getUTCSeconds(),[_i]:e=>e.getUTCMilliseconds(),[yi]:e=>Pi(e),[pi]:e=>Li(e),[gi]:(e,t)=>Ui(1,e.getUTCDay(),Bi(t)),[pi+gi]:(e,t)=>Ui(Li(e),e.getUTCDay(),Bi(t))},Yi={[di]:e=>3*e,[pi]:(e,t)=>Ui(e,0,Bi(t))};function Vi(e,t){return Ii(e,t||1,Gi,Yi,ji)}const Xi={[fi]:Qn,[di]:Kn.every(3),[hi]:Kn,[pi]:Rn,[mi]:On,[gi]:On,[yi]:On,[vi]:ti,[bi]:ii,[xi]:oi,[_i]:ai},Ji={[fi]:Zn,[di]:ei.every(3),[hi]:ei,[pi]:Wn,[mi]:Nn,[gi]:Nn,[yi]:Nn,[vi]:ni,[bi]:ri,[xi]:oi,[_i]:ai};function Qi(e){return Xi[e]}function Zi(e){return Ji[e]}function Ki(e,t,n){return e?e.offset(t,n):void 0}function er(e,t,n){return Ki(Qi(e),t,n)}function tr(e,t,n){return Ki(Zi(e),t,n)}function nr(e,t,n,i){return e?e.range(t,n,i):void 0}function ir(e,t,n,i){return nr(Qi(e),t,n,i)}function rr(e,t,n,i){return nr(Zi(e),t,n,i)}const or=31536e6,ar=[fi,hi,mi,vi,bi,xi,_i],sr=ar.slice(0,-1),lr=sr.slice(0,-1),ur=lr.slice(0,-1),cr=ur.slice(0,-1),fr=[fi,hi],dr=[fi],hr=[[sr,1,1e3],[sr,5,5e3],[sr,15,15e3],[sr,30,3e4],[lr,1,6e4],[lr,5,3e5],[lr,15,9e5],[lr,30,18e5],[ur,1,36e5],[ur,3,108e5],[ur,6,216e5],[ur,12,432e5],[cr,1,864e5],[[fi,pi],1,6048e5],[fr,1,2592e6],[fr,3,7776e6],[dr,1,or]];function pr(e){const t=e.extent,n=e.maxbins||40,i=Math.abs($t(t))/n;let r,o,a=ui((e=>e[2])).right(hr,i);return a===hr.length?(r=dr,o=rn(t[0]/or,t[1]/or,n)):a?(a=hr[i/hr[a-1][2]<hr[a][2]/i?a-1:a],r=a[0],o=a[1]):(r=ar,o=Math.max(rn(t[0],t[1],n),1)),{units:r,step:o}}function mr(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function gr(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function yr(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function vr(e){var t=e.dateTime,n=e.date,i=e.time,r=e.periods,o=e.days,a=e.shortDays,s=e.months,l=e.shortMonths,u=Cr(r),c=Fr(r),f=Cr(o),d=Fr(o),h=Cr(a),p=Fr(a),m=Cr(s),g=Fr(s),y=Cr(l),v=Fr(l),b={a:function(e){return a[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:Zr,e:Zr,f:io,g:mo,G:yo,H:Kr,I:eo,j:to,L:no,m:ro,M:oo,p:function(e){return r[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:jo,s:Io,S:ao,u:so,U:lo,V:co,w:fo,W:ho,x:null,X:null,y:po,Y:go,Z:vo,"%":Bo},x={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:bo,e:bo,f:Eo,g:zo,G:Po,H:xo,I:_o,j:wo,L:ko,m:Ao,M:$o,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:jo,s:Io,S:Do,u:So,U:Mo,V:Fo,w:Oo,W:No,x:null,X:null,y:To,Y:Ro,Z:Lo,"%":Bo},_={a:function(e,t,n){var i=h.exec(t.slice(n));return i?(e.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=f.exec(t.slice(n));return i?(e.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return E(e,t,n,i)},d:Ur,e:Ur,f:Vr,g:Lr,G:Pr,H:Wr,I:Wr,j:qr,L:Yr,m:Ir,M:Hr,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:jr,Q:Jr,s:Qr,S:Gr,u:Nr,U:Tr,V:zr,w:Or,W:Rr,x:function(e,t,i){return E(e,n,t,i)},X:function(e,t,n){return E(e,i,t,n)},y:Lr,Y:Pr,Z:Br,"%":Xr};function w(e,t){return function(n){var i,r,o,a=[],s=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s<u;)37===e.charCodeAt(s)&&(a.push(e.slice(l,s)),null!=(r=Er[i=e.charAt(++s)])?i=e.charAt(++s):r="e"===i?" ":"0",(o=t[i])&&(i=o(n,r)),a.push(i),l=s+1);return a.push(e.slice(l,s)),a.join("")}}function k(e,t){return function(n){var i,r,o=yr(1900,void 0,1);if(E(o,e,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(t&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=gr(yr(o.y,0,1))).getUTCDay(),i=r>4||0===r?Hn.ceil(i):Hn(i),i=Nn.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=mr(yr(o.y,0,1))).getDay(),i=r>4||0===r?Pn.ceil(i):Pn(i),i=On.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?gr(yr(o.y,0,1)).getUTCDay():mr(yr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,gr(o)):mr(o)}}function E(e,t,n,i){for(var r,o,a=0,s=t.length,l=n.length;a<s;){if(i>=l)return-1;if(37===(r=t.charCodeAt(a++))){if(r=t.charAt(a++),!(o=_[r in Er?t.charAt(a++):r])||(i=o(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=w(n,b),b.X=w(i,b),b.c=w(t,b),x.x=w(n,x),x.X=w(i,x),x.c=w(t,x),{format:function(e){var t=w(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",x);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}var br,xr,_r,wr,kr,Er={"-":"",_:" ",0:"0"},Ar=/^\s*\d+/,$r=/^%/,Dr=/[\\^$*+?|[\]().{}]/g;function Sr(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(t)+r:r)}function Mr(e){return e.replace(Dr,"\\$&")}function Cr(e){return new RegExp("^(?:"+e.map(Mr).join("|")+")","i")}function Fr(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}function Or(e,t,n){var i=Ar.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function Nr(e,t,n){var i=Ar.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function Tr(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function zr(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function Rr(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function Pr(e,t,n){var i=Ar.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function Lr(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Br(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function jr(e,t,n){var i=Ar.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function Ir(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function Ur(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function qr(e,t,n){var i=Ar.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function Wr(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function Hr(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function Gr(e,t,n){var i=Ar.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function Yr(e,t,n){var i=Ar.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function Vr(e,t,n){var i=Ar.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Xr(e,t,n){var i=$r.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function Jr(e,t,n){var i=Ar.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function Qr(e,t,n){var i=Ar.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function Zr(e,t){return Sr(e.getDate(),t,2)}function Kr(e,t){return Sr(e.getHours(),t,2)}function eo(e,t){return Sr(e.getHours()%12||12,t,2)}function to(e,t){return Sr(1+On.count(Qn(e),e),t,3)}function no(e,t){return Sr(e.getMilliseconds(),t,3)}function io(e,t){return no(e,t)+"000"}function ro(e,t){return Sr(e.getMonth()+1,t,2)}function oo(e,t){return Sr(e.getMinutes(),t,2)}function ao(e,t){return Sr(e.getSeconds(),t,2)}function so(e){var t=e.getDay();return 0===t?7:t}function lo(e,t){return Sr(Rn.count(Qn(e)-1,e),t,2)}function uo(e){var t=e.getDay();return t>=4||0===t?jn(e):jn.ceil(e)}function co(e,t){return e=uo(e),Sr(jn.count(Qn(e),e)+(4===Qn(e).getDay()),t,2)}function fo(e){return e.getDay()}function ho(e,t){return Sr(Pn.count(Qn(e)-1,e),t,2)}function po(e,t){return Sr(e.getFullYear()%100,t,2)}function mo(e,t){return Sr((e=uo(e)).getFullYear()%100,t,2)}function go(e,t){return Sr(e.getFullYear()%1e4,t,4)}function yo(e,t){var n=e.getDay();return Sr((e=n>=4||0===n?jn(e):jn.ceil(e)).getFullYear()%1e4,t,4)}function vo(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Sr(t/60|0,"0",2)+Sr(t%60,"0",2)}function bo(e,t){return Sr(e.getUTCDate(),t,2)}function xo(e,t){return Sr(e.getUTCHours(),t,2)}function _o(e,t){return Sr(e.getUTCHours()%12||12,t,2)}function wo(e,t){return Sr(1+Nn.count(Zn(e),e),t,3)}function ko(e,t){return Sr(e.getUTCMilliseconds(),t,3)}function Eo(e,t){return ko(e,t)+"000"}function Ao(e,t){return Sr(e.getUTCMonth()+1,t,2)}function $o(e,t){return Sr(e.getUTCMinutes(),t,2)}function Do(e,t){return Sr(e.getUTCSeconds(),t,2)}function So(e){var t=e.getUTCDay();return 0===t?7:t}function Mo(e,t){return Sr(Wn.count(Zn(e)-1,e),t,2)}function Co(e){var t=e.getUTCDay();return t>=4||0===t?Vn(e):Vn.ceil(e)}function Fo(e,t){return e=Co(e),Sr(Vn.count(Zn(e),e)+(4===Zn(e).getUTCDay()),t,2)}function Oo(e){return e.getUTCDay()}function No(e,t){return Sr(Hn.count(Zn(e)-1,e),t,2)}function To(e,t){return Sr(e.getUTCFullYear()%100,t,2)}function zo(e,t){return Sr((e=Co(e)).getUTCFullYear()%100,t,2)}function Ro(e,t){return Sr(e.getUTCFullYear()%1e4,t,4)}function Po(e,t){var n=e.getUTCDay();return Sr((e=n>=4||0===n?Vn(e):Vn.ceil(e)).getUTCFullYear()%1e4,t,4)}function Lo(){return"+0000"}function Bo(){return"%"}function jo(e){return+e}function Io(e){return Math.floor(+e/1e3)}function Uo(e){const t={};return n=>t[n]||(t[n]=e(n))}function qo(e){const t=Uo(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=sn(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let o=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const a=o<i.length?i.slice(o):"";for(;--o>r;)if("0"!==i[o]){++o;break}return i.slice(0,o)+a}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,o){o=sn(null==o?",f":o);const a=rn(e,i,r),s=Math.max(Math.abs(e),Math.abs(i));let l;if(null==o.precision)switch(o.type){case"s":return isNaN(l=fn(a,s))||(o.precision=l),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(l=dn(a,s))||(o.precision=l-("e"===o.type));break;case"f":case"%":isNaN(l=hn(a))||(o.precision=l-2*("%"===o.type))}return t(o)}}}let Wo,Ho;function Go(){return Wo=qo({format:vn,formatPrefix:bn})}function Yo(e){return qo(wn(e))}function Vo(e){return arguments.length?Wo=Yo(e):Wo}function Xo(e,t,n){we(n=n||{})||oe(`Invalid time multi-format specifier: ${n}`);const i=t(xi),r=t(bi),o=t(vi),a=t(mi),s=t(pi),l=t(hi),u=t(di),c=t(fi),f=e(n[_i]||".%L"),d=e(n[xi]||":%S"),h=e(n[bi]||"%I:%M"),p=e(n[vi]||"%I %p"),m=e(n[mi]||n[gi]||"%a %d"),g=e(n[pi]||"%b %d"),y=e(n[hi]||"%B"),v=e(n[di]||"%B"),b=e(n[fi]||"%Y");return e=>(i(e)<e?f:r(e)<e?d:o(e)<e?h:a(e)<e?p:l(e)<e?s(e)<e?m:g:c(e)<e?u(e)<e?y:v:b)(e)}function Jo(e){const t=Uo(e.format),n=Uo(e.utcFormat);return{timeFormat:e=>vt(e)?t(e):Xo(t,Qi,e),utcFormat:e=>vt(e)?n(e):Xo(n,Zi,e),timeParse:Uo(e.parse),utcParse:Uo(e.utcParse)}}function Qo(){return Ho=Jo({format:xr,parse:_r,utcFormat:wr,utcParse:kr})}function Zo(e){return Jo(vr(e))}function Ko(e){return arguments.length?Ho=Zo(e):Ho}br=vr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),xr=br.format,_r=br.parse,wr=br.utcFormat,kr=br.utcParse,Go(),Qo();const ea=(e,t)=>it({},e,t);function ta(e,t){const n=e?Yo(e):Vo(),i=t?Zo(t):Ko();return ea(n,i)}function na(e,t){const n=arguments.length;return n&&2!==n&&oe("defaultLocale expects either zero or two arguments."),n?ea(Vo(e),Ko(t)):ea(Vo(),Ko())}function ia(){return Go(),Qo(),na()}const ra=/^(data:|([A-Za-z]+:)?\/\/)/,oa=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,aa=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,sa="file://";async function la(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function ua(e,t){t=it({},this.options,t);const n=this.fileAccess,i={href:null};let r,o,a;const s=oa.test(e.replace(aa,""));null!=e&&"string"==typeof e&&s||oe("Sanitize failure, invalid URI: "+Dt(e));const l=ra.test(e);return(a=t.baseURL)&&!l&&(e.startsWith("/")||a.endsWith("/")||(e="/"+e),e=a+e),o=(r=e.startsWith(sa))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!o}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function ca(e){return e?t=>new Promise(((n,i)=>{e.readFile(t,((e,t)=>{e?i(e):n(t)}))})):fa}async function fa(){oe("No file system access.")}function da(e){return e?async function(t,n){const i=it({},this.options.http,n),r=n&&n.response,o=await e(t,i);return o.ok?Ve(o[r])?o[r]():o.text():oe(o.status+""+o.statusText)}:ha}async function ha(){oe("No HTTP fetch method available.")}const pa=e=>null!=e&&e==e,ma=e=>!(Number.isNaN(+e)||e instanceof Date),ga={boolean:St,integer:Se,number:Se,date:Ct,string:Ft,unknown:ue},ya=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>ma(e)&&Number.isInteger(+e),ma,e=>!Number.isNaN(Date.parse(e))],va=["boolean","integer","number","date"];function ba(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=ya.length,r=ya.map(((e,t)=>t+1));for(let o,a,s=0,l=0;s<n;++s)for(a=t?e[s][t]:e[s],o=0;o<i;++o)if(r[o]&&pa(a)&&!ya[o](a)&&(r[o]=0,++l,l===ya.length))return"string";return va[r.reduce(((e,t)=>0===e?t:e),0)-1]}function xa(e,t){return t.reduce(((t,n)=>(t[n]=ba(e,n),t)),{})}function _a(e){const t=function(t,n){const i={delimiter:e};return wa(t,n?it(n,i):i)};return t.responseType="text",t}function wa(e,t){return t.header&&(e=t.header.map(Dt).join(t.delimiter)+"\n"+e),qt(t.delimiter).parse(e+"")}function ka(e,t){const n=t&&t.property?se(t.property):ue;return!we(e)||(i=e,"function"==typeof Buffer&&Ve(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){return!_e(e)&&mt(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}wa.responseType="text",ka.responseType="json";const Ea={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function Aa(e,t){let n,i,r,o;return e=ka(e,t),t&&t.feature?(n=Ht,r=t.feature):t&&t.mesh?(n=Xt,r=t.mesh,o=Ea[t.filter]):oe("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,o):oe("Invalid TopoJSON object: "+r),i&&i.features||[i]}Aa.responseType="json";const $a={dsv:wa,csv:_a(","),tsv:_a("\t"),json:ka,topojson:Aa};function Da(e,t){return arguments.length>1?($a[e]=t,this):st($a,e)?$a[e]:null}function Sa(e){const t=Da(e);return t&&t.responseType||"text"}function Ma(e,t,n,i){const r=Da((t=t||{}).type||"json");return r||oe("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=Ko();n=n||r.timeParse,i=i||r.utcParse;let o,a,s,l,u,c,f=e.columns||Object.keys(e[0]);"auto"===t&&(t=xa(e,f)),f=Object.keys(t);const d=f.map((e=>{const r=t[e];let o,a;if(r&&(r.startsWith("date:")||r.startsWith("utc:")))return o=r.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?i:n)(a);if(!ga[r])throw Error("Illegal format pattern: "+e+":"+r);return ga[r]}));for(s=0,u=e.length,c=f.length;s<u;++s)for(o=e[s],l=0;l<c;++l)a=f[l],o[a]=d[l](o[a])}(e,t.parse,n,i),st(e,"columns")&&delete e.columns,e}const Ca=function(e,t){return t=>({options:t||{},sanitize:ua,load:la,fileAccess:!1,file:ca(null),http:da(e)})}("undefined"!=typeof fetch&&fetch);function Fa(e){const t=e||ue,n=[],i={};return n.add=e=>{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 Oa(e,t){try{await t(e)}catch(t){e.error(t)}}const Na=Symbol("vega_id");let Ta=1;function za(e){return!(!e||!Ra(e))}function Ra(e){return e[Na]}function Pa(e,t){return e[Na]=t,e}function La(e){const t=e===Object(e)?e:{data:e};return Ra(t)?t:Pa(t,Ta++)}function Ba(e){return ja(e,La({}))}function ja(e,t){for(const n in e)t[n]=e[n];return t}function Ia(e,t){return Pa(t,Ra(e))}function Ua(e,t){return e?t?(n,i)=>e(n,i)||Ra(t(n))-Ra(t(i)):(t,n)=>e(t,n)||Ra(t)-Ra(n):null}function qa(e){return e&&e.constructor===Wa}function Wa(){const e=[],t=[],n=[],i=[],r=[];let o=null,a=!1;return{constructor:Wa,insert(t){const n=Ge(t),i=n.length;for(let t=0;t<i;++t)e.push(n[t]);return this},remove(e){const n=Ve(e)?i:t,r=Ge(e),o=r.length;for(let e=0;e<o;++e)n.push(r[e]);return this},modify(e,t,i){const o={field:t,value:tt(i)};return Ve(e)?(o.filter=e,r.push(o)):(o.tuple=e,n.push(o)),this},encode(e,t){return Ve(e)?r.push({filter:e,field:t}):n.push({tuple:e,field:t}),this},clean(e){return o=e,this},reflow(){return a=!0,this},pulse(s,l){const u={},c={};let f,d,h,p,m,g;for(f=0,d=l.length;f<d;++f)u[Ra(l[f])]=1;for(f=0,d=t.length;f<d;++f)m=t[f],u[Ra(m)]=-1;for(f=0,d=i.length;f<d;++f)p=i[f],l.forEach((e=>{p(e)&&(u[Ra(e)]=-1)}));for(f=0,d=e.length;f<d;++f)m=e[f],g=Ra(m),u[g]?u[g]=1:s.add.push(La(e[f]));for(f=0,d=l.length;f<d;++f)m=l[f],u[Ra(m)]<0&&s.rem.push(m);function y(e,t,n){n?e[t]=n(e):s.encode=t,a||(c[Ra(e)]=e)}for(f=0,d=n.length;f<d;++f)h=n[f],m=h.tuple,p=h.field,g=u[Ra(m)],g>0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=r.length;f<d;++f)h=r[f],p=h.filter,l.forEach((e=>{p(e)&&u[Ra(e)]>0&&y(e,h.field,h.value)})),s.modifies(h.field);if(a)s.mod=t.length||i.length?l.filter((e=>u[Ra(e)]>0)):l.slice();else for(g in c)s.mod.push(c[g]);return(o||null==o&&(t.length||i.length))&&s.clean(!0),s}}}const Ha="_:mod:_";function Ga(){Object.defineProperty(this,Ha,{writable:!0,value:{}})}Ga.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[Ha];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]=_e(n)?1+n.length:-1),r},modified(e,t){const n=this[Ha];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(_e(e)){for(let t=0;t<e.length;++t)if(n[e[t]])return!0;return!1}return null!=t&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[Ha]={},this}};let Ya=0;const Va=new Ga;function Xa(e,t,n,i){this.id=++Ya,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,i)}function Ja(e){return function(t){const n=this.flags;return 0===arguments.length?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Xa.prototype={targets(){return this._targets||(this._targets=Fa(le))},set(e){return this.value!==e?(this.value=e,1):0},skip:Ja(1),modified:Ja(2),parameters(e,t,n){t=!1!==t;const i=this._argval=this._argval||new Ga,r=this._argops=this._argops||[],o=[];let a,s,l,u;const c=(e,n,a)=>{a instanceof Xa?(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)Ge(s).forEach((e=>{e instanceof Xa?e!==this&&(e.targets().add(this),o.push(e)):oe("Pulse parameters must be operator instances.")})),this.source=s;else if(_e(s))for(i.set(a,-1,Array(l=s.length)),u=0;u<l;++u)c(a,u,s[u]);else c(a,-1,s);return this.marshall().clear(),n&&(r.initonly=!0),o},marshall(e){const t=this._argval||Va,n=this._argops;let i,r,o,a;if(n){const s=n.length;for(r=0;r<s;++r)i=n[r],o=i.op,a=o.modified()&&o.stamp===e,t.set(i.name,i.index,o.value,a);if(n.initonly){for(r=0;r<s;++r)i=n[r],i.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,n,i,r;if(e)for(t=0,n=e.length;t<n;++t)i=e[t],r=i.op,r._targets&&r._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const n=this.marshall(e.stamp),i=t.call(this,n,e);if(n.clear(),i!==this.value)this.value=i;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};let Qa=0;function Za(e,t,n){this.id=++Qa,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Ka(e,t,n){return new Za(e,t,n)}Za.prototype={_filter:de,_apply:ue,targets(){return this._targets||(this._targets=Fa(le))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),n=this._targets,i=n?n.length:0;for(let e=0;e<i;++e)n[e].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Ka(e);return this.targets().add(t),t},apply(e){const t=Ka(null,e);return this.targets().add(t),t},merge(){const e=Ka();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter((()=>{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=Ka();return this.targets().add(Ka(null,null,nt(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(Ka(null,null,(()=>n=!0))),t.targets().add(Ka(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=de,this._targets=null}};const es={skip:!0};function ts(e,t,n,i,r,o){const a=it({},o,es);let s,l;Ve(n)||(n=tt(n)),void 0===i?s=t=>e.touch(n(t)):Ve(i)?(l=new Xa(null,i,r,!1),s=t=>{l.evaluate(t);const i=n(t),r=l.value;qa(r)?e.pulse(i,r,o):e.update(i,r,a)}):s=t=>e.update(n(t),i,a),t.apply(s)}function ns(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const a=o||{},s=new Xa(null,function(e,t){return t=Ve(t)?t:tt(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);s.modified(a.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}const is={};function rs(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 os(e,t){const n=[];return Tt(e,t,(e=>n.push(e))),n}function as(e,t){const n={};return e.visit(t,(e=>{n[Ra(e)]=1})),e=>n[Ra(e)]?null:e}function ss(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function ls(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 e of n)if(e.stamp===t){if(e.fields){const t=r.fields||(r.fields={});for(const n in e.fields)t[n]=1}e.changed(r.ADD)&&(o|=r.ADD),e.changed(r.REM)&&(o|=r.REM),e.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function us(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}rs.prototype={StopPropagation:is,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 rs(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 rs(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,as(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return _e(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?_e(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=ss(n.addF,t)),2&e&&(n.remF=ss(n.remF,t)),4&e&&(n.modF=ss(n.modF,t)),16&e&&(n.srcF=ss(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=os(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=os(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=os(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 Tt(n.source,n.srcF,i),n;1&e&&Tt(n.add,n.addF,i),2&e&&Tt(n.rem,n.remF,i),4&e&&Tt(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||Tt(r,e?as(n,5):n.srcF,i)}return n}},ft(ls,rs,{fork(e){const t=new rs(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?_e(e)?e.some((e=>n[e])):n[e]:0},filter(){oe("MultiPulse does not support filtering.")},materialize(){oe("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(;o<r;++o)i[o].visit(e,t);else for(;o<r;++o)i[o].stamp===n.stamp&&i[o].visit(e,t);return n}});const cs={skip:!1,force:!1};function fs(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 ds(){this.logger(xe()),this.logLevel(ge),this._clock=0,this._rank=0,this._locale=na();try{this._loader=Ca()}catch(e){}this._touched=Fa(le),this._input={},this._pulse=null,this._heap=function(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),fs(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<r;)a=s+1,a<r&&n(e[s],e[a])>=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,fs(e,i,t,n)}(t,0,e)):i=n,i}}}(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function hs(e){return function(){return this._log[e].apply(this,arguments)}}function ps(e,t){Xa.call(this,e,null,t)}ds.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:hs("error"),warn:hs("warn"),info:hs("info"),debug:hs("debug"),logLevel:hs("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof Xa?r=e:e&&e.prototype instanceof Xa?r=new e:Ve(e)?r=new Xa(null,e):(o=0,r=new Xa(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<i;++r)if(n<t[r].rank)return void this.rerank(e)},rank:function(e){e.rank=++this._rank},rerank:function(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&oe("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||cs);const i=new rs(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||cs;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||cs;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:Wa,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 Ma(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(de).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:Sa(t&&t.type)});try{i=n.parse(i,t)}catch(t){r=-2,n.warn("Data ingestion failed",e,t)}}catch(t){r=-1,n.warn("Loading failed",e,t)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,o=Ka(n,i),a=function(e){e.dataflow=r;try{o.receive(e)}catch(e){r.error(e)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):Ge(e);const l=s.length;for(let e=0;e<l;++e)s[e].addEventListener(t,a);return o},on:function(e,t,n,i,r){return(e instanceof Xa?ns:ts)(this,e,t,n,i,r),this},evaluate:async function(e,t,n){const i=this,r=[];if(i._pulse)return us(i);if(i._pending&&await i._pending,t&&await Oa(i,t),!i._touched.length)return i.debug("Dataflow invoked, but nothing to do."),i;const o=++i._clock;i._pulse=new rs(i,o,e),i._touched.forEach((e=>i._enqueue(e,!0))),i._touched=Fa(le);let a,s,l,u=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=is),s!==is&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++u):i._enqueue(a,!0)}catch(e){i._heap.clear(),l=e}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${u} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;t<e.length;++t)await Oa(i,e[t].callback)}return n&&await Oa(i,n),r.length&&Promise.all(r).then((e=>i.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(e){i.error(e)}}))})))),i},run:function(e,t,n){return this._pulse?us(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(e){this.error(e)}},_enqueue:function(e,t){const n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))},_getPulse:function(e,t){const n=e.source,i=this._clock;return n&&_e(n)?new ls(this,i,n.map((e=>e.pulse)),t):this._input[e.id]||function(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==is&&(e.source=t.source),e)}(this._pulse,n&&n.pulse)}},ft(ps,Xa,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then((e=>this.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 ms={};function gs(e){const t=ys(e);return t&&t.Definition||null}function ys(e){return e=e&&e.toLowerCase(),st(ms,e)?ms[e]:null}function vs(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}function bs(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function xs(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:e>t?1:0)}function _s(e,t,n=0,i=1/0,r){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(e.length-1,i)),!(n<=t&&t<=i))return e;for(r=void 0===r?xs:function(e=si){if(e===si)return xs;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||0===i?i:(0===e(n,n))-(0===e(t,t))}}(r);i>n;){if(i-n>600){const o=i-n+1,a=t-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);_s(e,t,Math.max(n,Math.floor(t-a*l/o+u)),Math.min(i,Math.floor(t+(o-a)*l/o+u)),r)}const o=e[t];let a=n,s=i;for(ws(e,n,t),r(e[i],o)>0&&ws(e,n,i);a<s;){for(ws(e,a,s),++a,--s;r(e[a],o)<0;)++a;for(;r(e[s],o)>0;)--s}0===r(e[n],o)?ws(e,n,s):(++s,ws(e,s,i)),s<=t&&(n=s+1),t<=s&&(i=s-1)}return e}function ws(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function ks(e){return null===e?NaN:+e}function Es(e,t,n){if(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(i=+i)>=i&&(yield i)}}(e,n)),(i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return bs(e);if(t>=1)return vs(e);var i,r=(i-1)*t,o=Math.floor(r),a=vs(_s(e,o).subarray(0,o+1));return a+(bs(e.subarray(o+1))-a)*(r-o)}}function As(e,t,n=ks){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 $s(e,t){return Es(e,.5,t)}function*Ds(e,t){if(null==t)for(let t of e)null!=t&&""!==t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function Ss(e,t,n){const i=Float64Array.from(Ds(e,n));return i.sort(si),t.map((e=>As(i,e)))}function Ms(e,t){return Ss(e,[.25,.5,.75],t)}function Cs(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 t of e)null!=t&&(t=+t)>=t&&(n=t-r,r+=n/++i,o+=n*(t-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=Ms(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 Fs(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,l,u,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(l=h/t,u=0,c=e.steps.length;u<c&&e.steps[u]<l;++u);o=e.steps[Math.max(0,u-1)]}else{for(a=Math.ceil(Math.log(t)/i),s=e.minstep||0,o=Math.max(s,Math.pow(n,Math.round(Math.log(h)/i)-a));Math.ceil(h/o)>t;)o*=n;for(u=0,c=r.length;u<c;++u)l=o/r[u],l>=s&&h/l<=t&&(o=l)}l=Math.log(o);const p=l>=0?0:1+~~(-l/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(l=Math.floor(f/o+m)*o,f=f<l?l-o:l,d=Math.ceil(d/o)*o),{start:f,stop:d===f?f+o:d,step:o}}var Os=Math.random;function Ns(e){Os=e}function Ts(e,t,n,i){if(!e.length)return[void 0,void 0];const r=Float64Array.from(Ds(e,i)),o=r.length,a=t;let s,l,u,c;for(u=0,c=Array(a);u<a;++u){for(s=0,l=0;l<o;++l)s+=r[~~(Os()*o)];c[u]=s/o}return c.sort(si),[Es(c,n/2),Es(c,1-n/2)]}function zs(e,t,n,i){i=i||(e=>e);const r=e.length,o=new Float64Array(r);let a,s=0,l=1,u=i(e[0]),c=u,f=u+t;for(;l<r;++l){if(a=i(e[l]),a>=f){for(c=(u+c)/2;s<l;++s)o[s]=c;f=a+t,u=a}c=a}for(c=(u+c)/2;s<l;++s)o[s]=c;return n?function(e,t){const n=e.length;let i,r,o=0,a=1;for(;e[o]===e[a];)++a;for(;a<n;){for(i=a+1;e[a]===e[i];)++i;if(e[a]-e[a-1]<t){for(r=a+(o+i-a-a>>1);r<a;)e[r++]=e[a];for(;r>a;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}function Rs(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function Ps(e,t){let n,i,r;null==t&&(t=e,e=0);const o={min(e){return arguments.length?(n=e||0,r=i-n,o):n},max(e){return arguments.length?(i=e||0,r=i-n,o):i},sample:()=>n+Math.floor(r*Os()),pdf:e=>e===Math.floor(e)&&e>=n&&e<i?1/r:0,cdf(e){const t=Math.floor(e);return t<n?0:t>=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)}const Ls=Math.sqrt(2*Math.PI),Bs=Math.SQRT2;let js=NaN;function Is(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(js==js)r=js,js=NaN;else{do{r=2*Os()-1,o=2*Os()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,js=o*i}return e+r*t}function Us(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*Ls)}function qs(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 Ws(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*Bs*function(e){let t,n=-Math.log((1-e)*(1+e));return 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,t*e}(2*e-1)}function Hs(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:()=>Is(n,i),pdf:e=>Us(e,n,i),cdf:e=>qs(e,n,i),icdf:e=>Ws(e,n,i)};return r.mean(e).stdev(t)}function Gs(e,t){const n=Hs();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=Cs(e)),r):t},sample:()=>e[~~(Os()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;a<i;++a)o+=n.pdf((r-e[a])/t);return o/t/i},cdf(r){let o=0,a=0;for(;a<i;++a)o+=n.cdf((r-e[a])/t);return o/i},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function Ys(e,t){return e=e||0,t=null==t?1:t,Math.exp(e+Is()*t)}function Vs(e,t,n){if(e<=0)return 0;t=t||0,n=null==n?1:n;const i=(Math.log(e)-t)/n;return Math.exp(-.5*i*i)/(n*Ls*e)}function Xs(e,t,n){return qs(Math.log(e),t,n)}function Js(e,t,n){return Math.exp(Ws(e,t,n))}function Qs(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:()=>Ys(n,i),pdf:e=>Vs(e,n,i),cdf:e=>Xs(e,n,i),icdf:e=>Js(e,n,i)};return r.mean(e).stdev(t)}function Zs(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<i;++n)r+=t[n]=null==e[n]?1:+e[n];for(n=0;n<i;++n)t[n]/=r;return t}(t=e||[]),r):t},distributions(n){return arguments.length?(n?(i=n.length,e=n):(i=0,e=[]),r.weights(t)):e},sample(){const t=Os();let r=e[i-1],o=n[0],a=0;for(;a<i-1;o+=n[++a])if(t<o){r=e[a];break}return r.sample()},pdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].pdf(t);return r},cdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].cdf(t);return r},icdf(){throw Error("Mixture icdf not supported.")}};return r.distributions(e).weights(t)}function Ks(e,t){return null==t&&(t=null==e?1:e,e=0),e+(t-e)*Os()}function el(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=t&&e<=n?1/(n-t):0}function tl(e,t,n){return null==n&&(n=null==t?1:t,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function nl(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function il(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:()=>Ks(n,i),pdf:e=>el(e,n,i),cdf:e=>tl(e,n,i),icdf:e=>nl(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function rl(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 ol(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 al(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,l,u,c=0,f=0,d=0;for(u of e)o[c]=s=+t(u),a[c]=l=+n(u),++c,f+=(s-f)/c,d+=(l-d)/c;for(c=0;c<r;++c)o[c]-=f,a[c]-=d;return[o,a,f,d]}function sl(e,t,n,i){let r,o,a=-1;for(const s of e)r=t(s),o=n(s),null!=r&&(r=+r)>=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function ll(e,t,n,i,r){let o=0,a=0;return sl(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function ul(e,t,n){let i=0,r=0,o=0,a=0,s=0;sl(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 l=ol(i,r,o,a),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:ll(e,t,n,r,u)}}function cl(e,t,n){let i=0,r=0,o=0,a=0,s=0;sl(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 l=ol(i,r,o,a),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:ll(e,t,n,r,u)}}function fl(e,t,n){const[i,r,o,a]=al(e,t,n);let s,l,u,c=0,f=0,d=0,h=0,p=0;sl(e,t,n,((e,t)=>{s=i[p++],l=Math.log(t),u=s*t,c+=(t*l-c)/p,f+=(u-f)/p,d+=(u*l-d)/p,h+=(s*u-h)/p}));const[m,g]=ol(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:ll(e,t,n,a,y)}}function dl(e,t,n){let i=0,r=0,o=0,a=0,s=0,l=0;sl(e,t,n,((e,t)=>{const n=Math.log(e),u=Math.log(t);++l,i+=(n-i)/l,r+=(u-r)/l,o+=(n*u-o)/l,a+=(n*n-a)/l,s+=(t-s)/l}));const u=ol(i,r,o,a),c=e=>u[0]*Math.pow(e,u[1]);return u[0]=Math.exp(u[0]),{coef:u,predict:c,rSquared:ll(e,t,n,s,c)}}function hl(e,t,n){const[i,r,o,a]=al(e,t,n),s=i.length;let l,u,c,f,d=0,h=0,p=0,m=0,g=0;for(l=0;l<s;)u=i[l],c=r[l++],f=u*u,d+=(f-d)/l,h+=(f*u-h)/l,p+=(f*f-p)/l,m+=(u*c-m)/l,g+=(f*c-g)/l;const y=p-d*d,v=d*y-h*h,b=(g*d-m*h)/v,x=(m*y-g*h)/v,_=-b*d,w=e=>b*(e-=o)*e+x*e+_+a;return{coef:[_-x*o+b*o*o+a,x-2*b*o,b],predict:w,rSquared:ll(e,t,n,a,w)}}function pl(e,t,n,i){if(0===i)return rl(e,t,n);if(1===i)return ul(e,t,n);if(2===i)return hl(e,t,n);const[r,o,a,s]=al(e,t,n),l=r.length,u=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;d<f;++d){for(p=0,m=0;p<l;++p)m+=Math.pow(r[p],d)*o[p];for(u.push(m),g=new Float64Array(f),h=0;h<f;++h){for(p=0,m=0;p<l;++p)m+=Math.pow(r[p],d+h);g[h]=m}c.push(g)}c.push(u);const y=function(e){const t=e.length-1,n=[];let i,r,o,a,s;for(i=0;i<t;++i){for(a=i,r=i+1;r<t;++r)Math.abs(e[i][r])>Math.abs(e[i][a])&&(a=r);for(o=i;o<t+1;++o)s=e[o][i],e[o][i]=e[o][a],e[o][a]=s;for(r=i+1;r<t;++r)for(o=t;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<t;++o)s+=e[o][r]*n[o];n[r]=(e[t][r]-s)/e[r][r]}return n}(c),v=e=>{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d<f;++d)t+=y[d]*Math.pow(e,d);return t};return{coef:ml(f,y,-a,s),predict:v,rSquared:ll(e,t,n,s,v)}}function ml(e,t,n,i){const r=Array(e);let o,a,s,l;for(o=0;o<e;++o)r[o]=0;for(o=e-1;o>=0;--o)for(s=t[o],l=1,r[o]+=s,a=1;a<=o;++a)l*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*l;return r[0]+=i,r}const gl=2,yl=1e-12;function vl(e,t,n,i){const[r,o,a,s]=al(e,t,n,!0),l=r.length,u=Math.max(2,~~(i*l)),c=new Float64Array(l),f=new Float64Array(l),d=new Float64Array(l).fill(1);for(let e=-1;++e<=gl;){const t=[0,u-1];for(let e=0;e<l;++e){const n=r[e],i=t[0],a=t[1],s=n-r[i]>r[a]-n?i:a;let l=0,u=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-n||1);for(let e=i;e<=a;++e){const t=r[e],i=o[e],a=bl(Math.abs(n-t)*g)*d[e],s=t*a;l+=a,u+=s,h+=i*a,p+=i*s,m+=t*s}const[y,v]=ol(u/l,h/l,p/l,m/l);c[e]=y+v*n,f[e]=Math.abs(o[e]-c[e]),xl(r,e+1,t)}if(e===gl)break;const n=$s(f);if(Math.abs(n)<yl)break;for(let e,t,i=0;i<l;++i)e=f[i]/(6*n),d[i]=e>=1?yl:(t=1-e*e)*t}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,l=0,u=[];for(;s<r;++s)a=e[s]+n,u[0]===a?u[1]+=(t[s]-u[1])/++l:(l=0,u[1]+=i,u=[a,t[s]],o.push(u));return u[1]+=i,o}(r,c,a,s)}function bl(e){return(e=1-e*e*e)*e*e}function xl(e,t,n){const i=e[t];let r=n[0],o=n[1]+1;if(!(o>=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const _l=.5*Math.PI/180;function wl(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,l=s/i,u=[r(o)],c=[];if(n===i){for(let e=1;e<i;++e)u.push(r(o+e/n*s));return u.push(r(a)),u}c.push(r(a));for(let e=n;--e>0;)c.push(r(o+e/n*s));let f=u[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 e=0;e<r;++e){const r=t[e][1];r<n&&(n=r),r>i&&(i=r)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=l&&kl(f,e,d,h,p)>_l?c.push(e):(f=d,u.push(d),c.pop()),d=c[c.length-1]}return u}function kl(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 El(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(r);++i<r;)o[i]=e+i*n;return o}function Al(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<n;++i)r+="|"+t[i](e);return r}):function(){return""};var t}function $l(e,t,n){return n||e+(t?"_"+t:"")}const Dl=()=>{},Sl={init:Dl,add:Dl,rem:Dl,idx:0},Ml={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.sum,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<e.min||void 0===e.min)&&(e.min=t)},rem:(e,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<e.min&&(e.argmin=n)},rem:(e,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}},Cl=Object.keys(Ml).filter((e=>"__count__"!==e));function Fl(e,t){return Ml[e](t)}function Ol(e,t){return e.idx-t.idx}function Nl(){this.valid=0,this.missing=0,this._ops.forEach((e=>e.init(this)))}function Tl(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function zl(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function Rl(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function Pl(e,t){const n=t||ue,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]=Ml[e]())}))};return e.forEach(n),Object.values(t).sort(Ol)}(e),r=e.slice().sort(Ol);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=Nl,o.prototype.add=Tl,o.prototype.rem=zl,o.prototype.set=Rl,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function Ll(e){this._key=e?se(e):Ra,this.reset()}[...Cl,"__count__"].forEach((e=>{Ml[e]=function(e,t){return n=>it({name:e,out:n||e},Sl,t)}(e,Ml[e])}));const Bl=Ll.prototype;function jl(e){ps.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}function Il(e){ps.call(this,null,e)}function Ul(e,t,n){const i=e;let r=t||[],o=n||[],a={},s=0;return{add:e=>o.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?kt(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function ql(e){ps.call(this,[],e)}function Wl(e){Xa.call(this,null,Hl,e)}function Hl(e){return this.value&&!e.modified()?this.value:Je(e.fields,e.orders)}function Gl(e){ps.call(this,null,e)}function Yl(e){ps.call(this,null,e)}Bl.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Bl.add=function(e){this._add.push(e)},Bl.rem=function(e){this._rem.push(e)},Bl.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,l,u;for(s=0;s<r;++s)a[n(t[s])]=1;for(s=0,l=0;s<i;++s)a[n(u=e[s])]?a[n(u)]=0:o[l++]=u;return this._rem=[],this._add=o},Bl.distinct=function(e){const t=this.values(),n={};let i,r=t.length,o=0;for(;--r>=0;)i=e(t[r])+"",st(n,i)||(n[i]=1,++o);return o},Bl.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=ot(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Bl.argmin=function(e){return this.extent(e)[0]||{}},Bl.argmax=function(e){return this.extent(e)[1]||{}},Bl.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},Bl.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},Bl.quartile=function(e){return this._get===e&&this._q||(this._q=Ms(this.values(),e),this._get=e),this._q},Bl.q1=function(e){return this.quartile(e)[0]},Bl.q2=function(e){return this.quartile(e)[1]},Bl.q3=function(e){return this.quartile(e)[2]},Bl.ci=function(e){return this._get===e&&this._ci||(this._ci=Ts(this.values(),1e3,.05,e),this._get=e),this._ci},Bl.ci0=function(e){return this.ci(e)[0]},Bl.ci1=function(e){return this.ci(e)[1]},jl.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Cl},{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"}]},ft(jl,ps,{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<r;++o)i[o][s=a[n[o]]]=s}o(e._prev),o(t),function o(a,s,l){const u=n[l],c=i[l++];for(const n in c){const i=a?a+"|"+n:n;s[u]=c[n],l<r?o(i,s,l):t[i]||e.cell(i,s)}}("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],i={};function r(e){const n=Ge(te(e)),r=n.length;let o,a=0;for(;a<r;++a)i[o=n[a]]||(i[o]=1,t.push(o))}this._dims=Ge(e.groupby),this._dnames=this._dims.map((e=>{const t=ee(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:Al(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],a=e.ops||["count"],s=e.as||[],l=o.length,u={};let c,f,d,h,p,m;for(l!==a.length&&oe("Unmatched number of fields and aggregate ops."),m=0;m<l;++m)c=o[m],f=a[m],null==c&&"count"!==f&&oe("Null aggregate field specified."),h=ee(c),p=$l(f,h,s[m]),n.push(p),"count"!==f?(d=u[h],d||(r(c),d=u[h]=[],d.field=c,this._measures.push(d)),"count"!==f&&(this._countOnly=!1),d.push(Fl(f,p))):this._counts.push(p);return this._measures=this._measures.map((e=>Pl(e,e.field))),Object.create(null)},cellkey:Al(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){const n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const e=this._measures,t=e.length;n.agg=Array(t);for(let i=0;i<t;++i)n.agg[i]=new e[i](n)}return n.store&&(n.data=new Ll),n},newtuple(e,t){const n=this._dnames,i=this._dims,r=i.length,o={};for(let t=0;t<r;++t)o[n[t]]=i[t](e);return t?Ia(t.tuple,o):La(o)},clean(){const e=this.value;for(const t in e)0===e[t].num&&delete e[t]},add(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);const i=n.agg;for(let t=0,n=i.length;t<n;++t)i[t].add(i[t].get(e),e)},rem(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);const i=n.agg;for(let t=0,n=i.length;t<n;++t)i[t].rem(i[t].get(e),e)},celltuple(e){const t=e.tuple,n=this._counts;e.store&&e.data.values();for(let i=0,r=n.length;i<r;++i)t[n[i]]=e.num;if(!this._countOnly){const n=e.agg;for(let e=0,i=n.length;e<i;++e)n[e].set(t)}return t},changes(e){const t=this._adds,n=this._mods,i=this._prev,r=this._drop,o=e.add,a=e.rem,s=e.mod;let l,u,c,f;if(i)for(u in i)l=i[u],r&&!l.num||a.push(l.tuple);for(c=0,f=this._alen;c<f;++c)o.push(this.celltuple(t[c])),t[c]=null;for(c=0,f=this._mlen;c<f;++c)l=n[c],(0===l.num&&r?a:s).push(this.celltuple(l)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}}),Il.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"]}]},ft(Il,ps,{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],l=a[1];let u;return u=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(te(e.field))?t.ADD_MOD:t.ADD,t.visit(u,n?e=>{const t=i(e);e[s]=t,e[l]=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=Fs(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 l=function(e){let n=Se(t(e));return null==n?null:n<a?-1/0:n>s?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return l.start=a,l.stop=n.stop,l.step=i,this.value=K(l,te(t),e.name||"bin_"+ee(t))}}),ql.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ft(ql,ps,{transform(e,t){const n=t.fork(t.ALL),i=Ul(Ra,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(Ua(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),ft(Wl,Xa),Gl.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"]}]},ft(Gl,ps,{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)||[],l=0,u=r.length;l<u;++l)a.test(i=r[l])||t(i)},i=this._parameterCheck(e,t),r=this._counts,o=this._match,a=this._stop,s=e.field,l=e.as||["text","count"],u=n((e=>r[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,u):(t.visit(t.ADD,u),t.visit(t.REM,c)),this._finish(t,l)},_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,l,u;for(s in n)l=i[s],u=n[s]||0,!l&&u?(i[s]=l=La({}),l[r]=s,l[o]=u,a.add.push(l)):0===u?(l&&a.rem.push(l),n[s]=null,i[s]=null):l[o]!==u&&(l[o]=u,a.mod.push(l));return a.modifies(t)}}),Yl.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ft(Yl,ps,{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={},l=e.length,u=0;u<l;++u)for(s[t]=o=e[u],r=0;r<l;++r)s[n]=e[r],i(s)&&(a.push(La(s)),(s={})[t]=o);return a}(s,r,o,e.filter||de)):n.mod=s,n.source=this.value,n.modifies(i)}});const Vl={kde:Gs,mixture:Zs,normal:Hs,lognormal:Qs,uniform:il},Xl="function";function Jl(e,t){const n=e[Xl];st(Vl,n)||oe("Unknown distribution function: "+n);const i=Vl[n]();for(const n in e)"field"===n?i.data((e.from||t()).map(e[n])):"distributions"===n?i[n](e[n].map((e=>Jl(e,t)))):typeof i[n]===Xl&&i[n](e[n]);return i}function Ql(e){ps.call(this,null,e)}const Zl=[{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}]}],Kl={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Zl},{name:"weights",type:"number",array:!0}]};function eu(e,t){return e?e.map(((e,n)=>t[n]||ee(e))):null}function tu(e,t,n){const i=[],r=e=>e(l);let o,a,s,l,u,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;a<s;++a)l=e[a],u=t.map(r),c=o[u],c||(o[u]=c=[],c.dims=u,i.push(c)),c.push(n(l));return i}function nu(e){ps.call(this,null,e)}function iu(e){Xa.call(this,null,ru,e),this.modified(!0)}function ru(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:K((n=>t(n,e)),te(t),ee(t))}function ou(e){ps.call(this,[void 0,void 0],e)}function au(e,t){Xa.call(this,e),this.parent=t,this.count=0}function su(e){ps.call(this,{},e),this._keys=ut();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;n<i;++n)e(t[n],n,t)}}function lu(e){Xa.call(this,null,uu,e)}function uu(e){return this.value&&!e.modified()?this.value:_e(e.name)?Ge(e.name).map((e=>se(e))):se(e.name,e.as)}function cu(e){ps.call(this,ut(),e)}function fu(e){ps.call(this,[],e)}function du(e){ps.call(this,[],e)}function hu(e){ps.call(this,null,e)}function pu(e){ps.call(this,[],e)}Ql.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:Zl.concat(Kl)},{name:"as",type:"string",array:!0,default:["value","density"]}]},ft(Ql,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=Jl(e.distribution,function(e){return()=>e.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&&oe("Invalid density method: "+a),e.extent||i.data||oe("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],l=wl(a,e.extent||rt(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],La(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),nu.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"}]},ft(nu,ps,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=tu(t.source,e.groupby,ue),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>$t(rt(e,t))/30)(n,o),s=Ua(((e,t)=>o(e)-o(t))),l=e.as||"bin",u=i.length;let c,f=1/0,d=-1/0,h=0;for(;h<u;++h){const e=i[h].sort(s);c=-1;for(const t of zs(e,a,r,o))t<f&&(f=t),t>d&&(d=t),e[++c][l]=t}return this.value={start:f,stop:d,step:a},t.reflow(!0).modifies(l)}}),ft(iu,Xa),ou.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ft(ou,ps,{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=Se(i(e));null!=t&&(t<o&&(o=t),t>a&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=ee(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),ft(au,Xa,{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}}),ft(su,ps,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=st(r,e)&&r[e];return s?s.value.stamp<n.stamp&&(s.init(n),this.activate(s)):(a=i||(a=this._group[e])&&a.tuple,o=n.dataflow,s=new au(n.fork(n.NO_SOURCE),this),o.add(s).connect(t(o,e,a)),r[e]=s,this.activate(s)),s},clean(){const e=this.value;let t=0;for(const n in e)if(0===e[n].count){const i=e[n].detachSubflow;i&&i(),delete e[n],++t}if(t){const e=this._targets.filter((e=>e&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;r<i;++r)t[r]=e[r];for(;r<n&&null!=t[r];++r)t[r]=null;t.active=i},transform(e,t){const n=t.dataflow,i=e.key,r=e.subflow,o=this._keys,a=e.modified("key"),s=e=>this.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=Ra(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(Ra(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=Ra(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(Ra(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=Ra(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}}),ft(lu,Xa),cu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ft(cu,ps,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,l=e.expr;let u=!0;function c(t){const n=Ra(t),r=l(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?u&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=Ra(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{l(t,e)?o.push(t):i.set(Ra(t),1)})),t.visit(t.MOD,c),e.modified()&&(u=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),fu.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}]},ft(fu,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=eu(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 l,u,c,f=0;for(;f<s;++f){for(u=Ba(e),l=0;l<a;++l)u[r[l]]=null==(c=t[l][f])?null:c;o&&(u[o]=f),n.add.push(u)}})),this.value=n.source=n.add,o&&n.modifies(o),n.modifies(r)}}),du.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},ft(du,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=i.map(ee),o=e.as||["key","value"],a=o[0],s=o[1],l=i.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{for(let t,o=0;o<l;++o)t=Ba(e),t[a]=r[o],t[s]=i[o](e),n.add.push(t)})),this.value=n.source=n.add,n.modifies(o)}}),hu.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},ft(hu,ps,{transform(e,t){const n=e.expr,i=e.as,r=e.modified(),o=e.initonly?t.ADD:r?t.SOURCE:t.modified(n.fields)||t.modified(i)?t.ADD_MOD:t.ADD;return r&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(i),t.visit(o,(t=>t[i]=n(t,e)))}}),ft(pu,ps,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,l=e.size-s.length;if(l>0){for(r=[];--l>=0;)r.push(a=La(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-l),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-l);return n.source=this.value=s,n}});const mu={value:"value",median:$s,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,i+=t);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:bs,max:vs},gu=[];function yu(e){ps.call(this,[],e)}function vu(e){jl.call(this,e)}function bu(e){ps.call(this,null,e)}function xu(e){Xa.call(this,null,_u,e)}function _u(e){return this.value&&!e.modified()?this.value:bt(e.fields,e.flat)}function wu(e){ps.call(this,[],e),this._pending=null}function ku(e,t,n){n.forEach(La);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 Eu(e){ps.call(this,{},e)}function Au(e){Xa.call(this,null,$u,e)}function $u(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;i<n;++i)r=t[i],r[0]<o&&(o=r[0]),r[1]>a&&(a=r[1]);return[o,a]}function Du(e){Xa.call(this,null,Su,e)}function Su(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function Mu(e){ps.call(this,null,e)}function Cu(e){jl.call(this,e)}function Fu(e){su.call(this,e)}function Ou(e){ps.call(this,null,e)}function Nu(e){ps.call(this,null,e)}function Tu(e){ps.call(this,null,e)}function zu(e){ps.call(this,null,e)}function Ru(e){ps.call(this,[],e),this.count=0}function Pu(e){ps.call(this,null,e)}function Lu(e){ps.call(this,null,e),this.modified(!0)}function Bu(e){ps.call(this,null,e)}yu.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}]},ft(yu,ps,{transform(e,t){var n,i,r,o,a,s,l,u,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||mu.value;if(null!=mu[n])return n===mu.value?(t=void 0!==e.value?e.value:0,()=>t):mu[n];oe("Unrecognized imputation method: "+n)}(e),p=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=ee(e.field),g=ee(e.key),y=(e.groupby||[]).map(ee),v=function(e,t,n,i){var r,o,a,s,l,u,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;s<c;++s)u=n(f=e[s]),l=m[u]||(m[u]=p.push(u)),(a=g[o=(r=t?t.map(d):gu)+""])||(a=g[o]=[],h.push(a),a.values=r),a[l-1]=f;return h.domain=p,h}(t.source,e.groupby,e.key,e.keyvals),b=[],x=this.value,_=v.domain.length;for(a=0,u=v.length;a<u;++a)for(r=(n=v[a]).values,i=NaN,l=0;l<_;++l)if(null==n[l]){for(o=v.domain[l],f={_impute:!0},s=0,c=r.length;s<c;++s)f[y[s]]=r[s];f[g]=o,f[m]=Number.isNaN(i)?i=h(n,p):i,b.push(La(f))}return b.length&&(d.add=d.materialize(d.ADD).add.concat(b)),x.length&&(d.rem=d.materialize(d.REM).rem.concat(x)),this.value=b,d}}),vu.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Cl},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},ft(vu,jl,{transform(e,t){const n=this,i=e.modified();let r;return n.value&&(i||t.modified(n._inputs,!0))?(r=n.value=i?n.init(e):{},t.visit(t.SOURCE,(e=>n.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=>{it(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<i;++n)this.celltuple(e[n]),e[n]=null;for(n=0,i=this._mlen;n<i;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}}),bu.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},ft(bu,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=tu(i,e.groupby,e.field),o=(e.groupby||[]).map(ee),a=e.bandwidth,s=e.cumulative?"cdf":"pdf",l=e.as||["value","density"],u=[];let c=e.extent,f=e.steps||e.minsteps||25,d=e.steps||e.maxsteps||200;"pdf"!==s&&"cdf"!==s&&oe("Invalid density method: "+s),"shared"===e.resolve&&(c||(c=rt(i,e.field)),f=d=e.steps||d),r.forEach((t=>{const n=Gs(t,a)[s],i=e.counts?t.length:1;wl(n,c||rt(t),f,d).forEach((e=>{const n={};for(let e=0;e<o.length;++e)n[o[e]]=t.dims[e];n[l[0]]=e[0],n[l[1]]=e[1]*i,u.push(La(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}}),ft(xu,Xa),ft(wu,ps,{transform(e,t){const n=t.dataflow;if(this._pending)return ku(this,t,this._pending);if(function(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}(e))return t.StopPropagation;if(e.values)return ku(this,t,n.parse(e.values,e.format));if(e.async){const t=n.request(e.url,e.format).then((e=>(this._pending=Ge(e.data),e=>e.touch(this))));return{async:t}}return n.request(e.url,e.format).then((e=>ku(this,t,Ge(e.data))))}}),Eu.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}]},ft(Eu,ps,{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 l,u,c,f=a?t.SOURCE:t.ADD,d=t,h=e.as;return r?(u=r.length,s>1&&!h&&oe('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*u&&oe('The "as" parameter has too few output field names.'),h=h||r.map(ee),l=function(e){for(var t,a,l=0,c=0;l<s;++l)if(null==(a=i.get(n[l](e))))for(t=0;t<u;++t,++c)e[h[c]]=o;else for(t=0;t<u;++t,++c)e[h[c]]=r[t](a)}):(h||oe("Missing output field names."),l=function(e){for(var t,r=0;r<s;++r)t=i.get(n[r](e)),e[h[r]]=null==t?o:t}),a?d=t.reflow(!0):(c=n.some((e=>t.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,l),d.modifies(h)}}),ft(Au,Xa),ft(Du,Xa),ft(Mu,ps,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),Cu.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:Cl,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},ft(Cu,jl,{_transform:jl.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=te(n).concat(te(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(Qe),t?r.slice(0,t):r}(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return K((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)}}),ft(Fu,su,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(Ra(e),n,t,e);return(e.modified("field")||i&&t.modified(te(i)))&&oe("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(La(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}}),Ou.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ft(Ou,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=eu(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r<o;++r)t[i[r]]=n[r](e);return t}(e,t,i,r):ja;let a;return this.value?a=this.value:(t=t.addAll(),a=this.value={}),t.visit(t.REM,(e=>{const t=Ra(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,La({}));a[Ra(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[Ra(e)]))})),n}}),ft(Nu,ps,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),Tu.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"]}]},ft(Tu,ps,{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=tu(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(ee),a=[],s=e.step||.01,l=e.probs||El(s/2,1-1e-14,s),u=l.length;return r.forEach((e=>{const t=Ss(e,l);for(let n=0;n<u;++n){const r={};for(let t=0;t<o.length;++t)r[o[t]]=e.dims[t];r[i[0]]=l[n],r[i[1]]=t[n],a.push(La(r))}})),this.value&&(n.rem=this.value),this.value=n.add=n.source=a,n}}),ft(zu,ps,{transform(e,t){let n,i;return this.value?i=this.value:(n=t=t.addAll(),i=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,(e=>{const t=Ra(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Ba(e);i[Ra(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[Ra(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),Ru.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ft(Ru,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[Ra(t)]=1,e)),{});let a=this.value,s=this.count,l=0;function u(e){let t,i;a.length<r?a.push(e):(i=~~((s+1)*Os()),i<a.length&&i>=l&&(t=a[i],o[Ra(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=Ra(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[Ra(e)]))),(t.rem.length||i)&&a.length<r&&t.source&&(l=s=a.length,t.visit(t.SOURCE,(e=>{o[Ra(e)]||u(e)})),l=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t<e;++t)o[Ra(a[t])]=-1,n.rem.push(a[t]);a=a.slice(e)}return t.mod.length&&t.visit(t.MOD,(e=>{o[Ra(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=a.filter((e=>!o[Ra(e)]))),this.count=s,this.value=n.source=a,n}}),Pu.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"}]},ft(Pu,ps,{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=El(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,La(t)})),n.add=t.add.concat(this.value),n}}),ft(Lu,ps,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const ju=["unit0","unit1"];function Iu(e){ps.call(this,ut(),e)}function Uu(e){ps.call(this,null,e)}Bu.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:wi,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:ju}]},ft(Bu,ps,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?Zi:Qi)(o.unit).offset,s=e.as||ju,l=s[0],u=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(te(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[l]=null,i&&(e[u]=null)):(e[l]=r=s=o(t),i&&(e[u]=s=a(r,c)),r<f&&(f=r),s>d&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:l)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:pr({extent:e.extent||rt(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=Ei(i),a=this.value||{},s=(n?Vi:Hi)(o,r);return s.unit=De(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),ft(Iu,ps,{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()}}),ft(Uu,ps,{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(Ua(e.sort)):t.source).map(e.field))}});const qu={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=qu.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(e<r){for(;r+1<n.length&&!i(n[r],n[r+1]);)++r;e=r}return(1+e)/n.length}}},ntile:function(e,t){(t=+t)>0||oe("ntile num must be greater than zero.");const n=qu.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 i<r.length?e(r[i]):null}}},first_value:function(e){return{next:t=>e(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||oe("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return i<n.i1?e(n.data[i]):null}}},prev_value:function(e){let t;return{init:()=>t=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;n<i;++n)if(null!=e(t[n]))return n;return-1}(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}},Wu=Object.keys(qu);function Hu(e){const t=Ge(e.ops),n=Ge(e.fields),i=Ge(e.params),r=Ge(e.as),o=this.outputs=[],a=this.windows=[],s={},l={},u=[],c=[];let f=!0;function d(e){Ge(te(e)).forEach((e=>s[e]=1))}d(e.sort),t.forEach(((e,t)=>{const s=n[t],h=ee(s),p=$l(e,h,r[t]);if(d(s),o.push(p),st(qu,e))a.push(function(e,t,n,i){const r=qu[e](t,n);return{init:r.init||ce,update:function(e,t){t[i]=r.next(e)}}}(e,n[t],i[t],p));else{if(null==s&&"count"!==e&&oe("Null aggregate field specified."),"count"===e)return void u.push(p);f=!1;let t=l[h];t||(t=l[h]=[],t.field=s,c.push(t)),t.push(Fl(e,p))}})),(u.length||c.length)&&(this.cell=function(e,t,n){e=e.map((e=>Pl(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;a<r;++a)o[a]=new e[a](i);if(i.store)var s=i.data=new Ll;return i.add=function(e){if(i.num+=1,!n){s&&s.add(e);for(let t=0;t<r;++t)o[t].add(o[t].get(e),e)}},i.rem=function(e){if(i.num-=1,!n){s&&s.rem(e);for(let t=0;t<r;++t)o[t].rem(o[t].get(e),e)}},i.set=function(e){let r,a;for(s&&s.values(),r=0,a=t.length;r<a;++r)e[t[r]]=i.num;if(!n)for(r=0,a=o.length;r<a;++r)o[r].set(e)},i.init=function(){i.num=0,s&&s.reset();for(let e=0;e<r;++e)o[e].init()},i}(c,u,f)),this.inputs=Object.keys(s)}const Gu=Hu.prototype;function Yu(e){ps.call(this,{},e),this._mlen=0,this._mods=[]}function Vu(e,t,n,i){const r=i.sort,o=r&&!i.ignorePeers,a=i.frame||[null,0],s=e.data(n),l=s.length,u=o?ui(r):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:s,compare:r||tt(-1)};t.init();for(let e=0;e<l;++e)Xu(c,a,e,l),o&&Ju(c,u),t.update(c,s[e])}function Xu(e,t,n,i){e.p0=e.i0,e.p1=e.i1,e.i0=null==t[0]?0:Math.max(0,n-Math.abs(t[0])),e.i1=null==t[1]?i:Math.min(i,n+Math.abs(t[1])+1),e.index=n}function Ju(e,t){const n=e.i0,i=e.i1-1,r=e.compare,o=e.data,a=o.length-1;n>0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),i<a&&!r(o[i],o[i+1])&&(e.i1=t.right(o,o[i]))}function Qu(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Zu(e){this._context=e}function Ku(){}function ec(e){this._context=e}function tc(e){this._context=e}function nc(e,t){this._basis=new Zu(e),this._beta=t}Gu.init=function(){this.windows.forEach((e=>e.init())),this.cell&&this.cell.init()},Gu.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;a<e.i0;++a)n.rem(r[a]);for(a=e.p1;a<e.i1;++a)n.add(r[a]);n.set(t)}for(a=0;a<o;++a)i[a].update(e,t)},Yu.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Wu.concat(Cl)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},ft(Yu,ps,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),i=Ua(e.sort),r=Al(e.groupby),o=e=>this.group(r(e));let a=this.state;a&&!n||(a=this.state=new Hu(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 t=0,n=this._mlen;t<n;++t)Vu(this._mods[t],a,i,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(a.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=Ul(Ra),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}}),Zu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qu(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qu(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},ec.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Qu(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},tc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:Qu(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},nc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var i,r=e[0],o=t[0],a=e[n]-r,s=t[n]-o,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+i*a),this._beta*t[l]+(1-this._beta)*(o+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const ic=function e(t){function n(e){return 1===t?new Zu(e):new nc(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function rc(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function oc(e,t){this._context=e,this._k=(1-t)/6}oc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:rc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const ac=function e(t){function n(e){return new oc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function sc(e,t){this._context=e,this._k=(1-t)/6}sc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const lc=function e(t){function n(e){return new sc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function uc(e,t){this._context=e,this._k=(1-t)/6}uc.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const cc=function e(t){function n(e){return new uc(e,t)}return n.tension=function(t){return e(+t)},n}(0),fc=Math.abs,dc=Math.atan2,hc=Math.cos,pc=Math.max,mc=Math.min,gc=Math.sin,yc=Math.sqrt,vc=1e-12,bc=Math.PI,xc=bc/2,_c=2*bc;function wc(e){return e>=1?xc:e<=-1?-xc:Math.asin(e)}function kc(e,t,n){var i=e._x1,r=e._y1,o=e._x2,a=e._y2;if(e._l01_a>vc){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,r=(r*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>vc){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*u+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*u+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,o,a,e._x2,e._y2)}function Ec(e,t){this._context=e,this._alpha=t}Ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Ac=function e(t){function n(e){return t?new Ec(e,t):new oc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function $c(e,t){this._context=e,this._alpha=t}$c.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Dc=function e(t){function n(e){return t?new $c(e,t):new uc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Sc(e,t){this._context=e,this._alpha=t}Sc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Mc=function e(t){function n(e){return t?new Sc(e,t):new sc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Cc(e){this._context=e}function Fc(e){return new Cc(e)}function Oc(e){this._context=e}function Nc(e){return e<0?-1:1}function Tc(e,t,n){var i=e._x1-e._x0,r=t-e._x1,o=(e._y1-e._y0)/(i||r<0&&-0),a=(n-e._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(Nc(o)+Nc(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function zc(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Rc(e,t,n){var i=e._x0,r=e._y0,o=e._x1,a=e._y1,s=(o-i)/3;e._context.bezierCurveTo(i+s,r+s*t,o-s,a-s*n,o,a)}function Pc(e){this._context=e}function Lc(e){this._context=new Bc(e)}function Bc(e){this._context=e}function jc(e){this._context=e}function Ic(e){var t,n,i=e.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t<i-1;++t)r[t]=1,o[t]=4,a[t]=4*e[t]+2*e[t+1];for(r[i-1]=2,o[i-1]=7,a[i-1]=8*e[i-1]+e[i],t=1;t<i;++t)n=r[t]/o[t-1],o[t]-=n,a[t]-=n*a[t-1];for(r[i-1]=a[i-1]/o[i-1],t=i-2;t>=0;--t)r[t]=(a[t]-r[t+1])/o[t];for(o[i-1]=(e[i]+r[i-1])/2,t=0;t<i-1;++t)o[t]=2*e[t+1]-r[t+1];return[r,o]}function Uc(e,t){this._context=e,this._t=t}function qc(e){return function(){return e}}Cc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},Oc.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},Pc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Rc(this,this._t0,zc(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Rc(this,zc(this,n=Tc(this,e,t)),n);break;default:Rc(this,this._t0,n=Tc(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Lc.prototype=Object.create(Pc.prototype)).point=function(e,t){Pc.prototype.point.call(this,t,e)},Bc.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,i,r,o){this._context.bezierCurveTo(t,e,i,n,o,r)}},jc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var i=Ic(e),r=Ic(t),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(i[0][o],r[0][o],i[1][o],r[1][o],e[a],t[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},Uc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};const Wc=Math.PI,Hc=2*Wc,Gc=1e-6,Yc=Hc-Gc;function Vc(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class Xc{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?Vc:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Vc;const n=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;t<i;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,i){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,t,n,i,r,o){this._append`C${+e},${+t},${+n},${+i},${this._x1=+r},${this._y1=+o}`}arcTo(e,t,n,i,r){if(e=+e,t=+t,n=+n,i=+i,(r=+r)<0)throw new Error(`negative radius: ${r}`);let o=this._x1,a=this._y1,s=n-e,l=i-t,u=o-e,c=a-t,f=u*u+c*c;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(f>Gc)if(Math.abs(c*s-l*u)>Gc&&r){let d=n-o,h=i-a,p=s*s+l*l,m=d*d+h*h,g=Math.sqrt(p),y=Math.sqrt(f),v=r*Math.tan((Wc-Math.acos((p+f-m)/(2*g*y)))/2),b=v/y,x=v/g;Math.abs(b-1)>Gc&&this._append`L${e+b*u},${t+b*c}`,this._append`A${r},${r},0,0,${+(c*d>u*h)},${this._x1=e+x*s},${this._y1=t+x*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,i,r,o){if(e=+e,t=+t,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),s=n*Math.sin(i),l=e+a,u=t+s,c=1^o,f=o?i-r:r-i;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Gc||Math.abs(this._y1-u)>Gc)&&this._append`L${l},${u}`,n&&(f<0&&(f=f%Hc+Hc),f>Yc?this._append`A${n},${n},0,1,${c},${e-a},${t-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:f>Gc&&this._append`A${n},${n},0,${+(f>=Wc)},${c},${this._x1=e+n*Math.cos(r)},${this._y1=t+n*Math.sin(r)}`)}rect(e,t,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Jc(){return new Xc}function Qc(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Xc(t)}function Zc(e){return e.innerRadius}function Kc(e){return e.outerRadius}function ef(e){return e.startAngle}function tf(e){return e.endAngle}function nf(e){return e&&e.padAngle}function rf(e,t,n,i,r,o,a){var s=e-n,l=t-i,u=(a?o:-o)/yc(s*s+l*l),c=u*l,f=-u*s,d=e+c,h=t+f,p=n+c,m=i+f,g=(d+p)/2,y=(h+m)/2,v=p-d,b=m-h,x=v*v+b*b,_=r-o,w=d*m-p*h,k=(b<0?-1:1)*yc(pc(0,_*_*x-w*w)),E=(w*b-v*k)/x,A=(-w*v-b*k)/x,$=(w*b+v*k)/x,D=(-w*v+b*k)/x,S=E-g,M=A-y,C=$-g,F=D-y;return S*S+M*M>C*C+F*F&&(E=$,A=D),{cx:E,cy:A,x01:-c,y01:-f,x11:E*(r/_-1),y11:A*(r/_-1)}}function of(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function af(e){return e[0]}function sf(e){return e[1]}function lf(e,t){var n=qc(!0),i=null,r=Fc,o=null,a=Qc(s);function s(s){var l,u,c,f=(s=of(s)).length,d=!1;for(null==i&&(o=r(c=a())),l=0;l<=f;++l)!(l<f&&n(u=s[l],l,s))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(u,l,s),+t(u,l,s));if(c)return o=null,c+""||null}return e="function"==typeof e?e:void 0===e?af:qc(e),t="function"==typeof t?t:void 0===t?sf:qc(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:qc(!!e),s):n},s.curve=function(e){return arguments.length?(r=e,null!=i&&(o=r(i)),s):r},s.context=function(e){return arguments.length?(null==e?i=o=null:o=r(i=e),s):i},s}function uf(e,t,n){var i=null,r=qc(!0),o=null,a=Fc,s=null,l=Qc(u);function u(u){var c,f,d,h,p,m=(u=of(u)).length,g=!1,y=new Array(m),v=new Array(m);for(null==o&&(s=a(p=l())),c=0;c<=m;++c){if(!(c<m&&r(h=u[c],c,u))===g)if(g=!g)f=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),d=c-1;d>=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,u),v[c]=+t(h,c,u),s.point(i?+i(h,c,u):y[c],n?+n(h,c,u):v[c]))}if(p)return s=null,p+""||null}function c(){return lf().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?af:qc(+e),t="function"==typeof t?t:qc(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?sf:qc(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:qc(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:qc(+e),u):n},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(n)},u.lineX1=function(){return c().x(i).y(t)},u.defined=function(e){return arguments.length?(r="function"==typeof e?e:qc(!!e),u):r},u.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),u):a},u.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),u):o},u}Jc.prototype=Xc.prototype,Array.prototype.slice,yc(3);const cf={draw(e,t){const n=yc(t/bc);e.moveTo(n,0),e.arc(0,0,n,0,_c)}};yc(1/3),gc(bc/10),gc(7*bc/10);function ff(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}gc(_c/10),hc(_c/10),yc(3),yc(3),yc(3),yc(12);const df=()=>"undefined"!=typeof Image?Image:null,hf=ui(si),pf=hf.right,mf=hf.left,gf=(ui(ks).center,pf);function yf(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function vf(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function bf(){}var xf=.7,_f=1/xf,wf="\\s*([+-]?\\d+)\\s*",kf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ef="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Af=/^#([0-9a-f]{3,8})$/,$f=new RegExp(`^rgb\\(${wf},${wf},${wf}\\)$`),Df=new RegExp(`^rgb\\(${Ef},${Ef},${Ef}\\)$`),Sf=new RegExp(`^rgba\\(${wf},${wf},${wf},${kf}\\)$`),Mf=new RegExp(`^rgba\\(${Ef},${Ef},${Ef},${kf}\\)$`),Cf=new RegExp(`^hsl\\(${kf},${Ef},${Ef}\\)$`),Ff=new RegExp(`^hsla\\(${kf},${Ef},${Ef},${kf}\\)$`),Of={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Nf(){return this.rgb().formatHex()}function Tf(){return this.rgb().formatRgb()}function zf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Af.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Rf(t):3===n?new jf(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Pf(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Pf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=$f.exec(e))?new jf(t[1],t[2],t[3],1):(t=Df.exec(e))?new jf(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Sf.exec(e))?Pf(t[1],t[2],t[3],t[4]):(t=Mf.exec(e))?Pf(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Cf.exec(e))?Gf(t[1],t[2]/100,t[3]/100,1):(t=Ff.exec(e))?Gf(t[1],t[2]/100,t[3]/100,t[4]):Of.hasOwnProperty(e)?Rf(Of[e]):"transparent"===e?new jf(NaN,NaN,NaN,0):null}function Rf(e){return new jf(e>>16&255,e>>8&255,255&e,1)}function Pf(e,t,n,i){return i<=0&&(e=t=n=NaN),new jf(e,t,n,i)}function Lf(e){return e instanceof bf||(e=zf(e)),e?new jf((e=e.rgb()).r,e.g,e.b,e.opacity):new jf}function Bf(e,t,n,i){return 1===arguments.length?Lf(e):new jf(e,t,n,null==i?1:i)}function jf(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function If(){return`#${Hf(this.r)}${Hf(this.g)}${Hf(this.b)}`}function Uf(){const e=qf(this.opacity);return`${1===e?"rgb(":"rgba("}${Wf(this.r)}, ${Wf(this.g)}, ${Wf(this.b)}${1===e?")":`, ${e})`}`}function qf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hf(e){return((e=Wf(e))<16?"0":"")+e.toString(16)}function Gf(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Xf(e,t,n,i)}function Yf(e){if(e instanceof Xf)return new Xf(e.h,e.s,e.l,e.opacity);if(e instanceof bf||(e=zf(e)),!e)return new Xf;if(e instanceof Xf)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),o=Math.max(t,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=t===o?(n-i)/s+6*(n<i):n===o?(i-t)/s+2:(t-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new Xf(a,s,l,e.opacity)}function Vf(e,t,n,i){return 1===arguments.length?Yf(e):new Xf(e,t,n,null==i?1:i)}function Xf(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Jf(e){return(e=(e||0)%360)<0?e+360:e}function Qf(e){return Math.max(0,Math.min(1,e||0))}function Zf(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Kf(e,t,n,i,r){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*n+(1+3*e+3*o-3*a)*i+a*r)/6}function ed(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],o=e[i+1],a=i>0?e[i-1]:2*r-o,s=i<t-1?e[i+2]:2*o-r;return Kf((n-i/t)*t,a,r,o,s)}}function td(e){var t=e.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*t),r=e[(i+t-1)%t],o=e[i%t],a=e[(i+1)%t],s=e[(i+2)%t];return Kf((n-i/t)*t,r,o,a,s)}}yf(bf,zf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nf,formatHex:Nf,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Yf(this).formatHsl()},formatRgb:Tf,toString:Tf}),yf(jf,Bf,vf(bf,{brighter(e){return e=null==e?_f:Math.pow(_f,e),new jf(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?xf:Math.pow(xf,e),new jf(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new jf(Wf(this.r),Wf(this.g),Wf(this.b),qf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:If,formatHex:If,formatHex8:function(){return`#${Hf(this.r)}${Hf(this.g)}${Hf(this.b)}${Hf(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Uf,toString:Uf})),yf(Xf,Vf,vf(bf,{brighter(e){return e=null==e?_f:Math.pow(_f,e),new Xf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?xf:Math.pow(xf,e),new Xf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new jf(Zf(e>=240?e-240:e+120,r,i),Zf(e,r,i),Zf(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new Xf(Jf(this.h),Qf(this.s),Qf(this.l),qf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=qf(this.opacity);return`${1===e?"hsl(":"hsla("}${Jf(this.h)}, ${100*Qf(this.s)}%, ${100*Qf(this.l)}%${1===e?")":`, ${e})`}`}}));const nd=e=>()=>e;function id(e,t){return function(n){return e+n*t}}function rd(e,t){var n=t-e;return n?id(e,n>180||n<-180?n-360*Math.round(n/360):n):nd(isNaN(e)?t:e)}function od(e,t){var n=t-e;return n?id(e,n):nd(isNaN(e)?t:e)}const ad=function e(t){var n=function(e){return 1==(e=+e)?od:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):nd(isNaN(t)?n:t)}}(t);function i(e,t){var i=n((e=Bf(e)).r,(t=Bf(t)).r),r=n(e.g,t.g),o=n(e.b,t.b),a=od(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=o(t),e.opacity=a(t),e+""}}return i.gamma=e,i}(1);function sd(e){return function(t){var n,i,r=t.length,o=new Array(r),a=new Array(r),s=new Array(r);for(n=0;n<r;++n)i=Bf(t[n]),o[n]=i.r||0,a[n]=i.g||0,s[n]=i.b||0;return o=e(o),a=e(a),s=e(s),i.opacity=1,function(e){return i.r=o(e),i.g=a(e),i.b=s(e),i+""}}}var ld=sd(ed),ud=sd(td);function cd(e,t){t||(t=[]);var n,i=e?Math.min(t.length,e.length):0,r=t.slice();return function(o){for(n=0;n<i;++n)r[n]=e[n]*(1-o)+t[n]*o;return r}}function fd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dd(e,t){return(fd(t)?cd:hd)(e,t)}function hd(e,t){var n,i=t?t.length:0,r=e?Math.min(i,e.length):0,o=new Array(r),a=new Array(i);for(n=0;n<r;++n)o[n]=xd(e[n],t[n]);for(;n<i;++n)a[n]=t[n];return function(e){for(n=0;n<r;++n)a[n]=o[n](e);return a}}function pd(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function md(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function gd(e,t){var n,i={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?i[n]=xd(e[n],t[n]):r[n]=t[n];return function(e){for(n in i)r[n]=i[n](e);return r}}var yd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vd=new RegExp(yd.source,"g");function bd(e,t){var n,i,r,o=yd.lastIndex=vd.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=yd.exec(e))&&(i=vd.exec(t));)(r=i.index)>o&&(r=t.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:md(n,i)})),o=vd.lastIndex;return o<t.length&&(r=t.slice(o),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,i=0;i<t;++i)s[(n=l[i]).i]=n.x(e);return s.join("")})}function xd(e,t){var n,i=typeof t;return null==t||"boolean"===i?nd(t):("number"===i?md:"string"===i?(n=zf(t))?(t=n,ad):bd:t instanceof zf?ad:t instanceof Date?pd:fd(t)?cd:Array.isArray(t)?hd:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?gd:md)(e,t)}function _d(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function wd(e){return+e}var kd=[0,1];function Ed(e){return e}function Ad(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function $d(e,t,n){var i=e[0],r=e[1],o=t[0],a=t[1];return r<i?(i=Ad(r,i),o=n(a,o)):(i=Ad(i,r),o=n(o,a)),function(e){return o(i(e))}}function Dd(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),o=new Array(i),a=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++a<i;)r[a]=Ad(e[a],e[a+1]),o[a]=n(t[a],t[a+1]);return function(t){var n=gf(e,t,1,i)-1;return o[n](r[n](t))}}function Sd(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Md(){var e,t,n,i,r,o,a=kd,s=kd,l=xd,u=Ed;function c(){var e=Math.min(a.length,s.length);return u!==Ed&&(u=function(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(a[0],a[e-1])),i=e>2?Dd:$d,r=o=null,f}function f(t){return null==t||isNaN(t=+t)?n:(r||(r=i(a.map(e),s,l)))(e(u(t)))}return f.invert=function(n){return u(t((o||(o=i(s,a.map(e),md)))(n)))},f.domain=function(e){return arguments.length?(a=Array.from(e,wd),c()):a.slice()},f.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},f.rangeRound=function(e){return s=Array.from(e),l=_d,c()},f.clamp=function(e){return arguments.length?(u=!!e||Ed,c()):u!==Ed},f.interpolate=function(e){return arguments.length?(l=e,c()):l},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,i){return e=n,t=i,c()}}function Cd(){return Md()(Ed,Ed)}function Fd(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Od(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}function Nd(e,t,n,i){var r,o=rn(e,t,n);switch((i=sn(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=fn(o,a))||(i.precision=r),bn(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=dn(o,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=hn(o))||(i.precision=r-2*("%"===i.type))}return vn(i)}function Td(e){var t=e.domain;return e.ticks=function(e){var n=t();return tn(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return Nd(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,o=t(),a=0,s=o.length-1,l=o[a],u=o[s],c=10;for(u<l&&(r=l,l=u,u=r,r=a,a=s,s=r);c-- >0;){if((r=nn(l,u,n))===i)return o[a]=l,o[s]=u,t(o);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function zd(e,t){var n,i=0,r=(e=e.slice()).length-1,o=e[i],a=e[r];return a<o&&(n=i,i=r,r=n,n=o,o=a,a=n),e[i]=t.floor(o),e[r]=t.ceil(a),e}function Rd(e){return Math.log(e)}function Pd(e){return Math.exp(e)}function Ld(e){return-Math.log(-e)}function Bd(e){return-Math.exp(-e)}function jd(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Id(e){return(t,n)=>-e(-t,n)}function Ud(e){const t=e(Rd,Pd),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?jd:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=Id(i),r=Id(r),e(Ld,Bd)):e(Rd,Pd),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 l=s<a;l&&([a,s]=[s,a]);let u,c,f=i(a),d=i(s);const h=null==e?10:+e;let p=[];if(!(o%1)&&d-f<h){if(f=Math.floor(f),d=Math.ceil(d),a>0){for(;f<=d;++f)for(u=1;u<o;++u)if(c=f<0?u/r(-f):u*r(f),!(c<a)){if(c>s)break;p.push(c)}}else for(;f<=d;++f)for(u=o-1;u>=1;--u)if(c=f>0?u/r(-f):u*r(f),!(c<a)){if(c>s)break;p.push(c)}2*p.length<h&&(p=tn(a,s,h))}else p=tn(f,d,Math.min(d-f,h)).map(r);return l?p.reverse():p},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=sn(n)).precision||(n.trim=!0),n=vn(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*o<o-.5&&(t*=o),t<=a?n(e):""}},t.nice=()=>n(zd(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function qd(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Wd(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Hd(e){return e<0?-e*e:e*e}function Gd(e){var t=e(Ed,Ed),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(Ed,Ed):.5===n?e(Wd,Hd):e(qd(n),qd(1/n)):n},Td(t)}function Yd(){var e=Gd(Md());return e.copy=function(){return Sd(e,Yd()).exponent(e.exponent())},Fd.apply(e,arguments),e}function Vd(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Xd(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Jd(e){var t=1,n=e(Vd(t),Xd(t));return n.constant=function(n){return arguments.length?e(Vd(t=+n),Xd(t)):t},Td(n)}function Qd(e,t,n,i,r,o){const a=[[oi,1,$n],[oi,5,5e3],[oi,15,15e3],[oi,30,3e4],[o,1,Dn],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,Sn],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,Mn],[i,2,1728e5],[n,1,Cn],[t,1,2592e6],[t,3,7776e6],[e,1,Fn]];function s(t,n,i){const r=Math.abs(n-t)/i,o=ui((([,,e])=>e)).right(a,r);if(o===a.length)return e.every(rn(t/Fn,n/Fn,i));if(0===o)return ai.every(Math.max(rn(t,n,i),1));const[s,l]=a[r/a[o-1][2]<a[o][2]/r?o-1:o];return s.every(l)}return[function(e,t,n){const i=t<e;i&&([e,t]=[t,e]);const r=n&&"function"==typeof n.range?n:s(e,t,n),o=r?r.range(e,+t+1):[];return i?o.reverse():o},s]}const[Zd,Kd]=Qd(Zn,ei,Wn,Tn,ni,ri),[eh,th]=Qd(Qn,Kn,Rn,On,ti,ii);function nh(e){return new Date(e)}function ih(e){return e instanceof Date?+e:+new Date(+e)}function rh(e,t,n,i,r,o,a,s,l,u){var c=Cd(),f=c.invert,d=c.domain,h=u(".%L"),p=u(":%S"),m=u("%I:%M"),g=u("%I %p"),y=u("%a %d"),v=u("%b %d"),b=u("%B"),x=u("%Y");function _(e){return(l(e)<e?h:s(e)<e?p:a(e)<e?m:o(e)<e?g:i(e)<e?r(e)<e?y:v:n(e)<e?b:x)(e)}return c.invert=function(e){return new Date(f(e))},c.domain=function(e){return arguments.length?d(Array.from(e,ih)):d().map(nh)},c.ticks=function(t){var n=d();return e(n[0],n[n.length-1],null==t?10:t)},c.tickFormat=function(e,t){return null==t?_:u(t)},c.nice=function(e){var n=d();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?d(zd(n,e)):c},c.copy=function(){return Sd(c,rh(e,t,n,i,r,o,a,s,l,u))},c}function oh(){var e,t,n,i,r,o=0,a=1,s=Ed,l=!1;function u(t){return null==t||isNaN(t=+t)?r:s(0===n?.5:(t=(i(t)-e)*n,l?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),u):[s(0),s(1)]}}return u.domain=function(r){return arguments.length?([o,a]=r,e=i(o=+o),t=i(a=+a),n=e===t?0:1/(t-e),u):[o,a]},u.clamp=function(e){return arguments.length?(l=!!e,u):l},u.interpolator=function(e){return arguments.length?(s=e,u):s},u.range=c(xd),u.rangeRound=c(_d),u.unknown=function(e){return arguments.length?(r=e,u):r},function(r){return i=r,e=r(o),t=r(a),n=e===t?0:1/(t-e),u}}function ah(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function sh(){var e=Td(oh()(Ed));return e.copy=function(){return ah(e,sh())},Od.apply(e,arguments)}function lh(){var e=Gd(oh());return e.copy=function(){return ah(e,lh()).exponent(e.exponent())},Od.apply(e,arguments)}function uh(e,t){void 0===t&&(t=e,e=xd);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);n<i;)o[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return o[t](e-t)}}function ch(){var e,t,n,i,r,o,a,s=0,l=.5,u=1,c=1,f=Ed,d=!1;function h(e){return isNaN(e=+e)?a:(e=.5+((e=+o(e))-t)*(c*e<c*t?i:r),f(d?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,i,r;return arguments.length?([n,i,r]=t,f=uh(e,[n,i,r]),h):[f(0),f(.5),f(1)]}}return h.domain=function(a){return arguments.length?([s,l,u]=a,e=o(s=+s),t=o(l=+l),n=o(u=+u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h):[s,l,u]},h.clamp=function(e){return arguments.length?(d=!!e,h):d},h.interpolator=function(e){return arguments.length?(f=e,h):f},h.range=p(xd),h.rangeRound=p(_d),h.unknown=function(e){return arguments.length?(a=e,h):a},function(a){return o=a,e=a(s),t=a(l),n=a(u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h}}function fh(){var e=Gd(ch());return e.copy=function(){return ah(e,fh()).exponent(e.exponent())},Od.apply(e,arguments)}class dh extends Map{constructor(e,t=yh){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(ph(this,e))}has(e){return super.has(ph(this,e))}set(e,t){return super.set(mh(this,e),t)}delete(e){return super.delete(gh(this,e))}}class hh extends Set{constructor(e,t=yh){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const t of e)this.add(t)}has(e){return super.has(ph(this,e))}add(e){return super.add(mh(this,e))}delete(e){return super.delete(gh(this,e))}}function ph({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function mh({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function gh({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(i),e.delete(i)),n}function yh(e){return null!==e&&"object"==typeof e?e.valueOf():e}const vh=Symbol("implicit");function bh(){var e=new dh,t=[],n=[],i=vh;function r(r){let o=e.get(r);if(void 0===o){if(i!==vh)return i;e.set(r,o=t.push(r)-1)}return n[o%n.length]}return r.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new dh;for(const i of n)e.has(i)||e.set(i,t.push(i)-1);return r},r.range=function(e){return arguments.length?(n=Array.from(e),r):n.slice()},r.unknown=function(e){return arguments.length?(i=e,r):i},r.copy=function(){return bh(t,n).unknown(i)},Fd.apply(r,arguments),r}function xh(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function _h(e,t){var n=rd(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var wh,kh=180/Math.PI,Eh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ah(e,t,n,i,r,o){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*i)&&(n-=e*l,i-=t*l),(s=Math.sqrt(n*n+i*i))&&(n/=s,i/=s,l/=s),e*i<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:o,rotate:Math.atan2(t,e)*kh,skewX:Math.atan(l)*kh,scaleX:a,scaleY:s}}function $h(e,t,n,i){function r(e){return e.length?e.pop()+" ":""}return function(o,a){var s=[],l=[];return o=e(o),a=e(a),function(e,i,r,o,a,s){if(e!==r||i!==o){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:md(e,r)},{i:l-2,x:md(i,o)})}else(r||o)&&a.push("translate("+r+t+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(e,t,n,o){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:md(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(o.rotate,a.rotate,s,l),function(e,t,n,o){e!==t?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:md(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(o.skewX,a.skewX,s,l),function(e,t,n,i,o,a){if(e!==n||t!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:md(e,n)},{i:s-2,x:md(t,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(e){for(var t,n=-1,i=l.length;++n<i;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var Dh=$h((function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Eh:Ah(t.a,t.b,t.c,t.d,t.e,t.f)}),"px, ","px)","deg)"),Sh=$h((function(e){return null==e?Eh:(wh||(wh=document.createElementNS("http://www.w3.org/2000/svg","g")),wh.setAttribute("transform",e),(e=wh.transform.baseVal.consolidate())?Ah((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Eh)}),", ",")",")");function Mh(e){return((e=Math.exp(e))+1/e)/2}const Ch=function e(t,n,i){function r(e,r){var o,a,s=e[0],l=e[1],u=e[2],c=r[0],f=r[1],d=r[2],h=c-s,p=f-l,m=h*h+p*p;if(m<1e-12)a=Math.log(d/u)/t,o=function(e){return[s+e*h,l+e*p,u*Math.exp(t*e*a)]};else{var g=Math.sqrt(m),y=(d*d-u*u+i*m)/(2*u*n*g),v=(d*d-u*u-i*m)/(2*d*n*g),b=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);a=(x-b)/t,o=function(e){var i=e*a,r=Mh(b),o=u/(n*g)*(r*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*i+b)-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+o*h,l+o*p,u*r/Mh(t*i+b)]}}return o.duration=1e3*a*t/Math.SQRT2,o}return r.rho=function(t){var n=Math.max(.001,+t),i=n*n;return e(n,i,i*i)},r}(Math.SQRT2,2,4);function Fh(e){return function(t,n){var i=e((t=Vf(t)).h,(n=Vf(n)).h),r=od(t.s,n.s),o=od(t.l,n.l),a=od(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+""}}}const Oh=Fh(rd);var Nh=Fh(od);const Th=Math.PI/180,zh=180/Math.PI,Rh=.96422,Ph=1,Lh=.82521,Bh=4/29,jh=6/29,Ih=3*jh*jh,Uh=.008856451679035631;function qh(e){if(e instanceof Hh)return new Hh(e.l,e.a,e.b,e.opacity);if(e instanceof Qh)return Zh(e);e instanceof jf||(e=Lf(e));var t,n,i=Xh(e.r),r=Xh(e.g),o=Xh(e.b),a=Gh((.2225045*i+.7168786*r+.0606169*o)/Ph);return i===r&&r===o?t=n=a:(t=Gh((.4360747*i+.3850649*r+.1430804*o)/Rh),n=Gh((.0139322*i+.0971045*r+.7141733*o)/Lh)),new Hh(116*a-16,500*(t-a),200*(a-n),e.opacity)}function Wh(e,t,n,i){return 1===arguments.length?qh(e):new Hh(e,t,n,null==i?1:i)}function Hh(e,t,n,i){this.l=+e,this.a=+t,this.b=+n,this.opacity=+i}function Gh(e){return e>Uh?Math.pow(e,1/3):e/Ih+Bh}function Yh(e){return e>jh?e*e*e:Ih*(e-Bh)}function Vh(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Xh(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jh(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof Qh)return new Qh(e.h,e.c,e.l,e.opacity);if(e instanceof Hh||(e=qh(e)),0===e.a&&0===e.b)return new Qh(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*zh;return new Qh(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}(e):new Qh(e,t,n,null==i?1:i)}function Qh(e,t,n,i){this.h=+e,this.c=+t,this.l=+n,this.opacity=+i}function Zh(e){if(isNaN(e.h))return new Hh(e.l,0,0,e.opacity);var t=e.h*Th;return new Hh(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Kh(e,t){var n=od((e=Wh(e)).l,(t=Wh(t)).l),i=od(e.a,t.a),r=od(e.b,t.b),o=od(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=o(t),e+""}}function ep(e){return function(t,n){var i=e((t=Jh(t)).h,(n=Jh(n)).h),r=od(t.c,n.c),o=od(t.l,n.l),a=od(t.opacity,n.opacity);return function(e){return t.h=i(e),t.c=r(e),t.l=o(e),t.opacity=a(e),t+""}}}yf(Hh,Wh,vf(bf,{brighter(e){return new Hh(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker(e){return new Hh(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new jf(Vh(3.1338561*(t=Rh*Yh(t))-1.6168667*(e=Ph*Yh(e))-.4906146*(n=Lh*Yh(n))),Vh(-.9787684*t+1.9161415*e+.033454*n),Vh(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),yf(Qh,Jh,vf(bf,{brighter(e){return new Qh(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker(e){return new Qh(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb(){return Zh(this).rgb()}}));const tp=ep(rd);var np=ep(od),ip=-.14861,rp=1.78277,op=-.29227,ap=-.90649,sp=1.97294,lp=sp*ap,up=sp*rp,cp=rp*op-ap*ip;function fp(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof dp)return new dp(e.h,e.s,e.l,e.opacity);e instanceof jf||(e=Lf(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(cp*i+lp*t-up*n)/(cp+lp-up),o=i-r,a=(sp*(n-r)-op*o)/ap,s=Math.sqrt(a*a+o*o)/(sp*r*(1-r)),l=s?Math.atan2(a,o)*zh-120:NaN;return new dp(l<0?l+360:l,s,r,e.opacity)}(e):new dp(e,t,n,null==i?1:i)}function dp(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function hp(e){return function t(n){function i(t,i){var r=e((t=fp(t)).h,(i=fp(i)).h),o=od(t.s,i.s),a=od(t.l,i.l),s=od(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)}yf(dp,fp,vf(bf,{brighter(e){return e=null==e?_f:Math.pow(_f,e),new dp(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?xf:Math.pow(xf,e),new dp(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Th,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new jf(255*(t+n*(ip*i+rp*r)),255*(t+n*(op*i+ap*r)),255*(t+n*(sp*i)),this.opacity)}}));const pp=hp(rd);var mp=hp(od);function gp(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function yp(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}const vp="linear",bp="log",xp="pow",_p="sqrt",wp="symlog",kp="time",Ep="utc",Ap="sequential",$p="diverging",Dp="quantile",Sp="quantize",Mp="threshold",Cp="ordinal",Fp="point",Op="band",Np="bin-ordinal",Tp="continuous",zp="discrete",Rp="discretizing",Pp="interpolating",Lp="temporal";function Bp(){const e=bh().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,l=0,u=.5;function c(){const e=t().length,c=o[1]<o[0],f=o[1-c],d=yp(e,s,l);let h=o[c-0];i=(f-h)/(d||1),a&&(i=Math.floor(i)),h+=(f-h-i*(e-s))*u,r=i*(1-s),a&&(h=Math.round(h),r=Math.round(r));const p=El(e).map((e=>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?(l=Math.max(0,Math.min(1,e)),s=l,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?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]<o[0],a=i?n().reverse():n(),s=a.length-1;let l,u,c,f=+e[0],d=+e[1];return f!=f||d!=d||(d<f&&(c=f,f=d,d=c),d<a[0]||f>o[1-i])?void 0:(l=Math.max(0,pf(a,f)-1),u=f===d?l:pf(a,d)-1,f-a[l]>r+1e-10&&++l,i&&(c=l,l=s-u,u=s-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Bp().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(l).align(u)},c()}function jp(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return jp(t())},e}var Ip=Array.prototype.map;const Up=Array.prototype.slice,qp=new Map,Wp=Symbol("vega_scale");function Hp(e){return e[Wp]=!0,e}function Gp(e,t,n){return arguments.length>1?(qp.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<i&&(n=i,i=r,r=n),[e.invert(i),e.invert(r)]}}(n):n.invertExtent?function(e){return function(t){const n=e.range();let i,r,o,a,s=t[0],l=t[1],u=-1;for(l<s&&(r=s,s=l,l=r),o=0,a=n.length;o<a;++o)n[o]>=s&&n[o]<=l&&(u<0&&(u=o),i=o);if(!(u<0))return s=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,Hp(n)};return i.metadata=Ot(Ge(n)),i}(e,t,n)),this):Yp(e)?qp.get(e):void 0}function Yp(e){return qp.has(e)}function Vp(e,t){const n=qp.get(e);return n&&n.metadata[t]}function Xp(e){return Vp(e,Tp)}function Jp(e){return Vp(e,zp)}function Qp(e){return Vp(e,Rp)}function Zp(e){return Vp(e,bp)}function Kp(e){return Vp(e,Pp)}function em(e){return Vp(e,Dp)}Gp("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,wd),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,wd):[0,1],Td(i)})),Gp(vp,(function e(){var t=Cd();return t.copy=function(){return Sd(t,e())},Fd.apply(t,arguments),Td(t)}),Tp),Gp(bp,(function e(){const t=Ud(Md()).domain([1,10]);return t.copy=()=>Sd(t,e()).base(t.base()),Fd.apply(t,arguments),t}),[Tp,bp]),Gp(xp,Yd,Tp),Gp(_p,(function(){return Yd.apply(null,arguments).exponent(.5)}),Tp),Gp(wp,(function e(){var t=Jd(Md());return t.copy=function(){return Sd(t,e()).constant(t.constant())},Fd.apply(t,arguments)}),Tp),Gp(kp,(function(){return Fd.apply(rh(eh,th,Qn,Kn,Rn,On,ti,ii,oi,xr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Tp,Lp]),Gp(Ep,(function(){return Fd.apply(rh(Zd,Kd,Zn,ei,Wn,Nn,ni,ri,oi,wr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Tp,Lp]),Gp(Ap,sh,[Tp,Pp]),Gp(`${Ap}-${vp}`,sh,[Tp,Pp]),Gp(`${Ap}-${bp}`,(function e(){var t=Ud(oh()).domain([1,10]);return t.copy=function(){return ah(t,e()).base(t.base())},Od.apply(t,arguments)}),[Tp,Pp,bp]),Gp(`${Ap}-${xp}`,lh,[Tp,Pp]),Gp(`${Ap}-${_p}`,(function(){return lh.apply(null,arguments).exponent(.5)}),[Tp,Pp]),Gp(`${Ap}-${wp}`,(function e(){var t=Jd(oh());return t.copy=function(){return ah(t,e()).constant(t.constant())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(`${$p}-${vp}`,(function e(){var t=Td(ch()(Ed));return t.copy=function(){return ah(t,e())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(`${$p}-${bp}`,(function e(){var t=Ud(ch()).domain([.1,1,10]);return t.copy=function(){return ah(t,e()).base(t.base())},Od.apply(t,arguments)}),[Tp,Pp,bp]),Gp(`${$p}-${xp}`,fh,[Tp,Pp]),Gp(`${$p}-${_p}`,(function(){return fh.apply(null,arguments).exponent(.5)}),[Tp,Pp]),Gp(`${$p}-${wp}`,(function e(){var t=Jd(ch());return t.copy=function(){return ah(t,e()).constant(t.constant())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(Dp,(function e(){var t,n=[],i=[],r=[];function o(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e<t;)r[e-1]=As(n,e/t);return a}function a(e){return null==e||isNaN(e=+e)?t:i[gf(r,e)]}return a.invertExtent=function(e){var t=i.indexOf(e);return t<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},a.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(si),o()},a.range=function(e){return arguments.length?(i=Array.from(e),o()):i.slice()},a.unknown=function(e){return arguments.length?(t=e,a):t},a.quantiles=function(){return r.slice()},a.copy=function(){return e().domain(n).range(i).unknown(t)},Fd.apply(a,arguments)}),[Rp,Dp]),Gp(Sp,(function e(){var t,n=0,i=1,r=1,o=[.5],a=[0,1];function s(e){return null!=e&&e<=e?a[gf(o,e,0,r)]:t}function l(){var e=-1;for(o=new Array(r);++e<r;)o[e]=((e+1)*i-(e-r)*n)/(r+1);return s}return s.domain=function(e){return arguments.length?([n,i]=e,n=+n,i=+i,l()):[n,i]},s.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,l()):a.slice()},s.invertExtent=function(e){var t=a.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,o[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)},Fd.apply(Td(s),arguments)}),Rp),Gp(Mp,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[gf(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)},Fd.apply(o,arguments)}),Rp),Gp(Np,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(gf(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return Ip.call(e,Se)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Up.call(e),i):n.slice()},i.tickFormat=function(e,n){return Nd(t[0],De(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[zp,Rp]),Gp(Cp,bh,zp),Gp(Op,Bp,zp),Gp(Fp,(function(){return jp(Bp().paddingInner(1))}),zp);const tm=["clamp","base","constant","exponent"];function nm(e,t){const n=t[0],i=De(t)-n;return function(t){return e(n+t*i)}}function im(e,t,n){return uh(am(t||"rgb",n),e)}function rm(e,t){const n=new Array(t),i=t+1;for(let r=0;r<t;)n[r]=e(++r/i);return n}function om(e,t,n){const i=n-t;let r,o,a;return i&&Number.isFinite(i)?(r=(o=e.type).indexOf("-"),o=r<0?o:o.slice(r+1),a=Gp(o)().domain([t,n]).range([0,1]),tm.forEach((t=>e[t]?a[t](e[t]()):0)),a):tt(.5)}function am(e,t){const n=a[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 sm(e){const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}function lm(e,t){for(const n in e)cm(n,t(e[n]))}const um={};function cm(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(um[e]=t,this):um[e]}lm({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},sm),lm({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=>im(sm(e))));const fm="symbol",dm="discrete",hm=e=>_e(e)?e.map((e=>String(e))):String(e),pm=(e,t)=>e[1]-t[1],mm=(e,t)=>t[1]-e[1];function gm(e,t,n){let i;return gt(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor($t(e.domain())/n||1)))),we(t)&&(i=t.step,t=t.interval),vt(t)&&(t=e.type===kp?Qi(t):e.type==Ep?Zi(t):oe("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function ym(e,t,n){let i=e.range(),r=i[0],o=De(i),a=pm;if(r>o&&(i=o,o=r,r=i,a=mm),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],De(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function vm(e,t){return e.bins?ym(e,e.bins):e.ticks?e.ticks(t):e.domain()}function bm(e,t,n,i,r,o){const a=t.type;let s=hm;if(a===kp||r===kp)s=e.timeFormat(i);else if(a===Ep||r===Ep)s=e.utcFormat(i);else if(Zp(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=xm(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 xm(e,t,n){const i=vm(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*r<r-.5&&(t*=r),t<=a};return n?i.filter(s):s}const _m={[Dp]:"quantiles",[Sp]:"thresholds",[Mp]:"domain"},wm={[Dp]:"quantiles",[Sp]:"domain"};function km(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=De(e),t}(e.bins):e.type===bp?xm(e,t,!0):_m[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[_m[e.type]]()):vm(e,t)}const Em=e=>_m[e.type]||e.bins;function Am(e,t,n,i,r,o,a){const s=wm[t.type]&&o!==kp&&o!==Ep?function(e,t,n){const i=t[wm[t.type]](),r=i.length;let o,a=r>1?i[1]-i[0]:i[0];for(o=1;o<r;++o)a=Math.min(a,i[o]-i[o-1]);return e.formatSpan(0,a,30,n)}(e,t,r):bm(e,t,n,r,o,a);return i===fm&&Em(t)?$m(s):i===dm?Sm(s):Mm(s)}const $m=e=>(t,n,i)=>{const r=Dm(i[n+1],Dm(i.max,1/0)),o=Cm(t,e),a=Cm(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Dm=(e,t)=>null!=e?e:t,Sm=e=>(t,n)=>n?e(t):null,Mm=e=>t=>e(t),Cm=(e,t)=>Number.isFinite(e)?t(e):null;function Fm(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=function(e,t,n,i){const r=i||t.type;return vt(n)&&function(e){return Vp(e,Lp)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==kp?n||r!==Ep?Am(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}(e,t,n.format,n.formatType);if(Qp(t.type)){const e=km(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(Jp(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(De(e))}`}}let Om=0;const Nm="p_";function Tm(e){return e&&e.gradient}function zm(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?Nm:"";return r||(r=e.id="gradient_"+Om++,"radial"===i?(e.x1=Rm(e.x1,.5),e.y1=Rm(e.y1,.5),e.r1=Rm(e.r1,0),e.x2=Rm(e.x2,.5),e.y2=Rm(e.y2,.5),e.r2=Rm(e.r2,.5),o=Nm):(e.x1=Rm(e.x1,0),e.y1=Rm(e.y1,0),e.x2=Rm(e.x2,1),e.y2=Rm(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Rm(e,t){return null!=e?e:t}function Pm(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 Lm={basis:{curve:function(e){return new Zu(e)}},"basis-closed":{curve:function(e){return new ec(e)}},"basis-open":{curve:function(e){return new tc(e)}},bundle:{curve:ic,tension:"beta",value:.85},cardinal:{curve:ac,tension:"tension",value:0},"cardinal-open":{curve:lc,tension:"tension",value:0},"cardinal-closed":{curve:cc,tension:"tension",value:0},"catmull-rom":{curve:Ac,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Dc,tension:"alpha",value:.5},"catmull-rom-open":{curve:Mc,tension:"alpha",value:.5},linear:{curve:Fc},"linear-closed":{curve:function(e){return new Oc(e)}},monotone:{horizontal:function(e){return new Lc(e)},vertical:function(e){return new Pc(e)}},natural:{curve:function(e){return new jc(e)}},step:{curve:function(e){return new Uc(e,.5)}},"step-after":{curve:function(e){return new Uc(e,1)}},"step-before":{curve:function(e){return new Uc(e,0)}}};function Bm(e,t,n){var i=st(Lm,e)&&Lm[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const jm={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Im=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Um=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,qm=/^((\s+,?\s*)|(,\s*))/,Wm=/^[01]/;function Hm(e){const t=[];return(e.match(Im)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=jm[i],o=function(e,t,n){const i=[];for(let r=0;t&&r<n.length;)for(let o=0;o<t;++o){const t="a"!==e||3!==o&&4!==o?Um:Wm,a=n.slice(r).match(t);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");r+=a[0].length,i.push(+a[0]);const s=n.slice(r).match(qm);null!==s&&(r+=s[0].length)}return i}(i,r,e.slice(1).trim()),a=o.length;if(a<r||a&&a%r!=0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([n,...o.slice(0,r)]),a!==r){"m"===i&&(n="M"===n?"L":"l");for(let e=r;e<a;e+=r)t.push([n,...o.slice(e,e+r)])}})),t}const Gm=Math.PI/180,Ym=Math.PI/2,Vm=2*Math.PI,Xm=Math.sqrt(3)/2;var Jm={},Qm={},Zm=[].join;function Km(e){const t=Zm.call(e);if(Qm[t])return Qm[t];var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7];const c=u*a,f=-l*s,d=l*a,h=u*s,p=Math.cos(r),m=Math.sin(r),g=Math.cos(o),y=Math.sin(o),v=.5*(o-r),b=Math.sin(.5*v),x=8/3*b*b/Math.sin(v),_=n+p-x*m,w=i+m+x*p,k=n+g,E=i+y,A=k+x*y,$=E-x*g;return Qm[t]=[c*_+f*w,d*_+h*w,c*A+f*$,d*A+h*$,c*k+f*E,d*k+h*E]}const eg=["l",0,0,0,0,0,0,0];function tg(e,t,n){const i=eg[0]=e[0];if("a"===i||"A"===i)eg[1]=t*e[1],eg[2]=n*e[2],eg[3]=e[3],eg[4]=e[4],eg[5]=e[5],eg[6]=t*e[6],eg[7]=n*e[7];else if("h"===i||"H"===i)eg[1]=t*e[1];else if("v"===i||"V"===i)eg[1]=n*e[1];else for(var r=1,o=e.length;r<o;++r)eg[r]=(r%2==1?t:n)*e[r];return eg}function ng(e,t,n,i,r,o){var a,s,l,u,c,f=null,d=0,h=0,p=0,m=0,g=0,y=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==o&&(o=r),e.beginPath&&e.beginPath();for(var v=0,b=t.length;v<b;++v){switch(a=t[v],1===r&&1===o||(a=tg(a,r,o)),a[0]){case"l":d+=a[1],h+=a[2],e.lineTo(d+n,h+i);break;case"L":d=a[1],h=a[2],e.lineTo(d+n,h+i);break;case"h":d+=a[1],e.lineTo(d+n,h+i);break;case"H":d=a[1],e.lineTo(d+n,h+i);break;case"v":h+=a[1],e.lineTo(d+n,h+i);break;case"V":h=a[1],e.lineTo(d+n,h+i);break;case"m":g=d+=a[1],y=h+=a[2],e.moveTo(d+n,h+i);break;case"M":g=d=a[1],y=h=a[2],e.moveTo(d+n,h+i);break;case"c":s=d+a[5],l=h+a[6],p=d+a[3],m=h+a[4],e.bezierCurveTo(d+a[1]+n,h+a[2]+i,p+n,m+i,s+n,l+i),d=s,h=l;break;case"C":d=a[5],h=a[6],p=a[3],m=a[4],e.bezierCurveTo(a[1]+n,a[2]+i,p+n,m+i,d+n,h+i);break;case"s":s=d+a[3],l=h+a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,d+a[1]+n,h+a[2]+i,s+n,l+i),p=d+a[1],m=h+a[2],d=s,h=l;break;case"S":s=a[3],l=a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,a[1]+n,a[2]+i,s+n,l+i),d=s,h=l,p=a[1],m=a[2];break;case"q":s=d+a[3],l=h+a[4],p=d+a[1],m=h+a[2],e.quadraticCurveTo(p+n,m+i,s+n,l+i),d=s,h=l;break;case"Q":s=a[3],l=a[4],e.quadraticCurveTo(a[1]+n,a[2]+i,s+n,l+i),d=s,h=l,p=a[1],m=a[2];break;case"t":s=d+a[1],l=h+a[2],null===f[0].match(/[QqTt]/)?(p=d,m=h):"t"===f[0]?(p=2*d-u,m=2*h-c):"q"===f[0]&&(p=2*d-p,m=2*h-m),u=p,c=m,e.quadraticCurveTo(p+n,m+i,s+n,l+i),h=l,p=(d=s)+a[1],m=h+a[2];break;case"T":s=a[1],l=a[2],p=2*d-p,m=2*h-m,e.quadraticCurveTo(p+n,m+i,s+n,l+i),d=s,h=l;break;case"a":ig(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+n,a[7]+h+i]),d+=a[6],h+=a[7];break;case"A":ig(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+i]),d=a[6],h=a[7];break;case"z":case"Z":d=g,h=y,e.closePath()}f=a}}function ig(e,t,n,i){const r=function(e,t,n,i,r,o,a,s,l){const u=Zm.call(arguments);if(Jm[u])return Jm[u];const c=a*Gm,f=Math.sin(c),d=Math.cos(c),h=d*(s-e)*.5+f*(l-t)*.5,p=d*(l-t)*.5-f*(s-e)*.5;let m=h*h/((n=Math.abs(n))*n)+p*p/((i=Math.abs(i))*i);m>1&&(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*l,_=v*s+b*l,w=g*e+y*t,k=v*e+b*t;let E=1/((w-x)*(w-x)+(k-_)*(k-_))-.25;E<0&&(E=0);let A=Math.sqrt(E);o==r&&(A=-A);const $=.5*(x+w)-A*(k-_),D=.5*(_+k)+A*(w-x),S=Math.atan2(_-D,x-$);let M=Math.atan2(k-D,w-$)-S;M<0&&1===o?M+=Vm:M>0&&0===o&&(M-=Vm);const C=Math.ceil(Math.abs(M/(Ym+.001))),F=[];for(let e=0;e<C;++e){const t=S+e*M/C,r=S+(e+1)*M/C;F[e]=[$,D,t,r,n,i,f,d]}return Jm[u]=F}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let t=0;t<r.length;++t){const n=Km(r[t]);e.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])}}const rg=.5773502691896257,og={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Vm)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/2.5;e.moveTo(-n,-i),e.lineTo(-n,i),e.lineTo(-i,i),e.lineTo(-i,n),e.lineTo(i,n),e.lineTo(i,i),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(i,-i),e.lineTo(i,-n),e.lineTo(-i,-n),e.lineTo(-i,-i),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/7,r=n/2.5,o=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-o),e.lineTo(r,-o),e.lineTo(0,-n),e.lineTo(-r,-o),e.lineTo(-i,-o),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n,r=i-n*rg,o=n/4;e.moveTo(0,-i-r),e.lineTo(-o,i-r),e.lineTo(o,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n,r=i-n*rg;e.moveTo(0,-i-r),e.lineTo(-n,i-r),e.lineTo(n,i-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(0,-i),e.lineTo(-n,i),e.lineTo(n,i),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(0,i),e.lineTo(-n,-i),e.lineTo(n,-i),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(i,0),e.lineTo(-i,-n),e.lineTo(-i,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(-i,0),e.lineTo(i,-n),e.lineTo(i,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function ag(e){return st(og,e)?og[e]:function(e){if(!st(sg,e)){const t=Hm(e);sg[e]={draw:function(e,n){ng(e,t,0,0,Math.sqrt(n)/2)}}}return sg[e]}(e)}var sg={};const lg=.448084975506;function ug(e){return e.x}function cg(e){return e.y}function fg(e){return e.width}function dg(e){return e.height}function hg(e){return"function"==typeof e?e:()=>+e}function pg(e,t,n){return Math.max(t,Math.min(e,n))}function mg(){var e=ug,t=cg,n=fg,i=dg,r=hg(0),o=r,a=r,s=r,l=null;function u(u,c,f){var d,h=null!=c?c:+e.call(this,u),p=null!=f?f:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,v=pg(+r.call(this,u),0,y),b=pg(+o.call(this,u),0,y),x=pg(+a.call(this,u),0,y),_=pg(+s.call(this,u),0,y);if(l||(l=d=Jc()),v<=0&&b<=0&&x<=0&&_<=0)l.rect(h,p,m,g);else{var w=h+m,k=p+g;l.moveTo(h+v,p),l.lineTo(w-b,p),l.bezierCurveTo(w-lg*b,p,w,p+lg*b,w,p+b),l.lineTo(w,k-_),l.bezierCurveTo(w,k-lg*_,w-lg*_,k,w-_,k),l.lineTo(h+x,k),l.bezierCurveTo(h+lg*x,k,h,k-lg*x,h,k-x),l.lineTo(h,p+v),l.bezierCurveTo(h,p+lg*v,h+lg*v,p,h+v,p),l.closePath()}if(d)return l=null,d+""||null}return u.x=function(t){return arguments.length?(e=hg(t),u):e},u.y=function(e){return arguments.length?(t=hg(e),u):t},u.width=function(e){return arguments.length?(n=hg(e),u):n},u.height=function(e){return arguments.length?(i=hg(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=hg(e),o=null!=t?hg(t):r,s=null!=n?hg(n):r,a=null!=i?hg(i):o,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function gg(){var e,t,n,i,r,o,a,s,l=null;function u(e,t,n){const i=n/2;if(r){var u=a-t,c=e-o;if(u||c){var f=Math.sqrt(u*u+c*c),d=(u/=f)*s,h=(c/=f)*s,p=Math.atan2(c,u);l.moveTo(o-d,a-h),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,p-Math.PI,p),l.lineTo(o+d,a+h),l.arc(o,a,s,p,p+Math.PI)}else l.arc(e,t,i,0,Vm);l.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==l&&(l=c=Jc()),a=0;a<=f;++a)!(a<f&&i(s=o[a],a,o))===d&&(d=!d)&&(r=0),d&&u(+e(s,a,o),+t(s,a,o),+n(s,a,o));if(c)return l=null,c+""||null}return c.x=function(t){return arguments.length?(e=t,c):e},c.y=function(e){return arguments.length?(t=e,c):t},c.size=function(e){return arguments.length?(n=e,c):n},c.defined=function(e){return arguments.length?(i=e,c):i},c.context=function(e){return arguments.length?(l=null==e?null:e,c):l},c}function yg(e,t){return null!=e?e:t}const vg=e=>e.x||0,bg=e=>e.y||0,xg=e=>!(!1===e.defined),_g=function(){var e=Zc,t=Kc,n=qc(0),i=null,r=ef,o=tf,a=nf,s=null,l=Qc(u);function u(){var u,c,f=+e.apply(this,arguments),d=+t.apply(this,arguments),h=r.apply(this,arguments)-xc,p=o.apply(this,arguments)-xc,m=fc(p-h),g=p>h;if(s||(s=u=l()),d<f&&(c=d,d=f,f=c),d>vc)if(m>_c-vc)s.moveTo(d*hc(h),d*gc(h)),s.arc(0,0,d,h,p,!g),f>vc&&(s.moveTo(f*hc(p),f*gc(p)),s.arc(0,0,f,p,h,g));else{var y,v,b=h,x=p,_=h,w=p,k=m,E=m,A=a.apply(this,arguments)/2,$=A>vc&&(i?+i.apply(this,arguments):yc(f*f+d*d)),D=mc(fc(d-f)/2,+n.apply(this,arguments)),S=D,M=D;if($>vc){var C=wc($/f*gc(A)),F=wc($/d*gc(A));(k-=2*C)>vc?(_+=C*=g?1:-1,w-=C):(k=0,_=w=(h+p)/2),(E-=2*F)>vc?(b+=F*=g?1:-1,x-=F):(E=0,b=x=(h+p)/2)}var O=d*hc(b),N=d*gc(b),T=f*hc(w),z=f*gc(w);if(D>vc){var R,P=d*hc(x),L=d*gc(x),B=f*hc(_),j=f*gc(_);if(m<bc)if(R=function(e,t,n,i,r,o,a,s){var l=n-e,u=i-t,c=a-r,f=s-o,d=f*l-c*u;if(!(d*d<vc))return[e+(d=(c*(t-o)-f*(e-r))/d)*l,t+d*u]}(O,N,B,j,P,L,T,z)){var I=O-R[0],U=N-R[1],q=P-R[0],W=L-R[1],H=1/gc(function(e){return e>1?0:e<-1?bc:Math.acos(e)}((I*q+U*W)/(yc(I*I+U*U)*yc(q*q+W*W)))/2),G=yc(R[0]*R[0]+R[1]*R[1]);S=mc(D,(f-G)/(H-1)),M=mc(D,(d-G)/(H+1))}else S=M=0}E>vc?M>vc?(y=rf(B,j,O,N,d,M,g),v=rf(P,L,T,z,d,M,g),s.moveTo(y.cx+y.x01,y.cy+y.y01),M<D?s.arc(y.cx,y.cy,M,dc(y.y01,y.x01),dc(v.y01,v.x01),!g):(s.arc(y.cx,y.cy,M,dc(y.y01,y.x01),dc(y.y11,y.x11),!g),s.arc(0,0,d,dc(y.cy+y.y11,y.cx+y.x11),dc(v.cy+v.y11,v.cx+v.x11),!g),s.arc(v.cx,v.cy,M,dc(v.y11,v.x11),dc(v.y01,v.x01),!g))):(s.moveTo(O,N),s.arc(0,0,d,b,x,!g)):s.moveTo(O,N),f>vc&&k>vc?S>vc?(y=rf(T,z,P,L,f,-S,g),v=rf(O,N,B,j,f,-S,g),s.lineTo(y.cx+y.x01,y.cy+y.y01),S<D?s.arc(y.cx,y.cy,S,dc(y.y01,y.x01),dc(v.y01,v.x01),!g):(s.arc(y.cx,y.cy,S,dc(y.y01,y.x01),dc(y.y11,y.x11),!g),s.arc(0,0,f,dc(y.cy+y.y11,y.cx+y.x11),dc(v.cy+v.y11,v.cx+v.x11),g),s.arc(v.cx,v.cy,S,dc(v.y11,v.x11),dc(v.y01,v.x01),!g))):s.arc(0,0,f,w,_,g):s.lineTo(T,z)}else s.moveTo(0,0);if(s.closePath(),u)return s=null,u+""||null}return u.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +o.apply(this,arguments))/2-bc/2;return[hc(i)*n,gc(i)*n]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),u):e},u.outerRadius=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),u):t},u.cornerRadius=function(e){return arguments.length?(n="function"==typeof e?e:qc(+e),u):n},u.padRadius=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:qc(+e),u):i},u.startAngle=function(e){return arguments.length?(r="function"==typeof e?e:qc(+e),u):r},u.endAngle=function(e){return arguments.length?(o="function"==typeof e?e:qc(+e),u):o},u.padAngle=function(e){return arguments.length?(a="function"==typeof e?e:qc(+e),u):a},u.context=function(e){return arguments.length?(s=null==e?null:e,u):s},u}().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)),wg=uf().x(vg).y1(bg).y0((e=>(e.y||0)+(e.height||0))).defined(xg),kg=uf().y(bg).x1(vg).x0((e=>(e.x||0)+(e.width||0))).defined(xg),Eg=lf().x(vg).y(bg).defined(xg),Ag=mg().x(vg).y(bg).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>yg(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>yg(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>yg(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>yg(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),$g=function(e,t){let n=null,i=Qc(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:qc(e||cf),t="function"==typeof t?t:qc(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:qc(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>ag(e.shape||"circle"))).size((e=>yg(e.size,64))),Dg=gg().x(vg).y(bg).defined(xg).size((e=>e.size||1));function Sg(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Mg(e,t,n,i){return Ag.context(e)(t,n,i)}var Cg=1;function Fg(){Cg=1}function Og(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+Cg++),a=r.clipping[o]||(r.clipping[o]={id:o});return Ve(i)?a.path=i(null):Sg(n)?a.path=Mg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function Ng(e){this.clear(),e&&this.union(e)}function Tg(e){this.mark=e,this.bounds=this.bounds||new Ng}function zg(e){Tg.call(this,e),this.items=this.items||[]}function Rg(e){this._pending=0,this._loader=e||Ca()}function Pg(e){e._pending+=1}function Lg(e){e._pending-=1}function Bg(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}Ng.prototype={clone(){return new Ng(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 n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),i<t?(this.y2=t,this.y1=i):(this.y1=t,this.y2=i),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.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),l=Math.sin(e),u=t-t*s+n*l,c=n-t*l-n*s;return[s*i-l*r+u,l*i+s*r+c,s*i-l*a+u,l*i+s*a+c,s*o-l*r+u,l*o+s*r+c,s*o-l*a+u,l*o+s*a+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.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<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.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.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},ft(zg,Tg),Rg.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return Pg(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Lg(t),e))).catch((()=>(Lg(t),null)))},loadImage(e){const t=this,n=df();return Pg(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=st(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>Lg(t),r.onerror=()=>Lg(t),r.src=i,r})).catch((e=>(Lg(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)}))}};const jg=Vm-1e-8;let Ig,Ug,qg,Wg,Hg,Gg,Yg,Vg;const Xg=(e,t)=>Ig.add(e,t),Jg=(e,t)=>Xg(Ug=e,qg=t),Qg=e=>Xg(e,Ig.y1),Zg=e=>Xg(Ig.x1,e),Kg=(e,t)=>Hg*e+Yg*t,ey=(e,t)=>Gg*e+Vg*t,ty=(e,t)=>Xg(Kg(e,t),ey(e,t)),ny=(e,t)=>Jg(Kg(e,t),ey(e,t));function iy(e,t){return Ig=e,t?(Wg=t*Gm,Hg=Vg=Math.cos(Wg),Gg=Math.sin(Wg),Yg=-Gg):(Hg=Vg=1,Wg=Gg=Yg=0),ry}const ry={beginPath(){},closePath(){},moveTo:ny,lineTo:ny,rect(e,t,n,i){Wg?(ty(e+n,t),ty(e+n,t+i),ty(e,t+i),ny(e,t)):(Xg(e+n,t+i),Jg(e,t))},quadraticCurveTo(e,t,n,i){const r=Kg(e,t),o=ey(e,t),a=Kg(n,i),s=ey(n,i);oy(Ug,r,a,Qg),oy(qg,o,s,Zg),Jg(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=Kg(e,t),s=ey(e,t),l=Kg(n,i),u=ey(n,i),c=Kg(r,o),f=ey(r,o);ay(Ug,a,l,c,Qg),ay(qg,s,u,f,Zg),Jg(c,f)},arc(e,t,n,i,r,o){if(i+=Wg,r+=Wg,Ug=n*Math.cos(r)+e,qg=n*Math.sin(r)+t,Math.abs(r-i)>jg)Xg(e-n,t-n),Xg(e+n,t+n);else{const a=i=>Xg(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,l;if(a(i),a(r),r!==i)if((i%=Vm)<0&&(i+=Vm),(r%=Vm)<0&&(r+=Vm),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=Vm,s=i-i%Ym,l=0;l<4&&s>r;++l,s-=Ym)a(s);else for(s=i-i%Ym+Ym,l=0;l<4&&s<r;++l,s+=Ym)a(s)}}};function oy(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function ay(e,t,n,i,r){const o=i-e+3*t-3*n,a=e+n-2*t,s=e-t;let l,u=0,c=0;Math.abs(o)>1e-14?(l=a*a+s*o,l>=0&&(l=Math.sqrt(l),u=(-a+l)/o,c=(-a-l)/o)):u=.5*s/a,0<u&&u<1&&r(sy(u,e,t,n,i)),0<c&&c<1&&r(sy(c,e,t,n,i))}function sy(e,t,n,i,r){const o=1-e,a=o*o,s=e*e;return a*o*t+3*a*e*n+3*o*s*i+s*e*r}var ly=(ly=ff(1,1))?ly.getContext("2d"):null;const uy=new Ng;function cy(e){return function(t,n){if(!ly)return!0;e(ly,t),uy.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:a}=uy;for(let e=r;e<=a;++e)for(let t=i;t<=o;++t)if(ly.isPointInPath(t,e))return!0;return!1}}function fy(e,t){return t.contains(e.x||0,e.y||0)}function dy(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,o=e.height||0;return t.intersects(uy.set(n,i,n+r,i+o))}function hy(e,t){const n=e.x||0,i=e.y||0;return py(t,n,i,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i)}function py(e,t,n,i,r){const{x1:o,y1:a,x2:s,y2:l}=e,u=i-t,c=r-n;let f,d,h,p,m=0,g=1;for(p=0;p<4;++p){if(0===p&&(f=-u,d=-(o-t)),1===p&&(f=u,d=s-t),2===p&&(f=-c,d=-(a-n)),3===p&&(f=c,d=l-n),Math.abs(f)<1e-10&&d<0)return!1;if(h=d/f,f<0){if(h>g)return!1;h>m&&(m=h)}else if(f>0){if(h<m)return!1;h<g&&(g=h)}}return!0}function my(e,t){e.globalCompositeOperation=t.blend||"source-over"}function gy(e,t){return null==e?t:e}function yy(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function vy(e,t,n){return Tm(n)?function(e,t,n){const i=n.width(),r=n.height();let o;if("radial"===t.gradient)o=e.createRadialGradient(n.x1+gy(t.x1,.5)*i,n.y1+gy(t.y1,.5)*r,Math.max(i,r)*gy(t.r1,0),n.x1+gy(t.x2,.5)*i,n.y1+gy(t.y2,.5)*r,Math.max(i,r)*gy(t.r2,.5));else{const a=gy(t.x1,0),s=gy(t.y1,0),l=gy(t.x2,1),u=gy(t.y2,0);if(a!==l&&s!==u&&i!==r){const n=ff(Math.ceil(i),Math.ceil(r)),o=n.getContext("2d");return o.scale(i,r),o.fillStyle=yy(o.createLinearGradient(a,s,l,u),t.stops),o.fillRect(0,0,i,r),e.createPattern(n,"no-repeat")}o=e.createLinearGradient(n.x1+a*i,n.y1+s*r,n.x1+l*i,n.y1+u*r)}return yy(o,t.stops)}(e,n,t.bounds):n}function by(e,t,n){return(n*=null==t.fillOpacity?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=vy(e,t,t.fill),!0)}var xy=[];function _y(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=vy(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||xy),e.lineDashOffset=t.strokeDashOffset||0),!0)}function wy(e,t){return e.zindex-t.zindex||e.index-t.index}function ky(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n<i;++n)(t=r[n]).index=n,t.zindex&&o.push(t);return e.zdirty=!1,e.zitems=o.sort(wy)}function Ey(e,t){var n,i,r=e.items;if(!r||!r.length)return;const o=ky(e);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||t(r[n]);r=o}for(n=0,i=r.length;n<i;++n)t(r[n])}function Ay(e,t){var n,i,r=e.items;if(!r||!r.length)return null;const o=ky(e);for(o&&o.length&&(r=o),i=r.length;--i>=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 $y(e){return function(t,n,i){Ey(n,(n=>{i&&!i.intersects(n.bounds)||Sy(e,t,n,n)}))}}function Dy(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Sy(e,t,n.items[0],n.items)}}function Sy(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(my(t,n),n.fill&&by(t,n,r)&&t.fill(),n.stroke&&_y(t,n,r)&&t.stroke()))}function My(e){return e=e||de,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,Ay(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 Cy(e,t){return function(n,i,r,o){var a,s,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(a=l.strokeWidth,s=l.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Fy(e){return My(Cy(e))}function Oy(e,t){return"translate("+e+","+t+")"}function Ny(e){return"rotate("+e+")"}function Ty(e){return Oy(e.x||0,e.y||0)}function zy(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*=Gm),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 Oy(e.x||0,e.y||0)+(e.angle?" "+Ny(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(iy(e,n.angle),n),Bg(e,n).translate(n.x||0,n.y||0)},draw:$y(i),pick:Fy(i),isect:n||cy(i)}}var Ry=zy("arc",(function(e,t){return _g.context(e)(t)}));function Py(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=Cy(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(iy(e),i),Bg(e,i[0]))},draw:Dy(i),pick:function(e,t,n,i,o,a){var s=t.items,l=t.bounds;return!s||!s.length||l&&!l.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:fy,tip:n}}var Ly=Py("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?kg:wg).curve(Bm(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))<s&&(s=i,n=e[a]);return n}));function By(e,t){e.beginPath(),Sg(t)?Mg(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function jy(e){const t=gy(e.strokeWidth,1);return null!=e.strokeOffset?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function Iy(e,t){const n=jy(t);e("d",Mg(null,t,n,n))}function Uy(e,t,n,i){const r=jy(t);e.beginPath(),Mg(e,t,(n||0)+r,(i||0)+r)}const qy=Cy(Uy),Wy=Cy(Uy,!1),Hy=Cy(Uy,!0);var Gy={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Ty(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t<i;++t)e.union(n[t].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),Bg(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n){Ey(t,(t=>{const i=t.x||0,r=t.y||0,o=t.strokeForeground,a=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&a&&(Uy(e,t,i,r),my(e,t),t.fill&&by(e,t,a)&&e.fill(),t.stroke&&!o&&_y(e,t,a)&&e.stroke()),e.save(),e.translate(i,r),t.clip&&By(e,t),n&&n.translate(-i,-r),Ey(t,(t=>{this.draw(e,t,n)})),n&&n.translate(i,r),e.restore(),o&&t.stroke&&a&&(Uy(e,t,i,r),my(e,t),_y(e,t,a)&&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 Ay(t,(l=>{let u,c,f;const d=l.bounds;if(d&&!d.contains(r,o))return;c=l.x||0,f=l.y||0;const h=c+(l.width||0),p=f+(l.height||0),m=l.clip;if(m&&(r<c||r>h||o<f||o>p))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&Sg(l)&&!Hy(e,l,a,s))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&Wy(e,l,a,s)?(e.restore(),l):(u=Ay(l,(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)),!u&&y&&(l.fill||!g&&l.stroke)&&qy(e,l,a,s)&&(u=l),e.restore(),u||null)}))},isect:dy,content:function(e,t,n){e("clip-path",t.clip?Og(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Iy(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Iy(e,t):e("d","")}},Yy={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Vy(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 Xy(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 Jy(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 Qy(e,t){return"center"===e?t/2:"right"===e?t:0}function Zy(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var Ky={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=Vy(t,n),r=Xy(t,i),o=Jy(t,i),a=(t.x||0)-Qy(t.align,r),s=(t.y||0)-Zy(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",Yy["xmlns:xlink"],"xlink:href"),e("transform",Oy(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=Xy(t,n),r=Jy(t,n),o=(t.x||0)-Qy(t.align,i),a=(t.y||0)-Zy(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){Ey(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=Vy(t,this);let r=Xy(t,i),o=Jy(t,i);if(0===r||0===o)return;let a,s,l,u,c=(t.x||0)-Qy(t.align,r),f=(t.y||0)-Zy(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,l=t.width/t.height,s==s&&l==l&&s!==l&&(l<s?(u=r/s,f+=(o-u)/2,o=u):(u=o*s,c+=(r-u)/2,r=u))),(i.complete||i.toDataURL)&&(my(e,t),e.globalAlpha=null!=(a=t.opacity)?a:1,e.imageSmoothingEnabled=!1!==t.smooth,e.drawImage(i,c,f,r,o))}))},pick:My(),isect:de,get:Vy,xOffset:Qy,yOffset:Zy},ev=Py("line",(function(e,t){const n=t[0],i=n.interpolate||"linear";return Eg.curve(Bm(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r=Math.pow(e[0].strokeWidth||1,2),o=e.length;--o>=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i<r)return e[o];return null}));function tv(e,t){var n=t.path;if(null==n)return!0;var i=t.x||0,r=t.y||0,o=t.scaleX||1,a=t.scaleY||1,s=(t.angle||0)*Gm,l=t.pathCache;l&&l.path===n||((t.pathCache=l=Hm(n)).path=n),s&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(s),ng(e,l,0,0,o,a),e.rotate(-s),e.translate(-i,-r)):ng(e,l,i,r,o,a)}var nv={type:"path",tag:"path",nested:!1,attr:function(e,t){var n=t.scaleX||1,i=t.scaleY||1;1===n&&1===i||e("vector-effect","non-scaling-stroke"),e("transform",function(e){return Oy(e.x||0,e.y||0)+(e.angle?" "+Ny(e.angle):"")+(e.scaleX||e.scaleY?" "+(t=e.scaleX||1,n=e.scaleY||1,"scale("+t+","+n+")"):"");var t,n}(t)),e("d",t.path)},bound:function(e,t){return tv(iy(e,t.angle),t)?e.set(0,0,0,0):Bg(e,t,!0)},draw:$y(tv),pick:Fy(tv),isect:cy(tv)};function iv(e,t){e.beginPath(),Mg(e,t)}var rv={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",Mg(null,t))},bound:function(e,t){var n,i;return Bg(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)},draw:$y(iv),pick:Fy(iv),isect:dy};function ov(e,t,n){var i,r,o,a;return!(!t.stroke||!_y(e,t,n)||(i=t.x||0,r=t.y||0,o=null!=t.x2?t.x2:i,a=null!=t.y2?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(o,a),0))}var av={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",Ty(t)),e("x2",null!=t.x2?t.x2-(t.x||0):0),e("y2",null!=t.y2?t.y2-(t.y||0):0)},bound:function(e,t){var n,i;return Bg(e.set(n=t.x||0,i=t.y||0,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i),t)},draw:function(e,t,n){Ey(t,(t=>{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&ov(e,t,i)&&(my(e,t),e.stroke())}}))},pick:My((function(e,t,n,i){return!!e.isPointInStroke&&ov(e,t,1)&&e.isPointInStroke(n,i)})),isect:hy},sv=zy("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),lv=zy("symbol",(function(e,t){return $g.context(e)(t)}),fy);const uv=wt();var cv={height:gv,measureWidth:pv,estimateWidth:dv,width:dv,canvas:fv};function fv(e){cv.width=e&&ly?pv:dv}function dv(e,t){return hv(xv(e,t),gv(e))}function hv(e,t){return~~(.8*e.length*t)}function pv(e,t){return gv(e)<=0||!(t=xv(e,t))?0:mv(t,wv(e))}function mv(e,t){const n=`(${t}) ${e}`;let i=uv.get(n);return void 0===i&&(ly.font=t,i=ly.measureText(e).width,uv.set(n,i)),i}function gv(e){return null!=e.fontSize?+e.fontSize||0:11}function yv(e){return null!=e.lineHeight?e.lineHeight:gv(e)+2}function vv(e){return t=e.lineBreak&&e.text&&!_e(e.text)?e.text.split(e.lineBreak):e.text,_e(t)?t.length>1?t:t[0]:t;var t}function bv(e){const t=vv(e);return(_e(t)?t.length-1:0)*yv(e)}function xv(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(cv.width===pv){const t=wv(e);return e=>mv(e,t)}{const t=gv(e);return e=>hv(e,t)}}(e);if(i(t)<n)return t;var r,o=e.ellipsis||"…",a="rtl"===e.dir,s=0,l=t.length;if(n-=i(o),a){for(;s<l;)r=s+l>>>1,i(t.slice(r))>n?s=r+1:l=r;return o+t.slice(s)}for(;s<l;)r=1+(s+l>>>1),i(t.slice(0,r))<n?s=r:l=r-1;return t.slice(0,s)+o}(e,n):n}function _v(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function wv(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+gv(e)+"px "+_v(e,t)}function kv(e){var t=e.baseline,n=gv(e);return Math.round("top"===t?.79*n:"middle"===t?.3*n:"bottom"===t?-.21*n:"line-top"===t?.29*n+.5*yv(e):"line-bottom"===t?.29*n-.5*yv(e):0)}fv(!0);const Ev={left:"start",center:"middle",right:"end"},Av=new Ng;function $v(e){var t,n=e.x||0,i=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-Ym,n+=r*Math.cos(t),i+=r*Math.sin(t)),Av.x1=n,Av.y1=i,Av}function Dv(e,t,n){var i,r=cv.height(t),o=t.align,a=$v(t),s=a.x1,l=a.y1,u=t.dx||0,c=(t.dy||0)+kv(t)-Math.round(.8*r),f=vv(t);if(_e(f)?(r+=yv(t)*(f.length-1),i=f.reduce(((e,n)=>Math.max(e,cv.width(t,n))),0)):i=cv.width(t,f),"center"===o?u-=i/2:"right"===o&&(u-=i),e.set(u+=s,c+=l,u+i,c+r),t.angle&&!n)e.rotate(t.angle*Gm,s,l);else if(2===n)return e.rotatedPoints(t.angle*Gm,s,l);return e}var Sv={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+kv(t),o=$v(t),a=o.x1,s=o.y1,l=t.angle||0;e("text-anchor",Ev[t.align]||"start"),l?(n=Oy(a,s)+" "+Ny(l),(i||r)&&(n+=" "+Oy(i,r))):n=Oy(a+i,s+r),e("transform",n)},bound:Dv,draw:function(e,t,n){Ey(t,(t=>{var i,r,o,a,s,l,u,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=wv(t),e.textAlign=t.align||"left",r=(i=$v(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*Gm),r=o=0),r+=t.dx||0,o+=(t.dy||0)+kv(t),l=vv(t),my(e,t),_e(l))for(s=yv(t),a=0;a<l.length;++a)u=xv(t,l[a]),t.fill&&by(e,t,c)&&e.fillText(u,r,o),t.stroke&&_y(e,t,c)&&e.strokeText(u,r,o),o+=s;else u=xv(t,l),t.fill&&by(e,t,c)&&e.fillText(u,r,o),t.stroke&&_y(e,t,c)&&e.strokeText(u,r,o);t.angle&&e.restore()}}))},pick:My((function(e,t,n,i,r,o){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var a=$v(t),s=a.x1,l=a.y1,u=Dv(Av,t,1),c=-t.angle*Gm,f=Math.cos(c),d=Math.sin(c),h=f*r-d*o+(s-f*s+d*l),p=d*r+f*o+(l-d*s-f*l);return u.contains(h,p)})),isect:function(e,t){const n=Dv(Av,e,2);return py(t,n[0],n[1],n[2],n[3])||py(t,n[0],n[1],n[4],n[5])||py(t,n[4],n[5],n[6],n[7])||py(t,n[2],n[3],n[6],n[7])}},Mv=Py("trail",(function(e,t){return Dg.context(e)(t)}),(function(e,t){for(var n,i,r=e.length;--r>=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})),Cv={arc:Ry,area:Ly,group:Gy,image:Ky,line:ev,path:nv,rect:rv,rule:av,shape:sv,symbol:lv,text:Sv,trail:Mv};function Fv(e,t,n){var i=Cv[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new Ng),e,n)}var Ov={mark:null};function Nv(e,t,n){var i,r,o,a,s=Cv[e.marktype],l=s.bound,u=e.items,c=u&&u.length;if(s.nested)return c?o=u[0]:(Ov.mark=e,o=Ov),a=Fv(o,l,n),t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new Ng,c)for(i=0,r=u.length;i<r;++i)t.union(Fv(u[i],l,n));return e.bounds=t}const Tv=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function zv(e,t){return JSON.stringify(e,Tv,t)}function Rv(e){return Pv("string"==typeof e?JSON.parse(e):e)}function Pv(e){var t,n,i,r=e.marktype,o=e.items;if(o)for(n=0,i=o.length;n<i;++n)t=r?"mark":"group",o[n][t]=e,o[n].zindex&&(o[n][t].zdirty=!0),"group"===(r||t)&&Pv(o[n]);return r&&Nv(e),e}function Lv(e){arguments.length?this.root=Rv(e):(this.root=Bv({marktype:"group",name:"root",role:"frame"}),this.root.items=[new zg(this.root)])}function Bv(e,t){const n={bounds:new Ng,clip:!!e.clip,group:t,interactive:!1!==e.interactive,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return null!=e.aria&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function jv(e,t,n){return!e&&"undefined"!=typeof document&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function Iv(e,t){t=t.toLowerCase();for(var n=e.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===t)return n[i]}function Uv(e,t,n,i){var r,o=e.childNodes[t];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=jv(e.ownerDocument,n,i),e.insertBefore(o,r)),o}function qv(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function Wv(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Hv(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function Gv(e,t){this._active=null,this._handlers={},this._loader=e||Ca(),this._tooltip=t||Yv}function Yv(e,t,n,i){e.element().setAttribute("title",i||"")}function Vv(e){this._el=null,this._bgcolor=null,this._loader=new Rg(e)}Lv.prototype={toJSON(e){return zv(this.root,e||0)},mark(e,t,n){const i=Bv(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}},Gv.prototype={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 e in t)n.push(...t[e]);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=jv(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=Cv[a.marktype]).tip){for((o=Hv(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,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,l+=e.y||0;return{x:s,y:l,width:o,height:a,left:s,top:l,right:s+o,bottom:l+a}}},Vv.prototype={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){const t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},_render(){},renderAsync(e){const t=this.render(e);return this._ready?this._ready.then((()=>t)):Promise.resolve(t)},_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 Xv="dragenter",Jv="dragleave",Qv="dragover",Zv="mousedown",Kv="mousemove",eb="mouseout",tb="mouseover",nb="click",ib="mousewheel",rb="touchstart",ob="touchmove",ab="touchend",sb=Kv,lb=eb,ub=nb;function cb(e,t){Gv.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}function fb(e,t){(e=>e===rb||e===ob||e===ab?[rb,ob,ab]:[e])(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 db(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||this.fire(n,i),this._active=o,this.fire(t,i)),this.fire(e,i)}}function hb(e){return function(t){this.fire(e,t),this._active=null}}ft(cb,Gv,{initialize(e,t,n){return this._canvas=e&&Iv(e,"canvas"),[nb,Zv,Kv,eb,Jv].forEach((e=>fb(this,e))),Gv.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",Xv,Jv,Qv,Zv,"mouseup",Kv,eb,tb,nb,"dblclick","wheel",ib,rb,ob,ab],DOMMouseScroll(e){this.fire(ib,e)},mousemove:db(Kv,tb,eb),dragover:db(Qv,Xv,Jv),mouseout:hb(eb),dragleave:hb(Jv),mousedown(e){this._down=this._active,this.fire(Zv,e)},click(e){this._down===this._active&&(this.fire(nb,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(rb,e,!0)},touchmove(e){this.fire(ob,e,!0)},touchend(e){this.fire(ab,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===ub&&i&&i.href?this.handleHref(t,i,i.href):e!==sb&&e!==lb||this.handleTooltip(t,i,e!==lb),r)for(let e=0,n=r.length;e<n;++e)r[e].handler.call(this._obj,t,i)},on(e,t){const n=this.eventName(e),i=this._handlers;return this._handlerIndex(i[n],e,t)<0&&(fb(this,e),(i[n]||(i[n]=[])).push({type:e,handler:t})),this},off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&i.splice(r,1),this},pickEvent(e){const t=Hv(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 Cv[e.marktype].pick.call(this,o,e,t,n,i,r)}});var pb="undefined"!=typeof window&&window.devicePixelRatio||1;function mb(e){Vv.call(this,e),this._options={},this._redraw=!1,this._dirty=new Ng,this._tempb=new Ng}const gb=Vv.prototype;function yb(e,t){Gv.call(this,e,t);const n=this;n._hrefHandler=vb(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=vb(n,((e,t)=>{n.handleTooltip(e,t,e.type!==lb)}))}ft(mb,Vv,{initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:ff(1,1,this._options.type),e&&this._canvas&&(qv(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),gb.initialize.call(this,e,t,n,i,r)},resize(e,t,n,i){if(gb.resize.call(this,e,t,n,i),this._canvas)!function(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=a?pb:r;e.width=t*l,e.height=n*l;for(const e in o)s[e]=o[e];a&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||oe("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){const t=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty,a=((e,t,n)=>(new Ng).set(0,0,t,n).translate(-e[0],-e[1]))(n,i,r);t.save();const s=this._redraw||o.empty()?(this._redraw=!1,a.expand(1)):function(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(t,a.intersect(o),n);return this.clear(-n[0],-n[1],i,r),this.draw(t,e,s),t.restore(),o.clear(),this},draw(e,t,n){const i=Cv[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),Ve(n)?(e.beginPath(),n(e),e.clip()):By(e,t.group)}(e,t),i.draw.call(this,e,t,n),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 vb=(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)};ft(yb,Gv,{initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(ub,this._hrefHandler),i.removeEventListener(sb,this._tooltipHandler),i.removeEventListener(lb,this._tooltipHandler)),this._svg=i=e&&Iv(e,"svg"),i&&(i.addEventListener(ub,this._hrefHandler),i.addEventListener(sb,this._tooltipHandler),i.addEventListener(lb,this._tooltipHandler)),Gv.prototype.initialize.call(this,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:vb(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 bb="aria-hidden",xb="aria-label",_b="role",wb="aria-roledescription",kb="graphics-object",Eb="graphics-symbol",Ab=(e,t,n)=>({[_b]:e,[wb]:t,[xb]:n||void 0}),$b=Ot(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Db={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Ob(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 ${Jp(s)?"discrete":s} scale`+` with ${Fm(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Ob(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,l=a.dataflow.locale();return((u=i).length?u[0].toUpperCase()+u.slice(1):u)+(n?` titled '${n}'`:"")+` for ${function(e){return(e=e.map((e=>e+("fill"===e||"stroke"===e?" color":"")))).length<2?e[0]:e.slice(0,-1).join(", ")+" and "+De(e)}(o)}`+` with ${Fm(l,s,e)}`;var u}},"title-text":{desc:"title",caption:e=>`Title text '${Fb(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Fb(e)}'`}},Sb={ariaRole:_b,ariaRoleDescription:wb,description:xb};function Mb(e,t){const n=!1===t.aria;if(e(bb,n||void 0),n||null==t.description)for(const t in Sb)e(Sb[t],void 0);else{const n=t.mark.marktype;e(xb,t.description),e(_b,t.ariaRole||("group"===n?kb:Eb)),e(wb,t.ariaRoleDescription||`${n} mark`)}}function Cb(e){return!1===e.aria?{[bb]:!0}:$b[e.role]?null:Db[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return Ab(t.role||Eb,t.desc,n.description||i(n))}catch(e){return null}}(e,Db[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return Ab(n?kb:Eb,`${t} mark container`,e.description)}(e)}function Fb(e){return Ge(e.text).join(" ")}function Ob(e){try{return Ge(De(e.items).items[0].text).join(" ")}catch(e){return null}}const Nb=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Tb=e=>Nb(e).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;");function zb(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>(null!=n&&(t+=` ${e}="${Tb(n)}"`),a),a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];for(const e of u)for(const t in e)o(t,e[t]);return a},close(){const o=i.pop();return e+=t?t+(n?`>${n}</${o}>`:"/>"):`</${o}>`,r(),a},attr:o,text:e=>(n+=Nb(e),a),toString:()=>e};return a}const Rb=e=>Pb(zb(),e)+"";function Pb(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t<i;++t)e.attr(n[t].name,n[t].value)}if(t.hasChildNodes()){const n=t.childNodes;for(const t of n)3===t.nodeType?e.text(t.nodeValue):Pb(e,t)}return e.close()}const Lb={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},Bb={blend:"mix-blend-mode"},jb={fill:"none","stroke-miterlimit":10},Ib="http://www.w3.org/2000/xmlns/",Ub=Yy.xmlns;function qb(e){Vv.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}const Wb=Vv.prototype;function Hb(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 Gb(e,t,n){let i,r,o;if("radial"===t.gradient){let i=Uv(e,n++,"pattern",Ub);ex(i,{id:Nm+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=Uv(i,0,"rect",Ub),ex(i,{width:1,height:1,fill:`url(${nx()}#${t.id})`}),ex(e=Uv(e,n++,"radialGradient",Ub),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else ex(e=Uv(e,n++,"linearGradient",Ub),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i<r;++i)o=Uv(e,i,"stop",Ub),o.setAttribute("offset",t.stops[i].offset),o.setAttribute("stop-color",t.stops[i].color);return qv(e,i),n}function Yb(e,t,n){let i;return(e=Uv(e,n,"clipPath",Ub)).setAttribute("id",t.id),t.path?(i=Uv(e,0,"path",Ub),i.setAttribute("d",t.path)):(i=Uv(e,0,"rect",Ub),ex(i,{x:0,y:0,width:t.width,height:t.height})),qv(e,1),n+1}function Vb(e,t,n,i,r){let o,a=e._svg;if(!a&&(o=t.ownerDocument,a=jv(o,i,Ub),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:"default"},"g"===i))){const t=jv(o,"path",Ub);a.appendChild(t),t.__data__=e;const n=jv(o,"g",Ub);a.appendChild(n),n.__data__=e;const i=jv(o,"path",Ub);a.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(a.ownerSVGElement!==r||function(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}ft(qb,Vv,{initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=Uv(e,0,"svg",Ub),this._svg.setAttributeNS(Ib,"xmlns",Ub),this._svg.setAttributeNS(Ib,"xmlns:xlink",Yy["xmlns:xlink"]),this._svg.setAttribute("version",Yy.version),this._svg.setAttribute("class","marks"),qv(e,1),this._root=Uv(this._svg,0,"g",Ub),ex(this._root,jb),qv(this._svg,1)),this.background(this._bgcolor),Wb.initialize.call(this,e,t,n,i,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),Wb.background.apply(this,arguments)},resize(e,t,n,i){return Wb.resize.call(this,e,t,n,i),this._svg&&(ex(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=Uv(e,0,"rect",Ub),ex(n,{width:this._width,height:this._height,fill:t}));const i=Rb(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i},_render(e){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e),qv(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,o,a,s,l;for(a=0,s=e.length;a<s;++a)n=e[a],i=n.mark,i.marktype!==r&&(r=i.marktype,o=Cv[r]),i.zdirty&&i.dirty!==t&&(this._dirtyAll=!1,Hb(n,t),i.items.forEach((e=>{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.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,Hb(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n){if(!this.isDirty(t))return t._svg;const i=this._svg,r=Cv[t.marktype],o=!1===t.interactive?"none":null,a="g"===r.tag,s=Vb(t,e,n,"g",i);s.setAttribute("class",Wv(t));const l=Cb(t);for(const e in l)tx(s,e,l[e]);a||tx(s,"pointer-events",o),tx(s,"clip-path",t.clip?Og(this,t,t.group):null);let u=null,c=0;const f=e=>{const t=this.isDirty(e),n=Vb(e,s,u,r.tag,i);t&&(this._update(r,n,e),a&&function(e,t,n){t=t.lastChild.previousSibling;let i,r=0;Ey(n,(n=>{i=e.mark(t,n,i),++r})),qv(t,1+r)}(this,n,e)),u=n,++c};return r.nested?t.items.length&&f(t.items[0]):Ey(t,f),qv(s,c),s},_update(e,t,n){Xb=t,Jb=t.__values__,Mb(Zb,n),e.attr(Zb,n,this);const i=Qb[e.type];i&&i.call(this,e,t,n),Xb&&this.style(Xb,n)},style(e,t){if(null!=t){for(const n in Lb){let i="font"===n?_v(t):t[n];if(i===Jb[n])continue;const r=Lb[n];null==i?e.removeAttribute(r):(Tm(i)&&(i=zm(i,this._defs.gradient,nx())),e.setAttribute(r,i+"")),Jb[n]=i}for(const n in Bb)Kb(e,Bb[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=Uv(e,1,"defs",Ub)),i=Gb(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=Uv(e,1,"defs",Ub)),i=Yb(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):qv(n,i))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let Xb=null,Jb=null;const Qb={group(e,t,n){const i=Xb=t.childNodes[2];Jb=i.__values__,e.foreground(Zb,n,this),Jb=t.__values__,Xb=t.childNodes[1],e.content(Zb,n,this);const r=Xb=t.childNodes[0];e.background(Zb,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==Jb.events&&(tx(i,"pointer-events",o),tx(r,"pointer-events",o),Jb.events=o),n.strokeForeground&&n.stroke){const e=n.fill;tx(i,"display",null),this.style(r,n),tx(r,"stroke",null),e&&(n.fill=null),Jb=i.__values__,this.style(i,n),e&&(n.fill=e),Xb=null}else tx(i,"display","none")},image(e,t,n){!1===n.smooth?(Kb(t,"image-rendering","optimizeSpeed"),Kb(t,"image-rendering","pixelated")):Kb(t,"image-rendering",null)},text(e,t,n){const i=vv(n);let r,o,a,s;_e(i)?(o=i.map((e=>xv(n,e))),r=o.join("\n"),r!==Jb.text&&(qv(t,0),a=t.ownerDocument,s=yv(n),o.forEach(((e,i)=>{const r=jv(a,"tspan",Ub);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),Jb.text=r)):(o=xv(n,i),o!==Jb.text&&(t.textContent=o,Jb.text=o)),tx(t,"font-family",_v(n)),tx(t,"font-size",gv(n)+"px"),tx(t,"font-style",n.fontStyle),tx(t,"font-variant",n.fontVariant),tx(t,"font-weight",n.fontWeight)}};function Zb(e,t,n){t!==Jb[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(Xb,e,t,n):tx(Xb,e,t),Jb[e]=t)}function Kb(e,t,n){n!==Jb[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Jb[t]=n)}function ex(e,t){for(const n in t)tx(e,n,t[n])}function tx(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function nx(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function ix(e){Vv.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}ft(ix,Vv,{svg(){return this._text},_render(e){const t=zb();t.open("svg",it({},Yy,{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",jb,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const n=Cv[t.marktype],i=n.tag,r=[Mb,n.attr];e.open("g",{class:Wv(t),"clip-path":t.clip?Og(this,t,t.group):null},Cb(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=vv(o);if(_e(t)){const n={x:0,dy:yv(o)};for(let i=0;i<t.length;++i)e.open("tspan",i?n:null).text(xv(o,t[i])).close()}else e.text(xv(o,t))}else if("g"===i){const i=o.strokeForeground,r=o.fill,a=o.stroke;i&&a&&(o.stroke=null),e.open("path",this.attr(t,o,n.background,"bgrect")).close(),e.open("g",this.attr(t,o,n.content)),Ey(o,(t=>this.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]):Ey(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;if("bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none"),"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"]=_v(t),e["font-size"]=gv(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in Lb){let i=t[n];const o=Lb[n];("transparent"!==i||"fill"!==o&&"stroke"!==o)&&null!=i&&(Tm(i)&&(i=zm(i,r.gradient,"")),e[o]=i)}for(const e in Bb){const n=t[e];null!=n&&(o=o||[],o.push(`${Bb[e]}: ${n};`))}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:Nm+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<r.length;++t)e.open("stop",{offset:r[t].offset,"stop-color":r[t].color}).close();e.close()}for(const t in n){const i=n[t];e.open("clipPath",{id:t}),i.path?e.open("path",{d:i.path}).close():e.open("rect",{x:0,y:0,width:i.width,height:i.height}).close(),e.close()}e.close()}}});const rx="canvas",ox="none",ax={Canvas:rx,PNG:"png",SVG:"svg",None:ox},sx={};function lx(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(sx[e]=t,this):sx[e]}function ux(e,t,n){const i=[],r=(new Ng).union(t),o=e.marktype;return o?cx(e,r,n,i):"group"===o?fx(e,r,n,i):oe("Intersect scene must be mark node or group item.")}function cx(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<a;++s)fx(r[s],t,n,i);else for(const e=Cv[o].isect;s<a;++s){const n=r[s];dx(n,t,e)&&i.push(n)}}return i}function fx(e,t,n,i){n&&n(e.mark)&&dx(e,t,Cv.group.isect)&&i.push(e);const r=e.items,o=r&&r.length;if(o){const a=e.x||0,s=e.y||0;t.translate(-a,-s);for(let e=0;e<o;++e)cx(r[e],t,n,i);t.translate(a,s)}return i}function dx(e,t,n){const i=e.bounds;return t.encloses(i)||t.intersects(i)&&n(e,t)}sx[rx]=sx.png={renderer:mb,headless:mb,handler:cb},sx.svg={renderer:qb,headless:ix,handler:yb},sx[ox]={};const hx=new Ng;function px(e){const t=e.clip;if(Ve(t))t(iy(hx.clear()));else{if(!t)return;hx.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(hx)}const mx=1e-9;function gx(e,t,n){return e===t||("path"===n?yx(e,t):e instanceof Date&&t instanceof Date?+e==+t:gt(e)&&gt(t)?Math.abs(e-t)<=mx:e&&t&&(we(e)||we(t))?function(e,t){var n,i,r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!gx(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function yx(e,t){return gx(Hm(e),Hm(t))}function vx(){Fg(),Om=0}const bx="top",xx="left",_x="right",wx="bottom",kx="start",Ex="middle",Ax="end",$x="x",Dx="y",Sx="group",Mx="axis",Cx="title",Fx="legend",Ox="row-header",Nx="row-footer",Tx="row-title",zx="column-header",Rx="column-footer",Px="column-title",Lx="fit-x",Bx="fit-y",jx="none",Ix="all",Ux="each",qx="flush",Wx="column",Hx="row";function Gx(e){ps.call(this,null,e)}function Yx(e,t,n){return t(e.bounds.clear(),e,n)}ft(Gx,ps,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=Cv[r],a=o.bound;let s,l=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),l=Yx(i,a),i.items.forEach((e=>{e.bounds.clear().union(l)}));else if(r===Sx||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),l.clear(),i.items.forEach((e=>l.union(Yx(e,a)))),i.role){case Mx:case Fx:case Cx:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{l.union(Yx(e,a))})),t.visit(t.MOD,(e=>{s=s||l.alignsWith(e.bounds),n.dirty(e),l.union(Yx(e,a))})),s&&(l.clear(),i.items.forEach((e=>l.union(e.bounds))));return px(i),t.modifies("bounds")}});const Vx=":vega_identifier:";function Xx(e){ps.call(this,0,e)}function Jx(e){ps.call(this,null,e)}function Qx(e){ps.call(this,null,e)}Xx.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ft(Xx,ps,{transform(e,t){const n=(r=t.dataflow)._signals[Vx]||(r._signals[Vx]=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}}),ft(Jx,ps,{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===Sx?zg:Tg;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 Zx={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&Kx(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},Kx=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),e_=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i<r;o=n,++i)if(Kx(o,n=e[i].bounds,t))return!0},t_=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},n_=e=>(e.forEach((e=>e.opacity=1)),e),i_=(e,t)=>e.reflow(t.modified()).modifies("opacity");function r_(e){ps.call(this,null,e)}ft(Qx,ps,{transform(e,t){const n=Zx[e.method]||Zx.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")&&(n_(a),t=i_(t,e)),t;if(a=a.filter(t_),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=n_(a),t=i_(t,e),r.length>=3&&e_(r,i)){do{r=n(r,i)}while(r.length>=3&&e_(r,i));r.length<3&&!De(a).opacity&&(r.length>1&&(De(r).opacity=0),De(a).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=((e,t,n)=>{var i=e.range(),r=new Ng;return t===bx||t===wx?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),e=>r.encloses(e.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),a.forEach((e=>{o(e)||(e.opacity=0)})));const s=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&s.union(e.bounds)})),t}}),ft(r_,ps,{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 o_=new Ng;function a_(e,t,n){return e[t]===n?0:(e[t]=n,1)}function s_(e){var t=e.items[0].orient;return t===xx||t===_x}function l_(e,t,n,i){var r,o,a=t.items[0],s=a.datum,l=null!=a.translate?a.translate:.5,u=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&&bv(g),x=0,_=0;switch(o_.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),u){case bx:x=h||0,_=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&u_(e,g,o,y,b,0,-1,v);break;case xx:x=-d,_=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&u_(e,g,o,y,b,1,-1,v);break;case _x:x=n+d,_=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&u_(e,g,o,y,b,1,1,v);break;case wx:x=h||0,_=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&u_(e,g,o,y,0,0,1,v);break;default:x=a.x,_=a.y}return Bg(v.translate(x,_),a),a_(a,"x",x+l)|a_(a,"y",_+l)&&(a.bounds=o_,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function u_(e,t,n,i,r,o,a,s){const l=t.bounds;if(t.auto){const s=a*(n+r+i);let u=0,c=0;e.dirty(t),o?u=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(l.translate(-u,-c)),e.dirty(t)}s.union(l)}const c_=(e,t)=>Math.floor(Math.min(e,t)),f_=(e,t)=>Math.ceil(Math.max(e,t));function d_(e){return(new Ng).set(0,0,e.width||0,e.height||0)}function h_(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function p_(e,t,n){const i=we(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function m_(e){return e<0?Math.ceil(-e):0}function g_(e,t,n){var i,r,o,a,s,l,u,c,f,d,h,p=!n.nodirty,m=n.bounds===qx?d_:h_,g=o_.set(0,0,0,0),y=p_(n.align,Wx),v=p_(n.align,Hx),b=p_(n.padding,Wx),x=p_(n.padding,Hx),_=n.columns||t.length,w=_<=0?1:Math.ceil(t.length/_),k=t.length,E=Array(k),A=Array(_),$=0,D=Array(k),S=Array(w),M=0,C=Array(k),F=Array(k),O=Array(k);for(r=0;r<_;++r)A[r]=0;for(r=0;r<w;++r)S[r]=0;for(r=0;r<k;++r)l=t[r],s=O[r]=m(l),l.x=l.x||0,C[r]=0,l.y=l.y||0,F[r]=0,o=r%_,a=~~(r/_),$=Math.max($,u=Math.ceil(s.x2)),M=Math.max(M,c=Math.ceil(s.y2)),A[o]=Math.max(A[o],u),S[a]=Math.max(S[a],c),E[r]=b+m_(s.x1),D[r]=x+m_(s.y1),p&&e.dirty(t[r]);for(r=0;r<k;++r)r%_==0&&(E[r]=0),r<_&&(D[r]=0);if(y===Ux)for(o=1;o<_;++o){for(h=0,r=o;r<k;r+=_)h<E[r]&&(h=E[r]);for(r=o;r<k;r+=_)E[r]=h+A[o-1]}else if(y===Ix){for(h=0,r=0;r<k;++r)r%_&&h<E[r]&&(h=E[r]);for(r=0;r<k;++r)r%_&&(E[r]=h+$)}else for(y=!1,o=1;o<_;++o)for(r=o;r<k;r+=_)E[r]+=A[o-1];if(v===Ux)for(a=1;a<w;++a){for(h=0,i=(r=a*_)+_;r<i;++r)h<D[r]&&(h=D[r]);for(r=a*_;r<i;++r)D[r]=h+S[a-1]}else if(v===Ix){for(h=0,r=_;r<k;++r)h<D[r]&&(h=D[r]);for(r=_;r<k;++r)D[r]=h+M}else for(v=!1,a=1;a<w;++a)for(i=(r=a*_)+_;r<i;++r)D[r]+=S[a-1];for(f=0,r=0;r<k;++r)f=E[r]+(r%_?f:0),C[r]+=f-t[r].x;for(o=0;o<_;++o)for(d=0,r=o;r<k;r+=_)d+=D[r],F[r]+=d-t[r].y;if(y&&p_(n.center,Wx)&&w>1)for(r=0;r<k;++r)(f=(s=y===Ix?$:A[r%_])-O[r].x2-t[r].x-C[r])>0&&(C[r]+=f/2);if(v&&p_(n.center,Hx)&&1!==_)for(r=0;r<k;++r)(d=(s=v===Ix?M:S[~~(r/_)])-O[r].y2-t[r].y-F[r])>0&&(F[r]+=d/2);for(r=0;r<k;++r)g.union(O[r].translate(C[r],F[r]));switch(f=p_(n.anchor,$x),d=p_(n.anchor,Dx),p_(n.anchor,Wx)){case Ax:f-=g.width();break;case Ex:f-=g.width()/2}switch(p_(n.anchor,Hx)){case Ax:d-=g.height();break;case Ex:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),r=0;r<k;++r)t[r].mark.bounds.clear();for(r=0;r<k;++r)(l=t[r]).x+=C[r]+=f,l.y+=F[r]+=d,g.union(l.mark.bounds.union(l.bounds.translate(C[r],F[r]))),p&&e.dirty(l);return g}function y_(e,t){return"x1"===t?e.x||0:"y1"===t?e.y||0:"x2"===t?(e.x||0)+(e.width||0):"y2"===t?(e.y||0)+(e.height||0):void 0}function v_(e,t){return e.bounds[t]}function b_(e,t,n,i,r,o,a,s,l,u,c,f,d,h){var p,m,g,y,v,b,x,_,w,k=n.length,E=0,A=0;if(!k)return E;for(p=c;p<k;p+=f)n[p]&&(E=a(E,l(n[p],u)));if(!t.length)return E;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),E+=o,m=0,y=t.length;m<y;++m)e.dirty(t[m]),t[m].mark.bounds.clear();for(p=c,m=0,y=t.length;m<y;++m,p+=f){for(v=(b=t[m]).mark.bounds,g=p;g>=0&&null==(x=n[g]);g-=d);s?(_=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),w=E):(_=E,w=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(_-(b.x||0),w-(b.y||0))),b.x=_,b.y=w,e.dirty(b),A=a(A,v[u])}return A}function x_(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 __(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),l=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)),u=s("anchor",kx),c=u===Ax?1:u===Ex?.5:0,f={align:Ux,bounds:s("bounds",qx),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case xx:f.anchor={x:Math.floor(i.x1)-l,column:Ax,y:c*(a||i.height()+2*i.y1),row:u};break;case _x:f.anchor={x:Math.ceil(i.x2)+l,y:c*(a||i.height()+2*i.y1),row:u};break;case bx:f.anchor={y:Math.floor(r.y1)-l,row:Ax,x:c*(o||r.width()+2*r.x1),column:u};break;case wx:f.anchor={y:Math.ceil(r.y2)+l,x:c*(o||r.width()+2*r.x1),column:u};break;case"top-left":f.anchor={x:l,y:l};break;case"top-right":f.anchor={x:o-l,y:l,column:Ax};break;case"bottom-left":f.anchor={x:l,y:a-l,row:Ax};break;case"bottom-right":f.anchor={x:o-l,y:a-l,column:Ax,row:Ax}}return f}function w_(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,l=r.x,u=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,l=t.titlePadding||0,u=i-a.x,c=i-a.y;switch(a.orient){case xx:r+=Math.ceil(a.bounds.width())+l;break;case _x:case wx:break;default:o+=a.bounds.height()+l}switch((r||o)&&E_(e,n,r,o),a.orient){case xx:c+=k_(t,n,a,s,1,1);break;case _x:u+=k_(t,n,a,Ax,0,0)+l,c+=k_(t,n,a,s,1,1);break;case wx:u+=k_(t,n,a,s,0,0),c+=k_(t,n,a,Ax,-1,0,1)+l;break;default:u+=k_(t,n,a,s,0,0)}(u||c)&&E_(e,a,u,c),(u=Math.round(a.bounds.x1-i))<0&&(E_(e,n,-u,0),E_(e,a,-u,0))}else(r||o)&&E_(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!==jx&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,Bg(s.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(s),r}function k_(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,l=n.datum.vgrad,u=(!s||!o&&l||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=l&&o?u:0,f=l&&o?0:u,d=r<=0?0:bv(n);return Math.round(i===kx?c:i===Ax?f-d:.5*(u-d))}function E_(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 A_(e){ps.call(this,null,e)}function $_(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function D_(e){ps.call(this,null,e)}function S_(e){ps.call(this,null,e)}function M_(){return La({})}function C_(e){ps.call(this,null,e)}function F_(e){ps.call(this,[],e)}ft(A_,ps,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&function(e,t,n){var i,r,o,a,s,l,u,c=function(e){var t,n,i=e.items,r=i.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<r;++o)if(n=(t=i[o]).items,t.marktype===Sx)switch(t.role){case Mx:case Fx:case Cx:break;case Ox:a.rowheaders.push(...n);break;case Nx:a.rowfooters.push(...n);break;case zx:a.colheaders.push(...n);break;case Rx:a.colfooters.push(...n);break;case Tx:a.rowtitle=n[0];break;case Px:a.coltitle=n[0];break;default:a.marks.push(...n)}return a}(t),f=c.marks,d=n.bounds===qx?y_:v_,h=n.offset,p=n.columns||f.length,m=p<=0?1:Math.ceil(f.length/p),g=m*p;const y=g_(e,f,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(l=p_(n.headerBand,Hx,null),i=b_(e,c.rowheaders,f,0,m,-p_(h,"rowHeader"),c_,0,d,"x1",0,p,1,l)),c.colheaders&&(l=p_(n.headerBand,Wx,null),r=b_(e,c.colheaders,f,0,p,-p_(h,"columnHeader"),c_,1,d,"y1",0,1,p,l)),c.rowfooters&&(l=p_(n.footerBand,Hx,null),o=b_(e,c.rowfooters,f,0,m,p_(h,"rowFooter"),f_,0,d,"x2",p-1,p,1,l)),c.colfooters&&(l=p_(n.footerBand,Wx,null),a=b_(e,c.colfooters,f,0,p,p_(h,"columnFooter"),f_,1,d,"y2",g-p,1,p,l)),c.rowtitle&&(s=p_(n.titleAnchor,Hx),u=p_(h,"rowTitle"),u=s===Ax?o+u:i-u,l=p_(n.titleBand,Hx,.5),x_(e,c.rowtitle,u,0,y,l)),c.coltitle&&(s=p_(n.titleAnchor,Wx),u=p_(h,"columnTitle"),u=s===Ax?a+u:r-u,l=p_(n.titleBand,Wx,.5),x_(e,c.coltitle,u,1,y,l))}(n,t,e.layout),function(e,t,n){var i,r,o,a,s,l=t.items,u=Math.max(0,t.width||0),c=Math.max(0,t.height||0),f=(new Ng).set(0,0,u,c),d=f.clone(),h=f.clone(),p=[];for(a=0,s=l.length;a<s;++a)switch((r=l[a]).role){case Mx:(s_(r)?d:h).union(l_(e,r,u,c));break;case Cx:i=r;break;case Fx:p.push(w_(e,r));break;case"frame":case"scope":case Ox:case Nx:case Tx:case zx:case Rx:case Px:d.union(r.bounds),h.union(r.bounds);break;default:f.union(r.bounds)}if(p.length){const t={};p.forEach((e=>{(o=e.orient||_x)!==jx&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];g_(e,r,__(r,i,n.legends,d,h,u,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||"fit"!==n.autosize.type&&n.autosize.type!==Lx&&n.autosize.type!==Bx)f.union(i);else switch(t.orient){case xx:case _x:f.add(i.x1,0).add(i.x2,0);break;case bx:case wx: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,l=a.orient,u=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=l===xx||l===_x?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Sx?l===xx?(m=r.y2,p=r.y1):l===_x?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):l===xx&&(m=i,p=0),o=u===kx?m:u===Ax?p:(m+p)/2,h&&h.text){switch(l){case bx:case wx:b=d.bounds.height()+f;break;case xx:v=d.bounds.width()+f;break;case _x:v=-d.bounds.width()-f}o_.clear().union(h.bounds),o_.translate(v-(h.x||0),b-(h.y||0)),a_(h,"x",v)|a_(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(o_),h.mark.bounds.clear().union(o_),e.dirty(h)),o_.clear().union(h.bounds)}else o_.clear();switch(o_.union(d.bounds),l){case bx:g=o,y=r.y1-o_.height()-c;break;case xx:g=r.x1-o_.width()-c,y=o;break;case _x:g=r.x2+o_.width()+c,y=o;break;case wx:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return a_(a,"x",g)|a_(a,"y",y)&&(o_.translate(g,y),e.dirty(a),a.bounds.clear().union(o_),t.bounds.clear().union(o_),e.dirty(a)),a.bounds}(e,i,u,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,l=Math.max(0,t.width||0),u=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-l)),h=Math.max(0,Math.ceil(n.y2-c));if("padding"===r.contains){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===jx?(u=0,f=0,l=a,c=s):"fit"===o?(l=Math.max(0,a-u-d),c=Math.max(0,s-f-h)):o===Lx?(l=Math.max(0,a-u-d),s=c+f+h):o===Bx?(a=l+u+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=l+u+d,s=c+f+h),e._resizeView(a,s,l,c,[u,f],r.resize)}(e,t,f,n)}(n,t,e)})),function(e){return e&&"legend-entry"!==e.mark.role}(e.mark.group)?t.reflow():t}}),ft(D_,ps,{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=gm(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||bm(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?ym(o,e.values,a):vm(o,a);return r&&(i.rem=r),r=l.map(((e,t)=>La({index:t/(l.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(La({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),ft(S_,ps,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||M_,o=e.key||Ra,a=this.value;return _e(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&oe("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=ut().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}}),ft(C_,ps,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(_e(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||he,l=r.enter||he,u=r.exit||he,c=(o&&!a?r[o]:s)||he;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{l(t,e),s(t,e)})),n.modifies(l.output),n.modifies(s.output),c!==he&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&u!==he&&(t.visit(t.REM,(t=>{u(t,e)})),n.modifies(u.output)),a||c!==he){const r=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(r,(t=>{const r=l(t,e)||i;(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(l.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}}),ft(F_,ps,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,o,a,s=t.dataflow.locale(),l=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=this.value,c=e.type||fm,f=e.scale,d=+e.limit,h=gm(f,null==e.count?5:e.count,e.minstep),p=!!e.values||c===fm,m=e.format||Am(s,f,h,c,e.formatSpecifier,e.formatType,p),g=e.values||km(f,h);return u&&(l.rem=u),c===fm?(d&&g.length>d?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),u=g.slice(0,d-1),a=!0):u=g,Ve(r=e.size)?(e.values||0!==f(u[0])||(u=u.slice(1)),o=u.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=tt(o=r||8),u=u.map(((t,n)=>La({index:n,label:m(t,n,u),value:t,offset:o,size:r(t,e)}))),a&&(a=g[u.length],u.push(La({index:u.length,label:`…${g.length-u.length} entries`,value:a,offset:o,size:r(a,e)})))):"gradient"===c?(n=f.domain(),i=om(f,n[0],De(n)),g.length<3&&!e.values&&n[0]!==De(n)&&(g=[n[0],De(n)]),u=g.map(((e,t)=>La({index:t,label:m(e,t,g),value:e,perc:i(e)})))):(r=g.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+De(t),o=r-i;if(e.type===Mp){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(f),u=g.map(((e,t)=>La({index:t,label:m(e,t,g),value:e,perc:t?i(e):0,perc2:t===r?1:i(g[t+1])})))),l.source=u,l.add=u,this.value=u,l}});const O_=e=>e.source.x,N_=e=>e.source.y,T_=e=>e.target.x,z_=e=>e.target.y;function R_(e){ps.call(this,{},e)}R_.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"}]},ft(R_,ps,{transform(e,t){var n=e.sourceX||O_,i=e.sourceY||N_,r=e.targetX||T_,o=e.targetY||z_,a=e.as||"path",s=e.orient||"vertical",l=e.shape||"line",u=j_.get(l+"-"+s)||j_.get(l);return u||oe("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=u(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const P_=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,L_=(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},B_=(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},j_=ut({line:P_,"line-radial":(e,t,n,i)=>P_(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:L_,"arc-radial":(e,t,n,i)=>L_(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:B_,"curve-radial":(e,t,n,i)=>B_(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),l=(t+i)/2;return"M"+t*r+","+t*o+"C"+l*r+","+l*o+" "+l*a+","+l*s+" "+i*a+","+i*s}});function I_(e){ps.call(this,null,e)}I_.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"]}]},ft(I_,ps,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],l=e.field||fe,u=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(l),h=d.length,p=u,m=(c-u)/$_(d),g=El(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;n<h;++n)r=d[g[n]],(i=f[g[n]])[a]=p,i[s]=p+=r*m;return this.value=d,t.reflow(e.modified()).modifies(o)}});function U_(e){return Xp(e)&&e!==Ap}const q_=Ot(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function W_(e){ps.call(this,null,e),this.modified(!0)}function H_(e,t,n){Zp(e)&&(Math.abs(t.reduce(((e,t)=>e+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+Dt(t)));return t}function G_(e,t,n){return Ve(e)&&(t||n)?nm(e,Y_(t||[0,1],n)):e}function Y_(e,t){return t?e.slice().reverse():e}function V_(e){ps.call(this,null,e)}ft(W_,ps,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";return n===Ap?Ap+"-"+vp:(function(e){const t=e.type;return Xp(t)&&t!==kp&&t!==Ep&&(e.scheme||e.range&&e.range.length&&e.range.every(vt))}(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?Ap+"-":3===t?$p+"-":""),(i+n||vp).toLowerCase())}(e);for(r in i&&r===i.type||(this.value=i=Gp(r)()),e)if(!q_[r]){if("padding"===r&&U_(i.type))continue;Ve(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!==Op&&e!==Fp&&oe("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===Fp?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*yp(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;return _e(t.scheme)?i=im(t.scheme,t.interpolate,t.interpolateGamma):(i=cm(t.scheme.toLowerCase()))||oe(`Unrecognized scheme name: ${t.scheme}`),n=e===Mp?n+1:e===Np?n-1:e===Dp||e===Sp?+t.schemeCount||5:n,Kp(e)?G_(i,r,t.reverse):Ve(i)?rm(G_(i,r),n):e===Cp?i:i.slice(0,n)}(i,t,n),Ve(o))){if(e.interpolator)return e.interpolator(o);oe(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&Kp(i))return e.interpolator(im(Y_(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(am(t.interpolate,t.interpolateGamma)):Ve(e.round)?e.round(r):Ve(e.rangeRound)&&e.interpolate(r?_d:xd),o&&e.range(Y_(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!_e(i)){const t=e.domain(),n=t[0],r=De(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||oe("Scale bins parameter missing step property."),a<n&&(a=o*Math.ceil(n/o)),s>r&&(s=o*Math.floor(r/o)),i=El(a,s+o/2,o)}return i?e.bins=i:e.bins&&delete e.bins,e.type===Np&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain()),n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(H_(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,l=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===vp||t===xp||t===_p)}(e);if(!a)return 0;if(U_(s)&&t.padding&&a[0]!==De(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs(De(n)-n[0]),s=a/(a-2*i),l=e===bp?Ie(t,null,s):e===_p?Ue(t,null,s,.5):e===xp?Ue(t,null,s,r||1):e===wp?qe(t,null,s,o||1):je(t,null,s);return(t=t.slice())[0]=l[0],t[t.length-1]=l[1],t}(s,a,t.range,t.padding,t.exponent,t.constant)),(l||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,l&&(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:o<a[0]?0:r;e!==r&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(e,0,o)}return e.domain(H_(s,a,n)),s===Cp&&e.unknown(t.domainImplicit?vh:void 0),t.nice&&e.nice&&e.nice(!0!==t.nice&&gm(e,t.nice)||null),a.length}(i,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),ft(V_,ps,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(Ua(e.sort)),this.modified(n),t}});const X_="zero",J_="center",Q_="normalize",Z_=["y0","y1"];function K_(e){ps.call(this,null,e)}function ew(e,t,n,i,r){for(var o,a=(t-e.sum)/2,s=e.length,l=0;l<s;++l)(o=e[l])[i]=a,o[r]=a+=Math.abs(n(o))}function tw(e,t,n,i,r){for(var o,a=1/e.sum,s=0,l=e.length,u=0,c=0;u<l;++u)(o=e[u])[i]=s,o[r]=s=a*(c+=Math.abs(n(o)))}function nw(e,t,n,i,r){for(var o,a,s=0,l=0,u=e.length,c=0;c<u;++c)(o=+n(a=e[c]))<0?(a[i]=l,a[r]=l+=o):(a[i]=s,a[r]=s+=o)}K_.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:X_,values:[X_,J_,Q_]},{name:"as",type:"string",array:!0,length:2,default:Z_}]},ft(K_,ps,{transform(e,t){var n,i,r,o,a=e.as||Z_,s=a[0],l=a[1],u=Ua(e.sort),c=e.field||fe,f=e.offset===J_?ew:e.offset===Q_?tw:nw;for(n=function(e,t,n,i){var r,o,a,s,l,u,c,f,d,h=[],p=e=>e(l);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;o<a;++o)l=e[o],(c=r[u=t.map(p)])||(r[u]=c=[],h.push(c)),c.push(l);for(u=0,d=0,s=h.length;u<s;++u){for(o=0,f=0,a=(c=h[u]).length;o<a;++o)f+=Math.abs(i(c[o]));c.sum=f,f>d&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,u,c),i=0,r=n.length,o=n.max;i<r;++i)f(n[i],o,c,s,l);return t.reflow(e.modified()).modifies(a)}});const iw=e=>e;function rw(e,t){e&&aw.hasOwnProperty(e.type)&&aw[e.type](e,t)}var ow={Feature:function(e,t){rw(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i<r;)rw(n[i].geometry,t)}},aw={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)e=n[i],t.point(e[0],e[1],e[2])},LineString:function(e,t){sw(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)sw(n[i],t,0)},Polygon:function(e,t){lw(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)lw(n[i],t)},GeometryCollection:function(e,t){for(var n=e.geometries,i=-1,r=n.length;++i<r;)rw(n[i],t)}};function sw(e,t,n){var i,r=-1,o=e.length-n;for(t.lineStart();++r<o;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function lw(e,t){var n=-1,i=e.length;for(t.polygonStart();++n<i;)sw(e[n],t,1);t.polygonEnd()}function uw(e,t){e&&ow.hasOwnProperty(e.type)?ow[e.type](e,t):rw(e,t)}class cw{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const r=t[i],o=e+r,a=Math.abs(e)<Math.abs(r)?e-(o-r):r-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t,n,i,r=this._n,o=0;if(r>0){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}}var fw=1e-6,dw=1e-12,hw=Math.PI,pw=hw/2,mw=hw/4,gw=2*hw,yw=180/hw,vw=hw/180,bw=Math.abs,xw=Math.atan,_w=Math.atan2,ww=Math.cos,kw=Math.ceil,Ew=Math.exp,Aw=(Math.floor,Math.hypot),$w=Math.log,Dw=Math.pow,Sw=Math.sin,Mw=Math.sign||function(e){return e>0?1:e<0?-1:0},Cw=Math.sqrt,Fw=Math.tan;function Ow(e){return e>1?0:e<-1?hw:Math.acos(e)}function Nw(e){return e>1?pw:e<-1?-pw:Math.asin(e)}function Tw(){}var zw,Rw,Pw,Lw,Bw=new cw,jw=new cw,Iw={point:Tw,lineStart:Tw,lineEnd:Tw,polygonStart:function(){Iw.lineStart=Uw,Iw.lineEnd=Hw},polygonEnd:function(){Iw.lineStart=Iw.lineEnd=Iw.point=Tw,Bw.add(bw(jw)),jw=new cw},result:function(){var e=Bw/2;return Bw=new cw,e}};function Uw(){Iw.point=qw}function qw(e,t){Iw.point=Ww,zw=Pw=e,Rw=Lw=t}function Ww(e,t){jw.add(Lw*e-Pw*t),Pw=e,Lw=t}function Hw(){Ww(zw,Rw)}const Gw=Iw;var Yw=1/0,Vw=Yw,Xw=-Yw,Jw=Xw,Qw={point:function(e,t){e<Yw&&(Yw=e),e>Xw&&(Xw=e),t<Vw&&(Vw=t),t>Jw&&(Jw=t)},lineStart:Tw,lineEnd:Tw,polygonStart:Tw,polygonEnd:Tw,result:function(){var e=[[Yw,Vw],[Xw,Jw]];return Xw=Jw=-(Vw=Yw=1/0),e}};const Zw=Qw;var Kw,ek,tk,nk,ik=0,rk=0,ok=0,ak=0,sk=0,lk=0,uk=0,ck=0,fk=0,dk={point:hk,lineStart:pk,lineEnd:yk,polygonStart:function(){dk.lineStart=vk,dk.lineEnd=bk},polygonEnd:function(){dk.point=hk,dk.lineStart=pk,dk.lineEnd=yk},result:function(){var e=fk?[uk/fk,ck/fk]:lk?[ak/lk,sk/lk]:ok?[ik/ok,rk/ok]:[NaN,NaN];return ik=rk=ok=ak=sk=lk=uk=ck=fk=0,e}};function hk(e,t){ik+=e,rk+=t,++ok}function pk(){dk.point=mk}function mk(e,t){dk.point=gk,hk(tk=e,nk=t)}function gk(e,t){var n=e-tk,i=t-nk,r=Cw(n*n+i*i);ak+=r*(tk+e)/2,sk+=r*(nk+t)/2,lk+=r,hk(tk=e,nk=t)}function yk(){dk.point=hk}function vk(){dk.point=xk}function bk(){_k(Kw,ek)}function xk(e,t){dk.point=_k,hk(Kw=tk=e,ek=nk=t)}function _k(e,t){var n=e-tk,i=t-nk,r=Cw(n*n+i*i);ak+=r*(tk+e)/2,sk+=r*(nk+t)/2,lk+=r,uk+=(r=nk*e-tk*t)*(tk+e),ck+=r*(nk+t),fk+=3*r,hk(tk=e,nk=t)}const wk=dk;function kk(e){this._context=e}kk.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,gw)}},result:Tw};var Ek,Ak,$k,Dk,Sk,Mk=new cw,Ck={point:Tw,lineStart:function(){Ck.point=Fk},lineEnd:function(){Ek&&Ok(Ak,$k),Ck.point=Tw},polygonStart:function(){Ek=!0},polygonEnd:function(){Ek=null},result:function(){var e=+Mk;return Mk=new cw,e}};function Fk(e,t){Ck.point=Ok,Ak=Dk=e,$k=Sk=t}function Ok(e,t){Dk-=e,Sk-=t,Mk.add(Cw(Dk*Dk+Sk*Sk)),Dk=e,Sk=t}const Nk=Ck;let Tk,zk,Rk,Pk;class Lk{constructor(e){this._append=null==e?Bk:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Bk;if(t!==Tk){const e=10**t;Tk=t,zk=function(t){let n=1;this._+=t[0];for(const i=t.length;n<i;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return zk}(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==Rk||this._append!==zk){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,Rk=e,zk=this._append,Pk=this._,this._=t}this._+=Pk}}result(){const e=this._;return this._="",e.length?e:null}}function Bk(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function jk(e,t){let n,i,r=3,o=4.5;function a(e){return e&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),uw(e,n(i))),i.result()}return a.area=function(e){return uw(e,n(Gw)),Gw.result()},a.measure=function(e){return uw(e,n(Nk)),Nk.result()},a.bounds=function(e){return uw(e,n(Zw)),Zw.result()},a.centroid=function(e){return uw(e,n(wk)),wk.result()},a.projection=function(t){return arguments.length?(n=null==t?(e=null,iw):(e=t).stream,a):e},a.context=function(e){return arguments.length?(i=null==e?(t=null,new Lk(r)):new kk(t=e),"function"!=typeof o&&i.pointRadius(o),a):t},a.pointRadius=function(e){return arguments.length?(o="function"==typeof e?e:(i.pointRadius(+e),+e),a):o},a.digits=function(e){if(!arguments.length)return r;if(null==e)r=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new Lk(r)),a},a.projection(e).digits(r).context(t)}function Ik(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Tw,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Uk(e,t){return bw(e[0]-t[0])<fw&&bw(e[1]-t[1])<fw}function qk(e,t,n,i){this.x=e,this.z=t,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function Wk(e,t,n,i,r){var o,a,s=[],l=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n,i=e[0],a=e[t];if(Uk(i,a)){if(!i[2]&&!a[2]){for(r.lineStart(),o=0;o<t;++o)r.point((i=e[o])[0],i[1]);return void r.lineEnd()}a[0]+=2*fw}s.push(n=new qk(i,e,null,!0)),l.push(n.o=new qk(i,null,n,!1)),s.push(n=new qk(a,e,null,!1)),l.push(n.o=new qk(a,null,n,!0))}})),s.length){for(l.sort(t),Hk(s),Hk(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var u,c,f=s[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,a=u.length;o<a;++o)r.point((c=u[o])[0],c[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(h)for(u=d.p.z,o=u.length-1;o>=0;--o)r.point((c=u[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}u=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function Hk(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i<t;)r.n=n=e[i],n.p=r,r=n;r.n=n=e[0],n.p=r}}function Gk(e){return[_w(e[1],e[0]),Nw(e[2])]}function Yk(e){var t=e[0],n=e[1],i=ww(n);return[i*ww(t),i*Sw(t),Sw(n)]}function Vk(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Xk(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 Jk(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Qk(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Zk(e){var t=Cw(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Kk(e){return bw(e[0])<=hw?e[0]:Mw(e[0])*((bw(e[0])+hw)%gw-hw)}function eE(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function tE(e,t,n,i){return function(r){var o,a,s,l=t(r),u=Ik(),c=t(u),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=v,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,a=eE(a);var e=function(e,t){var n=Kk(t),i=t[1],r=Sw(i),o=[Sw(n),-ww(n),0],a=0,s=0,l=new cw;1===r?i=pw+fw:-1===r&&(i=-pw-fw);for(var u=0,c=e.length;u<c;++u)if(d=(f=e[u]).length)for(var f,d,h=f[d-1],p=Kk(h),m=h[1]/2+mw,g=Sw(m),y=ww(m),v=0;v<d;++v,p=x,g=w,y=k,h=b){var b=f[v],x=Kk(b),_=b[1]/2+mw,w=Sw(_),k=ww(_),E=x-p,A=E>=0?1:-1,$=A*E,D=$>hw,S=g*w;if(l.add(_w(S*A*Sw($),y*k+S*ww($))),a+=D?E+A*gw:E,D^p>=n^x>=n){var M=Xk(Yk(h),Yk(b));Zk(M);var C=Xk(o,M);Zk(C);var F=(D^E>=0?-1:1)*Nw(C[2]);(i>F||i===F&&(M[0]||M[1]))&&(s+=D^E>=0?1:-1)}}return(a<-fw||a<fw&&l<-dw)^1&s}(o,i);a.length?(f||(r.polygonStart(),f=!0),Wk(a,iE,e,n,r)):e&&(f||(r.polygonStart(),f=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),f&&(r.polygonEnd(),f=!1),a=o=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function h(t,n){e(t,n)&&r.point(t,n)}function p(e,t){l.point(e,t)}function m(){d.point=p,l.lineStart()}function g(){d.point=h,l.lineEnd()}function y(e,t){s.push([e,t]),c.point(e,t)}function v(){c.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),c.lineEnd();var e,t,n,i,l=c.clean(),d=u.result(),h=d.length;if(s.pop(),o.push(s),s=null,h)if(1&l){if((t=(n=d[0]).length-1)>0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e<t;++e)r.point((i=n[e])[0],i[1]);r.lineEnd()}}else h>1&&2&l&&d.push(d.pop().concat(d.shift())),a.push(d.filter(nE))}return d}}function nE(e){return e.length>1}function iE(e,t){return((e=e.x)[0]<0?e[1]-pw-fw:pw-e[1])-((t=t.x)[0]<0?t[1]-pw-fw:pw-t[1])}const rE=tE((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?hw:-hw,l=bw(o-n);bw(l-hw)<fw?(e.point(n,i=(i+a)/2>0?pw:-pw),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&l>=hw&&(bw(n-r)<fw&&(n-=r*fw),bw(o-s)<fw&&(o-=s*fw),i=function(e,t,n,i){var r,o,a=Sw(e-n);return bw(a)>fw?xw((Sw(t)*(o=ww(i))*Sw(n)-Sw(i)*(r=ww(t))*Sw(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*pw,i.point(-hw,r),i.point(0,r),i.point(hw,r),i.point(hw,0),i.point(hw,-r),i.point(0,-r),i.point(-hw,-r),i.point(-hw,0),i.point(-hw,r);else if(bw(e[0]-t[0])>fw){var o=e[0]<t[0]?hw:-hw;r=n*o/2,i.point(-o,r),i.point(0,r),i.point(o,r)}else i.point(t[0],t[1])}),[-hw,-pw]);function oE(e,t){(t=Yk(t))[0]-=e,Zk(t);var n=Ow(-t[1]);return((-t[2]<0?-n:n)+gw-fw)%gw}var aE=1e9,sE=-aE;function lE(e,t,n,i){function r(r,o){return e<=r&&r<=n&&t<=o&&o<=i}function o(r,o,s,u){var c=0,f=0;if(null==r||(c=a(r,s))!==(f=a(o,s))||l(r,o)<0^s>0)do{u.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else u.point(o[0],o[1])}function a(i,r){return bw(i[0]-e)<fw?r>0?0:3:bw(i[0]-n)<fw?r>0?2:1:bw(i[1]-t)<fw?r>0?1:0:r>0?3:2}function s(e,t){return l(e.x,t.x)}function l(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 l,u,c,f,d,h,p,m,g,y,v,b=a,x=Ik(),_={point:w,lineStart:function(){_.point=k,u&&u.push(c=[]),y=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(k(f,d),h&&g&&x.rejoin(),l.push(x.result())),_.point=w,g&&b.lineEnd()},polygonStart:function(){b=x,l=[],u=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=u.length;n<r;++n)for(var o,a,s=u[n],l=1,c=s.length,f=s[0],d=f[0],h=f[1];l<c;++l)o=d,a=h,d=(f=s[l])[0],h=f[1],a<=i?h>i&&(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=(l=eE(l)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&Wk(l,s,t,o,a),a.polygonEnd()),b=a,l=u=c=null}};function w(e,t){r(e,t)&&b.point(e,t)}function k(o,a){var s=r(o,a);if(u&&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 l=[p=Math.max(sE,Math.min(aE,p)),m=Math.max(sE,Math.min(aE,m))],x=[o=Math.max(sE,Math.min(aE,o)),a=Math.max(sE,Math.min(aE,a))];!function(e,t,n,i,r,o){var a,s=e[0],l=e[1],u=0,c=1,f=t[0]-s,d=t[1]-l;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a<u)return;a<c&&(c=a)}else if(f>0){if(a>c)return;a>u&&(u=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>u&&(u=a)}else if(f>0){if(a<u)return;a<c&&(c=a)}if(a=i-l,d||!(a>0)){if(a/=d,d<0){if(a<u)return;a<c&&(c=a)}else if(d>0){if(a>c)return;a>u&&(u=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>u&&(u=a)}else if(d>0){if(a<u)return;a<c&&(c=a)}return u>0&&(e[0]=s+u*f,e[1]=l+u*d),c<1&&(t[0]=s+c*f,t[1]=l+c*d),!0}}}}}(l,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return _}}function uE(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function cE(e,t){return bw(e)>hw&&(e-=Math.round(e/gw)*gw),[e,t]}function fE(e,t,n){return(e%=gw)?t||n?uE(hE(e),pE(t,n)):hE(e):t||n?pE(t,n):cE}function dE(e){return function(t,n){return bw(t+=e)>hw&&(t-=Math.round(t/gw)*gw),[t,n]}}function hE(e){var t=dE(e);return t.invert=dE(-e),t}function pE(e,t){var n=ww(e),i=Sw(e),r=ww(t),o=Sw(t);function a(e,t){var a=ww(t),s=ww(e)*a,l=Sw(e)*a,u=Sw(t),c=u*n+s*i;return[_w(l*r-c*o,s*n-u*i),Nw(c*r+l*o)]}return a.invert=function(e,t){var a=ww(t),s=ww(e)*a,l=Sw(e)*a,u=Sw(t),c=u*r-l*o;return[_w(l*r+u*o,s*n+c*i),Nw(c*n-s*i)]},a}function mE(e){return function(t){var n=new gE;for(var i in e)n[i]=e[i];return n.stream=t,n}}function gE(){}function yE(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),uw(n,e.stream(Zw)),t(Zw.result()),null!=i&&e.clipExtent(i),e}function vE(e,t,n){return yE(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 bE(e,t,n){return vE(e,[[0,0],t],n)}function xE(e,t,n){return yE(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 _E(e,t,n){return yE(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)}cE.invert=cE,gE.prototype={constructor:gE,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 wE=16,kE=ww(30*vw);function EE(e,t){return+t?function(e,t){function n(i,r,o,a,s,l,u,c,f,d,h,p,m,g){var y=u-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,_=s+h,w=l+p,k=Cw(x*x+_*_+w*w),E=Nw(w/=k),A=bw(bw(w)-1)<fw||bw(o-f)<fw?(o+f)/2:_w(_,x),$=e(A,E),D=$[0],S=$[1],M=D-i,C=S-r,F=v*M-y*C;(F*F/b>t||bw((y*M+v*C)/b-.5)>.3||a*d+s*h+l*p<kE)&&(n(i,r,o,a,s,l,D,S,A,x/=k,_/=k,w,m,g),g.point(D,S),n(D,S,A,x,_,w,u,c,f,d,h,p,m,g))}}return function(t){var i,r,o,a,s,l,u,c,f,d,h,p,m={point:g,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),m.lineStart=x},polygonEnd:function(){t.polygonEnd(),m.lineStart=y}};function g(n,i){n=e(n,i),t.point(n[0],n[1])}function y(){c=NaN,m.point=v,t.lineStart()}function v(i,r){var o=Yk([i,r]),a=e(i,r);n(c,f,u,d,h,p,c=a[0],f=a[1],u=i,d=o[0],h=o[1],p=o[2],wE,t),t.point(c,f)}function b(){m.point=g,t.lineEnd()}function x(){y(),m.point=_,m.lineEnd=w}function _(e,t){v(i=e,t),r=c,o=f,a=d,s=h,l=p,m.point=v}function w(){n(c,f,u,d,h,p,r,o,i,a,s,l,wE,t),m.lineEnd=b,b()}return m}}(e,t):function(e){return mE({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}var AE=mE({point:function(e,t){this.stream.point(e*vw,t*vw)}});function $E(e,t,n,i,r,o){if(!o)return function(e,t,n,i,r){function o(o,a){return[t+e*(o*=i),n-e*(a*=r)]}return o.invert=function(o,a){return[(o-t)/e*i,(n-a)/e*r]},o}(e,t,n,i,r);var a=ww(o),s=Sw(o),l=a*e,u=s*e,c=a/e,f=s/e,d=(s*n-a*t)/e,h=(s*t+a*n)/e;function p(e,o){return[l*(e*=i)-u*(o*=r)+t,n-u*e-l*o]}return p.invert=function(e,t){return[i*(c*e-f*t+d),r*(h-f*e-c*t)]},p}function DE(e){return SE((function(){return e}))()}function SE(e){var t,n,i,r,o,a,s,l,u,c,f=150,d=480,h=250,p=0,m=0,g=0,y=0,v=0,b=0,x=1,_=1,w=null,k=rE,E=null,A=iw,$=.5;function D(e){return l(e[0]*vw,e[1]*vw)}function S(e){return(e=l.invert(e[0],e[1]))&&[e[0]*yw,e[1]*yw]}function M(){var e=$E(f,0,0,x,_,b).apply(null,t(p,m)),i=$E(f,d-e[0],h-e[1],x,_,b);return n=fE(g,y,v),s=uE(t,i),l=uE(n,s),a=EE(s,$),C()}function C(){return u=c=null,D}return D.stream=function(e){return u&&c===e?u:u=AE(function(e){return mE({point:function(t,n){var i=e(t,n);return this.stream.point(i[0],i[1])}})}(n)(k(a(A(c=e)))))},D.preclip=function(e){return arguments.length?(k=e,w=void 0,C()):k},D.postclip=function(e){return arguments.length?(A=e,E=i=r=o=null,C()):A},D.clipAngle=function(e){return arguments.length?(k=+e?function(e){var t=ww(e),n=6*vw,i=t>0,r=bw(t)>fw;function o(e,n){return ww(e)*ww(n)>t}function a(e,n,i){var r=[1,0,0],o=Xk(Yk(e),Yk(n)),a=Vk(o,o),s=o[0],l=a-s*s;if(!l)return!i&&e;var u=t*a/l,c=-t*s/l,f=Xk(r,o),d=Qk(r,u);Jk(d,Qk(o,c));var h=f,p=Vk(d,h),m=Vk(h,h),g=p*p-m*(Vk(d,d)-1);if(!(g<0)){var y=Cw(g),v=Qk(h,(-p-y)/m);if(Jk(v,d),v=Gk(v),!i)return v;var b,x=e[0],_=n[0],w=e[1],k=n[1];_<x&&(b=x,x=_,_=b);var E=_-x,A=bw(E-hw)<fw;if(!A&&k<w&&(b=w,w=k,k=b),A||E<fw?A?w+k>0^v[1]<(bw(v[0]-x)<fw?w:k):w<=v[1]&&v[1]<=k:E>hw^(x<=v[0]&&v[0]<=_)){var $=Qk(h,(-p+y)/m);return Jk($,d),[v,Gk($)]}}}function s(t,n){var r=i?e:hw-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return tE(o,(function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!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?hw:-hw),d):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(h=a(t,p))||Uk(t,h)||Uk(p,h))&&(p[2]=1),m!==l)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&&Uk(t,p)||e.point(p[0],p[1]),t=p,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=ww(t),s=Sw(t),l=i*n;null==r?(r=t+i*gw,o=t-l/2):(r=oE(a,r),o=oE(a,o),(i>0?r<o:r>o)&&(r+=i*gw));for(var u,c=r;i>0?c>o:c<o;c-=l)u=Gk([a,-s*ww(c),-s*Sw(c)]),e.point(u[0],u[1])}}(o,e,n,r,t,i)}),i?[0,-e]:[-hw,e-hw])}(w=e*vw):(w=null,rE),C()):w*yw},D.clipExtent=function(e){return arguments.length?(A=null==e?(E=i=r=o=null,iw):lE(E=+e[0][0],i=+e[0][1],r=+e[1][0],o=+e[1][1]),C()):null==E?null:[[E,i],[r,o]]},D.scale=function(e){return arguments.length?(f=+e,M()):f},D.translate=function(e){return arguments.length?(d=+e[0],h=+e[1],M()):[d,h]},D.center=function(e){return arguments.length?(p=e[0]%360*vw,m=e[1]%360*vw,M()):[p*yw,m*yw]},D.rotate=function(e){return arguments.length?(g=e[0]%360*vw,y=e[1]%360*vw,v=e.length>2?e[2]%360*vw:0,M()):[g*yw,y*yw,v*yw]},D.angle=function(e){return arguments.length?(b=e%360*vw,M()):b*yw},D.reflectX=function(e){return arguments.length?(x=e?-1:1,M()):x<0},D.reflectY=function(e){return arguments.length?(_=e?-1:1,M()):_<0},D.precision=function(e){return arguments.length?(a=EE(s,$=e*e),C()):Cw($)},D.fitExtent=function(e,t){return vE(D,e,t)},D.fitSize=function(e,t){return bE(D,e,t)},D.fitWidth=function(e,t){return xE(D,e,t)},D.fitHeight=function(e,t){return _E(D,e,t)},function(){return t=e.apply(this,arguments),D.invert=t.invert&&S,M()}}function ME(e){var t=0,n=hw/3,i=SE(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*vw,n=e[1]*vw):[t*yw,n*yw]},r}function CE(e,t){var n=Sw(e),i=(n+Sw(t))/2;if(bw(i)<fw)return function(e){var t=ww(e);function n(e,n){return[e*t,Sw(n)/t]}return n.invert=function(e,n){return[e/t,Nw(n*t)]},n}(e);var r=1+n*(2*i-n),o=Cw(r)/i;function a(e,t){var n=Cw(r-2*i*Sw(t))/i;return[n*Sw(e*=i),o-n*ww(e)]}return a.invert=function(e,t){var n=o-t,a=_w(e,bw(n))*Mw(n);return n*i<0&&(a-=hw*Mw(e)*Mw(n)),[a/i,Nw((r-(e*e+n*n)*i*i)/(2*i))]},a}function FE(){return ME(CE).scale(155.424).center([0,33.6442])}function OE(){return FE().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function NE(e){return function(t,n){var i=ww(t),r=ww(n),o=e(i*r);return o===1/0?[2,0]:[o*r*Sw(t),o*Sw(n)]}}function TE(e){return function(t,n){var i=Cw(t*t+n*n),r=e(i),o=Sw(r),a=ww(r);return[_w(t*o,i*a),Nw(i&&n*o/i)]}}var zE=NE((function(e){return Cw(2/(1+e))}));zE.invert=TE((function(e){return 2*Nw(e/2)}));var RE=NE((function(e){return(e=Ow(e))&&e/Sw(e)}));function PE(e,t){return[e,$w(Fw((pw+t)/2))]}function LE(e){var t,n,i,r=DE(e),o=r.center,a=r.scale,s=r.translate,l=r.clipExtent,u=null;function c(){var o=hw*a(),s=r(function(e){function t(t){return(t=e(t[0]*vw,t[1]*vw))[0]*=yw,t[1]*=yw,t}return e=fE(e[0]*vw,e[1]*vw,e.length>2?e[2]*vw:0),t.invert=function(t){return(t=e.invert(t[0]*vw,t[1]*vw))[0]*=yw,t[1]*=yw,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===PE?[[Math.max(s[0]-o,u),t],[Math.min(s[0]+o,n),i]]:[[u,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?u=t=n=i=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==u?null:[[u,t],[n,i]]},c()}function BE(e){return Fw((pw+e)/2)}function jE(e,t){var n=ww(e),i=e===t?Sw(e):$w(n/ww(t))/$w(BE(t)/BE(e)),r=n*Dw(BE(e),i)/i;if(!i)return PE;function o(e,t){r>0?t<-pw+fw&&(t=-pw+fw):t>pw-fw&&(t=pw-fw);var n=r/Dw(BE(t),i);return[n*Sw(i*e),r-n*ww(i*e)]}return o.invert=function(e,t){var n=r-t,o=Mw(i)*Cw(e*e+n*n),a=_w(e,bw(n))*Mw(n);return n*i<0&&(a-=hw*Mw(e)*Mw(n)),[a/i,2*xw(Dw(r/o,1/i))-pw]},o}function IE(e,t){return[e,t]}function UE(e,t){var n=ww(e),i=e===t?Sw(e):(n-ww(t))/(t-e),r=n/i+e;if(bw(i)<fw)return IE;function o(e,t){var n=r-t,o=i*e;return[n*Sw(o),r-n*ww(o)]}return o.invert=function(e,t){var n=r-t,o=_w(e,bw(n))*Mw(n);return n*i<0&&(o-=hw*Mw(e)*Mw(n)),[o/i,r-Mw(i)*Cw(e*e+n*n)]},o}RE.invert=TE((function(e){return e})),PE.invert=function(e,t){return[e,2*xw(Ew(t))-pw]},IE.invert=IE;var qE=1.340264,WE=-.081106,HE=893e-6,GE=.003796,YE=Cw(3)/2;function VE(e,t){var n=Nw(YE*Sw(t)),i=n*n,r=i*i*i;return[e*ww(n)/(YE*(qE+3*WE*i+r*(7*HE+9*GE*i))),n*(qE+WE*i+r*(HE+GE*i))]}function XE(e,t){var n=ww(t),i=ww(e)*n;return[n*Sw(e)/i,Sw(t)/i]}function JE(e,t){var n=t*t,i=n*n;return[e*(.8707-.131979*n+i*(i*(.003971*n-.001529*i)-.013791)),t*(1.007226+n*(.015085+i*(.028874*n-.044475-.005916*i)))]}function QE(e,t){return[ww(t)*Sw(e),Sw(t)]}function ZE(e,t){var n=ww(t),i=1+ww(e)*n;return[n*Sw(e)/i,Sw(t)/i]}function KE(e,t){return[$w(Fw((pw+t)/2)),-e]}VE.invert=function(e,t){for(var n,i=t,r=i*i,o=r*r*r,a=0;a<12&&(o=(r=(i-=n=(i*(qE+WE*r+o*(HE+GE*r))-t)/(qE+3*WE*r+o*(7*HE+9*GE*r)))*i)*r*r,!(bw(n)<dw));++a);return[YE*e*(qE+3*WE*r+o*(7*HE+9*GE*r))/ww(i),Nw(Sw(i)/YE)]},XE.invert=TE(xw),JE.invert=function(e,t){var n,i=t,r=25;do{var o=i*i,a=o*o;i-=n=(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(bw(n)>fw&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},QE.invert=TE(Nw),ZE.invert=TE((function(e){return 2*xw(e)})),KE.invert=function(e,t){return[-t,2*xw(Ew(e))-pw]};var eA=Math.abs,tA=(Math.atan,Math.atan2,Math.ceil,Math.cos),nA=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),iA=(Math.tan,1e-6),rA=Math.PI,oA=rA/2,aA=(Math.SQRT1_2,lA(2));function sA(e){return e>1?oA:e<-1?-oA:Math.asin(e)}function lA(e){return e>0?Math.sqrt(e):0}function uA(e,t){var n,i=e*nA(t),r=30;do{t-=n=(t+nA(t)-i)/(1+tA(t))}while(eA(n)>iA&&--r>0);return t/2}lA(rA);var cA=function(e,t,n){function i(i,r){return[e*i*tA(r=uA(n,r)),t*nA(r)]}return i.invert=function(i,r){return r=sA(r/t),[i/(e*tA(r)),sA((2*r+nA(2*r))/n)]},i}(aA/oA,aA,rA);const fA=jk(),dA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function hA(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(mA[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=jk().projection(i),i.copy=i.copy||function(){const e=n();return dA.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},Hp(i)}}(e,t),this):mA[e]||null}function pA(e){return e&&e.path||fA}const mA={albers:OE,albersusa:function(){var e,t,n,i,r,o,a=OE(),s=FE().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=FE().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={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?l:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),l.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n<r;)i[n].point(e,t)},sphere:function(){for(var e=-1;++e<r;)i[e].sphere()},lineStart:function(){for(var e=-1;++e<r;)i[e].lineStart()},lineEnd:function(){for(var e=-1;++e<r;)i[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<r;)i[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<r;)i[e].polygonEnd()}});var i,r},c.precision=function(e){return arguments.length?(a.precision(e),s.precision(e),l.precision(e),f()):a.precision()},c.scale=function(e){return arguments.length?(a.scale(e),s.scale(.35*e),l.scale(e),c.translate(a.translate())):a.scale()},c.translate=function(e){if(!arguments.length)return a.translate();var t=a.scale(),o=+e[0],c=+e[1];return n=a.translate(e).clipExtent([[o-.455*t,c-.238*t],[o+.455*t,c+.238*t]]).stream(u),i=s.translate([o-.307*t,c+.201*t]).clipExtent([[o-.425*t+fw,c+.12*t+fw],[o-.214*t-fw,c+.234*t-fw]]).stream(u),r=l.translate([o-.205*t,c+.212*t]).clipExtent([[o-.214*t+fw,c+.166*t+fw],[o-.115*t-fw,c+.234*t-fw]]).stream(u),f()},c.fitExtent=function(e,t){return vE(c,e,t)},c.fitSize=function(e,t){return bE(c,e,t)},c.fitWidth=function(e,t){return xE(c,e,t)},c.fitHeight=function(e,t){return _E(c,e,t)},c.scale(1070)},azimuthalequalarea:function(){return DE(zE).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return DE(RE).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return ME(jE).scale(109.5).parallels([30,30])},conicequalarea:FE,conicequidistant:function(){return ME(UE).scale(131.154).center([0,13.9389])},equalEarth:function(){return DE(VE).scale(177.158)},equirectangular:function(){return DE(IE).scale(152.63)},gnomonic:function(){return DE(XE).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,i,r,o,a,s=1,l=0,u=0,c=1,f=1,d=0,h=null,p=1,m=1,g=mE({point:function(e,t){var n=b([e,t]);this.stream.point(n[0],n[1])}}),y=iw;function v(){return p=s*c,m=s*f,o=a=null,b}function b(n){var i=n[0]*p,r=n[1]*m;if(d){var o=r*e-i*t;i=i*e+r*t,r=o}return[i+l,r+u]}return b.invert=function(n){var i=n[0]-l,r=n[1]-u;if(d){var o=r*e+i*t;i=i*e-r*t,r=o}return[i/p,r/m]},b.stream=function(e){return o&&a===e?o:o=g(y(a=e))},b.postclip=function(e){return arguments.length?(y=e,h=n=i=r=null,v()):y},b.clipExtent=function(e){return arguments.length?(y=null==e?(h=n=i=r=null,iw):lE(h=+e[0][0],n=+e[0][1],i=+e[1][0],r=+e[1][1]),v()):null==h?null:[[h,n],[i,r]]},b.scale=function(e){return arguments.length?(s=+e,v()):s},b.translate=function(e){return arguments.length?(l=+e[0],u=+e[1],v()):[l,u]},b.angle=function(n){return arguments.length?(t=Sw(d=n%360*vw),e=ww(d),v()):d*yw},b.reflectX=function(e){return arguments.length?(c=e?-1:1,v()):c<0},b.reflectY=function(e){return arguments.length?(f=e?-1:1,v()):f<0},b.fitExtent=function(e,t){return vE(b,e,t)},b.fitSize=function(e,t){return bE(b,e,t)},b.fitWidth=function(e,t){return xE(b,e,t)},b.fitHeight=function(e,t){return _E(b,e,t)},b},mercator:function(){return LE(PE).scale(961/gw)},mollweide:function(){return DE(cA).scale(169.529)},naturalEarth1:function(){return DE(JE).scale(175.295)},orthographic:function(){return DE(QE).scale(249.5).clipAngle(90+fw)},stereographic:function(){return DE(ZE).scale(250).clipAngle(142)},transversemercator:function(){var e=LE(KE),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const e in mA)hA(e,mA[e]);function gA(e,t,n){var i=El(e,t-fw,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function yA(e,t,n){var i=El(e,t-fw,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}function vA(){}const bA=[[],[[[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 xA(){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,l,u,c,f,d=new Array,h=new Array;for(a=s=-1,u=n[0]>=i,bA[u<<1].forEach(p);++a<e-1;)l=u,u=n[a+1]>=i,bA[l|u<<1].forEach(p);for(bA[u<<0].forEach(p);++s<t-1;){for(a=-1,u=n[s*e+e]>=i,c=n[s*e]>=i,bA[u<<1|c<<2].forEach(p);++a<e-1;)l=u,u=n[s*e+e+a+1]>=i,f=c,c=n[s*e+a+1]>=i,bA[l|u<<1|c<<2|f<<3].forEach(p);bA[u|c<<3].forEach(p)}for(a=-1,c=n[s*e]>=i,bA[c<<2].forEach(p);++a<e-1;)f=c,c=n[s*e+a+1]>=i,bA[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],l=[e[1][0]+a,e[1][1]+s],u=o(i),c=o(l);(t=h[u])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(l),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(l),h[t.end=c]=t):(t=d[c])?(n=h[u])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(l),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=u]=t):d[u]=h[c]={start:u,end:c,ring:[i,l]}}bA[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)i+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return i}(e)>0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n<i;++n)if(-1!==_A((t=a[n])[0],e))return void t.push(e)})),{type:"MultiPolygon",value:r,coordinates:a}}function o(t){return 2*t[0]+t[1]*(e+1)*4}function a(n,i,r){n.forEach((n=>{var o,a=n[0],s=n[1],l=0|a,u=0|s,c=i[u*e+l];a>0&&a<e&&l===a&&(o=i[u*e+l-1],n[0]=a+(r-o)/(c-o)-.5),s>0&&s<t&&u===s&&(o=i[(u-1)*e+l],n[1]=s+(r-o)/(c-o)-.5)}))}return i.contour=r,i.size=function(n){if(!arguments.length)return[e,t];var r=Math.floor(n[0]),o=Math.floor(n[1]);return r>=0&&o>=0||oe("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:vA,i):n===a},i}function _A(e,t){for(var n,i=-1,r=t.length;++i<r;)if(n=wA(e,t[i]))return n;return 0}function wA(e,t){for(var n=t[0],i=t[1],r=-1,o=0,a=e.length,s=a-1;o<a;s=o++){var l=e[o],u=l[0],c=l[1],f=e[s],d=f[0],h=f[1];if(kA(l,f,t))return 0;c>i!=h>i&&n<(d-u)*(i-c)/(h-c)+u&&(r=-r)}return r}function kA(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 EA(e,t,n){return function(i){var r=rt(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,l=t?rn(o,a,e):s/(e+1);return El(o+l,a,l)}}function AA(e){ps.call(this,null,e)}function $A(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function l(e){e.forEach(u)}function u(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(l),e}}function DA(e,t,n){const i=e>=0?e:Cs(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function SA(e){return Ve(e)?e:tt(+e)}function MA(){var e=e=>e[0],t=e=>e[1],n=fe,i=[-1,-1],r=960,o=500,a=2;function s(s,l){const u=DA(i[0],s,e)>>a,c=DA(i[1],s,t)>>a,f=u?u+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<h&&o>=0&&o<p&&(m[r+o*h]+=+n(i))})),u>0&&c>0?(CA(h,p,m,g,u),FA(h,p,g,m,c),CA(h,p,m,g,u),FA(h,p,g,m,c),CA(h,p,m,g,u),FA(h,p,g,m,c)):u>0?(CA(h,p,m,g,u),CA(h,p,g,m,u),CA(h,p,m,g,u),y=g):c>0&&(FA(h,p,m,g,c),FA(h,p,g,m,c),FA(h,p,m,g,c),y=g);const v=l?Math.pow(2,-2*a):1/$_(y);for(let e=0,t=h*p;e<t;++e)y[e]*=v;return{values:y,scale:1<<a,width:h,height:p,x1:f,y1:d,x2:f+(r>>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=SA(t),s):e},s.y=function(e){return arguments.length?(t=SA(e),s):t},s.weight=function(e){return arguments.length?(n=SA(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||oe("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||oe("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),s):1<<a},s.bandwidth=function(e){return arguments.length?(1===(e=Ge(e)).length&&(e=[+e[0],+e[0]]),2!==e.length&&oe("invalid bandwidth"),i=e,s):i},s}function CA(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<t;++a)for(let t=0,s=0;t<e+r;++t)t<e&&(s+=n[t+a*e]),t>=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 FA(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<e;++a)for(let s=0,l=0;s<t+r;++s)s<t&&(l+=n[a+s*e]),s>=r&&(s>=o&&(l-=n[a+(s-o)*e]),i[a+(s-r)*e]=l/Math.min(s+1,t-1+o-s,o))}function OA(e){ps.call(this,null,e)}AA.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"}]},ft(AA,ps,{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||ue,o=xA().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const i=EA(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>vs(t(e).values))))}(i,r,e),s=null===e.as?null:e.as||"contour",l=[];return i.forEach((t=>{const n=r(t),i=o.size([n.width,n.height])(n.values,_e(a)?a:a(n.values));!function(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;if(Ve(r)&&(r=r(n,i)),Ve(o)&&(o=o(n,i)),(1===r||null==r)&&!o)return;const a=(gt(r)?r:r[0])||1,s=(gt(r)?r:r[1])||1,l=o&&o[0]||0,u=o&&o[1]||0;e.forEach($A(t,a,s,l,u))}(i,n,t,e),i.forEach((e=>{l.push(ja(t,La(null!=s?{[s]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n}}),OA.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 NA=["x","y","weight","size","cellSize","bandwidth"];function TA(e,t){return NA.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function zA(e){ps.call(this,null,e)}ft(OA,ps,{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,l=[],u=e=>e(o);if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(u)])||(n[a]=s=[],s.dims=a,l.push(s)),s.push(o);return l}(t.materialize(t.SOURCE).source,e.groupby),o=(e.groupby||[]).map(ee),a=TA(MA(),e),s=e.as||"grid";return n=r.map((t=>La(function(e,t){for(let n=0;n<o.length;++n)e[o[n]]=t[n];return e}({[s]:a(t,e.counts)},t.dims)))),this.value&&(i.rem=this.value),this.value=i.source=i.add=n,i}}),zA.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},ft(zA,ps,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),o=xA().smooth(!1!==e.smooth),a=e.values,s=e.thresholds||EA(e.count||10,e.nice,!!a),l=e.size;return a||(a=t.materialize(t.SOURCE).source,i=$A(n=TA(MA(),e)(a,!0),n.scale||1,n.scale||1,0,0),l=[n.width,n.height],a=n.values),s=_e(s)?s:s(a),a=o.size(l)(a,s),i&&a.forEach(i),this.value&&(r.rem=this.value),this.value=r.source=r.add=(a||[]).map(La),r}});const RA="Feature",PA="FeatureCollection";function LA(e){ps.call(this,null,e)}function BA(e){ps.call(this,null,e)}function jA(e){ps.call(this,null,e)}function IA(e){ps.call(this,null,e)}function UA(e){ps.call(this,[],e),this.generator=function(){var e,t,n,i,r,o,a,s,l,u,c,f,d=10,h=d,p=90,m=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return El(kw(i/p)*p,n,p).map(c).concat(El(kw(s/m)*m,a,m).map(f)).concat(El(kw(t/d)*d,e,d).filter((function(e){return bw(e%p)>fw})).map(l)).concat(El(kw(o/h)*h,r,h).filter((function(e){return bw(e%m)>fw})).map(u))}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,l=gA(o,r,90),u=yA(t,e,g),c=gA(s,a,90),f=yA(i,n,g),y):g},y.extentMajor([[-180,-90+fw],[180,90-fw]]).extentMinor([[-180,-80-fw],[180,80+fw]])}()}function qA(e){ps.call(this,null,e)}function WA(e){if(!Ve(e))return!1;const t=Ot(te(e));return t.$x||t.$y||t.$value||t.$max}function HA(e){ps.call(this,null,e),this.modified(!0)}function GA(e,t,n){Ve(e[t])&&e[t](n)}function YA(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,l,u,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((u=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|u]))return r[f]=p,e;if(s=+e._x.call(null,h.data),l=+e._y.call(null,h.data),t===s&&n===l)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),(u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|u)==(d=(l>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function VA(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function XA(e){return e[0]}function JA(e){return e[1]}function QA(e,t,n){var i=new ZA(null==t?XA:t,null==n?JA:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function ZA(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 KA(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}LA.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ft(LA,ps,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],l=e.geojson||!o&&ue,u=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(te(l))||a&&t.modified(te(a))||s&&t.modified(te(s)),this.value&&!n||(u=t.SOURCE,this._features=i=[],this._points=r=[]),l&&t.visit(u,(e=>i.push(l(e)))),a&&s&&(t.visit(u,(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:RA,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:PA,features:i}}}),BA.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"}]},ft(BA,ps,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||ue,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=pA(e.projection),n.materialize().reflow()):a=r===ue||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();return e.context(null),null!=t&&e.pointRadius(t),n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),jA.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"]}]},ft(jA,ps,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],l=a[1];function u(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[l]=t[1]):(e[s]=void 0,e[l]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,u):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,u)),t.modifies(a)}}),IA.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"}]},ft(IA,ps,{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}(pA(e.projection),e.field||se("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),UA.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}]},ft(UA,ps,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const t in e)Ve(r[t])&&r[t](e[t]);return n=r(),i.length?t.mod.push(Ia(i[0],n)):t.add.push(La(n)),i[0]=n,t}}),qA.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"}]},ft(qA,ps,{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||ue,o=function(e,t){let n;return Ve(e)?(n=n=>e(n,t),n.dep=WA(e)):e?n=tt(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}(e.opacity,e),a=function(e,t){let n;return Ve(e)?(n=n=>Bf(e(n,t)),n.dep=WA(e)):n=tt(Bf(e||"#888")),n}(e.color,e),s=e.as||"image",l={$x:0,$y:0,$value:0,$max:i?vs(n.map((e=>vs(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=it({},e,l);i||(n.$max=vs(t.values||[])),e[s]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,l=e.x2||r,u=e.y2||o,c=e.values,f=c?e=>c[e]:ce,d=ff(l-a,u-s),h=d.getContext("2d"),p=h.getImageData(0,0,l-a,u-s),m=p.data;for(let e=s,o=0;e<u;++e){t.$y=e-s;for(let s=a,u=e*r;s<l;++s,o+=4){t.$x=s-a,t.$value=f(s+u);const e=n(t);m[o+0]=e.r,m[o+1]=e.g,m[o+2]=e.b,m[o+3]=~~(255*i(t))}}return h.putImageData(p,0,0),d}(t,n,a.dep?a:tt(a(n)),o.dep?o:tt(o(n)))})),t.reflow(!0).modifies(s)}}),ft(HA,ps,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=function(e){const t=hA((e||"mercator").toLowerCase());return t||oe("Unrecognized projection type: "+e),t()}(e.type),dA.forEach((t=>{null!=e[t]&&GA(n,t,e[t])}))):dA.forEach((t=>{e.modified(t)&&GA(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return 1===(e=Ge(e)).length?e[0]:{type:PA,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===PA?e.features:Ge(e).filter((e=>null!=e)).map((e=>e.type===RA?e:{type:RA,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)}});var e$=QA.prototype=ZA.prototype;function t$(e){return function(){return e}}function n$(e){return 1e-6*(e()-.5)}function i$(e){return e.x+e.vx}function r$(e){return e.y+e.vy}e$.copy=function(){var e,t,n=new ZA(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=KA(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]=KA(t));return n},e$.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return YA(this.cover(t,n),t,n,e)},e$.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),l=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(a[n]=i,s[n]=r,i<l&&(l=i),i>c&&(c=i),r<u&&(u=r),r>f&&(f=r));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),n=0;n<o;++n)YA(this,a[n],s[n],e[n]);return this},e$.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var a,s,l=r-n||1,u=this._root;n>e||e>=r||i>t||t>=o;)switch(s=(t<i)<<1|e<n,(a=new Array(4))[s]=u,u=a,l*=2,s){case 0:r=n+l,o=i+l;break;case 1:n=r-l,o=i+l;break;case 2:r=n+l,i=o-l;break;case 3:n=r-l,i=o-l}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this},e$.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},e$.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},e$.find=function(e,t,n){var i,r,o,a,s,l,u,c=this._x0,f=this._y0,d=this._x1,h=this._y1,p=[],m=this._root;for(m&&p.push(new VA(m,c,f,d,h)),null==n?n=1/0:(c=e-n,f=t-n,d=e+n,h=t+n,n*=n);l=p.pop();)if(!(!(m=l.node)||(r=l.x0)>d||(o=l.y0)>h||(a=l.x1)<c||(s=l.y1)<f))if(m.length){var g=(r+a)/2,y=(o+s)/2;p.push(new VA(m[3],g,y,a,s),new VA(m[2],r,y,g,s),new VA(m[1],g,o,a,y),new VA(m[0],r,o,g,y)),(u=(t>=y)<<1|e>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=l)}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<n){var _=Math.sqrt(n=x);c=e-_,f=t-_,d=e+_,h=t+_,i=m.data}}return i},e$.remove=function(e){if(isNaN(o=+this._x.call(null,e))||isNaN(a=+this._y.call(null,e)))return this;var t,n,i,r,o,a,s,l,u,c,f,d,h=this._root,p=this._x0,m=this._y0,g=this._x1,y=this._y1;if(!h)return this;if(h.length)for(;;){if((u=o>=(s=(p+g)/2))?p=s:g=s,(c=a>=(l=(m+y)/2))?m=l:y=l,t=h,!(h=h[f=c<<1|u]))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)},e$.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},e$.root=function(){return this._root},e$.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},e$.visit=function(e){var t,n,i,r,o,a,s=[],l=this._root;for(l&&s.push(new VA(l,this._x0,this._y0,this._x1,this._y1));t=s.pop();)if(!e(l=t.node,i=t.x0,r=t.y0,o=t.x1,a=t.y1)&&l.length){var u=(i+o)/2,c=(r+a)/2;(n=l[3])&&s.push(new VA(n,u,c,o,a)),(n=l[2])&&s.push(new VA(n,i,c,u,a)),(n=l[1])&&s.push(new VA(n,u,r,o,c)),(n=l[0])&&s.push(new VA(n,i,r,u,c))}return this},e$.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new VA(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var o,a=t.x0,s=t.y0,l=t.x1,u=t.y1,c=(a+l)/2,f=(s+u)/2;(o=r[0])&&n.push(new VA(o,a,s,c,f)),(o=r[1])&&n.push(new VA(o,c,s,l,f)),(o=r[2])&&n.push(new VA(o,a,f,c,u)),(o=r[3])&&n.push(new VA(o,c,f,l,u))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},e$.x=function(e){return arguments.length?(this._x=e,this):this._x},e$.y=function(e){return arguments.length?(this._y=e,this):this._y};var o$={value:()=>{}};function a$(){for(var e,t=0,n=arguments.length,i={};t<n;++t){if(!(e=arguments[t]+"")||e in i||/[\s.]/.test(e))throw new Error("illegal type: "+e);i[e]=[]}return new s$(i)}function s$(e){this._=e}function l$(e,t){for(var n,i=0,r=e.length;i<r;++i)if((n=e[i]).name===t)return n.value}function u$(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=o$,e=e.slice(0,i).concat(e.slice(i+1));break}return null!=n&&e.push({name:t,value:n}),e}s$.prototype=a$.prototype={constructor:s$,on:function(e,t){var n,i,r=this._,o=(i=r,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<s;)if(n=(e=o[a]).type)r[n]=u$(r[n],e.name,t);else if(null==t)for(n in r)r[n]=u$(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=o[a]).type)&&(n=l$(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new s$(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),o=0;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=0,n=(i=this._[e]).length;o<n;++o)i[o].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)}};const c$=a$;var f$,d$,h$=0,p$=0,m$=0,g$=1e3,y$=0,v$=0,b$=0,x$="object"==typeof performance&&performance.now?performance:Date,_$="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function w$(){return v$||(_$(k$),v$=x$.now()+b$)}function k$(){v$=0}function E$(){this._call=this._time=this._next=null}function A$(e,t,n){var i=new E$;return i.restart(e,t,n),i}function $$(){v$=(y$=x$.now())+b$,h$=p$=0;try{!function(){w$(),++h$;for(var e,t=f$;t;)(e=v$-t._time)>=0&&t._call.call(void 0,e),t=t._next;--h$}()}finally{h$=0,function(){for(var e,t,n=f$,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:f$=t);d$=e,S$(i)}(),v$=0}}function D$(){var e=x$.now(),t=e-y$;t>g$&&(b$-=t,y$=e)}function S$(e){h$||(p$&&(p$=clearTimeout(p$)),e-v$>24?(e<1/0&&(p$=setTimeout($$,e-x$.now()-b$)),m$&&(m$=clearInterval(m$))):(m$||(y$=x$.now(),m$=setInterval(D$,g$)),h$=1,_$($$)))}E$.prototype=A$.prototype={constructor:E$,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?w$():+n)+(null==t?0:+t),this._next||d$===this||(d$?d$._next=this:f$=this,d$=this),this._call=e,this._time=n,S$()},stop:function(){this._call&&(this._call=null,this._time=1/0,S$())}};const M$=4294967296;function C$(e){return e.x}function F$(e){return e.y}var O$=Math.PI*(3-Math.sqrt(5));function N$(e){return e.index}function T$(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}const z$={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,l=0;for(r=0;r<a;++r)s+=(o=n[r]).x,l+=o.y;for(s=(s/a-e)*i,l=(l/a-t)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=l}return null==e&&(e=0),null==t&&(t=0),r.initialize=function(e){n=e},r.x=function(t){return arguments.length?(e=+t,r):e},r.y=function(e){return arguments.length?(t=+e,r):t},r.strength=function(e){return arguments.length?(i=+e,r):i},r},collide:function(e){var t,n,i,r=1,o=1;function a(){for(var e,a,l,u,c,f,d,h=t.length,p=0;p<o;++p)for(a=QA(t,i$,r$).visitAfter(s),e=0;e<h;++e)l=t[e],f=n[l.index],d=f*f,u=l.x+l.vx,c=l.y+l.vy,a.visit(m);function m(e,t,n,o,a){var s=e.data,h=e.r,p=f+h;if(!s)return t>u+p||o<u-p||n>c+p||a<c-p;if(s.index>l.index){var m=u-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;y<p*p&&(0===m&&(y+=(m=n$(i))*m),0===g&&(y+=(g=n$(i))*g),y=(p-(y=Math.sqrt(y)))/y*r,l.vx+=(m*=y)*(p=(h*=h)/(d+h)),l.vy+=(g*=y)*p,s.vx-=m*(p=1-p),s.vy-=g*p)}}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function l(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i<o;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=t$(null==e?1:+e)),a.initialize=function(e,n){t=e,i=n,l()},a.iterations=function(e){return arguments.length?(o=+e,a):o},a.strength=function(e){return arguments.length?(r=+e,a):r},a.radius=function(t){return arguments.length?(e="function"==typeof t?t:t$(+t),l(),a):e},a},nbody:function(){var e,t,n,i,r,o=t$(-30),a=1,s=1/0,l=.81;function u(n){var r,o=e.length,a=QA(e,C$,F$).visitAfter(f);for(i=n,r=0;r<o;++r)t=e[r],a.visit(d)}function c(){if(e){var t,n,i=e.length;for(r=new Array(i),t=0;t<i;++t)n=e[t],r[n.index]=+o(n,t,e)}}function f(e){var t,n,i,o,a,s=0,l=0;if(e.length){for(i=o=a=0;a<4;++a)(t=e[a])&&(n=Math.abs(t.value))&&(s+=t.value,l+=n,i+=n*t.x,o+=n*t.y);e.x=i/l,e.y=o/l}else{(t=e).x=t.data.x,t.y=t.data.y;do{s+=r[t.data.index]}while(t=t.next)}e.value=s}function d(e,o,u,c){if(!e.value)return!0;var f=e.x-t.x,d=e.y-t.y,h=c-o,p=f*f+d*d;if(h*h/l<p)return p<s&&(0===f&&(p+=(f=n$(n))*f),0===d&&(p+=(d=n$(n))*d),p<a&&(p=Math.sqrt(a*p)),t.vx+=f*e.value*i/p,t.vy+=d*e.value*i/p),!0;if(!(e.length||p>=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=n$(n))*f),0===d&&(p+=(d=n$(n))*d),p<a&&(p=Math.sqrt(a*p)));do{e.data!==t&&(h=r[e.data.index]*i/p,t.vx+=f*h,t.vy+=d*h)}while(e=e.next)}}return u.initialize=function(t,i){e=t,n=i,c()},u.strength=function(e){return arguments.length?(o="function"==typeof e?e:t$(+e),c(),u):o},u.distanceMin=function(e){return arguments.length?(a=e*e,u):Math.sqrt(a)},u.distanceMax=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u},link:function(e){var t,n,i,r,o,a,s=N$,l=function(e){return 1/Math.min(r[e.source.index],r[e.target.index])},u=t$(30),c=1;function f(i){for(var r=0,s=e.length;r<c;++r)for(var l,u,f,d,h,p,m,g=0;g<s;++g)u=(l=e[g]).source,d=(f=l.target).x+f.vx-u.x-u.vx||n$(a),h=f.y+f.vy-u.y-u.vy||n$(a),d*=p=((p=Math.sqrt(d*d+h*h))-n[g])/p*i*t[g],h*=p,f.vx-=d*(m=o[g]),f.vy-=h*m,u.vx+=d*(m=1-m),u.vy+=h*m}function d(){if(i){var a,l,u=i.length,c=e.length,f=new Map(i.map(((e,t)=>[s(e,t,i),e])));for(a=0,r=new Array(u);a<c;++a)(l=e[a]).index=a,"object"!=typeof l.source&&(l.source=T$(f,l.source)),"object"!=typeof l.target&&(l.target=T$(f,l.target)),r[l.source.index]=(r[l.source.index]||0)+1,r[l.target.index]=(r[l.target.index]||0)+1;for(a=0,o=new Array(c);a<c;++a)l=e[a],o[a]=r[l.source.index]/(r[l.source.index]+r[l.target.index]);t=new Array(c),h(),n=new Array(c),p()}}function h(){if(i)for(var n=0,r=e.length;n<r;++n)t[n]=+l(e[n],n,e)}function p(){if(i)for(var t=0,r=e.length;t<r;++t)n[t]=+u(e[t],t,e)}return null==e&&(e=[]),f.initialize=function(e,t){i=e,a=t,d()},f.links=function(t){return arguments.length?(e=t,d(),f):e},f.id=function(e){return arguments.length?(s=e,f):s},f.iterations=function(e){return arguments.length?(c=+e,f):c},f.strength=function(e){return arguments.length?(l="function"==typeof e?e:t$(+e),h(),f):l},f.distance=function(e){return arguments.length?(u="function"==typeof e?e:t$(+e),p(),f):u},f},x:function(e){var t,n,i,r=t$(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vx+=(i[o]-r.x)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=t$(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:t$(+e),a(),o):r},o.x=function(t){return arguments.length?(e="function"==typeof t?t:t$(+t),a(),o):e},o},y:function(e){var t,n,i,r=t$(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vy+=(i[o]-r.y)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=t$(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:t$(+e),a(),o):r},o.y=function(t){return arguments.length?(e="function"==typeof t?t:t$(+t),a(),o):e},o}},R$="forces",P$=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],L$=["static","iterations"],B$=["x","y","vx","vy"];function j$(e){ps.call(this,null,e)}function I$(e,t,n,i){var r,o,a,s,l=Ge(t.forces);for(r=0,o=P$.length;r<o;++r)(a=P$[r])!==R$&&t.modified(a)&&e[a](t[a]);for(r=0,o=l.length;r<o;++r)s=R$+r,(a=n||t.modified(R$,r)?q$(l[r]):i&&U$(l[r],i)?e.force(s):null)&&e.force(s,a);for(o=e.numForces||0;r<o;++r)e.force(R$+r,null);return e.numForces=l.length,e}function U$(e,t){var n,i;for(n in e)if(Ve(i=e[n])&&t.modified(te(i)))return 1;return 0}function q$(e){var t,n;for(n in st(z$,e.force)||oe("Unrecognized force: "+e.force),t=z$[e.force](),e)Ve(t[n])&&W$(t[n],e[n],e);return t}function W$(e,t,n){e(Ve(t)?e=>t(e,n):t)}function H$(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function G$(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=V$)):void 0===t&&(t=Y$);for(var n,i,r,o,a,s=new Q$(e),l=[s];n=l.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new Q$(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(J$)}function Y$(e){return e.children}function V$(e){return Array.isArray(e)?e[1]:null}function X$(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function J$(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function Q$(e){this.data=e,this.depth=this.height=0,this.parent=null}function Z$(e){return null==e?null:K$(e)}function K$(e){if("function"!=typeof e)throw new Error;return e}function eD(){return 0}function tD(e){return function(){return e}}j$.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:B$}]},ft(j$,ps,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(P$),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&I$(r,e,0,t)):(this.value=r=function(e,t){const n=function(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,l=A$(f),u=c$("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%M$)/M$}();function f(){d(),u.call("tick",t),n<i&&(l.stop(),u.call("end",t))}function d(i){var l,u,c=e.length;void 0===i&&(i=1);for(var f=0;f<i;++f)for(n+=(o-n)*r,s.forEach((function(e){e(n)})),l=0;l<c;++l)null==(u=e[l]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function h(){for(var t,n=0,i=e.length;n<i;++n){if((t=e[n]).index=n,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(.5+n),o=n*O$;t.x=r*Math.cos(o),t.y=r*Math.sin(o)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(e,c),t}return null==e&&(e=[]),h(),t={tick:d,restart:function(){return l.restart(f),t},stop:function(){return l.stop(),t},nodes:function(n){return arguments.length?(e=n,h(),s.forEach(p),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(i=+e,t):i},alphaDecay:function(e){return arguments.length?(r=+e,t):+r},alphaTarget:function(e){return arguments.length?(o=+e,t):o},velocityDecay:function(e){return arguments.length?(a=1-e,t):1-a},randomSource:function(e){return arguments.length?(c=e,s.forEach(p),t):c},force:function(e,n){return arguments.length>1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,l,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(a=(r=t-(s=e[u]).x)*r+(o=n-s.y)*o)<i&&(l=s,i=a);return l},on:function(e,n){return arguments.length>1?(u.on(e,n),t):u.on(e)}}}(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),I$(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(L$)||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 e,t=this._argops,s=0,l=t.length;s<l;++s)if(e=t[s],e.name===R$&&"link"===e.op._argval.force)for(var i,r=e.op._argops,o=0,a=r.length;o<a;++o)if("links"===r[o].name&&(i=r[o].op.source)){n.pulse(i,n.changeset().reflow());break}return t.reflow(e.modified()).modifies(B$)}}),Q$.prototype=G$.prototype={constructor:Q$,count:function(){return this.eachAfter(H$)},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=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)e.call(t,o,++l,this);return this},eachBefore:function(e,t){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(e.call(t,r,++a,this),n=r.children)for(i=n.length-1;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;for(e=n.pop(),t=i.pop();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 G$(this).eachBefore(X$)},[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;n<i;++n)o.push(t[n])}while(o.length)}};const nD=4294967296;function iD(e,t){var n,i;if(aD(t,e))return[t];for(n=0;n<e.length;++n)if(rD(t,e[n])&&aD(lD(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(i=n+1;i<e.length;++i)if(rD(lD(e[n],e[i]),t)&&rD(lD(e[n],t),e[i])&&rD(lD(e[i],t),e[n])&&aD(uD(e[n],e[i],t),e))return[e[n],e[i],t];throw new Error}function rD(e,t){var n=e.r-t.r,i=t.x-e.x,r=t.y-e.y;return n<0||n*n<i*i+r*r}function oD(e,t){var n=e.r-t.r+1e-9*Math.max(e.r,t.r,1),i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function aD(e,t){for(var n=0;n<t.length;++n)if(!oD(e,t[n]))return!1;return!0}function sD(e){switch(e.length){case 1:return{x:(t=e[0]).x,y:t.y,r:t.r};case 2:return lD(e[0],e[1]);case 3:return uD(e[0],e[1],e[2])}var t}function lD(e,t){var n=e.x,i=e.y,r=e.r,o=t.x,a=t.y,s=t.r,l=o-n,u=a-i,c=s-r,f=Math.sqrt(l*l+u*u);return{x:(n+o+l/f*c)/2,y:(i+a+u/f*c)/2,r:(f+r+s)/2}}function uD(e,t,n){var i=e.x,r=e.y,o=e.r,a=t.x,s=t.y,l=t.r,u=n.x,c=n.y,f=n.r,d=i-a,h=i-u,p=r-s,m=r-c,g=l-o,y=f-o,v=i*i+r*r-o*o,b=v-a*a-s*s+l*l,x=v-u*u-c*c+f*f,_=h*p-d*m,w=(p*x-m*b)/(2*_)-i,k=(m*g-p*y)/_,E=(h*b-d*x)/(2*_)-r,A=(d*y-h*g)/_,$=k*k+A*A-1,D=2*(o+w*k+E*A),S=w*w+E*E-o*o,M=-(Math.abs($)>1e-6?(D+Math.sqrt(D*D-4*$*S))/(2*$):S/D);return{x:i+w+k*M,y:r+E+A*M,r:M}}function cD(e,t,n){var i,r,o,a,s=e.x-t.x,l=e.y-t.y,u=s*s+l*l;u?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(u+a-r)/(2*u),o=Math.sqrt(Math.max(0,a/u-i*i)),n.x=e.x-i*s-o*l,n.y=e.y-i*l+o*s):(i=(u+r-a)/(2*u),o=Math.sqrt(Math.max(0,r/u-i*i)),n.x=t.x+i*s-o*l,n.y=t.y+i*l+o*s)):(n.x=t.x+n.r,n.y=t.y)}function fD(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 dD(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 hD(e){this._=e,this.next=null,this.previous=null}function pD(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,l,u,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;cD(i,n,r=e[2]),n=new hD(n),i=new hD(i),r=new hD(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(l=3;l<o;++l){cD(n._,i._,r=e[l]),r=new hD(r),u=i.next,c=n.previous,f=i._.r,d=n._.r;do{if(f<=d){if(fD(u._,r._)){i=u,n.next=i,i.previous=n,--l;continue e}f+=u._.r,u=u.next}else{if(fD(c._,r._)){(n=c).next=i,i.previous=n,--l;continue e}d+=c._.r,c=c.previous}}while(u!==c.next);for(r.previous=n,r.next=i,n.next=i.previous=i=r,a=dD(n);(r=r.next)!==i;)(s=dD(r))<a&&(n=r,a=s);i=n.next}for(n=[i._],r=i;(r=r.next)!==i;)n.push(r._);for(r=function(e,t){for(var n,i,r=0,o=(e=function(e,t){let n,i,r=e.length;for(;r;)i=t()*r--|0,n=e[r],e[r]=e[i],e[i]=n;return e}(Array.from(e),t)).length,a=[];r<o;)n=e[r],i&&oD(i,n)?++r:(i=sD(a=iD(a,n)),r=0);return i}(n,t),l=0;l<o;++l)(n=e[l]).x-=r.x,n.y-=r.y;return r.r}function mD(e){return Math.sqrt(e.value)}function gD(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function yD(e,t,n){return function(i){if(r=i.children){var r,o,a,s=r.length,l=e(i)*t||0;if(l)for(o=0;o<s;++o)r[o].r+=l;if(a=pD(r,n),l)for(o=0;o<s;++o)r[o].r-=l;i.r=a+l}}}function vD(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function bD(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function xD(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(i-t)/e.value;++s<l;)(o=a[s]).y0=n,o.y1=r,o.x0=t,o.x1=t+=o.value*u}var _D={depth:-1},wD={},kD={};function ED(e){return e.id}function AD(e){return e.parentId}function $D(){var e,t=ED,n=AD;function i(i){var r,o,a,s,l,u,c,f,d=Array.from(i),h=t,p=n,m=new Map;if(null!=e){const t=d.map(((t,n)=>function(e){let t=(e=`${e}`).length;return SD(e,t-1)&&!SD(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(DD),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(DD(e)),d.push(kD));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a<r;++a)o=d[a],u=d[a]=new Q$(o),null!=(c=h(o,a,i))&&(c+="")&&(f=u.id=c,m.set(f,m.has(f)?wD:u)),null!=(c=p(o,a,i))&&(c+="")&&(u.parent=c);for(a=0;a<r;++a)if(c=(u=d[a]).parent){if(!(l=m.get(c)))throw new Error("missing: "+c);if(l===wD)throw new Error("ambiguous: "+c);l.children?l.children.push(u):l.children=[u],u.parent=l}else{if(s)throw new Error("multiple roots");s=u}if(!s)throw new Error("no root");if(null!=e){for(;s.data===kD&&1===s.children.length;)s=s.children[0],--r;for(let e=d.length-1;e>=0&&(u=d[e]).data===kD;--e)u.data=null}if(s.parent=_D,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(J$),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=Z$(e),i):t},i.parentId=function(e){return arguments.length?(n=Z$(e),i):n},i.path=function(t){return arguments.length?(e=Z$(t),i):e},i}function DD(e){let t=e.length;if(t<2)return"";for(;--t>1&&!SD(e,t););return e.slice(0,t)}function SD(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function MD(e,t){return e.parent===t.parent?1:2}function CD(e){var t=e.children;return t?t[0]:e.t}function FD(e){var t=e.children;return t?t[t.length-1]:e.t}function OD(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 ND(e,t,n){return e.a.parent===t.parent?e.a:n}function TD(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 zD(e,t){return e.parent===t.parent?1:2}function RD(e,t){return e+t.x}function PD(e,t){return Math.max(e,t.y)}function LD(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(r-n)/e.value;++s<l;)(o=a[s]).x0=t,o.x1=i,o.y0=n,o.y1=n+=o.value*u}TD.prototype=Object.create(Q$.prototype);var BD=(1+Math.sqrt(5))/2;function jD(e,t,n,i,r,o){for(var a,s,l,u,c,f,d,h,p,m,g,y=[],v=t.children,b=0,x=0,_=v.length,w=t.value;b<_;){l=r-n,u=o-i;do{c=v[x++].value}while(!c&&x<_);for(f=d=c,g=c*c*(m=Math.max(u/l,l/u)/(w*e)),p=Math.max(d/g,g/f);x<_;++x){if(c+=s=v[x].value,s<f&&(f=s),s>d&&(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:l<u,children:v.slice(b,x)}),a.dice?xD(a,n,i,r,w?i+=u*c/w:o):LD(a,n,i,w?n+=l*c/w:r,o),w-=c,b=x}return y}const ID=function e(t){function n(e,n,i,r,o){jD(t,e,n,i,r,o)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(BD),UD=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,l,u,c,f=-1,d=a.length,h=e.value;++f<d;){for(l=(s=a[f]).children,u=s.value=0,c=l.length;u<c;++u)s.value+=l[u].value;s.dice?xD(s,n,i,r,h?i+=(o-i)*s.value/h:o):LD(s,n,i,h?n+=(r-n)*s.value/h:r,o),h-=s.value}else e._squarify=a=jD(t,e,n,i,r,o),a.ratio=t}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(BD);function qD(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function WD(e){ps.call(this,null,e)}WD.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const HD=e=>e.values;function GD(){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 l,u,c,f=-1;for(;++f<r;)l=o(u=t[f])+"",(c=a[l])?c.push(u):a[l]=[u];for(l in a)s[l]=n(a[l],i);return s}function i(t,n){if(++n>e.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function YD(e){ps.call(this,null,e)}ft(WD,ps,{transform(e,t){t.source||oe("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&&za(e.data)&&r.rem.push(e.data)})),this.value=o=G$({values:Ge(e.keys).reduce(((e,t)=>(e.key(t),e)),GD()).entries(r.source)},HD),n&&o.each((e=>{e.children&&(e=La(e.data),r.add.push(e),r.source.push(e))})),qD(o,Ra,Ra)),r.source.root=o,r}});const VD=(e,t)=>e.parent===t.parent?1:2;ft(YD,ps,{transform(e,t){t.source&&t.source.root||oe(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(Ua(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;r<o;++r)i=t[r],i in n&&e[i](n[i])}(n,this.params,e),n.separation&&n.separation(!1!==e.separation?VD:fe);try{this.value=n(r)}catch(e){oe(e)}return r.each((e=>function(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o<r;++o)i[n[o]]=e[t[o]];i[n[r]]=e.children?e.children.length:0}(e,i,o))),t.reflow(e.modified()).modifies(o).modifies("leaf")}});const XD=["x","y","r","depth","children"];function JD(e){YD.call(this,e)}JD.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:XD.length,default:XD}]},ft(JD,YD,{layout:function(){var e=null,t=1,n=1,i=eD;function r(r){const o=function(){let e=1;return()=>(e=(1664525*e+1013904223)%nD)/nD}();return r.x=t/2,r.y=n/2,e?r.eachBefore(gD(e)).eachAfter(yD(i,.5,o)).eachBefore(vD(1)):r.eachBefore(gD(mD)).eachAfter(yD(eD,1,o)).eachAfter(yD(i,r.r/Math.min(t,n),o)).eachBefore(vD(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=Z$(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:tD(+e),r):i},r},params:["radius","size","padding"],fields:XD});const QD=["x0","y0","x1","y1","depth","children"];function ZD(e){YD.call(this,e)}function KD(e){ps.call(this,null,e)}ZD.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:QD.length,default:QD}]},ft(ZD,YD,{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&&xD(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<r&&(r=a=(r+a)/2),s<o&&(o=s=(o+s)/2),i.x0=r,i.y0=o,i.x1=a,i.y1=s}}(t,o)),i&&r.eachBefore(bD),r}return r.round=function(e){return arguments.length?(i=!!e,r):i},r.size=function(n){return arguments.length?(e=+n[0],t=+n[1],r):[e,t]},r.padding=function(e){return arguments.length?(n=+e,r):n},r},params:["size","round","padding"],fields:QD}),KD.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},ft(KD,ps,{transform(e,t){t.source||oe("Stratify transform requires an upstream data source.");let n=this.value;const i=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),o=!n||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),o&&(n=r.source.length?qD($D().id(e.key).parentId(e.parentKey)(r.source),e.key,de):qD($D()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});const eS={tidy:function(){var e=MD,t=1,n=1,i=null;function r(r){var l=function(e){for(var t,n,i,r,o,a=new TD(e,0),s=[a];t=s.pop();)if(i=t._.children)for(t.children=new Array(o=i.length),r=o-1;r>=0;--r)s.push(n=t.children[r]=new TD(i[r],r)),n.parent=t;return(a.parent=new TD(null,0)).children=[a],a}(r);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),i)r.eachBefore(s);else{var u=r,c=r,f=r;r.eachBefore((function(e){e.x<u.x&&(u=e),e.x>c.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=u===c?1:e(u,c)/2,h=d-u.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,l=o.parent.children[0],u=o.m,c=a.m,f=s.m,d=l.m;s=FD(s),o=CD(o),s&&o;)l=CD(l),(a=FD(a)).a=t,(r=s.z+f-o.z-u+e(s._,o._))>0&&(OD(ND(s,t,i),t,r),u+=r,c+=r),f+=s.m,u+=o.m,d+=l.m,c+=a.m;s&&!FD(a)&&(a.t=s,a.m+=f-c),o&&!CD(l)&&(l.t=o,l.m+=u-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=zD,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(RD,0)/e.length}(n),t.y=function(e){return 1+e.reduce(PD,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),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),u=s.x-e(s,l)/2,c=l.x+e(l,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-u)/(c-u)*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}},tS=["x","y","depth","children"];function nS(e){YD.call(this,e)}function iS(e){ps.call(this,[],e)}nS.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:tS.length,default:tS}]},ft(nS,YD,{layout(e){const t=e||"tidy";if(st(eS,t))return eS[t]();oe("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:tS}),iS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ft(iS,ps,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||oe("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[Ra(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[Ra(t)]&&o[Ra(n)]&&r.add.push(La({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[Ra(e)]=1)),n.forEach((e=>{(o[Ra(e.source)]||o[Ra(e.target)])&&r.mod.push(e)}))),r}});const rS={binary:function(e,t,n,i,r){var o,a,s=e.children,l=s.length,u=new Array(l+1);for(u[0]=a=o=0;o<l;++o)u[o+1]=a+=s[o].value;!function e(t,n,i,r,o,a,l){if(t>=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=l)}for(var f=u[t],d=i/2+f,h=t+1,p=n-1;h<p;){var m=h+p>>>1;u[m]<d?h=m+1:p=m}d-u[h-1]<u[h]-d&&t+1<h&&--h;var g=u[h]-f,y=i-g;if(a-r>l-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,l),e(h,n,y,v,o,a,l)}else{var b=i?(o*y+l*g)/i:l;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,l)}}(0,l,e.value,t,n,i,r)},dice:xD,slice:LD,slicedice:function(e,t,n,i,r){(1&e.depth?LD:xD)(e,t,n,i,r)},squarify:ID,resquarify:UD},oS=["x0","y0","x1","y1","depth","children"];function aS(e){YD.call(this,e)}aS.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:oS.length,default:oS}]},ft(aS,YD,{layout(){const e=function(){var e=ID,t=!1,n=1,i=1,r=[0],o=eD,a=eD,s=eD,l=eD,u=eD;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(bD),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<i&&(i=f=(i+f)/2),d<c&&(c=d=(c+d)/2),t.x0=i,t.y0=c,t.x1=f,t.y1=d,t.children&&(n=r[t.depth+1]=o(t)/2,i+=u(t)-n,c+=a(t)-n,(f-=s(t)-n)<i&&(i=f=(i+f)/2),(d-=l(t)-n)<c&&(c=d=(c+d)/2),e(t,i,c,f,d))}return c.round=function(e){return arguments.length?(t=!!e,c):t},c.size=function(e){return arguments.length?(n=+e[0],i=+e[1],c):[n,i]},c.tile=function(t){return arguments.length?(e=K$(t),c):e},c.padding=function(e){return arguments.length?c.paddingInner(e).paddingOuter(e):c.paddingInner()},c.paddingInner=function(e){return arguments.length?(o="function"==typeof e?e:tD(+e),c):o},c.paddingOuter=function(e){return arguments.length?c.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):c.paddingTop()},c.paddingTop=function(e){return arguments.length?(a="function"==typeof e?e:tD(+e),c):a},c.paddingRight=function(e){return arguments.length?(s="function"==typeof e?e:tD(+e),c):s},c.paddingBottom=function(e){return arguments.length?(l="function"==typeof e?e:tD(+e),c):l},c.paddingLeft=function(e){return arguments.length?(u="function"==typeof e?e:tD(+e),c):u},c}();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{st(rS,t)?e.tile(rS[t]):oe("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:oS});const sS=4278190080;function lS(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function uS(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>uS(e,t.items,n)))})):Cv[i].draw(e,{items:n?t.map(cS):t})}function cS(e){const t=ja(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const fS=5,dS=31,hS=32,pS=new Uint32Array(hS+1),mS=new Uint32Array(hS+1);mS[0]=0,pS[0]=~mS[0];for(let e=1;e<=hS;++e)mS[e]=mS[e-1]<<1|1,pS[e]=~mS[e];function gS(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 yS(e,t,n,i,r,o,a,s){const l=r*o/(2*i),u=e(t-l),c=e(t+l),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(u,f,c,d)||a.getRange(u,f,c,d)||s&&s.getRange(u,f,c,d)}const vS=[-1,-1,1,1],bS=[-1,1,-1,1],xS=["right","center","left"],_S=["bottom","middle","top"];function wS(e,t,n,i,r,o,a,s,l,u,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const kS={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},ES={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=cv.width(e.datum,e.datum.text);let l,u,c,f,d,h,p,m=0;for(let i=0;i<n;++i)l=t[i].x,c=t[i].y,u=void 0===t[i].x2?l:t[i].x2,f=void 0===t[i].y2?c:t[i].y2,d=(l+u)/2,h=(c+f)/2,p=Math.abs(u-l+f-c),p>=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,l=e.x-d,u=e.x+d,c=e.y-h,f=e.y+h,e.align="center",l<0&&u<=r?e.align="left":0<=l&&r<u&&(e.align="right"),e.baseline="middle",c<0&&f<=o?e.baseline="top":0<=c&&o<f&&(e.baseline="bottom"),!0}},"reduced-search":function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1];function l(t,n,i,l,u){const c=e.invert(t),f=e.invert(n);let d,h=i,p=o;if(!gS(c,f,l,u,r,o)&&!yS(e,c,f,u,l,h,a,s)&&!yS(e,c,f,u,l,u,a,null)){for(;p-h>=1;)d=(h+p)/2,yS(e,c,f,u,l,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,u=s.length,c=t.datum.fontSize,f=cv.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,_,w,k,E,A,$,D,S,M=n?c:0,C=!1,F=!1,O=0;for(let i=0;i<u;++i){for(d=s[i].x,p=s[i].y,h=void 0===s[i].x2?d:s[i].x2,m=void 0===s[i].y2?p:s[i].y2,d>h&&(S=d,d=h,h=S),p>m&&(S=p,p=m,m=S),x=e(d),w=e(h),_=~~((x+w)/2),k=e(p),A=e(m),E=~~((k+A)/2),v=_;v>=x;--v)for(b=E;b>=k;--b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);for(v=_;v<=w;++v)for(b=E;b<=A;++b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);C||n||($=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,$>=O&&!gS(g,y,f,c,r,o)&&!yS(e,g,y,c,f,c,a,null)&&(O=$,t.x=g,t.y=y,F=!0))}return!(!C&&!F||(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],l=e.bitmap();return function(t){const u=t.datum.datum.items[i].items,c=u.length,f=t.datum.fontSize,d=cv.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,_,w,k,E,A,$=n?f:0,D=!1,S=!1,M=0;for(let i=0;i<c;++i){for(p=u[i].x,g=u[i].y,m=void 0===u[i].x2?p:u[i].x2,y=void 0===u[i].y2?g:u[i].y2,h.push([e((p+m)/2),e((g+y)/2)]);h.length;)if([x,_]=h.pop(),!(a.get(x,_)||s.get(x,_)||l.get(x,_))){l.set(x,_);for(let e=0;e<4;++e)v=x+vS[e],b=_+bS[e],l.outOfBounds(v,b,v,b)||h.push([v,b]);if(v=e.invert(x),b=e.invert(_),w=$,k=o,!gS(v,b,d,f,r,o)&&!yS(e,v,b,f,d,w,a,s)&&!yS(e,v,b,f,d,f,a,null)){for(;k-w>=1;)E=(w+k)/2,yS(e,v,b,f,d,E,a,s)?k=E:w=E;w>$&&(t.x=v,t.y=b,$=w,D=!0)}}D||n||(A=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,A>=M&&!gS(v,b,d,f,r,o)&&!yS(e,v,b,f,d,f,a,null)&&(M=A,t.x=v,t.y=b,S=!0))}return!(!D&&!S||(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 AS(e,t,n,i,r,o,a,s,l,u,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 t=0;t<i;++t)n[t]=e[t]||0;for(let e=i;e<t;++e)n[e]=n[i-1];return n}(i,f),h=function(e,t){const n=new Int8Array(t),i=e.length;for(let t=0;t<i;++t)n[t]|=kS[e[t]];for(let e=i;e<t;++e)n[e]=n[i-1];return n}(r,f),p=(x=e[0].datum)&&x.mark&&x.mark.marktype,m="group"===p&&e[0].datum.items[l].marktype,g="area"===m,y=function(e,t,n,i){const r=e=>[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,l),v=null===u||u===1/0,b=g&&"naive"===c;var x;let _=-1,w=-1;const k=e.map((e=>{const t=v?cv.width(e,e.text):void 0;return _=Math.max(_,t),w=Math.max(w,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));u=null===u||u===1/0?Math.max(_,w)+Math.max(...i):u;const E=function(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+hS)/hS));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>>>fS]&1<<(r&dS)},set:(t,n)=>{const r=n*e+t;i(r>>>fS,1<<(r&dS))},clear:(t,n)=>{const i=n*e+t;r(i>>>fS,~(1<<(i&dS)))},getRange:(t,i,r,o)=>{let a,s,l,u,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,l=a>>>fS,u=s>>>fS,l===u){if(n[l]&pS[a&dS]&mS[1+(s&dS)])return!0}else{if(n[l]&pS[a&dS])return!0;if(n[u]&mS[1+(s&dS)])return!0;for(let e=l+1;e<u;++e)if(n[e])return!0}return!1},setRange:(t,n,r,o)=>{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,l=a>>>fS,u=s>>>fS,l===u)i(l,pS[a&dS]&mS[1+(s&dS)]);else for(i(l,pS[a&dS]),i(u,mS[1+(s&dS)]),c=l+1;c<u;++c)i(c,4294967295)},clearRange:(t,n,i,o)=>{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,l=a>>>fS,u=s>>>fS,l===u)r(l,mS[a&dS]|pS[1+(s&dS)]);else for(r(l,mS[a&dS]),r(u,pS[1+(s&dS)]),c=l+1;c<u;++c)r(c,0)},outOfBounds:(n,i,r,o)=>n<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}(t[0],t[1],u);let A;if(!b){n&&k.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;e<h.length&&!t;++e)t=5===h[e]||d[e]<0;const i=(p&&a||g)&&e.map((e=>e.datum));A=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,l=ff(o,a).getContext("2d"),u=ff(o,a).getContext("2d"),c=s&&ff(o,a).getContext("2d");n.forEach((e=>uS(l,e,!1))),uS(u,t,!1),s&&uS(c,t,!0);const f=lS(l,o,a),d=lS(u,o,a),h=s&&lS(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,_,w,k;for(y=0;y<a;++y)for(g=0;g<o;++g)x=y*o+g,_=f[x]&sS,k=d[x]&sS,w=s&&h[x]&sS,(_||w||k)&&(v=e(g),b=e(y),r||!_&&!k||p.set(v,b),s&&(_||w)&&m.set(v,b));return[p,m]}(E,i||[],o,t,g):function(e,t){const n=e.bitmap();return(t||[]).forEach((t=>n.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(E,a&&k)}const $=g?ES[c](E,A,a,l):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=i.length;return function(t){const u=t.boundary,c=t.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>r||u[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,_,w,k,E,A,$=t.textWidth??0;for(let r=0;r<l;++r){if(f=(3&n[r])-1,d=(n[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=u[1+f]+i[r]*f*p,_=u[4+d]+m*c*d/2+i[r]*d*p,v=_-c/2,b=_+c/2,w=e(g),E=e(v),A=e(b),!$){if(!wS(w,w,E,A,a,s,0,0,0,0,0,h))continue;$=cv.width(t.datum,t.datum.text)}if(x=g+m*$*f/2,g=x-$/2,y=x+$/2,w=e(g),k=e(y),wS(w,k,E,A,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:_,t.align=xS[f*m+1],t.baseline=_S[d*m+1],a.setRange(w,E,k,A),!0}return!1}}(E,A,h,d);return k.forEach((e=>e.opacity=+$(e))),k}const $S=["x","y","opacity","align","baseline"],DS=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function SS(e){ps.call(this,null,e)}function MS(e,t){var n,i,r,o,a,s,l=[],u=function(e){return e(o)};if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(u)])||(n[a]=s=[],s.dims=a,l.push(s)),s.push(o);return l}function CS(e){ps.call(this,null,e)}SS.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:DS},{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:$S.length,default:$S}]},ft(SS,ps,{transform(e,t){const n=e.modified();if(!(n||t.changed(t.ADD_REM)||function(n){const i=e.sort;return Ve(i)&&t.modified(i.fields)}()))return;e.size&&2===e.size.length||oe("Size parameter should be specified as a [width, height] array.");const i=e.as||$S;return AS(t.materialize(t.SOURCE).source||[],e.size,e.sort,Ge(null==e.offset?1:e.offset),Ge(e.anchor||DS),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)}}),CS.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},ft(CS,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=MS(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ee),o=r.length,a=e.as||[ee(e.x),ee(e.y)],s=[];i.forEach((t=>{vl(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let e=0;e<o;++e)n[r[e]]=t.dims[e];n[a[0]]=e[0],n[a[1]]=e[1],s.push(La(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=s}return n}});const FS={constant:rl,linear:ul,log:cl,exp:fl,pow:dl,quad:hl,poly:pl};function OS(e){ps.call(this,null,e)}OS.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(FS)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},ft(OS,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=MS(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ee),o=e.method||"linear",a=null==e.order?3:e.order,s=((e,t)=>"poly"===e?t:"quad"===e?2:1)(o,a),l=e.as||[ee(e.x),ee(e.y)],u=FS[o],c=[];let f=e.extent;st(FS,o)||oe("Invalid regression method: "+o),null!=f&&"log"===o&&f[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),f=null),i.forEach((n=>{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=u(n,e.x,e.y,a);if(e.params)return void c.push(La({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const d=f||rt(n,e.x),h=e=>{const t={};for(let e=0;e<r.length;++e)t[r[e]]=n.dims[e];t[l[0]]=e[0],t[l[1]]=e[1],c.push(La(t))};"linear"===o||"constant"===o?d.forEach((e=>h([e,i.predict(e)]))):wl(i.predict,d,25,200).forEach(h)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});const NS=134217729;function TS(e,t,n,i,r){let o,a,s,l,u=t[0],c=i[0],f=0,d=0;c>u==c>-u?(o=u,u=t[++f]):(o=c,c=i[++d]);let h=0;if(f<e&&d<n)for(c>u==c>-u?(a=u+o,s=o-(a-u),u=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);f<e&&d<n;)c>u==c>-u?(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f<e;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f],o=a,0!==s&&(r[h++]=s);for(;d<n;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d],o=a,0!==s&&(r[h++]=s);return 0===o&&0!==h||(r[h++]=o),h}function zS(e){return new Float64Array(e)}const RS=zS(4),PS=zS(8),LS=zS(12),BS=zS(16),jS=zS(4);function IS(e,t,n,i,r,o){const a=(t-o)*(n-r),s=(e-r)*(i-o),l=a-s;if(0===a||0===s||a>0!=s>0)return l;const u=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*u?l:-function(e,t,n,i,r,o,a){let s,l,u,c,f,d,h,p,m,g,y,v,b,x,_,w,k,E;const A=e-r,$=n-r,D=t-o,S=i-o;x=A*S,d=NS*A,h=d-(d-A),p=A-h,d=NS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=D*$,d=NS*D,h=d-(d-D),p=D-h,d=NS*$,m=d-(d-$),g=$-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,RS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,RS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,RS[2]=v-(E-f)+(y-f),RS[3]=E;let M=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,RS),C=22204460492503146e-32*a;if(M>=C||-M>=C)return M;if(f=e-A,s=e-(A+f)+(f-r),f=n-$,u=n-($+f)+(f-r),f=t-D,l=t-(D+f)+(f-o),f=i-S,c=i-(S+f)+(f-o),0===s&&0===l&&0===u&&0===c)return M;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=A*c+S*s-(D*u+$*l),M>=C||-M>=C)return M;x=s*S,d=NS*s,h=d-(d-s),p=s-h,d=NS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=l*$,d=NS*l,h=d-(d-l),p=l-h,d=NS*$,m=d-(d-$),g=$-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const F=TS(4,RS,4,jS,PS);x=A*c,d=NS*A,h=d-(d-A),p=A-h,d=NS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=D*u,d=NS*D,h=d-(d-D),p=D-h,d=NS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const O=TS(F,PS,4,jS,LS);x=s*c,d=NS*s,h=d-(d-s),p=s-h,d=NS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=l*u,d=NS*l,h=d-(d-l),p=l-h,d=NS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const N=TS(O,LS,4,jS,BS);return BS[N-1]}(e,t,n,i,r,o,u)}zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(8),zS(8),zS(8),zS(4),zS(8),zS(8),zS(8),zS(12),zS(192),zS(192),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(4),zS(4),zS(4),zS(8),zS(16),zS(16),zS(16),zS(32),zS(32),zS(48),zS(64),zS(1152),zS(1152),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(1152),zS(1152),zS(1152),zS(1152),zS(1152),zS(2304),zS(2304),zS(3456),zS(5760),zS(8),zS(8),zS(8),zS(16),zS(24),zS(48),zS(48),zS(96),zS(192),zS(384),zS(384),zS(384),zS(768),zS(96),zS(96),zS(96),zS(1152);const US=Math.pow(2,-52),qS=new Uint32Array(512);class WS{static from(e,t=JS,n=QS){const i=e.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=e[o];r[2*o]=t(i),r[2*o+1]=n(i)}return new WS(r)}constructor(e){const t=e.length>>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,l=-1/0,u=-1/0;for(let t=0;t<o;t++){const n=e[2*t],i=e[2*t+1];n<a&&(a=n),i<s&&(s=i),n>l&&(l=n),i>u&&(u=i),this._ids[t]=t}const c=(a+l)/2,f=(s+u)/2;let d,h,p,m=1/0;for(let t=0;t<o;t++){const n=HS(c,f,e[2*t],e[2*t+1]);n<m&&(d=t,m=n)}const g=e[2*d],y=e[2*d+1];m=1/0;for(let t=0;t<o;t++){if(t===d)continue;const n=HS(g,y,e[2*t],e[2*t+1]);n<m&&n>0&&(h=t,m=n)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let t=0;t<o;t++){if(t===d||t===h)continue;const n=YS(g,y,v,b,e[2*t],e[2*t+1]);n<x&&(p=t,x=n)}let _=e[2*p],w=e[2*p+1];if(x===1/0){for(let t=0;t<o;t++)this._dists[t]=e[2*t]-e[0]||e[2*t+1]-e[1];VS(this._ids,this._dists,0,o-1);const t=new Uint32Array(o);let n=0;for(let e=0,i=-1/0;e<o;e++){const r=this._ids[e];this._dists[r]>i&&(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(IS(g,y,v,b,_,w)<0){const e=h,t=v,n=b;h=p,v=_,b=w,p=e,_=t,w=n}const k=function(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l);return{x:e+(u*c-s*f)*d,y:t+(a*f-l*c)*d}}(g,y,v,b,_,w);this._cx=k.x,this._cy=k.y;for(let t=0;t<o;t++)this._dists[t]=HS(e[2*t],e[2*t+1],k.x,k.y);VS(this._ids,this._dists,0,o-1),this._hullStart=d;let E=3;n[d]=t[p]=h,n[h]=t[d]=p,n[p]=t[h]=d,i[d]=0,i[h]=1,i[p]=2,r.fill(-1),r[this._hashKey(g,y)]=d,r[this._hashKey(v,b)]=h,r[this._hashKey(_,w)]=p,this.trianglesLen=0,this._addTriangle(d,h,p,-1,-1,-1);for(let o,a,s=0;s<this._ids.length;s++){const l=this._ids[s],u=e[2*l],c=e[2*l+1];if(s>0&&Math.abs(u-o)<=US&&Math.abs(c-a)<=US)continue;if(o=u,a=c,l===d||l===h||l===p)continue;let f=0;for(let e=0,t=this._hashKey(u,c);e<this._hashSize&&(f=r[(t+e)%this._hashSize],-1===f||f===n[f]);e++);f=t[f];let m,g=f;for(;m=n[g],IS(u,c,e[2*g],e[2*g+1],e[2*m],e[2*m+1])>=0;)if(g=m,g===f){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(y+2),i[g]=y,E++;let v=n[g];for(;m=n[v],IS(u,c,e[2*v],e[2*v+1],e[2*m],e[2*m+1])<0;)y=this._addTriangle(v,l,m,i[l],-1,i[v]),i[l]=this._legalize(y+2),n[v]=v,E--,v=m;if(g===f)for(;m=t[g],IS(u,c,e[2*m],e[2*m+1],e[2*g],e[2*g+1])<0;)y=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(y+2),i[m]=y,n[g]=g,E--,g=m;this._hullStart=t[l]=g,n[g]=t[v]=l,n[l]=v,r[this._hashKey(u,c)]=l,r[this._hashKey(e[2*g],e[2*g+1])]=g}this.hull=new Uint32Array(E);for(let e=0,t=this._hullStart;e<E;e++)this.hull[e]=t,t=n[t];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?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=qS[--r];continue}const l=a-a%3,u=s+(e+1)%3,c=l+(a+2)%3,f=t[o],d=t[e],h=t[u],p=t[c];if(GS(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=l+(a+1)%3;r<qS.length&&(qS[r++]=s)}else{if(0===r)break;e=qS[--r]}}return o}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,i,r,o){const a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,r),this._link(a+2,o),this.trianglesLen+=3,a}}function HS(e,t,n,i){const r=e-n,o=t-i;return r*r+o*o}function GS(e,t,n,i,r,o,a,s){const l=e-a,u=t-s,c=n-a,f=i-s,d=r-a,h=o-s,p=c*c+f*f,m=d*d+h*h;return l*(f*m-p*h)-u*(c*m-p*d)+(l*l+u*u)*(c*h-f*d)<0}function YS(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l),h=(u*c-s*f)*d,p=(a*f-l*c)*d;return h*h+p*p}function VS(e,t,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=e[r],o=t[i];let a=r-1;for(;a>=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;XS(e,n+i>>1,r),t[e[n]]>t[e[i]]&&XS(e,n,i),t[e[r]]>t[e[i]]&&XS(e,r,i),t[e[n]]>t[e[r]]&&XS(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]<s);do{o--}while(t[e[o]]>s);if(o<r)break;XS(e,r,o)}e[n+1]=e[o],e[o]=a,i-r+1>=o-n?(VS(e,t,r,i),VS(e,t,n,o-1)):(VS(e,t,n,o-1),VS(e,t,r,i))}}function XS(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function JS(e){return e[0]}function QS(e){return e[1]}const ZS=1e-6;class KS{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)>ZS||Math.abs(this._y1-r)>ZS)&&(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 eM{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}}class tM{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 i,s,l=0,u=0,c=n.length;l<c;l+=3,u+=2){const c=2*n[l],f=2*n[l+1],d=2*n[l+2],h=e[c],p=e[c+1],m=e[f],g=e[f+1],y=e[d],v=e[d+1],b=m-h,x=g-p,_=y-h,w=v-p,k=2*(b*w-x*_);if(Math.abs(k)<1e-9){if(void 0===r){r=o=0;for(const n of t)r+=e[2*n],o+=e[2*n+1];r/=t.length,o/=t.length}const n=1e9*Math.sign((r-h)*w-(o-p)*_);i=(h+y)/2-n*w,s=(p+v)/2+n*_}else{const e=1/k,t=b*b+x*x,n=_*_+w*w;i=h+(w*t-x*n)*e,s=p+(b*n-_*t)*e}a[u]=i,a[u+1]=s}let s,l,u,c=t[t.length-1],f=4*c,d=e[2*c],h=e[2*c+1];i.fill(0);for(let n=0;n<t.length;++n)c=t[n],s=f,l=d,u=h,f=4*c,d=e[2*c],h=e[2*c+1],i[s+2]=i[f]=u-h,i[s+3]=i[f+1]=d-l}render(e){const t=null==e?e=new KS:void 0,{delaunay:{halfedges:n,inedges:i,hull:r},circumcenters:o,vectors:a}=this;if(r.length<=1)return null;for(let t=0,i=n.length;t<i;++t){const i=n[t];if(i<t)continue;const r=2*Math.floor(t/3),a=2*Math.floor(i/3),s=o[r],l=o[r+1],u=o[a],c=o[a+1];this._renderSegment(s,l,u,c,e)}let s,l=r[r.length-1];for(let t=0;t<r.length;++t){s=l,l=r[t];const n=2*Math.floor(i[l]/3),u=o[n],c=o[n+1],f=4*s,d=this._project(u,c,a[f+2],a[f+3]);d&&this._renderSegment(u,c,d[0],d[1],e)}return t&&t.value()}renderBounds(e){const t=null==e?e=new KS:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){const n=null==t?t=new KS:void 0,i=this._clip(e);if(null===i||!i.length)return;t.moveTo(i[0],i[1]);let r=i.length;for(;i[0]===i[r-2]&&i[1]===i[r-1]&&r>1;)r-=2;for(let e=2;e<r;e+=2)i[e]===i[e-2]&&i[e+1]===i[e-1]||t.lineTo(i[e],i[e+1]);return t.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){const e=this.cellPolygon(t);e&&(e.index=t,yield e)}}cellPolygon(e){const t=new eM;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,i,r){let o;const a=this._regioncode(e,t),s=this._regioncode(n,i);0===a&&0===s?(r.moveTo(e,t),r.lineTo(n,i)):(o=this._clipSegment(e,t,n,i,a,s))&&(r.moveTo(o[0],o[1]),r.lineTo(o[2],o[3]))}contains(e,t,n){return(t=+t)==t&&(n=+n)==n&&this.delaunay._step(e,t,n)===e}*neighbors(e){const t=this._clip(e);if(t)for(const n of this.delaunay.neighbors(e)){const e=this._clip(n);if(e)e:for(let i=0,r=t.length;i<r;i+=2)for(let o=0,a=e.length;o<a;o+=2)if(t[i]===e[o]&&t[i+1]===e[o+1]&&t[(i+2)%r]===e[(o+a-2)%a]&&t[(i+3)%r]===e[(o+a-1)%a]){yield n;break e}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:i,triangles:r}}=this,o=n[e];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(t[2*n],t[2*n+1]),s=s%3==2?s-2:s+1,r[s]!==e)break;s=i[s]}while(s!==o&&-1!==s);return a}_clip(e){if(0===e&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const t=this._cell(e);if(null===t)return null;const{vectors:n}=this,i=4*e;return this._simplify(n[i]||n[i+1]?this._clipInfinite(e,t,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(e,t))}_clipFinite(e,t){const n=t.length;let i,r,o,a,s=null,l=t[n-2],u=t[n-1],c=this._regioncode(l,u),f=0;for(let d=0;d<n;d+=2)if(i=l,r=u,l=t[d],u=t[d+1],o=c,c=this._regioncode(l,u),0===o&&0===c)a=f,f=0,s?s.push(l,u):s=[l,u];else{let t,n,d,h,p;if(0===o){if(null===(t=this._clipSegment(i,r,l,u,o,c)))continue;[n,d,h,p]=t}else{if(null===(t=this._clipSegment(l,u,i,r,c,o)))continue;[h,p,n,d]=t,a=f,f=this._edgecode(n,d),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(n,d):s=[n,d]}a=f,f=this._edgecode(h,p),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(h,p):s=[h,p]}if(s)a=f,f=this._edgecode(s[0],s[1]),a&&f&&this._edge(e,a,f,s,s.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(e,t,n,i,r,o){const a=r<o;for(a&&([e,t,n,i,r,o]=[n,i,e,t,o,r]);;){if(0===r&&0===o)return a?[n,i,e,t]:[e,t,n,i];if(r&o)return null;let s,l,u=r||o;8&u?(s=e+(n-e)*(this.ymax-t)/(i-t),l=this.ymax):4&u?(s=e+(n-e)*(this.ymin-t)/(i-t),l=this.ymin):2&u?(l=t+(i-t)*(this.xmax-e)/(n-e),s=this.xmax):(l=t+(i-t)*(this.xmin-e)/(n-e),s=this.xmin),r?(e=s,t=l,r=this._regioncode(e,t)):(n=s,i=l,o=this._regioncode(n,i))}}_clipInfinite(e,t,n,i,r,o){let a,s=Array.from(t);if((a=this._project(s[0],s[1],n,i))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],r,o))&&s.push(a[0],a[1]),s=this._clipFinite(e,s))for(let t,n=0,i=s.length,r=this._edgecode(s[i-2],s[i-1]);n<i;n+=2)t=r,r=this._edgecode(s[n],s[n+1]),t&&r&&(n=this._edge(e,t,r,s,n),i=s.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(e,t,n,i,r){for(;t!==n;){let n,o;switch(t){case 5:t=4;continue;case 4:t=6,n=this.xmax,o=this.ymin;break;case 6:t=2;continue;case 2:t=10,n=this.xmax,o=this.ymax;break;case 10:t=8;continue;case 8:t=9,n=this.xmin,o=this.ymax;break;case 9:t=1;continue;case 1:t=5,n=this.xmin,o=this.ymin}i[r]===n&&i[r+1]===o||!this.contains(e,n,o)||(i.splice(r,0,n,o),r+=2)}return r}_project(e,t,n,i){let r,o,a,s=1/0;if(i<0){if(t<=this.ymin)return null;(r=(this.ymin-t)/i)<s&&(a=this.ymin,o=e+(s=r)*n)}else if(i>0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)<s&&(a=this.ymax,o=e+(s=r)*n)}if(n>0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)<s&&(o=this.xmax,a=t+(s=r)*i)}else if(n<0){if(e<=this.xmin)return null;(r=(this.xmin-e)/n)<s&&(o=this.xmin,a=t+(s=r)*i)}return[o,a]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){const n=(t+2)%e.length,i=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[i]||e[t+1]===e[n+1]&&e[n+1]===e[i+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}}const nM=2*Math.PI,iM=Math.pow;function rM(e){return e[0]}function oM(e){return e[1]}function aM(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class sM{static from(e,t=rM,n=oM,i){return new sM("length"in e?function(e,t,n,i){const r=e.length,o=new Float64Array(2*r);for(let a=0;a<r;++a){const r=e[a];o[2*a]=t.call(i,r,a,e),o[2*a+1]=n.call(i,r,a,e)}return o}(e,t,n,i):Float64Array.from(function*(e,t,n,i){let r=0;for(const o of e)yield t.call(i,o,r,e),yield n.call(i,o,r,e),++r}(e,t,n,i)))}constructor(e){this._delaunator=new WS(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e<t.length;e+=3){const i=2*t[e],r=2*t[e+1],o=2*t[e+2];if((n[o]-n[i])*(n[r+1]-n[i+1])-(n[r]-n[i])*(n[o+1]-n[i+1])>1e-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 e=0,n=t.length/2;e<n;++e){const n=aM(t[2*e],t[2*e+1],r);t[2*e]=n[0],t[2*e+1]=n[1]}this._delaunator=new WS(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,r=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let e=0,t=n.length;e<t;++e){const t=r[e%3==2?e-2:e+1];-1!==n[e]&&-1!==o[t]||(o[t]=e)}for(let e=0,t=i.length;e<t;++e)a[i[e]]=e;i.length<=2&&i.length>0&&(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 tM(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<a.length-1&&(yield a[t+1]))}const s=t[e];if(-1===s)return;let l=s,u=-1;do{if(yield u=o[l],l=l%3==2?l-2:l+1,o[l]!==e)return;if(l=r[l],-1===l){const t=n[(i[e]+1)%n.length];return void(t!==u&&(yield t))}}while(l!==s)}find(e,t,n=0){if((e=+e)!=e||(t=+t)!=t)return-1;const i=n;let r;for(;(r=this._step(n,e,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:l}=this;if(-1===i[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=iM(t-l[2*e],2)+iM(n-l[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=iM(t-l[2*i],2)+iM(n-l[2*i+1],2);if(f<c&&(c=f,u=i),d=d%3==2?d-2:d+1,s[d]!==e)break;if(d=a[d],-1===d){if(d=r[(o[e]+1)%r.length],d!==i&&iM(t-l[2*d],2)+iM(n-l[2*d+1],2)<c)return d;break}}while(d!==f);return u}render(e){const t=null==e?e=new KS:void 0,{points:n,halfedges:i,triangles:r}=this;for(let t=0,o=i.length;t<o;++t){const o=i[t];if(o<t)continue;const a=2*r[t],s=2*r[o];e.moveTo(n[a],n[a+1]),e.lineTo(n[s],n[s+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){void 0!==t||e&&"function"==typeof e.moveTo||(t=e,e=null),t=null==t?2:+t;const n=null==e?e=new KS:void 0,{points:i}=this;for(let n=0,r=i.length;n<r;n+=2){const r=i[n],o=i[n+1];e.moveTo(r+t,o),e.arc(r,o,t,0,nM)}return n&&n.value()}renderHull(e){const t=null==e?e=new KS:void 0,{hull:n,points:i}=this,r=2*n[0],o=n.length;e.moveTo(i[r],i[r+1]);for(let t=1;t<o;++t){const r=2*n[t];e.lineTo(i[r],i[r+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new eM;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=null==t?t=new KS:void 0,{points:i,triangles:r}=this,o=2*r[e*=3],a=2*r[e+1],s=2*r[e+2];return t.moveTo(i[o],i[o+1]),t.lineTo(i[a],i[a+1]),t.lineTo(i[s],i[s+1]),t.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){const t=new eM;return this.renderTriangle(e,t),t.value()}}function lM(e){ps.call(this,null,e)}lM.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const uM=[-1e5,-1e5,1e5,1e5];function cM(e){const t=e[0][0],n=e[0][1];let i=e.length-1;for(;e[i][0]===t&&e[i][1]===n;--i);return"M"+e.slice(0,i+1).join("L")+"Z"}ft(lM,ps,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:uM;const o=this.value=sM.from(i,e.x,e.y).voronoi(r);for(let e=0,t=i.length;e<t;++e){const t=o.cellPolygon(e);i[e][n]=t?cM(t):null}return t.reflow(e.modified()).modifies(n)}});var fM=Math.PI/180,dM=64,hM=2048;function pM(e,t,n,i){if(!t.sprite){var r=e.context,o=e.ratio;r.clearRect(0,0,(dM<<5)/o,hM/o);var a,s,l,u,c,f=0,d=0,h=0,p=n.length;for(--i;++i<p;){if(t=n[i],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/o)+"px "+t.font,a=r.measureText(t.text+"m").width*o,l=t.size<<1,t.rotate){var m=Math.sin(t.rotate*fM),g=Math.cos(t.rotate*fM),y=a*g,v=a*m,b=l*g,x=l*m;a=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,l=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(l>h&&(h=l),f+a>=dM<<5&&(f=0,d+=h,h=0),d+l>=hM)break;r.translate((f+(a>>1))/o,(d+(l>>1))/o),t.rotate&&r.rotate(t.rotate*fM),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=l,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=l>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var _=r.getImageData(0,0,(dM<<5)/o,hM/o).data,w=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,l=t.y1-t.y0,u=0;u<l*s;u++)w[u]=0;if(null==(f=t.xoff))return;d=t.yoff;var k=0,E=-1;for(c=0;c<l;c++){for(u=0;u<a;u++){var A=s*c+(u>>5),$=_[(d+c)*(dM<<5)+(f+u)<<2]?1<<31-u%32:0;w[A]|=$,k|=$}k?E=c:(t.y0++,l--,c--,d++)}t.y1=t.y0+E,t.sprite=w.slice(0,(t.y1-t.y0)*s)}}}function mM(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,l=32-s,u=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f<u;f++){i=0;for(var d=0;d<=o;d++)if((i<<l|(d<o?(i=r[f*o+d])>>>s:0))&t[c+d])return!0;c+=n}return!1}function gM(e,t){var n=e[0],i=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function yM(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function vM(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function bM(e){return"function"==typeof e?e:function(){return e}}var xM={archimedean:vM,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 _M=["x","y","font","fontSize","fontStyle","fontWeight","angle"],wM=["text","font","rotate","fontSize","fontStyle","fontWeight"];function kM(e){ps.call(this,function(){var e,t,n,i,r,o,a,s=[256,256],l=vM,u=[],c=Math.random,f={};function d(e,t,n){for(var i,r,o,a=t.x,u=t.y,f=Math.sqrt(s[0]*s[0]+s[1]*s[1]),d=l(s),h=c()<.5?1:-1,p=-h;(i=d(p+=h))&&(r=~~i[0],o=~~i[1],!(Math.min(Math.abs(r),Math.abs(o))>=f));)if(t.x=a+r,t.y=u+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1])&&(!n||!mM(t,e,s[0]))&&(!n||yM(t,n))){for(var m,g=t.sprite,y=t.width>>5,v=s[0]>>5,b=t.x-(y<<4),x=127&b,_=32-x,w=t.y1-t.y0,k=(t.y+t.y0)*v+(b>>5),E=0;E<w;E++){m=0;for(var A=0;A<=y;A++)e[k+A]|=m<<_|(A<y?(m=g[E*y+A])>>>x:0);k+=v}return t.sprite=null,!0}return!1}return f.layout=function(){for(var l=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=(dM<<5)/t,e.height=hM/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(ff()),f=function(e){for(var t=[],n=-1;++n<e;)t[n]=0;return t}((s[0]>>5)*s[1]),h=null,p=u.length,m=-1,g=[],y=u.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<p;){var v=y[m];v.x=s[0]*(c()+.5)>>1,v.y=s[1]*(c()+.5)>>1,pM(l,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?gM(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?(u=e,f):u},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=bM(e),f):t},f.fontStyle=function(e){return arguments.length?(i=bM(e),f):i},f.fontWeight=function(e){return arguments.length?(r=bM(e),f):r},f.rotate=function(e){return arguments.length?(o=bM(e),f):o},f.text=function(t){return arguments.length?(e=bM(t),f):e},f.spiral=function(e){return arguments.length?(l=xM[e]||e,f):l},f.fontSize=function(e){return arguments.length?(n=bM(e),f):n},f.padding=function(e){return arguments.length?(a=bM(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}(),e)}kM.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:_M}]},ft(kM,ps,{transform(e,t){!e.size||e.size[0]&&e.size[1]||oe("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||wM.some((function(n){const i=e[n];return Ve(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,o=e.as||_M;let a,s=e.fontSize||14;if(Ve(s)?a=e.fontSizeRange:s=tt(s),a){const e=s,t=Gp("sqrt")().domain(rt(i,e)).range(a);s=n=>t(e(n))}i.forEach((e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0}));const l=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(s).random(Os).layout(),u=r.size(),c=u[0]>>1,f=u[1]>>1,d=l.length;for(let e,t,n=0;n<d;++n)e=l[n],t=e.datum,t[o[0]]=e.x+c,t[o[1]]=e.y+f,t[o[2]]=e.font,t[o[3]]=e.size,t[o[4]]=e.style,t[o[5]]=e.weight,t[o[6]]=e.rotate;return t.reflow(n).modifies(o)}});const EM=e=>new Uint8Array(e),AM=e=>new Uint16Array(e),$M=e=>new Uint32Array(e);function DM(e,t,n){const i=(t<257?EM:t<65537?AM:$M)(e);return n&&i.set(n),i}function SM(e,t,n){const i=1<<t;return{one:i,zero:~i,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(e,t){const n=this,r=n.bisect(n.range,e.value),o=e.index,a=r[0],s=r[1],l=o.length;let u;for(u=0;u<a;++u)t[o[u]]|=i;for(u=s;u<l;++u)t[o[u]]|=i;return n}}}function MM(){let e=$M(0),t=[],n=0;return{insert:function(i,r,o){if(!r.length)return[];const a=n,s=r.length,l=$M(s);let u,c,f,d=Array(s);for(f=0;f<s;++f)d[f]=i(r[f]),l[f]=f;if(d=function(e,t){return e.sort.call(t,((t,n)=>{const i=e[t],r=e[n];return i<r?-1:i>r?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,l),a)u=t,c=e,t=Array(a+s),e=$M(a+s),function(e,t,n,i,r,o,a,s,l){let u,c=0,f=0;for(u=0;c<i&&f<a;++u)t[c]<r[f]?(s[u]=t[c],l[u]=n[c++]):(s[u]=r[f],l[u]=o[f++]+e);for(;c<i;++c,++u)s[u]=t[c],l[u]=n[c];for(;f<a;++f,++u)s[u]=r[f],l[u]=o[f]+e}(o,u,c,a,d,l,s,t,e);else{if(o>0)for(f=0;f<s;++f)l[f]+=o;t=d,e=l}return n=a+s,{index:l,value:d}},remove:function(i,r){const o=n;let a,s,l;for(s=0;!r[e[s]]&&s<o;++s);for(l=s;s<o;++s)r[a=e[s]]||(e[l]=a,t[l]=t[s],++l);n=o-i},bisect:function(e,i){let r;return i?r=i.length:(i=t,r=n),[mf(i,e[0],0,r),pf(i,e[1],0,r)]},reindex:function(t){for(let i=0,r=n;i<r;++i)e[i]=t[e[i]]},index:()=>e,size:()=>n}}function CM(e){ps.call(this,function(){let e=8,t=[],n=$M(0),i=DM(0,e),r=DM(0,e);return{data:()=>t,seen:()=>n=function(e,t,n){return e.length>=t?e:((n=n||new e.constructor(t)).set(e),n)}(n,t.length),add(e){for(let n,i=0,r=t.length,o=e.length;i<o;++i)n=e[i],n._index=r++,t.push(n)},remove(e,n){const o=t.length,a=Array(o-e),s=t;let l,u,c;for(u=0;!n[u]&&u<o;++u)a[u]=t[u],s[u]=u;for(c=u;u<o;++u)l=t[u],n[u]?s[u]=-1:(s[u]=c,i[c]=i[u],r[c]=r[u],a[c]=l,l._index=c++),i[u]=0;return t=a,s},size:()=>t.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=DM(t,e,i),r=DM(t,e))}}}(),e),this._indices=null,this._dims=null}function FM(e){ps.call(this,null,e)}CM.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}}]},ft(CM,ps,{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,l,u=0;for(;u<a;++u)s=n[u].fname,l=r[s]||(r[s]=MM()),o.push(SM(l,u,i[u]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),i=e.fields,r=e.query,o=this._indices,a=this._dims,s=this.value,l=s.curr(),u=s.prev(),c=s.all(),f=n.rem=n.add,d=n.mod,h=r.length,p={};let m,g,y,v,b,x,_,w,k;if(u.set(l),t.rem.length&&(b=this.remove(e,t,n)),t.add.length&&s.add(t.add),t.mod.length)for(x={},v=t.mod,_=0,w=v.length;_<w;++_)x[v[_]._index]=1;for(_=0;_<h;++_)k=i[_],(!a[_]||e.modified("fields",_)||t.modified(k.fields))&&(y=k.fname,(m=p[y])||(o[y]=g=MM(),p[y]=m=g.insert(k,t.source,0)),a[_]=SM(g,_,r[_]).onAdd(m,l));for(_=0,w=s.data().length;_<w;++_)b[_]||(u[_]!==l[_]?f.push(_):x[_]&&l[_]!==c&&d.push(_));return s.mask=(1<<h)-1,n},eval(e,t){const n=t.materialize().fork(),i=this._dims.length;let r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<i)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<i)-1),t.mod.length&&(this.modify(t,n),r|=(1<<i)-1),this.value.mask=r,n},insert(e,t,n){const i=t.add,r=this.value,o=this._dims,a=this._indices,s=e.fields,l={},u=n.add,c=r.size()+i.length,f=o.length;let d,h,p,m=r.size();r.resize(c,f),r.add(i);const g=r.curr(),y=r.prev(),v=r.all();for(d=0;d<f;++d)h=s[d].fname,p=l[h]||(l[h]=a[h].insert(s[d],i,m)),o[d].onAdd(p,g);for(;m<c;++m)y[m]=v,g[m]!==v&&u.push(m)},modify(e,t){const n=t.mod,i=this.value,r=i.curr(),o=i.all(),a=e.mod;let s,l,u;for(s=0,l=a.length;s<l;++s)u=a[s]._index,r[u]!==o&&n.push(u)},remove(e,t,n){const i=this._indices,r=this.value,o=r.curr(),a=r.prev(),s=r.all(),l={},u=n.rem,c=t.rem;let f,d,h,p;for(f=0,d=c.length;f<d;++f)h=c[f]._index,l[h]=1,a[h]=p=o[h],o[h]=s,p!==s&&u.push(h);for(h in i)i[h].remove(d,l);return this.reindex(t,d,l),l},reindex(e,t,n){const i=this._indices,r=this.value;e.runAfter((()=>{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,l,u=0;for(n.filters=0,l=0;l<a;++l)e.modified("query",l)&&(s=l,++u);if(1===u)u=i[s].one,this.incrementOne(i[s],r[s],n.add,n.rem);else for(l=0,u=0;l<a;++l)e.modified("query",l)&&(u|=i[l].one,this.incrementAll(i[l],r[l],o,n.add),n.rem=n.add);return u},incrementAll(e,t,n,i){const r=this.value,o=r.seen(),a=r.curr(),s=r.prev(),l=e.index(),u=e.bisect(e.range),c=e.bisect(t),f=c[0],d=c[1],h=u[0],p=u[1],m=e.one;let g,y,v;if(f<h)for(g=f,y=Math.min(h,d);g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(f>h)for(g=h,y=Math.min(f,p);g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;if(d>p)for(g=Math.max(f,p),y=d;g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(d<p)for(g=Math.max(h,d),y=p;g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;e.range=t.slice()},incrementOne(e,t,n,i){const r=this.value.curr(),o=e.index(),a=e.bisect(e.range),s=e.bisect(t),l=s[0],u=s[1],c=a[0],f=a[1],d=e.one;let h,p,m;if(l<c)for(h=l,p=Math.min(c,u);h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(l>c)for(h=c,p=Math.min(l,f);h<p;++h)m=o[h],r[m]^=d,i.push(m);if(u>f)for(h=Math.max(l,f),p=u;h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(u<f)for(h=Math.max(c,u),p=f;h<p;++h)m=o[h],r[m]^=d,i.push(m);e.range=t.slice()}}),FM.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},ft(FM,ps,{transform(e,t){const n=~(e.ignore||0),i=e.filter,r=i.mask;if(0==(r&n))return t.StopPropagation;const o=t.fork(t.ALL),a=i.data(),s=i.curr(),l=i.prev(),u=e=>s[e]&n?null:a[e];return o.filter(o.MOD,u),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^l[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return!t||t^t^l[e]&n?null:a[e]}))):(o.filter(o.ADD,u),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>u(e._index)))}});const OM="Literal",NM="CallExpression";function TM(e){this.type=e}var zM,RM,PM,LM,BM;TM.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case"ArrayExpression":return e.elements;case"BinaryExpression":case"LogicalExpression":return[e.left,e.right];case NM:return[e.callee].concat(e.arguments);case"ConditionalExpression":return[e.test,e.consequent,e.alternate];case"MemberExpression":return[e.object,e.property];case"ObjectExpression":return e.properties;case"Property":return[e.key,e.value];case"UnaryExpression":return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};var jM=1,IM=2,UM=3,qM=4,WM=5,HM=6,GM=7,YM=8;(zM={})[jM]="Boolean",zM[IM]="<end>",zM[UM]="Identifier",zM[qM]="Keyword",zM[WM]="Null",zM[HM]="Numeric",zM[GM]="Punctuator",zM[YM]="String",zM[9]="RegularExpression";var VM="ArrayExpression",XM="BinaryExpression",JM="CallExpression",QM="ConditionalExpression",ZM="Identifier",KM="Literal",eC="LogicalExpression",tC="MemberExpression",nC="ObjectExpression",iC="Property",rC="UnaryExpression",oC="Unexpected token %0",aC="Unexpected number",sC="Unexpected string",lC="Unexpected identifier",uC="Unexpected reserved word",cC="Unexpected end of input",fC="Invalid regular expression",dC="Invalid regular expression: missing /",hC="Octal literals are not allowed in strict mode.",pC="Duplicate data property in object literal not allowed in strict mode",mC="ILLEGAL",gC="Disabled.",yC=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]"),vC=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 bC(e,t){if(!e)throw new Error("ASSERT: "+t)}function xC(e){return e>=48&&e<=57}function _C(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function wC(e){return"01234567".indexOf(e)>=0}function kC(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].indexOf(e)>=0}function EC(e){return 10===e||13===e||8232===e||8233===e}function AC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&yC.test(String.fromCharCode(e))}function $C(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&vC.test(String.fromCharCode(e))}const DC={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 SC(){for(;PM<LM;){const e=RM.charCodeAt(PM);if(!kC(e)&&!EC(e))break;++PM}}function MC(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)PM<LM&&_C(RM[PM])?(i=RM[PM++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):qC({},oC,mC);return String.fromCharCode(r)}function CC(){var e,t,n,i;for(t=0,"}"===(e=RM[PM])&&qC({},oC,mC);PM<LM&&_C(e=RM[PM++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&qC({},oC,mC),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function FC(){var e,t;for(e=RM.charCodeAt(PM++),t=String.fromCharCode(e),92===e&&(117!==RM.charCodeAt(PM)&&qC({},oC,mC),++PM,(e=MC("u"))&&"\\"!==e&&AC(e.charCodeAt(0))||qC({},oC,mC),t=e);PM<LM&&$C(e=RM.charCodeAt(PM));)++PM,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==RM.charCodeAt(PM)&&qC({},oC,mC),++PM,(e=MC("u"))&&"\\"!==e&&$C(e.charCodeAt(0))||qC({},oC,mC),t+=e);return t}function OC(){var e,t,n,i,r=PM,o=RM.charCodeAt(PM),a=RM[PM];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++PM,{type:GM,value:String.fromCharCode(o),start:r,end:PM};default:if(61===(e=RM.charCodeAt(PM+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return PM+=2,{type:GM,value:String.fromCharCode(o)+String.fromCharCode(e),start:r,end:PM};case 33:case 61:return PM+=2,61===RM.charCodeAt(PM)&&++PM,{type:GM,value:RM.slice(r,PM),start:r,end:PM}}}return">>>="===(i=RM.substr(PM,4))?{type:GM,value:i,start:r,end:PM+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:GM,value:n,start:r,end:PM+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:GM,value:t,start:r,end:PM+=2}:("//"===t&&qC({},oC,mC),"<>=!+-*%&|^/".indexOf(a)>=0?(++PM,{type:GM,value:a,start:r,end:PM}):void qC({},oC,mC))}function NC(){var e,t,n;if(bC(xC((n=RM[PM]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=PM,e="","."!==n){if(e=RM[PM++],n=RM[PM],"0"===e){if("x"===n||"X"===n)return++PM,function(e){let t="";for(;PM<LM&&_C(RM[PM]);)t+=RM[PM++];return 0===t.length&&qC({},oC,mC),AC(RM.charCodeAt(PM))&&qC({},oC,mC),{type:HM,value:parseInt("0x"+t,16),start:e,end:PM}}(t);if(wC(n))return function(e){let t="0"+RM[PM++];for(;PM<LM&&wC(RM[PM]);)t+=RM[PM++];return(AC(RM.charCodeAt(PM))||xC(RM.charCodeAt(PM)))&&qC({},oC,mC),{type:HM,value:parseInt(t,8),octal:!0,start:e,end:PM}}(t);n&&xC(n.charCodeAt(0))&&qC({},oC,mC)}for(;xC(RM.charCodeAt(PM));)e+=RM[PM++];n=RM[PM]}if("."===n){for(e+=RM[PM++];xC(RM.charCodeAt(PM));)e+=RM[PM++];n=RM[PM]}if("e"===n||"E"===n)if(e+=RM[PM++],"+"!==(n=RM[PM])&&"-"!==n||(e+=RM[PM++]),xC(RM.charCodeAt(PM)))for(;xC(RM.charCodeAt(PM));)e+=RM[PM++];else qC({},oC,mC);return AC(RM.charCodeAt(PM))&&qC({},oC,mC),{type:HM,value:parseFloat(e),start:t,end:PM}}function TC(){if(SC(),PM>=LM)return{type:IM,start:PM,end:PM};const e=RM.charCodeAt(PM);return AC(e)?function(){var e,t;return e=PM,t=92===RM.charCodeAt(PM)?FC():function(){var e,t;for(e=PM++;PM<LM;){if(92===(t=RM.charCodeAt(PM)))return PM=e,FC();if(!$C(t))break;++PM}return RM.slice(e,PM)}(),{type:1===t.length?UM:DC.hasOwnProperty(t)?qM:"null"===t?WM:"true"===t||"false"===t?jM:UM,value:t,start:e,end:PM}}():40===e||41===e||59===e?OC():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(bC("'"===(e=RM[PM])||'"'===e,"String literal must starts with a quote"),t=PM,++PM;PM<LM;){if((n=RM[PM++])===e){e="";break}if("\\"===n)if((n=RM[PM++])&&EC(n.charCodeAt(0)))"\r"===n&&"\n"===RM[PM]&&++PM;else switch(n){case"u":case"x":"{"===RM[PM]?(++PM,r+=CC()):r+=MC(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:wC(n)?(0!==(i="01234567".indexOf(n))&&(o=!0),PM<LM&&wC(RM[PM])&&(o=!0,i=8*i+"01234567".indexOf(RM[PM++]),"0123".indexOf(n)>=0&&PM<LM&&wC(RM[PM])&&(i=8*i+"01234567".indexOf(RM[PM++]))),r+=String.fromCharCode(i)):r+=n}else{if(EC(n.charCodeAt(0)))break;r+=n}}return""!==e&&qC({},oC,mC),{type:YM,value:r,octal:o,start:t,end:PM}}():46===e?xC(RM.charCodeAt(PM+1))?NC():OC():xC(e)?NC():OC()}function zC(){const e=BM;return PM=e.end,BM=TC(),PM=e.end,e}function RC(){const e=PM;BM=TC(),PM=e}function PC(e,t,n){const i=new TM("||"===e||"&&"===e?eC:XM);return i.operator=e,i.left=t,i.right=n,i}function LC(e,t){const n=new TM(JM);return n.callee=e,n.arguments=t,n}function BC(e){const t=new TM(ZM);return t.name=e,t}function jC(e){const t=new TM(KM);return t.value=e.value,t.raw=RM.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function IC(e,t,n){const i=new TM(tC);return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function UC(e,t,n){const i=new TM(iC);return i.key=t,i.value=n,i.kind=e,i}function qC(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((e,t)=>(bC(t<i.length,"Message reference must be in range"),i[t])));throw(n=new Error(r)).index=PM,n.description=r,n}function WC(e){e.type===IM&&qC(e,cC),e.type===HM&&qC(e,aC),e.type===YM&&qC(e,sC),e.type===UM&&qC(e,lC),e.type===qM&&qC(e,uC),qC(e,oC,e.value)}function HC(e){const t=zC();t.type===GM&&t.value===e||WC(t)}function GC(e){return BM.type===GM&&BM.value===e}function YC(e){return BM.type===qM&&BM.value===e}function VC(){PM=BM.start;const e=zC();return e.type===YM||e.type===HM?(e.octal&&qC(e,hC),jC(e)):BC(e.value)}function XC(){var e,t,n;return PM=BM.start,(e=BM).type===UM?(n=VC(),HC(":"),UC("init",n,rF())):e.type!==IM&&e.type!==GM?(t=VC(),HC(":"),UC("init",t,rF())):void WC(e)}const JC={if:1};function QC(){var e,t,n;if(GC("("))return function(){HC("(");const e=oF();return HC(")"),e}();if(GC("["))return function(){const e=[];for(PM=BM.start,HC("[");!GC("]");)GC(",")?(zC(),e.push(null)):(e.push(rF()),GC("]")||HC(","));return zC(),function(e){const t=new TM(VM);return t.elements=e,t}(e)}();if(GC("{"))return function(){var e,t,n=[],i={},r=String;for(PM=BM.start,HC("{");!GC("}");)t="$"+((e=XC()).key.type===ZM?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?qC({},pC):i[t]=!0,n.push(e),GC("}")||HC(",");return HC("}"),function(e){const t=new TM(nC);return t.properties=e,t}(n)}();if(e=BM.type,PM=BM.start,e===UM||JC[BM.value])n=BC(zC().value);else if(e===YM||e===HM)BM.octal&&qC(BM,hC),n=jC(zC());else{if(e===qM)throw new Error(gC);e===jM?((t=zC()).value="true"===t.value,n=jC(t)):e===WM?((t=zC()).value=null,n=jC(t)):GC("/")||GC("/=")?(n=jC(function(){var e,t,n,i;return BM=null,SC(),e=PM,t=function(){var e,t,n,i;for(bC("/"===(e=RM[PM]),"Regular expression literal must start with a slash"),t=RM[PM++],n=!1,i=!1;PM<LM;)if(t+=e=RM[PM++],"\\"===e)EC((e=RM[PM++]).charCodeAt(0))&&qC({},dC),t+=e;else if(EC(e.charCodeAt(0)))qC({},dC);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||qC({},dC),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";PM<LM&&$C((e=RM[PM]).charCodeAt(0));)++PM,"\\"===e&&PM<LM?qC({},oC,mC):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&qC({},fC,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";qC({},fC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){qC({},fC)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:PM}}()),RC()):WC(zC())}return n}function ZC(){const e=[];if(HC("("),!GC(")"))for(;PM<LM&&(e.push(rF()),!GC(")"));)HC(",");return HC(")"),e}function KC(){PM=BM.start;const e=zC();return function(e){return e.type===UM||e.type===qM||e.type===jM||e.type===WM}(e)||WC(e),BC(e.value)}function eF(){HC("[");const e=oF();return HC("]"),e}function tF(){const e=function(){var e;for(e=QC();;)if(GC("."))HC("."),e=IC(".",e,KC());else if(GC("("))e=LC(e,ZC());else{if(!GC("["))break;e=IC("[",e,eF())}return e}();if(BM.type===GM&&(GC("++")||GC("--")))throw new Error(gC);return e}function nF(){var e,t;if(BM.type!==GM&&BM.type!==qM)t=tF();else{if(GC("++")||GC("--"))throw new Error(gC);if(GC("+")||GC("-")||GC("~")||GC("!"))e=zC(),t=nF(),t=function(e,t){const n=new TM(rC);return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(YC("delete")||YC("void")||YC("typeof"))throw new Error(gC);t=tF()}}return t}function iF(e){let t=0;if(e.type!==GM&&e.type!==qM)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":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 rF(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,l,u;if(e=BM,l=nF(),0===(r=iF(i=BM)))return l;for(i.prec=r,zC(),t=[e,BM],o=[l,i,a=nF()];(r=iF(BM))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,l=o.pop(),t.pop(),n=PC(s,l,a),o.push(n);(i=zC()).prec=r,o.push(i),t.push(BM),n=nF(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=PC(o[u-1].value,o[u-2],n),u-=2;return n}(),GC("?")&&(zC(),t=rF(),HC(":"),e=function(e,t,n){const i=new TM(QM);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,rF())),e}function oF(){const e=rF();if(GC(","))throw new Error(gC);return e}function aF(e){PM=0,LM=(RM=e).length,BM=null,RC();const t=oF();if(BM.type!==IM)throw new Error("Unexpect token after expression.");return t}var sF={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 lF(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&&oe("Missing arguments to clamp function."),t.length>3&&oe("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),regexp:r,test:t("test",r),if:function(t){t.length<3&&oe("Missing arguments to if function."),t.length>3&&oe("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function uF(e){const t=(e=e||{}).allowed?Ot(e.allowed):{},n=e.forbidden?Ot(e.forbidden):{},i=e.constants||sF,r=(e.functions||lF)(f),o=e.globalvar,a=e.fieldvar,s=Ve(o)?o:e=>`${o}["${e}"]`;let l={},u={},c=0;function f(e){if(vt(e))return e;const t=d[e.type];return null==t&&oe("Unsupported type: "+e.type),t(e)}const d={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:st(n,r)?oe("Illegal identifier: "+r):st(i,r)?i[r]:st(t,r)?r:(l[r]=1,s(r))},MemberExpression:e=>{const t=!e.computed,n=f(e.object);t&&(c+=1);const i=f(e.property);return n===a&&(u[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&&(c-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&oe("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=st(r,t)&&r[t];return i||oe("Unrecognized function: "+t),Ve(i)?i(n):i+"("+n.map(f).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(f).join(",")+"]",BinaryExpression:e=>"("+f(e.left)+" "+e.operator+" "+f(e.right)+")",UnaryExpression:e=>"("+e.operator+f(e.argument)+")",ConditionalExpression:e=>"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")",LogicalExpression:e=>"("+f(e.left)+e.operator+f(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(f).join(",")+"}",Property:e=>{c+=1;const t=f(e.key);return c-=1,t+":"+f(e.value)}};function h(e){const t={code:f(e),globals:Object.keys(l),fields:Object.keys(u)};return l={},u={},t}return h.functions=r,h.constants=i,h}var cF,fF,dF,hF,pF,mF,gF,yF,vF,bF,xF,_F,wF,kF,EF,AF,$F=new cw,DF=new cw,SF={point:Tw,lineStart:Tw,lineEnd:Tw,polygonStart:function(){$F=new cw,SF.lineStart=MF,SF.lineEnd=CF},polygonEnd:function(){var e=+$F;DF.add(e<0?gw+e:e),this.lineStart=this.lineEnd=this.point=Tw},sphere:function(){DF.add(gw)}};function MF(){SF.point=FF}function CF(){OF(cF,fF)}function FF(e,t){SF.point=OF,cF=e,fF=t,dF=e*=vw,hF=ww(t=(t*=vw)/2+mw),pF=Sw(t)}function OF(e,t){var n=(e*=vw)-dF,i=n>=0?1:-1,r=i*n,o=ww(t=(t*=vw)/2+mw),a=Sw(t),s=pF*a,l=hF*o+s*ww(r),u=s*i*Sw(r);$F.add(_w(u,l)),dF=e,hF=o,pF=a}var NF,TF,zF,RF,PF,LF,BF,jF,IF,UF,qF,WF,HF,GF,YF,VF,XF={point:JF,lineStart:ZF,lineEnd:KF,polygonStart:function(){XF.point=eO,XF.lineStart=tO,XF.lineEnd=nO,kF=new cw,SF.polygonStart()},polygonEnd:function(){SF.polygonEnd(),XF.point=JF,XF.lineStart=ZF,XF.lineEnd=KF,$F<0?(mF=-(yF=180),gF=-(vF=90)):kF>fw?vF=90:kF<-fw&&(gF=-90),AF[0]=mF,AF[1]=yF},sphere:function(){mF=-(yF=180),gF=-(vF=90)}};function JF(e,t){EF.push(AF=[mF=e,yF=e]),t<gF&&(gF=t),t>vF&&(vF=t)}function QF(e,t){var n=Yk([e*vw,t*vw]);if(wF){var i=Xk(wF,n),r=Xk([i[1],-i[0],0],i);Zk(r),r=Gk(r);var o,a=e-bF,s=a>0?1:-1,l=r[0]*yw*s,u=bw(a)>180;u^(s*bF<l&&l<s*e)?(o=r[1]*yw)>vF&&(vF=o):u^(s*bF<(l=(l+360)%360-180)&&l<s*e)?(o=-r[1]*yw)<gF&&(gF=o):(t<gF&&(gF=t),t>vF&&(vF=t)),u?e<bF?iO(mF,e)>iO(mF,yF)&&(yF=e):iO(e,yF)>iO(mF,yF)&&(mF=e):yF>=mF?(e<mF&&(mF=e),e>yF&&(yF=e)):e>bF?iO(mF,e)>iO(mF,yF)&&(yF=e):iO(e,yF)>iO(mF,yF)&&(mF=e)}else EF.push(AF=[mF=e,yF=e]);t<gF&&(gF=t),t>vF&&(vF=t),wF=n,bF=e}function ZF(){XF.point=QF}function KF(){AF[0]=mF,AF[1]=yF,XF.point=JF,wF=null}function eO(e,t){if(wF){var n=e-bF;kF.add(bw(n)>180?n+(n>0?360:-360):n)}else xF=e,_F=t;SF.point(e,t),QF(e,t)}function tO(){SF.lineStart()}function nO(){eO(xF,_F),SF.lineEnd(),bw(kF)>fw&&(mF=-(yF=180)),AF[0]=mF,AF[1]=yF,wF=null}function iO(e,t){return(t-=e)<0?t+360:t}function rO(e,t){return e[0]-t[0]}function oO(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var aO={sphere:Tw,point:sO,lineStart:uO,lineEnd:dO,polygonStart:function(){aO.lineStart=hO,aO.lineEnd=pO},polygonEnd:function(){aO.lineStart=uO,aO.lineEnd=dO}};function sO(e,t){e*=vw;var n=ww(t*=vw);lO(n*ww(e),n*Sw(e),Sw(t))}function lO(e,t,n){++NF,zF+=(e-zF)/NF,RF+=(t-RF)/NF,PF+=(n-PF)/NF}function uO(){aO.point=cO}function cO(e,t){e*=vw;var n=ww(t*=vw);GF=n*ww(e),YF=n*Sw(e),VF=Sw(t),aO.point=fO,lO(GF,YF,VF)}function fO(e,t){e*=vw;var n=ww(t*=vw),i=n*ww(e),r=n*Sw(e),o=Sw(t),a=_w(Cw((a=YF*o-VF*r)*a+(a=VF*i-GF*o)*a+(a=GF*r-YF*i)*a),GF*i+YF*r+VF*o);TF+=a,LF+=a*(GF+(GF=i)),BF+=a*(YF+(YF=r)),jF+=a*(VF+(VF=o)),lO(GF,YF,VF)}function dO(){aO.point=sO}function hO(){aO.point=mO}function pO(){gO(WF,HF),aO.point=sO}function mO(e,t){WF=e,HF=t,e*=vw,t*=vw,aO.point=gO;var n=ww(t);GF=n*ww(e),YF=n*Sw(e),VF=Sw(t),lO(GF,YF,VF)}function gO(e,t){e*=vw;var n=ww(t*=vw),i=n*ww(e),r=n*Sw(e),o=Sw(t),a=YF*o-VF*r,s=VF*i-GF*o,l=GF*r-YF*i,u=Aw(a,s,l),c=Nw(u),f=u&&-c/u;IF.add(f*a),UF.add(f*s),qF.add(f*l),TF+=c,LF+=c*(GF+(GF=i)),BF+=c*(YF+(YF=r)),jF+=c*(VF+(VF=o)),lO(GF,YF,VF)}function yO(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vO(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bO(){return 0}function xO(e){return e instanceof hh?e:new hh(e)}const _O="intersect",wO="union",kO="_vgsid_",EO=se(kO),AO="index:unit";function $O(e,t){for(var n,i,r=t.fields,o=t.values,a=r.length,s=0;s<a;++s)if((i=r[s]).getter=se.getter||se(i.field),pt(n=i.getter(e))&&(n=Se(n)),pt(o[s])&&(o[s]=Se(o[s])),pt(o[s][0])&&(o[s]=o[s].map(Se)),"E"===i.type){if(_e(o[s])?o[s].indexOf(n)<0:n!==o[s])return!1}else if("R"===i.type){if(!dt(n,o[s]))return!1}else if("R-RE"===i.type){if(!dt(n,o[s],!0,!1))return!1}else if("R-E"===i.type){if(!dt(n,o[s],!1,!1))return!1}else if("R-LE"===i.type&&!dt(n,o[s],!1,!0))return!1;return!0}const DO=function(e){let t,n,i;function r(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<0?r=t+1:o=t}while(r<o)}return r}return 2!==e.length?(t=yO,n=(t,n)=>yO(e(t),n),i=(t,n)=>e(t)-n):(t=e===yO||e===vO?e:bO,n=e,i=e),{left:r,center:function(e,t,n=0,o=e.length){const a=r(e,t,n,o-1);return a>n&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<=0?r=t+1:o=t}while(r<o)}return r}}}(EO),SO=DO.left,MO=DO.right;var CO={[`${kO}_union`]:function(...e){const t=new hh;for(const n of e)for(const e of n)t.add(e);return t},[`${kO}_intersect`]:function(e,...t){e=new hh(e),t=t.map(xO);e:for(const n of e)for(const i of t)if(!i.has(n)){e.delete(n);continue e}return e},E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;n<i;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((e=>t.indexOf(e)>=0)):t},R_union:function(e,t){var n=Se(t[0]),i=Se(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<i&&(e[1]=i),e):[n,i]},R_intersect:function(e,t){var n=Se(t[0]),i=Se(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?i<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>i&&(e[1]=i),e):[n,i]}};function FO(e,t,n,i){t[0].type!==OM&&oe("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&De(t).value)!==_O||st(i,a)||(i[a]=n.getData(r).indataRef(n,o)),st(i,s)||(i[s]=n.getData(r).tuplesRef())}function OO(e){const t=this.context.data[e];return t?t.values.value:[]}const NO=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},TO=NO("format"),zO=NO("timeFormat"),RO=NO("utcFormat"),PO=NO("timeParse"),LO=NO("utcParse"),BO=new Date(2e3,0,1);function jO(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(BO.setYear(2e3),BO.setMonth(e),BO.setDate(t),zO.call(this,BO,n)):""}const IO="%",UO="$";function qO(e,t,n,i){t[0].type!==OM&&oe("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!st(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(e){}}function WO(e,t,n,i){if(t[0].type===OM)HO(n,i,t[0].value);else for(e in n.scales)HO(n,i,e)}function HO(e,t,n){const i=IO+n;if(!st(t,i))try{t[i]=e.scaleRef(n)}catch(e){}}function GO(e,t){if(Ve(e))return e;if(vt(e)){const i=t.scales[e];return i&&((n=i.value)&&!0===n[Wp])?i.value:void 0}var n}function YO(e,t){return function(n,i,r){if(n){const t=GO(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const VO=YO("area",(function(e){return DF=new cw,uw(e,SF),2*DF})),XO=YO("bounds",(function(e){var t,n,i,r,o,a,s;if(vF=yF=-(mF=gF=1/0),EF=[],uw(e,XF),n=EF.length){for(EF.sort(rO),t=1,o=[i=EF[0]];t<n;++t)oO(i,(r=EF[t])[0])||oO(i,r[1])?(iO(i[0],r[1])>iO(i[0],i[1])&&(i[1]=r[1]),iO(r[0],i[1])>iO(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=iO(i[1],r[0]))>a&&(a=s,mF=r[0],yF=i[1])}return EF=AF=null,mF===1/0||gF===1/0?[[NaN,NaN],[NaN,NaN]]:[[mF,gF],[yF,vF]]})),JO=YO("centroid",(function(e){NF=TF=zF=RF=PF=LF=BF=jF=0,IF=new cw,UF=new cw,qF=new cw,uw(e,aO);var t=+IF,n=+UF,i=+qF,r=Aw(t,n,i);return r<dw&&(t=LF,n=BF,i=jF,TF<fw&&(t=zF,n=RF,i=PF),(r=Aw(t,n,i))<dw)?[NaN,NaN]:[_w(n,t)*yw,Nw(i/r)*yw]}));function QO(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function ZO(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function KO(e){const t=Bf(e);return.2126*ZO(t.r)+.7152*ZO(t.g)+.0722*ZO(t.b)}function eN(e,t){return e===t||e!=e&&t!=t||(_e(e)?!(!_e(t)||e.length!==t.length)&&function(e,t){for(let n=0,i=e.length;n<i;++n)if(!eN(e[n],t[n]))return!1;return!0}(e,t):!(!we(e)||!we(t))&&tN(e,t))}function tN(e,t){for(const n in e)if(!eN(e[n],t[n]))return!1;return!0}function nN(e){return t=>tN(e,t)}const iN={};function rN(e){return _e(e)||ArrayBuffer.isView(e)?e:null}function oN(e){return rN(e)||(vt(e)?e:null)}const aN=e=>e.data;function sN(e,t){const n=OO.call(t,e);return n.root&&n.root.lookup||{}}const lN=()=>"undefined"!=typeof window&&window||null;function uN(e,t,n){if(!e)return[];const[i,r]=e,o=(new Ng).set(i[0],i[1],r[0],r[1]);return ux(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=Ge(e.marktype),i=Ge(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const cN={random:()=>Os(),cumulativeNormal:qs,cumulativeLogNormal:Xs,cumulativeUniform:tl,densityNormal:Us,densityLogNormal:Vs,densityUniform:el,quantileNormal:Ws,quantileLogNormal:Js,quantileUniform:nl,sampleNormal:Is,sampleLogNormal:Ys,sampleUniform:Ks,isArray:_e,isBoolean:ht,isDate:pt,isDefined:e=>void 0!==e,isNumber:gt,isObject:we,isRegExp:yt,isString:vt,isTuple:za,isValid:e=>null!=e&&e==e,toBoolean:St,toDate:e=>Ct(e),toNumber:Se,toString:Ft,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return oN(e).indexOf(...n)},join:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return rN(e).join(...n)},lastindexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return oN(e).lastIndexOf(...n)},replace:function(e,t,n){return Ve(n)&&oe("Function argument passed to replace."),String(e).replace(t,n)},reverse:function(e){return rN(e).slice().reverse()},slice:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return oN(e).slice(...n)},flush:ct,lerp:xt,merge:function(){const e=[].slice.call(arguments);return e.unshift({}),it(...e)},pad:At,peek:De,pluck:function(e,t){const n=iN[t]||(iN[t]=se(t));return _e(e)?e.map(n):n(e)},span:$t,inrange:dt,truncate:Nt,rgb:Bf,lab:Wh,hcl:Jh,hsl:Vf,luminance:KO,contrast:function(e,t){const n=KO(e),i=KO(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)},sequence:El,format:TO,utcFormat:RO,utcParse:LO,utcOffset:tr,utcSequence:rr,timeFormat:zO,timeParse:PO,timeOffset:er,timeSequence:ir,timeUnitSpecifier:$i,monthFormat:function(e){return jO.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return jO.call(this,e,1,"%b")},dayFormat:function(e){return jO.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return jO.call(this,0,2+e,"%a")},quarter:We,utcquarter:He,week:Ci,utcweek:Ri,dayofyear:Mi,utcdayofyear:zi,warn:function(){return QO(this.context.dataflow,"warn",arguments)},info:function(){return QO(this.context.dataflow,"info",arguments)},debug:function(){return QO(this.context.dataflow,"debug",arguments)},extent:e=>rt(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:uN,clampRange:Ye,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=lN();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=lN();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return yp(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(de).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?ng(n,t=t||Hm(e)):e}},panLinear:ze,panLog:Re,panPow:Pe,panSymlog:Le,zoomLinear:je,zoomLog:Ie,zoomPow:Ue,zoomSymlog:qe,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],l=s.input,u=a.stamp();let c,f,d=s.changes;if(!1===a._trigger||!(l.value.length||t||i))return 0;if((!d||d.stamp<u)&&(s.changes=d=a.changeset(),d.stamp=u,a.runAfter((()=>{s.modified=!0,a.pulse(l,d).run()}),!0,1)),n&&(c=!0===n?de:_e(n)||za(n)?n:nN(n),d.remove(c)),t&&d.insert(t),i&&(c=nN(i),l.value.some(c)?d.remove(c):d.insert(i)),r)for(f in o)d.modify(r,f,o[f]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=Ge(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 Ge(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 Ng).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[e,n]of t)e<a.x1&&(a.x1=e),e>a.x2&&(a.x2=e),n<a.y1&&(a.y1=n),n>a.y2&&(a.y2=n);return a.translate(i,r),uN([[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;r<n.length;o=r++){const[a,s]=n[o],[l,u]=n[r];u>t!=s>t&&e<(a-l)*(t-u)/(s-u)+l&&i++}return 1&i}(e.x,e.y,t)))}},fN=["view","item","group","xy","x","y"],dN="this.",hN={},pN={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${Dt(UO+e)}]`,functions:function(e){const t=lF(e);fN.forEach((e=>t[e]="event.vega."+e));for(const e in cN)t[e]=dN+e;return it(t,function(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=WO,n._range=WO,n._scale=WO;const i=t=>"_["+(t.type===OM?Dt(IO+t.value):Dt(IO)+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}(e,cN,hN)),t},constants:sF,visitors:hN},mN=uF(pN);function gN(e,t,n){return 1===arguments.length?cN[e]:(cN[e]=t,n&&(hN[e]=n),mN&&(mN.functions[e]=dN+e),this)}function yN(e,t){const n={};let i;try{i=aF(e=vt(e)?e:Dt(e)+"")}catch(t){oe("Expression parse error: "+e)}i.visit((e=>{if(e.type!==NM)return;const i=e.callee.name,r=pN.visitors[i];r&&r(i,e.arguments,t,n)}));const r=mN(i);return r.globals.forEach((e=>{const i=UO+e;!st(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:it({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}gN("bandwidth",(function(e,t){const n=GO(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),WO),gN("copy",(function(e,t){const n=GO(e,(t||this).context);return n?n.copy():void 0}),WO),gN("domain",(function(e,t){const n=GO(e,(t||this).context);return n?n.domain():[]}),WO),gN("range",(function(e,t){const n=GO(e,(t||this).context);return n&&n.range?n.range():[]}),WO),gN("invert",(function(e,t,n){const i=GO(e,(n||this).context);return i?_e(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),WO),gN("scale",(function(e,t,n){const i=GO(e,(n||this).context);return i?i(t):void 0}),WO),gN("gradient",(function(e,t,n,i,r){e=GO(e,(r||this).context);const o=Pm(t,n);let a=e.domain(),s=a[0],l=De(a),u=ue;return l-s?u=om(e,s,l):e=(e.interpolator?Gp("sequential")().interpolator(e.interpolator()):Gp("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,l=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),l!==De(a)&&a.push(l)),a.forEach((t=>o.stop(u(t),e(t)))),o}),WO),gN("geoArea",VO,WO),gN("geoBounds",XO,WO),gN("geoCentroid",JO,WO),gN("geoShape",(function(e,t,n){const i=GO(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),WO),gN("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!==OM&&oe("First argument to indata must be a string literal."),t[1].type!==OM&&oe("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;st(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),gN("data",OO,qO),gN("treePath",(function(e,t,n){const i=sN(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(aN):void 0}),qO),gN("treeAncestors",(function(e,t){const n=sN(e,this)[t];return n?n.ancestors().map(aN):void 0}),qO),gN("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,l=this.context.data[e],u=l?l.values.value:[],c=l?l[AO]&&l[AO].value:void 0,f=n===_O,d=u.length,h=0;h<d;++h)if(i=u[h],c&&f){if(-1===(o=(r=r||{})[a=i.unit]||0))continue;if(s=$O(t,i),r[a]=s?-1:++o,s&&1===c.size)return!0;if(!s&&o===c.get(a).count)return!1}else if(f^(s=$O(t,i)))return s;return d&&f}),FO),gN("vlSelectionIdTest",(function(e,t,n){const i=this.context.data[e],r=i?i.values.value:[],o=i?i[AO]&&i[AO].value:void 0,a=n===_O,s=EO(t),l=SO(r,s);if(l===r.length)return!1;if(EO(r[l])!==s)return!1;if(o&&a){if(1===o.size)return!0;if(MO(r,s)-l<o.size)return!1}return!0}),FO),gN("vlSelectionResolve",(function(e,t,n,i){for(var r,o,a,s,l,u,c,f,d,h,p,m,g=this.context.data[e],y=g?g.values.value:[],v={},b={},x={},_=y.length,w=0;w<_;++w)if(s=(r=y[w]).unit,o=r.fields,a=r.values,o&&a){for(p=0,m=o.length;p<m;++p)l=o[p],f=(c=v[l.field]||(v[l.field]={}))[s]||(c[s]=[]),x[l.field]=d=l.type.charAt(0),h=CO[`${d}_union`],c[s]=h(f,Ge(a[p]));n&&(f=b[s]||(b[s]=[])).push(Ge(a).reduce(((e,t,n)=>(e[o[n].field]=t,e)),{}))}else l=kO,u=EO(r),(f=(c=v[l]||(v[l]={}))[s]||(c[s]=[])).push(u),n&&(f=b[s]||(b[s]=[])).push({[kO]:u});return t=t||wO,v[kO]?v[kO]=CO[`${kO}_${t}`](...Object.values(v[kO])):Object.keys(v).forEach((e=>{v[e]=Object.keys(v[e]).map((t=>v[e][t])).reduce(((n,i)=>void 0===n?i:CO[`${x[e]}_${t}`](n,i)))})),y=Object.keys(b),n&&y.length&&(v[i?"vlPoint":"vlMulti"]=t===wO?{or:y.reduce(((e,t)=>(e.push(...b[t]),e)),[])}:{and:y.map((e=>({or:b[e]})))}),v}),FO),gN("vlSelectionTuples",(function(e,t){return e.map((e=>it(t.fields?{values:t.fields.map((t=>(t.getter||(t.getter=se(t.field)))(e.datum)))}:{[kO]:EO(e.datum)},t)))}));const vN=Ot(["rule"]),bN=Ot(["group","image","rect"]);function xN(e){return(e+"").toLowerCase()}function _N(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var wN={operator:(e,t)=>_N(e,["_"],t.code),parameter:(e,t)=>_N(e,["datum","_"],t.code),event:(e,t)=>_N(e,["event"],t.code),handler:(e,t)=>_N(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 e in i){const t="o["+Dt(e)+"]";r+=`$=${i[e].code};if(${t}!==$)${t}=$,m=1;`}return r+=function(e,t){let n="";return vN[t]||(e.x2&&(e.x?(bN[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?(bN[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;",_N(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(Dt).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 kN(e,t,n){if(!e||!we(e))return e;for(let i,r=0,o=EN.length;r<o;++r)if(i=EN[r],st(e,i.key))return i.parse(e,t,n);return e}var EN=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||oe("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,t){const n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=bt(e.$key,e.$flat,t.expr.codegen))}},{key:"$expr",parse:function(e,t,n){e.$params&&t.parseParameters(e.$params,n);const i="e:"+e.$expr.code;return t.fn[i]||(t.fn[i]=K(t.parameterExpression(e.$expr),e.$fields))}},{key:"$field",parse:function(e,t){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=se(e.$field,e.$name,t.expr.codegen))}},{key:"$encode",parse:function(e,t){const n=e.$encode,i={};for(const e in n){const r=n[e];i[e]=K(t.encodeExpression(r.$expr),r.$fields),i[e].output=r.$output}return i}},{key:"$compare",parse:function(e,t){const n="c:"+e.$compare+"_"+e.$order,i=Ge(e.$compare).map((e=>e&&e.$tupleid?Ra:e));return t.fn[n]||(t.fn[n]=Je(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 Ra}}];const AN={skip:!0};function $N(e,t,n,i){return new DN(e,t,n,i)}function DN(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||wN,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function SN(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 MN(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}DN.prototype=SN.prototype={fork(){const e=new SN(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"===xN(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 i in e.data){const r=n.data[i]||(n.data[i]={});e.data[i].forEach((e=>r[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[xN(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"!==xN(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||oe("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]=_e(r)?r.map((e=>kN(e,n,t))):kN(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&&oe("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=we(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||oe("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],AN)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(de).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const CN="default";function FN(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 ON(e,t){var n=e._runtime.data;return st(n,t)||oe("Unrecognized data set: "+t),n[t]}function NN(e,t){qa(t)||oe("Second argument to changes must be a changeset.");const n=ON(this,e);return n.modified=!0,this.pulse(n.input,t)}function TN(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function zN(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function RN(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}const PN="view",LN={trap:!1};function BN(e,t,n,i){e._eventListeners.push({type:n,sources:Ge(t),handler:i})}function jN(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||we(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function IN(e){return e.item}function UN(e){return e.item.mark.source}function qN(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function WN(e,t,n){const i=document.createElement(e);for(const e in t)i.setAttribute(e,t[e]);return null!=n&&(i.textContent=n),i}const HN="vega-bind-radio";function GN(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),BN(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 YN(e,t,n,i){const r=i.signal(n.signal),o=WN("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(WN("label"));a.appendChild(WN("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=VN;switch(n.input){case"checkbox":s=XN;break;case"select":s=JN;break;case"radio":s=QN;break;case"range":s=ZN}s(e,a,n,r)}function VN(e,t,n,i){const r=WN("input");for(const e in n)"signal"!==e&&"element"!==e&&r.setAttribute("input"===e?"type":e,n[e]);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 XN(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=WN("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function JN(e,t,n,i){const r=WN("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};KN(e,i)&&(n.selected=!0),r.appendChild(WN("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<i;++t)if(KN(n.options[t],e))return void(r.selectedIndex=t)}}function QN(e,t,n,i){const r=WN("span",{class:HN}),o=n.labels||[];t.appendChild(r),e.elements=n.options.map(((t,a)=>{const s={type:"radio",name:n.signal,value:t};KN(t,i)&&(s.checked=!0);const l=WN("input",s);l.addEventListener("change",(()=>e.update(t)));const u=WN("label",{},(o[a]||t)+"");return u.prepend(l),r.appendChild(u),l})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e<i;++e)KN(n[e].value,t)&&(n[e].checked=!0)}}function ZN(e,t,n,i){i=void 0!==i?i:(+n.max+ +n.min)/2;const r=null!=n.max?n.max:Math.max(100,+i)||100,o=n.min||Math.min(0,r,+i)||0,a=n.step||rn(o,r,100),s=WN("input",{type:"range",name:n.signal,min:o,max:r,step:a});s.value=i;const l=WN("span",{},+i);t.appendChild(s),t.appendChild(l);const u=()=>{l.textContent=s.value,e.update(+s.value)};s.addEventListener("input",u),s.addEventListener("change",u),e.elements=[s],e.set=e=>{s.value=e,l.textContent=e}}function KN(e,t){return e===t||e+""==t+""}function eT(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,TN(e),zN(e),RN(e),r,o).background(e.background())}function tT(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function nT(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(n){t=null,e.error(n)}return t}const iT=e=>+e||0;function rT(e){return we(e)?{top:iT(e.top),bottom:iT(e.bottom),left:iT(e.left),right:iT(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(iT(e))}async function oT(e,t,n,i){const r=lx(t),o=r&&r.headless;return o||oe("Unrecognized renderer type: "+t),await e.runAsync(),eT(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var aT="width",sT="height",lT="padding",uT={skip:!0};function cT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===lT?i.left+i.right:0)}function fT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===lT?i.top+i.bottom:0)}function dT(e,t){return t.modified&&_e(t.input.value)&&e.indexOf("_:vega:_")}function hT(e,t){return!("parent"===e||t instanceof ms.proxy)}function pT(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":_e(e)?mT(e):we(e)&&!pt(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(_e(n)?mT(n):gT(n))})).join("\n")):e+"";var t}(i))}function mT(e){return"["+e.map(gT).join(", ")+"]"}function gT(e){return _e(e)?"[…]":we(e)&&!pt(e)?"{…}":e}function yT(e,t){const n=this;if(t=t||{},ds.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=it({},e.locale,t.locale);n.locale(ta(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||ax.Canvas,n._scenegraph=new Lv;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||pT,n._redraw=!0,n._handler=(new cb).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=it({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{_e(e[t])&&(e[t]=Ot(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 $N(e,ms,cN,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:it({},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=cT(n,n._width),n._viewHeight=fT(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[aT],i=t[sT],r=t[lT];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=cT(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=fT(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:CN,item:null}));e.on(e.events("view","mousemove"),t,((e,n)=>{const i=t.value,r=i?vt(i)?i:i.user:CN,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 vt(n)||(i=n.item,n=n.user),FN(e,n&&n!==CN?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function vT(e,t){return st(e._signals,t)?e._signals[t]:oe("Unrecognized signal name: "+Dt(t))}function bT(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function xT(e,t,n,i){let r=bT(n,i);return r||(r=tT(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function _T(e,t,n){const i=bT(t,n);return i&&t._targets.remove(i),e}ft(yT,ds,{async evaluate(e,t,n){if(await ds.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=RN(i=this),o=TN(i),a=zN(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(e){i.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var i,r,o,a;return n&&Oa(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&&MN(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=vT(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",rT(e)):rT(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?(lx(e)||oe("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&&(ds.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(vT(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(aT,n,uT),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(sT,i,uT),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=tT(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.indexOf(e)<0&&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 xT(this,e,vT(this,e),t)},removeSignalListener(e,t){return _T(this,vT(this,e),t)},addDataListener(e,t){return xT(this,e,ON(this,e).values,t)},removeDataListener(e,t){return _T(this,ON(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=FN(this,null);this._globalCursor=!!e,t&&FN(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 E$,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?w$():+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 Za(n),a=function(n,i){r.runAsync(null,(()=>{e===PN&&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(function(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=RN(e),(i=Hv(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;vt(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:tt(e),item:tt(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}(r,n,i))}))};if("timer"===e)jN(r,"timer",t)&&r.timer(a,t);else if(e===PN)jN(r,"view",t)&&r.addEventListener(t,a,LN);else if("window"===e?jN(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&jN(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,l=i.length;s<l;++s)i[s].addEventListener(t,a);BN(r,i,t,a)}else r.warn("Can not resolve event source: "+e);return o},finalize:function(){var e,t,n,i=this._tooltip,r=this._timers,o=this._eventListeners;for(e=r.length;--e>=0;)r[e].stop();for(e=o.length;--e>=0;)for(t=(n=o[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return i&&i.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",IN),UN,qN(e)),this.on(this.events("view","mouseout",IN),UN,qN(t)),this},data:function(e,t){return arguments.length<2?ON(this,e).values.value:NN.call(this,e,Wa().remove(de).insert(t))},change:NN,insert:function(e,t){return NN.call(this,e,Wa().insert(t))},remove:function(e,t){return NN.call(this,e,Wa().remove(t))},scale:function(e){var t=this._runtime.scales;return st(t,e)||oe("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=lx(i);e=n._el=e?nT(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),MN(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||cb,s=e?o.renderer:o.headless;return n._renderer=s?eT(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),tT(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,RN(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=nT(n,t,!0):e.appendChild(WN("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=nT(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=nt(i.debounce,r.update))),(null==i.input&&i.element?GN:YN)(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!==ax.Canvas&&e!==ax.SVG&&e!==ax.PNG&&oe("Unrecognized image type: "+e);const n=await oT(this,e,t);return e===ax.SVG?function(e,t){const n=new Blob([e],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(n.svg()):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await oT(this,ax.Canvas,e,t)).canvas()},toSVG:async function(e){return(await oT(this,ax.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:dT,signals:hT,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this}});const wT="view",kT="[",ET="]",AT="{",$T="}",DT=":",ST=",",MT="@",CT=">",FT=/[[\]{}]/,OT={"*":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 NT,TT;function zT(e,t,n){return NT=t||wT,TT=n||OT,PT(e.trim()).map(LT)}function RT(e,t,n,i,r){const o=e.length;let a,s=0;for(;t<o;++t){if(a=e[t],!s&&a===n)return t;r&&r.indexOf(a)>=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function PT(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=RT(e,r,ST,kT+AT,ET+$T),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function LT(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=RT(e,i,ET,kT,ET),i===t)throw"Empty between selector: "+e;if(n=PT(e.substring(1,i)),2!==n.length)throw"Between selector must have two elements: "+e;if((e=e.slice(i+1).trim())[0]!==CT)throw"Expected '>' after between selector: "+e;n=n.map(LT);const r=LT(e.slice(1).trim());return r.between?{between:n,stream:r}:(r.between=n,r)}(e):function(e){const t={source:NT},n=[];let i,r,o=[0,0],a=0,s=0,l=e.length,u=0;if(e[l-1]===$T){if(u=e.lastIndexOf(AT),!(u>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(ST);if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(u+1,l-1))}catch(t){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;if(e[0]===MT&&(a=++u),i=RT(e,u,DT),i<l&&(n.push(e.substring(s,i).trim()),s=u=++i),u=RT(e,u,kT),u===l)n.push(e.substring(s,l).trim());else if(n.push(e.substring(s,u).trim()),r=[],s=++u,s===l)throw"Unmatched left bracket: "+e;for(;u<l;){if(u=RT(e,u,ET),u===l)throw"Unmatched left bracket: "+e;if(r.push(e.substring(s,u).trim()),u<l-1&&e[++u]!==kT)throw"Expected left bracket: "+e;s=++u}if(!(l=n.length)||FT.test(n[l-1]))throw"Invalid event selector: "+e;var c;return l>1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],TT[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0],"!"===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]),t}(e)}function BT(e){return we(e)?e:{type:e||"pad"}}const jT=e=>+e||0,IT=e=>({top:e,bottom:e,left:e,right:e});function UT(e){return we(e)?e.signal?e:{top:jT(e.top),bottom:jT(e.bottom),left:jT(e.left),right:jT(e.right)}:IT(jT(e))}const qT=e=>we(e)&&!_e(e)?it({},e):{value:e};function WT(e,t,n,i){return null!=n?(we(n)&&!_e(n)||_e(n)&&n.length&&we(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function HT(e,t,n){for(const n in t)WT(e,n,t[n]);for(const t in n)WT(e,t,n[t],"update")}function GT(e,t,n){for(const i in t)n&&st(n,i)||(e[i]=it(e[i]||{},t[i]));return e}function YT(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const VT="mark",XT="frame",JT="scope",QT="axis",ZT="axis-domain",KT="axis-grid",ez="axis-label",tz="axis-tick",nz="axis-title",iz="legend",rz="legend-band",oz="legend-entry",az="legend-gradient",sz="legend-label",lz="legend-symbol",uz="legend-title",cz="title",fz="title-text",dz="title-subtitle";function hz(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const pz=e=>vt(e)?Dt(e):e.signal?`(${e.signal})`:vz(e);function mz(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:Dt(e)));for(;t.length&&null==De(t);)t.pop();return t.unshift(pz(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?gz("hcl",e.h,e.c,e.l):e.h||e.s?gz("hsl",e.h,e.s,e.l):e.l||e.a?gz("lab",e.l,e.a,e.b):e.r||e.g||e.b?gz("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?vz(e.field):void 0!==e.value?Dt(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=pz(e.scale);return 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?"":"*"+yz(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0")),t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${yz(e.exponent)})`),null!=e.mult&&(t+=`*${yz(e.mult)}`),null!=e.offset&&(t+=`+${yz(e.offset)}`),e.round&&(t=`round(${t})`),t}const gz=(e,t,n,i)=>`(${e}(${[t,n,i].map(mz).join(",")})+'')`;function yz(e){return we(e)?"("+mz(e)+")":e}function vz(e){return bz(we(e)?e:{datum:e})}function bz(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):oe("Invalid field reference: "+Dt(e));return e.signal||(i=vt(i)?ae(i).map(Dt).join("]["):bz(i)),t+"["+i+"]"}function xz(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,u,c;for(l in l="lineBreak","text"!==t||null==r[l]||YT(l,e)||hz(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===XT?r.group:n===VT?it({},r.mark,r[t]):null,c)u=YT(l,e)||("fill"===l||"stroke"===l)&&(YT("fill",e)||YT("stroke",e)),u||hz(o,l,c[l]);for(l in Ge(i).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)YT(t,e)||hz(o,t,n[t])})),e=it({},e),o)c=o[l],c.signal?(s=s||{})[l]=c:a[l]=c;return e.enter=it(a,e.enter),s&&(e.update=it(s,e.update)),e}(e,t,n,i,r.config);for(const n in e)a[n]=_z(e[n],t,o,r);return o}function _z(e,t,n,i){const r={},o={};for(const t in e)null!=e[t]&&(r[t]=wz((a=e[t],_e(a)?function(e){let t="";return e.forEach((e=>{const n=mz(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===De(t)&&(t+="null"),t}(a):mz(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function wz(e,t,n,i){const r=yN(e,t);return r.$fields.forEach((e=>i[e]=1)),it(n,r.$params),r.$expr}const kz="outer",Ez=["value","update","init","react","bind"];function Az(e,t){oe(e+' for "outer" push: '+Dt(t))}function $z(e,t){const n=e.name;if(e.push===kz)t.signals[n]||Az("No prior signal definition",n),Ez.forEach((t=>{void 0!==e[t]&&Az("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 Dz(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function Sz(e,t,n,i){return new Dz(e,t,n,i)}function Mz(e,t){return Sz("operator",e,t)}function Cz(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Fz(e,t){return t?{$field:e,$name:t}:{$field:e}}const Oz=Fz("key");function Nz(e,t){return{$compare:e,$order:t}}function Tz(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const zz="scope",Rz="view";function Pz(e){return e&&e.signal}function Lz(e){if(Pz(e))return!0;if(we(e))for(const t in e)if(Lz(e[t]))return!0;return!1}function Bz(e,t){return null!=e?e:t}function jz(e){return e&&e.signal||e}const Iz="timer";function Uz(e,t){return(e.merge?qz:e.stream?Wz:e.type?Hz:oe("Invalid stream specification: "+Dt(e)))(e,t)}function qz(e,t){const n=Gz({merge:e.merge.map((e=>Uz(e,t)))},e,t);return t.addStream(n).id}function Wz(e,t){const n=Gz({stream:Uz(e.stream,t)},e,t);return t.addStream(n).id}function Hz(e,t){let n;var i;e.type===Iz?(n=t.event(Iz,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===zz?Rz:i||Rz,e.type);const r=Gz({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function Gz(e,t,n){let i=t.between;return i&&(2!==i.length&&oe('Stream "between" parameter must have 2 entries: '+Dt(t)),e.between=[Uz(i[0],n),Uz(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===zz&&i.push("inScope(event.item)"),i.length&&(e.filter=yN("("+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 Yz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Vz(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const Xz=e=>(t,n,i)=>Sz(e,n,t||void 0,i),Jz=Xz("aggregate"),Qz=Xz("axisticks"),Zz=Xz("bound"),Kz=Xz("collect"),eR=Xz("compare"),tR=Xz("datajoin"),nR=Xz("encode"),iR=Xz("expression"),rR=Xz("facet"),oR=Xz("field"),aR=Xz("key"),sR=Xz("legendentries"),lR=Xz("load"),uR=Xz("mark"),cR=Xz("multiextent"),fR=Xz("multivalues"),dR=Xz("overlap"),hR=Xz("params"),pR=Xz("prefacet"),mR=Xz("projection"),gR=Xz("proxy"),yR=Xz("relay"),vR=Xz("render"),bR=Xz("scale"),xR=Xz("sieve"),_R=Xz("sortitems"),wR=Xz("viewlayout"),kR=Xz("values");let ER=0;const AR={min:"min",max:"max",count:"sum"};function $R(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=CR(e.domain,e,t),null!=e.range&&(n.range=LR(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=DR(e.type||e),null!=e.gamma&&(t.interpolateGamma=DR(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e){return we(e)?{interval:DR(e.interval),step:DR(e.step)}:DR(e)}(e.nice)),null!=e.bins&&(n.bins=function(e,t){return e.signal||_e(e)?SR(e,t):t.objectProperty(e)}(e.bins,t)),e)st(n,i)||"name"===i||(n[i]=DR(e[i],t))}function DR(e,t){return we(e)?e.signal?t.signalRef(e.signal):oe("Unsupported object: "+Dt(e)):e}function SR(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>DR(e,t)))}function MR(e){oe("Can not find data set: "+Dt(e))}function CR(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(_e(e)?FR:e.fields?NR:OR)(e,t,n);null==t.domainMin&&null==t.domainMax||oe("No scale domain defined for domainMin/domainMax to override.")}function FR(e,t,n){return e.map((e=>DR(e,n)))}function OR(e,t,n){const i=n.getData(e.data);return i||MR(e.data),Jp(t.type)?i.valuesRef(n,e.field,zR(e.sort,!1)):em(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function NR(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=vt(t)?{data:i,field:t}:_e(t)||t.signal?function(e,t){const n="_:vega:_"+ER++,i=Kz({});if(_e(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+Dt(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,xR({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(Jp(t.type)?TR:em(t.type)?RR:PR)(e,n,r)}function TR(e,t,n){const i=zR(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||MR(e.data),n.countsRef(t,e.field,i)})),s={groupby:Oz,pulse:a};i&&(r=i.op||"count",o=i.field?Tz(r,i.field):"count",s.ops=[AR[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(Jz(s));const l=t.add(Kz({pulse:Cz(r)}));return o=t.add(kR({field:Oz,sort:t.sortRef(i),pulse:Cz(l)})),Cz(o)}function zR(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!AR[e.op]&&oe("Multiple domain scales can not be sorted using "+e.op):oe("No field provided for sort aggregate op: "+e.op):we(e)?e.field="key":e={field:"key"}),e}function RR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||MR(e.data),n.domainRef(t,e.field)}));return Cz(t.add(fR({values:i})))}function PR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||MR(e.data),n.extentRef(t,e.field)}));return Cz(t.add(cR({extents:i})))}function LR(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(vt(r)){if(i&&st(i,r))return LR(e=it({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Jp(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:oe("Unrecognized scale range value: "+Dt(r))}else{if(r.scheme)return n.scheme=_e(r.scheme)?SR(r.scheme,t):DR(r.scheme,t),r.extent&&(n.schemeExtent=SR(r.extent,t)),void(r.count&&(n.schemeCount=DR(r.count,t)));if(r.step)return void(n.rangeStep=DR(r.step,t));if(Jp(e.type)&&!_e(r))return CR(r,e,t);_e(r)||oe("Unsupported range type: "+Dt(r))}return r.map((e=>(_e(e)?SR:DR)(e,t)))}function BR(e,t,n){return _e(e)?e.map((e=>BR(e,t,n))):we(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:oe("Unsupported parameter object: "+Dt(e)):e}const jR="top",IR="left",UR="right",qR="bottom",WR="center",HR="vertical",GR="start",YR="end",VR="index",XR="label",JR="offset",QR="perc",ZR="perc2",KR="value",eP="guide-label",tP="guide-title",nP="group-title",iP="group-subtitle",rP="symbol",oP="gradient",aP="discrete",sP="size",lP=[sP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],uP={name:1,style:1,interactive:1},cP={value:0},fP={value:1},dP="group",hP="rect",pP="rule",mP="symbol",gP="text";function yP(e){return e.type=dP,e.interactive=e.interactive||!1,e}function vP(e,t){const n=(n,i)=>Bz(e[n],Bz(t[n],i));return n.isVertical=n=>HR===Bz(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>Bz(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>Bz(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>Bz(e.columns,Bz(t.columns,+n.isVertical(!0))),n}function bP(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 xP(e,t,n){return`item.anchor === '${GR}' ? ${e} : item.anchor === '${YR}' ? ${t} : ${n}`}const _P=xP(Dt(IR),Dt(UR),Dt(WR));function wP(e,t){return t?e?we(e)?Object.assign({},e,{offset:wP(e.offset,t)}):{value:e,offset:t}:t:e}function kP(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=GT(e.encode,t,uP)):e.interactive=!1,e}function EP(e,t,n,i){const r=vP(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let l,u,c,f,d;o?(u=[0,1],c=[0,0],f=a,d=s):(u=[0,0],c=[1,0],f=s,d=a);const h={enter:l={opacity:cP,x:cP,y:cP,width:qT(f),height:qT(d)},update:it({},l,{opacity:fP,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:cP}};return HT(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),kP({type:hP,role:az,encode:h},i)}function AP(e,t,n,i,r){const o=vP(e,n),a=o.isVertical(),s=o.gradientThickness(),l=o.gradientLength();let u,c,f,d,h="";a?(u="y",f="y2",c="x",d="width",h="1-"):(u="x",f="x2",c="y",d="height");const p={opacity:cP,fill:{scale:t,field:KR}};p[u]={signal:h+"datum."+QR,mult:l},p[c]=cP,p[f]={signal:h+"datum."+ZR,mult:l},p[d]=qT(s);const m={enter:p,update:it({},p,{opacity:fP}),exit:{opacity:cP}};return HT(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),kP({type:hP,role:rz,key:KR,from:r,encode:m},i)}const $P=`datum.${QR}<=0?"${IR}":datum.${QR}>=1?"${UR}":"${WR}"`,DP=`datum.${QR}<=0?"${qR}":datum.${QR}>=1?"${jR}":"middle"`;function SP(e,t,n,i){const r=vP(e,t),o=r.isVertical(),a=qT(r.gradientThickness()),s=r.gradientLength();let l,u,c,f,d=r("labelOverlap"),h="";const p={enter:l={opacity:cP},update:u={opacity:fP,text:{field:XR}},exit:{opacity:cP}};return HT(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:Bz(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=u.baseline={signal:DP},c="y",f="x",h="1-"):(l.align=u.align={signal:$P},l.baseline={value:"top"},c="x",f="y"),l[c]=u[c]={signal:h+"datum."+QR,mult:s},l[f]=u[f]=a,a.offset=Bz(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+VR}:void 0,kP({type:gP,role:sz,style:eP,key:KR,from:i,encode:p,overlap:d},n)}function MP(e,t,n,i,r){const o=vP(e,t),a=n.entries,s=!(!a||!a.interactive),l=a?a.name:void 0,u=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${JR} : datum.${sP}`,h=u?qT(u):{field:sP},p=`datum.${VR}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:cP,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:fP,x:y.x,y:y.y},exit:{opacity:cP}};let _=null,w=null;e.fill||(_=t.symbolBaseFillColor,w=t.symbolBaseStrokeColor),HT(g,{fill:o("symbolFillColor",_),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),lP.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:KR})}));const k=kP({type:mP,role:lz,key:KR,from:f,clip:!!u||void 0,encode:g},n.symbols),E=qT(c);E.offset=o("labelOffset"),g={enter:y={opacity:cP,x:{signal:d,offset:E},y:h},update:v={opacity:fP,text:{field:XR},x:y.x,y:y.y},exit:{opacity:cP}},HT(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 A=kP({type:gP,role:sz,style:eP,key:KR,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:cP,height:u?qT(u):cP,opacity:cP},exit:{opacity:cP},update:v={opacity:fP,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}`,yP({role:JT,from:i={facet:{data:i,name:"value",groupby:VR}},encode:GT(g,a,uP),marks:[k,A],name:l,interactive:s,sort:x})}const CP='item.orient === "left"',FP='item.orient === "right"',OP=`(${CP} || ${FP})`,NP=`datum.vgrad && ${OP}`,TP=xP('"top"','"bottom"','"middle"'),zP=`datum.vgrad && ${FP} ? (${xP('"right"','"left"','"center"')}) : (${OP} && !(datum.vgrad && ${CP})) ? "left" : ${_P}`,RP=`item._anchor || (${OP} ? "middle" : "start")`,PP=`${NP} ? (${CP} ? -90 : 90) : 0`,LP=`${OP} ? (datum.vgrad ? (${FP} ? "bottom" : "top") : ${TP}) : "top"`;function BP(e,t){let n;return we(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+jP(e.path)+")":e.sphere&&(n="geoShape("+jP(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function jP(e){return we(e)&&e.signal?e.signal:Dt(e)}function IP(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===dP?JT:t||VT:t}function UP(e){return{marktype:e.type,name:e.name||void 0,role:e.role||IP(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function qP(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function WP(e,t){const n=gs(e.type);n||oe("Unrecognized transform type: "+Dt(e.type));const i=Sz(n.type.toLowerCase(),null,HP(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function HP(e,t,n){const i={},r=e.params.length;for(let o=0;o<r;++o){const r=e.params[o];i[r.name]=GP(r,t,n)}return i}function GP(e,t,n){const i=e.type,r=t[e.name];return"index"===i?function(e,t,n){return vt(t.from)||oe('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}(0,t,n):void 0!==r?"param"===i?function(e,t,n){const i=t[e.name];return e.array?(_e(i)||oe("Expected an array of sub-parameters. Instead: "+Dt(i)),i.map((t=>VP(e,t,n)))):VP(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!Pz(r)?r.map((t=>YP(e,t,n))):YP(e,r,n):void(e.required&&oe("Missing required "+Dt(t.type)+" parameter: "+Dt(e.name)))}function YP(e,t,n){const i=e.type;if(Pz(t))return ZP(i)?oe("Expression references can not be signals."):KP(i)?n.fieldRef(t):eL(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||KP(i);return r&&XP(t)?n.exprRef(t.expr,t.as):r&&JP(t)?Fz(t.field,t.as):ZP(i)?yN(t,n):QP(i)?Cz(n.getData(t).values):KP(i)?Fz(t):eL(i)?n.compareRef(t):t}}function VP(e,t,n){const i=e.params.length;let r;for(let n=0;n<i;++n){r=e.params[n];for(const e in r.key)if(r.key[e]!==t[e]){r=null;break}if(r)break}r||oe("Unsupported parameter: "+Dt(t));const o=it(HP(r,t,n),r.key);return Cz(n.add(hR(o)))}const XP=e=>e&&e.expr,JP=e=>e&&e.field,QP=e=>"data"===e,ZP=e=>"expr"===e,KP=e=>"field"===e,eL=e=>"compare"===e;function tL(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Cz(t.getData(e.data).output)}function nL(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function iL(e){return vt(e)?e:null}function rL(e,t,n){const i=Tz(n.op,n.field);let r;if(t.ops){for(let e=0,n=t.as.length;e<n;++e)if(t.as[e]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function oL(e,t,n,i,r,o,a){const s=t[n]||(t[n]={}),l=function(e){return we(e)?("descending"===e.order?"-":"+")+Tz(e.op,e.field):""}(o);let u,c,f=iL(r);if(null!=f&&(e=t.scope,f+=l?"|"+l:"",u=s[f]),!u){const n=o?{field:Oz,pulse:t.countsRef(e,r,o)}:{field:e.fieldRef(r),pulse:Cz(t.output)};l&&(n.sort=e.sortRef(o)),c=e.add(Sz(i,void 0,n)),a&&(t.index[r]=c),u=Cz(c),null!=f&&(s[f]=u)}return u}function aL(e,t,n){const i=e.remove,r=e.insert,o=e.toggle,a=e.modify,s=e.values,l=t.add(Mz()),u=yN("if("+e.trigger+',modify("'+n+'",'+[r,i,o,a,s].map((e=>null==e?"null":e)).join(",")+"),0)",t);l.update=u.$expr,l.params=u.$params}function sL(e,t){const n=IP(e),i=e.type===dP,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,u,c,f,d,h=e.layout||n===JT||n===XT;const p=n===VT||h||r,m=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||oe("Only group marks can be faceted."),null!=i.field?a=s=tL(i,n):(e.data?s=Cz(n.getData(e.data).aggregate):(o=WP(it({type:"aggregate",groupby:Ge(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=tL(i,n),a=s=Cz(n.add(o))),r=n.keyRef(i.groupby,!0))):a=Cz(n.add(Kz(null,[{}]))),a||(a=tL(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(tR({key:m.key||(e.key?Fz(e.key):void 0),pulse:m.pulse,clean:!i}));const g=Cz(s);s=l=t.add(Kz({pulse:g})),s=t.add(uR({markdef:UP(e),interactive:qP(e.interactive,t),clip:BP(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Cz(s)}));const y=Cz(s);s=u=t.add(nR(xz(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),s.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=WP(e,t),i=n.metadata;(i.generates||i.changes)&&oe("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),n.params.pulse=Cz(s),t.add(s=n)})),e.sort&&(s=t.add(_R({sort:t.compareRef(e.sort),pulse:Cz(s)})));const v=Cz(s);(r||h)&&(h=t.add(wR({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:v})),f=Cz(h));const b=t.add(Zz({mark:y,pulse:f||v}));d=Cz(b),i&&(p&&(a=t.operators,a.pop(),h&&a.pop()),t.pushState(v,f||d,g),r?function(e,t,n){const i=e.from.facet,r=i.name,o=tL(i,t);let a;i.name||oe("Facet must have a name: "+Dt(i)),i.data||oe("Facet must reference a data set: "+Dt(i)),i.field?a=t.add(pR({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(rR({key:t.keyRef(i.groupby),group:Cz(t.proxy(n.parent)),pulse:o})):oe("Facet must specify groupby or field: "+Dt(i));const s=t.fork(),l=s.add(Kz()),u=s.add(xR({pulse:Cz(l)}));s.addData(r,new nL(s,l,l,u)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(e).toRuntime()}}(e,t,m):p?function(e,t,n){const i=t.add(pR({pulse:n.pulse})),r=t.fork();r.add(xR()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,m):t.parse(e),t.popState(),p&&(h&&a.push(h),a.push(b))),o&&(d=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:Pz(o)?n.signalRef(o.signal):o,method:Pz(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(a.sort=n.compareRef({field:e.order})),r){const e=r.tolerance;a.boundTolerance=Pz(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return Cz(n.add(dR(a)))}(o,d,t));const x=t.add(vR({pulse:d})),_=t.add(xR({pulse:Cz(x)},void 0,t.parent()));null!=e.name&&(c=e.name,t.addData(c,new nL(t,l,x,_)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&oe("Marks only support modify triggers."),aL(e,t,c)})))}function lL(e,t,n){const i={enter:{},update:{}};return HT(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 uL(e,t,n){return t[e]?`scale("${t[e]}",datum)`:bP(e,n[0].encode)}nL.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;++s)t[s].params.pulse=Cz(t[s-1]),e.add(t[s]),"aggregate"===t[s].type&&(a=t[s]);return new nL(e,o,r,i,a)},nL.prototype={countsRef(e,t,n){const i=this,r=i.counts||(i.counts={}),o=iL(t);let a,s,l;return null!=o&&(e=i.scope,a=r[o]),a?n&&n.field&&rL(e,a.agg.params,n):(l={groupby:e.fieldRef(t,"key"),pulse:Cz(i.output)},n&&n.field&&rL(e,l,n),s=e.add(Jz(l)),a=e.add(Kz({pulse:Cz(s)})),a={agg:s,ref:Cz(a)},null!=o&&(r[o]=a)),a.ref},tuplesRef(){return Cz(this.values)},extentRef(e,t){return oL(e,this,"extent","extent",t,!1)},domainRef(e,t){return oL(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return oL(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return oL(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return oL(e,this,"indata","tupleindex",t,!0,!0)}};const cL=`item.orient==="${IR}"?-90:item.orient==="${UR}"?90:0`;function fL(e,t){const n={enter:{},update:{}};return HT(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:_P},angle:{signal:cL},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),GT(n,t,uP)}function dL(e){const t=Kz({},e);return t.metadata={source:!0},t}function hL(e,t){return lR({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const pL=e=>e===qR||e===jR,mL=(e,t,n)=>Pz(e)?wL(e.signal,t,n):e===IR||e===jR?t:n,gL=(e,t,n)=>Pz(e)?xL(e.signal,t,n):pL(e)?t:n,yL=(e,t,n)=>Pz(e)?_L(e.signal,t,n):pL(e)?n:t,vL=(e,t,n)=>Pz(e)?kL(e.signal,t,n):e===jR?{value:t}:{value:n},bL=(e,t,n)=>Pz(e)?EL(e.signal,t,n):e===UR?{value:t}:{value:n},xL=(e,t,n)=>AL(`${e} === '${jR}' || ${e} === '${qR}'`,t,n),_L=(e,t,n)=>AL(`${e} !== '${jR}' && ${e} !== '${qR}'`,t,n),wL=(e,t,n)=>DL(`${e} === '${IR}' || ${e} === '${jR}'`,t,n),kL=(e,t,n)=>DL(`${e} === '${jR}'`,t,n),EL=(e,t,n)=>DL(`${e} === '${UR}'`,t,n),AL=(e,t,n)=>(t=null!=t?qT(t):t,n=null!=n?qT(n):n,$L(t)&&$L(n)?{signal:`${e} ? (${t=t?t.signal||Dt(t.value):null}) : (${n=n?n.signal||Dt(n.value):null})`}:[it({test:e},t)].concat(n||[])),$L=e=>null==e||1===Object.keys(e).length,DL=(e,t,n)=>({signal:`${e} ? (${ML(t)}) : (${ML(n)})`}),SL=(e,t,n,i,r)=>({signal:(null!=i?`${e} === '${IR}' ? (${ML(i)}) : `:"")+(null!=n?`${e} === '${qR}' ? (${ML(n)}) : `:"")+(null!=r?`${e} === '${UR}' ? (${ML(r)}) : `:"")+(null!=t?`${e} === '${jR}' ? (${ML(t)}) : `:"")+"(null)"}),ML=e=>Pz(e)?e.signal:null==e?null:Dt(e),CL=(e,t)=>0===t?0:Pz(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},FL=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function OL(e,t,n,i){let r;if(t&&st(t,e))return t[e];if(st(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[tP][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[eP][r]}return null}function NL(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function TL(e,t){return{scale:e.scale,range:t}}function zL(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function RL(e,t){const n=function(e,t){var n,i,r,o=t.config,a=o.style,s=o.axis,l="band"===t.scaleType(e.scale)&&o.axisBand,u=e.orient;if(Pz(u)){const e=NL([o.axisX,o.axisY]),t=NL([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(r of(n={},e))n[r]=gL(u,OL(r,o.axisX,s,a),OL(r,o.axisY,s,a));for(r of(i={},t))i[r]=SL(u.signal,OL(r,o.axisTop,s,a),OL(r,o.axisBottom,s,a),OL(r,o.axisLeft,s,a),OL(r,o.axisRight,s,a))}else n=u===jR||u===qR?o.axisX:o.axisY,i=o["axis"+u[0].toUpperCase()+u.slice(1)];return n||i||l?it({},s,n,i,l):s}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,l=vP(e,n),u=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'`},we(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}}(l),c={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},f=Cz(t.add(Kz({},[c]))),d=Cz(t.add(Qz({scale:t.scaleRef(e.scale),extra:t.property(u.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(function(e,t,n,i,r){const o=vP(e,t),a=e.orient,s=e.gridScale,l=mL(a,1,-1),u=function(e,t){if(1===t);else if(we(e)){let n=e=it({},e);for(;null!=n.mult;){if(!we(n.mult))return n.mult=Pz(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=it({},n.mult)}n.mult=t}else e=Pz(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,f,d;const h={enter:c={opacity:cP},update:d={opacity:fP},exit:f={opacity:cP}};HT(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:KR,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=gL(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:l,offset:u}:{value:0,offset:u},y=s?{scale:s,range:1,mult:l,offset:u}:it(m,{mult:l,offset:u});return c.x=d.x=gL(a,p,g),c.y=d.y=yL(a,p,g),c.x2=d.x2=yL(a,y),c.y2=d.y2=gL(a,y),f.x=gL(a,p),f.y=yL(a,p),kP({type:pP,role:KT,key:KR,from:i,encode:h},n)}(e,n,i.grid,d,u)),c.ticks&&(p=l("tickSize"),h.push(function(e,t,n,i,r,o){const a=vP(e,t),s=e.orient,l=mL(s,-1,1);let u,c,f;const d={enter:u={opacity:cP},update:f={opacity:fP},exit:c={opacity:cP}};HT(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=qT(r);h.mult=l;const p={scale:e.scale,field:KR,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=u.y=gL(s,cP,p),f.y2=u.y2=gL(s,h),c.x=gL(s,p),f.x=u.x=yL(s,cP,p),f.x2=u.x2=yL(s,h),c.y=yL(s,p),kP({type:pP,role:tz,key:KR,from:i,encode:d},n)}(e,n,i.ticks,d,p,u))),c.labels&&(p=c.ticks?p:0,h.push(function(e,t,n,i,r,o){const a=vP(e,t),s=e.orient,l=e.scale,u=mL(s,-1,1),c=jz(a("labelFlush")),f=jz(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=qT(r);g.mult=u,g.offset=qT(a("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:KR,band:.5,offset:wP(o.offset,a("labelOffset"))},v=gL(s,m?zL(l,c,'"left"','"right"','"center"'):{value:"center"},bL(s,"left","right")),b=gL(s,vL(s,"bottom","top"),m?zL(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=zL(l,c,`-(${f})`,f,0);m=m&&f;const _={opacity:cP,x:gL(s,y,g),y:yL(s,y,g)},w={enter:_,update:p={opacity:fP,text:{field:XR},x:_.x,y:_.y,align:v,baseline:b},exit:{opacity:cP,x:_.x,y:_.y}};HT(w,{dx:!d&&m?gL(s,x):null,dy:!h&&m?yL(s,x):null}),HT(w,{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 k=a("labelBound");let E=a("labelOverlap");return E=E||k?{separation:a("labelSeparation"),method:E,order:"datum.index",bound:k?{scale:l,orient:s,tolerance:k}:null}:void 0,p.align!==v&&(p.align=FL(p.align,v)),p.baseline!==b&&(p.baseline=FL(p.baseline,b)),kP({type:gP,role:ez,style:eP,key:KR,from:i,encode:w,overlap:E},n)}(e,n,i.labels,d,p,u))),c.domain&&h.push(function(e,t,n,i){const r=vP(e,t),o=e.orient;let a,s;const l={enter:a={opacity:cP},update:s={opacity:fP},exit:{opacity:cP}};HT(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=TL(e,0),c=TL(e,1);return a.x=s.x=gL(o,u,cP),a.x2=s.x2=gL(o,c),a.y=s.y=yL(o,u,cP),a.y2=s.y2=yL(o,c),kP({type:pP,role:ZT,from:i,encode:l},n)}(e,n,i.domain,f)),c.title&&h.push(function(e,t,n,i){const r=vP(e,t),o=e.orient,a=mL(o,-1,1);let s,l;const u={enter:s={opacity:cP,anchor:qT(r("titleAnchor",null)),align:{signal:_P}},update:l=it({},s,{opacity:fP,text:qT(e.title)}),exit:{opacity:cP}},c={signal:`lerp(range("${e.scale}"), ${xP(0,1,.5)})`};return l.x=gL(o,c),l.y=yL(o,c),s.angle=gL(o,cP,CL(a,90)),s.baseline=gL(o,vL(o,qR,jR),{value:qR}),l.angle=s.angle,l.baseline=s.baseline,HT(u,{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]=FL(qT(e),n.update[t]),!1):!YT(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?qT(a):gL(t,qT(a),qT(o))}(r,o,u,n),u.update.align=FL(u.update.align,s.align),u.update.angle=FL(u.update.angle,s.angle),u.update.baseline=FL(u.update.baseline,s.baseline),kP({type:gP,role:nz,style:tP,from:i,encode:u},n)}(e,n,i.title,f)),sL(yP({role:QT,from:f,encode:GT(PL(l,e),r,uP),marks:h,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:o,interactive:a,style:s}),t)}function PL(e,t){const n={enter:{},update:{}};return HT(n,{orient:e("orient"),offset:e("offset")||0,position:Bz(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 LL(e,t,n){const i=Ge(e.signals),r=Ge(e.scales);return n||i.forEach((e=>$z(e,t))),Ge(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=BR(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=BR(n[e],e,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";Yp(n)||oe("Unrecognized scale type: "+Dt(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),Ge(e.data).forEach((e=>function(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(WP(e,t))})),e.on&&e.on.forEach((n=>{aL(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,o,a,s,l,u=null,c=!1,f=!1;for(e.values?Pz(e.values)||Lz(e.format)?(i.push(hL(t,e)),i.push(u=dL())):i.push(u=dL({$ingest:e.values,$format:e.format})):e.url?Lz(e.url)||Lz(e.format)?(i.push(hL(t,e)),i.push(u=dL())):i.push(u=dL({$request:e.url,$format:e.format})):e.source&&(u=r=Ge(e.source).map((e=>Cz(t.getData(e).output))),i.push(null)),o=0,a=n.length;o<a;++o)s=n[o],l=s.metadata,u||l.source||i.push(u=dL()),i.push(s),l.generates&&(f=!0),l.modifies&&!f&&(c=!0),l.source?u=s:l.changes&&(u=null);return r&&(a=r.length-1,i[0]=yR({derive:c,pulse:a?r:r[0]}),(c||a)&&i.splice(1,0,dL())),u||i.push(dL()),i.push(xR({})),i}(e,t,n))}(e,t))),r.forEach((e=>$R(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?oe("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=yN(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>function(e,t,n){const i=e.encode,r={target:n};let o=e.events,a=e.update,s=[];o||oe("Signal update missing events specification."),vt(o)&&(o=zT(o,t.isSubscope()?zz:Rz)),o=Ge(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[Vz(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&oe("Signal encode and update are mutually exclusive."),a="encode(item(),"+Dt(i)+")"),r.update=vt(a)?yN(a,t):null!=a.expr?yN(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:Yz,$params:{$value:t.signalRef(a.signal)}}:oe("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(it(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):Uz(e,t)}}(e,t),r))))}(e,t,n.id)))}(e,t))),Ge(e.axes).forEach((e=>RL(e,t))),Ge(e.marks).forEach((e=>sL(e,t))),Ge(e.legends).forEach((e=>function(e,t){const n=t.config.legend,i=e.encode||{},r=vP(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,l=o.style,u={};let c,f,d,h=0;lP.forEach((t=>e[t]?(u[t]=e[t],h=h||e[t]):0)),h||oe("Missing valid scale for legend.");const p=function(e,t){let n=e.type||rP;return e.type||1!==function(e){return lP.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=Xp(t)?oP:Qp(t)?aP:rP),n!==oP?n:Qp(t)?aP:oP}(e,t.scaleType(h)),m={title:null!=e.title,scales:u,type:p,vgrad:"symbol"!==p&&r.isVertical()},g=Cz(t.add(Kz(null,[m]))),y=Cz(t.add(sR(f={type:p,scale:t.scaleRef(h),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 p===oP?(d=[EP(e,h,n,i.gradient),SP(e,n,i.labels,y)],f.count=f.count||t.signalRef(`max(2,2*floor((${jz(r.gradientLength())})/100))`)):p===aP?d=[AP(e,h,n,i.gradient,y),SP(e,n,i.labels,y)]:(c=function(e,t){const n=vP(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),d=[MP(e,n,i,y,jz(c.columns))],f.size=function(e,t,n){const i=jz(uL("size",e,n)),r=jz(uL("strokeWidth",e,n)),o=jz(function(e,t,n){return bP("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i.fontSize}(0,t,n)}(n[1].encode,t,eP));return yN(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,d[0].marks)),d=[yP({role:oz,from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(e,t,n,i){const r=vP(e,t),o={enter:{opacity:cP},update:{opacity:fP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:cP}};return HT(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:RP},angle:{signal:PP},align:{signal:zP},baseline:{signal:LP},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")}),kP({type:gP,role:uz,style:tP,from:i,encode:o},n)}(e,n,i.title,g)),sL(yP({role:iz,from:g,encode:GT(lL(r,e,n),o,uP),marks:d,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:s,style:l}),t)}(e,t))),e.title&&function(e,t){const n=vP(e=vt(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,a=r.interactive,s=r.style,l=[],u=Cz(t.add(Kz(null,[{}])));l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return HT(o,{text:e.text,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kP({type:gP,role:fz,style:nP,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||it({name:e.name,interactive:e.interactive,style:e.style},t)}(e),u)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return HT(o,{text:e.subtitle,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kP({type:gP,role:dz,style:iP,from:i,encode:o},n)}(e,n,i.subtitle,u)),sL(yP({role:cz,from:u,encode:fL(n,r),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),t)}(e.title,t),t.parseLambdas(),t}const BL=e=>GT({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function jL(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function IL(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 UL(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 qL(e){return(_e(e)?WL:HL)(e)}function WL(e){const t=e.length;let n="[";for(let i=0;i<t;++i){const t=e[i];n+=(i>0?",":"")+(we(t)?t.signal||qL(t):Dt(t))}return n+"]"}function HL(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+Dt(t)+":"+(we(n)?n.signal||qL(n):Dt(n));return i+"}"}function GL(e,t,n){return we(e)||oe("Input Vega specification must be an object."),t=Ee(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:r},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:r,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:r,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),t,e.config),function(e,t){const n=t.config,i=Cz(t.root=t.add(Mz())),r=function(e,t){const n=n=>Bz(e[n],t[n]),i=[jL("background",n("background")),jL("autosize",BT(n("autosize"))),jL("padding",UT(n("padding"))),jL("width",n("width")||0),jL("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return Ge(e.signals).forEach((e=>{st(r,e.name)?e=it(r[e.name],e):i.push(e),o[e.name]=e})),Ge(t.signals).forEach((e=>{st(o,e.name)||st(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>$z(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(Kz()),a=t.add(nR(xz(BL(e.encode),dP,XT,e.style,t,{pulse:Cz(o)}))),s=t.add(wR({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:Cz(a)}));t.operators.pop(),t.pushState(Cz(a),Cz(s),null),LL(e,t,r),t.operators.push(s);let l=t.add(Zz({mark:i,pulse:Cz(s)}));return l=t.add(vR({pulse:Cz(l)})),l=t.add(xR({pulse:Cz(l)})),t.addData("root",new nL(t,o,o,l)),t}(e,new IL(t,n)).toRuntime()}IL.prototype=UL.prototype={parse(e){return LL(e,this)},fork(){return new UL(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 Dz?Cz(e):e;return this.add(gR({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(Cz(this.add(xR({pulse:e})))),this._parent.push(t),this._lookup.push(n?Cz(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return De(this._parent)},encode(){return De(this._encode)},lookup(){return De(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(vt(e))return Fz(e,t);e.signal||oe("Unsupported field reference: "+Dt(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=Cz(this.add(oR(e)))}return i},compareRef(e){let t=!1;const n=e=>Pz(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=Ge(e.field).map(n),r=Ge(e.order).map(n);return t?Cz(this.add(eR({fields:i,orders:r}))):Nz(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=Ge(e).map((e=>Pz(e)?(n=!0,Cz(i[e.signal])):e)),n?Cz(this.add(aR({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=Tz(e.op,e.field),n=e.order||"ascending";return n.signal?Cz(this.add(eR({fields:t,orders:this.signalRef(n.signal)}))):Nz(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 st(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&oe("Duplicate signal name: "+Dt(e));const n=t instanceof Dz?t:this.add(Mz(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||oe("Unrecognized signal name: "+Dt(e)),this.signals[e]},signalRef(e){return this.signals[e]?Cz(this.signals[e]):(st(this.lambdas,e)||(this.lambdas[e]=this.add(Mz(null))),Cz(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){const n=e[t],i=yN(n,this),r=this.lambdas[n];r.params=i.$params,r.update=i.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&we(e)?this.signalRef(e.signal||qL(e)):e},exprRef(e,t){const n={expr:yN(e,this)};return t&&(n.expr.$name=t),Cz(this.add(iR(n)))},addBinding(e,t){this.bindings||oe("Nested signals do not support binding: "+Dt(e)),this.bindings.push(it({signal:e},t))},addScaleProj(e,t){st(this.scales,e)&&oe("Duplicate scale or projection name: "+Dt(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,bR(t))},addProjection(e,t){this.addScaleProj(e,mR(t))},getScale(e){return this.scales[e]||oe("Unrecognized scale name: "+Dt(e)),this.scales[e]},scaleRef(e){return Cz(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return st(this.data,e)&&oe("Duplicate data set name: "+Dt(e)),this.data[e]=t},getData(e){return this.data[e]||oe("Undefined data set name: "+Dt(e)),this.data[e]},addDataPipeline(e,t){return st(this.data,e)&&oe("Duplicate data set name: "+Dt(e)),this.addData(e,nL.fromEntries(this,t))}};var YL="5.25.0";it(ms,o,s,l,u,c,d,f,h,p,m,g);var VL={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},XL={"*":(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>=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>>t,">>>":(e,t)=>e>>>t},JL={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const QL=Array.prototype.slice,ZL=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,QL.call(t,1))};var KL={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,i,r,o,a)=>new Date(e,t||0,null!=n?n:1,i||0,r||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 ZL("join",arguments)},indexof:function(){return ZL("indexOf",arguments)},lastindexof:function(){return ZL("lastIndexOf",arguments)},slice:function(){return ZL("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return ZL("substring",arguments,String)},split:function(){return ZL("split",arguments,String)},replace:function(){return ZL("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const eB=["view","item","group","xy","x","y"],tB=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&tB.add(setImmediate);const nB={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:VL[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),!tB.has(i[r]))return i[r];console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),"if"===i?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||KL[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>XL[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>JL[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 i=e(n.key);return e.memberDepth-=1,tB.has(e(n.value))?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):t[i]=e(n.value),t}),{})};function iB(e,t,n,i,r,o){const a=e=>nB[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=i,a.event=r,a.item=o,eB.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var rB={operator(e,t){const n=t.ast,i=e.functions;return e=>iB(n,i,e)},parameter(e,t){const n=t.ast,i=e.functions;return(e,t)=>iB(n,i,t,e)},event(e,t){const n=t.ast,i=e.functions;return e=>iB(n,i,void 0,void 0,e)},handler(e,t){const n=t.ast,i=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return iB(n,i,e,r,t)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in i)s=iB(i[n].ast,r,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),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&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,i,o),l}}},oB=n(36425),aB=n.n(oB),sB=n(66471),lB=n.n(sB),uB=n(56440),cB=n.n(uB);function fB(e){return!!e.or}function dB(e){return!!e.and}function hB(e){return!!e.not}function pB(e,t){if(hB(e))pB(e.not,t);else if(dB(e))for(const n of e.and)pB(n,t);else if(fB(e))for(const n of e.or)pB(n,t);else t(e)}function mB(e,t){return hB(e)?{not:mB(e.not,t)}:dB(e)?{and:e.and.map((e=>mB(e,t)))}:fB(e)?{or:e.or.map((e=>mB(e,t)))}:t(e)}const gB=lB(),yB=aB();function vB(e){throw new Error(e)}function bB(e,t){const n={};for(const i of t)st(e,i)&&(n[i]=e[i]);return n}function xB(e,t){const n={...e};for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>cB()(e))).join(",")})`};const _B=cB();function wB(e){if(gt(e))return e;const t=vt(e)?e:cB()(e);if(t.length<250)return t;let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return n}function kB(e){return!1===e||null===e}function EB(e,t){return e.includes(t)}function AB(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function $B(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function DB(e,...t){for(const n of t)SB(e,n??{});return e}function SB(e,t){for(const n of RB(t))Ae(e,n,t[n],!0)}function MB(e,t){const n=[],i={};let r;for(const o of e)r=t(o),r in i||(i[r]=1,n.push(o));return n}function CB(e,t){const n=RB(e),i=RB(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0}function FB(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function OB(e,t){for(const n of e)if(t.has(n))return!0;return!1}function NB(e){const t=new Set;for(const n of e){const e=ae(n).map(((e,t)=>0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of i)t.add(e)}return t}function TB(e,t){return void 0===e||void 0===t||OB(NB(e),NB(t))}function zB(e){return 0===RB(e).length}const RB=Object.keys,PB=Object.values,LB=Object.entries;function BB(e){return!0===e||!1===e}function jB(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function IB(e,t){return hB(e)?`!(${IB(e.not,t)})`:dB(e)?`(${e.and.map((e=>IB(e,t))).join(") && (")})`:fB(e)?`(${e.or.map((e=>IB(e,t))).join(") || (")})`:t(e)}function UB(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&UB(e[n],t)&&delete e[n],zB(e)}function qB(e){return e.charAt(0).toUpperCase()+e.substr(1)}function WB(e,t="datum"){const n=ae(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(Dt).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function HB(e,t="datum"){return`${t}[${Dt(ae(e).join("."))}]`}function GB(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function YB(e){return`${ae(e).map(GB).join("\\.")}`}function VB(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function XB(e){return`${ae(e).join(".")}`}function JB(e){return e?ae(e).length:0}function QB(...e){for(const t of e)if(void 0!==t)return t}let ZB=42;function KB(e){const t=++ZB;return e?String(e)+t:t}function ej(){ZB=42}function tj(e){return nj(e)?e:`__${e}`}function nj(e){return e.startsWith("__")}function ij(e){if(void 0!==e)return(e%360+360)%360}function rj(e){return!!gt(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const oj="row",aj="column",sj="facet",lj="x",uj="y",cj="x2",fj="y2",dj="xOffset",hj="yOffset",pj="radius",mj="radius2",gj="theta",yj="theta2",vj="latitude",bj="longitude",xj="latitude2",_j="longitude2",wj="color",kj="fill",Ej="stroke",Aj="shape",$j="size",Dj="angle",Sj="opacity",Mj="fillOpacity",Cj="strokeOpacity",Fj="strokeWidth",Oj="strokeDash",Nj="text",Tj="order",zj="detail",Rj="key",Pj="tooltip",Lj="href",Bj="url",jj="description",Ij={theta:1,theta2:1,radius:1,radius2:1};function Uj(e){return e in Ij}const qj={longitude:1,longitude2:1,latitude:1,latitude2:1};function Wj(e){switch(e){case vj:return"y";case xj:return"y2";case bj:return"x";case _j:return"x2"}}function Hj(e){return e in qj}const Gj=RB(qj),Yj={x:1,y:1,x2:1,y2:1,...Ij,...qj,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function Vj(e){return e===wj||e===kj||e===Ej}const Xj={row:1,column:1,facet:1},Jj=RB(Xj),Qj={...Yj,...Xj},Zj=RB(Qj),{order:Kj,detail:eI,tooltip:tI,...nI}=Qj,{row:iI,column:rI,facet:oI,...aI}=nI;function sI(e){return!!Qj[e]}RB(nI),RB(aI);const lI=[cj,fj,xj,_j,yj,mj];function uI(e){return cI(e)!==e}function cI(e){switch(e){case cj:return lj;case fj:return uj;case xj:return vj;case _j:return bj;case yj:return gj;case mj:return pj}return e}function fI(e){if(Uj(e))switch(e){case gj:return"startAngle";case yj:return"endAngle";case pj:return"outerRadius";case mj:return"innerRadius"}return e}function dI(e){switch(e){case lj:return cj;case uj:return fj;case vj:return xj;case bj:return _j;case gj:return yj;case pj:return mj}}function hI(e){switch(e){case lj:case cj:return"width";case uj:case fj:return"height"}}function pI(e){switch(e){case lj:return"xOffset";case uj:return"yOffset";case cj:return"x2Offset";case fj:return"y2Offset";case gj:return"thetaOffset";case pj:return"radiusOffset";case yj:return"theta2Offset";case mj:return"radius2Offset"}}function mI(e){switch(e){case lj:return"xOffset";case uj:return"yOffset"}}function gI(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const yI=RB(Yj),{x:vI,y:bI,x2:xI,y2:_I,xOffset:wI,yOffset:kI,latitude:EI,longitude:AI,latitude2:$I,longitude2:DI,theta:SI,theta2:MI,radius:CI,radius2:FI,...OI}=Yj,NI=RB(OI),TI={x:1,y:1},zI=RB(TI);function RI(e){return e in TI}const PI={theta:1,radius:1},LI=RB(PI);function BI(e){return"width"===e?lj:uj}const jI={xOffset:1,yOffset:1};function II(e){return e in jI}RB(jI);const{text:UI,tooltip:qI,href:WI,url:HI,description:GI,detail:YI,key:VI,order:XI,...JI}=OI,QI=RB(JI),ZI={...TI,...PI,...jI,...JI},KI=RB(ZI);function eU(e){return!!ZI[e]}const tU={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:nU,...iU}=tU;function rU(e){switch(e){case lj:case uj:case gj:case pj:case dj:case hj:case $j:case Dj:case Fj:case Sj:case Mj:case Cj:case cj:case fj:case yj:case mj:return;case sj:case oj:case aj:case Aj:case Oj:case Nj:case Pj:case Lj:case Bj:case jj:return"discrete";case wj:case kj:case Ej:return"flexible";case vj:case bj:case xj:case _j:case zj:case Rj:case Tj:return}}const oU={argmax:1,argmin:1,average:1,count:1,distinct:1,product: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},aU={count:1,min:1,max:1};function sU(e){return!!e&&!!e.argmin}function lU(e){return!!e&&!!e.argmax}function uU(e){return vt(e)&&!!oU[e]}const cU=new Set(["count","valid","missing","distinct"]);function fU(e){return vt(e)&&cU.has(e)}const dU=new Set(["count","sum","distinct","valid","missing"]),hU=new Set(["mean","average","median","q1","q3","min","max"]);function pU(e){return ht(e)&&(e=mG(e,void 0)),"bin"+RB(e).map((t=>vU(e[t])?jB(`_${t}_${LB(e[t])}`):jB(`_${t}_${e[t]}`))).join("")}function mU(e){return!0===e||yU(e)&&!e.binned}function gU(e){return"binned"===e||yU(e)&&!0===e.binned}function yU(e){return we(e)}function vU(e){return e?.param}function bU(e){switch(e){case oj:case aj:case $j:case wj:case kj:case Ej:case Fj:case Sj:case Mj:case Cj:case Aj:return 6;case Oj:return 4;default:return 10}}function xU(e){return!!e?.expr}function _U(e){const t=RB(e||{}),n={};for(const i of t)n[i]=FU(e[i]);return n}function wU(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:u,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={...l?{subtitleColor:l}:{},...u?{subtitleFont:u}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:bB(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function kU(e){return vt(e)||_e(e)&&vt(e[0])}function EU(e){return!!e?.signal}function AU(e){return!!e.step}function $U(e){return!_e(e)&&"field"in e&&"data"in e}const DU=RB({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}),SU={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},MU=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function CU(e){const t=_e(e.condition)?e.condition.map(OU):OU(e.condition);return{...FU(e),condition:t}}function FU(e){if(xU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function OU(e){if(xU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function NU(e){if(xU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return EU(e)?e:void 0!==e?{value:e}:void 0}function TU(e){return EU(e)?e.signal:Dt(e)}function zU(e){return EU(e)?e.signal:Dt(e.value)}function RU(e){return EU(e)?e.signal:null==e?null:Dt(e)}function PU(e,t,n){for(const i of n){const n=jU(i,t.markDef,t.config);void 0!==n&&(e[i]=NU(n))}return e}function LU(e){return[].concat(e.type,e.style??[])}function BU(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?jU(e,t,n,i):void 0}function jU(e,t,n,{vgChannel:i}={}){return QB(i?IU(e,t,n.style):void 0,IU(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function IU(e,t,n){return UU(e,LU(t),n)}function UU(e,t,n){let i;t=Ge(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function qU(e,t){return Ge(e).reduce(((e,n)=>(e.field.push(tG(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function WU(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(gB(t,e))return;n.push(e)})),n}function HU(e,t){return gB(e,t)||!t?e:e?[...Ge(e),...Ge(t)].join(", "):t}function GU(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((kU(n)||EU(n))&&(kU(i)||EU(i)))return{explicit:e.explicit,value:HU(n,i)};if(kU(n)||EU(n))return{explicit:e.explicit,value:n};if(kU(i)||EU(i))return{explicit:e.explicit,value:i};if(!(kU(n)||EU(n)||kU(i)||EU(i)))return{explicit:e.explicit,value:WU(n,i)};throw new Error("It should never reach here")}function YU(e){return`Invalid specification ${_B(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const VU='Autosize "fit" only works for single views and layered views.';function XU(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function JU(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function QU(e){return e?`Dropping "fit-${e}" because spec has discrete ${hI(e)}.`:'Dropping "fit" because spec has discrete size.'}function ZU(e){return`Unknown field for ${e}. Cannot calculate view size.`}function KU(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function eq(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function tq(e){return`Selection not supported for ${e} yet.`}function nq(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function iq(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function rq(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function oq(e){return`${e}Offset dropped because ${e} is continuous`}function aq(e){return`There is no ${e} encoding. Replacing ${e}Offset encoding as ${e}.`}function sq(e){return`Invalid field type "${e}".`}function lq(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 uq(e,t){return`Dropping ${_B(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function cq(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function fq(e){return`${e} encoding has no scale, so specified scale is ignored.`}function dq(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function hq(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function pq(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function mq(e){return`Using unaggregated domain with raw field has no effect (${_B(e)}).`}function gq(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function yq(e){return`Unaggregated domain is currently unsupported for log scale (${_B(e)}).`}function vq(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function bq(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const xq="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function _q(e,t){return`Invalid ${e}: ${_B(t)}.`}function wq(e){return`1D error band does not support ${e}.`}function kq(e){return`Channel ${e} is required for "binned" bin.`}const Eq=xe(ye);let Aq=Eq;function $q(...e){Aq.warn(...e)}function Dq(e){if(e&&we(e))for(const t of zq)if(t in e)return!0;return!1}new WeakMap;const Sq=["january","february","march","april","may","june","july","august","september","october","november","december"],Mq=Sq.map((e=>e.substr(0,3))),Cq=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Fq=Cq.map((e=>e.substr(0,3)));function Oq(e,t){const n=[];if(t&&void 0!==e.day&&RB(e).length>1&&($q(function(e){return`Dropping day from datetime ${_B(e)} as day cannot be combined with other units.`}(e)),delete(e=yB(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(rj(e)&&(e=+e),gt(e))return e-1;{const t=e.toLowerCase(),n=Sq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Mq.indexOf(i);if(-1!==r)return r;throw new Error(_q("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(rj(e)&&(e=+e),gt(e))return e>4&&$q(_q("quarter",e)),e-1;throw new Error(_q("quarter",e))}(e.quarter):e.quarter;n.push(gt(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(rj(e)&&(e=+e),gt(e))return e%7;{const t=e.toLowerCase(),n=Cq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Fq.indexOf(i);if(-1!==r)return r;throw new Error(_q("day",e))}}(e.day):e.day;n.push(gt(i)?i+1:`${i}+1`)}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function Nq(e){const t=Oq(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const Tq={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},zq=RB(Tq);function Rq(e){return e.startsWith("utc")}const Pq={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Lq(e){return zq.filter((t=>Bq(e,t)))}function Bq(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 jq(e){if(!e)return;const t=Lq(e);return`timeUnitSpecifier(${_B(t)}, ${_B(Pq)})`}function Iq(e){if(!e)return;let t;return vt(e)?t={unit:e}:we(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Rq(t.unit)&&(t.utc=!0,t.unit=function(e){return e.substr(3)}(t.unit)),t}function Uq(e,t=(e=>e)){const n=Iq(e),i=function(e){const t=Lq(e);return t[t.length-1]}(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},r=n.step||1;return`${t(Nq({...e,..."quarter"===i?{month:+e.month+3*r}:{[i]:+e[i]+r}}))} - ${t(Nq(e))}`}}function qq(e){return!!e?.field&&void 0!==e.equal}function Wq(e){return!!e?.field&&void 0!==e.lt}function Hq(e){return!!e?.field&&void 0!==e.lte}function Gq(e){return!!e?.field&&void 0!==e.gt}function Yq(e){return!!e?.field&&void 0!==e.gte}function Vq(e){if(e?.field){if(_e(e.range)&&2===e.range.length)return!0;if(EU(e.range))return!0}return!1}function Xq(e){return!!e?.field&&(_e(e.oneOf)||_e(e.in))}function Jq(e){return Xq(e)||qq(e)||Vq(e)||Wq(e)||Gq(e)||Hq(e)||Yq(e)}function Qq(e,t){return vG(e,{timeUnit:t,wrapTime:!0})}function Zq(e,t=!0){const{field:n}=e,i=Iq(e.timeUnit)?.unit,r=i?`time(${function(e,t,{end:n}={end:!1}){const i=WB(t),r=Rq(e)?"utc":"";let o;const a={};for(const t of zq)Bq(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=Oq(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}(i,n)})`:tG(e,{expr:"datum"});if(qq(e))return`${r}===${Qq(e.equal,i)}`;if(Wq(e))return`${r}<${Qq(e.lt,i)}`;if(Gq(e))return`${r}>${Qq(e.gt,i)}`;if(Hq(e))return`${r}<=${Qq(e.lte,i)}`;if(Yq(e))return`${r}>=${Qq(e.gte,i)}`;if(Xq(e))return`indexof([${function(e,t){return e.map((e=>Qq(e,t)))}(e.oneOf,i).join(",")}], ${r}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return Kq(r,e.valid);if(Vq(e)){const{range:n}=e,o=EU(n)?{signal:`${n.signal}[0]`}:n[0],a=EU(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==o&&null!==a&&t)return"inrange("+r+", ["+Qq(o,i)+", "+Qq(a,i)+"])";const s=[];return null!==o&&s.push(`${r} >= ${Qq(o,i)}`),null!==a&&s.push(`${r} <= ${Qq(a,i)}`),s.length>0?s.join(" && "):"true"}throw new Error(`Invalid field predicate: ${_B(e)}`)}function Kq(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function eW(e){return Jq(e)&&e.timeUnit?{...e,timeUnit:Iq(e.timeUnit)?.unit}:e}const tW={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function nW(e){return"ordinal"===e||"nominal"===e}const iW=tW.quantitative,rW=tW.ordinal,oW=tW.temporal,aW=tW.nominal,sW=tW.geojson;RB(tW);const lW={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},uW={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 cW(e,t){const n=uW[e],i=uW[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}RB(uW);const fW={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 dW(e){return fW[e]}const hW=new Set(["linear","log","pow","sqrt","symlog"]),pW=new Set([...hW,"time","utc"]);function mW(e){return hW.has(e)}const gW=new Set(["quantile","quantize","threshold"]),yW=new Set([...pW,...gW,"sequential","identity"]),vW=new Set(["ordinal","bin-ordinal","point","band"]);function bW(e){return vW.has(e)}function xW(e){return yW.has(e)}function _W(e){return pW.has(e)}function wW(e){return gW.has(e)}function kW(e){return e?.param}new Set(["time","utc"]);const EW={type:1,domain:1,domainMax:1,domainMin:1,domainMid: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},{type:AW,domain:$W,range:DW,rangeMax:SW,rangeMin:MW,scheme:CW,...FW}=(RB(EW),EW),OW=RB(FW);function NW(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 _W(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return _W(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"clamp":return _W(e);case"nice":return _W(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return xW(e)&&!EB(["log","time","utc","threshold","quantile"],e)}}function TW(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Vj(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"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 zW={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"},RW=zW.arc,PW=zW.area,LW=zW.bar,BW=zW.image,jW=zW.line,IW=zW.point,UW=zW.rect,qW=zW.rule,WW=zW.text,HW=zW.tick,GW=zW.trail,YW=zW.circle,VW=zW.square,XW=zW.geoshape;function JW(e){return["line","area","trail"].includes(e)}function QW(e){return["rect","bar","image","arc"].includes(e)}const ZW=new Set(RB(zW));function KW(e){return e.type}const eH=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],tH=RB({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),nH=RB({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 iH(e){return e&&null!=e.band}const rH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]};function oH(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=cH(e);return IH(n)&&!fU(n.aggregate)&&r&&_W(r.get("type"))?function({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(JW(n.type))return i;return null===BU("invalid",n,r)?[aH(e,t),i]:i}({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function aH(e,t){return{test:sH(e,!0),..."y"===cI(t)?{field:{group:"height"}}:{value:0}}}function sH(e,t=!0){return Kq(vt(e)?e:tG(e,{expr:"datum"}),!t)}function lH(e,t,n,i){const r={};if(t&&(r.scale=t),qH(e)){const{datum:t}=e;Dq(t)?r.signal=Nq(t):EU(t)?r.signal=t.signal:xU(t)?r.signal=t.expr:r.value=t}else r.field=tG(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function uH({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,bandPosition:o=.5}){const a=0<o&&o<1?"datum":void 0,s=tG(t,{expr:a,suffix:r}),l=void 0!==n?tG(n,{expr:a}):tG(t,{suffix:"end",expr:a}),u={};if(0===o||1===o){u.scale=e;const t=0===o?s:l;u.field=t}else{const t=EU(o)?`${o.signal} * ${s} + (1-${o.signal}) * ${l}`:`${o} * ${s} + ${1-o} * ${l}`;u.signal=`scale("${e}", ${t})`}return i&&(u.offset=i),u}function cH({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:l,defaultRef:u,bandPosition:c}){if(t){if(YH(t)){const u=a?.get("type");if(VH(t)){c??(c=zH({fieldDef:t,fieldDef2:n,markDef:i,config:r}));const{bin:a,timeUnit:f,type:d}=t;if(mU(a)||c&&f&&d===oW)return s?.impute?lH(t,o,{binSuffix:"mid"},{offset:l}):c&&!bW(u)?uH({scaleName:o,fieldOrDatumDef:t,bandPosition:c,offset:l}):lH(t,o,xG(t,e)?{binSuffix:"range"}:{},{offset:l});if(gU(a)){if(IH(n))return uH({scaleName:o,fieldOrDatumDef:t,fieldOrDatumDef2:n,bandPosition:c,offset:l});$q(kq(e===lj?cj:fj))}}return lH(t,o,bW(u)?{binSuffix:"range"}:{},{offset:l,band:"band"===u?c??t.bandPosition??.5:void 0})}if(XH(t)){const n=l?{offset:l}:{};return{...fH(e,t.value),...n}}}return Ve(u)&&(u=u()),u?{...u,...l?{offset:l}:{}}:u}function fH(e,t){return EB(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:EB(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:NU(t)}function dH(e){return e&&"number"!==e&&"time"!==e}function hH(e,t,n){return`${e}(${t}${n?`, ${_B(n)}`:""})`}const pH=" – ";function mH({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o}){if(dH(n))return yH({fieldOrDatumDef:e,format:t,formatType:n,expr:i,config:o});const a=gH(e,i,r),s=UH(e);if(void 0===t&&void 0===n&&o.customFormatTypes){if("quantitative"===s){if(r&&o.normalizedNumberFormatType)return yH({fieldOrDatumDef:e,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:i,config:o});if(o.numberFormatType)return yH({fieldOrDatumDef:e,format:o.numberFormat,formatType:o.numberFormatType,expr:i,config:o})}if("temporal"===s&&o.timeFormatType&&IH(e)&&void 0===e.timeUnit)return yH({fieldOrDatumDef:e,format:o.timeFormat,formatType:o.timeFormatType,expr:i,config:o})}if(yG(e)){const n=function({field:e,timeUnit:t,format:n,formatType:i,rawTimeFormat:r,isUTCScale:o}){return!t||n?!t&&i?`${i}(${e}, '${n}')`:`${o?"utc":"time"}Format(${e}, '${n=vt(n)?n:r}')`:function(e,t,n){if(!e)return;const i=jq(e);return`${n||Rq(e)?"utc":"time"}Format(${t}, ${i})`}(t,e,o)}({field:a,timeUnit:IH(e)?Iq(e.timeUnit)?.unit:void 0,format:t,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:JH(e)&&e.scale?.type===lW.UTC});return n?{signal:n}:void 0}return t=xH({type:s,specifiedFormat:t,config:o,normalizeStack:r}),IH(e)&&mU(e.bin)?{signal:kH(a,tG(e,{expr:i,binSuffix:"end"}),t,n,o)}:t||"quantitative"===UH(e)?{signal:`${_H(a,t)}`}:{signal:`isValid(${a}) ? ${a} : ""+${a}`}}function gH(e,t,n){return IH(e)?n?`${tG(e,{expr:t,suffix:"end"})}-${tG(e,{expr:t,suffix:"start"})}`:tG(e,{expr:t}):function(e){const{datum:t}=e;return Dq(t)?Nq(t):`${_B(t)}`}(e)}function yH({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o,field:a}){return a??(a=gH(e,i,r)),"datum.value"!==a&&IH(e)&&mU(e.bin)?{signal:kH(a,tG(e,{expr:i,binSuffix:"end"}),t,n,o)}:{signal:hH(n,a,t)}}function vH(e,t,n,i,r,o){if(!vt(i)||!dH(i)){if(void 0===n&&void 0===i&&r.customFormatTypes&&"quantitative"===UH(e)){if(r.normalizedNumberFormatType&&QH(e)&&"normalize"===e.stack)return;if(r.numberFormatType)return}if(QH(e)&&"normalize"===e.stack&&r.normalizedNumberFormat)return xH({type:"quantitative",config:r,normalizeStack:!0});if(yG(e)){const t=IH(e)?Iq(e.timeUnit)?.unit:void 0;if(void 0===t&&r.customFormatTypes&&r.timeFormatType)return;return function({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:i}){return e||(t?{signal:jq(t)}:i?void 0:n.timeFormat)}({specifiedFormat:n,timeUnit:t,config:r,omitTimeFormatConfig:o})}return xH({type:t,specifiedFormat:n,config:r})}}function bH(e,t,n){return e&&(EU(e)||"number"===e||"time"===e)?e:yG(t)&&"time"!==n&&"utc"!==n?IH(t)&&Iq(t?.timeUnit)?.utc?"utc":"time":void 0}function xH({type:e,specifiedFormat:t,config:n,normalizeStack:i}){return vt(t)?t:e===iW?i?n.normalizedNumberFormat:n.numberFormat:void 0}function _H(e,t){return`format(${e}, "${t||""}")`}function wH(e,t,n,i){return dH(n)?hH(n,e,t):_H(e,(vt(t)?t:void 0)??i.numberFormat)}function kH(e,t,n,i,r){if(void 0===n&&void 0===i&&r.customFormatTypes&&r.numberFormatType)return kH(e,t,r.numberFormat,r.numberFormatType,r);const o=wH(e,n,i,r),a=wH(t,n,i,r);return`${Kq(e,!1)} ? "null" : ${o} + "${pH}" + ${a}`}const EH="min",AH={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function $H(e){return e in AH}function DH(e){return!!e?.encoding}function SH(e){return e&&("count"===e.op||!!e.field)}function MH(e){return e&&_e(e)}function CH(e){return"row"in e||"column"in e}function FH(e){return!!e&&"header"in e}function OH(e){return"facet"in e}function NH(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...r?{aggregate:r}:{},field:t}}function TH(e){return"sort"in e}function zH({fieldDef:e,fieldDef2:t,markDef:n,config:i}){if(YH(e)&&void 0!==e.bandPosition)return e.bandPosition;if(IH(e)){const{timeUnit:r,bin:o}=e;if(r&&!t)return QW(n.type)?0:jU("timeUnitBandPosition",n,i);if(mU(o))return.5}}function RH({channel:e,fieldDef:t,fieldDef2:n,markDef:i,config:r,scaleType:o,useVlSizeChannel:a}){const s=hI(e),l=BU(a?"size":s,i,r,{vgChannel:s});if(void 0!==l)return l;if(IH(t)){const{timeUnit:e,bin:a}=t;if(e&&!n)return{band:jU("timeUnitBandSize",i,r)};if(mU(a)&&!bW(o))return{band:1}}return QW(i.type)?o?bW(o)?r[i.type]?.discreteBandSize||{band:1}:r[i.type]?.continuousBandSize:r[i.type]?.discreteBandSize:void 0}function PH(e,t,n,i){return!!(mU(e.bin)||e.timeUnit&&VH(e)&&"temporal"===e.type)&&void 0!==zH({fieldDef:e,fieldDef2:t,markDef:n,config:i})}function LH(e){return e&&"condition"in e}function BH(e){const t=e?.condition;return!!t&&!_e(t)&&IH(t)}function jH(e){const t=e?.condition;return!!t&&!_e(t)&&YH(t)}function IH(e){return e&&(!!e.field||"count"===e.aggregate)}function UH(e){return e?.type}function qH(e){return e&&"datum"in e}function WH(e){return VH(e)&&!nG(e)||GH(e)}function HH(e){return VH(e)&&"quantitative"===e.type&&!e.bin||GH(e)}function GH(e){return qH(e)&&gt(e.datum)}function YH(e){return IH(e)||qH(e)}function VH(e){return e&&("field"in e||"count"===e.aggregate)&&"type"in e}function XH(e){return e&&"value"in e&&"value"in e}function JH(e){return e&&("scale"in e||"sort"in e)}function QH(e){return e&&("axis"in e||"stack"in e||"impute"in e)}function ZH(e){return e&&"legend"in e}function KH(e){return e&&("format"in e||"formatType"in e)}function eG(e){return xB(e,["legend","axis","header","scale"])}function tG(e,t={}){let n=e.field;const i=t.prefix;let r=t.suffix,o="";if(function(e){return"count"===e.aggregate}(e))n=tj("count");else{let i;if(!t.nofn)if(function(e){return"op"in e}(e))i=e.op;else{const{bin:a,aggregate:s,timeUnit:l}=e;mU(a)?(i=pU(a),r=(t.binSuffix??"")+(t.suffix??"")):s?lU(s)?(o=`["${n}"]`,n=`argmax_${s.argmax}`):sU(s)?(o=`["${n}"]`,n=`argmin_${s.argmin}`):i=String(s):l&&(i=function(e){const{utc:t,...n}=Iq(e);return n.unit?(t?"utc":"")+RB(n).map((e=>jB(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+RB(n).map((e=>jB(`_${e}_${n[e]}`))).join("")}(l),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?XB(n):t.expr?HB(n,t.expr)+o:YB(n)+o}function nG(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return IH(e)&&!!e.bin;case"temporal":return!1}throw new Error(sq(e.type))}const iG=(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(lU(t))return`${r} for argmax(${t.argmax})`;if(sU(t))return`${r} for argmin(${t.argmin})`;const o=Iq(i),a=t||o?.unit||o?.maxbins&&"timeunit"||mU(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(mU(i))return`${n} (binned)`;if(r){const e=Iq(r)?.unit;if(e)return`${n} (${Lq(e).join("-")})`}else if(o)return lU(o)?`${n} for max ${o.argmax}`:sU(o)?`${n} for min ${o.argmin}`:`${qB(o)} of ${n}`;return n}(e,t)}};let rG=iG;function oG(e){rG=e}function aG(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=sG(e)?.title;if(!IH(e))return r??e.title;const o=e,a=i?lG(o,t):void 0;return n?QB(r,o.title,a):r??o.title??a}function sG(e){return QH(e)&&e.axis?e.axis:ZH(e)&&e.legend?e.legend:FH(e)&&e.header?e.header:void 0}function lG(e,t){return rG(e,t)}function uG(e){if(KH(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=sG(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function cG(e){return IH(e)?e:BH(e)?e.condition:void 0}function fG(e){return YH(e)?e:jH(e)?e.condition:void 0}function dG(e,t,n,i={}){return vt(e)||gt(e)||ht(e)?($q(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${_B(n)}}.`}(t,vt(e)?"string":gt(e)?"number":"boolean",e)),{value:e}):YH(e)?hG(e,t,n,i):jH(e)?{...e,condition:hG(e.condition,t,n,i)}:e}function hG(e,t,n,i){if(KH(e)){const{format:r,formatType:o,...a}=e;if(dH(o)&&!n.customFormatTypes)return $q(rq(t)),hG(a,t,n,i)}else{const r=QH(e)?"axis":ZH(e)?"legend":FH(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(dH(a)&&!n.customFormatTypes)return $q(rq(t)),hG({...e,[r]:s},t,n,i)}}return IH(e)?pG(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=gt(n)?"quantitative":vt(n)?"nominal":Dq(n)?"temporal":void 0,{...e,type:t}}(e)}function pG(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||uU(i)||lU(i)||sU(i)||($q(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=Iq(r)),a&&(s.field=`${a}`),mU(o)&&(s.bin=mG(o,t)),gU(o)&&!RI(t)&&$q(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),VH(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case iW:return"quantitative";case"t":case oW:return"temporal";case"o":case rW:return"ordinal";case"n":case aW:return"nominal";case sW:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&fU(i)&&($q(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!uI(t)){const e=function(e,t){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(TH(e)&&_e(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!lU(n)&&!sU(n))return"quantitative";if(JH(e)&&e.scale?.type)switch(uW[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(VH(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 oj:case aj:case sj:return nG(e)?gG:{compatible:!1,warning:dq(t)};case lj:case uj:case dj:case hj:case wj:case kj:case Ej:case Nj:case zj:case Rj:case Pj:case Lj:case Bj:case Dj:case gj:case pj:case jj:return gG;case bj:case _j:case vj:case xj:return n!==iW?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:gG;case Sj:case Mj:case Cj:case Fj:case $j:case yj:case mj:case cj:case fj:return"nominal"!==n||e.sort?gG:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case Aj:case Oj:return nG(e)||function(e){return JH(e)&&wW(e.scale?.type)}(e)?gG:{compatible:!1,warning:hq(t)};case Tj:return"nominal"!==e.type||"sort"in e?gG:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,t)||{};!1===e&&$q(n)}if(TH(s)&&vt(s.sort)){const{sort:e}=s;if($H(e))return{...s,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&$H(t))return{...s,sort:{encoding:t,order:"descending"}}}if(FH(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 mG(e,t){return ht(e)?{maxbins:bU(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:bU(t)}}const gG={compatible:!0};function yG(e){const{formatType:t}=uG(e);return"time"===t||!t&&function(e){return e&&("temporal"===e.type||IH(e)&&!!e.timeUnit)}(e)}function vG(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const o=t&&Iq(t)?.unit;let a,s=o||"temporal"===n;return xU(e)?a=e.expr:EU(e)?a=e.signal:Dq(e)?(s=!0,a=Nq(e)):(vt(e)||gt(e))&&s&&(a=`datetime(${_B(e)})`,function(e){return!!Tq[e]}(o)&&(gt(e)&&e<1e4||vt(e)&&isNaN(Date.parse(e)))&&(a=Nq({[o]:e}))),a?i&&s?`time(${a})`:a:r?void 0:_B(e)}function bG(e,t){const{type:n}=e;return t.map((t=>{const i=vG(t,{timeUnit:IH(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function xG(e,t){return mU(e.bin)?eU(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const _G={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 wG(e){return e?.condition}const kG=["domain","grid","labels","ticks","title"],EG={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"},AG={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},$G={...AG,style:1,labelExpr:1,encoding:1};function DG(e){return!!$G[e]}RB($G);const SG=RB({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 MG(e){return"mark"in e}class CG{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!MG(e)&&function(e){return KW(e)?e.type:e}(e.mark)===this.name}}function FG(e,t){const n=e&&e[t];return!!n&&(_e(n)?AB(n,(e=>!!e.field)):IH(n)||BH(n))}function OG(e,t){const n=e&&e[t];return!!n&&(_e(n)?AB(n,(e=>!!e.field)):IH(n)||qH(n)||jH(n))}function NG(e,t){if(RI(t)){const n=e[t];if((IH(n)||qH(n))&&(nW(n.type)||IH(n)&&n.timeUnit))return OG(e,mI(t))}return!1}function TG(e){return AB(Zj,(t=>{if(FG(e,t)){const n=e[t];if(_e(n))return AB(n,(e=>!!e.aggregate));{const e=cG(n);return e&&!!e.aggregate}}return!1}))}function zG(e,t){const n=[],i=[],r=[],o=[],a={};return LG(e,((s,l)=>{if(IH(s)){const{field:u,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const e=sG(s),p=e?.title;let m=tG(s,{forAs:!0});const g={...p?[]:{title:aG(s,t,{allowDisabling:!0})},...h,field:m};if(c){let e;if(lU(c)?(e="argmax",m=tG({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${u}`):sU(c)?(e="argmin",m=tG({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${u}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};u&&(t.field=u),o.push(t)}}else if(n.push(m),VH(s)&&mU(f)){if(i.push({bin:f,field:u,as:m}),n.push(tG(s,{binSuffix:"end"})),xG(s,l)&&n.push(tG(s,{binSuffix:"range"})),RI(l)){const e={field:`${m}_end`};a[`${l}2`]=e}g.bin="binned",uI(l)||(g.type=iW)}else if(d){r.push({timeUnit:d,field:u,as:m});const e=VH(s)&&s.type!==oW&&"time";e&&(l===Nj||l===Pj?g.formatType=e:function(e){return!!OI[e]}(l)?g.legend={formatType:e,...g.legend}:RI(l)&&(g.axis={formatType:e,...g.axis}))}a[l]=g}else n.push(u),a[l]=e[l]}else a[l]=e[l]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function RG(e,t,n){const i=function(e,t){return function(e){switch(e){case wj:case kj:case Ej:case jj:case zj:case Rj:case Pj:case Lj:case Tj:case Sj:case Mj:case Cj:case Fj:case sj:case oj:case aj:return tU;case lj:case uj:case dj:case hj:case vj:case bj:return iU;case cj:case fj:case xj:case _j:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case $j:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Oj:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case Aj:return{point:"always",geoshape:"always"};case Nj:return{text:"always"};case Dj:return{point:"always",square:"always",text:"always"};case Bj:return{image:"always"};case gj:case pj:return{text:"always",arc:"always"};case yj:case mj:return{arc:"always"}}}(e)[t]}(t,n);if(!i)return!1;if("binned"===i){const n=e[t===cj?lj:uj];return!!(IH(n)&&IH(e[t])&&gU(n.bin))}return!0}function PG(e,t){const n={};for(const i of RB(e)){const r=dG(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function LG(e,t,n){if(e)for(const i of RB(e)){const r=e[i];if(_e(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function BG(e,t){return RB(t).reduce(((n,i)=>{switch(i){case lj:case uj:case Lj:case jj:case Bj:case cj:case fj:case dj:case hj:case gj:case yj:case pj:case mj:case vj:case bj:case xj:case _j:case Nj:case Aj:case Dj:case Pj:return n;case Tj:if("line"===e||"trail"===e)return n;case zj:case Rj:{const e=t[i];if(_e(e)||IH(e))for(const t of Ge(e))t.aggregate||n.push(tG(t,{}));return n}case $j:if("trail"===e)return n;case wj:case kj:case Ej:case Sj:case Mj:case Cj:case Oj:case Fj:{const e=cG(t[i]);return e&&!e.aggregate&&n.push(tG(e,{})),n}}}),[])}function jG(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${IG(t)}`:"";return{field:e+t.field,type:t.type,title:EU(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),o=function(e){const t=[];for(const n of RB(e))if(FG(e,n)){const i=Ge(e[n]);for(const e of i)IH(e)?t.push(e):BH(e)&&t.push(e.condition)}return t}(n).map(eG);return{tooltip:[...r,...MB(o,wB)]}}function IG(e){const{title:t,field:n}=e;return QB(t,n)}function UG(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:l,positionPrefix:u,endPositionPrefix:c,extraEncoding:f={}})=>{const d=IG(n);return qG(e,s,r,{mark:l,encoding:{[t]:{field:`${u}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...vt(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function qG(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}:{},...KW(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...ht(e[t])?{}:e[t]}}]:[]}function WG(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:HG(o,n),continuousAxisChannelDef2:HG(a,n),continuousAxisChannelDefError:HG(s,n),continuousAxisChannelDefError2:HG(l,n),continuousAxis:r}}function HG(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&$q(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function GG(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(KW(n)&&n.orient)return n.orient;if(WH(r)){if(WH(o)){const e=IH(r)&&r.aggregate,n=IH(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 yG(o)&&!yG(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(WH(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const YG="boxplot",VG=new CG(YG,JG);function XG(e){return gt(e)?"tukey":e}function JG(e,{config:t}){e={...e,encoding:PG(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=KW(n)?n:{type:n};r&&$q(tq("boxplot"));const l=s.extent??t.boxplot.extent,u=BU("size",s,t),c=s.invalid,f=XG(l),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:w}=function(e,t,n){const i=GG(e,YG),{continuousAxisChannelDef:r,continuousAxis:o}=WG(e,i,YG),a=r.field,s=XG(t),l=[...QG(a),{op:"median",field:a,as:`mid_box_${a}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+a}],u="min-max"===s||"tukey"===s?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:`iqr_${a}`},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,as:`upper_whisker_${a}`},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,as:`lower_whisker_${a}`}],{[o]:c,...f}=e.encoding,{customTooltipWithoutAggregatedField:d,filteredEncoding:h}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(_e(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 _e(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(f),{bins:p,timeUnits:m,aggregate:g,groupby:y,encoding:v}=zG(h,n),b="vertical"===i?"horizontal":"vertical",x=i;return{bins:p,timeUnits:m,transform:[...p,...m,{aggregate:[...g,...l],groupby:y},...u],groupby:y,aggregate:g,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:v,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:d}}(e,l,t),{color:k,size:E,...A}=b,$=e=>UG(s,g,m,e,t.boxplot),D=$(A),S=$(b),M=$({...A,...E?{size:E}:{}}),C=jG([{fieldPrefix:"min-max"===f?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===f?"lower_whisker_":"min_",titlePrefix:"Min"}],m,b),F={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},O="min-max"===f?C:jG([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,b),N=[...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:O}),...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"lower_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"upper_whisker",extraEncoding:O})],T=[..."tukey"!==f?N:[],...S({partName:"box",mark:{type:"bar",...u?{size:u}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:C}),...M({partName:"median",mark:{type:"tick",invalid:c,...we(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...u?{size:u}:{},orient:x,aria:!1},positionPrefix:"mid_box",extraEncoding:C})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(p),layer:T};const z=`datum["lower_box_${m.field}"]`,R=`datum["upper_box_${m.field}"]`,P=`(${R} - ${z})`,L=`${z} - ${l} * ${P}`,B=`${R} + ${l} * ${P}`,j=`datum["${m.field}"]`,I={joinaggregate:QG(m.field),groupby:y},U={transform:[{filter:`(${L} <= ${j}) && (${j} <= ${B})`},{aggregate:[{op:"min",field:m.field,as:`lower_whisker_${m.field}`},{op:"max",field:m.field,as:`upper_whisker_${m.field}`},{op:"min",field:`lower_box_${m.field}`,as:`lower_box_${m.field}`},{op:"max",field:`upper_box_${m.field}`,as:`upper_box_${m.field}`},...v],groupby:y}],layer:N},{tooltip:q,...W}=A,{scale:H,axis:G}=m,Y=IG(m),V=xB(G,["title"]),X=qG(s,"outliers",t.boxplot,{transform:[{filter:`(${j} < ${L}) || (${j} > ${B})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...void 0!==Y?{title:Y}:{},...void 0!==H?{scale:H}:{},...zB(V)?{}:{axis:V}},...W,...k?{color:k}:{},...w?{tooltip:w}:{}}})[0];let J;const Q=[...d,...h,I];return X?J={transform:Q,layer:[X,U]}:(J=U,J.transform.unshift(...Q)),{...a,layer:[J,{transform:p,layer:T}]}}function QG(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const ZG="errorbar",KG=new CG(ZG,eY);function eY(e,{config:t}){e={...e,encoding:PG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:l,tooltipEncoding:u}=tY(e,ZG,t);delete o.size;const c=UG(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:u}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:u}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...l,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function tY(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=KW(i)?i:{type:i};o&&$q(tq(t));const{orient:u,inputType:c}=function(e,t){const{encoding:n}=e;if(function(e){return(YH(e.x)||YH(e.y))&&!YH(e.x2)&&!YH(e.y2)&&!YH(e.xError)&&!YH(e.xError2)&&!YH(e.yError)&&!YH(e.yError2)}(n))return{orient:GG(e,t),inputType:"raw"};const i=function(e){return YH(e.x2)||YH(e.y2)}(n),r=function(e){return YH(e.xError)||YH(e.xError2)||YH(e.yError)||YH(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(YH(e)&&YH(i))throw new Error(`${t} cannot have both x2 and y2`);if(YH(e)){if(WH(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(YH(i)){if(WH(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(YH(i)&&!YH(e))throw new Error(`${t} cannot have xError2 without xError`);if(YH(s)&&!YH(r))throw new Error(`${t} cannot have yError2 without yError`);if(YH(e)&&YH(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(YH(e)){if(WH(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(YH(r)){if(WH(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")}}(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=WG(e,u,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],u=[];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)&&$q(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],u=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:`upper_${c}`},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:qB(t)},{fieldPrefix:"upper_",titlePrefix:nY(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:nY(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{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:aG({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:aG({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:aG({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&$q(function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}(e.center,e.extent)),"aggregated-upper-lower"===o?(f=[],u=[{calculate:`datum["${n.field}"]`,as:`upper_${c}`},{calculate:`datum["${c}"]`,as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],u=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:`upper_${c}`}],r?u.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:`lower_${c}`}):u.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:`lower_${c}`}));for(const e of u)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:VB(VB(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:u,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:_,["x"===m?"xError":"yError"]:w,["x"===m?"xError2":"yError2"]:k,...E}=r,{bins:A,timeUnits:$,aggregate:D,groupby:S,encoding:M}=zG(E,n),C=[...D,...g],F="raw"!==c?[]:S,O=jG(v,f,M,b);return{transform:[...s.transform??[],...A,...$,...0===C.length?[]:[{aggregate:C,groupby:F}],...y],groupby:F,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:M,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:O}}function nY(e,t,n){return`${qB(e)} ${n} ${t}`}const iY="errorband",rY=new CG(iY,oY);function oY(e,{config:t}){e={...e,encoding:PG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:l}=tY(e,iY,t),u=a,c=UG(u,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={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):u.interpolate?$q(wq("interpolate")):u.tension&&$q(wq("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:l})]}}const aY={};function sY(e,t,n){const i=new CG(e,t);aY[e]={normalizer:i,parts:n}}sY(YG,JG,["box","median","outliers","rule","ticks"]),sY(ZG,eY,["ticks","rule"]),sY(iY,oY,["band","borders"]);const lY=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],uY={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"},cY={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"},fY=RB(uY),dY=RB(cY),hY=RB({header:1,headerRow:1,headerColumn:1,headerFacet:1}),pY=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],mY={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},gY=(RB(mY),"_vgsid_"),yY={point:{on:"click",fields:[gY],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function vY(e){return"legend"===e||!!e?.legend}function bY(e){return vY(e)&&we(e)}function xY(e){return!!e?.select}function _Y(e){const t=[];for(const n of e||[]){if(xY(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 wY(e){return"concat"in e}function kY(e){return"vconcat"in e}function EY(e){return"hconcat"in e}function AY({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function $Y(e){return we(e)&&void 0!==e.step}function DY(e){return e.view||e.width||e.height}const SY=RB({align:1,bounds:1,center:1,columns:1,spacing:1});function MY(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function CY(e,t){const n=FY(e,t);return $Y(n)?n.step:OY}function FY(e,t){return QB(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const OY=20,NY={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:OY},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:{binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},circle:{},geoshape:{},image:{},line:{},point:{},rect:{binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5},rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},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,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:yY,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},TY=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],zY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},RY={blue:TY[0],orange:TY[1],red:TY[2],teal:TY[3],green:TY[4],yellow:TY[5],purple:TY[6],pink:TY[7],brown:TY[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 PY(e){const t=RB(e||{}),n={};for(const i of t){const t=e[i];n[i]=wG(t)?CU(t):FU(t)}return n}const LY=[...nH,...SG,...hY,"background","padding","legend","lineBreak","scale","style","title","view"];function BY(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=Ee({},yB(NY),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:we(e)?{...RY,...e}:RY}],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:we(e)?{...zY,...e}:zY}],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&&Ae(a,"selection",r,!0);const s=xB(a,LY);for(const e of["background","lineBreak","padding"])a[e]&&(s[e]=FU(a[e]));for(const e of nH)a[e]&&(s[e]=_U(a[e]));for(const e of SG)a[e]&&(s[e]=PY(a[e]));for(const e of hY)a[e]&&(s[e]=_U(a[e]));return a.legend&&(s.legend=_U(a.legend)),a.scale&&(s.scale=_U(a.scale)),a.style&&(s.style=function(e){const t=RB(e),n={};for(const i of t)n[i]=PY(e[i]);return n}(a.style)),a.title&&(s.title=_U(a.title)),a.view&&(s.view=_U(a.view)),s}const jY=new Set(["view",...ZW]),IY=["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"],UY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]};function qY(e,t,n,i){"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[n??t]};zB(r)||(e.style[n??t]=r),i||delete e[t]}function WY(e){return"layer"in e}class HY{map(e,t){return OH(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):EY(e)?this.mapHConcat(e,t):kY(e)?this.mapVConcat(e,t):wY(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(WY(e))return this.mapLayer(e,t);if(MG(e))return this.mapUnit(e,t);throw new Error(YU(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 GY={zero:1,center:1,normalize:1},YY=new Set([RW,LW,PW,qW,IW,YW,VW,jW,WW,HW]),VY=new Set([LW,PW,RW]);function XY(e){return IH(e)&&"quantitative"===UH(e)&&!e.bin}function JY(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t,a=e[t],s=e[r];if(IH(a)&&IH(s))if(XY(a)&&XY(s)){if(a.stack)return t;if(s.stack)return r;const e=IH(a)&&!!a.aggregate;if(e!==(IH(s)&&!!s.aggregate))return e?t:r;if(o&&"bar"===i){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(XY(a))return t;if(XY(s))return r}else{if(XY(a))return t;if(XY(s))return r}}function QY(e,t){const n=KW(e)?e:{type:e},i=n.type;if(!YY.has(i))return null;const r=JY(t,"x",n)||JY(t,"theta",n);if(!r)return null;const o=t[r],a=IH(o)?tG(o,{}):void 0,s=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),l=[],u=new Set;if(t[s]){const e=t[s],n=IH(e)?tG(e,{}):void 0;n&&n!==a&&(l.push(s),u.add(n));const i="x"===s?"xOffset":"yOffset",r=t[i],o=IH(r)?tG(r,{}):void 0;o&&o!==a&&(l.push(i),u.add(o))}const c=NI.reduce(((e,n)=>{if("tooltip"!==n&&FG(t,n)){const i=t[n];for(const t of Ge(i)){const i=cG(t);if(i.aggregate)continue;const r=tG(i,{});r&&u.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let f;return void 0!==o.stack?f=ht(o.stack)?o.stack?"zero":null:o.stack:VY.has(i)&&(f="zero"),f&&f in GY?TG(t)&&0===c.length?null:o?.scale?.type&&o?.scale?.type!==lW.LINEAR?(o?.stack&&$q(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type)),null):YH(t[dI(r)])?(void 0!==o.stack&&$q(`Cannot stack "${d=r}" if there is already "${d}2".`),null):(IH(o)&&o.aggregate&&!dU.has(o.aggregate)&&$q(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:l,groupbyFields:u,fieldChannel:r,impute:null!==o.impute&&JW(i),stackBy:c,offset:f}):null;var d}function ZY(e){const{point:t,line:n,...i}=e;return RB(i).length>1?i:i.type}function KY(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:xB(e[t],["point","line"])});return e}function eV(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?we(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?we(t.point)?t.point:{}:void 0}function tV(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 nV{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(MG(e)){const{mark:n,encoding:i}=e,r=KW(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!eV(r,t[r.type],i);case"area":return!!eV(r,t[r.type],i)||!!tV(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...u}=e,c=PG(l,i),f=KW(a)?a:{type:a},d=eV(f,i[f.type],c),h="area"===f.type&&tV(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:ZY({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:xB(c,["shape"])}],m=QY(f,c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=xB(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...bB(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...bB(f,["clip","tooltip"]),...d},encoding:g}),n({...u,layer:p},{...t,config:KY(i)})}}function iV(e,t){return t?CH(e)?uV(e,t):aV(e,t):e}function rV(e,t){return t?uV(e,t):e}function oV(e,t,n){const i=t[e];return function(e){return e&&!vt(e)&&"repeat"in e}(i)?i.repeat in n?{...t,[e]:n[i.repeat]}:void $q(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function aV(e,t){if(void 0!==(e=oV("field",e,t))){if(null===e)return null;if(TH(e)&&SH(e.sort)){const n=oV("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function sV(e,t){if(IH(e))return aV(e,t);{const n=oV("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function lV(e,t){if(!YH(e)){if(jH(e)){const n=sV(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=sV(e,t);if(n)return n;if(LH(e))return{condition:e.condition}}}function uV(e,t){const n={};for(const i in e)if(st(e,i)){const r=e[i];if(_e(r))n[i]=r.map((e=>lV(e,t))).filter((e=>e));else{const e=lV(r,t);void 0!==e&&(n[i]=e)}}return n}class cV{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(MG(e)){const{encoding:t,mark:n}=e;if("line"===n||KW(n)&&"line"===n.type)for(const e of lI){const n=t[cI(e)];if(t[e]&&(IH(n)&&!gU(n.bin)||qH(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return $q((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:we(r)?{...r,type:"rule"}:"rule"},t)}}function fV({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...RB(e),...RB(t)]);for(const o of r){const r=t[o],a=e[o];if(YH(r)){const e={...a,...r};i[o]=e}else jH(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||XH(a)||EU(a)||YH(a)||_e(a))&&(i[o]=a)}}else i=t;return!i||zB(i)?void 0:i}function dV(e){const{parentProjection:t,projection:n}=e;return t&&n&&$q(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${_B(t)} is overridden by a child projection ${_B(n)}.`}({parentProjection:t,projection:n})),n??t}function hV(e){return"filter"in e}function pV(e){return void 0!==e?.stop}function mV(e){return"lookup"in e}function gV(e){return"pivot"in e}function yV(e){return"density"in e}function vV(e){return"quantile"in e}function bV(e){return"regression"in e}function xV(e){return"loess"in e}function _V(e){return"sample"in e}function wV(e){return"window"in e}function kV(e){return"joinaggregate"in e}function EV(e){return"flatten"in e}function AV(e){return"calculate"in e}function $V(e){return"bin"in e}function DV(e){return"impute"in e}function SV(e){return"timeUnit"in e}function MV(e){return"aggregate"in e}function CV(e){return"stack"in e}function FV(e){return"fold"in e}function OV(e,t){const{transform:n,...i}=e;if(n){const e=n.map((e=>{if(hV(e))return{filter:zV(e,t)};if($V(e)&&yU(e.bin))return{...e,bin:TV(e.bin)};if(mV(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}));return{...i,transform:e}}return e}function NV(e,t){const n=yB(e);if(IH(n)&&yU(n.bin)&&(n.bin=TV(n.bin)),JH(n)&&n.scale?.domain?.selection){const{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(LH(n))if(_e(n.condition))n.condition=n.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:zV(e,t)}}));else{const{selection:e,param:i,test:r,...o}=NV(n.condition,t);n.condition=i?n.condition:{...o,test:zV(n.condition,t)}}return n}function TV(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function zV(e,t){const n=e=>mB(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):mB(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class RV extends HY{map(e,t){const n=t.selections??[];if(e.params&&!MG(e)){const t=[];for(const i of e.params)xY(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 t of n)if(t.views&&t.views.length)for(const n of t.views)(vt(n)&&(n===e.name||i.includes(n))||_e(n)&&n.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(t);else r.push(t);return r.length&&(e.params=r),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=RV.prototype[e];RV.prototype[e]=function(e,n){return t.call(this,e,PV(e,n))}}function PV(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function LV(e,t){void 0===t&&(t=BY(e.config));const n=function(e,t={}){const n={config:t};return IV.map(BV.map(jV.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=MG(e)||WY(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&&($q(XU("width")),i=void 0),"container"==r&&($q(XU("height")),r=void 0));const s={type:"pad",...a,...n?UV(n.autosize):{},...UV(e.autosize)};if("fit"!==s.type||o||($q(VU),s.type="pad"),"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&$q(JU("width")),"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&$q(JU("height")),!gB(s,{type:"pad"}))return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const BV=new class extends HY{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[VG,KG,rY,new nV,new cV]}map(e,t){if(MG(e)){const n=FG(e.encoding,oj),i=FG(e.encoding,aj),r=FG(e.encoding,sj);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=rV(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 e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!_e(e.repeat)&&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:l={},repeaterPrefix:u=""}=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={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+u}child__layer_${jB(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;!_e(n)&&e.columns&&(e=xB(e,["columns"]),$q(nq("repeat")));const a=[],{repeater:s={},repeaterPrefix:l=""}=t,u=!_e(n)&&n.row||[s?s.row:null],c=!_e(n)&&n.column||[s?s.column:null],f=_e(n)&&n||[s?s.repeat:null];for(const e of f)for(const r of u)for(const o of c){const u={repeat:e,row:r,column:o,layer:s.layer},c=(i.name?`${i.name}_`:"")+l+"child__"+(_e(n)?`${jB(e)}`:(n.row?`row_${jB(r)}`:"")+(n.column?`column_${jB(o)}`:"")),f=this.map(i,{...t,repeater:u,repeaterPrefix:c});f.name=c,a.push(xB(f,["data"]))}const d=_e(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:d,concat:a}}mapFacet(e,t){const{facet:n}=e;return CH(n)&&e.columns&&(e=xB(e,["columns"]),$q(nq("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=dV({parentProjection:o,projection:i}),l=fV({parentEncoding:r,encoding:rV(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:u,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=rV(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...u?{height:u}:{},...c?{view:c}:{},...l?{projection:l}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&$q(`Facet encoding dropped as ${(o=[...n?[oj]:[],...i?[aj]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[oj,aj]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??(a[e]={}),a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:iV(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:fV({parentEncoding:t,encoding:r,layer:!0}),parentProjection:dV({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},jV=new class extends HY{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=OV(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=OV(e,t)).encoding){const n={};for(const[i,r]of LB(e.encoding))n[i]=NV(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:LB(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 n of PB(t.selectionPredicates[e]??{}))n.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},IV=new RV;function UV(e){return vt(e)?{type:e}:e??{}}const qV=["background","padding"];function WV(e,t){const n={};for(const t of qV)e&&void 0!==e[t]&&(n[t]=FU(e[t]));return t&&(n.params=e.params),n}class HV{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new HV(yB(this.explicit),yB(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return QB(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 RB(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function GV(e){return{explicit:!0,value:e}}function YV(e){return{explicit:!1,value:e}}function VV(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:XV(t,n,i,r)}}function XV(e,t,n,i){return e.explicit&&t.explicit&&$q(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${_B(n)} and ${_B(i)}). Using ${_B(n)}.`}(n,i,e.value,t.value)),e}function JV(e,t,n,i,r=XV){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:gB(e.value,t.value)?e:r(e,t,n,i)}class QV extends HV{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 ZV(e){return"url"in e}function KV(e){return"values"in e}function eX(e){return"name"in e&&!ZV(e)&&!KV(e)&&!tX(e)}function tX(e){return e&&(nX(e)||iX(e)||rX(e))}function nX(e){return"sequence"in e}function iX(e){return"sphere"in e}function rX(e){return"graticule"in e}var oX;function aX(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=YB(r.field),r}function sX(e,t=!0,n=ue){if(_e(e)){const i=e.map((e=>sX(e,t,n)));return t?`[${i.join(", ")}]`:i}return Dq(e)?n(t?Nq(e):function(e){const t=Oq(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(_B(e)):e}function lX(e,t){for(const n of PB(e.component.selection??{})){const i=n.name;let r=`${i}${$J}, ${"global"===n.resolve?"true":`{unit: ${CJ(e)}}`}`;for(const i of MJ)i.defined(n)&&(i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(r=i.modifyExpr(e,n,r)));t.push({name:i+DJ,on:[{events:{signal:n.name+$J},update:`modify(${Dt(n.name+AJ)}, ${r})`}]})}return fX(t)}function uX(e,t){if(e.component.selection&&RB(e.component.selection).length){const n=Dt(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:zT("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return fX(t)}function cX(e,t){for(const n of PB(e.component.selection??{}))for(const i of MJ)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function fX(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}(oX||(oX={}));class dX{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)?$q("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 t of this._children)t.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class hX extends dX{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 ${KB()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class pX extends dX{clone(){return new pX(null,yB(this.formula))}constructor(e,t){super(e),this.formula=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,t)=>{const{field:n,timeUnit:i}=t;if(i){const r=tG(t,{forAs:!0});e[wB({as:r,field:n,timeUnit:i})]={as:r,field:n,timeUnit:i}}return e}),{});return zB(n)?null:new pX(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Iq(n)};return new pX(e,{[wB(r)]:r})}merge(e){this.formula={...this.formula};for(const t in e.formula)this.formula[t]||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of LB(this.formula))e.has(i.as)||(t[n]=i);this.formula=t}producedFields(){return new Set(PB(this.formula).map((e=>e.as)))}dependentFields(){return new Set(PB(this.formula).map((e=>e.field)))}hash(){return`TimeUnit ${wB(this.formula)}`}assemble(){const e=[];for(const t of PB(this.formula)){const{field:n,as:i,timeUnit:r}=t,{unit:o,utc:a,...s}=Iq(r);e.push({field:YB(n),type:"timeunit",...o?{units:Lq(o)}:{},...a?{timezone:"utc"}:{},...s,as:[i,`${i}_end`]})}return e}}const mX="_tuple_fields";class gX{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const yX={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new gX),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=jB(`${i}_${n}`);for(let e=1;s.has(r);e++)r=jB(`${i}_${n}_${e}`);return s.add(r),{[t]:r}},u=t.type,c=e.config.selection[u],f=void 0!==n.value?Ge(n.value):null;let{fields:d,encodings:h}=we(n.select)?n.select:{};if(!d&&!h&&f)for(const e of f)if(we(e))for(const t of RB(e))aI[t]?(h||(h=[])).push(t):"interval"===u?($q('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=c.encodings):(d??(d=[])).push(t);d||h||(h=c.encodings,"fields"in c&&(d=c.fields));for(const t of h??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){$q(eq(t,n.aggregate));continue}if(!i){$q(KU(t));continue}if(n.timeUnit){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};a[wB(r)]=r}if(!o[i]){const a={field:i,channel:t,type:"interval"===u&&eU(t)&&xW(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:r.items.length};a.signals={...l(a,"data"),...l(a,"visual")},r.items.push(o[i]=a),r.hasField[i]=o[i],r.hasSelectionId=r.hasSelectionId||i===gY,Hj(t)?(a.geoChannel=t,a.channel=Wj(t),r.hasChannel[a.channel]=o[i]):r.hasChannel[t]=o[i]}}else $q(KU(t))}for(const e of d??[]){if(r.hasField[e])continue;const t={type:"E",field:e,index:r.items.length};t.signals={...l(t,"data")},r.items.push(t),r.hasField[e]=t,r.hasSelectionId=r.hasSelectionId||e===gY}f&&(t.init=f.map((e=>r.items.map((t=>we(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),zB(a)||(r.timeUnit=new pX(null,a))},signals:(e,t,n)=>{const i=t.name+mX;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(aX)})}},vX=yX,bX={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(!eU(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&xW(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):$q("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||wX(e)||0===i.length)return n;const r=n.filter((e=>e.name===t.name))[0];let o=r.update;if(o.indexOf(SJ)>=0)r.update=`{${i.map((e=>`${Dt(YB(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${Dt(YB(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&&!wX(e))for(const e of t.scales){const t=n.filter((t=>t.name===e.signals.data))[0];t.push="outer",delete t.value,delete t.update}return n}},xX=bX;function _X(e,t){return`domain(${Dt(e.scaleName(t))})`}function wX(e){return e.parent&&cK(e.parent)&&(!e.parent.parent??wX(e.parent.parent))}const kX="_brush",EX="_scale_trigger",AX="geo_interval_init_tick",$X="_init",DX={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...we(n.select)?n.select:{}};e.fields=[gY],e.encodings||(e.encodings=n.value?RB(n.value):[bj,vj]),n.select={type:"interval",...e}}if(t.translate&&!xX.defined(t)){const e=`!event.item || event.item.mark.name !== ${Dt(t.name+kX)}`;for(const n of t.events){if(!n.between){$q(`${n} is not an ordered event stream for interval selections.`);continue}const t=Ge((i=n.between[0]).filter??(i.filter=[]));t.indexOf(e)<0&&t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+$J,o=PB(t.project.hasChannel).filter((e=>e.channel===lj||e.channel===uj)),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=Dt(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${s}, ${e})`,u=e.getSizeSignalRef(o===lj?"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, ${u})]`}]),[]);if(r){const r=n.signals.data,u=xX.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:sX(i,!0,l)}:{value:[]};return f.push({events:{signal:t.name+EX},update:xW(d)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),u?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:sX(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===lj?0:1,n=t.name+$X;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=Dt(e.projectionName()),l=e.projectionName()+"_center",{x:u,y:c}=t.project.hasChannel,f=u&&u.signals.visual,d=c&&c.signals.visual,h=u?a&&a[u.index]:`${l}[0]`,p=c?a&&a[c.index]:`${l}[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+$X,init:`[scale(${s}, [${u?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${u?h[1]:h}, ${c?p[1]:p}])]`}),!u||!c)){n.find((e=>e.name===l))||n.unshift({name:l,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(intersect(${g}, {markname: ${Dt(e.getName("marks"))}}, unit.mark), {unit: ${CJ(e)}})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:AX}]:[]],update:y}]})}{if(!xX.defined(t)){const t=i+EX,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=Dt(e.scaleName(n)),a=xW(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)),l=`unit: ${CJ(e)}, fields: ${i+mX}, values`;return n.concat({name:r,...a?{init:`{${l}: ${sX(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${l}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(sK(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===AX)).length||n.unshift({name:AX,value:null,on:[{events:"timer{1}",update:`${AX} === null ? {} : ${AX}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=r?.signals.visual,s=o?.signals.visual,l=`data(${Dt(t.name+AJ)})`;if(xX.defined(t)||!r&&!o)return n;const u={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 t of RB(u))u[t]=[{test:`${l}.length && ${l}[0].unit === ${CJ(e)}`,...u[t]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=RB(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)),{});return[{name:`${i+kX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:u}},...n,{name:i+kX,type:"rect",clip:!0,encode:{enter:{...d?{cursor:{value:d}}:{},fill:{value:"transparent"}},update:{...u,...p}}}]}},SX=DX,MX={defined:e=>"point"===e.type,signals:(e,t,n)=>{const i=t.name,r=i+mX,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=PB(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+kX):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),l="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let u=`unit: ${CJ(e)}, `;t.project.hasSelectionId?u+=`${gY}: ${a}[${Dt(gY)}]`:u+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return n?.bin?`[${a}[${Dt(e.vgField(t.channel,{}))}], ${a}[${Dt(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${Dt(t.field)}]`})).join(", ")}]`;const c=t.events;return n.concat([{name:i+$J,on:c?[{events:c,update:`${l} ? {${u}} : null`,force:!0}]:[]}])}},CX=MX;function FX(e,t,n,i){const r=LH(t)&&t.condition,o=i(t);if(r){const t=Ge(r).map((t=>{const n=i(t);if(function(e){return e.param}(t)){const{param:i,empty:r}=t;return{test:PJ(e,{param:i,empty:r}),...n}}return{test:BJ(e,t.test),...n}}));return{[n]:[...t,...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function OX(e,t="text"){const n=e.encoding[t];return FX(e,n,t,(t=>NX(t,e.config)))}function NX(e,t,n="datum"){if(e){if(XH(e))return NU(e.value);if(YH(e)){const{format:i,formatType:r}=uG(e);return mH({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function TX(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(_e(a))return{tooltip:RX({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return FX(e,a,"tooltip",(e=>{const a=NX(e,r,s);if(a)return a;if(null===e)return;let l=BU("tooltip",i,r);return!0===l&&(l={content:"encoding"}),vt(l)?{value:l}:we(l)?EU(l)?l:"encoding"===l.content?RX(n,o,r,t):{signal:s}:void 0}))}}function zX(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o={},a=i?"datum.datum":"datum",s=[];function l(n,i){const l=cI(i),u=VH(n)?n:{...n,type:e[l].type},c=Ge(u.title||lG(u,r)).join(", ");let f;if(RI(i)){const t="x"===i?"x2":"y2",n=cG(e[t]);if(gU(u.bin)&&n){const e=tG(u,{expr:a}),i=tG(n,{expr:a}),{format:s,formatType:l}=uG(u);f=kH(e,i,s,l,r),o[t]=!0}}if((RI(i)||i===gj||i===pj)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=uG(u);f=mH({fieldOrDatumDef:u,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}f??(f=NX(u,r,a).signal),s.push({channel:i,key:c,value:f})}LG(e,((e,t)=>{IH(e)?l(e,t):BH(e)&&l(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of s)o[e]||u[t]||(u[t]=n);return u}function RX(e,t,n,{reactiveGeom:i}={}){const r=zX(e,t,n,{reactiveGeom:i}),o=LB(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function PX(e){const{markDef:t,config:n}=e,i=BU("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...LX(e),...BX(e)}}function LX(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=BU("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in SU?{}:{ariaRoleDescription:{value:t}}}function BX(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return FX(e,o,"description",(t=>NX(t,e.config)));const a=BU("description",n,i);if(null!=a)return{description:NU(a)};if(!1===i.aria)return{};const s=zX(t,r,i);return zB(s)?void 0:{description:{signal:LB(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function jX(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;void 0===s&&(l??(l=BU(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==l&&(s=NU(l)));const u=r[e];return FX(t,u,a??e,(n=>cH({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function IX(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??BU("filled",n,r),s=EB(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=BU(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,u=BU(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...l?{fill:NU(l)}:{},...u?{stroke:NU(u)}:{}};return n.color&&(a?n.fill:n.stroke)&&$q(lq("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...jX("color",e,{vgChannel:c,defaultValue:a?l:u}),...jX("fill",e,{defaultValue:i.fill?l:void 0}),...jX("stroke",e,{defaultValue:i.stroke?u:void 0})}}function UX(e){const{encoding:t,mark:n}=e,i=t.order;return!JW(n)&&XH(i)?FX(e,i,"zindex",(e=>NU(e.value))):{}}function qX({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:cH({channel:o,channelDef:s,markDef:t,config:i?.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:NU(a),bandPosition:r})};const l=t[o];return l?{offsetType:"visual",offset:l}:{}}function WX(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,l=r[e],u=r[dI(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=qX({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=HX({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!l&&RI(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(YH(n)&&r&&t===r.fieldChannel){if(IH(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return uH({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return lH(n,i,{suffix:"end"},{offset:o})}return oH(e)}({channel:e,channelDef:l,channel2Def:u,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 HX({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=cI(n),l=fI(n),u=BU(n,o,a,{vgChannel:l});if(void 0!==u)return fH(n,u);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(EB([lW.LOG,lW.TIME,lW.UTC],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===s?{field:{group:"height"}}:{value:0};switch(s){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...e[hI(n)],mult:.5}}}}const GX={left:"x",center:"xc",right:"x2"},YX={top:"y",middle:"yc",bottom:"y2"};function VX(e,t,n,i="middle"){if("radius"===e||"theta"===e)return fI(e);const r="x"===e?"align":"baseline",o=BU(r,t,n);let a;return EU(o)?($q(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?GX[a||("top"===i?"left":"center")]:YX[a||i]}function XX(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?JX(e,t,{defaultPos:n,defaultPos2:i}):WX(e,t,{defaultPos:n})}function JX(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=dI(e),s=hI(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=cI(n),u=hI(n),c=fI(n),f=i[l],d=e.scaleName(l),h=e.getScaleComponent(l),{offset:p}=qX(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=hI(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:l,defaultRef:u}){return YH(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?lH(t,o,{suffix:"start"},{offset:l}):oH({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});return void 0!==m?{[c]:m}:QX(n,o)||QX(n,{[n]:IU(n,o,s.style),[u]:IU(u,o,s.style)})||QX(n,s[r])||QX(n,s.mark)||{[c]:HX({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...WX(e,t,{defaultPos:n,vgChannel:l[s]?VX(e,r,o):fI(e)}),...l}}function QX(e,t){const n=hI(e),i=fI(e);if(void 0!==t[i])return{[i]:fH(e,t[i])};if(void 0!==t[e])return{[i]:fH(e,t[e])};if(t[n]){const i=t[n];if(!iH(i))return{[n]:fH(e,i)};$q(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function ZX(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=dI(t),s=hI(t),l=i[t],u=i[a],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,h=i[s]??i.size??BU("size",r,n,{vgChannel:s}),p=pI(t),m="bar"===o&&("x"===t?"vertical"===d:"horizontal"===d);return!IH(l)||!(mU(l.bin)||gU(l.bin)||l.timeUnit&&!u)||h&&!iH(h)||i[p]||bW(f)?(YH(l)&&bW(f)||m)&&!u?function(e,t,n){const{markDef:i,encoding:r,config:o,stack:a}=n,s=i.orient,l=n.scaleName(t),u=n.getScaleComponent(t),c=hI(t),f=dI(t),d=pI(t),h=n.scaleName(d),p=n.getScaleComponent(mI(t)),m="horizontal"===s&&"y"===t||"vertical"===s&&"x"===t;let g;(r.size||i.size)&&(m?g=jX("size",n,{vgChannel:c,defaultRef:NU(i.size)}):$q(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(i.type)));const y=!!g,v=RH({channel:t,fieldDef:e,markDef:i,config:o,scaleType:u?.get("type"),useVlSizeChannel:m});g=g||{[c]:KX(c,h||l,p||u,o,v)};const b=VX(t,i,o,"band"===u?.get("type")&&iH(v)&&!y?"top":"middle"),x="xc"===b||"yc"===b,{offset:_,offsetType:w}=qX({channel:t,markDef:i,encoding:r,model:n,bandPosition:x?.5:0}),k=oH({channel:t,channelDef:e,markDef:i,config:o,scaleName:l,scale:u,stack:a,offset:_,defaultRef:HX({model:n,defaultPos:"mid",channel:t,scaleName:l,scale:u}),bandPosition:x?"encoding"===w?0:.5:EU(v)?{signal:`(1-${v})/2`}:iH(v)?(1-v.band)/2:0});if(c)return{[b]:k,...g};{const e=fI(f),t=g[c],n=_?{...t,offset:_}:t;return{[b]:k,[e]:_e(k)?[k[0],{...k[1],offset:n}]:{...k,offset:n}}}}(l,t,e):JX(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:o,encoding:a}=i,s=i.getScaleComponent(n),l=i.scaleName(n),u=s?s.get("type"):void 0,c=s.get("reverse"),f=RH({channel:n,fieldDef:e,markDef:o,config:r,scaleType:u}),d=i.component.axes[n]?.[0],h=d?.get("translate")??.5,p=RI(n)?BU("binSpacing",o,r)??0:0,m=dI(n),g=fI(n),y=fI(m),{offset:v}=qX({channel:n,markDef:o,encoding:a,model:i,bandPosition:0}),b=EU(f)?{signal:`(1-${f.signal})/2`}:iH(f)?(1-f.band)/2:.5;if(mU(e.bin)||e.timeUnit)return{[y]:tJ({fieldDef:e,scaleName:l,bandPosition:b,offset:eJ(m,p,c,h,v)}),[g]:tJ({fieldDef:e,scaleName:l,bandPosition:EU(b)?{signal:`1-${b.signal}`}:1-b,offset:eJ(n,p,c,h,v)})};if(gU(e.bin)){const i=lH(e,l,{},{offset:eJ(m,p,c,h,v)});if(IH(t))return{[y]:i,[g]:lH(t,l,{},{offset:eJ(n,p,c,h,v)})};if(yU(e.bin)&&e.bin.step)return{[y]:i,[g]:{signal:`scale("${l}", ${tG(e,{expr:"datum"})} + ${e.bin.step})`,offset:eJ(n,p,c,h,v)}}}$q(kq(m))}({fieldDef:l,fieldDef2:u,channel:t,model:e})}function KX(e,t,n,i,r){if(iH(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;return 1!==r.band&&(e=`${r.band} * ${e}`),{signal:`max(0.25, ${e})`}}1!==r.band&&($q(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(EU(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(AU(e)&&gt(e.step))return{value:e.step-2}}return{value:CY(i.view,e)-2}}function eJ(e,t,n,i,r){if(Uj(e))return 0;const o="x"===e||"y2"===e?-t/2:t/2;if(EU(n)||EU(r)||EU(i)){const e=RU(n),t=RU(r),a=RU(i);return{signal:(a?`${a} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${o})`:o)}}return r=r||0,i+(n?-r-o:+r+o)}function tJ({fieldDef:e,scaleName:t,bandPosition:n,offset:i}){return uH({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i})}const nJ=new Set(["aria","width","height"]);function iJ(e,t){const{fill:n,stroke:i}="include"===t.color?IX(e):{};return{...oJ(e.markDef,t),...rJ(e,"fill",n),...rJ(e,"stroke",i),...jX("opacity",e),...jX("fillOpacity",e),...jX("strokeOpacity",e),...jX("strokeWidth",e),...jX("strokeDash",e),...UX(e),...TX(e),...OX(e,"href"),...PX(e)}}function rJ(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===BU("invalid",o,i)&&n&&!JW(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&xW(r)&&(t[o]=!0)}return t}),{}),r=RB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>sH(e,t))).join(` ${e} `)}}(e,{invalid:!0,channels:KI});if(i)return{[t]:[{test:i,value:null},...Ge(n)]}}return n?{[t]:n}:{}}function oJ(e,t){return DU.reduce(((n,i)=>(nJ.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=NU(e[i])),n)),{})}function aJ(e){const{config:t,markDef:n}=e;if(BU("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});o&&xW(r)&&(t[o]=!0)}return t}),{}),r=RB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>sH(e,t))).join(` ${e} `)}}(e,{channels:zI});if(t)return{defined:{signal:t}}}return{}}function sJ(e,t){if(void 0!==t)return{[e]:NU(t)}}const lJ="voronoi",uJ={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(lJ)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(JW(o))return $q(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(lJ),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...TX(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,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.indexOf(lJ)>=0&&(l=!0)})),l||n.splice(s+1,0,a),n}},cJ=uJ,fJ={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!vY(e.bind),parse:(e,t,n)=>OJ(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=cJ.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=jB(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...a?{init:sX(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${Dt(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.filter((e=>e.name===i+$J))[0],a=i+mX,s=r.items.map((e=>jB(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},dJ=fJ,hJ="_toggle",pJ={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+hJ,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+$J,i=t.name+hJ;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${CJ(e)}}, `)+`${i} ? ${n} : null`}},mJ={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t)=>{t.clear&&(t.clear=vt(t.clear)?zT(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(dJ.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===jB(`${t.name}_${e.field}`)));-1!==i&&n[i].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 e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));i(t,"[0, 0]"),-1===t&&i(n.findIndex((t=>t.name===e.signals.data)),"null")}else{let e=n.findIndex((e=>e.name===t.name+$J));i(e,"null"),pJ.defined(t)&&(e=n.findIndex((e=>e.name===t.name+hJ)),i(e,"false"))}return n}},gJ={defined:e=>{const t="global"===e.resolve&&e.bind&&vY(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==gY;return t&&!n&&$q("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=yB(n);if(i.select=vt(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},OJ(t,i),we(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=Ge(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const r=bY(t.bind)?t.bind.legend:"click",o=vt(r)?zT(r,"view"):Ge(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=bY(t.bind)&&t.bind.legend,o=e=>t=>{const n=yB(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${jB(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"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+$J)),a=i+mX,s=r.items.filter((e=>e.hasLegend)).map((e=>jB(`${i}_${jB(e.field)}_legend`))),l=`${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:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const u=n.find((e=>e.name===i+hJ)),c=bY(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:c}):u.on[0].events=c),n}},yJ="_translate_anchor",vJ="_translate_delta",bJ={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=xX.defined(t),o=i+yJ,{x:a,y:s}=t.project.hasChannel;let l=zT(t.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=i+kX,e)))),n.push({name:o,value:{},on:[{events:l.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?_X(e,lj):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?_X(e,uj):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+vJ,value:{},on:[{events:l,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&xJ(e,t,a,"width",n),void 0!==s&&xJ(e,t,s,"height",n),n}};function xJ(e,t,n,i,r){const o=t.name,a=o+yJ,s=o+vJ,l=n.channel,u=xX.defined(t),c=r.filter((e=>e.name===n.signals[u?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${l}`,g=`${u&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${u?l===lj?p?"":"-":p?"-":"":""}${s}.${l} / ${u?`${f}`:`span(${m})`}${u?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:u?g:`clampRange(${g}, 0, ${f})`})}const _J="_zoom_anchor",wJ="_zoom_delta",kJ={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=xX.defined(t),o=i+wJ,{x:a,y:s}=t.project.hasChannel,l=Dt(e.scaleName(lj)),u=Dt(e.scaleName(uj));let c=zT(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+kX,e)))),n.push({name:i+_J,on:[{events:c,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, 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&&EJ(e,t,a,"width",n),void 0!==s&&EJ(e,t,s,"height",n),n}};function EJ(e,t,n,i,r){const o=t.name,a=n.channel,s=xX.defined(t),l=r.filter((e=>e.name===n.signals[s?"data":"visual"]))[0],u=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?_X(e,a):l.name,h=o+wJ,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${_J}.${a}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;l.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${u})`})}const AJ="_store",$J="_tuple",DJ="_modify",SJ="vlSelectionResolve",MJ=[CX,SX,vX,pJ,dJ,xX,gJ,mJ,bJ,kJ,cJ];function CJ(e,{escape:t}={escape:!0}){let n=t?Dt(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!lK(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of Jj)e[t]&&(n+=` + '__facet_${t}_' + (facet[${Dt(i.vgField(t))}])`)}return n}function FJ(e){return PB(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function OJ(e,t){!vt(t.select)&&t.select.on||delete e.events,!vt(t.select)&&t.select.clear||delete e.clear,!vt(t.select)&&t.select.toggle||delete e.toggle}function NJ(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...NJ(e.object)),t.push(...NJ(e.property))),t)}function TJ(e){return"MemberExpression"===e.object.type?TJ(e.object):"datum"===e.object.name}function zJ(e){const t=aF(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&TJ(e)&&n.add(NJ(e).slice(1).join("."))})),n}class RJ extends dX{clone(){return new RJ(null,this.model,yB(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=BJ(this.model,this.filter,this),this._dependentFields=zJ(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function PJ(e,t,n,i="datum"){const r=vt(t)?t:t.param,o=jB(r),a=Dt(o+AJ);let s;try{s=e.getSelectionComponent(o,r)}catch(e){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 l=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${Dt(s.resolve)})`}`,u=`length(data(${a}))`;return!1===t.empty?`${u} && ${l}`:`!${u} || ${l}`}function LJ(e,t,n){const i=jB(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(e){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,$q((e.length?"Multiple ":"No ")+`matching ${Dt(r)} encoding found for selection ${Dt(n.param)}. `+`Using "field": ${Dt(a)}.`)):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&$q(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Dt(a)}.`);return`${o.name}[${Dt(YB(a))}]`}function BJ(e,t,n){return IB(t,(t=>vt(t)?t:function(e){return e?.param}(t)?PJ(e,t,n):Zq(t)))}function jJ(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 IJ(e,t,n,i={header:!1}){const{disable:r,orient:o,scale:a,labelExpr:s,title:l,zindex:u,...c}=e.combine();if(!r){for(const e in c){const n=EG[e],i=c[e];if(n&&n!==t&&"both"!==n)delete c[e];else if(wG(i)){const{condition:t,...n}=i,r=Ge(t),o=_G[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((e=>{const{test:t,...n}=e;return{test:BJ(null,t),...n}})),n];jJ(c,i,t,a),delete c[e]}else if(null===o){const t={signal:r.map((e=>{const{test:t,...n}=e;return`${BJ(null,t)} ? ${zU(n)} : `})).join("")+zU(n)};c[e]=t}}else if(EU(i)){const t=_G[e];if(t){const{vgProp:n,part:r}=t;jJ(c,r,n,i),delete c[e]}}EB(["labelAlign","labelBaseline"],e)&&null===c[e]&&delete c[e]}if("grid"===t){if(!c.grid)return;if(c.encode){const{grid:e}=c.encode;c.encode={...e?{grid:e}:{}},zB(c.encode)&&delete c.encode}return{scale:a,orient:o,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:QB(u,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==s){let e=s;c.encode?.labels?.update&&EU(c.encode.labels.update.text)&&(e=VB(s,"datum.label",c.encode.labels.update.text.signal)),jJ(c,"labels","text",{signal:e})}if(null===c.labelAlign&&delete c.labelAlign,c.encode){for(const t of kG)e.hasAxisPart(t)||delete c.encode[t];zB(c.encode)&&delete c.encode}const t=function(e,t){if(e)return _e(e)&&!kU(e)?e.map((e=>lG(e,t))).join(", "):e}(l,n);return{scale:a,orient:o,grid:!1,...t?{title:t}:{},...c,...!1===n.aria?{aria:!1}:{},zindex:QB(u,0)}}}}function UJ(e){const{axes:t}=e.component,n=[];for(const i of zI)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 qJ(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([...RB(r),...RB(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${RU(r[t])} : ${RU(o[t])}`};return s}return t[e]}))])}function WJ(e,t){const n=[{}];for(const i of e){let e=t[i]?.style;if(e){e=Ge(e);for(const i of e)n.push(t.style[i])}}return Object.assign.apply(null,n)}function HJ(e,t,n,i={}){const r=UU(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const GJ={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!bW(e)&&IH(t)&&!mU(t?.bin)&&!gU(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)}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||XJ(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||VJ(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&EB(["quantitative","temporal"],e))return!0}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!we(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy"}(t.type,n,IH(t)&&!!t.timeUnit,IH(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}){if(!i&&!bW(t)&&"log"!==t){if(IH(e)){if(mU(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&EB(["month","hours","day","quarter"],Iq(e.timeUnit)?.unit))return}return{signal:`ceil(${n.signal}/40)`}}}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(IH(t)){const{timeUnit:e}=t;if(e){const t=Uq(e);if(t)return{signal:t}}}},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=JJ(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return WU(r?[NH(r)]:[],IH(a)?[NH(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;return _e(n)?bG(t,n):EU(n)?n:void 0}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){return"rect"===e&&nG(t)?1:0}(n,t)};function YJ(e){return`(((${e.signal} % 360) + 360) % 360)`}function VJ(e,t,n,i){if(void 0!==e){if("x"===n){if(EU(e)){const n=YJ(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${EU(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(EU(t)){const n=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${n} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(EU(e)){const n=YJ(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${EU(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(EU(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${n} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function XJ(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,o=i?"bottom":"left";if(EU(e)){const n=YJ(e);return{signal:`(${r?`(${n} + 90)`:n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${EU(t)?`(${t.signal} === "${o}")`:t===o} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(EU(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${t.signal} ${n} "${o}" ? "left" : "right"`}}return(r<e&&e<180+r)==(t===o)?"left":"right"}function JJ(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,a=r?r.title:void 0;return o&&a?HU(o,a):o||a||(void 0!==o?o:void 0!==a?a:void 0)}class QJ extends dX{clone(){return new QJ(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=zJ(this.transform.calculate)}static parseAllForSortIndex(e,t){return t.forEachFieldDef(((t,n)=>{if(JH(t)&&MH(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${Zq({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new QJ(e,{calculate:a,as:ZJ(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 ${wB(this.transform)}`}}function ZJ(e,t,n){return tG(e,{prefix:t,suffix:"sort_index",...n??{}})}function KJ(e,t){return EB(["top","bottom"],t)?"column":EB(["left","right"],t)||"row"===e?"row":"column"}function eQ(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return QB((t||{})[e],r[e],n.header[e])}function tQ(e,t,n,i){const r={};for(const o of e){const e=eQ(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const nQ=["row","column"],iQ=["header","footer"];function rQ(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}=tQ(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=KJ(t,s),u=ij(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...aQ(u,l),...oQ(l,u,o),...hQ(i,r,t,fY,uY)}}}function oQ(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=XJ(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function aQ(e,t){const n=VJ(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function sQ(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of iQ)if(n[r])for(const o of n[r]){const a=cQ(e,t,r,n,o);null!=a&&i.push(a)}return i}function lQ(e,t){const{sort:n}=e;return SH(n)?{field:tG(n,{expr:"datum"}),order:n.order??"ascending"}:_e(n)?{field:ZJ(e,t,{expr:"datum"}),order:"ascending"}:{field:tG(e,{expr:"datum"}),order:n??"ascending"}}function uQ(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=tQ(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=mH({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=KJ(t,s);return{text:{signal:l?VB(VB(l,"datum.label",u),"datum.value",tG(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...aQ(o,c),...oQ(c,o,a),...hQ(n,e,t,dY,cY)}}function cQ(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}=tQ(["labelOrient"],a.header,s,t);("row"===t&&!EB(["top","bottom"],e)||"column"===t&&!EB(["left","right"],e))&&(o=uQ(a,t,s))}const l=lK(e)&&!CH(e.facet),u=r.axes,c=u?.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:lQ(a,t)}:{},...c&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:u}:{}}}}return null}const fQ={column:{start:0,end:1},row:{start:1,end:0}};function dQ(e,t){return fQ[t][e]}function hQ(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=eQ(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function pQ(e){return[...mQ(e,"width"),...mQ(e,"height"),...mQ(e,"childWidth"),...mQ(e,"childHeight")]}function mQ(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(bW(i)&&AU(o)){const i=e.scaleName(n);return lK(e.parent)&&"independent"===e.parent.component.resolve.scale[n]?[gQ(i,o)]:[gQ(i,o),{name:r,update:yQ(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} : ${MY(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function gQ(e,t){const n=`${e}_step`;return EU(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function yQ(e,t,n){const i=t.get("type"),r=t.get("padding"),o=QB(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${RU(a)}, ${RU(o)}) * ${e}_step`}function vQ(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function bQ(e,t){return RB(e).reduce(((n,i)=>{const r=e[i];return{...n,...FX(t,r,i,(e=>NU(e.value)))}}),{})}function xQ(e,t){if(lK(t))return"theta"===e?"independent":"shared";if(cK(t))return"shared";if(uK(t))return RI(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function _Q(e,t){const n=e.scale[t],i=RI(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&$q(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 wQ={...mY,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},kQ=RB(wQ);class EQ extends HV{}const AQ={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:s,config:l,mark:u}=n,c=a.filled&&"trail"!==u;let f={...PU({},n,eH),...IX(n,{filled:c})};const d=r.get("symbolOpacity")??l.legend.symbolOpacity,h=r.get("symbolFillColor")??l.legend.symbolFillColor,p=r.get("symbolStrokeColor")??l.legend.symbolStrokeColor,m=void 0===d?$Q(s.opacity)??a.opacity:void 0;if(f.fill)if("fill"===i||c&&i===wj)delete f.fill;else if(f.fill.field)h?delete f.fill:(f.fill=NU(l.legend.symbolBaseFillColor??"black"),f.fillOpacity=NU(m??1));else if(_e(f.fill)){const e=DQ(s.fill??s.color)??a.fill??(c&&a.color);e&&(f.fill=NU(e))}if(f.stroke)if("stroke"===i||!c&&i===wj)delete f.stroke;else if(f.stroke.field||p)delete f.stroke;else if(_e(f.stroke)){const e=QB(DQ(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(f.stroke={value:e})}if(i!==Sj){const e=IH(t)&&MQ(0,r,t);e?f.opacity=[{test:e,...NU(m??1)},NU(l.legend.unselectedOpacity)]:m&&(f.opacity=NU(m))}return f={...f,...e},zB(f)?void 0:f},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const l=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?$Q(a.opacity)||o.opacity:void 0;return l&&(s.opacity=NU(l)),s={...s,...e},zB(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=IH(t)?MQ(0,r,t):void 0,l=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=o;let f;dH(c)?f=yH({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:c,config:a}):void 0===u&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=yH({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&IH(t)&&void 0===t.timeUnit&&(f=yH({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...l?{opacity:l}:{},...f?{text:f}:{},...e};return zB(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return n?.length?{...e,fill:{value:"transparent"}}:e}};function $Q(e){return SQ(e,((e,t)=>Math.max(e,t.value)))}function DQ(e){return SQ(e,((e,t)=>QB(e,t.value)))}function SQ(e,t){return function(e){const t=e?.condition;return!!t&&(_e(t)||XH(t))}(e)?Ge(e.condition).reduce(t,e.value):XH(e)?e.value:void 0}function MQ(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=Dt(n.field);return i.map((e=>`(!length(data(${Dt(jB(e)+AJ)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const CQ={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return vH(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return bH(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:l}=e;if(_W(r))return"horizontal"===n?"top"===i||"bottom"===i?OQ(t,"width",a,o):a:OQ(t,"height",l,s)}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(EB(["quantile","threshold","log","symlog"],e))return"greedy"}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=DQ(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})=>aG(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Vj(n)&&_W(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;return _e(n)?bG(t,n):EU(n)?n:void 0}(t,e)};function FQ({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)}function OQ(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function NQ(e){const t=sK(e)?function(e){const{encoding:t}=e,n={};for(const i of[wj,...pY]){const r=fG(t[i]);r&&e.getScaleComponent(i)&&(i===Aj&&IH(r)&&r.type===sW||(n[i]=zQ(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){NQ(i);for(const r of RB(i.component.legends))n.legend[r]=_Q(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=RQ(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of RB(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 TQ(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function zQ(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new EQ({},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){const i=e.fieldDef(t)?.field;for(const r of PB(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&gJ.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const l=void 0!==n?!n:a.disable;if(s.set("disable",l,void 0!==n),l)return s;n=n||{};const u=e.getScaleComponent(t).get("type"),c=fG(r[t]),f=IH(c)?Iq(c.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",h=function(e){const{legend:t}=e;return QB(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(Vj(e)){if(EB(["quarter","month","day"],t))return"symbol";if(_W(n))return"gradient"}return"symbol"}(e))}({legend:n,channel:t,timeUnit:f,scaleType:u}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:a,config:o,scaleType:u,orient:d,legendType:h,direction:FQ({legend:n,legendType:h,orient:d,legendConfig:a})};for(const i of kQ){if("gradient"===h&&i.startsWith("symbol")||"symbol"===h&&i.startsWith("gradient"))continue;const r=i in CQ?CQ[i](p):n[i];if(void 0!==r){const a=TQ(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const m=n?.encoding??{},g=s.get("selections"),y={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:s,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=bQ(m[t]??{},e),i=t in AQ?AQ[t](n,v):n;void 0===i||zB(i)||(y[t]={...g?.length&&IH(c)?{name:`${jB(c.field)}_legend_${t}`}:{},...g?.length?{interactive:!!g}:{},update:i})}return zB(y)||s.set("encode",y,!!n?.encoding),s}function RQ(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of kQ){const i=JV(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return i=e,"circle"===(o=t).value?o:i;case"title":return GU(e,t);case"type":return r=!0,YV("symbol")}var i,o;return XV(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&UB(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&UB(e.explicit,["encode","gradient"])),e}function PQ(e){const t=e.component.legends,n={};for(const i of RB(t)){const r=e.getScaleComponent(i),o=_B(r.get("domains"));if(n[o])for(const e of n[o])RQ(e,t[i])||n[o].push(t[i]);else n[o]=[t[i].clone()]}const i=PB(n).flat().map((t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(!n){if(!1===t.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of pY)o[t]&&delete e[t]}if(o.title||delete o.title,void 0!==i){let e=i;o.encode?.labels?.update&&EU(o.encode.labels.update.text)&&(e=VB(i,"datum.label",o.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.text=i}(o,"labels",0,{signal:e})}return o}}(t,e.config))).filter((e=>void 0!==e));return i}function LQ(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=EU(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return EB(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 BQ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class jQ extends HV{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 IQ(e){e.component.projection=sK(e)?function(e){if(e.hasProjection){const t=_U(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[[bj,vj],[_j,xj]])(fG(n[i[0]])||fG(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(Aj)&&e.typedFieldDef(Aj).type===sW&&t.push({signal:e.getName(`geojson_${t.length}`)}),0===t.length&&t.push(e.requestDataName(oX.Main)),t}(e):void 0,o=new jQ(e.projectionName(!0),{..._U(e.config.projection)??{},...t??{}},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)IQ(t);const n=$B(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=$B(BQ,(n=>!st(e.explicit,n)&&!st(t.explicit,n)||!!(st(e.explicit,n)&&st(t.explicit,n)&&gB(e.get(n),t.get(n)))));if(gB(e.size,t.size)){if(n)return e;if(gB(e.explicit,{}))return t;if(gB(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 jQ(n,t.specifiedProjection,t.size,yB(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}}(e)}function UQ(e,t,n,i){if(xG(t,n)){const r=sK(e)?e.axis(n)??e.legend(n)??{}:{},o=tG(t,{expr:"datum"}),a=tG(t,{expr:"datum",binSuffix:"end"});return{formulaAs:tG(t,{binSuffix:"range",forAs:!0}),formula:kH(o,a,r.format,r.formatType,i)}}return{}}function qQ(e,t){return`${pU(e)}_${t}`}function WQ(e,t,n){const i=qQ(mG(n,void 0)??{},t);return e.getName(`${i}_bins`)}function HQ(e,t,n){let i,r;i=function(e){return"as"in e}(e)?vt(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[tG(e,{forAs:!0}),tG(e,{binSuffix:"end",forAs:!0})];const o={...mG(t,void 0)},a=qQ(o,e.field),{signal:s,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(vU(o.extent)){const e=o.extent;r=LJ(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...l?{extentSignal:l}:{},...r?{span:r}:{}}}}class GQ extends dX{clone(){return new GQ(null,yB(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(VH(n)&&mU(n.bin)){const{key:r,binComponent:o}=HQ(n,n.bin,t);e[r]={...o,...e[r],...UQ(t,n,i,t.config)}}return e}),{});return zB(n)?null:new GQ(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=HQ(t,t.bin,n);return new GQ(e,{[i]:r})}merge(e,t){for(const n of RB(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=MB([...this.bins[n].as,...e.bins[n].as],wB)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(PB(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(PB(this.bins).map((e=>e.field)))}hash(){return`Bin ${wB(this.bins)}`}assemble(){return PB(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:YB(e.field),as:n,signal:e.signal,...vU(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:YB(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:tG({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}class YQ extends dX{clone(){return new YQ(null,new Set(this.dimensions),yB(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([tG(e,{forAs:!0})]);else{if(sU(o)||lU(o)){const e=sU(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([tG({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([tG(e,{forAs:!0})]);eU(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([tG({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([tG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(e,t,n,i){const r=sK(i)?i.encoding[dI(t)]:void 0;if(VH(n)&&sK(i)&&PH(n,r,i.markDef,i.config))e.add(tG(n,{})),e.add(tG(n,{suffix:"end"})),n.bin&&xG(n,t)&&e.add(tG(n,{binSuffix:"range"}));else if(Hj(t)){const n=Wj(t);e.add(i.getName(n))}else e.add(tG(n));JH(n)&&function(e){return we(e)&&"field"in e}(n.scale?.range)&&e.add(n.scale.range.field)}(r,n,e,t)})),r.size+RB(i).length===0?null:new YQ(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;t&&("count"===t?(i["*"]??(i["*"]={}),i["*"].count=new Set([r||tG(e,{forAs:!0})])):(i[n]??(i[n]={}),i[n][t]=new Set([r||tG(e,{forAs:!0})])))}for(const e of t.groupby??[])n.add(e);return n.size+RB(i).length===0?null:new YQ(e,n,i)}merge(e){return FB(this.dimensions,e.dimensions)?(function(e,t){for(const n of RB(t)){const i=t[n];for(const t of RB(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){Aq.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...RB(this.measures)])}producedFields(){const e=new Set;for(const t of RB(this.measures))for(const n of RB(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 ${wB({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of RB(this.measures))for(const r of RB(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:YB(i));return{type:"aggregate",groupby:[...this.dimensions].map(YB),ops:e,fields:t,as:n}}}class VQ extends dX{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of Jj){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]={name:t.getName(`${e}_domain`),fields:[tG(n),...mU(i)?[tG(n,{binSuffix:"end"})]:[]],...SH(r)?{sortField:r}:_e(r)?{sortIndexField:ZJ(n,e)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of Jj)this[t]&&(e+=` ${t.charAt(0)}:${wB(this[t])}`);return e}get fields(){const e=[];for(const t of Jj)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of Jj)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 zI){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(bW(i)&&AU(r)){const n=LZ(BZ(this.childModel,t));n?e[t]=n:$q(ZU(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:l}=this[e];if(s){const{op:e=EH,field:t}=s;r.push(t),o.push(e),a.push(tG(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));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){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of nQ){for(const t of iQ){const i=(n[e]&&n[e][t])??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}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 i of[aj,oj])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function XQ(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function JQ(e){const t={};return pB(e.filter,(e=>{if(Jq(e)){let n=null;qq(e)?n=FU(e.equal):Hq(e)?n=FU(e.lte):Wq(e)?n=FU(e.lt):Gq(e)?n=FU(e.gt):Yq(e)?n=FU(e.gte):Vq(e)?n=e.range[0]:Xq(e)&&(n=(e.oneOf??e.in)[0]),n&&(Dq(n)?t[e.field]="date":gt(n)?t[e.field]="number":vt(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}class QQ extends dX{clone(){return new QQ(null,yB(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${wB(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!tX(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of RB(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:$q(iq(e,n[e],t.value)))}for(const e of RB(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:$q(iq(e,t[e],n)))}const r=new HV(t,n);i.copyAll(r);const o={};for(const e of RB(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===RB(o).length||i.parseNothing?null:new QQ(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of RB(this._parse)){const n=this._parse[t];1===JB(t)&&(e[t]=n)}return e}producedFields(){return new Set(RB(this._parse))}dependentFields(){return new Set(RB(this._parse))}assembleTransforms(e=!1){return RB(this._parse).filter((t=>!e||JB(t)>1)).map((e=>{const t=function(e,t){const n=WB(e);return"number"===t?`toNumber(${n})`:"boolean"===t?`toBoolean(${n})`:"string"===t?`toString(${n})`:"date"===t?`toDate(${n})`:"flatten"===t?n:t.startsWith("date:")?`timeParse(${n},'${XQ(t.slice(5,t.length))}')`:t.startsWith("utc:")?`utcParse(${n},'${XQ(t.slice(4,t.length))}')`:($q(`Unrecognized parse "${t}".`),null)}(e,this._parse[e]);return t?{type:"formula",expr:t,as:XB(e)}:null})).filter((e=>null!==e))}}class ZQ extends dX{clone(){return new ZQ(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([gY])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:gY}}}class KQ extends dX{clone(){return new KQ(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${wB(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class eZ extends dX{clone(){return new eZ(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 ${wB(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class tZ extends dX{constructor(e){let t;if(super(null),e??(e={name:"source"}),tX(e)||(t=e.format?{...xB(e.format,["parse"])}:{}),KV(e))this._data={values:e.values};else if(ZV(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];EB(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else iX(e)?this._data={values:[{type:"Sphere"}]}:(eX(e)||tX(e))&&(this._data={});this._generator=tX(e),e.name&&(this._name=e.name),t&&!zB(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 nZ,iZ=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 rZ(e){return e instanceof tZ||e instanceof KQ||e instanceof eZ}class oZ{constructor(){nZ.set(this,void 0),iZ(this,nZ,!1,"f")}setModified(){iZ(this,nZ,!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,nZ,"f")}}nZ=new WeakMap;class aZ extends oZ{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 e of t)this.run(e[0]);return this.modifiedFlag}}class sZ extends oZ{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class lZ extends sZ{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;i<t.length;i++)void 0===n[t[i]]?n[t[i]]=[e.children[i]]:n[t[i]].push(e.children[i]);for(const t of RB(n))n[t].length>1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class uZ extends sZ{constructor(e){super(),this.requiresSelectionId=e&&FJ(e)}run(e){e instanceof ZQ&&(this.requiresSelectionId&&(rZ(e.parent)||e.parent instanceof YQ||e.parent instanceof QQ)||(this.setModified(),e.remove()))}}class cZ extends oZ{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof pX&&(n=e.producedFields(),OB(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 fZ extends sZ{constructor(){super()}run(e){e instanceof hX&&!e.isRequired()&&(this.setModified(),e.remove())}}class dZ extends aZ{run(e){if(!(rZ(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof QQ)if(e instanceof QQ)this.setModified(),e.merge(t);else{if(TB(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class hZ extends aZ{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof QQ));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 RB(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!zB(i)){this.setModified();const n=new QQ(e,i);for(const r of t){if(r instanceof QQ)for(const e of RB(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof QQ&&0===RB(r.parse).length&&r.remove()}}}}}class pZ extends aZ{run(e){e instanceof hX||e.numChildren()>0||e instanceof VQ||e instanceof tZ||(this.setModified(),e.remove())}}class mZ extends aZ{run(e){const t=e.children.filter((e=>e instanceof pX)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class gZ extends aZ{run(e){const t=e.children.filter((e=>e instanceof YQ)),n={};for(const e of t){const t=wB(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of RB(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class yZ extends aZ{constructor(e){super(),this.model=e}run(e){const t=!(rZ(e)||e instanceof RJ||e instanceof QQ||e instanceof ZQ),n=[],i=[];for(const r of e.children)r instanceof GQ&&(t&&!TB(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 GQ?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 vZ extends aZ{run(e){const t=[...e.children];if(!AB(t,(e=>e instanceof hX))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof hX){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof hX))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 bZ extends dX{clone(){return new bZ(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=MB(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??tG(e)}hash(){return`JoinAggregateTransform ${wB(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class xZ extends dX{clone(){return new xZ(null,yB(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 e of t.sort)a.push(e.field),s.push(QB(e.order,"ascending"));const l={field:a,order:s};let u;return u=function(e){return _e(e)&&e.every((e=>vt(e)))&&e.length>1}(r)?r:vt(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new xZ(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:l,facetby:[],as:u})}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,l=r.map((e=>cG(i[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=tG(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let f;return f=_e(c)||IH(c)?qU(c):u.reduce(((e,t)=>(e.field.push(t),e.order.push("y"===o?"descending":"ascending"),e)),{field:[],order:[]}),new xZ(e,{dimensionFieldDefs:l,stackField:t.vgField(o),facetby:[],stackby:u,sort:f,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 ${wB(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[tG(e,{binSuffix:"mid"})]:[tG(e,{}),tG(e,{binSuffix:"end"})]:[tG(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=tG(o,{expr:"datum"}),i=tG(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${n}*${t}+${1-n}*${i}`,as:tG(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:tG(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class _Z extends dX{clone(){return new _Z(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=MB(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??tG(e)}hash(){return`WindowTransform ${wB(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>uU(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 e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const l={field:a,order:s},u=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==u?{ignorePeers:u}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function wZ(e){if(e instanceof VQ)if(1!==e.numChildren()||e.children[0]instanceof hX){const n=e.model.component.data.main;kZ(n);const i=(t=e,function e(n){if(!(n instanceof VQ)){const i=n.clone();if(i instanceof hX){const e=EZ+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof YQ||i instanceof xZ||i instanceof _Z||i instanceof bZ)&&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 YQ||t instanceof xZ||t instanceof _Z||t instanceof bZ)&&t.addDimensions(e.fields),t.swapWithParent(),wZ(e)}else e.children.map(wZ);var t}function kZ(e){if(e instanceof hX&&e.type===oX.Main&&1===e.numChildren()){const t=e.children[0];t instanceof VQ||(t.swapWithParent(),kZ(e))}}const EZ="scale_",AZ=5;function $Z(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!$Z(t.children))return!1}return!0}function DZ(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function SZ(e,t,n){let i=e.sources,r=!1;return r=DZ(new fZ,i)||r,r=DZ(new uZ(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=DZ(new pZ,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=DZ(new dZ,i)||r,r=DZ(new yZ(t),i)||r,r=DZ(new cZ,i)||r,r=DZ(new hZ,i)||r,r=DZ(new gZ,i)||r,r=DZ(new mZ,i)||r,r=DZ(new lZ,i)||r,r=DZ(new vZ,i)||r),e.sources=i,r}class MZ{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new MZ((()=>e(t)))}}function CZ(e){sK(e)?function(e){const t=e.component.scales;for(const n of RB(t)){const i=FZ(e,n);if(t[n].setWithExplicit("domains",i),zZ(e,n),e.component.data.isFaceted){let t=e;for(;!lK(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)$U(e)&&(e.data=EZ+e.data.replace(EZ,""))}}}(e):function(e){for(const t of e.children)CZ(t);const t=e.component.scales;for(const n of RB(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"):JV(i,e.getWithExplicit("domains"),"domains","scale",PZ);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&$q("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function FZ(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}=RZ(t,n);if(!e)return void $q(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=RZ(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&&fG(i.x2)?fG(i.x)?JV(NZ(n,r,e,"x"),NZ(n,r,e,"x2"),"domain","scale",PZ):NZ(n,r,e,"x2"):"y"===t&&fG(i.y2)?fG(i.y)?JV(NZ(n,r,e,"y"),NZ(n,r,e,"y2"),"domain","scale",PZ):NZ(n,r,e,"y2"):NZ(n,r,e,t)}function OZ(e,t,n){const i=Iq(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${vG(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function NZ(e,t,n,i){const{encoding:r}=n,o=fG(r[i]),{type:a}=o,s=o.timeUnit;if(function(e){return e?.unionWith}(t)){const r=NZ(e,void 0,n,i);return GV([...OZ(t.unionWith,a,s),...r.value])}if(EU(t))return GV([t]);if(t&&"unaggregated"!==t&&!kW(t))return GV(OZ(t,a,s));const l=n.stack;if(l&&i===l.fieldChannel){if("normalize"===l.offset)return YV([[0,1]]);const e=n.requestDataName(oX.Main);return YV([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const u=eU(i)&&IH(o)?function(e,t,n){if(!bW(n))return;const i=e.fieldDef(t),r=i.sort;if(MH(r))return{op:"min",field:ZJ(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(SH(r))return TZ(r,o&&!a.has(r.field));if(DH(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,u=o&&!a.has(l);if(sU(s)||lU(s))return TZ({field:tG(i),order:n},u);if(uU(s)||!s)return TZ({op:s,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(EB(["ascending",void 0],r))return!0}}(n,i,e):void 0;if(qH(o))return YV(OZ([o.datum],a,s));const c=o;if("unaggregated"===t){const e=n.requestDataName(oX.Main),{field:t}=o;return YV([{data:e,field:tG({field:t,aggregate:"min"})},{data:e,field:tG({field:t,aggregate:"max"})}])}if(mU(c.bin)){if(bW(e))return YV("bin-ordinal"===e?[]:[{data:BB(u)?n.requestDataName(oX.Main):n.requestDataName(oX.Raw),field:n.vgField(i,xG(c,i)?{binSuffix:"range"}:{}),sort:!0!==u&&we(u)?u:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=c;if(mU(e)){const t=WQ(n,c.field,e);return YV([new MZ((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return YV([{data:n.requestDataName(oX.Main),field:n.vgField(i,{})}])}}if(c.timeUnit&&EB(["time","utc"],e)&&PH(c,sK(n)?n.encoding[dI(i)]:void 0,n.markDef,n.config)){const e=n.requestDataName(oX.Main);return YV([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return YV(u?[{data:BB(u)?n.requestDataName(oX.Main):n.requestDataName(oX.Raw),field:n.vgField(i),sort:u}]:[{data:n.requestDataName(oX.Main),field:n.vgField(i)}])}function TZ(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":EH),...i?{field:YB(i)}:{},...r?{order:r}:{}}}function zZ(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=kW(i)&&i,a=yU(r)&&vU(r.extent)&&r.extent;(o||a)&&n.set("selectionExtent",o??a,!0)}function RZ(e,t){const{aggregate:n,type:i}=e;return n?vt(n)&&!hU.has(n)?{valid:!1,reason:gq(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:yq(e)}:{valid:!0}:{valid:!1,reason:mq(e)}}function PZ(e,t,n,i){return e.explicit&&t.explicit&&$q(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${_B(n)} and ${_B(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function LZ(e){if($U(e)&&vt(e.field))return e.field;if(function(e){return!_e(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if($U(n)&&vt(n.field))if(t){if(t!==n.field)return $q("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 $q("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!_e(e)&&"fields"in e&&"data"in e}(e)){$q("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 vt(t)?t:void 0}}function BZ(e,t){return function(e){const t=MB(e.map((e=>{if($U(e)){const{sort:t,...n}=e;return n}return e})),wB),n=MB(e.map((e=>{if($U(e)){const t=e.sort;return void 0===t||BB(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),wB);if(0===t.length)return;if(1===t.length){const t=e[0];if($U(t)&&n.length>0){let e=n[0];if(n.length>1){$q(xq);const t=n.filter((e=>we(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>we(e)&&"op"in e))||1!==t.length||t[0]}else if(we(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=MB(n.map((e=>BB(e)||!("op"in e)||vt(e.op)&&e.op in aU?e:($q(function(e){return`Dropping sort property ${_B(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),wB);let r;1===i.length?r=i[0]:i.length>1&&($q(xq),r=!0);const o=MB(e.map((e=>$U(e)?e.data:null)),(e=>e));return 1===o.length&&null!==o[0]?{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}(e.component.scales[t].get("domains").map((t=>($U(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function jZ(e){return cK(e)||uK(e)?e.children.reduce(((e,t)=>e.concat(jZ(t))),IZ(e)):IZ(e)}function IZ(e){return RB(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:l,range:u,reverse:c,...f}=r,d=function(e,t,n,i){if(RI(n)){if(AU(e))return{step:{signal:`${t}_step`}}}else if(we(e)&&$U(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),h=BZ(e,n),p=s?function(e,t,n,i){const r=LJ(e,t.param,t);return{signal:xW(n.get("type"))&&_e(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,s,i,h):null;return t.push({name:o,type:a,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...void 0!==c?{reverse:c}:{},...f}),t}),[])}class UZ extends HV{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||AB(this.get("domains"),(e=>_e(e)&&2===e.length&&e[0]<=0&&e[1]>=0))}}const qZ=["range","scheme"];function WZ(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,o=hI(t),a=e.getName(o);if(we(i)&&i.binned&&void 0!==i.step)return new MZ((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(mU(i)){const t=WQ(e,r,i);return new MZ((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function HZ(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of qZ)if(void 0!==n[i]){const o=NW(r,i),a=TW(e,i);if(o)if(a)$q(a);else switch(i){case"range":{const i=n.range;if(_e(i)){if(RI(e))return GV(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return MZ.fromName(i,n)}return e})))}else if(we(i))return GV({data:t.requestDataName(oX.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return GV(i)}case"scheme":return GV(GZ(n[i]))}else $q(vq(r,i,e))}const o=e===lj||"xOffset"===e?"width":"height",a=i[o];if($Y(a))if(RI(e))if(bW(r)){const n=YZ(a,t,e);if(n)return GV({step:n})}else $q(bq(o));else if(II(e)){const n=e===dj?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=VZ(a,r);if(e)return GV(e)}}const{rangeMin:s,rangeMax:l}=n,u=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,a=t.getSignalName.bind(t),{type:s}=fG(o[e]),l=t.getScaleComponent(e).get("type"),{domain:u,domainMid:c}=t.specifiedScales[e];switch(e){case lj:case uj:{if(EB(["point","band"],l)){const r=XZ(e,n,i.view);if($Y(r))return{step:YZ(r,t,e)}}const r=hI(e),o=t.getName(r);return e===uj&&xW(l)?[MZ.fromName(a,o),0]:[0,MZ.fromName(a,o)]}case dj:case hj:return function(e,t,n){const i=e===dj?"x":"y",r=t.getScaleComponent(i).get("type"),o=t.scaleName(i);if("band"===r){const e=XZ(i,t.size,t.config.view);if($Y(e)){const t=VZ(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}{const n=t.encoding[i];if(IH(n)&&n.timeUnit){return[0,{signal:Uq(n.timeUnit,(e=>`scale('${o}', ${e})`))}]}return vB(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,l);case $j:{const o=JZ(r,t.component.scales[e].get("zero"),i),a=function(e,t,n,i){const r={x:WZ(n,"x"),y:WZ(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=ZZ(t,r,i.view);return gt(e)?e-1:new MZ((()=>`${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=ZZ(t,r,i.view);return gt(e)?Math.pow(QZ*e,2):new MZ((()=>`pow(${QZ} * ${e.signal}, 2)`))}}throw new Error(cq("size",e))}(r,n,t,i);return wW(l)?function(e,t,n){const i=()=>{const i=RU(t),r=RU(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return EU(t)?new MZ(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&&_e(n)?n.length+1:($q(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(l,i,u,e)):[o,a]}case gj:return[0,2*Math.PI];case Dj:return[0,360];case pj:return[0,new MZ((()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`))];case Fj:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Oj:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Aj:return"symbol";case wj:case kj:case Ej:return"ordinal"===l?"nominal"===s?"category":"ordinal":void 0!==c?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case Sj:case Mj:case Cj:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==l)&&NW(r,"rangeMin")&&_e(u)&&2===u.length?GV([s??u[0],l??u[1]]):YV(u)}function GZ(e){return function(e){return!vt(e)&&!!e.name}(e)?{scheme:e.name,...xB(e,["name"])}:{scheme:e}}function YZ(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=mI(n),a=i[o];if("offset"===AY({step:e,offsetIsDiscrete:YH(a)&&nW(a.type)})&&OG(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;"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-${TU(a)})`}}return e.step}function VZ(e,t){if("offset"===AY({step:e,offsetIsDiscrete:bW(t)}))return{step:e.step}}function XZ(e,t,n){const i=e===lj?"width":"height";return t[i]||FY(n,i)}function JZ(e,t,n){if(t)return EU(t)?{signal:`${t.signal} ? 0 : ${JZ(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(cq("size",e))}const QZ=.95;function ZZ(e,t,n){const i=$Y(e.width)?e.width.step:CY(n,"width"),r=$Y(e.height)?e.height.step:CY(n,"height");return t.x||t.y?new MZ((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function KZ(e,t){sK(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of RB(n)){const l=a[s],u=n[s],c=e.getScaleComponent(s),f=fG(r[s]),d=l[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=NW(h,t),y=TW(s,t);if(void 0!==d&&(g?y&&$q(y):$q(vq(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":Dq(l[t])||"temporal"===n||e?u.set(t,{signal:vG(l[t],{type:n,timeUnit:e})},!0):u.set(t,l[t],!0);break;default:u.copyKeyFromObject(t,l)}}else{const n=t in eK?eK[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:NG(r,s),hasSecondaryRangeChannel:!!r[dI(s)]}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):nK(e,t)}const eK={bins:({model:e,fieldOrDatumDef:t})=>IH(t)?function(e,t){const n=t.bin;if(mU(n)){const i=WQ(e,t.field,n);return new MZ((()=>e.getSignalName(i)))}if(gU(n)&&yU(n)&&void 0!==n.step)return{step:n.step}}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(EB([wj,kj,Ej],e)&&"nominal"!==t)return"hcl"}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){if(!(cG(o)?.bin||_e(n)||null!=r||null!=i||EB([lW.TIME,lW.UTC],e)))return!!RI(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(RI(e)){if(_W(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!IH(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===lW.POINT)return n.pointPadding}}(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){if(RI(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=r;return o?a:QB(e,"bar"===n?t:i)}return II(t)&&i===lW.BAND?r.offsetBandPaddingInner:void 0}}(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)if(RI(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===lW.BAND)return QB(e,EU(i)?{signal:`${i.signal}/2`}:i/2)}else if(II(t)){if(n===lW.POINT)return.5;if(n===lW.BAND)return r.offsetBandPaddingOuter}}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){return"x"===n&&void 0!==i.xReverse?xW(e)&&"descending"===t?EU(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse:!(!xW(e)||"descending"!==t)||void 0}(t,IH(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&&xW(r)){if(_e(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!wW(r))return!0;if((!IH(t)||!t.bin)&&EB([...zI,...LI],e)){const{orient:t,type:n}=i;return(!EB(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!EB(["bar","area"],n)||a)||o?.zero)}return!1}(e,t,n,i,r,o.scale,a)};function tK(e){sK(e)?function(e){const t=e.component.scales;for(const n of KI){const i=t[n];if(!i)continue;const r=HZ(n,e);i.setWithExplicit("range",r)}}(e):nK(e,"range")}function nK(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?tK(n):KZ(n,t);for(const i of RB(n)){let r;for(const n of e.children){const e=n.component.scales[i];e&&(r=JV(r,e.getWithExplicit(t),t,"scale",VV(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))))}n[i].setWithExplicit(t,r)}}function iK(e,t,n,i,r=!1){const o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(Vj(e)||"discrete"===rU(e))return"shape"===e&&"ordinal"===t.type&&$q(pq(e,"ordinal")),"ordinal";if(RI(e)||II(e)){if(EB(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in PI)return"band";return iH(n[hI(e)])||QH(t)&&t.axis?.tickBand?"band":"point";case"temporal":return Vj(e)?"time":"discrete"===rU(e)?($q(pq(e,"temporal")),"ordinal"):IH(t)&&t.timeUnit&&Iq(t.timeUnit).utc?"utc":"time";case"quantitative":return Vj(e)?IH(t)&&mU(t.bin)?"bin-ordinal":"linear":"discrete"===rU(e)?($q(pq(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(sq(t.type))}(t,n,i,r),{type:a}=e;return eU(t)?void 0!==a?function(e,t,n=!1){if(!eU(e))return!1;switch(e){case lj:case uj:case dj:case hj:case gj:case pj:return!!_W(t)||"band"===t||"point"===t&&!n;case $j:case Fj:case Sj:case Mj:case Cj:case Dj:return _W(t)||wW(t)||EB(["band","point","ordinal"],t);case wj:case kj:case Ej:return"band"!==t;case Oj:case Aj:return"ordinal"===t||wW(t)}}(t,a)?IH(n)&&(s=a,l=n.type,!(EB([rW,aW],l)?void 0===s||bW(s):l===oW?EB([lW.TIME,lW.UTC,void 0],s):l!==iW||mW(s)||wW(s)||void 0===s))?($q(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:($q(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,l}function rK(e){sK(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of KI){const a=fG(t[o]);if(a&&n===XW&&o===Aj&&a.type===sW)continue;let s=a&&a.scale;if(!II(o)||NG(t,gI(o))){if(a&&null!==s&&!1!==s){s??(s={});const n=iK(s,o,a,i,NG(t,o));r[o]=new UZ(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}else s&&$q(fq(o))}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){rK(n);for(const o of RB(n.component.scales))if((t=r.scale)[o]??(t[o]=xQ(o,e)),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?cW(e.value,t.value)?i[o]=JV(e,t,"type","scale",oK):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of RB(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new UZ(r,o);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const oK=VV(((e,t)=>dW(e)-dW(t)));class aK{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 sK(e){return"unit"===e?.type}function lK(e){return"facet"===e?.type}function uK(e){return"concat"===e?.type}function cK(e){return"layer"===e?.type}class fK{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.view=_U(a),this.name=e.name??i,this.title=kU(e.title)?{text:e.title}:e.title?_U(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new aK,this.projectionNameMap=n?n.projectionNameMap:new aK,this.signalNameMap=n?n.signalNameMap:new aK,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>hV(e)?{filter:mB(e.filter,eW)}: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&&(OH(e)&&!CH(e.facet)||wY(e))&&(r.columns=a),kY(e)&&(r.columns=1);for(const t of SY)if(void 0!==e[t])if("spacing"===t){const n=e[t];r[t]=gt(n)?n:{row:n.row??o,column:n.column??o}}else r[t]=e[t];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:OH(e)||n?.component.data.isFaceted&&void 0===e.data},layoutSize:new HV,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?yB(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}={}){rK(e),CZ(e);for(const t of OW)KZ(e,t);t||tK(e)}(this)}parseProjection(){IQ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){NQ(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of RB(n)){const t=n[e];void 0!==t&&(i[e]=NU(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=NU(this.description)),"unit"!==this.type&&"layer"!==this.type)?zB(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 Jj){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=tQ(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=KJ(i,o),s=dQ(e,a);void 0!==s&&(n[a]=s)}}return zB(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 Jj)e[n].title&&t.push(rQ(this,n));for(const e of nQ)t=t.concat(sQ(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>IJ(e,"grid",t))),...i.map((e=>IJ(e,"grid",t))),...n.map((e=>IJ(e,"main",t))),...i.map((e=>IJ(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return PQ(this)}assembleProjections(){return cK(e=this)||uK(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),LQ(e))}(e):LQ(e);var e}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...wU(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return EB(["unit","layer"],this.type)?EB(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),zB(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||lK(this.parent)?jZ(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 jB((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(oX[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(lK(this.parent)){const t=BI(vQ(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(bW(e)&&AU(i)){const e=n.get("name"),i=LZ(BZ(this,t));return i?{signal:yQ(e,n,tG({aggregate:"distinct",field:i},{expr:"datum"}))}:($q(ZU(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):sI(e)&&eU(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}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(){return this.component.axes.x?.some((e=>e.hasOrientSignalRef()))||this.component.axes.y?.some((e=>e.hasOrientSignalRef()))}}class dK extends fK{vgField(e,t={}){const n=this.fieldDef(e);if(n)return tG(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?RB(e).reduce(((n,r)=>{const o=e[r];return _e(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=cG(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){LG(this.getMapping(),((t,n)=>{const i=cG(t);i&&e(i,n)}),t)}}class hK extends dX{clone(){return new hK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"],t.groupby&&null==t.minsteps&&null==t.maxsteps&&null==t.steps&&(this.transform.steps=200)}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${wB(this.transform)}`}assemble(){const{density:e,...t}=this.transform;return{type:"kde",field:e,...t}}}class pK extends dX{clone(){return new pK(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==BU("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=eU(r)&&t.getScaleComponent(r);return o&&xW(o.get("type"))&&"count"!==n.aggregate&&!JW(i)&&(e[n.field]=n),e}),{});return RB(o).length?new pK(e,o):null}dependentFields(){return new Set(RB(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${wB(this.filter)}`}assemble(){const e=RB(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=tG(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class mK extends dX{clone(){return new mK(this.parent,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class gK extends dX{clone(){return new gK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class yK extends dX{clone(){return new yK(null,yB(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[[bj,vj],[_j,xj]]){const r=i.map((e=>{const n=fG(t.encoding[e]);return IH(n)?n.field:qH(n)?{expr:`${n.datum}`}:XH(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new yK(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(Aj)){const i=t.typedFieldDef(Aj);i.type===sW&&(e=new yK(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(vt);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${wB(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 vK extends dX{clone(){return new vK(null,this.projection,yB(this.fields),yB(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[[bj,vj],[_j,xj]]){const i=n.map((e=>{const n=fG(t.encoding[e]);return IH(n)?n.field:qH(n)?{expr:`${n.datum}`}:XH(n)?{expr:`${n.value}`}:void 0})),r=n[0]===_j?"2":"";(i[0]||i[1])&&(e=new vK(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(vt))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${wB(this.fields)} ${wB(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class bK extends dX{clone(){return new bK(null,yB(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 bK(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(IH(i)&&IH(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:l,frame:u,keyvals:c}=o.impute,f=BG(t.mark,n);return new bK(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...u?{frame:u}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${wB(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:pV(n)?this.processSequence(n):n}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};return i&&"value"!==i?[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}]:[s]}}class xK extends dX{clone(){return new xK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class _K extends dX{clone(){return new _K(null,yB(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"data"in e}(o)){let e=zK(o.data,r);e||(e=new tZ(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new hX(e,n,oX.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(jB(e),e)}catch(t){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new _K(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Ge(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${wB({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:Ge(this.transform.as)}:{}};else{let t=this.transform.as;vt(t)||($q('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 wK extends dX{clone(){return new wK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class kK extends dX{clone(){return new kK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class EK extends dX{clone(){return new EK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=MB((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${wB(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 AK extends dX{clone(){return new AK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${wB(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function $K(e){let t=0;return function n(i,r){if(i instanceof tZ&&!i.isGenerator&&!ZV(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof QQ&&(i.parent instanceof tZ&&!r.source?(r.format={...r.format??{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof VQ)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());switch((i instanceof KQ||i instanceof eZ||i instanceof pK||i instanceof RJ||i instanceof QJ||i instanceof vK||i instanceof YQ||i instanceof _K||i instanceof _Z||i instanceof bZ||i instanceof gK||i instanceof mK||i instanceof hK||i instanceof xK||i instanceof wK||i instanceof kK||i instanceof ZQ||i instanceof AK||i instanceof EK)&&r.transform.push(i.assemble()),(i instanceof GQ||i instanceof pX||i instanceof bK||i instanceof xZ||i instanceof yK)&&r.transform.push(...i.assemble()),i instanceof hX&&(r.source&&0===r.transform.length?i.setSource(r.source):i.parent instanceof hX?i.setSource(r.name):(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof hX&&(!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 DK(e,t){const{facet:n,config:i,child:r,component:o}=e;if(e.channelHasField(t)){const a=n[t],s=eQ("title",null,i,t);let l=aG(a,i,{allowDisabling:!0,includeDefault:void 0===s||!!s});r.component.layoutHeaders[t].title&&(l=_e(l)?l.join(", "):l,l+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const u=eQ("labelOrient",a.header,i,t),c=null!==a.header&&QB(a.header?.labels,i.header.labels,!0),f=EB(["bottom","right"],u)?"footer":"header";o.layoutHeaders[t]={title:null!==a.header?l:null,facetFieldDef:a,[f]:"facet"===t?[]:[SK(e,t,c)]}}}function SK(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 MK(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=_Q(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||EU(i)?"header":"footer";a[t]??(a[t]=[SK(e,o,!1)]);const n=IJ(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function CK(e){for(const t of e.children)t.parseLayoutSize()}function FK(e,t){const n=vQ(t),i=BI(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??xQ(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=JV(a,o,n,"")}else a=o}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 OK(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(bW(e)){const e=FY(i.view,t);return AU(n)||$Y(e)?"step":e}return MY(i.view,t)}if(e.hasProjection||"arc"===e.mark)return MY(i.view,t);{const e=FY(i.view,t);return $Y(e)?e.step:e}}function NK(e,t,n){return tG(t,{suffix:`by_${tG(e)}`,...n??{}})}class TK extends dK{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=r0(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!CH(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=RB(e),n={};for(const i of t){if(![oj,aj].includes(i)){$q(cq(i,"facet"));break}const t=e[i];if(void 0===t.field){$q(uq(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=pG(e,t);return n.header?n.header=_U(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=RK(this),this.child.parseData()}parseLayoutSize(){CK(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of Jj)DK(e,t);MK(e,"x"),MK(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 Jj)for(const n of iQ){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=eQ("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=KJ(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(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 TK))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof TK?{...this.channelHasField("column")?{encode:{update:{columns:{field:tG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof TK){if(this.child.channelHasField("column")){const i=tG(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of zI){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(bW(o)&&AU(a)){const r=LZ(BZ(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):$q(ZU(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 e of Jj){const t=this.facet[e];if(t){s.push(tG(t));const{bin:l,sort:u}=t;if(mU(l)&&s.push(tG(t,{binSuffix:"end"})),SH(u)){const{field:e,op:s=EH}=u,l=NK(t,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(e),o.push(s),a.push(l))}else if(_e(u)){const n=ZJ(t,e);r.push(n),o.push("max"),a.push(n)}}}const l=!!n&&!!i;return{name:e,data:t,groupby:s,...l||r.length>0?{aggregate:{...l?{cross:l}:{},...r.length?{fields:r,ops:o,as:a}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?SH(n.sort)?[NK(n,n.sort,{expr:"datum"})]:_e(n.sort)?[ZJ(n,e,{expr:"datum"})]:[tG(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(SH(e)?e.order:!_e(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return uQ(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of nQ)if(e[i]){const r=eQ("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return uQ(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=$K(t);for(const t of e.children)n(t,{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:Jj.map((e=>this.facetSortFields(e))).flat(),order:Jj.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(uX(this,[]))}]}getMapping(){return this.facet}}function zK(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(KV(e)&&KV(t)){if(gB(e.values,t.values))return n}else if(ZV(e)&&ZV(t)){if(e.url===t.url)return n}else if(eX(e)&&e.name===n.dataName)return n}return null}function RK(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new tZ({values:[]});return t.push(e),e}const n=zK(e.data,t);if(n)return tX(e.data)||(n.data.format=DB({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new tZ(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:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=r&&(tX(r)||ZV(r)||KV(r))||!e.parent?new QV:e.parent.component.data.ancestorParse.clone();tX(r)?(nX(r)?t=new eZ(t,r.sequence):rX(r)&&(t=new KQ(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=QQ.makeExplicit(t,e,o)??t,t=new ZQ(t);const a=e.parent&&cK(e.parent);(sK(e)||lK(e))&&a&&(t=GQ.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(AV(r))a=e=new QJ(e,r),o="derived";else if(hV(r)){const i=JQ(r);a=e=QQ.makeWithAncestors(e,{},i,n)??e,e=new RJ(e,t,r.filter)}else if($V(r))a=e=GQ.makeFromTransform(e,r,t),o="number";else if(SV(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new QQ(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=pX.makeFromTransform(e,r);else if(MV(r))a=e=YQ.makeFromTransform(e,r),o="number",FJ(t)&&(e=new ZQ(e));else if(mV(r))a=e=_K.make(e,t,r,i++),o="derived";else if(wV(r))a=e=new _Z(e,r),o="number";else if(kV(r))a=e=new bZ(e,r),o="number";else if(CV(r))a=e=xZ.makeFromTransform(e,r),o="derived";else if(FV(r))a=e=new gK(e,r),o="derived";else if(EV(r))a=e=new mK(e,r),o="derived";else if(gV(r))a=e=new EK(e,r),o="derived";else if(_V(r))e=new AK(e,r);else if(DV(r))a=e=bK.makeFromTransform(e,r),o="derived";else if(yV(r))a=e=new hK(e,r),o="derived";else if(vV(r))a=e=new wK(e,r),o="derived";else if(bV(r))a=e=new kK(e,r),o="derived";else{if(!xV(r)){$q(`Ignoring an invalid transform: ${_B(r)}.`);continue}a=e=new xK(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(sK(e)&&e.component.selection)for(const n of RB(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&JB(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=function(e){const t={};function n(e){var n;yG(e)?t[e.field]="date":"quantitative"===e.type&&vt(n=e.aggregate)&&EB(["min","max"],n)?t[e.field]="number":JB(e.field)>1?e.field in t||(t[e.field]="flatten"):JH(e)&&SH(e.sort)&&JB(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((sK(e)||lK(e))&&e.forEachFieldDef(((t,i)=>{if(VH(t))n(t);else{const r=cI(i),o=e.fieldDef(r);n({...t,type:o.type})}})),sK(e)){const{mark:n,markDef:i,encoding:r}=e;if(JW(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];IH(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}(e);t=QQ.makeWithAncestors(t,{},{...s,...l},o)??t,sK(e)&&(t=yK.parseAll(t,e),t=vK.parseAll(t,e)),(sK(e)||lK(e))&&(a||(t=GQ.makeFromEncoding(t,e)??t),t=pX.makeFromEncoding(t,e)??t,t=QJ.parseAllForSortIndex(t,e));const u=e.getDataName(oX.Raw),c=new hX(t,u,oX.Raw,i);if(n[u]=c,t=c,sK(e)){const n=YQ.makeFromEncoding(t,e);n&&(t=n,FJ(e)&&(t=new ZQ(t))),t=bK.makeFromEncoding(t,e)??t,t=xZ.makeFromEncoding(t,e)??t}sK(e)&&(t=pK.make(t,e)??t);const f=e.getDataName(oX.Main),d=new hX(t,f,oX.Main,i);n[f]=d,t=d,sK(e)&&function(e,t){for(const[n,i]of LB(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new hX(new RJ(t,e,{param:n}),r,oX.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let h=null;if(lK(e)){const i=e.getName("facet");t=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(SH(r.sort)){const{field:n,op:i=EH}=r.sort;e=t=new bZ(e,{joinaggregate:[{op:i,field:n,as:NK(r,r.sort,{forAs:!0})}],groupby:[tG(r)]})}return t}return null}(t,e.facet)??t,h=new VQ(t,e,i,d.getSource()),n[i]=h}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:d,facetRoot:h,ancestorParse:o}}class PK extends fK{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||$q("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)=>r0(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=RK(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 RB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return kY(e)?e.vconcat:EY(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){CK(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";FK(e,t),FK(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=pQ(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 LK={disable:1,gridScale:1,scale:1,...AG,labelExpr:1,encode:1},BK=RB(LK);class jK extends HV{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new jK(yB(this.explicit),yB(this.implicit),this.mainExtracted)}hasAxisPart(e){return!("axis"!==e&&("grid"===e||"title"===e?!this.get(e):(t=this.get(e),!1===t||null===t)));var t}hasOrientSignalRef(){return EU(this.explicit.orient)}}const IK={bottom:"top",top:"bottom",left:"right",right:"left"};function UK(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<n;i++){const n=e[i],r=t[i];if(!!n!=!!r)return;if(n&&r){const t=n.getWithExplicit("orient"),o=r.getWithExplicit("orient");if(t.explicit&&o.explicit&&t.value!==o.value)return;e[i]=qK(n,r)}}}return e}function qK(e,t){for(const n of BK){const i=JV(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",((e,t)=>{switch(n){case"title":return GU(e,t);case"gridScale":return{explicit:e.explicit,value:QB(e.value,t.value)}}return XV(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function WK(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(EU(n.labelAngle)?n.labelAngle:ij(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===JJ(i,r))return!0}return e===n[t]}const HK=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function GK(e,t){let n=t.axis(e);const i=new jK,r=fG(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),l=t.getScaleComponent(e).get("type"),u=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:mW(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=EU(n)?"axisOrient":`axis${qB(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:qJ(s,i,e,n),vgAxisConfig:qJ(l,i,e,n),axisConfigStyle:WJ([...l,...s],i)}}(e,l,s,t.config),c=void 0!==n?!n:HJ("disable",a.style,n?.style,u).configValue;if(i.set("disable",c,void 0!==n),c)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return EU(o)?o:ij(o);{const{configValue:o}=HJ("labelAngle",i,t?.style,r);return void 0!==o?ij(o):n!==lj||!EB([aW,rW],e.type)||IH(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,u),d=bH(n.formatType,r,l),h=vH(r,r.type,n.format,n.formatType,a,!0),p={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:l,orient:s,labelAngle:f,format:h,formatType:d,mark:o,config:a};for(const r of BK){const o=r in GJ?GJ[r](p):DG(r)?n[r]:void 0,s=void 0!==o,l=WK(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=DG(r)&&"values"!==r?HJ(r,a.style,n.style,u):{},c=void 0!==e;s&&!c?i.set(r,o,l):("vgAxisConfig"!==t||HK.has(r)&&c||wG(e)||EU(e))&&i.set(r,e,!1)}}const m=n.encoding??{},g=kG.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=bQ(m[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=fG(i[t])??fG(i[dI(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(dH(l))return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===UH(o)){if(QH(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===UH(o)&&r.timeFormatType&&IH(o)&&!o.timeUnit)return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||zB(a)||(n[r]={update:a}),n}),{});return zB(g)||i.set("encode",g,!!n.encoding||void 0!==n.labelAngle),i}function YK(e,t){const{config:n}=e;return{...iJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...WX("x",e,{defaultPos:"mid"}),...WX("y",e,{defaultPos:"mid"}),...jX("size",e),...jX("angle",e),...VK(e,0,t)}}function VK(e,t,n){return n?{shape:{value:n}}:jX("shape",e)}function XK(e,t,n){if(void 0===BU("align",e,n))return"center"}function JK(e,t,n){if(void 0===BU("baseline",e,n))return"middle"}function QK(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),a=BU("size",n,t,{vgChannel:r})??t.tick.bandSize;if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&AU(e)&&gt(e.step)?3*e.step/4:3*CY(t.view,r)/4}}const ZK={arc:{vgMark:"arc",encodeEntry:e=>({...iJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...WX("x",e,{defaultPos:"mid"}),...WX("y",e,{defaultPos:"mid"}),...ZX(e,"radius"),...ZX(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...iJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...XX("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...XX("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...aJ(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...iJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...ZX(e,"x"),...ZX(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>YK(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...iJ(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&&IH(n)&&n.type===sW?{field:tG(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...iJ(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...ZX(e,"x"),...ZX(e,"y"),...OX(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...iJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...WX("x",e,{defaultPos:"mid"}),...WX("y",e,{defaultPos:"mid"}),...jX("size",e,{vgChannel:"strokeWidth"}),...aJ(e)})},point:{vgMark:"symbol",encodeEntry:e=>YK(e)},rect:{vgMark:"rect",encodeEntry:e=>({...iJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...ZX(e,"x"),...ZX(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?{...iJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...XX("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...XX("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...jX("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>YK(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...iJ(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...WX("x",e,{defaultPos:"mid"}),...WX("y",e,{defaultPos:"mid"}),...OX(e),...jX("size",e,{vgChannel:"fontSize"}),...jX("angle",e),...sJ("align",XK(e.markDef,0,t)),...sJ("baseline",JK(e.markDef,0,t)),...WX("radius",e,{defaultPos:null}),...WX("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return{...iJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...WX("x",e,{defaultPos:"mid",vgChannel:"xc"}),...WX("y",e,{defaultPos:"mid",vgChannel:"yc"}),...jX("size",e,{defaultValue:QK(e),vgChannel:r}),[o]:NU(BU("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...iJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...WX("x",e,{defaultPos:"mid"}),...WX("y",e,{defaultPos:"mid"}),...jX("size",e),...aJ(e)})}};const KK="faceted_path_",e0="stack_group_";function t0(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=QB(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),s=LU(i),l=r.key,u=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!_e(a)&&XH(a)&&kB(a.value)||!a&&kB(BU("order",r,o)))){if((_e(a)||IH(a))&&!n)return qU(a,{expr:"datum"});if(JW(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(IH(i)){const t=i.sort;return _e(t)?{field:tG(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:SH(t)?{field:tG({aggregate:TG(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:DH(t)?{field:tG(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:tG(i,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}}}}(e),c=function(e){if(!e.component.selection)return null;const t=RB(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=RB(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip}:null}(e),f=BU("aria",i,o),d=ZK[n].postEncodingTransform?ZK[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:ZK[n].vgMark,...a?{clip:!0}:{},...s?{style:s}:{},...l?{key:l.field}:{},...u?{sort:u}:{},...c||{},...!1===f?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(oX.Main)},encode:{update:ZK[n].encodeEntry(e)},...d?{transform:d}:{}}]}class n0 extends dK{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,DY(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const o=KW(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=jU("filled",e,t),r=e.type;return QB(i,r!==IW&&r!==jW&&r!==qW)}(o,r,{graticule:e.data&&rX(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const t of RB(e))sI(t)||$q(`${o=t}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let o of yI){if(!e[o])continue;const s=e[o];if(II(o)){const e=gI(o),t=r[e];if(IH(t)){if(("quantitative"===(a=t.type)||"temporal"===a)&&IH(s)&&!t.timeUnit){$q(oq(e));continue}}else o=e,$q(aq(e))}if("angle"!==o||"arc"!==t||e.theta||($q("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=gj),RG(e,o,t)){if(o===$j&&"line"===t){const t=cG(e[o]);if(t?.aggregate){$q("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===wj&&(n?"fill"in e:"stroke"in e))$q(lq("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(o===zj||o===Tj&&!_e(s)&&!XH(s)||o===Pj&&_e(s))s&&(r[o]=Ge(s).reduce(((e,t)=>(IH(t)?e.push(pG(t,o)):$q(uq(t,o)),e)),[]));else{if(o===Pj&&null===s)r[o]=null;else if(!(IH(s)||qH(s)||XH(s)||LH(s)||EU(s))){$q(uq(s,o));continue}r[o]=dG(s,o,i)}}else $q(cq(o,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=function(e,t,n){const i=_U(e),r=BU("orient",i,n);if(i.orient=function(e,t,n){switch(e){case IW:case YW:case VW:case WW:case UW:case BW:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case LW:if(IH(i)&&(gU(i.bin)||IH(r)&&r.aggregate&&!i.aggregate))return"vertical";if(IH(r)&&(gU(r.bin)||IH(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(IH(i)&&i.type===iW&&!mU(i.bin)||GH(i))&&IH(r)&&gU(r.bin)?"horizontal":"vertical";if(!a)return(IH(r)&&r.type===iW&&!mU(r.bin)||GH(r))&&IH(i)&&gU(i.bin)?"vertical":"horizontal"}case qW:if(o&&(!IH(i)||!gU(i.bin))&&a&&(!IH(r)||!gU(r.bin)))return;case PW:if(a)return IH(r)&&gU(r.bin)?"horizontal":"vertical";if(o)return IH(i)&&gU(i.bin)?"vertical":"horizontal";if(e===qW){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case jW:case HW:{const t=HH(i),o=HH(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=VH(i)&&i.type===oW,t=VH(r)&&r.type===oW;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&$q(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=BU("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:rH[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}return void 0===BU("opacity",i,n)&&(i.opacity=function(e,t){if(EB([IW,HW,YW,VW],e)&&!TG(t))return.7}(i.type,t)),void 0===BU("cursor",i,n)&&(i.cursor=function(e,t,n){return t.href||e.href||BU("href",e,n)?"pointer":e.cursor}(i,t,n)),i}(o,s,r),this.size=function({encoding:e,size:t}){for(const n of zI){const i=hI(n);$Y(t[i])&&WH(e[n])&&(delete t[i],$q(bq(i)))}return t}({encoding:s,size:DY(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=QY(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=>xY(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===XW,n=e&&Gj.some((t=>YH(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 KI.reduce(((e,n)=>{const i=fG(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=_U(e);return _e(t)&&(i.domain=t.map(FU)),_e(n)&&(i.range=n.map(FU)),i}initAxes(e){return zI.reduce(((t,n)=>{const i=e[n];if(YH(i)||n===lj&&YH(e.x2)||n===uj&&YH(e.y2)){const e=YH(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=RB(e),n={};for(const i of t){const t=e[i];n[i]=wG(t)?CU(t):FU(t)}return n}initLegends(e){return QI.reduce(((t,n)=>{const i=fG(e[n]);if(i&&function(e){switch(e){case wj:case kj:case Ej:case $j:case Aj:case Sj:case Fj:case Oj:return!0;case Mj:case Cj:case Dj:return!1}}(n)){const e=i.legend;t[n]=e?_U(e):e}return t}),{})}parseData(){this.component.data=RK(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of zI){const r=hI(i);if(t[r]){const e=t[r];n.layoutSize.set(r,$Y(e)?"step":e,!0)}else{const t=OK(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;for(const r of t){const t=jB(r.name),o=r.select,a=vt(o)?o:o.type,s=we(o)?yB(o):{type:a},l=i[a];for(const e in l)"fields"!==e&&"encodings"!==e&&("mark"===e&&(s[e]={...l[e],...s[e]}),void 0!==s[e]&&!0!==s[e]||(s[e]=yB(l[e]??s[e])));const u=n[t]={...s,name:t,type:a,init:r.value,bind:r.bind,events:vt(s.on)?zT(s.on,"scope"):Ge(yB(s.on))},c=yB(r);for(const t of MJ)t.defined(u)&&t.parse&&t.parse(e,u,c)}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=function(e){if(EB([jW,PW,GW],e.mark)){const t=BG(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:KK+e.requestDataName(oX.Main),data:e.requestDataName(oX.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:t0(e,{fromPrefix:KK})}]}(e,t)}else if(e.mark===LW){const t=MU.some((t=>BU(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=t0(e,{fromPrefix:e0}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${n}',${e})`)).join(",")})`;let o,a;"x"===e.stack.fieldChannel?(o={...bB(t.encode.update,["y","yc","y2","height",...MU]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...xB(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...bB(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...xB(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of MU){const i=jU(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=NU(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=tG(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(tG(n,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=jU(i,e.markDef,e.config);return void 0!==t?{...n,[i]:NU(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(oX.Main),name:e0+e.requestDataName(oX.Main),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}(e)}return t0(e)}(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,zI.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[GK(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of PB(e.component.selection??{})){const r=i.name,o=Dt(r+AJ);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:`${SJ}(${o}, ${Dt(e)}${n}`})}n=!0;for(const n of MJ)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}if(n){0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return fX(t)}(this,e)}assembleSignals(){return[...UJ(this),...lX(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=CJ(e,{escape:!1});for(const t of PB(e.component.selection??{})){const e={name:t.name+AJ};if(t.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:gY}}]),t.init){const n=t.project.items.map(aX);e.values=t.project.hasSelectionId?t.init.map((e=>({unit:i,[gY]:sX(e,!1)[0]}))):t.init.map((e=>({unit:i,fields:n,values:sX(e,!1)})))}n.filter((e=>e.name===t.name+AJ)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return pQ(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&cK(this.parent)||(e=cX(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 FG(this.encoding,e)}fieldDef(e){return cG(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return VH(t)?t:null}}class i0 extends fK{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(WY(e))return new i0(e,this,this.getName(`layer_${t}`),o,r);if(MG(e))return new n0(e,this,this.getName(`layer_${t}`),o,r);throw new Error(YU(e))}))}parseData(){this.component.data=RK(this);for(const e of this.children)e.parseData()}parseLayoutSize(){CK(this),FK(this,"width"),FK(this,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of RB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}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 i of e.children){i.parseAxesAndHeaders();for(const r of RB(i.component.axes))n.axis[r]=_Q(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=UK(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of zI){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(!EU(t)){if(i[t]>0&&!n){const n=IK[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 of t[r])e.get("grid")&&!e.explicit.grid&&(e.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())),UJ(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),pQ(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const t of this.children)for(const n of Ge(t.assembleGroupStyle()))e.add(n);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)sK(n)&&(t=cX(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),PQ(this))}}function r0(e,t,n,i,r){if(OH(e))return new TK(e,t,n,r);if(WY(e))return new i0(e,t,n,i,r);if(MG(e))return new n0(e,t,n,i,r);if(function(e){return kY(e)||EY(e)||wY(e)}(e))return new PK(e,t,n,r);throw new Error(YU(e))}function o0(e,t={}){var n;t.logger&&(n=t.logger,Aq=n),t.fieldTitle&&oG(t.fieldTitle);try{const n=BY(Ee(t.config,e.config)),i=LV(e,n),r=r0(i,null,"",void 0,n);r.parse(),function(e,t){$Z(e.sources);let n=0,i=0;for(let i=0;i<AZ&&SZ(e,t,!0);i++)n++;e.sources.map(wZ);for(let n=0;n<AZ&&SZ(e,t,!1);n++)i++;$Z(e.sources),Math.max(n,i)===AZ&&$q(`Maximum optimization runs(${AZ}) reached.`)}(r.component.data,r);const o=function(e,t,n={},i){const r=e.config?function(e){e=yB(e);for(const t of IY)delete e[t];if(e.axis)for(const t in e.axis)wG(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of lY)delete e.legend[t];if(e.mark){for(const t of tH)delete e.mark[t];e.mark.tooltip&&we(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(_Y(e.params)),delete e.params);for(const t of jY){for(const n of tH)delete e[t][n];const n=UY[t];if(n)for(const i of n)delete e[t][i];qY(e,t)}for(const t of RB(aY))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=wU(e.title);zB(t)||(e.style["group-title"]={...e.style["group-title"],...t}),zB(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),zB(i)?delete e.title:e.title=i}(e);for(const t in e)we(e[t])&&zB(e[t])&&delete e[t];return zB(e)?void 0:e}(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){const n=[],i=$K(n);let r=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+r++);const e=t.assemble();i(t,e)}for(const e of n)0===e.transform.length&&delete e.transform;let o=0;for(const[e,t]of n.entries())0!==(t.transform??[]).length||t.source||n.splice(o++,0,n.splice(e,1)[0]);for(const t of n)for(const n of t.transform??[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of n)e.name in t&&(e.values=t[e.name]);return n}(e.component.data,n)),a=e.assembleProjections(),s=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();c=c.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([]),..._Y(f)]),...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");if(void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):vt(t)&&(t={type:t}),r&&o&&("fit"===(a=t.type)||"fit-x"===a||"fit-y"===a))if("step"===r&&"step"===o)$q(QU()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";$q(QU(BI(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${BI(e)}`:"fit"}(n)}var a;return{...1===RB(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...WV(n,!1),...WV(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(Aq=Eq),t.fieldTitle&&oG(iG)}}const a0="5.9.0",s0=function(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}};const l0="#fff",u0="#888",c0={background:"#333",view:{stroke:u0},title:{color:l0,subtitleColor:l0},style:{"guide-label":{fill:l0},"guide-title":{fill:l0}},axis:{domainColor:l0,gridColor:u0,tickColor:l0}},f0="#4572a7",d0={background:"#fff",arc:{fill:f0},area:{fill:f0},line:{stroke:f0,strokeWidth:2},path:{stroke:f0},rect:{fill:f0},shape:{stroke:f0},symbol:{fill:f0,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"]}},h0="#30a2da",p0="#cbcbcb",m0="#f0f0f0",g0="#333",y0={arc:{fill:h0},area:{fill:h0},axis:{domainColor:p0,grid:!0,gridColor:p0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:p0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:m0,group:{fill:m0},legend:{labelColor:g0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:g0,titleFontSize:14,titlePadding:10},line:{stroke:h0,strokeWidth:2},path:{stroke:h0,strokeWidth:.5},rect:{fill:h0},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:h0},bar:{binSpacing:2,fill:h0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},v0="#000",b0={group:{fill:"#e5e5e5"},arc:{fill:v0},area:{fill:v0},line:{stroke:v0},path:{stroke:v0},rect:{fill:v0},shape:{stroke:v0},symbol:{fill:v0,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"]}},x0="Benton Gothic, sans-serif",_0="#82c6df",w0="Benton Gothic Bold, sans-serif",k0="normal",E0={"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"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},A0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:w0,fontSize:22,fontWeight:"normal"},arc:{fill:_0},area:{fill:_0},line:{stroke:_0,strokeWidth:2},path:{stroke:_0},rect:{fill:_0},shape:{stroke:_0},symbol:{fill:_0,size:30},axis:{labelFont:x0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:w0,titleFontSize:13,titleFontWeight:k0},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:x0,labelFontSize:11.5,symbolType:"square",titleFont:w0,titleFontSize:13,titleFontWeight:k0},range:{category:E0["category-6"],diverging:E0["fireandice-6"],heatmap:E0["fire-7"],ordinal:E0["fire-7"],ramp:E0["fire-7"]}},$0="#ab5787",D0="#979797",S0={background:"#f9f9f9",arc:{fill:$0},area:{fill:$0},line:{stroke:$0},path:{stroke:$0},rect:{fill:$0},shape:{stroke:$0},symbol:{fill:$0,size:30},axis:{domainColor:D0,domainWidth:.5,gridWidth:.2,labelColor:D0,tickColor:D0,tickWidth:.2,titleColor:D0},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"]}},M0="#3e5c69",C0={background:"#fff",arc:{fill:M0},area:{fill:M0},line:{stroke:M0},path:{stroke:M0},rect:{fill:M0},shape:{stroke:M0},symbol:{fill:M0},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"]}},F0="#1696d2",O0="#000000",N0="Lato",T0="Lato",z0={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},R0={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:N0},axisX:{domain:!0,domainColor:O0,domainWidth:1,grid:!1,labelFontSize:12,labelFont:T0,labelAngle:0,tickColor:O0,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:N0},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:T0,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:N0,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:T0,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:N0,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:z0["six-groups-cat-1"],diverging:z0["diverging-colors"],heatmap:z0["diverging-colors"],ordinal:z0["six-groups-seq"],ramp:z0["shades-blue"]},area:{fill:F0},rect:{fill:F0},line:{color:F0,stroke:F0,strokeWidth:5},trail:{color:F0,stroke:F0,strokeWidth:0,size:1},path:{stroke:F0,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:F0,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:F0,stroke:null}},arc:{fill:F0},shape:{stroke:F0},symbol:{fill:F0,size:30}},P0="#3366CC",L0="#ccc",B0="Arial, sans-serif",j0={arc:{fill:P0},area:{fill:P0},path:{stroke:P0},rect:{fill:P0},shape:{stroke:P0},symbol:{stroke:P0},circle:{fill:P0},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:B0,fontSize:12},"guide-title":{font:B0,fontSize:12},"group-title":{font:B0,fontSize:12}},title:{font:B0,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:L0,tickColor:L0,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},I0=e=>e*(1/3+1),U0=I0(9),q0=I0(10),W0=I0(12),H0="Segoe UI",G0="wf_standard-font, helvetica, arial, sans-serif",Y0="#252423",V0="#605E5C",X0="transparent",J0="#118DFF",Q0="#DEEFFF",Z0=[Q0,J0],K0={view:{stroke:X0},background:X0,font:H0,header:{titleFont:G0,titleFontSize:W0,titleColor:Y0,labelFont:H0,labelFontSize:q0,labelColor:V0},axis:{ticks:!1,grid:!1,domain:!1,labelColor:V0,labelFontSize:U0,titleFont:G0,titleColor:Y0,titleFontSize:W0,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:J0},line:{stroke:J0,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:H0,fontSize:U0,fill:V0},arc:{fill:J0},area:{fill:J0,line:!0,opacity:.6},path:{stroke:J0},rect:{fill:J0},point:{fill:J0,filled:!0,size:75},shape:{stroke:J0},symbol:{fill:J0,strokeWidth:1.5,size:50},legend:{titleFont:H0,titleFontWeight:"bold",titleColor:V0,labelFont:H0,labelFontSize:q0,labelColor:V0,symbolType:"circle",symbolSize:75},range:{category:[J0,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:Z0,heatmap:Z0,ordinal:[Q0,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",J0]}},e1="2.13.0";function t1(e){return t1="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},t1(e)}function n1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==t1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==t1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i1=["title","image"];function r1(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,i){if("object"!=typeof i||null===i)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}(t))}const o1="vg-tooltip-element",a1={offsetX:10,offsetY:10,id:o1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(e,t,n){if(_e(e))return`[${e.map((e=>t(vt(e)?e:r1(e,n)))).join(", ")}]`;if(we(e)){let i="";const r=e,{title:o,image:a}=r,s=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(r,i1);o&&(i+=`<h2>${t(o)}</h2>`),a&&(i+=`<img src="${t(a)}">`);const l=Object.keys(s);if(l.length>0){i+="<table>";for(const e of l){let r=s[e];void 0!==r&&(we(r)&&(r=r1(r,n)),i+=`<tr><td class="key">${t(e)}:</td><td class="value">${t(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return t(e)}};function s1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s1(Object(n),!0).forEach((function(t){n1(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s1(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class u1{constructor(e){this.options=l1(l1({},a1),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"#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".toString().replace(o1,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,i){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)),null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:o}=function(e,t,n,i){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let o=e.clientY+i;return o+t.height>window.innerHeight&&(o=+e.clientY-i-t.height),{x:r,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${o}px`,this.el.style.left=`${r}px`}}var c1,f1,d1=n(27061);function h1(e){return h1="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},h1(e)}function p1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==h1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==h1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===h1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g1=y1;function y1(e){var t=this;if(t instanceof y1||(t=new y1),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,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}function v1(e,t,n){var i=t===e.head?new _1(n,null,t,e):new _1(n,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function b1(e,t){e.tail=new _1(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function x1(e,t){e.head=new _1(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function _1(e,t,n,i){if(!(this instanceof _1))return new _1(e,t,n,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}y1.Node=_1,y1.create=y1,y1.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},y1.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},y1.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},y1.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)b1(this,arguments[e]);return this.length},y1.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)x1(this,arguments[e]);return this.length},y1.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},y1.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},y1.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,i=0;null!==n;i++)e.call(t,n.value,i,this),n=n.next},y1.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,i=this.length-1;null!==n;i--)e.call(t,n.value,i,this),n=n.prev},y1.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},y1.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},y1.prototype.map=function(e,t){t=t||this;for(var n=new y1,i=this.head;null!==i;)n.push(e.call(t,i.value,this)),i=i.next;return n},y1.prototype.mapReverse=function(e,t){t=t||this;for(var n=new y1,i=this.tail;null!==i;)n.push(e.call(t,i.value,this)),i=i.prev;return n},y1.prototype.reduce=function(e,t){var n,i=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},y1.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},y1.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},y1.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},y1.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new y1;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,r=this.head;null!==r&&i<e;i++)r=r.next;for(;null!==r&&i<t;i++,r=r.next)n.push(r.value);return n},y1.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new y1;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,r=this.tail;null!==r&&i>t;i--)r=r.prev;for(;null!==r&&i>e;i--,r=r.prev)n.push(r.value);return n},y1.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,r=this.head;null!==r&&i<e;i++)r=r.next;var o=[];for(i=0;r&&i<t;i++)o.push(r.value),r=this.removeNode(r);for(null===r&&(r=this.tail),r!==this.head&&r!==this.tail&&(r=r.prev),i=0;i<n.length;i++)r=v1(this,r,n[i]);return o},y1.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=e,this};try{(f1||(f1=1,c1=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),c1)(y1)}catch(e){}const w1=g1,k1=Symbol("max"),E1=Symbol("length"),A1=Symbol("lengthCalculator"),$1=Symbol("allowStale"),D1=Symbol("maxAge"),S1=Symbol("dispose"),M1=Symbol("noDisposeOnSet"),C1=Symbol("lruList"),F1=Symbol("cache"),O1=Symbol("updateAgeOnGet"),N1=()=>1,T1=(e,t,n)=>{const i=e[F1].get(t);if(i){const t=i.value;if(z1(e,t)){if(P1(e,i),!e[$1])return}else n&&(e[O1]&&(i.value.now=Date.now()),e[C1].unshiftNode(i));return t.value}},z1=(e,t)=>{if(!t||!t.maxAge&&!e[D1])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[D1]&&n>e[D1]},R1=e=>{if(e[E1]>e[k1])for(let t=e[C1].tail;e[E1]>e[k1]&&null!==t;){const n=t.prev;P1(e,t),t=n}},P1=(e,t)=>{if(t){const n=t.value;e[S1]&&e[S1](n.key,n.value),e[E1]-=n.length,e[F1].delete(n.key),e[C1].removeNode(t)}};class L1{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const B1=(e,t,n,i)=>{let r=n.value;z1(e,r)&&(P1(e,n),e[$1]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};const j1=Object.freeze({loose:!0}),I1=Object.freeze({});var U1=e=>e?"object"!=typeof e?j1:e:I1,q1={exports:{}},W1={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},H1="object"==typeof d1&&d1.env&&d1.env.NODE_DEBUG&&/\bsemver\b/i.test(d1.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=W1,i=H1,r=(t=e.exports={}).re=[],o=t.src=[],a=t.t={};let s=0;const l=(e,t,n)=>{const l=s++;i(e,l,t),a[e]=l,o[l]=t,r[l]=new RegExp(t,n?"g":void 0)};l("NUMERICIDENTIFIER","0|[1-9]\\d*"),l("NUMERICIDENTIFIERLOOSE","[0-9]+"),l("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),l("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),l("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),l("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),l("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),l("BUILDIDENTIFIER","[0-9A-Za-z-]+"),l("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),l("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),l("FULL",`^${o[a.FULLPLAIN]}$`),l("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),l("LOOSE",`^${o[a.LOOSEPLAIN]}$`),l("GTLT","((?:<|>)?=?)"),l("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),l("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),l("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),l("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),l("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),l("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),l("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),l("COERCERTL",o[a.COERCE],!0),l("LONETILDE","(?:~>?)"),l("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",l("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),l("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),l("LONECARET","(?:\\^)"),l("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",l("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),l("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),l("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),l("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),l("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",l("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),l("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),l("STAR","(<|>)?=?\\s*\\*"),l("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),l("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(q1,q1.exports);var G1=q1.exports;const Y1=/^[0-9]+$/,V1=(e,t)=>{const n=Y1.test(e),i=Y1.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:e<t?-1:1};var X1={compareIdentifiers:V1,rcompareIdentifiers:(e,t)=>V1(t,e)};const J1=H1,{MAX_LENGTH:Q1,MAX_SAFE_INTEGER:Z1}=W1,{re:K1,t:e2}=G1,t2=U1,{compareIdentifiers:n2}=X1;var i2=class e{constructor(t,n){if(n=t2(n),t instanceof e){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid Version: ${t}`);if(t.length>Q1)throw new TypeError(`version is longer than ${Q1} characters`);J1("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const i=t.trim().match(n.loose?K1[e2.LOOSE]:K1[e2.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>Z1||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Z1||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Z1||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<Z1)return t}return e})):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(J1("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),n2(this.major,t.major)||n2(this.minor,t.minor)||n2(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const e=this.prerelease[n],i=t.prerelease[n];if(J1("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return n2(e,i)}while(++n)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let n=0;do{const e=this.build[n],i=t.build[n];if(J1("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return n2(e,i)}while(++n)}inc(e,t,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}if(t){const e=Number(n)?1:0;0===n2(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=[t,e]):this.prerelease=[t,e]}break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};const r2=i2;var o2=(e,t,n)=>new r2(e,n).compare(new r2(t,n));const a2=o2;const s2=o2;const l2=o2;const u2=o2;const c2=o2;const f2=o2;const d2=(e,t,n)=>0===a2(e,t,n),h2=(e,t,n)=>0!==s2(e,t,n),p2=(e,t,n)=>l2(e,t,n)>0,m2=(e,t,n)=>u2(e,t,n)>=0,g2=(e,t,n)=>c2(e,t,n)<0,y2=(e,t,n)=>f2(e,t,n)<=0;var v2,b2,x2,_2,w2=(e,t,n,i)=>{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 d2(e,n,i);case"!=":return h2(e,n,i);case">":return p2(e,n,i);case">=":return m2(e,n,i);case"<":return g2(e,n,i);case"<=":return y2(e,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const k2=function e(){if(_2)return x2;_2=1;class t{constructor(e,n){if(n=i(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e,this.set=e.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,i=n.get(t);if(i)return i;const a=this.options.loose,m=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(m,D(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],u),o("comparator trim",e);let g=(e=(e=(e=e.replace(s[l.TILDETRIM],c)).replace(s[l.CARETTRIM],f)).split(/\s+/).join(" ")).split(" ").map((e=>y(e,this.options))).join(" ").split(/\s+/).map((e=>$(e,this.options)));a&&(g=g.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE]))))),o("range list",g);const v=new Map,b=g.map((e=>new r(e,this.options)));for(const e of b){if(p(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const x=[...v.values()];return n.set(t,x),x}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>g(t,n)&&e.set.some((e=>g(e,n)&&t.every((t=>e.every((e=>t.intersects(e,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(S(this.set[t],e,this.options))return!0;return!1}}x2=t;const n=new 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[k1]=e.max||1/0;const t=e.length||N1;if(this[A1]="function"!=typeof t?N1:t,this[$1]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[D1]=e.maxAge||0,this[S1]=e.dispose,this[M1]=e.noDisposeOnSet||!1,this[O1]=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[k1]=e||1/0,R1(this)}get max(){return this[k1]}set allowStale(e){this[$1]=!!e}get allowStale(){return this[$1]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[D1]=e,R1(this)}get maxAge(){return this[D1]}set lengthCalculator(e){"function"!=typeof e&&(e=N1),e!==this[A1]&&(this[A1]=e,this[E1]=0,this[C1].forEach((e=>{e.length=this[A1](e.value,e.key),this[E1]+=e.length}))),R1(this)}get lengthCalculator(){return this[A1]}get length(){return this[E1]}get itemCount(){return this[C1].length}rforEach(e,t){t=t||this;for(let n=this[C1].tail;null!==n;){const i=n.prev;B1(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[C1].head;null!==n;){const i=n.next;B1(this,e,n,t),n=i}}keys(){return this[C1].toArray().map((e=>e.key))}values(){return this[C1].toArray().map((e=>e.value))}reset(){this[S1]&&this[C1]&&this[C1].length&&this[C1].forEach((e=>this[S1](e.key,e.value))),this[F1]=new Map,this[C1]=new w1,this[E1]=0}dump(){return this[C1].map((e=>!z1(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[C1]}set(e,t,n){if((n=n||this[D1])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,r=this[A1](t,e);if(this[F1].has(e)){if(r>this[k1])return P1(this,this[F1].get(e)),!1;const o=this[F1].get(e).value;return this[S1]&&(this[M1]||this[S1](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[E1]+=r-o.length,o.length=r,this.get(e),R1(this),!0}const o=new L1(e,t,r,i,n);return o.length>this[k1]?(this[S1]&&this[S1](e,t),!1):(this[E1]+=o.length,this[C1].unshift(o),this[F1].set(e,this[C1].head),R1(this),!0)}has(e){if(!this[F1].has(e))return!1;const t=this[F1].get(e).value;return!z1(this,t)}get(e){return T1(this,e,!0)}peek(e){return T1(this,e,!1)}pop(){const e=this[C1].tail;return e?(P1(this,e),e.value):null}del(e){P1(this,this[F1].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[F1].forEach(((e,t)=>T1(this,t,!1)))}}({max:1e3}),i=U1,r=function(){if(b2)return v2;b2=1;const t=Symbol("SemVer ANY");class n{static get ANY(){return t}constructor(e,r){if(r=i(r),e instanceof n){if(e.loose===!!r.loose)return e;e=e.value}s("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===t?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(e){const n=this.options.loose?r[o.COMPARATORLOOSE]:r[o.COMPARATOR],i=e.match(n);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new l(i[2],this.options.loose):this.semver=t}toString(){return this.value}test(e){if(s("Comparator.test",e,this.options.loose),this.semver===t||e===t)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return a(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new u(e.value,t).test(this.value):""===e.operator?""===e.value||new u(this.value,t).test(e.semver):!((t=i(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(a(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(a(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}v2=n;const i=U1,{re:r,t:o}=G1,a=w2,s=H1,l=i2,u=e();return v2}(),o=H1,a=i2,{re:s,t:l,comparatorTrimReplace:u,tildeTrimReplace:c,caretTrimReplace:f}=G1,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=W1,p=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const i=e.slice();let r=i.pop();for(;n&&i.length;)n=i.every((e=>r.intersects(e,t))),r=i.pop();return n},y=(e,t)=>(o("comp",e,t),e=_(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=k(e,t),o("xrange",e),e=A(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>x(e,t))).join(" "),x=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,((t,n,i,r,a)=>{let s;return o("tilde",e,t,n,i,r,a),v(n)?s="":v(i)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(r)?s=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${i}.${r}-${a} <${n}.${+i+1}.0-0`):s=`>=${n}.${i}.${r} <${n}.${+i+1}.0-0`,o("tilde return",s),s}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(n,((t,n,r,a,s)=>{let l;return o("caret",e,t,n,r,a,s),v(n)?l="":v(r)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${r}.0${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.0${i} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===r?`>=${n}.${r}.${a}-${s} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}-${s} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===r?`>=${n}.${r}.${a}${i} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a} <${+n+1}.0.0-0`),o("caret return",l),l}))},k=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>E(e,t))).join(" ")),E=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,((n,i,r,a,s,l)=>{o("xRange",e,n,i,r,a,s,l);const u=v(r),c=u||v(a),f=c||v(s),d=f;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",u?n=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(c&&(a=0),s=0,">"===i?(i=">=",c?(r=+r+1,a=0,s=0):(a=+a+1,s=0)):"<="===i&&(i="<",c?r=+r+1:a=+a+1),"<"===i&&(l="-0"),n=`${i+r}.${a}.${s}${l}`):c?n=`>=${r}.0.0${l} <${+r+1}.0.0-0`:f&&(n=`>=${r}.${a}.0${l} <${r}.${+a+1}.0-0`),o("xRange return",n),n}))},A=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),$=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,n,i,r,o,a,s,l,u,c,f,d,h)=>`${n=v(i)?"":v(r)?`>=${i}.0.0${e?"-0":""}`:v(o)?`>=${i}.${r}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(u)?"":v(c)?`<${+u+1}.0.0-0`:v(f)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${f}-${d}`:e?`<${u}.${c}.${+f+1}-0`:`<=${l}`}`.trim(),S=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==r.ANY&&e[n].semver.prerelease.length>0){const i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return x2}();var E2=(e,t,n)=>{try{t=new k2(t,n)}catch(e){return!1}return t.test(e)},A2=m1(E2),$2='.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 D2(e,...t){for(const n of t)S2(e,n);return e}function S2(e,t){for(const n of Object.keys(t))Ae(e,n,t[n],!0)}function M2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function C2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M2(Object(n),!0).forEach((function(t){p1(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M2(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const F2="6.22.1",O2=y;let N2=v;const T2="undefined"!=typeof window?window:void 0;void 0===N2&&T2?.vl?.compile&&(N2=T2.vl);const z2={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},R2={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},P2={vega:"Vega","vega-lite":"Vega-Lite"},L2={vega:O2.version,"vega-lite":N2?N2.version:"not available"},B2={vega:e=>e,"vega-lite":(e,t)=>N2.compile(e,{config:t}).spec},j2='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">\n <circle r="2" cy="8" cx="2"></circle>\n <circle r="2" cy="8" cx="8"></circle>\n <circle r="2" cy="8" cx="14"></circle>\n</svg>',I2="chart-wrapper";function U2(e,t,n,i){const r=`<html><head>${t}</head><body><pre><code class="json">`,o=`</code></pre>${n}</body></html>`,a=window.open("");a.document.write(r+e+o),a.document.title=`${P2[i]} JSON Source`}function q2(e,t){if(e.$schema){const n=s0(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${P2[n.library]}, but mode argument sets ${P2[t]??t}.`);const i=n.library;return A2(L2[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${P2[i]} ${n.version}, but the current version of ${P2[i]} is v${L2[i]}.`),i}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"}function W2(e){return(t=e)&&"load"in t?e:O2.loader(e);var t}async function H2(e,t,n={}){let i,r;vt(t)?(r=W2(n.loader),i=JSON.parse(await r.load(t))):i=t;const o=function(e){const t=e.usermeta?.embedOptions??{};return vt(t.defaultStyle)&&(t.defaultStyle=!1),t}(i),a=o.loader;r&&!a||(r=W2(n.loader??a));const s=await G2(o,r),l=await G2(n,r),u=C2(C2({},D2(l,s)),{},{config:Ee(l.config??{},s.config??{})});return await async function(e,t,n={},i){const r=n.theme?Ee(b[n.theme],n.config??{}):n.config,o=ht(n.actions)?n.actions:D2({},z2,n.actions??{}),a=C2(C2({},R2),n.i18n),s=n.renderer??"canvas",l=n.logLevel??O2.Warn,u=n.downloadFileName??"visualization",c="string"==typeof e?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(!1!==n.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:i}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(c);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===n.defaultStyle||!0===n.defaultStyle?$2.toString():n.defaultStyle,i.appendChild(t)}}const f=q2(t,n.mode);let d=B2[f](t,r);if("vega-lite"===f&&d.$schema){const e=s0(d.$schema);A2(L2.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${L2.vega}.`)}c.classList.add("vega-embed"),o&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(o){const e=document.createElement("div");e.classList.add(I2),c.appendChild(e),h=e}const p=n.patch;if(p&&(d=p instanceof Function?p(d):L(d,p,!0,!1).newDocument),n.formatLocale&&O2.formatLocale(n.formatLocale),n.timeFormatLocale&&O2.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const e in n.expressionFunctions){const t=n.expressionFunctions[e];"fn"in t?O2.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&O2.expressionFunction(e,t)}const{ast:m}=n,g=O2.parse(d,"vega-lite"===f?{}:r,{ast:m}),y=new(n.viewClass||O2.View)(g,C2({loader:i,logLevel:l,renderer:s},m?{expr:O2.expressionInterpreter??n.expr??rB}:{}));if(y.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(h.classList.add("fit-x"),h.classList.remove("fit-y")):"fit-y"==n?(h.classList.remove("fit-x"),h.classList.add("fit-y")):"fit"==n?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")})),!1!==n.tooltip){const e="function"==typeof n.tooltip?n.tooltip:new u1(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let v,{hover:x}=n;if(void 0===x&&(x="vega"===f),x){const{hoverSet:e,updateSet:t}="boolean"==typeof x?{}:x;y.hover(e,t)}if(n&&(null!=n.width&&y.width(n.width),null!=n.height&&y.height(n.height),null!=n.padding&&y.padding(n.padding)),await y.initialize(h,n.bind).runAsync(),!1!==o){let e=c;if(!1!==n.defaultStyle){const t=document.createElement("details");t.title=a.CLICK_TO_VIEW_ACTIONS,c.append(t),e=t;const n=document.createElement("summary");n.innerHTML=j2,t.append(n),v=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",v)}const i=document.createElement("div");if(e.append(i),i.classList.add("vega-actions"),!0===o||!1!==o.export)for(const e of["svg","png"])if(!0===o||!0===o.export||o.export[e]){const t=a[`${e.toUpperCase()}_ACTION`],r=document.createElement("a"),o=we(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;r.text=t,r.href="#",r.target="_blank",r.download=`${u}.${e}`,r.addEventListener("mousedown",(async function(t){t.preventDefault();const n=await y.toImageURL(e,o);this.href=n})),i.append(r)}if(!0===o||!1!==o.source){const e=document.createElement("a");e.text=a.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){U2(Z()(t),n.sourceHeader??"",n.sourceFooter??"",f),e.preventDefault()})),i.append(e)}if("vega-lite"===f&&(!0===o||!1!==o.compiled)){const e=document.createElement("a");e.text=a.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){U2(Z()(d),n.sourceHeader??"",n.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===o||!1!==o.editor){const e=n.editorUrl??"https://vega.github.io/editor/",o=document.createElement("a");o.text=a.EDITOR_ACTION,o.href="#",o.addEventListener("click",(function(n){!function(e,t,n){const i=e.open(t),{origin:r}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===i&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(i.postMessage(n,r),setTimeout(e,250),o-=1)}),250)}(window,e,{config:r,mode:f,renderer:s,spec:Z()(t)}),n.preventDefault()})),i.append(o)}}return{view:y,spec:t,vgSpec:d,finalize:function(){v&&document.removeEventListener("click",v),y.finalize()},embedOptions:n}}(e,i,u,r)}async function G2(e,t){const n=vt(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=vt(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return C2(C2(C2({},e),i?{patch:i}:{}),n?{config:n}:{})}},36425:e=>{var t=function(){"use strict";function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function r(o,s,l,u,c){"object"==typeof s&&(l=s.depth,u=s.prototype,c=s.includeNonEnumerable,s=s.circular);var f=[],d=[],h="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===l&&(l=1/0),function o(l,p){if(null===l)return null;if(0===p)return l;var m,g;if("object"!=typeof l)return l;if(e(l,t))m=new t;else if(e(l,n))m=new n;else if(e(l,i))m=new i((function(e,t){l.then((function(t){e(o(t,p-1))}),(function(e){t(o(e,p-1))}))}));else if(r.__isArray(l))m=[];else if(r.__isRegExp(l))m=new RegExp(l.source,a(l)),l.lastIndex&&(m.lastIndex=l.lastIndex);else if(r.__isDate(l))m=new Date(l.getTime());else{if(h&&Buffer.isBuffer(l))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(l.length):new Buffer(l.length),l.copy(m),m;e(l,Error)?m=Object.create(l):void 0===u?(g=Object.getPrototypeOf(l),m=Object.create(g)):(m=Object.create(u),g=u)}if(s){var y=f.indexOf(l);if(-1!=y)return d[y];f.push(l),d.push(m)}for(var v in e(l,t)&&l.forEach((function(e,t){var n=o(t,p-1),i=o(e,p-1);m.set(n,i)})),e(l,n)&&l.forEach((function(e){var t=o(e,p-1);m.add(t)})),l){var b;g&&(b=Object.getOwnPropertyDescriptor(g,v)),b&&null==b.set||(m[v]=o(l[v],p-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(l);for(v=0;v<x.length;v++){var _=x[v];(!(k=Object.getOwnPropertyDescriptor(l,_))||k.enumerable||c)&&(m[_]=o(l[_],p-1),k.enumerable||Object.defineProperty(m,_,{enumerable:!1}))}}if(c){var w=Object.getOwnPropertyNames(l);for(v=0;v<w.length;v++){var k,E=w[v];(k=Object.getOwnPropertyDescriptor(l,E))&&k.enumerable||(m[E]=o(l[E],p-1),Object.defineProperty(m,E,{enumerable:!1}))}}return m}(o,l)}function o(e){return Object.prototype.toString.call(e)}function a(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return r.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},r.__objToStr=o,r.__isDate=function(e){return"object"==typeof e&&"[object Date]"===o(e)},r.__isArray=function(e){return"object"==typeof e&&"[object Array]"===o(e)},r.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===o(e)},r.__getRegExpFlags=a,r}();e.exports&&(e.exports=t)}}]);
2
+ (self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[8914],{66471:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;0!=r--;){var a=o[r];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}},56440:e=>{"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(n=t.cmp,function(e){return function(t,i){var r={key:t,value:e[t]},o={key:i,value:e[i]};return n(r,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,a;if(Array.isArray(t)){for(a="[",n=0;n<t.length;n++)n&&(a+=","),a+=e(t[n])||"null";return a+"]"}if(null===t)return"null";if(-1!==o.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=o.push(t)-1,l=Object.keys(t).sort(r&&r(t));for(a="",n=0;n<l.length;n++){var u=l[n],c=e(t[u]);c&&(a&&(a+=","),a+=JSON.stringify(u)+":"+c)}return o.splice(s,1),"{"+a+"}"}}(e)}},72759:e=>{"use strict";var t=/("(?:[^\\"]|\\.)*")|[:,]/g;e.exports=function(e,n){var i,r,o;return n=n||{},i=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===i?1/0:void 0===n.maxLength?80:n.maxLength,o=n.replacer,function e(n,a,s){var l,u,c,f,d,h,p,m,g,y,v,b;if(n&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===(v=JSON.stringify(n,o)))return v;if(p=r-a.length-s,v.length<=p&&(g=v.replace(t,(function(e,t){return t||e+" "}))).length<=p)return g;if(null!=o&&(n=JSON.parse(v),o=void 0),"object"==typeof n&&null!==n){if(m=a+i,c=[],u=0,Array.isArray(n))for(y="[",l="]",p=n.length;u<p;u++)c.push(e(n[u],m,u===p-1?0:1)||"null");else for(y="{",l="}",p=(h=Object.keys(n)).length;u<p;u++)f=h[u],d=JSON.stringify(f)+": ",void 0!==(b=e(n[f],m,d.length+(u===p-1?0:1)))&&c.push(d+b);if(c.length>0)return[y,i+c.join(",\n"+m),l].join("\n"+a)}return v}(e,"",0)}},27061:e=>{var t,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,l=[],u=!1,c=-1;function f(){u&&s&&(u=!1,s.length?l=s.concat(l):c=-1,l.length&&d())}function d(){if(!u){var e=a(f);u=!0;for(var t=l.length;t;){for(s=l,l=[];++c<t;)s&&s[c].run();c=-1,t=l.length}s=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),1!==l.length||u||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},58914:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DEFAULT_ACTIONS:()=>R2,default:()=>G2,guessMode:()=>W2,vega:()=>N2,vegaLite:()=>T2,version:()=>O2});var i={};n.r(i),n.d(i,{JsonPatchError:()=>O,_areEquals:()=>U,applyOperation:()=>P,applyPatch:()=>L,applyReducer:()=>B,deepClone:()=>N,getValueByPointer:()=>R,validate:()=>I,validator:()=>j});var r={};n.r(r),n.d(r,{compare:()=>J,generate:()=>V,observe:()=>Y,unobserve:()=>G});var o={};n.r(o),n.d(o,{aggregate:()=>jl,bin:()=>Il,collect:()=>ql,compare:()=>Wl,countpattern:()=>Gl,cross:()=>Yl,density:()=>Ql,dotbin:()=>nu,expression:()=>iu,extent:()=>ou,facet:()=>su,field:()=>lu,filter:()=>cu,flatten:()=>fu,fold:()=>du,formula:()=>hu,generate:()=>pu,impute:()=>yu,joinaggregate:()=>vu,kde:()=>bu,key:()=>xu,load:()=>wu,lookup:()=>Eu,multiextent:()=>$u,multivalues:()=>Du,params:()=>Mu,pivot:()=>Cu,prefacet:()=>Fu,project:()=>Ou,proxy:()=>Nu,quantile:()=>Tu,relay:()=>zu,sample:()=>Ru,sequence:()=>Pu,sieve:()=>Lu,subflow:()=>au,timeunit:()=>Bu,tupleindex:()=>Iu,values:()=>Uu,window:()=>Yu});var a={};n.r(a),n.d(a,{interpolate:()=>xd,interpolateArray:()=>dd,interpolateBasis:()=>ed,interpolateBasisClosed:()=>td,interpolateCubehelix:()=>pp,interpolateCubehelixLong:()=>mp,interpolateDate:()=>pd,interpolateDiscrete:()=>xh,interpolateHcl:()=>tp,interpolateHclLong:()=>np,interpolateHsl:()=>Oh,interpolateHslLong:()=>Nh,interpolateHue:()=>_h,interpolateLab:()=>Kh,interpolateNumber:()=>md,interpolateNumberArray:()=>cd,interpolateObject:()=>gd,interpolateRgb:()=>ad,interpolateRgbBasis:()=>ld,interpolateRgbBasisClosed:()=>ud,interpolateRound:()=>_d,interpolateString:()=>bd,interpolateTransformCss:()=>Dh,interpolateTransformSvg:()=>Sh,interpolateZoom:()=>Ch,piecewise:()=>uh,quantize:()=>gp});var s={};n.r(s),n.d(s,{bound:()=>Gx,identifier:()=>Xx,mark:()=>Jx,overlap:()=>Qx,render:()=>r_,viewlayout:()=>$_});var l={};n.r(l),n.d(l,{axisticks:()=>D_,datajoin:()=>S_,encode:()=>C_,legendentries:()=>F_,linkpath:()=>R_,pie:()=>I_,scale:()=>W_,sortitems:()=>V_,stack:()=>K_});var u={};n.r(u),n.d(u,{contour:()=>z$,geojson:()=>L$,geopath:()=>B$,geopoint:()=>j$,geoshape:()=>I$,graticule:()=>U$,heatmap:()=>q$,isocontour:()=>$$,kde2d:()=>O$,projection:()=>H$});var c={};n.r(c),n.d(c,{force:()=>jA});var f={};n.r(f),n.d(f,{nest:()=>WD,pack:()=>JD,partition:()=>ZD,stratify:()=>KD,tree:()=>nS,treelinks:()=>iS,treemap:()=>aS});var d={};n.r(d),n.d(d,{label:()=>SS});var h={};n.r(h),n.d(h,{loess:()=>CS,regression:()=>OS});var p={};n.r(p),n.d(p,{voronoi:()=>lM});var m={};n.r(m),n.d(m,{wordcloud:()=>kM});var g={};n.r(g),n.d(g,{crossfilter:()=>CM,resolvefilter:()=>FM});var y={};n.r(y),n.d(y,{Bounds:()=>Ng,CanvasHandler:()=>cb,CanvasRenderer:()=>mb,DATE:()=>mi,DAY:()=>gi,DAYOFYEAR:()=>yi,Dataflow:()=>ds,Debug:()=>be,Error:()=>ge,EventStream:()=>Za,Gradient:()=>Pm,GroupItem:()=>zg,HOURS:()=>vi,Handler:()=>Gv,Info:()=>ve,Item:()=>Tg,MILLISECONDS:()=>_i,MINUTES:()=>bi,MONTH:()=>hi,Marks:()=>Cv,MultiPulse:()=>ls,None:()=>me,Operator:()=>Xa,Parameters:()=>Ga,Pulse:()=>rs,QUARTER:()=>di,RenderType:()=>ax,Renderer:()=>Vv,ResourceLoader:()=>Rg,SECONDS:()=>xi,SVGHandler:()=>yb,SVGRenderer:()=>qb,SVGStringRenderer:()=>ix,Scenegraph:()=>Lv,TIME_UNITS:()=>wi,Transform:()=>ps,View:()=>yT,WEEK:()=>pi,Warn:()=>ye,YEAR:()=>fi,accessor:()=>K,accessorFields:()=>te,accessorName:()=>ee,array:()=>Ge,ascending:()=>Qe,bandwidthNRD:()=>Cs,bin:()=>Fs,bootstrapCI:()=>Ts,boundClip:()=>px,boundContext:()=>iy,boundItem:()=>Fv,boundMark:()=>Nv,boundStroke:()=>Bg,changeset:()=>Wa,clampRange:()=>Ye,codegenExpression:()=>uF,compare:()=>Je,constant:()=>tt,cumulativeLogNormal:()=>Xs,cumulativeNormal:()=>qs,cumulativeUniform:()=>tl,dayofyear:()=>Mi,debounce:()=>nt,defaultLocale:()=>na,definition:()=>gs,densityLogNormal:()=>Vs,densityNormal:()=>Us,densityUniform:()=>el,domChild:()=>Uv,domClear:()=>qv,domCreate:()=>jv,domFind:()=>Iv,dotbin:()=>zs,error:()=>oe,expressionFunction:()=>gN,extend:()=>it,extent:()=>rt,extentIndex:()=>ot,falsy:()=>he,fastmap:()=>ut,field:()=>se,flush:()=>ct,font:()=>wv,fontFamily:()=>_v,fontSize:()=>gv,format:()=>Aa,formatLocale:()=>Vo,formats:()=>Da,hasOwnProperty:()=>st,id:()=>le,identity:()=>ue,inferType:()=>ba,inferTypes:()=>xa,ingest:()=>La,inherits:()=>ft,inrange:()=>dt,interpolate:()=>am,interpolateColors:()=>im,interpolateRange:()=>nm,intersect:()=>ux,intersectBoxLine:()=>py,intersectPath:()=>cy,intersectPoint:()=>fy,intersectRule:()=>hy,isArray:()=>_e,isBoolean:()=>ht,isDate:()=>pt,isFunction:()=>Ve,isIterable:()=>mt,isNumber:()=>gt,isObject:()=>we,isRegExp:()=>yt,isString:()=>vt,isTuple:()=>za,key:()=>bt,lerp:()=>xt,lineHeight:()=>yv,loader:()=>Ca,locale:()=>ta,logger:()=>xe,lruCache:()=>wt,markup:()=>zb,merge:()=>kt,mergeConfig:()=>Ee,multiLineOffset:()=>bv,one:()=>fe,pad:()=>$t,panLinear:()=>ze,panLog:()=>Re,panPow:()=>Pe,panSymlog:()=>Le,parse:()=>GL,parseExpression:()=>aF,parseSelector:()=>zT,path:()=>Jc,pathCurves:()=>Bm,pathEqual:()=>yx,pathParse:()=>Hm,pathRectangle:()=>mg,pathRender:()=>ng,pathSymbols:()=>ag,pathTrail:()=>gg,peek:()=>De,point:()=>Hv,projection:()=>h$,quantileLogNormal:()=>Js,quantileNormal:()=>Ws,quantileUniform:()=>nl,quantiles:()=>Ss,quantizeInterpolator:()=>rm,quarter:()=>We,quartiles:()=>Ms,random:()=>Os,randomInteger:()=>Ps,randomKDE:()=>Gs,randomLCG:()=>Rs,randomLogNormal:()=>Qs,randomMixture:()=>Zs,randomNormal:()=>Hs,randomUniform:()=>il,read:()=>Ma,regressionConstant:()=>rl,regressionExp:()=>fl,regressionLinear:()=>ul,regressionLoess:()=>vl,regressionLog:()=>cl,regressionPoly:()=>pl,regressionPow:()=>dl,regressionQuad:()=>hl,renderModule:()=>lx,repeat:()=>Et,resetDefaultLocale:()=>ia,resetSVGClipId:()=>Fg,resetSVGDefIds:()=>vx,responseType:()=>Sa,runtimeContext:()=>AN,sampleCurve:()=>wl,sampleLogNormal:()=>Ys,sampleNormal:()=>Is,sampleUniform:()=>Ks,scale:()=>Gp,sceneEqual:()=>gx,sceneFromJSON:()=>Rv,scenePickVisit:()=>$y,sceneToJSON:()=>zv,sceneVisit:()=>Ey,sceneZOrder:()=>ky,scheme:()=>cm,serializeXML:()=>Rb,setRandom:()=>Ns,span:()=>At,splitAccessPath:()=>ae,stringValue:()=>Dt,textMetrics:()=>cv,timeBin:()=>pr,timeFloor:()=>Hi,timeFormatLocale:()=>Ko,timeInterval:()=>Qi,timeOffset:()=>er,timeSequence:()=>ir,timeUnitSpecifier:()=>Ai,timeUnits:()=>Ei,toBoolean:()=>St,toDate:()=>Ct,toNumber:()=>Se,toSet:()=>Ot,toString:()=>Ft,transform:()=>ys,transforms:()=>ms,truncate:()=>Nt,truthy:()=>de,tupleid:()=>Ra,typeParsers:()=>ga,utcFloor:()=>Vi,utcInterval:()=>Zi,utcOffset:()=>tr,utcSequence:()=>rr,utcdayofyear:()=>zi,utcquarter:()=>He,utcweek:()=>Ri,version:()=>YL,visitArray:()=>Tt,week:()=>Ci,writeConfig:()=>$e,zero:()=>ce,zoomLinear:()=>je,zoomLog:()=>Ie,zoomPow:()=>Ue,zoomSymlog:()=>qe});var v={};n.r(v),n.d(v,{accessPathDepth:()=>JB,accessPathWithDatum:()=>WB,compile:()=>a0,contains:()=>EB,deepEqual:()=>gB,deleteNestedProperty:()=>UB,duplicate:()=>yB,entries:()=>LB,every:()=>AB,fieldIntersection:()=>TB,flatAccessWithDatum:()=>HB,getFirstDefined:()=>QB,hasIntersection:()=>OB,hash:()=>wB,internalField:()=>tj,isBoolean:()=>BB,isEmpty:()=>zB,isEqual:()=>CB,isInternalField:()=>nj,isNullOrFalse:()=>kB,isNumeric:()=>rj,keys:()=>RB,logicalExpr:()=>IB,mergeDeep:()=>DB,never:()=>vB,normalize:()=>BV,normalizeAngle:()=>ij,omit:()=>xB,pick:()=>bB,prefixGenerator:()=>NB,removePathFromField:()=>XB,replaceAll:()=>VB,replacePathInField:()=>YB,resetIdCounter:()=>ej,setEqual:()=>FB,some:()=>$B,stringify:()=>_B,titleCase:()=>qB,unique:()=>MB,uniqueId:()=>KB,vals:()=>PB,varName:()=>jB,version:()=>s0});var b={};n.r(b),n.d(b,{dark:()=>f0,excel:()=>h0,fivethirtyeight:()=>v0,ggplot2:()=>x0,googlecharts:()=>I0,latimes:()=>A0,powerbi:()=>e1,quartz:()=>M0,urbaninstitute:()=>P0,version:()=>t1,vox:()=>F0});var x,_=(x=function(e,t){return x=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])},x(e,t)},function(e,t){function n(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),w=Object.prototype.hasOwnProperty;function k(e,t){return w.call(e,t)}function E(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var i=[];for(var r in e)k(e,r)&&i.push(r);return i}function $(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function A(e){for(var t,n=0,i=e.length;n<i;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function D(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function S(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function M(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(M(e[t]))return!0}else if("object"==typeof e)for(var i=E(e),r=i.length,o=0;o<r;o++)if(M(e[i[o]]))return!0;return!1}function C(e,t){var n=[e];for(var i in t){var r="object"==typeof t[i]?JSON.stringify(t[i],null,2):t[i];void 0!==r&&n.push(i+": "+r)}return n.join("\n")}var F=function(e){function t(t,n,i,r,o){var a=this.constructor,s=e.call(this,C(t,{name:n,index:i,operation:r,tree:o}))||this;return s.name=n,s.index=i,s.operation=r,s.tree=o,Object.setPrototypeOf(s,a.prototype),s.message=C(t,{name:n,index:i,operation:r,tree:o}),s}return _(t,e),t}(Error),O=F,N=$,T={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var i=e[t];return delete e[t],{newDocument:n,removed:i}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:function(e,t,n){var i=R(n,this.path);i&&(i=$(i));var r=P(n,{op:"remove",path:this.from}).removed;return P(n,{op:"add",path:this.path,value:r}),{newDocument:n,removed:i}},copy:function(e,t,n){var i=R(n,this.from);return P(n,{op:"add",path:this.path,value:$(i)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:U(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},z={add:function(e,t,n){return A(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:T.move,copy:T.copy,test:T.test,_get:T._get};function R(e,t){if(""==t)return e;var n={op:"_get",path:t};return P(e,n),n.value}function P(e,t,n,i,r,o){if(void 0===n&&(n=!1),void 0===i&&(i=!0),void 0===r&&(r=!0),void 0===o&&(o=0),n&&("function"==typeof n?n(t,0,e,t.path):j(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=R(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=U(e,t.value),!1===a.test)throw new O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(n)throw new O("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return a}i||(e=$(e));var s=(t.path||"").split("/"),l=e,u=1,c=s.length,f=void 0,d=void 0,h=void 0;for(h="function"==typeof n?n:j;;){if((d=s[u])&&-1!=d.indexOf("~")&&(d=S(d)),r&&("__proto__"==d||"prototype"==d&&u>0&&"constructor"==s[u-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===f&&(void 0===l[d]?f=s.slice(0,u).join("/"):u==c-1&&(f=t.path),void 0!==f&&h(t,0,e,f)),u++,Array.isArray(l)){if("-"===d)d=l.length;else{if(n&&!A(d))throw new O("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);A(d)&&(d=~~d)}if(u>=c){if(n&&"add"===t.op&&d>l.length)throw new O("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=z[t.op].call(t,l,d,e)).test)throw new O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(u>=c){if(!1===(a=T[t.op].call(t,l,d,e)).test)throw new O("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[d],n&&u<c&&(!l||"object"!=typeof l))throw new O("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}function L(e,t,n,i,r){if(void 0===i&&(i=!0),void 0===r&&(r=!0),n&&!Array.isArray(t))throw new O("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");i||(e=$(e));for(var o=new Array(t.length),a=0,s=t.length;a<s;a++)o[a]=P(e,t[a],n,!0,r,a),e=o[a].newDocument;return o.newDocument=e,o}function B(e,t,n){var i=P(e,t);if(!1===i.test)throw new O("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return i.newDocument}function j(e,t,n,i){if("object"!=typeof e||null===e||Array.isArray(e))throw new O("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!T[e.op])throw new O("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new O("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new O('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 O("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 O("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)&&M(e.value))throw new O("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 r=e.path.split("/").length,o=i.split("/").length;if(r!==o+1&&r!==o)throw new O("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!==i)throw new O("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=I([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new O("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function I(e,t,n){try{if(!Array.isArray(e))throw new O("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)L($(t),$(e),n||!0);else{n=n||j;for(var i=0;i<e.length;i++)n(e[i],i,t,void 0)}}catch(e){if(e instanceof O)return e;throw e}}function U(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,i,r,o=Array.isArray(e),a=Array.isArray(t);if(o&&a){if((i=e.length)!=t.length)return!1;for(n=i;0!=n--;)if(!U(e[n],t[n]))return!1;return!0}if(o!=a)return!1;var s=Object.keys(e);if((i=s.length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=i;0!=n--;)if(!U(e[r=s[n]],t[r]))return!1;return!0}return e!=e&&t!=t}var q=new WeakMap,W=function(e){this.observers=new Map,this.obj=e},H=function(e,t){this.callback=e,this.observer=t};function G(e,t){t.unobserve()}function Y(e,t){var n,i=function(e){return q.get(e)}(e);if(i){var r=function(e,t){return e.observers.get(t)}(i,t);n=r&&r.observer}else i=new W(e),q.set(e,i);if(n)return n;if(n={},i.value=$(e),t){n.callback=t,n.next=null;var o=function(){V(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=e,n.unobserve=function(){V(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(i,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new H(t,n)),n}function V(e,t){void 0===t&&(t=!1);var n=q.get(e.object);X(n.value,e.object,e.patches,"",t),e.patches.length&&L(n.value,e.patches);var i=e.patches;return i.length>0&&(e.patches=[],e.callback&&e.callback(i)),i}function X(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=E(t),a=E(e),s=!1,l=a.length-1;l>=0;l--){var u=e[f=a[l]];if(!k(t,f)||void 0===t[f]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+D(f),value:$(u)}),n.push({op:"remove",path:i+"/"+D(f)}),s=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}));else{var c=t[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?X(u,c,n,i+"/"+D(f),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+D(f),value:$(u)}),n.push({op:"replace",path:i+"/"+D(f),value:$(c)}))}}if(s||o.length!=a.length)for(l=0;l<o.length;l++){var f;k(e,f=o[l])||void 0===t[f]||n.push({op:"add",path:i+"/"+D(f),value:$(t[f])})}}}function J(e,t,n){void 0===n&&(n=!1);var i=[];return X(e,t,i,"",n),i}Object.assign({},i,r,{JsonPatchError:F,deepClone:$,escapePathComponent:D,unescapePathComponent:S});var Q=n(72759),Z=n.n(Q);function K(e,t,n){return e.fields=t||[],e.fname=n,e}function ee(e){return null==e?null:e.fname}function te(e){return null==e?null:e.fields}function ne(e){return 1===e.length?ie(e[0]):re(e)}const ie=e=>function(t){return t[e]},re=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function oe(e){throw Error(e)}function ae(e){const t=[],n=e.length;let i,r,o,a=null,s=0,l="";function u(){t.push(l+e.substring(i,r)),l="",i=r+1}for(e+="",i=r=0;r<n;++r)if(o=e[r],"\\"===o)l+=e.substring(i,r++),i=r;else if(o===a)u(),a=null,s=-1;else{if(a)continue;i===s&&'"'===o||i===s&&"'"===o?(i=r+1,a=o):"."!==o||s?"["===o?(r>i&&u(),s=i=r+1):"]"===o&&(s||oe("Access path missing open bracket: "+e),s>0&&u(),s=0,i=r+1):r>i?u():i=r+1}return s&&oe("Access path missing closing bracket: "+e),a&&oe("Access path missing closing quote: "+e),r>i&&(r++,u()),t}function se(e,t,n){const i=ae(e);return e=1===i.length?i[0]:e,K((n&&n.get||ne)(i),[e],t||e)}const le=se("id"),ue=K((e=>e),[],"identity"),ce=K((()=>0),[],"zero"),fe=K((()=>1),[],"one"),de=K((()=>!0),[],"true"),he=K((()=>!1),[],"false");function pe(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const me=0,ge=1,ye=2,ve=3,be=4;function xe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pe,i=e||me;return{level(e){return arguments.length?(i=+e,this):i},error(){return i>=ge&&n(t||"error","ERROR",arguments),this},warn(){return i>=ye&&n(t||"warn","WARN",arguments),this},info(){return i>=ve&&n(t||"log","INFO",arguments),this},debug(){return i>=be&&n(t||"log","DEBUG",arguments),this}}}var _e=Array.isArray;function we(e){return e===Object(e)}const ke=e=>"__proto__"!==e;function Ee(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(((e,t)=>{for(const n in t)if("signals"===n)e.signals=Ae(e.signals,t.signals);else{const i="legend"===n?{layout:1}:"style"===n||null;$e(e,n,t[n],i)}return e}),{})}function $e(e,t,n,i){if(!ke(t))return;let r,o;if(we(n)&&!_e(n))for(r in o=we(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?$e(o,r,n[r]):ke(r)&&(o[r]=n[r]);else e[t]=n}function Ae(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function De(e){return e[e.length-1]}function Se(e){return null==e||""===e?null:+e}const Me=e=>t=>e*Math.exp(t),Ce=e=>t=>Math.log(e*t),Fe=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Oe=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Ne=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function Te(e,t,n,i){const r=n(e[0]),o=n(De(e)),a=(o-r)*t;return[i(r-a),i(o-a)]}function ze(e,t){return Te(e,t,Se,ue)}function Re(e,t){var n=Math.sign(e[0]);return Te(e,t,Ce(n),Me(n))}function Pe(e,t,n){return Te(e,t,Ne(n),Ne(1/n))}function Le(e,t,n){return Te(e,t,Fe(n),Oe(n))}function Be(e,t,n,i,r){const o=i(e[0]),a=i(De(e)),s=null!=t?i(t):(o+a)/2;return[r(s+(o-s)*n),r(s+(a-s)*n)]}function je(e,t,n){return Be(e,t,n,Se,ue)}function Ie(e,t,n){const i=Math.sign(e[0]);return Be(e,t,n,Ce(i),Me(i))}function Ue(e,t,n,i){return Be(e,t,n,Ne(i),Ne(1/i))}function qe(e,t,n,i){return Be(e,t,n,Fe(i),Oe(i))}function We(e){return 1+~~(new Date(e).getMonth()/3)}function He(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Ge(e){return null!=e?_e(e)?e:[e]:[]}function Ye(e,t,n){let i,r=e[0],o=e[1];return o<r&&(i=o,o=r,r=i),i=o-r,i>=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-i),r+i]}function Ve(e){return"function"==typeof e}const Xe="descending";function Je(e,t,n){n=n||{},t=Ge(t)||[];const i=[],r=[],o={},a=n.comparator||Ze;return Ge(e).forEach(((e,a)=>{null!=e&&(i.push(t[a]===Xe?-1:1),r.push(e=Ve(e)?e:se(e,null,n)),(te(e)||[]).forEach((e=>o[e]=1)))})),0===r.length?null:K(a(r,i),Object.keys(o))}const Qe=(e,t)=>(e<t||null==e)&&null!=t?-1:(e>t||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),Ze=(e,t)=>1===e.length?Ke(e[0],t[0]):et(e,t,e.length),Ke=(e,t)=>function(n,i){return Qe(e(n),e(i))*t},et=(e,t,n)=>(t.push(0),function(i,r){let o,a=0,s=-1;for(;0===a&&++s<n;)o=e[s],a=Qe(o(i),o(r));return a*t[s]});function tt(e){return Ve(e)?e:()=>e}function nt(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout((()=>(t(i),n=null)),e)}}function it(e){for(let t,n,i=1,r=arguments.length;i<r;++i)for(n in t=arguments[i],t)e[n]=t[n];return e}function rt(e,t){let n,i,r,o,a=0;if(e&&(n=e.length))if(null==t){for(i=e[a];a<n&&(null==i||i!=i);i=e[++a]);for(r=o=i;a<n;++a)i=e[a],null!=i&&(i<r&&(r=i),i>o&&(o=i))}else{for(i=t(e[a]);a<n&&(null==i||i!=i);i=t(e[++a]));for(r=o=i;a<n;++a)i=t(e[a]),null!=i&&(i<r&&(r=i),i>o&&(o=i))}return[r,o]}function ot(e,t){const n=e.length;let i,r,o,a,s,l=-1;if(null==t){for(;++l<n;)if(r=e[l],null!=r&&r>=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++l<n;)r=e[l],null!=r&&(i>r&&(i=r,a=l),o<r&&(o=r,s=l))}else{for(;++l<n;)if(r=t(e[l],l,e),null!=r&&r>=r){i=o=r;break}if(l===n)return[-1,-1];for(a=s=l;++l<n;)r=t(e[l],l,e),null!=r&&(i>r&&(i=r,a=l),o<r&&(o=r,s=l))}return[a,s]}const at=Object.prototype.hasOwnProperty;function st(e,t){return at.call(e,t)}const lt={};function ut(e){let t,n={};function i(e){return st(n,e)&&n[e]!==lt}const r={size:0,empty:0,object:n,has:i,get:e=>i(e)?n[e]:void 0,set(e,t){return i(e)||(++r.size,n[e]===lt&&--r.empty),n[e]=t,this},delete(e){return i(e)&&(--r.size,++r.empty,n[e]=lt),this},clear(){r.size=r.empty=0,r.object=n={}},test(e){return arguments.length?(t=e,r):t},clean(){const e={};let i=0;for(const r in n){const o=n[r];o===lt||t&&t(o)||(e[r]=o,++i)}r.size=i,r.empty=0,r.object=n=e}};return e&&Object.keys(e).forEach((t=>{r.set(t,e[t])})),r}function ct(e,t,n,i,r,o){if(!n&&0!==n)return o;const a=+n;let s,l=e[0],u=De(e);u<l&&(s=l,l=u,u=s),s=Math.abs(t-l);const c=Math.abs(u-t);return s<c&&s<=a?i:c<=a?r:o}function ft(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),it(i,n)}function dt(e,t,n,i){let r,o=t[0],a=t[t.length-1];return o>a&&(r=o,o=a,a=r),i=void 0===i||i,((n=void 0===n||n)?o<=e:o<e)&&(i?e<=a:e<a)}function ht(e){return"boolean"==typeof e}function pt(e){return"[object Date]"===Object.prototype.toString.call(e)}function mt(e){return e&&Ve(e[Symbol.iterator])}function gt(e){return"number"==typeof e}function yt(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function vt(e){return"string"==typeof e}function bt(e,t,n){e&&(e=t?Ge(e).map((e=>e.replace(/\\(.)/g,"$1"))):Ge(e));const i=e&&e.length,r=n&&n.get||ne,o=e=>r(t?[e]:ae(e));let a;if(i)if(1===i){const t=o(e[0]);a=function(e){return""+t(e)}}else{const t=e.map(o);a=function(e){let n=""+t[0](e),r=0;for(;++r<i;)n+="|"+t[r](e);return n}}else a=function(){return""};return K(a,e,"key")}function xt(e,t){const n=e[0],i=De(e),r=+t;return r?1===r?i:n+r*(i-n):n}const _t=1e4;function wt(e){let t,n,i;e=+e||_t;const r=()=>{t={},n={},i=0},o=(r,o)=>(++i>e&&(n=t,t={},i=1),t[r]=o);return r(),{clear:r,has:e=>st(t,e)||st(n,e),get:e=>st(t,e)?t[e]:st(n,e)?o(e,n[e]):void 0,set:(e,n)=>st(t,e)?t[e]=n:o(e,n)}}function kt(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const a=i||new t.constructor(r+o);let s=0,l=0,u=0;for(;s<r&&l<o;++u)a[u]=e(t[s],n[l])>0?n[l++]:t[s++];for(;s<r;++s,++u)a[u]=t[s];for(;l<o;++l,++u)a[u]=n[l];return a}function Et(e,t){let n="";for(;--t>=0;)n+=e;return n}function $t(e,t,n,i){const r=n||" ",o=e+"",a=t-o.length;return a<=0?o:"left"===i?Et(r,a)+o:"center"===i?Et(r,~~(a/2))+o+Et(r,Math.ceil(a/2)):o+Et(r,a)}function At(e){return e&&De(e)-e[0]||0}function Dt(e){return _e(e)?"["+e.map(Dt)+"]":we(e)||vt(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function St(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e||!e)}const Mt=e=>gt(e)||pt(e)?e:Date.parse(e);function Ct(e,t){return t=t||Mt,null==e||""===e?null:t(e)}function Ft(e){return null==e||""===e?null:e+""}function Ot(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}function Nt(e,t,n,i){const r=null!=i?i:"…",o=e+"",a=o.length,s=Math.max(0,t-r.length);return a<=t?o:"left"===n?r+o.slice(a-s):"center"===n?o.slice(0,Math.ceil(s/2))+r+o.slice(a-~~(s/2)):o.slice(0,s)+r}function Tt(e,t,n){if(e)if(t){const i=e.length;for(let r=0;r<i;++r){const i=t(e[r]);i&&n(i,r,e)}}else e.forEach(n)}var zt={},Rt={},Pt=34,Lt=10,Bt=13;function jt(e){return new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'})).join(",")+"}")}function It(e){var t=Object.create(null),n=[];return e.forEach((function(e){for(var i in e)i in t||n.push(t[i]=i)})),n}function Ut(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function qt(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function i(e,t){var i,r=[],o=e.length,a=0,s=0,l=o<=0,u=!1;function c(){if(l)return Rt;if(u)return u=!1,zt;var t,i,r=a;if(e.charCodeAt(r)===Pt){for(;a++<o&&e.charCodeAt(a)!==Pt||e.charCodeAt(++a)===Pt;);return(t=a)>=o?l=!0:(i=e.charCodeAt(a++))===Lt?u=!0:i===Bt&&(u=!0,e.charCodeAt(a)===Lt&&++a),e.slice(r+1,t-1).replace(/""/g,'"')}for(;a<o;){if((i=e.charCodeAt(t=a++))===Lt)u=!0;else if(i===Bt)u=!0,e.charCodeAt(a)===Lt&&++a;else if(i!==n)continue;return e.slice(r,t)}return l=!0,e.slice(r,o)}for(e.charCodeAt(o-1)===Lt&&--o,e.charCodeAt(o-1)===Bt&&--o;(i=c())!==Rt;){for(var f=[];i!==zt&&i!==Rt;)f.push(i),i=c();t&&null==(f=t(f,s++))||r.push(f)}return r}function r(t,n){return t.map((function(t){return n.map((function(e){return a(t[e])})).join(e)}))}function o(t){return t.map(a).join(e)}function a(e){return null==e?"":e instanceof Date?function(e){var t,n=e.getUTCHours(),i=e.getUTCMinutes(),r=e.getUTCSeconds(),o=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+Ut(-t,6):t>9999?"+"+Ut(t,6):Ut(t,4))+"-"+Ut(e.getUTCMonth()+1,2)+"-"+Ut(e.getUTCDate(),2)+(o?"T"+Ut(n,2)+":"+Ut(i,2)+":"+Ut(r,2)+"."+Ut(o,3)+"Z":r?"T"+Ut(n,2)+":"+Ut(i,2)+":"+Ut(r,2)+"Z":i||n?"T"+Ut(n,2)+":"+Ut(i,2)+"Z":"")}(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,r,o=i(e,(function(e,i){if(n)return n(e,i-1);r=e,n=t?function(e,t){var n=jt(e);return function(i,r){return t(n(i),r,e)}}(e,t):jt(e)}));return o.columns=r||[],o},parseRows:i,format:function(t,n){return null==n&&(n=It(t)),[n.map(a).join(e)].concat(r(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=It(e)),r(e,t).join("\n")},formatRows:function(e){return e.map(o).join("\n")},formatRow:o,formatValue:a}}function Wt(e){return e}function Ht(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return Gt(e,t)}))}:Gt(e,t)}function Gt(e,t){var n=t.id,i=t.bbox,r=null==t.properties?{}:t.properties,o=Yt(e,t);return null==n&&null==i?{type:"Feature",properties:r,geometry:o}:null==i?{type:"Feature",id:n,properties:r,geometry:o}:{type:"Feature",id:n,bbox:i,properties:r,geometry:o}}function Yt(e,t){var n=function(e){if(null==e)return Wt;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],a=e.translate[1];return function(e,s){s||(t=n=0);var l=2,u=e.length,c=new Array(u);for(c[0]=(t+=e[0])*i+o,c[1]=(n+=e[1])*r+a;l<u;)c[l]=e[l],++l;return c}}(e.transform),i=e.arcs;function r(e,t){t.length&&t.pop();for(var r=i[e<0?~e:e],o=0,a=r.length;o<a;++o)t.push(n(r[o],o));e<0&&function(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}(t,a)}function o(e){return n(e)}function a(e){for(var t=[],n=0,i=e.length;n<i;++n)r(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0]);return t}function l(e){return e.map(s)}return function e(t){var n,i=t.type;switch(i){case"GeometryCollection":return{type:i,geometries:t.geometries.map(e)};case"Point":n=o(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(o);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:i,coordinates:n}}(t)}function Vt(e,t){var n={},i={},r={},o=[],a=-1;function s(e,t){for(var i in e){var r=e[i];delete t[r.start],delete r.start,delete r.end,r.forEach((function(e){n[e<0?~e:e]=1})),o.push(r)}}return t.forEach((function(n,i){var r,o=e.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(r=t[++a],t[a]=n,t[i]=r)})),t.forEach((function(t){var n,o,a=function(t){var n,i=e.arcs[t<0?~t:t],r=i[0];return e.transform?(n=[0,0],i.forEach((function(e){n[0]+=e[0],n[1]+=e[1]}))):n=i[i.length-1],t<0?[n,r]:[r,n]}(t),s=a[0],l=a[1];if(n=r[s])if(delete r[n.end],n.push(t),n.end=l,o=i[l]){delete i[o.start];var u=o===n?n:n.concat(o);i[u.start=n.start]=r[u.end=o.end]=u}else i[n.start]=r[n.end]=n;else if(n=i[l])if(delete i[n.start],n.unshift(t),n.start=s,o=r[s]){delete r[o.end];var c=o===n?n:o.concat(n);i[c.start=o.start]=r[c.end=n.end]=c}else i[n.start]=r[n.end]=n;else i[(n=[t]).start=s]=r[n.end=l]=n})),s(r,i),s(i,r),t.forEach((function(e){n[e<0?~e:e]||o.push([e])})),o}function Xt(e){return Yt(e,Jt.apply(this,arguments))}function Jt(e,t,n){var i,r,o;if(arguments.length>1)i=function(e,t,n){var i,r=[],o=[];function a(e){var t=e<0?~e:e;(o[t]||(o[t]=[])).push({i:e,g:i})}function s(e){e.forEach(a)}function l(e){e.forEach(s)}return function e(t){switch(i=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(l)}(t.arcs)}}(t),o.forEach(null==n?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}(0,t,n);else for(r=0,i=new Array(o=e.arcs.length);r<o;++r)i[r]=r;return{type:"MultiLineString",arcs:Vt(e,i)}}const Qt=Math.sqrt(50),Zt=Math.sqrt(10),Kt=Math.sqrt(2);function en(e,t,n){const i=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(i)),o=i/Math.pow(10,r),a=o>=Qt?10:o>=Zt?5:o>=Kt?2:1;let s,l,u;return r<0?(u=Math.pow(10,-r)/a,s=Math.round(e*u),l=Math.round(t*u),s/u<e&&++s,l/u>t&&--l,u=-u):(u=Math.pow(10,r)*a,s=Math.round(e/u),l=Math.round(t/u),s*u<e&&++s,l*u>t&&--l),l<s&&.5<=n&&n<2?en(e,t,2*n):[s,l,u]}function tn(e,t,n){if(!((n=+n)>0))return[];if((e=+e)==(t=+t))return[e];const i=t<e,[r,o,a]=i?en(t,e,n):en(e,t,n);if(!(o>=r))return[];const s=o-r+1,l=new Array(s);if(i)if(a<0)for(let e=0;e<s;++e)l[e]=(o-e)/-a;else for(let e=0;e<s;++e)l[e]=(o-e)*a;else if(a<0)for(let e=0;e<s;++e)l[e]=(r+e)/-a;else for(let e=0;e<s;++e)l[e]=(r+e)*a;return l}function nn(e,t,n){return en(e=+e,t=+t,n=+n)[2]}function rn(e,t,n){n=+n;const i=(t=+t)<(e=+e),r=i?nn(t,e,n):nn(e,t,n);return(i?-1:1)*(r<0?1/-r:r)}var on,an=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sn(e){if(!(t=an.exec(e)))throw new Error("invalid format: "+e);var t;return new ln({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function ln(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function un(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}function cn(e){return(e=un(Math.abs(e)))?e[1]:NaN}function fn(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(cn(t)/3)))-cn(Math.abs(e)))}function dn(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,cn(t)-cn(e))+1}function hn(e){return Math.max(0,-cn(Math.abs(e)))}function pn(e,t){var n=un(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}sn.prototype=ln.prototype,ln.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const mn={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>pn(100*e,t),r:pn,s:function(e,t){var n=un(e,t);if(!n)return e+"";var i=n[0],r=n[1],o=r-(on=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=i.length;return o===a?i:o>a?i+new Array(o-a+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+un(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function gn(e){return e}var yn,vn,bn,xn=Array.prototype.map,_n=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function wn(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?gn:(t=xn.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,o=[],a=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>i&&(s=Math.max(1,i-l)),o.push(e.substring(r-=s,r+s)),!((l+=s+1)>i));)s=t[a=(a+1)%t.length];return o.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?gn:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(xn.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=sn(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,m=e.comma,g=e.precision,y=e.trim,v=e.type;"n"===v?(m=!0,v="g"):mn[v]||(void 0===g&&(g=12),y=!0,v="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?r:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===d?o:/[%p]/.test(v)?l:"",_=mn[v],w=/[defgprs%]/.test(v);function k(e){var r,o,l,d=b,k=x;if("c"===v)k=_(e)+k,e="";else{var E=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:_(Math.abs(e),g),y&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i<n;++i)switch(e[i]){case".":r=t=i;break;case"0":0===r&&(r=i),t=i;break;default:if(!+e[i])break e;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),E&&0==+e&&"+"!==f&&(E=!1),d=(E?"("===f?f:u:"-"===f||"("===f?"":f)+d,k=("s"===v?_n[8+on/3]:"")+k+(E&&"("===f?")":""),w)for(r=-1,o=e.length;++r<o;)if(48>(l=e.charCodeAt(r))||l>57){k=(46===l?a+e.slice(r+1):e.slice(r))+k,e=e.slice(0,r);break}}m&&!h&&(e=i(e,1/0));var $=d.length+e.length+k.length,A=$<p?new Array(p-$+1).join(t):"";switch(m&&h&&(e=i(A+e,A.length?p-k.length:1/0),A=""),n){case"<":e=d+e+k+A;break;case"=":e=d+A+e+k;break;case"^":e=A.slice(0,$=A.length>>1)+d+e+k+A.slice($);break;default:e=A+d+e+k}return s(e)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return e+""},k}return{format:f,formatPrefix:function(e,t){var n=f(((e=sn(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(cn(t)/3))),r=Math.pow(10,-i),o=_n[8+i/3];return function(e){return n(r*e)+o}}}}yn=wn({thousands:",",grouping:[3],currency:["$",""]}),vn=yn.format,bn=yn.formatPrefix;const kn=new Date,En=new Date;function $n(e,t,n,i){function r(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return r.floor=t=>(e(t=new Date(+t)),t),r.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),r.round=e=>{const t=r(e),n=r.ceil(e);return e-t<n-e?t:n},r.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),r.range=(n,i,o)=>{const a=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n<i&&o>0))return a;let s;do{a.push(s=new Date(+n)),t(n,o),e(n)}while(s<n&&n<i);return a},r.filter=n=>$n((t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),((e,i)=>{if(e>=e)if(i<0)for(;++i<=0;)for(;t(e,-1),!n(e););else for(;--i>=0;)for(;t(e,1),!n(e););})),n&&(r.count=(t,i)=>(kn.setTime(+t),En.setTime(+i),e(kn),e(En),Math.floor(n(kn,En))),r.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?r.filter(i?t=>i(t)%e==0:t=>r.count(0,t)%e==0):r:null)),r}const An=1e3,Dn=6e4,Sn=36e5,Mn=864e5,Cn=6048e5,Fn=31536e6,On=$n((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Dn)/Mn),(e=>e.getDate()-1)),Nn=(On.range,$n((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Mn),(e=>e.getUTCDate()-1))),Tn=(Nn.range,$n((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Mn),(e=>Math.floor(e/Mn))));function zn(e){return $n((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Dn)/Cn))}Tn.range;const Rn=zn(0),Pn=zn(1),Ln=zn(2),Bn=zn(3),jn=zn(4),In=zn(5),Un=zn(6);function qn(e){return $n((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/Cn))}Rn.range,Pn.range,Ln.range,Bn.range,jn.range,In.range,Un.range;const Wn=qn(0),Hn=qn(1),Gn=qn(2),Yn=qn(3),Vn=qn(4),Xn=qn(5),Jn=qn(6),Qn=(Wn.range,Hn.range,Gn.range,Yn.range,Vn.range,Xn.range,Jn.range,$n((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear())));Qn.every=e=>isFinite(e=Math.floor(e))&&e>0?$n((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null,Qn.range;const Zn=$n((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));Zn.every=e=>isFinite(e=Math.floor(e))&&e>0?$n((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null,Zn.range;const Kn=$n((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth())),ei=(Kn.range,$n((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()))),ti=(ei.range,$n((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*An-e.getMinutes()*Dn)}),((e,t)=>{e.setTime(+e+t*Sn)}),((e,t)=>(t-e)/Sn),(e=>e.getHours()))),ni=(ti.range,$n((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*Sn)}),((e,t)=>(t-e)/Sn),(e=>e.getUTCHours()))),ii=(ni.range,$n((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*An)}),((e,t)=>{e.setTime(+e+t*Dn)}),((e,t)=>(t-e)/Dn),(e=>e.getMinutes()))),ri=(ii.range,$n((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*Dn)}),((e,t)=>(t-e)/Dn),(e=>e.getUTCMinutes()))),oi=(ri.range,$n((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*An)}),((e,t)=>(t-e)/An),(e=>e.getUTCSeconds()))),ai=(oi.range,$n((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e)));function si(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function li(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ui(e){let t,n,i;function r(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<0?r=t+1:o=t}while(r<o)}return r}return 2!==e.length?(t=si,n=(t,n)=>si(e(t),n),i=(t,n)=>e(t)-n):(t=e===si||e===li?e:ci,n=e,i=e),{left:r,center:function(e,t,n=0,o=e.length){const a=r(e,t,n,o-1);return a>n&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<=0?r=t+1:o=t}while(r<o)}return r}}}function ci(){return 0}ai.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?$n((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):ai:null),ai.range;const fi="year",di="quarter",hi="month",pi="week",mi="date",gi="day",yi="dayofyear",vi="hours",bi="minutes",xi="seconds",_i="milliseconds",wi=[fi,di,hi,pi,mi,gi,yi,vi,bi,xi,_i],ki=wi.reduce(((e,t,n)=>(e[t]=1+n,e)),{});function Ei(e){const t=Ge(e).slice(),n={};return t.length||oe("Missing time unit."),t.forEach((e=>{st(ki,e)?n[e]=1:oe(`Invalid time unit: ${e}.`)})),(n[pi]||n[gi]?1:0)+(n[di]||n[hi]||n[mi]?1:0)+(n[yi]?1:0)>1&&oe(`Incompatible time units: ${e}`),t.sort(((e,t)=>ki[e]-ki[t])),t}const $i={[fi]:"%Y ",[di]:"Q%q ",[hi]:"%b ",[mi]:"%d ",[pi]:"W%U ",[gi]:"%a ",[yi]:"%j ",[vi]:"%H:00",[bi]:"00:%M",[xi]:":%S",[_i]:".%L",[`${fi}-${hi}`]:"%Y-%m ",[`${fi}-${hi}-${mi}`]:"%Y-%m-%d ",[`${vi}-${bi}`]:"%H:%M"};function Ai(e,t){const n=it({},$i,t),i=Ei(e),r=i.length;let o,a,s="",l=0;for(l=0;l<r;)for(o=i.length;o>l;--o)if(a=i.slice(l,o).join("-"),null!=n[a]){s+=n[a],l=o;break}return s.trim()}const Di=new Date;function Si(e){return Di.setFullYear(e),Di.setMonth(0),Di.setDate(1),Di.setHours(0,0,0,0),Di}function Mi(e){return Fi(new Date(e))}function Ci(e){return Oi(new Date(e))}function Fi(e){return On.count(Si(e.getFullYear())-1,e)}function Oi(e){return Rn.count(Si(e.getFullYear())-1,e)}function Ni(e){return Si(e).getDay()}function Ti(e,t,n,i,r,o,a){if(0<=e&&e<100){const s=new Date(-1,t,n,i,r,o,a);return s.setFullYear(e),s}return new Date(e,t,n,i,r,o,a)}function zi(e){return Pi(new Date(e))}function Ri(e){return Li(new Date(e))}function Pi(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Nn.count(t-1,e)}function Li(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Wn.count(t-1,e)}function Bi(e){return Di.setTime(Date.UTC(e,0,1)),Di.getUTCDay()}function ji(e,t,n,i,r,o,a){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,i,r,o,a));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,i,r,o,a))}function Ii(e,t,n,i,r){const o=t||1,a=De(e),s=(e,t,r)=>function(e,t,n,i){const r=n<=1?e:i?(t,r)=>i+n*Math.floor((e(t,r)-i)/n):(t,i)=>n*Math.floor(e(t,i)/n);return t?(e,n)=>t(r(e,n),n):r}(n[r=r||e],i[r],e===a&&o,t),l=new Date,u=Ot(e),c=u[fi]?s(fi):tt(2012),f=u[hi]?s(hi):u[di]?s(di):ce,d=u[pi]&&u[gi]?s(gi,1,pi+gi):u[pi]?s(pi,1):u[gi]?s(gi,1):u[mi]?s(mi,1):u[yi]?s(yi,1):fe,h=u[vi]?s(vi):ce,p=u[bi]?s(bi):ce,m=u[xi]?s(xi):ce,g=u[_i]?s(_i):ce;return function(e){l.setTime(+e);const t=c(l);return r(t,f(l),d(l,t),h(l),p(l),m(l),g(l))}}function Ui(e,t,n){return t+7*e-(n+6)%7}const qi={[fi]:e=>e.getFullYear(),[di]:e=>Math.floor(e.getMonth()/3),[hi]:e=>e.getMonth(),[mi]:e=>e.getDate(),[vi]:e=>e.getHours(),[bi]:e=>e.getMinutes(),[xi]:e=>e.getSeconds(),[_i]:e=>e.getMilliseconds(),[yi]:e=>Fi(e),[pi]:e=>Oi(e),[pi+gi]:(e,t)=>Ui(Oi(e),e.getDay(),Ni(t)),[gi]:(e,t)=>Ui(1,e.getDay(),Ni(t))},Wi={[di]:e=>3*e,[pi]:(e,t)=>Ui(e,0,Ni(t))};function Hi(e,t){return Ii(e,t||1,qi,Wi,Ti)}const Gi={[fi]:e=>e.getUTCFullYear(),[di]:e=>Math.floor(e.getUTCMonth()/3),[hi]:e=>e.getUTCMonth(),[mi]:e=>e.getUTCDate(),[vi]:e=>e.getUTCHours(),[bi]:e=>e.getUTCMinutes(),[xi]:e=>e.getUTCSeconds(),[_i]:e=>e.getUTCMilliseconds(),[yi]:e=>Pi(e),[pi]:e=>Li(e),[gi]:(e,t)=>Ui(1,e.getUTCDay(),Bi(t)),[pi+gi]:(e,t)=>Ui(Li(e),e.getUTCDay(),Bi(t))},Yi={[di]:e=>3*e,[pi]:(e,t)=>Ui(e,0,Bi(t))};function Vi(e,t){return Ii(e,t||1,Gi,Yi,ji)}const Xi={[fi]:Qn,[di]:Kn.every(3),[hi]:Kn,[pi]:Rn,[mi]:On,[gi]:On,[yi]:On,[vi]:ti,[bi]:ii,[xi]:oi,[_i]:ai},Ji={[fi]:Zn,[di]:ei.every(3),[hi]:ei,[pi]:Wn,[mi]:Nn,[gi]:Nn,[yi]:Nn,[vi]:ni,[bi]:ri,[xi]:oi,[_i]:ai};function Qi(e){return Xi[e]}function Zi(e){return Ji[e]}function Ki(e,t,n){return e?e.offset(t,n):void 0}function er(e,t,n){return Ki(Qi(e),t,n)}function tr(e,t,n){return Ki(Zi(e),t,n)}function nr(e,t,n,i){return e?e.range(t,n,i):void 0}function ir(e,t,n,i){return nr(Qi(e),t,n,i)}function rr(e,t,n,i){return nr(Zi(e),t,n,i)}const or=31536e6,ar=[fi,hi,mi,vi,bi,xi,_i],sr=ar.slice(0,-1),lr=sr.slice(0,-1),ur=lr.slice(0,-1),cr=ur.slice(0,-1),fr=[fi,hi],dr=[fi],hr=[[sr,1,1e3],[sr,5,5e3],[sr,15,15e3],[sr,30,3e4],[lr,1,6e4],[lr,5,3e5],[lr,15,9e5],[lr,30,18e5],[ur,1,36e5],[ur,3,108e5],[ur,6,216e5],[ur,12,432e5],[cr,1,864e5],[[fi,pi],1,6048e5],[fr,1,2592e6],[fr,3,7776e6],[dr,1,or]];function pr(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(At(t))/n;let r,o,a=ui((e=>e[2])).right(hr,i);return a===hr.length?(r=dr,o=rn(t[0]/or,t[1]/or,n)):a?(a=hr[i/hr[a-1][2]<hr[a][2]/i?a-1:a],r=a[0],o=a[1]):(r=ar,o=Math.max(rn(t[0],t[1],n),1)),{units:r,step:o}}function mr(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function gr(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function yr(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function vr(e){var t=e.dateTime,n=e.date,i=e.time,r=e.periods,o=e.days,a=e.shortDays,s=e.months,l=e.shortMonths,u=Cr(r),c=Fr(r),f=Cr(o),d=Fr(o),h=Cr(a),p=Fr(a),m=Cr(s),g=Fr(s),y=Cr(l),v=Fr(l),b={a:function(e){return a[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:Zr,e:Zr,f:io,g:mo,G:yo,H:Kr,I:eo,j:to,L:no,m:ro,M:oo,p:function(e){return r[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:jo,s:Io,S:ao,u:so,U:lo,V:co,w:fo,W:ho,x:null,X:null,y:po,Y:go,Z:vo,"%":Bo},x={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:bo,e:bo,f:Eo,g:zo,G:Po,H:xo,I:_o,j:wo,L:ko,m:$o,M:Ao,p:function(e){return r[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:jo,s:Io,S:Do,u:So,U:Mo,V:Fo,w:Oo,W:No,x:null,X:null,y:To,Y:Ro,Z:Lo,"%":Bo},_={a:function(e,t,n){var i=h.exec(t.slice(n));return i?(e.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(e,t,n){var i=f.exec(t.slice(n));return i?(e.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(e,t,n){var i=y.exec(t.slice(n));return i?(e.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(e,t,n){var i=m.exec(t.slice(n));return i?(e.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(e,n,i){return E(e,t,n,i)},d:Ur,e:Ur,f:Vr,g:Lr,G:Pr,H:Wr,I:Wr,j:qr,L:Yr,m:Ir,M:Hr,p:function(e,t,n){var i=u.exec(t.slice(n));return i?(e.p=c.get(i[0].toLowerCase()),n+i[0].length):-1},q:jr,Q:Jr,s:Qr,S:Gr,u:Nr,U:Tr,V:zr,w:Or,W:Rr,x:function(e,t,i){return E(e,n,t,i)},X:function(e,t,n){return E(e,i,t,n)},y:Lr,Y:Pr,Z:Br,"%":Xr};function w(e,t){return function(n){var i,r,o,a=[],s=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s<u;)37===e.charCodeAt(s)&&(a.push(e.slice(l,s)),null!=(r=Er[i=e.charAt(++s)])?i=e.charAt(++s):r="e"===i?" ":"0",(o=t[i])&&(i=o(n,r)),a.push(i),l=s+1);return a.push(e.slice(l,s)),a.join("")}}function k(e,t){return function(n){var i,r,o=yr(1900,void 0,1);if(E(o,e,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(t&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=gr(yr(o.y,0,1))).getUTCDay(),i=r>4||0===r?Hn.ceil(i):Hn(i),i=Nn.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=mr(yr(o.y,0,1))).getDay(),i=r>4||0===r?Pn.ceil(i):Pn(i),i=On.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?gr(yr(o.y,0,1)).getUTCDay():mr(yr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,gr(o)):mr(o)}}function E(e,t,n,i){for(var r,o,a=0,s=t.length,l=n.length;a<s;){if(i>=l)return-1;if(37===(r=t.charCodeAt(a++))){if(r=t.charAt(a++),!(o=_[r in Er?t.charAt(a++):r])||(i=o(e,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=w(n,b),b.X=w(i,b),b.c=w(t,b),x.x=w(n,x),x.X=w(i,x),x.c=w(t,x),{format:function(e){var t=w(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=w(e+="",x);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}var br,xr,_r,wr,kr,Er={"-":"",_:" ",0:"0"},$r=/^\s*\d+/,Ar=/^%/,Dr=/[\\^$*+?|[\]().{}]/g;function Sr(e,t,n){var i=e<0?"-":"",r=(i?-e:e)+"",o=r.length;return i+(o<n?new Array(n-o+1).join(t)+r:r)}function Mr(e){return e.replace(Dr,"\\$&")}function Cr(e){return new RegExp("^(?:"+e.map(Mr).join("|")+")","i")}function Fr(e){return new Map(e.map(((e,t)=>[e.toLowerCase(),t])))}function Or(e,t,n){var i=$r.exec(t.slice(n,n+1));return i?(e.w=+i[0],n+i[0].length):-1}function Nr(e,t,n){var i=$r.exec(t.slice(n,n+1));return i?(e.u=+i[0],n+i[0].length):-1}function Tr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.U=+i[0],n+i[0].length):-1}function zr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.V=+i[0],n+i[0].length):-1}function Rr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.W=+i[0],n+i[0].length):-1}function Pr(e,t,n){var i=$r.exec(t.slice(n,n+4));return i?(e.y=+i[0],n+i[0].length):-1}function Lr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Br(e,t,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function jr(e,t,n){var i=$r.exec(t.slice(n,n+1));return i?(e.q=3*i[0]-3,n+i[0].length):-1}function Ir(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.m=i[0]-1,n+i[0].length):-1}function Ur(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.d=+i[0],n+i[0].length):-1}function qr(e,t,n){var i=$r.exec(t.slice(n,n+3));return i?(e.m=0,e.d=+i[0],n+i[0].length):-1}function Wr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.H=+i[0],n+i[0].length):-1}function Hr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.M=+i[0],n+i[0].length):-1}function Gr(e,t,n){var i=$r.exec(t.slice(n,n+2));return i?(e.S=+i[0],n+i[0].length):-1}function Yr(e,t,n){var i=$r.exec(t.slice(n,n+3));return i?(e.L=+i[0],n+i[0].length):-1}function Vr(e,t,n){var i=$r.exec(t.slice(n,n+6));return i?(e.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Xr(e,t,n){var i=Ar.exec(t.slice(n,n+1));return i?n+i[0].length:-1}function Jr(e,t,n){var i=$r.exec(t.slice(n));return i?(e.Q=+i[0],n+i[0].length):-1}function Qr(e,t,n){var i=$r.exec(t.slice(n));return i?(e.s=+i[0],n+i[0].length):-1}function Zr(e,t){return Sr(e.getDate(),t,2)}function Kr(e,t){return Sr(e.getHours(),t,2)}function eo(e,t){return Sr(e.getHours()%12||12,t,2)}function to(e,t){return Sr(1+On.count(Qn(e),e),t,3)}function no(e,t){return Sr(e.getMilliseconds(),t,3)}function io(e,t){return no(e,t)+"000"}function ro(e,t){return Sr(e.getMonth()+1,t,2)}function oo(e,t){return Sr(e.getMinutes(),t,2)}function ao(e,t){return Sr(e.getSeconds(),t,2)}function so(e){var t=e.getDay();return 0===t?7:t}function lo(e,t){return Sr(Rn.count(Qn(e)-1,e),t,2)}function uo(e){var t=e.getDay();return t>=4||0===t?jn(e):jn.ceil(e)}function co(e,t){return e=uo(e),Sr(jn.count(Qn(e),e)+(4===Qn(e).getDay()),t,2)}function fo(e){return e.getDay()}function ho(e,t){return Sr(Pn.count(Qn(e)-1,e),t,2)}function po(e,t){return Sr(e.getFullYear()%100,t,2)}function mo(e,t){return Sr((e=uo(e)).getFullYear()%100,t,2)}function go(e,t){return Sr(e.getFullYear()%1e4,t,4)}function yo(e,t){var n=e.getDay();return Sr((e=n>=4||0===n?jn(e):jn.ceil(e)).getFullYear()%1e4,t,4)}function vo(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Sr(t/60|0,"0",2)+Sr(t%60,"0",2)}function bo(e,t){return Sr(e.getUTCDate(),t,2)}function xo(e,t){return Sr(e.getUTCHours(),t,2)}function _o(e,t){return Sr(e.getUTCHours()%12||12,t,2)}function wo(e,t){return Sr(1+Nn.count(Zn(e),e),t,3)}function ko(e,t){return Sr(e.getUTCMilliseconds(),t,3)}function Eo(e,t){return ko(e,t)+"000"}function $o(e,t){return Sr(e.getUTCMonth()+1,t,2)}function Ao(e,t){return Sr(e.getUTCMinutes(),t,2)}function Do(e,t){return Sr(e.getUTCSeconds(),t,2)}function So(e){var t=e.getUTCDay();return 0===t?7:t}function Mo(e,t){return Sr(Wn.count(Zn(e)-1,e),t,2)}function Co(e){var t=e.getUTCDay();return t>=4||0===t?Vn(e):Vn.ceil(e)}function Fo(e,t){return e=Co(e),Sr(Vn.count(Zn(e),e)+(4===Zn(e).getUTCDay()),t,2)}function Oo(e){return e.getUTCDay()}function No(e,t){return Sr(Hn.count(Zn(e)-1,e),t,2)}function To(e,t){return Sr(e.getUTCFullYear()%100,t,2)}function zo(e,t){return Sr((e=Co(e)).getUTCFullYear()%100,t,2)}function Ro(e,t){return Sr(e.getUTCFullYear()%1e4,t,4)}function Po(e,t){var n=e.getUTCDay();return Sr((e=n>=4||0===n?Vn(e):Vn.ceil(e)).getUTCFullYear()%1e4,t,4)}function Lo(){return"+0000"}function Bo(){return"%"}function jo(e){return+e}function Io(e){return Math.floor(+e/1e3)}function Uo(e){const t={};return n=>t[n]||(t[n]=e(n))}function qo(e){const t=Uo(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(e){const n=sn(e||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let o=function(e,t){let n,i=e.lastIndexOf("e");if(i>0)return i;for(i=e.length;--i>t;)if(n=e.charCodeAt(i),n>=48&&n<=57)return i+1}(i,r);const a=o<i.length?i.slice(o):"";for(;--o>r;)if("0"!==i[o]){++o;break}return i.slice(0,o)+a}}(t(n),t(".1f")(1)[1])}return t(n)},formatSpan(e,i,r,o){o=sn(null==o?",f":o);const a=rn(e,i,r),s=Math.max(Math.abs(e),Math.abs(i));let l;if(null==o.precision)switch(o.type){case"s":return isNaN(l=fn(a,s))||(o.precision=l),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(l=dn(a,s))||(o.precision=l-("e"===o.type));break;case"f":case"%":isNaN(l=hn(a))||(o.precision=l-2*("%"===o.type))}return t(o)}}}let Wo,Ho;function Go(){return Wo=qo({format:vn,formatPrefix:bn})}function Yo(e){return qo(wn(e))}function Vo(e){return arguments.length?Wo=Yo(e):Wo}function Xo(e,t,n){we(n=n||{})||oe(`Invalid time multi-format specifier: ${n}`);const i=t(xi),r=t(bi),o=t(vi),a=t(mi),s=t(pi),l=t(hi),u=t(di),c=t(fi),f=e(n[_i]||".%L"),d=e(n[xi]||":%S"),h=e(n[bi]||"%I:%M"),p=e(n[vi]||"%I %p"),m=e(n[mi]||n[gi]||"%a %d"),g=e(n[pi]||"%b %d"),y=e(n[hi]||"%B"),v=e(n[di]||"%B"),b=e(n[fi]||"%Y");return e=>(i(e)<e?f:r(e)<e?d:o(e)<e?h:a(e)<e?p:l(e)<e?s(e)<e?m:g:c(e)<e?u(e)<e?y:v:b)(e)}function Jo(e){const t=Uo(e.format),n=Uo(e.utcFormat);return{timeFormat:e=>vt(e)?t(e):Xo(t,Qi,e),utcFormat:e=>vt(e)?n(e):Xo(n,Zi,e),timeParse:Uo(e.parse),utcParse:Uo(e.utcParse)}}function Qo(){return Ho=Jo({format:xr,parse:_r,utcFormat:wr,utcParse:kr})}function Zo(e){return Jo(vr(e))}function Ko(e){return arguments.length?Ho=Zo(e):Ho}br=vr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),xr=br.format,_r=br.parse,wr=br.utcFormat,kr=br.utcParse,Go(),Qo();const ea=(e,t)=>it({},e,t);function ta(e,t){const n=e?Yo(e):Vo(),i=t?Zo(t):Ko();return ea(n,i)}function na(e,t){const n=arguments.length;return n&&2!==n&&oe("defaultLocale expects either zero or two arguments."),n?ea(Vo(e),Ko(t)):ea(Vo(),Ko())}function ia(){return Go(),Qo(),na()}const ra=/^(data:|([A-Za-z]+:)?\/\/)/,oa=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,aa=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,sa="file://";async function la(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function ua(e,t){t=it({},this.options,t);const n=this.fileAccess,i={href:null};let r,o,a;const s=oa.test(e.replace(aa,""));null!=e&&"string"==typeof e&&s||oe("Sanitize failure, invalid URI: "+Dt(e));const l=ra.test(e);return(a=t.baseURL)&&!l&&(e.startsWith("/")||a.endsWith("/")||(e="/"+e),e=a+e),o=(r=e.startsWith(sa))||"file"===t.mode||"http"!==t.mode&&!l&&n,r?e=e.slice(7):e.startsWith("//")&&("file"===t.defaultProtocol?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!o}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),"image"===t.context&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function ca(e){return e?t=>new Promise(((n,i)=>{e.readFile(t,((e,t)=>{e?i(e):n(t)}))})):fa}async function fa(){oe("No file system access.")}function da(e){return e?async function(t,n){const i=it({},this.options.http,n),r=n&&n.response,o=await e(t,i);return o.ok?Ve(o[r])?o[r]():o.text():oe(o.status+""+o.statusText)}:ha}async function ha(){oe("No HTTP fetch method available.")}const pa=e=>null!=e&&e==e,ma=e=>!(Number.isNaN(+e)||e instanceof Date),ga={boolean:St,integer:Se,number:Se,date:Ct,string:Ft,unknown:ue},ya=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>ma(e)&&Number.isInteger(+e),ma,e=>!Number.isNaN(Date.parse(e))],va=["boolean","integer","number","date"];function ba(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=ya.length,r=ya.map(((e,t)=>t+1));for(let o,a,s=0,l=0;s<n;++s)for(a=t?e[s][t]:e[s],o=0;o<i;++o)if(r[o]&&pa(a)&&!ya[o](a)&&(r[o]=0,++l,l===ya.length))return"string";return va[r.reduce(((e,t)=>0===e?t:e),0)-1]}function xa(e,t){return t.reduce(((t,n)=>(t[n]=ba(e,n),t)),{})}function _a(e){const t=function(t,n){const i={delimiter:e};return wa(t,n?it(n,i):i)};return t.responseType="text",t}function wa(e,t){return t.header&&(e=t.header.map(Dt).join(t.delimiter)+"\n"+e),qt(t.delimiter).parse(e+"")}function ka(e,t){const n=t&&t.property?se(t.property):ue;return!we(e)||(i=e,"function"==typeof Buffer&&Ve(Buffer.isBuffer)&&Buffer.isBuffer(i))?n(JSON.parse(e)):function(e,t){return!_e(e)&&mt(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}(n(e),t);var i}wa.responseType="text",ka.responseType="json";const Ea={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function $a(e,t){let n,i,r,o;return e=ka(e,t),t&&t.feature?(n=Ht,r=t.feature):t&&t.mesh?(n=Xt,r=t.mesh,o=Ea[t.filter]):oe("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,o):oe("Invalid TopoJSON object: "+r),i&&i.features||[i]}$a.responseType="json";const Aa={dsv:wa,csv:_a(","),tsv:_a("\t"),json:ka,topojson:$a};function Da(e,t){return arguments.length>1?(Aa[e]=t,this):st(Aa,e)?Aa[e]:null}function Sa(e){const t=Da(e);return t&&t.responseType||"text"}function Ma(e,t,n,i){const r=Da((t=t||{}).type||"json");return r||oe("Unknown data format type: "+t.type),e=r(e,t),t.parse&&function(e,t,n,i){if(!e.length)return;const r=Ko();n=n||r.timeParse,i=i||r.utcParse;let o,a,s,l,u,c,f=e.columns||Object.keys(e[0]);"auto"===t&&(t=xa(e,f)),f=Object.keys(t);const d=f.map((e=>{const r=t[e];let o,a;if(r&&(r.startsWith("date:")||r.startsWith("utc:")))return o=r.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?i:n)(a);if(!ga[r])throw Error("Illegal format pattern: "+e+":"+r);return ga[r]}));for(s=0,u=e.length,c=f.length;s<u;++s)for(o=e[s],l=0;l<c;++l)a=f[l],o[a]=d[l](o[a])}(e,t.parse,n,i),st(e,"columns")&&delete e.columns,e}const Ca=function(e,t){return t=>({options:t||{},sanitize:ua,load:la,fileAccess:!1,file:ca(null),http:da(e)})}("undefined"!=typeof fetch&&fetch);function Fa(e){const t=e||ue,n=[],i={};return n.add=e=>{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 Oa(e,t){try{await t(e)}catch(t){e.error(t)}}const Na=Symbol("vega_id");let Ta=1;function za(e){return!(!e||!Ra(e))}function Ra(e){return e[Na]}function Pa(e,t){return e[Na]=t,e}function La(e){const t=e===Object(e)?e:{data:e};return Ra(t)?t:Pa(t,Ta++)}function Ba(e){return ja(e,La({}))}function ja(e,t){for(const n in e)t[n]=e[n];return t}function Ia(e,t){return Pa(t,Ra(e))}function Ua(e,t){return e?t?(n,i)=>e(n,i)||Ra(t(n))-Ra(t(i)):(t,n)=>e(t,n)||Ra(t)-Ra(n):null}function qa(e){return e&&e.constructor===Wa}function Wa(){const e=[],t=[],n=[],i=[],r=[];let o=null,a=!1;return{constructor:Wa,insert(t){const n=Ge(t),i=n.length;for(let t=0;t<i;++t)e.push(n[t]);return this},remove(e){const n=Ve(e)?i:t,r=Ge(e),o=r.length;for(let e=0;e<o;++e)n.push(r[e]);return this},modify(e,t,i){const o={field:t,value:tt(i)};return Ve(e)?(o.filter=e,r.push(o)):(o.tuple=e,n.push(o)),this},encode(e,t){return Ve(e)?r.push({filter:e,field:t}):n.push({tuple:e,field:t}),this},clean(e){return o=e,this},reflow(){return a=!0,this},pulse(s,l){const u={},c={};let f,d,h,p,m,g;for(f=0,d=l.length;f<d;++f)u[Ra(l[f])]=1;for(f=0,d=t.length;f<d;++f)m=t[f],u[Ra(m)]=-1;for(f=0,d=i.length;f<d;++f)p=i[f],l.forEach((e=>{p(e)&&(u[Ra(e)]=-1)}));for(f=0,d=e.length;f<d;++f)m=e[f],g=Ra(m),u[g]?u[g]=1:s.add.push(La(e[f]));for(f=0,d=l.length;f<d;++f)m=l[f],u[Ra(m)]<0&&s.rem.push(m);function y(e,t,n){n?e[t]=n(e):s.encode=t,a||(c[Ra(e)]=e)}for(f=0,d=n.length;f<d;++f)h=n[f],m=h.tuple,p=h.field,g=u[Ra(m)],g>0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=r.length;f<d;++f)h=r[f],p=h.filter,l.forEach((e=>{p(e)&&u[Ra(e)]>0&&y(e,h.field,h.value)})),s.modifies(h.field);if(a)s.mod=t.length||i.length?l.filter((e=>u[Ra(e)]>0)):l.slice();else for(g in c)s.mod.push(c[g]);return(o||null==o&&(t.length||i.length))&&s.clean(!0),s}}}const Ha="_:mod:_";function Ga(){Object.defineProperty(this,Ha,{writable:!0,value:{}})}Ga.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[Ha];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]=_e(n)?1+n.length:-1),r},modified(e,t){const n=this[Ha];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(_e(e)){for(let t=0;t<e.length;++t)if(n[e[t]])return!0;return!1}return null!=t&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[Ha]={},this}};let Ya=0;const Va=new Ga;function Xa(e,t,n,i){this.id=++Ya,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,i)}function Ja(e){return function(t){const n=this.flags;return 0===arguments.length?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Xa.prototype={targets(){return this._targets||(this._targets=Fa(le))},set(e){return this.value!==e?(this.value=e,1):0},skip:Ja(1),modified:Ja(2),parameters(e,t,n){t=!1!==t;const i=this._argval=this._argval||new Ga,r=this._argops=this._argops||[],o=[];let a,s,l,u;const c=(e,n,a)=>{a instanceof Xa?(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)Ge(s).forEach((e=>{e instanceof Xa?e!==this&&(e.targets().add(this),o.push(e)):oe("Pulse parameters must be operator instances.")})),this.source=s;else if(_e(s))for(i.set(a,-1,Array(l=s.length)),u=0;u<l;++u)c(a,u,s[u]);else c(a,-1,s);return this.marshall().clear(),n&&(r.initonly=!0),o},marshall(e){const t=this._argval||Va,n=this._argops;let i,r,o,a;if(n){const s=n.length;for(r=0;r<s;++r)i=n[r],o=i.op,a=o.modified()&&o.stamp===e,t.set(i.name,i.index,o.value,a);if(n.initonly){for(r=0;r<s;++r)i=n[r],i.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,n,i,r;if(e)for(t=0,n=e.length;t<n;++t)i=e[t],r=i.op,r._targets&&r._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const n=this.marshall(e.stamp),i=t.call(this,n,e);if(n.clear(),i!==this.value)this.value=i;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};let Qa=0;function Za(e,t,n){this.id=++Qa,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Ka(e,t,n){return new Za(e,t,n)}Za.prototype={_filter:de,_apply:ue,targets(){return this._targets||(this._targets=Fa(le))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),n=this._targets,i=n?n.length:0;for(let e=0;e<i;++e)n[e].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Ka(e);return this.targets().add(t),t},apply(e){const t=Ka(null,e);return this.targets().add(t),t},merge(){const e=Ka();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter((()=>{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=Ka();return this.targets().add(Ka(null,null,nt(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(Ka(null,null,(()=>n=!0))),t.targets().add(Ka(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=de,this._targets=null}};const es={skip:!0};function ts(e,t,n,i,r,o){const a=it({},o,es);let s,l;Ve(n)||(n=tt(n)),void 0===i?s=t=>e.touch(n(t)):Ve(i)?(l=new Xa(null,i,r,!1),s=t=>{l.evaluate(t);const i=n(t),r=l.value;qa(r)?e.pulse(i,r,o):e.update(i,r,a)}):s=t=>e.update(n(t),i,a),t.apply(s)}function ns(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const a=o||{},s=new Xa(null,function(e,t){return t=Ve(t)?t:tt(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);s.modified(a.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}const is={};function rs(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 os(e,t){const n=[];return Tt(e,t,(e=>n.push(e))),n}function as(e,t){const n={};return e.visit(t,(e=>{n[Ra(e)]=1})),e=>n[Ra(e)]?null:e}function ss(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function ls(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 e of n)if(e.stamp===t){if(e.fields){const t=r.fields||(r.fields={});for(const n in e.fields)t[n]=1}e.changed(r.ADD)&&(o|=r.ADD),e.changed(r.REM)&&(o|=r.REM),e.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function us(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}rs.prototype={StopPropagation:is,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 rs(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 rs(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,as(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return _e(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?_e(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=ss(n.addF,t)),2&e&&(n.remF=ss(n.remF,t)),4&e&&(n.modF=ss(n.modF,t)),16&e&&(n.srcF=ss(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=os(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=os(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=os(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 Tt(n.source,n.srcF,i),n;1&e&&Tt(n.add,n.addF,i),2&e&&Tt(n.rem,n.remF,i),4&e&&Tt(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||Tt(r,e?as(n,5):n.srcF,i)}return n}},ft(ls,rs,{fork(e){const t=new rs(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?_e(e)?e.some((e=>n[e])):n[e]:0},filter(){oe("MultiPulse does not support filtering.")},materialize(){oe("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(;o<r;++o)i[o].visit(e,t);else for(;o<r;++o)i[o].stamp===n.stamp&&i[o].visit(e,t);return n}});const cs={skip:!1,force:!1};function fs(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 ds(){this.logger(xe()),this.logLevel(ge),this._clock=0,this._rank=0,this._locale=na();try{this._loader=Ca()}catch(e){}this._touched=Fa(le),this._input={},this._pulse=null,this._heap=function(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),fs(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<r;)a=s+1,a<r&&n(e[s],e[a])>=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,fs(e,i,t,n)}(t,0,e)):i=n,i}}}(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function hs(e){return function(){return this._log[e].apply(this,arguments)}}function ps(e,t){Xa.call(this,e,null,t)}ds.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:hs("error"),warn:hs("warn"),info:hs("info"),debug:hs("debug"),logLevel:hs("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof Xa?r=e:e&&e.prototype instanceof Xa?r=new e:Ve(e)?r=new Xa(null,e):(o=0,r=new Xa(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<i;++r)if(n<t[r].rank)return void this.rerank(e)},rank:function(e){e.rank=++this._rank},rerank:function(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&oe("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||cs);const i=new rs(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||cs;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||cs;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:Wa,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 Ma(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(de).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:Sa(t&&t.type)});try{i=n.parse(i,t)}catch(t){r=-2,n.warn("Data ingestion failed",e,t)}}catch(t){r=-1,n.warn("Loading failed",e,t)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,o=Ka(n,i),a=function(e){e.dataflow=r;try{o.receive(e)}catch(e){r.error(e)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):Ge(e);const l=s.length;for(let e=0;e<l;++e)s[e].addEventListener(t,a);return o},on:function(e,t,n,i,r){return(e instanceof Xa?ns:ts)(this,e,t,n,i,r),this},evaluate:async function(e,t,n){const i=this,r=[];if(i._pulse)return us(i);if(i._pending&&await i._pending,t&&await Oa(i,t),!i._touched.length)return i.debug("Dataflow invoked, but nothing to do."),i;const o=++i._clock;i._pulse=new rs(i,o,e),i._touched.forEach((e=>i._enqueue(e,!0))),i._touched=Fa(le);let a,s,l,u=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=is),s!==is&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++u):i._enqueue(a,!0)}catch(e){i._heap.clear(),l=e}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${u} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;t<e.length;++t)await Oa(i,e[t].callback)}return n&&await Oa(i,n),r.length&&Promise.all(r).then((e=>i.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(e){i.error(e)}}))})))),i},run:function(e,t,n){return this._pulse?us(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(e){this.error(e)}},_enqueue:function(e,t){const n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))},_getPulse:function(e,t){const n=e.source,i=this._clock;return n&&_e(n)?new ls(this,i,n.map((e=>e.pulse)),t):this._input[e.id]||function(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==is&&(e.source=t.source),e)}(this._pulse,n&&n.pulse)}},ft(ps,Xa,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then((e=>this.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 ms={};function gs(e){const t=ys(e);return t&&t.Definition||null}function ys(e){return e=e&&e.toLowerCase(),st(ms,e)?ms[e]:null}function vs(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}function bs(e,t){let n;if(void 0===t)for(const t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let i=-1;for(let r of e)null!=(r=t(r,++i,e))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function xs(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:e>t?1:0)}function _s(e,t,n=0,i=1/0,r){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(e.length-1,i)),!(n<=t&&t<=i))return e;for(r=void 0===r?xs:function(e=si){if(e===si)return xs;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||0===i?i:(0===e(n,n))-(0===e(t,t))}}(r);i>n;){if(i-n>600){const o=i-n+1,a=t-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);_s(e,t,Math.max(n,Math.floor(t-a*l/o+u)),Math.min(i,Math.floor(t+(o-a)*l/o+u)),r)}const o=e[t];let a=n,s=i;for(ws(e,n,t),r(e[i],o)>0&&ws(e,n,i);a<s;){for(ws(e,a,s),++a,--s;r(e[a],o)<0;)++a;for(;r(e[s],o)>0;)--s}0===r(e[n],o)?ws(e,n,s):(++s,ws(e,s,i)),s<=t&&(n=s+1),t<=s&&(i=s-1)}return e}function ws(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function ks(e){return null===e?NaN:+e}function Es(e,t,n){if(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)null!=(i=t(i,++n,e))&&(i=+i)>=i&&(yield i)}}(e,n)),(i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return bs(e);if(t>=1)return vs(e);var i,r=(i-1)*t,o=Math.floor(r),a=vs(_s(e,o).subarray(0,o+1));return a+(bs(e.subarray(o+1))-a)*(r-o)}}function $s(e,t,n=ks){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 As(e,t){return Es(e,.5,t)}function*Ds(e,t){if(null==t)for(let t of e)null!=t&&""!==t&&(t=+t)>=t&&(yield t);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function Ss(e,t,n){const i=Float64Array.from(Ds(e,n));return i.sort(si),t.map((e=>$s(i,e)))}function Ms(e,t){return Ss(e,[.25,.5,.75],t)}function Cs(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 t of e)null!=t&&(t=+t)>=t&&(n=t-r,r+=n/++i,o+=n*(t-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=Ms(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 Fs(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,l,u,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(l=h/t,u=0,c=e.steps.length;u<c&&e.steps[u]<l;++u);o=e.steps[Math.max(0,u-1)]}else{for(a=Math.ceil(Math.log(t)/i),s=e.minstep||0,o=Math.max(s,Math.pow(n,Math.round(Math.log(h)/i)-a));Math.ceil(h/o)>t;)o*=n;for(u=0,c=r.length;u<c;++u)l=o/r[u],l>=s&&h/l<=t&&(o=l)}l=Math.log(o);const p=l>=0?0:1+~~(-l/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(l=Math.floor(f/o+m)*o,f=f<l?l-o:l,d=Math.ceil(d/o)*o),{start:f,stop:d===f?f+o:d,step:o}}var Os=Math.random;function Ns(e){Os=e}function Ts(e,t,n,i){if(!e.length)return[void 0,void 0];const r=Float64Array.from(Ds(e,i)),o=r.length,a=t;let s,l,u,c;for(u=0,c=Array(a);u<a;++u){for(s=0,l=0;l<o;++l)s+=r[~~(Os()*o)];c[u]=s/o}return c.sort(si),[Es(c,n/2),Es(c,1-n/2)]}function zs(e,t,n,i){i=i||(e=>e);const r=e.length,o=new Float64Array(r);let a,s=0,l=1,u=i(e[0]),c=u,f=u+t;for(;l<r;++l){if(a=i(e[l]),a>=f){for(c=(u+c)/2;s<l;++s)o[s]=c;f=a+t,u=a}c=a}for(c=(u+c)/2;s<l;++s)o[s]=c;return n?function(e,t){const n=e.length;let i,r,o=0,a=1;for(;e[o]===e[a];)++a;for(;a<n;){for(i=a+1;e[a]===e[i];)++i;if(e[a]-e[a-1]<t){for(r=a+(o+i-a-a>>1);r<a;)e[r++]=e[a];for(;r>a;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}function Rs(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function Ps(e,t){let n,i,r;null==t&&(t=e,e=0);const o={min(e){return arguments.length?(n=e||0,r=i-n,o):n},max(e){return arguments.length?(i=e||0,r=i-n,o):i},sample:()=>n+Math.floor(r*Os()),pdf:e=>e===Math.floor(e)&&e>=n&&e<i?1/r:0,cdf(e){const t=Math.floor(e);return t<n?0:t>=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)}const Ls=Math.sqrt(2*Math.PI),Bs=Math.SQRT2;let js=NaN;function Is(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(js==js)r=js,js=NaN;else{do{r=2*Os()-1,o=2*Os()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,js=o*i}return e+r*t}function Us(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*Ls)}function qs(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 Ws(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*Bs*function(e){let t,n=-Math.log((1-e)*(1+e));return 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,t*e}(2*e-1)}function Hs(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:()=>Is(n,i),pdf:e=>Us(e,n,i),cdf:e=>qs(e,n,i),icdf:e=>Ws(e,n,i)};return r.mean(e).stdev(t)}function Gs(e,t){const n=Hs();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=Cs(e)),r):t},sample:()=>e[~~(Os()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;a<i;++a)o+=n.pdf((r-e[a])/t);return o/t/i},cdf(r){let o=0,a=0;for(;a<i;++a)o+=n.cdf((r-e[a])/t);return o/i},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function Ys(e,t){return e=e||0,t=null==t?1:t,Math.exp(e+Is()*t)}function Vs(e,t,n){if(e<=0)return 0;t=t||0,n=null==n?1:n;const i=(Math.log(e)-t)/n;return Math.exp(-.5*i*i)/(n*Ls*e)}function Xs(e,t,n){return qs(Math.log(e),t,n)}function Js(e,t,n){return Math.exp(Ws(e,t,n))}function Qs(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:()=>Ys(n,i),pdf:e=>Vs(e,n,i),cdf:e=>Xs(e,n,i),icdf:e=>Js(e,n,i)};return r.mean(e).stdev(t)}function Zs(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<i;++n)r+=t[n]=null==e[n]?1:+e[n];for(n=0;n<i;++n)t[n]/=r;return t}(t=e||[]),r):t},distributions(n){return arguments.length?(n?(i=n.length,e=n):(i=0,e=[]),r.weights(t)):e},sample(){const t=Os();let r=e[i-1],o=n[0],a=0;for(;a<i-1;o+=n[++a])if(t<o){r=e[a];break}return r.sample()},pdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].pdf(t);return r},cdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].cdf(t);return r},icdf(){throw Error("Mixture icdf not supported.")}};return r.distributions(e).weights(t)}function Ks(e,t){return null==t&&(t=null==e?1:e,e=0),e+(t-e)*Os()}function el(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=t&&e<=n?1/(n-t):0}function tl(e,t,n){return null==n&&(n=null==t?1:t,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function nl(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function il(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:()=>Ks(n,i),pdf:e=>el(e,n,i),cdf:e=>tl(e,n,i),icdf:e=>nl(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function rl(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 ol(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 al(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,l,u,c=0,f=0,d=0;for(u of e)o[c]=s=+t(u),a[c]=l=+n(u),++c,f+=(s-f)/c,d+=(l-d)/c;for(c=0;c<r;++c)o[c]-=f,a[c]-=d;return[o,a,f,d]}function sl(e,t,n,i){let r,o,a=-1;for(const s of e)r=t(s),o=n(s),null!=r&&(r=+r)>=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function ll(e,t,n,i,r){let o=0,a=0;return sl(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function ul(e,t,n){let i=0,r=0,o=0,a=0,s=0;sl(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 l=ol(i,r,o,a),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:ll(e,t,n,r,u)}}function cl(e,t,n){let i=0,r=0,o=0,a=0,s=0;sl(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 l=ol(i,r,o,a),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:ll(e,t,n,r,u)}}function fl(e,t,n){const[i,r,o,a]=al(e,t,n);let s,l,u,c=0,f=0,d=0,h=0,p=0;sl(e,t,n,((e,t)=>{s=i[p++],l=Math.log(t),u=s*t,c+=(t*l-c)/p,f+=(u-f)/p,d+=(u*l-d)/p,h+=(s*u-h)/p}));const[m,g]=ol(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:ll(e,t,n,a,y)}}function dl(e,t,n){let i=0,r=0,o=0,a=0,s=0,l=0;sl(e,t,n,((e,t)=>{const n=Math.log(e),u=Math.log(t);++l,i+=(n-i)/l,r+=(u-r)/l,o+=(n*u-o)/l,a+=(n*n-a)/l,s+=(t-s)/l}));const u=ol(i,r,o,a),c=e=>u[0]*Math.pow(e,u[1]);return u[0]=Math.exp(u[0]),{coef:u,predict:c,rSquared:ll(e,t,n,s,c)}}function hl(e,t,n){const[i,r,o,a]=al(e,t,n),s=i.length;let l,u,c,f,d=0,h=0,p=0,m=0,g=0;for(l=0;l<s;)u=i[l],c=r[l++],f=u*u,d+=(f-d)/l,h+=(f*u-h)/l,p+=(f*f-p)/l,m+=(u*c-m)/l,g+=(f*c-g)/l;const y=p-d*d,v=d*y-h*h,b=(g*d-m*h)/v,x=(m*y-g*h)/v,_=-b*d,w=e=>b*(e-=o)*e+x*e+_+a;return{coef:[_-x*o+b*o*o+a,x-2*b*o,b],predict:w,rSquared:ll(e,t,n,a,w)}}function pl(e,t,n,i){if(0===i)return rl(e,t,n);if(1===i)return ul(e,t,n);if(2===i)return hl(e,t,n);const[r,o,a,s]=al(e,t,n),l=r.length,u=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;d<f;++d){for(p=0,m=0;p<l;++p)m+=Math.pow(r[p],d)*o[p];for(u.push(m),g=new Float64Array(f),h=0;h<f;++h){for(p=0,m=0;p<l;++p)m+=Math.pow(r[p],d+h);g[h]=m}c.push(g)}c.push(u);const y=function(e){const t=e.length-1,n=[];let i,r,o,a,s;for(i=0;i<t;++i){for(a=i,r=i+1;r<t;++r)Math.abs(e[i][r])>Math.abs(e[i][a])&&(a=r);for(o=i;o<t+1;++o)s=e[o][i],e[o][i]=e[o][a],e[o][a]=s;for(r=i+1;r<t;++r)for(o=t;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<t;++o)s+=e[o][r]*n[o];n[r]=(e[t][r]-s)/e[r][r]}return n}(c),v=e=>{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d<f;++d)t+=y[d]*Math.pow(e,d);return t};return{coef:ml(f,y,-a,s),predict:v,rSquared:ll(e,t,n,s,v)}}function ml(e,t,n,i){const r=Array(e);let o,a,s,l;for(o=0;o<e;++o)r[o]=0;for(o=e-1;o>=0;--o)for(s=t[o],l=1,r[o]+=s,a=1;a<=o;++a)l*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*l;return r[0]+=i,r}const gl=2,yl=1e-12;function vl(e,t,n,i){const[r,o,a,s]=al(e,t,n,!0),l=r.length,u=Math.max(2,~~(i*l)),c=new Float64Array(l),f=new Float64Array(l),d=new Float64Array(l).fill(1);for(let e=-1;++e<=gl;){const t=[0,u-1];for(let e=0;e<l;++e){const n=r[e],i=t[0],a=t[1],s=n-r[i]>r[a]-n?i:a;let l=0,u=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-n||1);for(let e=i;e<=a;++e){const t=r[e],i=o[e],a=bl(Math.abs(n-t)*g)*d[e],s=t*a;l+=a,u+=s,h+=i*a,p+=i*s,m+=t*s}const[y,v]=ol(u/l,h/l,p/l,m/l);c[e]=y+v*n,f[e]=Math.abs(o[e]-c[e]),xl(r,e+1,t)}if(e===gl)break;const n=As(f);if(Math.abs(n)<yl)break;for(let e,t,i=0;i<l;++i)e=f[i]/(6*n),d[i]=e>=1?yl:(t=1-e*e)*t}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,l=0,u=[];for(;s<r;++s)a=e[s]+n,u[0]===a?u[1]+=(t[s]-u[1])/++l:(l=0,u[1]+=i,u=[a,t[s]],o.push(u));return u[1]+=i,o}(r,c,a,s)}function bl(e){return(e=1-e*e*e)*e*e}function xl(e,t,n){const i=e[t];let r=n[0],o=n[1]+1;if(!(o>=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const _l=.5*Math.PI/180;function wl(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,l=s/i,u=[r(o)],c=[];if(n===i){for(let e=1;e<i;++e)u.push(r(o+e/n*s));return u.push(r(a)),u}c.push(r(a));for(let e=n;--e>0;)c.push(r(o+e/n*s));let f=u[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 e=0;e<r;++e){const r=t[e][1];r<n&&(n=r),r>i&&(i=r)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=l&&kl(f,e,d,h,p)>_l?c.push(e):(f=d,u.push(d),c.pop()),d=c[c.length-1]}return u}function kl(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 El(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var i=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(r);++i<r;)o[i]=e+i*n;return o}function $l(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<n;++i)r+="|"+t[i](e);return r}):function(){return""};var t}function Al(e,t,n){return n||e+(t?"_"+t:"")}const Dl=()=>{},Sl={init:Dl,add:Dl,rem:Dl,idx:0},Ml={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.sum,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<e.min||void 0===e.min)&&(e.min=t)},rem:(e,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<e.min&&(e.argmin=n)},rem:(e,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}},Cl=Object.keys(Ml).filter((e=>"__count__"!==e));function Fl(e,t){return Ml[e](t)}function Ol(e,t){return e.idx-t.idx}function Nl(){this.valid=0,this.missing=0,this._ops.forEach((e=>e.init(this)))}function Tl(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function zl(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function Rl(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function Pl(e,t){const n=t||ue,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]=Ml[e]())}))};return e.forEach(n),Object.values(t).sort(Ol)}(e),r=e.slice().sort(Ol);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=Nl,o.prototype.add=Tl,o.prototype.rem=zl,o.prototype.set=Rl,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function Ll(e){this._key=e?se(e):Ra,this.reset()}[...Cl,"__count__"].forEach((e=>{Ml[e]=function(e,t){return n=>it({name:e,out:n||e},Sl,t)}(e,Ml[e])}));const Bl=Ll.prototype;function jl(e){ps.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}function Il(e){ps.call(this,null,e)}function Ul(e,t,n){const i=e;let r=t||[],o=n||[],a={},s=0;return{add:e=>o.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?kt(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function ql(e){ps.call(this,[],e)}function Wl(e){Xa.call(this,null,Hl,e)}function Hl(e){return this.value&&!e.modified()?this.value:Je(e.fields,e.orders)}function Gl(e){ps.call(this,null,e)}function Yl(e){ps.call(this,null,e)}Bl.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Bl.add=function(e){this._add.push(e)},Bl.rem=function(e){this._rem.push(e)},Bl.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,l,u;for(s=0;s<r;++s)a[n(t[s])]=1;for(s=0,l=0;s<i;++s)a[n(u=e[s])]?a[n(u)]=0:o[l++]=u;return this._rem=[],this._add=o},Bl.distinct=function(e){const t=this.values(),n={};let i,r=t.length,o=0;for(;--r>=0;)i=e(t[r])+"",st(n,i)||(n[i]=1,++o);return o},Bl.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=ot(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Bl.argmin=function(e){return this.extent(e)[0]||{}},Bl.argmax=function(e){return this.extent(e)[1]||{}},Bl.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},Bl.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},Bl.quartile=function(e){return this._get===e&&this._q||(this._q=Ms(this.values(),e),this._get=e),this._q},Bl.q1=function(e){return this.quartile(e)[0]},Bl.q2=function(e){return this.quartile(e)[1]},Bl.q3=function(e){return this.quartile(e)[2]},Bl.ci=function(e){return this._get===e&&this._ci||(this._ci=Ts(this.values(),1e3,.05,e),this._get=e),this._ci},Bl.ci0=function(e){return this.ci(e)[0]},Bl.ci1=function(e){return this.ci(e)[1]},jl.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Cl},{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"}]},ft(jl,ps,{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<r;++o)i[o][s=a[n[o]]]=s}o(e._prev),o(t),function o(a,s,l){const u=n[l],c=i[l++];for(const n in c){const i=a?a+"|"+n:n;s[u]=c[n],l<r?o(i,s,l):t[i]||e.cell(i,s)}}("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],i={};function r(e){const n=Ge(te(e)),r=n.length;let o,a=0;for(;a<r;++a)i[o=n[a]]||(i[o]=1,t.push(o))}this._dims=Ge(e.groupby),this._dnames=this._dims.map((e=>{const t=ee(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:$l(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],a=e.ops||["count"],s=e.as||[],l=o.length,u={};let c,f,d,h,p,m;for(l!==a.length&&oe("Unmatched number of fields and aggregate ops."),m=0;m<l;++m)c=o[m],f=a[m],null==c&&"count"!==f&&oe("Null aggregate field specified."),h=ee(c),p=Al(f,h,s[m]),n.push(p),"count"!==f?(d=u[h],d||(r(c),d=u[h]=[],d.field=c,this._measures.push(d)),"count"!==f&&(this._countOnly=!1),d.push(Fl(f,p))):this._counts.push(p);return this._measures=this._measures.map((e=>Pl(e,e.field))),Object.create(null)},cellkey:$l(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){const n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const e=this._measures,t=e.length;n.agg=Array(t);for(let i=0;i<t;++i)n.agg[i]=new e[i](n)}return n.store&&(n.data=new Ll),n},newtuple(e,t){const n=this._dnames,i=this._dims,r=i.length,o={};for(let t=0;t<r;++t)o[n[t]]=i[t](e);return t?Ia(t.tuple,o):La(o)},clean(){const e=this.value;for(const t in e)0===e[t].num&&delete e[t]},add(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);const i=n.agg;for(let t=0,n=i.length;t<n;++t)i[t].add(i[t].get(e),e)},rem(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);const i=n.agg;for(let t=0,n=i.length;t<n;++t)i[t].rem(i[t].get(e),e)},celltuple(e){const t=e.tuple,n=this._counts;e.store&&e.data.values();for(let i=0,r=n.length;i<r;++i)t[n[i]]=e.num;if(!this._countOnly){const n=e.agg;for(let e=0,i=n.length;e<i;++e)n[e].set(t)}return t},changes(e){const t=this._adds,n=this._mods,i=this._prev,r=this._drop,o=e.add,a=e.rem,s=e.mod;let l,u,c,f;if(i)for(u in i)l=i[u],r&&!l.num||a.push(l.tuple);for(c=0,f=this._alen;c<f;++c)o.push(this.celltuple(t[c])),t[c]=null;for(c=0,f=this._mlen;c<f;++c)l=n[c],(0===l.num&&r?a:s).push(this.celltuple(l)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}}),Il.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"]}]},ft(Il,ps,{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],l=a[1];let u;return u=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(te(e.field))?t.ADD_MOD:t.ADD,t.visit(u,n?e=>{const t=i(e);e[s]=t,e[l]=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=Fs(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 l=function(e){let n=Se(t(e));return null==n?null:n<a?-1/0:n>s?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return l.start=a,l.stop=n.stop,l.step=i,this.value=K(l,te(t),e.name||"bin_"+ee(t))}}),ql.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ft(ql,ps,{transform(e,t){const n=t.fork(t.ALL),i=Ul(Ra,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(Ua(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),ft(Wl,Xa),Gl.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"]}]},ft(Gl,ps,{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)||[],l=0,u=r.length;l<u;++l)a.test(i=r[l])||t(i)},i=this._parameterCheck(e,t),r=this._counts,o=this._match,a=this._stop,s=e.field,l=e.as||["text","count"],u=n((e=>r[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,u):(t.visit(t.ADD,u),t.visit(t.REM,c)),this._finish(t,l)},_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,l,u;for(s in n)l=i[s],u=n[s]||0,!l&&u?(i[s]=l=La({}),l[r]=s,l[o]=u,a.add.push(l)):0===u?(l&&a.rem.push(l),n[s]=null,i[s]=null):l[o]!==u&&(l[o]=u,a.mod.push(l));return a.modifies(t)}}),Yl.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ft(Yl,ps,{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={},l=e.length,u=0;u<l;++u)for(s[t]=o=e[u],r=0;r<l;++r)s[n]=e[r],i(s)&&(a.push(La(s)),(s={})[t]=o);return a}(s,r,o,e.filter||de)):n.mod=s,n.source=this.value,n.modifies(i)}});const Vl={kde:Gs,mixture:Zs,normal:Hs,lognormal:Qs,uniform:il},Xl="function";function Jl(e,t){const n=e[Xl];st(Vl,n)||oe("Unknown distribution function: "+n);const i=Vl[n]();for(const n in e)"field"===n?i.data((e.from||t()).map(e[n])):"distributions"===n?i[n](e[n].map((e=>Jl(e,t)))):typeof i[n]===Xl&&i[n](e[n]);return i}function Ql(e){ps.call(this,null,e)}const Zl=[{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}]}],Kl={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Zl},{name:"weights",type:"number",array:!0}]};function eu(e,t){return e?e.map(((e,n)=>t[n]||ee(e))):null}function tu(e,t,n){const i=[],r=e=>e(l);let o,a,s,l,u,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;a<s;++a)l=e[a],u=t.map(r),c=o[u],c||(o[u]=c=[],c.dims=u,i.push(c)),c.push(n(l));return i}function nu(e){ps.call(this,null,e)}function iu(e){Xa.call(this,null,ru,e),this.modified(!0)}function ru(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:K((n=>t(n,e)),te(t),ee(t))}function ou(e){ps.call(this,[void 0,void 0],e)}function au(e,t){Xa.call(this,e),this.parent=t,this.count=0}function su(e){ps.call(this,{},e),this._keys=ut();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;n<i;++n)e(t[n],n,t)}}function lu(e){Xa.call(this,null,uu,e)}function uu(e){return this.value&&!e.modified()?this.value:_e(e.name)?Ge(e.name).map((e=>se(e))):se(e.name,e.as)}function cu(e){ps.call(this,ut(),e)}function fu(e){ps.call(this,[],e)}function du(e){ps.call(this,[],e)}function hu(e){ps.call(this,null,e)}function pu(e){ps.call(this,[],e)}Ql.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:Zl.concat(Kl)},{name:"as",type:"string",array:!0,default:["value","density"]}]},ft(Ql,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=Jl(e.distribution,function(e){return()=>e.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&&oe("Invalid density method: "+a),e.extent||i.data||oe("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],l=wl(a,e.extent||rt(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],La(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),nu.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"}]},ft(nu,ps,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=tu(t.source,e.groupby,ue),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>At(rt(e,t))/30)(n,o),s=Ua(((e,t)=>o(e)-o(t))),l=e.as||"bin",u=i.length;let c,f=1/0,d=-1/0,h=0;for(;h<u;++h){const e=i[h].sort(s);c=-1;for(const t of zs(e,a,r,o))t<f&&(f=t),t>d&&(d=t),e[++c][l]=t}return this.value={start:f,stop:d,step:a},t.reflow(!0).modifies(l)}}),ft(iu,Xa),ou.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ft(ou,ps,{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=Se(i(e));null!=t&&(t<o&&(o=t),t>a&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=ee(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),ft(au,Xa,{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}}),ft(su,ps,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=st(r,e)&&r[e];return s?s.value.stamp<n.stamp&&(s.init(n),this.activate(s)):(a=i||(a=this._group[e])&&a.tuple,o=n.dataflow,s=new au(n.fork(n.NO_SOURCE),this),o.add(s).connect(t(o,e,a)),r[e]=s,this.activate(s)),s},clean(){const e=this.value;let t=0;for(const n in e)if(0===e[n].count){const i=e[n].detachSubflow;i&&i(),delete e[n],++t}if(t){const e=this._targets.filter((e=>e&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;r<i;++r)t[r]=e[r];for(;r<n&&null!=t[r];++r)t[r]=null;t.active=i},transform(e,t){const n=t.dataflow,i=e.key,r=e.subflow,o=this._keys,a=e.modified("key"),s=e=>this.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=Ra(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(Ra(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=Ra(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(Ra(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=Ra(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}}),ft(lu,Xa),cu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ft(cu,ps,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,l=e.expr;let u=!0;function c(t){const n=Ra(t),r=l(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?u&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=Ra(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{l(t,e)?o.push(t):i.set(Ra(t),1)})),t.visit(t.MOD,c),e.modified()&&(u=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),fu.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}]},ft(fu,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=eu(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 l,u,c,f=0;for(;f<s;++f){for(u=Ba(e),l=0;l<a;++l)u[r[l]]=null==(c=t[l][f])?null:c;o&&(u[o]=f),n.add.push(u)}})),this.value=n.source=n.add,o&&n.modifies(o),n.modifies(r)}}),du.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},ft(du,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=i.map(ee),o=e.as||["key","value"],a=o[0],s=o[1],l=i.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{for(let t,o=0;o<l;++o)t=Ba(e),t[a]=r[o],t[s]=i[o](e),n.add.push(t)})),this.value=n.source=n.add,n.modifies(o)}}),hu.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},ft(hu,ps,{transform(e,t){const n=e.expr,i=e.as,r=e.modified(),o=e.initonly?t.ADD:r?t.SOURCE:t.modified(n.fields)||t.modified(i)?t.ADD_MOD:t.ADD;return r&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(i),t.visit(o,(t=>t[i]=n(t,e)))}}),ft(pu,ps,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,l=e.size-s.length;if(l>0){for(r=[];--l>=0;)r.push(a=La(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-l),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-l);return n.source=this.value=s,n}});const mu={value:"value",median:As,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,i+=t);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:bs,max:vs},gu=[];function yu(e){ps.call(this,[],e)}function vu(e){jl.call(this,e)}function bu(e){ps.call(this,null,e)}function xu(e){Xa.call(this,null,_u,e)}function _u(e){return this.value&&!e.modified()?this.value:bt(e.fields,e.flat)}function wu(e){ps.call(this,[],e),this._pending=null}function ku(e,t,n){n.forEach(La);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 Eu(e){ps.call(this,{},e)}function $u(e){Xa.call(this,null,Au,e)}function Au(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;i<n;++i)r=t[i],r[0]<o&&(o=r[0]),r[1]>a&&(a=r[1]);return[o,a]}function Du(e){Xa.call(this,null,Su,e)}function Su(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function Mu(e){ps.call(this,null,e)}function Cu(e){jl.call(this,e)}function Fu(e){su.call(this,e)}function Ou(e){ps.call(this,null,e)}function Nu(e){ps.call(this,null,e)}function Tu(e){ps.call(this,null,e)}function zu(e){ps.call(this,null,e)}function Ru(e){ps.call(this,[],e),this.count=0}function Pu(e){ps.call(this,null,e)}function Lu(e){ps.call(this,null,e),this.modified(!0)}function Bu(e){ps.call(this,null,e)}yu.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}]},ft(yu,ps,{transform(e,t){var n,i,r,o,a,s,l,u,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||mu.value;if(null!=mu[n])return n===mu.value?(t=void 0!==e.value?e.value:0,()=>t):mu[n];oe("Unrecognized imputation method: "+n)}(e),p=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=ee(e.field),g=ee(e.key),y=(e.groupby||[]).map(ee),v=function(e,t,n,i){var r,o,a,s,l,u,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;s<c;++s)u=n(f=e[s]),l=m[u]||(m[u]=p.push(u)),(a=g[o=(r=t?t.map(d):gu)+""])||(a=g[o]=[],h.push(a),a.values=r),a[l-1]=f;return h.domain=p,h}(t.source,e.groupby,e.key,e.keyvals),b=[],x=this.value,_=v.domain.length;for(a=0,u=v.length;a<u;++a)for(r=(n=v[a]).values,i=NaN,l=0;l<_;++l)if(null==n[l]){for(o=v.domain[l],f={_impute:!0},s=0,c=r.length;s<c;++s)f[y[s]]=r[s];f[g]=o,f[m]=Number.isNaN(i)?i=h(n,p):i,b.push(La(f))}return b.length&&(d.add=d.materialize(d.ADD).add.concat(b)),x.length&&(d.rem=d.materialize(d.REM).rem.concat(x)),this.value=b,d}}),vu.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Cl},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},ft(vu,jl,{transform(e,t){const n=this,i=e.modified();let r;return n.value&&(i||t.modified(n._inputs,!0))?(r=n.value=i?n.init(e):{},t.visit(t.SOURCE,(e=>n.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=>{it(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<i;++n)this.celltuple(e[n]),e[n]=null;for(n=0,i=this._mlen;n<i;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}}),bu.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},ft(bu,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=tu(i,e.groupby,e.field),o=(e.groupby||[]).map(ee),a=e.bandwidth,s=e.cumulative?"cdf":"pdf",l=e.as||["value","density"],u=[];let c=e.extent,f=e.steps||e.minsteps||25,d=e.steps||e.maxsteps||200;"pdf"!==s&&"cdf"!==s&&oe("Invalid density method: "+s),"shared"===e.resolve&&(c||(c=rt(i,e.field)),f=d=e.steps||d),r.forEach((t=>{const n=Gs(t,a)[s],i=e.counts?t.length:1;wl(n,c||rt(t),f,d).forEach((e=>{const n={};for(let e=0;e<o.length;++e)n[o[e]]=t.dims[e];n[l[0]]=e[0],n[l[1]]=e[1]*i,u.push(La(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}}),ft(xu,Xa),ft(wu,ps,{transform(e,t){const n=t.dataflow;if(this._pending)return ku(this,t,this._pending);if(function(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}(e))return t.StopPropagation;if(e.values)return ku(this,t,n.parse(e.values,e.format));if(e.async){const t=n.request(e.url,e.format).then((e=>(this._pending=Ge(e.data),e=>e.touch(this))));return{async:t}}return n.request(e.url,e.format).then((e=>ku(this,t,Ge(e.data))))}}),Eu.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}]},ft(Eu,ps,{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 l,u,c,f=a?t.SOURCE:t.ADD,d=t,h=e.as;return r?(u=r.length,s>1&&!h&&oe('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*u&&oe('The "as" parameter has too few output field names.'),h=h||r.map(ee),l=function(e){for(var t,a,l=0,c=0;l<s;++l)if(null==(a=i.get(n[l](e))))for(t=0;t<u;++t,++c)e[h[c]]=o;else for(t=0;t<u;++t,++c)e[h[c]]=r[t](a)}):(h||oe("Missing output field names."),l=function(e){for(var t,r=0;r<s;++r)t=i.get(n[r](e)),e[h[r]]=null==t?o:t}),a?d=t.reflow(!0):(c=n.some((e=>t.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,l),d.modifies(h)}}),ft($u,Xa),ft(Du,Xa),ft(Mu,ps,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),Cu.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:Cl,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},ft(Cu,jl,{_transform:jl.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=te(n).concat(te(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(Qe),t?r.slice(0,t):r}(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return K((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)}}),ft(Fu,su,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(Ra(e),n,t,e);return(e.modified("field")||i&&t.modified(te(i)))&&oe("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(La(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}}),Ou.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ft(Ou,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=eu(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r<o;++r)t[i[r]]=n[r](e);return t}(e,t,i,r):ja;let a;return this.value?a=this.value:(t=t.addAll(),a=this.value={}),t.visit(t.REM,(e=>{const t=Ra(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,La({}));a[Ra(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[Ra(e)]))})),n}}),ft(Nu,ps,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),Tu.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"]}]},ft(Tu,ps,{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=tu(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(ee),a=[],s=e.step||.01,l=e.probs||El(s/2,1-1e-14,s),u=l.length;return r.forEach((e=>{const t=Ss(e,l);for(let n=0;n<u;++n){const r={};for(let t=0;t<o.length;++t)r[o[t]]=e.dims[t];r[i[0]]=l[n],r[i[1]]=t[n],a.push(La(r))}})),this.value&&(n.rem=this.value),this.value=n.add=n.source=a,n}}),ft(zu,ps,{transform(e,t){let n,i;return this.value?i=this.value:(n=t=t.addAll(),i=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,(e=>{const t=Ra(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Ba(e);i[Ra(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[Ra(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),Ru.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ft(Ru,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[Ra(t)]=1,e)),{});let a=this.value,s=this.count,l=0;function u(e){let t,i;a.length<r?a.push(e):(i=~~((s+1)*Os()),i<a.length&&i>=l&&(t=a[i],o[Ra(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=Ra(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[Ra(e)]))),(t.rem.length||i)&&a.length<r&&t.source&&(l=s=a.length,t.visit(t.SOURCE,(e=>{o[Ra(e)]||u(e)})),l=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t<e;++t)o[Ra(a[t])]=-1,n.rem.push(a[t]);a=a.slice(e)}return t.mod.length&&t.visit(t.MOD,(e=>{o[Ra(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=a.filter((e=>!o[Ra(e)]))),this.count=s,this.value=n.source=a,n}}),Pu.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"}]},ft(Pu,ps,{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=El(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,La(t)})),n.add=t.add.concat(this.value),n}}),ft(Lu,ps,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const ju=["unit0","unit1"];function Iu(e){ps.call(this,ut(),e)}function Uu(e){ps.call(this,null,e)}Bu.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:wi,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:ju}]},ft(Bu,ps,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?Zi:Qi)(o.unit).offset,s=e.as||ju,l=s[0],u=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(te(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[l]=null,i&&(e[u]=null)):(e[l]=r=s=o(t),i&&(e[u]=s=a(r,c)),r<f&&(f=r),s>d&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:l)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:pr({extent:e.extent||rt(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=Ei(i),a=this.value||{},s=(n?Vi:Hi)(o,r);return s.unit=De(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),ft(Iu,ps,{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()}}),ft(Uu,ps,{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(Ua(e.sort)):t.source).map(e.field))}});const qu={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=qu.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(e<r){for(;r+1<n.length&&!i(n[r],n[r+1]);)++r;e=r}return(1+e)/n.length}}},ntile:function(e,t){(t=+t)>0||oe("ntile num must be greater than zero.");const n=qu.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 i<r.length?e(r[i]):null}}},first_value:function(e){return{next:t=>e(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||oe("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return i<n.i1?e(n.data[i]):null}}},prev_value:function(e){let t;return{init:()=>t=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;n<i;++n)if(null!=e(t[n]))return n;return-1}(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}},Wu=Object.keys(qu);function Hu(e){const t=Ge(e.ops),n=Ge(e.fields),i=Ge(e.params),r=Ge(e.as),o=this.outputs=[],a=this.windows=[],s={},l={},u=[],c=[];let f=!0;function d(e){Ge(te(e)).forEach((e=>s[e]=1))}d(e.sort),t.forEach(((e,t)=>{const s=n[t],h=ee(s),p=Al(e,h,r[t]);if(d(s),o.push(p),st(qu,e))a.push(function(e,t,n,i){const r=qu[e](t,n);return{init:r.init||ce,update:function(e,t){t[i]=r.next(e)}}}(e,n[t],i[t],p));else{if(null==s&&"count"!==e&&oe("Null aggregate field specified."),"count"===e)return void u.push(p);f=!1;let t=l[h];t||(t=l[h]=[],t.field=s,c.push(t)),t.push(Fl(e,p))}})),(u.length||c.length)&&(this.cell=function(e,t,n){e=e.map((e=>Pl(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;a<r;++a)o[a]=new e[a](i);if(i.store)var s=i.data=new Ll;return i.add=function(e){if(i.num+=1,!n){s&&s.add(e);for(let t=0;t<r;++t)o[t].add(o[t].get(e),e)}},i.rem=function(e){if(i.num-=1,!n){s&&s.rem(e);for(let t=0;t<r;++t)o[t].rem(o[t].get(e),e)}},i.set=function(e){let r,a;for(s&&s.values(),r=0,a=t.length;r<a;++r)e[t[r]]=i.num;if(!n)for(r=0,a=o.length;r<a;++r)o[r].set(e)},i.init=function(){i.num=0,s&&s.reset();for(let e=0;e<r;++e)o[e].init()},i}(c,u,f)),this.inputs=Object.keys(s)}const Gu=Hu.prototype;function Yu(e){ps.call(this,{},e),this._mlen=0,this._mods=[]}function Vu(e,t,n,i){const r=i.sort,o=r&&!i.ignorePeers,a=i.frame||[null,0],s=e.data(n),l=s.length,u=o?ui(r):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:s,compare:r||tt(-1)};t.init();for(let e=0;e<l;++e)Xu(c,a,e,l),o&&Ju(c,u),t.update(c,s[e])}function Xu(e,t,n,i){e.p0=e.i0,e.p1=e.i1,e.i0=null==t[0]?0:Math.max(0,n-Math.abs(t[0])),e.i1=null==t[1]?i:Math.min(i,n+Math.abs(t[1])+1),e.index=n}function Ju(e,t){const n=e.i0,i=e.i1-1,r=e.compare,o=e.data,a=o.length-1;n>0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),i<a&&!r(o[i],o[i+1])&&(e.i1=t.right(o,o[i]))}function Qu(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Zu(e){this._context=e}function Ku(){}function ec(e){this._context=e}function tc(e){this._context=e}function nc(e,t){this._basis=new Zu(e),this._beta=t}Gu.init=function(){this.windows.forEach((e=>e.init())),this.cell&&this.cell.init()},Gu.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;a<e.i0;++a)n.rem(r[a]);for(a=e.p1;a<e.i1;++a)n.add(r[a]);n.set(t)}for(a=0;a<o;++a)i[a].update(e,t)},Yu.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Wu.concat(Cl)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},ft(Yu,ps,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),i=Ua(e.sort),r=$l(e.groupby),o=e=>this.group(r(e));let a=this.state;a&&!n||(a=this.state=new Hu(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 t=0,n=this._mlen;t<n;++t)Vu(this._mods[t],a,i,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(a.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=Ul(Ra),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}}),Zu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Qu(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Qu(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},ec.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Qu(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},tc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:Qu(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},nc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var i,r=e[0],o=t[0],a=e[n]-r,s=t[n]-o,l=-1;++l<=n;)i=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+i*a),this._beta*t[l]+(1-this._beta)*(o+i*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const ic=function e(t){function n(e){return 1===t?new Zu(e):new nc(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function rc(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function oc(e,t){this._context=e,this._k=(1-t)/6}oc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:rc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const ac=function e(t){function n(e){return new oc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function sc(e,t){this._context=e,this._k=(1-t)/6}sc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const lc=function e(t){function n(e){return new sc(e,t)}return n.tension=function(t){return e(+t)},n}(0);function uc(e,t){this._context=e,this._k=(1-t)/6}uc.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:rc(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const cc=function e(t){function n(e){return new uc(e,t)}return n.tension=function(t){return e(+t)},n}(0),fc=Math.abs,dc=Math.atan2,hc=Math.cos,pc=Math.max,mc=Math.min,gc=Math.sin,yc=Math.sqrt,vc=1e-12,bc=Math.PI,xc=bc/2,_c=2*bc;function wc(e){return e>=1?xc:e<=-1?-xc:Math.asin(e)}function kc(e,t,n){var i=e._x1,r=e._y1,o=e._x2,a=e._y2;if(e._l01_a>vc){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,r=(r*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>vc){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*u+e._x1*e._l23_2a-t*e._l12_2a)/c,a=(a*u+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(i,r,o,a,e._x2,e._y2)}function Ec(e,t){this._context=e,this._alpha=t}Ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const $c=function e(t){function n(e){return t?new Ec(e,t):new oc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Ac(e,t){this._context=e,this._alpha=t}Ac.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Dc=function e(t){function n(e){return t?new Ac(e,t):new uc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Sc(e,t){this._context=e,this._alpha=t}Sc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:kc(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Mc=function e(t){function n(e){return t?new Sc(e,t):new sc(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Cc(e){this._context=e}function Fc(e){return new Cc(e)}function Oc(e){this._context=e}function Nc(e){return e<0?-1:1}function Tc(e,t,n){var i=e._x1-e._x0,r=t-e._x1,o=(e._y1-e._y0)/(i||r<0&&-0),a=(n-e._y1)/(r||i<0&&-0),s=(o*r+a*i)/(i+r);return(Nc(o)+Nc(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function zc(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Rc(e,t,n){var i=e._x0,r=e._y0,o=e._x1,a=e._y1,s=(o-i)/3;e._context.bezierCurveTo(i+s,r+s*t,o-s,a-s*n,o,a)}function Pc(e){this._context=e}function Lc(e){this._context=new Bc(e)}function Bc(e){this._context=e}function jc(e){this._context=e}function Ic(e){var t,n,i=e.length-1,r=new Array(i),o=new Array(i),a=new Array(i);for(r[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t<i-1;++t)r[t]=1,o[t]=4,a[t]=4*e[t]+2*e[t+1];for(r[i-1]=2,o[i-1]=7,a[i-1]=8*e[i-1]+e[i],t=1;t<i;++t)n=r[t]/o[t-1],o[t]-=n,a[t]-=n*a[t-1];for(r[i-1]=a[i-1]/o[i-1],t=i-2;t>=0;--t)r[t]=(a[t]-r[t+1])/o[t];for(o[i-1]=(e[i]+r[i-1])/2,t=0;t<i-1;++t)o[t]=2*e[t+1]-r[t+1];return[r,o]}function Uc(e,t){this._context=e,this._t=t}function qc(e){return function(){return e}}Cc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}},Oc.prototype={areaStart:Ku,areaEnd:Ku,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},Pc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Rc(this,this._t0,zc(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Rc(this,zc(this,n=Tc(this,e,t)),n);break;default:Rc(this,this._t0,n=Tc(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Lc.prototype=Object.create(Pc.prototype)).point=function(e,t){Pc.prototype.point.call(this,t,e)},Bc.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,i,r,o){this._context.bezierCurveTo(t,e,i,n,o,r)}},jc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var i=Ic(e),r=Ic(t),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(i[0][o],r[0][o],i[1][o],r[1][o],e[a],t[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},Uc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};const Wc=Math.PI,Hc=2*Wc,Gc=1e-6,Yc=Hc-Gc;function Vc(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class Xc{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?Vc:function(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Vc;const n=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;t<i;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,i){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,t,n,i,r,o){this._append`C${+e},${+t},${+n},${+i},${this._x1=+r},${this._y1=+o}`}arcTo(e,t,n,i,r){if(e=+e,t=+t,n=+n,i=+i,(r=+r)<0)throw new Error(`negative radius: ${r}`);let o=this._x1,a=this._y1,s=n-e,l=i-t,u=o-e,c=a-t,f=u*u+c*c;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(f>Gc)if(Math.abs(c*s-l*u)>Gc&&r){let d=n-o,h=i-a,p=s*s+l*l,m=d*d+h*h,g=Math.sqrt(p),y=Math.sqrt(f),v=r*Math.tan((Wc-Math.acos((p+f-m)/(2*g*y)))/2),b=v/y,x=v/g;Math.abs(b-1)>Gc&&this._append`L${e+b*u},${t+b*c}`,this._append`A${r},${r},0,0,${+(c*d>u*h)},${this._x1=e+x*s},${this._y1=t+x*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,i,r,o){if(e=+e,t=+t,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),s=n*Math.sin(i),l=e+a,u=t+s,c=1^o,f=o?i-r:r-i;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Gc||Math.abs(this._y1-u)>Gc)&&this._append`L${l},${u}`,n&&(f<0&&(f=f%Hc+Hc),f>Yc?this._append`A${n},${n},0,1,${c},${e-a},${t-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:f>Gc&&this._append`A${n},${n},0,${+(f>=Wc)},${c},${this._x1=e+n*Math.cos(r)},${this._y1=t+n*Math.sin(r)}`)}rect(e,t,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Jc(){return new Xc}function Qc(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Xc(t)}function Zc(e){return e.innerRadius}function Kc(e){return e.outerRadius}function ef(e){return e.startAngle}function tf(e){return e.endAngle}function nf(e){return e&&e.padAngle}function rf(e,t,n,i,r,o,a){var s=e-n,l=t-i,u=(a?o:-o)/yc(s*s+l*l),c=u*l,f=-u*s,d=e+c,h=t+f,p=n+c,m=i+f,g=(d+p)/2,y=(h+m)/2,v=p-d,b=m-h,x=v*v+b*b,_=r-o,w=d*m-p*h,k=(b<0?-1:1)*yc(pc(0,_*_*x-w*w)),E=(w*b-v*k)/x,$=(-w*v-b*k)/x,A=(w*b+v*k)/x,D=(-w*v+b*k)/x,S=E-g,M=$-y,C=A-g,F=D-y;return S*S+M*M>C*C+F*F&&(E=A,$=D),{cx:E,cy:$,x01:-c,y01:-f,x11:E*(r/_-1),y11:$*(r/_-1)}}function of(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function af(e){return e[0]}function sf(e){return e[1]}function lf(e,t){var n=qc(!0),i=null,r=Fc,o=null,a=Qc(s);function s(s){var l,u,c,f=(s=of(s)).length,d=!1;for(null==i&&(o=r(c=a())),l=0;l<=f;++l)!(l<f&&n(u=s[l],l,s))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(u,l,s),+t(u,l,s));if(c)return o=null,c+""||null}return e="function"==typeof e?e:void 0===e?af:qc(e),t="function"==typeof t?t:void 0===t?sf:qc(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:qc(!!e),s):n},s.curve=function(e){return arguments.length?(r=e,null!=i&&(o=r(i)),s):r},s.context=function(e){return arguments.length?(null==e?i=o=null:o=r(i=e),s):i},s}function uf(e,t,n){var i=null,r=qc(!0),o=null,a=Fc,s=null,l=Qc(u);function u(u){var c,f,d,h,p,m=(u=of(u)).length,g=!1,y=new Array(m),v=new Array(m);for(null==o&&(s=a(p=l())),c=0;c<=m;++c){if(!(c<m&&r(h=u[c],c,u))===g)if(g=!g)f=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),d=c-1;d>=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,u),v[c]=+t(h,c,u),s.point(i?+i(h,c,u):y[c],n?+n(h,c,u):v[c]))}if(p)return s=null,p+""||null}function c(){return lf().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?af:qc(+e),t="function"==typeof t?t:qc(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?sf:qc(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:qc(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:qc(+e),u):n},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(n)},u.lineX1=function(){return c().x(i).y(t)},u.defined=function(e){return arguments.length?(r="function"==typeof e?e:qc(!!e),u):r},u.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),u):a},u.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),u):o},u}Jc.prototype=Xc.prototype,Array.prototype.slice,yc(3);const cf={draw(e,t){const n=yc(t/bc);e.moveTo(n,0),e.arc(0,0,n,0,_c)}};yc(1/3),gc(bc/10),gc(7*bc/10);function ff(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}gc(_c/10),hc(_c/10),yc(3),yc(3),yc(3),yc(12);const df=()=>"undefined"!=typeof Image?Image:null,hf=ui(si),pf=hf.right,mf=hf.left,gf=(ui(ks).center,pf);function yf(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function vf(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function bf(){}var xf=.7,_f=1/xf,wf="\\s*([+-]?\\d+)\\s*",kf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ef="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$f=/^#([0-9a-f]{3,8})$/,Af=new RegExp(`^rgb\\(${wf},${wf},${wf}\\)$`),Df=new RegExp(`^rgb\\(${Ef},${Ef},${Ef}\\)$`),Sf=new RegExp(`^rgba\\(${wf},${wf},${wf},${kf}\\)$`),Mf=new RegExp(`^rgba\\(${Ef},${Ef},${Ef},${kf}\\)$`),Cf=new RegExp(`^hsl\\(${kf},${Ef},${Ef}\\)$`),Ff=new RegExp(`^hsla\\(${kf},${Ef},${Ef},${kf}\\)$`),Of={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Nf(){return this.rgb().formatHex()}function Tf(){return this.rgb().formatRgb()}function zf(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=$f.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Rf(t):3===n?new jf(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Pf(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Pf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Af.exec(e))?new jf(t[1],t[2],t[3],1):(t=Df.exec(e))?new jf(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Sf.exec(e))?Pf(t[1],t[2],t[3],t[4]):(t=Mf.exec(e))?Pf(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Cf.exec(e))?Gf(t[1],t[2]/100,t[3]/100,1):(t=Ff.exec(e))?Gf(t[1],t[2]/100,t[3]/100,t[4]):Of.hasOwnProperty(e)?Rf(Of[e]):"transparent"===e?new jf(NaN,NaN,NaN,0):null}function Rf(e){return new jf(e>>16&255,e>>8&255,255&e,1)}function Pf(e,t,n,i){return i<=0&&(e=t=n=NaN),new jf(e,t,n,i)}function Lf(e){return e instanceof bf||(e=zf(e)),e?new jf((e=e.rgb()).r,e.g,e.b,e.opacity):new jf}function Bf(e,t,n,i){return 1===arguments.length?Lf(e):new jf(e,t,n,null==i?1:i)}function jf(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function If(){return`#${Hf(this.r)}${Hf(this.g)}${Hf(this.b)}`}function Uf(){const e=qf(this.opacity);return`${1===e?"rgb(":"rgba("}${Wf(this.r)}, ${Wf(this.g)}, ${Wf(this.b)}${1===e?")":`, ${e})`}`}function qf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hf(e){return((e=Wf(e))<16?"0":"")+e.toString(16)}function Gf(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Xf(e,t,n,i)}function Yf(e){if(e instanceof Xf)return new Xf(e.h,e.s,e.l,e.opacity);if(e instanceof bf||(e=zf(e)),!e)return new Xf;if(e instanceof Xf)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),o=Math.max(t,n,i),a=NaN,s=o-r,l=(o+r)/2;return s?(a=t===o?(n-i)/s+6*(n<i):n===o?(i-t)/s+2:(t-n)/s+4,s/=l<.5?o+r:2-o-r,a*=60):s=l>0&&l<1?0:a,new Xf(a,s,l,e.opacity)}function Vf(e,t,n,i){return 1===arguments.length?Yf(e):new Xf(e,t,n,null==i?1:i)}function Xf(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Jf(e){return(e=(e||0)%360)<0?e+360:e}function Qf(e){return Math.max(0,Math.min(1,e||0))}function Zf(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Kf(e,t,n,i,r){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*n+(1+3*e+3*o-3*a)*i+a*r)/6}function ed(e){var t=e.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[i],o=e[i+1],a=i>0?e[i-1]:2*r-o,s=i<t-1?e[i+2]:2*o-r;return Kf((n-i/t)*t,a,r,o,s)}}function td(e){var t=e.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*t),r=e[(i+t-1)%t],o=e[i%t],a=e[(i+1)%t],s=e[(i+2)%t];return Kf((n-i/t)*t,r,o,a,s)}}yf(bf,zf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Nf,formatHex:Nf,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Yf(this).formatHsl()},formatRgb:Tf,toString:Tf}),yf(jf,Bf,vf(bf,{brighter(e){return e=null==e?_f:Math.pow(_f,e),new jf(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?xf:Math.pow(xf,e),new jf(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new jf(Wf(this.r),Wf(this.g),Wf(this.b),qf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:If,formatHex:If,formatHex8:function(){return`#${Hf(this.r)}${Hf(this.g)}${Hf(this.b)}${Hf(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Uf,toString:Uf})),yf(Xf,Vf,vf(bf,{brighter(e){return e=null==e?_f:Math.pow(_f,e),new Xf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?xf:Math.pow(xf,e),new Xf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new jf(Zf(e>=240?e-240:e+120,r,i),Zf(e,r,i),Zf(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new Xf(Jf(this.h),Qf(this.s),Qf(this.l),qf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=qf(this.opacity);return`${1===e?"hsl(":"hsla("}${Jf(this.h)}, ${100*Qf(this.s)}%, ${100*Qf(this.l)}%${1===e?")":`, ${e})`}`}}));const nd=e=>()=>e;function id(e,t){return function(n){return e+n*t}}function rd(e,t){var n=t-e;return n?id(e,n>180||n<-180?n-360*Math.round(n/360):n):nd(isNaN(e)?t:e)}function od(e,t){var n=t-e;return n?id(e,n):nd(isNaN(e)?t:e)}const ad=function e(t){var n=function(e){return 1==(e=+e)?od:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):nd(isNaN(t)?n:t)}}(t);function i(e,t){var i=n((e=Bf(e)).r,(t=Bf(t)).r),r=n(e.g,t.g),o=n(e.b,t.b),a=od(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=r(t),e.b=o(t),e.opacity=a(t),e+""}}return i.gamma=e,i}(1);function sd(e){return function(t){var n,i,r=t.length,o=new Array(r),a=new Array(r),s=new Array(r);for(n=0;n<r;++n)i=Bf(t[n]),o[n]=i.r||0,a[n]=i.g||0,s[n]=i.b||0;return o=e(o),a=e(a),s=e(s),i.opacity=1,function(e){return i.r=o(e),i.g=a(e),i.b=s(e),i+""}}}var ld=sd(ed),ud=sd(td);function cd(e,t){t||(t=[]);var n,i=e?Math.min(t.length,e.length):0,r=t.slice();return function(o){for(n=0;n<i;++n)r[n]=e[n]*(1-o)+t[n]*o;return r}}function fd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dd(e,t){return(fd(t)?cd:hd)(e,t)}function hd(e,t){var n,i=t?t.length:0,r=e?Math.min(i,e.length):0,o=new Array(r),a=new Array(i);for(n=0;n<r;++n)o[n]=xd(e[n],t[n]);for(;n<i;++n)a[n]=t[n];return function(e){for(n=0;n<r;++n)a[n]=o[n](e);return a}}function pd(e,t){var n=new Date;return e=+e,t=+t,function(i){return n.setTime(e*(1-i)+t*i),n}}function md(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function gd(e,t){var n,i={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?i[n]=xd(e[n],t[n]):r[n]=t[n];return function(e){for(n in i)r[n]=i[n](e);return r}}var yd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vd=new RegExp(yd.source,"g");function bd(e,t){var n,i,r,o=yd.lastIndex=vd.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=yd.exec(e))&&(i=vd.exec(t));)(r=i.index)>o&&(r=t.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:md(n,i)})),o=vd.lastIndex;return o<t.length&&(r=t.slice(o),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,i=0;i<t;++i)s[(n=l[i]).i]=n.x(e);return s.join("")})}function xd(e,t){var n,i=typeof t;return null==t||"boolean"===i?nd(t):("number"===i?md:"string"===i?(n=zf(t))?(t=n,ad):bd:t instanceof zf?ad:t instanceof Date?pd:fd(t)?cd:Array.isArray(t)?hd:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?gd:md)(e,t)}function _d(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function wd(e){return+e}var kd=[0,1];function Ed(e){return e}function $d(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:function(e){return function(){return e}}(isNaN(t)?NaN:.5)}function Ad(e,t,n){var i=e[0],r=e[1],o=t[0],a=t[1];return r<i?(i=$d(r,i),o=n(a,o)):(i=$d(i,r),o=n(o,a)),function(e){return o(i(e))}}function Dd(e,t,n){var i=Math.min(e.length,t.length)-1,r=new Array(i),o=new Array(i),a=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++a<i;)r[a]=$d(e[a],e[a+1]),o[a]=n(t[a],t[a+1]);return function(t){var n=gf(e,t,1,i)-1;return o[n](r[n](t))}}function Sd(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Md(){var e,t,n,i,r,o,a=kd,s=kd,l=xd,u=Ed;function c(){var e=Math.min(a.length,s.length);return u!==Ed&&(u=function(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(a[0],a[e-1])),i=e>2?Dd:Ad,r=o=null,f}function f(t){return null==t||isNaN(t=+t)?n:(r||(r=i(a.map(e),s,l)))(e(u(t)))}return f.invert=function(n){return u(t((o||(o=i(s,a.map(e),md)))(n)))},f.domain=function(e){return arguments.length?(a=Array.from(e,wd),c()):a.slice()},f.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},f.rangeRound=function(e){return s=Array.from(e),l=_d,c()},f.clamp=function(e){return arguments.length?(u=!!e||Ed,c()):u!==Ed},f.interpolate=function(e){return arguments.length?(l=e,c()):l},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,i){return e=n,t=i,c()}}function Cd(){return Md()(Ed,Ed)}function Fd(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Od(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}function Nd(e,t,n,i){var r,o=rn(e,t,n);switch((i=sn(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(r=fn(o,a))||(i.precision=r),bn(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(r=dn(o,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=r-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(r=hn(o))||(i.precision=r-2*("%"===i.type))}return vn(i)}function Td(e){var t=e.domain;return e.ticks=function(e){var n=t();return tn(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var i=t();return Nd(i[0],i[i.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var i,r,o=t(),a=0,s=o.length-1,l=o[a],u=o[s],c=10;for(u<l&&(r=l,l=u,u=r,r=a,a=s,s=r);c-- >0;){if((r=nn(l,u,n))===i)return o[a]=l,o[s]=u,t(o);if(r>0)l=Math.floor(l/r)*r,u=Math.ceil(u/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,u=Math.floor(u*r)/r}i=r}return e},e}function zd(e,t){var n,i=0,r=(e=e.slice()).length-1,o=e[i],a=e[r];return a<o&&(n=i,i=r,r=n,n=o,o=a,a=n),e[i]=t.floor(o),e[r]=t.ceil(a),e}function Rd(e){return Math.log(e)}function Pd(e){return Math.exp(e)}function Ld(e){return-Math.log(-e)}function Bd(e){return-Math.exp(-e)}function jd(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Id(e){return(t,n)=>-e(-t,n)}function Ud(e){const t=e(Rd,Pd),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?jd:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=Id(i),r=Id(r),e(Ld,Bd)):e(Rd,Pd),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 l=s<a;l&&([a,s]=[s,a]);let u,c,f=i(a),d=i(s);const h=null==e?10:+e;let p=[];if(!(o%1)&&d-f<h){if(f=Math.floor(f),d=Math.ceil(d),a>0){for(;f<=d;++f)for(u=1;u<o;++u)if(c=f<0?u/r(-f):u*r(f),!(c<a)){if(c>s)break;p.push(c)}}else for(;f<=d;++f)for(u=o-1;u>=1;--u)if(c=f>0?u/r(-f):u*r(f),!(c<a)){if(c>s)break;p.push(c)}2*p.length<h&&(p=tn(a,s,h))}else p=tn(f,d,Math.min(d-f,h)).map(r);return l?p.reverse():p},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=sn(n)).precision||(n.trim=!0),n=vn(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*o<o-.5&&(t*=o),t<=a?n(e):""}},t.nice=()=>n(zd(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function qd(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Wd(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Hd(e){return e<0?-e*e:e*e}function Gd(e){var t=e(Ed,Ed),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(Ed,Ed):.5===n?e(Wd,Hd):e(qd(n),qd(1/n)):n},Td(t)}function Yd(){var e=Gd(Md());return e.copy=function(){return Sd(e,Yd()).exponent(e.exponent())},Fd.apply(e,arguments),e}function Vd(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Xd(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Jd(e){var t=1,n=e(Vd(t),Xd(t));return n.constant=function(n){return arguments.length?e(Vd(t=+n),Xd(t)):t},Td(n)}function Qd(e,t,n,i,r,o){const a=[[oi,1,An],[oi,5,5e3],[oi,15,15e3],[oi,30,3e4],[o,1,Dn],[o,5,3e5],[o,15,9e5],[o,30,18e5],[r,1,Sn],[r,3,108e5],[r,6,216e5],[r,12,432e5],[i,1,Mn],[i,2,1728e5],[n,1,Cn],[t,1,2592e6],[t,3,7776e6],[e,1,Fn]];function s(t,n,i){const r=Math.abs(n-t)/i,o=ui((([,,e])=>e)).right(a,r);if(o===a.length)return e.every(rn(t/Fn,n/Fn,i));if(0===o)return ai.every(Math.max(rn(t,n,i),1));const[s,l]=a[r/a[o-1][2]<a[o][2]/r?o-1:o];return s.every(l)}return[function(e,t,n){const i=t<e;i&&([e,t]=[t,e]);const r=n&&"function"==typeof n.range?n:s(e,t,n),o=r?r.range(e,+t+1):[];return i?o.reverse():o},s]}const[Zd,Kd]=Qd(Zn,ei,Wn,Tn,ni,ri),[eh,th]=Qd(Qn,Kn,Rn,On,ti,ii);function nh(e){return new Date(e)}function ih(e){return e instanceof Date?+e:+new Date(+e)}function rh(e,t,n,i,r,o,a,s,l,u){var c=Cd(),f=c.invert,d=c.domain,h=u(".%L"),p=u(":%S"),m=u("%I:%M"),g=u("%I %p"),y=u("%a %d"),v=u("%b %d"),b=u("%B"),x=u("%Y");function _(e){return(l(e)<e?h:s(e)<e?p:a(e)<e?m:o(e)<e?g:i(e)<e?r(e)<e?y:v:n(e)<e?b:x)(e)}return c.invert=function(e){return new Date(f(e))},c.domain=function(e){return arguments.length?d(Array.from(e,ih)):d().map(nh)},c.ticks=function(t){var n=d();return e(n[0],n[n.length-1],null==t?10:t)},c.tickFormat=function(e,t){return null==t?_:u(t)},c.nice=function(e){var n=d();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?d(zd(n,e)):c},c.copy=function(){return Sd(c,rh(e,t,n,i,r,o,a,s,l,u))},c}function oh(){var e,t,n,i,r,o=0,a=1,s=Ed,l=!1;function u(t){return null==t||isNaN(t=+t)?r:s(0===n?.5:(t=(i(t)-e)*n,l?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),u):[s(0),s(1)]}}return u.domain=function(r){return arguments.length?([o,a]=r,e=i(o=+o),t=i(a=+a),n=e===t?0:1/(t-e),u):[o,a]},u.clamp=function(e){return arguments.length?(l=!!e,u):l},u.interpolator=function(e){return arguments.length?(s=e,u):s},u.range=c(xd),u.rangeRound=c(_d),u.unknown=function(e){return arguments.length?(r=e,u):r},function(r){return i=r,e=r(o),t=r(a),n=e===t?0:1/(t-e),u}}function ah(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function sh(){var e=Td(oh()(Ed));return e.copy=function(){return ah(e,sh())},Od.apply(e,arguments)}function lh(){var e=Gd(oh());return e.copy=function(){return ah(e,lh()).exponent(e.exponent())},Od.apply(e,arguments)}function uh(e,t){void 0===t&&(t=e,e=xd);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);n<i;)o[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return o[t](e-t)}}function ch(){var e,t,n,i,r,o,a,s=0,l=.5,u=1,c=1,f=Ed,d=!1;function h(e){return isNaN(e=+e)?a:(e=.5+((e=+o(e))-t)*(c*e<c*t?i:r),f(d?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,i,r;return arguments.length?([n,i,r]=t,f=uh(e,[n,i,r]),h):[f(0),f(.5),f(1)]}}return h.domain=function(a){return arguments.length?([s,l,u]=a,e=o(s=+s),t=o(l=+l),n=o(u=+u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h):[s,l,u]},h.clamp=function(e){return arguments.length?(d=!!e,h):d},h.interpolator=function(e){return arguments.length?(f=e,h):f},h.range=p(xd),h.rangeRound=p(_d),h.unknown=function(e){return arguments.length?(a=e,h):a},function(a){return o=a,e=a(s),t=a(l),n=a(u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h}}function fh(){var e=Gd(ch());return e.copy=function(){return ah(e,fh()).exponent(e.exponent())},Od.apply(e,arguments)}class dh extends Map{constructor(e,t=yh){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(ph(this,e))}has(e){return super.has(ph(this,e))}set(e,t){return super.set(mh(this,e),t)}delete(e){return super.delete(gh(this,e))}}class hh extends Set{constructor(e,t=yh){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const t of e)this.add(t)}has(e){return super.has(ph(this,e))}add(e){return super.add(mh(this,e))}delete(e){return super.delete(gh(this,e))}}function ph({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):n}function mh({_intern:e,_key:t},n){const i=t(n);return e.has(i)?e.get(i):(e.set(i,n),n)}function gh({_intern:e,_key:t},n){const i=t(n);return e.has(i)&&(n=e.get(i),e.delete(i)),n}function yh(e){return null!==e&&"object"==typeof e?e.valueOf():e}const vh=Symbol("implicit");function bh(){var e=new dh,t=[],n=[],i=vh;function r(r){let o=e.get(r);if(void 0===o){if(i!==vh)return i;e.set(r,o=t.push(r)-1)}return n[o%n.length]}return r.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new dh;for(const i of n)e.has(i)||e.set(i,t.push(i)-1);return r},r.range=function(e){return arguments.length?(n=Array.from(e),r):n.slice()},r.unknown=function(e){return arguments.length?(i=e,r):i},r.copy=function(){return bh(t,n).unknown(i)},Fd.apply(r,arguments),r}function xh(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function _h(e,t){var n=rd(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}}var wh,kh=180/Math.PI,Eh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $h(e,t,n,i,r,o){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*i)&&(n-=e*l,i-=t*l),(s=Math.sqrt(n*n+i*i))&&(n/=s,i/=s,l/=s),e*i<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:o,rotate:Math.atan2(t,e)*kh,skewX:Math.atan(l)*kh,scaleX:a,scaleY:s}}function Ah(e,t,n,i){function r(e){return e.length?e.pop()+" ":""}return function(o,a){var s=[],l=[];return o=e(o),a=e(a),function(e,i,r,o,a,s){if(e!==r||i!==o){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:md(e,r)},{i:l-2,x:md(i,o)})}else(r||o)&&a.push("translate("+r+t+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(e,t,n,o){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(r(n)+"rotate(",null,i)-2,x:md(e,t)})):t&&n.push(r(n)+"rotate("+t+i)}(o.rotate,a.rotate,s,l),function(e,t,n,o){e!==t?o.push({i:n.push(r(n)+"skewX(",null,i)-2,x:md(e,t)}):t&&n.push(r(n)+"skewX("+t+i)}(o.skewX,a.skewX,s,l),function(e,t,n,i,o,a){if(e!==n||t!==i){var s=o.push(r(o)+"scale(",null,",",null,")");a.push({i:s-4,x:md(e,n)},{i:s-2,x:md(t,i)})}else 1===n&&1===i||o.push(r(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(e){for(var t,n=-1,i=l.length;++n<i;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var Dh=Ah((function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Eh:$h(t.a,t.b,t.c,t.d,t.e,t.f)}),"px, ","px)","deg)"),Sh=Ah((function(e){return null==e?Eh:(wh||(wh=document.createElementNS("http://www.w3.org/2000/svg","g")),wh.setAttribute("transform",e),(e=wh.transform.baseVal.consolidate())?$h((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Eh)}),", ",")",")");function Mh(e){return((e=Math.exp(e))+1/e)/2}const Ch=function e(t,n,i){function r(e,r){var o,a,s=e[0],l=e[1],u=e[2],c=r[0],f=r[1],d=r[2],h=c-s,p=f-l,m=h*h+p*p;if(m<1e-12)a=Math.log(d/u)/t,o=function(e){return[s+e*h,l+e*p,u*Math.exp(t*e*a)]};else{var g=Math.sqrt(m),y=(d*d-u*u+i*m)/(2*u*n*g),v=(d*d-u*u-i*m)/(2*d*n*g),b=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);a=(x-b)/t,o=function(e){var i=e*a,r=Mh(b),o=u/(n*g)*(r*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*i+b)-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+o*h,l+o*p,u*r/Mh(t*i+b)]}}return o.duration=1e3*a*t/Math.SQRT2,o}return r.rho=function(t){var n=Math.max(.001,+t),i=n*n;return e(n,i,i*i)},r}(Math.SQRT2,2,4);function Fh(e){return function(t,n){var i=e((t=Vf(t)).h,(n=Vf(n)).h),r=od(t.s,n.s),o=od(t.l,n.l),a=od(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+""}}}const Oh=Fh(rd);var Nh=Fh(od);const Th=Math.PI/180,zh=180/Math.PI,Rh=.96422,Ph=1,Lh=.82521,Bh=4/29,jh=6/29,Ih=3*jh*jh,Uh=.008856451679035631;function qh(e){if(e instanceof Hh)return new Hh(e.l,e.a,e.b,e.opacity);if(e instanceof Qh)return Zh(e);e instanceof jf||(e=Lf(e));var t,n,i=Xh(e.r),r=Xh(e.g),o=Xh(e.b),a=Gh((.2225045*i+.7168786*r+.0606169*o)/Ph);return i===r&&r===o?t=n=a:(t=Gh((.4360747*i+.3850649*r+.1430804*o)/Rh),n=Gh((.0139322*i+.0971045*r+.7141733*o)/Lh)),new Hh(116*a-16,500*(t-a),200*(a-n),e.opacity)}function Wh(e,t,n,i){return 1===arguments.length?qh(e):new Hh(e,t,n,null==i?1:i)}function Hh(e,t,n,i){this.l=+e,this.a=+t,this.b=+n,this.opacity=+i}function Gh(e){return e>Uh?Math.pow(e,1/3):e/Ih+Bh}function Yh(e){return e>jh?e*e*e:Ih*(e-Bh)}function Vh(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Xh(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Jh(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof Qh)return new Qh(e.h,e.c,e.l,e.opacity);if(e instanceof Hh||(e=qh(e)),0===e.a&&0===e.b)return new Qh(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*zh;return new Qh(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}(e):new Qh(e,t,n,null==i?1:i)}function Qh(e,t,n,i){this.h=+e,this.c=+t,this.l=+n,this.opacity=+i}function Zh(e){if(isNaN(e.h))return new Hh(e.l,0,0,e.opacity);var t=e.h*Th;return new Hh(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Kh(e,t){var n=od((e=Wh(e)).l,(t=Wh(t)).l),i=od(e.a,t.a),r=od(e.b,t.b),o=od(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=o(t),e+""}}function ep(e){return function(t,n){var i=e((t=Jh(t)).h,(n=Jh(n)).h),r=od(t.c,n.c),o=od(t.l,n.l),a=od(t.opacity,n.opacity);return function(e){return t.h=i(e),t.c=r(e),t.l=o(e),t.opacity=a(e),t+""}}}yf(Hh,Wh,vf(bf,{brighter(e){return new Hh(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker(e){return new Hh(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new jf(Vh(3.1338561*(t=Rh*Yh(t))-1.6168667*(e=Ph*Yh(e))-.4906146*(n=Lh*Yh(n))),Vh(-.9787684*t+1.9161415*e+.033454*n),Vh(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),yf(Qh,Jh,vf(bf,{brighter(e){return new Qh(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker(e){return new Qh(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb(){return Zh(this).rgb()}}));const tp=ep(rd);var np=ep(od),ip=-.14861,rp=1.78277,op=-.29227,ap=-.90649,sp=1.97294,lp=sp*ap,up=sp*rp,cp=rp*op-ap*ip;function fp(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof dp)return new dp(e.h,e.s,e.l,e.opacity);e instanceof jf||(e=Lf(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(cp*i+lp*t-up*n)/(cp+lp-up),o=i-r,a=(sp*(n-r)-op*o)/ap,s=Math.sqrt(a*a+o*o)/(sp*r*(1-r)),l=s?Math.atan2(a,o)*zh-120:NaN;return new dp(l<0?l+360:l,s,r,e.opacity)}(e):new dp(e,t,n,null==i?1:i)}function dp(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function hp(e){return function t(n){function i(t,i){var r=e((t=fp(t)).h,(i=fp(i)).h),o=od(t.s,i.s),a=od(t.l,i.l),s=od(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)}yf(dp,fp,vf(bf,{brighter(e){return e=null==e?_f:Math.pow(_f,e),new dp(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?xf:Math.pow(xf,e),new dp(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Th,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new jf(255*(t+n*(ip*i+rp*r)),255*(t+n*(op*i+ap*r)),255*(t+n*(sp*i)),this.opacity)}}));const pp=hp(rd);var mp=hp(od);function gp(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}function yp(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}const vp="linear",bp="log",xp="pow",_p="sqrt",wp="symlog",kp="time",Ep="utc",$p="sequential",Ap="diverging",Dp="quantile",Sp="quantize",Mp="threshold",Cp="ordinal",Fp="point",Op="band",Np="bin-ordinal",Tp="continuous",zp="discrete",Rp="discretizing",Pp="interpolating",Lp="temporal";function Bp(){const e=bh().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,l=0,u=.5;function c(){const e=t().length,c=o[1]<o[0],f=o[1-c],d=yp(e,s,l);let h=o[c-0];i=(f-h)/(d||1),a&&(i=Math.floor(i)),h+=(f-h-i*(e-s))*u,r=i*(1-s),a&&(h=Math.round(h),r=Math.round(r));const p=El(e).map((e=>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?(l=Math.max(0,Math.min(1,e)),s=l,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?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]<o[0],a=i?n().reverse():n(),s=a.length-1;let l,u,c,f=+e[0],d=+e[1];return f!=f||d!=d||(d<f&&(c=f,f=d,d=c),d<a[0]||f>o[1-i])?void 0:(l=Math.max(0,pf(a,f)-1),u=f===d?l:pf(a,d)-1,f-a[l]>r+1e-10&&++l,i&&(c=l,l=s-u,u=s-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Bp().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(l).align(u)},c()}function jp(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return jp(t())},e}var Ip=Array.prototype.map;const Up=Array.prototype.slice,qp=new Map,Wp=Symbol("vega_scale");function Hp(e){return e[Wp]=!0,e}function Gp(e,t,n){return arguments.length>1?(qp.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<i&&(n=i,i=r,r=n),[e.invert(i),e.invert(r)]}}(n):n.invertExtent?function(e){return function(t){const n=e.range();let i,r,o,a,s=t[0],l=t[1],u=-1;for(l<s&&(r=s,s=l,l=r),o=0,a=n.length;o<a;++o)n[o]>=s&&n[o]<=l&&(u<0&&(u=o),i=o);if(!(u<0))return s=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,Hp(n)};return i.metadata=Ot(Ge(n)),i}(e,t,n)),this):Yp(e)?qp.get(e):void 0}function Yp(e){return qp.has(e)}function Vp(e,t){const n=qp.get(e);return n&&n.metadata[t]}function Xp(e){return Vp(e,Tp)}function Jp(e){return Vp(e,zp)}function Qp(e){return Vp(e,Rp)}function Zp(e){return Vp(e,bp)}function Kp(e){return Vp(e,Pp)}function em(e){return Vp(e,Dp)}Gp("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,wd),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,wd):[0,1],Td(i)})),Gp(vp,(function e(){var t=Cd();return t.copy=function(){return Sd(t,e())},Fd.apply(t,arguments),Td(t)}),Tp),Gp(bp,(function e(){const t=Ud(Md()).domain([1,10]);return t.copy=()=>Sd(t,e()).base(t.base()),Fd.apply(t,arguments),t}),[Tp,bp]),Gp(xp,Yd,Tp),Gp(_p,(function(){return Yd.apply(null,arguments).exponent(.5)}),Tp),Gp(wp,(function e(){var t=Jd(Md());return t.copy=function(){return Sd(t,e()).constant(t.constant())},Fd.apply(t,arguments)}),Tp),Gp(kp,(function(){return Fd.apply(rh(eh,th,Qn,Kn,Rn,On,ti,ii,oi,xr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Tp,Lp]),Gp(Ep,(function(){return Fd.apply(rh(Zd,Kd,Zn,ei,Wn,Nn,ni,ri,oi,wr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Tp,Lp]),Gp($p,sh,[Tp,Pp]),Gp(`${$p}-${vp}`,sh,[Tp,Pp]),Gp(`${$p}-${bp}`,(function e(){var t=Ud(oh()).domain([1,10]);return t.copy=function(){return ah(t,e()).base(t.base())},Od.apply(t,arguments)}),[Tp,Pp,bp]),Gp(`${$p}-${xp}`,lh,[Tp,Pp]),Gp(`${$p}-${_p}`,(function(){return lh.apply(null,arguments).exponent(.5)}),[Tp,Pp]),Gp(`${$p}-${wp}`,(function e(){var t=Jd(oh());return t.copy=function(){return ah(t,e()).constant(t.constant())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(`${Ap}-${vp}`,(function e(){var t=Td(ch()(Ed));return t.copy=function(){return ah(t,e())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(`${Ap}-${bp}`,(function e(){var t=Ud(ch()).domain([.1,1,10]);return t.copy=function(){return ah(t,e()).base(t.base())},Od.apply(t,arguments)}),[Tp,Pp,bp]),Gp(`${Ap}-${xp}`,fh,[Tp,Pp]),Gp(`${Ap}-${_p}`,(function(){return fh.apply(null,arguments).exponent(.5)}),[Tp,Pp]),Gp(`${Ap}-${wp}`,(function e(){var t=Jd(ch());return t.copy=function(){return ah(t,e()).constant(t.constant())},Od.apply(t,arguments)}),[Tp,Pp]),Gp(Dp,(function e(){var t,n=[],i=[],r=[];function o(){var e=0,t=Math.max(1,i.length);for(r=new Array(t-1);++e<t;)r[e-1]=$s(n,e/t);return a}function a(e){return null==e||isNaN(e=+e)?t:i[gf(r,e)]}return a.invertExtent=function(e){var t=i.indexOf(e);return t<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},a.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(si),o()},a.range=function(e){return arguments.length?(i=Array.from(e),o()):i.slice()},a.unknown=function(e){return arguments.length?(t=e,a):t},a.quantiles=function(){return r.slice()},a.copy=function(){return e().domain(n).range(i).unknown(t)},Fd.apply(a,arguments)}),[Rp,Dp]),Gp(Sp,(function e(){var t,n=0,i=1,r=1,o=[.5],a=[0,1];function s(e){return null!=e&&e<=e?a[gf(o,e,0,r)]:t}function l(){var e=-1;for(o=new Array(r);++e<r;)o[e]=((e+1)*i-(e-r)*n)/(r+1);return s}return s.domain=function(e){return arguments.length?([n,i]=e,n=+n,i=+i,l()):[n,i]},s.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,l()):a.slice()},s.invertExtent=function(e){var t=a.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,o[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)},Fd.apply(Td(s),arguments)}),Rp),Gp(Mp,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[gf(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)},Fd.apply(o,arguments)}),Rp),Gp(Np,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(gf(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return Ip.call(e,Se)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Up.call(e),i):n.slice()},i.tickFormat=function(e,n){return Nd(t[0],De(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[zp,Rp]),Gp(Cp,bh,zp),Gp(Op,Bp,zp),Gp(Fp,(function(){return jp(Bp().paddingInner(1))}),zp);const tm=["clamp","base","constant","exponent"];function nm(e,t){const n=t[0],i=De(t)-n;return function(t){return e(n+t*i)}}function im(e,t,n){return uh(am(t||"rgb",n),e)}function rm(e,t){const n=new Array(t),i=t+1;for(let r=0;r<t;)n[r]=e(++r/i);return n}function om(e,t,n){const i=n-t;let r,o,a;return i&&Number.isFinite(i)?(r=(o=e.type).indexOf("-"),o=r<0?o:o.slice(r+1),a=Gp(o)().domain([t,n]).range([0,1]),tm.forEach((t=>e[t]?a[t](e[t]()):0)),a):tt(.5)}function am(e,t){const n=a[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 sm(e){const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}function lm(e,t){for(const n in e)cm(n,t(e[n]))}const um={};function cm(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(um[e]=t,this):um[e]}lm({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},sm),lm({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=>im(sm(e))));const fm="symbol",dm="discrete",hm=e=>_e(e)?e.map((e=>String(e))):String(e),pm=(e,t)=>e[1]-t[1],mm=(e,t)=>t[1]-e[1];function gm(e,t,n){let i;return gt(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(At(e.domain())/n||1)))),we(t)&&(i=t.step,t=t.interval),vt(t)&&(t=e.type===kp?Qi(t):e.type==Ep?Zi(t):oe("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function ym(e,t,n){let i=e.range(),r=i[0],o=De(i),a=pm;if(r>o&&(i=o,o=r,r=i,a=mm),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],De(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function vm(e,t){return e.bins?ym(e,e.bins):e.ticks?e.ticks(t):e.domain()}function bm(e,t,n,i,r,o){const a=t.type;let s=hm;if(a===kp||r===kp)s=e.timeFormat(i);else if(a===Ep||r===Ep)s=e.utcFormat(i);else if(Zp(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=xm(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 xm(e,t,n){const i=vm(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*r<r-.5&&(t*=r),t<=a};return n?i.filter(s):s}const _m={[Dp]:"quantiles",[Sp]:"thresholds",[Mp]:"domain"},wm={[Dp]:"quantiles",[Sp]:"domain"};function km(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=De(e),t}(e.bins):e.type===bp?xm(e,t,!0):_m[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[_m[e.type]]()):vm(e,t)}const Em=e=>_m[e.type]||e.bins;function $m(e,t,n,i,r,o,a){const s=wm[t.type]&&o!==kp&&o!==Ep?function(e,t,n){const i=t[wm[t.type]](),r=i.length;let o,a=r>1?i[1]-i[0]:i[0];for(o=1;o<r;++o)a=Math.min(a,i[o]-i[o-1]);return e.formatSpan(0,a,30,n)}(e,t,r):bm(e,t,n,r,o,a);return i===fm&&Em(t)?Am(s):i===dm?Sm(s):Mm(s)}const Am=e=>(t,n,i)=>{const r=Dm(i[n+1],Dm(i.max,1/0)),o=Cm(t,e),a=Cm(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Dm=(e,t)=>null!=e?e:t,Sm=e=>(t,n)=>n?e(t):null,Mm=e=>t=>e(t),Cm=(e,t)=>Number.isFinite(e)?t(e):null;function Fm(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=function(e,t,n,i){const r=i||t.type;return vt(n)&&function(e){return Vp(e,Lp)}(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==kp?n||r!==Ep?$m(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}(e,t,n.format,n.formatType);if(Qp(t.type)){const e=km(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(Jp(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(De(e))}`}}let Om=0;const Nm="p_";function Tm(e){return e&&e.gradient}function zm(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?Nm:"";return r||(r=e.id="gradient_"+Om++,"radial"===i?(e.x1=Rm(e.x1,.5),e.y1=Rm(e.y1,.5),e.r1=Rm(e.r1,0),e.x2=Rm(e.x2,.5),e.y2=Rm(e.y2,.5),e.r2=Rm(e.r2,.5),o=Nm):(e.x1=Rm(e.x1,0),e.y1=Rm(e.y1,0),e.x2=Rm(e.x2,1),e.y2=Rm(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Rm(e,t){return null!=e?e:t}function Pm(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 Lm={basis:{curve:function(e){return new Zu(e)}},"basis-closed":{curve:function(e){return new ec(e)}},"basis-open":{curve:function(e){return new tc(e)}},bundle:{curve:ic,tension:"beta",value:.85},cardinal:{curve:ac,tension:"tension",value:0},"cardinal-open":{curve:lc,tension:"tension",value:0},"cardinal-closed":{curve:cc,tension:"tension",value:0},"catmull-rom":{curve:$c,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Dc,tension:"alpha",value:.5},"catmull-rom-open":{curve:Mc,tension:"alpha",value:.5},linear:{curve:Fc},"linear-closed":{curve:function(e){return new Oc(e)}},monotone:{horizontal:function(e){return new Lc(e)},vertical:function(e){return new Pc(e)}},natural:{curve:function(e){return new jc(e)}},step:{curve:function(e){return new Uc(e,.5)}},"step-after":{curve:function(e){return new Uc(e,1)}},"step-before":{curve:function(e){return new Uc(e,0)}}};function Bm(e,t,n){var i=st(Lm,e)&&Lm[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const jm={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Im=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Um=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,qm=/^((\s+,?\s*)|(,\s*))/,Wm=/^[01]/;function Hm(e){const t=[];return(e.match(Im)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=jm[i],o=function(e,t,n){const i=[];for(let r=0;t&&r<n.length;)for(let o=0;o<t;++o){const t="a"!==e||3!==o&&4!==o?Um:Wm,a=n.slice(r).match(t);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");r+=a[0].length,i.push(+a[0]);const s=n.slice(r).match(qm);null!==s&&(r+=s[0].length)}return i}(i,r,e.slice(1).trim()),a=o.length;if(a<r||a&&a%r!=0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([n,...o.slice(0,r)]),a!==r){"m"===i&&(n="M"===n?"L":"l");for(let e=r;e<a;e+=r)t.push([n,...o.slice(e,e+r)])}})),t}const Gm=Math.PI/180,Ym=Math.PI/2,Vm=2*Math.PI,Xm=Math.sqrt(3)/2;var Jm={},Qm={},Zm=[].join;function Km(e){const t=Zm.call(e);if(Qm[t])return Qm[t];var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7];const c=u*a,f=-l*s,d=l*a,h=u*s,p=Math.cos(r),m=Math.sin(r),g=Math.cos(o),y=Math.sin(o),v=.5*(o-r),b=Math.sin(.5*v),x=8/3*b*b/Math.sin(v),_=n+p-x*m,w=i+m+x*p,k=n+g,E=i+y,$=k+x*y,A=E-x*g;return Qm[t]=[c*_+f*w,d*_+h*w,c*$+f*A,d*$+h*A,c*k+f*E,d*k+h*E]}const eg=["l",0,0,0,0,0,0,0];function tg(e,t,n){const i=eg[0]=e[0];if("a"===i||"A"===i)eg[1]=t*e[1],eg[2]=n*e[2],eg[3]=e[3],eg[4]=e[4],eg[5]=e[5],eg[6]=t*e[6],eg[7]=n*e[7];else if("h"===i||"H"===i)eg[1]=t*e[1];else if("v"===i||"V"===i)eg[1]=n*e[1];else for(var r=1,o=e.length;r<o;++r)eg[r]=(r%2==1?t:n)*e[r];return eg}function ng(e,t,n,i,r,o){var a,s,l,u,c,f=null,d=0,h=0,p=0,m=0,g=0,y=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==o&&(o=r),e.beginPath&&e.beginPath();for(var v=0,b=t.length;v<b;++v){switch(a=t[v],1===r&&1===o||(a=tg(a,r,o)),a[0]){case"l":d+=a[1],h+=a[2],e.lineTo(d+n,h+i);break;case"L":d=a[1],h=a[2],e.lineTo(d+n,h+i);break;case"h":d+=a[1],e.lineTo(d+n,h+i);break;case"H":d=a[1],e.lineTo(d+n,h+i);break;case"v":h+=a[1],e.lineTo(d+n,h+i);break;case"V":h=a[1],e.lineTo(d+n,h+i);break;case"m":g=d+=a[1],y=h+=a[2],e.moveTo(d+n,h+i);break;case"M":g=d=a[1],y=h=a[2],e.moveTo(d+n,h+i);break;case"c":s=d+a[5],l=h+a[6],p=d+a[3],m=h+a[4],e.bezierCurveTo(d+a[1]+n,h+a[2]+i,p+n,m+i,s+n,l+i),d=s,h=l;break;case"C":d=a[5],h=a[6],p=a[3],m=a[4],e.bezierCurveTo(a[1]+n,a[2]+i,p+n,m+i,d+n,h+i);break;case"s":s=d+a[3],l=h+a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,d+a[1]+n,h+a[2]+i,s+n,l+i),p=d+a[1],m=h+a[2],d=s,h=l;break;case"S":s=a[3],l=a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,a[1]+n,a[2]+i,s+n,l+i),d=s,h=l,p=a[1],m=a[2];break;case"q":s=d+a[3],l=h+a[4],p=d+a[1],m=h+a[2],e.quadraticCurveTo(p+n,m+i,s+n,l+i),d=s,h=l;break;case"Q":s=a[3],l=a[4],e.quadraticCurveTo(a[1]+n,a[2]+i,s+n,l+i),d=s,h=l,p=a[1],m=a[2];break;case"t":s=d+a[1],l=h+a[2],null===f[0].match(/[QqTt]/)?(p=d,m=h):"t"===f[0]?(p=2*d-u,m=2*h-c):"q"===f[0]&&(p=2*d-p,m=2*h-m),u=p,c=m,e.quadraticCurveTo(p+n,m+i,s+n,l+i),h=l,p=(d=s)+a[1],m=h+a[2];break;case"T":s=a[1],l=a[2],p=2*d-p,m=2*h-m,e.quadraticCurveTo(p+n,m+i,s+n,l+i),d=s,h=l;break;case"a":ig(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+n,a[7]+h+i]),d+=a[6],h+=a[7];break;case"A":ig(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+i]),d=a[6],h=a[7];break;case"z":case"Z":d=g,h=y,e.closePath()}f=a}}function ig(e,t,n,i){const r=function(e,t,n,i,r,o,a,s,l){const u=Zm.call(arguments);if(Jm[u])return Jm[u];const c=a*Gm,f=Math.sin(c),d=Math.cos(c),h=d*(s-e)*.5+f*(l-t)*.5,p=d*(l-t)*.5-f*(s-e)*.5;let m=h*h/((n=Math.abs(n))*n)+p*p/((i=Math.abs(i))*i);m>1&&(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*l,_=v*s+b*l,w=g*e+y*t,k=v*e+b*t;let E=1/((w-x)*(w-x)+(k-_)*(k-_))-.25;E<0&&(E=0);let $=Math.sqrt(E);o==r&&($=-$);const A=.5*(x+w)-$*(k-_),D=.5*(_+k)+$*(w-x),S=Math.atan2(_-D,x-A);let M=Math.atan2(k-D,w-A)-S;M<0&&1===o?M+=Vm:M>0&&0===o&&(M-=Vm);const C=Math.ceil(Math.abs(M/(Ym+.001))),F=[];for(let e=0;e<C;++e){const t=S+e*M/C,r=S+(e+1)*M/C;F[e]=[A,D,t,r,n,i,f,d]}return Jm[u]=F}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let t=0;t<r.length;++t){const n=Km(r[t]);e.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])}}const rg=.5773502691896257,og={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Vm)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/2.5;e.moveTo(-n,-i),e.lineTo(-n,i),e.lineTo(-i,i),e.lineTo(-i,n),e.lineTo(i,n),e.lineTo(i,i),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(i,-i),e.lineTo(i,-n),e.lineTo(-i,-n),e.lineTo(-i,-i),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/7,r=n/2.5,o=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-o),e.lineTo(r,-o),e.lineTo(0,-n),e.lineTo(-r,-o),e.lineTo(-i,-o),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n,r=i-n*rg,o=n/4;e.moveTo(0,-i-r),e.lineTo(-o,i-r),e.lineTo(o,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n,r=i-n*rg;e.moveTo(0,-i-r),e.lineTo(-n,i-r),e.lineTo(n,i-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(0,-i),e.lineTo(-n,i),e.lineTo(n,i),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(0,i),e.lineTo(-n,-i),e.lineTo(n,-i),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(i,0),e.lineTo(-i,-n),e.lineTo(-i,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Xm*n;e.moveTo(-i,0),e.lineTo(i,-n),e.lineTo(i,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function ag(e){return st(og,e)?og[e]:function(e){if(!st(sg,e)){const t=Hm(e);sg[e]={draw:function(e,n){ng(e,t,0,0,Math.sqrt(n)/2)}}}return sg[e]}(e)}var sg={};const lg=.448084975506;function ug(e){return e.x}function cg(e){return e.y}function fg(e){return e.width}function dg(e){return e.height}function hg(e){return"function"==typeof e?e:()=>+e}function pg(e,t,n){return Math.max(t,Math.min(e,n))}function mg(){var e=ug,t=cg,n=fg,i=dg,r=hg(0),o=r,a=r,s=r,l=null;function u(u,c,f){var d,h=null!=c?c:+e.call(this,u),p=null!=f?f:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,v=pg(+r.call(this,u),0,y),b=pg(+o.call(this,u),0,y),x=pg(+a.call(this,u),0,y),_=pg(+s.call(this,u),0,y);if(l||(l=d=Jc()),v<=0&&b<=0&&x<=0&&_<=0)l.rect(h,p,m,g);else{var w=h+m,k=p+g;l.moveTo(h+v,p),l.lineTo(w-b,p),l.bezierCurveTo(w-lg*b,p,w,p+lg*b,w,p+b),l.lineTo(w,k-_),l.bezierCurveTo(w,k-lg*_,w-lg*_,k,w-_,k),l.lineTo(h+x,k),l.bezierCurveTo(h+lg*x,k,h,k-lg*x,h,k-x),l.lineTo(h,p+v),l.bezierCurveTo(h,p+lg*v,h+lg*v,p,h+v,p),l.closePath()}if(d)return l=null,d+""||null}return u.x=function(t){return arguments.length?(e=hg(t),u):e},u.y=function(e){return arguments.length?(t=hg(e),u):t},u.width=function(e){return arguments.length?(n=hg(e),u):n},u.height=function(e){return arguments.length?(i=hg(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=hg(e),o=null!=t?hg(t):r,s=null!=n?hg(n):r,a=null!=i?hg(i):o,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function gg(){var e,t,n,i,r,o,a,s,l=null;function u(e,t,n){const i=n/2;if(r){var u=a-t,c=e-o;if(u||c){var f=Math.sqrt(u*u+c*c),d=(u/=f)*s,h=(c/=f)*s,p=Math.atan2(c,u);l.moveTo(o-d,a-h),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,p-Math.PI,p),l.lineTo(o+d,a+h),l.arc(o,a,s,p,p+Math.PI)}else l.arc(e,t,i,0,Vm);l.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==l&&(l=c=Jc()),a=0;a<=f;++a)!(a<f&&i(s=o[a],a,o))===d&&(d=!d)&&(r=0),d&&u(+e(s,a,o),+t(s,a,o),+n(s,a,o));if(c)return l=null,c+""||null}return c.x=function(t){return arguments.length?(e=t,c):e},c.y=function(e){return arguments.length?(t=e,c):t},c.size=function(e){return arguments.length?(n=e,c):n},c.defined=function(e){return arguments.length?(i=e,c):i},c.context=function(e){return arguments.length?(l=null==e?null:e,c):l},c}function yg(e,t){return null!=e?e:t}const vg=e=>e.x||0,bg=e=>e.y||0,xg=e=>!(!1===e.defined),_g=function(){var e=Zc,t=Kc,n=qc(0),i=null,r=ef,o=tf,a=nf,s=null,l=Qc(u);function u(){var u,c,f=+e.apply(this,arguments),d=+t.apply(this,arguments),h=r.apply(this,arguments)-xc,p=o.apply(this,arguments)-xc,m=fc(p-h),g=p>h;if(s||(s=u=l()),d<f&&(c=d,d=f,f=c),d>vc)if(m>_c-vc)s.moveTo(d*hc(h),d*gc(h)),s.arc(0,0,d,h,p,!g),f>vc&&(s.moveTo(f*hc(p),f*gc(p)),s.arc(0,0,f,p,h,g));else{var y,v,b=h,x=p,_=h,w=p,k=m,E=m,$=a.apply(this,arguments)/2,A=$>vc&&(i?+i.apply(this,arguments):yc(f*f+d*d)),D=mc(fc(d-f)/2,+n.apply(this,arguments)),S=D,M=D;if(A>vc){var C=wc(A/f*gc($)),F=wc(A/d*gc($));(k-=2*C)>vc?(_+=C*=g?1:-1,w-=C):(k=0,_=w=(h+p)/2),(E-=2*F)>vc?(b+=F*=g?1:-1,x-=F):(E=0,b=x=(h+p)/2)}var O=d*hc(b),N=d*gc(b),T=f*hc(w),z=f*gc(w);if(D>vc){var R,P=d*hc(x),L=d*gc(x),B=f*hc(_),j=f*gc(_);if(m<bc)if(R=function(e,t,n,i,r,o,a,s){var l=n-e,u=i-t,c=a-r,f=s-o,d=f*l-c*u;if(!(d*d<vc))return[e+(d=(c*(t-o)-f*(e-r))/d)*l,t+d*u]}(O,N,B,j,P,L,T,z)){var I=O-R[0],U=N-R[1],q=P-R[0],W=L-R[1],H=1/gc(function(e){return e>1?0:e<-1?bc:Math.acos(e)}((I*q+U*W)/(yc(I*I+U*U)*yc(q*q+W*W)))/2),G=yc(R[0]*R[0]+R[1]*R[1]);S=mc(D,(f-G)/(H-1)),M=mc(D,(d-G)/(H+1))}else S=M=0}E>vc?M>vc?(y=rf(B,j,O,N,d,M,g),v=rf(P,L,T,z,d,M,g),s.moveTo(y.cx+y.x01,y.cy+y.y01),M<D?s.arc(y.cx,y.cy,M,dc(y.y01,y.x01),dc(v.y01,v.x01),!g):(s.arc(y.cx,y.cy,M,dc(y.y01,y.x01),dc(y.y11,y.x11),!g),s.arc(0,0,d,dc(y.cy+y.y11,y.cx+y.x11),dc(v.cy+v.y11,v.cx+v.x11),!g),s.arc(v.cx,v.cy,M,dc(v.y11,v.x11),dc(v.y01,v.x01),!g))):(s.moveTo(O,N),s.arc(0,0,d,b,x,!g)):s.moveTo(O,N),f>vc&&k>vc?S>vc?(y=rf(T,z,P,L,f,-S,g),v=rf(O,N,B,j,f,-S,g),s.lineTo(y.cx+y.x01,y.cy+y.y01),S<D?s.arc(y.cx,y.cy,S,dc(y.y01,y.x01),dc(v.y01,v.x01),!g):(s.arc(y.cx,y.cy,S,dc(y.y01,y.x01),dc(y.y11,y.x11),!g),s.arc(0,0,f,dc(y.cy+y.y11,y.cx+y.x11),dc(v.cy+v.y11,v.cx+v.x11),g),s.arc(v.cx,v.cy,S,dc(v.y11,v.x11),dc(v.y01,v.x01),!g))):s.arc(0,0,f,w,_,g):s.lineTo(T,z)}else s.moveTo(0,0);if(s.closePath(),u)return s=null,u+""||null}return u.centroid=function(){var n=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +o.apply(this,arguments))/2-bc/2;return[hc(i)*n,gc(i)*n]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:qc(+t),u):e},u.outerRadius=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),u):t},u.cornerRadius=function(e){return arguments.length?(n="function"==typeof e?e:qc(+e),u):n},u.padRadius=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:qc(+e),u):i},u.startAngle=function(e){return arguments.length?(r="function"==typeof e?e:qc(+e),u):r},u.endAngle=function(e){return arguments.length?(o="function"==typeof e?e:qc(+e),u):o},u.padAngle=function(e){return arguments.length?(a="function"==typeof e?e:qc(+e),u):a},u.context=function(e){return arguments.length?(s=null==e?null:e,u):s},u}().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)),wg=uf().x(vg).y1(bg).y0((e=>(e.y||0)+(e.height||0))).defined(xg),kg=uf().y(bg).x1(vg).x0((e=>(e.x||0)+(e.width||0))).defined(xg),Eg=lf().x(vg).y(bg).defined(xg),$g=mg().x(vg).y(bg).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>yg(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>yg(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>yg(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>yg(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),Ag=function(e,t){let n=null,i=Qc(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:qc(e||cf),t="function"==typeof t?t:qc(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:qc(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:qc(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>ag(e.shape||"circle"))).size((e=>yg(e.size,64))),Dg=gg().x(vg).y(bg).defined(xg).size((e=>e.size||1));function Sg(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Mg(e,t,n,i){return $g.context(e)(t,n,i)}var Cg=1;function Fg(){Cg=1}function Og(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+Cg++),a=r.clipping[o]||(r.clipping[o]={id:o});return Ve(i)?a.path=i(null):Sg(n)?a.path=Mg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function Ng(e){this.clear(),e&&this.union(e)}function Tg(e){this.mark=e,this.bounds=this.bounds||new Ng}function zg(e){Tg.call(this,e),this.items=this.items||[]}function Rg(e){this._pending=0,this._loader=e||Ca()}function Pg(e){e._pending+=1}function Lg(e){e._pending-=1}function Bg(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}Ng.prototype={clone(){return new Ng(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 n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),i<t?(this.y2=t,this.y1=i):(this.y1=t,this.y2=i),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.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),l=Math.sin(e),u=t-t*s+n*l,c=n-t*l-n*s;return[s*i-l*r+u,l*i+s*r+c,s*i-l*a+u,l*i+s*a+c,s*o-l*r+u,l*o+s*r+c,s*o-l*a+u,l*o+s*a+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.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<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.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.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},ft(zg,Tg),Rg.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return Pg(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Lg(t),e))).catch((()=>(Lg(t),null)))},loadImage(e){const t=this,n=df();return Pg(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=st(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>Lg(t),r.onerror=()=>Lg(t),r.src=i,r})).catch((e=>(Lg(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)}))}};const jg=Vm-1e-8;let Ig,Ug,qg,Wg,Hg,Gg,Yg,Vg;const Xg=(e,t)=>Ig.add(e,t),Jg=(e,t)=>Xg(Ug=e,qg=t),Qg=e=>Xg(e,Ig.y1),Zg=e=>Xg(Ig.x1,e),Kg=(e,t)=>Hg*e+Yg*t,ey=(e,t)=>Gg*e+Vg*t,ty=(e,t)=>Xg(Kg(e,t),ey(e,t)),ny=(e,t)=>Jg(Kg(e,t),ey(e,t));function iy(e,t){return Ig=e,t?(Wg=t*Gm,Hg=Vg=Math.cos(Wg),Gg=Math.sin(Wg),Yg=-Gg):(Hg=Vg=1,Wg=Gg=Yg=0),ry}const ry={beginPath(){},closePath(){},moveTo:ny,lineTo:ny,rect(e,t,n,i){Wg?(ty(e+n,t),ty(e+n,t+i),ty(e,t+i),ny(e,t)):(Xg(e+n,t+i),Jg(e,t))},quadraticCurveTo(e,t,n,i){const r=Kg(e,t),o=ey(e,t),a=Kg(n,i),s=ey(n,i);oy(Ug,r,a,Qg),oy(qg,o,s,Zg),Jg(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=Kg(e,t),s=ey(e,t),l=Kg(n,i),u=ey(n,i),c=Kg(r,o),f=ey(r,o);ay(Ug,a,l,c,Qg),ay(qg,s,u,f,Zg),Jg(c,f)},arc(e,t,n,i,r,o){if(i+=Wg,r+=Wg,Ug=n*Math.cos(r)+e,qg=n*Math.sin(r)+t,Math.abs(r-i)>jg)Xg(e-n,t-n),Xg(e+n,t+n);else{const a=i=>Xg(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,l;if(a(i),a(r),r!==i)if((i%=Vm)<0&&(i+=Vm),(r%=Vm)<0&&(r+=Vm),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=Vm,s=i-i%Ym,l=0;l<4&&s>r;++l,s-=Ym)a(s);else for(s=i-i%Ym+Ym,l=0;l<4&&s<r;++l,s+=Ym)a(s)}}};function oy(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function ay(e,t,n,i,r){const o=i-e+3*t-3*n,a=e+n-2*t,s=e-t;let l,u=0,c=0;Math.abs(o)>1e-14?(l=a*a+s*o,l>=0&&(l=Math.sqrt(l),u=(-a+l)/o,c=(-a-l)/o)):u=.5*s/a,0<u&&u<1&&r(sy(u,e,t,n,i)),0<c&&c<1&&r(sy(c,e,t,n,i))}function sy(e,t,n,i,r){const o=1-e,a=o*o,s=e*e;return a*o*t+3*a*e*n+3*o*s*i+s*e*r}var ly=(ly=ff(1,1))?ly.getContext("2d"):null;const uy=new Ng;function cy(e){return function(t,n){if(!ly)return!0;e(ly,t),uy.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:a}=uy;for(let e=r;e<=a;++e)for(let t=i;t<=o;++t)if(ly.isPointInPath(t,e))return!0;return!1}}function fy(e,t){return t.contains(e.x||0,e.y||0)}function dy(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,o=e.height||0;return t.intersects(uy.set(n,i,n+r,i+o))}function hy(e,t){const n=e.x||0,i=e.y||0;return py(t,n,i,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i)}function py(e,t,n,i,r){const{x1:o,y1:a,x2:s,y2:l}=e,u=i-t,c=r-n;let f,d,h,p,m=0,g=1;for(p=0;p<4;++p){if(0===p&&(f=-u,d=-(o-t)),1===p&&(f=u,d=s-t),2===p&&(f=-c,d=-(a-n)),3===p&&(f=c,d=l-n),Math.abs(f)<1e-10&&d<0)return!1;if(h=d/f,f<0){if(h>g)return!1;h>m&&(m=h)}else if(f>0){if(h<m)return!1;h<g&&(g=h)}}return!0}function my(e,t){e.globalCompositeOperation=t.blend||"source-over"}function gy(e,t){return null==e?t:e}function yy(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function vy(e,t,n){return Tm(n)?function(e,t,n){const i=n.width(),r=n.height();let o;if("radial"===t.gradient)o=e.createRadialGradient(n.x1+gy(t.x1,.5)*i,n.y1+gy(t.y1,.5)*r,Math.max(i,r)*gy(t.r1,0),n.x1+gy(t.x2,.5)*i,n.y1+gy(t.y2,.5)*r,Math.max(i,r)*gy(t.r2,.5));else{const a=gy(t.x1,0),s=gy(t.y1,0),l=gy(t.x2,1),u=gy(t.y2,0);if(a!==l&&s!==u&&i!==r){const n=ff(Math.ceil(i),Math.ceil(r)),o=n.getContext("2d");return o.scale(i,r),o.fillStyle=yy(o.createLinearGradient(a,s,l,u),t.stops),o.fillRect(0,0,i,r),e.createPattern(n,"no-repeat")}o=e.createLinearGradient(n.x1+a*i,n.y1+s*r,n.x1+l*i,n.y1+u*r)}return yy(o,t.stops)}(e,n,t.bounds):n}function by(e,t,n){return(n*=null==t.fillOpacity?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=vy(e,t,t.fill),!0)}var xy=[];function _y(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=vy(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||xy),e.lineDashOffset=t.strokeDashOffset||0),!0)}function wy(e,t){return e.zindex-t.zindex||e.index-t.index}function ky(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n<i;++n)(t=r[n]).index=n,t.zindex&&o.push(t);return e.zdirty=!1,e.zitems=o.sort(wy)}function Ey(e,t){var n,i,r=e.items;if(!r||!r.length)return;const o=ky(e);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||t(r[n]);r=o}for(n=0,i=r.length;n<i;++n)t(r[n])}function $y(e,t){var n,i,r=e.items;if(!r||!r.length)return null;const o=ky(e);for(o&&o.length&&(r=o),i=r.length;--i>=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 Ay(e){return function(t,n,i){Ey(n,(n=>{i&&!i.intersects(n.bounds)||Sy(e,t,n,n)}))}}function Dy(e){return function(t,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Sy(e,t,n.items[0],n.items)}}function Sy(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(my(t,n),n.fill&&by(t,n,r)&&t.fill(),n.stroke&&_y(t,n,r)&&t.stroke()))}function My(e){return e=e||de,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,$y(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 Cy(e,t){return function(n,i,r,o){var a,s,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(a=l.strokeWidth,s=l.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Fy(e){return My(Cy(e))}function Oy(e,t){return"translate("+e+","+t+")"}function Ny(e){return"rotate("+e+")"}function Ty(e){return Oy(e.x||0,e.y||0)}function zy(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*=Gm),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 Oy(e.x||0,e.y||0)+(e.angle?" "+Ny(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(iy(e,n.angle),n),Bg(e,n).translate(n.x||0,n.y||0)},draw:Ay(i),pick:Fy(i),isect:n||cy(i)}}var Ry=zy("arc",(function(e,t){return _g.context(e)(t)}));function Py(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=Cy(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(iy(e),i),Bg(e,i[0]))},draw:Dy(i),pick:function(e,t,n,i,o,a){var s=t.items,l=t.bounds;return!s||!s.length||l&&!l.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:fy,tip:n}}var Ly=Py("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?kg:wg).curve(Bm(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))<s&&(s=i,n=e[a]);return n}));function By(e,t){e.beginPath(),Sg(t)?Mg(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function jy(e){const t=gy(e.strokeWidth,1);return null!=e.strokeOffset?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function Iy(e,t){const n=jy(t);e("d",Mg(null,t,n,n))}function Uy(e,t,n,i){const r=jy(t);e.beginPath(),Mg(e,t,(n||0)+r,(i||0)+r)}const qy=Cy(Uy),Wy=Cy(Uy,!1),Hy=Cy(Uy,!0);var Gy={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Ty(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t<i;++t)e.union(n[t].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),Bg(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n){Ey(t,(t=>{const i=t.x||0,r=t.y||0,o=t.strokeForeground,a=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&a&&(Uy(e,t,i,r),my(e,t),t.fill&&by(e,t,a)&&e.fill(),t.stroke&&!o&&_y(e,t,a)&&e.stroke()),e.save(),e.translate(i,r),t.clip&&By(e,t),n&&n.translate(-i,-r),Ey(t,(t=>{this.draw(e,t,n)})),n&&n.translate(i,r),e.restore(),o&&t.stroke&&a&&(Uy(e,t,i,r),my(e,t),_y(e,t,a)&&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 $y(t,(l=>{let u,c,f;const d=l.bounds;if(d&&!d.contains(r,o))return;c=l.x||0,f=l.y||0;const h=c+(l.width||0),p=f+(l.height||0),m=l.clip;if(m&&(r<c||r>h||o<f||o>p))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&Sg(l)&&!Hy(e,l,a,s))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&Wy(e,l,a,s)?(e.restore(),l):(u=$y(l,(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)),!u&&y&&(l.fill||!g&&l.stroke)&&qy(e,l,a,s)&&(u=l),e.restore(),u||null)}))},isect:dy,content:function(e,t,n){e("clip-path",t.clip?Og(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Iy(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Iy(e,t):e("d","")}},Yy={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Vy(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 Xy(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 Jy(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 Qy(e,t){return"center"===e?t/2:"right"===e?t:0}function Zy(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var Ky={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=Vy(t,n),r=Xy(t,i),o=Jy(t,i),a=(t.x||0)-Qy(t.align,r),s=(t.y||0)-Zy(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",Yy["xmlns:xlink"],"xlink:href"),e("transform",Oy(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=Xy(t,n),r=Jy(t,n),o=(t.x||0)-Qy(t.align,i),a=(t.y||0)-Zy(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){Ey(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=Vy(t,this);let r=Xy(t,i),o=Jy(t,i);if(0===r||0===o)return;let a,s,l,u,c=(t.x||0)-Qy(t.align,r),f=(t.y||0)-Zy(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,l=t.width/t.height,s==s&&l==l&&s!==l&&(l<s?(u=r/s,f+=(o-u)/2,o=u):(u=o*s,c+=(r-u)/2,r=u))),(i.complete||i.toDataURL)&&(my(e,t),e.globalAlpha=null!=(a=t.opacity)?a:1,e.imageSmoothingEnabled=!1!==t.smooth,e.drawImage(i,c,f,r,o))}))},pick:My(),isect:de,get:Vy,xOffset:Qy,yOffset:Zy},ev=Py("line",(function(e,t){const n=t[0],i=n.interpolate||"linear";return Eg.curve(Bm(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r=Math.pow(e[0].strokeWidth||1,2),o=e.length;--o>=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i<r)return e[o];return null}));function tv(e,t){var n=t.path;if(null==n)return!0;var i=t.x||0,r=t.y||0,o=t.scaleX||1,a=t.scaleY||1,s=(t.angle||0)*Gm,l=t.pathCache;l&&l.path===n||((t.pathCache=l=Hm(n)).path=n),s&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(s),ng(e,l,0,0,o,a),e.rotate(-s),e.translate(-i,-r)):ng(e,l,i,r,o,a)}var nv={type:"path",tag:"path",nested:!1,attr:function(e,t){var n=t.scaleX||1,i=t.scaleY||1;1===n&&1===i||e("vector-effect","non-scaling-stroke"),e("transform",function(e){return Oy(e.x||0,e.y||0)+(e.angle?" "+Ny(e.angle):"")+(e.scaleX||e.scaleY?" "+(t=e.scaleX||1,n=e.scaleY||1,"scale("+t+","+n+")"):"");var t,n}(t)),e("d",t.path)},bound:function(e,t){return tv(iy(e,t.angle),t)?e.set(0,0,0,0):Bg(e,t,!0)},draw:Ay(tv),pick:Fy(tv),isect:cy(tv)};function iv(e,t){e.beginPath(),Mg(e,t)}var rv={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",Mg(null,t))},bound:function(e,t){var n,i;return Bg(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)},draw:Ay(iv),pick:Fy(iv),isect:dy};function ov(e,t,n){var i,r,o,a;return!(!t.stroke||!_y(e,t,n)||(i=t.x||0,r=t.y||0,o=null!=t.x2?t.x2:i,a=null!=t.y2?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(o,a),0))}var av={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",Ty(t)),e("x2",null!=t.x2?t.x2-(t.x||0):0),e("y2",null!=t.y2?t.y2-(t.y||0):0)},bound:function(e,t){var n,i;return Bg(e.set(n=t.x||0,i=t.y||0,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i),t)},draw:function(e,t,n){Ey(t,(t=>{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&ov(e,t,i)&&(my(e,t),e.stroke())}}))},pick:My((function(e,t,n,i){return!!e.isPointInStroke&&ov(e,t,1)&&e.isPointInStroke(n,i)})),isect:hy},sv=zy("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),lv=zy("symbol",(function(e,t){return Ag.context(e)(t)}),fy);const uv=wt();var cv={height:gv,measureWidth:pv,estimateWidth:dv,width:dv,canvas:fv};function fv(e){cv.width=e&&ly?pv:dv}function dv(e,t){return hv(xv(e,t),gv(e))}function hv(e,t){return~~(.8*e.length*t)}function pv(e,t){return gv(e)<=0||!(t=xv(e,t))?0:mv(t,wv(e))}function mv(e,t){const n=`(${t}) ${e}`;let i=uv.get(n);return void 0===i&&(ly.font=t,i=ly.measureText(e).width,uv.set(n,i)),i}function gv(e){return null!=e.fontSize?+e.fontSize||0:11}function yv(e){return null!=e.lineHeight?e.lineHeight:gv(e)+2}function vv(e){return t=e.lineBreak&&e.text&&!_e(e.text)?e.text.split(e.lineBreak):e.text,_e(t)?t.length>1?t:t[0]:t;var t}function bv(e){const t=vv(e);return(_e(t)?t.length-1:0)*yv(e)}function xv(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(cv.width===pv){const t=wv(e);return e=>mv(e,t)}{const t=gv(e);return e=>hv(e,t)}}(e);if(i(t)<n)return t;var r,o=e.ellipsis||"…",a="rtl"===e.dir,s=0,l=t.length;if(n-=i(o),a){for(;s<l;)r=s+l>>>1,i(t.slice(r))>n?s=r+1:l=r;return o+t.slice(s)}for(;s<l;)r=1+(s+l>>>1),i(t.slice(0,r))<n?s=r:l=r-1;return t.slice(0,s)+o}(e,n):n}function _v(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function wv(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+gv(e)+"px "+_v(e,t)}function kv(e){var t=e.baseline,n=gv(e);return Math.round("top"===t?.79*n:"middle"===t?.3*n:"bottom"===t?-.21*n:"line-top"===t?.29*n+.5*yv(e):"line-bottom"===t?.29*n-.5*yv(e):0)}fv(!0);const Ev={left:"start",center:"middle",right:"end"},$v=new Ng;function Av(e){var t,n=e.x||0,i=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-Ym,n+=r*Math.cos(t),i+=r*Math.sin(t)),$v.x1=n,$v.y1=i,$v}function Dv(e,t,n){var i,r=cv.height(t),o=t.align,a=Av(t),s=a.x1,l=a.y1,u=t.dx||0,c=(t.dy||0)+kv(t)-Math.round(.8*r),f=vv(t);if(_e(f)?(r+=yv(t)*(f.length-1),i=f.reduce(((e,n)=>Math.max(e,cv.width(t,n))),0)):i=cv.width(t,f),"center"===o?u-=i/2:"right"===o&&(u-=i),e.set(u+=s,c+=l,u+i,c+r),t.angle&&!n)e.rotate(t.angle*Gm,s,l);else if(2===n)return e.rotatedPoints(t.angle*Gm,s,l);return e}var Sv={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+kv(t),o=Av(t),a=o.x1,s=o.y1,l=t.angle||0;e("text-anchor",Ev[t.align]||"start"),l?(n=Oy(a,s)+" "+Ny(l),(i||r)&&(n+=" "+Oy(i,r))):n=Oy(a+i,s+r),e("transform",n)},bound:Dv,draw:function(e,t,n){Ey(t,(t=>{var i,r,o,a,s,l,u,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=wv(t),e.textAlign=t.align||"left",r=(i=Av(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*Gm),r=o=0),r+=t.dx||0,o+=(t.dy||0)+kv(t),l=vv(t),my(e,t),_e(l))for(s=yv(t),a=0;a<l.length;++a)u=xv(t,l[a]),t.fill&&by(e,t,c)&&e.fillText(u,r,o),t.stroke&&_y(e,t,c)&&e.strokeText(u,r,o),o+=s;else u=xv(t,l),t.fill&&by(e,t,c)&&e.fillText(u,r,o),t.stroke&&_y(e,t,c)&&e.strokeText(u,r,o);t.angle&&e.restore()}}))},pick:My((function(e,t,n,i,r,o){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var a=Av(t),s=a.x1,l=a.y1,u=Dv($v,t,1),c=-t.angle*Gm,f=Math.cos(c),d=Math.sin(c),h=f*r-d*o+(s-f*s+d*l),p=d*r+f*o+(l-d*s-f*l);return u.contains(h,p)})),isect:function(e,t){const n=Dv($v,e,2);return py(t,n[0],n[1],n[2],n[3])||py(t,n[0],n[1],n[4],n[5])||py(t,n[4],n[5],n[6],n[7])||py(t,n[2],n[3],n[6],n[7])}},Mv=Py("trail",(function(e,t){return Dg.context(e)(t)}),(function(e,t){for(var n,i,r=e.length;--r>=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})),Cv={arc:Ry,area:Ly,group:Gy,image:Ky,line:ev,path:nv,rect:rv,rule:av,shape:sv,symbol:lv,text:Sv,trail:Mv};function Fv(e,t,n){var i=Cv[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new Ng),e,n)}var Ov={mark:null};function Nv(e,t,n){var i,r,o,a,s=Cv[e.marktype],l=s.bound,u=e.items,c=u&&u.length;if(s.nested)return c?o=u[0]:(Ov.mark=e,o=Ov),a=Fv(o,l,n),t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new Ng,c)for(i=0,r=u.length;i<r;++i)t.union(Fv(u[i],l,n));return e.bounds=t}const Tv=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function zv(e,t){return JSON.stringify(e,Tv,t)}function Rv(e){return Pv("string"==typeof e?JSON.parse(e):e)}function Pv(e){var t,n,i,r=e.marktype,o=e.items;if(o)for(n=0,i=o.length;n<i;++n)t=r?"mark":"group",o[n][t]=e,o[n].zindex&&(o[n][t].zdirty=!0),"group"===(r||t)&&Pv(o[n]);return r&&Nv(e),e}function Lv(e){arguments.length?this.root=Rv(e):(this.root=Bv({marktype:"group",name:"root",role:"frame"}),this.root.items=[new zg(this.root)])}function Bv(e,t){const n={bounds:new Ng,clip:!!e.clip,group:t,interactive:!1!==e.interactive,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return null!=e.aria&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function jv(e,t,n){return!e&&"undefined"!=typeof document&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function Iv(e,t){t=t.toLowerCase();for(var n=e.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===t)return n[i]}function Uv(e,t,n,i){var r,o=e.childNodes[t];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=jv(e.ownerDocument,n,i),e.insertBefore(o,r)),o}function qv(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function Wv(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Hv(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function Gv(e,t){this._active=null,this._handlers={},this._loader=e||Ca(),this._tooltip=t||Yv}function Yv(e,t,n,i){e.element().setAttribute("title",i||"")}function Vv(e){this._el=null,this._bgcolor=null,this._loader=new Rg(e)}Lv.prototype={toJSON(e){return zv(this.root,e||0)},mark(e,t,n){const i=Bv(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}},Gv.prototype={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 e in t)n.push(...t[e]);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=jv(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=Cv[a.marktype]).tip){for((o=Hv(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,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,l+=e.y||0;return{x:s,y:l,width:o,height:a,left:s,top:l,right:s+o,bottom:l+a}}},Vv.prototype={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){const t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},_render(){},renderAsync(e){const t=this.render(e);return this._ready?this._ready.then((()=>t)):Promise.resolve(t)},_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 Xv="dragenter",Jv="dragleave",Qv="dragover",Zv="mousedown",Kv="mousemove",eb="mouseout",tb="mouseover",nb="click",ib="mousewheel",rb="touchstart",ob="touchmove",ab="touchend",sb=Kv,lb=eb,ub=nb;function cb(e,t){Gv.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}function fb(e,t){(e=>e===rb||e===ob||e===ab?[rb,ob,ab]:[e])(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 db(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||this.fire(n,i),this._active=o,this.fire(t,i)),this.fire(e,i)}}function hb(e){return function(t){this.fire(e,t),this._active=null}}ft(cb,Gv,{initialize(e,t,n){return this._canvas=e&&Iv(e,"canvas"),[nb,Zv,Kv,eb,Jv].forEach((e=>fb(this,e))),Gv.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",Xv,Jv,Qv,Zv,"mouseup",Kv,eb,tb,nb,"dblclick","wheel",ib,rb,ob,ab],DOMMouseScroll(e){this.fire(ib,e)},mousemove:db(Kv,tb,eb),dragover:db(Qv,Xv,Jv),mouseout:hb(eb),dragleave:hb(Jv),mousedown(e){this._down=this._active,this.fire(Zv,e)},click(e){this._down===this._active&&(this.fire(nb,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(rb,e,!0)},touchmove(e){this.fire(ob,e,!0)},touchend(e){this.fire(ab,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===ub&&i&&i.href?this.handleHref(t,i,i.href):e!==sb&&e!==lb||this.handleTooltip(t,i,e!==lb),r)for(let e=0,n=r.length;e<n;++e)r[e].handler.call(this._obj,t,i)},on(e,t){const n=this.eventName(e),i=this._handlers;return this._handlerIndex(i[n],e,t)<0&&(fb(this,e),(i[n]||(i[n]=[])).push({type:e,handler:t})),this},off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&i.splice(r,1),this},pickEvent(e){const t=Hv(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 Cv[e.marktype].pick.call(this,o,e,t,n,i,r)}});var pb="undefined"!=typeof window&&window.devicePixelRatio||1;function mb(e){Vv.call(this,e),this._options={},this._redraw=!1,this._dirty=new Ng,this._tempb=new Ng}const gb=Vv.prototype;function yb(e,t){Gv.call(this,e,t);const n=this;n._hrefHandler=vb(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=vb(n,((e,t)=>{n.handleTooltip(e,t,e.type!==lb)}))}ft(mb,Vv,{initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:ff(1,1,this._options.type),e&&this._canvas&&(qv(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),gb.initialize.call(this,e,t,n,i,r)},resize(e,t,n,i){if(gb.resize.call(this,e,t,n,i),this._canvas)!function(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=a?pb:r;e.width=t*l,e.height=n*l;for(const e in o)s[e]=o[e];a&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||oe("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){const t=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty,a=((e,t,n)=>(new Ng).set(0,0,t,n).translate(-e[0],-e[1]))(n,i,r);t.save();const s=this._redraw||o.empty()?(this._redraw=!1,a.expand(1)):function(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(t,a.intersect(o),n);return this.clear(-n[0],-n[1],i,r),this.draw(t,e,s),t.restore(),o.clear(),this},draw(e,t,n){const i=Cv[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),Ve(n)?(e.beginPath(),n(e),e.clip()):By(e,t.group)}(e,t),i.draw.call(this,e,t,n),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 vb=(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)};ft(yb,Gv,{initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(ub,this._hrefHandler),i.removeEventListener(sb,this._tooltipHandler),i.removeEventListener(lb,this._tooltipHandler)),this._svg=i=e&&Iv(e,"svg"),i&&(i.addEventListener(ub,this._hrefHandler),i.addEventListener(sb,this._tooltipHandler),i.addEventListener(lb,this._tooltipHandler)),Gv.prototype.initialize.call(this,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:vb(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 bb="aria-hidden",xb="aria-label",_b="role",wb="aria-roledescription",kb="graphics-object",Eb="graphics-symbol",$b=(e,t,n)=>({[_b]:e,[wb]:t,[xb]:n||void 0}),Ab=Ot(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Db={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Ob(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 ${Jp(s)?"discrete":s} scale`+` with ${Fm(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Ob(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,l=a.dataflow.locale();return((u=i).length?u[0].toUpperCase()+u.slice(1):u)+(n?` titled '${n}'`:"")+` for ${function(e){return(e=e.map((e=>e+("fill"===e||"stroke"===e?" color":"")))).length<2?e[0]:e.slice(0,-1).join(", ")+" and "+De(e)}(o)}`+` with ${Fm(l,s,e)}`;var u}},"title-text":{desc:"title",caption:e=>`Title text '${Fb(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Fb(e)}'`}},Sb={ariaRole:_b,ariaRoleDescription:wb,description:xb};function Mb(e,t){const n=!1===t.aria;if(e(bb,n||void 0),n||null==t.description)for(const t in Sb)e(Sb[t],void 0);else{const n=t.mark.marktype;e(xb,t.description),e(_b,t.ariaRole||("group"===n?kb:Eb)),e(wb,t.ariaRoleDescription||`${n} mark`)}}function Cb(e){return!1===e.aria?{[bb]:!0}:Ab[e.role]?null:Db[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return $b(t.role||Eb,t.desc,n.description||i(n))}catch(e){return null}}(e,Db[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return $b(n?kb:Eb,`${t} mark container`,e.description)}(e)}function Fb(e){return Ge(e.text).join(" ")}function Ob(e){try{return Ge(De(e.items).items[0].text).join(" ")}catch(e){return null}}const Nb=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Tb=e=>Nb(e).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;");function zb(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>(null!=n&&(t+=` ${e}="${Tb(n)}"`),a),a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];for(const e of u)for(const t in e)o(t,e[t]);return a},close(){const o=i.pop();return e+=t?t+(n?`>${n}</${o}>`:"/>"):`</${o}>`,r(),a},attr:o,text:e=>(n+=Nb(e),a),toString:()=>e};return a}const Rb=e=>Pb(zb(),e)+"";function Pb(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t<i;++t)e.attr(n[t].name,n[t].value)}if(t.hasChildNodes()){const n=t.childNodes;for(const t of n)3===t.nodeType?e.text(t.nodeValue):Pb(e,t)}return e.close()}const Lb={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},Bb={blend:"mix-blend-mode"},jb={fill:"none","stroke-miterlimit":10},Ib="http://www.w3.org/2000/xmlns/",Ub=Yy.xmlns;function qb(e){Vv.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}const Wb=Vv.prototype;function Hb(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 Gb(e,t,n){let i,r,o;if("radial"===t.gradient){let i=Uv(e,n++,"pattern",Ub);ex(i,{id:Nm+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=Uv(i,0,"rect",Ub),ex(i,{width:1,height:1,fill:`url(${nx()}#${t.id})`}),ex(e=Uv(e,n++,"radialGradient",Ub),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else ex(e=Uv(e,n++,"linearGradient",Ub),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i<r;++i)o=Uv(e,i,"stop",Ub),o.setAttribute("offset",t.stops[i].offset),o.setAttribute("stop-color",t.stops[i].color);return qv(e,i),n}function Yb(e,t,n){let i;return(e=Uv(e,n,"clipPath",Ub)).setAttribute("id",t.id),t.path?(i=Uv(e,0,"path",Ub),i.setAttribute("d",t.path)):(i=Uv(e,0,"rect",Ub),ex(i,{x:0,y:0,width:t.width,height:t.height})),qv(e,1),n+1}function Vb(e,t,n,i,r){let o,a=e._svg;if(!a&&(o=t.ownerDocument,a=jv(o,i,Ub),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:"default"},"g"===i))){const t=jv(o,"path",Ub);a.appendChild(t),t.__data__=e;const n=jv(o,"g",Ub);a.appendChild(n),n.__data__=e;const i=jv(o,"path",Ub);a.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(a.ownerSVGElement!==r||function(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}ft(qb,Vv,{initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=Uv(e,0,"svg",Ub),this._svg.setAttributeNS(Ib,"xmlns",Ub),this._svg.setAttributeNS(Ib,"xmlns:xlink",Yy["xmlns:xlink"]),this._svg.setAttribute("version",Yy.version),this._svg.setAttribute("class","marks"),qv(e,1),this._root=Uv(this._svg,0,"g",Ub),ex(this._root,jb),qv(this._svg,1)),this.background(this._bgcolor),Wb.initialize.call(this,e,t,n,i,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),Wb.background.apply(this,arguments)},resize(e,t,n,i){return Wb.resize.call(this,e,t,n,i),this._svg&&(ex(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=Uv(e,0,"rect",Ub),ex(n,{width:this._width,height:this._height,fill:t}));const i=Rb(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i},_render(e){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e),qv(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,o,a,s,l;for(a=0,s=e.length;a<s;++a)n=e[a],i=n.mark,i.marktype!==r&&(r=i.marktype,o=Cv[r]),i.zdirty&&i.dirty!==t&&(this._dirtyAll=!1,Hb(n,t),i.items.forEach((e=>{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.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,Hb(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n){if(!this.isDirty(t))return t._svg;const i=this._svg,r=Cv[t.marktype],o=!1===t.interactive?"none":null,a="g"===r.tag,s=Vb(t,e,n,"g",i);s.setAttribute("class",Wv(t));const l=Cb(t);for(const e in l)tx(s,e,l[e]);a||tx(s,"pointer-events",o),tx(s,"clip-path",t.clip?Og(this,t,t.group):null);let u=null,c=0;const f=e=>{const t=this.isDirty(e),n=Vb(e,s,u,r.tag,i);t&&(this._update(r,n,e),a&&function(e,t,n){t=t.lastChild.previousSibling;let i,r=0;Ey(n,(n=>{i=e.mark(t,n,i),++r})),qv(t,1+r)}(this,n,e)),u=n,++c};return r.nested?t.items.length&&f(t.items[0]):Ey(t,f),qv(s,c),s},_update(e,t,n){Xb=t,Jb=t.__values__,Mb(Zb,n),e.attr(Zb,n,this);const i=Qb[e.type];i&&i.call(this,e,t,n),Xb&&this.style(Xb,n)},style(e,t){if(null!=t){for(const n in Lb){let i="font"===n?_v(t):t[n];if(i===Jb[n])continue;const r=Lb[n];null==i?e.removeAttribute(r):(Tm(i)&&(i=zm(i,this._defs.gradient,nx())),e.setAttribute(r,i+"")),Jb[n]=i}for(const n in Bb)Kb(e,Bb[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=Uv(e,1,"defs",Ub)),i=Gb(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=Uv(e,1,"defs",Ub)),i=Yb(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):qv(n,i))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let Xb=null,Jb=null;const Qb={group(e,t,n){const i=Xb=t.childNodes[2];Jb=i.__values__,e.foreground(Zb,n,this),Jb=t.__values__,Xb=t.childNodes[1],e.content(Zb,n,this);const r=Xb=t.childNodes[0];e.background(Zb,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==Jb.events&&(tx(i,"pointer-events",o),tx(r,"pointer-events",o),Jb.events=o),n.strokeForeground&&n.stroke){const e=n.fill;tx(i,"display",null),this.style(r,n),tx(r,"stroke",null),e&&(n.fill=null),Jb=i.__values__,this.style(i,n),e&&(n.fill=e),Xb=null}else tx(i,"display","none")},image(e,t,n){!1===n.smooth?(Kb(t,"image-rendering","optimizeSpeed"),Kb(t,"image-rendering","pixelated")):Kb(t,"image-rendering",null)},text(e,t,n){const i=vv(n);let r,o,a,s;_e(i)?(o=i.map((e=>xv(n,e))),r=o.join("\n"),r!==Jb.text&&(qv(t,0),a=t.ownerDocument,s=yv(n),o.forEach(((e,i)=>{const r=jv(a,"tspan",Ub);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),Jb.text=r)):(o=xv(n,i),o!==Jb.text&&(t.textContent=o,Jb.text=o)),tx(t,"font-family",_v(n)),tx(t,"font-size",gv(n)+"px"),tx(t,"font-style",n.fontStyle),tx(t,"font-variant",n.fontVariant),tx(t,"font-weight",n.fontWeight)}};function Zb(e,t,n){t!==Jb[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(Xb,e,t,n):tx(Xb,e,t),Jb[e]=t)}function Kb(e,t,n){n!==Jb[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Jb[t]=n)}function ex(e,t){for(const n in t)tx(e,n,t[n])}function tx(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function nx(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function ix(e){Vv.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}ft(ix,Vv,{svg(){return this._text},_render(e){const t=zb();t.open("svg",it({},Yy,{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",jb,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const n=Cv[t.marktype],i=n.tag,r=[Mb,n.attr];e.open("g",{class:Wv(t),"clip-path":t.clip?Og(this,t,t.group):null},Cb(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=vv(o);if(_e(t)){const n={x:0,dy:yv(o)};for(let i=0;i<t.length;++i)e.open("tspan",i?n:null).text(xv(o,t[i])).close()}else e.text(xv(o,t))}else if("g"===i){const i=o.strokeForeground,r=o.fill,a=o.stroke;i&&a&&(o.stroke=null),e.open("path",this.attr(t,o,n.background,"bgrect")).close(),e.open("g",this.attr(t,o,n.content)),Ey(o,(t=>this.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]):Ey(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;if("bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none"),"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"]=_v(t),e["font-size"]=gv(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const n in Lb){let i=t[n];const o=Lb[n];("transparent"!==i||"fill"!==o&&"stroke"!==o)&&null!=i&&(Tm(i)&&(i=zm(i,r.gradient,"")),e[o]=i)}for(const e in Bb){const n=t[e];null!=n&&(o=o||[],o.push(`${Bb[e]}: ${n};`))}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:Nm+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<r.length;++t)e.open("stop",{offset:r[t].offset,"stop-color":r[t].color}).close();e.close()}for(const t in n){const i=n[t];e.open("clipPath",{id:t}),i.path?e.open("path",{d:i.path}).close():e.open("rect",{x:0,y:0,width:i.width,height:i.height}).close(),e.close()}e.close()}}});const rx="canvas",ox="none",ax={Canvas:rx,PNG:"png",SVG:"svg",None:ox},sx={};function lx(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(sx[e]=t,this):sx[e]}function ux(e,t,n){const i=[],r=(new Ng).union(t),o=e.marktype;return o?cx(e,r,n,i):"group"===o?fx(e,r,n,i):oe("Intersect scene must be mark node or group item.")}function cx(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<a;++s)fx(r[s],t,n,i);else for(const e=Cv[o].isect;s<a;++s){const n=r[s];dx(n,t,e)&&i.push(n)}}return i}function fx(e,t,n,i){n&&n(e.mark)&&dx(e,t,Cv.group.isect)&&i.push(e);const r=e.items,o=r&&r.length;if(o){const a=e.x||0,s=e.y||0;t.translate(-a,-s);for(let e=0;e<o;++e)cx(r[e],t,n,i);t.translate(a,s)}return i}function dx(e,t,n){const i=e.bounds;return t.encloses(i)||t.intersects(i)&&n(e,t)}sx[rx]=sx.png={renderer:mb,headless:mb,handler:cb},sx.svg={renderer:qb,headless:ix,handler:yb},sx[ox]={};const hx=new Ng;function px(e){const t=e.clip;if(Ve(t))t(iy(hx.clear()));else{if(!t)return;hx.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(hx)}const mx=1e-9;function gx(e,t,n){return e===t||("path"===n?yx(e,t):e instanceof Date&&t instanceof Date?+e==+t:gt(e)&&gt(t)?Math.abs(e-t)<=mx:e&&t&&(we(e)||we(t))?function(e,t){var n,i,r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!gx(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function yx(e,t){return gx(Hm(e),Hm(t))}function vx(){Fg(),Om=0}const bx="top",xx="left",_x="right",wx="bottom",kx="start",Ex="middle",$x="end",Ax="x",Dx="y",Sx="group",Mx="axis",Cx="title",Fx="legend",Ox="row-header",Nx="row-footer",Tx="row-title",zx="column-header",Rx="column-footer",Px="column-title",Lx="fit-x",Bx="fit-y",jx="none",Ix="all",Ux="each",qx="flush",Wx="column",Hx="row";function Gx(e){ps.call(this,null,e)}function Yx(e,t,n){return t(e.bounds.clear(),e,n)}ft(Gx,ps,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=Cv[r],a=o.bound;let s,l=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),l=Yx(i,a),i.items.forEach((e=>{e.bounds.clear().union(l)}));else if(r===Sx||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),l.clear(),i.items.forEach((e=>l.union(Yx(e,a)))),i.role){case Mx:case Fx:case Cx:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{l.union(Yx(e,a))})),t.visit(t.MOD,(e=>{s=s||l.alignsWith(e.bounds),n.dirty(e),l.union(Yx(e,a))})),s&&(l.clear(),i.items.forEach((e=>l.union(e.bounds))));return px(i),t.modifies("bounds")}});const Vx=":vega_identifier:";function Xx(e){ps.call(this,0,e)}function Jx(e){ps.call(this,null,e)}function Qx(e){ps.call(this,null,e)}Xx.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ft(Xx,ps,{transform(e,t){const n=(r=t.dataflow)._signals[Vx]||(r._signals[Vx]=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}}),ft(Jx,ps,{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===Sx?zg:Tg;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 Zx={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&Kx(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},Kx=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),e_=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i<r;o=n,++i)if(Kx(o,n=e[i].bounds,t))return!0},t_=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},n_=e=>(e.forEach((e=>e.opacity=1)),e),i_=(e,t)=>e.reflow(t.modified()).modifies("opacity");function r_(e){ps.call(this,null,e)}ft(Qx,ps,{transform(e,t){const n=Zx[e.method]||Zx.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")&&(n_(a),t=i_(t,e)),t;if(a=a.filter(t_),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=n_(a),t=i_(t,e),r.length>=3&&e_(r,i)){do{r=n(r,i)}while(r.length>=3&&e_(r,i));r.length<3&&!De(a).opacity&&(r.length>1&&(De(r).opacity=0),De(a).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=((e,t,n)=>{var i=e.range(),r=new Ng;return t===bx||t===wx?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),e=>r.encloses(e.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),a.forEach((e=>{o(e)||(e.opacity=0)})));const s=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&s.union(e.bounds)})),t}}),ft(r_,ps,{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 o_=new Ng;function a_(e,t,n){return e[t]===n?0:(e[t]=n,1)}function s_(e){var t=e.items[0].orient;return t===xx||t===_x}function l_(e,t,n,i){var r,o,a=t.items[0],s=a.datum,l=null!=a.translate?a.translate:.5,u=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&&bv(g),x=0,_=0;switch(o_.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),u){case bx:x=h||0,_=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&u_(e,g,o,y,b,0,-1,v);break;case xx:x=-d,_=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&u_(e,g,o,y,b,1,-1,v);break;case _x:x=n+d,_=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&u_(e,g,o,y,b,1,1,v);break;case wx:x=h||0,_=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&u_(e,g,o,y,0,0,1,v);break;default:x=a.x,_=a.y}return Bg(v.translate(x,_),a),a_(a,"x",x+l)|a_(a,"y",_+l)&&(a.bounds=o_,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function u_(e,t,n,i,r,o,a,s){const l=t.bounds;if(t.auto){const s=a*(n+r+i);let u=0,c=0;e.dirty(t),o?u=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(l.translate(-u,-c)),e.dirty(t)}s.union(l)}const c_=(e,t)=>Math.floor(Math.min(e,t)),f_=(e,t)=>Math.ceil(Math.max(e,t));function d_(e){return(new Ng).set(0,0,e.width||0,e.height||0)}function h_(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function p_(e,t,n){const i=we(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function m_(e){return e<0?Math.ceil(-e):0}function g_(e,t,n){var i,r,o,a,s,l,u,c,f,d,h,p=!n.nodirty,m=n.bounds===qx?d_:h_,g=o_.set(0,0,0,0),y=p_(n.align,Wx),v=p_(n.align,Hx),b=p_(n.padding,Wx),x=p_(n.padding,Hx),_=n.columns||t.length,w=_<=0?1:Math.ceil(t.length/_),k=t.length,E=Array(k),$=Array(_),A=0,D=Array(k),S=Array(w),M=0,C=Array(k),F=Array(k),O=Array(k);for(r=0;r<_;++r)$[r]=0;for(r=0;r<w;++r)S[r]=0;for(r=0;r<k;++r)l=t[r],s=O[r]=m(l),l.x=l.x||0,C[r]=0,l.y=l.y||0,F[r]=0,o=r%_,a=~~(r/_),A=Math.max(A,u=Math.ceil(s.x2)),M=Math.max(M,c=Math.ceil(s.y2)),$[o]=Math.max($[o],u),S[a]=Math.max(S[a],c),E[r]=b+m_(s.x1),D[r]=x+m_(s.y1),p&&e.dirty(t[r]);for(r=0;r<k;++r)r%_==0&&(E[r]=0),r<_&&(D[r]=0);if(y===Ux)for(o=1;o<_;++o){for(h=0,r=o;r<k;r+=_)h<E[r]&&(h=E[r]);for(r=o;r<k;r+=_)E[r]=h+$[o-1]}else if(y===Ix){for(h=0,r=0;r<k;++r)r%_&&h<E[r]&&(h=E[r]);for(r=0;r<k;++r)r%_&&(E[r]=h+A)}else for(y=!1,o=1;o<_;++o)for(r=o;r<k;r+=_)E[r]+=$[o-1];if(v===Ux)for(a=1;a<w;++a){for(h=0,i=(r=a*_)+_;r<i;++r)h<D[r]&&(h=D[r]);for(r=a*_;r<i;++r)D[r]=h+S[a-1]}else if(v===Ix){for(h=0,r=_;r<k;++r)h<D[r]&&(h=D[r]);for(r=_;r<k;++r)D[r]=h+M}else for(v=!1,a=1;a<w;++a)for(i=(r=a*_)+_;r<i;++r)D[r]+=S[a-1];for(f=0,r=0;r<k;++r)f=E[r]+(r%_?f:0),C[r]+=f-t[r].x;for(o=0;o<_;++o)for(d=0,r=o;r<k;r+=_)d+=D[r],F[r]+=d-t[r].y;if(y&&p_(n.center,Wx)&&w>1)for(r=0;r<k;++r)(f=(s=y===Ix?A:$[r%_])-O[r].x2-t[r].x-C[r])>0&&(C[r]+=f/2);if(v&&p_(n.center,Hx)&&1!==_)for(r=0;r<k;++r)(d=(s=v===Ix?M:S[~~(r/_)])-O[r].y2-t[r].y-F[r])>0&&(F[r]+=d/2);for(r=0;r<k;++r)g.union(O[r].translate(C[r],F[r]));switch(f=p_(n.anchor,Ax),d=p_(n.anchor,Dx),p_(n.anchor,Wx)){case $x:f-=g.width();break;case Ex:f-=g.width()/2}switch(p_(n.anchor,Hx)){case $x:d-=g.height();break;case Ex:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),r=0;r<k;++r)t[r].mark.bounds.clear();for(r=0;r<k;++r)(l=t[r]).x+=C[r]+=f,l.y+=F[r]+=d,g.union(l.mark.bounds.union(l.bounds.translate(C[r],F[r]))),p&&e.dirty(l);return g}function y_(e,t){return"x1"===t?e.x||0:"y1"===t?e.y||0:"x2"===t?(e.x||0)+(e.width||0):"y2"===t?(e.y||0)+(e.height||0):void 0}function v_(e,t){return e.bounds[t]}function b_(e,t,n,i,r,o,a,s,l,u,c,f,d,h){var p,m,g,y,v,b,x,_,w,k=n.length,E=0,$=0;if(!k)return E;for(p=c;p<k;p+=f)n[p]&&(E=a(E,l(n[p],u)));if(!t.length)return E;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),E+=o,m=0,y=t.length;m<y;++m)e.dirty(t[m]),t[m].mark.bounds.clear();for(p=c,m=0,y=t.length;m<y;++m,p+=f){for(v=(b=t[m]).mark.bounds,g=p;g>=0&&null==(x=n[g]);g-=d);s?(_=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),w=E):(_=E,w=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(_-(b.x||0),w-(b.y||0))),b.x=_,b.y=w,e.dirty(b),$=a($,v[u])}return $}function x_(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 __(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),l=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)),u=s("anchor",kx),c=u===$x?1:u===Ex?.5:0,f={align:Ux,bounds:s("bounds",qx),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case xx:f.anchor={x:Math.floor(i.x1)-l,column:$x,y:c*(a||i.height()+2*i.y1),row:u};break;case _x:f.anchor={x:Math.ceil(i.x2)+l,y:c*(a||i.height()+2*i.y1),row:u};break;case bx:f.anchor={y:Math.floor(r.y1)-l,row:$x,x:c*(o||r.width()+2*r.x1),column:u};break;case wx:f.anchor={y:Math.ceil(r.y2)+l,x:c*(o||r.width()+2*r.x1),column:u};break;case"top-left":f.anchor={x:l,y:l};break;case"top-right":f.anchor={x:o-l,y:l,column:$x};break;case"bottom-left":f.anchor={x:l,y:a-l,row:$x};break;case"bottom-right":f.anchor={x:o-l,y:a-l,column:$x,row:$x}}return f}function w_(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,l=r.x,u=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,l=t.titlePadding||0,u=i-a.x,c=i-a.y;switch(a.orient){case xx:r+=Math.ceil(a.bounds.width())+l;break;case _x:case wx:break;default:o+=a.bounds.height()+l}switch((r||o)&&E_(e,n,r,o),a.orient){case xx:c+=k_(t,n,a,s,1,1);break;case _x:u+=k_(t,n,a,$x,0,0)+l,c+=k_(t,n,a,s,1,1);break;case wx:u+=k_(t,n,a,s,0,0),c+=k_(t,n,a,$x,-1,0,1)+l;break;default:u+=k_(t,n,a,s,0,0)}(u||c)&&E_(e,a,u,c),(u=Math.round(a.bounds.x1-i))<0&&(E_(e,n,-u,0),E_(e,a,-u,0))}else(r||o)&&E_(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!==jx&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,Bg(s.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(s),r}function k_(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,l=n.datum.vgrad,u=(!s||!o&&l||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=l&&o?u:0,f=l&&o?0:u,d=r<=0?0:bv(n);return Math.round(i===kx?c:i===$x?f-d:.5*(u-d))}function E_(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 $_(e){ps.call(this,null,e)}function A_(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function D_(e){ps.call(this,null,e)}function S_(e){ps.call(this,null,e)}function M_(){return La({})}function C_(e){ps.call(this,null,e)}function F_(e){ps.call(this,[],e)}ft($_,ps,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&function(e,t,n){var i,r,o,a,s,l,u,c=function(e){var t,n,i=e.items,r=i.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<r;++o)if(n=(t=i[o]).items,t.marktype===Sx)switch(t.role){case Mx:case Fx:case Cx:break;case Ox:a.rowheaders.push(...n);break;case Nx:a.rowfooters.push(...n);break;case zx:a.colheaders.push(...n);break;case Rx:a.colfooters.push(...n);break;case Tx:a.rowtitle=n[0];break;case Px:a.coltitle=n[0];break;default:a.marks.push(...n)}return a}(t),f=c.marks,d=n.bounds===qx?y_:v_,h=n.offset,p=n.columns||f.length,m=p<=0?1:Math.ceil(f.length/p),g=m*p;const y=g_(e,f,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(l=p_(n.headerBand,Hx,null),i=b_(e,c.rowheaders,f,0,m,-p_(h,"rowHeader"),c_,0,d,"x1",0,p,1,l)),c.colheaders&&(l=p_(n.headerBand,Wx,null),r=b_(e,c.colheaders,f,0,p,-p_(h,"columnHeader"),c_,1,d,"y1",0,1,p,l)),c.rowfooters&&(l=p_(n.footerBand,Hx,null),o=b_(e,c.rowfooters,f,0,m,p_(h,"rowFooter"),f_,0,d,"x2",p-1,p,1,l)),c.colfooters&&(l=p_(n.footerBand,Wx,null),a=b_(e,c.colfooters,f,0,p,p_(h,"columnFooter"),f_,1,d,"y2",g-p,1,p,l)),c.rowtitle&&(s=p_(n.titleAnchor,Hx),u=p_(h,"rowTitle"),u=s===$x?o+u:i-u,l=p_(n.titleBand,Hx,.5),x_(e,c.rowtitle,u,0,y,l)),c.coltitle&&(s=p_(n.titleAnchor,Wx),u=p_(h,"columnTitle"),u=s===$x?a+u:r-u,l=p_(n.titleBand,Wx,.5),x_(e,c.coltitle,u,1,y,l))}(n,t,e.layout),function(e,t,n){var i,r,o,a,s,l=t.items,u=Math.max(0,t.width||0),c=Math.max(0,t.height||0),f=(new Ng).set(0,0,u,c),d=f.clone(),h=f.clone(),p=[];for(a=0,s=l.length;a<s;++a)switch((r=l[a]).role){case Mx:(s_(r)?d:h).union(l_(e,r,u,c));break;case Cx:i=r;break;case Fx:p.push(w_(e,r));break;case"frame":case"scope":case Ox:case Nx:case Tx:case zx:case Rx:case Px:d.union(r.bounds),h.union(r.bounds);break;default:f.union(r.bounds)}if(p.length){const t={};p.forEach((e=>{(o=e.orient||_x)!==jx&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];g_(e,r,__(r,i,n.legends,d,h,u,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||"fit"!==n.autosize.type&&n.autosize.type!==Lx&&n.autosize.type!==Bx)f.union(i);else switch(t.orient){case xx:case _x:f.add(i.x1,0).add(i.x2,0);break;case bx:case wx: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,l=a.orient,u=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=l===xx||l===_x?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Sx?l===xx?(m=r.y2,p=r.y1):l===_x?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):l===xx&&(m=i,p=0),o=u===kx?m:u===$x?p:(m+p)/2,h&&h.text){switch(l){case bx:case wx:b=d.bounds.height()+f;break;case xx:v=d.bounds.width()+f;break;case _x:v=-d.bounds.width()-f}o_.clear().union(h.bounds),o_.translate(v-(h.x||0),b-(h.y||0)),a_(h,"x",v)|a_(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(o_),h.mark.bounds.clear().union(o_),e.dirty(h)),o_.clear().union(h.bounds)}else o_.clear();switch(o_.union(d.bounds),l){case bx:g=o,y=r.y1-o_.height()-c;break;case xx:g=r.x1-o_.width()-c,y=o;break;case _x:g=r.x2+o_.width()+c,y=o;break;case wx:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return a_(a,"x",g)|a_(a,"y",y)&&(o_.translate(g,y),e.dirty(a),a.bounds.clear().union(o_),t.bounds.clear().union(o_),e.dirty(a)),a.bounds}(e,i,u,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,l=Math.max(0,t.width||0),u=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-l)),h=Math.max(0,Math.ceil(n.y2-c));if("padding"===r.contains){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===jx?(u=0,f=0,l=a,c=s):"fit"===o?(l=Math.max(0,a-u-d),c=Math.max(0,s-f-h)):o===Lx?(l=Math.max(0,a-u-d),s=c+f+h):o===Bx?(a=l+u+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=l+u+d,s=c+f+h),e._resizeView(a,s,l,c,[u,f],r.resize)}(e,t,f,n)}(n,t,e)})),function(e){return e&&"legend-entry"!==e.mark.role}(e.mark.group)?t.reflow():t}}),ft(D_,ps,{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=gm(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||bm(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?ym(o,e.values,a):vm(o,a);return r&&(i.rem=r),r=l.map(((e,t)=>La({index:t/(l.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(La({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),ft(S_,ps,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||M_,o=e.key||Ra,a=this.value;return _e(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&oe("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=ut().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}}),ft(C_,ps,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(_e(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||he,l=r.enter||he,u=r.exit||he,c=(o&&!a?r[o]:s)||he;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{l(t,e),s(t,e)})),n.modifies(l.output),n.modifies(s.output),c!==he&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&u!==he&&(t.visit(t.REM,(t=>{u(t,e)})),n.modifies(u.output)),a||c!==he){const r=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(r,(t=>{const r=l(t,e)||i;(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(l.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}}),ft(F_,ps,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,o,a,s=t.dataflow.locale(),l=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=this.value,c=e.type||fm,f=e.scale,d=+e.limit,h=gm(f,null==e.count?5:e.count,e.minstep),p=!!e.values||c===fm,m=e.format||$m(s,f,h,c,e.formatSpecifier,e.formatType,p),g=e.values||km(f,h);return u&&(l.rem=u),c===fm?(d&&g.length>d?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),u=g.slice(0,d-1),a=!0):u=g,Ve(r=e.size)?(e.values||0!==f(u[0])||(u=u.slice(1)),o=u.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=tt(o=r||8),u=u.map(((t,n)=>La({index:n,label:m(t,n,u),value:t,offset:o,size:r(t,e)}))),a&&(a=g[u.length],u.push(La({index:u.length,label:`…${g.length-u.length} entries`,value:a,offset:o,size:r(a,e)})))):"gradient"===c?(n=f.domain(),i=om(f,n[0],De(n)),g.length<3&&!e.values&&n[0]!==De(n)&&(g=[n[0],De(n)]),u=g.map(((e,t)=>La({index:t,label:m(e,t,g),value:e,perc:i(e)})))):(r=g.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+De(t),o=r-i;if(e.type===Mp){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(f),u=g.map(((e,t)=>La({index:t,label:m(e,t,g),value:e,perc:t?i(e):0,perc2:t===r?1:i(g[t+1])})))),l.source=u,l.add=u,this.value=u,l}});const O_=e=>e.source.x,N_=e=>e.source.y,T_=e=>e.target.x,z_=e=>e.target.y;function R_(e){ps.call(this,{},e)}R_.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"}]},ft(R_,ps,{transform(e,t){var n=e.sourceX||O_,i=e.sourceY||N_,r=e.targetX||T_,o=e.targetY||z_,a=e.as||"path",s=e.orient||"vertical",l=e.shape||"line",u=j_.get(l+"-"+s)||j_.get(l);return u||oe("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=u(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const P_=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,L_=(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},B_=(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},j_=ut({line:P_,"line-radial":(e,t,n,i)=>P_(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:L_,"arc-radial":(e,t,n,i)=>L_(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:B_,"curve-radial":(e,t,n,i)=>B_(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),l=(t+i)/2;return"M"+t*r+","+t*o+"C"+l*r+","+l*o+" "+l*a+","+l*s+" "+i*a+","+i*s}});function I_(e){ps.call(this,null,e)}I_.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"]}]},ft(I_,ps,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],l=e.field||fe,u=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(l),h=d.length,p=u,m=(c-u)/A_(d),g=El(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;n<h;++n)r=d[g[n]],(i=f[g[n]])[a]=p,i[s]=p+=r*m;return this.value=d,t.reflow(e.modified()).modifies(o)}});function U_(e){return Xp(e)&&e!==$p}const q_=Ot(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function W_(e){ps.call(this,null,e),this.modified(!0)}function H_(e,t,n){Zp(e)&&(Math.abs(t.reduce(((e,t)=>e+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+Dt(t)));return t}function G_(e,t,n){return Ve(e)&&(t||n)?nm(e,Y_(t||[0,1],n)):e}function Y_(e,t){return t?e.slice().reverse():e}function V_(e){ps.call(this,null,e)}ft(W_,ps,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";return n===$p?$p+"-"+vp:(function(e){const t=e.type;return Xp(t)&&t!==kp&&t!==Ep&&(e.scheme||e.range&&e.range.length&&e.range.every(vt))}(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?$p+"-":3===t?Ap+"-":""),(i+n||vp).toLowerCase())}(e);for(r in i&&r===i.type||(this.value=i=Gp(r)()),e)if(!q_[r]){if("padding"===r&&U_(i.type))continue;Ve(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!==Op&&e!==Fp&&oe("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===Fp?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*yp(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;return _e(t.scheme)?i=im(t.scheme,t.interpolate,t.interpolateGamma):(i=cm(t.scheme.toLowerCase()))||oe(`Unrecognized scheme name: ${t.scheme}`),n=e===Mp?n+1:e===Np?n-1:e===Dp||e===Sp?+t.schemeCount||5:n,Kp(e)?G_(i,r,t.reverse):Ve(i)?rm(G_(i,r),n):e===Cp?i:i.slice(0,n)}(i,t,n),Ve(o))){if(e.interpolator)return e.interpolator(o);oe(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&Kp(i))return e.interpolator(im(Y_(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(am(t.interpolate,t.interpolateGamma)):Ve(e.round)?e.round(r):Ve(e.rangeRound)&&e.interpolate(r?_d:xd),o&&e.range(Y_(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!_e(i)){const t=e.domain(),n=t[0],r=De(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||oe("Scale bins parameter missing step property."),a<n&&(a=o*Math.ceil(n/o)),s>r&&(s=o*Math.floor(r/o)),i=El(a,s+o/2,o)}return i?e.bins=i:e.bins&&delete e.bins,e.type===Np&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain()),n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(H_(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,l=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===vp||t===xp||t===_p)}(e);if(!a)return 0;if(U_(s)&&t.padding&&a[0]!==De(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs(De(n)-n[0]),s=a/(a-2*i),l=e===bp?Ie(t,null,s):e===_p?Ue(t,null,s,.5):e===xp?Ue(t,null,s,r||1):e===wp?qe(t,null,s,o||1):je(t,null,s);return(t=t.slice())[0]=l[0],t[t.length-1]=l[1],t}(s,a,t.range,t.padding,t.exponent,t.constant)),(l||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,l&&(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:o<a[0]?0:r;e!==r&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(e,0,o)}return e.domain(H_(s,a,n)),s===Cp&&e.unknown(t.domainImplicit?vh:void 0),t.nice&&e.nice&&e.nice(!0!==t.nice&&gm(e,t.nice)||null),a.length}(i,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),ft(V_,ps,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(Ua(e.sort)),this.modified(n),t}});const X_="zero",J_="center",Q_="normalize",Z_=["y0","y1"];function K_(e){ps.call(this,null,e)}function ew(e,t,n,i,r){for(var o,a=(t-e.sum)/2,s=e.length,l=0;l<s;++l)(o=e[l])[i]=a,o[r]=a+=Math.abs(n(o))}function tw(e,t,n,i,r){for(var o,a=1/e.sum,s=0,l=e.length,u=0,c=0;u<l;++u)(o=e[u])[i]=s,o[r]=s=a*(c+=Math.abs(n(o)))}function nw(e,t,n,i,r){for(var o,a,s=0,l=0,u=e.length,c=0;c<u;++c)(o=+n(a=e[c]))<0?(a[i]=l,a[r]=l+=o):(a[i]=s,a[r]=s+=o)}K_.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:X_,values:[X_,J_,Q_]},{name:"as",type:"string",array:!0,length:2,default:Z_}]},ft(K_,ps,{transform(e,t){var n,i,r,o,a=e.as||Z_,s=a[0],l=a[1],u=Ua(e.sort),c=e.field||fe,f=e.offset===J_?ew:e.offset===Q_?tw:nw;for(n=function(e,t,n,i){var r,o,a,s,l,u,c,f,d,h=[],p=e=>e(l);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;o<a;++o)l=e[o],(c=r[u=t.map(p)])||(r[u]=c=[],h.push(c)),c.push(l);for(u=0,d=0,s=h.length;u<s;++u){for(o=0,f=0,a=(c=h[u]).length;o<a;++o)f+=Math.abs(i(c[o]));c.sum=f,f>d&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,u,c),i=0,r=n.length,o=n.max;i<r;++i)f(n[i],o,c,s,l);return t.reflow(e.modified()).modifies(a)}});const iw=e=>e;function rw(e,t){e&&aw.hasOwnProperty(e.type)&&aw[e.type](e,t)}var ow={Feature:function(e,t){rw(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i<r;)rw(n[i].geometry,t)}},aw={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)e=n[i],t.point(e[0],e[1],e[2])},LineString:function(e,t){sw(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)sw(n[i],t,0)},Polygon:function(e,t){lw(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)lw(n[i],t)},GeometryCollection:function(e,t){for(var n=e.geometries,i=-1,r=n.length;++i<r;)rw(n[i],t)}};function sw(e,t,n){var i,r=-1,o=e.length-n;for(t.lineStart();++r<o;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function lw(e,t){var n=-1,i=e.length;for(t.polygonStart();++n<i;)sw(e[n],t,1);t.polygonEnd()}function uw(e,t){e&&ow.hasOwnProperty(e.type)?ow[e.type](e,t):rw(e,t)}class cw{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const r=t[i],o=e+r,a=Math.abs(e)<Math.abs(r)?e-(o-r):r-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t,n,i,r=this._n,o=0;if(r>0){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}}var fw=1e-6,dw=1e-12,hw=Math.PI,pw=hw/2,mw=hw/4,gw=2*hw,yw=180/hw,vw=hw/180,bw=Math.abs,xw=Math.atan,_w=Math.atan2,ww=Math.cos,kw=Math.ceil,Ew=Math.exp,$w=(Math.floor,Math.hypot),Aw=Math.log,Dw=Math.pow,Sw=Math.sin,Mw=Math.sign||function(e){return e>0?1:e<0?-1:0},Cw=Math.sqrt,Fw=Math.tan;function Ow(e){return e>1?0:e<-1?hw:Math.acos(e)}function Nw(e){return e>1?pw:e<-1?-pw:Math.asin(e)}function Tw(){}var zw,Rw,Pw,Lw,Bw=new cw,jw=new cw,Iw={point:Tw,lineStart:Tw,lineEnd:Tw,polygonStart:function(){Iw.lineStart=Uw,Iw.lineEnd=Hw},polygonEnd:function(){Iw.lineStart=Iw.lineEnd=Iw.point=Tw,Bw.add(bw(jw)),jw=new cw},result:function(){var e=Bw/2;return Bw=new cw,e}};function Uw(){Iw.point=qw}function qw(e,t){Iw.point=Ww,zw=Pw=e,Rw=Lw=t}function Ww(e,t){jw.add(Lw*e-Pw*t),Pw=e,Lw=t}function Hw(){Ww(zw,Rw)}const Gw=Iw;var Yw=1/0,Vw=Yw,Xw=-Yw,Jw=Xw,Qw={point:function(e,t){e<Yw&&(Yw=e),e>Xw&&(Xw=e),t<Vw&&(Vw=t),t>Jw&&(Jw=t)},lineStart:Tw,lineEnd:Tw,polygonStart:Tw,polygonEnd:Tw,result:function(){var e=[[Yw,Vw],[Xw,Jw]];return Xw=Jw=-(Vw=Yw=1/0),e}};const Zw=Qw;var Kw,ek,tk,nk,ik=0,rk=0,ok=0,ak=0,sk=0,lk=0,uk=0,ck=0,fk=0,dk={point:hk,lineStart:pk,lineEnd:yk,polygonStart:function(){dk.lineStart=vk,dk.lineEnd=bk},polygonEnd:function(){dk.point=hk,dk.lineStart=pk,dk.lineEnd=yk},result:function(){var e=fk?[uk/fk,ck/fk]:lk?[ak/lk,sk/lk]:ok?[ik/ok,rk/ok]:[NaN,NaN];return ik=rk=ok=ak=sk=lk=uk=ck=fk=0,e}};function hk(e,t){ik+=e,rk+=t,++ok}function pk(){dk.point=mk}function mk(e,t){dk.point=gk,hk(tk=e,nk=t)}function gk(e,t){var n=e-tk,i=t-nk,r=Cw(n*n+i*i);ak+=r*(tk+e)/2,sk+=r*(nk+t)/2,lk+=r,hk(tk=e,nk=t)}function yk(){dk.point=hk}function vk(){dk.point=xk}function bk(){_k(Kw,ek)}function xk(e,t){dk.point=_k,hk(Kw=tk=e,ek=nk=t)}function _k(e,t){var n=e-tk,i=t-nk,r=Cw(n*n+i*i);ak+=r*(tk+e)/2,sk+=r*(nk+t)/2,lk+=r,uk+=(r=nk*e-tk*t)*(tk+e),ck+=r*(nk+t),fk+=3*r,hk(tk=e,nk=t)}const wk=dk;function kk(e){this._context=e}kk.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,gw)}},result:Tw};var Ek,$k,Ak,Dk,Sk,Mk=new cw,Ck={point:Tw,lineStart:function(){Ck.point=Fk},lineEnd:function(){Ek&&Ok($k,Ak),Ck.point=Tw},polygonStart:function(){Ek=!0},polygonEnd:function(){Ek=null},result:function(){var e=+Mk;return Mk=new cw,e}};function Fk(e,t){Ck.point=Ok,$k=Dk=e,Ak=Sk=t}function Ok(e,t){Dk-=e,Sk-=t,Mk.add(Cw(Dk*Dk+Sk*Sk)),Dk=e,Sk=t}const Nk=Ck;let Tk,zk,Rk,Pk;class Lk{constructor(e){this._append=null==e?Bk:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Bk;if(t!==Tk){const e=10**t;Tk=t,zk=function(t){let n=1;this._+=t[0];for(const i=t.length;n<i;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return zk}(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==Rk||this._append!==zk){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,Rk=e,zk=this._append,Pk=this._,this._=t}this._+=Pk}}result(){const e=this._;return this._="",e.length?e:null}}function Bk(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function jk(e,t){let n,i,r=3,o=4.5;function a(e){return e&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),uw(e,n(i))),i.result()}return a.area=function(e){return uw(e,n(Gw)),Gw.result()},a.measure=function(e){return uw(e,n(Nk)),Nk.result()},a.bounds=function(e){return uw(e,n(Zw)),Zw.result()},a.centroid=function(e){return uw(e,n(wk)),wk.result()},a.projection=function(t){return arguments.length?(n=null==t?(e=null,iw):(e=t).stream,a):e},a.context=function(e){return arguments.length?(i=null==e?(t=null,new Lk(r)):new kk(t=e),"function"!=typeof o&&i.pointRadius(o),a):t},a.pointRadius=function(e){return arguments.length?(o="function"==typeof e?e:(i.pointRadius(+e),+e),a):o},a.digits=function(e){if(!arguments.length)return r;if(null==e)r=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new Lk(r)),a},a.projection(e).digits(r).context(t)}function Ik(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Tw,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Uk(e,t){return bw(e[0]-t[0])<fw&&bw(e[1]-t[1])<fw}function qk(e,t,n,i){this.x=e,this.z=t,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function Wk(e,t,n,i,r){var o,a,s=[],l=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n,i=e[0],a=e[t];if(Uk(i,a)){if(!i[2]&&!a[2]){for(r.lineStart(),o=0;o<t;++o)r.point((i=e[o])[0],i[1]);return void r.lineEnd()}a[0]+=2*fw}s.push(n=new qk(i,e,null,!0)),l.push(n.o=new qk(i,null,n,!1)),s.push(n=new qk(a,e,null,!1)),l.push(n.o=new qk(a,null,n,!0))}})),s.length){for(l.sort(t),Hk(s),Hk(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var u,c,f=s[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,a=u.length;o<a;++o)r.point((c=u[o])[0],c[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(h)for(u=d.p.z,o=u.length-1;o>=0;--o)r.point((c=u[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}u=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function Hk(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i<t;)r.n=n=e[i],n.p=r,r=n;r.n=n=e[0],n.p=r}}function Gk(e){return[_w(e[1],e[0]),Nw(e[2])]}function Yk(e){var t=e[0],n=e[1],i=ww(n);return[i*ww(t),i*Sw(t),Sw(n)]}function Vk(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Xk(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 Jk(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Qk(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Zk(e){var t=Cw(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Kk(e){return bw(e[0])<=hw?e[0]:Mw(e[0])*((bw(e[0])+hw)%gw-hw)}function eE(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function tE(e,t,n,i){return function(r){var o,a,s,l=t(r),u=Ik(),c=t(u),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=v,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,a=eE(a);var e=function(e,t){var n=Kk(t),i=t[1],r=Sw(i),o=[Sw(n),-ww(n),0],a=0,s=0,l=new cw;1===r?i=pw+fw:-1===r&&(i=-pw-fw);for(var u=0,c=e.length;u<c;++u)if(d=(f=e[u]).length)for(var f,d,h=f[d-1],p=Kk(h),m=h[1]/2+mw,g=Sw(m),y=ww(m),v=0;v<d;++v,p=x,g=w,y=k,h=b){var b=f[v],x=Kk(b),_=b[1]/2+mw,w=Sw(_),k=ww(_),E=x-p,$=E>=0?1:-1,A=$*E,D=A>hw,S=g*w;if(l.add(_w(S*$*Sw(A),y*k+S*ww(A))),a+=D?E+$*gw:E,D^p>=n^x>=n){var M=Xk(Yk(h),Yk(b));Zk(M);var C=Xk(o,M);Zk(C);var F=(D^E>=0?-1:1)*Nw(C[2]);(i>F||i===F&&(M[0]||M[1]))&&(s+=D^E>=0?1:-1)}}return(a<-fw||a<fw&&l<-dw)^1&s}(o,i);a.length?(f||(r.polygonStart(),f=!0),Wk(a,iE,e,n,r)):e&&(f||(r.polygonStart(),f=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),f&&(r.polygonEnd(),f=!1),a=o=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function h(t,n){e(t,n)&&r.point(t,n)}function p(e,t){l.point(e,t)}function m(){d.point=p,l.lineStart()}function g(){d.point=h,l.lineEnd()}function y(e,t){s.push([e,t]),c.point(e,t)}function v(){c.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),c.lineEnd();var e,t,n,i,l=c.clean(),d=u.result(),h=d.length;if(s.pop(),o.push(s),s=null,h)if(1&l){if((t=(n=d[0]).length-1)>0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e<t;++e)r.point((i=n[e])[0],i[1]);r.lineEnd()}}else h>1&&2&l&&d.push(d.pop().concat(d.shift())),a.push(d.filter(nE))}return d}}function nE(e){return e.length>1}function iE(e,t){return((e=e.x)[0]<0?e[1]-pw-fw:pw-e[1])-((t=t.x)[0]<0?t[1]-pw-fw:pw-t[1])}const rE=tE((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?hw:-hw,l=bw(o-n);bw(l-hw)<fw?(e.point(n,i=(i+a)/2>0?pw:-pw),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&l>=hw&&(bw(n-r)<fw&&(n-=r*fw),bw(o-s)<fw&&(o-=s*fw),i=function(e,t,n,i){var r,o,a=Sw(e-n);return bw(a)>fw?xw((Sw(t)*(o=ww(i))*Sw(n)-Sw(i)*(r=ww(t))*Sw(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*pw,i.point(-hw,r),i.point(0,r),i.point(hw,r),i.point(hw,0),i.point(hw,-r),i.point(0,-r),i.point(-hw,-r),i.point(-hw,0),i.point(-hw,r);else if(bw(e[0]-t[0])>fw){var o=e[0]<t[0]?hw:-hw;r=n*o/2,i.point(-o,r),i.point(0,r),i.point(o,r)}else i.point(t[0],t[1])}),[-hw,-pw]);function oE(e,t){(t=Yk(t))[0]-=e,Zk(t);var n=Ow(-t[1]);return((-t[2]<0?-n:n)+gw-fw)%gw}var aE=1e9,sE=-aE;function lE(e,t,n,i){function r(r,o){return e<=r&&r<=n&&t<=o&&o<=i}function o(r,o,s,u){var c=0,f=0;if(null==r||(c=a(r,s))!==(f=a(o,s))||l(r,o)<0^s>0)do{u.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else u.point(o[0],o[1])}function a(i,r){return bw(i[0]-e)<fw?r>0?0:3:bw(i[0]-n)<fw?r>0?2:1:bw(i[1]-t)<fw?r>0?1:0:r>0?3:2}function s(e,t){return l(e.x,t.x)}function l(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 l,u,c,f,d,h,p,m,g,y,v,b=a,x=Ik(),_={point:w,lineStart:function(){_.point=k,u&&u.push(c=[]),y=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(k(f,d),h&&g&&x.rejoin(),l.push(x.result())),_.point=w,g&&b.lineEnd()},polygonStart:function(){b=x,l=[],u=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=u.length;n<r;++n)for(var o,a,s=u[n],l=1,c=s.length,f=s[0],d=f[0],h=f[1];l<c;++l)o=d,a=h,d=(f=s[l])[0],h=f[1],a<=i?h>i&&(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=(l=eE(l)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&Wk(l,s,t,o,a),a.polygonEnd()),b=a,l=u=c=null}};function w(e,t){r(e,t)&&b.point(e,t)}function k(o,a){var s=r(o,a);if(u&&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 l=[p=Math.max(sE,Math.min(aE,p)),m=Math.max(sE,Math.min(aE,m))],x=[o=Math.max(sE,Math.min(aE,o)),a=Math.max(sE,Math.min(aE,a))];!function(e,t,n,i,r,o){var a,s=e[0],l=e[1],u=0,c=1,f=t[0]-s,d=t[1]-l;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a<u)return;a<c&&(c=a)}else if(f>0){if(a>c)return;a>u&&(u=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>u&&(u=a)}else if(f>0){if(a<u)return;a<c&&(c=a)}if(a=i-l,d||!(a>0)){if(a/=d,d<0){if(a<u)return;a<c&&(c=a)}else if(d>0){if(a>c)return;a>u&&(u=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>u&&(u=a)}else if(d>0){if(a<u)return;a<c&&(c=a)}return u>0&&(e[0]=s+u*f,e[1]=l+u*d),c<1&&(t[0]=s+c*f,t[1]=l+c*d),!0}}}}}(l,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return _}}function uE(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function cE(e,t){return bw(e)>hw&&(e-=Math.round(e/gw)*gw),[e,t]}function fE(e,t,n){return(e%=gw)?t||n?uE(hE(e),pE(t,n)):hE(e):t||n?pE(t,n):cE}function dE(e){return function(t,n){return bw(t+=e)>hw&&(t-=Math.round(t/gw)*gw),[t,n]}}function hE(e){var t=dE(e);return t.invert=dE(-e),t}function pE(e,t){var n=ww(e),i=Sw(e),r=ww(t),o=Sw(t);function a(e,t){var a=ww(t),s=ww(e)*a,l=Sw(e)*a,u=Sw(t),c=u*n+s*i;return[_w(l*r-c*o,s*n-u*i),Nw(c*r+l*o)]}return a.invert=function(e,t){var a=ww(t),s=ww(e)*a,l=Sw(e)*a,u=Sw(t),c=u*r-l*o;return[_w(l*r+u*o,s*n+c*i),Nw(c*n-s*i)]},a}function mE(e){return function(t){var n=new gE;for(var i in e)n[i]=e[i];return n.stream=t,n}}function gE(){}function yE(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),uw(n,e.stream(Zw)),t(Zw.result()),null!=i&&e.clipExtent(i),e}function vE(e,t,n){return yE(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 bE(e,t,n){return vE(e,[[0,0],t],n)}function xE(e,t,n){return yE(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 _E(e,t,n){return yE(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)}cE.invert=cE,gE.prototype={constructor:gE,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 wE=16,kE=ww(30*vw);function EE(e,t){return+t?function(e,t){function n(i,r,o,a,s,l,u,c,f,d,h,p,m,g){var y=u-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,_=s+h,w=l+p,k=Cw(x*x+_*_+w*w),E=Nw(w/=k),$=bw(bw(w)-1)<fw||bw(o-f)<fw?(o+f)/2:_w(_,x),A=e($,E),D=A[0],S=A[1],M=D-i,C=S-r,F=v*M-y*C;(F*F/b>t||bw((y*M+v*C)/b-.5)>.3||a*d+s*h+l*p<kE)&&(n(i,r,o,a,s,l,D,S,$,x/=k,_/=k,w,m,g),g.point(D,S),n(D,S,$,x,_,w,u,c,f,d,h,p,m,g))}}return function(t){var i,r,o,a,s,l,u,c,f,d,h,p,m={point:g,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),m.lineStart=x},polygonEnd:function(){t.polygonEnd(),m.lineStart=y}};function g(n,i){n=e(n,i),t.point(n[0],n[1])}function y(){c=NaN,m.point=v,t.lineStart()}function v(i,r){var o=Yk([i,r]),a=e(i,r);n(c,f,u,d,h,p,c=a[0],f=a[1],u=i,d=o[0],h=o[1],p=o[2],wE,t),t.point(c,f)}function b(){m.point=g,t.lineEnd()}function x(){y(),m.point=_,m.lineEnd=w}function _(e,t){v(i=e,t),r=c,o=f,a=d,s=h,l=p,m.point=v}function w(){n(c,f,u,d,h,p,r,o,i,a,s,l,wE,t),m.lineEnd=b,b()}return m}}(e,t):function(e){return mE({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}var $E=mE({point:function(e,t){this.stream.point(e*vw,t*vw)}});function AE(e,t,n,i,r,o){if(!o)return function(e,t,n,i,r){function o(o,a){return[t+e*(o*=i),n-e*(a*=r)]}return o.invert=function(o,a){return[(o-t)/e*i,(n-a)/e*r]},o}(e,t,n,i,r);var a=ww(o),s=Sw(o),l=a*e,u=s*e,c=a/e,f=s/e,d=(s*n-a*t)/e,h=(s*t+a*n)/e;function p(e,o){return[l*(e*=i)-u*(o*=r)+t,n-u*e-l*o]}return p.invert=function(e,t){return[i*(c*e-f*t+d),r*(h-f*e-c*t)]},p}function DE(e){return SE((function(){return e}))()}function SE(e){var t,n,i,r,o,a,s,l,u,c,f=150,d=480,h=250,p=0,m=0,g=0,y=0,v=0,b=0,x=1,_=1,w=null,k=rE,E=null,$=iw,A=.5;function D(e){return l(e[0]*vw,e[1]*vw)}function S(e){return(e=l.invert(e[0],e[1]))&&[e[0]*yw,e[1]*yw]}function M(){var e=AE(f,0,0,x,_,b).apply(null,t(p,m)),i=AE(f,d-e[0],h-e[1],x,_,b);return n=fE(g,y,v),s=uE(t,i),l=uE(n,s),a=EE(s,A),C()}function C(){return u=c=null,D}return D.stream=function(e){return u&&c===e?u:u=$E(function(e){return mE({point:function(t,n){var i=e(t,n);return this.stream.point(i[0],i[1])}})}(n)(k(a($(c=e)))))},D.preclip=function(e){return arguments.length?(k=e,w=void 0,C()):k},D.postclip=function(e){return arguments.length?($=e,E=i=r=o=null,C()):$},D.clipAngle=function(e){return arguments.length?(k=+e?function(e){var t=ww(e),n=6*vw,i=t>0,r=bw(t)>fw;function o(e,n){return ww(e)*ww(n)>t}function a(e,n,i){var r=[1,0,0],o=Xk(Yk(e),Yk(n)),a=Vk(o,o),s=o[0],l=a-s*s;if(!l)return!i&&e;var u=t*a/l,c=-t*s/l,f=Xk(r,o),d=Qk(r,u);Jk(d,Qk(o,c));var h=f,p=Vk(d,h),m=Vk(h,h),g=p*p-m*(Vk(d,d)-1);if(!(g<0)){var y=Cw(g),v=Qk(h,(-p-y)/m);if(Jk(v,d),v=Gk(v),!i)return v;var b,x=e[0],_=n[0],w=e[1],k=n[1];_<x&&(b=x,x=_,_=b);var E=_-x,$=bw(E-hw)<fw;if(!$&&k<w&&(b=w,w=k,k=b),$||E<fw?$?w+k>0^v[1]<(bw(v[0]-x)<fw?w:k):w<=v[1]&&v[1]<=k:E>hw^(x<=v[0]&&v[0]<=_)){var A=Qk(h,(-p+y)/m);return Jk(A,d),[v,Gk(A)]}}}function s(t,n){var r=i?e:hw-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return tE(o,(function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!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?hw:-hw),d):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(h=a(t,p))||Uk(t,h)||Uk(p,h))&&(p[2]=1),m!==l)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&&Uk(t,p)||e.point(p[0],p[1]),t=p,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=ww(t),s=Sw(t),l=i*n;null==r?(r=t+i*gw,o=t-l/2):(r=oE(a,r),o=oE(a,o),(i>0?r<o:r>o)&&(r+=i*gw));for(var u,c=r;i>0?c>o:c<o;c-=l)u=Gk([a,-s*ww(c),-s*Sw(c)]),e.point(u[0],u[1])}}(o,e,n,r,t,i)}),i?[0,-e]:[-hw,e-hw])}(w=e*vw):(w=null,rE),C()):w*yw},D.clipExtent=function(e){return arguments.length?($=null==e?(E=i=r=o=null,iw):lE(E=+e[0][0],i=+e[0][1],r=+e[1][0],o=+e[1][1]),C()):null==E?null:[[E,i],[r,o]]},D.scale=function(e){return arguments.length?(f=+e,M()):f},D.translate=function(e){return arguments.length?(d=+e[0],h=+e[1],M()):[d,h]},D.center=function(e){return arguments.length?(p=e[0]%360*vw,m=e[1]%360*vw,M()):[p*yw,m*yw]},D.rotate=function(e){return arguments.length?(g=e[0]%360*vw,y=e[1]%360*vw,v=e.length>2?e[2]%360*vw:0,M()):[g*yw,y*yw,v*yw]},D.angle=function(e){return arguments.length?(b=e%360*vw,M()):b*yw},D.reflectX=function(e){return arguments.length?(x=e?-1:1,M()):x<0},D.reflectY=function(e){return arguments.length?(_=e?-1:1,M()):_<0},D.precision=function(e){return arguments.length?(a=EE(s,A=e*e),C()):Cw(A)},D.fitExtent=function(e,t){return vE(D,e,t)},D.fitSize=function(e,t){return bE(D,e,t)},D.fitWidth=function(e,t){return xE(D,e,t)},D.fitHeight=function(e,t){return _E(D,e,t)},function(){return t=e.apply(this,arguments),D.invert=t.invert&&S,M()}}function ME(e){var t=0,n=hw/3,i=SE(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*vw,n=e[1]*vw):[t*yw,n*yw]},r}function CE(e,t){var n=Sw(e),i=(n+Sw(t))/2;if(bw(i)<fw)return function(e){var t=ww(e);function n(e,n){return[e*t,Sw(n)/t]}return n.invert=function(e,n){return[e/t,Nw(n*t)]},n}(e);var r=1+n*(2*i-n),o=Cw(r)/i;function a(e,t){var n=Cw(r-2*i*Sw(t))/i;return[n*Sw(e*=i),o-n*ww(e)]}return a.invert=function(e,t){var n=o-t,a=_w(e,bw(n))*Mw(n);return n*i<0&&(a-=hw*Mw(e)*Mw(n)),[a/i,Nw((r-(e*e+n*n)*i*i)/(2*i))]},a}function FE(){return ME(CE).scale(155.424).center([0,33.6442])}function OE(){return FE().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function NE(e){return function(t,n){var i=ww(t),r=ww(n),o=e(i*r);return o===1/0?[2,0]:[o*r*Sw(t),o*Sw(n)]}}function TE(e){return function(t,n){var i=Cw(t*t+n*n),r=e(i),o=Sw(r),a=ww(r);return[_w(t*o,i*a),Nw(i&&n*o/i)]}}var zE=NE((function(e){return Cw(2/(1+e))}));zE.invert=TE((function(e){return 2*Nw(e/2)}));var RE=NE((function(e){return(e=Ow(e))&&e/Sw(e)}));function PE(e,t){return[e,Aw(Fw((pw+t)/2))]}function LE(e){var t,n,i,r=DE(e),o=r.center,a=r.scale,s=r.translate,l=r.clipExtent,u=null;function c(){var o=hw*a(),s=r(function(e){function t(t){return(t=e(t[0]*vw,t[1]*vw))[0]*=yw,t[1]*=yw,t}return e=fE(e[0]*vw,e[1]*vw,e.length>2?e[2]*vw:0),t.invert=function(t){return(t=e.invert(t[0]*vw,t[1]*vw))[0]*=yw,t[1]*=yw,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===PE?[[Math.max(s[0]-o,u),t],[Math.min(s[0]+o,n),i]]:[[u,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?u=t=n=i=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==u?null:[[u,t],[n,i]]},c()}function BE(e){return Fw((pw+e)/2)}function jE(e,t){var n=ww(e),i=e===t?Sw(e):Aw(n/ww(t))/Aw(BE(t)/BE(e)),r=n*Dw(BE(e),i)/i;if(!i)return PE;function o(e,t){r>0?t<-pw+fw&&(t=-pw+fw):t>pw-fw&&(t=pw-fw);var n=r/Dw(BE(t),i);return[n*Sw(i*e),r-n*ww(i*e)]}return o.invert=function(e,t){var n=r-t,o=Mw(i)*Cw(e*e+n*n),a=_w(e,bw(n))*Mw(n);return n*i<0&&(a-=hw*Mw(e)*Mw(n)),[a/i,2*xw(Dw(r/o,1/i))-pw]},o}function IE(e,t){return[e,t]}function UE(e,t){var n=ww(e),i=e===t?Sw(e):(n-ww(t))/(t-e),r=n/i+e;if(bw(i)<fw)return IE;function o(e,t){var n=r-t,o=i*e;return[n*Sw(o),r-n*ww(o)]}return o.invert=function(e,t){var n=r-t,o=_w(e,bw(n))*Mw(n);return n*i<0&&(o-=hw*Mw(e)*Mw(n)),[o/i,r-Mw(i)*Cw(e*e+n*n)]},o}RE.invert=TE((function(e){return e})),PE.invert=function(e,t){return[e,2*xw(Ew(t))-pw]},IE.invert=IE;var qE=1.340264,WE=-.081106,HE=893e-6,GE=.003796,YE=Cw(3)/2;function VE(e,t){var n=Nw(YE*Sw(t)),i=n*n,r=i*i*i;return[e*ww(n)/(YE*(qE+3*WE*i+r*(7*HE+9*GE*i))),n*(qE+WE*i+r*(HE+GE*i))]}function XE(e,t){var n=ww(t),i=ww(e)*n;return[n*Sw(e)/i,Sw(t)/i]}function JE(e,t){var n=t*t,i=n*n;return[e*(.8707-.131979*n+i*(i*(.003971*n-.001529*i)-.013791)),t*(1.007226+n*(.015085+i*(.028874*n-.044475-.005916*i)))]}function QE(e,t){return[ww(t)*Sw(e),Sw(t)]}function ZE(e,t){var n=ww(t),i=1+ww(e)*n;return[n*Sw(e)/i,Sw(t)/i]}function KE(e,t){return[Aw(Fw((pw+t)/2)),-e]}VE.invert=function(e,t){for(var n,i=t,r=i*i,o=r*r*r,a=0;a<12&&(o=(r=(i-=n=(i*(qE+WE*r+o*(HE+GE*r))-t)/(qE+3*WE*r+o*(7*HE+9*GE*r)))*i)*r*r,!(bw(n)<dw));++a);return[YE*e*(qE+3*WE*r+o*(7*HE+9*GE*r))/ww(i),Nw(Sw(i)/YE)]},XE.invert=TE(xw),JE.invert=function(e,t){var n,i=t,r=25;do{var o=i*i,a=o*o;i-=n=(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(bw(n)>fw&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},QE.invert=TE(Nw),ZE.invert=TE((function(e){return 2*xw(e)})),KE.invert=function(e,t){return[-t,2*xw(Ew(e))-pw]};var e$=Math.abs,t$=(Math.atan,Math.atan2,Math.ceil,Math.cos),n$=(Math.exp,Math.floor,Math.log,Math.max,Math.min,Math.pow,Math.round,Math.sign,Math.sin),i$=(Math.tan,1e-6),r$=Math.PI,o$=r$/2,a$=(Math.SQRT1_2,l$(2));function s$(e){return e>1?o$:e<-1?-o$:Math.asin(e)}function l$(e){return e>0?Math.sqrt(e):0}function u$(e,t){var n,i=e*n$(t),r=30;do{t-=n=(t+n$(t)-i)/(1+t$(t))}while(e$(n)>i$&&--r>0);return t/2}l$(r$);var c$=function(e,t,n){function i(i,r){return[e*i*t$(r=u$(n,r)),t*n$(r)]}return i.invert=function(i,r){return r=s$(r/t),[i/(e*t$(r)),s$((2*r+n$(2*r))/n)]},i}(a$/o$,a$,r$);const f$=jk(),d$=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function h$(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(m$[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=jk().projection(i),i.copy=i.copy||function(){const e=n();return d$.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},Hp(i)}}(e,t),this):m$[e]||null}function p$(e){return e&&e.path||f$}const m$={albers:OE,albersusa:function(){var e,t,n,i,r,o,a=OE(),s=FE().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=FE().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={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?l:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),l.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n<r;)i[n].point(e,t)},sphere:function(){for(var e=-1;++e<r;)i[e].sphere()},lineStart:function(){for(var e=-1;++e<r;)i[e].lineStart()},lineEnd:function(){for(var e=-1;++e<r;)i[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<r;)i[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<r;)i[e].polygonEnd()}});var i,r},c.precision=function(e){return arguments.length?(a.precision(e),s.precision(e),l.precision(e),f()):a.precision()},c.scale=function(e){return arguments.length?(a.scale(e),s.scale(.35*e),l.scale(e),c.translate(a.translate())):a.scale()},c.translate=function(e){if(!arguments.length)return a.translate();var t=a.scale(),o=+e[0],c=+e[1];return n=a.translate(e).clipExtent([[o-.455*t,c-.238*t],[o+.455*t,c+.238*t]]).stream(u),i=s.translate([o-.307*t,c+.201*t]).clipExtent([[o-.425*t+fw,c+.12*t+fw],[o-.214*t-fw,c+.234*t-fw]]).stream(u),r=l.translate([o-.205*t,c+.212*t]).clipExtent([[o-.214*t+fw,c+.166*t+fw],[o-.115*t-fw,c+.234*t-fw]]).stream(u),f()},c.fitExtent=function(e,t){return vE(c,e,t)},c.fitSize=function(e,t){return bE(c,e,t)},c.fitWidth=function(e,t){return xE(c,e,t)},c.fitHeight=function(e,t){return _E(c,e,t)},c.scale(1070)},azimuthalequalarea:function(){return DE(zE).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return DE(RE).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return ME(jE).scale(109.5).parallels([30,30])},conicequalarea:FE,conicequidistant:function(){return ME(UE).scale(131.154).center([0,13.9389])},equalEarth:function(){return DE(VE).scale(177.158)},equirectangular:function(){return DE(IE).scale(152.63)},gnomonic:function(){return DE(XE).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,i,r,o,a,s=1,l=0,u=0,c=1,f=1,d=0,h=null,p=1,m=1,g=mE({point:function(e,t){var n=b([e,t]);this.stream.point(n[0],n[1])}}),y=iw;function v(){return p=s*c,m=s*f,o=a=null,b}function b(n){var i=n[0]*p,r=n[1]*m;if(d){var o=r*e-i*t;i=i*e+r*t,r=o}return[i+l,r+u]}return b.invert=function(n){var i=n[0]-l,r=n[1]-u;if(d){var o=r*e+i*t;i=i*e-r*t,r=o}return[i/p,r/m]},b.stream=function(e){return o&&a===e?o:o=g(y(a=e))},b.postclip=function(e){return arguments.length?(y=e,h=n=i=r=null,v()):y},b.clipExtent=function(e){return arguments.length?(y=null==e?(h=n=i=r=null,iw):lE(h=+e[0][0],n=+e[0][1],i=+e[1][0],r=+e[1][1]),v()):null==h?null:[[h,n],[i,r]]},b.scale=function(e){return arguments.length?(s=+e,v()):s},b.translate=function(e){return arguments.length?(l=+e[0],u=+e[1],v()):[l,u]},b.angle=function(n){return arguments.length?(t=Sw(d=n%360*vw),e=ww(d),v()):d*yw},b.reflectX=function(e){return arguments.length?(c=e?-1:1,v()):c<0},b.reflectY=function(e){return arguments.length?(f=e?-1:1,v()):f<0},b.fitExtent=function(e,t){return vE(b,e,t)},b.fitSize=function(e,t){return bE(b,e,t)},b.fitWidth=function(e,t){return xE(b,e,t)},b.fitHeight=function(e,t){return _E(b,e,t)},b},mercator:function(){return LE(PE).scale(961/gw)},mollweide:function(){return DE(c$).scale(169.529)},naturalEarth1:function(){return DE(JE).scale(175.295)},orthographic:function(){return DE(QE).scale(249.5).clipAngle(90+fw)},stereographic:function(){return DE(ZE).scale(250).clipAngle(142)},transversemercator:function(){var e=LE(KE),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const e in m$)h$(e,m$[e]);function g$(e,t,n){var i=El(e,t-fw,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function y$(e,t,n){var i=El(e,t-fw,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}function v$(){}const b$=[[],[[[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 x$(){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,l,u,c,f,d=new Array,h=new Array;for(a=s=-1,u=n[0]>=i,b$[u<<1].forEach(p);++a<e-1;)l=u,u=n[a+1]>=i,b$[l|u<<1].forEach(p);for(b$[u<<0].forEach(p);++s<t-1;){for(a=-1,u=n[s*e+e]>=i,c=n[s*e]>=i,b$[u<<1|c<<2].forEach(p);++a<e-1;)l=u,u=n[s*e+e+a+1]>=i,f=c,c=n[s*e+a+1]>=i,b$[l|u<<1|c<<2|f<<3].forEach(p);b$[u|c<<3].forEach(p)}for(a=-1,c=n[s*e]>=i,b$[c<<2].forEach(p);++a<e-1;)f=c,c=n[s*e+a+1]>=i,b$[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],l=[e[1][0]+a,e[1][1]+s],u=o(i),c=o(l);(t=h[u])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(l),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(l),h[t.end=c]=t):(t=d[c])?(n=h[u])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(l),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=u]=t):d[u]=h[c]={start:u,end:c,ring:[i,l]}}b$[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)i+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return i}(e)>0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n<i;++n)if(-1!==_$((t=a[n])[0],e))return void t.push(e)})),{type:"MultiPolygon",value:r,coordinates:a}}function o(t){return 2*t[0]+t[1]*(e+1)*4}function a(n,i,r){n.forEach((n=>{var o,a=n[0],s=n[1],l=0|a,u=0|s,c=i[u*e+l];a>0&&a<e&&l===a&&(o=i[u*e+l-1],n[0]=a+(r-o)/(c-o)-.5),s>0&&s<t&&u===s&&(o=i[(u-1)*e+l],n[1]=s+(r-o)/(c-o)-.5)}))}return i.contour=r,i.size=function(n){if(!arguments.length)return[e,t];var r=Math.floor(n[0]),o=Math.floor(n[1]);return r>=0&&o>=0||oe("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:v$,i):n===a},i}function _$(e,t){for(var n,i=-1,r=t.length;++i<r;)if(n=w$(e,t[i]))return n;return 0}function w$(e,t){for(var n=t[0],i=t[1],r=-1,o=0,a=e.length,s=a-1;o<a;s=o++){var l=e[o],u=l[0],c=l[1],f=e[s],d=f[0],h=f[1];if(k$(l,f,t))return 0;c>i!=h>i&&n<(d-u)*(i-c)/(h-c)+u&&(r=-r)}return r}function k$(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 E$(e,t,n){return function(i){var r=rt(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,l=t?rn(o,a,e):s/(e+1);return El(o+l,a,l)}}function $$(e){ps.call(this,null,e)}function A$(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function l(e){e.forEach(u)}function u(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(l),e}}function D$(e,t,n){const i=e>=0?e:Cs(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function S$(e){return Ve(e)?e:tt(+e)}function M$(){var e=e=>e[0],t=e=>e[1],n=fe,i=[-1,-1],r=960,o=500,a=2;function s(s,l){const u=D$(i[0],s,e)>>a,c=D$(i[1],s,t)>>a,f=u?u+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<h&&o>=0&&o<p&&(m[r+o*h]+=+n(i))})),u>0&&c>0?(C$(h,p,m,g,u),F$(h,p,g,m,c),C$(h,p,m,g,u),F$(h,p,g,m,c),C$(h,p,m,g,u),F$(h,p,g,m,c)):u>0?(C$(h,p,m,g,u),C$(h,p,g,m,u),C$(h,p,m,g,u),y=g):c>0&&(F$(h,p,m,g,c),F$(h,p,g,m,c),F$(h,p,m,g,c),y=g);const v=l?Math.pow(2,-2*a):1/A_(y);for(let e=0,t=h*p;e<t;++e)y[e]*=v;return{values:y,scale:1<<a,width:h,height:p,x1:f,y1:d,x2:f+(r>>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=S$(t),s):e},s.y=function(e){return arguments.length?(t=S$(e),s):t},s.weight=function(e){return arguments.length?(n=S$(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||oe("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||oe("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),s):1<<a},s.bandwidth=function(e){return arguments.length?(1===(e=Ge(e)).length&&(e=[+e[0],+e[0]]),2!==e.length&&oe("invalid bandwidth"),i=e,s):i},s}function C$(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<t;++a)for(let t=0,s=0;t<e+r;++t)t<e&&(s+=n[t+a*e]),t>=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 F$(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<e;++a)for(let s=0,l=0;s<t+r;++s)s<t&&(l+=n[a+s*e]),s>=r&&(s>=o&&(l-=n[a+(s-o)*e]),i[a+(s-r)*e]=l/Math.min(s+1,t-1+o-s,o))}function O$(e){ps.call(this,null,e)}$$.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"}]},ft($$,ps,{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||ue,o=x$().smooth(!1!==e.smooth),a=e.thresholds||function(e,t,n){const i=E$(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>vs(t(e).values))))}(i,r,e),s=null===e.as?null:e.as||"contour",l=[];return i.forEach((t=>{const n=r(t),i=o.size([n.width,n.height])(n.values,_e(a)?a:a(n.values));!function(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;if(Ve(r)&&(r=r(n,i)),Ve(o)&&(o=o(n,i)),(1===r||null==r)&&!o)return;const a=(gt(r)?r:r[0])||1,s=(gt(r)?r:r[1])||1,l=o&&o[0]||0,u=o&&o[1]||0;e.forEach(A$(t,a,s,l,u))}(i,n,t,e),i.forEach((e=>{l.push(ja(t,La(null!=s?{[s]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n}}),O$.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 N$=["x","y","weight","size","cellSize","bandwidth"];function T$(e,t){return N$.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function z$(e){ps.call(this,null,e)}ft(O$,ps,{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,l=[],u=e=>e(o);if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(u)])||(n[a]=s=[],s.dims=a,l.push(s)),s.push(o);return l}(t.materialize(t.SOURCE).source,e.groupby),o=(e.groupby||[]).map(ee),a=T$(M$(),e),s=e.as||"grid";return n=r.map((t=>La(function(e,t){for(let n=0;n<o.length;++n)e[o[n]]=t[n];return e}({[s]:a(t,e.counts)},t.dims)))),this.value&&(i.rem=this.value),this.value=i.source=i.add=n,i}}),z$.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},ft(z$,ps,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),o=x$().smooth(!1!==e.smooth),a=e.values,s=e.thresholds||E$(e.count||10,e.nice,!!a),l=e.size;return a||(a=t.materialize(t.SOURCE).source,i=A$(n=T$(M$(),e)(a,!0),n.scale||1,n.scale||1,0,0),l=[n.width,n.height],a=n.values),s=_e(s)?s:s(a),a=o.size(l)(a,s),i&&a.forEach(i),this.value&&(r.rem=this.value),this.value=r.source=r.add=(a||[]).map(La),r}});const R$="Feature",P$="FeatureCollection";function L$(e){ps.call(this,null,e)}function B$(e){ps.call(this,null,e)}function j$(e){ps.call(this,null,e)}function I$(e){ps.call(this,null,e)}function U$(e){ps.call(this,[],e),this.generator=function(){var e,t,n,i,r,o,a,s,l,u,c,f,d=10,h=d,p=90,m=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return El(kw(i/p)*p,n,p).map(c).concat(El(kw(s/m)*m,a,m).map(f)).concat(El(kw(t/d)*d,e,d).filter((function(e){return bw(e%p)>fw})).map(l)).concat(El(kw(o/h)*h,r,h).filter((function(e){return bw(e%m)>fw})).map(u))}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,l=g$(o,r,90),u=y$(t,e,g),c=g$(s,a,90),f=y$(i,n,g),y):g},y.extentMajor([[-180,-90+fw],[180,90-fw]]).extentMinor([[-180,-80-fw],[180,80+fw]])}()}function q$(e){ps.call(this,null,e)}function W$(e){if(!Ve(e))return!1;const t=Ot(te(e));return t.$x||t.$y||t.$value||t.$max}function H$(e){ps.call(this,null,e),this.modified(!0)}function G$(e,t,n){Ve(e[t])&&e[t](n)}function Y$(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,l,u,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((u=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|u]))return r[f]=p,e;if(s=+e._x.call(null,h.data),l=+e._y.call(null,h.data),t===s&&n===l)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),(u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|u)==(d=(l>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function V$(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function X$(e){return e[0]}function J$(e){return e[1]}function Q$(e,t,n){var i=new Z$(null==t?X$:t,null==n?J$:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function Z$(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 K$(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}L$.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ft(L$,ps,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],l=e.geojson||!o&&ue,u=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(te(l))||a&&t.modified(te(a))||s&&t.modified(te(s)),this.value&&!n||(u=t.SOURCE,this._features=i=[],this._points=r=[]),l&&t.visit(u,(e=>i.push(l(e)))),a&&s&&(t.visit(u,(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:R$,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:P$,features:i}}}),B$.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"}]},ft(B$,ps,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||ue,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=p$(e.projection),n.materialize().reflow()):a=r===ue||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();return e.context(null),null!=t&&e.pointRadius(t),n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),j$.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"]}]},ft(j$,ps,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],l=a[1];function u(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[l]=t[1]):(e[s]=void 0,e[l]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,u):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,u)),t.modifies(a)}}),I$.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"}]},ft(I$,ps,{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}(p$(e.projection),e.field||se("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),U$.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}]},ft(U$,ps,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const t in e)Ve(r[t])&&r[t](e[t]);return n=r(),i.length?t.mod.push(Ia(i[0],n)):t.add.push(La(n)),i[0]=n,t}}),q$.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"}]},ft(q$,ps,{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||ue,o=function(e,t){let n;return Ve(e)?(n=n=>e(n,t),n.dep=W$(e)):e?n=tt(e):(n=e=>e.$value/e.$max||0,n.dep=!0),n}(e.opacity,e),a=function(e,t){let n;return Ve(e)?(n=n=>Bf(e(n,t)),n.dep=W$(e)):n=tt(Bf(e||"#888")),n}(e.color,e),s=e.as||"image",l={$x:0,$y:0,$value:0,$max:i?vs(n.map((e=>vs(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=it({},e,l);i||(n.$max=vs(t.values||[])),e[s]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,l=e.x2||r,u=e.y2||o,c=e.values,f=c?e=>c[e]:ce,d=ff(l-a,u-s),h=d.getContext("2d"),p=h.getImageData(0,0,l-a,u-s),m=p.data;for(let e=s,o=0;e<u;++e){t.$y=e-s;for(let s=a,u=e*r;s<l;++s,o+=4){t.$x=s-a,t.$value=f(s+u);const e=n(t);m[o+0]=e.r,m[o+1]=e.g,m[o+2]=e.b,m[o+3]=~~(255*i(t))}}return h.putImageData(p,0,0),d}(t,n,a.dep?a:tt(a(n)),o.dep?o:tt(o(n)))})),t.reflow(!0).modifies(s)}}),ft(H$,ps,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=function(e){const t=h$((e||"mercator").toLowerCase());return t||oe("Unrecognized projection type: "+e),t()}(e.type),d$.forEach((t=>{null!=e[t]&&G$(n,t,e[t])}))):d$.forEach((t=>{e.modified(t)&&G$(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return 1===(e=Ge(e)).length?e[0]:{type:P$,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===P$?e.features:Ge(e).filter((e=>null!=e)).map((e=>e.type===R$?e:{type:R$,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)}});var eA=Q$.prototype=Z$.prototype;function tA(e){return function(){return e}}function nA(e){return 1e-6*(e()-.5)}function iA(e){return e.x+e.vx}function rA(e){return e.y+e.vy}eA.copy=function(){var e,t,n=new Z$(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=K$(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]=K$(t));return n},eA.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Y$(this.cover(t,n),t,n,e)},eA.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),l=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(a[n]=i,s[n]=r,i<l&&(l=i),i>c&&(c=i),r<u&&(u=r),r>f&&(f=r));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),n=0;n<o;++n)Y$(this,a[n],s[n],e[n]);return this},eA.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var a,s,l=r-n||1,u=this._root;n>e||e>=r||i>t||t>=o;)switch(s=(t<i)<<1|e<n,(a=new Array(4))[s]=u,u=a,l*=2,s){case 0:r=n+l,o=i+l;break;case 1:n=r-l,o=i+l;break;case 2:r=n+l,i=o-l;break;case 3:n=r-l,i=o-l}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this},eA.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},eA.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},eA.find=function(e,t,n){var i,r,o,a,s,l,u,c=this._x0,f=this._y0,d=this._x1,h=this._y1,p=[],m=this._root;for(m&&p.push(new V$(m,c,f,d,h)),null==n?n=1/0:(c=e-n,f=t-n,d=e+n,h=t+n,n*=n);l=p.pop();)if(!(!(m=l.node)||(r=l.x0)>d||(o=l.y0)>h||(a=l.x1)<c||(s=l.y1)<f))if(m.length){var g=(r+a)/2,y=(o+s)/2;p.push(new V$(m[3],g,y,a,s),new V$(m[2],r,y,g,s),new V$(m[1],g,o,a,y),new V$(m[0],r,o,g,y)),(u=(t>=y)<<1|e>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=l)}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<n){var _=Math.sqrt(n=x);c=e-_,f=t-_,d=e+_,h=t+_,i=m.data}}return i},eA.remove=function(e){if(isNaN(o=+this._x.call(null,e))||isNaN(a=+this._y.call(null,e)))return this;var t,n,i,r,o,a,s,l,u,c,f,d,h=this._root,p=this._x0,m=this._y0,g=this._x1,y=this._y1;if(!h)return this;if(h.length)for(;;){if((u=o>=(s=(p+g)/2))?p=s:g=s,(c=a>=(l=(m+y)/2))?m=l:y=l,t=h,!(h=h[f=c<<1|u]))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)},eA.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},eA.root=function(){return this._root},eA.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},eA.visit=function(e){var t,n,i,r,o,a,s=[],l=this._root;for(l&&s.push(new V$(l,this._x0,this._y0,this._x1,this._y1));t=s.pop();)if(!e(l=t.node,i=t.x0,r=t.y0,o=t.x1,a=t.y1)&&l.length){var u=(i+o)/2,c=(r+a)/2;(n=l[3])&&s.push(new V$(n,u,c,o,a)),(n=l[2])&&s.push(new V$(n,i,c,u,a)),(n=l[1])&&s.push(new V$(n,u,r,o,c)),(n=l[0])&&s.push(new V$(n,i,r,u,c))}return this},eA.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new V$(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var o,a=t.x0,s=t.y0,l=t.x1,u=t.y1,c=(a+l)/2,f=(s+u)/2;(o=r[0])&&n.push(new V$(o,a,s,c,f)),(o=r[1])&&n.push(new V$(o,c,s,l,f)),(o=r[2])&&n.push(new V$(o,a,f,c,u)),(o=r[3])&&n.push(new V$(o,c,f,l,u))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},eA.x=function(e){return arguments.length?(this._x=e,this):this._x},eA.y=function(e){return arguments.length?(this._y=e,this):this._y};var oA={value:()=>{}};function aA(){for(var e,t=0,n=arguments.length,i={};t<n;++t){if(!(e=arguments[t]+"")||e in i||/[\s.]/.test(e))throw new Error("illegal type: "+e);i[e]=[]}return new sA(i)}function sA(e){this._=e}function lA(e,t){for(var n,i=0,r=e.length;i<r;++i)if((n=e[i]).name===t)return n.value}function uA(e,t,n){for(var i=0,r=e.length;i<r;++i)if(e[i].name===t){e[i]=oA,e=e.slice(0,i).concat(e.slice(i+1));break}return null!=n&&e.push({name:t,value:n}),e}sA.prototype=aA.prototype={constructor:sA,on:function(e,t){var n,i,r=this._,o=(i=r,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<s;)if(n=(e=o[a]).type)r[n]=uA(r[n],e.name,t);else if(null==t)for(n in r)r[n]=uA(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=o[a]).type)&&(n=lA(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new sA(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),o=0;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=0,n=(i=this._[e]).length;o<n;++o)i[o].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)}};const cA=aA;var fA,dA,hA=0,pA=0,mA=0,gA=1e3,yA=0,vA=0,bA=0,xA="object"==typeof performance&&performance.now?performance:Date,_A="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wA(){return vA||(_A(kA),vA=xA.now()+bA)}function kA(){vA=0}function EA(){this._call=this._time=this._next=null}function $A(e,t,n){var i=new EA;return i.restart(e,t,n),i}function AA(){vA=(yA=xA.now())+bA,hA=pA=0;try{!function(){wA(),++hA;for(var e,t=fA;t;)(e=vA-t._time)>=0&&t._call.call(void 0,e),t=t._next;--hA}()}finally{hA=0,function(){for(var e,t,n=fA,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:fA=t);dA=e,SA(i)}(),vA=0}}function DA(){var e=xA.now(),t=e-yA;t>gA&&(bA-=t,yA=e)}function SA(e){hA||(pA&&(pA=clearTimeout(pA)),e-vA>24?(e<1/0&&(pA=setTimeout(AA,e-xA.now()-bA)),mA&&(mA=clearInterval(mA))):(mA||(yA=xA.now(),mA=setInterval(DA,gA)),hA=1,_A(AA)))}EA.prototype=$A.prototype={constructor:EA,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?wA():+n)+(null==t?0:+t),this._next||dA===this||(dA?dA._next=this:fA=this,dA=this),this._call=e,this._time=n,SA()},stop:function(){this._call&&(this._call=null,this._time=1/0,SA())}};const MA=4294967296;function CA(e){return e.x}function FA(e){return e.y}var OA=Math.PI*(3-Math.sqrt(5));function NA(e){return e.index}function TA(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}const zA={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,l=0;for(r=0;r<a;++r)s+=(o=n[r]).x,l+=o.y;for(s=(s/a-e)*i,l=(l/a-t)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=l}return null==e&&(e=0),null==t&&(t=0),r.initialize=function(e){n=e},r.x=function(t){return arguments.length?(e=+t,r):e},r.y=function(e){return arguments.length?(t=+e,r):t},r.strength=function(e){return arguments.length?(i=+e,r):i},r},collide:function(e){var t,n,i,r=1,o=1;function a(){for(var e,a,l,u,c,f,d,h=t.length,p=0;p<o;++p)for(a=Q$(t,iA,rA).visitAfter(s),e=0;e<h;++e)l=t[e],f=n[l.index],d=f*f,u=l.x+l.vx,c=l.y+l.vy,a.visit(m);function m(e,t,n,o,a){var s=e.data,h=e.r,p=f+h;if(!s)return t>u+p||o<u-p||n>c+p||a<c-p;if(s.index>l.index){var m=u-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;y<p*p&&(0===m&&(y+=(m=nA(i))*m),0===g&&(y+=(g=nA(i))*g),y=(p-(y=Math.sqrt(y)))/y*r,l.vx+=(m*=y)*(p=(h*=h)/(d+h)),l.vy+=(g*=y)*p,s.vx-=m*(p=1-p),s.vy-=g*p)}}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function l(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i<o;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=tA(null==e?1:+e)),a.initialize=function(e,n){t=e,i=n,l()},a.iterations=function(e){return arguments.length?(o=+e,a):o},a.strength=function(e){return arguments.length?(r=+e,a):r},a.radius=function(t){return arguments.length?(e="function"==typeof t?t:tA(+t),l(),a):e},a},nbody:function(){var e,t,n,i,r,o=tA(-30),a=1,s=1/0,l=.81;function u(n){var r,o=e.length,a=Q$(e,CA,FA).visitAfter(f);for(i=n,r=0;r<o;++r)t=e[r],a.visit(d)}function c(){if(e){var t,n,i=e.length;for(r=new Array(i),t=0;t<i;++t)n=e[t],r[n.index]=+o(n,t,e)}}function f(e){var t,n,i,o,a,s=0,l=0;if(e.length){for(i=o=a=0;a<4;++a)(t=e[a])&&(n=Math.abs(t.value))&&(s+=t.value,l+=n,i+=n*t.x,o+=n*t.y);e.x=i/l,e.y=o/l}else{(t=e).x=t.data.x,t.y=t.data.y;do{s+=r[t.data.index]}while(t=t.next)}e.value=s}function d(e,o,u,c){if(!e.value)return!0;var f=e.x-t.x,d=e.y-t.y,h=c-o,p=f*f+d*d;if(h*h/l<p)return p<s&&(0===f&&(p+=(f=nA(n))*f),0===d&&(p+=(d=nA(n))*d),p<a&&(p=Math.sqrt(a*p)),t.vx+=f*e.value*i/p,t.vy+=d*e.value*i/p),!0;if(!(e.length||p>=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=nA(n))*f),0===d&&(p+=(d=nA(n))*d),p<a&&(p=Math.sqrt(a*p)));do{e.data!==t&&(h=r[e.data.index]*i/p,t.vx+=f*h,t.vy+=d*h)}while(e=e.next)}}return u.initialize=function(t,i){e=t,n=i,c()},u.strength=function(e){return arguments.length?(o="function"==typeof e?e:tA(+e),c(),u):o},u.distanceMin=function(e){return arguments.length?(a=e*e,u):Math.sqrt(a)},u.distanceMax=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u},link:function(e){var t,n,i,r,o,a,s=NA,l=function(e){return 1/Math.min(r[e.source.index],r[e.target.index])},u=tA(30),c=1;function f(i){for(var r=0,s=e.length;r<c;++r)for(var l,u,f,d,h,p,m,g=0;g<s;++g)u=(l=e[g]).source,d=(f=l.target).x+f.vx-u.x-u.vx||nA(a),h=f.y+f.vy-u.y-u.vy||nA(a),d*=p=((p=Math.sqrt(d*d+h*h))-n[g])/p*i*t[g],h*=p,f.vx-=d*(m=o[g]),f.vy-=h*m,u.vx+=d*(m=1-m),u.vy+=h*m}function d(){if(i){var a,l,u=i.length,c=e.length,f=new Map(i.map(((e,t)=>[s(e,t,i),e])));for(a=0,r=new Array(u);a<c;++a)(l=e[a]).index=a,"object"!=typeof l.source&&(l.source=TA(f,l.source)),"object"!=typeof l.target&&(l.target=TA(f,l.target)),r[l.source.index]=(r[l.source.index]||0)+1,r[l.target.index]=(r[l.target.index]||0)+1;for(a=0,o=new Array(c);a<c;++a)l=e[a],o[a]=r[l.source.index]/(r[l.source.index]+r[l.target.index]);t=new Array(c),h(),n=new Array(c),p()}}function h(){if(i)for(var n=0,r=e.length;n<r;++n)t[n]=+l(e[n],n,e)}function p(){if(i)for(var t=0,r=e.length;t<r;++t)n[t]=+u(e[t],t,e)}return null==e&&(e=[]),f.initialize=function(e,t){i=e,a=t,d()},f.links=function(t){return arguments.length?(e=t,d(),f):e},f.id=function(e){return arguments.length?(s=e,f):s},f.iterations=function(e){return arguments.length?(c=+e,f):c},f.strength=function(e){return arguments.length?(l="function"==typeof e?e:tA(+e),h(),f):l},f.distance=function(e){return arguments.length?(u="function"==typeof e?e:tA(+e),p(),f):u},f},x:function(e){var t,n,i,r=tA(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vx+=(i[o]-r.x)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=tA(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:tA(+e),a(),o):r},o.x=function(t){return arguments.length?(e="function"==typeof t?t:tA(+t),a(),o):e},o},y:function(e){var t,n,i,r=tA(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vy+=(i[o]-r.y)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=tA(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:tA(+e),a(),o):r},o.y=function(t){return arguments.length?(e="function"==typeof t?t:tA(+t),a(),o):e},o}},RA="forces",PA=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],LA=["static","iterations"],BA=["x","y","vx","vy"];function jA(e){ps.call(this,null,e)}function IA(e,t,n,i){var r,o,a,s,l=Ge(t.forces);for(r=0,o=PA.length;r<o;++r)(a=PA[r])!==RA&&t.modified(a)&&e[a](t[a]);for(r=0,o=l.length;r<o;++r)s=RA+r,(a=n||t.modified(RA,r)?qA(l[r]):i&&UA(l[r],i)?e.force(s):null)&&e.force(s,a);for(o=e.numForces||0;r<o;++r)e.force(RA+r,null);return e.numForces=l.length,e}function UA(e,t){var n,i;for(n in e)if(Ve(i=e[n])&&t.modified(te(i)))return 1;return 0}function qA(e){var t,n;for(n in st(zA,e.force)||oe("Unrecognized force: "+e.force),t=zA[e.force](),e)Ve(t[n])&&WA(t[n],e[n],e);return t}function WA(e,t,n){e(Ve(t)?e=>t(e,n):t)}function HA(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function GA(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=VA)):void 0===t&&(t=YA);for(var n,i,r,o,a,s=new QA(e),l=[s];n=l.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new QA(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(JA)}function YA(e){return e.children}function VA(e){return Array.isArray(e)?e[1]:null}function XA(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function JA(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function QA(e){this.data=e,this.depth=this.height=0,this.parent=null}function ZA(e){return null==e?null:KA(e)}function KA(e){if("function"!=typeof e)throw new Error;return e}function eD(){return 0}function tD(e){return function(){return e}}jA.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:BA}]},ft(jA,ps,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(PA),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&IA(r,e,0,t)):(this.value=r=function(e,t){const n=function(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,l=$A(f),u=cA("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%MA)/MA}();function f(){d(),u.call("tick",t),n<i&&(l.stop(),u.call("end",t))}function d(i){var l,u,c=e.length;void 0===i&&(i=1);for(var f=0;f<i;++f)for(n+=(o-n)*r,s.forEach((function(e){e(n)})),l=0;l<c;++l)null==(u=e[l]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function h(){for(var t,n=0,i=e.length;n<i;++n){if((t=e[n]).index=n,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(.5+n),o=n*OA;t.x=r*Math.cos(o),t.y=r*Math.sin(o)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(e,c),t}return null==e&&(e=[]),h(),t={tick:d,restart:function(){return l.restart(f),t},stop:function(){return l.stop(),t},nodes:function(n){return arguments.length?(e=n,h(),s.forEach(p),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(i=+e,t):i},alphaDecay:function(e){return arguments.length?(r=+e,t):+r},alphaTarget:function(e){return arguments.length?(o=+e,t):o},velocityDecay:function(e){return arguments.length?(a=1-e,t):1-a},randomSource:function(e){return arguments.length?(c=e,s.forEach(p),t):c},force:function(e,n){return arguments.length>1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,l,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(a=(r=t-(s=e[u]).x)*r+(o=n-s.y)*o)<i&&(l=s,i=a);return l},on:function(e,n){return arguments.length>1?(u.on(e,n),t):u.on(e)}}}(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),IA(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(LA)||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 e,t=this._argops,s=0,l=t.length;s<l;++s)if(e=t[s],e.name===RA&&"link"===e.op._argval.force)for(var i,r=e.op._argops,o=0,a=r.length;o<a;++o)if("links"===r[o].name&&(i=r[o].op.source)){n.pulse(i,n.changeset().reflow());break}return t.reflow(e.modified()).modifies(BA)}}),QA.prototype=GA.prototype={constructor:QA,count:function(){return this.eachAfter(HA)},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=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)e.call(t,o,++l,this);return this},eachBefore:function(e,t){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(e.call(t,r,++a,this),n=r.children)for(i=n.length-1;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;for(e=n.pop(),t=i.pop();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 GA(this).eachBefore(XA)},[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;n<i;++n)o.push(t[n])}while(o.length)}};const nD=4294967296;function iD(e,t){var n,i;if(aD(t,e))return[t];for(n=0;n<e.length;++n)if(rD(t,e[n])&&aD(lD(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(i=n+1;i<e.length;++i)if(rD(lD(e[n],e[i]),t)&&rD(lD(e[n],t),e[i])&&rD(lD(e[i],t),e[n])&&aD(uD(e[n],e[i],t),e))return[e[n],e[i],t];throw new Error}function rD(e,t){var n=e.r-t.r,i=t.x-e.x,r=t.y-e.y;return n<0||n*n<i*i+r*r}function oD(e,t){var n=e.r-t.r+1e-9*Math.max(e.r,t.r,1),i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function aD(e,t){for(var n=0;n<t.length;++n)if(!oD(e,t[n]))return!1;return!0}function sD(e){switch(e.length){case 1:return{x:(t=e[0]).x,y:t.y,r:t.r};case 2:return lD(e[0],e[1]);case 3:return uD(e[0],e[1],e[2])}var t}function lD(e,t){var n=e.x,i=e.y,r=e.r,o=t.x,a=t.y,s=t.r,l=o-n,u=a-i,c=s-r,f=Math.sqrt(l*l+u*u);return{x:(n+o+l/f*c)/2,y:(i+a+u/f*c)/2,r:(f+r+s)/2}}function uD(e,t,n){var i=e.x,r=e.y,o=e.r,a=t.x,s=t.y,l=t.r,u=n.x,c=n.y,f=n.r,d=i-a,h=i-u,p=r-s,m=r-c,g=l-o,y=f-o,v=i*i+r*r-o*o,b=v-a*a-s*s+l*l,x=v-u*u-c*c+f*f,_=h*p-d*m,w=(p*x-m*b)/(2*_)-i,k=(m*g-p*y)/_,E=(h*b-d*x)/(2*_)-r,$=(d*y-h*g)/_,A=k*k+$*$-1,D=2*(o+w*k+E*$),S=w*w+E*E-o*o,M=-(Math.abs(A)>1e-6?(D+Math.sqrt(D*D-4*A*S))/(2*A):S/D);return{x:i+w+k*M,y:r+E+$*M,r:M}}function cD(e,t,n){var i,r,o,a,s=e.x-t.x,l=e.y-t.y,u=s*s+l*l;u?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(u+a-r)/(2*u),o=Math.sqrt(Math.max(0,a/u-i*i)),n.x=e.x-i*s-o*l,n.y=e.y-i*l+o*s):(i=(u+r-a)/(2*u),o=Math.sqrt(Math.max(0,r/u-i*i)),n.x=t.x+i*s-o*l,n.y=t.y+i*l+o*s)):(n.x=t.x+n.r,n.y=t.y)}function fD(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 dD(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 hD(e){this._=e,this.next=null,this.previous=null}function pD(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,l,u,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;cD(i,n,r=e[2]),n=new hD(n),i=new hD(i),r=new hD(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(l=3;l<o;++l){cD(n._,i._,r=e[l]),r=new hD(r),u=i.next,c=n.previous,f=i._.r,d=n._.r;do{if(f<=d){if(fD(u._,r._)){i=u,n.next=i,i.previous=n,--l;continue e}f+=u._.r,u=u.next}else{if(fD(c._,r._)){(n=c).next=i,i.previous=n,--l;continue e}d+=c._.r,c=c.previous}}while(u!==c.next);for(r.previous=n,r.next=i,n.next=i.previous=i=r,a=dD(n);(r=r.next)!==i;)(s=dD(r))<a&&(n=r,a=s);i=n.next}for(n=[i._],r=i;(r=r.next)!==i;)n.push(r._);for(r=function(e,t){for(var n,i,r=0,o=(e=function(e,t){let n,i,r=e.length;for(;r;)i=t()*r--|0,n=e[r],e[r]=e[i],e[i]=n;return e}(Array.from(e),t)).length,a=[];r<o;)n=e[r],i&&oD(i,n)?++r:(i=sD(a=iD(a,n)),r=0);return i}(n,t),l=0;l<o;++l)(n=e[l]).x-=r.x,n.y-=r.y;return r.r}function mD(e){return Math.sqrt(e.value)}function gD(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function yD(e,t,n){return function(i){if(r=i.children){var r,o,a,s=r.length,l=e(i)*t||0;if(l)for(o=0;o<s;++o)r[o].r+=l;if(a=pD(r,n),l)for(o=0;o<s;++o)r[o].r-=l;i.r=a+l}}}function vD(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function bD(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function xD(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(i-t)/e.value;++s<l;)(o=a[s]).y0=n,o.y1=r,o.x0=t,o.x1=t+=o.value*u}var _D={depth:-1},wD={},kD={};function ED(e){return e.id}function $D(e){return e.parentId}function AD(){var e,t=ED,n=$D;function i(i){var r,o,a,s,l,u,c,f,d=Array.from(i),h=t,p=n,m=new Map;if(null!=e){const t=d.map(((t,n)=>function(e){let t=(e=`${e}`).length;return SD(e,t-1)&&!SD(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(DD),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(DD(e)),d.push(kD));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a<r;++a)o=d[a],u=d[a]=new QA(o),null!=(c=h(o,a,i))&&(c+="")&&(f=u.id=c,m.set(f,m.has(f)?wD:u)),null!=(c=p(o,a,i))&&(c+="")&&(u.parent=c);for(a=0;a<r;++a)if(c=(u=d[a]).parent){if(!(l=m.get(c)))throw new Error("missing: "+c);if(l===wD)throw new Error("ambiguous: "+c);l.children?l.children.push(u):l.children=[u],u.parent=l}else{if(s)throw new Error("multiple roots");s=u}if(!s)throw new Error("no root");if(null!=e){for(;s.data===kD&&1===s.children.length;)s=s.children[0],--r;for(let e=d.length-1;e>=0&&(u=d[e]).data===kD;--e)u.data=null}if(s.parent=_D,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(JA),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=ZA(e),i):t},i.parentId=function(e){return arguments.length?(n=ZA(e),i):n},i.path=function(t){return arguments.length?(e=ZA(t),i):e},i}function DD(e){let t=e.length;if(t<2)return"";for(;--t>1&&!SD(e,t););return e.slice(0,t)}function SD(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function MD(e,t){return e.parent===t.parent?1:2}function CD(e){var t=e.children;return t?t[0]:e.t}function FD(e){var t=e.children;return t?t[t.length-1]:e.t}function OD(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 ND(e,t,n){return e.a.parent===t.parent?e.a:n}function TD(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 zD(e,t){return e.parent===t.parent?1:2}function RD(e,t){return e+t.x}function PD(e,t){return Math.max(e,t.y)}function LD(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(r-n)/e.value;++s<l;)(o=a[s]).x0=t,o.x1=i,o.y0=n,o.y1=n+=o.value*u}TD.prototype=Object.create(QA.prototype);var BD=(1+Math.sqrt(5))/2;function jD(e,t,n,i,r,o){for(var a,s,l,u,c,f,d,h,p,m,g,y=[],v=t.children,b=0,x=0,_=v.length,w=t.value;b<_;){l=r-n,u=o-i;do{c=v[x++].value}while(!c&&x<_);for(f=d=c,g=c*c*(m=Math.max(u/l,l/u)/(w*e)),p=Math.max(d/g,g/f);x<_;++x){if(c+=s=v[x].value,s<f&&(f=s),s>d&&(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:l<u,children:v.slice(b,x)}),a.dice?xD(a,n,i,r,w?i+=u*c/w:o):LD(a,n,i,w?n+=l*c/w:r,o),w-=c,b=x}return y}const ID=function e(t){function n(e,n,i,r,o){jD(t,e,n,i,r,o)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(BD),UD=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,l,u,c,f=-1,d=a.length,h=e.value;++f<d;){for(l=(s=a[f]).children,u=s.value=0,c=l.length;u<c;++u)s.value+=l[u].value;s.dice?xD(s,n,i,r,h?i+=(o-i)*s.value/h:o):LD(s,n,i,h?n+=(r-n)*s.value/h:r,o),h-=s.value}else e._squarify=a=jD(t,e,n,i,r,o),a.ratio=t}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(BD);function qD(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function WD(e){ps.call(this,null,e)}WD.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const HD=e=>e.values;function GD(){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 l,u,c,f=-1;for(;++f<r;)l=o(u=t[f])+"",(c=a[l])?c.push(u):a[l]=[u];for(l in a)s[l]=n(a[l],i);return s}function i(t,n){if(++n>e.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function YD(e){ps.call(this,null,e)}ft(WD,ps,{transform(e,t){t.source||oe("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&&za(e.data)&&r.rem.push(e.data)})),this.value=o=GA({values:Ge(e.keys).reduce(((e,t)=>(e.key(t),e)),GD()).entries(r.source)},HD),n&&o.each((e=>{e.children&&(e=La(e.data),r.add.push(e),r.source.push(e))})),qD(o,Ra,Ra)),r.source.root=o,r}});const VD=(e,t)=>e.parent===t.parent?1:2;ft(YD,ps,{transform(e,t){t.source&&t.source.root||oe(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(Ua(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;r<o;++r)i=t[r],i in n&&e[i](n[i])}(n,this.params,e),n.separation&&n.separation(!1!==e.separation?VD:fe);try{this.value=n(r)}catch(e){oe(e)}return r.each((e=>function(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o<r;++o)i[n[o]]=e[t[o]];i[n[r]]=e.children?e.children.length:0}(e,i,o))),t.reflow(e.modified()).modifies(o).modifies("leaf")}});const XD=["x","y","r","depth","children"];function JD(e){YD.call(this,e)}JD.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:XD.length,default:XD}]},ft(JD,YD,{layout:function(){var e=null,t=1,n=1,i=eD;function r(r){const o=function(){let e=1;return()=>(e=(1664525*e+1013904223)%nD)/nD}();return r.x=t/2,r.y=n/2,e?r.eachBefore(gD(e)).eachAfter(yD(i,.5,o)).eachBefore(vD(1)):r.eachBefore(gD(mD)).eachAfter(yD(eD,1,o)).eachAfter(yD(i,r.r/Math.min(t,n),o)).eachBefore(vD(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=ZA(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:tD(+e),r):i},r},params:["radius","size","padding"],fields:XD});const QD=["x0","y0","x1","y1","depth","children"];function ZD(e){YD.call(this,e)}function KD(e){ps.call(this,null,e)}ZD.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:QD.length,default:QD}]},ft(ZD,YD,{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&&xD(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<r&&(r=a=(r+a)/2),s<o&&(o=s=(o+s)/2),i.x0=r,i.y0=o,i.x1=a,i.y1=s}}(t,o)),i&&r.eachBefore(bD),r}return r.round=function(e){return arguments.length?(i=!!e,r):i},r.size=function(n){return arguments.length?(e=+n[0],t=+n[1],r):[e,t]},r.padding=function(e){return arguments.length?(n=+e,r):n},r},params:["size","round","padding"],fields:QD}),KD.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},ft(KD,ps,{transform(e,t){t.source||oe("Stratify transform requires an upstream data source.");let n=this.value;const i=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),o=!n||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),o&&(n=r.source.length?qD(AD().id(e.key).parentId(e.parentKey)(r.source),e.key,de):qD(AD()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});const eS={tidy:function(){var e=MD,t=1,n=1,i=null;function r(r){var l=function(e){for(var t,n,i,r,o,a=new TD(e,0),s=[a];t=s.pop();)if(i=t._.children)for(t.children=new Array(o=i.length),r=o-1;r>=0;--r)s.push(n=t.children[r]=new TD(i[r],r)),n.parent=t;return(a.parent=new TD(null,0)).children=[a],a}(r);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),i)r.eachBefore(s);else{var u=r,c=r,f=r;r.eachBefore((function(e){e.x<u.x&&(u=e),e.x>c.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=u===c?1:e(u,c)/2,h=d-u.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,l=o.parent.children[0],u=o.m,c=a.m,f=s.m,d=l.m;s=FD(s),o=CD(o),s&&o;)l=CD(l),(a=FD(a)).a=t,(r=s.z+f-o.z-u+e(s._,o._))>0&&(OD(ND(s,t,i),t,r),u+=r,c+=r),f+=s.m,u+=o.m,d+=l.m,c+=a.m;s&&!FD(a)&&(a.t=s,a.m+=f-c),o&&!CD(l)&&(l.t=o,l.m+=u-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=zD,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(RD,0)/e.length}(n),t.y=function(e){return 1+e.reduce(PD,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),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),u=s.x-e(s,l)/2,c=l.x+e(l,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-u)/(c-u)*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}},tS=["x","y","depth","children"];function nS(e){YD.call(this,e)}function iS(e){ps.call(this,[],e)}nS.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:tS.length,default:tS}]},ft(nS,YD,{layout(e){const t=e||"tidy";if(st(eS,t))return eS[t]();oe("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:tS}),iS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ft(iS,ps,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||oe("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[Ra(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[Ra(t)]&&o[Ra(n)]&&r.add.push(La({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[Ra(e)]=1)),n.forEach((e=>{(o[Ra(e.source)]||o[Ra(e.target)])&&r.mod.push(e)}))),r}});const rS={binary:function(e,t,n,i,r){var o,a,s=e.children,l=s.length,u=new Array(l+1);for(u[0]=a=o=0;o<l;++o)u[o+1]=a+=s[o].value;!function e(t,n,i,r,o,a,l){if(t>=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=l)}for(var f=u[t],d=i/2+f,h=t+1,p=n-1;h<p;){var m=h+p>>>1;u[m]<d?h=m+1:p=m}d-u[h-1]<u[h]-d&&t+1<h&&--h;var g=u[h]-f,y=i-g;if(a-r>l-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,l),e(h,n,y,v,o,a,l)}else{var b=i?(o*y+l*g)/i:l;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,l)}}(0,l,e.value,t,n,i,r)},dice:xD,slice:LD,slicedice:function(e,t,n,i,r){(1&e.depth?LD:xD)(e,t,n,i,r)},squarify:ID,resquarify:UD},oS=["x0","y0","x1","y1","depth","children"];function aS(e){YD.call(this,e)}aS.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:oS.length,default:oS}]},ft(aS,YD,{layout(){const e=function(){var e=ID,t=!1,n=1,i=1,r=[0],o=eD,a=eD,s=eD,l=eD,u=eD;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(bD),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<i&&(i=f=(i+f)/2),d<c&&(c=d=(c+d)/2),t.x0=i,t.y0=c,t.x1=f,t.y1=d,t.children&&(n=r[t.depth+1]=o(t)/2,i+=u(t)-n,c+=a(t)-n,(f-=s(t)-n)<i&&(i=f=(i+f)/2),(d-=l(t)-n)<c&&(c=d=(c+d)/2),e(t,i,c,f,d))}return c.round=function(e){return arguments.length?(t=!!e,c):t},c.size=function(e){return arguments.length?(n=+e[0],i=+e[1],c):[n,i]},c.tile=function(t){return arguments.length?(e=KA(t),c):e},c.padding=function(e){return arguments.length?c.paddingInner(e).paddingOuter(e):c.paddingInner()},c.paddingInner=function(e){return arguments.length?(o="function"==typeof e?e:tD(+e),c):o},c.paddingOuter=function(e){return arguments.length?c.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):c.paddingTop()},c.paddingTop=function(e){return arguments.length?(a="function"==typeof e?e:tD(+e),c):a},c.paddingRight=function(e){return arguments.length?(s="function"==typeof e?e:tD(+e),c):s},c.paddingBottom=function(e){return arguments.length?(l="function"==typeof e?e:tD(+e),c):l},c.paddingLeft=function(e){return arguments.length?(u="function"==typeof e?e:tD(+e),c):u},c}();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{st(rS,t)?e.tile(rS[t]):oe("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:oS});const sS=4278190080;function lS(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function uS(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>uS(e,t.items,n)))})):Cv[i].draw(e,{items:n?t.map(cS):t})}function cS(e){const t=ja(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const fS=5,dS=31,hS=32,pS=new Uint32Array(hS+1),mS=new Uint32Array(hS+1);mS[0]=0,pS[0]=~mS[0];for(let e=1;e<=hS;++e)mS[e]=mS[e-1]<<1|1,pS[e]=~mS[e];function gS(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 yS(e,t,n,i,r,o,a,s){const l=r*o/(2*i),u=e(t-l),c=e(t+l),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(u,f,c,d)||a.getRange(u,f,c,d)||s&&s.getRange(u,f,c,d)}const vS=[-1,-1,1,1],bS=[-1,1,-1,1],xS=["right","center","left"],_S=["bottom","middle","top"];function wS(e,t,n,i,r,o,a,s,l,u,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const kS={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},ES={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=cv.width(e.datum,e.datum.text);let l,u,c,f,d,h,p,m=0;for(let i=0;i<n;++i)l=t[i].x,c=t[i].y,u=void 0===t[i].x2?l:t[i].x2,f=void 0===t[i].y2?c:t[i].y2,d=(l+u)/2,h=(c+f)/2,p=Math.abs(u-l+f-c),p>=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,l=e.x-d,u=e.x+d,c=e.y-h,f=e.y+h,e.align="center",l<0&&u<=r?e.align="left":0<=l&&r<u&&(e.align="right"),e.baseline="middle",c<0&&f<=o?e.baseline="top":0<=c&&o<f&&(e.baseline="bottom"),!0}},"reduced-search":function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1];function l(t,n,i,l,u){const c=e.invert(t),f=e.invert(n);let d,h=i,p=o;if(!gS(c,f,l,u,r,o)&&!yS(e,c,f,u,l,h,a,s)&&!yS(e,c,f,u,l,u,a,null)){for(;p-h>=1;)d=(h+p)/2,yS(e,c,f,u,l,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,u=s.length,c=t.datum.fontSize,f=cv.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,_,w,k,E,$,A,D,S,M=n?c:0,C=!1,F=!1,O=0;for(let i=0;i<u;++i){for(d=s[i].x,p=s[i].y,h=void 0===s[i].x2?d:s[i].x2,m=void 0===s[i].y2?p:s[i].y2,d>h&&(S=d,d=h,h=S),p>m&&(S=p,p=m,m=S),x=e(d),w=e(h),_=~~((x+w)/2),k=e(p),$=e(m),E=~~((k+$)/2),v=_;v>=x;--v)for(b=E;b>=k;--b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);for(v=_;v<=w;++v)for(b=E;b<=$;++b)D=l(v,b,M,f,c),D&&([t.x,t.y,M,C]=D);C||n||(A=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,A>=O&&!gS(g,y,f,c,r,o)&&!yS(e,g,y,c,f,c,a,null)&&(O=A,t.x=g,t.y=y,F=!0))}return!(!C&&!F||(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],l=e.bitmap();return function(t){const u=t.datum.datum.items[i].items,c=u.length,f=t.datum.fontSize,d=cv.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,_,w,k,E,$,A=n?f:0,D=!1,S=!1,M=0;for(let i=0;i<c;++i){for(p=u[i].x,g=u[i].y,m=void 0===u[i].x2?p:u[i].x2,y=void 0===u[i].y2?g:u[i].y2,h.push([e((p+m)/2),e((g+y)/2)]);h.length;)if([x,_]=h.pop(),!(a.get(x,_)||s.get(x,_)||l.get(x,_))){l.set(x,_);for(let e=0;e<4;++e)v=x+vS[e],b=_+bS[e],l.outOfBounds(v,b,v,b)||h.push([v,b]);if(v=e.invert(x),b=e.invert(_),w=A,k=o,!gS(v,b,d,f,r,o)&&!yS(e,v,b,f,d,w,a,s)&&!yS(e,v,b,f,d,f,a,null)){for(;k-w>=1;)E=(w+k)/2,yS(e,v,b,f,d,E,a,s)?k=E:w=E;w>A&&(t.x=v,t.y=b,A=w,D=!0)}}D||n||($=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,$>=M&&!gS(v,b,d,f,r,o)&&!yS(e,v,b,f,d,f,a,null)&&(M=$,t.x=v,t.y=b,S=!0))}return!(!D&&!S||(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 $S(e,t,n,i,r,o,a,s,l,u,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 t=0;t<i;++t)n[t]=e[t]||0;for(let e=i;e<t;++e)n[e]=n[i-1];return n}(i,f),h=function(e,t){const n=new Int8Array(t),i=e.length;for(let t=0;t<i;++t)n[t]|=kS[e[t]];for(let e=i;e<t;++e)n[e]=n[i-1];return n}(r,f),p=(x=e[0].datum)&&x.mark&&x.mark.marktype,m="group"===p&&e[0].datum.items[l].marktype,g="area"===m,y=function(e,t,n,i){const r=e=>[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,l),v=null===u||u===1/0,b=g&&"naive"===c;var x;let _=-1,w=-1;const k=e.map((e=>{const t=v?cv.width(e,e.text):void 0;return _=Math.max(_,t),w=Math.max(w,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));u=null===u||u===1/0?Math.max(_,w)+Math.max(...i):u;const E=function(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+hS)/hS));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>>>fS]&1<<(r&dS)},set:(t,n)=>{const r=n*e+t;i(r>>>fS,1<<(r&dS))},clear:(t,n)=>{const i=n*e+t;r(i>>>fS,~(1<<(i&dS)))},getRange:(t,i,r,o)=>{let a,s,l,u,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,l=a>>>fS,u=s>>>fS,l===u){if(n[l]&pS[a&dS]&mS[1+(s&dS)])return!0}else{if(n[l]&pS[a&dS])return!0;if(n[u]&mS[1+(s&dS)])return!0;for(let e=l+1;e<u;++e)if(n[e])return!0}return!1},setRange:(t,n,r,o)=>{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,l=a>>>fS,u=s>>>fS,l===u)i(l,pS[a&dS]&mS[1+(s&dS)]);else for(i(l,pS[a&dS]),i(u,mS[1+(s&dS)]),c=l+1;c<u;++c)i(c,4294967295)},clearRange:(t,n,i,o)=>{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,l=a>>>fS,u=s>>>fS,l===u)r(l,mS[a&dS]|pS[1+(s&dS)]);else for(r(l,mS[a&dS]),r(u,pS[1+(s&dS)]),c=l+1;c<u;++c)r(c,0)},outOfBounds:(n,i,r,o)=>n<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}(t[0],t[1],u);let $;if(!b){n&&k.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;e<h.length&&!t;++e)t=5===h[e]||d[e]<0;const i=(p&&a||g)&&e.map((e=>e.datum));$=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,l=ff(o,a).getContext("2d"),u=ff(o,a).getContext("2d"),c=s&&ff(o,a).getContext("2d");n.forEach((e=>uS(l,e,!1))),uS(u,t,!1),s&&uS(c,t,!0);const f=lS(l,o,a),d=lS(u,o,a),h=s&&lS(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,_,w,k;for(y=0;y<a;++y)for(g=0;g<o;++g)x=y*o+g,_=f[x]&sS,k=d[x]&sS,w=s&&h[x]&sS,(_||w||k)&&(v=e(g),b=e(y),r||!_&&!k||p.set(v,b),s&&(_||w)&&m.set(v,b));return[p,m]}(E,i||[],o,t,g):function(e,t){const n=e.bitmap();return(t||[]).forEach((t=>n.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(E,a&&k)}const A=g?ES[c](E,$,a,l):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=i.length;return function(t){const u=t.boundary,c=t.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>r||u[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,_,w,k,E,$,A=t.textWidth??0;for(let r=0;r<l;++r){if(f=(3&n[r])-1,d=(n[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=u[1+f]+i[r]*f*p,_=u[4+d]+m*c*d/2+i[r]*d*p,v=_-c/2,b=_+c/2,w=e(g),E=e(v),$=e(b),!A){if(!wS(w,w,E,$,a,s,0,0,0,0,0,h))continue;A=cv.width(t.datum,t.datum.text)}if(x=g+m*A*f/2,g=x-A/2,y=x+A/2,w=e(g),k=e(y),wS(w,k,E,$,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:_,t.align=xS[f*m+1],t.baseline=_S[d*m+1],a.setRange(w,E,k,$),!0}return!1}}(E,$,h,d);return k.forEach((e=>e.opacity=+A(e))),k}const AS=["x","y","opacity","align","baseline"],DS=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function SS(e){ps.call(this,null,e)}function MS(e,t){var n,i,r,o,a,s,l=[],u=function(e){return e(o)};if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(u)])||(n[a]=s=[],s.dims=a,l.push(s)),s.push(o);return l}function CS(e){ps.call(this,null,e)}SS.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:DS},{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:AS.length,default:AS}]},ft(SS,ps,{transform(e,t){const n=e.modified();if(!(n||t.changed(t.ADD_REM)||function(n){const i=e.sort;return Ve(i)&&t.modified(i.fields)}()))return;e.size&&2===e.size.length||oe("Size parameter should be specified as a [width, height] array.");const i=e.as||AS;return $S(t.materialize(t.SOURCE).source||[],e.size,e.sort,Ge(null==e.offset?1:e.offset),Ge(e.anchor||DS),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)}}),CS.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},ft(CS,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=MS(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ee),o=r.length,a=e.as||[ee(e.x),ee(e.y)],s=[];i.forEach((t=>{vl(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let e=0;e<o;++e)n[r[e]]=t.dims[e];n[a[0]]=e[0],n[a[1]]=e[1],s.push(La(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=s}return n}});const FS={constant:rl,linear:ul,log:cl,exp:fl,pow:dl,quad:hl,poly:pl};function OS(e){ps.call(this,null,e)}OS.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(FS)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},ft(OS,ps,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=MS(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(ee),o=e.method||"linear",a=null==e.order?3:e.order,s=((e,t)=>"poly"===e?t:"quad"===e?2:1)(o,a),l=e.as||[ee(e.x),ee(e.y)],u=FS[o],c=[];let f=e.extent;st(FS,o)||oe("Invalid regression method: "+o),null!=f&&"log"===o&&f[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),f=null),i.forEach((n=>{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=u(n,e.x,e.y,a);if(e.params)return void c.push(La({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const d=f||rt(n,e.x),h=e=>{const t={};for(let e=0;e<r.length;++e)t[r[e]]=n.dims[e];t[l[0]]=e[0],t[l[1]]=e[1],c.push(La(t))};"linear"===o||"constant"===o?d.forEach((e=>h([e,i.predict(e)]))):wl(i.predict,d,25,200).forEach(h)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});const NS=134217729;function TS(e,t,n,i,r){let o,a,s,l,u=t[0],c=i[0],f=0,d=0;c>u==c>-u?(o=u,u=t[++f]):(o=c,c=i[++d]);let h=0;if(f<e&&d<n)for(c>u==c>-u?(a=u+o,s=o-(a-u),u=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);f<e&&d<n;)c>u==c>-u?(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f<e;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f],o=a,0!==s&&(r[h++]=s);for(;d<n;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d],o=a,0!==s&&(r[h++]=s);return 0===o&&0!==h||(r[h++]=o),h}function zS(e){return new Float64Array(e)}const RS=zS(4),PS=zS(8),LS=zS(12),BS=zS(16),jS=zS(4);function IS(e,t,n,i,r,o){const a=(t-o)*(n-r),s=(e-r)*(i-o),l=a-s,u=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*u?l:-function(e,t,n,i,r,o,a){let s,l,u,c,f,d,h,p,m,g,y,v,b,x,_,w,k,E;const $=e-r,A=n-r,D=t-o,S=i-o;x=$*S,d=NS*$,h=d-(d-$),p=$-h,d=NS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=D*A,d=NS*D,h=d-(d-D),p=D-h,d=NS*A,m=d-(d-A),g=A-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,RS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,RS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,RS[2]=v-(E-f)+(y-f),RS[3]=E;let M=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,RS),C=22204460492503146e-32*a;if(M>=C||-M>=C)return M;if(f=e-$,s=e-($+f)+(f-r),f=n-A,u=n-(A+f)+(f-r),f=t-D,l=t-(D+f)+(f-o),f=i-S,c=i-(S+f)+(f-o),0===s&&0===l&&0===u&&0===c)return M;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=$*c+S*s-(D*u+A*l),M>=C||-M>=C)return M;x=s*S,d=NS*s,h=d-(d-s),p=s-h,d=NS*S,m=d-(d-S),g=S-m,_=p*g-(x-h*m-p*m-h*g),w=l*A,d=NS*l,h=d-(d-l),p=l-h,d=NS*A,m=d-(d-A),g=A-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const F=TS(4,RS,4,jS,PS);x=$*c,d=NS*$,h=d-(d-$),p=$-h,d=NS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=D*u,d=NS*D,h=d-(d-D),p=D-h,d=NS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const O=TS(F,PS,4,jS,LS);x=s*c,d=NS*s,h=d-(d-s),p=s-h,d=NS*c,m=d-(d-c),g=c-m,_=p*g-(x-h*m-p*m-h*g),w=l*u,d=NS*l,h=d-(d-l),p=l-h,d=NS*u,m=d-(d-u),g=u-m,k=p*g-(w-h*m-p*m-h*g),y=_-k,f=_-y,jS[0]=_-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-w,f=b-y,jS[1]=b-(y+f)+(f-w),E=v+y,f=E-v,jS[2]=v-(E-f)+(y-f),jS[3]=E;const N=TS(O,LS,4,jS,BS);return BS[N-1]}(e,t,n,i,r,o,u)}zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(8),zS(8),zS(8),zS(4),zS(8),zS(8),zS(8),zS(12),zS(192),zS(192),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(8),zS(4),zS(4),zS(4),zS(8),zS(16),zS(16),zS(16),zS(32),zS(32),zS(48),zS(64),zS(1152),zS(1152),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(4),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(24),zS(1152),zS(1152),zS(1152),zS(1152),zS(1152),zS(2304),zS(2304),zS(3456),zS(5760),zS(8),zS(8),zS(8),zS(16),zS(24),zS(48),zS(48),zS(96),zS(192),zS(384),zS(384),zS(384),zS(768),zS(96),zS(96),zS(96),zS(1152);const US=Math.pow(2,-52),qS=new Uint32Array(512);class WS{static from(e,t=JS,n=QS){const i=e.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=e[o];r[2*o]=t(i),r[2*o+1]=n(i)}return new WS(r)}constructor(e){const t=e.length>>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,l=-1/0,u=-1/0;for(let t=0;t<o;t++){const n=e[2*t],i=e[2*t+1];n<a&&(a=n),i<s&&(s=i),n>l&&(l=n),i>u&&(u=i),this._ids[t]=t}const c=(a+l)/2,f=(s+u)/2;let d,h,p,m=1/0;for(let t=0;t<o;t++){const n=HS(c,f,e[2*t],e[2*t+1]);n<m&&(d=t,m=n)}const g=e[2*d],y=e[2*d+1];m=1/0;for(let t=0;t<o;t++){if(t===d)continue;const n=HS(g,y,e[2*t],e[2*t+1]);n<m&&n>0&&(h=t,m=n)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let t=0;t<o;t++){if(t===d||t===h)continue;const n=YS(g,y,v,b,e[2*t],e[2*t+1]);n<x&&(p=t,x=n)}let _=e[2*p],w=e[2*p+1];if(x===1/0){for(let t=0;t<o;t++)this._dists[t]=e[2*t]-e[0]||e[2*t+1]-e[1];VS(this._ids,this._dists,0,o-1);const t=new Uint32Array(o);let n=0;for(let e=0,i=-1/0;e<o;e++){const r=this._ids[e];this._dists[r]>i&&(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(IS(g,y,v,b,_,w)<0){const e=h,t=v,n=b;h=p,v=_,b=w,p=e,_=t,w=n}const k=function(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l);return{x:e+(u*c-s*f)*d,y:t+(a*f-l*c)*d}}(g,y,v,b,_,w);this._cx=k.x,this._cy=k.y;for(let t=0;t<o;t++)this._dists[t]=HS(e[2*t],e[2*t+1],k.x,k.y);VS(this._ids,this._dists,0,o-1),this._hullStart=d;let E=3;n[d]=t[p]=h,n[h]=t[d]=p,n[p]=t[h]=d,i[d]=0,i[h]=1,i[p]=2,r.fill(-1),r[this._hashKey(g,y)]=d,r[this._hashKey(v,b)]=h,r[this._hashKey(_,w)]=p,this.trianglesLen=0,this._addTriangle(d,h,p,-1,-1,-1);for(let o,a,s=0;s<this._ids.length;s++){const l=this._ids[s],u=e[2*l],c=e[2*l+1];if(s>0&&Math.abs(u-o)<=US&&Math.abs(c-a)<=US)continue;if(o=u,a=c,l===d||l===h||l===p)continue;let f=0;for(let e=0,t=this._hashKey(u,c);e<this._hashSize&&(f=r[(t+e)%this._hashSize],-1===f||f===n[f]);e++);f=t[f];let m,g=f;for(;m=n[g],IS(u,c,e[2*g],e[2*g+1],e[2*m],e[2*m+1])>=0;)if(g=m,g===f){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,l,n[g],-1,-1,i[g]);i[l]=this._legalize(y+2),i[g]=y,E++;let v=n[g];for(;m=n[v],IS(u,c,e[2*v],e[2*v+1],e[2*m],e[2*m+1])<0;)y=this._addTriangle(v,l,m,i[l],-1,i[v]),i[l]=this._legalize(y+2),n[v]=v,E--,v=m;if(g===f)for(;m=t[g],IS(u,c,e[2*m],e[2*m+1],e[2*g],e[2*g+1])<0;)y=this._addTriangle(m,l,g,-1,i[g],i[m]),this._legalize(y+2),i[m]=y,n[g]=g,E--,g=m;this._hullStart=t[l]=g,n[g]=t[v]=l,n[l]=v,r[this._hashKey(u,c)]=l,r[this._hashKey(e[2*g],e[2*g+1])]=g}this.hull=new Uint32Array(E);for(let e=0,t=this._hullStart;e<E;e++)this.hull[e]=t,t=n[t];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?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=qS[--r];continue}const l=a-a%3,u=s+(e+1)%3,c=l+(a+2)%3,f=t[o],d=t[e],h=t[u],p=t[c];if(GS(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=l+(a+1)%3;r<qS.length&&(qS[r++]=s)}else{if(0===r)break;e=qS[--r]}}return o}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,i,r,o){const a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,r),this._link(a+2,o),this.trianglesLen+=3,a}}function HS(e,t,n,i){const r=e-n,o=t-i;return r*r+o*o}function GS(e,t,n,i,r,o,a,s){const l=e-a,u=t-s,c=n-a,f=i-s,d=r-a,h=o-s,p=c*c+f*f,m=d*d+h*h;return l*(f*m-p*h)-u*(c*m-p*d)+(l*l+u*u)*(c*h-f*d)<0}function YS(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l),h=(u*c-s*f)*d,p=(a*f-l*c)*d;return h*h+p*p}function VS(e,t,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=e[r],o=t[i];let a=r-1;for(;a>=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;XS(e,n+i>>1,r),t[e[n]]>t[e[i]]&&XS(e,n,i),t[e[r]]>t[e[i]]&&XS(e,r,i),t[e[n]]>t[e[r]]&&XS(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]<s);do{o--}while(t[e[o]]>s);if(o<r)break;XS(e,r,o)}e[n+1]=e[o],e[o]=a,i-r+1>=o-n?(VS(e,t,r,i),VS(e,t,n,o-1)):(VS(e,t,n,o-1),VS(e,t,r,i))}}function XS(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function JS(e){return e[0]}function QS(e){return e[1]}const ZS=1e-6;class KS{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)>ZS||Math.abs(this._y1-r)>ZS)&&(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 eM{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}}class tM{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 i,s,l=0,u=0,c=n.length;l<c;l+=3,u+=2){const c=2*n[l],f=2*n[l+1],d=2*n[l+2],h=e[c],p=e[c+1],m=e[f],g=e[f+1],y=e[d],v=e[d+1],b=m-h,x=g-p,_=y-h,w=v-p,k=2*(b*w-x*_);if(Math.abs(k)<1e-9){if(void 0===r){r=o=0;for(const n of t)r+=e[2*n],o+=e[2*n+1];r/=t.length,o/=t.length}const n=1e9*Math.sign((r-h)*w-(o-p)*_);i=(h+y)/2-n*w,s=(p+v)/2+n*_}else{const e=1/k,t=b*b+x*x,n=_*_+w*w;i=h+(w*t-x*n)*e,s=p+(b*n-_*t)*e}a[u]=i,a[u+1]=s}let s,l,u,c=t[t.length-1],f=4*c,d=e[2*c],h=e[2*c+1];i.fill(0);for(let n=0;n<t.length;++n)c=t[n],s=f,l=d,u=h,f=4*c,d=e[2*c],h=e[2*c+1],i[s+2]=i[f]=u-h,i[s+3]=i[f+1]=d-l}render(e){const t=null==e?e=new KS:void 0,{delaunay:{halfedges:n,inedges:i,hull:r},circumcenters:o,vectors:a}=this;if(r.length<=1)return null;for(let t=0,i=n.length;t<i;++t){const i=n[t];if(i<t)continue;const r=2*Math.floor(t/3),a=2*Math.floor(i/3),s=o[r],l=o[r+1],u=o[a],c=o[a+1];this._renderSegment(s,l,u,c,e)}let s,l=r[r.length-1];for(let t=0;t<r.length;++t){s=l,l=r[t];const n=2*Math.floor(i[l]/3),u=o[n],c=o[n+1],f=4*s,d=this._project(u,c,a[f+2],a[f+3]);d&&this._renderSegment(u,c,d[0],d[1],e)}return t&&t.value()}renderBounds(e){const t=null==e?e=new KS:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){const n=null==t?t=new KS:void 0,i=this._clip(e);if(null===i||!i.length)return;t.moveTo(i[0],i[1]);let r=i.length;for(;i[0]===i[r-2]&&i[1]===i[r-1]&&r>1;)r-=2;for(let e=2;e<r;e+=2)i[e]===i[e-2]&&i[e+1]===i[e-1]||t.lineTo(i[e],i[e+1]);return t.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){const e=this.cellPolygon(t);e&&(e.index=t,yield e)}}cellPolygon(e){const t=new eM;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,i,r){let o;const a=this._regioncode(e,t),s=this._regioncode(n,i);0===a&&0===s?(r.moveTo(e,t),r.lineTo(n,i)):(o=this._clipSegment(e,t,n,i,a,s))&&(r.moveTo(o[0],o[1]),r.lineTo(o[2],o[3]))}contains(e,t,n){return(t=+t)==t&&(n=+n)==n&&this.delaunay._step(e,t,n)===e}*neighbors(e){const t=this._clip(e);if(t)for(const n of this.delaunay.neighbors(e)){const e=this._clip(n);if(e)e:for(let i=0,r=t.length;i<r;i+=2)for(let o=0,a=e.length;o<a;o+=2)if(t[i]===e[o]&&t[i+1]===e[o+1]&&t[(i+2)%r]===e[(o+a-2)%a]&&t[(i+3)%r]===e[(o+a-1)%a]){yield n;break e}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:i,triangles:r}}=this,o=n[e];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(t[2*n],t[2*n+1]),s=s%3==2?s-2:s+1,r[s]!==e)break;s=i[s]}while(s!==o&&-1!==s);return a}_clip(e){if(0===e&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const t=this._cell(e);if(null===t)return null;const{vectors:n}=this,i=4*e;return this._simplify(n[i]||n[i+1]?this._clipInfinite(e,t,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(e,t))}_clipFinite(e,t){const n=t.length;let i,r,o,a,s=null,l=t[n-2],u=t[n-1],c=this._regioncode(l,u),f=0;for(let d=0;d<n;d+=2)if(i=l,r=u,l=t[d],u=t[d+1],o=c,c=this._regioncode(l,u),0===o&&0===c)a=f,f=0,s?s.push(l,u):s=[l,u];else{let t,n,d,h,p;if(0===o){if(null===(t=this._clipSegment(i,r,l,u,o,c)))continue;[n,d,h,p]=t}else{if(null===(t=this._clipSegment(l,u,i,r,c,o)))continue;[h,p,n,d]=t,a=f,f=this._edgecode(n,d),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(n,d):s=[n,d]}a=f,f=this._edgecode(h,p),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(h,p):s=[h,p]}if(s)a=f,f=this._edgecode(s[0],s[1]),a&&f&&this._edge(e,a,f,s,s.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(e,t,n,i,r,o){const a=r<o;for(a&&([e,t,n,i,r,o]=[n,i,e,t,o,r]);;){if(0===r&&0===o)return a?[n,i,e,t]:[e,t,n,i];if(r&o)return null;let s,l,u=r||o;8&u?(s=e+(n-e)*(this.ymax-t)/(i-t),l=this.ymax):4&u?(s=e+(n-e)*(this.ymin-t)/(i-t),l=this.ymin):2&u?(l=t+(i-t)*(this.xmax-e)/(n-e),s=this.xmax):(l=t+(i-t)*(this.xmin-e)/(n-e),s=this.xmin),r?(e=s,t=l,r=this._regioncode(e,t)):(n=s,i=l,o=this._regioncode(n,i))}}_clipInfinite(e,t,n,i,r,o){let a,s=Array.from(t);if((a=this._project(s[0],s[1],n,i))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],r,o))&&s.push(a[0],a[1]),s=this._clipFinite(e,s))for(let t,n=0,i=s.length,r=this._edgecode(s[i-2],s[i-1]);n<i;n+=2)t=r,r=this._edgecode(s[n],s[n+1]),t&&r&&(n=this._edge(e,t,r,s,n),i=s.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(e,t,n,i,r){for(;t!==n;){let n,o;switch(t){case 5:t=4;continue;case 4:t=6,n=this.xmax,o=this.ymin;break;case 6:t=2;continue;case 2:t=10,n=this.xmax,o=this.ymax;break;case 10:t=8;continue;case 8:t=9,n=this.xmin,o=this.ymax;break;case 9:t=1;continue;case 1:t=5,n=this.xmin,o=this.ymin}i[r]===n&&i[r+1]===o||!this.contains(e,n,o)||(i.splice(r,0,n,o),r+=2)}return r}_project(e,t,n,i){let r,o,a,s=1/0;if(i<0){if(t<=this.ymin)return null;(r=(this.ymin-t)/i)<s&&(a=this.ymin,o=e+(s=r)*n)}else if(i>0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)<s&&(a=this.ymax,o=e+(s=r)*n)}if(n>0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)<s&&(o=this.xmax,a=t+(s=r)*i)}else if(n<0){if(e<=this.xmin)return null;(r=(this.xmin-e)/n)<s&&(o=this.xmin,a=t+(s=r)*i)}return[o,a]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){const n=(t+2)%e.length,i=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[i]||e[t+1]===e[n+1]&&e[n+1]===e[i+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}}const nM=2*Math.PI,iM=Math.pow;function rM(e){return e[0]}function oM(e){return e[1]}function aM(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class sM{static from(e,t=rM,n=oM,i){return new sM("length"in e?function(e,t,n,i){const r=e.length,o=new Float64Array(2*r);for(let a=0;a<r;++a){const r=e[a];o[2*a]=t.call(i,r,a,e),o[2*a+1]=n.call(i,r,a,e)}return o}(e,t,n,i):Float64Array.from(function*(e,t,n,i){let r=0;for(const o of e)yield t.call(i,o,r,e),yield n.call(i,o,r,e),++r}(e,t,n,i)))}constructor(e){this._delaunator=new WS(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e<t.length;e+=3){const i=2*t[e],r=2*t[e+1],o=2*t[e+2];if((n[o]-n[i])*(n[r+1]-n[i+1])-(n[r]-n[i])*(n[o+1]-n[i+1])>1e-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 e=0,n=t.length/2;e<n;++e){const n=aM(t[2*e],t[2*e+1],r);t[2*e]=n[0],t[2*e+1]=n[1]}this._delaunator=new WS(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,r=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let e=0,t=n.length;e<t;++e){const t=r[e%3==2?e-2:e+1];-1!==n[e]&&-1!==o[t]||(o[t]=e)}for(let e=0,t=i.length;e<t;++e)a[i[e]]=e;i.length<=2&&i.length>0&&(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 tM(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<a.length-1&&(yield a[t+1]))}const s=t[e];if(-1===s)return;let l=s,u=-1;do{if(yield u=o[l],l=l%3==2?l-2:l+1,o[l]!==e)return;if(l=r[l],-1===l){const t=n[(i[e]+1)%n.length];return void(t!==u&&(yield t))}}while(l!==s)}find(e,t,n=0){if((e=+e)!=e||(t=+t)!=t)return-1;const i=n;let r;for(;(r=this._step(n,e,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:l}=this;if(-1===i[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=iM(t-l[2*e],2)+iM(n-l[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=iM(t-l[2*i],2)+iM(n-l[2*i+1],2);if(f<c&&(c=f,u=i),d=d%3==2?d-2:d+1,s[d]!==e)break;if(d=a[d],-1===d){if(d=r[(o[e]+1)%r.length],d!==i&&iM(t-l[2*d],2)+iM(n-l[2*d+1],2)<c)return d;break}}while(d!==f);return u}render(e){const t=null==e?e=new KS:void 0,{points:n,halfedges:i,triangles:r}=this;for(let t=0,o=i.length;t<o;++t){const o=i[t];if(o<t)continue;const a=2*r[t],s=2*r[o];e.moveTo(n[a],n[a+1]),e.lineTo(n[s],n[s+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){void 0!==t||e&&"function"==typeof e.moveTo||(t=e,e=null),t=null==t?2:+t;const n=null==e?e=new KS:void 0,{points:i}=this;for(let n=0,r=i.length;n<r;n+=2){const r=i[n],o=i[n+1];e.moveTo(r+t,o),e.arc(r,o,t,0,nM)}return n&&n.value()}renderHull(e){const t=null==e?e=new KS:void 0,{hull:n,points:i}=this,r=2*n[0],o=n.length;e.moveTo(i[r],i[r+1]);for(let t=1;t<o;++t){const r=2*n[t];e.lineTo(i[r],i[r+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new eM;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=null==t?t=new KS:void 0,{points:i,triangles:r}=this,o=2*r[e*=3],a=2*r[e+1],s=2*r[e+2];return t.moveTo(i[o],i[o+1]),t.lineTo(i[a],i[a+1]),t.lineTo(i[s],i[s+1]),t.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){const t=new eM;return this.renderTriangle(e,t),t.value()}}function lM(e){ps.call(this,null,e)}lM.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const uM=[-1e5,-1e5,1e5,1e5];function cM(e){const t=e[0][0],n=e[0][1];let i=e.length-1;for(;e[i][0]===t&&e[i][1]===n;--i);return"M"+e.slice(0,i+1).join("L")+"Z"}ft(lM,ps,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:uM;const o=this.value=sM.from(i,e.x,e.y).voronoi(r);for(let e=0,t=i.length;e<t;++e){const t=o.cellPolygon(e);i[e][n]=t?cM(t):null}return t.reflow(e.modified()).modifies(n)}});var fM=Math.PI/180,dM=64,hM=2048;function pM(e,t,n,i){if(!t.sprite){var r=e.context,o=e.ratio;r.clearRect(0,0,(dM<<5)/o,hM/o);var a,s,l,u,c,f=0,d=0,h=0,p=n.length;for(--i;++i<p;){if(t=n[i],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/o)+"px "+t.font,a=r.measureText(t.text+"m").width*o,l=t.size<<1,t.rotate){var m=Math.sin(t.rotate*fM),g=Math.cos(t.rotate*fM),y=a*g,v=a*m,b=l*g,x=l*m;a=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,l=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(l>h&&(h=l),f+a>=dM<<5&&(f=0,d+=h,h=0),d+l>=hM)break;r.translate((f+(a>>1))/o,(d+(l>>1))/o),t.rotate&&r.rotate(t.rotate*fM),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=l,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=l>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var _=r.getImageData(0,0,(dM<<5)/o,hM/o).data,w=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,l=t.y1-t.y0,u=0;u<l*s;u++)w[u]=0;if(null==(f=t.xoff))return;d=t.yoff;var k=0,E=-1;for(c=0;c<l;c++){for(u=0;u<a;u++){var $=s*c+(u>>5),A=_[(d+c)*(dM<<5)+(f+u)<<2]?1<<31-u%32:0;w[$]|=A,k|=A}k?E=c:(t.y0++,l--,c--,d++)}t.y1=t.y0+E,t.sprite=w.slice(0,(t.y1-t.y0)*s)}}}function mM(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,l=32-s,u=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f<u;f++){i=0;for(var d=0;d<=o;d++)if((i<<l|(d<o?(i=r[f*o+d])>>>s:0))&t[c+d])return!0;c+=n}return!1}function gM(e,t){var n=e[0],i=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function yM(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function vM(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function bM(e){return"function"==typeof e?e:function(){return e}}var xM={archimedean:vM,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 _M=["x","y","font","fontSize","fontStyle","fontWeight","angle"],wM=["text","font","rotate","fontSize","fontStyle","fontWeight"];function kM(e){ps.call(this,function(){var e,t,n,i,r,o,a,s=[256,256],l=vM,u=[],c=Math.random,f={};function d(e,t,n){for(var i,r,o,a=t.x,u=t.y,f=Math.sqrt(s[0]*s[0]+s[1]*s[1]),d=l(s),h=c()<.5?1:-1,p=-h;(i=d(p+=h))&&(r=~~i[0],o=~~i[1],!(Math.min(Math.abs(r),Math.abs(o))>=f));)if(t.x=a+r,t.y=u+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1])&&(!n||!mM(t,e,s[0]))&&(!n||yM(t,n))){for(var m,g=t.sprite,y=t.width>>5,v=s[0]>>5,b=t.x-(y<<4),x=127&b,_=32-x,w=t.y1-t.y0,k=(t.y+t.y0)*v+(b>>5),E=0;E<w;E++){m=0;for(var $=0;$<=y;$++)e[k+$]|=m<<_|($<y?(m=g[E*y+$])>>>x:0);k+=v}return t.sprite=null,!0}return!1}return f.layout=function(){for(var l=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=(dM<<5)/t,e.height=hM/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(ff()),f=function(e){for(var t=[],n=-1;++n<e;)t[n]=0;return t}((s[0]>>5)*s[1]),h=null,p=u.length,m=-1,g=[],y=u.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<p;){var v=y[m];v.x=s[0]*(c()+.5)>>1,v.y=s[1]*(c()+.5)>>1,pM(l,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?gM(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?(u=e,f):u},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=bM(e),f):t},f.fontStyle=function(e){return arguments.length?(i=bM(e),f):i},f.fontWeight=function(e){return arguments.length?(r=bM(e),f):r},f.rotate=function(e){return arguments.length?(o=bM(e),f):o},f.text=function(t){return arguments.length?(e=bM(t),f):e},f.spiral=function(e){return arguments.length?(l=xM[e]||e,f):l},f.fontSize=function(e){return arguments.length?(n=bM(e),f):n},f.padding=function(e){return arguments.length?(a=bM(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}(),e)}kM.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:_M}]},ft(kM,ps,{transform(e,t){!e.size||e.size[0]&&e.size[1]||oe("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||wM.some((function(n){const i=e[n];return Ve(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,o=e.as||_M;let a,s=e.fontSize||14;if(Ve(s)?a=e.fontSizeRange:s=tt(s),a){const e=s,t=Gp("sqrt")().domain(rt(i,e)).range(a);s=n=>t(e(n))}i.forEach((e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0}));const l=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(s).random(Os).layout(),u=r.size(),c=u[0]>>1,f=u[1]>>1,d=l.length;for(let e,t,n=0;n<d;++n)e=l[n],t=e.datum,t[o[0]]=e.x+c,t[o[1]]=e.y+f,t[o[2]]=e.font,t[o[3]]=e.size,t[o[4]]=e.style,t[o[5]]=e.weight,t[o[6]]=e.rotate;return t.reflow(n).modifies(o)}});const EM=e=>new Uint8Array(e),$M=e=>new Uint16Array(e),AM=e=>new Uint32Array(e);function DM(e,t,n){const i=(t<257?EM:t<65537?$M:AM)(e);return n&&i.set(n),i}function SM(e,t,n){const i=1<<t;return{one:i,zero:~i,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(e,t){const n=this,r=n.bisect(n.range,e.value),o=e.index,a=r[0],s=r[1],l=o.length;let u;for(u=0;u<a;++u)t[o[u]]|=i;for(u=s;u<l;++u)t[o[u]]|=i;return n}}}function MM(){let e=AM(0),t=[],n=0;return{insert:function(i,r,o){if(!r.length)return[];const a=n,s=r.length,l=AM(s);let u,c,f,d=Array(s);for(f=0;f<s;++f)d[f]=i(r[f]),l[f]=f;if(d=function(e,t){return e.sort.call(t,((t,n)=>{const i=e[t],r=e[n];return i<r?-1:i>r?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,l),a)u=t,c=e,t=Array(a+s),e=AM(a+s),function(e,t,n,i,r,o,a,s,l){let u,c=0,f=0;for(u=0;c<i&&f<a;++u)t[c]<r[f]?(s[u]=t[c],l[u]=n[c++]):(s[u]=r[f],l[u]=o[f++]+e);for(;c<i;++c,++u)s[u]=t[c],l[u]=n[c];for(;f<a;++f,++u)s[u]=r[f],l[u]=o[f]+e}(o,u,c,a,d,l,s,t,e);else{if(o>0)for(f=0;f<s;++f)l[f]+=o;t=d,e=l}return n=a+s,{index:l,value:d}},remove:function(i,r){const o=n;let a,s,l;for(s=0;!r[e[s]]&&s<o;++s);for(l=s;s<o;++s)r[a=e[s]]||(e[l]=a,t[l]=t[s],++l);n=o-i},bisect:function(e,i){let r;return i?r=i.length:(i=t,r=n),[mf(i,e[0],0,r),pf(i,e[1],0,r)]},reindex:function(t){for(let i=0,r=n;i<r;++i)e[i]=t[e[i]]},index:()=>e,size:()=>n}}function CM(e){ps.call(this,function(){let e=8,t=[],n=AM(0),i=DM(0,e),r=DM(0,e);return{data:()=>t,seen:()=>n=function(e,t,n){return e.length>=t?e:((n=n||new e.constructor(t)).set(e),n)}(n,t.length),add(e){for(let n,i=0,r=t.length,o=e.length;i<o;++i)n=e[i],n._index=r++,t.push(n)},remove(e,n){const o=t.length,a=Array(o-e),s=t;let l,u,c;for(u=0;!n[u]&&u<o;++u)a[u]=t[u],s[u]=u;for(c=u;u<o;++u)l=t[u],n[u]?s[u]=-1:(s[u]=c,i[c]=i[u],r[c]=r[u],a[c]=l,l._index=c++),i[u]=0;return t=a,s},size:()=>t.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=DM(t,e,i),r=DM(t,e))}}}(),e),this._indices=null,this._dims=null}function FM(e){ps.call(this,null,e)}CM.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}}]},ft(CM,ps,{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,l,u=0;for(;u<a;++u)s=n[u].fname,l=r[s]||(r[s]=MM()),o.push(SM(l,u,i[u]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),i=e.fields,r=e.query,o=this._indices,a=this._dims,s=this.value,l=s.curr(),u=s.prev(),c=s.all(),f=n.rem=n.add,d=n.mod,h=r.length,p={};let m,g,y,v,b,x,_,w,k;if(u.set(l),t.rem.length&&(b=this.remove(e,t,n)),t.add.length&&s.add(t.add),t.mod.length)for(x={},v=t.mod,_=0,w=v.length;_<w;++_)x[v[_]._index]=1;for(_=0;_<h;++_)k=i[_],(!a[_]||e.modified("fields",_)||t.modified(k.fields))&&(y=k.fname,(m=p[y])||(o[y]=g=MM(),p[y]=m=g.insert(k,t.source,0)),a[_]=SM(g,_,r[_]).onAdd(m,l));for(_=0,w=s.data().length;_<w;++_)b[_]||(u[_]!==l[_]?f.push(_):x[_]&&l[_]!==c&&d.push(_));return s.mask=(1<<h)-1,n},eval(e,t){const n=t.materialize().fork(),i=this._dims.length;let r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<i)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<i)-1),t.mod.length&&(this.modify(t,n),r|=(1<<i)-1),this.value.mask=r,n},insert(e,t,n){const i=t.add,r=this.value,o=this._dims,a=this._indices,s=e.fields,l={},u=n.add,c=r.size()+i.length,f=o.length;let d,h,p,m=r.size();r.resize(c,f),r.add(i);const g=r.curr(),y=r.prev(),v=r.all();for(d=0;d<f;++d)h=s[d].fname,p=l[h]||(l[h]=a[h].insert(s[d],i,m)),o[d].onAdd(p,g);for(;m<c;++m)y[m]=v,g[m]!==v&&u.push(m)},modify(e,t){const n=t.mod,i=this.value,r=i.curr(),o=i.all(),a=e.mod;let s,l,u;for(s=0,l=a.length;s<l;++s)u=a[s]._index,r[u]!==o&&n.push(u)},remove(e,t,n){const i=this._indices,r=this.value,o=r.curr(),a=r.prev(),s=r.all(),l={},u=n.rem,c=t.rem;let f,d,h,p;for(f=0,d=c.length;f<d;++f)h=c[f]._index,l[h]=1,a[h]=p=o[h],o[h]=s,p!==s&&u.push(h);for(h in i)i[h].remove(d,l);return this.reindex(t,d,l),l},reindex(e,t,n){const i=this._indices,r=this.value;e.runAfter((()=>{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,l,u=0;for(n.filters=0,l=0;l<a;++l)e.modified("query",l)&&(s=l,++u);if(1===u)u=i[s].one,this.incrementOne(i[s],r[s],n.add,n.rem);else for(l=0,u=0;l<a;++l)e.modified("query",l)&&(u|=i[l].one,this.incrementAll(i[l],r[l],o,n.add),n.rem=n.add);return u},incrementAll(e,t,n,i){const r=this.value,o=r.seen(),a=r.curr(),s=r.prev(),l=e.index(),u=e.bisect(e.range),c=e.bisect(t),f=c[0],d=c[1],h=u[0],p=u[1],m=e.one;let g,y,v;if(f<h)for(g=f,y=Math.min(h,d);g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(f>h)for(g=h,y=Math.min(f,p);g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;if(d>p)for(g=Math.max(f,p),y=d;g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(d<p)for(g=Math.max(h,d),y=p;g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;e.range=t.slice()},incrementOne(e,t,n,i){const r=this.value.curr(),o=e.index(),a=e.bisect(e.range),s=e.bisect(t),l=s[0],u=s[1],c=a[0],f=a[1],d=e.one;let h,p,m;if(l<c)for(h=l,p=Math.min(c,u);h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(l>c)for(h=c,p=Math.min(l,f);h<p;++h)m=o[h],r[m]^=d,i.push(m);if(u>f)for(h=Math.max(l,f),p=u;h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(u<f)for(h=Math.max(c,u),p=f;h<p;++h)m=o[h],r[m]^=d,i.push(m);e.range=t.slice()}}),FM.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},ft(FM,ps,{transform(e,t){const n=~(e.ignore||0),i=e.filter,r=i.mask;if(0==(r&n))return t.StopPropagation;const o=t.fork(t.ALL),a=i.data(),s=i.curr(),l=i.prev(),u=e=>s[e]&n?null:a[e];return o.filter(o.MOD,u),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^l[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return!t||t^t^l[e]&n?null:a[e]}))):(o.filter(o.ADD,u),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>u(e._index)))}});const OM="Literal",NM="CallExpression";function TM(e){this.type=e}var zM,RM,PM,LM,BM;TM.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case"ArrayExpression":return e.elements;case"BinaryExpression":case"LogicalExpression":return[e.left,e.right];case NM:return[e.callee].concat(e.arguments);case"ConditionalExpression":return[e.test,e.consequent,e.alternate];case"MemberExpression":return[e.object,e.property];case"ObjectExpression":return e.properties;case"Property":return[e.key,e.value];case"UnaryExpression":return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};var jM=1,IM=2,UM=3,qM=4,WM=5,HM=6,GM=7,YM=8;(zM={})[jM]="Boolean",zM[IM]="<end>",zM[UM]="Identifier",zM[qM]="Keyword",zM[WM]="Null",zM[HM]="Numeric",zM[GM]="Punctuator",zM[YM]="String",zM[9]="RegularExpression";var VM="ArrayExpression",XM="BinaryExpression",JM="CallExpression",QM="ConditionalExpression",ZM="Identifier",KM="Literal",eC="LogicalExpression",tC="MemberExpression",nC="ObjectExpression",iC="Property",rC="UnaryExpression",oC="Unexpected token %0",aC="Unexpected number",sC="Unexpected string",lC="Unexpected identifier",uC="Unexpected reserved word",cC="Unexpected end of input",fC="Invalid regular expression",dC="Invalid regular expression: missing /",hC="Octal literals are not allowed in strict mode.",pC="Duplicate data property in object literal not allowed in strict mode",mC="ILLEGAL",gC="Disabled.",yC=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]"),vC=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 bC(e,t){if(!e)throw new Error("ASSERT: "+t)}function xC(e){return e>=48&&e<=57}function _C(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function wC(e){return"01234567".indexOf(e)>=0}function kC(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].indexOf(e)>=0}function EC(e){return 10===e||13===e||8232===e||8233===e}function $C(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&yC.test(String.fromCharCode(e))}function AC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&vC.test(String.fromCharCode(e))}const DC={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 SC(){for(;PM<LM;){const e=RM.charCodeAt(PM);if(!kC(e)&&!EC(e))break;++PM}}function MC(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)PM<LM&&_C(RM[PM])?(i=RM[PM++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):qC({},oC,mC);return String.fromCharCode(r)}function CC(){var e,t,n,i;for(t=0,"}"===(e=RM[PM])&&qC({},oC,mC);PM<LM&&_C(e=RM[PM++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&qC({},oC,mC),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function FC(){var e,t;for(e=RM.charCodeAt(PM++),t=String.fromCharCode(e),92===e&&(117!==RM.charCodeAt(PM)&&qC({},oC,mC),++PM,(e=MC("u"))&&"\\"!==e&&$C(e.charCodeAt(0))||qC({},oC,mC),t=e);PM<LM&&AC(e=RM.charCodeAt(PM));)++PM,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==RM.charCodeAt(PM)&&qC({},oC,mC),++PM,(e=MC("u"))&&"\\"!==e&&AC(e.charCodeAt(0))||qC({},oC,mC),t+=e);return t}function OC(){var e,t,n,i,r=PM,o=RM.charCodeAt(PM),a=RM[PM];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++PM,{type:GM,value:String.fromCharCode(o),start:r,end:PM};default:if(61===(e=RM.charCodeAt(PM+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return PM+=2,{type:GM,value:String.fromCharCode(o)+String.fromCharCode(e),start:r,end:PM};case 33:case 61:return PM+=2,61===RM.charCodeAt(PM)&&++PM,{type:GM,value:RM.slice(r,PM),start:r,end:PM}}}return">>>="===(i=RM.substr(PM,4))?{type:GM,value:i,start:r,end:PM+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:GM,value:n,start:r,end:PM+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:GM,value:t,start:r,end:PM+=2}:("//"===t&&qC({},oC,mC),"<>=!+-*%&|^/".indexOf(a)>=0?(++PM,{type:GM,value:a,start:r,end:PM}):void qC({},oC,mC))}function NC(){var e,t,n;if(bC(xC((n=RM[PM]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=PM,e="","."!==n){if(e=RM[PM++],n=RM[PM],"0"===e){if("x"===n||"X"===n)return++PM,function(e){let t="";for(;PM<LM&&_C(RM[PM]);)t+=RM[PM++];return 0===t.length&&qC({},oC,mC),$C(RM.charCodeAt(PM))&&qC({},oC,mC),{type:HM,value:parseInt("0x"+t,16),start:e,end:PM}}(t);if(wC(n))return function(e){let t="0"+RM[PM++];for(;PM<LM&&wC(RM[PM]);)t+=RM[PM++];return($C(RM.charCodeAt(PM))||xC(RM.charCodeAt(PM)))&&qC({},oC,mC),{type:HM,value:parseInt(t,8),octal:!0,start:e,end:PM}}(t);n&&xC(n.charCodeAt(0))&&qC({},oC,mC)}for(;xC(RM.charCodeAt(PM));)e+=RM[PM++];n=RM[PM]}if("."===n){for(e+=RM[PM++];xC(RM.charCodeAt(PM));)e+=RM[PM++];n=RM[PM]}if("e"===n||"E"===n)if(e+=RM[PM++],"+"!==(n=RM[PM])&&"-"!==n||(e+=RM[PM++]),xC(RM.charCodeAt(PM)))for(;xC(RM.charCodeAt(PM));)e+=RM[PM++];else qC({},oC,mC);return $C(RM.charCodeAt(PM))&&qC({},oC,mC),{type:HM,value:parseFloat(e),start:t,end:PM}}function TC(){if(SC(),PM>=LM)return{type:IM,start:PM,end:PM};const e=RM.charCodeAt(PM);return $C(e)?function(){var e,t;return e=PM,t=92===RM.charCodeAt(PM)?FC():function(){var e,t;for(e=PM++;PM<LM;){if(92===(t=RM.charCodeAt(PM)))return PM=e,FC();if(!AC(t))break;++PM}return RM.slice(e,PM)}(),{type:1===t.length?UM:DC.hasOwnProperty(t)?qM:"null"===t?WM:"true"===t||"false"===t?jM:UM,value:t,start:e,end:PM}}():40===e||41===e||59===e?OC():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(bC("'"===(e=RM[PM])||'"'===e,"String literal must starts with a quote"),t=PM,++PM;PM<LM;){if((n=RM[PM++])===e){e="";break}if("\\"===n)if((n=RM[PM++])&&EC(n.charCodeAt(0)))"\r"===n&&"\n"===RM[PM]&&++PM;else switch(n){case"u":case"x":"{"===RM[PM]?(++PM,r+=CC()):r+=MC(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:wC(n)?(0!==(i="01234567".indexOf(n))&&(o=!0),PM<LM&&wC(RM[PM])&&(o=!0,i=8*i+"01234567".indexOf(RM[PM++]),"0123".indexOf(n)>=0&&PM<LM&&wC(RM[PM])&&(i=8*i+"01234567".indexOf(RM[PM++]))),r+=String.fromCharCode(i)):r+=n}else{if(EC(n.charCodeAt(0)))break;r+=n}}return""!==e&&qC({},oC,mC),{type:YM,value:r,octal:o,start:t,end:PM}}():46===e?xC(RM.charCodeAt(PM+1))?NC():OC():xC(e)?NC():OC()}function zC(){const e=BM;return PM=e.end,BM=TC(),PM=e.end,e}function RC(){const e=PM;BM=TC(),PM=e}function PC(e,t,n){const i=new TM("||"===e||"&&"===e?eC:XM);return i.operator=e,i.left=t,i.right=n,i}function LC(e,t){const n=new TM(JM);return n.callee=e,n.arguments=t,n}function BC(e){const t=new TM(ZM);return t.name=e,t}function jC(e){const t=new TM(KM);return t.value=e.value,t.raw=RM.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function IC(e,t,n){const i=new TM(tC);return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function UC(e,t,n){const i=new TM(iC);return i.key=t,i.value=n,i.kind=e,i}function qC(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((e,t)=>(bC(t<i.length,"Message reference must be in range"),i[t])));throw(n=new Error(r)).index=PM,n.description=r,n}function WC(e){e.type===IM&&qC(e,cC),e.type===HM&&qC(e,aC),e.type===YM&&qC(e,sC),e.type===UM&&qC(e,lC),e.type===qM&&qC(e,uC),qC(e,oC,e.value)}function HC(e){const t=zC();t.type===GM&&t.value===e||WC(t)}function GC(e){return BM.type===GM&&BM.value===e}function YC(e){return BM.type===qM&&BM.value===e}function VC(){PM=BM.start;const e=zC();return e.type===YM||e.type===HM?(e.octal&&qC(e,hC),jC(e)):BC(e.value)}function XC(){var e,t,n;return PM=BM.start,(e=BM).type===UM?(n=VC(),HC(":"),UC("init",n,rF())):e.type!==IM&&e.type!==GM?(t=VC(),HC(":"),UC("init",t,rF())):void WC(e)}const JC={if:1};function QC(){var e,t,n;if(GC("("))return function(){HC("(");const e=oF();return HC(")"),e}();if(GC("["))return function(){const e=[];for(PM=BM.start,HC("[");!GC("]");)GC(",")?(zC(),e.push(null)):(e.push(rF()),GC("]")||HC(","));return zC(),function(e){const t=new TM(VM);return t.elements=e,t}(e)}();if(GC("{"))return function(){var e,t,n=[],i={},r=String;for(PM=BM.start,HC("{");!GC("}");)t="$"+((e=XC()).key.type===ZM?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?qC({},pC):i[t]=!0,n.push(e),GC("}")||HC(",");return HC("}"),function(e){const t=new TM(nC);return t.properties=e,t}(n)}();if(e=BM.type,PM=BM.start,e===UM||JC[BM.value])n=BC(zC().value);else if(e===YM||e===HM)BM.octal&&qC(BM,hC),n=jC(zC());else{if(e===qM)throw new Error(gC);e===jM?((t=zC()).value="true"===t.value,n=jC(t)):e===WM?((t=zC()).value=null,n=jC(t)):GC("/")||GC("/=")?(n=jC(function(){var e,t,n,i;return BM=null,SC(),e=PM,t=function(){var e,t,n,i;for(bC("/"===(e=RM[PM]),"Regular expression literal must start with a slash"),t=RM[PM++],n=!1,i=!1;PM<LM;)if(t+=e=RM[PM++],"\\"===e)EC((e=RM[PM++]).charCodeAt(0))&&qC({},dC),t+=e;else if(EC(e.charCodeAt(0)))qC({},dC);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||qC({},dC),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";PM<LM&&AC((e=RM[PM]).charCodeAt(0));)++PM,"\\"===e&&PM<LM?qC({},oC,mC):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&qC({},fC,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";qC({},fC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){qC({},fC)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:PM}}()),RC()):WC(zC())}return n}function ZC(){const e=[];if(HC("("),!GC(")"))for(;PM<LM&&(e.push(rF()),!GC(")"));)HC(",");return HC(")"),e}function KC(){PM=BM.start;const e=zC();return function(e){return e.type===UM||e.type===qM||e.type===jM||e.type===WM}(e)||WC(e),BC(e.value)}function eF(){HC("[");const e=oF();return HC("]"),e}function tF(){const e=function(){var e;for(e=QC();;)if(GC("."))HC("."),e=IC(".",e,KC());else if(GC("("))e=LC(e,ZC());else{if(!GC("["))break;e=IC("[",e,eF())}return e}();if(BM.type===GM&&(GC("++")||GC("--")))throw new Error(gC);return e}function nF(){var e,t;if(BM.type!==GM&&BM.type!==qM)t=tF();else{if(GC("++")||GC("--"))throw new Error(gC);if(GC("+")||GC("-")||GC("~")||GC("!"))e=zC(),t=nF(),t=function(e,t){const n=new TM(rC);return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(YC("delete")||YC("void")||YC("typeof"))throw new Error(gC);t=tF()}}return t}function iF(e){let t=0;if(e.type!==GM&&e.type!==qM)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":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 rF(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,l,u;if(e=BM,l=nF(),0===(r=iF(i=BM)))return l;for(i.prec=r,zC(),t=[e,BM],o=[l,i,a=nF()];(r=iF(BM))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,l=o.pop(),t.pop(),n=PC(s,l,a),o.push(n);(i=zC()).prec=r,o.push(i),t.push(BM),n=nF(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=PC(o[u-1].value,o[u-2],n),u-=2;return n}(),GC("?")&&(zC(),t=rF(),HC(":"),e=function(e,t,n){const i=new TM(QM);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,rF())),e}function oF(){const e=rF();if(GC(","))throw new Error(gC);return e}function aF(e){PM=0,LM=(RM=e).length,BM=null,RC();const t=oF();if(BM.type!==IM)throw new Error("Unexpect token after expression.");return t}var sF={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 lF(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&&oe("Missing arguments to clamp function."),t.length>3&&oe("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),regexp:r,test:t("test",r),if:function(t){t.length<3&&oe("Missing arguments to if function."),t.length>3&&oe("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function uF(e){const t=(e=e||{}).allowed?Ot(e.allowed):{},n=e.forbidden?Ot(e.forbidden):{},i=e.constants||sF,r=(e.functions||lF)(f),o=e.globalvar,a=e.fieldvar,s=Ve(o)?o:e=>`${o}["${e}"]`;let l={},u={},c=0;function f(e){if(vt(e))return e;const t=d[e.type];return null==t&&oe("Unsupported type: "+e.type),t(e)}const d={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return c>0?r:st(n,r)?oe("Illegal identifier: "+r):st(i,r)?i[r]:st(t,r)?r:(l[r]=1,s(r))},MemberExpression:e=>{const t=!e.computed,n=f(e.object);t&&(c+=1);const i=f(e.property);return n===a&&(u[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&&(c-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&oe("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=st(r,t)&&r[t];return i||oe("Unrecognized function: "+t),Ve(i)?i(n):i+"("+n.map(f).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(f).join(",")+"]",BinaryExpression:e=>"("+f(e.left)+" "+e.operator+" "+f(e.right)+")",UnaryExpression:e=>"("+e.operator+f(e.argument)+")",ConditionalExpression:e=>"("+f(e.test)+"?"+f(e.consequent)+":"+f(e.alternate)+")",LogicalExpression:e=>"("+f(e.left)+e.operator+f(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(f).join(",")+"}",Property:e=>{c+=1;const t=f(e.key);return c-=1,t+":"+f(e.value)}};function h(e){const t={code:f(e),globals:Object.keys(l),fields:Object.keys(u)};return l={},u={},t}return h.functions=r,h.constants=i,h}var cF,fF,dF,hF,pF,mF,gF,yF,vF,bF,xF,_F,wF,kF,EF,$F,AF=new cw,DF=new cw,SF={point:Tw,lineStart:Tw,lineEnd:Tw,polygonStart:function(){AF=new cw,SF.lineStart=MF,SF.lineEnd=CF},polygonEnd:function(){var e=+AF;DF.add(e<0?gw+e:e),this.lineStart=this.lineEnd=this.point=Tw},sphere:function(){DF.add(gw)}};function MF(){SF.point=FF}function CF(){OF(cF,fF)}function FF(e,t){SF.point=OF,cF=e,fF=t,dF=e*=vw,hF=ww(t=(t*=vw)/2+mw),pF=Sw(t)}function OF(e,t){var n=(e*=vw)-dF,i=n>=0?1:-1,r=i*n,o=ww(t=(t*=vw)/2+mw),a=Sw(t),s=pF*a,l=hF*o+s*ww(r),u=s*i*Sw(r);AF.add(_w(u,l)),dF=e,hF=o,pF=a}var NF,TF,zF,RF,PF,LF,BF,jF,IF,UF,qF,WF,HF,GF,YF,VF,XF={point:JF,lineStart:ZF,lineEnd:KF,polygonStart:function(){XF.point=eO,XF.lineStart=tO,XF.lineEnd=nO,kF=new cw,SF.polygonStart()},polygonEnd:function(){SF.polygonEnd(),XF.point=JF,XF.lineStart=ZF,XF.lineEnd=KF,AF<0?(mF=-(yF=180),gF=-(vF=90)):kF>fw?vF=90:kF<-fw&&(gF=-90),$F[0]=mF,$F[1]=yF},sphere:function(){mF=-(yF=180),gF=-(vF=90)}};function JF(e,t){EF.push($F=[mF=e,yF=e]),t<gF&&(gF=t),t>vF&&(vF=t)}function QF(e,t){var n=Yk([e*vw,t*vw]);if(wF){var i=Xk(wF,n),r=Xk([i[1],-i[0],0],i);Zk(r),r=Gk(r);var o,a=e-bF,s=a>0?1:-1,l=r[0]*yw*s,u=bw(a)>180;u^(s*bF<l&&l<s*e)?(o=r[1]*yw)>vF&&(vF=o):u^(s*bF<(l=(l+360)%360-180)&&l<s*e)?(o=-r[1]*yw)<gF&&(gF=o):(t<gF&&(gF=t),t>vF&&(vF=t)),u?e<bF?iO(mF,e)>iO(mF,yF)&&(yF=e):iO(e,yF)>iO(mF,yF)&&(mF=e):yF>=mF?(e<mF&&(mF=e),e>yF&&(yF=e)):e>bF?iO(mF,e)>iO(mF,yF)&&(yF=e):iO(e,yF)>iO(mF,yF)&&(mF=e)}else EF.push($F=[mF=e,yF=e]);t<gF&&(gF=t),t>vF&&(vF=t),wF=n,bF=e}function ZF(){XF.point=QF}function KF(){$F[0]=mF,$F[1]=yF,XF.point=JF,wF=null}function eO(e,t){if(wF){var n=e-bF;kF.add(bw(n)>180?n+(n>0?360:-360):n)}else xF=e,_F=t;SF.point(e,t),QF(e,t)}function tO(){SF.lineStart()}function nO(){eO(xF,_F),SF.lineEnd(),bw(kF)>fw&&(mF=-(yF=180)),$F[0]=mF,$F[1]=yF,wF=null}function iO(e,t){return(t-=e)<0?t+360:t}function rO(e,t){return e[0]-t[0]}function oO(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var aO={sphere:Tw,point:sO,lineStart:uO,lineEnd:dO,polygonStart:function(){aO.lineStart=hO,aO.lineEnd=pO},polygonEnd:function(){aO.lineStart=uO,aO.lineEnd=dO}};function sO(e,t){e*=vw;var n=ww(t*=vw);lO(n*ww(e),n*Sw(e),Sw(t))}function lO(e,t,n){++NF,zF+=(e-zF)/NF,RF+=(t-RF)/NF,PF+=(n-PF)/NF}function uO(){aO.point=cO}function cO(e,t){e*=vw;var n=ww(t*=vw);GF=n*ww(e),YF=n*Sw(e),VF=Sw(t),aO.point=fO,lO(GF,YF,VF)}function fO(e,t){e*=vw;var n=ww(t*=vw),i=n*ww(e),r=n*Sw(e),o=Sw(t),a=_w(Cw((a=YF*o-VF*r)*a+(a=VF*i-GF*o)*a+(a=GF*r-YF*i)*a),GF*i+YF*r+VF*o);TF+=a,LF+=a*(GF+(GF=i)),BF+=a*(YF+(YF=r)),jF+=a*(VF+(VF=o)),lO(GF,YF,VF)}function dO(){aO.point=sO}function hO(){aO.point=mO}function pO(){gO(WF,HF),aO.point=sO}function mO(e,t){WF=e,HF=t,e*=vw,t*=vw,aO.point=gO;var n=ww(t);GF=n*ww(e),YF=n*Sw(e),VF=Sw(t),lO(GF,YF,VF)}function gO(e,t){e*=vw;var n=ww(t*=vw),i=n*ww(e),r=n*Sw(e),o=Sw(t),a=YF*o-VF*r,s=VF*i-GF*o,l=GF*r-YF*i,u=$w(a,s,l),c=Nw(u),f=u&&-c/u;IF.add(f*a),UF.add(f*s),qF.add(f*l),TF+=c,LF+=c*(GF+(GF=i)),BF+=c*(YF+(YF=r)),jF+=c*(VF+(VF=o)),lO(GF,YF,VF)}function yO(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vO(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function bO(){return 0}function xO(e){return e instanceof hh?e:new hh(e)}const _O="intersect",wO="union",kO="_vgsid_",EO=se(kO),$O="index:unit";function AO(e,t){for(var n,i,r=t.fields,o=t.values,a=r.length,s=0;s<a;++s)if((i=r[s]).getter=se.getter||se(i.field),pt(n=i.getter(e))&&(n=Se(n)),pt(o[s])&&(o[s]=Se(o[s])),pt(o[s][0])&&(o[s]=o[s].map(Se)),"E"===i.type){if(_e(o[s])?o[s].indexOf(n)<0:n!==o[s])return!1}else if("R"===i.type){if(!dt(n,o[s]))return!1}else if("R-RE"===i.type){if(!dt(n,o[s],!0,!1))return!1}else if("R-E"===i.type){if(!dt(n,o[s],!1,!1))return!1}else if("R-LE"===i.type&&!dt(n,o[s],!1,!0))return!1;return!0}const DO=function(e){let t,n,i;function r(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<0?r=t+1:o=t}while(r<o)}return r}return 2!==e.length?(t=yO,n=(t,n)=>yO(e(t),n),i=(t,n)=>e(t)-n):(t=e===yO||e===vO?e:bO,n=e,i=e),{left:r,center:function(e,t,n=0,o=e.length){const a=r(e,t,n,o-1);return a>n&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,r=0,o=e.length){if(r<o){if(0!==t(i,i))return o;do{const t=r+o>>>1;n(e[t],i)<=0?r=t+1:o=t}while(r<o)}return r}}}(EO),SO=DO.left,MO=DO.right;var CO={[`${kO}_union`]:function(...e){const t=new hh;for(const n of e)for(const e of n)t.add(e);return t},[`${kO}_intersect`]:function(e,...t){e=new hh(e),t=t.map(xO);e:for(const n of e)for(const i of t)if(!i.has(n)){e.delete(n);continue e}return e},E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;n<i;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((e=>t.indexOf(e)>=0)):t},R_union:function(e,t){var n=Se(t[0]),i=Se(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<i&&(e[1]=i),e):[n,i]},R_intersect:function(e,t){var n=Se(t[0]),i=Se(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?i<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>i&&(e[1]=i),e):[n,i]}};function FO(e,t,n,i){t[0].type!==OM&&oe("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&De(t).value)!==_O||st(i,a)||(i[a]=n.getData(r).indataRef(n,o)),st(i,s)||(i[s]=n.getData(r).tuplesRef())}function OO(e){const t=this.context.data[e];return t?t.values.value:[]}const NO=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},TO=NO("format"),zO=NO("timeFormat"),RO=NO("utcFormat"),PO=NO("timeParse"),LO=NO("utcParse"),BO=new Date(2e3,0,1);function jO(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(BO.setYear(2e3),BO.setMonth(e),BO.setDate(t),zO.call(this,BO,n)):""}const IO="%",UO="$";function qO(e,t,n,i){t[0].type!==OM&&oe("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!st(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(e){}}function WO(e,t,n,i){if(t[0].type===OM)HO(n,i,t[0].value);else for(e in n.scales)HO(n,i,e)}function HO(e,t,n){const i=IO+n;if(!st(t,i))try{t[i]=e.scaleRef(n)}catch(e){}}function GO(e,t){if(Ve(e))return e;if(vt(e)){const i=t.scales[e];return i&&((n=i.value)&&!0===n[Wp])?i.value:void 0}var n}function YO(e,t){return function(n,i,r){if(n){const t=GO(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const VO=YO("area",(function(e){return DF=new cw,uw(e,SF),2*DF})),XO=YO("bounds",(function(e){var t,n,i,r,o,a,s;if(vF=yF=-(mF=gF=1/0),EF=[],uw(e,XF),n=EF.length){for(EF.sort(rO),t=1,o=[i=EF[0]];t<n;++t)oO(i,(r=EF[t])[0])||oO(i,r[1])?(iO(i[0],r[1])>iO(i[0],i[1])&&(i[1]=r[1]),iO(r[0],i[1])>iO(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=iO(i[1],r[0]))>a&&(a=s,mF=r[0],yF=i[1])}return EF=$F=null,mF===1/0||gF===1/0?[[NaN,NaN],[NaN,NaN]]:[[mF,gF],[yF,vF]]})),JO=YO("centroid",(function(e){NF=TF=zF=RF=PF=LF=BF=jF=0,IF=new cw,UF=new cw,qF=new cw,uw(e,aO);var t=+IF,n=+UF,i=+qF,r=$w(t,n,i);return r<dw&&(t=LF,n=BF,i=jF,TF<fw&&(t=zF,n=RF,i=PF),(r=$w(t,n,i))<dw)?[NaN,NaN]:[_w(n,t)*yw,Nw(i/r)*yw]}));function QO(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(t){e.warn(t)}return n[n.length-1]}function ZO(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function KO(e){const t=Bf(e);return.2126*ZO(t.r)+.7152*ZO(t.g)+.0722*ZO(t.b)}function eN(e,t){return e===t||e!=e&&t!=t||(_e(e)?!(!_e(t)||e.length!==t.length)&&function(e,t){for(let n=0,i=e.length;n<i;++n)if(!eN(e[n],t[n]))return!1;return!0}(e,t):!(!we(e)||!we(t))&&tN(e,t))}function tN(e,t){for(const n in e)if(!eN(e[n],t[n]))return!1;return!0}function nN(e){return t=>tN(e,t)}const iN={};function rN(e){return _e(e)||ArrayBuffer.isView(e)?e:null}function oN(e){return rN(e)||(vt(e)?e:null)}const aN=e=>e.data;function sN(e,t){const n=OO.call(t,e);return n.root&&n.root.lookup||{}}const lN=()=>"undefined"!=typeof window&&window||null;function uN(e,t,n){if(!e)return[];const[i,r]=e,o=(new Ng).set(i[0],i[1],r[0],r[1]);return ux(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=Ge(e.marktype),i=Ge(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const cN={random:()=>Os(),cumulativeNormal:qs,cumulativeLogNormal:Xs,cumulativeUniform:tl,densityNormal:Us,densityLogNormal:Vs,densityUniform:el,quantileNormal:Ws,quantileLogNormal:Js,quantileUniform:nl,sampleNormal:Is,sampleLogNormal:Ys,sampleUniform:Ks,isArray:_e,isBoolean:ht,isDate:pt,isDefined:e=>void 0!==e,isNumber:gt,isObject:we,isRegExp:yt,isString:vt,isTuple:za,isValid:e=>null!=e&&e==e,toBoolean:St,toDate:e=>Ct(e),toNumber:Se,toString:Ft,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return oN(e).indexOf(...n)},join:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return rN(e).join(...n)},lastindexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return oN(e).lastIndexOf(...n)},replace:function(e,t,n){return Ve(n)&&oe("Function argument passed to replace."),String(e).replace(t,n)},reverse:function(e){return rN(e).slice().reverse()},slice:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return oN(e).slice(...n)},flush:ct,lerp:xt,merge:function(){const e=[].slice.call(arguments);return e.unshift({}),it(...e)},pad:$t,peek:De,pluck:function(e,t){const n=iN[t]||(iN[t]=se(t));return _e(e)?e.map(n):n(e)},span:At,inrange:dt,truncate:Nt,rgb:Bf,lab:Wh,hcl:Jh,hsl:Vf,luminance:KO,contrast:function(e,t){const n=KO(e),i=KO(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)},sequence:El,format:TO,utcFormat:RO,utcParse:LO,utcOffset:tr,utcSequence:rr,timeFormat:zO,timeParse:PO,timeOffset:er,timeSequence:ir,timeUnitSpecifier:Ai,monthFormat:function(e){return jO.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return jO.call(this,e,1,"%b")},dayFormat:function(e){return jO.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return jO.call(this,0,2+e,"%a")},quarter:We,utcquarter:He,week:Ci,utcweek:Ri,dayofyear:Mi,utcdayofyear:zi,warn:function(){return QO(this.context.dataflow,"warn",arguments)},info:function(){return QO(this.context.dataflow,"info",arguments)},debug:function(){return QO(this.context.dataflow,"debug",arguments)},extent:e=>rt(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:uN,clampRange:Ye,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=lN();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=lN();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return yp(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(de).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?ng(n,t=t||Hm(e)):e}},panLinear:ze,panLog:Re,panPow:Pe,panSymlog:Le,zoomLinear:je,zoomLog:Ie,zoomPow:Ue,zoomSymlog:qe,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],l=s.input,u=a.stamp();let c,f,d=s.changes;if(!1===a._trigger||!(l.value.length||t||i))return 0;if((!d||d.stamp<u)&&(s.changes=d=a.changeset(),d.stamp=u,a.runAfter((()=>{s.modified=!0,a.pulse(l,d).run()}),!0,1)),n&&(c=!0===n?de:_e(n)||za(n)?n:nN(n),d.remove(c)),t&&d.insert(t),i&&(c=nN(i),l.value.some(c)?d.remove(c):d.insert(i)),r)for(f in o)d.modify(r,f,o[f]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=Ge(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 Ge(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 Ng).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[e,n]of t)e<a.x1&&(a.x1=e),e>a.x2&&(a.x2=e),n<a.y1&&(a.y1=n),n>a.y2&&(a.y2=n);return a.translate(i,r),uN([[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;r<n.length;o=r++){const[a,s]=n[o],[l,u]=n[r];u>t!=s>t&&e<(a-l)*(t-u)/(s-u)+l&&i++}return 1&i}(e.x,e.y,t)))}},fN=["view","item","group","xy","x","y"],dN="this.",hN={},pN={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${Dt(UO+e)}]`,functions:function(e){const t=lF(e);fN.forEach((e=>t[e]="event.vega."+e));for(const e in cN)t[e]=dN+e;return it(t,function(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=WO,n._range=WO,n._scale=WO;const i=t=>"_["+(t.type===OM?Dt(IO+t.value):Dt(IO)+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}(e,cN,hN)),t},constants:sF,visitors:hN},mN=uF(pN);function gN(e,t,n){return 1===arguments.length?cN[e]:(cN[e]=t,n&&(hN[e]=n),mN&&(mN.functions[e]=dN+e),this)}function yN(e,t){const n={};let i;try{i=aF(e=vt(e)?e:Dt(e)+"")}catch(t){oe("Expression parse error: "+e)}i.visit((e=>{if(e.type!==NM)return;const i=e.callee.name,r=pN.visitors[i];r&&r(i,e.arguments,t,n)}));const r=mN(i);return r.globals.forEach((e=>{const i=UO+e;!st(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:it({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}gN("bandwidth",(function(e,t){const n=GO(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),WO),gN("copy",(function(e,t){const n=GO(e,(t||this).context);return n?n.copy():void 0}),WO),gN("domain",(function(e,t){const n=GO(e,(t||this).context);return n?n.domain():[]}),WO),gN("range",(function(e,t){const n=GO(e,(t||this).context);return n&&n.range?n.range():[]}),WO),gN("invert",(function(e,t,n){const i=GO(e,(n||this).context);return i?_e(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),WO),gN("scale",(function(e,t,n){const i=GO(e,(n||this).context);return i?i(t):void 0}),WO),gN("gradient",(function(e,t,n,i,r){e=GO(e,(r||this).context);const o=Pm(t,n);let a=e.domain(),s=a[0],l=De(a),u=ue;return l-s?u=om(e,s,l):e=(e.interpolator?Gp("sequential")().interpolator(e.interpolator()):Gp("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,l=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),l!==De(a)&&a.push(l)),a.forEach((t=>o.stop(u(t),e(t)))),o}),WO),gN("geoArea",VO,WO),gN("geoBounds",XO,WO),gN("geoCentroid",JO,WO),gN("geoShape",(function(e,t,n){const i=GO(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),WO),gN("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!==OM&&oe("First argument to indata must be a string literal."),t[1].type!==OM&&oe("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;st(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),gN("data",OO,qO),gN("treePath",(function(e,t,n){const i=sN(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(aN):void 0}),qO),gN("treeAncestors",(function(e,t){const n=sN(e,this)[t];return n?n.ancestors().map(aN):void 0}),qO),gN("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,l=this.context.data[e],u=l?l.values.value:[],c=l?l[$O]&&l[$O].value:void 0,f=n===_O,d=u.length,h=0;h<d;++h)if(i=u[h],c&&f){if(-1===(o=(r=r||{})[a=i.unit]||0))continue;if(s=AO(t,i),r[a]=s?-1:++o,s&&1===c.size)return!0;if(!s&&o===c.get(a).count)return!1}else if(f^(s=AO(t,i)))return s;return d&&f}),FO),gN("vlSelectionIdTest",(function(e,t,n){const i=this.context.data[e],r=i?i.values.value:[],o=i?i[$O]&&i[$O].value:void 0,a=n===_O,s=EO(t),l=SO(r,s);if(l===r.length)return!1;if(EO(r[l])!==s)return!1;if(o&&a){if(1===o.size)return!0;if(MO(r,s)-l<o.size)return!1}return!0}),FO),gN("vlSelectionResolve",(function(e,t,n,i){for(var r,o,a,s,l,u,c,f,d,h,p,m,g=this.context.data[e],y=g?g.values.value:[],v={},b={},x={},_=y.length,w=0;w<_;++w)if(s=(r=y[w]).unit,o=r.fields,a=r.values,o&&a){for(p=0,m=o.length;p<m;++p)l=o[p],f=(c=v[l.field]||(v[l.field]={}))[s]||(c[s]=[]),x[l.field]=d=l.type.charAt(0),h=CO[`${d}_union`],c[s]=h(f,Ge(a[p]));n&&(f=b[s]||(b[s]=[])).push(Ge(a).reduce(((e,t,n)=>(e[o[n].field]=t,e)),{}))}else l=kO,u=EO(r),(f=(c=v[l]||(v[l]={}))[s]||(c[s]=[])).push(u),n&&(f=b[s]||(b[s]=[])).push({[kO]:u});return t=t||wO,v[kO]?v[kO]=CO[`${kO}_${t}`](...Object.values(v[kO])):Object.keys(v).forEach((e=>{v[e]=Object.keys(v[e]).map((t=>v[e][t])).reduce(((n,i)=>void 0===n?i:CO[`${x[e]}_${t}`](n,i)))})),y=Object.keys(b),n&&y.length&&(v[i?"vlPoint":"vlMulti"]=t===wO?{or:y.reduce(((e,t)=>(e.push(...b[t]),e)),[])}:{and:y.map((e=>({or:b[e]})))}),v}),FO),gN("vlSelectionTuples",(function(e,t){return e.map((e=>it(t.fields?{values:t.fields.map((t=>(t.getter||(t.getter=se(t.field)))(e.datum)))}:{[kO]:EO(e.datum)},t)))}));const vN=Ot(["rule"]),bN=Ot(["group","image","rect"]);function xN(e){return(e+"").toLowerCase()}function _N(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var wN={operator:(e,t)=>_N(e,["_"],t.code),parameter:(e,t)=>_N(e,["datum","_"],t.code),event:(e,t)=>_N(e,["event"],t.code),handler:(e,t)=>_N(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 e in i){const t="o["+Dt(e)+"]";r+=`$=${i[e].code};if(${t}!==$)${t}=$,m=1;`}return r+=function(e,t){let n="";return vN[t]||(e.x2&&(e.x?(bN[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?(bN[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;",_N(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(Dt).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 kN(e,t,n){if(!e||!we(e))return e;for(let i,r=0,o=EN.length;r<o;++r)if(i=EN[r],st(e,i.key))return i.parse(e,t,n);return e}var EN=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||oe("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,t){const n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=bt(e.$key,e.$flat,t.expr.codegen))}},{key:"$expr",parse:function(e,t,n){e.$params&&t.parseParameters(e.$params,n);const i="e:"+e.$expr.code;return t.fn[i]||(t.fn[i]=K(t.parameterExpression(e.$expr),e.$fields))}},{key:"$field",parse:function(e,t){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=se(e.$field,e.$name,t.expr.codegen))}},{key:"$encode",parse:function(e,t){const n=e.$encode,i={};for(const e in n){const r=n[e];i[e]=K(t.encodeExpression(r.$expr),r.$fields),i[e].output=r.$output}return i}},{key:"$compare",parse:function(e,t){const n="c:"+e.$compare+"_"+e.$order,i=Ge(e.$compare).map((e=>e&&e.$tupleid?Ra:e));return t.fn[n]||(t.fn[n]=Je(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 Ra}}];const $N={skip:!0};function AN(e,t,n,i){return new DN(e,t,n,i)}function DN(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||wN,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function SN(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 MN(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}DN.prototype=SN.prototype={fork(){const e=new SN(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"===xN(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 i in e.data){const r=n.data[i]||(n.data[i]={});e.data[i].forEach((e=>r[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[xN(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"!==xN(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||oe("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]=_e(r)?r.map((e=>kN(e,n,t))):kN(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&&oe("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=we(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||oe("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],$N)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(de).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const CN="default";function FN(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 ON(e,t){var n=e._runtime.data;return st(n,t)||oe("Unrecognized data set: "+t),n[t]}function NN(e,t){qa(t)||oe("Second argument to changes must be a changeset.");const n=ON(this,e);return n.modified=!0,this.pulse(n.input,t)}function TN(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function zN(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function RN(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}const PN="view",LN={trap:!1};function BN(e,t,n,i){e._eventListeners.push({type:n,sources:Ge(t),handler:i})}function jN(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||we(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function IN(e){return e.item}function UN(e){return e.item.mark.source}function qN(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function WN(e,t,n){const i=document.createElement(e);for(const e in t)i.setAttribute(e,t[e]);return null!=n&&(i.textContent=n),i}const HN="vega-bind-radio";function GN(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),BN(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 YN(e,t,n,i){const r=i.signal(n.signal),o=WN("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(WN("label"));a.appendChild(WN("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=VN;switch(n.input){case"checkbox":s=XN;break;case"select":s=JN;break;case"radio":s=QN;break;case"range":s=ZN}s(e,a,n,r)}function VN(e,t,n,i){const r=WN("input");for(const e in n)"signal"!==e&&"element"!==e&&r.setAttribute("input"===e?"type":e,n[e]);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 XN(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=WN("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function JN(e,t,n,i){const r=WN("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};KN(e,i)&&(n.selected=!0),r.appendChild(WN("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<i;++t)if(KN(n.options[t],e))return void(r.selectedIndex=t)}}function QN(e,t,n,i){const r=WN("span",{class:HN}),o=n.labels||[];t.appendChild(r),e.elements=n.options.map(((t,a)=>{const s={type:"radio",name:n.signal,value:t};KN(t,i)&&(s.checked=!0);const l=WN("input",s);l.addEventListener("change",(()=>e.update(t)));const u=WN("label",{},(o[a]||t)+"");return u.prepend(l),r.appendChild(u),l})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e<i;++e)KN(n[e].value,t)&&(n[e].checked=!0)}}function ZN(e,t,n,i){i=void 0!==i?i:(+n.max+ +n.min)/2;const r=null!=n.max?n.max:Math.max(100,+i)||100,o=n.min||Math.min(0,r,+i)||0,a=n.step||rn(o,r,100),s=WN("input",{type:"range",name:n.signal,min:o,max:r,step:a});s.value=i;const l=WN("span",{},+i);t.appendChild(s),t.appendChild(l);const u=()=>{l.textContent=s.value,e.update(+s.value)};s.addEventListener("input",u),s.addEventListener("change",u),e.elements=[s],e.set=e=>{s.value=e,l.textContent=e}}function KN(e,t){return e===t||e+""==t+""}function eT(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,TN(e),zN(e),RN(e),r,o).background(e.background())}function tT(e,t){return t?function(){try{t.apply(this,arguments)}catch(t){e.error(t)}}:null}function nT(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(n){t=null,e.error(n)}return t}const iT=e=>+e||0;function rT(e){return we(e)?{top:iT(e.top),bottom:iT(e.bottom),left:iT(e.left),right:iT(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(iT(e))}async function oT(e,t,n,i){const r=lx(t),o=r&&r.headless;return o||oe("Unrecognized renderer type: "+t),await e.runAsync(),eT(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var aT="width",sT="height",lT="padding",uT={skip:!0};function cT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===lT?i.left+i.right:0)}function fT(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===lT?i.top+i.bottom:0)}function dT(e,t){return t.modified&&_e(t.input.value)&&e.indexOf("_:vega:_")}function hT(e,t){return!("parent"===e||t instanceof ms.proxy)}function pT(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":_e(e)?mT(e):we(e)&&!pt(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(_e(n)?mT(n):gT(n))})).join("\n")):e+"";var t}(i))}function mT(e){return"["+e.map(gT).join(", ")+"]"}function gT(e){return _e(e)?"[…]":we(e)&&!pt(e)?"{…}":e}function yT(e,t){const n=this;if(t=t||{},ds.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=it({},e.locale,t.locale);n.locale(ta(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||ax.Canvas,n._scenegraph=new Lv;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||pT,n._redraw=!0,n._handler=(new cb).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=it({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{_e(e[t])&&(e[t]=Ot(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 AN(e,ms,cN,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:it({},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=cT(n,n._width),n._viewHeight=fT(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[aT],i=t[sT],r=t[lT];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=cT(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=fT(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:CN,item:null}));e.on(e.events("view","mousemove"),t,((e,n)=>{const i=t.value,r=i?vt(i)?i:i.user:CN,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 vt(n)||(i=n.item,n=n.user),FN(e,n&&n!==CN?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function vT(e,t){return st(e._signals,t)?e._signals[t]:oe("Unrecognized signal name: "+Dt(t))}function bT(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function xT(e,t,n,i){let r=bT(n,i);return r||(r=tT(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function _T(e,t,n){const i=bT(t,n);return i&&t._targets.remove(i),e}ft(yT,ds,{async evaluate(e,t,n){if(await ds.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=RN(i=this),o=TN(i),a=zN(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(e){i.error(e)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(e){this.error(e)}var i,r,o,a;return n&&Oa(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&&MN(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=vT(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",rT(e)):rT(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?(lx(e)||oe("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&&(ds.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(vT(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(aT,n,uT),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(sT,i,uT),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=tT(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.indexOf(e)<0&&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 xT(this,e,vT(this,e),t)},removeSignalListener(e,t){return _T(this,vT(this,e),t)},addDataListener(e,t){return xT(this,e,ON(this,e).values,t)},removeDataListener(e,t){return _T(this,ON(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=FN(this,null);this._globalCursor=!!e,t&&FN(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 EA,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?wA():+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 Za(n),a=function(n,i){r.runAsync(null,(()=>{e===PN&&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(function(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=RN(e),(i=Hv(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;vt(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:tt(e),item:tt(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}(r,n,i))}))};if("timer"===e)jN(r,"timer",t)&&r.timer(a,t);else if(e===PN)jN(r,"view",t)&&r.addEventListener(t,a,LN);else if("window"===e?jN(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&jN(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,l=i.length;s<l;++s)i[s].addEventListener(t,a);BN(r,i,t,a)}else r.warn("Can not resolve event source: "+e);return o},finalize:function(){var e,t,n,i=this._tooltip,r=this._timers,o=this._eventListeners;for(e=r.length;--e>=0;)r[e].stop();for(e=o.length;--e>=0;)for(t=(n=o[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return i&&i.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",IN),UN,qN(e)),this.on(this.events("view","mouseout",IN),UN,qN(t)),this},data:function(e,t){return arguments.length<2?ON(this,e).values.value:NN.call(this,e,Wa().remove(de).insert(t))},change:NN,insert:function(e,t){return NN.call(this,e,Wa().insert(t))},remove:function(e,t){return NN.call(this,e,Wa().remove(t))},scale:function(e){var t=this._runtime.scales;return st(t,e)||oe("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=lx(i);e=n._el=e?nT(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),MN(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||cb,s=e?o.renderer:o.headless;return n._renderer=s?eT(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),tT(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,RN(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=nT(n,t,!0):e.appendChild(WN("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=nT(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=nt(i.debounce,r.update))),(null==i.input&&i.element?GN:YN)(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!==ax.Canvas&&e!==ax.SVG&&e!==ax.PNG&&oe("Unrecognized image type: "+e);const n=await oT(this,e,t);return e===ax.SVG?function(e,t){const n=new Blob([e],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(n.svg()):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await oT(this,ax.Canvas,e,t)).canvas()},toSVG:async function(e){return(await oT(this,ax.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:dT,signals:hT,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this}});const wT="view",kT="[",ET="]",$T="{",AT="}",DT=":",ST=",",MT="@",CT=">",FT=/[[\]{}]/,OT={"*":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 NT,TT;function zT(e,t,n){return NT=t||wT,TT=n||OT,PT(e.trim()).map(LT)}function RT(e,t,n,i,r){const o=e.length;let a,s=0;for(;t<o;++t){if(a=e[t],!s&&a===n)return t;r&&r.indexOf(a)>=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function PT(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=RT(e,r,ST,kT+$T,ET+AT),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function LT(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=RT(e,i,ET,kT,ET),i===t)throw"Empty between selector: "+e;if(n=PT(e.substring(1,i)),2!==n.length)throw"Between selector must have two elements: "+e;if((e=e.slice(i+1).trim())[0]!==CT)throw"Expected '>' after between selector: "+e;n=n.map(LT);const r=LT(e.slice(1).trim());return r.between?{between:n,stream:r}:(r.between=n,r)}(e):function(e){const t={source:NT},n=[];let i,r,o=[0,0],a=0,s=0,l=e.length,u=0;if(e[l-1]===AT){if(u=e.lastIndexOf($T),!(u>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(ST);if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(u+1,l-1))}catch(t){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;if(e[0]===MT&&(a=++u),i=RT(e,u,DT),i<l&&(n.push(e.substring(s,i).trim()),s=u=++i),u=RT(e,u,kT),u===l)n.push(e.substring(s,l).trim());else if(n.push(e.substring(s,u).trim()),r=[],s=++u,s===l)throw"Unmatched left bracket: "+e;for(;u<l;){if(u=RT(e,u,ET),u===l)throw"Unmatched left bracket: "+e;if(r.push(e.substring(s,u).trim()),u<l-1&&e[++u]!==kT)throw"Expected left bracket: "+e;s=++u}if(!(l=n.length)||FT.test(n[l-1]))throw"Invalid event selector: "+e;var c;return l>1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],TT[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0],"!"===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]),t}(e)}function BT(e){return we(e)?e:{type:e||"pad"}}const jT=e=>+e||0,IT=e=>({top:e,bottom:e,left:e,right:e});function UT(e){return we(e)?e.signal?e:{top:jT(e.top),bottom:jT(e.bottom),left:jT(e.left),right:jT(e.right)}:IT(jT(e))}const qT=e=>we(e)&&!_e(e)?it({},e):{value:e};function WT(e,t,n,i){return null!=n?(we(n)&&!_e(n)||_e(n)&&n.length&&we(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function HT(e,t,n){for(const n in t)WT(e,n,t[n]);for(const t in n)WT(e,t,n[t],"update")}function GT(e,t,n){for(const i in t)n&&st(n,i)||(e[i]=it(e[i]||{},t[i]));return e}function YT(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const VT="mark",XT="frame",JT="scope",QT="axis",ZT="axis-domain",KT="axis-grid",ez="axis-label",tz="axis-tick",nz="axis-title",iz="legend",rz="legend-band",oz="legend-entry",az="legend-gradient",sz="legend-label",lz="legend-symbol",uz="legend-title",cz="title",fz="title-text",dz="title-subtitle";function hz(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const pz=e=>vt(e)?Dt(e):e.signal?`(${e.signal})`:vz(e);function mz(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:Dt(e)));for(;t.length&&null==De(t);)t.pop();return t.unshift(pz(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?gz("hcl",e.h,e.c,e.l):e.h||e.s?gz("hsl",e.h,e.s,e.l):e.l||e.a?gz("lab",e.l,e.a,e.b):e.r||e.g||e.b?gz("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?vz(e.field):void 0!==e.value?Dt(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=pz(e.scale);return 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?"":"*"+yz(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0")),t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${yz(e.exponent)})`),null!=e.mult&&(t+=`*${yz(e.mult)}`),null!=e.offset&&(t+=`+${yz(e.offset)}`),e.round&&(t=`round(${t})`),t}const gz=(e,t,n,i)=>`(${e}(${[t,n,i].map(mz).join(",")})+'')`;function yz(e){return we(e)?"("+mz(e)+")":e}function vz(e){return bz(we(e)?e:{datum:e})}function bz(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):oe("Invalid field reference: "+Dt(e));return e.signal||(i=vt(i)?ae(i).map(Dt).join("]["):bz(i)),t+"["+i+"]"}function xz(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,u,c;for(l in l="lineBreak","text"!==t||null==r[l]||YT(l,e)||hz(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===XT?r.group:n===VT?it({},r.mark,r[t]):null,c)u=YT(l,e)||("fill"===l||"stroke"===l)&&(YT("fill",e)||YT("stroke",e)),u||hz(o,l,c[l]);for(l in Ge(i).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)YT(t,e)||hz(o,t,n[t])})),e=it({},e),o)c=o[l],c.signal?(s=s||{})[l]=c:a[l]=c;return e.enter=it(a,e.enter),s&&(e.update=it(s,e.update)),e}(e,t,n,i,r.config);for(const n in e)a[n]=_z(e[n],t,o,r);return o}function _z(e,t,n,i){const r={},o={};for(const t in e)null!=e[t]&&(r[t]=wz((a=e[t],_e(a)?function(e){let t="";return e.forEach((e=>{const n=mz(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===De(t)&&(t+="null"),t}(a):mz(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function wz(e,t,n,i){const r=yN(e,t);return r.$fields.forEach((e=>i[e]=1)),it(n,r.$params),r.$expr}const kz="outer",Ez=["value","update","init","react","bind"];function $z(e,t){oe(e+' for "outer" push: '+Dt(t))}function Az(e,t){const n=e.name;if(e.push===kz)t.signals[n]||$z("No prior signal definition",n),Ez.forEach((t=>{void 0!==e[t]&&$z("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 Dz(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function Sz(e,t,n,i){return new Dz(e,t,n,i)}function Mz(e,t){return Sz("operator",e,t)}function Cz(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Fz(e,t){return t?{$field:e,$name:t}:{$field:e}}const Oz=Fz("key");function Nz(e,t){return{$compare:e,$order:t}}function Tz(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const zz="scope",Rz="view";function Pz(e){return e&&e.signal}function Lz(e){if(Pz(e))return!0;if(we(e))for(const t in e)if(Lz(e[t]))return!0;return!1}function Bz(e,t){return null!=e?e:t}function jz(e){return e&&e.signal||e}const Iz="timer";function Uz(e,t){return(e.merge?qz:e.stream?Wz:e.type?Hz:oe("Invalid stream specification: "+Dt(e)))(e,t)}function qz(e,t){const n=Gz({merge:e.merge.map((e=>Uz(e,t)))},e,t);return t.addStream(n).id}function Wz(e,t){const n=Gz({stream:Uz(e.stream,t)},e,t);return t.addStream(n).id}function Hz(e,t){let n;var i;e.type===Iz?(n=t.event(Iz,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===zz?Rz:i||Rz,e.type);const r=Gz({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function Gz(e,t,n){let i=t.between;return i&&(2!==i.length&&oe('Stream "between" parameter must have 2 entries: '+Dt(t)),e.between=[Uz(i[0],n),Uz(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===zz&&i.push("inScope(event.item)"),i.length&&(e.filter=yN("("+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 Yz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Vz(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const Xz=e=>(t,n,i)=>Sz(e,n,t||void 0,i),Jz=Xz("aggregate"),Qz=Xz("axisticks"),Zz=Xz("bound"),Kz=Xz("collect"),eR=Xz("compare"),tR=Xz("datajoin"),nR=Xz("encode"),iR=Xz("expression"),rR=Xz("facet"),oR=Xz("field"),aR=Xz("key"),sR=Xz("legendentries"),lR=Xz("load"),uR=Xz("mark"),cR=Xz("multiextent"),fR=Xz("multivalues"),dR=Xz("overlap"),hR=Xz("params"),pR=Xz("prefacet"),mR=Xz("projection"),gR=Xz("proxy"),yR=Xz("relay"),vR=Xz("render"),bR=Xz("scale"),xR=Xz("sieve"),_R=Xz("sortitems"),wR=Xz("viewlayout"),kR=Xz("values");let ER=0;const $R={min:"min",max:"max",count:"sum"};function AR(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=CR(e.domain,e,t),null!=e.range&&(n.range=LR(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=DR(e.type||e),null!=e.gamma&&(t.interpolateGamma=DR(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e){return we(e)?{interval:DR(e.interval),step:DR(e.step)}:DR(e)}(e.nice)),null!=e.bins&&(n.bins=function(e,t){return e.signal||_e(e)?SR(e,t):t.objectProperty(e)}(e.bins,t)),e)st(n,i)||"name"===i||(n[i]=DR(e[i],t))}function DR(e,t){return we(e)?e.signal?t.signalRef(e.signal):oe("Unsupported object: "+Dt(e)):e}function SR(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>DR(e,t)))}function MR(e){oe("Can not find data set: "+Dt(e))}function CR(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(_e(e)?FR:e.fields?NR:OR)(e,t,n);null==t.domainMin&&null==t.domainMax||oe("No scale domain defined for domainMin/domainMax to override.")}function FR(e,t,n){return e.map((e=>DR(e,n)))}function OR(e,t,n){const i=n.getData(e.data);return i||MR(e.data),Jp(t.type)?i.valuesRef(n,e.field,zR(e.sort,!1)):em(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function NR(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=vt(t)?{data:i,field:t}:_e(t)||t.signal?function(e,t){const n="_:vega:_"+ER++,i=Kz({});if(_e(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+Dt(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,xR({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(Jp(t.type)?TR:em(t.type)?RR:PR)(e,n,r)}function TR(e,t,n){const i=zR(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||MR(e.data),n.countsRef(t,e.field,i)})),s={groupby:Oz,pulse:a};i&&(r=i.op||"count",o=i.field?Tz(r,i.field):"count",s.ops=[$R[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(Jz(s));const l=t.add(Kz({pulse:Cz(r)}));return o=t.add(kR({field:Oz,sort:t.sortRef(i),pulse:Cz(l)})),Cz(o)}function zR(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!$R[e.op]&&oe("Multiple domain scales can not be sorted using "+e.op):oe("No field provided for sort aggregate op: "+e.op):we(e)?e.field="key":e={field:"key"}),e}function RR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||MR(e.data),n.domainRef(t,e.field)}));return Cz(t.add(fR({values:i})))}function PR(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||MR(e.data),n.extentRef(t,e.field)}));return Cz(t.add(cR({extents:i})))}function LR(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(vt(r)){if(i&&st(i,r))return LR(e=it({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Jp(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:oe("Unrecognized scale range value: "+Dt(r))}else{if(r.scheme)return n.scheme=_e(r.scheme)?SR(r.scheme,t):DR(r.scheme,t),r.extent&&(n.schemeExtent=SR(r.extent,t)),void(r.count&&(n.schemeCount=DR(r.count,t)));if(r.step)return void(n.rangeStep=DR(r.step,t));if(Jp(e.type)&&!_e(r))return CR(r,e,t);_e(r)||oe("Unsupported range type: "+Dt(r))}return r.map((e=>(_e(e)?SR:DR)(e,t)))}function BR(e,t,n){return _e(e)?e.map((e=>BR(e,t,n))):we(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:oe("Unsupported parameter object: "+Dt(e)):e}const jR="top",IR="left",UR="right",qR="bottom",WR="center",HR="vertical",GR="start",YR="end",VR="index",XR="label",JR="offset",QR="perc",ZR="perc2",KR="value",eP="guide-label",tP="guide-title",nP="group-title",iP="group-subtitle",rP="symbol",oP="gradient",aP="discrete",sP="size",lP=[sP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],uP={name:1,style:1,interactive:1},cP={value:0},fP={value:1},dP="group",hP="rect",pP="rule",mP="symbol",gP="text";function yP(e){return e.type=dP,e.interactive=e.interactive||!1,e}function vP(e,t){const n=(n,i)=>Bz(e[n],Bz(t[n],i));return n.isVertical=n=>HR===Bz(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>Bz(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>Bz(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>Bz(e.columns,Bz(t.columns,+n.isVertical(!0))),n}function bP(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 xP(e,t,n){return`item.anchor === '${GR}' ? ${e} : item.anchor === '${YR}' ? ${t} : ${n}`}const _P=xP(Dt(IR),Dt(UR),Dt(WR));function wP(e,t){return t?e?we(e)?Object.assign({},e,{offset:wP(e.offset,t)}):{value:e,offset:t}:t:e}function kP(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=GT(e.encode,t,uP)):e.interactive=!1,e}function EP(e,t,n,i){const r=vP(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let l,u,c,f,d;o?(u=[0,1],c=[0,0],f=a,d=s):(u=[0,0],c=[1,0],f=s,d=a);const h={enter:l={opacity:cP,x:cP,y:cP,width:qT(f),height:qT(d)},update:it({},l,{opacity:fP,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:cP}};return HT(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),kP({type:hP,role:az,encode:h},i)}function $P(e,t,n,i,r){const o=vP(e,n),a=o.isVertical(),s=o.gradientThickness(),l=o.gradientLength();let u,c,f,d,h="";a?(u="y",f="y2",c="x",d="width",h="1-"):(u="x",f="x2",c="y",d="height");const p={opacity:cP,fill:{scale:t,field:KR}};p[u]={signal:h+"datum."+QR,mult:l},p[c]=cP,p[f]={signal:h+"datum."+ZR,mult:l},p[d]=qT(s);const m={enter:p,update:it({},p,{opacity:fP}),exit:{opacity:cP}};return HT(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),kP({type:hP,role:rz,key:KR,from:r,encode:m},i)}const AP=`datum.${QR}<=0?"${IR}":datum.${QR}>=1?"${UR}":"${WR}"`,DP=`datum.${QR}<=0?"${qR}":datum.${QR}>=1?"${jR}":"middle"`;function SP(e,t,n,i){const r=vP(e,t),o=r.isVertical(),a=qT(r.gradientThickness()),s=r.gradientLength();let l,u,c,f,d=r("labelOverlap"),h="";const p={enter:l={opacity:cP},update:u={opacity:fP,text:{field:XR}},exit:{opacity:cP}};return HT(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:Bz(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=u.baseline={signal:DP},c="y",f="x",h="1-"):(l.align=u.align={signal:AP},l.baseline={value:"top"},c="x",f="y"),l[c]=u[c]={signal:h+"datum."+QR,mult:s},l[f]=u[f]=a,a.offset=Bz(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+VR}:void 0,kP({type:gP,role:sz,style:eP,key:KR,from:i,encode:p,overlap:d},n)}function MP(e,t,n,i,r){const o=vP(e,t),a=n.entries,s=!(!a||!a.interactive),l=a?a.name:void 0,u=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${JR} : datum.${sP}`,h=u?qT(u):{field:sP},p=`datum.${VR}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:cP,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:fP,x:y.x,y:y.y},exit:{opacity:cP}};let _=null,w=null;e.fill||(_=t.symbolBaseFillColor,w=t.symbolBaseStrokeColor),HT(g,{fill:o("symbolFillColor",_),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),lP.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:KR})}));const k=kP({type:mP,role:lz,key:KR,from:f,clip:!!u||void 0,encode:g},n.symbols),E=qT(c);E.offset=o("labelOffset"),g={enter:y={opacity:cP,x:{signal:d,offset:E},y:h},update:v={opacity:fP,text:{field:XR},x:y.x,y:y.y},exit:{opacity:cP}},HT(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 $=kP({type:gP,role:sz,style:eP,key:KR,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:cP,height:u?qT(u):cP,opacity:cP},exit:{opacity:cP},update:v={opacity:fP,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}`,yP({role:JT,from:i={facet:{data:i,name:"value",groupby:VR}},encode:GT(g,a,uP),marks:[k,$],name:l,interactive:s,sort:x})}const CP='item.orient === "left"',FP='item.orient === "right"',OP=`(${CP} || ${FP})`,NP=`datum.vgrad && ${OP}`,TP=xP('"top"','"bottom"','"middle"'),zP=`datum.vgrad && ${FP} ? (${xP('"right"','"left"','"center"')}) : (${OP} && !(datum.vgrad && ${CP})) ? "left" : ${_P}`,RP=`item._anchor || (${OP} ? "middle" : "start")`,PP=`${NP} ? (${CP} ? -90 : 90) : 0`,LP=`${OP} ? (datum.vgrad ? (${FP} ? "bottom" : "top") : ${TP}) : "top"`;function BP(e,t){let n;return we(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+jP(e.path)+")":e.sphere&&(n="geoShape("+jP(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function jP(e){return we(e)&&e.signal?e.signal:Dt(e)}function IP(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===dP?JT:t||VT:t}function UP(e){return{marktype:e.type,name:e.name||void 0,role:e.role||IP(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function qP(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function WP(e,t){const n=gs(e.type);n||oe("Unrecognized transform type: "+Dt(e.type));const i=Sz(n.type.toLowerCase(),null,HP(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function HP(e,t,n){const i={},r=e.params.length;for(let o=0;o<r;++o){const r=e.params[o];i[r.name]=GP(r,t,n)}return i}function GP(e,t,n){const i=e.type,r=t[e.name];return"index"===i?function(e,t,n){return vt(t.from)||oe('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}(0,t,n):void 0!==r?"param"===i?function(e,t,n){const i=t[e.name];return e.array?(_e(i)||oe("Expected an array of sub-parameters. Instead: "+Dt(i)),i.map((t=>VP(e,t,n)))):VP(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!Pz(r)?r.map((t=>YP(e,t,n))):YP(e,r,n):void(e.required&&oe("Missing required "+Dt(t.type)+" parameter: "+Dt(e.name)))}function YP(e,t,n){const i=e.type;if(Pz(t))return ZP(i)?oe("Expression references can not be signals."):KP(i)?n.fieldRef(t):eL(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||KP(i);return r&&XP(t)?n.exprRef(t.expr,t.as):r&&JP(t)?Fz(t.field,t.as):ZP(i)?yN(t,n):QP(i)?Cz(n.getData(t).values):KP(i)?Fz(t):eL(i)?n.compareRef(t):t}}function VP(e,t,n){const i=e.params.length;let r;for(let n=0;n<i;++n){r=e.params[n];for(const e in r.key)if(r.key[e]!==t[e]){r=null;break}if(r)break}r||oe("Unsupported parameter: "+Dt(t));const o=it(HP(r,t,n),r.key);return Cz(n.add(hR(o)))}const XP=e=>e&&e.expr,JP=e=>e&&e.field,QP=e=>"data"===e,ZP=e=>"expr"===e,KP=e=>"field"===e,eL=e=>"compare"===e;function tL(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Cz(t.getData(e.data).output)}function nL(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function iL(e){return vt(e)?e:null}function rL(e,t,n){const i=Tz(n.op,n.field);let r;if(t.ops){for(let e=0,n=t.as.length;e<n;++e)if(t.as[e]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function oL(e,t,n,i,r,o,a){const s=t[n]||(t[n]={}),l=function(e){return we(e)?("descending"===e.order?"-":"+")+Tz(e.op,e.field):""}(o);let u,c,f=iL(r);if(null!=f&&(e=t.scope,f+=l?"|"+l:"",u=s[f]),!u){const n=o?{field:Oz,pulse:t.countsRef(e,r,o)}:{field:e.fieldRef(r),pulse:Cz(t.output)};l&&(n.sort=e.sortRef(o)),c=e.add(Sz(i,void 0,n)),a&&(t.index[r]=c),u=Cz(c),null!=f&&(s[f]=u)}return u}function aL(e,t,n){const i=e.remove,r=e.insert,o=e.toggle,a=e.modify,s=e.values,l=t.add(Mz()),u=yN("if("+e.trigger+',modify("'+n+'",'+[r,i,o,a,s].map((e=>null==e?"null":e)).join(",")+"),0)",t);l.update=u.$expr,l.params=u.$params}function sL(e,t){const n=IP(e),i=e.type===dP,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,u,c,f,d,h=e.layout||n===JT||n===XT;const p=n===VT||h||r,m=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||oe("Only group marks can be faceted."),null!=i.field?a=s=tL(i,n):(e.data?s=Cz(n.getData(e.data).aggregate):(o=WP(it({type:"aggregate",groupby:Ge(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=tL(i,n),a=s=Cz(n.add(o))),r=n.keyRef(i.groupby,!0))):a=Cz(n.add(Kz(null,[{}]))),a||(a=tL(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(tR({key:m.key||(e.key?Fz(e.key):void 0),pulse:m.pulse,clean:!i}));const g=Cz(s);s=l=t.add(Kz({pulse:g})),s=t.add(uR({markdef:UP(e),interactive:qP(e.interactive,t),clip:BP(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Cz(s)}));const y=Cz(s);s=u=t.add(nR(xz(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),s.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=WP(e,t),i=n.metadata;(i.generates||i.changes)&&oe("Mark transforms should not generate new data."),i.nomod||(u.params.mod=!0),n.params.pulse=Cz(s),t.add(s=n)})),e.sort&&(s=t.add(_R({sort:t.compareRef(e.sort),pulse:Cz(s)})));const v=Cz(s);(r||h)&&(h=t.add(wR({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:v})),f=Cz(h));const b=t.add(Zz({mark:y,pulse:f||v}));d=Cz(b),i&&(p&&(a=t.operators,a.pop(),h&&a.pop()),t.pushState(v,f||d,g),r?function(e,t,n){const i=e.from.facet,r=i.name,o=tL(i,t);let a;i.name||oe("Facet must have a name: "+Dt(i)),i.data||oe("Facet must reference a data set: "+Dt(i)),i.field?a=t.add(pR({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(rR({key:t.keyRef(i.groupby),group:Cz(t.proxy(n.parent)),pulse:o})):oe("Facet must specify groupby or field: "+Dt(i));const s=t.fork(),l=s.add(Kz()),u=s.add(xR({pulse:Cz(l)}));s.addData(r,new nL(s,l,l,u)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(e).toRuntime()}}(e,t,m):p?function(e,t,n){const i=t.add(pR({pulse:n.pulse})),r=t.fork();r.add(xR()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,m):t.parse(e),t.popState(),p&&(h&&a.push(h),a.push(b))),o&&(d=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:Pz(o)?n.signalRef(o.signal):o,method:Pz(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(a.sort=n.compareRef({field:e.order})),r){const e=r.tolerance;a.boundTolerance=Pz(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return Cz(n.add(dR(a)))}(o,d,t));const x=t.add(vR({pulse:d})),_=t.add(xR({pulse:Cz(x)},void 0,t.parent()));null!=e.name&&(c=e.name,t.addData(c,new nL(t,l,x,_)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&oe("Marks only support modify triggers."),aL(e,t,c)})))}function lL(e,t,n){const i={enter:{},update:{}};return HT(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 uL(e,t,n){return t[e]?`scale("${t[e]}",datum)`:bP(e,n[0].encode)}nL.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;++s)t[s].params.pulse=Cz(t[s-1]),e.add(t[s]),"aggregate"===t[s].type&&(a=t[s]);return new nL(e,o,r,i,a)},nL.prototype={countsRef(e,t,n){const i=this,r=i.counts||(i.counts={}),o=iL(t);let a,s,l;return null!=o&&(e=i.scope,a=r[o]),a?n&&n.field&&rL(e,a.agg.params,n):(l={groupby:e.fieldRef(t,"key"),pulse:Cz(i.output)},n&&n.field&&rL(e,l,n),s=e.add(Jz(l)),a=e.add(Kz({pulse:Cz(s)})),a={agg:s,ref:Cz(a)},null!=o&&(r[o]=a)),a.ref},tuplesRef(){return Cz(this.values)},extentRef(e,t){return oL(e,this,"extent","extent",t,!1)},domainRef(e,t){return oL(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return oL(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return oL(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return oL(e,this,"indata","tupleindex",t,!0,!0)}};const cL=`item.orient==="${IR}"?-90:item.orient==="${UR}"?90:0`;function fL(e,t){const n={enter:{},update:{}};return HT(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:_P},angle:{signal:cL},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),GT(n,t,uP)}function dL(e){const t=Kz({},e);return t.metadata={source:!0},t}function hL(e,t){return lR({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const pL=e=>e===qR||e===jR,mL=(e,t,n)=>Pz(e)?wL(e.signal,t,n):e===IR||e===jR?t:n,gL=(e,t,n)=>Pz(e)?xL(e.signal,t,n):pL(e)?t:n,yL=(e,t,n)=>Pz(e)?_L(e.signal,t,n):pL(e)?n:t,vL=(e,t,n)=>Pz(e)?kL(e.signal,t,n):e===jR?{value:t}:{value:n},bL=(e,t,n)=>Pz(e)?EL(e.signal,t,n):e===UR?{value:t}:{value:n},xL=(e,t,n)=>$L(`${e} === '${jR}' || ${e} === '${qR}'`,t,n),_L=(e,t,n)=>$L(`${e} !== '${jR}' && ${e} !== '${qR}'`,t,n),wL=(e,t,n)=>DL(`${e} === '${IR}' || ${e} === '${jR}'`,t,n),kL=(e,t,n)=>DL(`${e} === '${jR}'`,t,n),EL=(e,t,n)=>DL(`${e} === '${UR}'`,t,n),$L=(e,t,n)=>(t=null!=t?qT(t):t,n=null!=n?qT(n):n,AL(t)&&AL(n)?{signal:`${e} ? (${t=t?t.signal||Dt(t.value):null}) : (${n=n?n.signal||Dt(n.value):null})`}:[it({test:e},t)].concat(n||[])),AL=e=>null==e||1===Object.keys(e).length,DL=(e,t,n)=>({signal:`${e} ? (${ML(t)}) : (${ML(n)})`}),SL=(e,t,n,i,r)=>({signal:(null!=i?`${e} === '${IR}' ? (${ML(i)}) : `:"")+(null!=n?`${e} === '${qR}' ? (${ML(n)}) : `:"")+(null!=r?`${e} === '${UR}' ? (${ML(r)}) : `:"")+(null!=t?`${e} === '${jR}' ? (${ML(t)}) : `:"")+"(null)"}),ML=e=>Pz(e)?e.signal:null==e?null:Dt(e),CL=(e,t)=>0===t?0:Pz(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},FL=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function OL(e,t,n,i){let r;if(t&&st(t,e))return t[e];if(st(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[tP][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[eP][r]}return null}function NL(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function TL(e,t){return{scale:e.scale,range:t}}function zL(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function RL(e,t){const n=function(e,t){var n,i,r,o=t.config,a=o.style,s=o.axis,l="band"===t.scaleType(e.scale)&&o.axisBand,u=e.orient;if(Pz(u)){const e=NL([o.axisX,o.axisY]),t=NL([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(r of(n={},e))n[r]=gL(u,OL(r,o.axisX,s,a),OL(r,o.axisY,s,a));for(r of(i={},t))i[r]=SL(u.signal,OL(r,o.axisTop,s,a),OL(r,o.axisBottom,s,a),OL(r,o.axisLeft,s,a),OL(r,o.axisRight,s,a))}else n=u===jR||u===qR?o.axisX:o.axisY,i=o["axis"+u[0].toUpperCase()+u.slice(1)];return n||i||l?it({},s,n,i,l):s}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,l=vP(e,n),u=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'`},we(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}}(l),c={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},f=Cz(t.add(Kz({},[c]))),d=Cz(t.add(Qz({scale:t.scaleRef(e.scale),extra:t.property(u.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(function(e,t,n,i,r){const o=vP(e,t),a=e.orient,s=e.gridScale,l=mL(a,1,-1),u=function(e,t){if(1===t);else if(we(e)){let n=e=it({},e);for(;null!=n.mult;){if(!we(n.mult))return n.mult=Pz(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=it({},n.mult)}n.mult=t}else e=Pz(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,f,d;const h={enter:c={opacity:cP},update:d={opacity:fP},exit:f={opacity:cP}};HT(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:KR,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=gL(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:l,offset:u}:{value:0,offset:u},y=s?{scale:s,range:1,mult:l,offset:u}:it(m,{mult:l,offset:u});return c.x=d.x=gL(a,p,g),c.y=d.y=yL(a,p,g),c.x2=d.x2=yL(a,y),c.y2=d.y2=gL(a,y),f.x=gL(a,p),f.y=yL(a,p),kP({type:pP,role:KT,key:KR,from:i,encode:h},n)}(e,n,i.grid,d,u)),c.ticks&&(p=l("tickSize"),h.push(function(e,t,n,i,r,o){const a=vP(e,t),s=e.orient,l=mL(s,-1,1);let u,c,f;const d={enter:u={opacity:cP},update:f={opacity:fP},exit:c={opacity:cP}};HT(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=qT(r);h.mult=l;const p={scale:e.scale,field:KR,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=u.y=gL(s,cP,p),f.y2=u.y2=gL(s,h),c.x=gL(s,p),f.x=u.x=yL(s,cP,p),f.x2=u.x2=yL(s,h),c.y=yL(s,p),kP({type:pP,role:tz,key:KR,from:i,encode:d},n)}(e,n,i.ticks,d,p,u))),c.labels&&(p=c.ticks?p:0,h.push(function(e,t,n,i,r,o){const a=vP(e,t),s=e.orient,l=e.scale,u=mL(s,-1,1),c=jz(a("labelFlush")),f=jz(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=qT(r);g.mult=u,g.offset=qT(a("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:KR,band:.5,offset:wP(o.offset,a("labelOffset"))},v=gL(s,m?zL(l,c,'"left"','"right"','"center"'):{value:"center"},bL(s,"left","right")),b=gL(s,vL(s,"bottom","top"),m?zL(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=zL(l,c,`-(${f})`,f,0);m=m&&f;const _={opacity:cP,x:gL(s,y,g),y:yL(s,y,g)},w={enter:_,update:p={opacity:fP,text:{field:XR},x:_.x,y:_.y,align:v,baseline:b},exit:{opacity:cP,x:_.x,y:_.y}};HT(w,{dx:!d&&m?gL(s,x):null,dy:!h&&m?yL(s,x):null}),HT(w,{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 k=a("labelBound");let E=a("labelOverlap");return E=E||k?{separation:a("labelSeparation"),method:E,order:"datum.index",bound:k?{scale:l,orient:s,tolerance:k}:null}:void 0,p.align!==v&&(p.align=FL(p.align,v)),p.baseline!==b&&(p.baseline=FL(p.baseline,b)),kP({type:gP,role:ez,style:eP,key:KR,from:i,encode:w,overlap:E},n)}(e,n,i.labels,d,p,u))),c.domain&&h.push(function(e,t,n,i){const r=vP(e,t),o=e.orient;let a,s;const l={enter:a={opacity:cP},update:s={opacity:fP},exit:{opacity:cP}};HT(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=TL(e,0),c=TL(e,1);return a.x=s.x=gL(o,u,cP),a.x2=s.x2=gL(o,c),a.y=s.y=yL(o,u,cP),a.y2=s.y2=yL(o,c),kP({type:pP,role:ZT,from:i,encode:l},n)}(e,n,i.domain,f)),c.title&&h.push(function(e,t,n,i){const r=vP(e,t),o=e.orient,a=mL(o,-1,1);let s,l;const u={enter:s={opacity:cP,anchor:qT(r("titleAnchor",null)),align:{signal:_P}},update:l=it({},s,{opacity:fP,text:qT(e.title)}),exit:{opacity:cP}},c={signal:`lerp(range("${e.scale}"), ${xP(0,1,.5)})`};return l.x=gL(o,c),l.y=yL(o,c),s.angle=gL(o,cP,CL(a,90)),s.baseline=gL(o,vL(o,qR,jR),{value:qR}),l.angle=s.angle,l.baseline=s.baseline,HT(u,{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]=FL(qT(e),n.update[t]),!1):!YT(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?qT(a):gL(t,qT(a),qT(o))}(r,o,u,n),u.update.align=FL(u.update.align,s.align),u.update.angle=FL(u.update.angle,s.angle),u.update.baseline=FL(u.update.baseline,s.baseline),kP({type:gP,role:nz,style:tP,from:i,encode:u},n)}(e,n,i.title,f)),sL(yP({role:QT,from:f,encode:GT(PL(l,e),r,uP),marks:h,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:o,interactive:a,style:s}),t)}function PL(e,t){const n={enter:{},update:{}};return HT(n,{orient:e("orient"),offset:e("offset")||0,position:Bz(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 LL(e,t,n){const i=Ge(e.signals),r=Ge(e.scales);return n||i.forEach((e=>Az(e,t))),Ge(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=BR(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=BR(n[e],e,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";Yp(n)||oe("Unrecognized scale type: "+Dt(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),Ge(e.data).forEach((e=>function(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(WP(e,t))})),e.on&&e.on.forEach((n=>{aL(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,o,a,s,l,u=null,c=!1,f=!1;for(e.values?Pz(e.values)||Lz(e.format)?(i.push(hL(t,e)),i.push(u=dL())):i.push(u=dL({$ingest:e.values,$format:e.format})):e.url?Lz(e.url)||Lz(e.format)?(i.push(hL(t,e)),i.push(u=dL())):i.push(u=dL({$request:e.url,$format:e.format})):e.source&&(u=r=Ge(e.source).map((e=>Cz(t.getData(e).output))),i.push(null)),o=0,a=n.length;o<a;++o)s=n[o],l=s.metadata,u||l.source||i.push(u=dL()),i.push(s),l.generates&&(f=!0),l.modifies&&!f&&(c=!0),l.source?u=s:l.changes&&(u=null);return r&&(a=r.length-1,i[0]=yR({derive:c,pulse:a?r:r[0]}),(c||a)&&i.splice(1,0,dL())),u||i.push(dL()),i.push(xR({})),i}(e,t,n))}(e,t))),r.forEach((e=>AR(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?oe("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=yN(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>function(e,t,n){const i=e.encode,r={target:n};let o=e.events,a=e.update,s=[];o||oe("Signal update missing events specification."),vt(o)&&(o=zT(o,t.isSubscope()?zz:Rz)),o=Ge(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[Vz(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&oe("Signal encode and update are mutually exclusive."),a="encode(item(),"+Dt(i)+")"),r.update=vt(a)?yN(a,t):null!=a.expr?yN(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:Yz,$params:{$value:t.signalRef(a.signal)}}:oe("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(it(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):Uz(e,t)}}(e,t),r))))}(e,t,n.id)))}(e,t))),Ge(e.axes).forEach((e=>RL(e,t))),Ge(e.marks).forEach((e=>sL(e,t))),Ge(e.legends).forEach((e=>function(e,t){const n=t.config.legend,i=e.encode||{},r=vP(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,l=o.style,u={};let c,f,d,h=0;lP.forEach((t=>e[t]?(u[t]=e[t],h=h||e[t]):0)),h||oe("Missing valid scale for legend.");const p=function(e,t){let n=e.type||rP;return e.type||1!==function(e){return lP.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=Xp(t)?oP:Qp(t)?aP:rP),n!==oP?n:Qp(t)?aP:oP}(e,t.scaleType(h)),m={title:null!=e.title,scales:u,type:p,vgrad:"symbol"!==p&&r.isVertical()},g=Cz(t.add(Kz(null,[m]))),y=Cz(t.add(sR(f={type:p,scale:t.scaleRef(h),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 p===oP?(d=[EP(e,h,n,i.gradient),SP(e,n,i.labels,y)],f.count=f.count||t.signalRef(`max(2,2*floor((${jz(r.gradientLength())})/100))`)):p===aP?d=[$P(e,h,n,i.gradient,y),SP(e,n,i.labels,y)]:(c=function(e,t){const n=vP(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),d=[MP(e,n,i,y,jz(c.columns))],f.size=function(e,t,n){const i=jz(uL("size",e,n)),r=jz(uL("strokeWidth",e,n)),o=jz(function(e,t,n){return bP("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i.fontSize}(0,t,n)}(n[1].encode,t,eP));return yN(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,d[0].marks)),d=[yP({role:oz,from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(e,t,n,i){const r=vP(e,t),o={enter:{opacity:cP},update:{opacity:fP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:cP}};return HT(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:RP},angle:{signal:PP},align:{signal:zP},baseline:{signal:LP},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")}),kP({type:gP,role:uz,style:tP,from:i,encode:o},n)}(e,n,i.title,g)),sL(yP({role:iz,from:g,encode:GT(lL(r,e,n),o,uP),marks:d,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:s,style:l}),t)}(e,t))),e.title&&function(e,t){const n=vP(e=vt(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,a=r.interactive,s=r.style,l=[],u=Cz(t.add(Kz(null,[{}])));l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return HT(o,{text:e.text,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kP({type:gP,role:fz,style:nP,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||it({name:e.name,interactive:e.interactive,style:e.style},t)}(e),u)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return HT(o,{text:e.subtitle,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kP({type:gP,role:dz,style:iP,from:i,encode:o},n)}(e,n,i.subtitle,u)),sL(yP({role:cz,from:u,encode:fL(n,r),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),t)}(e.title,t),t.parseLambdas(),t}const BL=e=>GT({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function jL(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function IL(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 UL(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 qL(e){return(_e(e)?WL:HL)(e)}function WL(e){const t=e.length;let n="[";for(let i=0;i<t;++i){const t=e[i];n+=(i>0?",":"")+(we(t)?t.signal||qL(t):Dt(t))}return n+"]"}function HL(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+Dt(t)+":"+(we(n)?n.signal||qL(n):Dt(n));return i+"}"}function GL(e,t,n){return we(e)||oe("Input Vega specification must be an object."),t=Ee(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:r},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:r,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:r,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),t,e.config),function(e,t){const n=t.config,i=Cz(t.root=t.add(Mz())),r=function(e,t){const n=n=>Bz(e[n],t[n]),i=[jL("background",n("background")),jL("autosize",BT(n("autosize"))),jL("padding",UT(n("padding"))),jL("width",n("width")||0),jL("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return Ge(e.signals).forEach((e=>{st(r,e.name)?e=it(r[e.name],e):i.push(e),o[e.name]=e})),Ge(t.signals).forEach((e=>{st(o,e.name)||st(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>Az(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(Kz()),a=t.add(nR(xz(BL(e.encode),dP,XT,e.style,t,{pulse:Cz(o)}))),s=t.add(wR({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:Cz(a)}));t.operators.pop(),t.pushState(Cz(a),Cz(s),null),LL(e,t,r),t.operators.push(s);let l=t.add(Zz({mark:i,pulse:Cz(s)}));return l=t.add(vR({pulse:Cz(l)})),l=t.add(xR({pulse:Cz(l)})),t.addData("root",new nL(t,o,o,l)),t}(e,new IL(t,n)).toRuntime()}IL.prototype=UL.prototype={parse(e){return LL(e,this)},fork(){return new UL(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 Dz?Cz(e):e;return this.add(gR({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(Cz(this.add(xR({pulse:e})))),this._parent.push(t),this._lookup.push(n?Cz(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return De(this._parent)},encode(){return De(this._encode)},lookup(){return De(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(vt(e))return Fz(e,t);e.signal||oe("Unsupported field reference: "+Dt(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=Cz(this.add(oR(e)))}return i},compareRef(e){let t=!1;const n=e=>Pz(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=Ge(e.field).map(n),r=Ge(e.order).map(n);return t?Cz(this.add(eR({fields:i,orders:r}))):Nz(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=Ge(e).map((e=>Pz(e)?(n=!0,Cz(i[e.signal])):e)),n?Cz(this.add(aR({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=Tz(e.op,e.field),n=e.order||"ascending";return n.signal?Cz(this.add(eR({fields:t,orders:this.signalRef(n.signal)}))):Nz(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 st(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&oe("Duplicate signal name: "+Dt(e));const n=t instanceof Dz?t:this.add(Mz(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||oe("Unrecognized signal name: "+Dt(e)),this.signals[e]},signalRef(e){return this.signals[e]?Cz(this.signals[e]):(st(this.lambdas,e)||(this.lambdas[e]=this.add(Mz(null))),Cz(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){const n=e[t],i=yN(n,this),r=this.lambdas[n];r.params=i.$params,r.update=i.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&we(e)?this.signalRef(e.signal||qL(e)):e},exprRef(e,t){const n={expr:yN(e,this)};return t&&(n.expr.$name=t),Cz(this.add(iR(n)))},addBinding(e,t){this.bindings||oe("Nested signals do not support binding: "+Dt(e)),this.bindings.push(it({signal:e},t))},addScaleProj(e,t){st(this.scales,e)&&oe("Duplicate scale or projection name: "+Dt(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,bR(t))},addProjection(e,t){this.addScaleProj(e,mR(t))},getScale(e){return this.scales[e]||oe("Unrecognized scale name: "+Dt(e)),this.scales[e]},scaleRef(e){return Cz(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return st(this.data,e)&&oe("Duplicate data set name: "+Dt(e)),this.data[e]=t},getData(e){return this.data[e]||oe("Undefined data set name: "+Dt(e)),this.data[e]},addDataPipeline(e,t){return st(this.data,e)&&oe("Duplicate data set name: "+Dt(e)),this.addData(e,nL.fromEntries(this,t))}};var YL="5.25.0";it(ms,o,s,l,u,c,d,f,h,p,m,g);var VL={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},XL={"*":(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>=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>>t,">>>":(e,t)=>e>>>t},JL={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const QL=Array.prototype.slice,ZL=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,QL.call(t,1))};var KL={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,i,r,o,a)=>new Date(e,t||0,null!=n?n:1,i||0,r||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 ZL("join",arguments)},indexof:function(){return ZL("indexOf",arguments)},lastindexof:function(){return ZL("lastIndexOf",arguments)},slice:function(){return ZL("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return ZL("substring",arguments,String)},split:function(){return ZL("split",arguments,String)},replace:function(){return ZL("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const eB=["view","item","group","xy","x","y"],tB=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&tB.add(setImmediate);const nB={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:VL[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),!tB.has(i[r]))return i[r];console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),"if"===i?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||KL[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>XL[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>JL[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 i=e(n.key);return e.memberDepth-=1,tB.has(e(n.value))?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):t[i]=e(n.value),t}),{})};function iB(e,t,n,i,r,o){const a=e=>nB[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=i,a.event=r,a.item=o,eB.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var rB={operator(e,t){const n=t.ast,i=e.functions;return e=>iB(n,i,e)},parameter(e,t){const n=t.ast,i=e.functions;return(e,t)=>iB(n,i,t,e)},event(e,t){const n=t.ast,i=e.functions;return e=>iB(n,i,void 0,void 0,e)},handler(e,t){const n=t.ast,i=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return iB(n,i,e,r,t)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in i)s=iB(i[n].ast,r,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),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&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,i,o),l}}},oB=n(36425),aB=n.n(oB),sB=n(66471),lB=n.n(sB),uB=n(56440),cB=n.n(uB);function fB(e){return!!e.or}function dB(e){return!!e.and}function hB(e){return!!e.not}function pB(e,t){if(hB(e))pB(e.not,t);else if(dB(e))for(const n of e.and)pB(n,t);else if(fB(e))for(const n of e.or)pB(n,t);else t(e)}function mB(e,t){return hB(e)?{not:mB(e.not,t)}:dB(e)?{and:e.and.map((e=>mB(e,t)))}:fB(e)?{or:e.or.map((e=>mB(e,t)))}:t(e)}const gB=lB(),yB=aB();function vB(e){throw new Error(e)}function bB(e,t){const n={};for(const i of t)st(e,i)&&(n[i]=e[i]);return n}function xB(e,t){const n={...e};for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>cB()(e))).join(",")})`};const _B=cB();function wB(e){if(gt(e))return e;const t=vt(e)?e:cB()(e);if(t.length<250)return t;let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return n}function kB(e){return!1===e||null===e}function EB(e,t){return e.includes(t)}function $B(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function AB(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function DB(e,...t){for(const n of t)SB(e,n??{});return e}function SB(e,t){for(const n of RB(t))$e(e,n,t[n],!0)}function MB(e,t){const n=[],i={};let r;for(const o of e)r=t(o),r in i||(i[r]=1,n.push(o));return n}function CB(e,t){const n=RB(e),i=RB(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0}function FB(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function OB(e,t){for(const n of e)if(t.has(n))return!0;return!1}function NB(e){const t=new Set;for(const n of e){const e=ae(n).map(((e,t)=>0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of i)t.add(e)}return t}function TB(e,t){return void 0===e||void 0===t||OB(NB(e),NB(t))}function zB(e){return 0===RB(e).length}const RB=Object.keys,PB=Object.values,LB=Object.entries;function BB(e){return!0===e||!1===e}function jB(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function IB(e,t){return hB(e)?`!(${IB(e.not,t)})`:dB(e)?`(${e.and.map((e=>IB(e,t))).join(") && (")})`:fB(e)?`(${e.or.map((e=>IB(e,t))).join(") || (")})`:t(e)}function UB(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&UB(e[n],t)&&delete e[n],zB(e)}function qB(e){return e.charAt(0).toUpperCase()+e.substr(1)}function WB(e,t="datum"){const n=ae(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(Dt).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function HB(e,t="datum"){return`${t}[${Dt(ae(e).join("."))}]`}function GB(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function YB(e){return`${ae(e).map(GB).join("\\.")}`}function VB(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function XB(e){return`${ae(e).join(".")}`}function JB(e){return e?ae(e).length:0}function QB(...e){for(const t of e)if(void 0!==t)return t}let ZB=42;function KB(e){const t=++ZB;return e?String(e)+t:t}function ej(){ZB=42}function tj(e){return nj(e)?e:`__${e}`}function nj(e){return e.startsWith("__")}function ij(e){if(void 0!==e)return(e%360+360)%360}function rj(e){return!!gt(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const oj="row",aj="column",sj="facet",lj="x",uj="y",cj="x2",fj="y2",dj="xOffset",hj="yOffset",pj="radius",mj="radius2",gj="theta",yj="theta2",vj="latitude",bj="longitude",xj="latitude2",_j="longitude2",wj="color",kj="fill",Ej="stroke",$j="shape",Aj="size",Dj="angle",Sj="opacity",Mj="fillOpacity",Cj="strokeOpacity",Fj="strokeWidth",Oj="strokeDash",Nj="text",Tj="order",zj="detail",Rj="key",Pj="tooltip",Lj="href",Bj="url",jj="description",Ij={theta:1,theta2:1,radius:1,radius2:1};function Uj(e){return e in Ij}const qj={longitude:1,longitude2:1,latitude:1,latitude2:1};function Wj(e){switch(e){case vj:return"y";case xj:return"y2";case bj:return"x";case _j:return"x2"}}function Hj(e){return e in qj}const Gj=RB(qj),Yj={x:1,y:1,x2:1,y2:1,...Ij,...qj,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function Vj(e){return e===wj||e===kj||e===Ej}const Xj={row:1,column:1,facet:1},Jj=RB(Xj),Qj={...Yj,...Xj},Zj=RB(Qj),{order:Kj,detail:eI,tooltip:tI,...nI}=Qj,{row:iI,column:rI,facet:oI,...aI}=nI;function sI(e){return!!Qj[e]}RB(nI),RB(aI);const lI=[cj,fj,xj,_j,yj,mj];function uI(e){return cI(e)!==e}function cI(e){switch(e){case cj:return lj;case fj:return uj;case xj:return vj;case _j:return bj;case yj:return gj;case mj:return pj}return e}function fI(e){if(Uj(e))switch(e){case gj:return"startAngle";case yj:return"endAngle";case pj:return"outerRadius";case mj:return"innerRadius"}return e}function dI(e){switch(e){case lj:return cj;case uj:return fj;case vj:return xj;case bj:return _j;case gj:return yj;case pj:return mj}}function hI(e){switch(e){case lj:case cj:return"width";case uj:case fj:return"height"}}function pI(e){switch(e){case lj:return"xOffset";case uj:return"yOffset";case cj:return"x2Offset";case fj:return"y2Offset";case gj:return"thetaOffset";case pj:return"radiusOffset";case yj:return"theta2Offset";case mj:return"radius2Offset"}}function mI(e){switch(e){case lj:return"xOffset";case uj:return"yOffset"}}function gI(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const yI=RB(Yj),{x:vI,y:bI,x2:xI,y2:_I,xOffset:wI,yOffset:kI,latitude:EI,longitude:$I,latitude2:AI,longitude2:DI,theta:SI,theta2:MI,radius:CI,radius2:FI,...OI}=Yj,NI=RB(OI),TI={x:1,y:1},zI=RB(TI);function RI(e){return e in TI}const PI={theta:1,radius:1},LI=RB(PI);function BI(e){return"width"===e?lj:uj}const jI={xOffset:1,yOffset:1};function II(e){return e in jI}RB(jI);const{text:UI,tooltip:qI,href:WI,url:HI,description:GI,detail:YI,key:VI,order:XI,...JI}=OI,QI=RB(JI),ZI={...TI,...PI,...jI,...JI},KI=RB(ZI);function eU(e){return!!ZI[e]}const tU={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:nU,...iU}=tU;function rU(e){switch(e){case lj:case uj:case gj:case pj:case dj:case hj:case Aj:case Dj:case Fj:case Sj:case Mj:case Cj:case cj:case fj:case yj:case mj:return;case sj:case oj:case aj:case $j:case Oj:case Nj:case Pj:case Lj:case Bj:case jj:return"discrete";case wj:case kj:case Ej:return"flexible";case vj:case bj:case xj:case _j:case zj:case Rj:case Tj:return}}const oU={argmax:1,argmin:1,average:1,count:1,distinct:1,product: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},aU={count:1,min:1,max:1};function sU(e){return!!e&&!!e.argmin}function lU(e){return!!e&&!!e.argmax}function uU(e){return vt(e)&&!!oU[e]}const cU=new Set(["count","valid","missing","distinct"]);function fU(e){return vt(e)&&cU.has(e)}const dU=new Set(["count","sum","distinct","valid","missing"]),hU=new Set(["mean","average","median","q1","q3","min","max"]);function pU(e){return ht(e)&&(e=gG(e,void 0)),"bin"+RB(e).map((t=>vU(e[t])?jB(`_${t}_${LB(e[t])}`):jB(`_${t}_${e[t]}`))).join("")}function mU(e){return!0===e||yU(e)&&!e.binned}function gU(e){return"binned"===e||yU(e)&&!0===e.binned}function yU(e){return we(e)}function vU(e){return e?.param}function bU(e){switch(e){case oj:case aj:case Aj:case wj:case kj:case Ej:case Fj:case Sj:case Mj:case Cj:case $j:return 6;case Oj:return 4;default:return 10}}function xU(e){return!!e?.expr}function _U(e){const t=RB(e||{}),n={};for(const i of t)n[i]=FU(e[i]);return n}function wU(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:u,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={...l?{subtitleColor:l}:{},...u?{subtitleFont:u}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:bB(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function kU(e){return vt(e)||_e(e)&&vt(e[0])}function EU(e){return!!e?.signal}function $U(e){return!!e.step}function AU(e){return!_e(e)&&"field"in e&&"data"in e}const DU=RB({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}),SU={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},MU=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function CU(e){const t=_e(e.condition)?e.condition.map(OU):OU(e.condition);return{...FU(e),condition:t}}function FU(e){if(xU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function OU(e){if(xU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function NU(e){if(xU(e)){const{expr:t,...n}=e;return{signal:t,...n}}return EU(e)?e:void 0!==e?{value:e}:void 0}function TU(e){return EU(e)?e.signal:Dt(e)}function zU(e){return EU(e)?e.signal:Dt(e.value)}function RU(e){return EU(e)?e.signal:null==e?null:Dt(e)}function PU(e,t,n){for(const i of n){const n=jU(i,t.markDef,t.config);void 0!==n&&(e[i]=NU(n))}return e}function LU(e){return[].concat(e.type,e.style??[])}function BU(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?jU(e,t,n,i):void 0}function jU(e,t,n,{vgChannel:i}={}){return QB(i?IU(e,t,n.style):void 0,IU(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function IU(e,t,n){return UU(e,LU(t),n)}function UU(e,t,n){let i;t=Ge(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function qU(e,t){return Ge(e).reduce(((e,n)=>(e.field.push(nG(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function WU(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(gB(t,e))return;n.push(e)})),n}function HU(e,t){return gB(e,t)||!t?e:e?[...Ge(e),...Ge(t)].join(", "):t}function GU(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((kU(n)||EU(n))&&(kU(i)||EU(i)))return{explicit:e.explicit,value:HU(n,i)};if(kU(n)||EU(n))return{explicit:e.explicit,value:n};if(kU(i)||EU(i))return{explicit:e.explicit,value:i};if(!(kU(n)||EU(n)||kU(i)||EU(i)))return{explicit:e.explicit,value:WU(n,i)};throw new Error("It should never reach here")}function YU(e){return`Invalid specification ${_B(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const VU='Autosize "fit" only works for single views and layered views.';function XU(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function JU(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function QU(e){return e?`Dropping "fit-${e}" because spec has discrete ${hI(e)}.`:'Dropping "fit" because spec has discrete size.'}function ZU(e){return`Unknown field for ${e}. Cannot calculate view size.`}function KU(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function eq(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function tq(e){return`Selection not supported for ${e} yet.`}function nq(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function iq(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function rq(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function oq(e){return`${e}Offset dropped because ${e} is continuous`}function aq(e){return`There is no ${e} encoding. Replacing ${e}Offset encoding as ${e}.`}function sq(e){return`Invalid field type "${e}".`}function lq(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 uq(e,t){return`Dropping ${_B(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function cq(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function fq(e){return`${e} encoding has no scale, so specified scale is ignored.`}function dq(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function hq(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function pq(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function mq(e){return`Using unaggregated domain with raw field has no effect (${_B(e)}).`}function gq(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function yq(e){return`Unaggregated domain is currently unsupported for log scale (${_B(e)}).`}function vq(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function bq(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const xq="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function _q(e,t){return`Invalid ${e}: ${_B(t)}.`}function wq(e){return`1D error band does not support ${e}.`}function kq(e){return`Channel ${e} is required for "binned" bin.`}const Eq=xe(ye);let $q=Eq;function Aq(...e){$q.warn(...e)}function Dq(e){if(e&&we(e))for(const t of zq)if(t in e)return!0;return!1}new WeakMap;const Sq=["january","february","march","april","may","june","july","august","september","october","november","december"],Mq=Sq.map((e=>e.substr(0,3))),Cq=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Fq=Cq.map((e=>e.substr(0,3)));function Oq(e,t){const n=[];if(t&&void 0!==e.day&&RB(e).length>1&&(Aq(function(e){return`Dropping day from datetime ${_B(e)} as day cannot be combined with other units.`}(e)),delete(e=yB(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(rj(e)&&(e=+e),gt(e))return e-1;{const t=e.toLowerCase(),n=Sq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Mq.indexOf(i);if(-1!==r)return r;throw new Error(_q("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(rj(e)&&(e=+e),gt(e))return e>4&&Aq(_q("quarter",e)),e-1;throw new Error(_q("quarter",e))}(e.quarter):e.quarter;n.push(gt(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(rj(e)&&(e=+e),gt(e))return e%7;{const t=e.toLowerCase(),n=Cq.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Fq.indexOf(i);if(-1!==r)return r;throw new Error(_q("day",e))}}(e.day):e.day;n.push(gt(i)?i+1:`${i}+1`)}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function Nq(e){const t=Oq(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const Tq={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},zq=RB(Tq);function Rq(e){return e.startsWith("utc")}const Pq={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Lq(e){return zq.filter((t=>Bq(e,t)))}function Bq(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 jq(e){if(!e)return;const t=Lq(e);return`timeUnitSpecifier(${_B(t)}, ${_B(Pq)})`}function Iq(e){if(!e)return;let t;return vt(e)?t={unit:e}:we(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Rq(t.unit)&&(t.utc=!0,t.unit=function(e){return e.substr(3)}(t.unit)),t}function Uq(e,t=(e=>e)){const n=Iq(e),i=function(e){const t=Lq(e);return t[t.length-1]}(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},r=n.step||1;return`${t(Nq({...e,..."quarter"===i?{month:+e.month+3*r}:"week"===i?{date:+e.date+7*r}:{[i]:+e[i]+r}}))} - ${t(Nq(e))}`}}function qq(e){return!!e?.field&&void 0!==e.equal}function Wq(e){return!!e?.field&&void 0!==e.lt}function Hq(e){return!!e?.field&&void 0!==e.lte}function Gq(e){return!!e?.field&&void 0!==e.gt}function Yq(e){return!!e?.field&&void 0!==e.gte}function Vq(e){if(e?.field){if(_e(e.range)&&2===e.range.length)return!0;if(EU(e.range))return!0}return!1}function Xq(e){return!!e?.field&&(_e(e.oneOf)||_e(e.in))}function Jq(e){return Xq(e)||qq(e)||Vq(e)||Wq(e)||Gq(e)||Hq(e)||Yq(e)}function Qq(e,t){return bG(e,{timeUnit:t,wrapTime:!0})}function Zq(e,t=!0){const{field:n}=e,i=Iq(e.timeUnit)?.unit,r=i?`time(${function(e,t,{end:n}={end:!1}){const i=WB(t),r=Rq(e)?"utc":"";let o;const a={};for(const t of zq)Bq(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=Oq(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}(i,n)})`:nG(e,{expr:"datum"});if(qq(e))return`${r}===${Qq(e.equal,i)}`;if(Wq(e))return`${r}<${Qq(e.lt,i)}`;if(Gq(e))return`${r}>${Qq(e.gt,i)}`;if(Hq(e))return`${r}<=${Qq(e.lte,i)}`;if(Yq(e))return`${r}>=${Qq(e.gte,i)}`;if(Xq(e))return`indexof([${function(e,t){return e.map((e=>Qq(e,t)))}(e.oneOf,i).join(",")}], ${r}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return Kq(r,e.valid);if(Vq(e)){const{range:n}=e,o=EU(n)?{signal:`${n.signal}[0]`}:n[0],a=EU(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==o&&null!==a&&t)return"inrange("+r+", ["+Qq(o,i)+", "+Qq(a,i)+"])";const s=[];return null!==o&&s.push(`${r} >= ${Qq(o,i)}`),null!==a&&s.push(`${r} <= ${Qq(a,i)}`),s.length>0?s.join(" && "):"true"}throw new Error(`Invalid field predicate: ${_B(e)}`)}function Kq(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function eW(e){return Jq(e)&&e.timeUnit?{...e,timeUnit:Iq(e.timeUnit)?.unit}:e}const tW={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function nW(e){return"ordinal"===e||"nominal"===e}const iW=tW.quantitative,rW=tW.ordinal,oW=tW.temporal,aW=tW.nominal,sW=tW.geojson;RB(tW);const lW={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},uW={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 cW(e,t){const n=uW[e],i=uW[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}RB(uW);const fW={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 dW(e){return fW[e]}const hW=new Set(["linear","log","pow","sqrt","symlog"]),pW=new Set([...hW,"time","utc"]);function mW(e){return hW.has(e)}const gW=new Set(["quantile","quantize","threshold"]),yW=new Set([...pW,...gW,"sequential","identity"]),vW=new Set(["ordinal","bin-ordinal","point","band"]);function bW(e){return vW.has(e)}function xW(e){return yW.has(e)}function _W(e){return pW.has(e)}function wW(e){return gW.has(e)}function kW(e){return e?.param}new Set(["time","utc"]);const EW={type:1,domain:1,domainMax:1,domainMin:1,domainMid: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},{type:$W,domain:AW,range:DW,rangeMax:SW,rangeMin:MW,scheme:CW,...FW}=(RB(EW),EW),OW=RB(FW);function NW(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 _W(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return _W(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"clamp":return _W(e);case"nice":return _W(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return xW(e)&&!EB(["log","time","utc","threshold","quantile"],e)}}function TW(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Vj(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"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 zW={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"},RW=zW.arc,PW=zW.area,LW=zW.bar,BW=zW.image,jW=zW.line,IW=zW.point,UW=zW.rect,qW=zW.rule,WW=zW.text,HW=zW.tick,GW=zW.trail,YW=zW.circle,VW=zW.square,XW=zW.geoshape;function JW(e){return["line","area","trail"].includes(e)}function QW(e){return["rect","bar","image","arc"].includes(e)}const ZW=new Set(RB(zW));function KW(e){return e.type}const eH=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],tH=RB({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),nH=RB({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 iH(e){return e&&null!=e.band}const rH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]};function oH(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=cH(e);return UH(n)&&!fU(n.aggregate)&&r&&_W(r.get("type"))?function({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(JW(n.type))return i;return null===BU("invalid",n,r)?[aH(e,t),i]:i}({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function aH(e,t){return{test:sH(e,!0),..."y"===cI(t)?{field:{group:"height"}}:{value:0}}}function sH(e,t=!0){return Kq(vt(e)?e:nG(e,{expr:"datum"}),!t)}function lH(e,t,n,i){const r={};if(t&&(r.scale=t),WH(e)){const{datum:t}=e;Dq(t)?r.signal=Nq(t):EU(t)?r.signal=t.signal:xU(t)?r.signal=t.expr:r.value=t}else r.field=nG(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function uH({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,bandPosition:o=.5}){const a=0<o&&o<1?"datum":void 0,s=nG(t,{expr:a,suffix:r}),l=void 0!==n?nG(n,{expr:a}):nG(t,{suffix:"end",expr:a}),u={};if(0===o||1===o){u.scale=e;const t=0===o?s:l;u.field=t}else{const t=EU(o)?`${o.signal} * ${s} + (1-${o.signal}) * ${l}`:`${o} * ${s} + ${1-o} * ${l}`;u.signal=`scale("${e}", ${t})`}return i&&(u.offset=i),u}function cH({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:l,defaultRef:u,bandPosition:c}){if(t){if(VH(t)){const u=a?.get("type");if(XH(t)){c??(c=zH({fieldDef:t,fieldDef2:n,markDef:i,config:r}));const{bin:a,timeUnit:f,type:d}=t;if(mU(a)||c&&f&&d===oW)return s?.impute?lH(t,o,{binSuffix:"mid"},{offset:l}):c&&!bW(u)?uH({scaleName:o,fieldOrDatumDef:t,bandPosition:c,offset:l}):lH(t,o,_G(t,e)?{binSuffix:"range"}:{},{offset:l});if(gU(a)){if(UH(n))return uH({scaleName:o,fieldOrDatumDef:t,fieldOrDatumDef2:n,bandPosition:c,offset:l});Aq(kq(e===lj?cj:fj))}}return lH(t,o,bW(u)?{binSuffix:"range"}:{},{offset:l,band:"band"===u?c??t.bandPosition??.5:void 0})}if(JH(t)){const n=l?{offset:l}:{};return{...fH(e,t.value),...n}}}return Ve(u)&&(u=u()),u?{...u,...l?{offset:l}:{}}:u}function fH(e,t){return EB(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:EB(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:NU(t)}function dH(e){return e&&"number"!==e&&"time"!==e}function hH(e,t,n){return`${e}(${t}${n?`, ${_B(n)}`:""})`}const pH=" – ";function mH({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o}){if(dH(n))return yH({fieldOrDatumDef:e,format:t,formatType:n,expr:i,config:o});const a=gH(e,i,r),s=qH(e);if(void 0===t&&void 0===n&&o.customFormatTypes){if("quantitative"===s){if(r&&o.normalizedNumberFormatType)return yH({fieldOrDatumDef:e,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:i,config:o});if(o.numberFormatType)return yH({fieldOrDatumDef:e,format:o.numberFormat,formatType:o.numberFormatType,expr:i,config:o})}if("temporal"===s&&o.timeFormatType&&UH(e)&&void 0===e.timeUnit)return yH({fieldOrDatumDef:e,format:o.timeFormat,formatType:o.timeFormatType,expr:i,config:o})}if(vG(e)){const n=function({field:e,timeUnit:t,format:n,formatType:i,rawTimeFormat:r,isUTCScale:o}){return!t||n?!t&&i?`${i}(${e}, '${n}')`:`${o?"utc":"time"}Format(${e}, '${n=vt(n)?n:r}')`:function(e,t,n){if(!e)return;const i=jq(e);return`${n||Rq(e)?"utc":"time"}Format(${t}, ${i})`}(t,e,o)}({field:a,timeUnit:UH(e)?Iq(e.timeUnit)?.unit:void 0,format:t,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:QH(e)&&e.scale?.type===lW.UTC});return n?{signal:n}:void 0}return t=xH({type:s,specifiedFormat:t,config:o,normalizeStack:r}),UH(e)&&mU(e.bin)?{signal:kH(a,nG(e,{expr:i,binSuffix:"end"}),t,n,o)}:t||"quantitative"===qH(e)?{signal:`${_H(a,t)}`}:{signal:`isValid(${a}) ? ${a} : ""+${a}`}}function gH(e,t,n){return UH(e)?n?`${nG(e,{expr:t,suffix:"end"})}-${nG(e,{expr:t,suffix:"start"})}`:nG(e,{expr:t}):function(e){const{datum:t}=e;return Dq(t)?Nq(t):`${_B(t)}`}(e)}function yH({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o,field:a}){return a??(a=gH(e,i,r)),"datum.value"!==a&&UH(e)&&mU(e.bin)?{signal:kH(a,nG(e,{expr:i,binSuffix:"end"}),t,n,o)}:{signal:hH(n,a,t)}}function vH(e,t,n,i,r,o){if(!vt(i)||!dH(i)){if(void 0===n&&void 0===i&&r.customFormatTypes&&"quantitative"===qH(e)){if(r.normalizedNumberFormatType&&ZH(e)&&"normalize"===e.stack)return;if(r.numberFormatType)return}if(ZH(e)&&"normalize"===e.stack&&r.normalizedNumberFormat)return xH({type:"quantitative",config:r,normalizeStack:!0});if(vG(e)){const t=UH(e)?Iq(e.timeUnit)?.unit:void 0;if(void 0===t&&r.customFormatTypes&&r.timeFormatType)return;return function({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:i}){return e||(t?{signal:jq(t)}:i?void 0:n.timeFormat)}({specifiedFormat:n,timeUnit:t,config:r,omitTimeFormatConfig:o})}return xH({type:t,specifiedFormat:n,config:r})}}function bH(e,t,n){return e&&(EU(e)||"number"===e||"time"===e)?e:vG(t)&&"time"!==n&&"utc"!==n?UH(t)&&Iq(t?.timeUnit)?.utc?"utc":"time":void 0}function xH({type:e,specifiedFormat:t,config:n,normalizeStack:i}){return vt(t)?t:e===iW?i?n.normalizedNumberFormat:n.numberFormat:void 0}function _H(e,t){return`format(${e}, "${t||""}")`}function wH(e,t,n,i){return dH(n)?hH(n,e,t):_H(e,(vt(t)?t:void 0)??i.numberFormat)}function kH(e,t,n,i,r){if(void 0===n&&void 0===i&&r.customFormatTypes&&r.numberFormatType)return kH(e,t,r.numberFormat,r.numberFormatType,r);const o=wH(e,n,i,r),a=wH(t,n,i,r);return`${Kq(e,!1)} ? "null" : ${o} + "${pH}" + ${a}`}const EH="min",$H={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function AH(e){return e in $H}function DH(e){return!!e?.encoding}function SH(e){return e&&("count"===e.op||!!e.field)}function MH(e){return e&&_e(e)}function CH(e){return"row"in e||"column"in e}function FH(e){return!!e&&"header"in e}function OH(e){return"facet"in e}function NH(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...r?{aggregate:r}:{},field:t}}function TH(e){return"sort"in e}function zH({fieldDef:e,fieldDef2:t,markDef:n,config:i}){if(VH(e)&&void 0!==e.bandPosition)return e.bandPosition;if(UH(e)){const{timeUnit:r,bin:o}=e;if(r&&!t)return QW(n.type)?0:jU("timeUnitBandPosition",n,i);if(mU(o))return.5}}function RH({channel:e,fieldDef:t,fieldDef2:n,markDef:i,config:r,scaleType:o,useVlSizeChannel:a}){const s=hI(e),l=BU(a?"size":s,i,r,{vgChannel:s});if(void 0!==l)return l;if(UH(t)){const{timeUnit:e,bin:a}=t;if(e&&!n)return{band:jU("timeUnitBandSize",i,r)};if(mU(a)&&!bW(o))return{band:1}}return QW(i.type)?o?bW(o)?r[i.type]?.discreteBandSize||{band:1}:r[i.type]?.continuousBandSize:r[i.type]?.discreteBandSize:void 0}function PH(e,t,n,i){return!!(mU(e.bin)||e.timeUnit&&XH(e)&&"temporal"===e.type)&&void 0!==zH({fieldDef:e,fieldDef2:t,markDef:n,config:i})}function LH(e){return e&&!!e.sort&&!e.field}function BH(e){return e&&"condition"in e}function jH(e){const t=e?.condition;return!!t&&!_e(t)&&UH(t)}function IH(e){const t=e?.condition;return!!t&&!_e(t)&&VH(t)}function UH(e){return e&&(!!e.field||"count"===e.aggregate)}function qH(e){return e?.type}function WH(e){return e&&"datum"in e}function HH(e){return XH(e)&&!iG(e)||YH(e)}function GH(e){return XH(e)&&"quantitative"===e.type&&!e.bin||YH(e)}function YH(e){return WH(e)&&gt(e.datum)}function VH(e){return UH(e)||WH(e)}function XH(e){return e&&("field"in e||"count"===e.aggregate)&&"type"in e}function JH(e){return e&&"value"in e&&"value"in e}function QH(e){return e&&("scale"in e||"sort"in e)}function ZH(e){return e&&("axis"in e||"stack"in e||"impute"in e)}function KH(e){return e&&"legend"in e}function eG(e){return e&&("format"in e||"formatType"in e)}function tG(e){return xB(e,["legend","axis","header","scale"])}function nG(e,t={}){let n=e.field;const i=t.prefix;let r=t.suffix,o="";if(function(e){return"count"===e.aggregate}(e))n=tj("count");else{let i;if(!t.nofn)if(function(e){return"op"in e}(e))i=e.op;else{const{bin:a,aggregate:s,timeUnit:l}=e;mU(a)?(i=pU(a),r=(t.binSuffix??"")+(t.suffix??"")):s?lU(s)?(o=`["${n}"]`,n=`argmax_${s.argmax}`):sU(s)?(o=`["${n}"]`,n=`argmin_${s.argmin}`):i=String(s):l&&(i=function(e){const{utc:t,...n}=Iq(e);return n.unit?(t?"utc":"")+RB(n).map((e=>jB(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+RB(n).map((e=>jB(`_${e}_${n[e]}`))).join("")}(l),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?XB(n):t.expr?HB(n,t.expr)+o:YB(n)+o}function iG(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return UH(e)&&!!e.bin;case"temporal":return!1}throw new Error(sq(e.type))}const rG=(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(lU(t))return`${r} for argmax(${t.argmax})`;if(sU(t))return`${r} for argmin(${t.argmin})`;const o=Iq(i),a=t||o?.unit||o?.maxbins&&"timeunit"||mU(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(mU(i))return`${n} (binned)`;if(r){const e=Iq(r)?.unit;if(e)return`${n} (${Lq(e).join("-")})`}else if(o)return lU(o)?`${n} for max ${o.argmax}`:sU(o)?`${n} for min ${o.argmin}`:`${qB(o)} of ${n}`;return n}(e,t)}};let oG=rG;function aG(e){oG=e}function sG(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=lG(e)?.title;if(!UH(e))return r??e.title;const o=e,a=i?uG(o,t):void 0;return n?QB(r,o.title,a):r??o.title??a}function lG(e){return ZH(e)&&e.axis?e.axis:KH(e)&&e.legend?e.legend:FH(e)&&e.header?e.header:void 0}function uG(e,t){return oG(e,t)}function cG(e){if(eG(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=lG(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function fG(e){return UH(e)?e:jH(e)?e.condition:void 0}function dG(e){return VH(e)?e:IH(e)?e.condition:void 0}function hG(e,t,n,i={}){return vt(e)||gt(e)||ht(e)?(Aq(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${_B(n)}}.`}(t,vt(e)?"string":gt(e)?"number":"boolean",e)),{value:e}):VH(e)?pG(e,t,n,i):IH(e)?{...e,condition:pG(e.condition,t,n,i)}:e}function pG(e,t,n,i){if(eG(e)){const{format:r,formatType:o,...a}=e;if(dH(o)&&!n.customFormatTypes)return Aq(rq(t)),pG(a,t,n,i)}else{const r=ZH(e)?"axis":KH(e)?"legend":FH(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(dH(a)&&!n.customFormatTypes)return Aq(rq(t)),pG({...e,[r]:s},t,n,i)}}return UH(e)?mG(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=gt(n)?"quantitative":vt(n)?"nominal":Dq(n)?"temporal":void 0,{...e,type:t}}(e)}function mG(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||uU(i)||lU(i)||sU(i)||(Aq(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=Iq(r)),a&&(s.field=`${a}`),mU(o)&&(s.bin=gG(o,t)),gU(o)&&!RI(t)&&Aq(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),XH(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case iW:return"quantitative";case"t":case oW:return"temporal";case"o":case rW:return"ordinal";case"n":case aW:return"nominal";case sW:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&fU(i)&&(Aq(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!uI(t)){const e=function(e,t){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(TH(e)&&_e(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!lU(n)&&!sU(n))return"quantitative";if(QH(e)&&e.scale?.type)switch(uW[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(XH(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 oj:case aj:case sj:return iG(e)?yG:{compatible:!1,warning:dq(t)};case lj:case uj:case dj:case hj:case wj:case kj:case Ej:case Nj:case zj:case Rj:case Pj:case Lj:case Bj:case Dj:case gj:case pj:case jj:return yG;case bj:case _j:case vj:case xj:return n!==iW?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:yG;case Sj:case Mj:case Cj:case Fj:case Aj:case yj:case mj:case cj:case fj:return"nominal"!==n||e.sort?yG:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case $j:case Oj:return iG(e)||function(e){return QH(e)&&wW(e.scale?.type)}(e)?yG:{compatible:!1,warning:hq(t)};case Tj:return"nominal"!==e.type||"sort"in e?yG:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,t)||{};!1===e&&Aq(n)}if(TH(s)&&vt(s.sort)){const{sort:e}=s;if(AH(e))return{...s,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&AH(t))return{...s,sort:{encoding:t,order:"descending"}}}if(FH(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 gG(e,t){return ht(e)?{maxbins:bU(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:bU(t)}}const yG={compatible:!0};function vG(e){const{formatType:t}=cG(e);return"time"===t||!t&&function(e){return e&&("temporal"===e.type||UH(e)&&!!e.timeUnit)}(e)}function bG(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const o=t&&Iq(t)?.unit;let a,s=o||"temporal"===n;return xU(e)?a=e.expr:EU(e)?a=e.signal:Dq(e)?(s=!0,a=Nq(e)):(vt(e)||gt(e))&&s&&(a=`datetime(${_B(e)})`,function(e){return!!Tq[e]}(o)&&(gt(e)&&e<1e4||vt(e)&&isNaN(Date.parse(e)))&&(a=Nq({[o]:e}))),a?i&&s?`time(${a})`:a:r?void 0:_B(e)}function xG(e,t){const{type:n}=e;return t.map((t=>{const i=bG(t,{timeUnit:UH(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function _G(e,t){return mU(e.bin)?eU(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const wG={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 kG(e){return e?.condition}const EG=["domain","grid","labels","ticks","title"],$G={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"},AG={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},DG={...AG,style:1,labelExpr:1,encoding:1};function SG(e){return!!DG[e]}RB(DG);const MG=RB({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 CG(e){return"mark"in e}class FG{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!CG(e)&&function(e){return KW(e)?e.type:e}(e.mark)===this.name}}function OG(e,t){const n=e&&e[t];return!!n&&(_e(n)?$B(n,(e=>!!e.field)):UH(n)||jH(n))}function NG(e,t){const n=e&&e[t];return!!n&&(_e(n)?$B(n,(e=>!!e.field)):UH(n)||WH(n)||IH(n))}function TG(e,t){if(RI(t)){const n=e[t];if((UH(n)||WH(n))&&(nW(n.type)||UH(n)&&n.timeUnit))return NG(e,mI(t))}return!1}function zG(e){return $B(Zj,(t=>{if(OG(e,t)){const n=e[t];if(_e(n))return $B(n,(e=>!!e.aggregate));{const e=fG(n);return e&&!!e.aggregate}}return!1}))}function RG(e,t){const n=[],i=[],r=[],o=[],a={};return BG(e,((s,l)=>{if(UH(s)){const{field:u,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const e=lG(s),p=e?.title;let m=nG(s,{forAs:!0});const g={...p?[]:{title:sG(s,t,{allowDisabling:!0})},...h,field:m};if(c){let e;if(lU(c)?(e="argmax",m=nG({op:"argmax",field:c.argmax},{forAs:!0}),g.field=`${m}.${u}`):sU(c)?(e="argmin",m=nG({op:"argmin",field:c.argmin},{forAs:!0}),g.field=`${m}.${u}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:m};u&&(t.field=u),o.push(t)}}else if(n.push(m),XH(s)&&mU(f)){if(i.push({bin:f,field:u,as:m}),n.push(nG(s,{binSuffix:"end"})),_G(s,l)&&n.push(nG(s,{binSuffix:"range"})),RI(l)){const e={field:`${m}_end`};a[`${l}2`]=e}g.bin="binned",uI(l)||(g.type=iW)}else if(d){r.push({timeUnit:d,field:u,as:m});const e=XH(s)&&s.type!==oW&&"time";e&&(l===Nj||l===Pj?g.formatType=e:function(e){return!!OI[e]}(l)?g.legend={formatType:e,...g.legend}:RI(l)&&(g.axis={formatType:e,...g.axis}))}a[l]=g}else n.push(u),a[l]=e[l]}else a[l]=e[l]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function PG(e,t,n){const i=function(e,t){return function(e){switch(e){case wj:case kj:case Ej:case jj:case zj:case Rj:case Pj:case Lj:case Tj:case Sj:case Mj:case Cj:case Fj:case sj:case oj:case aj:return tU;case lj:case uj:case dj:case hj:case vj:case bj:return iU;case cj:case fj:case xj:case _j:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Aj:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Oj:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case $j:return{point:"always",geoshape:"always"};case Nj:return{text:"always"};case Dj:return{point:"always",square:"always",text:"always"};case Bj:return{image:"always"};case gj:case pj:return{text:"always",arc:"always"};case yj:case mj:return{arc:"always"}}}(e)[t]}(t,n);if(!i)return!1;if("binned"===i){const n=e[t===cj?lj:uj];return!!(UH(n)&&UH(e[t])&&gU(n.bin))}return!0}function LG(e,t){const n={};for(const i of RB(e)){const r=hG(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function BG(e,t,n){if(e)for(const i of RB(e)){const r=e[i];if(_e(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function jG(e,t){return RB(t).reduce(((n,i)=>{switch(i){case lj:case uj:case Lj:case jj:case Bj:case cj:case fj:case dj:case hj:case gj:case yj:case pj:case mj:case vj:case bj:case xj:case _j:case Nj:case $j:case Dj:case Pj:return n;case Tj:if("line"===e||"trail"===e)return n;case zj:case Rj:{const e=t[i];if(_e(e)||UH(e))for(const t of Ge(e))t.aggregate||n.push(nG(t,{}));return n}case Aj:if("trail"===e)return n;case wj:case kj:case Ej:case Sj:case Mj:case Cj:case Oj:case Fj:{const e=fG(t[i]);return e&&!e.aggregate&&n.push(nG(e,{})),n}}}),[])}function IG(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${UG(t)}`:"";return{field:e+t.field,type:t.type,title:EU(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),o=function(e){const t=[];for(const n of RB(e))if(OG(e,n)){const i=Ge(e[n]);for(const e of i)UH(e)?t.push(e):jH(e)&&t.push(e.condition)}return t}(n).map(tG);return{tooltip:[...r,...MB(o,wB)]}}function UG(e){const{title:t,field:n}=e;return QB(t,n)}function qG(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:l,positionPrefix:u,endPositionPrefix:c,extraEncoding:f={}})=>{const d=UG(n);return WG(e,s,r,{mark:l,encoding:{[t]:{field:`${u}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...vt(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function WG(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}:{},...KW(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...ht(e[t])?{}:e[t]}}]:[]}function HG(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:GG(o,n),continuousAxisChannelDef2:GG(a,n),continuousAxisChannelDefError:GG(s,n),continuousAxisChannelDefError2:GG(l,n),continuousAxis:r}}function GG(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&Aq(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function YG(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(KW(n)&&n.orient)return n.orient;if(HH(r)){if(HH(o)){const e=UH(r)&&r.aggregate,n=UH(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 vG(o)&&!vG(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(HH(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const VG="boxplot",XG=new FG(VG,QG);function JG(e){return gt(e)?"tukey":e}function QG(e,{config:t}){e={...e,encoding:LG(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=KW(n)?n:{type:n};r&&Aq(tq("boxplot"));const l=s.extent??t.boxplot.extent,u=BU("size",s,t),c=s.invalid,f=JG(l),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:w}=function(e,t,n){const i=YG(e,VG),{continuousAxisChannelDef:r,continuousAxis:o}=HG(e,i,VG),a=r.field,s=JG(t),l=[...ZG(a),{op:"median",field:a,as:`mid_box_${a}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+a}],u="min-max"===s||"tukey"===s?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:`iqr_${a}`},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,as:`upper_whisker_${a}`},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,as:`lower_whisker_${a}`}],{[o]:c,...f}=e.encoding,{customTooltipWithoutAggregatedField:d,filteredEncoding:h}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(_e(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 _e(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(f),{bins:p,timeUnits:m,aggregate:g,groupby:y,encoding:v}=RG(h,n),b="vertical"===i?"horizontal":"vertical",x=i;return{bins:p,timeUnits:m,transform:[...p,...m,{aggregate:[...g,...l],groupby:y},...u],groupby:y,aggregate:g,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:v,ticksOrient:b,boxOrient:x,customTooltipWithoutAggregatedField:d}}(e,l,t),{color:k,size:E,...$}=b,A=e=>qG(s,g,m,e,t.boxplot),D=A($),S=A(b),M=A({...$,...E?{size:E}:{}}),C=IG([{fieldPrefix:"min-max"===f?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===f?"lower_whisker_":"min_",titlePrefix:"Min"}],m,b),F={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},O="min-max"===f?C:IG([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,b),N=[...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:O}),...D({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"lower_whisker",extraEncoding:O}),...D({partName:"ticks",mark:F,positionPrefix:"upper_whisker",extraEncoding:O})],T=[..."tukey"!==f?N:[],...S({partName:"box",mark:{type:"bar",...u?{size:u}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:C}),...M({partName:"median",mark:{type:"tick",invalid:c,...we(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...u?{size:u}:{},orient:x,aria:!1},positionPrefix:"mid_box",extraEncoding:C})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(p),layer:T};const z=`datum["lower_box_${m.field}"]`,R=`datum["upper_box_${m.field}"]`,P=`(${R} - ${z})`,L=`${z} - ${l} * ${P}`,B=`${R} + ${l} * ${P}`,j=`datum["${m.field}"]`,I={joinaggregate:ZG(m.field),groupby:y},U={transform:[{filter:`(${L} <= ${j}) && (${j} <= ${B})`},{aggregate:[{op:"min",field:m.field,as:`lower_whisker_${m.field}`},{op:"max",field:m.field,as:`upper_whisker_${m.field}`},{op:"min",field:`lower_box_${m.field}`,as:`lower_box_${m.field}`},{op:"max",field:`upper_box_${m.field}`,as:`upper_box_${m.field}`},...v],groupby:y}],layer:N},{tooltip:q,...W}=$,{scale:H,axis:G}=m,Y=UG(m),V=xB(G,["title"]),X=WG(s,"outliers",t.boxplot,{transform:[{filter:`(${j} < ${L}) || (${j} > ${B})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...void 0!==Y?{title:Y}:{},...void 0!==H?{scale:H}:{},...zB(V)?{}:{axis:V}},...W,...k?{color:k}:{},...w?{tooltip:w}:{}}})[0];let J;const Q=[...d,...h,I];return X?J={transform:Q,layer:[X,U]}:(J=U,J.transform.unshift(...Q)),{...a,layer:[J,{transform:p,layer:T}]}}function ZG(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const KG="errorbar",eY=new FG(KG,tY);function tY(e,{config:t}){e={...e,encoding:LG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:l,tooltipEncoding:u}=nY(e,KG,t);delete o.size;const c=qG(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:u}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:u}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...l,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function nY(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=KW(i)?i:{type:i};o&&Aq(tq(t));const{orient:u,inputType:c}=function(e,t){const{encoding:n}=e;if(function(e){return(VH(e.x)||VH(e.y))&&!VH(e.x2)&&!VH(e.y2)&&!VH(e.xError)&&!VH(e.xError2)&&!VH(e.yError)&&!VH(e.yError2)}(n))return{orient:YG(e,t),inputType:"raw"};const i=function(e){return VH(e.x2)||VH(e.y2)}(n),r=function(e){return VH(e.xError)||VH(e.xError2)||VH(e.yError)||VH(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(VH(e)&&VH(i))throw new Error(`${t} cannot have both x2 and y2`);if(VH(e)){if(HH(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(VH(i)){if(HH(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(VH(i)&&!VH(e))throw new Error(`${t} cannot have xError2 without xError`);if(VH(s)&&!VH(r))throw new Error(`${t} cannot have yError2 without yError`);if(VH(e)&&VH(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(VH(e)){if(HH(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(VH(r)){if(HH(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")}}(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=HG(e,u,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],u=[];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)&&Aq(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],u=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:`upper_${c}`},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:qB(t)},{fieldPrefix:"upper_",titlePrefix:iY(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:iY(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{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:sG({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:sG({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:sG({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Aq(function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}(e.center,e.extent)),"aggregated-upper-lower"===o?(f=[],u=[{calculate:`datum["${n.field}"]`,as:`upper_${c}`},{calculate:`datum["${c}"]`,as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],u=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:`upper_${c}`}],r?u.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:`lower_${c}`}):u.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:`lower_${c}`}));for(const e of u)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:VB(VB(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:u,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:_,["x"===m?"xError":"yError"]:w,["x"===m?"xError2":"yError2"]:k,...E}=r,{bins:$,timeUnits:A,aggregate:D,groupby:S,encoding:M}=RG(E,n),C=[...D,...g],F="raw"!==c?[]:S,O=IG(v,f,M,b);return{transform:[...s.transform??[],...$,...A,...0===C.length?[]:[{aggregate:C,groupby:F}],...y],groupby:F,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:M,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:O}}function iY(e,t,n){return`${qB(e)} ${n} ${t}`}const rY="errorband",oY=new FG(rY,aY);function aY(e,{config:t}){e={...e,encoding:LG(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:l}=nY(e,rY,t),u=a,c=qG(u,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={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):u.interpolate?Aq(wq("interpolate")):u.tension&&Aq(wq("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:l})]}}const sY={};function lY(e,t,n){const i=new FG(e,t);sY[e]={normalizer:i,parts:n}}lY(VG,QG,["box","median","outliers","rule","ticks"]),lY(KG,tY,["ticks","rule"]),lY(rY,aY,["band","borders"]);const uY=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],cY={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"},fY={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"},dY=RB(cY),hY=RB(fY),pY=RB({header:1,headerRow:1,headerColumn:1,headerFacet:1}),mY=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],gY={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},yY=(RB(gY),"_vgsid_"),vY={point:{on:"click",fields:[yY],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function bY(e){return"legend"===e||!!e?.legend}function xY(e){return bY(e)&&we(e)}function _Y(e){return!!e?.select}function wY(e){const t=[];for(const n of e||[]){if(_Y(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 kY(e){return"concat"in e}function EY(e){return"vconcat"in e}function $Y(e){return"hconcat"in e}function AY({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function DY(e){return we(e)&&void 0!==e.step}function SY(e){return e.view||e.width||e.height}const MY=RB({align:1,bounds:1,center:1,columns:1,spacing:1});function CY(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function FY(e,t){const n=OY(e,t);return DY(n)?n.step:NY}function OY(e,t){return QB(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const NY=20,TY={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:NY},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:{binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},circle:{},geoshape:{},image:{},line:{},point:{},rect:{binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5},rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},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,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:vY,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},zY=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],RY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},PY={blue:zY[0],orange:zY[1],red:zY[2],teal:zY[3],green:zY[4],yellow:zY[5],purple:zY[6],pink:zY[7],brown:zY[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 LY(e){const t=RB(e||{}),n={};for(const i of t){const t=e[i];n[i]=kG(t)?CU(t):FU(t)}return n}const BY=[...nH,...MG,...pY,"background","padding","legend","lineBreak","scale","style","title","view"];function jY(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=Ee({},yB(TY),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:we(e)?{...PY,...e}:PY}],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:we(e)?{...RY,...e}:RY}],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&&$e(a,"selection",r,!0);const s=xB(a,BY);for(const e of["background","lineBreak","padding"])a[e]&&(s[e]=FU(a[e]));for(const e of nH)a[e]&&(s[e]=_U(a[e]));for(const e of MG)a[e]&&(s[e]=LY(a[e]));for(const e of pY)a[e]&&(s[e]=_U(a[e]));return a.legend&&(s.legend=_U(a.legend)),a.scale&&(s.scale=_U(a.scale)),a.style&&(s.style=function(e){const t=RB(e),n={};for(const i of t)n[i]=LY(e[i]);return n}(a.style)),a.title&&(s.title=_U(a.title)),a.view&&(s.view=_U(a.view)),s}const IY=new Set(["view",...ZW]),UY=["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"],qY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]};function WY(e,t,n,i){"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[n??t]};zB(r)||(e.style[n??t]=r),i||delete e[t]}function HY(e){return"layer"in e}class GY{map(e,t){return OH(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):$Y(e)?this.mapHConcat(e,t):EY(e)?this.mapVConcat(e,t):kY(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(HY(e))return this.mapLayer(e,t);if(CG(e))return this.mapUnit(e,t);throw new Error(YU(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 YY={zero:1,center:1,normalize:1},VY=new Set([RW,LW,PW,qW,IW,YW,VW,jW,WW,HW]),XY=new Set([LW,PW,RW]);function JY(e){return UH(e)&&"quantitative"===qH(e)&&!e.bin}function QY(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t,a=e[t],s=e[r];if(UH(a)&&UH(s))if(JY(a)&&JY(s)){if(a.stack)return t;if(s.stack)return r;const e=UH(a)&&!!a.aggregate;if(e!==(UH(s)&&!!s.aggregate))return e?t:r;if(o&&"bar"===i){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(JY(a))return t;if(JY(s))return r}else{if(JY(a))return t;if(JY(s))return r}}function ZY(e,t){const n=KW(e)?e:{type:e},i=n.type;if(!VY.has(i))return null;const r=QY(t,"x",n)||QY(t,"theta",n);if(!r)return null;const o=t[r],a=UH(o)?nG(o,{}):void 0,s=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),l=[],u=new Set;if(t[s]){const e=t[s],n=UH(e)?nG(e,{}):void 0;n&&n!==a&&(l.push(s),u.add(n));const i="x"===s?"xOffset":"yOffset",r=t[i],o=UH(r)?nG(r,{}):void 0;o&&o!==a&&(l.push(i),u.add(o))}const c=NI.reduce(((e,n)=>{if("tooltip"!==n&&OG(t,n)){const i=t[n];for(const t of Ge(i)){const i=fG(t);if(i.aggregate)continue;const r=nG(i,{});r&&u.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let f;return void 0!==o.stack?f=ht(o.stack)?o.stack?"zero":null:o.stack:XY.has(i)&&(f="zero"),f&&f in YY?zG(t)&&0===c.length?null:o?.scale?.type&&o?.scale?.type!==lW.LINEAR?(o?.stack&&Aq(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type)),null):VH(t[dI(r)])?(void 0!==o.stack&&Aq(`Cannot stack "${d=r}" if there is already "${d}2".`),null):(UH(o)&&o.aggregate&&!dU.has(o.aggregate)&&Aq(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:l,groupbyFields:u,fieldChannel:r,impute:null!==o.impute&&JW(i),stackBy:c,offset:f}):null;var d}function KY(e){const{point:t,line:n,...i}=e;return RB(i).length>1?i:i.type}function eV(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:xB(e[t],["point","line"])});return e}function tV(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?we(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?we(t.point)?t.point:{}:void 0}function nV(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 iV{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(CG(e)){const{mark:n,encoding:i}=e,r=KW(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!tV(r,t[r.type],i);case"area":return!!tV(r,t[r.type],i)||!!nV(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...u}=e,c=LG(l,i),f=KW(a)?a:{type:a},d=tV(f,i[f.type],c),h="area"===f.type&&nV(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:KY({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:xB(c,["shape"])}],m=ZY(f,c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=xB(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...bB(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...bB(f,["clip","tooltip"]),...d},encoding:g}),n({...u,layer:p},{...t,config:eV(i)})}}function rV(e,t){return t?CH(e)?cV(e,t):sV(e,t):e}function oV(e,t){return t?cV(e,t):e}function aV(e,t,n){const i=t[e];return function(e){return e&&!vt(e)&&"repeat"in e}(i)?i.repeat in n?{...t,[e]:n[i.repeat]}:void Aq(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function sV(e,t){if(void 0!==(e=aV("field",e,t))){if(null===e)return null;if(TH(e)&&SH(e.sort)){const n=aV("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function lV(e,t){if(UH(e))return sV(e,t);{const n=aV("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function uV(e,t){if(!VH(e)){if(IH(e)){const n=lV(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=lV(e,t);if(n)return n;if(BH(e))return{condition:e.condition}}}function cV(e,t){const n={};for(const i in e)if(st(e,i)){const r=e[i];if(_e(r))n[i]=r.map((e=>uV(e,t))).filter((e=>e));else{const e=uV(r,t);void 0!==e&&(n[i]=e)}}return n}class fV{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(CG(e)){const{encoding:t,mark:n}=e;if("line"===n||KW(n)&&"line"===n.type)for(const e of lI){const n=t[cI(e)];if(t[e]&&(UH(n)&&!gU(n.bin)||WH(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return Aq((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:we(r)?{...r,type:"rule"}:"rule"},t)}}function dV({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...RB(e),...RB(t)]);for(const o of r){const r=t[o],a=e[o];if(VH(r)){const e={...a,...r};i[o]=e}else IH(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||JH(a)||EU(a)||VH(a)||_e(a))&&(i[o]=a)}}else i=t;return!i||zB(i)?void 0:i}function hV(e){const{parentProjection:t,projection:n}=e;return t&&n&&Aq(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${_B(t)} is overridden by a child projection ${_B(n)}.`}({parentProjection:t,projection:n})),n??t}function pV(e){return"filter"in e}function mV(e){return void 0!==e?.stop}function gV(e){return"lookup"in e}function yV(e){return"pivot"in e}function vV(e){return"density"in e}function bV(e){return"quantile"in e}function xV(e){return"regression"in e}function _V(e){return"loess"in e}function wV(e){return"sample"in e}function kV(e){return"window"in e}function EV(e){return"joinaggregate"in e}function $V(e){return"flatten"in e}function AV(e){return"calculate"in e}function DV(e){return"bin"in e}function SV(e){return"impute"in e}function MV(e){return"timeUnit"in e}function CV(e){return"aggregate"in e}function FV(e){return"stack"in e}function OV(e){return"fold"in e}function NV(e,t){const{transform:n,...i}=e;if(n){const e=n.map((e=>{if(pV(e))return{filter:RV(e,t)};if(DV(e)&&yU(e.bin))return{...e,bin:zV(e.bin)};if(gV(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}));return{...i,transform:e}}return e}function TV(e,t){const n=yB(e);if(UH(n)&&yU(n.bin)&&(n.bin=zV(n.bin)),QH(n)&&n.scale?.domain?.selection){const{selection:e,...t}=n.scale.domain;n.scale.domain={...t,...e?{param:e}:{}}}if(BH(n))if(_e(n.condition))n.condition=n.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:RV(e,t)}}));else{const{selection:e,param:i,test:r,...o}=TV(n.condition,t);n.condition=i?n.condition:{...o,test:RV(n.condition,t)}}return n}function zV(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function RV(e,t){const n=e=>mB(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):mB(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class PV extends GY{map(e,t){const n=t.selections??[];if(e.params&&!CG(e)){const t=[];for(const i of e.params)_Y(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 t of n)if(t.views&&t.views.length)for(const n of t.views)(vt(n)&&(n===e.name||i.includes(n))||_e(n)&&n.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(t);else r.push(t);return r.length&&(e.params=r),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=PV.prototype[e];PV.prototype[e]=function(e,n){return t.call(this,e,LV(e,n))}}function LV(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function BV(e,t){void 0===t&&(t=jY(e.config));const n=function(e,t={}){const n={config:t};return UV.map(jV.map(IV.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=CG(e)||HY(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&&(Aq(XU("width")),i=void 0),"container"==r&&(Aq(XU("height")),r=void 0));const s={type:"pad",...a,...n?qV(n.autosize):{},...qV(e.autosize)};if("fit"!==s.type||o||(Aq(VU),s.type="pad"),"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&Aq(JU("width")),"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&Aq(JU("height")),!gB(s,{type:"pad"}))return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const jV=new class extends GY{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[XG,eY,oY,new iV,new fV]}map(e,t){if(CG(e)){const n=OG(e.encoding,oj),i=OG(e.encoding,aj),r=OG(e.encoding,sj);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=oV(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 e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!_e(e.repeat)&&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:l={},repeaterPrefix:u=""}=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={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+u}child__layer_${jB(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;!_e(n)&&e.columns&&(e=xB(e,["columns"]),Aq(nq("repeat")));const a=[],{repeater:s={},repeaterPrefix:l=""}=t,u=!_e(n)&&n.row||[s?s.row:null],c=!_e(n)&&n.column||[s?s.column:null],f=_e(n)&&n||[s?s.repeat:null];for(const e of f)for(const r of u)for(const o of c){const u={repeat:e,row:r,column:o,layer:s.layer},c=(i.name?`${i.name}_`:"")+l+"child__"+(_e(n)?`${jB(e)}`:(n.row?`row_${jB(r)}`:"")+(n.column?`column_${jB(o)}`:"")),f=this.map(i,{...t,repeater:u,repeaterPrefix:c});f.name=c,a.push(xB(f,["data"]))}const d=_e(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:d,concat:a}}mapFacet(e,t){const{facet:n}=e;return CH(n)&&e.columns&&(e=xB(e,["columns"]),Aq(nq("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=hV({parentProjection:o,projection:i}),l=dV({parentEncoding:r,encoding:oV(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:u,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=oV(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...u?{height:u}:{},...c?{view:c}:{},...l?{projection:l}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&Aq(`Facet encoding dropped as ${(o=[...n?[oj]:[],...i?[aj]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[oj,aj]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??(a[e]={}),a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:rV(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:dV({parentEncoding:t,encoding:r,layer:!0}),parentProjection:hV({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},IV=new class extends GY{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=NV(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=NV(e,t)).encoding){const n={};for(const[i,r]of LB(e.encoding))n[i]=TV(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:LB(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 n of PB(t.selectionPredicates[e]??{}))n.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},UV=new PV;function qV(e){return vt(e)?{type:e}:e??{}}const WV=["background","padding"];function HV(e,t){const n={};for(const t of WV)e&&void 0!==e[t]&&(n[t]=FU(e[t]));return t&&(n.params=e.params),n}class GV{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new GV(yB(this.explicit),yB(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return QB(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 RB(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function YV(e){return{explicit:!0,value:e}}function VV(e){return{explicit:!1,value:e}}function XV(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:JV(t,n,i,r)}}function JV(e,t,n,i){return e.explicit&&t.explicit&&Aq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${_B(n)} and ${_B(i)}). Using ${_B(n)}.`}(n,i,e.value,t.value)),e}function QV(e,t,n,i,r=JV){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:gB(e.value,t.value)?e:r(e,t,n,i)}class ZV extends GV{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 KV(e){return"url"in e}function eX(e){return"values"in e}function tX(e){return"name"in e&&!KV(e)&&!eX(e)&&!nX(e)}function nX(e){return e&&(iX(e)||rX(e)||oX(e))}function iX(e){return"sequence"in e}function rX(e){return"sphere"in e}function oX(e){return"graticule"in e}var aX;function sX(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=YB(r.field),r}function lX(e,t=!0,n=ue){if(_e(e)){const i=e.map((e=>lX(e,t,n)));return t?`[${i.join(", ")}]`:i}return Dq(e)?n(t?Nq(e):function(e){const t=Oq(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(_B(e)):e}function uX(e,t){for(const n of PB(e.component.selection??{})){const i=n.name;let r=`${i}${DJ}, ${"global"===n.resolve?"true":`{unit: ${FJ(e)}}`}`;for(const i of CJ)i.defined(n)&&(i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(r=i.modifyExpr(e,n,r)));t.push({name:i+SJ,on:[{events:{signal:n.name+DJ},update:`modify(${Dt(n.name+AJ)}, ${r})`}]})}return dX(t)}function cX(e,t){if(e.component.selection&&RB(e.component.selection).length){const n=Dt(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:zT("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return dX(t)}function fX(e,t){for(const n of PB(e.component.selection??{}))for(const i of CJ)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function dX(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}(aX||(aX={}));class hX{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)?Aq("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 t of this._children)t.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class pX extends hX{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 ${KB()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class mX extends hX{clone(){return new mX(null,yB(this.formula))}constructor(e,t){super(e),this.formula=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,t)=>{const{field:n,timeUnit:i}=t;if(i){const r=nG(t,{forAs:!0});e[wB({as:r,field:n,timeUnit:i})]={as:r,field:n,timeUnit:i}}return e}),{});return zB(n)?null:new mX(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Iq(n)};return new mX(e,{[wB(r)]:r})}merge(e){this.formula={...this.formula};for(const t in e.formula)this.formula[t]||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of LB(this.formula))e.has(i.as)||(t[n]=i);this.formula=t}producedFields(){return new Set(PB(this.formula).map((e=>e.as)))}dependentFields(){return new Set(PB(this.formula).map((e=>e.field)))}hash(){return`TimeUnit ${wB(this.formula)}`}assemble(){const e=[];for(const t of PB(this.formula)){const{field:n,as:i,timeUnit:r}=t,{unit:o,utc:a,...s}=Iq(r);e.push({field:YB(n),type:"timeunit",...o?{units:Lq(o)}:{},...a?{timezone:"utc"}:{},...s,as:[i,`${i}_end`]})}return e}}const gX="_tuple_fields";class yX{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const vX={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new yX),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=jB(`${i}_${n}`);for(let e=1;s.has(r);e++)r=jB(`${i}_${n}_${e}`);return s.add(r),{[t]:r}},u=t.type,c=e.config.selection[u],f=void 0!==n.value?Ge(n.value):null;let{fields:d,encodings:h}=we(n.select)?n.select:{};if(!d&&!h&&f)for(const e of f)if(we(e))for(const t of RB(e))aI[t]?(h||(h=[])).push(t):"interval"===u?(Aq('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=c.encodings):(d??(d=[])).push(t);d||h||(h=c.encodings,"fields"in c&&(d=c.fields));for(const t of h??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){Aq(eq(t,n.aggregate));continue}if(!i){Aq(KU(t));continue}if(n.timeUnit){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};a[wB(r)]=r}if(!o[i]){const a={field:i,channel:t,type:"interval"===u&&eU(t)&&xW(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:r.items.length};a.signals={...l(a,"data"),...l(a,"visual")},r.items.push(o[i]=a),r.hasField[i]=o[i],r.hasSelectionId=r.hasSelectionId||i===yY,Hj(t)?(a.geoChannel=t,a.channel=Wj(t),r.hasChannel[a.channel]=o[i]):r.hasChannel[t]=o[i]}}else Aq(KU(t))}for(const e of d??[]){if(r.hasField[e])continue;const t={type:"E",field:e,index:r.items.length};t.signals={...l(t,"data")},r.items.push(t),r.hasField[e]=t,r.hasSelectionId=r.hasSelectionId||e===yY}f&&(t.init=f.map((e=>r.items.map((t=>we(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),zB(a)||(r.timeUnit=new mX(null,a))},signals:(e,t,n)=>{const i=t.name+gX;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(sX)})}},bX=vX,xX={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(!eU(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&xW(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):Aq("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||kX(e)||0===i.length)return n;const r=n.filter((e=>e.name===t.name))[0];let o=r.update;if(o.indexOf(MJ)>=0)r.update=`{${i.map((e=>`${Dt(YB(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${Dt(YB(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&&!kX(e))for(const e of t.scales){const t=n.filter((t=>t.name===e.signals.data))[0];t.push="outer",delete t.value,delete t.update}return n}},_X=xX;function wX(e,t){return`domain(${Dt(e.scaleName(t))})`}function kX(e){return e.parent&&fK(e.parent)&&(!e.parent.parent??kX(e.parent.parent))}const EX="_brush",$X="_scale_trigger",AX="geo_interval_init_tick",DX="_init",SX={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...we(n.select)?n.select:{}};e.fields=[yY],e.encodings||(e.encodings=n.value?RB(n.value):[bj,vj]),n.select={type:"interval",...e}}if(t.translate&&!_X.defined(t)){const e=`!event.item || event.item.mark.name !== ${Dt(t.name+EX)}`;for(const n of t.events){if(!n.between){Aq(`${n} is not an ordered event stream for interval selections.`);continue}const t=Ge((i=n.between[0]).filter??(i.filter=[]));t.indexOf(e)<0&&t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+DJ,o=PB(t.project.hasChannel).filter((e=>e.channel===lj||e.channel===uj)),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=Dt(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${s}, ${e})`,u=e.getSizeSignalRef(o===lj?"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, ${u})]`}]),[]);if(r){const r=n.signals.data,u=_X.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:lX(i,!0,l)}:{value:[]};return f.push({events:{signal:t.name+$X},update:xW(d)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),u?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:lX(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===lj?0:1,n=t.name+DX;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=Dt(e.projectionName()),l=e.projectionName()+"_center",{x:u,y:c}=t.project.hasChannel,f=u&&u.signals.visual,d=c&&c.signals.visual,h=u?a&&a[u.index]:`${l}[0]`,p=c?a&&a[c.index]:`${l}[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+DX,init:`[scale(${s}, [${u?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${u?h[1]:h}, ${c?p[1]:p}])]`}),!u||!c)){n.find((e=>e.name===l))||n.unshift({name:l,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(intersect(${g}, {markname: ${Dt(e.getName("marks"))}}, unit.mark), {unit: ${FJ(e)}})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:AX}]:[]],update:y}]})}{if(!_X.defined(t)){const t=i+$X,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=Dt(e.scaleName(n)),a=xW(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)),l=`unit: ${FJ(e)}, fields: ${i+gX}, values`;return n.concat({name:r,...a?{init:`{${l}: ${lX(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${l}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(lK(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===AX)).length||n.unshift({name:AX,value:null,on:[{events:"timer{1}",update:`${AX} === null ? {} : ${AX}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=r?.signals.visual,s=o?.signals.visual,l=`data(${Dt(t.name+AJ)})`;if(_X.defined(t)||!r&&!o)return n;const u={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 t of RB(u))u[t]=[{test:`${l}.length && ${l}[0].unit === ${FJ(e)}`,...u[t]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=RB(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)),{});return[{name:`${i+EX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:u}},...n,{name:i+EX,type:"rect",clip:!0,encode:{enter:{...d?{cursor:{value:d}}:{},fill:{value:"transparent"}},update:{...u,...p}}}]}},MX=SX,CX={defined:e=>"point"===e.type,signals:(e,t,n)=>{const i=t.name,r=i+gX,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=PB(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+EX):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),l="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let u=`unit: ${FJ(e)}, `;t.project.hasSelectionId?u+=`${yY}: ${a}[${Dt(yY)}]`:u+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return n?.bin?`[${a}[${Dt(e.vgField(t.channel,{}))}], ${a}[${Dt(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${Dt(t.field)}]`})).join(", ")}]`;const c=t.events;return n.concat([{name:i+DJ,on:c?[{events:c,update:`${l} ? {${u}} : null`,force:!0}]:[]}])}},FX=CX;function OX(e,t,n,i){const r=BH(t)&&t.condition,o=i(t);if(r){const t=Ge(r).map((t=>{const n=i(t);if(function(e){return e.param}(t)){const{param:i,empty:r}=t;return{test:LJ(e,{param:i,empty:r}),...n}}return{test:jJ(e,t.test),...n}}));return{[n]:[...t,...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function NX(e,t="text"){const n=e.encoding[t];return OX(e,n,t,(t=>TX(t,e.config)))}function TX(e,t,n="datum"){if(e){if(JH(e))return NU(e.value);if(VH(e)){const{format:i,formatType:r}=cG(e);return mH({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function zX(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(_e(a))return{tooltip:PX({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return OX(e,a,"tooltip",(e=>{const a=TX(e,r,s);if(a)return a;if(null===e)return;let l=BU("tooltip",i,r);return!0===l&&(l={content:"encoding"}),vt(l)?{value:l}:we(l)?EU(l)?l:"encoding"===l.content?PX(n,o,r,t):{signal:s}:void 0}))}}function RX(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o={},a=i?"datum.datum":"datum",s=[];function l(n,i){const l=cI(i),u=XH(n)?n:{...n,type:e[l].type},c=Ge(u.title||uG(u,r)).join(", ");let f;if(RI(i)){const t="x"===i?"x2":"y2",n=fG(e[t]);if(gU(u.bin)&&n){const e=nG(u,{expr:a}),i=nG(n,{expr:a}),{format:s,formatType:l}=cG(u);f=kH(e,i,s,l,r),o[t]=!0}}if((RI(i)||i===gj||i===pj)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=cG(u);f=mH({fieldOrDatumDef:u,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}f??(f=TX(u,r,a).signal),s.push({channel:i,key:c,value:f})}BG(e,((e,t)=>{UH(e)?l(e,t):jH(e)&&l(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of s)o[e]||u[t]||(u[t]=n);return u}function PX(e,t,n,{reactiveGeom:i}={}){const r=RX(e,t,n,{reactiveGeom:i}),o=LB(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function LX(e){const{markDef:t,config:n}=e,i=BU("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...BX(e),...jX(e)}}function BX(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=BU("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in SU?{}:{ariaRoleDescription:{value:t}}}function jX(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return OX(e,o,"description",(t=>TX(t,e.config)));const a=BU("description",n,i);if(null!=a)return{description:NU(a)};if(!1===i.aria)return{};const s=RX(t,r,i);return zB(s)?void 0:{description:{signal:LB(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function IX(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;void 0===s&&(l??(l=BU(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==l&&(s=NU(l)));const u=r[e];return OX(t,u,a??e,(n=>cH({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function UX(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??BU("filled",n,r),s=EB(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=BU(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,u=BU(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...l?{fill:NU(l)}:{},...u?{stroke:NU(u)}:{}};return n.color&&(a?n.fill:n.stroke)&&Aq(lq("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...IX("color",e,{vgChannel:c,defaultValue:a?l:u}),...IX("fill",e,{defaultValue:i.fill?l:void 0}),...IX("stroke",e,{defaultValue:i.stroke?u:void 0})}}function qX(e){const{encoding:t,mark:n}=e,i=t.order;return!JW(n)&&JH(i)?OX(e,i,"zindex",(e=>NU(e.value))):{}}function WX({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:cH({channel:o,channelDef:s,markDef:t,config:i?.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:NU(a),bandPosition:r})};const l=t[o];return l?{offsetType:"visual",offset:l}:{}}function HX(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,l=r[e],u=r[dI(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=WX({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=GX({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!l&&RI(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(VH(n)&&r&&t===r.fieldChannel){if(UH(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return uH({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return lH(n,i,{suffix:"end"},{offset:o})}return oH(e)}({channel:e,channelDef:l,channel2Def:u,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 GX({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=cI(n),l=fI(n),u=BU(n,o,a,{vgChannel:l});if(void 0!==u)return fH(n,u);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(EB([lW.LOG,lW.TIME,lW.UTC],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===s?{field:{group:"height"}}:{value:0};switch(s){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...e[hI(n)],mult:.5}}}}const YX={left:"x",center:"xc",right:"x2"},VX={top:"y",middle:"yc",bottom:"y2"};function XX(e,t,n,i="middle"){if("radius"===e||"theta"===e)return fI(e);const r="x"===e?"align":"baseline",o=BU(r,t,n);let a;return EU(o)?(Aq(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?YX[a||("top"===i?"left":"center")]:VX[a||i]}function JX(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?QX(e,t,{defaultPos:n,defaultPos2:i}):HX(e,t,{defaultPos:n})}function QX(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=dI(e),s=hI(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=cI(n),u=hI(n),c=fI(n),f=i[l],d=e.scaleName(l),h=e.getScaleComponent(l),{offset:p}=WX(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=hI(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:l,defaultRef:u}){return VH(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0)?lH(t,o,{suffix:"start"},{offset:l}):oH({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});return void 0!==m?{[c]:m}:ZX(n,o)||ZX(n,{[n]:IU(n,o,s.style),[u]:IU(u,o,s.style)})||ZX(n,s[r])||ZX(n,s.mark)||{[c]:GX({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...HX(e,t,{defaultPos:n,vgChannel:l[s]?XX(e,r,o):fI(e)}),...l}}function ZX(e,t){const n=hI(e),i=fI(e);if(void 0!==t[i])return{[i]:fH(e,t[i])};if(void 0!==t[e])return{[i]:fH(e,t[e])};if(t[n]){const i=t[n];if(!iH(i))return{[n]:fH(e,i)};Aq(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function KX(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=dI(t),s=hI(t),l=i[t],u=i[a],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,h=i[s]??i.size??BU("size",r,n,{vgChannel:s}),p=pI(t),m="bar"===o&&("x"===t?"vertical"===d:"horizontal"===d);return!UH(l)||!(mU(l.bin)||gU(l.bin)||l.timeUnit&&!u)||h&&!iH(h)||i[p]||bW(f)?(VH(l)&&bW(f)||m)&&!u?function(e,t,n){const{markDef:i,encoding:r,config:o,stack:a}=n,s=i.orient,l=n.scaleName(t),u=n.getScaleComponent(t),c=hI(t),f=dI(t),d=pI(t),h=n.scaleName(d),p=n.getScaleComponent(mI(t)),m="horizontal"===s&&"y"===t||"vertical"===s&&"x"===t;let g;(r.size||i.size)&&(m?g=IX("size",n,{vgChannel:c,defaultRef:NU(i.size)}):Aq(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(i.type)));const y=!!g,v=RH({channel:t,fieldDef:e,markDef:i,config:o,scaleType:u?.get("type"),useVlSizeChannel:m});g=g||{[c]:eJ(c,h||l,p||u,o,v,!!e,i.type)};const b=XX(t,i,o,"band"===u?.get("type")&&iH(v)&&!y?"top":"middle"),x="xc"===b||"yc"===b,{offset:_,offsetType:w}=WX({channel:t,markDef:i,encoding:r,model:n,bandPosition:x?.5:0}),k=oH({channel:t,channelDef:e,markDef:i,config:o,scaleName:l,scale:u,stack:a,offset:_,defaultRef:GX({model:n,defaultPos:"mid",channel:t,scaleName:l,scale:u}),bandPosition:x?"encoding"===w?0:.5:EU(v)?{signal:`(1-${v})/2`}:iH(v)?(1-v.band)/2:0});if(c)return{[b]:k,...g};{const e=fI(f),t=g[c],n=_?{...t,offset:_}:t;return{[b]:k,[e]:_e(k)?[k[0],{...k[1],offset:n}]:{...k,offset:n}}}}(l,t,e):QX(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:o,encoding:a}=i,s=i.getScaleComponent(n),l=i.scaleName(n),u=s?s.get("type"):void 0,c=s.get("reverse"),f=RH({channel:n,fieldDef:e,markDef:o,config:r,scaleType:u}),d=i.component.axes[n]?.[0],h=d?.get("translate")??.5,p=RI(n)?BU("binSpacing",o,r)??0:0,m=dI(n),g=fI(n),y=fI(m),{offset:v}=WX({channel:n,markDef:o,encoding:a,model:i,bandPosition:0}),b=EU(f)?{signal:`(1-${f.signal})/2`}:iH(f)?(1-f.band)/2:.5;if(mU(e.bin)||e.timeUnit)return{[y]:nJ({fieldDef:e,scaleName:l,bandPosition:b,offset:tJ(m,p,c,h,v)}),[g]:nJ({fieldDef:e,scaleName:l,bandPosition:EU(b)?{signal:`1-${b.signal}`}:1-b,offset:tJ(n,p,c,h,v)})};if(gU(e.bin)){const i=lH(e,l,{},{offset:tJ(m,p,c,h,v)});if(UH(t))return{[y]:i,[g]:lH(t,l,{},{offset:tJ(n,p,c,h,v)})};if(yU(e.bin)&&e.bin.step)return{[y]:i,[g]:{signal:`scale("${l}", ${nG(e,{expr:"datum"})} + ${e.bin.step})`,offset:tJ(n,p,c,h,v)}}}Aq(kq(m))}({fieldDef:l,fieldDef2:u,channel:t,model:e})}function eJ(e,t,n,i,r,o,a){if(iH(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;return 1!==r.band&&(e=`${r.band} * ${e}`),{signal:`max(0.25, ${e})`}}1!==r.band&&(Aq(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(EU(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if($U(e)&&gt(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r}=i.scale,o=QB(t,"bar"===a?n:r);if(EU(o))return{signal:`(1 - (${o.signal})) * ${e}`};if(gt(o))return{signal:`${1-o} * ${e}`};if(xU(o))return{signal:`(1 - (${o.expr})) * ${e}`}}return{value:FY(i.view,e)-2}}function tJ(e,t,n,i,r){if(Uj(e))return 0;const o="x"===e||"y2"===e?-t/2:t/2;if(EU(n)||EU(r)||EU(i)){const e=RU(n),t=RU(r),a=RU(i);return{signal:(a?`${a} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${o})`:o)}}return r=r||0,i+(n?-r-o:+r+o)}function nJ({fieldDef:e,scaleName:t,bandPosition:n,offset:i}){return uH({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i})}const iJ=new Set(["aria","width","height"]);function rJ(e,t){const{fill:n,stroke:i}="include"===t.color?UX(e):{};return{...aJ(e.markDef,t),...oJ(e,"fill",n),...oJ(e,"stroke",i),...IX("opacity",e),...IX("fillOpacity",e),...IX("strokeOpacity",e),...IX("strokeWidth",e),...IX("strokeDash",e),...qX(e),...zX(e),...NX(e,"href"),...LX(e)}}function oJ(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===BU("invalid",o,i)&&n&&!JW(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&xW(r)&&(t[o]=!0)}return t}),{}),r=RB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>sH(e,t))).join(` ${e} `)}}(e,{invalid:!0,channels:KI});if(i)return{[t]:[{test:i,value:null},...Ge(n)]}}return n?{[t]:n}:{}}function aJ(e,t){return DU.reduce(((n,i)=>(iJ.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=NU(e[i])),n)),{})}function sJ(e){const{config:t,markDef:n}=e;if(BU("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});o&&xW(r)&&(t[o]=!0)}return t}),{}),r=RB(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>sH(e,t))).join(` ${e} `)}}(e,{channels:zI});if(t)return{defined:{signal:t}}}return{}}function lJ(e,t){if(void 0!==t)return{[e]:NU(t)}}const uJ="voronoi",cJ={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(uJ)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(JW(o))return Aq(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(uJ),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...zX(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,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.indexOf(uJ)>=0&&(l=!0)})),l||n.splice(s+1,0,a),n}},fJ=cJ,dJ={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!bY(e.bind),parse:(e,t,n)=>NJ(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=fJ.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=jB(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...a?{init:lX(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${Dt(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.filter((e=>e.name===i+DJ))[0],a=i+gX,s=r.items.map((e=>jB(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},hJ=dJ,pJ="_toggle",mJ={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+pJ,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+DJ,i=t.name+pJ;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${FJ(e)}}, `)+`${i} ? ${n} : null`}},gJ={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t)=>{t.clear&&(t.clear=vt(t.clear)?zT(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(hJ.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===jB(`${t.name}_${e.field}`)));-1!==i&&n[i].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 e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));i(t,"[0, 0]"),-1===t&&i(n.findIndex((t=>t.name===e.signals.data)),"null")}else{let e=n.findIndex((e=>e.name===t.name+DJ));i(e,"null"),mJ.defined(t)&&(e=n.findIndex((e=>e.name===t.name+pJ)),i(e,"false"))}return n}},yJ={defined:e=>{const t="global"===e.resolve&&e.bind&&bY(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==yY;return t&&!n&&Aq("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=yB(n);if(i.select=vt(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},NJ(t,i),we(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=Ge(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const r=xY(t.bind)?t.bind.legend:"click",o=vt(r)?zT(r,"view"):Ge(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=xY(t.bind)&&t.bind.legend,o=e=>t=>{const n=yB(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${jB(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,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+DJ)),a=i+gX,s=r.items.filter((e=>e.hasLegend)).map((e=>jB(`${i}_${jB(e.field)}_legend`))),l=`${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:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const u=n.find((e=>e.name===i+pJ)),c=xY(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:c}):u.on[0].events=c),n}},vJ="_translate_anchor",bJ="_translate_delta",xJ={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=_X.defined(t),o=i+vJ,{x:a,y:s}=t.project.hasChannel;let l=zT(t.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=i+EX,e)))),n.push({name:o,value:{},on:[{events:l.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?wX(e,lj):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?wX(e,uj):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+bJ,value:{},on:[{events:l,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&_J(e,t,a,"width",n),void 0!==s&&_J(e,t,s,"height",n),n}};function _J(e,t,n,i,r){const o=t.name,a=o+vJ,s=o+bJ,l=n.channel,u=_X.defined(t),c=r.filter((e=>e.name===n.signals[u?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${l}`,g=`${u&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${u?l===lj?p?"":"-":p?"-":"":""}${s}.${l} / ${u?`${f}`:`span(${m})`}${u?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:u?g:`clampRange(${g}, 0, ${f})`})}const wJ="_zoom_anchor",kJ="_zoom_delta",EJ={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=_X.defined(t),o=i+kJ,{x:a,y:s}=t.project.hasChannel,l=Dt(e.scaleName(lj)),u=Dt(e.scaleName(uj));let c=zT(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+EX,e)))),n.push({name:i+wJ,on:[{events:c,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, 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&&$J(e,t,a,"width",n),void 0!==s&&$J(e,t,s,"height",n),n}};function $J(e,t,n,i,r){const o=t.name,a=n.channel,s=_X.defined(t),l=r.filter((e=>e.name===n.signals[s?"data":"visual"]))[0],u=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?wX(e,a):l.name,h=o+kJ,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${wJ}.${a}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;l.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${u})`})}const AJ="_store",DJ="_tuple",SJ="_modify",MJ="vlSelectionResolve",CJ=[FX,MX,bX,mJ,hJ,_X,yJ,gJ,xJ,EJ,fJ];function FJ(e,{escape:t}={escape:!0}){let n=t?Dt(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!uK(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of Jj)e[t]&&(n+=` + '__facet_${t}_' + (facet[${Dt(i.vgField(t))}])`)}return n}function OJ(e){return PB(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function NJ(e,t){!vt(t.select)&&t.select.on||delete e.events,!vt(t.select)&&t.select.clear||delete e.clear,!vt(t.select)&&t.select.toggle||delete e.toggle}function TJ(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...TJ(e.object)),t.push(...TJ(e.property))),t)}function zJ(e){return"MemberExpression"===e.object.type?zJ(e.object):"datum"===e.object.name}function RJ(e){const t=aF(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&zJ(e)&&n.add(TJ(e).slice(1).join("."))})),n}class PJ extends hX{clone(){return new PJ(null,this.model,yB(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=jJ(this.model,this.filter,this),this._dependentFields=RJ(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function LJ(e,t,n,i="datum"){const r=vt(t)?t:t.param,o=jB(r),a=Dt(o+AJ);let s;try{s=e.getSelectionComponent(o,r)}catch(e){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 l=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${Dt(s.resolve)})`}`,u=`length(data(${a}))`;return!1===t.empty?`${u} && ${l}`:`!${u} || ${l}`}function BJ(e,t,n){const i=jB(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(e){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,Aq((e.length?"Multiple ":"No ")+`matching ${Dt(r)} encoding found for selection ${Dt(n.param)}. `+`Using "field": ${Dt(a)}.`)):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&Aq(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Dt(a)}.`);return`${o.name}[${Dt(YB(a))}]`}function jJ(e,t,n){return IB(t,(t=>vt(t)?t:function(e){return e?.param}(t)?LJ(e,t,n):Zq(t)))}function IJ(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 UJ(e,t,n,i={header:!1}){const{disable:r,orient:o,scale:a,labelExpr:s,title:l,zindex:u,...c}=e.combine();if(!r){for(const e in c){const n=$G[e],i=c[e];if(n&&n!==t&&"both"!==n)delete c[e];else if(kG(i)){const{condition:t,...n}=i,r=Ge(t),o=wG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((e=>{const{test:t,...n}=e;return{test:jJ(null,t),...n}})),n];IJ(c,i,t,a),delete c[e]}else if(null===o){const t={signal:r.map((e=>{const{test:t,...n}=e;return`${jJ(null,t)} ? ${zU(n)} : `})).join("")+zU(n)};c[e]=t}}else if(EU(i)){const t=wG[e];if(t){const{vgProp:n,part:r}=t;IJ(c,r,n,i),delete c[e]}}EB(["labelAlign","labelBaseline"],e)&&null===c[e]&&delete c[e]}if("grid"===t){if(!c.grid)return;if(c.encode){const{grid:e}=c.encode;c.encode={...e?{grid:e}:{}},zB(c.encode)&&delete c.encode}return{scale:a,orient:o,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:QB(u,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==s){let e=s;c.encode?.labels?.update&&EU(c.encode.labels.update.text)&&(e=VB(s,"datum.label",c.encode.labels.update.text.signal)),IJ(c,"labels","text",{signal:e})}if(null===c.labelAlign&&delete c.labelAlign,c.encode){for(const t of EG)e.hasAxisPart(t)||delete c.encode[t];zB(c.encode)&&delete c.encode}const t=function(e,t){if(e)return _e(e)&&!kU(e)?e.map((e=>uG(e,t))).join(", "):e}(l,n);return{scale:a,orient:o,grid:!1,...t?{title:t}:{},...c,...!1===n.aria?{aria:!1}:{},zindex:QB(u,0)}}}}function qJ(e){const{axes:t}=e.component,n=[];for(const i of zI)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 WJ(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([...RB(r),...RB(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${RU(r[t])} : ${RU(o[t])}`};return s}return t[e]}))])}function HJ(e,t){const n=[{}];for(const i of e){let e=t[i]?.style;if(e){e=Ge(e);for(const i of e)n.push(t.style[i])}}return Object.assign.apply(null,n)}function GJ(e,t,n,i={}){const r=UU(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const YJ={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!bW(e)&&UH(t)&&!mU(t?.bin)&&!gU(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)}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||JJ(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||XJ(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&EB(["quantitative","temporal"],e))return!0}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!we(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy"}(t.type,n,UH(t)&&!!t.timeUnit,UH(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}){if(!i&&!bW(t)&&"log"!==t){if(UH(e)){if(mU(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&EB(["month","hours","day","quarter"],Iq(e.timeUnit)?.unit))return}return{signal:`ceil(${n.signal}/40)`}}}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(UH(t)){const{timeUnit:e}=t;if(e){const t=Uq(e);if(t)return{signal:t}}}},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=QJ(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return WU(r?[NH(r)]:[],UH(a)?[NH(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;return _e(n)?xG(t,n):EU(n)?n:void 0}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){return"rect"===e&&iG(t)?1:0}(n,t)};function VJ(e){return`(((${e.signal} % 360) + 360) % 360)`}function XJ(e,t,n,i){if(void 0!==e){if("x"===n){if(EU(e)){const n=VJ(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${EU(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(EU(t)){const n=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${n} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(EU(e)){const n=VJ(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${EU(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(EU(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${n} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function JJ(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,o=i?"bottom":"left";if(EU(e)){const n=VJ(e);return{signal:`(${r?`(${n} + 90)`:n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${EU(t)?`(${t.signal} === "${o}")`:t===o} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(EU(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${t.signal} ${n} "${o}" ? "left" : "right"`}}return(r<e&&e<180+r)==(t===o)?"left":"right"}function QJ(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,a=r?r.title:void 0;return o&&a?HU(o,a):o||a||(void 0!==o?o:void 0!==a?a:void 0)}class ZJ extends hX{clone(){return new ZJ(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=RJ(this.transform.calculate)}static parseAllForSortIndex(e,t){return t.forEachFieldDef(((t,n)=>{if(QH(t)&&MH(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${Zq({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new ZJ(e,{calculate:a,as:KJ(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 ${wB(this.transform)}`}}function KJ(e,t,n){return nG(e,{prefix:t,suffix:"sort_index",...n??{}})}function eQ(e,t){return EB(["top","bottom"],t)?"column":EB(["left","right"],t)||"row"===e?"row":"column"}function tQ(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return QB((t||{})[e],r[e],n.header[e])}function nQ(e,t,n,i){const r={};for(const o of e){const e=tQ(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const iQ=["row","column"],rQ=["header","footer"];function oQ(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}=nQ(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=eQ(t,s),u=ij(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...sQ(u,l),...aQ(l,u,o),...pQ(i,r,t,dY,cY)}}}function aQ(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=JJ(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function sQ(e,t){const n=XJ(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function lQ(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of rQ)if(n[r])for(const o of n[r]){const a=fQ(e,t,r,n,o);null!=a&&i.push(a)}return i}function uQ(e,t){const{sort:n}=e;return SH(n)?{field:nG(n,{expr:"datum"}),order:n.order??"ascending"}:_e(n)?{field:KJ(e,t,{expr:"datum"}),order:"ascending"}:{field:nG(e,{expr:"datum"}),order:n??"ascending"}}function cQ(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=nQ(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=mH({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=eQ(t,s);return{text:{signal:l?VB(VB(l,"datum.label",u),"datum.value",nG(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...sQ(o,c),...aQ(c,o,a),...pQ(n,e,t,hY,fY)}}function fQ(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}=nQ(["labelOrient"],a.header,s,t);("row"===t&&!EB(["top","bottom"],e)||"column"===t&&!EB(["left","right"],e))&&(o=cQ(a,t,s))}const l=uK(e)&&!CH(e.facet),u=r.axes,c=u?.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:uQ(a,t)}:{},...c&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:u}:{}}}}return null}const dQ={column:{start:0,end:1},row:{start:1,end:0}};function hQ(e,t){return dQ[t][e]}function pQ(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=tQ(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function mQ(e){return[...gQ(e,"width"),...gQ(e,"height"),...gQ(e,"childWidth"),...gQ(e,"childHeight")]}function gQ(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(bW(i)&&$U(o)){const i=e.scaleName(n);return uK(e.parent)&&"independent"===e.parent.component.resolve.scale[n]?[yQ(i,o)]:[yQ(i,o),{name:r,update:vQ(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} : ${CY(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function yQ(e,t){const n=`${e}_step`;return EU(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function vQ(e,t,n){const i=t.get("type"),r=t.get("padding"),o=QB(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${RU(a)}, ${RU(o)}) * ${e}_step`}function bQ(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function xQ(e,t){return RB(e).reduce(((n,i)=>{const r=e[i];return{...n,...OX(t,r,i,(e=>NU(e.value)))}}),{})}function _Q(e,t){if(uK(t))return"theta"===e?"independent":"shared";if(fK(t))return"shared";if(cK(t))return RI(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function wQ(e,t){const n=e.scale[t],i=RI(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Aq(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 kQ={...gY,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},EQ=RB(kQ);class $Q extends GV{}const AQ={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:s,config:l,mark:u}=n,c=a.filled&&"trail"!==u;let f={...PU({},n,eH),...UX(n,{filled:c})};const d=r.get("symbolOpacity")??l.legend.symbolOpacity,h=r.get("symbolFillColor")??l.legend.symbolFillColor,p=r.get("symbolStrokeColor")??l.legend.symbolStrokeColor,m=void 0===d?DQ(s.opacity)??a.opacity:void 0;if(f.fill)if("fill"===i||c&&i===wj)delete f.fill;else if(f.fill.field)h?delete f.fill:(f.fill=NU(l.legend.symbolBaseFillColor??"black"),f.fillOpacity=NU(m??1));else if(_e(f.fill)){const e=SQ(s.fill??s.color)??a.fill??(c&&a.color);e&&(f.fill=NU(e))}if(f.stroke)if("stroke"===i||!c&&i===wj)delete f.stroke;else if(f.stroke.field||p)delete f.stroke;else if(_e(f.stroke)){const e=QB(SQ(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(f.stroke={value:e})}if(i!==Sj){const e=UH(t)&&CQ(0,r,t);e?f.opacity=[{test:e,...NU(m??1)},NU(l.legend.unselectedOpacity)]:m&&(f.opacity=NU(m))}return f={...f,...e},zB(f)?void 0:f},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const l=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?DQ(a.opacity)||o.opacity:void 0;return l&&(s.opacity=NU(l)),s={...s,...e},zB(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=UH(t)?CQ(0,r,t):void 0,l=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=o;let f;dH(c)?f=yH({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:c,config:a}):void 0===u&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=yH({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&UH(t)&&void 0===t.timeUnit&&(f=yH({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...l?{opacity:l}:{},...f?{text:f}:{},...e};return zB(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return n?.length?{...e,fill:{value:"transparent"}}:e}};function DQ(e){return MQ(e,((e,t)=>Math.max(e,t.value)))}function SQ(e){return MQ(e,((e,t)=>QB(e,t.value)))}function MQ(e,t){return function(e){const t=e?.condition;return!!t&&(_e(t)||JH(t))}(e)?Ge(e.condition).reduce(t,e.value):JH(e)?e.value:void 0}function CQ(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=Dt(n.field);return i.map((e=>`(!length(data(${Dt(jB(e)+AJ)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const FQ={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return vH(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return bH(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:l}=e;if(_W(r))return"horizontal"===n?"top"===i||"bottom"===i?NQ(t,"width",a,o):a:NQ(t,"height",l,s)}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(EB(["quantile","threshold","log","symlog"],e))return"greedy"}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=SQ(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})=>sG(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Vj(n)&&_W(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;return _e(n)?xG(t,n):EU(n)?n:void 0}(t,e)};function OQ({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)}function NQ(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function TQ(e){const t=lK(e)?function(e){const{encoding:t}=e,n={};for(const i of[wj,...mY]){const r=dG(t[i]);r&&e.getScaleComponent(i)&&(i===$j&&UH(r)&&r.type===sW||(n[i]=RQ(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){TQ(i);for(const r of RB(i.component.legends))n.legend[r]=wQ(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=PQ(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of RB(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 zQ(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function RQ(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new $Q({},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){const i=e.fieldDef(t)?.field;for(const r of PB(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&yJ.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const l=void 0!==n?!n:a.disable;if(s.set("disable",l,void 0!==n),l)return s;n=n||{};const u=e.getScaleComponent(t).get("type"),c=dG(r[t]),f=UH(c)?Iq(c.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",h=function(e){const{legend:t}=e;return QB(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(Vj(e)){if(EB(["quarter","month","day"],t))return"symbol";if(_W(n))return"gradient"}return"symbol"}(e))}({legend:n,channel:t,timeUnit:f,scaleType:u}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:a,config:o,scaleType:u,orient:d,legendType:h,direction:OQ({legend:n,legendType:h,orient:d,legendConfig:a})};for(const i of EQ){if("gradient"===h&&i.startsWith("symbol")||"symbol"===h&&i.startsWith("gradient"))continue;const r=i in FQ?FQ[i](p):n[i];if(void 0!==r){const a=zQ(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const m=n?.encoding??{},g=s.get("selections"),y={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:s,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=xQ(m[t]??{},e),i=t in AQ?AQ[t](n,v):n;void 0===i||zB(i)||(y[t]={...g?.length&&UH(c)?{name:`${jB(c.field)}_legend_${t}`}:{},...g?.length?{interactive:!!g}:{},update:i})}return zB(y)||s.set("encode",y,!!n?.encoding),s}function PQ(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of EQ){const i=QV(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return i=e,"circle"===(o=t).value?o:i;case"title":return GU(e,t);case"type":return r=!0,VV("symbol")}var i,o;return JV(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&UB(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&UB(e.explicit,["encode","gradient"])),e}function LQ(e){const t=e.component.legends,n={};for(const i of RB(t)){const r=e.getScaleComponent(i),o=_B(r.get("domains"));if(n[o])for(const e of n[o])PQ(e,t[i])||n[o].push(t[i]);else n[o]=[t[i].clone()]}const i=PB(n).flat().map((t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(!n){if(!1===t.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of mY)o[t]&&delete e[t]}if(o.title||delete o.title,void 0!==i){let e=i;o.encode?.labels?.update&&EU(o.encode.labels.update.text)&&(e=VB(i,"datum.label",o.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.text=i}(o,"labels",0,{signal:e})}return o}}(t,e.config))).filter((e=>void 0!==e));return i}function BQ(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=EU(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return EB(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 jQ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class IQ extends GV{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 UQ(e){e.component.projection=lK(e)?function(e){if(e.hasProjection){const t=_U(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[[bj,vj],[_j,xj]])(dG(n[i[0]])||dG(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField($j)&&e.typedFieldDef($j).type===sW&&t.push({signal:e.getName(`geojson_${t.length}`)}),0===t.length&&t.push(e.requestDataName(aX.Main)),t}(e):void 0,o=new IQ(e.projectionName(!0),{..._U(e.config.projection)??{},...t??{}},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)UQ(t);const n=AB(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=AB(jQ,(n=>!st(e.explicit,n)&&!st(t.explicit,n)||!!(st(e.explicit,n)&&st(t.explicit,n)&&gB(e.get(n),t.get(n)))));if(gB(e.size,t.size)){if(n)return e;if(gB(e.explicit,{}))return t;if(gB(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 IQ(n,t.specifiedProjection,t.size,yB(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}}(e)}function qQ(e,t,n,i){if(_G(t,n)){const r=lK(e)?e.axis(n)??e.legend(n)??{}:{},o=nG(t,{expr:"datum"}),a=nG(t,{expr:"datum",binSuffix:"end"});return{formulaAs:nG(t,{binSuffix:"range",forAs:!0}),formula:kH(o,a,r.format,r.formatType,i)}}return{}}function WQ(e,t){return`${pU(e)}_${t}`}function HQ(e,t,n){const i=WQ(gG(n,void 0)??{},t);return e.getName(`${i}_bins`)}function GQ(e,t,n){let i,r;i=function(e){return"as"in e}(e)?vt(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[nG(e,{forAs:!0}),nG(e,{binSuffix:"end",forAs:!0})];const o={...gG(t,void 0)},a=WQ(o,e.field),{signal:s,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(vU(o.extent)){const e=o.extent;r=BJ(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...l?{extentSignal:l}:{},...r?{span:r}:{}}}}class YQ extends hX{clone(){return new YQ(null,yB(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(XH(n)&&mU(n.bin)){const{key:r,binComponent:o}=GQ(n,n.bin,t);e[r]={...o,...e[r],...qQ(t,n,i,t.config)}}return e}),{});return zB(n)?null:new YQ(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=GQ(t,t.bin,n);return new YQ(e,{[i]:r})}merge(e,t){for(const n of RB(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=MB([...this.bins[n].as,...e.bins[n].as],wB)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(PB(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(PB(this.bins).map((e=>e.field)))}hash(){return`Bin ${wB(this.bins)}`}assemble(){return PB(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:YB(e.field),as:n,signal:e.signal,...vU(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:YB(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:nG({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}class VQ extends hX{clone(){return new VQ(null,new Set(this.dimensions),yB(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([nG(e,{forAs:!0})]);else{if(sU(o)||lU(o)){const e=sU(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([nG({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([nG(e,{forAs:!0})]);eU(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([nG({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([nG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(e,t,n,i){const r=lK(i)?i.encoding[dI(t)]:void 0;if(XH(n)&&lK(i)&&PH(n,r,i.markDef,i.config))e.add(nG(n,{})),e.add(nG(n,{suffix:"end"})),n.bin&&_G(n,t)&&e.add(nG(n,{binSuffix:"range"}));else if(Hj(t)){const n=Wj(t);e.add(i.getName(n))}else e.add(nG(n));QH(n)&&function(e){return we(e)&&"field"in e}(n.scale?.range)&&e.add(n.scale.range.field)}(r,n,e,t)})),r.size+RB(i).length===0?null:new VQ(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;t&&("count"===t?(i["*"]??(i["*"]={}),i["*"].count=new Set([r||nG(e,{forAs:!0})])):(i[n]??(i[n]={}),i[n][t]=new Set([r||nG(e,{forAs:!0})])))}for(const e of t.groupby??[])n.add(e);return n.size+RB(i).length===0?null:new VQ(e,n,i)}merge(e){return FB(this.dimensions,e.dimensions)?(function(e,t){for(const n of RB(t)){const i=t[n];for(const t of RB(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){$q.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...RB(this.measures)])}producedFields(){const e=new Set;for(const t of RB(this.measures))for(const n of RB(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 ${wB({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of RB(this.measures))for(const r of RB(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:YB(i));return{type:"aggregate",groupby:[...this.dimensions].map(YB),ops:e,fields:t,as:n}}}class XQ extends hX{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of Jj){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]={name:t.getName(`${e}_domain`),fields:[nG(n),...mU(i)?[nG(n,{binSuffix:"end"})]:[]],...SH(r)?{sortField:r}:_e(r)?{sortIndexField:KJ(n,e)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of Jj)this[t]&&(e+=` ${t.charAt(0)}:${wB(this[t])}`);return e}get fields(){const e=[];for(const t of Jj)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of Jj)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 zI){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(bW(i)&&$U(r)){const n=BZ(jZ(this.childModel,t));n?e[t]=n:Aq(ZU(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:l}=this[e];if(s){const{op:e=EH,field:t}=s;r.push(t),o.push(e),a.push(nG(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));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){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of iQ){for(const t of rQ){const i=(n[e]&&n[e][t])??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}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 i of[aj,oj])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function JQ(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function QQ(e){const t={};return pB(e.filter,(e=>{if(Jq(e)){let n=null;qq(e)?n=FU(e.equal):Hq(e)?n=FU(e.lte):Wq(e)?n=FU(e.lt):Gq(e)?n=FU(e.gt):Yq(e)?n=FU(e.gte):Vq(e)?n=e.range[0]:Xq(e)&&(n=(e.oneOf??e.in)[0]),n&&(Dq(n)?t[e.field]="date":gt(n)?t[e.field]="number":vt(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}class ZQ extends hX{clone(){return new ZQ(null,yB(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${wB(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!nX(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of RB(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Aq(iq(e,n[e],t.value)))}for(const e of RB(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Aq(iq(e,t[e],n)))}const r=new GV(t,n);i.copyAll(r);const o={};for(const e of RB(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===RB(o).length||i.parseNothing?null:new ZQ(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of RB(this._parse)){const n=this._parse[t];1===JB(t)&&(e[t]=n)}return e}producedFields(){return new Set(RB(this._parse))}dependentFields(){return new Set(RB(this._parse))}assembleTransforms(e=!1){return RB(this._parse).filter((t=>!e||JB(t)>1)).map((e=>{const t=function(e,t){const n=WB(e);return"number"===t?`toNumber(${n})`:"boolean"===t?`toBoolean(${n})`:"string"===t?`toString(${n})`:"date"===t?`toDate(${n})`:"flatten"===t?n:t.startsWith("date:")?`timeParse(${n},'${JQ(t.slice(5,t.length))}')`:t.startsWith("utc:")?`utcParse(${n},'${JQ(t.slice(4,t.length))}')`:(Aq(`Unrecognized parse "${t}".`),null)}(e,this._parse[e]);return t?{type:"formula",expr:t,as:XB(e)}:null})).filter((e=>null!==e))}}class KQ extends hX{clone(){return new KQ(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([yY])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:yY}}}class eZ extends hX{clone(){return new eZ(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${wB(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class tZ extends hX{clone(){return new tZ(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 ${wB(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class nZ extends hX{constructor(e){let t;if(super(null),e??(e={name:"source"}),nX(e)||(t=e.format?{...xB(e.format,["parse"])}:{}),eX(e))this._data={values:e.values};else if(KV(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];EB(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else rX(e)?this._data={values:[{type:"Sphere"}]}:(tX(e)||nX(e))&&(this._data={});this._generator=nX(e),e.name&&(this._name=e.name),t&&!zB(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 iZ,rZ=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 oZ(e){return e instanceof nZ||e instanceof eZ||e instanceof tZ}class aZ{constructor(){iZ.set(this,void 0),rZ(this,iZ,!1,"f")}setModified(){rZ(this,iZ,!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,iZ,"f")}}iZ=new WeakMap;class sZ extends aZ{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 e of t)this.run(e[0]);return this.modifiedFlag}}class lZ extends aZ{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class uZ extends lZ{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;i<t.length;i++)void 0===n[t[i]]?n[t[i]]=[e.children[i]]:n[t[i]].push(e.children[i]);for(const t of RB(n))n[t].length>1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class cZ extends lZ{constructor(e){super(),this.requiresSelectionId=e&&OJ(e)}run(e){e instanceof KQ&&(this.requiresSelectionId&&(oZ(e.parent)||e.parent instanceof VQ||e.parent instanceof ZQ)||(this.setModified(),e.remove()))}}class fZ extends aZ{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof mX&&(n=e.producedFields(),OB(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 dZ extends lZ{constructor(){super()}run(e){e instanceof pX&&!e.isRequired()&&(this.setModified(),e.remove())}}class hZ extends sZ{run(e){if(!(oZ(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof ZQ)if(e instanceof ZQ)this.setModified(),e.merge(t);else{if(TB(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class pZ extends sZ{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof ZQ));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 RB(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!zB(i)){this.setModified();const n=new ZQ(e,i);for(const r of t){if(r instanceof ZQ)for(const e of RB(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof ZQ&&0===RB(r.parse).length&&r.remove()}}}}}class mZ extends sZ{run(e){e instanceof pX||e.numChildren()>0||e instanceof XQ||e instanceof nZ||(this.setModified(),e.remove())}}class gZ extends sZ{run(e){const t=e.children.filter((e=>e instanceof mX)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class yZ extends sZ{run(e){const t=e.children.filter((e=>e instanceof VQ)),n={};for(const e of t){const t=wB(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of RB(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class vZ extends sZ{constructor(e){super(),this.model=e}run(e){const t=!(oZ(e)||e instanceof PJ||e instanceof ZQ||e instanceof KQ),n=[],i=[];for(const r of e.children)r instanceof YQ&&(t&&!TB(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 YQ?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 bZ extends sZ{run(e){const t=[...e.children];if(!$B(t,(e=>e instanceof pX))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof pX){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof pX))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 xZ extends hX{clone(){return new xZ(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=MB(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??nG(e)}hash(){return`JoinAggregateTransform ${wB(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class _Z extends hX{clone(){return new _Z(null,yB(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 e of t.sort)a.push(e.field),s.push(QB(e.order,"ascending"));const l={field:a,order:s};let u;return u=function(e){return _e(e)&&e.every((e=>vt(e)))&&e.length>1}(r)?r:vt(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new _Z(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:l,facetby:[],as:u})}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,l=r.map((e=>fG(i[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=nG(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let f;if(_e(c)||UH(c))f=qU(c);else{const e=LH(c)?c.sort:"y"===o?"descending":"ascending";f=u.reduce(((t,n)=>(t.field.push(n),t.order.push(e),t)),{field:[],order:[]})}return new _Z(e,{dimensionFieldDefs:l,stackField:t.vgField(o),facetby:[],stackby:u,sort:f,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 ${wB(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[nG(e,{binSuffix:"mid"})]:[nG(e,{}),nG(e,{binSuffix:"end"})]:[nG(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=nG(o,{expr:"datum"}),i=nG(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${n}*${t}+${1-n}*${i}`,as:nG(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:nG(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class wZ extends hX{clone(){return new wZ(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=MB(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??nG(e)}hash(){return`WindowTransform ${wB(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>uU(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 e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const l={field:a,order:s},u=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==u?{ignorePeers:u}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function kZ(e){if(e instanceof XQ)if(1!==e.numChildren()||e.children[0]instanceof pX){const n=e.model.component.data.main;EZ(n);const i=(t=e,function e(n){if(!(n instanceof XQ)){const i=n.clone();if(i instanceof pX){const e=$Z+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof VQ||i instanceof _Z||i instanceof wZ||i instanceof xZ)&&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 VQ||t instanceof _Z||t instanceof wZ||t instanceof xZ)&&t.addDimensions(e.fields),t.swapWithParent(),kZ(e)}else e.children.map(kZ);var t}function EZ(e){if(e instanceof pX&&e.type===aX.Main&&1===e.numChildren()){const t=e.children[0];t instanceof XQ||(t.swapWithParent(),EZ(e))}}const $Z="scale_",AZ=5;function DZ(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!DZ(t.children))return!1}return!0}function SZ(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function MZ(e,t,n){let i=e.sources,r=!1;return r=SZ(new dZ,i)||r,r=SZ(new cZ(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=SZ(new mZ,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=SZ(new hZ,i)||r,r=SZ(new vZ(t),i)||r,r=SZ(new fZ,i)||r,r=SZ(new pZ,i)||r,r=SZ(new yZ,i)||r,r=SZ(new gZ,i)||r,r=SZ(new uZ,i)||r,r=SZ(new bZ,i)||r),e.sources=i,r}class CZ{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new CZ((()=>e(t)))}}function FZ(e){lK(e)?function(e){const t=e.component.scales;for(const n of RB(t)){const i=OZ(e,n);if(t[n].setWithExplicit("domains",i),RZ(e,n),e.component.data.isFaceted){let t=e;for(;!uK(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)AU(e)&&(e.data=$Z+e.data.replace($Z,""))}}}(e):function(e){for(const t of e.children)FZ(t);const t=e.component.scales;for(const n of RB(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"):QV(i,e.getWithExplicit("domains"),"domains","scale",LZ);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&Aq("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function OZ(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}=PZ(t,n);if(!e)return void Aq(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=PZ(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&&dG(i.x2)?dG(i.x)?QV(TZ(n,r,e,"x"),TZ(n,r,e,"x2"),"domain","scale",LZ):TZ(n,r,e,"x2"):"y"===t&&dG(i.y2)?dG(i.y)?QV(TZ(n,r,e,"y"),TZ(n,r,e,"y2"),"domain","scale",LZ):TZ(n,r,e,"y2"):TZ(n,r,e,t)}function NZ(e,t,n){const i=Iq(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${bG(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function TZ(e,t,n,i){const{encoding:r}=n,o=dG(r[i]),{type:a}=o,s=o.timeUnit;if(function(e){return e?.unionWith}(t)){const r=TZ(e,void 0,n,i);return YV([...NZ(t.unionWith,a,s),...r.value])}if(EU(t))return YV([t]);if(t&&"unaggregated"!==t&&!kW(t))return YV(NZ(t,a,s));const l=n.stack;if(l&&i===l.fieldChannel){if("normalize"===l.offset)return VV([[0,1]]);const e=n.requestDataName(aX.Main);return VV([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const u=eU(i)&&UH(o)?function(e,t,n){if(!bW(n))return;const i=e.fieldDef(t),r=i.sort;if(MH(r))return{op:"min",field:KJ(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(SH(r))return zZ(r,o&&!a.has(r.field));if(DH(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,u=o&&!a.has(l);if(sU(s)||lU(s))return zZ({field:nG(i),order:n},u);if(uU(s)||!s)return zZ({op:s,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(EB(["ascending",void 0],r))return!0}}(n,i,e):void 0;if(WH(o))return VV(NZ([o.datum],a,s));const c=o;if("unaggregated"===t){const e=n.requestDataName(aX.Main),{field:t}=o;return VV([{data:e,field:nG({field:t,aggregate:"min"})},{data:e,field:nG({field:t,aggregate:"max"})}])}if(mU(c.bin)){if(bW(e))return VV("bin-ordinal"===e?[]:[{data:BB(u)?n.requestDataName(aX.Main):n.requestDataName(aX.Raw),field:n.vgField(i,_G(c,i)?{binSuffix:"range"}:{}),sort:!0!==u&&we(u)?u:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=c;if(mU(e)){const t=HQ(n,c.field,e);return VV([new CZ((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return VV([{data:n.requestDataName(aX.Main),field:n.vgField(i,{})}])}}if(c.timeUnit&&EB(["time","utc"],e)&&PH(c,lK(n)?n.encoding[dI(i)]:void 0,n.markDef,n.config)){const e=n.requestDataName(aX.Main);return VV([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return VV(u?[{data:BB(u)?n.requestDataName(aX.Main):n.requestDataName(aX.Raw),field:n.vgField(i),sort:u}]:[{data:n.requestDataName(aX.Main),field:n.vgField(i)}])}function zZ(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":EH),...i?{field:YB(i)}:{},...r?{order:r}:{}}}function RZ(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=kW(i)&&i,a=yU(r)&&vU(r.extent)&&r.extent;(o||a)&&n.set("selectionExtent",o??a,!0)}function PZ(e,t){const{aggregate:n,type:i}=e;return n?vt(n)&&!hU.has(n)?{valid:!1,reason:gq(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:yq(e)}:{valid:!0}:{valid:!1,reason:mq(e)}}function LZ(e,t,n,i){return e.explicit&&t.explicit&&Aq(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${_B(n)} and ${_B(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function BZ(e){if(AU(e)&&vt(e.field))return e.field;if(function(e){return!_e(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if(AU(n)&&vt(n.field))if(t){if(t!==n.field)return Aq("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 Aq("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!_e(e)&&"fields"in e&&"data"in e}(e)){Aq("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 vt(t)?t:void 0}}function jZ(e,t){return function(e){const t=MB(e.map((e=>{if(AU(e)){const{sort:t,...n}=e;return n}return e})),wB),n=MB(e.map((e=>{if(AU(e)){const t=e.sort;return void 0===t||BB(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),wB);if(0===t.length)return;if(1===t.length){const t=e[0];if(AU(t)&&n.length>0){let e=n[0];if(n.length>1){Aq(xq);const t=n.filter((e=>we(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>we(e)&&"op"in e))||1!==t.length||t[0]}else if(we(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=MB(n.map((e=>BB(e)||!("op"in e)||vt(e.op)&&e.op in aU?e:(Aq(function(e){return`Dropping sort property ${_B(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),wB);let r;1===i.length?r=i[0]:i.length>1&&(Aq(xq),r=!0);const o=MB(e.map((e=>AU(e)?e.data:null)),(e=>e));return 1===o.length&&null!==o[0]?{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}(e.component.scales[t].get("domains").map((t=>(AU(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function IZ(e){return fK(e)||cK(e)?e.children.reduce(((e,t)=>e.concat(IZ(t))),UZ(e)):UZ(e)}function UZ(e){return RB(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:l,range:u,reverse:c,...f}=r,d=function(e,t,n,i){if(RI(n)){if($U(e))return{step:{signal:`${t}_step`}}}else if(we(e)&&AU(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),h=jZ(e,n),p=s?function(e,t,n,i){const r=BJ(e,t.param,t);return{signal:xW(n.get("type"))&&_e(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,s,i,h):null;return t.push({name:o,type:a,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...void 0!==c?{reverse:c}:{},...f}),t}),[])}class qZ extends GV{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||$B(this.get("domains"),(e=>_e(e)&&2===e.length&&e[0]<=0&&e[1]>=0))}}const WZ=["range","scheme"];function HZ(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,o=hI(t),a=e.getName(o);if(we(i)&&i.binned&&void 0!==i.step)return new CZ((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(mU(i)){const t=HQ(e,r,i);return new CZ((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function GZ(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of WZ)if(void 0!==n[i]){const o=NW(r,i),a=TW(e,i);if(o)if(a)Aq(a);else switch(i){case"range":{const i=n.range;if(_e(i)){if(RI(e))return YV(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return CZ.fromName(i,n)}return e})))}else if(we(i))return YV({data:t.requestDataName(aX.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return YV(i)}case"scheme":return YV(YZ(n[i]))}else Aq(vq(r,i,e))}const o=e===lj||"xOffset"===e?"width":"height",a=i[o];if(DY(a))if(RI(e))if(bW(r)){const n=VZ(a,t,e);if(n)return YV({step:n})}else Aq(bq(o));else if(II(e)){const n=e===dj?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=XZ(a,r);if(e)return YV(e)}}const{rangeMin:s,rangeMax:l}=n,u=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,a=t.getSignalName.bind(t),{type:s}=dG(o[e]),l=t.getScaleComponent(e).get("type"),{domain:u,domainMid:c}=t.specifiedScales[e];switch(e){case lj:case uj:{if(EB(["point","band"],l)){const r=JZ(e,n,i.view);if(DY(r))return{step:VZ(r,t,e)}}const r=hI(e),o=t.getName(r);return e===uj&&xW(l)?[CZ.fromName(a,o),0]:[0,CZ.fromName(a,o)]}case dj:case hj:return function(e,t,n){const i=e===dj?"x":"y",r=t.getScaleComponent(i).get("type"),o=t.scaleName(i);if("band"===r){const e=JZ(i,t.size,t.config.view);if(DY(e)){const t=XZ(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}{const n=t.encoding[i];if(UH(n)&&n.timeUnit){const e=Uq(n.timeUnit,(e=>`scale('${o}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner;return i?[{signal:`${EU(i)?`${i.signal}/2`:""+i/2} * (${e})`},{signal:`${EU(i)?`(1 - ${i.signal}/2)`:""+(1-i/2)} * (${e})`}]:[0,{signal:e}]}return vB(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,l);case Aj:{const o=QZ(r,t.component.scales[e].get("zero"),i),a=function(e,t,n,i){const r={x:HZ(n,"x"),y:HZ(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=KZ(t,r,i.view);return gt(e)?e-1:new CZ((()=>`${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=KZ(t,r,i.view);return gt(e)?Math.pow(ZZ*e,2):new CZ((()=>`pow(${ZZ} * ${e.signal}, 2)`))}}throw new Error(cq("size",e))}(r,n,t,i);return wW(l)?function(e,t,n){const i=()=>{const i=RU(t),r=RU(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return EU(t)?new CZ(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&&_e(n)?n.length+1:(Aq(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(l,i,u,e)):[o,a]}case gj:return[0,2*Math.PI];case Dj:return[0,360];case pj:return[0,new CZ((()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`))];case Fj:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Oj:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case $j:return"symbol";case wj:case kj:case Ej:return"ordinal"===l?"nominal"===s?"category":"ordinal":void 0!==c?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case Sj:case Mj:case Cj:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==l)&&NW(r,"rangeMin")&&_e(u)&&2===u.length?YV([s??u[0],l??u[1]]):VV(u)}function YZ(e){return function(e){return!vt(e)&&!!e.name}(e)?{scheme:e.name,...xB(e,["name"])}:{scheme:e}}function VZ(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=mI(n),a=i[o];if("offset"===AY({step:e,offsetIsDiscrete:VH(a)&&nW(a.type)})&&NG(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;"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-${TU(a)})`}}return e.step}function XZ(e,t){if("offset"===AY({step:e,offsetIsDiscrete:bW(t)}))return{step:e.step}}function JZ(e,t,n){const i=e===lj?"width":"height";return t[i]||OY(n,i)}function QZ(e,t,n){if(t)return EU(t)?{signal:`${t.signal} ? 0 : ${QZ(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(cq("size",e))}const ZZ=.95;function KZ(e,t,n){const i=DY(e.width)?e.width.step:FY(n,"width"),r=DY(e.height)?e.height.step:FY(n,"height");return t.x||t.y?new CZ((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function eK(e,t){lK(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of RB(n)){const l=a[s],u=n[s],c=e.getScaleComponent(s),f=dG(r[s]),d=l[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=NW(h,t),y=TW(s,t);if(void 0!==d&&(g?y&&Aq(y):Aq(vq(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":Dq(l[t])||"temporal"===n||e?u.set(t,{signal:bG(l[t],{type:n,timeUnit:e})},!0):u.set(t,l[t],!0);break;default:u.copyKeyFromObject(t,l)}}else{const n=t in tK?tK[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:TG(r,s),hasSecondaryRangeChannel:!!r[dI(s)]}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):iK(e,t)}const tK={bins:({model:e,fieldOrDatumDef:t})=>UH(t)?function(e,t){const n=t.bin;if(mU(n)){const i=HQ(e,t.field,n);return new CZ((()=>e.getSignalName(i)))}if(gU(n)&&yU(n)&&void 0!==n.step)return{step:n.step}}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(EB([wj,kj,Ej],e)&&"nominal"!==t)return"hcl"}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){if(!(fG(o)?.bin||_e(n)||null!=r||null!=i||EB([lW.TIME,lW.UTC],e)))return!!RI(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(RI(e)){if(_W(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!UH(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===lW.POINT)return n.pointPadding}}(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){if(RI(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=r;return o?a:QB(e,"bar"===n?t:i)}return II(t)&&i===lW.BAND?r.offsetBandPaddingInner:void 0}}(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)if(RI(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===lW.BAND)return QB(e,EU(i)?{signal:`${i.signal}/2`}:i/2)}else if(II(t)){if(n===lW.POINT)return.5;if(n===lW.BAND)return r.offsetBandPaddingOuter}}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){return"x"===n&&void 0!==i.xReverse?xW(e)&&"descending"===t?EU(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse:!(!xW(e)||"descending"!==t)||void 0}(t,UH(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&&xW(r)){if(_e(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!wW(r))return!0;if((!UH(t)||!t.bin)&&EB([...zI,...LI],e)){const{orient:t,type:n}=i;return(!EB(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!EB(["bar","area"],n)||a)||o?.zero)}return!1}(e,t,n,i,r,o.scale,a)};function nK(e){lK(e)?function(e){const t=e.component.scales;for(const n of KI){const i=t[n];if(!i)continue;const r=GZ(n,e);i.setWithExplicit("range",r)}}(e):iK(e,"range")}function iK(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?nK(n):eK(n,t);for(const i of RB(n)){let r;for(const n of e.children){const e=n.component.scales[i];e&&(r=QV(r,e.getWithExplicit(t),t,"scale",XV(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))))}n[i].setWithExplicit(t,r)}}function rK(e,t,n,i,r=!1){const o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(Vj(e)||"discrete"===rU(e))return"shape"===e&&"ordinal"===t.type&&Aq(pq(e,"ordinal")),"ordinal";if(RI(e)||II(e)){if(EB(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in PI)return"band";return iH(n[hI(e)])||ZH(t)&&t.axis?.tickBand?"band":"point";case"temporal":return Vj(e)?"time":"discrete"===rU(e)?(Aq(pq(e,"temporal")),"ordinal"):UH(t)&&t.timeUnit&&Iq(t.timeUnit).utc?"utc":"time";case"quantitative":return Vj(e)?UH(t)&&mU(t.bin)?"bin-ordinal":"linear":"discrete"===rU(e)?(Aq(pq(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(sq(t.type))}(t,n,i,r),{type:a}=e;return eU(t)?void 0!==a?function(e,t,n=!1){if(!eU(e))return!1;switch(e){case lj:case uj:case dj:case hj:case gj:case pj:return!!_W(t)||"band"===t||"point"===t&&!n;case Aj:case Fj:case Sj:case Mj:case Cj:case Dj:return _W(t)||wW(t)||EB(["band","point","ordinal"],t);case wj:case kj:case Ej:return"band"!==t;case Oj:case $j:return"ordinal"===t||wW(t)}}(t,a)?UH(n)&&(s=a,l=n.type,!(EB([rW,aW],l)?void 0===s||bW(s):l===oW?EB([lW.TIME,lW.UTC,void 0],s):l!==iW||mW(s)||wW(s)||void 0===s))?(Aq(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(Aq(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,l}function oK(e){lK(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of KI){const a=dG(t[o]);if(a&&n===XW&&o===$j&&a.type===sW)continue;let s=a&&a.scale;if(!II(o)||TG(t,gI(o))){if(a&&null!==s&&!1!==s){s??(s={});const n=rK(s,o,a,i,TG(t,o));r[o]=new qZ(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}else s&&Aq(fq(o))}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){oK(n);for(const o of RB(n.component.scales))if((t=r.scale)[o]??(t[o]=_Q(o,e)),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?cW(e.value,t.value)?i[o]=QV(e,t,"type","scale",aK):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of RB(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new qZ(r,o);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const aK=XV(((e,t)=>dW(e)-dW(t)));class sK{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 lK(e){return"unit"===e?.type}function uK(e){return"facet"===e?.type}function cK(e){return"concat"===e?.type}function fK(e){return"layer"===e?.type}class dK{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.view=_U(a),this.name=e.name??i,this.title=kU(e.title)?{text:e.title}:e.title?_U(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new sK,this.projectionNameMap=n?n.projectionNameMap:new sK,this.signalNameMap=n?n.signalNameMap:new sK,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>pV(e)?{filter:mB(e.filter,eW)}: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&&(OH(e)&&!CH(e.facet)||kY(e))&&(r.columns=a),EY(e)&&(r.columns=1);for(const t of MY)if(void 0!==e[t])if("spacing"===t){const n=e[t];r[t]=gt(n)?n:{row:n.row??o,column:n.column??o}}else r[t]=e[t];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:OH(e)||n?.component.data.isFaceted&&void 0===e.data},layoutSize:new GV,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?yB(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}={}){oK(e),FZ(e);for(const t of OW)eK(e,t);t||nK(e)}(this)}parseProjection(){UQ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){TQ(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of RB(n)){const t=n[e];void 0!==t&&(i[e]=NU(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=NU(this.description)),"unit"!==this.type&&"layer"!==this.type)?zB(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 Jj){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=nQ(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=eQ(i,o),s=hQ(e,a);void 0!==s&&(n[a]=s)}}return zB(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 Jj)e[n].title&&t.push(oQ(this,n));for(const e of iQ)t=t.concat(lQ(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>UJ(e,"grid",t))),...i.map((e=>UJ(e,"grid",t))),...n.map((e=>UJ(e,"main",t))),...i.map((e=>UJ(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return LQ(this)}assembleProjections(){return fK(e=this)||cK(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),BQ(e))}(e):BQ(e);var e}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...wU(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return EB(["unit","layer"],this.type)?EB(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),zB(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||uK(this.parent)?IZ(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 jB((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(aX[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(uK(this.parent)){const t=BI(bQ(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(bW(e)&&$U(i)){const e=n.get("name"),i=BZ(jZ(this,t));return i?{signal:vQ(e,n,nG({aggregate:"distinct",field:i},{expr:"datum"}))}:(Aq(ZU(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):sI(e)&&eU(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}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(){return this.component.axes.x?.some((e=>e.hasOrientSignalRef()))||this.component.axes.y?.some((e=>e.hasOrientSignalRef()))}}class hK extends dK{vgField(e,t={}){const n=this.fieldDef(e);if(n)return nG(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?RB(e).reduce(((n,r)=>{const o=e[r];return _e(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=fG(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){BG(this.getMapping(),((t,n)=>{const i=fG(t);i&&e(i,n)}),t)}}class pK extends hX{clone(){return new pK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"],t.groupby&&null==t.minsteps&&null==t.maxsteps&&null==t.steps&&(this.transform.steps=200)}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${wB(this.transform)}`}assemble(){const{density:e,...t}=this.transform;return{type:"kde",field:e,...t}}}class mK extends hX{clone(){return new mK(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==BU("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=eU(r)&&t.getScaleComponent(r);return o&&xW(o.get("type"))&&"count"!==n.aggregate&&!JW(i)&&(e[n.field]=n),e}),{});return RB(o).length?new mK(e,o):null}dependentFields(){return new Set(RB(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${wB(this.filter)}`}assemble(){const e=RB(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=nG(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class gK extends hX{clone(){return new gK(this.parent,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class yK extends hX{clone(){return new yK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class vK extends hX{clone(){return new vK(null,yB(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[[bj,vj],[_j,xj]]){const r=i.map((e=>{const n=dG(t.encoding[e]);return UH(n)?n.field:WH(n)?{expr:`${n.datum}`}:JH(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new vK(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField($j)){const i=t.typedFieldDef($j);i.type===sW&&(e=new vK(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(vt);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${wB(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 bK extends hX{clone(){return new bK(null,this.projection,yB(this.fields),yB(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[[bj,vj],[_j,xj]]){const i=n.map((e=>{const n=dG(t.encoding[e]);return UH(n)?n.field:WH(n)?{expr:`${n.datum}`}:JH(n)?{expr:`${n.value}`}:void 0})),r=n[0]===_j?"2":"";(i[0]||i[1])&&(e=new bK(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(vt))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${wB(this.fields)} ${wB(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class xK extends hX{clone(){return new xK(null,yB(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 xK(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(UH(i)&&UH(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:l,frame:u,keyvals:c}=o.impute,f=jG(t.mark,n);return new xK(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...u?{frame:u}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${wB(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:mV(n)?this.processSequence(n):n}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};return i&&"value"!==i?[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}]:[s]}}class _K extends hX{clone(){return new _K(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class wK extends hX{clone(){return new wK(null,yB(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"data"in e}(o)){let e=RK(o.data,r);e||(e=new nZ(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new pX(e,n,aX.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(jB(e),e)}catch(t){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new wK(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Ge(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${wB({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:Ge(this.transform.as)}:{}};else{let t=this.transform.as;vt(t)||(Aq('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 kK extends hX{clone(){return new kK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class EK extends hX{clone(){return new EK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=yB(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 ${wB(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class $K extends hX{clone(){return new $K(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=MB((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${wB(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 AK extends hX{clone(){return new AK(null,yB(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${wB(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function DK(e){let t=0;return function n(i,r){if(i instanceof nZ&&!i.isGenerator&&!KV(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof ZQ&&(i.parent instanceof nZ&&!r.source?(r.format={...r.format??{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof XQ)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());switch((i instanceof eZ||i instanceof tZ||i instanceof mK||i instanceof PJ||i instanceof ZJ||i instanceof bK||i instanceof VQ||i instanceof wK||i instanceof wZ||i instanceof xZ||i instanceof yK||i instanceof gK||i instanceof pK||i instanceof _K||i instanceof kK||i instanceof EK||i instanceof KQ||i instanceof AK||i instanceof $K)&&r.transform.push(i.assemble()),(i instanceof YQ||i instanceof mX||i instanceof xK||i instanceof _Z||i instanceof vK)&&r.transform.push(...i.assemble()),i instanceof pX&&(r.source&&0===r.transform.length?i.setSource(r.source):i.parent instanceof pX?i.setSource(r.name):(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof pX&&(!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 SK(e,t){const{facet:n,config:i,child:r,component:o}=e;if(e.channelHasField(t)){const a=n[t],s=tQ("title",null,i,t);let l=sG(a,i,{allowDisabling:!0,includeDefault:void 0===s||!!s});r.component.layoutHeaders[t].title&&(l=_e(l)?l.join(", "):l,l+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const u=tQ("labelOrient",a.header,i,t),c=null!==a.header&&QB(a.header?.labels,i.header.labels,!0),f=EB(["bottom","right"],u)?"footer":"header";o.layoutHeaders[t]={title:null!==a.header?l:null,facetFieldDef:a,[f]:"facet"===t?[]:[MK(e,t,c)]}}}function MK(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 CK(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=wQ(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||EU(i)?"header":"footer";a[t]??(a[t]=[MK(e,o,!1)]);const n=UJ(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function FK(e){for(const t of e.children)t.parseLayoutSize()}function OK(e,t){const n=bQ(t),i=BI(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??_Q(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=QV(a,o,n,"")}else a=o}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 NK(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(bW(e)){const e=OY(i.view,t);return $U(n)||DY(e)?"step":e}return CY(i.view,t)}if(e.hasProjection||"arc"===e.mark)return CY(i.view,t);{const e=OY(i.view,t);return DY(e)?e.step:e}}function TK(e,t,n){return nG(t,{suffix:`by_${nG(e)}`,...n??{}})}class zK extends hK{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=o0(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!CH(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=RB(e),n={};for(const i of t){if(![oj,aj].includes(i)){Aq(cq(i,"facet"));break}const t=e[i];if(void 0===t.field){Aq(uq(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=mG(e,t);return n.header?n.header=_U(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=PK(this),this.child.parseData()}parseLayoutSize(){FK(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of Jj)SK(e,t);CK(e,"x"),CK(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 Jj)for(const n of rQ){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=tQ("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=eQ(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(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 zK))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof zK?{...this.channelHasField("column")?{encode:{update:{columns:{field:nG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof zK){if(this.child.channelHasField("column")){const i=nG(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of zI){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(bW(o)&&$U(a)){const r=BZ(jZ(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):Aq(ZU(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 e of Jj){const t=this.facet[e];if(t){s.push(nG(t));const{bin:l,sort:u}=t;if(mU(l)&&s.push(nG(t,{binSuffix:"end"})),SH(u)){const{field:e,op:s=EH}=u,l=TK(t,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(e),o.push(s),a.push(l))}else if(_e(u)){const n=KJ(t,e);r.push(n),o.push("max"),a.push(n)}}}const l=!!n&&!!i;return{name:e,data:t,groupby:s,...l||r.length>0?{aggregate:{...l?{cross:l}:{},...r.length?{fields:r,ops:o,as:a}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?SH(n.sort)?[TK(n,n.sort,{expr:"datum"})]:_e(n.sort)?[KJ(n,e,{expr:"datum"})]:[nG(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(SH(e)?e.order:!_e(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return cQ(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of iQ)if(e[i]){const r=tQ("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return cQ(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=DK(t);for(const t of e.children)n(t,{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:Jj.map((e=>this.facetSortFields(e))).flat(),order:Jj.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(cX(this,[]))}]}getMapping(){return this.facet}}function RK(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(eX(e)&&eX(t)){if(gB(e.values,t.values))return n}else if(KV(e)&&KV(t)){if(e.url===t.url)return n}else if(tX(e)&&e.name===n.dataName)return n}return null}function PK(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new nZ({values:[]});return t.push(e),e}const n=RK(e.data,t);if(n)return nX(e.data)||(n.data.format=DB({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new nZ(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:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=r&&(nX(r)||KV(r)||eX(r))||!e.parent?new ZV:e.parent.component.data.ancestorParse.clone();nX(r)?(iX(r)?t=new tZ(t,r.sequence):oX(r)&&(t=new eZ(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=ZQ.makeExplicit(t,e,o)??t,t=new KQ(t);const a=e.parent&&fK(e.parent);(lK(e)||uK(e))&&a&&(t=YQ.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(AV(r))a=e=new ZJ(e,r),o="derived";else if(pV(r)){const i=QQ(r);a=e=ZQ.makeWithAncestors(e,{},i,n)??e,e=new PJ(e,t,r.filter)}else if(DV(r))a=e=YQ.makeFromTransform(e,r,t),o="number";else if(MV(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new ZQ(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=mX.makeFromTransform(e,r);else if(CV(r))a=e=VQ.makeFromTransform(e,r),o="number",OJ(t)&&(e=new KQ(e));else if(gV(r))a=e=wK.make(e,t,r,i++),o="derived";else if(kV(r))a=e=new wZ(e,r),o="number";else if(EV(r))a=e=new xZ(e,r),o="number";else if(FV(r))a=e=_Z.makeFromTransform(e,r),o="derived";else if(OV(r))a=e=new yK(e,r),o="derived";else if($V(r))a=e=new gK(e,r),o="derived";else if(yV(r))a=e=new $K(e,r),o="derived";else if(wV(r))e=new AK(e,r);else if(SV(r))a=e=xK.makeFromTransform(e,r),o="derived";else if(vV(r))a=e=new pK(e,r),o="derived";else if(bV(r))a=e=new kK(e,r),o="derived";else if(xV(r))a=e=new EK(e,r),o="derived";else{if(!_V(r)){Aq(`Ignoring an invalid transform: ${_B(r)}.`);continue}a=e=new _K(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(lK(e)&&e.component.selection)for(const n of RB(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&JB(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=function(e){const t={};function n(e){var n;vG(e)?t[e.field]="date":"quantitative"===e.type&&vt(n=e.aggregate)&&EB(["min","max"],n)?t[e.field]="number":JB(e.field)>1?e.field in t||(t[e.field]="flatten"):QH(e)&&SH(e.sort)&&JB(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((lK(e)||uK(e))&&e.forEachFieldDef(((t,i)=>{if(XH(t))n(t);else{const r=cI(i),o=e.fieldDef(r);n({...t,type:o.type})}})),lK(e)){const{mark:n,markDef:i,encoding:r}=e;if(JW(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];UH(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}(e);t=ZQ.makeWithAncestors(t,{},{...s,...l},o)??t,lK(e)&&(t=vK.parseAll(t,e),t=bK.parseAll(t,e)),(lK(e)||uK(e))&&(a||(t=YQ.makeFromEncoding(t,e)??t),t=mX.makeFromEncoding(t,e)??t,t=ZJ.parseAllForSortIndex(t,e));const u=e.getDataName(aX.Raw),c=new pX(t,u,aX.Raw,i);if(n[u]=c,t=c,lK(e)){const n=VQ.makeFromEncoding(t,e);n&&(t=n,OJ(e)&&(t=new KQ(t))),t=xK.makeFromEncoding(t,e)??t,t=_Z.makeFromEncoding(t,e)??t}lK(e)&&(t=mK.make(t,e)??t);const f=e.getDataName(aX.Main),d=new pX(t,f,aX.Main,i);n[f]=d,t=d,lK(e)&&function(e,t){for(const[n,i]of LB(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new pX(new PJ(t,e,{param:n}),r,aX.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let h=null;if(uK(e)){const i=e.getName("facet");t=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(SH(r.sort)){const{field:n,op:i=EH}=r.sort;e=t=new xZ(e,{joinaggregate:[{op:i,field:n,as:TK(r,r.sort,{forAs:!0})}],groupby:[nG(r)]})}return t}return null}(t,e.facet)??t,h=new XQ(t,e,i,d.getSource()),n[i]=h}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:d,facetRoot:h,ancestorParse:o}}class LK extends dK{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||Aq("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)=>o0(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=PK(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 RB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return EY(e)?e.vconcat:$Y(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){FK(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";OK(e,t),OK(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=mQ(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 BK={disable:1,gridScale:1,scale:1,...AG,labelExpr:1,encode:1},jK=RB(BK);class IK extends GV{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new IK(yB(this.explicit),yB(this.implicit),this.mainExtracted)}hasAxisPart(e){return!("axis"!==e&&("grid"===e||"title"===e?!this.get(e):(t=this.get(e),!1===t||null===t)));var t}hasOrientSignalRef(){return EU(this.explicit.orient)}}const UK={bottom:"top",top:"bottom",left:"right",right:"left"};function qK(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<n;i++){const n=e[i],r=t[i];if(!!n!=!!r)return;if(n&&r){const t=n.getWithExplicit("orient"),o=r.getWithExplicit("orient");if(t.explicit&&o.explicit&&t.value!==o.value)return;e[i]=WK(n,r)}}}return e}function WK(e,t){for(const n of jK){const i=QV(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",((e,t)=>{switch(n){case"title":return GU(e,t);case"gridScale":return{explicit:e.explicit,value:QB(e.value,t.value)}}return JV(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function HK(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(EU(n.labelAngle)?n.labelAngle:ij(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===QJ(i,r))return!0}return e===n[t]}const GK=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function YK(e,t){let n=t.axis(e);const i=new IK,r=dG(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),l=t.getScaleComponent(e).get("type"),u=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:mW(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=EU(n)?"axisOrient":`axis${qB(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:WJ(s,i,e,n),vgAxisConfig:WJ(l,i,e,n),axisConfigStyle:HJ([...l,...s],i)}}(e,l,s,t.config),c=void 0!==n?!n:GJ("disable",a.style,n?.style,u).configValue;if(i.set("disable",c,void 0!==n),c)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return EU(o)?o:ij(o);{const{configValue:o}=GJ("labelAngle",i,t?.style,r);return void 0!==o?ij(o):n!==lj||!EB([aW,rW],e.type)||UH(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,u),d=bH(n.formatType,r,l),h=vH(r,r.type,n.format,n.formatType,a,!0),p={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:l,orient:s,labelAngle:f,format:h,formatType:d,mark:o,config:a};for(const r of jK){const o=r in YJ?YJ[r](p):SG(r)?n[r]:void 0,s=void 0!==o,l=HK(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=SG(r)&&"values"!==r?GJ(r,a.style,n.style,u):{},c=void 0!==e;s&&!c?i.set(r,o,l):("vgAxisConfig"!==t||GK.has(r)&&c||kG(e)||EU(e))&&i.set(r,e,!1)}}const m=n.encoding??{},g=EG.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=xQ(m[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=dG(i[t])??dG(i[dI(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(dH(l))return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===qH(o)){if(ZH(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===qH(o)&&r.timeFormatType&&UH(o)&&!o.timeUnit)return{text:yH({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||zB(a)||(n[r]={update:a}),n}),{});return zB(g)||i.set("encode",g,!!n.encoding||void 0!==n.labelAngle),i}function VK(e,t){const{config:n}=e;return{...rJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...HX("x",e,{defaultPos:"mid"}),...HX("y",e,{defaultPos:"mid"}),...IX("size",e),...IX("angle",e),...XK(e,0,t)}}function XK(e,t,n){return n?{shape:{value:n}}:IX("shape",e)}function JK(e,t,n){if(void 0===BU("align",e,n))return"center"}function QK(e,t,n){if(void 0===BU("baseline",e,n))return"middle"}function ZK(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),a=BU("size",n,t,{vgChannel:r})??t.tick.bandSize;if(void 0!==a)return a;{const e=o?o.get("range"):void 0;return e&&$U(e)&&gt(e.step)?3*e.step/4:3*FY(t.view,r)/4}}const KK={arc:{vgMark:"arc",encodeEntry:e=>({...rJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...HX("x",e,{defaultPos:"mid"}),...HX("y",e,{defaultPos:"mid"}),...KX(e,"radius"),...KX(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...rJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...JX("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...JX("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...sJ(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...rJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...KX(e,"x"),...KX(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>VK(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...rJ(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&&UH(n)&&n.type===sW?{field:nG(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...rJ(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...KX(e,"x"),...KX(e,"y"),...NX(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...rJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...HX("x",e,{defaultPos:"mid"}),...HX("y",e,{defaultPos:"mid"}),...IX("size",e,{vgChannel:"strokeWidth"}),...sJ(e)})},point:{vgMark:"symbol",encodeEntry:e=>VK(e)},rect:{vgMark:"rect",encodeEntry:e=>({...rJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...KX(e,"x"),...KX(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?{...rJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...JX("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...JX("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...IX("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>VK(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...rJ(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...HX("x",e,{defaultPos:"mid"}),...HX("y",e,{defaultPos:"mid"}),...NX(e),...IX("size",e,{vgChannel:"fontSize"}),...IX("angle",e),...lJ("align",JK(e.markDef,0,t)),...lJ("baseline",QK(e.markDef,0,t)),...HX("radius",e,{defaultPos:null}),...HX("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return{...rJ(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...HX("x",e,{defaultPos:"mid",vgChannel:"xc"}),...HX("y",e,{defaultPos:"mid",vgChannel:"yc"}),...IX("size",e,{defaultValue:ZK(e),vgChannel:r}),[o]:NU(BU("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...rJ(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...HX("x",e,{defaultPos:"mid"}),...HX("y",e,{defaultPos:"mid"}),...IX("size",e),...sJ(e)})}};const e0="faceted_path_",t0="stack_group_";function n0(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=QB(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),s=LU(i),l=r.key,u=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!_e(a)&&JH(a)&&kB(a.value)||!a&&kB(BU("order",r,o)))){if((_e(a)||UH(a))&&!n)return qU(a,{expr:"datum"});if(JW(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(UH(i)){const t=i.sort;return _e(t)?{field:nG(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:SH(t)?{field:nG({aggregate:zG(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:DH(t)?{field:nG(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:nG(i,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}}}}(e),c=function(e){if(!e.component.selection)return null;const t=RB(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=RB(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip}:null}(e),f=BU("aria",i,o),d=KK[n].postEncodingTransform?KK[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:KK[n].vgMark,...a?{clip:!0}:{},...s?{style:s}:{},...l?{key:l.field}:{},...u?{sort:u}:{},...c||{},...!1===f?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(aX.Main)},encode:{update:KK[n].encodeEntry(e)},...d?{transform:d}:{}}]}class i0 extends hK{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,SY(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const o=KW(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=jU("filled",e,t),r=e.type;return QB(i,r!==IW&&r!==jW&&r!==qW)}(o,r,{graticule:e.data&&oX(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const t of RB(e))sI(t)||Aq(`${o=t}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let o of yI){if(!e[o])continue;const s=e[o];if(II(o)){const e=gI(o),t=r[e];if(UH(t)){if(("quantitative"===(a=t.type)||"temporal"===a)&&UH(s)&&!t.timeUnit){Aq(oq(e));continue}}else o=e,Aq(aq(e))}if("angle"!==o||"arc"!==t||e.theta||(Aq("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=gj),PG(e,o,t)){if(o===Aj&&"line"===t){const t=fG(e[o]);if(t?.aggregate){Aq("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===wj&&(n?"fill"in e:"stroke"in e))Aq(lq("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(o===zj||o===Tj&&!_e(s)&&!JH(s)||o===Pj&&_e(s)){if(s){if(o===Tj){const t=e[o];if(LH(t)){r[o]=t;continue}}r[o]=Ge(s).reduce(((e,t)=>(UH(t)?e.push(mG(t,o)):Aq(uq(t,o)),e)),[])}}else{if(o===Pj&&null===s)r[o]=null;else if(!(UH(s)||WH(s)||JH(s)||BH(s)||EU(s))){Aq(uq(s,o));continue}r[o]=hG(s,o,i)}}else Aq(cq(o,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=function(e,t,n){const i=_U(e),r=BU("orient",i,n);if(i.orient=function(e,t,n){switch(e){case IW:case YW:case VW:case WW:case UW:case BW:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case LW:if(UH(i)&&(gU(i.bin)||UH(r)&&r.aggregate&&!i.aggregate))return"vertical";if(UH(r)&&(gU(r.bin)||UH(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(UH(i)&&i.type===iW&&!mU(i.bin)||YH(i))&&UH(r)&&gU(r.bin)?"horizontal":"vertical";if(!a)return(UH(r)&&r.type===iW&&!mU(r.bin)||YH(r))&&UH(i)&&gU(i.bin)?"vertical":"horizontal"}case qW:if(o&&(!UH(i)||!gU(i.bin))&&a&&(!UH(r)||!gU(r.bin)))return;case PW:if(a)return UH(r)&&gU(r.bin)?"horizontal":"vertical";if(o)return UH(i)&&gU(i.bin)?"vertical":"horizontal";if(e===qW){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case jW:case HW:{const t=GH(i),o=GH(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=XH(i)&&i.type===oW,t=XH(r)&&r.type===oW;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&Aq(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=BU("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:rH[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}return void 0===BU("opacity",i,n)&&(i.opacity=function(e,t){if(EB([IW,HW,YW,VW],e)&&!zG(t))return.7}(i.type,t)),void 0===BU("cursor",i,n)&&(i.cursor=function(e,t,n){return t.href||e.href||BU("href",e,n)?"pointer":e.cursor}(i,t,n)),i}(o,s,r),this.size=function({encoding:e,size:t}){for(const n of zI){const i=hI(n);DY(t[i])&&HH(e[n])&&(delete t[i],Aq(bq(i)))}return t}({encoding:s,size:SY(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=ZY(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=>_Y(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===XW,n=e&&Gj.some((t=>VH(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 KI.reduce(((e,n)=>{const i=dG(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=_U(e);return _e(t)&&(i.domain=t.map(FU)),_e(n)&&(i.range=n.map(FU)),i}initAxes(e){return zI.reduce(((t,n)=>{const i=e[n];if(VH(i)||n===lj&&VH(e.x2)||n===uj&&VH(e.y2)){const e=VH(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=RB(e),n={};for(const i of t){const t=e[i];n[i]=kG(t)?CU(t):FU(t)}return n}initLegends(e){return QI.reduce(((t,n)=>{const i=dG(e[n]);if(i&&function(e){switch(e){case wj:case kj:case Ej:case Aj:case $j:case Sj:case Fj:case Oj:return!0;case Mj:case Cj:case Dj:return!1}}(n)){const e=i.legend;t[n]=e?_U(e):e}return t}),{})}parseData(){this.component.data=PK(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of zI){const r=hI(i);if(t[r]){const e=t[r];n.layoutSize.set(r,DY(e)?"step":e,!0)}else{const t=NK(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;for(const r of t){const t=jB(r.name),o=r.select,a=vt(o)?o:o.type,s=we(o)?yB(o):{type:a},l=i[a];for(const e in l)"fields"!==e&&"encodings"!==e&&("mark"===e&&(s[e]={...l[e],...s[e]}),void 0!==s[e]&&!0!==s[e]||(s[e]=yB(l[e]??s[e])));const u=n[t]={...s,name:t,type:a,init:r.value,bind:r.bind,events:vt(s.on)?zT(s.on,"scope"):Ge(yB(s.on))},c=yB(r);for(const t of CJ)t.defined(u)&&t.parse&&t.parse(e,u,c)}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=function(e){if(EB([jW,PW,GW],e.mark)){const t=jG(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:e0+e.requestDataName(aX.Main),data:e.requestDataName(aX.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:n0(e,{fromPrefix:e0})}]}(e,t)}else if(e.mark===LW){const t=MU.some((t=>BU(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=n0(e,{fromPrefix:t0}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${n}',${e})`)).join(",")})`;let o,a;"x"===e.stack.fieldChannel?(o={...bB(t.encode.update,["y","yc","y2","height",...MU]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...xB(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...bB(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...xB(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of MU){const i=jU(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=NU(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=nG(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(nG(n,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=jU(i,e.markDef,e.config);return void 0!==t?{...n,[i]:NU(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(aX.Main),name:t0+e.requestDataName(aX.Main),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}(e)}return n0(e)}(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,zI.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[YK(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of PB(e.component.selection??{})){const r=i.name,o=Dt(r+AJ);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:`${MJ}(${o}, ${Dt(e)}${n}`})}n=!0;for(const n of CJ)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}if(n){0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return dX(t)}(this,e)}assembleSignals(){return[...qJ(this),...uX(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=FJ(e,{escape:!1});for(const t of PB(e.component.selection??{})){const e={name:t.name+AJ};if(t.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:yY}}]),t.init){const n=t.project.items.map(sX);e.values=t.project.hasSelectionId?t.init.map((e=>({unit:i,[yY]:lX(e,!1)[0]}))):t.init.map((e=>({unit:i,fields:n,values:lX(e,!1)})))}n.filter((e=>e.name===t.name+AJ)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return mQ(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&fK(this.parent)||(e=fX(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 OG(this.encoding,e)}fieldDef(e){return fG(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return XH(t)?t:null}}class r0 extends dK{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(HY(e))return new r0(e,this,this.getName(`layer_${t}`),o,r);if(CG(e))return new i0(e,this,this.getName(`layer_${t}`),o,r);throw new Error(YU(e))}))}parseData(){this.component.data=PK(this);for(const e of this.children)e.parseData()}parseLayoutSize(){FK(this),OK(this,"width"),OK(this,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of RB(e.component.selection))this.component.selection[t]=e.component.selection[t]}}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 i of e.children){i.parseAxesAndHeaders();for(const r of RB(i.component.axes))n.axis[r]=wQ(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=qK(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of zI){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(!EU(t)){if(i[t]>0&&!n){const n=UK[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 of t[r])e.get("grid")&&!e.explicit.grid&&(e.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())),qJ(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),mQ(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const t of this.children)for(const n of Ge(t.assembleGroupStyle()))e.add(n);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)lK(n)&&(t=fX(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),LQ(this))}}function o0(e,t,n,i,r){if(OH(e))return new zK(e,t,n,r);if(HY(e))return new r0(e,t,n,i,r);if(CG(e))return new i0(e,t,n,i,r);if(function(e){return EY(e)||$Y(e)||kY(e)}(e))return new LK(e,t,n,r);throw new Error(YU(e))}function a0(e,t={}){var n;t.logger&&(n=t.logger,$q=n),t.fieldTitle&&aG(t.fieldTitle);try{const n=jY(Ee(t.config,e.config)),i=BV(e,n),r=o0(i,null,"",void 0,n);r.parse(),function(e,t){DZ(e.sources);let n=0,i=0;for(let i=0;i<AZ&&MZ(e,t,!0);i++)n++;e.sources.map(kZ);for(let n=0;n<AZ&&MZ(e,t,!1);n++)i++;DZ(e.sources),Math.max(n,i)===AZ&&Aq(`Maximum optimization runs(${AZ}) reached.`)}(r.component.data,r);const o=function(e,t,n={},i){const r=e.config?function(e){e=yB(e);for(const t of UY)delete e[t];if(e.axis)for(const t in e.axis)kG(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of uY)delete e.legend[t];if(e.mark){for(const t of tH)delete e.mark[t];e.mark.tooltip&&we(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(wY(e.params)),delete e.params);for(const t of IY){for(const n of tH)delete e[t][n];const n=qY[t];if(n)for(const i of n)delete e[t][i];WY(e,t)}for(const t of RB(sY))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=wU(e.title);zB(t)||(e.style["group-title"]={...e.style["group-title"],...t}),zB(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),zB(i)?delete e.title:e.title=i}(e);for(const t in e)we(e[t])&&zB(e[t])&&delete e[t];return zB(e)?void 0:e}(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){const n=[],i=DK(n);let r=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+r++);const e=t.assemble();i(t,e)}for(const e of n)0===e.transform.length&&delete e.transform;let o=0;for(const[e,t]of n.entries())0!==(t.transform??[]).length||t.source||n.splice(o++,0,n.splice(e,1)[0]);for(const t of n)for(const n of t.transform??[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of n)e.name in t&&(e.values=t[e.name]);return n}(e.component.data,n)),a=e.assembleProjections(),s=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();c=c.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([]),...wY(f)]),...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");if(void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):vt(t)&&(t={type:t}),r&&o&&("fit"===(a=t.type)||"fit-x"===a||"fit-y"===a))if("step"===r&&"step"===o)Aq(QU()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";Aq(QU(BI(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${BI(e)}`:"fit"}(n)}var a;return{...1===RB(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...HV(n,!1),...HV(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&($q=Eq),t.fieldTitle&&aG(rG)}}const s0="5.9.3",l0=function(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}};const u0="#fff",c0="#888",f0={background:"#333",view:{stroke:c0},title:{color:u0,subtitleColor:u0},style:{"guide-label":{fill:u0},"guide-title":{fill:u0}},axis:{domainColor:u0,gridColor:c0,tickColor:u0}},d0="#4572a7",h0={background:"#fff",arc:{fill:d0},area:{fill:d0},line:{stroke:d0,strokeWidth:2},path:{stroke:d0},rect:{fill:d0},shape:{stroke:d0},symbol:{fill:d0,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"]}},p0="#30a2da",m0="#cbcbcb",g0="#f0f0f0",y0="#333",v0={arc:{fill:p0},area:{fill:p0},axis:{domainColor:m0,grid:!0,gridColor:m0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:m0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:g0,group:{fill:g0},legend:{labelColor:y0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:y0,titleFontSize:14,titlePadding:10},line:{stroke:p0,strokeWidth:2},path:{stroke:p0,strokeWidth:.5},rect:{fill:p0},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:p0},bar:{binSpacing:2,fill:p0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},b0="#000",x0={group:{fill:"#e5e5e5"},arc:{fill:b0},area:{fill:b0},line:{stroke:b0},path:{stroke:b0},rect:{fill:b0},shape:{stroke:b0},symbol:{fill:b0,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"]}},_0="Benton Gothic, sans-serif",w0="#82c6df",k0="Benton Gothic Bold, sans-serif",E0="normal",$0={"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"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},A0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:k0,fontSize:22,fontWeight:"normal"},arc:{fill:w0},area:{fill:w0},line:{stroke:w0,strokeWidth:2},path:{stroke:w0},rect:{fill:w0},shape:{stroke:w0},symbol:{fill:w0,size:30},axis:{labelFont:_0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:k0,titleFontSize:13,titleFontWeight:E0},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:_0,labelFontSize:11.5,symbolType:"square",titleFont:k0,titleFontSize:13,titleFontWeight:E0},range:{category:$0["category-6"],diverging:$0["fireandice-6"],heatmap:$0["fire-7"],ordinal:$0["fire-7"],ramp:$0["fire-7"]}},D0="#ab5787",S0="#979797",M0={background:"#f9f9f9",arc:{fill:D0},area:{fill:D0},line:{stroke:D0},path:{stroke:D0},rect:{fill:D0},shape:{stroke:D0},symbol:{fill:D0,size:30},axis:{domainColor:S0,domainWidth:.5,gridWidth:.2,labelColor:S0,tickColor:S0,tickWidth:.2,titleColor:S0},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"]}},C0="#3e5c69",F0={background:"#fff",arc:{fill:C0},area:{fill:C0},line:{stroke:C0},path:{stroke:C0},rect:{fill:C0},shape:{stroke:C0},symbol:{fill:C0},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"]}},O0="#1696d2",N0="#000000",T0="Lato",z0="Lato",R0={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},P0={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:T0},axisX:{domain:!0,domainColor:N0,domainWidth:1,grid:!1,labelFontSize:12,labelFont:z0,labelAngle:0,tickColor:N0,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:T0},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:z0,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:T0,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:z0,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:T0,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:R0["six-groups-cat-1"],diverging:R0["diverging-colors"],heatmap:R0["diverging-colors"],ordinal:R0["six-groups-seq"],ramp:R0["shades-blue"]},area:{fill:O0},rect:{fill:O0},line:{color:O0,stroke:O0,strokeWidth:5},trail:{color:O0,stroke:O0,strokeWidth:0,size:1},path:{stroke:O0,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:O0,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:O0,stroke:null}},arc:{fill:O0},shape:{stroke:O0},symbol:{fill:O0,size:30}},L0="#3366CC",B0="#ccc",j0="Arial, sans-serif",I0={arc:{fill:L0},area:{fill:L0},path:{stroke:L0},rect:{fill:L0},shape:{stroke:L0},symbol:{stroke:L0},circle:{fill:L0},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:j0,fontSize:12},"guide-title":{font:j0,fontSize:12},"group-title":{font:j0,fontSize:12}},title:{font:j0,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:B0,tickColor:B0,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},U0=e=>e*(1/3+1),q0=U0(9),W0=U0(10),H0=U0(12),G0="Segoe UI",Y0="wf_standard-font, helvetica, arial, sans-serif",V0="#252423",X0="#605E5C",J0="transparent",Q0="#118DFF",Z0="#DEEFFF",K0=[Z0,Q0],e1={view:{stroke:J0},background:J0,font:G0,header:{titleFont:Y0,titleFontSize:H0,titleColor:V0,labelFont:G0,labelFontSize:W0,labelColor:X0},axis:{ticks:!1,grid:!1,domain:!1,labelColor:X0,labelFontSize:q0,titleFont:Y0,titleColor:V0,titleFontSize:H0,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:Q0},line:{stroke:Q0,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:G0,fontSize:q0,fill:X0},arc:{fill:Q0},area:{fill:Q0,line:!0,opacity:.6},path:{stroke:Q0},rect:{fill:Q0},point:{fill:Q0,filled:!0,size:75},shape:{stroke:Q0},symbol:{fill:Q0,strokeWidth:1.5,size:50},legend:{titleFont:G0,titleFontWeight:"bold",titleColor:X0,labelFont:G0,labelFontSize:W0,labelColor:X0,symbolType:"circle",symbolSize:75},range:{category:[Q0,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:K0,heatmap:K0,ordinal:[Z0,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",Q0]}},t1="2.13.0";function n1(e){return n1="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},n1(e)}function i1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==n1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==n1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const r1=["title","image"];function o1(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,i){if("object"!=typeof i||null===i)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}(t))}const a1="vg-tooltip-element",s1={offsetX:10,offsetY:10,id:a1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(e,t,n){if(_e(e))return`[${e.map((e=>t(vt(e)?e:o1(e,n)))).join(", ")}]`;if(we(e)){let i="";const r=e,{title:o,image:a}=r,s=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(r,r1);o&&(i+=`<h2>${t(o)}</h2>`),a&&(i+=`<img src="${t(a)}">`);const l=Object.keys(s);if(l.length>0){i+="<table>";for(const e of l){let r=s[e];void 0!==r&&(we(r)&&(r=o1(r,n)),i+=`<tr><td class="key">${t(e)}:</td><td class="value">${t(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return t(e)}};function l1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function u1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l1(Object(n),!0).forEach((function(t){i1(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l1(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class c1{constructor(e){this.options=u1(u1({},s1),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"#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".toString().replace(a1,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,i){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)),null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:o}=function(e,t,n,i){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let o=e.clientY+i;return o+t.height>window.innerHeight&&(o=+e.clientY-i-t.height),{x:r,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${o}px`,this.el.style.left=`${r}px`}}var f1,d1,h1=n(27061);function p1(e){return p1="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},p1(e)}function m1(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==p1(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==p1(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===p1(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var y1=v1;function v1(e){var t=this;if(t instanceof v1||(t=new v1),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,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}function b1(e,t,n){var i=t===e.head?new w1(n,null,t,e):new w1(n,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function x1(e,t){e.tail=new w1(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function _1(e,t){e.head=new w1(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function w1(e,t,n,i){if(!(this instanceof w1))return new w1(e,t,n,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}v1.Node=w1,v1.create=v1,v1.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},v1.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},v1.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},v1.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)x1(this,arguments[e]);return this.length},v1.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)_1(this,arguments[e]);return this.length},v1.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},v1.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},v1.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,i=0;null!==n;i++)e.call(t,n.value,i,this),n=n.next},v1.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,i=this.length-1;null!==n;i--)e.call(t,n.value,i,this),n=n.prev},v1.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},v1.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},v1.prototype.map=function(e,t){t=t||this;for(var n=new v1,i=this.head;null!==i;)n.push(e.call(t,i.value,this)),i=i.next;return n},v1.prototype.mapReverse=function(e,t){t=t||this;for(var n=new v1,i=this.tail;null!==i;)n.push(e.call(t,i.value,this)),i=i.prev;return n},v1.prototype.reduce=function(e,t){var n,i=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},v1.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},v1.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},v1.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},v1.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new v1;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,r=this.head;null!==r&&i<e;i++)r=r.next;for(;null!==r&&i<t;i++,r=r.next)n.push(r.value);return n},v1.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new v1;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,r=this.tail;null!==r&&i>t;i--)r=r.prev;for(;null!==r&&i>e;i--,r=r.prev)n.push(r.value);return n},v1.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,r=this.head;null!==r&&i<e;i++)r=r.next;var o=[];for(i=0;r&&i<t;i++)o.push(r.value),r=this.removeNode(r);for(null===r&&(r=this.tail),r!==this.head&&r!==this.tail&&(r=r.prev),i=0;i<n.length;i++)r=b1(this,r,n[i]);return o},v1.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=e,this};try{(d1||(d1=1,f1=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),f1)(v1)}catch(e){}const k1=y1,E1=Symbol("max"),$1=Symbol("length"),A1=Symbol("lengthCalculator"),D1=Symbol("allowStale"),S1=Symbol("maxAge"),M1=Symbol("dispose"),C1=Symbol("noDisposeOnSet"),F1=Symbol("lruList"),O1=Symbol("cache"),N1=Symbol("updateAgeOnGet"),T1=()=>1,z1=(e,t,n)=>{const i=e[O1].get(t);if(i){const t=i.value;if(R1(e,t)){if(L1(e,i),!e[D1])return}else n&&(e[N1]&&(i.value.now=Date.now()),e[F1].unshiftNode(i));return t.value}},R1=(e,t)=>{if(!t||!t.maxAge&&!e[S1])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[S1]&&n>e[S1]},P1=e=>{if(e[$1]>e[E1])for(let t=e[F1].tail;e[$1]>e[E1]&&null!==t;){const n=t.prev;L1(e,t),t=n}},L1=(e,t)=>{if(t){const n=t.value;e[M1]&&e[M1](n.key,n.value),e[$1]-=n.length,e[O1].delete(n.key),e[F1].removeNode(t)}};class B1{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const j1=(e,t,n,i)=>{let r=n.value;R1(e,r)&&(L1(e,n),e[D1]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};const I1=Object.freeze({loose:!0}),U1=Object.freeze({});var q1=e=>e?"object"!=typeof e?I1:e:U1,W1={exports:{}},H1={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},G1="object"==typeof h1&&h1.env&&h1.env.NODE_DEBUG&&/\bsemver\b/i.test(h1.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=H1,i=G1,r=(t=e.exports={}).re=[],o=t.src=[],a=t.t={};let s=0;const l=(e,t,n)=>{const l=s++;i(e,l,t),a[e]=l,o[l]=t,r[l]=new RegExp(t,n?"g":void 0)};l("NUMERICIDENTIFIER","0|[1-9]\\d*"),l("NUMERICIDENTIFIERLOOSE","[0-9]+"),l("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),l("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),l("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),l("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),l("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),l("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),l("BUILDIDENTIFIER","[0-9A-Za-z-]+"),l("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),l("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),l("FULL",`^${o[a.FULLPLAIN]}$`),l("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),l("LOOSE",`^${o[a.LOOSEPLAIN]}$`),l("GTLT","((?:<|>)?=?)"),l("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),l("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),l("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),l("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),l("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),l("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),l("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),l("COERCERTL",o[a.COERCE],!0),l("LONETILDE","(?:~>?)"),l("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",l("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),l("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),l("LONECARET","(?:\\^)"),l("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",l("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),l("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),l("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),l("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),l("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",l("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),l("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),l("STAR","(<|>)?=?\\s*\\*"),l("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),l("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(W1,W1.exports);var Y1=W1.exports;const V1=/^[0-9]+$/,X1=(e,t)=>{const n=V1.test(e),i=V1.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:e<t?-1:1};var J1={compareIdentifiers:X1,rcompareIdentifiers:(e,t)=>X1(t,e)};const Q1=G1,{MAX_LENGTH:Z1,MAX_SAFE_INTEGER:K1}=H1,{re:e2,t:t2}=Y1,n2=q1,{compareIdentifiers:i2}=J1;var r2=class e{constructor(t,n){if(n=n2(n),t instanceof e){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid Version: ${t}`);if(t.length>Z1)throw new TypeError(`version is longer than ${Z1} characters`);Q1("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const i=t.trim().match(n.loose?e2[t2.LOOSE]:e2[t2.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>K1||this.major<0)throw new TypeError("Invalid major version");if(this.minor>K1||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>K1||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<K1)return t}return e})):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Q1("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),i2(this.major,t.major)||i2(this.minor,t.minor)||i2(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const e=this.prerelease[n],i=t.prerelease[n];if(Q1("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return i2(e,i)}while(++n)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let n=0;do{const e=this.build[n],i=t.build[n];if(Q1("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return i2(e,i)}while(++n)}inc(e,t,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}if(t){const e=Number(n)?1:0;0===i2(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=[t,e]):this.prerelease=[t,e]}break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};const o2=r2;var a2=(e,t,n)=>new o2(e,n).compare(new o2(t,n));const s2=a2;const l2=a2;const u2=a2;const c2=a2;const f2=a2;const d2=a2;const h2=(e,t,n)=>0===s2(e,t,n),p2=(e,t,n)=>0!==l2(e,t,n),m2=(e,t,n)=>u2(e,t,n)>0,g2=(e,t,n)=>c2(e,t,n)>=0,y2=(e,t,n)=>f2(e,t,n)<0,v2=(e,t,n)=>d2(e,t,n)<=0;var b2,x2,_2,w2,k2=(e,t,n,i)=>{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 h2(e,n,i);case"!=":return p2(e,n,i);case">":return m2(e,n,i);case">=":return g2(e,n,i);case"<":return y2(e,n,i);case"<=":return v2(e,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};const E2=function e(){if(w2)return _2;w2=1;class t{constructor(e,n){if(n=i(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof r)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e,this.set=e.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,i=n.get(t);if(i)return i;const a=this.options.loose,m=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(m,D(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],u),o("comparator trim",e);let g=(e=(e=(e=e.replace(s[l.TILDETRIM],c)).replace(s[l.CARETTRIM],f)).split(/\s+/).join(" ")).split(" ").map((e=>y(e,this.options))).join(" ").split(/\s+/).map((e=>A(e,this.options)));a&&(g=g.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE]))))),o("range list",g);const v=new Map,b=g.map((e=>new r(e,this.options)));for(const e of b){if(p(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const x=[...v.values()];return n.set(t,x),x}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>g(t,n)&&e.set.some((e=>g(e,n)&&t.every((t=>e.every((e=>t.intersects(e,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(S(this.set[t],e,this.options))return!0;return!1}}_2=t;const n=new 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[E1]=e.max||1/0;const t=e.length||T1;if(this[A1]="function"!=typeof t?T1:t,this[D1]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[S1]=e.maxAge||0,this[M1]=e.dispose,this[C1]=e.noDisposeOnSet||!1,this[N1]=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[E1]=e||1/0,P1(this)}get max(){return this[E1]}set allowStale(e){this[D1]=!!e}get allowStale(){return this[D1]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[S1]=e,P1(this)}get maxAge(){return this[S1]}set lengthCalculator(e){"function"!=typeof e&&(e=T1),e!==this[A1]&&(this[A1]=e,this[$1]=0,this[F1].forEach((e=>{e.length=this[A1](e.value,e.key),this[$1]+=e.length}))),P1(this)}get lengthCalculator(){return this[A1]}get length(){return this[$1]}get itemCount(){return this[F1].length}rforEach(e,t){t=t||this;for(let n=this[F1].tail;null!==n;){const i=n.prev;j1(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[F1].head;null!==n;){const i=n.next;j1(this,e,n,t),n=i}}keys(){return this[F1].toArray().map((e=>e.key))}values(){return this[F1].toArray().map((e=>e.value))}reset(){this[M1]&&this[F1]&&this[F1].length&&this[F1].forEach((e=>this[M1](e.key,e.value))),this[O1]=new Map,this[F1]=new k1,this[$1]=0}dump(){return this[F1].map((e=>!R1(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[F1]}set(e,t,n){if((n=n||this[S1])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,r=this[A1](t,e);if(this[O1].has(e)){if(r>this[E1])return L1(this,this[O1].get(e)),!1;const o=this[O1].get(e).value;return this[M1]&&(this[C1]||this[M1](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[$1]+=r-o.length,o.length=r,this.get(e),P1(this),!0}const o=new B1(e,t,r,i,n);return o.length>this[E1]?(this[M1]&&this[M1](e,t),!1):(this[$1]+=o.length,this[F1].unshift(o),this[O1].set(e,this[F1].head),P1(this),!0)}has(e){if(!this[O1].has(e))return!1;const t=this[O1].get(e).value;return!R1(this,t)}get(e){return z1(this,e,!0)}peek(e){return z1(this,e,!1)}pop(){const e=this[F1].tail;return e?(L1(this,e),e.value):null}del(e){L1(this,this[O1].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[O1].forEach(((e,t)=>z1(this,t,!1)))}}({max:1e3}),i=q1,r=function(){if(x2)return b2;x2=1;const t=Symbol("SemVer ANY");class n{static get ANY(){return t}constructor(e,r){if(r=i(r),e instanceof n){if(e.loose===!!r.loose)return e;e=e.value}s("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===t?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(e){const n=this.options.loose?r[o.COMPARATORLOOSE]:r[o.COMPARATOR],i=e.match(n);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new l(i[2],this.options.loose):this.semver=t}toString(){return this.value}test(e){if(s("Comparator.test",e,this.options.loose),this.semver===t||e===t)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return a(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new u(e.value,t).test(this.value):""===e.operator?""===e.value||new u(this.value,t).test(e.semver):!((t=i(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(a(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(a(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}b2=n;const i=q1,{re:r,t:o}=Y1,a=k2,s=G1,l=r2,u=e();return b2}(),o=G1,a=r2,{re:s,t:l,comparatorTrimReplace:u,tildeTrimReplace:c,caretTrimReplace:f}=Y1,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=H1,p=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const i=e.slice();let r=i.pop();for(;n&&i.length;)n=i.every((e=>r.intersects(e,t))),r=i.pop();return n},y=(e,t)=>(o("comp",e,t),e=_(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=k(e,t),o("xrange",e),e=$(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>x(e,t))).join(" "),x=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,((t,n,i,r,a)=>{let s;return o("tilde",e,t,n,i,r,a),v(n)?s="":v(i)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(r)?s=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${i}.${r}-${a} <${n}.${+i+1}.0-0`):s=`>=${n}.${i}.${r} <${n}.${+i+1}.0-0`,o("tilde return",s),s}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(n,((t,n,r,a,s)=>{let l;return o("caret",e,t,n,r,a,s),v(n)?l="":v(r)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${r}.0${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.0${i} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===r?`>=${n}.${r}.${a}-${s} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}-${s} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===r?`>=${n}.${r}.${a}${i} <${n}.${r}.${+a+1}-0`:`>=${n}.${r}.${a}${i} <${n}.${+r+1}.0-0`:`>=${n}.${r}.${a} <${+n+1}.0.0-0`),o("caret return",l),l}))},k=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>E(e,t))).join(" ")),E=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,((n,i,r,a,s,l)=>{o("xRange",e,n,i,r,a,s,l);const u=v(r),c=u||v(a),f=c||v(s),d=f;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",u?n=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(c&&(a=0),s=0,">"===i?(i=">=",c?(r=+r+1,a=0,s=0):(a=+a+1,s=0)):"<="===i&&(i="<",c?r=+r+1:a=+a+1),"<"===i&&(l="-0"),n=`${i+r}.${a}.${s}${l}`):c?n=`>=${r}.0.0${l} <${+r+1}.0.0-0`:f&&(n=`>=${r}.${a}.0${l} <${r}.${+a+1}.0-0`),o("xRange return",n),n}))},$=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),A=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),D=e=>(t,n,i,r,o,a,s,l,u,c,f,d,h)=>`${n=v(i)?"":v(r)?`>=${i}.0.0${e?"-0":""}`:v(o)?`>=${i}.${r}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(u)?"":v(c)?`<${+u+1}.0.0-0`:v(f)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${f}-${d}`:e?`<${u}.${c}.${+f+1}-0`:`<=${l}`}`.trim(),S=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==r.ANY&&e[n].semver.prerelease.length>0){const i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return _2}();var $2=(e,t,n)=>{try{t=new E2(t,n)}catch(e){return!1}return t.test(e)},A2=g1($2),D2='.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 S2(e,...t){for(const n of t)M2(e,n);return e}function M2(e,t){for(const n of Object.keys(t))$e(e,n,t[n],!0)}function C2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function F2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C2(Object(n),!0).forEach((function(t){m1(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C2(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const O2="6.22.1",N2=y;let T2=v;const z2="undefined"!=typeof window?window:void 0;void 0===T2&&z2?.vl?.compile&&(T2=z2.vl);const R2={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},P2={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},L2={vega:"Vega","vega-lite":"Vega-Lite"},B2={vega:N2.version,"vega-lite":T2?T2.version:"not available"},j2={vega:e=>e,"vega-lite":(e,t)=>T2.compile(e,{config:t}).spec},I2='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">\n <circle r="2" cy="8" cx="2"></circle>\n <circle r="2" cy="8" cx="8"></circle>\n <circle r="2" cy="8" cx="14"></circle>\n</svg>',U2="chart-wrapper";function q2(e,t,n,i){const r=`<html><head>${t}</head><body><pre><code class="json">`,o=`</code></pre>${n}</body></html>`,a=window.open("");a.document.write(r+e+o),a.document.title=`${L2[i]} JSON Source`}function W2(e,t){if(e.$schema){const n=l0(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${L2[n.library]}, but mode argument sets ${L2[t]??t}.`);const i=n.library;return A2(B2[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${L2[i]} ${n.version}, but the current version of ${L2[i]} is v${B2[i]}.`),i}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"}function H2(e){return(t=e)&&"load"in t?e:N2.loader(e);var t}async function G2(e,t,n={}){let i,r;vt(t)?(r=H2(n.loader),i=JSON.parse(await r.load(t))):i=t;const o=function(e){const t=e.usermeta?.embedOptions??{};return vt(t.defaultStyle)&&(t.defaultStyle=!1),t}(i),a=o.loader;r&&!a||(r=H2(n.loader??a));const s=await Y2(o,r),l=await Y2(n,r),u=F2(F2({},S2(l,s)),{},{config:Ee(l.config??{},s.config??{})});return await async function(e,t,n={},i){const r=n.theme?Ee(b[n.theme],n.config??{}):n.config,o=ht(n.actions)?n.actions:S2({},R2,n.actions??{}),a=F2(F2({},P2),n.i18n),s=n.renderer??"canvas",l=n.logLevel??N2.Warn,u=n.downloadFileName??"visualization",c="string"==typeof e?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(!1!==n.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:i}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(c);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===n.defaultStyle||!0===n.defaultStyle?D2.toString():n.defaultStyle,i.appendChild(t)}}const f=W2(t,n.mode);let d=j2[f](t,r);if("vega-lite"===f&&d.$schema){const e=l0(d.$schema);A2(B2.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${B2.vega}.`)}c.classList.add("vega-embed"),o&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(o){const e=document.createElement("div");e.classList.add(U2),c.appendChild(e),h=e}const p=n.patch;if(p&&(d=p instanceof Function?p(d):L(d,p,!0,!1).newDocument),n.formatLocale&&N2.formatLocale(n.formatLocale),n.timeFormatLocale&&N2.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const e in n.expressionFunctions){const t=n.expressionFunctions[e];"fn"in t?N2.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&N2.expressionFunction(e,t)}const{ast:m}=n,g=N2.parse(d,"vega-lite"===f?{}:r,{ast:m}),y=new(n.viewClass||N2.View)(g,F2({loader:i,logLevel:l,renderer:s},m?{expr:N2.expressionInterpreter??n.expr??rB}:{}));if(y.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(h.classList.add("fit-x"),h.classList.remove("fit-y")):"fit-y"==n?(h.classList.remove("fit-x"),h.classList.add("fit-y")):"fit"==n?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")})),!1!==n.tooltip){const e="function"==typeof n.tooltip?n.tooltip:new c1(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let v,{hover:x}=n;if(void 0===x&&(x="vega"===f),x){const{hoverSet:e,updateSet:t}="boolean"==typeof x?{}:x;y.hover(e,t)}if(n&&(null!=n.width&&y.width(n.width),null!=n.height&&y.height(n.height),null!=n.padding&&y.padding(n.padding)),await y.initialize(h,n.bind).runAsync(),!1!==o){let e=c;if(!1!==n.defaultStyle){const t=document.createElement("details");t.title=a.CLICK_TO_VIEW_ACTIONS,c.append(t),e=t;const n=document.createElement("summary");n.innerHTML=I2,t.append(n),v=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",v)}const i=document.createElement("div");if(e.append(i),i.classList.add("vega-actions"),!0===o||!1!==o.export)for(const e of["svg","png"])if(!0===o||!0===o.export||o.export[e]){const t=a[`${e.toUpperCase()}_ACTION`],r=document.createElement("a"),o=we(n.scaleFactor)?n.scaleFactor[e]:n.scaleFactor;r.text=t,r.href="#",r.target="_blank",r.download=`${u}.${e}`,r.addEventListener("mousedown",(async function(t){t.preventDefault();const n=await y.toImageURL(e,o);this.href=n})),i.append(r)}if(!0===o||!1!==o.source){const e=document.createElement("a");e.text=a.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){q2(Z()(t),n.sourceHeader??"",n.sourceFooter??"",f),e.preventDefault()})),i.append(e)}if("vega-lite"===f&&(!0===o||!1!==o.compiled)){const e=document.createElement("a");e.text=a.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){q2(Z()(d),n.sourceHeader??"",n.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===o||!1!==o.editor){const e=n.editorUrl??"https://vega.github.io/editor/",o=document.createElement("a");o.text=a.EDITOR_ACTION,o.href="#",o.addEventListener("click",(function(n){!function(e,t,n){const i=e.open(t),{origin:r}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===i&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(i.postMessage(n,r),setTimeout(e,250),o-=1)}),250)}(window,e,{config:r,mode:f,renderer:s,spec:Z()(t)}),n.preventDefault()})),i.append(o)}}return{view:y,spec:t,vgSpec:d,finalize:function(){v&&document.removeEventListener("click",v),y.finalize()},embedOptions:n}}(e,i,u,r)}async function Y2(e,t){const n=vt(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=vt(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return F2(F2(F2({},e),i?{patch:i}:{}),n?{config:n}:{})}},36425:e=>{var t=function(){"use strict";function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function r(o,s,l,u,c){"object"==typeof s&&(l=s.depth,u=s.prototype,c=s.includeNonEnumerable,s=s.circular);var f=[],d=[],h="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===l&&(l=1/0),function o(l,p){if(null===l)return null;if(0===p)return l;var m,g;if("object"!=typeof l)return l;if(e(l,t))m=new t;else if(e(l,n))m=new n;else if(e(l,i))m=new i((function(e,t){l.then((function(t){e(o(t,p-1))}),(function(e){t(o(e,p-1))}))}));else if(r.__isArray(l))m=[];else if(r.__isRegExp(l))m=new RegExp(l.source,a(l)),l.lastIndex&&(m.lastIndex=l.lastIndex);else if(r.__isDate(l))m=new Date(l.getTime());else{if(h&&Buffer.isBuffer(l))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(l.length):new Buffer(l.length),l.copy(m),m;e(l,Error)?m=Object.create(l):void 0===u?(g=Object.getPrototypeOf(l),m=Object.create(g)):(m=Object.create(u),g=u)}if(s){var y=f.indexOf(l);if(-1!=y)return d[y];f.push(l),d.push(m)}for(var v in e(l,t)&&l.forEach((function(e,t){var n=o(t,p-1),i=o(e,p-1);m.set(n,i)})),e(l,n)&&l.forEach((function(e){var t=o(e,p-1);m.add(t)})),l){var b;g&&(b=Object.getOwnPropertyDescriptor(g,v)),b&&null==b.set||(m[v]=o(l[v],p-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(l);for(v=0;v<x.length;v++){var _=x[v];(!(k=Object.getOwnPropertyDescriptor(l,_))||k.enumerable||c)&&(m[_]=o(l[_],p-1),k.enumerable||Object.defineProperty(m,_,{enumerable:!1}))}}if(c){var w=Object.getOwnPropertyNames(l);for(v=0;v<w.length;v++){var k,E=w[v];(k=Object.getOwnPropertyDescriptor(l,E))&&k.enumerable||(m[E]=o(l[E],p-1),Object.defineProperty(m,E,{enumerable:!1}))}}return m}(o,l)}function o(e){return Object.prototype.toString.call(e)}function a(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return r.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},r.__objToStr=o,r.__isDate=function(e){return"object"==typeof e&&"[object Date]"===o(e)},r.__isArray=function(e){return"object"==typeof e&&"[object Array]"===o(e)},r.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===o(e)},r.__getRegExpFlags=a,r}();e.exports&&(e.exports=t)}}]);