@cosmos.gl/graph 2.6.0 → 2.6.2-rc.0
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.
- package/dist/config.d.ts +3 -0
- package/dist/index.d.ts +48 -6
- package/dist/index.js +1346 -1289
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +15 -15
- package/dist/index.min.js.map +1 -1
- package/package.json +5 -1
- package/.eslintrc +0 -147
- package/.github/SECURITY.md +0 -19
- package/.github/dco.yml +0 -4
- package/.github/workflows/github_pages.yml +0 -54
- package/.storybook/main.ts +0 -26
- package/.storybook/manager-head.html +0 -1
- package/.storybook/manager.ts +0 -14
- package/.storybook/preview.ts +0 -29
- package/.storybook/style.css +0 -3
- package/CHARTER.md +0 -69
- package/CODE_OF_CONDUCT.md +0 -178
- package/CONTRIBUTING.md +0 -22
- package/GOVERNANCE.md +0 -21
- package/cosmos-2-0-migration-notes.md +0 -98
- package/cosmos_awesome.md +0 -96
- package/dist/stories/beginners/basic-set-up/data-gen.d.ts +0 -4
- package/dist/stories/beginners/basic-set-up/index.d.ts +0 -5
- package/dist/stories/beginners/link-hovering/data-generator.d.ts +0 -19
- package/dist/stories/beginners/link-hovering/index.d.ts +0 -5
- package/dist/stories/beginners/pinned-points/data-gen.d.ts +0 -5
- package/dist/stories/beginners/pinned-points/index.d.ts +0 -5
- package/dist/stories/beginners/point-labels/data.d.ts +0 -13
- package/dist/stories/beginners/point-labels/index.d.ts +0 -9
- package/dist/stories/beginners/point-labels/labels.d.ts +0 -8
- package/dist/stories/beginners/quick-start.d.ts +0 -5
- package/dist/stories/beginners/remove-points/config.d.ts +0 -2
- package/dist/stories/beginners/remove-points/data-gen.d.ts +0 -4
- package/dist/stories/beginners/remove-points/index.d.ts +0 -5
- package/dist/stories/beginners.stories.d.ts +0 -11
- package/dist/stories/clusters/polygon-selection/index.d.ts +0 -6
- package/dist/stories/clusters/polygon-selection/polygon.d.ts +0 -20
- package/dist/stories/clusters/radial.d.ts +0 -5
- package/dist/stories/clusters/with-labels.d.ts +0 -6
- package/dist/stories/clusters/worm.d.ts +0 -5
- package/dist/stories/clusters.stories.d.ts +0 -9
- package/dist/stories/create-cluster-labels.d.ts +0 -4
- package/dist/stories/create-cosmos.d.ts +0 -16
- package/dist/stories/create-story.d.ts +0 -16
- package/dist/stories/experiments/full-mesh.d.ts +0 -5
- package/dist/stories/experiments/mesh-with-holes.d.ts +0 -5
- package/dist/stories/experiments.stories.d.ts +0 -7
- package/dist/stories/generate-mesh-data.d.ts +0 -12
- package/dist/stories/geospatial/moscow-metro-stations/index.d.ts +0 -15
- package/dist/stories/geospatial/moscow-metro-stations/moscow-metro-coords.d.ts +0 -1
- package/dist/stories/geospatial/moscow-metro-stations/point-colors.d.ts +0 -1
- package/dist/stories/geospatial.stories.d.ts +0 -6
- package/dist/stories/shapes/all-shapes/index.d.ts +0 -5
- package/dist/stories/shapes/image-example/index.d.ts +0 -5
- package/dist/stories/shapes.stories.d.ts +0 -7
- package/logo.svg +0 -3
- package/rollup.config.js +0 -70
- package/src/config.ts +0 -734
- package/src/declaration.d.ts +0 -12
- package/src/graph/utils/error-message.ts +0 -23
- package/src/helper.ts +0 -74
- package/src/index.ts +0 -1635
- package/src/modules/Clusters/calculate-centermass.frag +0 -9
- package/src/modules/Clusters/calculate-centermass.vert +0 -26
- package/src/modules/Clusters/force-cluster.frag +0 -39
- package/src/modules/Clusters/index.ts +0 -200
- package/src/modules/Drag/index.ts +0 -33
- package/src/modules/FPSMonitor/css.ts +0 -53
- package/src/modules/FPSMonitor/index.ts +0 -28
- package/src/modules/ForceCenter/calculate-centermass.frag +0 -9
- package/src/modules/ForceCenter/calculate-centermass.vert +0 -18
- package/src/modules/ForceCenter/force-center.frag +0 -27
- package/src/modules/ForceCenter/index.ts +0 -104
- package/src/modules/ForceGravity/force-gravity.frag +0 -27
- package/src/modules/ForceGravity/index.ts +0 -33
- package/src/modules/ForceLink/force-spring.ts +0 -73
- package/src/modules/ForceLink/index.ts +0 -149
- package/src/modules/ForceManyBody/calculate-level.frag +0 -9
- package/src/modules/ForceManyBody/calculate-level.vert +0 -25
- package/src/modules/ForceManyBody/force-centermass.frag +0 -52
- package/src/modules/ForceManyBody/force-level.frag +0 -121
- package/src/modules/ForceManyBody/index.ts +0 -223
- package/src/modules/ForceManyBody/quadtree-frag-shader.ts +0 -90
- package/src/modules/ForceManyBodyQuadtree/calculate-level.frag +0 -9
- package/src/modules/ForceManyBodyQuadtree/calculate-level.vert +0 -25
- package/src/modules/ForceManyBodyQuadtree/index.ts +0 -157
- package/src/modules/ForceManyBodyQuadtree/quadtree-frag-shader.ts +0 -93
- package/src/modules/ForceMouse/force-mouse.frag +0 -24
- package/src/modules/ForceMouse/index.ts +0 -32
- package/src/modules/GraphData/index.ts +0 -384
- package/src/modules/Lines/draw-curve-line.frag +0 -46
- package/src/modules/Lines/draw-curve-line.vert +0 -194
- package/src/modules/Lines/geometry.ts +0 -18
- package/src/modules/Lines/hovered-line-index.frag +0 -27
- package/src/modules/Lines/hovered-line-index.vert +0 -8
- package/src/modules/Lines/index.ts +0 -273
- package/src/modules/Points/atlas-utils.ts +0 -137
- package/src/modules/Points/drag-point.frag +0 -20
- package/src/modules/Points/draw-highlighted.frag +0 -16
- package/src/modules/Points/draw-highlighted.vert +0 -86
- package/src/modules/Points/draw-points.frag +0 -243
- package/src/modules/Points/draw-points.vert +0 -127
- package/src/modules/Points/fill-sampled-points.frag +0 -9
- package/src/modules/Points/fill-sampled-points.vert +0 -29
- package/src/modules/Points/find-hovered-point.frag +0 -9
- package/src/modules/Points/find-hovered-point.vert +0 -57
- package/src/modules/Points/find-points-on-area-selection.frag +0 -48
- package/src/modules/Points/find-points-on-polygon-selection.frag +0 -65
- package/src/modules/Points/index.ts +0 -968
- package/src/modules/Points/track-positions.frag +0 -18
- package/src/modules/Points/update-position.frag +0 -37
- package/src/modules/Shared/buffer.ts +0 -37
- package/src/modules/Shared/clear.frag +0 -7
- package/src/modules/Shared/quad.vert +0 -12
- package/src/modules/Store/index.ts +0 -173
- package/src/modules/Zoom/index.ts +0 -148
- package/src/modules/core-module.ts +0 -28
- package/src/stories/1. welcome.mdx +0 -81
- package/src/stories/2. configuration.mdx +0 -113
- package/src/stories/3. api-reference.mdx +0 -591
- package/src/stories/beginners/basic-set-up/data-gen.ts +0 -33
- package/src/stories/beginners/basic-set-up/index.ts +0 -163
- package/src/stories/beginners/basic-set-up/style.css +0 -35
- package/src/stories/beginners/link-hovering/data-generator.ts +0 -198
- package/src/stories/beginners/link-hovering/index.ts +0 -61
- package/src/stories/beginners/link-hovering/style.css +0 -73
- package/src/stories/beginners/pinned-points/data-gen.ts +0 -153
- package/src/stories/beginners/pinned-points/index.ts +0 -61
- package/src/stories/beginners/point-labels/data.ts +0 -73
- package/src/stories/beginners/point-labels/index.ts +0 -65
- package/src/stories/beginners/point-labels/labels.ts +0 -46
- package/src/stories/beginners/point-labels/style.css +0 -16
- package/src/stories/beginners/quick-start.ts +0 -50
- package/src/stories/beginners/remove-points/config.ts +0 -25
- package/src/stories/beginners/remove-points/data-gen.ts +0 -30
- package/src/stories/beginners/remove-points/index.ts +0 -92
- package/src/stories/beginners/remove-points/style.css +0 -31
- package/src/stories/beginners.stories.ts +0 -131
- package/src/stories/clusters/polygon-selection/index.ts +0 -51
- package/src/stories/clusters/polygon-selection/polygon.ts +0 -143
- package/src/stories/clusters/polygon-selection/style.css +0 -8
- package/src/stories/clusters/radial.ts +0 -24
- package/src/stories/clusters/with-labels.ts +0 -53
- package/src/stories/clusters/worm.ts +0 -40
- package/src/stories/clusters.stories.ts +0 -77
- package/src/stories/create-cluster-labels.ts +0 -50
- package/src/stories/create-cosmos.ts +0 -68
- package/src/stories/create-story.ts +0 -51
- package/src/stories/experiments/full-mesh.ts +0 -13
- package/src/stories/experiments/mesh-with-holes.ts +0 -13
- package/src/stories/experiments.stories.ts +0 -43
- package/src/stories/generate-mesh-data.ts +0 -125
- package/src/stories/geospatial/moscow-metro-stations/index.ts +0 -62
- package/src/stories/geospatial/moscow-metro-stations/moscow-metro-coords.ts +0 -1
- package/src/stories/geospatial/moscow-metro-stations/point-colors.ts +0 -46
- package/src/stories/geospatial/moscow-metro-stations/style.css +0 -30
- package/src/stories/geospatial.stories.ts +0 -30
- package/src/stories/shapes/all-shapes/index.ts +0 -69
- package/src/stories/shapes/image-example/icons/box.png +0 -0
- package/src/stories/shapes/image-example/icons/lego.png +0 -0
- package/src/stories/shapes/image-example/icons/s.png +0 -0
- package/src/stories/shapes/image-example/icons/swift.png +0 -0
- package/src/stories/shapes/image-example/icons/toolbox.png +0 -0
- package/src/stories/shapes/image-example/index.ts +0 -238
- package/src/stories/shapes.stories.ts +0 -37
- package/src/variables.ts +0 -68
- package/tsconfig.json +0 -41
- package/vite.config.ts +0 -54
package/dist/index.min.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(Rt,ti){typeof exports=="object"&&typeof module<"u"?ti(exports):typeof define=="function"&&define.amd?define(["exports"],ti):(Rt=typeof globalThis<"u"?globalThis:Rt||self,ti(Rt.Cosmos={}))})(this,function(Rt){"use strict";var ti="http://www.w3.org/1999/xhtml";const lf={svg:"http://www.w3.org/2000/svg",xhtml:ti,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Br(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),lf.hasOwnProperty(e)?{space:lf[e],local:t}:t}function Yc(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ti&&e.documentElement.namespaceURI===ti?e.createElement(t):e.createElementNS(n,t)}}function Zc(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function uf(t){var e=Br(t);return(e.local?Zc:Yc)(e)}function Qc(){}function ya(t){return t==null?Qc:function(){return this.querySelector(t)}}function Kc(t){typeof t!="function"&&(t=ya(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],s=o.length,f=i[r]=new Array(s),l,u,m=0;m<s;++m)(l=o[m])&&(u=t.call(l,l.__data__,m,o))&&("__data__"in l&&(u.__data__=l.__data__),f[m]=u);return new tn(i,this._parents)}function Jc(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function eh(){return[]}function cf(t){return t==null?eh:function(){return this.querySelectorAll(t)}}function th(t){return function(){return Jc(t.apply(this,arguments))}}function nh(t){typeof t=="function"?t=th(t):t=cf(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var s=e[o],f=s.length,l,u=0;u<f;++u)(l=s[u])&&(i.push(t.call(l,l.__data__,u,s)),r.push(l));return new tn(i,r)}function hf(t){return function(){return this.matches(t)}}function df(t){return function(e){return e.matches(t)}}var ih=Array.prototype.find;function rh(t){return function(){return ih.call(this.children,t)}}function oh(){return this.firstElementChild}function ah(t){return this.select(t==null?oh:rh(typeof t=="function"?t:df(t)))}var sh=Array.prototype.filter;function fh(){return Array.from(this.children)}function lh(t){return function(){return sh.call(this.children,t)}}function uh(t){return this.selectAll(t==null?fh:lh(typeof t=="function"?t:df(t)))}function ch(t){typeof t!="function"&&(t=hf(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],s=o.length,f=i[r]=[],l,u=0;u<s;++u)(l=o[u])&&t.call(l,l.__data__,u,o)&&f.push(l);return new tn(i,this._parents)}function mf(t){return new Array(t.length)}function hh(){return new tn(this._enter||this._groups.map(mf),this._parents)}function Ur(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ur.prototype={constructor:Ur,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function dh(t){return function(){return t}}function mh(t,e,n,i,r,o){for(var s=0,f,l=e.length,u=o.length;s<u;++s)(f=e[s])?(f.__data__=o[s],i[s]=f):n[s]=new Ur(t,o[s]);for(;s<l;++s)(f=e[s])&&(r[s]=f)}function ph(t,e,n,i,r,o,s){var f,l,u=new Map,m=e.length,y=o.length,S=new Array(m),D;for(f=0;f<m;++f)(l=e[f])&&(S[f]=D=s.call(l,l.__data__,f,e)+"",u.has(D)?r[f]=l:u.set(D,l));for(f=0;f<y;++f)D=s.call(t,o[f],f,o)+"",(l=u.get(D))?(i[f]=l,l.__data__=o[f],u.delete(D)):n[f]=new Ur(t,o[f]);for(f=0;f<m;++f)(l=e[f])&&u.get(S[f])===l&&(r[f]=l)}function vh(t){return t.__data__}function gh(t,e){if(!arguments.length)return Array.from(this,vh);var n=e?ph:mh,i=this._parents,r=this._groups;typeof t!="function"&&(t=dh(t));for(var o=r.length,s=new Array(o),f=new Array(o),l=new Array(o),u=0;u<o;++u){var m=i[u],y=r[u],S=y.length,D=yh(t.call(m,m&&m.__data__,u,i)),q=D.length,Te=f[u]=new Array(q),we=s[u]=new Array(q),fe=l[u]=new Array(S);n(m,y,Te,we,fe,D,e);for(var Ne=0,Ve=0,V,se;Ne<q;++Ne)if(V=Te[Ne]){for(Ne>=Ve&&(Ve=Ne+1);!(se=we[Ve])&&++Ve<q;);V._next=se||null}}return s=new tn(s,i),s._enter=f,s._exit=l,s}function yh(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function xh(){return new tn(this._exit||this._groups.map(mf),this._parents)}function bh(t,e,n){var i=this.enter(),r=this,o=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?o.remove():n(o),i&&r?i.merge(r).order():r}function _h(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,o=i.length,s=Math.min(r,o),f=new Array(r),l=0;l<s;++l)for(var u=n[l],m=i[l],y=u.length,S=f[l]=new Array(y),D,q=0;q<y;++q)(D=u[q]||m[q])&&(S[q]=D);for(;l<r;++l)f[l]=n[l];return new tn(f,this._parents)}function Sh(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,o=i[r],s;--r>=0;)(s=i[r])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Th(t){t||(t=wh);function e(y,S){return y&&S?t(y.__data__,S.__data__):!y-!S}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var s=n[o],f=s.length,l=r[o]=new Array(f),u,m=0;m<f;++m)(u=s[m])&&(l[m]=u);l.sort(e)}return new tn(r,this._parents).order()}function wh(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Ah(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Eh(){return Array.from(this)}function Ch(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var s=i[r];if(s)return s}return null}function Ph(){let t=0;for(const e of this)++t;return t}function kh(){return!this.node()}function Ih(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],o=0,s=r.length,f;o<s;++o)(f=r[o])&&t.call(f,f.__data__,o,r);return this}function Lh(t){return function(){this.removeAttribute(t)}}function Dh(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Fh(t,e){return function(){this.setAttribute(t,e)}}function zh(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Rh(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Mh(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Oh(t,e){var n=Br(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?Dh:Lh:typeof e=="function"?n.local?Mh:Rh:n.local?zh:Fh)(n,e))}function pf(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Nh(t){return function(){this.style.removeProperty(t)}}function Gh(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Bh(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Uh(t,e,n){return arguments.length>1?this.each((e==null?Nh:typeof e=="function"?Bh:Gh)(t,e,n??"")):Pi(this.node(),t)}function Pi(t,e){return t.style.getPropertyValue(e)||pf(t).getComputedStyle(t,null).getPropertyValue(e)}function Vh(t){return function(){delete this[t]}}function $h(t,e){return function(){this[t]=e}}function Hh(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Wh(t,e){return arguments.length>1?this.each((e==null?Vh:typeof e=="function"?Hh:$h)(t,e)):this.node()[t]}function vf(t){return t.trim().split(/^|\s+/)}function xa(t){return t.classList||new gf(t)}function gf(t){this._node=t,this._names=vf(t.getAttribute("class")||"")}gf.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function yf(t,e){for(var n=xa(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function xf(t,e){for(var n=xa(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function Xh(t){return function(){yf(this,t)}}function jh(t){return function(){xf(this,t)}}function qh(t,e){return function(){(e.apply(this,arguments)?yf:xf)(this,t)}}function Yh(t,e){var n=vf(t+"");if(arguments.length<2){for(var i=xa(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?qh:e?Xh:jh)(n,e))}function Zh(){this.textContent=""}function Qh(t){return function(){this.textContent=t}}function Kh(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Jh(t){return arguments.length?this.each(t==null?Zh:(typeof t=="function"?Kh:Qh)(t)):this.node().textContent}function ed(){this.innerHTML=""}function td(t){return function(){this.innerHTML=t}}function nd(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function id(t){return arguments.length?this.each(t==null?ed:(typeof t=="function"?nd:td)(t)):this.node().innerHTML}function rd(){this.nextSibling&&this.parentNode.appendChild(this)}function od(){return this.each(rd)}function ad(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function sd(){return this.each(ad)}function fd(t){var e=typeof t=="function"?t:uf(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ld(){return null}function ud(t,e){var n=typeof t=="function"?t:uf(t),i=e==null?ld:typeof e=="function"?e:ya(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function cd(){var t=this.parentNode;t&&t.removeChild(this)}function hd(){return this.each(cd)}function dd(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function md(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function pd(t){return this.select(t?md:dd)}function vd(t){return arguments.length?this.property("__data__",t):this.node().__data__}function gd(t){return function(e){t.call(this,e,this.__data__)}}function yd(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function xd(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,o;n<r;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++i]=o;++i?e.length=i:delete this.__on}}}function bd(t,e,n){return function(){var i=this.__on,r,o=gd(e);if(i){for(var s=0,f=i.length;s<f;++s)if((r=i[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=e;return}}this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function _d(t,e,n){var i=yd(t+""),r,o=i.length,s;if(arguments.length<2){var f=this.node().__on;if(f){for(var l=0,u=f.length,m;l<u;++l)for(r=0,m=f[l];r<o;++r)if((s=i[r]).type===m.type&&s.name===m.name)return m.value}return}for(f=e?bd:xd,r=0;r<o;++r)this.each(f(i[r],e,n));return this}function bf(t,e,n){var i=pf(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Sd(t,e){return function(){return bf(this,t,e)}}function Td(t,e){return function(){return bf(this,t,e.apply(this,arguments))}}function wd(t,e){return this.each((typeof e=="function"?Td:Sd)(t,e))}function*Ad(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length,s;r<o;++r)(s=i[r])&&(yield s)}var _f=[null];function tn(t,e){this._groups=t,this._parents=e}function nr(){return new tn([[document.documentElement]],_f)}function Ed(){return this}tn.prototype=nr.prototype={constructor:tn,select:Kc,selectAll:nh,selectChild:ah,selectChildren:uh,filter:ch,data:gh,enter:hh,exit:xh,join:bh,merge:_h,selection:Ed,order:Sh,sort:Th,call:Ah,nodes:Eh,node:Ch,size:Ph,empty:kh,each:Ih,attr:Oh,style:Uh,property:Wh,classed:Yh,text:Jh,html:id,raise:od,lower:sd,append:fd,insert:ud,remove:hd,clone:pd,datum:vd,on:_d,dispatch:wd,[Symbol.iterator]:Ad};function Ft(t){return typeof t=="string"?new tn([[document.querySelector(t)]],[document.documentElement]):new tn([[t]],_f)}function Cd(t){let e;for(;e=t.sourceEvent;)t=e;return t}function kn(t,e){if(t=Cd(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}var Pd={value:()=>{}};function Vr(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new $r(n)}function $r(t){this._=t}function kd(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}$r.prototype=Vr.prototype={constructor:$r,on:function(t,e){var n=this._,i=kd(t+"",n),r,o=-1,s=i.length;if(arguments.length<2){for(;++o<s;)if((r=(t=i[o]).type)&&(r=Id(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<s;)if(r=(t=i[o]).type)n[r]=Sf(n[r],t.name,e);else if(e==null)for(r in n)n[r]=Sf(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new $r(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};function Id(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function Sf(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Pd,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var ki=0,ir=0,rr=0,Tf=1e3,Hr,or,Wr=0,ni=0,Xr=0,ar=typeof performance=="object"&&performance.now?performance:Date,wf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ba(){return ni||(wf(Ld),ni=ar.now()+Xr)}function Ld(){ni=0}function jr(){this._call=this._time=this._next=null}jr.prototype=Af.prototype={constructor:jr,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ba():+n)+(e==null?0:+e),!this._next&&or!==this&&(or?or._next=this:Hr=this,or=this),this._call=t,this._time=n,_a()},stop:function(){this._call&&(this._call=null,this._time=1/0,_a())}};function Af(t,e,n){var i=new jr;return i.restart(t,e,n),i}function Dd(){ba(),++ki;for(var t=Hr,e;t;)(e=ni-t._time)>=0&&t._call.call(null,e),t=t._next;--ki}function Ef(){ni=(Wr=ar.now())+Xr,ki=ir=0;try{Dd()}finally{ki=0,zd(),ni=0}}function Fd(){var t=ar.now(),e=t-Wr;e>Tf&&(Xr-=e,Wr=t)}function zd(){for(var t,e=Hr,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Hr=n);or=t,_a(i)}function _a(t){if(!ki){ir&&(ir=clearTimeout(ir));var e=t-ni;e>24?(t<1/0&&(ir=setTimeout(Ef,t-ar.now()-Xr)),rr&&(rr=clearInterval(rr))):(rr||(Wr=ar.now(),rr=setInterval(Fd,Tf)),ki=1,wf(Ef))}}function Cf(t,e,n){var i=new jr;return e=e==null?0:+e,i.restart(r=>{i.stop(),t(r+e)},e,n),i}var Rd=Vr("start","end","cancel","interrupt"),Md=[],Pf=0,kf=1,Sa=2,qr=3,If=4,Ta=5,Yr=6;function Zr(t,e,n,i,r,o){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Od(t,n,{name:e,index:i,group:r,on:Rd,tween:Md,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Pf})}function wa(t,e){var n=cn(t,e);if(n.state>Pf)throw new Error("too late; already scheduled");return n}function bn(t,e){var n=cn(t,e);if(n.state>qr)throw new Error("too late; already running");return n}function cn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Od(t,e,n){var i=t.__transition,r;i[e]=n,n.timer=Af(o,0,n.time);function o(u){n.state=kf,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var m,y,S,D;if(n.state!==kf)return l();for(m in i)if(D=i[m],D.name===n.name){if(D.state===qr)return Cf(s);D.state===If?(D.state=Yr,D.timer.stop(),D.on.call("interrupt",t,t.__data__,D.index,D.group),delete i[m]):+m<e&&(D.state=Yr,D.timer.stop(),D.on.call("cancel",t,t.__data__,D.index,D.group),delete i[m])}if(Cf(function(){n.state===qr&&(n.state=If,n.timer.restart(f,n.delay,n.time),f(u))}),n.state=Sa,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Sa){for(n.state=qr,r=new Array(S=n.tween.length),m=0,y=-1;m<S;++m)(D=n.tween[m].value.call(t,t.__data__,n.index,n.group))&&(r[++y]=D);r.length=y+1}}function f(u){for(var m=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=Ta,1),y=-1,S=r.length;++y<S;)r[y].call(t,m);n.state===Ta&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Yr,n.timer.stop(),delete i[e];for(var u in i)return;delete t.__transition}}function Qr(t,e){var n=t.__transition,i,r,o=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((i=n[s]).name!==e){o=!1;continue}r=i.state>Sa&&i.state<Ta,i.state=Yr,i.timer.stop(),i.on.call(r?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[s]}o&&delete t.__transition}}function Nd(t){return this.each(function(){Qr(this,t)})}function Aa(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Lf(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function sr(){}var fr=.7,Kr=1/fr,Ii="\\s*([+-]?\\d+)\\s*",lr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gd=/^#([0-9a-f]{3,8})$/,Bd=new RegExp(`^rgb\\(${Ii},${Ii},${Ii}\\)$`),Ud=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),Vd=new RegExp(`^rgba\\(${Ii},${Ii},${Ii},${lr}\\)$`),$d=new RegExp(`^rgba\\(${_n},${_n},${_n},${lr}\\)$`),Hd=new RegExp(`^hsl\\(${lr},${_n},${_n}\\)$`),Wd=new RegExp(`^hsla\\(${lr},${_n},${_n},${lr}\\)$`),Df={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};Aa(sr,Vn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ff,formatHex:Ff,formatHex8:Xd,formatHsl:jd,formatRgb:zf,toString:zf});function Ff(){return this.rgb().formatHex()}function Xd(){return this.rgb().formatHex8()}function jd(){return Gf(this).formatHsl()}function zf(){return this.rgb().formatRgb()}function Vn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Gd.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Rf(e):n===3?new Zt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Jr(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Jr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Bd.exec(t))?new Zt(e[1],e[2],e[3],1):(e=Ud.exec(t))?new Zt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Vd.exec(t))?Jr(e[1],e[2],e[3],e[4]):(e=$d.exec(t))?Jr(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Hd.exec(t))?Nf(e[1],e[2]/100,e[3]/100,1):(e=Wd.exec(t))?Nf(e[1],e[2]/100,e[3]/100,e[4]):Df.hasOwnProperty(t)?Rf(Df[t]):t==="transparent"?new Zt(NaN,NaN,NaN,0):null}function Rf(t){return new Zt(t>>16&255,t>>8&255,t&255,1)}function Jr(t,e,n,i){return i<=0&&(t=e=n=NaN),new Zt(t,e,n,i)}function qd(t){return t instanceof sr||(t=Vn(t)),t?(t=t.rgb(),new Zt(t.r,t.g,t.b,t.opacity)):new Zt}function Ea(t,e,n,i){return arguments.length===1?qd(t):new Zt(t,e,n,i??1)}function Zt(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}Aa(Zt,Ea,Lf(sr,{brighter(t){return t=t==null?Kr:Math.pow(Kr,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?fr:Math.pow(fr,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zt(ii(this.r),ii(this.g),ii(this.b),eo(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:Mf,formatHex:Mf,formatHex8:Yd,formatRgb:Of,toString:Of}));function Mf(){return`#${ri(this.r)}${ri(this.g)}${ri(this.b)}`}function Yd(){return`#${ri(this.r)}${ri(this.g)}${ri(this.b)}${ri((isNaN(this.opacity)?1:this.opacity)*255)}`}function Of(){const t=eo(this.opacity);return`${t===1?"rgb(":"rgba("}${ii(this.r)}, ${ii(this.g)}, ${ii(this.b)}${t===1?")":`, ${t})`}`}function eo(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ii(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ri(t){return t=ii(t),(t<16?"0":"")+t.toString(16)}function Nf(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new hn(t,e,n,i)}function Gf(t){if(t instanceof hn)return new hn(t.h,t.s,t.l,t.opacity);if(t instanceof sr||(t=Vn(t)),!t)return new hn;if(t instanceof hn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=NaN,f=o-r,l=(o+r)/2;return f?(e===o?s=(n-i)/f+(n<i)*6:n===o?s=(i-e)/f+2:s=(e-n)/f+4,f/=l<.5?o+r:2-o-r,s*=60):f=l>0&&l<1?0:s,new hn(s,f,l,t.opacity)}function Zd(t,e,n,i){return arguments.length===1?Gf(t):new hn(t,e,n,i??1)}function hn(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}Aa(hn,Zd,Lf(sr,{brighter(t){return t=t==null?Kr:Math.pow(Kr,t),new hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?fr:Math.pow(fr,t),new hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Zt(Ca(t>=240?t-240:t+120,r,i),Ca(t,r,i),Ca(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new hn(Bf(this.h),to(this.s),to(this.l),eo(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 t=eo(this.opacity);return`${t===1?"hsl(":"hsla("}${Bf(this.h)}, ${to(this.s)*100}%, ${to(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Bf(t){return t=(t||0)%360,t<0?t+360:t}function to(t){return Math.max(0,Math.min(1,t||0))}function Ca(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Pa=t=>()=>t;function Qd(t,e){return function(n){return t+n*e}}function Kd(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function Jd(t){return(t=+t)==1?Uf:function(e,n){return n-e?Kd(e,n,t):Pa(isNaN(e)?n:e)}}function Uf(t,e){var n=e-t;return n?Qd(t,n):Pa(isNaN(t)?e:t)}const no=function t(e){var n=Jd(e);function i(r,o){var s=n((r=Ea(r)).r,(o=Ea(o)).r),f=n(r.g,o.g),l=n(r.b,o.b),u=Uf(r.opacity,o.opacity);return function(m){return r.r=s(m),r.g=f(m),r.b=l(m),r.opacity=u(m),r+""}}return i.gamma=t,i}(1);function em(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(o){for(r=0;r<n;++r)i[r]=t[r]*(1-o)+e[r]*o;return i}}function tm(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function nm(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),o=new Array(n),s;for(s=0;s<i;++s)r[s]=La(t[s],e[s]);for(;s<n;++s)o[s]=e[s];return function(f){for(s=0;s<i;++s)o[s]=r[s](f);return o}}function im(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function dn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function rm(t,e){var n={},i={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?n[r]=La(t[r],e[r]):i[r]=e[r];return function(o){for(r in n)i[r]=n[r](o);return i}}var ka=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ia=new RegExp(ka.source,"g");function om(t){return function(){return t}}function am(t){return function(e){return t(e)+""}}function Vf(t,e){var n=ka.lastIndex=Ia.lastIndex=0,i,r,o,s=-1,f=[],l=[];for(t=t+"",e=e+"";(i=ka.exec(t))&&(r=Ia.exec(e));)(o=r.index)>n&&(o=e.slice(n,o),f[s]?f[s]+=o:f[++s]=o),(i=i[0])===(r=r[0])?f[s]?f[s]+=r:f[++s]=r:(f[++s]=null,l.push({i:s,x:dn(i,r)})),n=Ia.lastIndex;return n<e.length&&(o=e.slice(n),f[s]?f[s]+=o:f[++s]=o),f.length<2?l[0]?am(l[0].x):om(e):(e=l.length,function(u){for(var m=0,y;m<e;++m)f[(y=l[m]).i]=y.x(u);return f.join("")})}function La(t,e){var n=typeof e,i;return e==null||n==="boolean"?Pa(e):(n==="number"?dn:n==="string"?(i=Vn(e))?(e=i,no):Vf:e instanceof Vn?no:e instanceof Date?im:tm(e)?em:Array.isArray(e)?nm:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?rm:dn)(t,e)}function sm(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var $f=180/Math.PI,Da={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Hf(t,e,n,i,r,o){var s,f,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(f=Math.sqrt(n*n+i*i))&&(n/=f,i/=f,l/=f),t*i<e*n&&(t=-t,e=-e,l=-l,s=-s),{translateX:r,translateY:o,rotate:Math.atan2(e,t)*$f,skewX:Math.atan(l)*$f,scaleX:s,scaleY:f}}var io;function fm(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Da:Hf(e.a,e.b,e.c,e.d,e.e,e.f)}function lm(t){return t==null||(io||(io=document.createElementNS("http://www.w3.org/2000/svg","g")),io.setAttribute("transform",t),!(t=io.transform.baseVal.consolidate()))?Da:(t=t.matrix,Hf(t.a,t.b,t.c,t.d,t.e,t.f))}function Wf(t,e,n,i){function r(u){return u.length?u.pop()+" ":""}function o(u,m,y,S,D,q){if(u!==y||m!==S){var Te=D.push("translate(",null,e,null,n);q.push({i:Te-4,x:dn(u,y)},{i:Te-2,x:dn(m,S)})}else(y||S)&&D.push("translate("+y+e+S+n)}function s(u,m,y,S){u!==m?(u-m>180?m+=360:m-u>180&&(u+=360),S.push({i:y.push(r(y)+"rotate(",null,i)-2,x:dn(u,m)})):m&&y.push(r(y)+"rotate("+m+i)}function f(u,m,y,S){u!==m?S.push({i:y.push(r(y)+"skewX(",null,i)-2,x:dn(u,m)}):m&&y.push(r(y)+"skewX("+m+i)}function l(u,m,y,S,D,q){if(u!==y||m!==S){var Te=D.push(r(D)+"scale(",null,",",null,")");q.push({i:Te-4,x:dn(u,y)},{i:Te-2,x:dn(m,S)})}else(y!==1||S!==1)&&D.push(r(D)+"scale("+y+","+S+")")}return function(u,m){var y=[],S=[];return u=t(u),m=t(m),o(u.translateX,u.translateY,m.translateX,m.translateY,y,S),s(u.rotate,m.rotate,y,S),f(u.skewX,m.skewX,y,S),l(u.scaleX,u.scaleY,m.scaleX,m.scaleY,y,S),u=m=null,function(D){for(var q=-1,Te=S.length,we;++q<Te;)y[(we=S[q]).i]=we.x(D);return y.join("")}}}var um=Wf(fm,"px, ","px)","deg)"),cm=Wf(lm,", ",")",")"),hm=1e-12;function Xf(t){return((t=Math.exp(t))+1/t)/2}function dm(t){return((t=Math.exp(t))-1/t)/2}function mm(t){return((t=Math.exp(2*t))-1)/(t+1)}const pm=function t(e,n,i){function r(o,s){var f=o[0],l=o[1],u=o[2],m=s[0],y=s[1],S=s[2],D=m-f,q=y-l,Te=D*D+q*q,we,fe;if(Te<hm)fe=Math.log(S/u)/e,we=function(Be){return[f+Be*D,l+Be*q,u*Math.exp(e*Be*fe)]};else{var Ne=Math.sqrt(Te),Ve=(S*S-u*u+i*Te)/(2*u*n*Ne),V=(S*S-u*u-i*Te)/(2*S*n*Ne),se=Math.log(Math.sqrt(Ve*Ve+1)-Ve),Le=Math.log(Math.sqrt(V*V+1)-V);fe=(Le-se)/e,we=function(Be){var je=Be*fe,nt=Xf(se),lt=u/(n*Ne)*(nt*mm(e*je+se)-dm(se));return[f+lt*D,l+lt*q,u*nt/Xf(e*je+se)]}}return we.duration=fe*1e3*e/Math.SQRT2,we}return r.rho=function(o){var s=Math.max(.001,+o),f=s*s,l=f*f;return t(s,f,l)},r}(Math.SQRT2,2,4);function vm(t,e){var n,i;return function(){var r=bn(this,t),o=r.tween;if(o!==n){i=n=o;for(var s=0,f=i.length;s<f;++s)if(i[s].name===e){i=i.slice(),i.splice(s,1);break}}r.tween=i}}function gm(t,e,n){var i,r;if(typeof n!="function")throw new Error;return function(){var o=bn(this,t),s=o.tween;if(s!==i){r=(i=s).slice();for(var f={name:e,value:n},l=0,u=r.length;l<u;++l)if(r[l].name===e){r[l]=f;break}l===u&&r.push(f)}o.tween=r}}function ym(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=cn(this.node(),n).tween,r=0,o=i.length,s;r<o;++r)if((s=i[r]).name===t)return s.value;return null}return this.each((e==null?vm:gm)(n,t,e))}function Fa(t,e,n){var i=t._id;return t.each(function(){var r=bn(this,i);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return cn(r,i).value[e]}}function jf(t,e){var n;return(typeof e=="number"?dn:e instanceof Vn?no:(n=Vn(e))?(e=n,no):Vf)(t,e)}function xm(t){return function(){this.removeAttribute(t)}}function bm(t){return function(){this.removeAttributeNS(t.space,t.local)}}function _m(t,e,n){var i,r=n+"",o;return function(){var s=this.getAttribute(t);return s===r?null:s===i?o:o=e(i=s,n)}}function Sm(t,e,n){var i,r=n+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===i?o:o=e(i=s,n)}}function Tm(t,e,n){var i,r,o;return function(){var s,f=n(this),l;return f==null?void this.removeAttribute(t):(s=this.getAttribute(t),l=f+"",s===l?null:s===i&&l===r?o:(r=l,o=e(i=s,f)))}}function wm(t,e,n){var i,r,o;return function(){var s,f=n(this),l;return f==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),l=f+"",s===l?null:s===i&&l===r?o:(r=l,o=e(i=s,f)))}}function Am(t,e){var n=Br(t),i=n==="transform"?cm:jf;return this.attrTween(t,typeof e=="function"?(n.local?wm:Tm)(n,i,Fa(this,"attr."+t,e)):e==null?(n.local?bm:xm)(n):(n.local?Sm:_m)(n,i,e))}function Em(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Cm(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Pm(t,e){var n,i;function r(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&Cm(t,o)),n}return r._value=e,r}function km(t,e){var n,i;function r(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&Em(t,o)),n}return r._value=e,r}function Im(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=Br(t);return this.tween(n,(i.local?Pm:km)(i,e))}function Lm(t,e){return function(){wa(this,t).delay=+e.apply(this,arguments)}}function Dm(t,e){return e=+e,function(){wa(this,t).delay=e}}function Fm(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Lm:Dm)(e,t)):cn(this.node(),e).delay}function zm(t,e){return function(){bn(this,t).duration=+e.apply(this,arguments)}}function Rm(t,e){return e=+e,function(){bn(this,t).duration=e}}function Mm(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?zm:Rm)(e,t)):cn(this.node(),e).duration}function Om(t,e){if(typeof e!="function")throw new Error;return function(){bn(this,t).ease=e}}function Nm(t){var e=this._id;return arguments.length?this.each(Om(e,t)):cn(this.node(),e).ease}function Gm(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;bn(this,t).ease=n}}function Bm(t){if(typeof t!="function")throw new Error;return this.each(Gm(this._id,t))}function Um(t){typeof t!="function"&&(t=hf(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],s=o.length,f=i[r]=[],l,u=0;u<s;++u)(l=o[u])&&t.call(l,l.__data__,u,o)&&f.push(l);return new In(i,this._parents,this._name,this._id)}function Vm(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),s=new Array(i),f=0;f<o;++f)for(var l=e[f],u=n[f],m=l.length,y=s[f]=new Array(m),S,D=0;D<m;++D)(S=l[D]||u[D])&&(y[D]=S);for(;f<i;++f)s[f]=e[f];return new In(s,this._parents,this._name,this._id)}function $m(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Hm(t,e,n){var i,r,o=$m(e)?wa:bn;return function(){var s=o(this,t),f=s.on;f!==i&&(r=(i=f).copy()).on(e,n),s.on=r}}function Wm(t,e){var n=this._id;return arguments.length<2?cn(this.node(),n).on.on(t):this.each(Hm(n,t,e))}function Xm(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function jm(){return this.on("end.remove",Xm(this._id))}function qm(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ya(t));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s<r;++s)for(var f=i[s],l=f.length,u=o[s]=new Array(l),m,y,S=0;S<l;++S)(m=f[S])&&(y=t.call(m,m.__data__,S,f))&&("__data__"in m&&(y.__data__=m.__data__),u[S]=y,Zr(u[S],e,n,S,u,cn(m,n)));return new In(o,this._parents,e,n)}function Ym(t){var e=this._name,n=this._id;typeof t!="function"&&(t=cf(t));for(var i=this._groups,r=i.length,o=[],s=[],f=0;f<r;++f)for(var l=i[f],u=l.length,m,y=0;y<u;++y)if(m=l[y]){for(var S=t.call(m,m.__data__,y,l),D,q=cn(m,n),Te=0,we=S.length;Te<we;++Te)(D=S[Te])&&Zr(D,e,n,Te,S,q);o.push(S),s.push(m)}return new In(o,s,e,n)}var Zm=nr.prototype.constructor;function Qm(){return new Zm(this._groups,this._parents)}function Km(t,e){var n,i,r;return function(){var o=Pi(this,t),s=(this.style.removeProperty(t),Pi(this,t));return o===s?null:o===n&&s===i?r:r=e(n=o,i=s)}}function qf(t){return function(){this.style.removeProperty(t)}}function Jm(t,e,n){var i,r=n+"",o;return function(){var s=Pi(this,t);return s===r?null:s===i?o:o=e(i=s,n)}}function ep(t,e,n){var i,r,o;return function(){var s=Pi(this,t),f=n(this),l=f+"";return f==null&&(l=f=(this.style.removeProperty(t),Pi(this,t))),s===l?null:s===i&&l===r?o:(r=l,o=e(i=s,f))}}function tp(t,e){var n,i,r,o="style."+e,s="end."+o,f;return function(){var l=bn(this,t),u=l.on,m=l.value[o]==null?f||(f=qf(e)):void 0;(u!==n||r!==m)&&(i=(n=u).copy()).on(s,r=m),l.on=i}}function np(t,e,n){var i=(t+="")=="transform"?um:jf;return e==null?this.styleTween(t,Km(t,i)).on("end.style."+t,qf(t)):typeof e=="function"?this.styleTween(t,ep(t,i,Fa(this,"style."+t,e))).each(tp(this._id,t)):this.styleTween(t,Jm(t,i,e),n).on("end.style."+t,null)}function ip(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function rp(t,e,n){var i,r;function o(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&ip(t,s,n)),i}return o._value=e,o}function op(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,rp(t,e,n??""))}function ap(t){return function(){this.textContent=t}}function sp(t){return function(){var e=t(this);this.textContent=e??""}}function fp(t){return this.tween("text",typeof t=="function"?sp(Fa(this,"text",t)):ap(t==null?"":t+""))}function lp(t){return function(e){this.textContent=t.call(this,e)}}function up(t){var e,n;function i(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&lp(r)),e}return i._value=t,i}function cp(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,up(t))}function hp(){for(var t=this._name,e=this._id,n=Yf(),i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],f=s.length,l,u=0;u<f;++u)if(l=s[u]){var m=cn(l,e);Zr(l,t,n,u,s,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new In(i,this._parents,t,n)}function dp(){var t,e,n=this,i=n._id,r=n.size();return new Promise(function(o,s){var f={value:s},l={value:function(){--r===0&&o()}};n.each(function(){var u=bn(this,i),m=u.on;m!==t&&(e=(t=m).copy(),e._.cancel.push(f),e._.interrupt.push(f),e._.end.push(l)),u.on=e}),r===0&&o()})}var mp=0;function In(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Yf(){return++mp}var Ln=nr.prototype;In.prototype={constructor:In,select:qm,selectAll:Ym,selectChild:Ln.selectChild,selectChildren:Ln.selectChildren,filter:Um,merge:Vm,selection:Qm,transition:hp,call:Ln.call,nodes:Ln.nodes,node:Ln.node,size:Ln.size,empty:Ln.empty,each:Ln.each,on:Wm,attr:Am,attrTween:Im,style:np,styleTween:op,text:fp,textTween:cp,remove:jm,tween:ym,delay:Fm,duration:Mm,ease:Nm,easeVarying:Bm,end:dp,[Symbol.iterator]:Ln[Symbol.iterator]};function pp(t){return t*t}function vp(t){return t*(2-t)}function gp(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function yp(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var xp={time:null,delay:0,duration:250,ease:yp};function bp(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function _p(t){var e,n;t instanceof In?(e=t._id,t=t._name):(e=Yf(),(n=xp).time=ba(),t=t==null?null:t+"");for(var i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],f=s.length,l,u=0;u<f;++u)(l=s[u])&&Zr(l,t,e,u,s,n||bp(l,e));return new In(i,this._parents,t,e)}nr.prototype.interrupt=Nd,nr.prototype.transition=_p;function za(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Sp(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),n}var ro={exports:{}},Tp=ro.exports,Zf;function wp(){return Zf||(Zf=1,function(t,e){(function(n,i){t.exports=i()})(Tp,function(){var n=function(a){return a instanceof Uint8Array||a instanceof Uint16Array||a instanceof Uint32Array||a instanceof Int8Array||a instanceof Int16Array||a instanceof Int32Array||a instanceof Float32Array||a instanceof Float64Array||a instanceof Uint8ClampedArray},i=function(a,h){for(var _=Object.keys(h),M=0;M<_.length;++M)a[_[M]]=h[_[M]];return a},r=`
|
|
2
|
-
`;function o(a){return typeof atob<"u"?atob(a):"base64:"+a}function s(a){var h=new Error("(regl) "+a);throw console.error(h),h}function f(a,h){a||s(h)}function l(a){return a?": "+a:""}function u(a,h,_){a in h||s("unknown parameter ("+a+")"+l(_)+". possible values: "+Object.keys(h).join())}function
|
|
3
|
-
`),M=1,W=0,R={unknown:new Ne,0:new Ne};R.unknown.name=R[0].name=h||
|
|
4
|
-
`).forEach(function(_){if(!(_.length<5)){var M=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(_);M?h.push(new V(M[1]|0,M[2]|0,M[3].trim())):_.length>0&&h.push(new V("unknown",0,_))}}),h}function nt(a,h){h.forEach(function(_){var M=a[_.file];if(M){var W=M.index[_.line];if(W){W.errors.push(_),M.hasErrors=!0;return}}a.unknown.hasErrors=!0,a.unknown.lines[0].errors.push(_)})}function lt(a,h,_,M,W){if(!a.getShaderParameter(h,a.COMPILE_STATUS)){var R=a.getShaderInfoLog(h),B=M===a.FRAGMENT_SHADER?"fragment":"vertex";
|
|
5
|
-
`,"color:red;text-decoration:underline;font-weight:bold"),ae.lines.forEach(function(ne){if(ne.errors.length>0){J(fe(ne.number,4)+"| ","background-color:yellow; font-weight:bold"),J(ne.line+r,"color:red; background-color:yellow; font-weight:bold");var k=0;ne.errors.forEach(function(G){var te=G.message,xe=/^\s*'(.*)'\s*:\s*(.*)$/.exec(te);if(xe){var Z=xe[1];switch(te=xe[2],Z){case"assign":Z="=";break}k=Math.max(ne.line.indexOf(Z,k),0)}else k=0;J(fe("| ",6)),J(fe("^^^",k+3)+r,"font-weight:bold"),J(fe("| ",6)),J(te+r,"font-weight:bold")}),J(fe("| ",6)+r)}else J(fe(ne.number,4)+"| "),J(ne.line+r,"color:red")}),typeof document<"u"&&!window.chrome?(ue[0]=oe.join("%c"),console.log.apply(console,ue)):console.log(oe.join(""))}),f.raise("Error compiling "+B+" shader, "+K[0].name)}}function Ee(a,h,_,M,W){if(!a.getProgramParameter(h,a.LINK_STATUS)){var R=a.getProgramInfoLog(h),B=Be(_,W),K=Be(M,W),Q='Error linking program with vertex shader, "'+K[0].name+'", and fragment shader "'+B[0].name+'"';typeof document<"u"?console.log("%c"+Q+r+"%c"+R,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Q+r+R),f.raise(Q)}}function ut(a){a._commandRef=se()}function ot(a,h,_,M){ut(a);function W(Q){return Q?M.id(Q):0}a._fragId=W(a.static.frag),a._vertId=W(a.static.vert);function R(Q,re){Object.keys(re).forEach(function(ae){Q[M.id(ae)]=!0})}var B=a._uniformSet={};R(B,h.static),R(B,h.dynamic);var K=a._attributeSet={};R(K,_.static),R(K,_.dynamic),a._hasCount="count"in a.static||"count"in a.dynamic||"elements"in a.static||"elements"in a.dynamic}function N(a,h){var _=Le();s(a+" in command "+(h||se())+(_==="unknown"?"":" called from "+_))}function Pe(a,h,_){a||N(h,_||se())}function ie(a,h,_,M){a in h||N("unknown parameter ("+a+")"+l(_)+". possible values: "+Object.keys(h).join(),M||se())}function ke(a,h,_,M){y(a,h)||N("invalid parameter type"+l(_)+". expected "+h+", got "+typeof a,M||se())}function He(a){a()}function qe(a,h,_){a.texture?q(a.texture._texture.internalformat,h,"unsupported texture format for attachment"):q(a.renderbuffer._renderbuffer.format,_,"unsupported renderbuffer format for attachment")}var Qe=33071,Ze=9728,dt=9984,ct=9985,_t=9986,st=9987,$t=5120,Ht=5121,Kt=5122,Mn=5123,wo=5124,Ao=5125,On=5126,si=32819,Tn=32820,Fi=33635,zi=34042,$n=36193,Mt={};Mt[$t]=Mt[Ht]=1,Mt[Kt]=Mt[Mn]=Mt[$n]=Mt[Fi]=Mt[si]=Mt[Tn]=2,Mt[wo]=Mt[Ao]=Mt[On]=Mt[zi]=4;function fi(a,h){return a===Tn||a===si||a===Fi?2:a===zi?4:Mt[a]*h}function li(a){return!(a&a-1)&&!!a}function Eo(a,h,_){var M,W=h.width,R=h.height,B=h.channels;f(W>0&&W<=_.maxTextureSize&&R>0&&R<=_.maxTextureSize,"invalid texture shape"),(a.wrapS!==Qe||a.wrapT!==Qe)&&f(li(W)&&li(R),"incompatible wrap mode for texture, both width and height must be power of 2"),h.mipmask===1?W!==1&&R!==1&&f(a.minFilter!==dt&&a.minFilter!==_t&&a.minFilter!==ct&&a.minFilter!==st,"min filter requires mipmap"):(f(li(W)&&li(R),"texture must be a square power of 2 to support mipmapping"),f(h.mipmask===(W<<1)-1,"missing or incomplete mipmap data")),h.type===On&&(_.extensions.indexOf("oes_texture_float_linear")<0&&f(a.minFilter===Ze&&a.magFilter===Ze,"filter not supported, must enable oes_texture_float_linear"),f(!a.genMipmaps,"mipmap generation not supported with float textures"));var K=h.images;for(M=0;M<16;++M)if(K[M]){var Q=W>>M,re=R>>M;f(h.mipmask&1<<M,"missing mipmap data");var ae=K[M];if(f(ae.width===Q&&ae.height===re,"invalid shape for mip images"),f(ae.format===h.format&&ae.internalformat===h.internalformat&&ae.type===h.type,"incompatible type for mip image"),!ae.compressed)if(ae.data){var oe=Math.ceil(fi(ae.type,B)*Q/ae.unpackAlignment)*ae.unpackAlignment;f(ae.data.byteLength===oe*re,"invalid data for image, buffer size is inconsistent with image format")}else ae.element||ae.copy}else a.genMipmaps||f((h.mipmask&1<<M)===0,"extra mipmap data");h.compressed&&f(!a.genMipmaps,"mipmap generation for compressed images not supported")}function ss(a,h,_,M){var W=a.width,R=a.height,B=a.channels;f(W>0&&W<=M.maxTextureSize&&R>0&&R<=M.maxTextureSize,"invalid texture shape"),f(W===R,"cube map must be square"),f(h.wrapS===Qe&&h.wrapT===Qe,"wrap mode not supported by cube map");for(var K=0;K<_.length;++K){var Q=_[K];f(Q.width===W&&Q.height===R,"inconsistent cube map face shape"),h.genMipmaps&&(f(!Q.compressed,"can not generate mipmap for compressed textures"),f(Q.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var re=Q.images,ae=0;ae<16;++ae){var oe=re[ae];if(oe){var ue=W>>ae,J=R>>ae;f(Q.mipmask&1<<ae,"missing mipmap data"),f(oe.width===ue&&oe.height===J,"invalid shape for mip images"),f(oe.format===a.format&&oe.internalformat===a.internalformat&&oe.type===a.type,"incompatible type for mip image"),oe.compressed||(oe.data?f(oe.data.byteLength===ue*J*Math.max(fi(oe.type,B),oe.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):oe.element||oe.copy)}}}}var d=i(f,{optional:He,raise:s,commandRaise:N,command:Pe,parameter:u,commandParameter:ie,constructor:we,type:S,commandType:ke,isTypedArray:m,nni:D,oneOf:q,shaderError:lt,linkError:Ee,callSite:Le,saveCommandRef:ut,saveDrawInfo:ot,framebufferFormat:qe,guessCommand:se,texture2D:Eo,textureCube:ss}),ui=0,Hn=0,Wn=5,Co=6;function wn(a,h){this.id=ui++,this.type=a,this.data=h}function yr(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Nn(a){if(a.length===0)return[];var h=a.charAt(0),_=a.charAt(a.length-1);if(a.length>1&&h===_&&(h==='"'||h==="'"))return['"'+yr(a.substr(1,a.length-2))+'"'];var M=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(a);if(M)return Nn(a.substr(0,M.index)).concat(Nn(M[1])).concat(Nn(a.substr(M.index+M[0].length)));var W=a.split(".");if(W.length===1)return['"'+yr(a)+'"'];for(var R=[],B=0;B<W.length;++B)R=R.concat(Nn(W[B]));return R}function xr(a){return"["+Nn(a).join("][")+"]"}function Ri(a,h){return new wn(a,xr(h+""))}function Mi(a){return typeof a=="function"&&!a._reglType||a instanceof wn}function sn(a,h){if(typeof a=="function")return new wn(Hn,a);if(typeof a=="number"||typeof a=="boolean")return new wn(Wn,a);if(Array.isArray(a))return new wn(Co,a.map(function(_,M){return sn(_,h+"["+M+"]")}));if(a instanceof wn)return a;d(!1,"invalid option type in uniform "+h)}var It={DynamicVariable:wn,define:Ri,isDynamic:Mi,unbox:sn,accessor:xr},ci={next:typeof requestAnimationFrame=="function"?function(a){return requestAnimationFrame(a)}:function(a){return setTimeout(a,16)},cancel:typeof cancelAnimationFrame=="function"?function(a){return cancelAnimationFrame(a)}:clearTimeout},Oi=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function fs(){var a={"":0},h=[""];return{id:function(_){var M=a[_];return M||(M=a[_]=h.length,h.push(_),M)},str:function(_){return h[_]}}}function Ni(a,h,_){var M=document.createElement("canvas");i(M.style,{border:0,margin:0,padding:0,top:0,left:0,width:"100%",height:"100%"}),a.appendChild(M),a===document.body&&(M.style.position="absolute",i(a.style,{margin:0,padding:0}));function W(){var K=window.innerWidth,Q=window.innerHeight;if(a!==document.body){var re=M.getBoundingClientRect();K=re.right-re.left,Q=re.bottom-re.top}M.width=_*K,M.height=_*Q}var R;a!==document.body&&typeof ResizeObserver=="function"?(R=new ResizeObserver(function(){setTimeout(W)}),R.observe(a)):window.addEventListener("resize",W,!1);function B(){R?R.disconnect():window.removeEventListener("resize",W),a.removeChild(M)}return W(),{canvas:M,onDestroy:B}}function Gi(a,h){function _(M){try{return a.getContext(M,h)}catch{return null}}return _("webgl")||_("experimental-webgl")||_("webgl-experimental")}function ls(a){return typeof a.nodeName=="string"&&typeof a.appendChild=="function"&&typeof a.getBoundingClientRect=="function"}function hi(a){return typeof a.drawArrays=="function"||typeof a.drawElements=="function"}function Po(a){return typeof a=="string"?a.split():(d(Array.isArray(a),"invalid extension array"),a)}function ko(a){return typeof a=="string"?(d(typeof document<"u","not supported outside of DOM"),document.querySelector(a)):a}function Lt(a){var h=a||{},_,M,W,R,B={},K=[],Q=[],re=typeof window>"u"?1:window.devicePixelRatio,ae=!1,oe=function(ne){ne&&d.raise(ne)},ue=function(){};if(typeof h=="string"?(d(typeof document<"u","selector queries only supported in DOM enviroments"),_=document.querySelector(h),d(_,"invalid query string for element")):typeof h=="object"?ls(h)?_=h:hi(h)?(R=h,W=R.canvas):(d.constructor(h),"gl"in h?R=h.gl:"canvas"in h?W=ko(h.canvas):"container"in h&&(M=ko(h.container)),"attributes"in h&&(B=h.attributes,d.type(B,"object","invalid context attributes")),"extensions"in h&&(K=Po(h.extensions)),"optionalExtensions"in h&&(Q=Po(h.optionalExtensions)),"onDone"in h&&(d.type(h.onDone,"function","invalid or missing onDone callback"),oe=h.onDone),"profile"in h&&(ae=!!h.profile),"pixelRatio"in h&&(re=+h.pixelRatio,d(re>0,"invalid pixel ratio"))):d.raise("invalid arguments to regl"),_&&(_.nodeName.toLowerCase()==="canvas"?W=_:M=_),!R){if(!W){d(typeof document<"u","must manually specify webgl context outside of DOM environments");var J=Ni(M||document.body,oe,re);if(!J)return null;W=J.canvas,ue=J.onDestroy}B.premultipliedAlpha===void 0&&(B.premultipliedAlpha=!0),R=Gi(W,B)}return R?{gl:R,canvas:W,container:M,extensions:K,optionalExtensions:Q,pixelRatio:re,profile:ae,onDone:oe,onDestroy:ue}:(ue(),oe("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Xn(a,h){var _={};function M(B){d.type(B,"string","extension name must be string");var K=B.toLowerCase(),Q;try{Q=_[K]=a.getExtension(K)}catch{}return!!Q}for(var W=0;W<h.extensions.length;++W){var R=h.extensions[W];if(!M(R))return h.onDestroy(),h.onDone('"'+R+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return h.optionalExtensions.forEach(M),{extensions:_,restore:function(){Object.keys(_).forEach(function(B){if(_[B]&&!M(B))throw new Error("(regl): error restoring extension "+B)})}}}function Yt(a,h){for(var _=Array(a),M=0;M<a;++M)_[M]=h(M);return _}var Io=5120,br=5121,Lo=5122,Do=5123,us=5124,fn=5125,jn=5126;function Fo(a){for(var h=16;h<=1<<28;h*=16)if(a<=h)return h;return 0}function _r(a){var h,_;return h=(a>65535)<<4,a>>>=h,_=(a>255)<<3,a>>>=_,h|=_,_=(a>15)<<2,a>>>=_,h|=_,_=(a>3)<<1,a>>>=_,h|=_,h|a>>1}function Bi(){var a=Yt(8,function(){return[]});function h(R){var B=Fo(R),K=a[_r(B)>>2];return K.length>0?K.pop():new ArrayBuffer(B)}function _(R){a[_r(R.byteLength)>>2].push(R)}function M(R,B){var K=null;switch(R){case Io:K=new Int8Array(h(B),0,B);break;case br:K=new Uint8Array(h(B),0,B);break;case Lo:K=new Int16Array(h(2*B),0,B);break;case Do:K=new Uint16Array(h(2*B),0,B);break;case us:K=new Int32Array(h(4*B),0,B);break;case fn:K=new Uint32Array(h(4*B),0,B);break;case jn:K=new Float32Array(h(4*B),0,B);break;default:return null}return K.length!==B?K.subarray(0,B):K}function W(R){_(R.buffer)}return{alloc:h,free:_,allocType:M,freeType:W}}var gt=Bi();gt.zero=Bi();var vn=3408,zo=3410,Ro=3411,Mo=3412,Oo=3413,cs=3414,$e=3415,P=33901,ve=33902,ze=3379,mt=3386,Ot=34921,At=36347,Wt=36348,gn=35661,di=35660,Sr=34930,Nt=36349,No=34076,Go=34024,Dg=7936,Fg=7937,zg=7938,Rg=35724,Mg=34047,Og=36063,Ng=34852,Bo=3553,ou=34067,Gg=34069,Bg=33984,Tr=6408,hs=5126,au=5121,ds=36160,Ug=36053,Vg=36064,$g=16384,Hg=function(a,h){var _=1;h.ext_texture_filter_anisotropic&&(_=a.getParameter(Mg));var M=1,W=1;h.webgl_draw_buffers&&(M=a.getParameter(Ng),W=a.getParameter(Og));var R=!!h.oes_texture_float;if(R){var B=a.createTexture();a.bindTexture(Bo,B),a.texImage2D(Bo,0,Tr,1,1,0,Tr,hs,null);var K=a.createFramebuffer();if(a.bindFramebuffer(ds,K),a.framebufferTexture2D(ds,Vg,Bo,B,0),a.bindTexture(Bo,null),a.checkFramebufferStatus(ds)!==Ug)R=!1;else{a.viewport(0,0,1,1),a.clearColor(1,0,0,1),a.clear($g);var Q=gt.allocType(hs,4);a.readPixels(0,0,1,1,Tr,hs,Q),a.getError()?R=!1:(a.deleteFramebuffer(K),a.deleteTexture(B),R=Q[0]===1),gt.freeType(Q)}}var re=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),ae=!0;if(!re){var oe=a.createTexture(),ue=gt.allocType(au,36);a.activeTexture(Bg),a.bindTexture(ou,oe),a.texImage2D(Gg,0,Tr,3,3,0,Tr,au,ue),gt.freeType(ue),a.bindTexture(ou,null),a.deleteTexture(oe),ae=!a.getError()}return{colorBits:[a.getParameter(zo),a.getParameter(Ro),a.getParameter(Mo),a.getParameter(Oo)],depthBits:a.getParameter(cs),stencilBits:a.getParameter($e),subpixelBits:a.getParameter(vn),extensions:Object.keys(h).filter(function(J){return!!h[J]}),maxAnisotropic:_,maxDrawbuffers:M,maxColorAttachments:W,pointSizeDims:a.getParameter(P),lineWidthDims:a.getParameter(ve),maxViewportDims:a.getParameter(mt),maxCombinedTextureUnits:a.getParameter(gn),maxCubeMapSize:a.getParameter(No),maxRenderbufferSize:a.getParameter(Go),maxTextureUnits:a.getParameter(Sr),maxTextureSize:a.getParameter(ze),maxAttributes:a.getParameter(Ot),maxVertexUniforms:a.getParameter(At),maxVertexTextureUnits:a.getParameter(di),maxVaryingVectors:a.getParameter(Wt),maxFragmentUniforms:a.getParameter(Nt),glsl:a.getParameter(Rg),renderer:a.getParameter(Fg),vendor:a.getParameter(Dg),version:a.getParameter(zg),readFloat:R,npotTextureCube:ae}};function yn(a){return!!a&&typeof a=="object"&&Array.isArray(a.shape)&&Array.isArray(a.stride)&&typeof a.offset=="number"&&a.shape.length===a.stride.length&&(Array.isArray(a.data)||n(a.data))}var rn=function(a){return Object.keys(a).map(function(h){return a[h]})},Uo={shape:qg,flatten:jg};function Wg(a,h,_){for(var M=0;M<h;++M)_[M]=a[M]}function Xg(a,h,_,M){for(var W=0,R=0;R<h;++R)for(var B=a[R],K=0;K<_;++K)M[W++]=B[K]}function su(a,h,_,M,W,R){for(var B=R,K=0;K<h;++K)for(var Q=a[K],re=0;re<_;++re)for(var ae=Q[re],oe=0;oe<M;++oe)W[B++]=ae[oe]}function fu(a,h,_,M,W){for(var R=1,B=_+1;B<h.length;++B)R*=h[B];var K=h[_];if(h.length-_===4){var Q=h[_+1],re=h[_+2],ae=h[_+3];for(B=0;B<K;++B)su(a[B],Q,re,ae,M,W),W+=R}else for(B=0;B<K;++B)fu(a[B],h,_+1,M,W),W+=R}function jg(a,h,_,M){var W=1;if(h.length)for(var R=0;R<h.length;++R)W*=h[R];else W=0;var B=M||gt.allocType(_,W);switch(h.length){case 0:break;case 1:Wg(a,h[0],B);break;case 2:Xg(a,h[0],h[1],B);break;case 3:su(a,h[0],h[1],h[2],B,0);break;default:fu(a,h,0,B,0)}return B}function qg(a){for(var h=[],_=a;_.length;_=_[0])h.push(_.length);return h}var ms={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Yg=5120,Zg=5122,Qg=5124,Kg=5121,Jg=5123,ey=5125,ty=5126,ny=5126,mi={int8:Yg,int16:Zg,int32:Qg,uint8:Kg,uint16:Jg,uint32:ey,float:ty,float32:ny},iy=35048,ry=35040,Vo={dynamic:iy,stream:ry,static:35044},ps=Uo.flatten,lu=Uo.shape,uu=35044,oy=35040,vs=5121,gs=5126,qn=[];qn[5120]=1,qn[5122]=2,qn[5124]=4,qn[5121]=1,qn[5123]=2,qn[5125]=4,qn[5126]=4;function $o(a){return ms[Object.prototype.toString.call(a)]|0}function cu(a,h){for(var _=0;_<h.length;++_)a[_]=h[_]}function hu(a,h,_,M,W,R,B){for(var K=0,Q=0;Q<_;++Q)for(var re=0;re<M;++re)a[K++]=h[W*Q+R*re+B]}function ay(a,h,_,M){var W=0,R={};function B(k){this.id=W++,this.buffer=a.createBuffer(),this.type=k,this.usage=uu,this.byteLength=0,this.dimension=1,this.dtype=vs,this.persistentData=null,_.profile&&(this.stats={size:0})}B.prototype.bind=function(){a.bindBuffer(this.type,this.buffer)},B.prototype.destroy=function(){ue(this)};var K=[];function Q(k,G){var te=K.pop();return te||(te=new B(k)),te.bind(),oe(te,G,oy,0,1,!1),te}function re(k){K.push(k)}function ae(k,G,te){k.byteLength=G.byteLength,a.bufferData(k.type,G,te)}function oe(k,G,te,xe,Z,ge){var me;if(k.usage=te,Array.isArray(G)){if(k.dtype=xe||gs,G.length>0){var De;if(Array.isArray(G[0])){me=lu(G);for(var X=1,H=1;H<me.length;++H)X*=me[H];k.dimension=X,De=ps(G,me,k.dtype),ae(k,De,te),ge?k.persistentData=De:gt.freeType(De)}else if(typeof G[0]=="number"){k.dimension=Z;var Se=gt.allocType(k.dtype,G.length);cu(Se,G),ae(k,Se,te),ge?k.persistentData=Se:gt.freeType(Se)}else n(G[0])?(k.dimension=G[0].length,k.dtype=xe||$o(G[0])||gs,De=ps(G,[G.length,G[0].length],k.dtype),ae(k,De,te),ge?k.persistentData=De:gt.freeType(De)):d.raise("invalid buffer data")}}else if(n(G))k.dtype=xe||$o(G),k.dimension=Z,ae(k,G,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(G.buffer)));else if(yn(G)){me=G.shape;var ce=G.stride,ee=G.offset,he=0,de=0,We=0,Ue=0;me.length===1?(he=me[0],de=1,We=ce[0],Ue=0):me.length===2?(he=me[0],de=me[1],We=ce[0],Ue=ce[1]):d.raise("invalid shape"),k.dtype=xe||$o(G.data)||gs,k.dimension=de;var pe=gt.allocType(k.dtype,he*de);hu(pe,G.data,he,de,We,Ue,ee),ae(k,pe,te),ge?k.persistentData=pe:gt.freeType(pe)}else G instanceof ArrayBuffer?(k.dtype=vs,k.dimension=Z,ae(k,G,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(G)))):d.raise("invalid buffer data")}function ue(k){h.bufferCount--,M(k);var G=k.buffer;d(G,"buffer must not be deleted already"),a.deleteBuffer(G),k.buffer=null,delete R[k.id]}function J(k,G,te,xe){h.bufferCount++;var Z=new B(G);R[Z.id]=Z;function ge(X){var H=uu,Se=null,ce=0,ee=0,he=1;return Array.isArray(X)||n(X)||yn(X)||X instanceof ArrayBuffer?Se=X:typeof X=="number"?ce=X|0:X&&(d.type(X,"object","buffer arguments must be an object, a number or an array"),"data"in X&&(d(Se===null||Array.isArray(Se)||n(Se)||yn(Se),"invalid data for buffer"),Se=X.data),"usage"in X&&(d.parameter(X.usage,Vo,"invalid buffer usage"),H=Vo[X.usage]),"type"in X&&(d.parameter(X.type,mi,"invalid buffer type"),ee=mi[X.type]),"dimension"in X&&(d.type(X.dimension,"number","invalid dimension"),he=X.dimension|0),"length"in X&&(d.nni(ce,"buffer length must be a nonnegative integer"),ce=X.length|0)),Z.bind(),Se?oe(Z,Se,H,ee,he,xe):(ce&&a.bufferData(Z.type,ce,H),Z.dtype=ee||vs,Z.usage=H,Z.dimension=he,Z.byteLength=ce),_.profile&&(Z.stats.size=Z.byteLength*qn[Z.dtype]),ge}function me(X,H){d(H+X.byteLength<=Z.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+X.byteLength+" starting from offset "+H+" to a buffer of size "+Z.byteLength),a.bufferSubData(Z.type,H,X)}function De(X,H){var Se=(H||0)|0,ce;if(Z.bind(),n(X)||X instanceof ArrayBuffer)me(X,Se);else if(Array.isArray(X)){if(X.length>0)if(typeof X[0]=="number"){var ee=gt.allocType(Z.dtype,X.length);cu(ee,X),me(ee,Se),gt.freeType(ee)}else if(Array.isArray(X[0])||n(X[0])){ce=lu(X);var he=ps(X,ce,Z.dtype);me(he,Se),gt.freeType(he)}else d.raise("invalid buffer data")}else if(yn(X)){ce=X.shape;var de=X.stride,We=0,Ue=0,pe=0,ye=0;ce.length===1?(We=ce[0],Ue=1,pe=de[0],ye=0):ce.length===2?(We=ce[0],Ue=ce[1],pe=de[0],ye=de[1]):d.raise("invalid shape");var Re=Array.isArray(X.data)?Z.dtype:$o(X.data),Xe=gt.allocType(Re,We*Ue);hu(Xe,X.data,We,Ue,pe,ye,X.offset),me(Xe,Se),gt.freeType(Xe)}else d.raise("invalid data for buffer subdata");return ge}return te||ge(k),ge._reglType="buffer",ge._buffer=Z,ge.subdata=De,_.profile&&(ge.stats=Z.stats),ge.destroy=function(){ue(Z)},ge}function ne(){rn(R).forEach(function(k){k.buffer=a.createBuffer(),a.bindBuffer(k.type,k.buffer),a.bufferData(k.type,k.persistentData||k.byteLength,k.usage)})}return _.profile&&(h.getTotalBufferSize=function(){var k=0;return Object.keys(R).forEach(function(G){k+=R[G].stats.size}),k}),{create:J,createStream:Q,destroyStream:re,clear:function(){rn(R).forEach(ue),K.forEach(ue)},getBuffer:function(k){return k&&k._buffer instanceof B?k._buffer:null},restore:ne,_initBuffer:oe}}var sy=0,fy=0,ly=1,uy=1,cy=4,hy=4,Yn={points:sy,point:fy,lines:ly,line:uy,triangles:cy,triangle:hy,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},dy=0,my=1,wr=4,py=5120,Ui=5121,du=5122,Vi=5123,mu=5124,pi=5125,ys=34963,vy=35040,gy=35044;function yy(a,h,_,M){var W={},R=0,B={uint8:Ui,uint16:Vi};h.oes_element_index_uint&&(B.uint32=pi);function K(ne){this.id=R++,W[this.id]=this,this.buffer=ne,this.primType=wr,this.vertCount=0,this.type=0}K.prototype.bind=function(){this.buffer.bind()};var Q=[];function re(ne){var k=Q.pop();return k||(k=new K(_.create(null,ys,!0,!1)._buffer)),oe(k,ne,vy,-1,-1,0,0),k}function ae(ne){Q.push(ne)}function oe(ne,k,G,te,xe,Z,ge){ne.buffer.bind();var me;if(k){var De=ge;!ge&&(!n(k)||yn(k)&&!n(k.data))&&(De=h.oes_element_index_uint?pi:Vi),_._initBuffer(ne.buffer,k,G,De,3)}else a.bufferData(ys,Z,G),ne.buffer.dtype=me||Ui,ne.buffer.usage=G,ne.buffer.dimension=3,ne.buffer.byteLength=Z;if(me=ge,!ge){switch(ne.buffer.dtype){case Ui:case py:me=Ui;break;case Vi:case du:me=Vi;break;case pi:case mu:me=pi;break;default:d.raise("unsupported type for element array")}ne.buffer.dtype=me}ne.type=me,d(me!==pi||!!h.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var X=xe;X<0&&(X=ne.buffer.byteLength,me===Vi?X>>=1:me===pi&&(X>>=2)),ne.vertCount=X;var H=te;if(te<0){H=wr;var Se=ne.buffer.dimension;Se===1&&(H=dy),Se===2&&(H=my),Se===3&&(H=wr)}ne.primType=H}function ue(ne){M.elementsCount--,d(ne.buffer!==null,"must not double destroy elements"),delete W[ne.id],ne.buffer.destroy(),ne.buffer=null}function J(ne,k){var G=_.create(null,ys,!0),te=new K(G._buffer);M.elementsCount++;function xe(Z){if(!Z)G(),te.primType=wr,te.vertCount=0,te.type=Ui;else if(typeof Z=="number")G(Z),te.primType=wr,te.vertCount=Z|0,te.type=Ui;else{var ge=null,me=gy,De=-1,X=-1,H=0,Se=0;Array.isArray(Z)||n(Z)||yn(Z)?ge=Z:(d.type(Z,"object","invalid arguments for elements"),"data"in Z&&(ge=Z.data,d(Array.isArray(ge)||n(ge)||yn(ge),"invalid data for element buffer")),"usage"in Z&&(d.parameter(Z.usage,Vo,"invalid element buffer usage"),me=Vo[Z.usage]),"primitive"in Z&&(d.parameter(Z.primitive,Yn,"invalid element buffer primitive"),De=Yn[Z.primitive]),"count"in Z&&(d(typeof Z.count=="number"&&Z.count>=0,"invalid vertex count for elements"),X=Z.count|0),"type"in Z&&(d.parameter(Z.type,B,"invalid buffer type"),Se=B[Z.type]),"length"in Z?H=Z.length|0:(H=X,Se===Vi||Se===du?H*=2:(Se===pi||Se===mu)&&(H*=4))),oe(te,ge,me,De,X,H,Se)}return xe}return xe(ne),xe._reglType="elements",xe._elements=te,xe.subdata=function(Z,ge){return G.subdata(Z,ge),xe},xe.destroy=function(){ue(te)},xe}return{create:J,createStream:re,destroyStream:ae,getElements:function(ne){return typeof ne=="function"&&ne._elements instanceof K?ne._elements:null},clear:function(){rn(W).forEach(ue)}}}var pu=new Float32Array(1),xy=new Uint32Array(pu.buffer),by=5123;function vu(a){for(var h=gt.allocType(by,a.length),_=0;_<a.length;++_)if(isNaN(a[_]))h[_]=65535;else if(a[_]===1/0)h[_]=31744;else if(a[_]===-1/0)h[_]=64512;else{pu[0]=a[_];var M=xy[0],W=M>>>31<<15,R=(M<<1>>>24)-127,B=M>>13&1023;if(R<-24)h[_]=W;else if(R<-14){var K=-14-R;h[_]=W+(B+1024>>K)}else R>15?h[_]=W+31744:h[_]=W+(R+15<<10)+B}return h}function pt(a){return Array.isArray(a)||n(a)}var gu=function(a){return!(a&a-1)&&!!a},_y=34467,An=3553,xs=34067,Ho=34069,vi=6408,bs=6406,Wo=6407,Ar=6409,Xo=6410,yu=32854,_s=32855,xu=36194,Sy=32819,Ty=32820,wy=33635,Ay=34042,Ss=6402,jo=34041,Ts=35904,ws=35906,$i=36193,As=33776,Es=33777,Cs=33778,Ps=33779,bu=35986,_u=35987,Su=34798,Tu=35840,wu=35841,Au=35842,Eu=35843,Cu=36196,Hi=5121,ks=5123,Is=5125,Er=5126,Ey=10242,Cy=10243,Py=10497,Ls=33071,ky=33648,Iy=10240,Ly=10241,Ds=9728,Dy=9729,Fs=9984,Pu=9985,ku=9986,zs=9987,Fy=33170,qo=4352,zy=4353,Ry=4354,My=34046,Oy=3317,Ny=37440,Gy=37441,By=37443,Iu=37444,Cr=33984,Uy=[Fs,ku,Pu,zs],Yo=[0,Ar,Xo,Wo,vi],ln={};ln[Ar]=ln[bs]=ln[Ss]=1,ln[jo]=ln[Xo]=2,ln[Wo]=ln[Ts]=3,ln[vi]=ln[ws]=4;function Wi(a){return"[object "+a+"]"}var Lu=Wi("HTMLCanvasElement"),Du=Wi("OffscreenCanvas"),Fu=Wi("CanvasRenderingContext2D"),zu=Wi("ImageBitmap"),Ru=Wi("HTMLImageElement"),Mu=Wi("HTMLVideoElement"),Vy=Object.keys(ms).concat([Lu,Du,Fu,zu,Ru,Mu]),Xi=[];Xi[Hi]=1,Xi[Er]=4,Xi[$i]=2,Xi[ks]=2,Xi[Is]=4;var Gt=[];Gt[yu]=2,Gt[_s]=2,Gt[xu]=2,Gt[jo]=4,Gt[As]=.5,Gt[Es]=.5,Gt[Cs]=1,Gt[Ps]=1,Gt[bu]=.5,Gt[_u]=1,Gt[Su]=1,Gt[Tu]=.5,Gt[wu]=.25,Gt[Au]=.5,Gt[Eu]=.25,Gt[Cu]=.5;function Ou(a){return Array.isArray(a)&&(a.length===0||typeof a[0]=="number")}function Nu(a){if(!Array.isArray(a))return!1;var h=a.length;return!(h===0||!pt(a[0]))}function gi(a){return Object.prototype.toString.call(a)}function Gu(a){return gi(a)===Lu}function Bu(a){return gi(a)===Du}function $y(a){return gi(a)===Fu}function Hy(a){return gi(a)===zu}function Wy(a){return gi(a)===Ru}function Xy(a){return gi(a)===Mu}function Rs(a){if(!a)return!1;var h=gi(a);return Vy.indexOf(h)>=0?!0:Ou(a)||Nu(a)||yn(a)}function Uu(a){return ms[Object.prototype.toString.call(a)]|0}function jy(a,h){var _=h.length;switch(a.type){case Hi:case ks:case Is:case Er:var M=gt.allocType(a.type,_);M.set(h),a.data=M;break;case $i:a.data=vu(h);break;default:d.raise("unsupported texture type, must specify a typed array")}}function Vu(a,h){return gt.allocType(a.type===$i?Er:a.type,h)}function $u(a,h){a.type===$i?(a.data=vu(h),gt.freeType(h)):a.data=h}function qy(a,h,_,M,W,R){for(var B=a.width,K=a.height,Q=a.channels,re=B*K*Q,ae=Vu(a,re),oe=0,ue=0;ue<K;++ue)for(var J=0;J<B;++J)for(var ne=0;ne<Q;++ne)ae[oe++]=h[_*J+M*ue+W*ne+R];$u(a,ae)}function Zo(a,h,_,M,W,R){var B;if(typeof Gt[a]<"u"?B=Gt[a]:B=ln[a]*Xi[h],R&&(B*=6),W){for(var K=0,Q=_;Q>=1;)K+=B*Q*Q,Q/=2;return K}else return B*_*M}function Yy(a,h,_,M,W,R,B){var K={"don't care":qo,"dont care":qo,nice:Ry,fast:zy},Q={repeat:Py,clamp:Ls,mirror:ky},re={nearest:Ds,linear:Dy},ae=i({mipmap:zs,"nearest mipmap nearest":Fs,"linear mipmap nearest":Pu,"nearest mipmap linear":ku,"linear mipmap linear":zs},re),oe={none:0,browser:Iu},ue={uint8:Hi,rgba4:Sy,rgb565:wy,"rgb5 a1":Ty},J={alpha:bs,luminance:Ar,"luminance alpha":Xo,rgb:Wo,rgba:vi,rgba4:yu,"rgb5 a1":_s,rgb565:xu},ne={};h.ext_srgb&&(J.srgb=Ts,J.srgba=ws),h.oes_texture_float&&(ue.float32=ue.float=Er),h.oes_texture_half_float&&(ue.float16=ue["half float"]=$i),h.webgl_depth_texture&&(i(J,{depth:Ss,"depth stencil":jo}),i(ue,{uint16:ks,uint32:Is,"depth stencil":Ay})),h.webgl_compressed_texture_s3tc&&i(ne,{"rgb s3tc dxt1":As,"rgba s3tc dxt1":Es,"rgba s3tc dxt3":Cs,"rgba s3tc dxt5":Ps}),h.webgl_compressed_texture_atc&&i(ne,{"rgb atc":bu,"rgba atc explicit alpha":_u,"rgba atc interpolated alpha":Su}),h.webgl_compressed_texture_pvrtc&&i(ne,{"rgb pvrtc 4bppv1":Tu,"rgb pvrtc 2bppv1":wu,"rgba pvrtc 4bppv1":Au,"rgba pvrtc 2bppv1":Eu}),h.webgl_compressed_texture_etc1&&(ne["rgb etc1"]=Cu);var k=Array.prototype.slice.call(a.getParameter(_y));Object.keys(ne).forEach(function(x){var O=ne[x];k.indexOf(O)>=0&&(J[x]=O)});var G=Object.keys(J);_.textureFormats=G;var te=[];Object.keys(J).forEach(function(x){var O=J[x];te[O]=x});var xe=[];Object.keys(ue).forEach(function(x){var O=ue[x];xe[O]=x});var Z=[];Object.keys(re).forEach(function(x){var O=re[x];Z[O]=x});var ge=[];Object.keys(ae).forEach(function(x){var O=ae[x];ge[O]=x});var me=[];Object.keys(Q).forEach(function(x){var O=Q[x];me[O]=x});var De=G.reduce(function(x,O){var z=J[O];return z===Ar||z===bs||z===Ar||z===Xo||z===Ss||z===jo||h.ext_srgb&&(z===Ts||z===ws)?x[z]=z:z===_s||O.indexOf("rgba")>=0?x[z]=vi:x[z]=Wo,x},{});function X(){this.internalformat=vi,this.format=vi,this.type=Hi,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Iu,this.width=0,this.height=0,this.channels=0}function H(x,O){x.internalformat=O.internalformat,x.format=O.format,x.type=O.type,x.compressed=O.compressed,x.premultiplyAlpha=O.premultiplyAlpha,x.flipY=O.flipY,x.unpackAlignment=O.unpackAlignment,x.colorSpace=O.colorSpace,x.width=O.width,x.height=O.height,x.channels=O.channels}function Se(x,O){if(!(typeof O!="object"||!O)){if("premultiplyAlpha"in O&&(d.type(O.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),x.premultiplyAlpha=O.premultiplyAlpha),"flipY"in O&&(d.type(O.flipY,"boolean","invalid texture flip"),x.flipY=O.flipY),"alignment"in O&&(d.oneOf(O.alignment,[1,2,4,8],"invalid texture unpack alignment"),x.unpackAlignment=O.alignment),"colorSpace"in O&&(d.parameter(O.colorSpace,oe,"invalid colorSpace"),x.colorSpace=oe[O.colorSpace]),"type"in O){var z=O.type;d(h.oes_texture_float||!(z==="float"||z==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),d(h.oes_texture_half_float||!(z==="half float"||z==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),d(h.webgl_depth_texture||!(z==="uint16"||z==="uint32"||z==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),d.parameter(z,ue,"invalid texture type"),x.type=ue[z]}var _e=x.width,Ke=x.height,p=x.channels,c=!1;"shape"in O?(d(Array.isArray(O.shape)&&O.shape.length>=2,"shape must be an array"),_e=O.shape[0],Ke=O.shape[1],O.shape.length===3&&(p=O.shape[2],d(p>0&&p<=4,"invalid number of channels"),c=!0),d(_e>=0&&_e<=_.maxTextureSize,"invalid width"),d(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")):("radius"in O&&(_e=Ke=O.radius,d(_e>=0&&_e<=_.maxTextureSize,"invalid radius")),"width"in O&&(_e=O.width,d(_e>=0&&_e<=_.maxTextureSize,"invalid width")),"height"in O&&(Ke=O.height,d(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")),"channels"in O&&(p=O.channels,d(p>0&&p<=4,"invalid number of channels"),c=!0)),x.width=_e|0,x.height=Ke|0,x.channels=p|0;var T=!1;if("format"in O){var C=O.format;d(h.webgl_depth_texture||!(C==="depth"||C==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),d.parameter(C,J,"invalid texture format");var I=x.internalformat=J[C];x.format=De[I],C in ue&&("type"in O||(x.type=ue[C])),C in ne&&(x.compressed=!0),T=!0}!c&&T?x.channels=ln[x.format]:c&&!T?x.channels!==Yo[x.format]&&(x.format=x.internalformat=Yo[x.channels]):T&&c&&d(x.channels===ln[x.format],"number of channels inconsistent with specified format")}}function ce(x){a.pixelStorei(Ny,x.flipY),a.pixelStorei(Gy,x.premultiplyAlpha),a.pixelStorei(By,x.colorSpace),a.pixelStorei(Oy,x.unpackAlignment)}function ee(){X.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function he(x,O){var z=null;if(Rs(O)?z=O:O&&(d.type(O,"object","invalid pixel data type"),Se(x,O),"x"in O&&(x.xOffset=O.x|0),"y"in O&&(x.yOffset=O.y|0),Rs(O.data)&&(z=O.data)),d(!x.compressed||z instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),O.copy){d(!z,"can not specify copy and data field for the same texture");var _e=W.viewportWidth,Ke=W.viewportHeight;x.width=x.width||_e-x.xOffset,x.height=x.height||Ke-x.yOffset,x.needsCopy=!0,d(x.xOffset>=0&&x.xOffset<_e&&x.yOffset>=0&&x.yOffset<Ke&&x.width>0&&x.width<=_e&&x.height>0&&x.height<=Ke,"copy texture read out of bounds")}else if(!z)x.width=x.width||1,x.height=x.height||1,x.channels=x.channels||4;else if(n(z))x.channels=x.channels||4,x.data=z,!("type"in O)&&x.type===Hi&&(x.type=Uu(z));else if(Ou(z))x.channels=x.channels||4,jy(x,z),x.alignment=1,x.needsFree=!0;else if(yn(z)){var p=z.data;!Array.isArray(p)&&x.type===Hi&&(x.type=Uu(p));var c=z.shape,T=z.stride,C,I,A,w,E,v;c.length===3?(A=c[2],v=T[2]):(d(c.length===2,"invalid ndarray pixel data, must be 2 or 3D"),A=1,v=1),C=c[0],I=c[1],w=T[0],E=T[1],x.alignment=1,x.width=C,x.height=I,x.channels=A,x.format=x.internalformat=Yo[A],x.needsFree=!0,qy(x,p,w,E,v,z.offset)}else if(Gu(z)||Bu(z)||$y(z))Gu(z)||Bu(z)?x.element=z:x.element=z.canvas,x.width=x.element.width,x.height=x.element.height,x.channels=4;else if(Hy(z))x.element=z,x.width=z.width,x.height=z.height,x.channels=4;else if(Wy(z))x.element=z,x.width=z.naturalWidth,x.height=z.naturalHeight,x.channels=4;else if(Xy(z))x.element=z,x.width=z.videoWidth,x.height=z.videoHeight,x.channels=4;else if(Nu(z)){var b=x.width||z[0].length,g=x.height||z.length,F=x.channels;pt(z[0][0])?F=F||z[0][0].length:F=F||1;for(var L=Uo.shape(z),$=1,j=0;j<L.length;++j)$*=L[j];var le=Vu(x,$);Uo.flatten(z,L,"",le),$u(x,le),x.alignment=1,x.width=b,x.height=g,x.channels=F,x.format=x.internalformat=Yo[F],x.needsFree=!0}x.type===Er?d(_.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):x.type===$i&&d(_.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function de(x,O,z){var _e=x.element,Ke=x.data,p=x.internalformat,c=x.format,T=x.type,C=x.width,I=x.height;ce(x),_e?a.texImage2D(O,z,c,c,T,_e):x.compressed?a.compressedTexImage2D(O,z,p,C,I,0,Ke):x.needsCopy?(M(),a.copyTexImage2D(O,z,c,x.xOffset,x.yOffset,C,I,0)):a.texImage2D(O,z,c,C,I,0,c,T,Ke||null)}function We(x,O,z,_e,Ke){var p=x.element,c=x.data,T=x.internalformat,C=x.format,I=x.type,A=x.width,w=x.height;ce(x),p?a.texSubImage2D(O,Ke,z,_e,C,I,p):x.compressed?a.compressedTexSubImage2D(O,Ke,z,_e,T,A,w,c):x.needsCopy?(M(),a.copyTexSubImage2D(O,Ke,z,_e,x.xOffset,x.yOffset,A,w)):a.texSubImage2D(O,Ke,z,_e,A,w,C,I,c)}var Ue=[];function pe(){return Ue.pop()||new ee}function ye(x){x.needsFree&>.freeType(x.data),ee.call(x),Ue.push(x)}function Re(){X.call(this),this.genMipmaps=!1,this.mipmapHint=qo,this.mipmask=0,this.images=Array(16)}function Xe(x,O,z){var _e=x.images[0]=pe();x.mipmask=1,_e.width=x.width=O,_e.height=x.height=z,_e.channels=x.channels=4}function Je(x,O){var z=null;if(Rs(O))z=x.images[0]=pe(),H(z,x),he(z,O),x.mipmask=1;else if(Se(x,O),Array.isArray(O.mipmap))for(var _e=O.mipmap,Ke=0;Ke<_e.length;++Ke)z=x.images[Ke]=pe(),H(z,x),z.width>>=Ke,z.height>>=Ke,he(z,_e[Ke]),x.mipmask|=1<<Ke;else z=x.images[0]=pe(),H(z,x),he(z,O),x.mipmask=1;H(x,x.images[0]),x.compressed&&(x.internalformat===As||x.internalformat===Es||x.internalformat===Cs||x.internalformat===Ps)&&d(x.width%4===0&&x.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function vt(x,O){for(var z=x.images,_e=0;_e<z.length;++_e){if(!z[_e])return;de(z[_e],O,_e)}}var yt=[];function tt(){var x=yt.pop()||new Re;X.call(x),x.mipmask=0;for(var O=0;O<16;++O)x.images[O]=null;return x}function Et(x){for(var O=x.images,z=0;z<O.length;++z)O[z]&&ye(O[z]),O[z]=null;yt.push(x)}function ht(){this.minFilter=Ds,this.magFilter=Ds,this.wrapS=Ls,this.wrapT=Ls,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=qo}function Tt(x,O){if("min"in O){var z=O.min;d.parameter(z,ae),x.minFilter=ae[z],Uy.indexOf(x.minFilter)>=0&&!("faces"in O)&&(x.genMipmaps=!0)}if("mag"in O){var _e=O.mag;d.parameter(_e,re),x.magFilter=re[_e]}var Ke=x.wrapS,p=x.wrapT;if("wrap"in O){var c=O.wrap;typeof c=="string"?(d.parameter(c,Q),Ke=p=Q[c]):Array.isArray(c)&&(d.parameter(c[0],Q),d.parameter(c[1],Q),Ke=Q[c[0]],p=Q[c[1]])}else{if("wrapS"in O){var T=O.wrapS;d.parameter(T,Q),Ke=Q[T]}if("wrapT"in O){var C=O.wrapT;d.parameter(C,Q),p=Q[C]}}if(x.wrapS=Ke,x.wrapT=p,"anisotropic"in O){var I=O.anisotropic;d(typeof I=="number"&&I>=1&&I<=_.maxAnisotropic,"aniso samples must be between 1 and "),x.anisotropic=O.anisotropic}if("mipmap"in O){var A=!1;switch(typeof O.mipmap){case"string":d.parameter(O.mipmap,K,"invalid mipmap hint"),x.mipmapHint=K[O.mipmap],x.genMipmaps=!0,A=!0;break;case"boolean":A=x.genMipmaps=O.mipmap;break;case"object":d(Array.isArray(O.mipmap),"invalid mipmap type"),x.genMipmaps=!1,A=!0;break;default:d.raise("invalid mipmap type")}A&&!("min"in O)&&(x.minFilter=Fs)}}function Ct(x,O){a.texParameteri(O,Ly,x.minFilter),a.texParameteri(O,Iy,x.magFilter),a.texParameteri(O,Ey,x.wrapS),a.texParameteri(O,Cy,x.wrapT),h.ext_texture_filter_anisotropic&&a.texParameteri(O,My,x.anisotropic),x.genMipmaps&&(a.hint(Fy,x.mipmapHint),a.generateMipmap(O))}var Pt=0,zt={},Bt=_.maxTextureUnits,xt=Array(Bt).map(function(){return null});function Ye(x){X.call(this),this.mipmask=0,this.internalformat=vi,this.id=Pt++,this.refCount=1,this.target=x,this.texture=a.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new ht,B.profile&&(this.stats={size:0})}function Ut(x){a.activeTexture(Cr),a.bindTexture(x.target,x.texture)}function at(){var x=xt[0];x?a.bindTexture(x.target,x.texture):a.bindTexture(An,null)}function Fe(x){var O=x.texture;d(O,"must not double destroy texture");var z=x.unit,_e=x.target;z>=0&&(a.activeTexture(Cr+z),a.bindTexture(_e,null),xt[z]=null),a.deleteTexture(O),x.texture=null,x.params=null,x.pixels=null,x.refCount=0,delete zt[x.id],R.textureCount--}i(Ye.prototype,{bind:function(){var x=this;x.bindCount+=1;var O=x.unit;if(O<0){for(var z=0;z<Bt;++z){var _e=xt[z];if(_e){if(_e.bindCount>0)continue;_e.unit=-1}xt[z]=x,O=z;break}O>=Bt&&d.raise("insufficient number of texture units"),B.profile&&R.maxTextureUnits<O+1&&(R.maxTextureUnits=O+1),x.unit=O,a.activeTexture(Cr+O),a.bindTexture(x.target,x.texture)}return O},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Fe(this)}});function et(x,O){var z=new Ye(An);zt[z.id]=z,R.textureCount++;function _e(c,T){var C=z.texInfo;ht.call(C);var I=tt();return typeof c=="number"?typeof T=="number"?Xe(I,c|0,T|0):Xe(I,c|0,c|0):c?(d.type(c,"object","invalid arguments to regl.texture"),Tt(C,c),Je(I,c)):Xe(I,1,1),C.genMipmaps&&(I.mipmask=(I.width<<1)-1),z.mipmask=I.mipmask,H(z,I),d.texture2D(C,I,_),z.internalformat=I.internalformat,_e.width=I.width,_e.height=I.height,Ut(z),vt(I,An),Ct(C,An),at(),Et(I),B.profile&&(z.stats.size=Zo(z.internalformat,z.type,I.width,I.height,C.genMipmaps,!1)),_e.format=te[z.internalformat],_e.type=xe[z.type],_e.mag=Z[C.magFilter],_e.min=ge[C.minFilter],_e.wrapS=me[C.wrapS],_e.wrapT=me[C.wrapT],_e}function Ke(c,T,C,I){d(!!c,"must specify image data");var A=T|0,w=C|0,E=I|0,v=pe();return H(v,z),v.width=0,v.height=0,he(v,c),v.width=v.width||(z.width>>E)-A,v.height=v.height||(z.height>>E)-w,d(z.type===v.type&&z.format===v.format&&z.internalformat===v.internalformat,"incompatible format for texture.subimage"),d(A>=0&&w>=0&&A+v.width<=z.width&&w+v.height<=z.height,"texture.subimage write out of bounds"),d(z.mipmask&1<<E,"missing mipmap data"),d(v.data||v.element||v.needsCopy,"missing image data"),Ut(z),We(v,An,A,w,E),at(),ye(v),_e}function p(c,T){var C=c|0,I=T|0||C;if(C===z.width&&I===z.height)return _e;_e.width=z.width=C,_e.height=z.height=I,Ut(z);for(var A=0;z.mipmask>>A;++A){var w=C>>A,E=I>>A;if(!w||!E)break;a.texImage2D(An,A,z.format,w,E,0,z.format,z.type,null)}return at(),B.profile&&(z.stats.size=Zo(z.internalformat,z.type,C,I,!1,!1)),_e}return _e(x,O),_e.subimage=Ke,_e.resize=p,_e._reglType="texture2d",_e._texture=z,B.profile&&(_e.stats=z.stats),_e.destroy=function(){z.decRef()},_e}function it(x,O,z,_e,Ke,p){var c=new Ye(xs);zt[c.id]=c,R.cubeCount++;var T=new Array(6);function C(w,E,v,b,g,F){var L,$=c.texInfo;for(ht.call($),L=0;L<6;++L)T[L]=tt();if(typeof w=="number"||!w){var j=w|0||1;for(L=0;L<6;++L)Xe(T[L],j,j)}else if(typeof w=="object")if(E)Je(T[0],w),Je(T[1],E),Je(T[2],v),Je(T[3],b),Je(T[4],g),Je(T[5],F);else if(Tt($,w),Se(c,w),"faces"in w){var le=w.faces;for(d(Array.isArray(le)&&le.length===6,"cube faces must be a length 6 array"),L=0;L<6;++L)d(typeof le[L]=="object"&&!!le[L],"invalid input for cube map face"),H(T[L],c),Je(T[L],le[L])}else for(L=0;L<6;++L)Je(T[L],w);else d.raise("invalid arguments to cube map");for(H(c,T[0]),d.optional(function(){_.npotTextureCube||d(gu(c.width)&&gu(c.height),"your browser does not support non power or two texture dimensions")}),$.genMipmaps?c.mipmask=(T[0].width<<1)-1:c.mipmask=T[0].mipmask,d.textureCube(c,$,T,_),c.internalformat=T[0].internalformat,C.width=T[0].width,C.height=T[0].height,Ut(c),L=0;L<6;++L)vt(T[L],Ho+L);for(Ct($,xs),at(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,C.width,C.height,$.genMipmaps,!0)),C.format=te[c.internalformat],C.type=xe[c.type],C.mag=Z[$.magFilter],C.min=ge[$.minFilter],C.wrapS=me[$.wrapS],C.wrapT=me[$.wrapT],L=0;L<6;++L)Et(T[L]);return C}function I(w,E,v,b,g){d(!!E,"must specify image data"),d(typeof w=="number"&&w===(w|0)&&w>=0&&w<6,"invalid face");var F=v|0,L=b|0,$=g|0,j=pe();return H(j,c),j.width=0,j.height=0,he(j,E),j.width=j.width||(c.width>>$)-F,j.height=j.height||(c.height>>$)-L,d(c.type===j.type&&c.format===j.format&&c.internalformat===j.internalformat,"incompatible format for texture.subimage"),d(F>=0&&L>=0&&F+j.width<=c.width&&L+j.height<=c.height,"texture.subimage write out of bounds"),d(c.mipmask&1<<$,"missing mipmap data"),d(j.data||j.element||j.needsCopy,"missing image data"),Ut(c),We(j,Ho+w,F,L,$),at(),ye(j),C}function A(w){var E=w|0;if(E!==c.width){C.width=c.width=E,C.height=c.height=E,Ut(c);for(var v=0;v<6;++v)for(var b=0;c.mipmask>>b;++b)a.texImage2D(Ho+v,b,c.format,E>>b,E>>b,0,c.format,c.type,null);return at(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,C.width,C.height,!1,!0)),C}}return C(x,O,z,_e,Ke,p),C.subimage=I,C.resize=A,C._reglType="textureCube",C._texture=c,B.profile&&(C.stats=c.stats),C.destroy=function(){c.decRef()},C}function bt(){for(var x=0;x<Bt;++x)a.activeTexture(Cr+x),a.bindTexture(An,null),xt[x]=null;rn(zt).forEach(Fe),R.cubeCount=0,R.textureCount=0}B.profile&&(R.getTotalTextureSize=function(){var x=0;return Object.keys(zt).forEach(function(O){x+=zt[O].stats.size}),x});function Cn(){for(var x=0;x<Bt;++x){var O=xt[x];O&&(O.bindCount=0,O.unit=-1,xt[x]=null)}rn(zt).forEach(function(z){z.texture=a.createTexture(),a.bindTexture(z.target,z.texture);for(var _e=0;_e<32;++_e)if((z.mipmask&1<<_e)!==0)if(z.target===An)a.texImage2D(An,_e,z.internalformat,z.width>>_e,z.height>>_e,0,z.internalformat,z.type,null);else for(var Ke=0;Ke<6;++Ke)a.texImage2D(Ho+Ke,_e,z.internalformat,z.width>>_e,z.height>>_e,0,z.internalformat,z.type,null);Ct(z.texInfo,z.target)})}function wi(){for(var x=0;x<Bt;++x){var O=xt[x];O&&(O.bindCount=0,O.unit=-1,xt[x]=null),a.activeTexture(Cr+x),a.bindTexture(An,null),a.bindTexture(xs,null)}}return{create2D:et,createCube:it,clear:bt,getTexture:function(x){return null},restore:Cn,refresh:wi}}var Zn=36161,Qo=32854,Hu=32855,Wu=36194,Xu=33189,ju=36168,qu=34041,Yu=35907,Zu=34836,Qu=34842,Ku=34843,xn=[];xn[Qo]=2,xn[Hu]=2,xn[Wu]=2,xn[Xu]=2,xn[ju]=1,xn[qu]=4,xn[Yu]=4,xn[Zu]=16,xn[Qu]=8,xn[Ku]=6;function Ju(a,h,_){return xn[a]*h*_}var Zy=function(a,h,_,M,W){var R={rgba4:Qo,rgb565:Wu,"rgb5 a1":Hu,depth:Xu,stencil:ju,"depth stencil":qu};h.ext_srgb&&(R.srgba=Yu),h.ext_color_buffer_half_float&&(R.rgba16f=Qu,R.rgb16f=Ku),h.webgl_color_buffer_float&&(R.rgba32f=Zu);var B=[];Object.keys(R).forEach(function(J){var ne=R[J];B[ne]=J});var K=0,Q={};function re(J){this.id=K++,this.refCount=1,this.renderbuffer=J,this.format=Qo,this.width=0,this.height=0,W.profile&&(this.stats={size:0})}re.prototype.decRef=function(){--this.refCount<=0&&ae(this)};function ae(J){var ne=J.renderbuffer;d(ne,"must not double destroy renderbuffer"),a.bindRenderbuffer(Zn,null),a.deleteRenderbuffer(ne),J.renderbuffer=null,J.refCount=0,delete Q[J.id],M.renderbufferCount--}function oe(J,ne){var k=new re(a.createRenderbuffer());Q[k.id]=k,M.renderbufferCount++;function G(xe,Z){var ge=0,me=0,De=Qo;if(typeof xe=="object"&&xe){var X=xe;if("shape"in X){var H=X.shape;d(Array.isArray(H)&&H.length>=2,"invalid renderbuffer shape"),ge=H[0]|0,me=H[1]|0}else"radius"in X&&(ge=me=X.radius|0),"width"in X&&(ge=X.width|0),"height"in X&&(me=X.height|0);"format"in X&&(d.parameter(X.format,R,"invalid renderbuffer format"),De=R[X.format])}else typeof xe=="number"?(ge=xe|0,typeof Z=="number"?me=Z|0:me=ge):xe?d.raise("invalid arguments to renderbuffer constructor"):ge=me=1;if(d(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),!(ge===k.width&&me===k.height&&De===k.format))return G.width=k.width=ge,G.height=k.height=me,k.format=De,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,De,ge,me),d(a.getError()===0,"invalid render buffer format"),W.profile&&(k.stats.size=Ju(k.format,k.width,k.height)),G.format=B[k.format],G}function te(xe,Z){var ge=xe|0,me=Z|0||ge;return ge===k.width&&me===k.height||(d(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),G.width=k.width=ge,G.height=k.height=me,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,k.format,ge,me),d(a.getError()===0,"invalid render buffer format"),W.profile&&(k.stats.size=Ju(k.format,k.width,k.height))),G}return G(J,ne),G.resize=te,G._reglType="renderbuffer",G._renderbuffer=k,W.profile&&(G.stats=k.stats),G.destroy=function(){k.decRef()},G}W.profile&&(M.getTotalRenderbufferSize=function(){var J=0;return Object.keys(Q).forEach(function(ne){J+=Q[ne].stats.size}),J});function ue(){rn(Q).forEach(function(J){J.renderbuffer=a.createRenderbuffer(),a.bindRenderbuffer(Zn,J.renderbuffer),a.renderbufferStorage(Zn,J.format,J.width,J.height)}),a.bindRenderbuffer(Zn,null)}return{create:oe,clear:function(){rn(Q).forEach(ae)},restore:ue}},Gn=36160,Ms=36161,yi=3553,Ko=34069,ec=36064,tc=36096,nc=36128,ic=33306,rc=36053,Qy=36054,Ky=36055,Jy=36057,ex=36061,tx=36193,nx=5121,ix=5126,oc=6407,ac=6408,rx=6402,ox=[oc,ac],Os=[];Os[ac]=4,Os[oc]=3;var Jo=[];Jo[nx]=1,Jo[ix]=4,Jo[tx]=2;var ax=32854,sx=32855,fx=36194,lx=33189,ux=36168,sc=34041,cx=35907,hx=34836,dx=34842,mx=34843,px=[ax,sx,fx,cx,dx,mx,hx],ji={};ji[rc]="complete",ji[Qy]="incomplete attachment",ji[Jy]="incomplete dimensions",ji[Ky]="incomplete, missing attachment",ji[ex]="unsupported";function vx(a,h,_,M,W,R){var B={cur:null,next:null,dirty:!1,setFBO:null},K=["rgba"],Q=["rgba4","rgb565","rgb5 a1"];h.ext_srgb&&Q.push("srgba"),h.ext_color_buffer_half_float&&Q.push("rgba16f","rgb16f"),h.webgl_color_buffer_float&&Q.push("rgba32f");var re=["uint8"];h.oes_texture_half_float&&re.push("half float","float16"),h.oes_texture_float&&re.push("float","float32");function ae(ee,he,de){this.target=ee,this.texture=he,this.renderbuffer=de;var We=0,Ue=0;he?(We=he.width,Ue=he.height):de&&(We=de.width,Ue=de.height),this.width=We,this.height=Ue}function oe(ee){ee&&(ee.texture&&ee.texture._texture.decRef(),ee.renderbuffer&&ee.renderbuffer._renderbuffer.decRef())}function ue(ee,he,de){if(ee)if(ee.texture){var We=ee.texture._texture,Ue=Math.max(1,We.width),pe=Math.max(1,We.height);d(Ue===he&&pe===de,"inconsistent width/height for supplied texture"),We.refCount+=1}else{var ye=ee.renderbuffer._renderbuffer;d(ye.width===he&&ye.height===de,"inconsistent width/height for renderbuffer"),ye.refCount+=1}}function J(ee,he){he&&(he.texture?a.framebufferTexture2D(Gn,ee,he.target,he.texture._texture.texture,0):a.framebufferRenderbuffer(Gn,ee,Ms,he.renderbuffer._renderbuffer.renderbuffer))}function ne(ee){var he=yi,de=null,We=null,Ue=ee;typeof ee=="object"&&(Ue=ee.data,"target"in ee&&(he=ee.target|0)),d.type(Ue,"function","invalid attachment data");var pe=Ue._reglType;return pe==="texture2d"?(de=Ue,d(he===yi)):pe==="textureCube"?(de=Ue,d(he>=Ko&&he<Ko+6,"invalid cube map target")):pe==="renderbuffer"?(We=Ue,he=Ms):d.raise("invalid regl object for attachment"),new ae(he,de,We)}function k(ee,he,de,We,Ue){if(de){var pe=M.create2D({width:ee,height:he,format:We,type:Ue});return pe._texture.refCount=0,new ae(yi,pe,null)}else{var ye=W.create({width:ee,height:he,format:We});return ye._renderbuffer.refCount=0,new ae(Ms,null,ye)}}function G(ee){return ee&&(ee.texture||ee.renderbuffer)}function te(ee,he,de){ee&&(ee.texture?ee.texture.resize(he,de):ee.renderbuffer&&ee.renderbuffer.resize(he,de),ee.width=he,ee.height=de)}var xe=0,Z={};function ge(){this.id=xe++,Z[this.id]=this,this.framebuffer=a.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function me(ee){ee.colorAttachments.forEach(oe),oe(ee.depthAttachment),oe(ee.stencilAttachment),oe(ee.depthStencilAttachment)}function De(ee){var he=ee.framebuffer;d(he,"must not double destroy framebuffer"),a.deleteFramebuffer(he),ee.framebuffer=null,R.framebufferCount--,delete Z[ee.id]}function X(ee){var he;a.bindFramebuffer(Gn,ee.framebuffer);var de=ee.colorAttachments;for(he=0;he<de.length;++he)J(ec+he,de[he]);for(he=de.length;he<_.maxColorAttachments;++he)a.framebufferTexture2D(Gn,ec+he,yi,null,0);a.framebufferTexture2D(Gn,ic,yi,null,0),a.framebufferTexture2D(Gn,tc,yi,null,0),a.framebufferTexture2D(Gn,nc,yi,null,0),J(tc,ee.depthAttachment),J(nc,ee.stencilAttachment),J(ic,ee.depthStencilAttachment);var We=a.checkFramebufferStatus(Gn);!a.isContextLost()&&We!==rc&&d.raise("framebuffer configuration not supported, status = "+ji[We]),a.bindFramebuffer(Gn,B.next?B.next.framebuffer:null),B.cur=B.next,a.getError()}function H(ee,he){var de=new ge;R.framebufferCount++;function We(pe,ye){var Re;d(B.next!==de,"can not update framebuffer which is currently in use");var Xe=0,Je=0,vt=!0,yt=!0,tt=null,Et=!0,ht="rgba",Tt="uint8",Ct=1,Pt=null,zt=null,Bt=null,xt=!1;if(typeof pe=="number")Xe=pe|0,Je=ye|0||Xe;else if(!pe)Xe=Je=1;else{d.type(pe,"object","invalid arguments for framebuffer");var Ye=pe;if("shape"in Ye){var Ut=Ye.shape;d(Array.isArray(Ut)&&Ut.length>=2,"invalid shape for framebuffer"),Xe=Ut[0],Je=Ut[1]}else"radius"in Ye&&(Xe=Je=Ye.radius),"width"in Ye&&(Xe=Ye.width),"height"in Ye&&(Je=Ye.height);("color"in Ye||"colors"in Ye)&&(tt=Ye.color||Ye.colors,Array.isArray(tt)&&d(tt.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),tt||("colorCount"in Ye&&(Ct=Ye.colorCount|0,d(Ct>0,"invalid color buffer count")),"colorTexture"in Ye&&(Et=!!Ye.colorTexture,ht="rgba4"),"colorType"in Ye&&(Tt=Ye.colorType,Et?(d(h.oes_texture_float||!(Tt==="float"||Tt==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),d(h.oes_texture_half_float||!(Tt==="half float"||Tt==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Tt==="half float"||Tt==="float16"?(d(h.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),ht="rgba16f"):(Tt==="float"||Tt==="float32")&&(d(h.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),ht="rgba32f"),d.oneOf(Tt,re,"invalid color type")),"colorFormat"in Ye&&(ht=Ye.colorFormat,K.indexOf(ht)>=0?Et=!0:Q.indexOf(ht)>=0?Et=!1:d.optional(function(){Et?d.oneOf(Ye.colorFormat,K,"invalid color format for texture"):d.oneOf(Ye.colorFormat,Q,"invalid color format for renderbuffer")}))),("depthTexture"in Ye||"depthStencilTexture"in Ye)&&(xt=!!(Ye.depthTexture||Ye.depthStencilTexture),d(!xt||h.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Ye&&(typeof Ye.depth=="boolean"?vt=Ye.depth:(Pt=Ye.depth,yt=!1)),"stencil"in Ye&&(typeof Ye.stencil=="boolean"?yt=Ye.stencil:(zt=Ye.stencil,vt=!1)),"depthStencil"in Ye&&(typeof Ye.depthStencil=="boolean"?vt=yt=Ye.depthStencil:(Bt=Ye.depthStencil,vt=!1,yt=!1))}var at=null,Fe=null,et=null,it=null;if(Array.isArray(tt))at=tt.map(ne);else if(tt)at=[ne(tt)];else for(at=new Array(Ct),Re=0;Re<Ct;++Re)at[Re]=k(Xe,Je,Et,ht,Tt);d(h.webgl_draw_buffers||at.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),d(at.length<=_.maxColorAttachments,"too many color attachments, not supported"),Xe=Xe||at[0].width,Je=Je||at[0].height,Pt?Fe=ne(Pt):vt&&!yt&&(Fe=k(Xe,Je,xt,"depth","uint32")),zt?et=ne(zt):yt&&!vt&&(et=k(Xe,Je,!1,"stencil","uint8")),Bt?it=ne(Bt):!Pt&&!zt&&yt&&vt&&(it=k(Xe,Je,xt,"depth stencil","depth stencil")),d(!!Pt+!!zt+!!Bt<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var bt=null;for(Re=0;Re<at.length;++Re)if(ue(at[Re],Xe,Je),d(!at[Re]||at[Re].texture&&ox.indexOf(at[Re].texture._texture.format)>=0||at[Re].renderbuffer&&px.indexOf(at[Re].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+Re+" is invalid"),at[Re]&&at[Re].texture){var Cn=Os[at[Re].texture._texture.format]*Jo[at[Re].texture._texture.type];bt===null?bt=Cn:d(bt===Cn,"all color attachments much have the same number of bits per pixel.")}return ue(Fe,Xe,Je),d(!Fe||Fe.texture&&Fe.texture._texture.format===rx||Fe.renderbuffer&&Fe.renderbuffer._renderbuffer.format===lx,"invalid depth attachment for framebuffer object"),ue(et,Xe,Je),d(!et||et.renderbuffer&&et.renderbuffer._renderbuffer.format===ux,"invalid stencil attachment for framebuffer object"),ue(it,Xe,Je),d(!it||it.texture&&it.texture._texture.format===sc||it.renderbuffer&&it.renderbuffer._renderbuffer.format===sc,"invalid depth-stencil attachment for framebuffer object"),me(de),de.width=Xe,de.height=Je,de.colorAttachments=at,de.depthAttachment=Fe,de.stencilAttachment=et,de.depthStencilAttachment=it,We.color=at.map(G),We.depth=G(Fe),We.stencil=G(et),We.depthStencil=G(it),We.width=de.width,We.height=de.height,X(de),We}function Ue(pe,ye){d(B.next!==de,"can not resize a framebuffer which is currently in use");var Re=Math.max(pe|0,1),Xe=Math.max(ye|0||Re,1);if(Re===de.width&&Xe===de.height)return We;for(var Je=de.colorAttachments,vt=0;vt<Je.length;++vt)te(Je[vt],Re,Xe);return te(de.depthAttachment,Re,Xe),te(de.stencilAttachment,Re,Xe),te(de.depthStencilAttachment,Re,Xe),de.width=We.width=Re,de.height=We.height=Xe,X(de),We}return We(ee,he),i(We,{resize:Ue,_reglType:"framebuffer",_framebuffer:de,destroy:function(){De(de),me(de)},use:function(pe){B.setFBO({framebuffer:We},pe)}})}function Se(ee){var he=Array(6);function de(Ue){var pe;d(he.indexOf(B.next)<0,"can not update framebuffer which is currently in use");var ye={color:null},Re=0,Xe=null,Je="rgba",vt="uint8",yt=1;if(typeof Ue=="number")Re=Ue|0;else if(!Ue)Re=1;else{d.type(Ue,"object","invalid arguments for framebuffer");var tt=Ue;if("shape"in tt){var Et=tt.shape;d(Array.isArray(Et)&&Et.length>=2,"invalid shape for framebuffer"),d(Et[0]===Et[1],"cube framebuffer must be square"),Re=Et[0]}else"radius"in tt&&(Re=tt.radius|0),"width"in tt?(Re=tt.width|0,"height"in tt&&d(tt.height===Re,"must be square")):"height"in tt&&(Re=tt.height|0);("color"in tt||"colors"in tt)&&(Xe=tt.color||tt.colors,Array.isArray(Xe)&&d(Xe.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),Xe||("colorCount"in tt&&(yt=tt.colorCount|0,d(yt>0,"invalid color buffer count")),"colorType"in tt&&(d.oneOf(tt.colorType,re,"invalid color type"),vt=tt.colorType),"colorFormat"in tt&&(Je=tt.colorFormat,d.oneOf(tt.colorFormat,K,"invalid color format for texture"))),"depth"in tt&&(ye.depth=tt.depth),"stencil"in tt&&(ye.stencil=tt.stencil),"depthStencil"in tt&&(ye.depthStencil=tt.depthStencil)}var ht;if(Xe)if(Array.isArray(Xe))for(ht=[],pe=0;pe<Xe.length;++pe)ht[pe]=Xe[pe];else ht=[Xe];else{ht=Array(yt);var Tt={radius:Re,format:Je,type:vt};for(pe=0;pe<yt;++pe)ht[pe]=M.createCube(Tt)}for(ye.color=Array(ht.length),pe=0;pe<ht.length;++pe){var Ct=ht[pe];d(typeof Ct=="function"&&Ct._reglType==="textureCube","invalid cube map"),Re=Re||Ct.width,d(Ct.width===Re&&Ct.height===Re,"invalid cube map shape"),ye.color[pe]={target:Ko,data:ht[pe]}}for(pe=0;pe<6;++pe){for(var Pt=0;Pt<ht.length;++Pt)ye.color[Pt].target=Ko+pe;pe>0&&(ye.depth=he[0].depth,ye.stencil=he[0].stencil,ye.depthStencil=he[0].depthStencil),he[pe]?he[pe](ye):he[pe]=H(ye)}return i(de,{width:Re,height:Re,color:ht})}function We(Ue){var pe,ye=Ue|0;if(d(ye>0&&ye<=_.maxCubeMapSize,"invalid radius for cube fbo"),ye===de.width)return de;var Re=de.color;for(pe=0;pe<Re.length;++pe)Re[pe].resize(ye);for(pe=0;pe<6;++pe)he[pe].resize(ye);return de.width=de.height=ye,de}return de(ee),i(de,{faces:he,resize:We,_reglType:"framebufferCube",destroy:function(){he.forEach(function(Ue){Ue.destroy()})}})}function ce(){B.cur=null,B.next=null,B.dirty=!0,rn(Z).forEach(function(ee){ee.framebuffer=a.createFramebuffer(),X(ee)})}return i(B,{getFramebuffer:function(ee){if(typeof ee=="function"&&ee._reglType==="framebuffer"){var he=ee._framebuffer;if(he instanceof ge)return he}return null},create:H,createCube:Se,clear:function(){rn(Z).forEach(De)},restore:ce})}var gx=5126,fc=34962,ea=34963,lc=["attributes","elements","offset","count","primitive","instances"];function Ns(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=gx,this.offset=0,this.stride=0,this.divisor=0}function yx(a,h,_,M,W,R,B){for(var K=_.maxAttributes,Q=new Array(K),re=0;re<K;++re)Q[re]=new Ns;var ae=0,oe={},ue={Record:Ns,scope:{},state:Q,currentVAO:null,targetVAO:null,restore:ne()?me:function(){},createVAO:De,getVAO:G,destroyBuffer:J,setVAO:ne()?te:xe,clear:ne()?Z:function(){}};function J(X){for(var H=0;H<Q.length;++H){var Se=Q[H];Se.buffer===X&&(a.disableVertexAttribArray(H),Se.buffer=null)}}function ne(){return h.oes_vertex_array_object}function k(){return h.angle_instanced_arrays}function G(X){return typeof X=="function"&&X._vao?X._vao:null}function te(X){if(X!==ue.currentVAO){var H=ne();X?H.bindVertexArrayOES(X.vao):H.bindVertexArrayOES(null),ue.currentVAO=X}}function xe(X){if(X!==ue.currentVAO){if(X)X.bindAttrs();else{for(var H=k(),Se=0;Se<Q.length;++Se){var ce=Q[Se];ce.buffer?(a.enableVertexAttribArray(Se),ce.buffer.bind(),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offfset),H&&ce.divisor&&H.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}B.elements?a.bindBuffer(ea,B.elements.buffer.buffer):a.bindBuffer(ea,null)}ue.currentVAO=X}}function Z(){rn(oe).forEach(function(X){X.destroy()})}function ge(){this.id=++ae,this.attributes=[],this.elements=null,this.ownsElements=!1,this.count=0,this.offset=0,this.instances=-1,this.primitive=4;var X=ne();X?this.vao=X.createVertexArrayOES():this.vao=null,oe[this.id]=this,this.buffers=[]}ge.prototype.bindAttrs=function(){for(var X=k(),H=this.attributes,Se=0;Se<H.length;++Se){var ce=H[Se];ce.buffer?(a.enableVertexAttribArray(Se),a.bindBuffer(fc,ce.buffer.buffer),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offset),X&&ce.divisor&&X.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}for(var ee=H.length;ee<K;++ee)a.disableVertexAttribArray(ee);var he=R.getElements(this.elements);he?a.bindBuffer(ea,he.buffer.buffer):a.bindBuffer(ea,null)},ge.prototype.refresh=function(){var X=ne();X&&(X.bindVertexArrayOES(this.vao),this.bindAttrs(),ue.currentVAO=null,X.bindVertexArrayOES(null))},ge.prototype.destroy=function(){if(this.vao){var X=ne();this===ue.currentVAO&&(ue.currentVAO=null,X.bindVertexArrayOES(null)),X.deleteVertexArrayOES(this.vao),this.vao=null}this.ownsElements&&(this.elements.destroy(),this.elements=null,this.ownsElements=!1),oe[this.id]&&(delete oe[this.id],M.vaoCount-=1)};function me(){var X=ne();X&&rn(oe).forEach(function(H){H.refresh()})}function De(X){var H=new ge;M.vaoCount+=1;function Se(ce){var ee;if(Array.isArray(ce))ee=ce,H.elements&&H.ownsElements&&H.elements.destroy(),H.elements=null,H.ownsElements=!1,H.offset=0,H.count=0,H.instances=-1,H.primitive=4;else{if(d(typeof ce=="object","invalid arguments for create vao"),d("attributes"in ce,"must specify attributes for vao"),ce.elements){var he=ce.elements;H.ownsElements?typeof he=="function"&&he._reglType==="elements"?(H.elements.destroy(),H.ownsElements=!1):(H.elements(he),H.ownsElements=!1):R.getElements(ce.elements)?(H.elements=ce.elements,H.ownsElements=!1):(H.elements=R.create(ce.elements),H.ownsElements=!0)}else H.elements=null,H.ownsElements=!1;ee=ce.attributes,H.offset=0,H.count=-1,H.instances=-1,H.primitive=4,H.elements&&(H.count=H.elements._elements.vertCount,H.primitive=H.elements._elements.primType),"offset"in ce&&(H.offset=ce.offset|0),"count"in ce&&(H.count=ce.count|0),"instances"in ce&&(H.instances=ce.instances|0),"primitive"in ce&&(d(ce.primitive in Yn,"bad primitive type: "+ce.primitive),H.primitive=Yn[ce.primitive]),d.optional(()=>{for(var vt=Object.keys(ce),yt=0;yt<vt.length;++yt)d(lc.indexOf(vt[yt])>=0,'invalid option for vao: "'+vt[yt]+'" valid options are '+lc)}),d(Array.isArray(ee),"attributes must be an array")}d(ee.length<K,"too many attributes"),d(ee.length>0,"must specify at least one attribute");var de={},We=H.attributes;We.length=ee.length;for(var Ue=0;Ue<ee.length;++Ue){var pe=ee[Ue],ye=We[Ue]=new Ns,Re=pe.data||pe;if(Array.isArray(Re)||n(Re)||yn(Re)){var Xe;H.buffers[Ue]&&(Xe=H.buffers[Ue],n(Re)&&Xe._buffer.byteLength>=Re.byteLength?Xe.subdata(Re):(Xe.destroy(),H.buffers[Ue]=null)),H.buffers[Ue]||(Xe=H.buffers[Ue]=W.create(pe,fc,!1,!0)),ye.buffer=W.getBuffer(Xe),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1,de[Ue]=1}else W.getBuffer(pe)?(ye.buffer=W.getBuffer(pe),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1):W.getBuffer(pe.buffer)?(ye.buffer=W.getBuffer(pe.buffer),ye.size=(+pe.size||ye.buffer.dimension)|0,ye.normalized=!!pe.normalized||!1,"type"in pe?(d.parameter(pe.type,mi,"invalid buffer type"),ye.type=mi[pe.type]):ye.type=ye.buffer.dtype,ye.offset=(pe.offset||0)|0,ye.stride=(pe.stride||0)|0,ye.divisor=(pe.divisor||0)|0,ye.state=1,d(ye.size>=1&&ye.size<=4,"size must be between 1 and 4"),d(ye.offset>=0,"invalid offset"),d(ye.stride>=0&&ye.stride<=255,"stride must be between 0 and 255"),d(ye.divisor>=0,"divisor must be positive"),d(!ye.divisor||!!h.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in pe?(d(Ue>0,"first attribute must not be a constant"),ye.x=+pe.x||0,ye.y=+pe.y||0,ye.z=+pe.z||0,ye.w=+pe.w||0,ye.state=2):d(!1,"invalid attribute spec for location "+Ue)}for(var Je=0;Je<H.buffers.length;++Je)!de[Je]&&H.buffers[Je]&&(H.buffers[Je].destroy(),H.buffers[Je]=null);return H.refresh(),Se}return Se.destroy=function(){for(var ce=0;ce<H.buffers.length;++ce)H.buffers[ce]&&H.buffers[ce].destroy();H.buffers.length=0,H.ownsElements&&(H.elements.destroy(),H.elements=null,H.ownsElements=!1),H.destroy()},Se._vao=H,Se._reglType="vao",Se(X)}return ue}var uc=35632,xx=35633,bx=35718,_x=35721;function Sx(a,h,_,M){var W={},R={};function B(k,G,te,xe){this.name=k,this.id=G,this.location=te,this.info=xe}function K(k,G){for(var te=0;te<k.length;++te)if(k[te].id===G.id){k[te].location=G.location;return}k.push(G)}function Q(k,G,te){var xe=k===uc?W:R,Z=xe[G];if(!Z){var ge=h.str(G);Z=a.createShader(k),a.shaderSource(Z,ge),a.compileShader(Z),d.shaderError(a,Z,ge,k,te),xe[G]=Z}return Z}var re={},ae=[],oe=0;function ue(k,G){this.id=oe++,this.fragId=k,this.vertId=G,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,M.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function J(k,G,te){var xe,Z,ge=Q(uc,k.fragId),me=Q(xx,k.vertId),De=k.program=a.createProgram();if(a.attachShader(De,ge),a.attachShader(De,me),te)for(xe=0;xe<te.length;++xe){var X=te[xe];a.bindAttribLocation(De,X[0],X[1])}a.linkProgram(De),d.linkError(a,De,h.str(k.fragId),h.str(k.vertId),G);var H=a.getProgramParameter(De,bx);M.profile&&(k.stats.uniformsCount=H);var Se=k.uniforms;for(xe=0;xe<H;++xe)if(Z=a.getActiveUniform(De,xe),Z){if(Z.size>1)for(var ce=0;ce<Z.size;++ce){var ee=Z.name.replace("[0]","["+ce+"]");K(Se,new B(ee,h.id(ee),a.getUniformLocation(De,ee),Z))}var he=Z.name;Z.size>1&&(he=he.replace("[0]","")),K(Se,new B(he,h.id(he),a.getUniformLocation(De,he),Z))}var de=a.getProgramParameter(De,_x);M.profile&&(k.stats.attributesCount=de);var We=k.attributes;for(xe=0;xe<de;++xe)Z=a.getActiveAttrib(De,xe),Z&&K(We,new B(Z.name,h.id(Z.name),a.getAttribLocation(De,Z.name),Z))}M.profile&&(_.getMaxUniformsCount=function(){var k=0;return ae.forEach(function(G){G.stats.uniformsCount>k&&(k=G.stats.uniformsCount)}),k},_.getMaxAttributesCount=function(){var k=0;return ae.forEach(function(G){G.stats.attributesCount>k&&(k=G.stats.attributesCount)}),k});function ne(){W={},R={};for(var k=0;k<ae.length;++k)J(ae[k],null,ae[k].attributes.map(function(G){return[G.location,G.name]}))}return{clear:function(){var k=a.deleteShader.bind(a);rn(W).forEach(k),W={},rn(R).forEach(k),R={},ae.forEach(function(G){a.deleteProgram(G.program)}),ae.length=0,re={},_.shaderCount=0},program:function(k,G,te,xe){d.command(k>=0,"missing vertex shader",te),d.command(G>=0,"missing fragment shader",te);var Z=re[G];Z||(Z=re[G]={});var ge=Z[k];if(ge&&(ge.refCount++,!xe))return ge;var me=new ue(G,k);return _.shaderCount++,J(me,te,xe),ge||(Z[k]=me),ae.push(me),i(me,{destroy:function(){if(me.refCount--,me.refCount<=0){a.deleteProgram(me.program);var De=ae.indexOf(me);ae.splice(De,1),_.shaderCount--}Z[me.vertId].refCount<=0&&(a.deleteShader(R[me.vertId]),delete R[me.vertId],delete re[me.fragId][me.vertId]),Object.keys(re[me.fragId]).length||(a.deleteShader(W[me.fragId]),delete W[me.fragId],delete re[me.fragId])}})},restore:ne,shader:Q,frag:-1,vert:-1}}var Tx=6408,Pr=5121,wx=3333,ta=5126;function Ax(a,h,_,M,W,R,B){function K(ae){var oe;h.next===null?(d(W.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),oe=Pr):(d(h.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),oe=h.next.colorAttachments[0].texture._texture.type,d.optional(function(){R.oes_texture_float?(d(oe===Pr||oe===ta,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),oe===ta&&d(B.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):d(oe===Pr,"Reading from a framebuffer is only allowed for the type 'uint8'")}));var ue=0,J=0,ne=M.framebufferWidth,k=M.framebufferHeight,G=null;n(ae)?G=ae:ae&&(d.type(ae,"object","invalid arguments to regl.read()"),ue=ae.x|0,J=ae.y|0,d(ue>=0&&ue<M.framebufferWidth,"invalid x offset for regl.read"),d(J>=0&&J<M.framebufferHeight,"invalid y offset for regl.read"),ne=(ae.width||M.framebufferWidth-ue)|0,k=(ae.height||M.framebufferHeight-J)|0,G=ae.data||null),G&&(oe===Pr?d(G instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):oe===ta&&d(G instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),d(ne>0&&ne+ue<=M.framebufferWidth,"invalid width for read pixels"),d(k>0&&k+J<=M.framebufferHeight,"invalid height for read pixels"),_();var te=ne*k*4;return G||(oe===Pr?G=new Uint8Array(te):oe===ta&&(G=G||new Float32Array(te))),d.isTypedArray(G,"data buffer for regl.read() must be a typedarray"),d(G.byteLength>=te,"data buffer for regl.read() too small"),a.pixelStorei(wx,4),a.readPixels(ue,J,ne,k,Tx,oe,G),G}function Q(ae){var oe;return h.setFBO({framebuffer:ae.framebuffer},function(){oe=K(ae)}),oe}function re(ae){return!ae||!("framebuffer"in ae)?K(ae):Q(ae)}return re}function qi(a){return Array.prototype.slice.call(a)}function Yi(a){return qi(a).join("")}function Ex(){var a=0,h=[],_=[];function M(oe){for(var ue=0;ue<_.length;++ue)if(_[ue]===oe)return h[ue];var J="g"+a++;return h.push(J),_.push(oe),J}function W(){var oe=[];function ue(){oe.push.apply(oe,qi(arguments))}var J=[];function ne(){var k="v"+a++;return J.push(k),arguments.length>0&&(oe.push(k,"="),oe.push.apply(oe,qi(arguments)),oe.push(";")),k}return i(ue,{def:ne,toString:function(){return Yi([J.length>0?"var "+J.join(",")+";":"",Yi(oe)])}})}function R(){var oe=W(),ue=W(),J=oe.toString,ne=ue.toString;function k(G,te){ue(G,te,"=",oe.def(G,te),";")}return i(function(){oe.apply(oe,qi(arguments))},{def:oe.def,entry:oe,exit:ue,save:k,set:function(G,te,xe){k(G,te),oe(G,te,"=",xe,";")},toString:function(){return J()+ne()}})}function B(){var oe=Yi(arguments),ue=R(),J=R(),ne=ue.toString,k=J.toString;return i(ue,{then:function(){return ue.apply(ue,qi(arguments)),this},else:function(){return J.apply(J,qi(arguments)),this},toString:function(){var G=k();return G&&(G="else{"+G+"}"),Yi(["if(",oe,"){",ne(),"}",G])}})}var K=W(),Q={};function re(oe,ue){var J=[];function ne(){var Z="a"+J.length;return J.push(Z),Z}ue=ue||0;for(var k=0;k<ue;++k)ne();var G=R(),te=G.toString,xe=Q[oe]=i(G,{arg:ne,toString:function(){return Yi(["function(",J.join(),"){",te(),"}"])}});return xe}function ae(){var oe=['"use strict";',K,"return {"];Object.keys(Q).forEach(function(ne){oe.push('"',ne,'":',Q[ne].toString(),",")}),oe.push("}");var ue=Yi(oe).replace(/;/g,`;
|
|
1
|
+
(function(Rt,ti){typeof exports=="object"&&typeof module<"u"?ti(exports):typeof define=="function"&&define.amd?define(["exports"],ti):(Rt=typeof globalThis<"u"?globalThis:Rt||self,ti(Rt.Cosmos={}))})(this,function(Rt){"use strict";var ti="http://www.w3.org/1999/xhtml";const lf={svg:"http://www.w3.org/2000/svg",xhtml:ti,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Br(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),lf.hasOwnProperty(e)?{space:lf[e],local:t}:t}function Yc(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ti&&e.documentElement.namespaceURI===ti?e.createElement(t):e.createElementNS(n,t)}}function Zc(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function uf(t){var e=Br(t);return(e.local?Zc:Yc)(e)}function Qc(){}function ya(t){return t==null?Qc:function(){return this.querySelector(t)}}function Kc(t){typeof t!="function"&&(t=ya(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],s=o.length,f=i[r]=new Array(s),l,u,d=0;d<s;++d)(l=o[d])&&(u=t.call(l,l.__data__,d,o))&&("__data__"in l&&(u.__data__=l.__data__),f[d]=u);return new tn(i,this._parents)}function Jc(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function eh(){return[]}function cf(t){return t==null?eh:function(){return this.querySelectorAll(t)}}function th(t){return function(){return Jc(t.apply(this,arguments))}}function nh(t){typeof t=="function"?t=th(t):t=cf(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var s=e[o],f=s.length,l,u=0;u<f;++u)(l=s[u])&&(i.push(t.call(l,l.__data__,u,s)),r.push(l));return new tn(i,r)}function hf(t){return function(){return this.matches(t)}}function df(t){return function(e){return e.matches(t)}}var ih=Array.prototype.find;function rh(t){return function(){return ih.call(this.children,t)}}function oh(){return this.firstElementChild}function ah(t){return this.select(t==null?oh:rh(typeof t=="function"?t:df(t)))}var sh=Array.prototype.filter;function fh(){return Array.from(this.children)}function lh(t){return function(){return sh.call(this.children,t)}}function uh(t){return this.selectAll(t==null?fh:lh(typeof t=="function"?t:df(t)))}function ch(t){typeof t!="function"&&(t=hf(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],s=o.length,f=i[r]=[],l,u=0;u<s;++u)(l=o[u])&&t.call(l,l.__data__,u,o)&&f.push(l);return new tn(i,this._parents)}function mf(t){return new Array(t.length)}function hh(){return new tn(this._enter||this._groups.map(mf),this._parents)}function Ur(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ur.prototype={constructor:Ur,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function dh(t){return function(){return t}}function mh(t,e,n,i,r,o){for(var s=0,f,l=e.length,u=o.length;s<u;++s)(f=e[s])?(f.__data__=o[s],i[s]=f):n[s]=new Ur(t,o[s]);for(;s<l;++s)(f=e[s])&&(r[s]=f)}function ph(t,e,n,i,r,o,s){var f,l,u=new Map,d=e.length,y=o.length,S=new Array(d),D;for(f=0;f<d;++f)(l=e[f])&&(S[f]=D=s.call(l,l.__data__,f,e)+"",u.has(D)?r[f]=l:u.set(D,l));for(f=0;f<y;++f)D=s.call(t,o[f],f,o)+"",(l=u.get(D))?(i[f]=l,l.__data__=o[f],u.delete(D)):n[f]=new Ur(t,o[f]);for(f=0;f<d;++f)(l=e[f])&&u.get(S[f])===l&&(r[f]=l)}function vh(t){return t.__data__}function gh(t,e){if(!arguments.length)return Array.from(this,vh);var n=e?ph:mh,i=this._parents,r=this._groups;typeof t!="function"&&(t=dh(t));for(var o=r.length,s=new Array(o),f=new Array(o),l=new Array(o),u=0;u<o;++u){var d=i[u],y=r[u],S=y.length,D=yh(t.call(d,d&&d.__data__,u,i)),q=D.length,Te=f[u]=new Array(q),we=s[u]=new Array(q),fe=l[u]=new Array(S);n(d,y,Te,we,fe,D,e);for(var Ne=0,Ve=0,V,ae;Ne<q;++Ne)if(V=Te[Ne]){for(Ne>=Ve&&(Ve=Ne+1);!(ae=we[Ve])&&++Ve<q;);V._next=ae||null}}return s=new tn(s,i),s._enter=f,s._exit=l,s}function yh(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function xh(){return new tn(this._exit||this._groups.map(mf),this._parents)}function bh(t,e,n){var i=this.enter(),r=this,o=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?o.remove():n(o),i&&r?i.merge(r).order():r}function _h(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,o=i.length,s=Math.min(r,o),f=new Array(r),l=0;l<s;++l)for(var u=n[l],d=i[l],y=u.length,S=f[l]=new Array(y),D,q=0;q<y;++q)(D=u[q]||d[q])&&(S[q]=D);for(;l<r;++l)f[l]=n[l];return new tn(f,this._parents)}function Sh(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,o=i[r],s;--r>=0;)(s=i[r])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Th(t){t||(t=wh);function e(y,S){return y&&S?t(y.__data__,S.__data__):!y-!S}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var s=n[o],f=s.length,l=r[o]=new Array(f),u,d=0;d<f;++d)(u=s[d])&&(l[d]=u);l.sort(e)}return new tn(r,this._parents).order()}function wh(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Ah(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Eh(){return Array.from(this)}function Ch(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var s=i[r];if(s)return s}return null}function Ph(){let t=0;for(const e of this)++t;return t}function kh(){return!this.node()}function Ih(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],o=0,s=r.length,f;o<s;++o)(f=r[o])&&t.call(f,f.__data__,o,r);return this}function Lh(t){return function(){this.removeAttribute(t)}}function Dh(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Fh(t,e){return function(){this.setAttribute(t,e)}}function zh(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Rh(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Mh(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Oh(t,e){var n=Br(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?Dh:Lh:typeof e=="function"?n.local?Mh:Rh:n.local?zh:Fh)(n,e))}function pf(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Nh(t){return function(){this.style.removeProperty(t)}}function Gh(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Bh(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Uh(t,e,n){return arguments.length>1?this.each((e==null?Nh:typeof e=="function"?Bh:Gh)(t,e,n??"")):Pi(this.node(),t)}function Pi(t,e){return t.style.getPropertyValue(e)||pf(t).getComputedStyle(t,null).getPropertyValue(e)}function Vh(t){return function(){delete this[t]}}function $h(t,e){return function(){this[t]=e}}function Hh(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Wh(t,e){return arguments.length>1?this.each((e==null?Vh:typeof e=="function"?Hh:$h)(t,e)):this.node()[t]}function vf(t){return t.trim().split(/^|\s+/)}function xa(t){return t.classList||new gf(t)}function gf(t){this._node=t,this._names=vf(t.getAttribute("class")||"")}gf.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function yf(t,e){for(var n=xa(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function xf(t,e){for(var n=xa(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function Xh(t){return function(){yf(this,t)}}function jh(t){return function(){xf(this,t)}}function qh(t,e){return function(){(e.apply(this,arguments)?yf:xf)(this,t)}}function Yh(t,e){var n=vf(t+"");if(arguments.length<2){for(var i=xa(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?qh:e?Xh:jh)(n,e))}function Zh(){this.textContent=""}function Qh(t){return function(){this.textContent=t}}function Kh(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Jh(t){return arguments.length?this.each(t==null?Zh:(typeof t=="function"?Kh:Qh)(t)):this.node().textContent}function ed(){this.innerHTML=""}function td(t){return function(){this.innerHTML=t}}function nd(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function id(t){return arguments.length?this.each(t==null?ed:(typeof t=="function"?nd:td)(t)):this.node().innerHTML}function rd(){this.nextSibling&&this.parentNode.appendChild(this)}function od(){return this.each(rd)}function ad(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function sd(){return this.each(ad)}function fd(t){var e=typeof t=="function"?t:uf(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ld(){return null}function ud(t,e){var n=typeof t=="function"?t:uf(t),i=e==null?ld:typeof e=="function"?e:ya(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function cd(){var t=this.parentNode;t&&t.removeChild(this)}function hd(){return this.each(cd)}function dd(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function md(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function pd(t){return this.select(t?md:dd)}function vd(t){return arguments.length?this.property("__data__",t):this.node().__data__}function gd(t){return function(e){t.call(this,e,this.__data__)}}function yd(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function xd(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,o;n<r;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++i]=o;++i?e.length=i:delete this.__on}}}function bd(t,e,n){return function(){var i=this.__on,r,o=gd(e);if(i){for(var s=0,f=i.length;s<f;++s)if((r=i[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=e;return}}this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function _d(t,e,n){var i=yd(t+""),r,o=i.length,s;if(arguments.length<2){var f=this.node().__on;if(f){for(var l=0,u=f.length,d;l<u;++l)for(r=0,d=f[l];r<o;++r)if((s=i[r]).type===d.type&&s.name===d.name)return d.value}return}for(f=e?bd:xd,r=0;r<o;++r)this.each(f(i[r],e,n));return this}function bf(t,e,n){var i=pf(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Sd(t,e){return function(){return bf(this,t,e)}}function Td(t,e){return function(){return bf(this,t,e.apply(this,arguments))}}function wd(t,e){return this.each((typeof e=="function"?Td:Sd)(t,e))}function*Ad(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length,s;r<o;++r)(s=i[r])&&(yield s)}var _f=[null];function tn(t,e){this._groups=t,this._parents=e}function nr(){return new tn([[document.documentElement]],_f)}function Ed(){return this}tn.prototype=nr.prototype={constructor:tn,select:Kc,selectAll:nh,selectChild:ah,selectChildren:uh,filter:ch,data:gh,enter:hh,exit:xh,join:bh,merge:_h,selection:Ed,order:Sh,sort:Th,call:Ah,nodes:Eh,node:Ch,size:Ph,empty:kh,each:Ih,attr:Oh,style:Uh,property:Wh,classed:Yh,text:Jh,html:id,raise:od,lower:sd,append:fd,insert:ud,remove:hd,clone:pd,datum:vd,on:_d,dispatch:wd,[Symbol.iterator]:Ad};function Ft(t){return typeof t=="string"?new tn([[document.querySelector(t)]],[document.documentElement]):new tn([[t]],_f)}function Cd(t){let e;for(;e=t.sourceEvent;)t=e;return t}function kn(t,e){if(t=Cd(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}var Pd={value:()=>{}};function Vr(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new $r(n)}function $r(t){this._=t}function kd(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}$r.prototype=Vr.prototype={constructor:$r,on:function(t,e){var n=this._,i=kd(t+"",n),r,o=-1,s=i.length;if(arguments.length<2){for(;++o<s;)if((r=(t=i[o]).type)&&(r=Id(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<s;)if(r=(t=i[o]).type)n[r]=Sf(n[r],t.name,e);else if(e==null)for(r in n)n[r]=Sf(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new $r(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};function Id(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function Sf(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Pd,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var ki=0,ir=0,rr=0,Tf=1e3,Hr,or,Wr=0,ni=0,Xr=0,ar=typeof performance=="object"&&performance.now?performance:Date,wf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ba(){return ni||(wf(Ld),ni=ar.now()+Xr)}function Ld(){ni=0}function jr(){this._call=this._time=this._next=null}jr.prototype=Af.prototype={constructor:jr,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ba():+n)+(e==null?0:+e),!this._next&&or!==this&&(or?or._next=this:Hr=this,or=this),this._call=t,this._time=n,_a()},stop:function(){this._call&&(this._call=null,this._time=1/0,_a())}};function Af(t,e,n){var i=new jr;return i.restart(t,e,n),i}function Dd(){ba(),++ki;for(var t=Hr,e;t;)(e=ni-t._time)>=0&&t._call.call(null,e),t=t._next;--ki}function Ef(){ni=(Wr=ar.now())+Xr,ki=ir=0;try{Dd()}finally{ki=0,zd(),ni=0}}function Fd(){var t=ar.now(),e=t-Wr;e>Tf&&(Xr-=e,Wr=t)}function zd(){for(var t,e=Hr,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Hr=n);or=t,_a(i)}function _a(t){if(!ki){ir&&(ir=clearTimeout(ir));var e=t-ni;e>24?(t<1/0&&(ir=setTimeout(Ef,t-ar.now()-Xr)),rr&&(rr=clearInterval(rr))):(rr||(Wr=ar.now(),rr=setInterval(Fd,Tf)),ki=1,wf(Ef))}}function Cf(t,e,n){var i=new jr;return e=e==null?0:+e,i.restart(r=>{i.stop(),t(r+e)},e,n),i}var Rd=Vr("start","end","cancel","interrupt"),Md=[],Pf=0,kf=1,Sa=2,qr=3,If=4,Ta=5,Yr=6;function Zr(t,e,n,i,r,o){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Od(t,n,{name:e,index:i,group:r,on:Rd,tween:Md,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Pf})}function wa(t,e){var n=cn(t,e);if(n.state>Pf)throw new Error("too late; already scheduled");return n}function bn(t,e){var n=cn(t,e);if(n.state>qr)throw new Error("too late; already running");return n}function cn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Od(t,e,n){var i=t.__transition,r;i[e]=n,n.timer=Af(o,0,n.time);function o(u){n.state=kf,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,y,S,D;if(n.state!==kf)return l();for(d in i)if(D=i[d],D.name===n.name){if(D.state===qr)return Cf(s);D.state===If?(D.state=Yr,D.timer.stop(),D.on.call("interrupt",t,t.__data__,D.index,D.group),delete i[d]):+d<e&&(D.state=Yr,D.timer.stop(),D.on.call("cancel",t,t.__data__,D.index,D.group),delete i[d])}if(Cf(function(){n.state===qr&&(n.state=If,n.timer.restart(f,n.delay,n.time),f(u))}),n.state=Sa,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Sa){for(n.state=qr,r=new Array(S=n.tween.length),d=0,y=-1;d<S;++d)(D=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(r[++y]=D);r.length=y+1}}function f(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=Ta,1),y=-1,S=r.length;++y<S;)r[y].call(t,d);n.state===Ta&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Yr,n.timer.stop(),delete i[e];for(var u in i)return;delete t.__transition}}function Qr(t,e){var n=t.__transition,i,r,o=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((i=n[s]).name!==e){o=!1;continue}r=i.state>Sa&&i.state<Ta,i.state=Yr,i.timer.stop(),i.on.call(r?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[s]}o&&delete t.__transition}}function Nd(t){return this.each(function(){Qr(this,t)})}function Aa(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Lf(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function sr(){}var fr=.7,Kr=1/fr,Ii="\\s*([+-]?\\d+)\\s*",lr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gd=/^#([0-9a-f]{3,8})$/,Bd=new RegExp(`^rgb\\(${Ii},${Ii},${Ii}\\)$`),Ud=new RegExp(`^rgb\\(${_n},${_n},${_n}\\)$`),Vd=new RegExp(`^rgba\\(${Ii},${Ii},${Ii},${lr}\\)$`),$d=new RegExp(`^rgba\\(${_n},${_n},${_n},${lr}\\)$`),Hd=new RegExp(`^hsl\\(${lr},${_n},${_n}\\)$`),Wd=new RegExp(`^hsla\\(${lr},${_n},${_n},${lr}\\)$`),Df={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};Aa(sr,Vn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ff,formatHex:Ff,formatHex8:Xd,formatHsl:jd,formatRgb:zf,toString:zf});function Ff(){return this.rgb().formatHex()}function Xd(){return this.rgb().formatHex8()}function jd(){return Gf(this).formatHsl()}function zf(){return this.rgb().formatRgb()}function Vn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Gd.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Rf(e):n===3?new Zt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Jr(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Jr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Bd.exec(t))?new Zt(e[1],e[2],e[3],1):(e=Ud.exec(t))?new Zt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Vd.exec(t))?Jr(e[1],e[2],e[3],e[4]):(e=$d.exec(t))?Jr(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Hd.exec(t))?Nf(e[1],e[2]/100,e[3]/100,1):(e=Wd.exec(t))?Nf(e[1],e[2]/100,e[3]/100,e[4]):Df.hasOwnProperty(t)?Rf(Df[t]):t==="transparent"?new Zt(NaN,NaN,NaN,0):null}function Rf(t){return new Zt(t>>16&255,t>>8&255,t&255,1)}function Jr(t,e,n,i){return i<=0&&(t=e=n=NaN),new Zt(t,e,n,i)}function qd(t){return t instanceof sr||(t=Vn(t)),t?(t=t.rgb(),new Zt(t.r,t.g,t.b,t.opacity)):new Zt}function Ea(t,e,n,i){return arguments.length===1?qd(t):new Zt(t,e,n,i??1)}function Zt(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}Aa(Zt,Ea,Lf(sr,{brighter(t){return t=t==null?Kr:Math.pow(Kr,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?fr:Math.pow(fr,t),new Zt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zt(ii(this.r),ii(this.g),ii(this.b),eo(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:Mf,formatHex:Mf,formatHex8:Yd,formatRgb:Of,toString:Of}));function Mf(){return`#${ri(this.r)}${ri(this.g)}${ri(this.b)}`}function Yd(){return`#${ri(this.r)}${ri(this.g)}${ri(this.b)}${ri((isNaN(this.opacity)?1:this.opacity)*255)}`}function Of(){const t=eo(this.opacity);return`${t===1?"rgb(":"rgba("}${ii(this.r)}, ${ii(this.g)}, ${ii(this.b)}${t===1?")":`, ${t})`}`}function eo(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ii(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ri(t){return t=ii(t),(t<16?"0":"")+t.toString(16)}function Nf(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new hn(t,e,n,i)}function Gf(t){if(t instanceof hn)return new hn(t.h,t.s,t.l,t.opacity);if(t instanceof sr||(t=Vn(t)),!t)return new hn;if(t instanceof hn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=NaN,f=o-r,l=(o+r)/2;return f?(e===o?s=(n-i)/f+(n<i)*6:n===o?s=(i-e)/f+2:s=(e-n)/f+4,f/=l<.5?o+r:2-o-r,s*=60):f=l>0&&l<1?0:s,new hn(s,f,l,t.opacity)}function Zd(t,e,n,i){return arguments.length===1?Gf(t):new hn(t,e,n,i??1)}function hn(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}Aa(hn,Zd,Lf(sr,{brighter(t){return t=t==null?Kr:Math.pow(Kr,t),new hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?fr:Math.pow(fr,t),new hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Zt(Ca(t>=240?t-240:t+120,r,i),Ca(t,r,i),Ca(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new hn(Bf(this.h),to(this.s),to(this.l),eo(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 t=eo(this.opacity);return`${t===1?"hsl(":"hsla("}${Bf(this.h)}, ${to(this.s)*100}%, ${to(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Bf(t){return t=(t||0)%360,t<0?t+360:t}function to(t){return Math.max(0,Math.min(1,t||0))}function Ca(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Pa=t=>()=>t;function Qd(t,e){return function(n){return t+n*e}}function Kd(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function Jd(t){return(t=+t)==1?Uf:function(e,n){return n-e?Kd(e,n,t):Pa(isNaN(e)?n:e)}}function Uf(t,e){var n=e-t;return n?Qd(t,n):Pa(isNaN(t)?e:t)}const no=function t(e){var n=Jd(e);function i(r,o){var s=n((r=Ea(r)).r,(o=Ea(o)).r),f=n(r.g,o.g),l=n(r.b,o.b),u=Uf(r.opacity,o.opacity);return function(d){return r.r=s(d),r.g=f(d),r.b=l(d),r.opacity=u(d),r+""}}return i.gamma=t,i}(1);function em(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(o){for(r=0;r<n;++r)i[r]=t[r]*(1-o)+e[r]*o;return i}}function tm(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function nm(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),o=new Array(n),s;for(s=0;s<i;++s)r[s]=La(t[s],e[s]);for(;s<n;++s)o[s]=e[s];return function(f){for(s=0;s<i;++s)o[s]=r[s](f);return o}}function im(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function dn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function rm(t,e){var n={},i={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?n[r]=La(t[r],e[r]):i[r]=e[r];return function(o){for(r in n)i[r]=n[r](o);return i}}var ka=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ia=new RegExp(ka.source,"g");function om(t){return function(){return t}}function am(t){return function(e){return t(e)+""}}function Vf(t,e){var n=ka.lastIndex=Ia.lastIndex=0,i,r,o,s=-1,f=[],l=[];for(t=t+"",e=e+"";(i=ka.exec(t))&&(r=Ia.exec(e));)(o=r.index)>n&&(o=e.slice(n,o),f[s]?f[s]+=o:f[++s]=o),(i=i[0])===(r=r[0])?f[s]?f[s]+=r:f[++s]=r:(f[++s]=null,l.push({i:s,x:dn(i,r)})),n=Ia.lastIndex;return n<e.length&&(o=e.slice(n),f[s]?f[s]+=o:f[++s]=o),f.length<2?l[0]?am(l[0].x):om(e):(e=l.length,function(u){for(var d=0,y;d<e;++d)f[(y=l[d]).i]=y.x(u);return f.join("")})}function La(t,e){var n=typeof e,i;return e==null||n==="boolean"?Pa(e):(n==="number"?dn:n==="string"?(i=Vn(e))?(e=i,no):Vf:e instanceof Vn?no:e instanceof Date?im:tm(e)?em:Array.isArray(e)?nm:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?rm:dn)(t,e)}function sm(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var $f=180/Math.PI,Da={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Hf(t,e,n,i,r,o){var s,f,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(f=Math.sqrt(n*n+i*i))&&(n/=f,i/=f,l/=f),t*i<e*n&&(t=-t,e=-e,l=-l,s=-s),{translateX:r,translateY:o,rotate:Math.atan2(e,t)*$f,skewX:Math.atan(l)*$f,scaleX:s,scaleY:f}}var io;function fm(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Da:Hf(e.a,e.b,e.c,e.d,e.e,e.f)}function lm(t){return t==null||(io||(io=document.createElementNS("http://www.w3.org/2000/svg","g")),io.setAttribute("transform",t),!(t=io.transform.baseVal.consolidate()))?Da:(t=t.matrix,Hf(t.a,t.b,t.c,t.d,t.e,t.f))}function Wf(t,e,n,i){function r(u){return u.length?u.pop()+" ":""}function o(u,d,y,S,D,q){if(u!==y||d!==S){var Te=D.push("translate(",null,e,null,n);q.push({i:Te-4,x:dn(u,y)},{i:Te-2,x:dn(d,S)})}else(y||S)&&D.push("translate("+y+e+S+n)}function s(u,d,y,S){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),S.push({i:y.push(r(y)+"rotate(",null,i)-2,x:dn(u,d)})):d&&y.push(r(y)+"rotate("+d+i)}function f(u,d,y,S){u!==d?S.push({i:y.push(r(y)+"skewX(",null,i)-2,x:dn(u,d)}):d&&y.push(r(y)+"skewX("+d+i)}function l(u,d,y,S,D,q){if(u!==y||d!==S){var Te=D.push(r(D)+"scale(",null,",",null,")");q.push({i:Te-4,x:dn(u,y)},{i:Te-2,x:dn(d,S)})}else(y!==1||S!==1)&&D.push(r(D)+"scale("+y+","+S+")")}return function(u,d){var y=[],S=[];return u=t(u),d=t(d),o(u.translateX,u.translateY,d.translateX,d.translateY,y,S),s(u.rotate,d.rotate,y,S),f(u.skewX,d.skewX,y,S),l(u.scaleX,u.scaleY,d.scaleX,d.scaleY,y,S),u=d=null,function(D){for(var q=-1,Te=S.length,we;++q<Te;)y[(we=S[q]).i]=we.x(D);return y.join("")}}}var um=Wf(fm,"px, ","px)","deg)"),cm=Wf(lm,", ",")",")"),hm=1e-12;function Xf(t){return((t=Math.exp(t))+1/t)/2}function dm(t){return((t=Math.exp(t))-1/t)/2}function mm(t){return((t=Math.exp(2*t))-1)/(t+1)}const pm=function t(e,n,i){function r(o,s){var f=o[0],l=o[1],u=o[2],d=s[0],y=s[1],S=s[2],D=d-f,q=y-l,Te=D*D+q*q,we,fe;if(Te<hm)fe=Math.log(S/u)/e,we=function(Be){return[f+Be*D,l+Be*q,u*Math.exp(e*Be*fe)]};else{var Ne=Math.sqrt(Te),Ve=(S*S-u*u+i*Te)/(2*u*n*Ne),V=(S*S-u*u-i*Te)/(2*S*n*Ne),ae=Math.log(Math.sqrt(Ve*Ve+1)-Ve),Ie=Math.log(Math.sqrt(V*V+1)-V);fe=(Ie-ae)/e,we=function(Be){var Xe=Be*fe,nt=Xf(ae),lt=u/(n*Ne)*(nt*mm(e*Xe+ae)-dm(ae));return[f+lt*D,l+lt*q,u*nt/Xf(e*Xe+ae)]}}return we.duration=fe*1e3*e/Math.SQRT2,we}return r.rho=function(o){var s=Math.max(.001,+o),f=s*s,l=f*f;return t(s,f,l)},r}(Math.SQRT2,2,4);function vm(t,e){var n,i;return function(){var r=bn(this,t),o=r.tween;if(o!==n){i=n=o;for(var s=0,f=i.length;s<f;++s)if(i[s].name===e){i=i.slice(),i.splice(s,1);break}}r.tween=i}}function gm(t,e,n){var i,r;if(typeof n!="function")throw new Error;return function(){var o=bn(this,t),s=o.tween;if(s!==i){r=(i=s).slice();for(var f={name:e,value:n},l=0,u=r.length;l<u;++l)if(r[l].name===e){r[l]=f;break}l===u&&r.push(f)}o.tween=r}}function ym(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=cn(this.node(),n).tween,r=0,o=i.length,s;r<o;++r)if((s=i[r]).name===t)return s.value;return null}return this.each((e==null?vm:gm)(n,t,e))}function Fa(t,e,n){var i=t._id;return t.each(function(){var r=bn(this,i);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return cn(r,i).value[e]}}function jf(t,e){var n;return(typeof e=="number"?dn:e instanceof Vn?no:(n=Vn(e))?(e=n,no):Vf)(t,e)}function xm(t){return function(){this.removeAttribute(t)}}function bm(t){return function(){this.removeAttributeNS(t.space,t.local)}}function _m(t,e,n){var i,r=n+"",o;return function(){var s=this.getAttribute(t);return s===r?null:s===i?o:o=e(i=s,n)}}function Sm(t,e,n){var i,r=n+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===i?o:o=e(i=s,n)}}function Tm(t,e,n){var i,r,o;return function(){var s,f=n(this),l;return f==null?void this.removeAttribute(t):(s=this.getAttribute(t),l=f+"",s===l?null:s===i&&l===r?o:(r=l,o=e(i=s,f)))}}function wm(t,e,n){var i,r,o;return function(){var s,f=n(this),l;return f==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),l=f+"",s===l?null:s===i&&l===r?o:(r=l,o=e(i=s,f)))}}function Am(t,e){var n=Br(t),i=n==="transform"?cm:jf;return this.attrTween(t,typeof e=="function"?(n.local?wm:Tm)(n,i,Fa(this,"attr."+t,e)):e==null?(n.local?bm:xm)(n):(n.local?Sm:_m)(n,i,e))}function Em(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Cm(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Pm(t,e){var n,i;function r(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&Cm(t,o)),n}return r._value=e,r}function km(t,e){var n,i;function r(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&Em(t,o)),n}return r._value=e,r}function Im(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=Br(t);return this.tween(n,(i.local?Pm:km)(i,e))}function Lm(t,e){return function(){wa(this,t).delay=+e.apply(this,arguments)}}function Dm(t,e){return e=+e,function(){wa(this,t).delay=e}}function Fm(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Lm:Dm)(e,t)):cn(this.node(),e).delay}function zm(t,e){return function(){bn(this,t).duration=+e.apply(this,arguments)}}function Rm(t,e){return e=+e,function(){bn(this,t).duration=e}}function Mm(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?zm:Rm)(e,t)):cn(this.node(),e).duration}function Om(t,e){if(typeof e!="function")throw new Error;return function(){bn(this,t).ease=e}}function Nm(t){var e=this._id;return arguments.length?this.each(Om(e,t)):cn(this.node(),e).ease}function Gm(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;bn(this,t).ease=n}}function Bm(t){if(typeof t!="function")throw new Error;return this.each(Gm(this._id,t))}function Um(t){typeof t!="function"&&(t=hf(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],s=o.length,f=i[r]=[],l,u=0;u<s;++u)(l=o[u])&&t.call(l,l.__data__,u,o)&&f.push(l);return new In(i,this._parents,this._name,this._id)}function Vm(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),s=new Array(i),f=0;f<o;++f)for(var l=e[f],u=n[f],d=l.length,y=s[f]=new Array(d),S,D=0;D<d;++D)(S=l[D]||u[D])&&(y[D]=S);for(;f<i;++f)s[f]=e[f];return new In(s,this._parents,this._name,this._id)}function $m(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Hm(t,e,n){var i,r,o=$m(e)?wa:bn;return function(){var s=o(this,t),f=s.on;f!==i&&(r=(i=f).copy()).on(e,n),s.on=r}}function Wm(t,e){var n=this._id;return arguments.length<2?cn(this.node(),n).on.on(t):this.each(Hm(n,t,e))}function Xm(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function jm(){return this.on("end.remove",Xm(this._id))}function qm(t){var e=this._name,n=this._id;typeof t!="function"&&(t=ya(t));for(var i=this._groups,r=i.length,o=new Array(r),s=0;s<r;++s)for(var f=i[s],l=f.length,u=o[s]=new Array(l),d,y,S=0;S<l;++S)(d=f[S])&&(y=t.call(d,d.__data__,S,f))&&("__data__"in d&&(y.__data__=d.__data__),u[S]=y,Zr(u[S],e,n,S,u,cn(d,n)));return new In(o,this._parents,e,n)}function Ym(t){var e=this._name,n=this._id;typeof t!="function"&&(t=cf(t));for(var i=this._groups,r=i.length,o=[],s=[],f=0;f<r;++f)for(var l=i[f],u=l.length,d,y=0;y<u;++y)if(d=l[y]){for(var S=t.call(d,d.__data__,y,l),D,q=cn(d,n),Te=0,we=S.length;Te<we;++Te)(D=S[Te])&&Zr(D,e,n,Te,S,q);o.push(S),s.push(d)}return new In(o,s,e,n)}var Zm=nr.prototype.constructor;function Qm(){return new Zm(this._groups,this._parents)}function Km(t,e){var n,i,r;return function(){var o=Pi(this,t),s=(this.style.removeProperty(t),Pi(this,t));return o===s?null:o===n&&s===i?r:r=e(n=o,i=s)}}function qf(t){return function(){this.style.removeProperty(t)}}function Jm(t,e,n){var i,r=n+"",o;return function(){var s=Pi(this,t);return s===r?null:s===i?o:o=e(i=s,n)}}function ep(t,e,n){var i,r,o;return function(){var s=Pi(this,t),f=n(this),l=f+"";return f==null&&(l=f=(this.style.removeProperty(t),Pi(this,t))),s===l?null:s===i&&l===r?o:(r=l,o=e(i=s,f))}}function tp(t,e){var n,i,r,o="style."+e,s="end."+o,f;return function(){var l=bn(this,t),u=l.on,d=l.value[o]==null?f||(f=qf(e)):void 0;(u!==n||r!==d)&&(i=(n=u).copy()).on(s,r=d),l.on=i}}function np(t,e,n){var i=(t+="")=="transform"?um:jf;return e==null?this.styleTween(t,Km(t,i)).on("end.style."+t,qf(t)):typeof e=="function"?this.styleTween(t,ep(t,i,Fa(this,"style."+t,e))).each(tp(this._id,t)):this.styleTween(t,Jm(t,i,e),n).on("end.style."+t,null)}function ip(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function rp(t,e,n){var i,r;function o(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&ip(t,s,n)),i}return o._value=e,o}function op(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,rp(t,e,n??""))}function ap(t){return function(){this.textContent=t}}function sp(t){return function(){var e=t(this);this.textContent=e??""}}function fp(t){return this.tween("text",typeof t=="function"?sp(Fa(this,"text",t)):ap(t==null?"":t+""))}function lp(t){return function(e){this.textContent=t.call(this,e)}}function up(t){var e,n;function i(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&lp(r)),e}return i._value=t,i}function cp(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,up(t))}function hp(){for(var t=this._name,e=this._id,n=Yf(),i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],f=s.length,l,u=0;u<f;++u)if(l=s[u]){var d=cn(l,e);Zr(l,t,n,u,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new In(i,this._parents,t,n)}function dp(){var t,e,n=this,i=n._id,r=n.size();return new Promise(function(o,s){var f={value:s},l={value:function(){--r===0&&o()}};n.each(function(){var u=bn(this,i),d=u.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(f),e._.interrupt.push(f),e._.end.push(l)),u.on=e}),r===0&&o()})}var mp=0;function In(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Yf(){return++mp}var Ln=nr.prototype;In.prototype={constructor:In,select:qm,selectAll:Ym,selectChild:Ln.selectChild,selectChildren:Ln.selectChildren,filter:Um,merge:Vm,selection:Qm,transition:hp,call:Ln.call,nodes:Ln.nodes,node:Ln.node,size:Ln.size,empty:Ln.empty,each:Ln.each,on:Wm,attr:Am,attrTween:Im,style:np,styleTween:op,text:fp,textTween:cp,remove:jm,tween:ym,delay:Fm,duration:Mm,ease:Nm,easeVarying:Bm,end:dp,[Symbol.iterator]:Ln[Symbol.iterator]};function pp(t){return t*t}function vp(t){return t*(2-t)}function gp(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function yp(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var xp={time:null,delay:0,duration:250,ease:yp};function bp(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function _p(t){var e,n;t instanceof In?(e=t._id,t=t._name):(e=Yf(),(n=xp).time=ba(),t=t==null?null:t+"");for(var i=this._groups,r=i.length,o=0;o<r;++o)for(var s=i[o],f=s.length,l,u=0;u<f;++u)(l=s[u])&&Zr(l,t,e,u,s,n||bp(l,e));return new In(i,this._parents,t,e)}nr.prototype.interrupt=Nd,nr.prototype.transition=_p;function za(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Sp(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),n}var ro={exports:{}},Tp=ro.exports,Zf;function wp(){return Zf||(Zf=1,function(t,e){(function(n,i){t.exports=i()})(Tp,function(){var n=function(a){return a instanceof Uint8Array||a instanceof Uint16Array||a instanceof Uint32Array||a instanceof Int8Array||a instanceof Int16Array||a instanceof Int32Array||a instanceof Float32Array||a instanceof Float64Array||a instanceof Uint8ClampedArray},i=function(a,h){for(var _=Object.keys(h),M=0;M<_.length;++M)a[_[M]]=h[_[M]];return a},r=`
|
|
2
|
+
`;function o(a){return typeof atob<"u"?atob(a):"base64:"+a}function s(a){var h=new Error("(regl) "+a);throw console.error(h),h}function f(a,h){a||s(h)}function l(a){return a?": "+a:""}function u(a,h,_){a in h||s("unknown parameter ("+a+")"+l(_)+". possible values: "+Object.keys(h).join())}function d(a,h){n(a)||s("invalid parameter type"+l(h)+". must be a typed array")}function y(a,h){switch(h){case"number":return typeof a=="number";case"object":return typeof a=="object";case"string":return typeof a=="string";case"boolean":return typeof a=="boolean";case"function":return typeof a=="function";case"undefined":return typeof a>"u";case"symbol":return typeof a=="symbol"}}function S(a,h,_){y(a,h)||s("invalid parameter type"+l(_)+". expected "+h+", got "+typeof a)}function D(a,h){a>=0&&(a|0)===a||s("invalid parameter type, ("+a+")"+l(h)+". must be a nonnegative integer")}function q(a,h,_){h.indexOf(a)<0&&s("invalid value"+l(_)+". must be one of: "+h)}var Te=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function we(a){Object.keys(a).forEach(function(h){Te.indexOf(h)<0&&s('invalid regl constructor argument "'+h+'". must be one of '+Te)})}function fe(a,h){for(a=a+"";a.length<h;)a=" "+a;return a}function Ne(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function Ve(a,h){this.number=a,this.line=h,this.errors=[]}function V(a,h,_){this.file=a,this.line=h,this.message=_}function ae(){var a=new Error,h=(a.stack||a).toString(),_=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(h);if(_)return _[1];var M=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(h);return M?M[1]:"unknown"}function Ie(){var a=new Error,h=(a.stack||a).toString(),_=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(h);if(_)return _[1];var M=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(h);return M?M[1]:"unknown"}function Be(a,h){var _=a.split(`
|
|
3
|
+
`),M=1,W=0,R={unknown:new Ne,0:new Ne};R.unknown.name=R[0].name=h||ae(),R.unknown.lines.push(new Ve(0,""));for(var B=0;B<_.length;++B){var K=_[B],Q=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(K);if(Q)switch(Q[1]){case"line":var ie=/(\d+)(\s+\d+)?/.exec(Q[2]);ie&&(M=ie[1]|0,ie[2]&&(W=ie[2]|0,W in R||(R[W]=new Ne)));break;case"define":var oe=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Q[2]);oe&&(R[W].name=oe[1]?o(oe[2]):oe[2]);break}R[W].lines.push(new Ve(M++,K))}return Object.keys(R).forEach(function(re){var ue=R[re];ue.lines.forEach(function(J){ue.index[J.number]=J})}),R}function Xe(a){var h=[];return a.split(`
|
|
4
|
+
`).forEach(function(_){if(!(_.length<5)){var M=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(_);M?h.push(new V(M[1]|0,M[2]|0,M[3].trim())):_.length>0&&h.push(new V("unknown",0,_))}}),h}function nt(a,h){h.forEach(function(_){var M=a[_.file];if(M){var W=M.index[_.line];if(W){W.errors.push(_),M.hasErrors=!0;return}}a.unknown.hasErrors=!0,a.unknown.lines[0].errors.push(_)})}function lt(a,h,_,M,W){if(!a.getShaderParameter(h,a.COMPILE_STATUS)){var R=a.getShaderInfoLog(h),B=M===a.FRAGMENT_SHADER?"fragment":"vertex";De(_,"string",B+" shader source must be a string",W);var K=Be(_,W),Q=Xe(R);nt(K,Q),Object.keys(K).forEach(function(ie){var oe=K[ie];if(!oe.hasErrors)return;var re=[""],ue=[""];function J(ne,k){re.push(ne),ue.push(k||"")}J("file number "+ie+": "+oe.name+`
|
|
5
|
+
`,"color:red;text-decoration:underline;font-weight:bold"),oe.lines.forEach(function(ne){if(ne.errors.length>0){J(fe(ne.number,4)+"| ","background-color:yellow; font-weight:bold"),J(ne.line+r,"color:red; background-color:yellow; font-weight:bold");var k=0;ne.errors.forEach(function(N){var te=N.message,xe=/^\s*'(.*)'\s*:\s*(.*)$/.exec(te);if(xe){var Z=xe[1];switch(te=xe[2],Z){case"assign":Z="=";break}k=Math.max(ne.line.indexOf(Z,k),0)}else k=0;J(fe("| ",6)),J(fe("^^^",k+3)+r,"font-weight:bold"),J(fe("| ",6)),J(te+r,"font-weight:bold")}),J(fe("| ",6)+r)}else J(fe(ne.number,4)+"| "),J(ne.line+r,"color:red")}),typeof document<"u"&&!window.chrome?(ue[0]=re.join("%c"),console.log.apply(console,ue)):console.log(re.join(""))}),f.raise("Error compiling "+B+" shader, "+K[0].name)}}function Ee(a,h,_,M,W){if(!a.getProgramParameter(h,a.LINK_STATUS)){var R=a.getProgramInfoLog(h),B=Be(_,W),K=Be(M,W),Q='Error linking program with vertex shader, "'+K[0].name+'", and fragment shader "'+B[0].name+'"';typeof document<"u"?console.log("%c"+Q+r+"%c"+R,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Q+r+R),f.raise(Q)}}function ct(a){a._commandRef=ae()}function ft(a,h,_,M){ct(a);function W(Q){return Q?M.id(Q):0}a._fragId=W(a.static.frag),a._vertId=W(a.static.vert);function R(Q,ie){Object.keys(ie).forEach(function(oe){Q[M.id(oe)]=!0})}var B=a._uniformSet={};R(B,h.static),R(B,h.dynamic);var K=a._attributeSet={};R(K,_.static),R(K,_.dynamic),a._hasCount="count"in a.static||"count"in a.dynamic||"elements"in a.static||"elements"in a.dynamic}function G(a,h){var _=Ie();s(a+" in command "+(h||ae())+(_==="unknown"?"":" called from "+_))}function Pe(a,h,_){a||G(h,_||ae())}function se(a,h,_,M){a in h||G("unknown parameter ("+a+")"+l(_)+". possible values: "+Object.keys(h).join(),M||ae())}function De(a,h,_,M){y(a,h)||G("invalid parameter type"+l(_)+". expected "+h+", got "+typeof a,M||ae())}function qe(a){a()}function je(a,h,_){a.texture?q(a.texture._texture.internalformat,h,"unsupported texture format for attachment"):q(a.renderbuffer._renderbuffer.format,_,"unsupported renderbuffer format for attachment")}var Qe=33071,Ze=9728,dt=9984,ut=9985,_t=9986,at=9987,$t=5120,Ht=5121,Kt=5122,Mn=5123,wo=5124,Ao=5125,On=5126,si=32819,Tn=32820,Fi=33635,zi=34042,$n=36193,Mt={};Mt[$t]=Mt[Ht]=1,Mt[Kt]=Mt[Mn]=Mt[$n]=Mt[Fi]=Mt[si]=Mt[Tn]=2,Mt[wo]=Mt[Ao]=Mt[On]=Mt[zi]=4;function fi(a,h){return a===Tn||a===si||a===Fi?2:a===zi?4:Mt[a]*h}function li(a){return!(a&a-1)&&!!a}function Eo(a,h,_){var M,W=h.width,R=h.height,B=h.channels;f(W>0&&W<=_.maxTextureSize&&R>0&&R<=_.maxTextureSize,"invalid texture shape"),(a.wrapS!==Qe||a.wrapT!==Qe)&&f(li(W)&&li(R),"incompatible wrap mode for texture, both width and height must be power of 2"),h.mipmask===1?W!==1&&R!==1&&f(a.minFilter!==dt&&a.minFilter!==_t&&a.minFilter!==ut&&a.minFilter!==at,"min filter requires mipmap"):(f(li(W)&&li(R),"texture must be a square power of 2 to support mipmapping"),f(h.mipmask===(W<<1)-1,"missing or incomplete mipmap data")),h.type===On&&(_.extensions.indexOf("oes_texture_float_linear")<0&&f(a.minFilter===Ze&&a.magFilter===Ze,"filter not supported, must enable oes_texture_float_linear"),f(!a.genMipmaps,"mipmap generation not supported with float textures"));var K=h.images;for(M=0;M<16;++M)if(K[M]){var Q=W>>M,ie=R>>M;f(h.mipmask&1<<M,"missing mipmap data");var oe=K[M];if(f(oe.width===Q&&oe.height===ie,"invalid shape for mip images"),f(oe.format===h.format&&oe.internalformat===h.internalformat&&oe.type===h.type,"incompatible type for mip image"),!oe.compressed)if(oe.data){var re=Math.ceil(fi(oe.type,B)*Q/oe.unpackAlignment)*oe.unpackAlignment;f(oe.data.byteLength===re*ie,"invalid data for image, buffer size is inconsistent with image format")}else oe.element||oe.copy}else a.genMipmaps||f((h.mipmask&1<<M)===0,"extra mipmap data");h.compressed&&f(!a.genMipmaps,"mipmap generation for compressed images not supported")}function ss(a,h,_,M){var W=a.width,R=a.height,B=a.channels;f(W>0&&W<=M.maxTextureSize&&R>0&&R<=M.maxTextureSize,"invalid texture shape"),f(W===R,"cube map must be square"),f(h.wrapS===Qe&&h.wrapT===Qe,"wrap mode not supported by cube map");for(var K=0;K<_.length;++K){var Q=_[K];f(Q.width===W&&Q.height===R,"inconsistent cube map face shape"),h.genMipmaps&&(f(!Q.compressed,"can not generate mipmap for compressed textures"),f(Q.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var ie=Q.images,oe=0;oe<16;++oe){var re=ie[oe];if(re){var ue=W>>oe,J=R>>oe;f(Q.mipmask&1<<oe,"missing mipmap data"),f(re.width===ue&&re.height===J,"invalid shape for mip images"),f(re.format===a.format&&re.internalformat===a.internalformat&&re.type===a.type,"incompatible type for mip image"),re.compressed||(re.data?f(re.data.byteLength===ue*J*Math.max(fi(re.type,B),re.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):re.element||re.copy)}}}}var m=i(f,{optional:qe,raise:s,commandRaise:G,command:Pe,parameter:u,commandParameter:se,constructor:we,type:S,commandType:De,isTypedArray:d,nni:D,oneOf:q,shaderError:lt,linkError:Ee,callSite:Ie,saveCommandRef:ct,saveDrawInfo:ft,framebufferFormat:je,guessCommand:ae,texture2D:Eo,textureCube:ss}),ui=0,Hn=0,Wn=5,Co=6;function wn(a,h){this.id=ui++,this.type=a,this.data=h}function yr(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Nn(a){if(a.length===0)return[];var h=a.charAt(0),_=a.charAt(a.length-1);if(a.length>1&&h===_&&(h==='"'||h==="'"))return['"'+yr(a.substr(1,a.length-2))+'"'];var M=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(a);if(M)return Nn(a.substr(0,M.index)).concat(Nn(M[1])).concat(Nn(a.substr(M.index+M[0].length)));var W=a.split(".");if(W.length===1)return['"'+yr(a)+'"'];for(var R=[],B=0;B<W.length;++B)R=R.concat(Nn(W[B]));return R}function xr(a){return"["+Nn(a).join("][")+"]"}function Ri(a,h){return new wn(a,xr(h+""))}function Mi(a){return typeof a=="function"&&!a._reglType||a instanceof wn}function sn(a,h){if(typeof a=="function")return new wn(Hn,a);if(typeof a=="number"||typeof a=="boolean")return new wn(Wn,a);if(Array.isArray(a))return new wn(Co,a.map(function(_,M){return sn(_,h+"["+M+"]")}));if(a instanceof wn)return a;m(!1,"invalid option type in uniform "+h)}var It={DynamicVariable:wn,define:Ri,isDynamic:Mi,unbox:sn,accessor:xr},ci={next:typeof requestAnimationFrame=="function"?function(a){return requestAnimationFrame(a)}:function(a){return setTimeout(a,16)},cancel:typeof cancelAnimationFrame=="function"?function(a){return cancelAnimationFrame(a)}:clearTimeout},Oi=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function fs(){var a={"":0},h=[""];return{id:function(_){var M=a[_];return M||(M=a[_]=h.length,h.push(_),M)},str:function(_){return h[_]}}}function Ni(a,h,_){var M=document.createElement("canvas");i(M.style,{border:0,margin:0,padding:0,top:0,left:0,width:"100%",height:"100%"}),a.appendChild(M),a===document.body&&(M.style.position="absolute",i(a.style,{margin:0,padding:0}));function W(){var K=window.innerWidth,Q=window.innerHeight;if(a!==document.body){var ie=M.getBoundingClientRect();K=ie.right-ie.left,Q=ie.bottom-ie.top}M.width=_*K,M.height=_*Q}var R;a!==document.body&&typeof ResizeObserver=="function"?(R=new ResizeObserver(function(){setTimeout(W)}),R.observe(a)):window.addEventListener("resize",W,!1);function B(){R?R.disconnect():window.removeEventListener("resize",W),a.removeChild(M)}return W(),{canvas:M,onDestroy:B}}function Gi(a,h){function _(M){try{return a.getContext(M,h)}catch{return null}}return _("webgl")||_("experimental-webgl")||_("webgl-experimental")}function ls(a){return typeof a.nodeName=="string"&&typeof a.appendChild=="function"&&typeof a.getBoundingClientRect=="function"}function hi(a){return typeof a.drawArrays=="function"||typeof a.drawElements=="function"}function Po(a){return typeof a=="string"?a.split():(m(Array.isArray(a),"invalid extension array"),a)}function ko(a){return typeof a=="string"?(m(typeof document<"u","not supported outside of DOM"),document.querySelector(a)):a}function Lt(a){var h=a||{},_,M,W,R,B={},K=[],Q=[],ie=typeof window>"u"?1:window.devicePixelRatio,oe=!1,re=function(ne){ne&&m.raise(ne)},ue=function(){};if(typeof h=="string"?(m(typeof document<"u","selector queries only supported in DOM enviroments"),_=document.querySelector(h),m(_,"invalid query string for element")):typeof h=="object"?ls(h)?_=h:hi(h)?(R=h,W=R.canvas):(m.constructor(h),"gl"in h?R=h.gl:"canvas"in h?W=ko(h.canvas):"container"in h&&(M=ko(h.container)),"attributes"in h&&(B=h.attributes,m.type(B,"object","invalid context attributes")),"extensions"in h&&(K=Po(h.extensions)),"optionalExtensions"in h&&(Q=Po(h.optionalExtensions)),"onDone"in h&&(m.type(h.onDone,"function","invalid or missing onDone callback"),re=h.onDone),"profile"in h&&(oe=!!h.profile),"pixelRatio"in h&&(ie=+h.pixelRatio,m(ie>0,"invalid pixel ratio"))):m.raise("invalid arguments to regl"),_&&(_.nodeName.toLowerCase()==="canvas"?W=_:M=_),!R){if(!W){m(typeof document<"u","must manually specify webgl context outside of DOM environments");var J=Ni(M||document.body,re,ie);if(!J)return null;W=J.canvas,ue=J.onDestroy}B.premultipliedAlpha===void 0&&(B.premultipliedAlpha=!0),R=Gi(W,B)}return R?{gl:R,canvas:W,container:M,extensions:K,optionalExtensions:Q,pixelRatio:ie,profile:oe,onDone:re,onDestroy:ue}:(ue(),re("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Xn(a,h){var _={};function M(B){m.type(B,"string","extension name must be string");var K=B.toLowerCase(),Q;try{Q=_[K]=a.getExtension(K)}catch{}return!!Q}for(var W=0;W<h.extensions.length;++W){var R=h.extensions[W];if(!M(R))return h.onDestroy(),h.onDone('"'+R+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return h.optionalExtensions.forEach(M),{extensions:_,restore:function(){Object.keys(_).forEach(function(B){if(_[B]&&!M(B))throw new Error("(regl): error restoring extension "+B)})}}}function Yt(a,h){for(var _=Array(a),M=0;M<a;++M)_[M]=h(M);return _}var Io=5120,br=5121,Lo=5122,Do=5123,us=5124,fn=5125,jn=5126;function Fo(a){for(var h=16;h<=1<<28;h*=16)if(a<=h)return h;return 0}function _r(a){var h,_;return h=(a>65535)<<4,a>>>=h,_=(a>255)<<3,a>>>=_,h|=_,_=(a>15)<<2,a>>>=_,h|=_,_=(a>3)<<1,a>>>=_,h|=_,h|a>>1}function Bi(){var a=Yt(8,function(){return[]});function h(R){var B=Fo(R),K=a[_r(B)>>2];return K.length>0?K.pop():new ArrayBuffer(B)}function _(R){a[_r(R.byteLength)>>2].push(R)}function M(R,B){var K=null;switch(R){case Io:K=new Int8Array(h(B),0,B);break;case br:K=new Uint8Array(h(B),0,B);break;case Lo:K=new Int16Array(h(2*B),0,B);break;case Do:K=new Uint16Array(h(2*B),0,B);break;case us:K=new Int32Array(h(4*B),0,B);break;case fn:K=new Uint32Array(h(4*B),0,B);break;case jn:K=new Float32Array(h(4*B),0,B);break;default:return null}return K.length!==B?K.subarray(0,B):K}function W(R){_(R.buffer)}return{alloc:h,free:_,allocType:M,freeType:W}}var gt=Bi();gt.zero=Bi();var vn=3408,zo=3410,Ro=3411,Mo=3412,Oo=3413,cs=3414,$e=3415,P=33901,ve=33902,ze=3379,mt=3386,Ot=34921,At=36347,Wt=36348,gn=35661,di=35660,Sr=34930,Nt=36349,No=34076,Go=34024,Dg=7936,Fg=7937,zg=7938,Rg=35724,Mg=34047,Og=36063,Ng=34852,Bo=3553,ou=34067,Gg=34069,Bg=33984,Tr=6408,hs=5126,au=5121,ds=36160,Ug=36053,Vg=36064,$g=16384,Hg=function(a,h){var _=1;h.ext_texture_filter_anisotropic&&(_=a.getParameter(Mg));var M=1,W=1;h.webgl_draw_buffers&&(M=a.getParameter(Ng),W=a.getParameter(Og));var R=!!h.oes_texture_float;if(R){var B=a.createTexture();a.bindTexture(Bo,B),a.texImage2D(Bo,0,Tr,1,1,0,Tr,hs,null);var K=a.createFramebuffer();if(a.bindFramebuffer(ds,K),a.framebufferTexture2D(ds,Vg,Bo,B,0),a.bindTexture(Bo,null),a.checkFramebufferStatus(ds)!==Ug)R=!1;else{a.viewport(0,0,1,1),a.clearColor(1,0,0,1),a.clear($g);var Q=gt.allocType(hs,4);a.readPixels(0,0,1,1,Tr,hs,Q),a.getError()?R=!1:(a.deleteFramebuffer(K),a.deleteTexture(B),R=Q[0]===1),gt.freeType(Q)}}var ie=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),oe=!0;if(!ie){var re=a.createTexture(),ue=gt.allocType(au,36);a.activeTexture(Bg),a.bindTexture(ou,re),a.texImage2D(Gg,0,Tr,3,3,0,Tr,au,ue),gt.freeType(ue),a.bindTexture(ou,null),a.deleteTexture(re),oe=!a.getError()}return{colorBits:[a.getParameter(zo),a.getParameter(Ro),a.getParameter(Mo),a.getParameter(Oo)],depthBits:a.getParameter(cs),stencilBits:a.getParameter($e),subpixelBits:a.getParameter(vn),extensions:Object.keys(h).filter(function(J){return!!h[J]}),maxAnisotropic:_,maxDrawbuffers:M,maxColorAttachments:W,pointSizeDims:a.getParameter(P),lineWidthDims:a.getParameter(ve),maxViewportDims:a.getParameter(mt),maxCombinedTextureUnits:a.getParameter(gn),maxCubeMapSize:a.getParameter(No),maxRenderbufferSize:a.getParameter(Go),maxTextureUnits:a.getParameter(Sr),maxTextureSize:a.getParameter(ze),maxAttributes:a.getParameter(Ot),maxVertexUniforms:a.getParameter(At),maxVertexTextureUnits:a.getParameter(di),maxVaryingVectors:a.getParameter(Wt),maxFragmentUniforms:a.getParameter(Nt),glsl:a.getParameter(Rg),renderer:a.getParameter(Fg),vendor:a.getParameter(Dg),version:a.getParameter(zg),readFloat:R,npotTextureCube:oe}};function yn(a){return!!a&&typeof a=="object"&&Array.isArray(a.shape)&&Array.isArray(a.stride)&&typeof a.offset=="number"&&a.shape.length===a.stride.length&&(Array.isArray(a.data)||n(a.data))}var rn=function(a){return Object.keys(a).map(function(h){return a[h]})},Uo={shape:qg,flatten:jg};function Wg(a,h,_){for(var M=0;M<h;++M)_[M]=a[M]}function Xg(a,h,_,M){for(var W=0,R=0;R<h;++R)for(var B=a[R],K=0;K<_;++K)M[W++]=B[K]}function su(a,h,_,M,W,R){for(var B=R,K=0;K<h;++K)for(var Q=a[K],ie=0;ie<_;++ie)for(var oe=Q[ie],re=0;re<M;++re)W[B++]=oe[re]}function fu(a,h,_,M,W){for(var R=1,B=_+1;B<h.length;++B)R*=h[B];var K=h[_];if(h.length-_===4){var Q=h[_+1],ie=h[_+2],oe=h[_+3];for(B=0;B<K;++B)su(a[B],Q,ie,oe,M,W),W+=R}else for(B=0;B<K;++B)fu(a[B],h,_+1,M,W),W+=R}function jg(a,h,_,M){var W=1;if(h.length)for(var R=0;R<h.length;++R)W*=h[R];else W=0;var B=M||gt.allocType(_,W);switch(h.length){case 0:break;case 1:Wg(a,h[0],B);break;case 2:Xg(a,h[0],h[1],B);break;case 3:su(a,h[0],h[1],h[2],B,0);break;default:fu(a,h,0,B,0)}return B}function qg(a){for(var h=[],_=a;_.length;_=_[0])h.push(_.length);return h}var ms={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Yg=5120,Zg=5122,Qg=5124,Kg=5121,Jg=5123,ey=5125,ty=5126,ny=5126,mi={int8:Yg,int16:Zg,int32:Qg,uint8:Kg,uint16:Jg,uint32:ey,float:ty,float32:ny},iy=35048,ry=35040,Vo={dynamic:iy,stream:ry,static:35044},ps=Uo.flatten,lu=Uo.shape,uu=35044,oy=35040,vs=5121,gs=5126,qn=[];qn[5120]=1,qn[5122]=2,qn[5124]=4,qn[5121]=1,qn[5123]=2,qn[5125]=4,qn[5126]=4;function $o(a){return ms[Object.prototype.toString.call(a)]|0}function cu(a,h){for(var _=0;_<h.length;++_)a[_]=h[_]}function hu(a,h,_,M,W,R,B){for(var K=0,Q=0;Q<_;++Q)for(var ie=0;ie<M;++ie)a[K++]=h[W*Q+R*ie+B]}function ay(a,h,_,M){var W=0,R={};function B(k){this.id=W++,this.buffer=a.createBuffer(),this.type=k,this.usage=uu,this.byteLength=0,this.dimension=1,this.dtype=vs,this.persistentData=null,_.profile&&(this.stats={size:0})}B.prototype.bind=function(){a.bindBuffer(this.type,this.buffer)},B.prototype.destroy=function(){ue(this)};var K=[];function Q(k,N){var te=K.pop();return te||(te=new B(k)),te.bind(),re(te,N,oy,0,1,!1),te}function ie(k){K.push(k)}function oe(k,N,te){k.byteLength=N.byteLength,a.bufferData(k.type,N,te)}function re(k,N,te,xe,Z,ge){var me;if(k.usage=te,Array.isArray(N)){if(k.dtype=xe||gs,N.length>0){var Le;if(Array.isArray(N[0])){me=lu(N);for(var X=1,H=1;H<me.length;++H)X*=me[H];k.dimension=X,Le=ps(N,me,k.dtype),oe(k,Le,te),ge?k.persistentData=Le:gt.freeType(Le)}else if(typeof N[0]=="number"){k.dimension=Z;var Se=gt.allocType(k.dtype,N.length);cu(Se,N),oe(k,Se,te),ge?k.persistentData=Se:gt.freeType(Se)}else n(N[0])?(k.dimension=N[0].length,k.dtype=xe||$o(N[0])||gs,Le=ps(N,[N.length,N[0].length],k.dtype),oe(k,Le,te),ge?k.persistentData=Le:gt.freeType(Le)):m.raise("invalid buffer data")}}else if(n(N))k.dtype=xe||$o(N),k.dimension=Z,oe(k,N,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(N.buffer)));else if(yn(N)){me=N.shape;var ce=N.stride,ee=N.offset,he=0,de=0,He=0,Ue=0;me.length===1?(he=me[0],de=1,He=ce[0],Ue=0):me.length===2?(he=me[0],de=me[1],He=ce[0],Ue=ce[1]):m.raise("invalid shape"),k.dtype=xe||$o(N.data)||gs,k.dimension=de;var pe=gt.allocType(k.dtype,he*de);hu(pe,N.data,he,de,He,Ue,ee),oe(k,pe,te),ge?k.persistentData=pe:gt.freeType(pe)}else N instanceof ArrayBuffer?(k.dtype=vs,k.dimension=Z,oe(k,N,te),ge&&(k.persistentData=new Uint8Array(new Uint8Array(N)))):m.raise("invalid buffer data")}function ue(k){h.bufferCount--,M(k);var N=k.buffer;m(N,"buffer must not be deleted already"),a.deleteBuffer(N),k.buffer=null,delete R[k.id]}function J(k,N,te,xe){h.bufferCount++;var Z=new B(N);R[Z.id]=Z;function ge(X){var H=uu,Se=null,ce=0,ee=0,he=1;return Array.isArray(X)||n(X)||yn(X)||X instanceof ArrayBuffer?Se=X:typeof X=="number"?ce=X|0:X&&(m.type(X,"object","buffer arguments must be an object, a number or an array"),"data"in X&&(m(Se===null||Array.isArray(Se)||n(Se)||yn(Se),"invalid data for buffer"),Se=X.data),"usage"in X&&(m.parameter(X.usage,Vo,"invalid buffer usage"),H=Vo[X.usage]),"type"in X&&(m.parameter(X.type,mi,"invalid buffer type"),ee=mi[X.type]),"dimension"in X&&(m.type(X.dimension,"number","invalid dimension"),he=X.dimension|0),"length"in X&&(m.nni(ce,"buffer length must be a nonnegative integer"),ce=X.length|0)),Z.bind(),Se?re(Z,Se,H,ee,he,xe):(ce&&a.bufferData(Z.type,ce,H),Z.dtype=ee||vs,Z.usage=H,Z.dimension=he,Z.byteLength=ce),_.profile&&(Z.stats.size=Z.byteLength*qn[Z.dtype]),ge}function me(X,H){m(H+X.byteLength<=Z.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+X.byteLength+" starting from offset "+H+" to a buffer of size "+Z.byteLength),a.bufferSubData(Z.type,H,X)}function Le(X,H){var Se=(H||0)|0,ce;if(Z.bind(),n(X)||X instanceof ArrayBuffer)me(X,Se);else if(Array.isArray(X)){if(X.length>0)if(typeof X[0]=="number"){var ee=gt.allocType(Z.dtype,X.length);cu(ee,X),me(ee,Se),gt.freeType(ee)}else if(Array.isArray(X[0])||n(X[0])){ce=lu(X);var he=ps(X,ce,Z.dtype);me(he,Se),gt.freeType(he)}else m.raise("invalid buffer data")}else if(yn(X)){ce=X.shape;var de=X.stride,He=0,Ue=0,pe=0,ye=0;ce.length===1?(He=ce[0],Ue=1,pe=de[0],ye=0):ce.length===2?(He=ce[0],Ue=ce[1],pe=de[0],ye=de[1]):m.raise("invalid shape");var Re=Array.isArray(X.data)?Z.dtype:$o(X.data),We=gt.allocType(Re,He*Ue);hu(We,X.data,He,Ue,pe,ye,X.offset),me(We,Se),gt.freeType(We)}else m.raise("invalid data for buffer subdata");return ge}return te||ge(k),ge._reglType="buffer",ge._buffer=Z,ge.subdata=Le,_.profile&&(ge.stats=Z.stats),ge.destroy=function(){ue(Z)},ge}function ne(){rn(R).forEach(function(k){k.buffer=a.createBuffer(),a.bindBuffer(k.type,k.buffer),a.bufferData(k.type,k.persistentData||k.byteLength,k.usage)})}return _.profile&&(h.getTotalBufferSize=function(){var k=0;return Object.keys(R).forEach(function(N){k+=R[N].stats.size}),k}),{create:J,createStream:Q,destroyStream:ie,clear:function(){rn(R).forEach(ue),K.forEach(ue)},getBuffer:function(k){return k&&k._buffer instanceof B?k._buffer:null},restore:ne,_initBuffer:re}}var sy=0,fy=0,ly=1,uy=1,cy=4,hy=4,Yn={points:sy,point:fy,lines:ly,line:uy,triangles:cy,triangle:hy,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},dy=0,my=1,wr=4,py=5120,Ui=5121,du=5122,Vi=5123,mu=5124,pi=5125,ys=34963,vy=35040,gy=35044;function yy(a,h,_,M){var W={},R=0,B={uint8:Ui,uint16:Vi};h.oes_element_index_uint&&(B.uint32=pi);function K(ne){this.id=R++,W[this.id]=this,this.buffer=ne,this.primType=wr,this.vertCount=0,this.type=0}K.prototype.bind=function(){this.buffer.bind()};var Q=[];function ie(ne){var k=Q.pop();return k||(k=new K(_.create(null,ys,!0,!1)._buffer)),re(k,ne,vy,-1,-1,0,0),k}function oe(ne){Q.push(ne)}function re(ne,k,N,te,xe,Z,ge){ne.buffer.bind();var me;if(k){var Le=ge;!ge&&(!n(k)||yn(k)&&!n(k.data))&&(Le=h.oes_element_index_uint?pi:Vi),_._initBuffer(ne.buffer,k,N,Le,3)}else a.bufferData(ys,Z,N),ne.buffer.dtype=me||Ui,ne.buffer.usage=N,ne.buffer.dimension=3,ne.buffer.byteLength=Z;if(me=ge,!ge){switch(ne.buffer.dtype){case Ui:case py:me=Ui;break;case Vi:case du:me=Vi;break;case pi:case mu:me=pi;break;default:m.raise("unsupported type for element array")}ne.buffer.dtype=me}ne.type=me,m(me!==pi||!!h.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var X=xe;X<0&&(X=ne.buffer.byteLength,me===Vi?X>>=1:me===pi&&(X>>=2)),ne.vertCount=X;var H=te;if(te<0){H=wr;var Se=ne.buffer.dimension;Se===1&&(H=dy),Se===2&&(H=my),Se===3&&(H=wr)}ne.primType=H}function ue(ne){M.elementsCount--,m(ne.buffer!==null,"must not double destroy elements"),delete W[ne.id],ne.buffer.destroy(),ne.buffer=null}function J(ne,k){var N=_.create(null,ys,!0),te=new K(N._buffer);M.elementsCount++;function xe(Z){if(!Z)N(),te.primType=wr,te.vertCount=0,te.type=Ui;else if(typeof Z=="number")N(Z),te.primType=wr,te.vertCount=Z|0,te.type=Ui;else{var ge=null,me=gy,Le=-1,X=-1,H=0,Se=0;Array.isArray(Z)||n(Z)||yn(Z)?ge=Z:(m.type(Z,"object","invalid arguments for elements"),"data"in Z&&(ge=Z.data,m(Array.isArray(ge)||n(ge)||yn(ge),"invalid data for element buffer")),"usage"in Z&&(m.parameter(Z.usage,Vo,"invalid element buffer usage"),me=Vo[Z.usage]),"primitive"in Z&&(m.parameter(Z.primitive,Yn,"invalid element buffer primitive"),Le=Yn[Z.primitive]),"count"in Z&&(m(typeof Z.count=="number"&&Z.count>=0,"invalid vertex count for elements"),X=Z.count|0),"type"in Z&&(m.parameter(Z.type,B,"invalid buffer type"),Se=B[Z.type]),"length"in Z?H=Z.length|0:(H=X,Se===Vi||Se===du?H*=2:(Se===pi||Se===mu)&&(H*=4))),re(te,ge,me,Le,X,H,Se)}return xe}return xe(ne),xe._reglType="elements",xe._elements=te,xe.subdata=function(Z,ge){return N.subdata(Z,ge),xe},xe.destroy=function(){ue(te)},xe}return{create:J,createStream:ie,destroyStream:oe,getElements:function(ne){return typeof ne=="function"&&ne._elements instanceof K?ne._elements:null},clear:function(){rn(W).forEach(ue)}}}var pu=new Float32Array(1),xy=new Uint32Array(pu.buffer),by=5123;function vu(a){for(var h=gt.allocType(by,a.length),_=0;_<a.length;++_)if(isNaN(a[_]))h[_]=65535;else if(a[_]===1/0)h[_]=31744;else if(a[_]===-1/0)h[_]=64512;else{pu[0]=a[_];var M=xy[0],W=M>>>31<<15,R=(M<<1>>>24)-127,B=M>>13&1023;if(R<-24)h[_]=W;else if(R<-14){var K=-14-R;h[_]=W+(B+1024>>K)}else R>15?h[_]=W+31744:h[_]=W+(R+15<<10)+B}return h}function pt(a){return Array.isArray(a)||n(a)}var gu=function(a){return!(a&a-1)&&!!a},_y=34467,An=3553,xs=34067,Ho=34069,vi=6408,bs=6406,Wo=6407,Ar=6409,Xo=6410,yu=32854,_s=32855,xu=36194,Sy=32819,Ty=32820,wy=33635,Ay=34042,Ss=6402,jo=34041,Ts=35904,ws=35906,$i=36193,As=33776,Es=33777,Cs=33778,Ps=33779,bu=35986,_u=35987,Su=34798,Tu=35840,wu=35841,Au=35842,Eu=35843,Cu=36196,Hi=5121,ks=5123,Is=5125,Er=5126,Ey=10242,Cy=10243,Py=10497,Ls=33071,ky=33648,Iy=10240,Ly=10241,Ds=9728,Dy=9729,Fs=9984,Pu=9985,ku=9986,zs=9987,Fy=33170,qo=4352,zy=4353,Ry=4354,My=34046,Oy=3317,Ny=37440,Gy=37441,By=37443,Iu=37444,Cr=33984,Uy=[Fs,ku,Pu,zs],Yo=[0,Ar,Xo,Wo,vi],ln={};ln[Ar]=ln[bs]=ln[Ss]=1,ln[jo]=ln[Xo]=2,ln[Wo]=ln[Ts]=3,ln[vi]=ln[ws]=4;function Wi(a){return"[object "+a+"]"}var Lu=Wi("HTMLCanvasElement"),Du=Wi("OffscreenCanvas"),Fu=Wi("CanvasRenderingContext2D"),zu=Wi("ImageBitmap"),Ru=Wi("HTMLImageElement"),Mu=Wi("HTMLVideoElement"),Vy=Object.keys(ms).concat([Lu,Du,Fu,zu,Ru,Mu]),Xi=[];Xi[Hi]=1,Xi[Er]=4,Xi[$i]=2,Xi[ks]=2,Xi[Is]=4;var Gt=[];Gt[yu]=2,Gt[_s]=2,Gt[xu]=2,Gt[jo]=4,Gt[As]=.5,Gt[Es]=.5,Gt[Cs]=1,Gt[Ps]=1,Gt[bu]=.5,Gt[_u]=1,Gt[Su]=1,Gt[Tu]=.5,Gt[wu]=.25,Gt[Au]=.5,Gt[Eu]=.25,Gt[Cu]=.5;function Ou(a){return Array.isArray(a)&&(a.length===0||typeof a[0]=="number")}function Nu(a){if(!Array.isArray(a))return!1;var h=a.length;return!(h===0||!pt(a[0]))}function gi(a){return Object.prototype.toString.call(a)}function Gu(a){return gi(a)===Lu}function Bu(a){return gi(a)===Du}function $y(a){return gi(a)===Fu}function Hy(a){return gi(a)===zu}function Wy(a){return gi(a)===Ru}function Xy(a){return gi(a)===Mu}function Rs(a){if(!a)return!1;var h=gi(a);return Vy.indexOf(h)>=0?!0:Ou(a)||Nu(a)||yn(a)}function Uu(a){return ms[Object.prototype.toString.call(a)]|0}function jy(a,h){var _=h.length;switch(a.type){case Hi:case ks:case Is:case Er:var M=gt.allocType(a.type,_);M.set(h),a.data=M;break;case $i:a.data=vu(h);break;default:m.raise("unsupported texture type, must specify a typed array")}}function Vu(a,h){return gt.allocType(a.type===$i?Er:a.type,h)}function $u(a,h){a.type===$i?(a.data=vu(h),gt.freeType(h)):a.data=h}function qy(a,h,_,M,W,R){for(var B=a.width,K=a.height,Q=a.channels,ie=B*K*Q,oe=Vu(a,ie),re=0,ue=0;ue<K;++ue)for(var J=0;J<B;++J)for(var ne=0;ne<Q;++ne)oe[re++]=h[_*J+M*ue+W*ne+R];$u(a,oe)}function Zo(a,h,_,M,W,R){var B;if(typeof Gt[a]<"u"?B=Gt[a]:B=ln[a]*Xi[h],R&&(B*=6),W){for(var K=0,Q=_;Q>=1;)K+=B*Q*Q,Q/=2;return K}else return B*_*M}function Yy(a,h,_,M,W,R,B){var K={"don't care":qo,"dont care":qo,nice:Ry,fast:zy},Q={repeat:Py,clamp:Ls,mirror:ky},ie={nearest:Ds,linear:Dy},oe=i({mipmap:zs,"nearest mipmap nearest":Fs,"linear mipmap nearest":Pu,"nearest mipmap linear":ku,"linear mipmap linear":zs},ie),re={none:0,browser:Iu},ue={uint8:Hi,rgba4:Sy,rgb565:wy,"rgb5 a1":Ty},J={alpha:bs,luminance:Ar,"luminance alpha":Xo,rgb:Wo,rgba:vi,rgba4:yu,"rgb5 a1":_s,rgb565:xu},ne={};h.ext_srgb&&(J.srgb=Ts,J.srgba=ws),h.oes_texture_float&&(ue.float32=ue.float=Er),h.oes_texture_half_float&&(ue.float16=ue["half float"]=$i),h.webgl_depth_texture&&(i(J,{depth:Ss,"depth stencil":jo}),i(ue,{uint16:ks,uint32:Is,"depth stencil":Ay})),h.webgl_compressed_texture_s3tc&&i(ne,{"rgb s3tc dxt1":As,"rgba s3tc dxt1":Es,"rgba s3tc dxt3":Cs,"rgba s3tc dxt5":Ps}),h.webgl_compressed_texture_atc&&i(ne,{"rgb atc":bu,"rgba atc explicit alpha":_u,"rgba atc interpolated alpha":Su}),h.webgl_compressed_texture_pvrtc&&i(ne,{"rgb pvrtc 4bppv1":Tu,"rgb pvrtc 2bppv1":wu,"rgba pvrtc 4bppv1":Au,"rgba pvrtc 2bppv1":Eu}),h.webgl_compressed_texture_etc1&&(ne["rgb etc1"]=Cu);var k=Array.prototype.slice.call(a.getParameter(_y));Object.keys(ne).forEach(function(x){var O=ne[x];k.indexOf(O)>=0&&(J[x]=O)});var N=Object.keys(J);_.textureFormats=N;var te=[];Object.keys(J).forEach(function(x){var O=J[x];te[O]=x});var xe=[];Object.keys(ue).forEach(function(x){var O=ue[x];xe[O]=x});var Z=[];Object.keys(ie).forEach(function(x){var O=ie[x];Z[O]=x});var ge=[];Object.keys(oe).forEach(function(x){var O=oe[x];ge[O]=x});var me=[];Object.keys(Q).forEach(function(x){var O=Q[x];me[O]=x});var Le=N.reduce(function(x,O){var z=J[O];return z===Ar||z===bs||z===Ar||z===Xo||z===Ss||z===jo||h.ext_srgb&&(z===Ts||z===ws)?x[z]=z:z===_s||O.indexOf("rgba")>=0?x[z]=vi:x[z]=Wo,x},{});function X(){this.internalformat=vi,this.format=vi,this.type=Hi,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Iu,this.width=0,this.height=0,this.channels=0}function H(x,O){x.internalformat=O.internalformat,x.format=O.format,x.type=O.type,x.compressed=O.compressed,x.premultiplyAlpha=O.premultiplyAlpha,x.flipY=O.flipY,x.unpackAlignment=O.unpackAlignment,x.colorSpace=O.colorSpace,x.width=O.width,x.height=O.height,x.channels=O.channels}function Se(x,O){if(!(typeof O!="object"||!O)){if("premultiplyAlpha"in O&&(m.type(O.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),x.premultiplyAlpha=O.premultiplyAlpha),"flipY"in O&&(m.type(O.flipY,"boolean","invalid texture flip"),x.flipY=O.flipY),"alignment"in O&&(m.oneOf(O.alignment,[1,2,4,8],"invalid texture unpack alignment"),x.unpackAlignment=O.alignment),"colorSpace"in O&&(m.parameter(O.colorSpace,re,"invalid colorSpace"),x.colorSpace=re[O.colorSpace]),"type"in O){var z=O.type;m(h.oes_texture_float||!(z==="float"||z==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),m(h.oes_texture_half_float||!(z==="half float"||z==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),m(h.webgl_depth_texture||!(z==="uint16"||z==="uint32"||z==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),m.parameter(z,ue,"invalid texture type"),x.type=ue[z]}var _e=x.width,Ke=x.height,p=x.channels,c=!1;"shape"in O?(m(Array.isArray(O.shape)&&O.shape.length>=2,"shape must be an array"),_e=O.shape[0],Ke=O.shape[1],O.shape.length===3&&(p=O.shape[2],m(p>0&&p<=4,"invalid number of channels"),c=!0),m(_e>=0&&_e<=_.maxTextureSize,"invalid width"),m(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")):("radius"in O&&(_e=Ke=O.radius,m(_e>=0&&_e<=_.maxTextureSize,"invalid radius")),"width"in O&&(_e=O.width,m(_e>=0&&_e<=_.maxTextureSize,"invalid width")),"height"in O&&(Ke=O.height,m(Ke>=0&&Ke<=_.maxTextureSize,"invalid height")),"channels"in O&&(p=O.channels,m(p>0&&p<=4,"invalid number of channels"),c=!0)),x.width=_e|0,x.height=Ke|0,x.channels=p|0;var T=!1;if("format"in O){var C=O.format;m(h.webgl_depth_texture||!(C==="depth"||C==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),m.parameter(C,J,"invalid texture format");var I=x.internalformat=J[C];x.format=Le[I],C in ue&&("type"in O||(x.type=ue[C])),C in ne&&(x.compressed=!0),T=!0}!c&&T?x.channels=ln[x.format]:c&&!T?x.channels!==Yo[x.format]&&(x.format=x.internalformat=Yo[x.channels]):T&&c&&m(x.channels===ln[x.format],"number of channels inconsistent with specified format")}}function ce(x){a.pixelStorei(Ny,x.flipY),a.pixelStorei(Gy,x.premultiplyAlpha),a.pixelStorei(By,x.colorSpace),a.pixelStorei(Oy,x.unpackAlignment)}function ee(){X.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function he(x,O){var z=null;if(Rs(O)?z=O:O&&(m.type(O,"object","invalid pixel data type"),Se(x,O),"x"in O&&(x.xOffset=O.x|0),"y"in O&&(x.yOffset=O.y|0),Rs(O.data)&&(z=O.data)),m(!x.compressed||z instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),O.copy){m(!z,"can not specify copy and data field for the same texture");var _e=W.viewportWidth,Ke=W.viewportHeight;x.width=x.width||_e-x.xOffset,x.height=x.height||Ke-x.yOffset,x.needsCopy=!0,m(x.xOffset>=0&&x.xOffset<_e&&x.yOffset>=0&&x.yOffset<Ke&&x.width>0&&x.width<=_e&&x.height>0&&x.height<=Ke,"copy texture read out of bounds")}else if(!z)x.width=x.width||1,x.height=x.height||1,x.channels=x.channels||4;else if(n(z))x.channels=x.channels||4,x.data=z,!("type"in O)&&x.type===Hi&&(x.type=Uu(z));else if(Ou(z))x.channels=x.channels||4,jy(x,z),x.alignment=1,x.needsFree=!0;else if(yn(z)){var p=z.data;!Array.isArray(p)&&x.type===Hi&&(x.type=Uu(p));var c=z.shape,T=z.stride,C,I,A,w,E,v;c.length===3?(A=c[2],v=T[2]):(m(c.length===2,"invalid ndarray pixel data, must be 2 or 3D"),A=1,v=1),C=c[0],I=c[1],w=T[0],E=T[1],x.alignment=1,x.width=C,x.height=I,x.channels=A,x.format=x.internalformat=Yo[A],x.needsFree=!0,qy(x,p,w,E,v,z.offset)}else if(Gu(z)||Bu(z)||$y(z))Gu(z)||Bu(z)?x.element=z:x.element=z.canvas,x.width=x.element.width,x.height=x.element.height,x.channels=4;else if(Hy(z))x.element=z,x.width=z.width,x.height=z.height,x.channels=4;else if(Wy(z))x.element=z,x.width=z.naturalWidth,x.height=z.naturalHeight,x.channels=4;else if(Xy(z))x.element=z,x.width=z.videoWidth,x.height=z.videoHeight,x.channels=4;else if(Nu(z)){var b=x.width||z[0].length,g=x.height||z.length,F=x.channels;pt(z[0][0])?F=F||z[0][0].length:F=F||1;for(var L=Uo.shape(z),$=1,j=0;j<L.length;++j)$*=L[j];var le=Vu(x,$);Uo.flatten(z,L,"",le),$u(x,le),x.alignment=1,x.width=b,x.height=g,x.channels=F,x.format=x.internalformat=Yo[F],x.needsFree=!0}x.type===Er?m(_.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):x.type===$i&&m(_.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function de(x,O,z){var _e=x.element,Ke=x.data,p=x.internalformat,c=x.format,T=x.type,C=x.width,I=x.height;ce(x),_e?a.texImage2D(O,z,c,c,T,_e):x.compressed?a.compressedTexImage2D(O,z,p,C,I,0,Ke):x.needsCopy?(M(),a.copyTexImage2D(O,z,c,x.xOffset,x.yOffset,C,I,0)):a.texImage2D(O,z,c,C,I,0,c,T,Ke||null)}function He(x,O,z,_e,Ke){var p=x.element,c=x.data,T=x.internalformat,C=x.format,I=x.type,A=x.width,w=x.height;ce(x),p?a.texSubImage2D(O,Ke,z,_e,C,I,p):x.compressed?a.compressedTexSubImage2D(O,Ke,z,_e,T,A,w,c):x.needsCopy?(M(),a.copyTexSubImage2D(O,Ke,z,_e,x.xOffset,x.yOffset,A,w)):a.texSubImage2D(O,Ke,z,_e,A,w,C,I,c)}var Ue=[];function pe(){return Ue.pop()||new ee}function ye(x){x.needsFree&>.freeType(x.data),ee.call(x),Ue.push(x)}function Re(){X.call(this),this.genMipmaps=!1,this.mipmapHint=qo,this.mipmask=0,this.images=Array(16)}function We(x,O,z){var _e=x.images[0]=pe();x.mipmask=1,_e.width=x.width=O,_e.height=x.height=z,_e.channels=x.channels=4}function Je(x,O){var z=null;if(Rs(O))z=x.images[0]=pe(),H(z,x),he(z,O),x.mipmask=1;else if(Se(x,O),Array.isArray(O.mipmap))for(var _e=O.mipmap,Ke=0;Ke<_e.length;++Ke)z=x.images[Ke]=pe(),H(z,x),z.width>>=Ke,z.height>>=Ke,he(z,_e[Ke]),x.mipmask|=1<<Ke;else z=x.images[0]=pe(),H(z,x),he(z,O),x.mipmask=1;H(x,x.images[0]),x.compressed&&(x.internalformat===As||x.internalformat===Es||x.internalformat===Cs||x.internalformat===Ps)&&m(x.width%4===0&&x.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function vt(x,O){for(var z=x.images,_e=0;_e<z.length;++_e){if(!z[_e])return;de(z[_e],O,_e)}}var yt=[];function tt(){var x=yt.pop()||new Re;X.call(x),x.mipmask=0;for(var O=0;O<16;++O)x.images[O]=null;return x}function Et(x){for(var O=x.images,z=0;z<O.length;++z)O[z]&&ye(O[z]),O[z]=null;yt.push(x)}function ht(){this.minFilter=Ds,this.magFilter=Ds,this.wrapS=Ls,this.wrapT=Ls,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=qo}function Tt(x,O){if("min"in O){var z=O.min;m.parameter(z,oe),x.minFilter=oe[z],Uy.indexOf(x.minFilter)>=0&&!("faces"in O)&&(x.genMipmaps=!0)}if("mag"in O){var _e=O.mag;m.parameter(_e,ie),x.magFilter=ie[_e]}var Ke=x.wrapS,p=x.wrapT;if("wrap"in O){var c=O.wrap;typeof c=="string"?(m.parameter(c,Q),Ke=p=Q[c]):Array.isArray(c)&&(m.parameter(c[0],Q),m.parameter(c[1],Q),Ke=Q[c[0]],p=Q[c[1]])}else{if("wrapS"in O){var T=O.wrapS;m.parameter(T,Q),Ke=Q[T]}if("wrapT"in O){var C=O.wrapT;m.parameter(C,Q),p=Q[C]}}if(x.wrapS=Ke,x.wrapT=p,"anisotropic"in O){var I=O.anisotropic;m(typeof I=="number"&&I>=1&&I<=_.maxAnisotropic,"aniso samples must be between 1 and "),x.anisotropic=O.anisotropic}if("mipmap"in O){var A=!1;switch(typeof O.mipmap){case"string":m.parameter(O.mipmap,K,"invalid mipmap hint"),x.mipmapHint=K[O.mipmap],x.genMipmaps=!0,A=!0;break;case"boolean":A=x.genMipmaps=O.mipmap;break;case"object":m(Array.isArray(O.mipmap),"invalid mipmap type"),x.genMipmaps=!1,A=!0;break;default:m.raise("invalid mipmap type")}A&&!("min"in O)&&(x.minFilter=Fs)}}function Ct(x,O){a.texParameteri(O,Ly,x.minFilter),a.texParameteri(O,Iy,x.magFilter),a.texParameteri(O,Ey,x.wrapS),a.texParameteri(O,Cy,x.wrapT),h.ext_texture_filter_anisotropic&&a.texParameteri(O,My,x.anisotropic),x.genMipmaps&&(a.hint(Fy,x.mipmapHint),a.generateMipmap(O))}var Pt=0,zt={},Bt=_.maxTextureUnits,xt=Array(Bt).map(function(){return null});function Ye(x){X.call(this),this.mipmask=0,this.internalformat=vi,this.id=Pt++,this.refCount=1,this.target=x,this.texture=a.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new ht,B.profile&&(this.stats={size:0})}function Ut(x){a.activeTexture(Cr),a.bindTexture(x.target,x.texture)}function ot(){var x=xt[0];x?a.bindTexture(x.target,x.texture):a.bindTexture(An,null)}function Fe(x){var O=x.texture;m(O,"must not double destroy texture");var z=x.unit,_e=x.target;z>=0&&(a.activeTexture(Cr+z),a.bindTexture(_e,null),xt[z]=null),a.deleteTexture(O),x.texture=null,x.params=null,x.pixels=null,x.refCount=0,delete zt[x.id],R.textureCount--}i(Ye.prototype,{bind:function(){var x=this;x.bindCount+=1;var O=x.unit;if(O<0){for(var z=0;z<Bt;++z){var _e=xt[z];if(_e){if(_e.bindCount>0)continue;_e.unit=-1}xt[z]=x,O=z;break}O>=Bt&&m.raise("insufficient number of texture units"),B.profile&&R.maxTextureUnits<O+1&&(R.maxTextureUnits=O+1),x.unit=O,a.activeTexture(Cr+O),a.bindTexture(x.target,x.texture)}return O},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Fe(this)}});function et(x,O){var z=new Ye(An);zt[z.id]=z,R.textureCount++;function _e(c,T){var C=z.texInfo;ht.call(C);var I=tt();return typeof c=="number"?typeof T=="number"?We(I,c|0,T|0):We(I,c|0,c|0):c?(m.type(c,"object","invalid arguments to regl.texture"),Tt(C,c),Je(I,c)):We(I,1,1),C.genMipmaps&&(I.mipmask=(I.width<<1)-1),z.mipmask=I.mipmask,H(z,I),m.texture2D(C,I,_),z.internalformat=I.internalformat,_e.width=I.width,_e.height=I.height,Ut(z),vt(I,An),Ct(C,An),ot(),Et(I),B.profile&&(z.stats.size=Zo(z.internalformat,z.type,I.width,I.height,C.genMipmaps,!1)),_e.format=te[z.internalformat],_e.type=xe[z.type],_e.mag=Z[C.magFilter],_e.min=ge[C.minFilter],_e.wrapS=me[C.wrapS],_e.wrapT=me[C.wrapT],_e}function Ke(c,T,C,I){m(!!c,"must specify image data");var A=T|0,w=C|0,E=I|0,v=pe();return H(v,z),v.width=0,v.height=0,he(v,c),v.width=v.width||(z.width>>E)-A,v.height=v.height||(z.height>>E)-w,m(z.type===v.type&&z.format===v.format&&z.internalformat===v.internalformat,"incompatible format for texture.subimage"),m(A>=0&&w>=0&&A+v.width<=z.width&&w+v.height<=z.height,"texture.subimage write out of bounds"),m(z.mipmask&1<<E,"missing mipmap data"),m(v.data||v.element||v.needsCopy,"missing image data"),Ut(z),He(v,An,A,w,E),ot(),ye(v),_e}function p(c,T){var C=c|0,I=T|0||C;if(C===z.width&&I===z.height)return _e;_e.width=z.width=C,_e.height=z.height=I,Ut(z);for(var A=0;z.mipmask>>A;++A){var w=C>>A,E=I>>A;if(!w||!E)break;a.texImage2D(An,A,z.format,w,E,0,z.format,z.type,null)}return ot(),B.profile&&(z.stats.size=Zo(z.internalformat,z.type,C,I,!1,!1)),_e}return _e(x,O),_e.subimage=Ke,_e.resize=p,_e._reglType="texture2d",_e._texture=z,B.profile&&(_e.stats=z.stats),_e.destroy=function(){z.decRef()},_e}function it(x,O,z,_e,Ke,p){var c=new Ye(xs);zt[c.id]=c,R.cubeCount++;var T=new Array(6);function C(w,E,v,b,g,F){var L,$=c.texInfo;for(ht.call($),L=0;L<6;++L)T[L]=tt();if(typeof w=="number"||!w){var j=w|0||1;for(L=0;L<6;++L)We(T[L],j,j)}else if(typeof w=="object")if(E)Je(T[0],w),Je(T[1],E),Je(T[2],v),Je(T[3],b),Je(T[4],g),Je(T[5],F);else if(Tt($,w),Se(c,w),"faces"in w){var le=w.faces;for(m(Array.isArray(le)&&le.length===6,"cube faces must be a length 6 array"),L=0;L<6;++L)m(typeof le[L]=="object"&&!!le[L],"invalid input for cube map face"),H(T[L],c),Je(T[L],le[L])}else for(L=0;L<6;++L)Je(T[L],w);else m.raise("invalid arguments to cube map");for(H(c,T[0]),m.optional(function(){_.npotTextureCube||m(gu(c.width)&&gu(c.height),"your browser does not support non power or two texture dimensions")}),$.genMipmaps?c.mipmask=(T[0].width<<1)-1:c.mipmask=T[0].mipmask,m.textureCube(c,$,T,_),c.internalformat=T[0].internalformat,C.width=T[0].width,C.height=T[0].height,Ut(c),L=0;L<6;++L)vt(T[L],Ho+L);for(Ct($,xs),ot(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,C.width,C.height,$.genMipmaps,!0)),C.format=te[c.internalformat],C.type=xe[c.type],C.mag=Z[$.magFilter],C.min=ge[$.minFilter],C.wrapS=me[$.wrapS],C.wrapT=me[$.wrapT],L=0;L<6;++L)Et(T[L]);return C}function I(w,E,v,b,g){m(!!E,"must specify image data"),m(typeof w=="number"&&w===(w|0)&&w>=0&&w<6,"invalid face");var F=v|0,L=b|0,$=g|0,j=pe();return H(j,c),j.width=0,j.height=0,he(j,E),j.width=j.width||(c.width>>$)-F,j.height=j.height||(c.height>>$)-L,m(c.type===j.type&&c.format===j.format&&c.internalformat===j.internalformat,"incompatible format for texture.subimage"),m(F>=0&&L>=0&&F+j.width<=c.width&&L+j.height<=c.height,"texture.subimage write out of bounds"),m(c.mipmask&1<<$,"missing mipmap data"),m(j.data||j.element||j.needsCopy,"missing image data"),Ut(c),He(j,Ho+w,F,L,$),ot(),ye(j),C}function A(w){var E=w|0;if(E!==c.width){C.width=c.width=E,C.height=c.height=E,Ut(c);for(var v=0;v<6;++v)for(var b=0;c.mipmask>>b;++b)a.texImage2D(Ho+v,b,c.format,E>>b,E>>b,0,c.format,c.type,null);return ot(),B.profile&&(c.stats.size=Zo(c.internalformat,c.type,C.width,C.height,!1,!0)),C}}return C(x,O,z,_e,Ke,p),C.subimage=I,C.resize=A,C._reglType="textureCube",C._texture=c,B.profile&&(C.stats=c.stats),C.destroy=function(){c.decRef()},C}function bt(){for(var x=0;x<Bt;++x)a.activeTexture(Cr+x),a.bindTexture(An,null),xt[x]=null;rn(zt).forEach(Fe),R.cubeCount=0,R.textureCount=0}B.profile&&(R.getTotalTextureSize=function(){var x=0;return Object.keys(zt).forEach(function(O){x+=zt[O].stats.size}),x});function Cn(){for(var x=0;x<Bt;++x){var O=xt[x];O&&(O.bindCount=0,O.unit=-1,xt[x]=null)}rn(zt).forEach(function(z){z.texture=a.createTexture(),a.bindTexture(z.target,z.texture);for(var _e=0;_e<32;++_e)if((z.mipmask&1<<_e)!==0)if(z.target===An)a.texImage2D(An,_e,z.internalformat,z.width>>_e,z.height>>_e,0,z.internalformat,z.type,null);else for(var Ke=0;Ke<6;++Ke)a.texImage2D(Ho+Ke,_e,z.internalformat,z.width>>_e,z.height>>_e,0,z.internalformat,z.type,null);Ct(z.texInfo,z.target)})}function wi(){for(var x=0;x<Bt;++x){var O=xt[x];O&&(O.bindCount=0,O.unit=-1,xt[x]=null),a.activeTexture(Cr+x),a.bindTexture(An,null),a.bindTexture(xs,null)}}return{create2D:et,createCube:it,clear:bt,getTexture:function(x){return null},restore:Cn,refresh:wi}}var Zn=36161,Qo=32854,Hu=32855,Wu=36194,Xu=33189,ju=36168,qu=34041,Yu=35907,Zu=34836,Qu=34842,Ku=34843,xn=[];xn[Qo]=2,xn[Hu]=2,xn[Wu]=2,xn[Xu]=2,xn[ju]=1,xn[qu]=4,xn[Yu]=4,xn[Zu]=16,xn[Qu]=8,xn[Ku]=6;function Ju(a,h,_){return xn[a]*h*_}var Zy=function(a,h,_,M,W){var R={rgba4:Qo,rgb565:Wu,"rgb5 a1":Hu,depth:Xu,stencil:ju,"depth stencil":qu};h.ext_srgb&&(R.srgba=Yu),h.ext_color_buffer_half_float&&(R.rgba16f=Qu,R.rgb16f=Ku),h.webgl_color_buffer_float&&(R.rgba32f=Zu);var B=[];Object.keys(R).forEach(function(J){var ne=R[J];B[ne]=J});var K=0,Q={};function ie(J){this.id=K++,this.refCount=1,this.renderbuffer=J,this.format=Qo,this.width=0,this.height=0,W.profile&&(this.stats={size:0})}ie.prototype.decRef=function(){--this.refCount<=0&&oe(this)};function oe(J){var ne=J.renderbuffer;m(ne,"must not double destroy renderbuffer"),a.bindRenderbuffer(Zn,null),a.deleteRenderbuffer(ne),J.renderbuffer=null,J.refCount=0,delete Q[J.id],M.renderbufferCount--}function re(J,ne){var k=new ie(a.createRenderbuffer());Q[k.id]=k,M.renderbufferCount++;function N(xe,Z){var ge=0,me=0,Le=Qo;if(typeof xe=="object"&&xe){var X=xe;if("shape"in X){var H=X.shape;m(Array.isArray(H)&&H.length>=2,"invalid renderbuffer shape"),ge=H[0]|0,me=H[1]|0}else"radius"in X&&(ge=me=X.radius|0),"width"in X&&(ge=X.width|0),"height"in X&&(me=X.height|0);"format"in X&&(m.parameter(X.format,R,"invalid renderbuffer format"),Le=R[X.format])}else typeof xe=="number"?(ge=xe|0,typeof Z=="number"?me=Z|0:me=ge):xe?m.raise("invalid arguments to renderbuffer constructor"):ge=me=1;if(m(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),!(ge===k.width&&me===k.height&&Le===k.format))return N.width=k.width=ge,N.height=k.height=me,k.format=Le,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,Le,ge,me),m(a.getError()===0,"invalid render buffer format"),W.profile&&(k.stats.size=Ju(k.format,k.width,k.height)),N.format=B[k.format],N}function te(xe,Z){var ge=xe|0,me=Z|0||ge;return ge===k.width&&me===k.height||(m(ge>0&&me>0&&ge<=_.maxRenderbufferSize&&me<=_.maxRenderbufferSize,"invalid renderbuffer size"),N.width=k.width=ge,N.height=k.height=me,a.bindRenderbuffer(Zn,k.renderbuffer),a.renderbufferStorage(Zn,k.format,ge,me),m(a.getError()===0,"invalid render buffer format"),W.profile&&(k.stats.size=Ju(k.format,k.width,k.height))),N}return N(J,ne),N.resize=te,N._reglType="renderbuffer",N._renderbuffer=k,W.profile&&(N.stats=k.stats),N.destroy=function(){k.decRef()},N}W.profile&&(M.getTotalRenderbufferSize=function(){var J=0;return Object.keys(Q).forEach(function(ne){J+=Q[ne].stats.size}),J});function ue(){rn(Q).forEach(function(J){J.renderbuffer=a.createRenderbuffer(),a.bindRenderbuffer(Zn,J.renderbuffer),a.renderbufferStorage(Zn,J.format,J.width,J.height)}),a.bindRenderbuffer(Zn,null)}return{create:re,clear:function(){rn(Q).forEach(oe)},restore:ue}},Gn=36160,Ms=36161,yi=3553,Ko=34069,ec=36064,tc=36096,nc=36128,ic=33306,rc=36053,Qy=36054,Ky=36055,Jy=36057,ex=36061,tx=36193,nx=5121,ix=5126,oc=6407,ac=6408,rx=6402,ox=[oc,ac],Os=[];Os[ac]=4,Os[oc]=3;var Jo=[];Jo[nx]=1,Jo[ix]=4,Jo[tx]=2;var ax=32854,sx=32855,fx=36194,lx=33189,ux=36168,sc=34041,cx=35907,hx=34836,dx=34842,mx=34843,px=[ax,sx,fx,cx,dx,mx,hx],ji={};ji[rc]="complete",ji[Qy]="incomplete attachment",ji[Jy]="incomplete dimensions",ji[Ky]="incomplete, missing attachment",ji[ex]="unsupported";function vx(a,h,_,M,W,R){var B={cur:null,next:null,dirty:!1,setFBO:null},K=["rgba"],Q=["rgba4","rgb565","rgb5 a1"];h.ext_srgb&&Q.push("srgba"),h.ext_color_buffer_half_float&&Q.push("rgba16f","rgb16f"),h.webgl_color_buffer_float&&Q.push("rgba32f");var ie=["uint8"];h.oes_texture_half_float&&ie.push("half float","float16"),h.oes_texture_float&&ie.push("float","float32");function oe(ee,he,de){this.target=ee,this.texture=he,this.renderbuffer=de;var He=0,Ue=0;he?(He=he.width,Ue=he.height):de&&(He=de.width,Ue=de.height),this.width=He,this.height=Ue}function re(ee){ee&&(ee.texture&&ee.texture._texture.decRef(),ee.renderbuffer&&ee.renderbuffer._renderbuffer.decRef())}function ue(ee,he,de){if(ee)if(ee.texture){var He=ee.texture._texture,Ue=Math.max(1,He.width),pe=Math.max(1,He.height);m(Ue===he&&pe===de,"inconsistent width/height for supplied texture"),He.refCount+=1}else{var ye=ee.renderbuffer._renderbuffer;m(ye.width===he&&ye.height===de,"inconsistent width/height for renderbuffer"),ye.refCount+=1}}function J(ee,he){he&&(he.texture?a.framebufferTexture2D(Gn,ee,he.target,he.texture._texture.texture,0):a.framebufferRenderbuffer(Gn,ee,Ms,he.renderbuffer._renderbuffer.renderbuffer))}function ne(ee){var he=yi,de=null,He=null,Ue=ee;typeof ee=="object"&&(Ue=ee.data,"target"in ee&&(he=ee.target|0)),m.type(Ue,"function","invalid attachment data");var pe=Ue._reglType;return pe==="texture2d"?(de=Ue,m(he===yi)):pe==="textureCube"?(de=Ue,m(he>=Ko&&he<Ko+6,"invalid cube map target")):pe==="renderbuffer"?(He=Ue,he=Ms):m.raise("invalid regl object for attachment"),new oe(he,de,He)}function k(ee,he,de,He,Ue){if(de){var pe=M.create2D({width:ee,height:he,format:He,type:Ue});return pe._texture.refCount=0,new oe(yi,pe,null)}else{var ye=W.create({width:ee,height:he,format:He});return ye._renderbuffer.refCount=0,new oe(Ms,null,ye)}}function N(ee){return ee&&(ee.texture||ee.renderbuffer)}function te(ee,he,de){ee&&(ee.texture?ee.texture.resize(he,de):ee.renderbuffer&&ee.renderbuffer.resize(he,de),ee.width=he,ee.height=de)}var xe=0,Z={};function ge(){this.id=xe++,Z[this.id]=this,this.framebuffer=a.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function me(ee){ee.colorAttachments.forEach(re),re(ee.depthAttachment),re(ee.stencilAttachment),re(ee.depthStencilAttachment)}function Le(ee){var he=ee.framebuffer;m(he,"must not double destroy framebuffer"),a.deleteFramebuffer(he),ee.framebuffer=null,R.framebufferCount--,delete Z[ee.id]}function X(ee){var he;a.bindFramebuffer(Gn,ee.framebuffer);var de=ee.colorAttachments;for(he=0;he<de.length;++he)J(ec+he,de[he]);for(he=de.length;he<_.maxColorAttachments;++he)a.framebufferTexture2D(Gn,ec+he,yi,null,0);a.framebufferTexture2D(Gn,ic,yi,null,0),a.framebufferTexture2D(Gn,tc,yi,null,0),a.framebufferTexture2D(Gn,nc,yi,null,0),J(tc,ee.depthAttachment),J(nc,ee.stencilAttachment),J(ic,ee.depthStencilAttachment);var He=a.checkFramebufferStatus(Gn);!a.isContextLost()&&He!==rc&&m.raise("framebuffer configuration not supported, status = "+ji[He]),a.bindFramebuffer(Gn,B.next?B.next.framebuffer:null),B.cur=B.next,a.getError()}function H(ee,he){var de=new ge;R.framebufferCount++;function He(pe,ye){var Re;m(B.next!==de,"can not update framebuffer which is currently in use");var We=0,Je=0,vt=!0,yt=!0,tt=null,Et=!0,ht="rgba",Tt="uint8",Ct=1,Pt=null,zt=null,Bt=null,xt=!1;if(typeof pe=="number")We=pe|0,Je=ye|0||We;else if(!pe)We=Je=1;else{m.type(pe,"object","invalid arguments for framebuffer");var Ye=pe;if("shape"in Ye){var Ut=Ye.shape;m(Array.isArray(Ut)&&Ut.length>=2,"invalid shape for framebuffer"),We=Ut[0],Je=Ut[1]}else"radius"in Ye&&(We=Je=Ye.radius),"width"in Ye&&(We=Ye.width),"height"in Ye&&(Je=Ye.height);("color"in Ye||"colors"in Ye)&&(tt=Ye.color||Ye.colors,Array.isArray(tt)&&m(tt.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),tt||("colorCount"in Ye&&(Ct=Ye.colorCount|0,m(Ct>0,"invalid color buffer count")),"colorTexture"in Ye&&(Et=!!Ye.colorTexture,ht="rgba4"),"colorType"in Ye&&(Tt=Ye.colorType,Et?(m(h.oes_texture_float||!(Tt==="float"||Tt==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),m(h.oes_texture_half_float||!(Tt==="half float"||Tt==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Tt==="half float"||Tt==="float16"?(m(h.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),ht="rgba16f"):(Tt==="float"||Tt==="float32")&&(m(h.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),ht="rgba32f"),m.oneOf(Tt,ie,"invalid color type")),"colorFormat"in Ye&&(ht=Ye.colorFormat,K.indexOf(ht)>=0?Et=!0:Q.indexOf(ht)>=0?Et=!1:m.optional(function(){Et?m.oneOf(Ye.colorFormat,K,"invalid color format for texture"):m.oneOf(Ye.colorFormat,Q,"invalid color format for renderbuffer")}))),("depthTexture"in Ye||"depthStencilTexture"in Ye)&&(xt=!!(Ye.depthTexture||Ye.depthStencilTexture),m(!xt||h.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Ye&&(typeof Ye.depth=="boolean"?vt=Ye.depth:(Pt=Ye.depth,yt=!1)),"stencil"in Ye&&(typeof Ye.stencil=="boolean"?yt=Ye.stencil:(zt=Ye.stencil,vt=!1)),"depthStencil"in Ye&&(typeof Ye.depthStencil=="boolean"?vt=yt=Ye.depthStencil:(Bt=Ye.depthStencil,vt=!1,yt=!1))}var ot=null,Fe=null,et=null,it=null;if(Array.isArray(tt))ot=tt.map(ne);else if(tt)ot=[ne(tt)];else for(ot=new Array(Ct),Re=0;Re<Ct;++Re)ot[Re]=k(We,Je,Et,ht,Tt);m(h.webgl_draw_buffers||ot.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),m(ot.length<=_.maxColorAttachments,"too many color attachments, not supported"),We=We||ot[0].width,Je=Je||ot[0].height,Pt?Fe=ne(Pt):vt&&!yt&&(Fe=k(We,Je,xt,"depth","uint32")),zt?et=ne(zt):yt&&!vt&&(et=k(We,Je,!1,"stencil","uint8")),Bt?it=ne(Bt):!Pt&&!zt&&yt&&vt&&(it=k(We,Je,xt,"depth stencil","depth stencil")),m(!!Pt+!!zt+!!Bt<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var bt=null;for(Re=0;Re<ot.length;++Re)if(ue(ot[Re],We,Je),m(!ot[Re]||ot[Re].texture&&ox.indexOf(ot[Re].texture._texture.format)>=0||ot[Re].renderbuffer&&px.indexOf(ot[Re].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+Re+" is invalid"),ot[Re]&&ot[Re].texture){var Cn=Os[ot[Re].texture._texture.format]*Jo[ot[Re].texture._texture.type];bt===null?bt=Cn:m(bt===Cn,"all color attachments much have the same number of bits per pixel.")}return ue(Fe,We,Je),m(!Fe||Fe.texture&&Fe.texture._texture.format===rx||Fe.renderbuffer&&Fe.renderbuffer._renderbuffer.format===lx,"invalid depth attachment for framebuffer object"),ue(et,We,Je),m(!et||et.renderbuffer&&et.renderbuffer._renderbuffer.format===ux,"invalid stencil attachment for framebuffer object"),ue(it,We,Je),m(!it||it.texture&&it.texture._texture.format===sc||it.renderbuffer&&it.renderbuffer._renderbuffer.format===sc,"invalid depth-stencil attachment for framebuffer object"),me(de),de.width=We,de.height=Je,de.colorAttachments=ot,de.depthAttachment=Fe,de.stencilAttachment=et,de.depthStencilAttachment=it,He.color=ot.map(N),He.depth=N(Fe),He.stencil=N(et),He.depthStencil=N(it),He.width=de.width,He.height=de.height,X(de),He}function Ue(pe,ye){m(B.next!==de,"can not resize a framebuffer which is currently in use");var Re=Math.max(pe|0,1),We=Math.max(ye|0||Re,1);if(Re===de.width&&We===de.height)return He;for(var Je=de.colorAttachments,vt=0;vt<Je.length;++vt)te(Je[vt],Re,We);return te(de.depthAttachment,Re,We),te(de.stencilAttachment,Re,We),te(de.depthStencilAttachment,Re,We),de.width=He.width=Re,de.height=He.height=We,X(de),He}return He(ee,he),i(He,{resize:Ue,_reglType:"framebuffer",_framebuffer:de,destroy:function(){Le(de),me(de)},use:function(pe){B.setFBO({framebuffer:He},pe)}})}function Se(ee){var he=Array(6);function de(Ue){var pe;m(he.indexOf(B.next)<0,"can not update framebuffer which is currently in use");var ye={color:null},Re=0,We=null,Je="rgba",vt="uint8",yt=1;if(typeof Ue=="number")Re=Ue|0;else if(!Ue)Re=1;else{m.type(Ue,"object","invalid arguments for framebuffer");var tt=Ue;if("shape"in tt){var Et=tt.shape;m(Array.isArray(Et)&&Et.length>=2,"invalid shape for framebuffer"),m(Et[0]===Et[1],"cube framebuffer must be square"),Re=Et[0]}else"radius"in tt&&(Re=tt.radius|0),"width"in tt?(Re=tt.width|0,"height"in tt&&m(tt.height===Re,"must be square")):"height"in tt&&(Re=tt.height|0);("color"in tt||"colors"in tt)&&(We=tt.color||tt.colors,Array.isArray(We)&&m(We.length===1||h.webgl_draw_buffers,"multiple render targets not supported")),We||("colorCount"in tt&&(yt=tt.colorCount|0,m(yt>0,"invalid color buffer count")),"colorType"in tt&&(m.oneOf(tt.colorType,ie,"invalid color type"),vt=tt.colorType),"colorFormat"in tt&&(Je=tt.colorFormat,m.oneOf(tt.colorFormat,K,"invalid color format for texture"))),"depth"in tt&&(ye.depth=tt.depth),"stencil"in tt&&(ye.stencil=tt.stencil),"depthStencil"in tt&&(ye.depthStencil=tt.depthStencil)}var ht;if(We)if(Array.isArray(We))for(ht=[],pe=0;pe<We.length;++pe)ht[pe]=We[pe];else ht=[We];else{ht=Array(yt);var Tt={radius:Re,format:Je,type:vt};for(pe=0;pe<yt;++pe)ht[pe]=M.createCube(Tt)}for(ye.color=Array(ht.length),pe=0;pe<ht.length;++pe){var Ct=ht[pe];m(typeof Ct=="function"&&Ct._reglType==="textureCube","invalid cube map"),Re=Re||Ct.width,m(Ct.width===Re&&Ct.height===Re,"invalid cube map shape"),ye.color[pe]={target:Ko,data:ht[pe]}}for(pe=0;pe<6;++pe){for(var Pt=0;Pt<ht.length;++Pt)ye.color[Pt].target=Ko+pe;pe>0&&(ye.depth=he[0].depth,ye.stencil=he[0].stencil,ye.depthStencil=he[0].depthStencil),he[pe]?he[pe](ye):he[pe]=H(ye)}return i(de,{width:Re,height:Re,color:ht})}function He(Ue){var pe,ye=Ue|0;if(m(ye>0&&ye<=_.maxCubeMapSize,"invalid radius for cube fbo"),ye===de.width)return de;var Re=de.color;for(pe=0;pe<Re.length;++pe)Re[pe].resize(ye);for(pe=0;pe<6;++pe)he[pe].resize(ye);return de.width=de.height=ye,de}return de(ee),i(de,{faces:he,resize:He,_reglType:"framebufferCube",destroy:function(){he.forEach(function(Ue){Ue.destroy()})}})}function ce(){B.cur=null,B.next=null,B.dirty=!0,rn(Z).forEach(function(ee){ee.framebuffer=a.createFramebuffer(),X(ee)})}return i(B,{getFramebuffer:function(ee){if(typeof ee=="function"&&ee._reglType==="framebuffer"){var he=ee._framebuffer;if(he instanceof ge)return he}return null},create:H,createCube:Se,clear:function(){rn(Z).forEach(Le)},restore:ce})}var gx=5126,fc=34962,ea=34963,lc=["attributes","elements","offset","count","primitive","instances"];function Ns(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=gx,this.offset=0,this.stride=0,this.divisor=0}function yx(a,h,_,M,W,R,B){for(var K=_.maxAttributes,Q=new Array(K),ie=0;ie<K;++ie)Q[ie]=new Ns;var oe=0,re={},ue={Record:Ns,scope:{},state:Q,currentVAO:null,targetVAO:null,restore:ne()?me:function(){},createVAO:Le,getVAO:N,destroyBuffer:J,setVAO:ne()?te:xe,clear:ne()?Z:function(){}};function J(X){for(var H=0;H<Q.length;++H){var Se=Q[H];Se.buffer===X&&(a.disableVertexAttribArray(H),Se.buffer=null)}}function ne(){return h.oes_vertex_array_object}function k(){return h.angle_instanced_arrays}function N(X){return typeof X=="function"&&X._vao?X._vao:null}function te(X){if(X!==ue.currentVAO){var H=ne();X?H.bindVertexArrayOES(X.vao):H.bindVertexArrayOES(null),ue.currentVAO=X}}function xe(X){if(X!==ue.currentVAO){if(X)X.bindAttrs();else{for(var H=k(),Se=0;Se<Q.length;++Se){var ce=Q[Se];ce.buffer?(a.enableVertexAttribArray(Se),ce.buffer.bind(),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offfset),H&&ce.divisor&&H.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}B.elements?a.bindBuffer(ea,B.elements.buffer.buffer):a.bindBuffer(ea,null)}ue.currentVAO=X}}function Z(){rn(re).forEach(function(X){X.destroy()})}function ge(){this.id=++oe,this.attributes=[],this.elements=null,this.ownsElements=!1,this.count=0,this.offset=0,this.instances=-1,this.primitive=4;var X=ne();X?this.vao=X.createVertexArrayOES():this.vao=null,re[this.id]=this,this.buffers=[]}ge.prototype.bindAttrs=function(){for(var X=k(),H=this.attributes,Se=0;Se<H.length;++Se){var ce=H[Se];ce.buffer?(a.enableVertexAttribArray(Se),a.bindBuffer(fc,ce.buffer.buffer),a.vertexAttribPointer(Se,ce.size,ce.type,ce.normalized,ce.stride,ce.offset),X&&ce.divisor&&X.vertexAttribDivisorANGLE(Se,ce.divisor)):(a.disableVertexAttribArray(Se),a.vertexAttrib4f(Se,ce.x,ce.y,ce.z,ce.w))}for(var ee=H.length;ee<K;++ee)a.disableVertexAttribArray(ee);var he=R.getElements(this.elements);he?a.bindBuffer(ea,he.buffer.buffer):a.bindBuffer(ea,null)},ge.prototype.refresh=function(){var X=ne();X&&(X.bindVertexArrayOES(this.vao),this.bindAttrs(),ue.currentVAO=null,X.bindVertexArrayOES(null))},ge.prototype.destroy=function(){if(this.vao){var X=ne();this===ue.currentVAO&&(ue.currentVAO=null,X.bindVertexArrayOES(null)),X.deleteVertexArrayOES(this.vao),this.vao=null}this.ownsElements&&(this.elements.destroy(),this.elements=null,this.ownsElements=!1),re[this.id]&&(delete re[this.id],M.vaoCount-=1)};function me(){var X=ne();X&&rn(re).forEach(function(H){H.refresh()})}function Le(X){var H=new ge;M.vaoCount+=1;function Se(ce){var ee;if(Array.isArray(ce))ee=ce,H.elements&&H.ownsElements&&H.elements.destroy(),H.elements=null,H.ownsElements=!1,H.offset=0,H.count=0,H.instances=-1,H.primitive=4;else{if(m(typeof ce=="object","invalid arguments for create vao"),m("attributes"in ce,"must specify attributes for vao"),ce.elements){var he=ce.elements;H.ownsElements?typeof he=="function"&&he._reglType==="elements"?(H.elements.destroy(),H.ownsElements=!1):(H.elements(he),H.ownsElements=!1):R.getElements(ce.elements)?(H.elements=ce.elements,H.ownsElements=!1):(H.elements=R.create(ce.elements),H.ownsElements=!0)}else H.elements=null,H.ownsElements=!1;ee=ce.attributes,H.offset=0,H.count=-1,H.instances=-1,H.primitive=4,H.elements&&(H.count=H.elements._elements.vertCount,H.primitive=H.elements._elements.primType),"offset"in ce&&(H.offset=ce.offset|0),"count"in ce&&(H.count=ce.count|0),"instances"in ce&&(H.instances=ce.instances|0),"primitive"in ce&&(m(ce.primitive in Yn,"bad primitive type: "+ce.primitive),H.primitive=Yn[ce.primitive]),m.optional(()=>{for(var vt=Object.keys(ce),yt=0;yt<vt.length;++yt)m(lc.indexOf(vt[yt])>=0,'invalid option for vao: "'+vt[yt]+'" valid options are '+lc)}),m(Array.isArray(ee),"attributes must be an array")}m(ee.length<K,"too many attributes"),m(ee.length>0,"must specify at least one attribute");var de={},He=H.attributes;He.length=ee.length;for(var Ue=0;Ue<ee.length;++Ue){var pe=ee[Ue],ye=He[Ue]=new Ns,Re=pe.data||pe;if(Array.isArray(Re)||n(Re)||yn(Re)){var We;H.buffers[Ue]&&(We=H.buffers[Ue],n(Re)&&We._buffer.byteLength>=Re.byteLength?We.subdata(Re):(We.destroy(),H.buffers[Ue]=null)),H.buffers[Ue]||(We=H.buffers[Ue]=W.create(pe,fc,!1,!0)),ye.buffer=W.getBuffer(We),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1,de[Ue]=1}else W.getBuffer(pe)?(ye.buffer=W.getBuffer(pe),ye.size=ye.buffer.dimension|0,ye.normalized=!1,ye.type=ye.buffer.dtype,ye.offset=0,ye.stride=0,ye.divisor=0,ye.state=1):W.getBuffer(pe.buffer)?(ye.buffer=W.getBuffer(pe.buffer),ye.size=(+pe.size||ye.buffer.dimension)|0,ye.normalized=!!pe.normalized||!1,"type"in pe?(m.parameter(pe.type,mi,"invalid buffer type"),ye.type=mi[pe.type]):ye.type=ye.buffer.dtype,ye.offset=(pe.offset||0)|0,ye.stride=(pe.stride||0)|0,ye.divisor=(pe.divisor||0)|0,ye.state=1,m(ye.size>=1&&ye.size<=4,"size must be between 1 and 4"),m(ye.offset>=0,"invalid offset"),m(ye.stride>=0&&ye.stride<=255,"stride must be between 0 and 255"),m(ye.divisor>=0,"divisor must be positive"),m(!ye.divisor||!!h.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in pe?(m(Ue>0,"first attribute must not be a constant"),ye.x=+pe.x||0,ye.y=+pe.y||0,ye.z=+pe.z||0,ye.w=+pe.w||0,ye.state=2):m(!1,"invalid attribute spec for location "+Ue)}for(var Je=0;Je<H.buffers.length;++Je)!de[Je]&&H.buffers[Je]&&(H.buffers[Je].destroy(),H.buffers[Je]=null);return H.refresh(),Se}return Se.destroy=function(){for(var ce=0;ce<H.buffers.length;++ce)H.buffers[ce]&&H.buffers[ce].destroy();H.buffers.length=0,H.ownsElements&&(H.elements.destroy(),H.elements=null,H.ownsElements=!1),H.destroy()},Se._vao=H,Se._reglType="vao",Se(X)}return ue}var uc=35632,xx=35633,bx=35718,_x=35721;function Sx(a,h,_,M){var W={},R={};function B(k,N,te,xe){this.name=k,this.id=N,this.location=te,this.info=xe}function K(k,N){for(var te=0;te<k.length;++te)if(k[te].id===N.id){k[te].location=N.location;return}k.push(N)}function Q(k,N,te){var xe=k===uc?W:R,Z=xe[N];if(!Z){var ge=h.str(N);Z=a.createShader(k),a.shaderSource(Z,ge),a.compileShader(Z),m.shaderError(a,Z,ge,k,te),xe[N]=Z}return Z}var ie={},oe=[],re=0;function ue(k,N){this.id=re++,this.fragId=k,this.vertId=N,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,M.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function J(k,N,te){var xe,Z,ge=Q(uc,k.fragId),me=Q(xx,k.vertId),Le=k.program=a.createProgram();if(a.attachShader(Le,ge),a.attachShader(Le,me),te)for(xe=0;xe<te.length;++xe){var X=te[xe];a.bindAttribLocation(Le,X[0],X[1])}a.linkProgram(Le),m.linkError(a,Le,h.str(k.fragId),h.str(k.vertId),N);var H=a.getProgramParameter(Le,bx);M.profile&&(k.stats.uniformsCount=H);var Se=k.uniforms;for(xe=0;xe<H;++xe)if(Z=a.getActiveUniform(Le,xe),Z){if(Z.size>1)for(var ce=0;ce<Z.size;++ce){var ee=Z.name.replace("[0]","["+ce+"]");K(Se,new B(ee,h.id(ee),a.getUniformLocation(Le,ee),Z))}var he=Z.name;Z.size>1&&(he=he.replace("[0]","")),K(Se,new B(he,h.id(he),a.getUniformLocation(Le,he),Z))}var de=a.getProgramParameter(Le,_x);M.profile&&(k.stats.attributesCount=de);var He=k.attributes;for(xe=0;xe<de;++xe)Z=a.getActiveAttrib(Le,xe),Z&&K(He,new B(Z.name,h.id(Z.name),a.getAttribLocation(Le,Z.name),Z))}M.profile&&(_.getMaxUniformsCount=function(){var k=0;return oe.forEach(function(N){N.stats.uniformsCount>k&&(k=N.stats.uniformsCount)}),k},_.getMaxAttributesCount=function(){var k=0;return oe.forEach(function(N){N.stats.attributesCount>k&&(k=N.stats.attributesCount)}),k});function ne(){W={},R={};for(var k=0;k<oe.length;++k)J(oe[k],null,oe[k].attributes.map(function(N){return[N.location,N.name]}))}return{clear:function(){var k=a.deleteShader.bind(a);rn(W).forEach(k),W={},rn(R).forEach(k),R={},oe.forEach(function(N){a.deleteProgram(N.program)}),oe.length=0,ie={},_.shaderCount=0},program:function(k,N,te,xe){m.command(k>=0,"missing vertex shader",te),m.command(N>=0,"missing fragment shader",te);var Z=ie[N];Z||(Z=ie[N]={});var ge=Z[k];if(ge&&(ge.refCount++,!xe))return ge;var me=new ue(N,k);return _.shaderCount++,J(me,te,xe),ge||(Z[k]=me),oe.push(me),i(me,{destroy:function(){if(me.refCount--,me.refCount<=0){a.deleteProgram(me.program);var Le=oe.indexOf(me);oe.splice(Le,1),_.shaderCount--}Z[me.vertId].refCount<=0&&(a.deleteShader(R[me.vertId]),delete R[me.vertId],delete ie[me.fragId][me.vertId]),Object.keys(ie[me.fragId]).length||(a.deleteShader(W[me.fragId]),delete W[me.fragId],delete ie[me.fragId])}})},restore:ne,shader:Q,frag:-1,vert:-1}}var Tx=6408,Pr=5121,wx=3333,ta=5126;function Ax(a,h,_,M,W,R,B){function K(oe){var re;h.next===null?(m(W.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),re=Pr):(m(h.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),re=h.next.colorAttachments[0].texture._texture.type,m.optional(function(){R.oes_texture_float?(m(re===Pr||re===ta,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),re===ta&&m(B.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):m(re===Pr,"Reading from a framebuffer is only allowed for the type 'uint8'")}));var ue=0,J=0,ne=M.framebufferWidth,k=M.framebufferHeight,N=null;n(oe)?N=oe:oe&&(m.type(oe,"object","invalid arguments to regl.read()"),ue=oe.x|0,J=oe.y|0,m(ue>=0&&ue<M.framebufferWidth,"invalid x offset for regl.read"),m(J>=0&&J<M.framebufferHeight,"invalid y offset for regl.read"),ne=(oe.width||M.framebufferWidth-ue)|0,k=(oe.height||M.framebufferHeight-J)|0,N=oe.data||null),N&&(re===Pr?m(N instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):re===ta&&m(N instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),m(ne>0&&ne+ue<=M.framebufferWidth,"invalid width for read pixels"),m(k>0&&k+J<=M.framebufferHeight,"invalid height for read pixels"),_();var te=ne*k*4;return N||(re===Pr?N=new Uint8Array(te):re===ta&&(N=N||new Float32Array(te))),m.isTypedArray(N,"data buffer for regl.read() must be a typedarray"),m(N.byteLength>=te,"data buffer for regl.read() too small"),a.pixelStorei(wx,4),a.readPixels(ue,J,ne,k,Tx,re,N),N}function Q(oe){var re;return h.setFBO({framebuffer:oe.framebuffer},function(){re=K(oe)}),re}function ie(oe){return!oe||!("framebuffer"in oe)?K(oe):Q(oe)}return ie}function qi(a){return Array.prototype.slice.call(a)}function Yi(a){return qi(a).join("")}function Ex(){var a=0,h=[],_=[];function M(re){for(var ue=0;ue<_.length;++ue)if(_[ue]===re)return h[ue];var J="g"+a++;return h.push(J),_.push(re),J}function W(){var re=[];function ue(){re.push.apply(re,qi(arguments))}var J=[];function ne(){var k="v"+a++;return J.push(k),arguments.length>0&&(re.push(k,"="),re.push.apply(re,qi(arguments)),re.push(";")),k}return i(ue,{def:ne,toString:function(){return Yi([J.length>0?"var "+J.join(",")+";":"",Yi(re)])}})}function R(){var re=W(),ue=W(),J=re.toString,ne=ue.toString;function k(N,te){ue(N,te,"=",re.def(N,te),";")}return i(function(){re.apply(re,qi(arguments))},{def:re.def,entry:re,exit:ue,save:k,set:function(N,te,xe){k(N,te),re(N,te,"=",xe,";")},toString:function(){return J()+ne()}})}function B(){var re=Yi(arguments),ue=R(),J=R(),ne=ue.toString,k=J.toString;return i(ue,{then:function(){return ue.apply(ue,qi(arguments)),this},else:function(){return J.apply(J,qi(arguments)),this},toString:function(){var N=k();return N&&(N="else{"+N+"}"),Yi(["if(",re,"){",ne(),"}",N])}})}var K=W(),Q={};function ie(re,ue){var J=[];function ne(){var Z="a"+J.length;return J.push(Z),Z}ue=ue||0;for(var k=0;k<ue;++k)ne();var N=R(),te=N.toString,xe=Q[re]=i(N,{arg:ne,toString:function(){return Yi(["function(",J.join(),"){",te(),"}"])}});return xe}function oe(){var re=['"use strict";',K,"return {"];Object.keys(Q).forEach(function(ne){re.push('"',ne,'":',Q[ne].toString(),",")}),re.push("}");var ue=Yi(re).replace(/;/g,`;
|
|
6
6
|
`).replace(/}/g,`}
|
|
7
7
|
`).replace(/{/g,`{
|
|
8
|
-
`),J=Function.apply(null,h.concat(ue));return J.apply(null,_)}return{global:K,link:M,block:W,proc:re,scope:R,cond:B,compile:ae}}var Zi="xyzw".split(""),cc=5121,Qi=1,Gs=2,Bs=0,Us=1,Vs=2,$s=3,na=4,hc=5,dc=6,mc="dither",pc="blend.enable",vc="blend.color",Hs="blend.equation",Ws="blend.func",gc="depth.enable",yc="depth.func",xc="depth.range",bc="depth.mask",Xs="colorMask",_c="cull.enable",Sc="cull.face",js="frontFace",qs="lineWidth",Tc="polygonOffset.enable",Ys="polygonOffset.offset",wc="sample.alpha",Ac="sample.enable",Zs="sample.coverage",Ec="stencil.enable",Cc="stencil.mask",Qs="stencil.func",Ks="stencil.opFront",kr="stencil.opBack",Pc="scissor.enable",ia="scissor.box",Bn="viewport",Ir="profile",xi="framebuffer",Lr="vert",Dr="frag",bi="elements",_i="primitive",Si="count",ra="offset",oa="instances",Fr="vao",Js="Width",ef="Height",Ki=xi+Js,Ji=xi+ef,Cx=Bn+Js,Px=Bn+ef,kc="drawingBuffer",Ic=kc+Js,Lc=kc+ef,kx=[Ws,Hs,Qs,Ks,kr,Zs,Bn,ia,Ys],er=34962,tf=34963,Ix=35632,Lx=35633,Dc=3553,Dx=34067,Fx=2884,zx=3042,Rx=3024,Mx=2960,Ox=2929,Nx=3089,Gx=32823,Bx=32926,Ux=32928,nf=5126,aa=35664,sa=35665,fa=35666,rf=5124,la=35667,ua=35668,ca=35669,of=35670,ha=35671,da=35672,ma=35673,zr=35674,Rr=35675,Mr=35676,Or=35678,Nr=35680,af=4,Gr=1028,Ti=1029,Fc=2304,sf=2305,Vx=32775,$x=32776,Hx=519,Qn=7680,zc=0,Rc=1,Mc=32774,Wx=513,Oc=36160,Xx=36064,En={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Nc=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],tr={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Kn={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Gc={frag:Ix,vert:Lx},ff={cw:Fc,ccw:sf};function pa(a){return Array.isArray(a)||n(a)||yn(a)}function Bc(a){return a.sort(function(h,_){return h===Bn?-1:_===Bn?1:h<_?-1:1})}function Dt(a,h,_,M){this.thisDep=a,this.contextDep=h,this.propDep=_,this.append=M}function Jn(a){return a&&!(a.thisDep||a.contextDep||a.propDep)}function St(a){return new Dt(!1,!1,!1,a)}function Jt(a,h){var _=a.type;if(_===Bs){var M=a.data.length;return new Dt(!0,M>=1,M>=2,h)}else if(_===na){var W=a.data;return new Dt(W.thisDep,W.contextDep,W.propDep,h)}else{if(_===hc)return new Dt(!1,!1,!1,h);if(_===dc){for(var R=!1,B=!1,K=!1,Q=0;Q<a.data.length;++Q){var re=a.data[Q];if(re.type===Us)K=!0;else if(re.type===Vs)B=!0;else if(re.type===$s)R=!0;else if(re.type===Bs){R=!0;var ae=re.data;ae>=1&&(B=!0),ae>=2&&(K=!0)}else re.type===na&&(R=R||re.data.thisDep,B=B||re.data.contextDep,K=K||re.data.propDep)}return new Dt(R,B,K,h)}else return new Dt(_===$s,_===Vs,_===Us,h)}}var Uc=new Dt(!1,!1,!1,function(){});function jx(a,h,_,M,W,R,B,K,Q,re,ae,oe,ue,J,ne){var k=re.Record,G={add:32774,subtract:32778,"reverse subtract":32779};_.ext_blend_minmax&&(G.min=Vx,G.max=$x);var te=_.angle_instanced_arrays,xe=_.webgl_draw_buffers,Z=_.oes_vertex_array_object,ge={dirty:!0,profile:ne.profile},me={},De=[],X={},H={};function Se(p){return p.replace(".","_")}function ce(p,c,T){var C=Se(p);De.push(p),me[C]=ge[C]=!!T,X[C]=c}function ee(p,c,T){var C=Se(p);De.push(p),Array.isArray(T)?(ge[C]=T.slice(),me[C]=T.slice()):ge[C]=me[C]=T,H[C]=c}ce(mc,Rx),ce(pc,zx),ee(vc,"blendColor",[0,0,0,0]),ee(Hs,"blendEquationSeparate",[Mc,Mc]),ee(Ws,"blendFuncSeparate",[Rc,zc,Rc,zc]),ce(gc,Ox,!0),ee(yc,"depthFunc",Wx),ee(xc,"depthRange",[0,1]),ee(bc,"depthMask",!0),ee(Xs,Xs,[!0,!0,!0,!0]),ce(_c,Fx),ee(Sc,"cullFace",Ti),ee(js,js,sf),ee(qs,qs,1),ce(Tc,Gx),ee(Ys,"polygonOffset",[0,0]),ce(wc,Bx),ce(Ac,Ux),ee(Zs,"sampleCoverage",[1,!1]),ce(Ec,Mx),ee(Cc,"stencilMask",-1),ee(Qs,"stencilFunc",[Hx,0,-1]),ee(Ks,"stencilOpSeparate",[Gr,Qn,Qn,Qn]),ee(kr,"stencilOpSeparate",[Ti,Qn,Qn,Qn]),ce(Pc,Nx),ee(ia,"scissor",[0,0,a.drawingBufferWidth,a.drawingBufferHeight]),ee(Bn,Bn,[0,0,a.drawingBufferWidth,a.drawingBufferHeight]);var he={gl:a,context:ue,strings:h,next:me,current:ge,draw:oe,elements:R,buffer:W,shader:ae,attributes:re.state,vao:re,uniforms:Q,framebuffer:K,extensions:_,timer:J,isBufferArgs:pa},de={primTypes:Yn,compareFuncs:tr,blendFuncs:En,blendEquations:G,stencilOps:Kn,glTypes:mi,orientationType:ff};d.optional(function(){he.isArrayLike=pt}),xe&&(de.backBuffer=[Ti],de.drawBuffer=Yt(M.maxDrawbuffers,function(p){return p===0?[0]:Yt(p,function(c){return Xx+c})}));var We=0;function Ue(){var p=Ex(),c=p.link,T=p.global;p.id=We++,p.batchId="0";var C=c(he),I=p.shared={props:"a0"};Object.keys(he).forEach(function(b){I[b]=T.def(C,".",b)}),d.optional(function(){p.CHECK=c(d),p.commandStr=d.guessCommand(),p.command=c(p.commandStr),p.assert=function(b,g,F){b("if(!(",g,"))",this.CHECK,".commandRaise(",c(F),",",this.command,");")},de.invalidBlendCombinations=Nc});var A=p.next={},w=p.current={};Object.keys(H).forEach(function(b){Array.isArray(ge[b])&&(A[b]=T.def(I.next,".",b),w[b]=T.def(I.current,".",b))});var E=p.constants={};Object.keys(de).forEach(function(b){E[b]=T.def(JSON.stringify(de[b]))}),p.invoke=function(b,g){switch(g.type){case Bs:var F=["this",I.context,I.props,p.batchId];return b.def(c(g.data),".call(",F.slice(0,Math.max(g.data.length+1,4)),")");case Us:return b.def(I.props,g.data);case Vs:return b.def(I.context,g.data);case $s:return b.def("this",g.data);case na:return g.data.append(p,b),g.data.ref;case hc:return g.data.toString();case dc:return g.data.map(function(L){return p.invoke(b,L)})}},p.attribCache={};var v={};return p.scopeAttrib=function(b){var g=h.id(b);if(g in v)return v[g];var F=re.scope[g];F||(F=re.scope[g]=new k);var L=v[g]=c(F);return L},p}function pe(p){var c=p.static,T=p.dynamic,C;if(Ir in c){var I=!!c[Ir];C=St(function(w,E){return I}),C.enable=I}else if(Ir in T){var A=T[Ir];C=Jt(A,function(w,E){return w.invoke(E,A)})}return C}function ye(p,c){var T=p.static,C=p.dynamic;if(xi in T){var I=T[xi];return I?(I=K.getFramebuffer(I),d.command(I,"invalid framebuffer object"),St(function(w,E){var v=w.link(I),b=w.shared;E.set(b.framebuffer,".next",v);var g=b.context;return E.set(g,"."+Ki,v+".width"),E.set(g,"."+Ji,v+".height"),v})):St(function(w,E){var v=w.shared;E.set(v.framebuffer,".next","null");var b=v.context;return E.set(b,"."+Ki,b+"."+Ic),E.set(b,"."+Ji,b+"."+Lc),"null"})}else if(xi in C){var A=C[xi];return Jt(A,function(w,E){var v=w.invoke(E,A),b=w.shared,g=b.framebuffer,F=E.def(g,".getFramebuffer(",v,")");d.optional(function(){w.assert(E,"!"+v+"||"+F,"invalid framebuffer object")}),E.set(g,".next",F);var L=b.context;return E.set(L,"."+Ki,F+"?"+F+".width:"+L+"."+Ic),E.set(L,"."+Ji,F+"?"+F+".height:"+L+"."+Lc),F})}else return null}function Re(p,c,T){var C=p.static,I=p.dynamic;function A(v){if(v in C){var b=C[v];d.commandType(b,"object","invalid "+v,T.commandStr);var g=!0,F=b.x|0,L=b.y|0,$,j;return"width"in b?($=b.width|0,d.command($>=0,"invalid "+v,T.commandStr)):g=!1,"height"in b?(j=b.height|0,d.command(j>=0,"invalid "+v,T.commandStr)):g=!1,new Dt(!g&&c&&c.thisDep,!g&&c&&c.contextDep,!g&&c&&c.propDep,function(Ie,be){var Y=Ie.shared.context,U=$;"width"in b||(U=be.def(Y,".",Ki,"-",F));var Ce=j;return"height"in b||(Ce=be.def(Y,".",Ji,"-",L)),[F,L,U,Ce]})}else if(v in I){var le=I[v],Ge=Jt(le,function(Ie,be){var Y=Ie.invoke(be,le);d.optional(function(){Ie.assert(be,Y+"&&typeof "+Y+'==="object"',"invalid "+v)});var U=Ie.shared.context,Ce=be.def(Y,".x|0"),Ae=be.def(Y,".y|0"),Me=be.def('"width" in ',Y,"?",Y,".width|0:","(",U,".",Ki,"-",Ce,")"),ft=be.def('"height" in ',Y,"?",Y,".height|0:","(",U,".",Ji,"-",Ae,")");return d.optional(function(){Ie.assert(be,Me+">=0&&"+ft+">=0","invalid "+v)}),[Ce,Ae,Me,ft]});return c&&(Ge.thisDep=Ge.thisDep||c.thisDep,Ge.contextDep=Ge.contextDep||c.contextDep,Ge.propDep=Ge.propDep||c.propDep),Ge}else return c?new Dt(c.thisDep,c.contextDep,c.propDep,function(Ie,be){var Y=Ie.shared.context;return[0,0,be.def(Y,".",Ki),be.def(Y,".",Ji)]}):null}var w=A(Bn);if(w){var E=w;w=new Dt(w.thisDep,w.contextDep,w.propDep,function(v,b){var g=E.append(v,b),F=v.shared.context;return b.set(F,"."+Cx,g[2]),b.set(F,"."+Px,g[3]),g})}return{viewport:w,scissor_box:A(ia)}}function Xe(p,c){var T=p.static,C=typeof T[Dr]=="string"&&typeof T[Lr]=="string";if(C){if(Object.keys(c.dynamic).length>0)return null;var I=c.static,A=Object.keys(I);if(A.length>0&&typeof I[A[0]]=="number"){for(var w=[],E=0;E<A.length;++E)d(typeof I[A[E]]=="number","must specify all vertex attribute locations when using vaos"),w.push([I[A[E]]|0,A[E]]);return w}}return null}function Je(p,c,T){var C=p.static,I=p.dynamic;function A(g){if(g in C){var F=h.id(C[g]);d.optional(function(){ae.shader(Gc[g],F,d.guessCommand())});var L=St(function(){return F});return L.id=F,L}else if(g in I){var $=I[g];return Jt($,function(j,le){var Ge=j.invoke(le,$),Ie=le.def(j.shared.strings,".id(",Ge,")");return d.optional(function(){le(j.shared.shader,".shader(",Gc[g],",",Ie,",",j.command,");")}),Ie})}return null}var w=A(Dr),E=A(Lr),v=null,b;return Jn(w)&&Jn(E)?(v=ae.program(E.id,w.id,null,T),b=St(function(g,F){return g.link(v)})):b=new Dt(w&&w.thisDep||E&&E.thisDep,w&&w.contextDep||E&&E.contextDep,w&&w.propDep||E&&E.propDep,function(g,F){var L=g.shared.shader,$;w?$=w.append(g,F):$=F.def(L,".",Dr);var j;E?j=E.append(g,F):j=F.def(L,".",Lr);var le=L+".program("+j+","+$;return d.optional(function(){le+=","+g.command}),F.def(le+")")}),{frag:w,vert:E,progVar:b,program:v}}function vt(p,c){var T=p.static,C=p.dynamic,I={},A=!1;function w(){if(Fr in T){var be=T[Fr];return be!==null&&re.getVAO(be)===null&&(be=re.createVAO(be)),A=!0,I.vao=be,St(function(U){var Ce=re.getVAO(be);return Ce?U.link(Ce):"null"})}else if(Fr in C){A=!0;var Y=C[Fr];return Jt(Y,function(U,Ce){var Ae=U.invoke(Ce,Y);return Ce.def(U.shared.vao+".getVAO("+Ae+")")})}return null}var E=w(),v=!1;function b(){if(bi in T){var be=T[bi];if(I.elements=be,pa(be)){var Y=I.elements=R.create(be,!0);be=R.getElements(Y),v=!0}else be&&(be=R.getElements(be),v=!0,d.command(be,"invalid elements",c.commandStr));var U=St(function(Ae,Me){if(be){var ft=Ae.link(be);return Ae.ELEMENTS=ft,ft}return Ae.ELEMENTS=null,null});return U.value=be,U}else if(bi in C){v=!0;var Ce=C[bi];return Jt(Ce,function(Ae,Me){var ft=Ae.shared,Vt=ft.isBufferArgs,Ai=ft.elements,Un=Ae.invoke(Me,Ce),Pn=Me.def("null"),ei=Me.def(Vt,"(",Un,")"),Ei=Ae.cond(ei).then(Pn,"=",Ai,".createStream(",Un,");").else(Pn,"=",Ai,".getElements(",Un,");");return d.optional(function(){Ae.assert(Ei.else,"!"+Un+"||"+Pn,"invalid elements")}),Me.entry(Ei),Me.exit(Ae.cond(ei).then(Ai,".destroyStream(",Pn,");")),Ae.ELEMENTS=Pn,Pn})}else if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(Ae,Me){return Me.def(Ae.shared.vao+".currentVAO?"+Ae.shared.elements+".getElements("+Ae.shared.vao+".currentVAO.elements):null")});return null}var g=b();function F(){if(_i in T){var be=T[_i];return I.primitive=be,d.commandParameter(be,Yn,"invalid primitve",c.commandStr),St(function(U,Ce){return Yn[be]})}else if(_i in C){var Y=C[_i];return Jt(Y,function(U,Ce){var Ae=U.constants.primTypes,Me=U.invoke(Ce,Y);return d.optional(function(){U.assert(Ce,Me+" in "+Ae,"invalid primitive, must be one of "+Object.keys(Yn))}),Ce.def(Ae,"[",Me,"]")})}else{if(v)return Jn(g)?g.value?St(function(U,Ce){return Ce.def(U.ELEMENTS,".primType")}):St(function(){return af}):new Dt(g.thisDep,g.contextDep,g.propDep,function(U,Ce){var Ae=U.ELEMENTS;return Ce.def(Ae,"?",Ae,".primType:",af)});if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(U,Ce){return Ce.def(U.shared.vao+".currentVAO?"+U.shared.vao+".currentVAO.primitive:"+af)})}return null}function L(be,Y){if(be in T){var U=T[be]|0;return Y?I.offset=U:I.instances=U,d.command(!Y||U>=0,"invalid "+be,c.commandStr),St(function(Ae,Me){return Y&&(Ae.OFFSET=U),U})}else if(be in C){var Ce=C[be];return Jt(Ce,function(Ae,Me){var ft=Ae.invoke(Me,Ce);return Y&&(Ae.OFFSET=ft,d.optional(function(){Ae.assert(Me,ft+">=0","invalid "+be)})),ft})}else if(Y){if(v)return St(function(Ae,Me){return Ae.OFFSET=0,0});if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(Ae,Me){return Me.def(Ae.shared.vao+".currentVAO?"+Ae.shared.vao+".currentVAO.offset:0")})}else if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(Ae,Me){return Me.def(Ae.shared.vao+".currentVAO?"+Ae.shared.vao+".currentVAO.instances:-1")});return null}var $=L(ra,!0);function j(){if(Si in T){var be=T[Si]|0;return I.count=be,d.command(typeof be=="number"&&be>=0,"invalid vertex count",c.commandStr),St(function(){return be})}else if(Si in C){var Y=C[Si];return Jt(Y,function(Me,ft){var Vt=Me.invoke(ft,Y);return d.optional(function(){Me.assert(ft,"typeof "+Vt+'==="number"&&'+Vt+">=0&&"+Vt+"===("+Vt+"|0)","invalid vertex count")}),Vt})}else if(v)if(Jn(g)){if(g)return $?new Dt($.thisDep,$.contextDep,$.propDep,function(Me,ft){var Vt=ft.def(Me.ELEMENTS,".vertCount-",Me.OFFSET);return d.optional(function(){Me.assert(ft,Vt+">=0","invalid vertex offset/element buffer too small")}),Vt}):St(function(Me,ft){return ft.def(Me.ELEMENTS,".vertCount")});var U=St(function(){return-1});return d.optional(function(){U.MISSING=!0}),U}else{var Ce=new Dt(g.thisDep||$.thisDep,g.contextDep||$.contextDep,g.propDep||$.propDep,function(Me,ft){var Vt=Me.ELEMENTS;return Me.OFFSET?ft.def(Vt,"?",Vt,".vertCount-",Me.OFFSET,":-1"):ft.def(Vt,"?",Vt,".vertCount:-1")});return d.optional(function(){Ce.DYNAMIC=!0}),Ce}else if(A){var Ae=new Dt(E.thisDep,E.contextDep,E.propDep,function(Me,ft){return ft.def(Me.shared.vao,".currentVAO?",Me.shared.vao,".currentVAO.count:-1")});return Ae}return null}var le=F(),Ge=j(),Ie=L(oa,!1);return{elements:g,primitive:le,count:Ge,instances:Ie,offset:$,vao:E,vaoActive:A,elementsActive:v,static:I}}function yt(p,c){var T=p.static,C=p.dynamic,I={};return De.forEach(function(A){var w=Se(A);function E(v,b){if(A in T){var g=v(T[A]);I[w]=St(function(){return g})}else if(A in C){var F=C[A];I[w]=Jt(F,function(L,$){return b(L,$,L.invoke($,F))})}}switch(A){case _c:case pc:case mc:case Ec:case gc:case Pc:case Tc:case wc:case Ac:case bc:return E(function(v){return d.commandType(v,"boolean",A,c.commandStr),v},function(v,b,g){return d.optional(function(){v.assert(b,"typeof "+g+'==="boolean"',"invalid flag "+A,v.commandStr)}),g});case yc:return E(function(v){return d.commandParameter(v,tr,"invalid "+A,c.commandStr),tr[v]},function(v,b,g){var F=v.constants.compareFuncs;return d.optional(function(){v.assert(b,g+" in "+F,"invalid "+A+", must be one of "+Object.keys(tr))}),b.def(F,"[",g,"]")});case xc:return E(function(v){return d.command(pt(v)&&v.length===2&&typeof v[0]=="number"&&typeof v[1]=="number"&&v[0]<=v[1],"depth range is 2d array",c.commandStr),v},function(v,b,g){d.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===2&&typeof "+g+'[0]==="number"&&typeof '+g+'[1]==="number"&&'+g+"[0]<="+g+"[1]","depth range must be a 2d array")});var F=b.def("+",g,"[0]"),L=b.def("+",g,"[1]");return[F,L]});case Ws:return E(function(v){d.commandType(v,"object","blend.func",c.commandStr);var b="srcRGB"in v?v.srcRGB:v.src,g="srcAlpha"in v?v.srcAlpha:v.src,F="dstRGB"in v?v.dstRGB:v.dst,L="dstAlpha"in v?v.dstAlpha:v.dst;return d.commandParameter(b,En,w+".srcRGB",c.commandStr),d.commandParameter(g,En,w+".srcAlpha",c.commandStr),d.commandParameter(F,En,w+".dstRGB",c.commandStr),d.commandParameter(L,En,w+".dstAlpha",c.commandStr),d.command(Nc.indexOf(b+", "+F)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+b+", "+F+")",c.commandStr),[En[b],En[F],En[g],En[L]]},function(v,b,g){var F=v.constants.blendFuncs;d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid blend func, must be an object")});function L(Y,U){var Ce=b.def('"',Y,U,'" in ',g,"?",g,".",Y,U,":",g,".",Y);return d.optional(function(){v.assert(b,Ce+" in "+F,"invalid "+A+"."+Y+U+", must be one of "+Object.keys(En))}),Ce}var $=L("src","RGB"),j=L("dst","RGB");d.optional(function(){var Y=v.constants.invalidBlendCombinations;v.assert(b,Y+".indexOf("+$+'+", "+'+j+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var le=b.def(F,"[",$,"]"),Ge=b.def(F,"[",L("src","Alpha"),"]"),Ie=b.def(F,"[",j,"]"),be=b.def(F,"[",L("dst","Alpha"),"]");return[le,Ie,Ge,be]});case Hs:return E(function(v){if(typeof v=="string")return d.commandParameter(v,G,"invalid "+A,c.commandStr),[G[v],G[v]];if(typeof v=="object")return d.commandParameter(v.rgb,G,A+".rgb",c.commandStr),d.commandParameter(v.alpha,G,A+".alpha",c.commandStr),[G[v.rgb],G[v.alpha]];d.commandRaise("invalid blend.equation",c.commandStr)},function(v,b,g){var F=v.constants.blendEquations,L=b.def(),$=b.def(),j=v.cond("typeof ",g,'==="string"');return d.optional(function(){function le(Ge,Ie,be){v.assert(Ge,be+" in "+F,"invalid "+Ie+", must be one of "+Object.keys(G))}le(j.then,A,g),v.assert(j.else,g+"&&typeof "+g+'==="object"',"invalid "+A),le(j.else,A+".rgb",g+".rgb"),le(j.else,A+".alpha",g+".alpha")}),j.then(L,"=",$,"=",F,"[",g,"];"),j.else(L,"=",F,"[",g,".rgb];",$,"=",F,"[",g,".alpha];"),b(j),[L,$]});case vc:return E(function(v){return d.command(pt(v)&&v.length===4,"blend.color must be a 4d array",c.commandStr),Yt(4,function(b){return+v[b]})},function(v,b,g){return d.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===4","blend.color must be a 4d array")}),Yt(4,function(F){return b.def("+",g,"[",F,"]")})});case Cc:return E(function(v){return d.commandType(v,"number",w,c.commandStr),v|0},function(v,b,g){return d.optional(function(){v.assert(b,"typeof "+g+'==="number"',"invalid stencil.mask")}),b.def(g,"|0")});case Qs:return E(function(v){d.commandType(v,"object",w,c.commandStr);var b=v.cmp||"keep",g=v.ref||0,F="mask"in v?v.mask:-1;return d.commandParameter(b,tr,A+".cmp",c.commandStr),d.commandType(g,"number",A+".ref",c.commandStr),d.commandType(F,"number",A+".mask",c.commandStr),[tr[b],g,F]},function(v,b,g){var F=v.constants.compareFuncs;d.optional(function(){function le(){v.assert(b,Array.prototype.join.call(arguments,""),"invalid stencil.func")}le(g+"&&typeof ",g,'==="object"'),le('!("cmp" in ',g,")||(",g,".cmp in ",F,")")});var L=b.def('"cmp" in ',g,"?",F,"[",g,".cmp]",":",Qn),$=b.def(g,".ref|0"),j=b.def('"mask" in ',g,"?",g,".mask|0:-1");return[L,$,j]});case Ks:case kr:return E(function(v){d.commandType(v,"object",w,c.commandStr);var b=v.fail||"keep",g=v.zfail||"keep",F=v.zpass||"keep";return d.commandParameter(b,Kn,A+".fail",c.commandStr),d.commandParameter(g,Kn,A+".zfail",c.commandStr),d.commandParameter(F,Kn,A+".zpass",c.commandStr),[A===kr?Ti:Gr,Kn[b],Kn[g],Kn[F]]},function(v,b,g){var F=v.constants.stencilOps;d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid "+A)});function L($){return d.optional(function(){v.assert(b,'!("'+$+'" in '+g+")||("+g+"."+$+" in "+F+")","invalid "+A+"."+$+", must be one of "+Object.keys(Kn))}),b.def('"',$,'" in ',g,"?",F,"[",g,".",$,"]:",Qn)}return[A===kr?Ti:Gr,L("fail"),L("zfail"),L("zpass")]});case Ys:return E(function(v){d.commandType(v,"object",w,c.commandStr);var b=v.factor|0,g=v.units|0;return d.commandType(b,"number",w+".factor",c.commandStr),d.commandType(g,"number",w+".units",c.commandStr),[b,g]},function(v,b,g){d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid "+A)});var F=b.def(g,".factor|0"),L=b.def(g,".units|0");return[F,L]});case Sc:return E(function(v){var b=0;return v==="front"?b=Gr:v==="back"&&(b=Ti),d.command(!!b,w,c.commandStr),b},function(v,b,g){return d.optional(function(){v.assert(b,g+'==="front"||'+g+'==="back"',"invalid cull.face")}),b.def(g,'==="front"?',Gr,":",Ti)});case qs:return E(function(v){return d.command(typeof v=="number"&&v>=M.lineWidthDims[0]&&v<=M.lineWidthDims[1],"invalid line width, must be a positive number between "+M.lineWidthDims[0]+" and "+M.lineWidthDims[1],c.commandStr),v},function(v,b,g){return d.optional(function(){v.assert(b,"typeof "+g+'==="number"&&'+g+">="+M.lineWidthDims[0]+"&&"+g+"<="+M.lineWidthDims[1],"invalid line width")}),g});case js:return E(function(v){return d.commandParameter(v,ff,w,c.commandStr),ff[v]},function(v,b,g){return d.optional(function(){v.assert(b,g+'==="cw"||'+g+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),b.def(g+'==="cw"?'+Fc+":"+sf)});case Xs:return E(function(v){return d.command(pt(v)&&v.length===4,"color.mask must be length 4 array",c.commandStr),v.map(function(b){return!!b})},function(v,b,g){return d.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===4","invalid color.mask")}),Yt(4,function(F){return"!!"+g+"["+F+"]"})});case Zs:return E(function(v){d.command(typeof v=="object"&&v,w,c.commandStr);var b="value"in v?v.value:1,g=!!v.invert;return d.command(typeof b=="number"&&b>=0&&b<=1,"sample.coverage.value must be a number between 0 and 1",c.commandStr),[b,g]},function(v,b,g){d.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid sample.coverage")});var F=b.def('"value" in ',g,"?+",g,".value:1"),L=b.def("!!",g,".invert");return[F,L]})}}),I}function tt(p,c){var T=p.static,C=p.dynamic,I={};return Object.keys(T).forEach(function(A){var w=T[A],E;if(typeof w=="number"||typeof w=="boolean")E=St(function(){return w});else if(typeof w=="function"){var v=w._reglType;v==="texture2d"||v==="textureCube"?E=St(function(b){return b.link(w)}):v==="framebuffer"||v==="framebufferCube"?(d.command(w.color.length>0,'missing color attachment for framebuffer sent to uniform "'+A+'"',c.commandStr),E=St(function(b){return b.link(w.color[0])})):d.commandRaise('invalid data for uniform "'+A+'"',c.commandStr)}else pt(w)?E=St(function(b){var g=b.global.def("[",Yt(w.length,function(F){return d.command(typeof w[F]=="number"||typeof w[F]=="boolean","invalid uniform "+A,b.commandStr),w[F]}),"]");return g}):d.commandRaise('invalid or missing data for uniform "'+A+'"',c.commandStr);E.value=w,I[A]=E}),Object.keys(C).forEach(function(A){var w=C[A];I[A]=Jt(w,function(E,v){return E.invoke(v,w)})}),I}function Et(p,c){var T=p.static,C=p.dynamic,I={};return Object.keys(T).forEach(function(A){var w=T[A],E=h.id(A),v=new k;if(pa(w))v.state=Qi,v.buffer=W.getBuffer(W.create(w,er,!1,!0)),v.type=0;else{var b=W.getBuffer(w);if(b)v.state=Qi,v.buffer=b,v.type=0;else if(d.command(typeof w=="object"&&w,"invalid data for attribute "+A,c.commandStr),"constant"in w){var g=w.constant;v.buffer="null",v.state=Gs,typeof g=="number"?v.x=g:(d.command(pt(g)&&g.length>0&&g.length<=4,"invalid constant for attribute "+A,c.commandStr),Zi.forEach(function(Ie,be){be<g.length&&(v[Ie]=g[be])}))}else{pa(w.buffer)?b=W.getBuffer(W.create(w.buffer,er,!1,!0)):b=W.getBuffer(w.buffer),d.command(!!b,'missing buffer for attribute "'+A+'"',c.commandStr);var F=w.offset|0;d.command(F>=0,'invalid offset for attribute "'+A+'"',c.commandStr);var L=w.stride|0;d.command(L>=0&&L<256,'invalid stride for attribute "'+A+'", must be integer betweeen [0, 255]',c.commandStr);var $=w.size|0;d.command(!("size"in w)||$>0&&$<=4,'invalid size for attribute "'+A+'", must be 1,2,3,4',c.commandStr);var j=!!w.normalized,le=0;"type"in w&&(d.commandParameter(w.type,mi,"invalid type for attribute "+A,c.commandStr),le=mi[w.type]);var Ge=w.divisor|0;d.optional(function(){"divisor"in w&&(d.command(Ge===0||te,'cannot specify divisor for attribute "'+A+'", instancing not supported',c.commandStr),d.command(Ge>=0,'invalid divisor for attribute "'+A+'"',c.commandStr));var Ie=c.commandStr,be=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(w).forEach(function(Y){d.command(be.indexOf(Y)>=0,'unknown parameter "'+Y+'" for attribute pointer "'+A+'" (valid parameters are '+be+")",Ie)})}),v.buffer=b,v.state=Qi,v.size=$,v.normalized=j,v.type=le||b.dtype,v.offset=F,v.stride=L,v.divisor=Ge}}I[A]=St(function(Ie,be){var Y=Ie.attribCache;if(E in Y)return Y[E];var U={isStream:!1};return Object.keys(v).forEach(function(Ce){U[Ce]=v[Ce]}),v.buffer&&(U.buffer=Ie.link(v.buffer),U.type=U.type||U.buffer+".dtype"),Y[E]=U,U})}),Object.keys(C).forEach(function(A){var w=C[A];function E(v,b){var g=v.invoke(b,w),F=v.shared,L=v.constants,$=F.isBufferArgs,j=F.buffer;d.optional(function(){v.assert(b,g+"&&(typeof "+g+'==="object"||typeof '+g+'==="function")&&('+$+"("+g+")||"+j+".getBuffer("+g+")||"+j+".getBuffer("+g+".buffer)||"+$+"("+g+'.buffer)||("constant" in '+g+"&&(typeof "+g+'.constant==="number"||'+F.isArrayLike+"("+g+".constant))))",'invalid dynamic attribute "'+A+'"')});var le={isStream:b.def(!1)},Ge=new k;Ge.state=Qi,Object.keys(Ge).forEach(function(U){le[U]=b.def(""+Ge[U])});var Ie=le.buffer,be=le.type;b("if(",$,"(",g,")){",le.isStream,"=true;",Ie,"=",j,".createStream(",er,",",g,");",be,"=",Ie,".dtype;","}else{",Ie,"=",j,".getBuffer(",g,");","if(",Ie,"){",be,"=",Ie,".dtype;",'}else if("constant" in ',g,"){",le.state,"=",Gs,";","if(typeof "+g+'.constant === "number"){',le[Zi[0]],"=",g,".constant;",Zi.slice(1).map(function(U){return le[U]}).join("="),"=0;","}else{",Zi.map(function(U,Ce){return le[U]+"="+g+".constant.length>"+Ce+"?"+g+".constant["+Ce+"]:0;"}).join(""),"}}else{","if(",$,"(",g,".buffer)){",Ie,"=",j,".createStream(",er,",",g,".buffer);","}else{",Ie,"=",j,".getBuffer(",g,".buffer);","}",be,'="type" in ',g,"?",L.glTypes,"[",g,".type]:",Ie,".dtype;",le.normalized,"=!!",g,".normalized;");function Y(U){b(le[U],"=",g,".",U,"|0;")}return Y("size"),Y("offset"),Y("stride"),Y("divisor"),b("}}"),b.exit("if(",le.isStream,"){",j,".destroyStream(",Ie,");","}"),le}I[A]=Jt(w,E)}),I}function ht(p){var c=p.static,T=p.dynamic,C={};return Object.keys(c).forEach(function(I){var A=c[I];C[I]=St(function(w,E){return typeof A=="number"||typeof A=="boolean"?""+A:w.link(A)})}),Object.keys(T).forEach(function(I){var A=T[I];C[I]=Jt(A,function(w,E){return w.invoke(E,A)})}),C}function Tt(p,c,T,C,I){var A=p.static,w=p.dynamic;d.optional(function(){var Y=[xi,Lr,Dr,bi,_i,ra,Si,oa,Ir,Fr].concat(De);function U(Ce){Object.keys(Ce).forEach(function(Ae){d.command(Y.indexOf(Ae)>=0,'unknown parameter "'+Ae+'"',I.commandStr)})}U(A),U(w)});var E=Xe(p,c),v=ye(p),b=Re(p,v,I),g=vt(p,I),F=yt(p,I),L=Je(p,I,E);function $(Y){var U=b[Y];U&&(F[Y]=U)}$(Bn),$(Se(ia));var j=Object.keys(F).length>0,le={framebuffer:v,draw:g,shader:L,state:F,dirty:j,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(le.profile=pe(p),le.uniforms=tt(T,I),le.drawVAO=le.scopeVAO=g.vao,!le.drawVAO&&L.program&&!E&&_.angle_instanced_arrays&&g.static.elements){var Ge=!0,Ie=L.program.attributes.map(function(Y){var U=c.static[Y];return Ge=Ge&&!!U,U});if(Ge&&Ie.length>0){var be=re.getVAO(re.createVAO({attributes:Ie,elements:g.static.elements}));le.drawVAO=new Dt(null,null,null,function(Y,U){return Y.link(be)}),le.useVAO=!0}}return E?le.useVAO=!0:le.attributes=Et(c,I),le.context=ht(C),le}function Ct(p,c,T){var C=p.shared,I=C.context,A=p.scope();Object.keys(T).forEach(function(w){c.save(I,"."+w);var E=T[w],v=E.append(p,c);Array.isArray(v)?A(I,".",w,"=[",v.join(),"];"):A(I,".",w,"=",v,";")}),c(A)}function Pt(p,c,T,C){var I=p.shared,A=I.gl,w=I.framebuffer,E;xe&&(E=c.def(I.extensions,".webgl_draw_buffers"));var v=p.constants,b=v.drawBuffer,g=v.backBuffer,F;T?F=T.append(p,c):F=c.def(w,".next"),C||c("if(",F,"!==",w,".cur){"),c("if(",F,"){",A,".bindFramebuffer(",Oc,",",F,".framebuffer);"),xe&&c(E,".drawBuffersWEBGL(",b,"[",F,".colorAttachments.length]);"),c("}else{",A,".bindFramebuffer(",Oc,",null);"),xe&&c(E,".drawBuffersWEBGL(",g,");"),c("}",w,".cur=",F,";"),C||c("}")}function zt(p,c,T){var C=p.shared,I=C.gl,A=p.current,w=p.next,E=C.current,v=C.next,b=p.cond(E,".dirty");De.forEach(function(g){var F=Se(g);if(!(F in T.state)){var L,$;if(F in w){L=w[F],$=A[F];var j=Yt(ge[F].length,function(Ge){return b.def(L,"[",Ge,"]")});b(p.cond(j.map(function(Ge,Ie){return Ge+"!=="+$+"["+Ie+"]"}).join("||")).then(I,".",H[F],"(",j,");",j.map(function(Ge,Ie){return $+"["+Ie+"]="+Ge}).join(";"),";"))}else{L=b.def(v,".",F);var le=p.cond(L,"!==",E,".",F);b(le),F in X?le(p.cond(L).then(I,".enable(",X[F],");").else(I,".disable(",X[F],");"),E,".",F,"=",L,";"):le(I,".",H[F],"(",L,");",E,".",F,"=",L,";")}}}),Object.keys(T.state).length===0&&b(E,".dirty=false;"),c(b)}function Bt(p,c,T,C){var I=p.shared,A=p.current,w=I.current,E=I.gl;Bc(Object.keys(T)).forEach(function(v){var b=T[v];if(!(C&&!C(b))){var g=b.append(p,c);if(X[v]){var F=X[v];Jn(b)?g?c(E,".enable(",F,");"):c(E,".disable(",F,");"):c(p.cond(g).then(E,".enable(",F,");").else(E,".disable(",F,");")),c(w,".",v,"=",g,";")}else if(pt(g)){var L=A[v];c(E,".",H[v],"(",g,");",g.map(function($,j){return L+"["+j+"]="+$}).join(";"),";")}else c(E,".",H[v],"(",g,");",w,".",v,"=",g,";")}})}function xt(p,c){te&&(p.instancing=c.def(p.shared.extensions,".angle_instanced_arrays"))}function Ye(p,c,T,C,I){var A=p.shared,w=p.stats,E=A.current,v=A.timer,b=T.profile;function g(){return typeof performance>"u"?"Date.now()":"performance.now()"}var F,L;function $(Y){F=c.def(),Y(F,"=",g(),";"),typeof I=="string"?Y(w,".count+=",I,";"):Y(w,".count++;"),J&&(C?(L=c.def(),Y(L,"=",v,".getNumPendingQueries();")):Y(v,".beginQuery(",w,");"))}function j(Y){Y(w,".cpuTime+=",g(),"-",F,";"),J&&(C?Y(v,".pushScopeStats(",L,",",v,".getNumPendingQueries(),",w,");"):Y(v,".endQuery();"))}function le(Y){var U=c.def(E,".profile");c(E,".profile=",Y,";"),c.exit(E,".profile=",U,";")}var Ge;if(b){if(Jn(b)){b.enable?($(c),j(c.exit),le("true")):le("false");return}Ge=b.append(p,c),le(Ge)}else Ge=c.def(E,".profile");var Ie=p.block();$(Ie),c("if(",Ge,"){",Ie,"}");var be=p.block();j(be),c.exit("if(",Ge,"){",be,"}")}function Ut(p,c,T,C,I){var A=p.shared;function w(v){switch(v){case aa:case la:case ha:return 2;case sa:case ua:case da:return 3;case fa:case ca:case ma:return 4;default:return 1}}function E(v,b,g){var F=A.gl,L=c.def(v,".location"),$=c.def(A.attributes,"[",L,"]"),j=g.state,le=g.buffer,Ge=[g.x,g.y,g.z,g.w],Ie=["buffer","normalized","offset","stride"];function be(){c("if(!",$,".buffer){",F,".enableVertexAttribArray(",L,");}");var U=g.type,Ce;if(g.size?Ce=c.def(g.size,"||",b):Ce=b,c("if(",$,".type!==",U,"||",$,".size!==",Ce,"||",Ie.map(function(Me){return $+"."+Me+"!=="+g[Me]}).join("||"),"){",F,".bindBuffer(",er,",",le,".buffer);",F,".vertexAttribPointer(",[L,Ce,U,g.normalized,g.stride,g.offset],");",$,".type=",U,";",$,".size=",Ce,";",Ie.map(function(Me){return $+"."+Me+"="+g[Me]+";"}).join(""),"}"),te){var Ae=g.divisor;c("if(",$,".divisor!==",Ae,"){",p.instancing,".vertexAttribDivisorANGLE(",[L,Ae],");",$,".divisor=",Ae,";}")}}function Y(){c("if(",$,".buffer){",F,".disableVertexAttribArray(",L,");",$,".buffer=null;","}if(",Zi.map(function(U,Ce){return $+"."+U+"!=="+Ge[Ce]}).join("||"),"){",F,".vertexAttrib4f(",L,",",Ge,");",Zi.map(function(U,Ce){return $+"."+U+"="+Ge[Ce]+";"}).join(""),"}")}j===Qi?be():j===Gs?Y():(c("if(",j,"===",Qi,"){"),be(),c("}else{"),Y(),c("}"))}C.forEach(function(v){var b=v.name,g=T.attributes[b],F;if(g){if(!I(g))return;F=g.append(p,c)}else{if(!I(Uc))return;var L=p.scopeAttrib(b);d.optional(function(){p.assert(c,L+".state","missing attribute "+b)}),F={},Object.keys(new k).forEach(function($){F[$]=c.def(L,".",$)})}E(p.link(v),w(v.info.type),F)})}function at(p,c,T,C,I,A){for(var w=p.shared,E=w.gl,v={},b,g=0;g<C.length;++g){var F=C[g],L=F.name,$=F.info.type,j=F.info.size,le=T.uniforms[L];if(j>1){if(!le)continue;var Ge=L.replace("[0]","");if(v[Ge])continue;v[Ge]=1}var Ie=p.link(F),be=Ie+".location",Y;if(le){if(!I(le))continue;if(Jn(le)){var U=le.value;if(d.command(U!==null&&typeof U<"u",'missing uniform "'+L+'"',p.commandStr),$===Or||$===Nr){d.command(typeof U=="function"&&($===Or&&(U._reglType==="texture2d"||U._reglType==="framebuffer")||$===Nr&&(U._reglType==="textureCube"||U._reglType==="framebufferCube")),"invalid texture for uniform "+L,p.commandStr);var Ce=p.link(U._texture||U.color[0]._texture);c(E,".uniform1i(",be,",",Ce+".bind());"),c.exit(Ce,".unbind();")}else if($===zr||$===Rr||$===Mr){d.optional(function(){d.command(pt(U),"invalid matrix for uniform "+L,p.commandStr),d.command($===zr&&U.length===4||$===Rr&&U.length===9||$===Mr&&U.length===16,"invalid length for matrix uniform "+L,p.commandStr)});var Ae=p.global.def("new Float32Array(["+Array.prototype.slice.call(U)+"])"),Me=2;$===Rr?Me=3:$===Mr&&(Me=4),c(E,".uniformMatrix",Me,"fv(",be,",false,",Ae,");")}else{switch($){case nf:j===1?d.commandType(U,"number","uniform "+L,p.commandStr):d.command(pt(U)&&U.length===j,"uniform "+L,p.commandStr),b="1f";break;case aa:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=j*2,"uniform "+L,p.commandStr),b="2f";break;case sa:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=j*3,"uniform "+L,p.commandStr),b="3f";break;case fa:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=j*4,"uniform "+L,p.commandStr),b="4f";break;case of:j===1?d.commandType(U,"boolean","uniform "+L,p.commandStr):d.command(pt(U)&&U.length===j,"uniform "+L,p.commandStr),b="1i";break;case rf:j===1?d.commandType(U,"number","uniform "+L,p.commandStr):d.command(pt(U)&&U.length===j,"uniform "+L,p.commandStr),b="1i";break;case ha:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=j*2,"uniform "+L,p.commandStr),b="2i";break;case la:d.command(pt(U)&&U.length&&U.length%2===0&&U.length<=j*2,"uniform "+L,p.commandStr),b="2i";break;case da:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=j*3,"uniform "+L,p.commandStr),b="3i";break;case ua:d.command(pt(U)&&U.length&&U.length%3===0&&U.length<=j*3,"uniform "+L,p.commandStr),b="3i";break;case ma:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=j*4,"uniform "+L,p.commandStr),b="4i";break;case ca:d.command(pt(U)&&U.length&&U.length%4===0&&U.length<=j*4,"uniform "+L,p.commandStr),b="4i";break}j>1?(b+="v",U=p.global.def("["+Array.prototype.slice.call(U)+"]")):U=pt(U)?Array.prototype.slice.call(U):U,c(E,".uniform",b,"(",be,",",U,");")}continue}else Y=le.append(p,c)}else{if(!I(Uc))continue;Y=c.def(w.uniforms,"[",h.id(L),"]")}$===Or?(d(!Array.isArray(Y),"must specify a scalar prop for textures"),c("if(",Y,"&&",Y,'._reglType==="framebuffer"){',Y,"=",Y,".color[0];","}")):$===Nr&&(d(!Array.isArray(Y),"must specify a scalar prop for cube maps"),c("if(",Y,"&&",Y,'._reglType==="framebufferCube"){',Y,"=",Y,".color[0];","}")),d.optional(function(){function on(en,va){p.assert(c,en,'bad data or missing for uniform "'+L+'". '+va)}function Ci(en,va){va===1&&d(!Array.isArray(Y),"must not specify an array type for uniform"),on("Array.isArray("+Y+") && typeof "+Y+'[0]===" '+en+'" || typeof '+Y+'==="'+en+'"',"invalid type, expected "+en)}function un(en,va,ga){Array.isArray(Y)?d(Y.length&&Y.length%en===0&&Y.length<=en*ga,"must have length of "+(ga===1?"":"n * ")+en):on(w.isArrayLike+"("+Y+")&&"+Y+".length && "+Y+".length % "+en+" === 0 && "+Y+".length<="+en*ga,"invalid vector, should have length of "+(ga===1?"":"n * ")+en,p.commandStr)}function qc(en){d(!Array.isArray(Y),"must not specify a value type"),on("typeof "+Y+'==="function"&&'+Y+'._reglType==="texture'+(en===Dc?"2d":"Cube")+'"',"invalid texture type",p.commandStr)}switch($){case rf:Ci("number",j);break;case la:un(2,"number",j);break;case ua:un(3,"number",j);break;case ca:un(4,"number",j);break;case nf:Ci("number",j);break;case aa:un(2,"number",j);break;case sa:un(3,"number",j);break;case fa:un(4,"number",j);break;case of:Ci("boolean",j);break;case ha:un(2,"boolean",j);break;case da:un(3,"boolean",j);break;case ma:un(4,"boolean",j);break;case zr:un(4,"number",j);break;case Rr:un(9,"number",j);break;case Mr:un(16,"number",j);break;case Or:qc(Dc);break;case Nr:qc(Dx);break}});var ft=1;switch($){case Or:case Nr:var Vt=c.def(Y,"._texture");c(E,".uniform1i(",be,",",Vt,".bind());"),c.exit(Vt,".unbind();");continue;case rf:case of:b="1i";break;case la:case ha:b="2i",ft=2;break;case ua:case da:b="3i",ft=3;break;case ca:case ma:b="4i",ft=4;break;case nf:b="1f";break;case aa:b="2f",ft=2;break;case sa:b="3f",ft=3;break;case fa:b="4f",ft=4;break;case zr:b="Matrix2fv";break;case Rr:b="Matrix3fv";break;case Mr:b="Matrix4fv";break}if(b.indexOf("Matrix")===-1&&j>1&&(b+="v",ft=1),b.charAt(0)==="M"){c(E,".uniform",b,"(",be,",");var Ai=Math.pow($-zr+2,2),Un=p.global.def("new Float32Array(",Ai,")");Array.isArray(Y)?c("false,(",Yt(Ai,function(on){return Un+"["+on+"]="+Y[on]}),",",Un,")"):c("false,(Array.isArray(",Y,")||",Y," instanceof Float32Array)?",Y,":(",Yt(Ai,function(on){return Un+"["+on+"]="+Y+"["+on+"]"}),",",Un,")"),c(");")}else if(ft>1){for(var Pn=[],ei=[],Ei=0;Ei<ft;++Ei)Array.isArray(Y)?ei.push(Y[Ei]):ei.push(c.def(Y+"["+Ei+"]")),A&&Pn.push(c.def());A&&c("if(!",p.batchId,"||",Pn.map(function(on,Ci){return on+"!=="+ei[Ci]}).join("||"),"){",Pn.map(function(on,Ci){return on+"="+ei[Ci]+";"}).join("")),c(E,".uniform",b,"(",be,",",ei.join(","),");"),A&&c("}")}else{if(d(!Array.isArray(Y),"uniform value must not be an array"),A){var jc=c.def();c("if(!",p.batchId,"||",jc,"!==",Y,"){",jc,"=",Y,";")}c(E,".uniform",b,"(",be,",",Y,");"),A&&c("}")}}}function Fe(p,c,T,C){var I=p.shared,A=I.gl,w=I.draw,E=C.draw;function v(){var Ce=E.elements,Ae,Me=c;return Ce?((Ce.contextDep&&C.contextDynamic||Ce.propDep)&&(Me=T),Ae=Ce.append(p,Me),E.elementsActive&&Me("if("+Ae+")"+A+".bindBuffer("+tf+","+Ae+".buffer.buffer);")):(Ae=Me.def(),Me(Ae,"=",w,".",bi,";","if(",Ae,"){",A,".bindBuffer(",tf,",",Ae,".buffer.buffer);}","else if(",I.vao,".currentVAO){",Ae,"=",p.shared.elements+".getElements("+I.vao,".currentVAO.elements);",Z?"":"if("+Ae+")"+A+".bindBuffer("+tf+","+Ae+".buffer.buffer);","}")),Ae}function b(){var Ce=E.count,Ae,Me=c;return Ce?((Ce.contextDep&&C.contextDynamic||Ce.propDep)&&(Me=T),Ae=Ce.append(p,Me),d.optional(function(){Ce.MISSING&&p.assert(c,"false","missing vertex count"),Ce.DYNAMIC&&p.assert(Me,Ae+">=0","missing vertex count")})):(Ae=Me.def(w,".",Si),d.optional(function(){p.assert(Me,Ae+">=0","missing vertex count")})),Ae}var g=v();function F(Ce){var Ae=E[Ce];return Ae?Ae.contextDep&&C.contextDynamic||Ae.propDep?Ae.append(p,T):Ae.append(p,c):c.def(w,".",Ce)}var L=F(_i),$=F(ra),j=b();if(typeof j=="number"){if(j===0)return}else T("if(",j,"){"),T.exit("}");var le,Ge;te&&(le=F(oa),Ge=p.instancing);var Ie=g+".type",be=E.elements&&Jn(E.elements)&&!E.vaoActive;function Y(){function Ce(){T(Ge,".drawElementsInstancedANGLE(",[L,j,Ie,$+"<<(("+Ie+"-"+cc+")>>1)",le],");")}function Ae(){T(Ge,".drawArraysInstancedANGLE(",[L,$,j,le],");")}g&&g!=="null"?be?Ce():(T("if(",g,"){"),Ce(),T("}else{"),Ae(),T("}")):Ae()}function U(){function Ce(){T(A+".drawElements("+[L,j,Ie,$+"<<(("+Ie+"-"+cc+")>>1)"]+");")}function Ae(){T(A+".drawArrays("+[L,$,j]+");")}g&&g!=="null"?be?Ce():(T("if(",g,"){"),Ce(),T("}else{"),Ae(),T("}")):Ae()}te&&(typeof le!="number"||le>=0)?typeof le=="string"?(T("if(",le,">0){"),Y(),T("}else if(",le,"<0){"),U(),T("}")):Y():U()}function et(p,c,T,C,I){var A=Ue(),w=A.proc("body",I);return d.optional(function(){A.commandStr=c.commandStr,A.command=A.link(c.commandStr)}),te&&(A.instancing=w.def(A.shared.extensions,".angle_instanced_arrays")),p(A,w,T,C),A.compile().body}function it(p,c,T,C){xt(p,c),T.useVAO?T.drawVAO?c(p.shared.vao,".setVAO(",T.drawVAO.append(p,c),");"):c(p.shared.vao,".setVAO(",p.shared.vao,".targetVAO);"):(c(p.shared.vao,".setVAO(null);"),Ut(p,c,T,C.attributes,function(){return!0})),at(p,c,T,C.uniforms,function(){return!0},!1),Fe(p,c,c,T)}function bt(p,c){var T=p.proc("draw",1);xt(p,T),Ct(p,T,c.context),Pt(p,T,c.framebuffer),zt(p,T,c),Bt(p,T,c.state),Ye(p,T,c,!1,!0);var C=c.shader.progVar.append(p,T);if(T(p.shared.gl,".useProgram(",C,".program);"),c.shader.program)it(p,T,c,c.shader.program);else{T(p.shared.vao,".setVAO(null);");var I=p.global.def("{}"),A=T.def(C,".id"),w=T.def(I,"[",A,"]");T(p.cond(w).then(w,".call(this,a0);").else(w,"=",I,"[",A,"]=",p.link(function(E){return et(it,p,c,E,1)}),"(",C,");",w,".call(this,a0);"))}Object.keys(c.state).length>0&&T(p.shared.current,".dirty=true;"),p.shared.vao&&T(p.shared.vao,".setVAO(null);")}function Cn(p,c,T,C){p.batchId="a1",xt(p,c);function I(){return!0}Ut(p,c,T,C.attributes,I),at(p,c,T,C.uniforms,I,!1),Fe(p,c,c,T)}function wi(p,c,T,C){xt(p,c);var I=T.contextDep,A=c.def(),w="a0",E="a1",v=c.def();p.shared.props=v,p.batchId=A;var b=p.scope(),g=p.scope();c(b.entry,"for(",A,"=0;",A,"<",E,";++",A,"){",v,"=",w,"[",A,"];",g,"}",b.exit);function F(Ie){return Ie.contextDep&&I||Ie.propDep}function L(Ie){return!F(Ie)}if(T.needsContext&&Ct(p,g,T.context),T.needsFramebuffer&&Pt(p,g,T.framebuffer),Bt(p,g,T.state,F),T.profile&&F(T.profile)&&Ye(p,g,T,!1,!0),C)T.useVAO?T.drawVAO?F(T.drawVAO)?g(p.shared.vao,".setVAO(",T.drawVAO.append(p,g),");"):b(p.shared.vao,".setVAO(",T.drawVAO.append(p,b),");"):b(p.shared.vao,".setVAO(",p.shared.vao,".targetVAO);"):(b(p.shared.vao,".setVAO(null);"),Ut(p,b,T,C.attributes,L),Ut(p,g,T,C.attributes,F)),at(p,b,T,C.uniforms,L,!1),at(p,g,T,C.uniforms,F,!0),Fe(p,b,g,T);else{var $=p.global.def("{}"),j=T.shader.progVar.append(p,g),le=g.def(j,".id"),Ge=g.def($,"[",le,"]");g(p.shared.gl,".useProgram(",j,".program);","if(!",Ge,"){",Ge,"=",$,"[",le,"]=",p.link(function(Ie){return et(Cn,p,T,Ie,2)}),"(",j,");}",Ge,".call(this,a0[",A,"],",A,");")}}function x(p,c){var T=p.proc("batch",2);p.batchId="0",xt(p,T);var C=!1,I=!0;Object.keys(c.context).forEach(function($){C=C||c.context[$].propDep}),C||(Ct(p,T,c.context),I=!1);var A=c.framebuffer,w=!1;A?(A.propDep?C=w=!0:A.contextDep&&C&&(w=!0),w||Pt(p,T,A)):Pt(p,T,null),c.state.viewport&&c.state.viewport.propDep&&(C=!0);function E($){return $.contextDep&&C||$.propDep}zt(p,T,c),Bt(p,T,c.state,function($){return!E($)}),(!c.profile||!E(c.profile))&&Ye(p,T,c,!1,"a1"),c.contextDep=C,c.needsContext=I,c.needsFramebuffer=w;var v=c.shader.progVar;if(v.contextDep&&C||v.propDep)wi(p,T,c,null);else{var b=v.append(p,T);if(T(p.shared.gl,".useProgram(",b,".program);"),c.shader.program)wi(p,T,c,c.shader.program);else{T(p.shared.vao,".setVAO(null);");var g=p.global.def("{}"),F=T.def(b,".id"),L=T.def(g,"[",F,"]");T(p.cond(L).then(L,".call(this,a0,a1);").else(L,"=",g,"[",F,"]=",p.link(function($){return et(wi,p,c,$,2)}),"(",b,");",L,".call(this,a0,a1);"))}}Object.keys(c.state).length>0&&T(p.shared.current,".dirty=true;"),p.shared.vao&&T(p.shared.vao,".setVAO(null);")}function O(p,c){var T=p.proc("scope",3);p.batchId="a2";var C=p.shared,I=C.current;Ct(p,T,c.context),c.framebuffer&&c.framebuffer.append(p,T),Bc(Object.keys(c.state)).forEach(function(w){var E=c.state[w],v=E.append(p,T);pt(v)?v.forEach(function(b,g){T.set(p.next[w],"["+g+"]",b)}):T.set(C.next,"."+w,v)}),Ye(p,T,c,!0,!0),[bi,ra,Si,oa,_i].forEach(function(w){var E=c.draw[w];E&&T.set(C.draw,"."+w,""+E.append(p,T))}),Object.keys(c.uniforms).forEach(function(w){var E=c.uniforms[w].append(p,T);Array.isArray(E)&&(E="["+E.join()+"]"),T.set(C.uniforms,"["+h.id(w)+"]",E)}),Object.keys(c.attributes).forEach(function(w){var E=c.attributes[w].append(p,T),v=p.scopeAttrib(w);Object.keys(new k).forEach(function(b){T.set(v,"."+b,E[b])})}),c.scopeVAO&&T.set(C.vao,".targetVAO",c.scopeVAO.append(p,T));function A(w){var E=c.shader[w];E&&T.set(C.shader,"."+w,E.append(p,T))}A(Lr),A(Dr),Object.keys(c.state).length>0&&(T(I,".dirty=true;"),T.exit(I,".dirty=true;")),T("a1(",p.shared.context,",a0,",p.batchId,");")}function z(p){if(!(typeof p!="object"||pt(p))){for(var c=Object.keys(p),T=0;T<c.length;++T)if(It.isDynamic(p[c[T]]))return!0;return!1}}function _e(p,c,T){var C=c.static[T];if(!C||!z(C))return;var I=p.global,A=Object.keys(C),w=!1,E=!1,v=!1,b=p.global.def("{}");A.forEach(function(F){var L=C[F];if(It.isDynamic(L)){typeof L=="function"&&(L=C[F]=It.unbox(L));var $=Jt(L,null);w=w||$.thisDep,v=v||$.propDep,E=E||$.contextDep}else{switch(I(b,".",F,"="),typeof L){case"number":I(L);break;case"string":I('"',L,'"');break;case"object":Array.isArray(L)&&I("[",L.join(),"]");break;default:I(p.link(L));break}I(";")}});function g(F,L){A.forEach(function($){var j=C[$];if(It.isDynamic(j)){var le=F.invoke(L,j);L(b,".",$,"=",le,";")}})}c.dynamic[T]=new It.DynamicVariable(na,{thisDep:w,contextDep:E,propDep:v,ref:b,append:g}),delete c.static[T]}function Ke(p,c,T,C,I){var A=Ue();A.stats=A.link(I),Object.keys(c.static).forEach(function(E){_e(A,c,E)}),kx.forEach(function(E){_e(A,p,E)});var w=Tt(p,c,T,C,A);return bt(A,w),O(A,w),x(A,w),i(A.compile(),{destroy:function(){w.shader.program.destroy()}})}return{next:me,current:ge,procs:function(){var p=Ue(),c=p.proc("poll"),T=p.proc("refresh"),C=p.block();c(C),T(C);var I=p.shared,A=I.gl,w=I.next,E=I.current;C(E,".dirty=false;"),Pt(p,c),Pt(p,T,null,!0);var v;te&&(v=p.link(te)),_.oes_vertex_array_object&&T(p.link(_.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var b=0;b<M.maxAttributes;++b){var g=T.def(I.attributes,"[",b,"]"),F=p.cond(g,".buffer");F.then(A,".enableVertexAttribArray(",b,");",A,".bindBuffer(",er,",",g,".buffer.buffer);",A,".vertexAttribPointer(",b,",",g,".size,",g,".type,",g,".normalized,",g,".stride,",g,".offset);").else(A,".disableVertexAttribArray(",b,");",A,".vertexAttrib4f(",b,",",g,".x,",g,".y,",g,".z,",g,".w);",g,".buffer=null;"),T(F),te&&T(v,".vertexAttribDivisorANGLE(",b,",",g,".divisor);")}return T(p.shared.vao,".currentVAO=null;",p.shared.vao,".setVAO(",p.shared.vao,".targetVAO);"),Object.keys(X).forEach(function(L){var $=X[L],j=C.def(w,".",L),le=p.block();le("if(",j,"){",A,".enable(",$,")}else{",A,".disable(",$,")}",E,".",L,"=",j,";"),T(le),c("if(",j,"!==",E,".",L,"){",le,"}")}),Object.keys(H).forEach(function(L){var $=H[L],j=ge[L],le,Ge,Ie=p.block();if(Ie(A,".",$,"("),pt(j)){var be=j.length;le=p.global.def(w,".",L),Ge=p.global.def(E,".",L),Ie(Yt(be,function(Y){return le+"["+Y+"]"}),");",Yt(be,function(Y){return Ge+"["+Y+"]="+le+"["+Y+"];"}).join("")),c("if(",Yt(be,function(Y){return le+"["+Y+"]!=="+Ge+"["+Y+"]"}).join("||"),"){",Ie,"}")}else le=C.def(w,".",L),Ge=C.def(E,".",L),Ie(le,");",E,".",L,"=",le,";"),c("if(",le,"!==",Ge,"){",Ie,"}");T(Ie)}),p.compile()}(),compile:Ke}}function qx(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var Yx=34918,Zx=34919,Vc=35007,Qx=function(a,h){if(!h.ext_disjoint_timer_query)return null;var _=[];function M(){return _.pop()||h.ext_disjoint_timer_query.createQueryEXT()}function W(te){_.push(te)}var R=[];function B(te){var xe=M();h.ext_disjoint_timer_query.beginQueryEXT(Vc,xe),R.push(xe),J(R.length-1,R.length,te)}function K(){h.ext_disjoint_timer_query.endQueryEXT(Vc)}function Q(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var re=[];function ae(){return re.pop()||new Q}function oe(te){re.push(te)}var ue=[];function J(te,xe,Z){var ge=ae();ge.startQueryIndex=te,ge.endQueryIndex=xe,ge.sum=0,ge.stats=Z,ue.push(ge)}var ne=[],k=[];function G(){var te,xe,Z=R.length;if(Z!==0){k.length=Math.max(k.length,Z+1),ne.length=Math.max(ne.length,Z+1),ne[0]=0,k[0]=0;var ge=0;for(te=0,xe=0;xe<R.length;++xe){var me=R[xe];h.ext_disjoint_timer_query.getQueryObjectEXT(me,Zx)?(ge+=h.ext_disjoint_timer_query.getQueryObjectEXT(me,Yx),W(me)):R[te++]=me,ne[xe+1]=ge,k[xe+1]=te}for(R.length=te,te=0,xe=0;xe<ue.length;++xe){var De=ue[xe],X=De.startQueryIndex,H=De.endQueryIndex;De.sum+=ne[H]-ne[X];var Se=k[X],ce=k[H];ce===Se?(De.stats.gpuTime+=De.sum/1e6,oe(De)):(De.startQueryIndex=Se,De.endQueryIndex=ce,ue[te++]=De)}ue.length=te}}return{beginQuery:B,endQuery:K,pushScopeStats:J,update:G,getNumPendingQueries:function(){return R.length},clear:function(){_.push.apply(_,R);for(var te=0;te<_.length;te++)h.ext_disjoint_timer_query.deleteQueryEXT(_[te]);R.length=0,_.length=0},restore:function(){R.length=0,_.length=0}}},Kx=16384,Jx=256,eb=1024,tb=34962,$c="webglcontextlost",Hc="webglcontextrestored",Wc=1,nb=2,ib=3;function Xc(a,h){for(var _=0;_<a.length;++_)if(a[_]===h)return _;return-1}function rb(a){var h=Lt(a);if(!h)return null;var _=h.gl,M=_.getContextAttributes(),W=_.isContextLost(),R=Xn(_,h);if(!R)return null;var B=fs(),K=qx(),Q=R.extensions,re=Qx(_,Q),ae=Oi(),oe=_.drawingBufferWidth,ue=_.drawingBufferHeight,J={tick:0,time:0,viewportWidth:oe,viewportHeight:ue,framebufferWidth:oe,framebufferHeight:ue,drawingBufferWidth:oe,drawingBufferHeight:ue,pixelRatio:h.pixelRatio},ne={},k={elements:null,primitive:4,count:-1,offset:0,instances:-1},G=Hg(_,Q),te=ay(_,K,h,ge),xe=yy(_,Q,te,K),Z=yx(_,Q,G,K,te,xe,k);function ge(Fe){return Z.destroyBuffer(Fe)}var me=Sx(_,B,K,h),De=Yy(_,Q,G,function(){Se.procs.poll()},J,K,h),X=Zy(_,Q,G,K,h),H=vx(_,Q,G,De,X,K),Se=jx(_,B,Q,G,te,xe,De,H,ne,Z,me,k,J,re,h),ce=Ax(_,H,Se.procs.poll,J,M,Q,G),ee=Se.next,he=_.canvas,de=[],We=[],Ue=[],pe=[h.onDestroy],ye=null;function Re(){if(de.length===0){re&&re.update(),ye=null;return}ye=ci.next(Re),Bt();for(var Fe=de.length-1;Fe>=0;--Fe){var et=de[Fe];et&&et(J,null,0)}_.flush(),re&&re.update()}function Xe(){!ye&&de.length>0&&(ye=ci.next(Re))}function Je(){ye&&(ci.cancel(Re),ye=null)}function vt(Fe){Fe.preventDefault(),W=!0,Je(),We.forEach(function(et){et()})}function yt(Fe){_.getError(),W=!1,R.restore(),me.restore(),te.restore(),De.restore(),X.restore(),H.restore(),Z.restore(),re&&re.restore(),Se.procs.refresh(),Xe(),Ue.forEach(function(et){et()})}he&&(he.addEventListener($c,vt,!1),he.addEventListener(Hc,yt,!1));function tt(){de.length=0,Je(),he&&(he.removeEventListener($c,vt),he.removeEventListener(Hc,yt)),me.clear(),H.clear(),X.clear(),Z.clear(),De.clear(),xe.clear(),te.clear(),re&&re.clear(),pe.forEach(function(Fe){Fe()})}function Et(Fe){d(!!Fe,"invalid args to regl({...})"),d.type(Fe,"object","invalid args to regl({...})");function et(I){var A=i({},I);delete A.uniforms,delete A.attributes,delete A.context,delete A.vao,"stencil"in A&&A.stencil.op&&(A.stencil.opBack=A.stencil.opFront=A.stencil.op,delete A.stencil.op);function w(E){if(E in A){var v=A[E];delete A[E],Object.keys(v).forEach(function(b){A[E+"."+b]=v[b]})}}return w("blend"),w("depth"),w("cull"),w("stencil"),w("polygonOffset"),w("scissor"),w("sample"),"vao"in I&&(A.vao=I.vao),A}function it(I,A){var w={},E={};return Object.keys(I).forEach(function(v){var b=I[v];if(It.isDynamic(b)){E[v]=It.unbox(b,v);return}else if(A&&Array.isArray(b)){for(var g=0;g<b.length;++g)if(It.isDynamic(b[g])){E[v]=It.unbox(b,v);return}}w[v]=b}),{dynamic:E,static:w}}var bt=it(Fe.context||{},!0),Cn=it(Fe.uniforms||{},!0),wi=it(Fe.attributes||{},!1),x=it(et(Fe),!1),O={gpuTime:0,cpuTime:0,count:0},z=Se.compile(x,wi,Cn,bt,O),_e=z.draw,Ke=z.batch,p=z.scope,c=[];function T(I){for(;c.length<I;)c.push(null);return c}function C(I,A){var w;if(W&&d.raise("context lost"),typeof I=="function")return p.call(this,null,I,0);if(typeof A=="function")if(typeof I=="number")for(w=0;w<I;++w)p.call(this,null,A,w);else if(Array.isArray(I))for(w=0;w<I.length;++w)p.call(this,I[w],A,w);else return p.call(this,I,A,0);else if(typeof I=="number"){if(I>0)return Ke.call(this,T(I|0),I|0)}else if(Array.isArray(I)){if(I.length)return Ke.call(this,I,I.length)}else return _e.call(this,I)}return i(C,{stats:O,destroy:function(){z.destroy()}})}var ht=H.setFBO=Et({framebuffer:It.define.call(null,Wc,"framebuffer")});function Tt(Fe,et){var it=0;Se.procs.poll();var bt=et.color;bt&&(_.clearColor(+bt[0]||0,+bt[1]||0,+bt[2]||0,+bt[3]||0),it|=Kx),"depth"in et&&(_.clearDepth(+et.depth),it|=Jx),"stencil"in et&&(_.clearStencil(et.stencil|0),it|=eb),d(!!it,"called regl.clear with no buffer specified"),_.clear(it)}function Ct(Fe){if(d(typeof Fe=="object"&&Fe,"regl.clear() takes an object as input"),"framebuffer"in Fe)if(Fe.framebuffer&&Fe.framebuffer_reglType==="framebufferCube")for(var et=0;et<6;++et)ht(i({framebuffer:Fe.framebuffer.faces[et]},Fe),Tt);else ht(Fe,Tt);else Tt(null,Fe)}function Pt(Fe){d.type(Fe,"function","regl.frame() callback must be a function"),de.push(Fe);function et(){var it=Xc(de,Fe);d(it>=0,"cannot cancel a frame twice");function bt(){var Cn=Xc(de,bt);de[Cn]=de[de.length-1],de.length-=1,de.length<=0&&Je()}de[it]=bt}return Xe(),{cancel:et}}function zt(){var Fe=ee.viewport,et=ee.scissor_box;Fe[0]=Fe[1]=et[0]=et[1]=0,J.viewportWidth=J.framebufferWidth=J.drawingBufferWidth=Fe[2]=et[2]=_.drawingBufferWidth,J.viewportHeight=J.framebufferHeight=J.drawingBufferHeight=Fe[3]=et[3]=_.drawingBufferHeight}function Bt(){J.tick+=1,J.time=Ye(),zt(),Se.procs.poll()}function xt(){De.refresh(),zt(),Se.procs.refresh(),re&&re.update()}function Ye(){return(Oi()-ae)/1e3}xt();function Ut(Fe,et){d.type(et,"function","listener callback must be a function");var it;switch(Fe){case"frame":return Pt(et);case"lost":it=We;break;case"restore":it=Ue;break;case"destroy":it=pe;break;default:d.raise("invalid event, must be one of frame,lost,restore,destroy")}return it.push(et),{cancel:function(){for(var bt=0;bt<it.length;++bt)if(it[bt]===et){it[bt]=it[it.length-1],it.pop();return}}}}var at=i(Et,{clear:Ct,prop:It.define.bind(null,Wc),context:It.define.bind(null,nb),this:It.define.bind(null,ib),draw:Et({}),buffer:function(Fe){return te.create(Fe,tb,!1,!1)},elements:function(Fe){return xe.create(Fe,!1)},texture:De.create2D,cube:De.createCube,renderbuffer:X.create,framebuffer:H.create,framebufferCube:H.createCube,vao:Z.createVAO,attributes:M,frame:Pt,on:Ut,limits:G,hasExtension:function(Fe){return G.extensions.indexOf(Fe.toLowerCase())>=0},read:ce,destroy:tt,_gl:_,_refresh:xt,poll:function(){Bt(),re&&re.update()},now:Ye,stats:K});return h.onDone(null,at),at}return rb})}(ro)),ro.exports}var Ap=wp();const Ep=za(Ap),Cp="#b3b3b3",Pp=void 0,Ra=void 0,kp=1,Ip=4,Lp="#666666",Dp=.1,Fp=1,zp=1,Qf="#222222",Oe={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,linkArrowsSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,linkArrows:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",hoveredLinkCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",hoveredLinkColor:void 0,hoveredLinkWidthIncrease:5,focusedPointRingColor:"white",focusedPointIndex:void 0,useClassicQuadtree:!1,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,repulsionQuadtreeLevels:12,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},Rp=.7,Mp=.95,Op=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Kf,setPrototypeOf:Jf,isFrozen:Np,getPrototypeOf:Gp,getOwnPropertyDescriptor:Bp}=Object;let{freeze:Xt,seal:an,create:el}=Object,{apply:Ma,construct:Oa}=typeof Reflect<"u"&&Reflect;Xt||(Xt=function(e){return e}),an||(an=function(e){return e}),Ma||(Ma=function(e,n,i){return e.apply(n,i)}),Oa||(Oa=function(e,n){return new e(...n)});const oo=qt(Array.prototype.forEach),Up=qt(Array.prototype.lastIndexOf),tl=qt(Array.prototype.pop),ur=qt(Array.prototype.push),Vp=qt(Array.prototype.splice),ao=qt(String.prototype.toLowerCase),Na=qt(String.prototype.toString),nl=qt(String.prototype.match),cr=qt(String.prototype.replace),$p=qt(String.prototype.indexOf),Hp=qt(String.prototype.trim),mn=qt(Object.prototype.hasOwnProperty),jt=qt(RegExp.prototype.test),hr=Wp(TypeError);function qt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Ma(t,e,i)}}function Wp(t){return function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return Oa(t,n)}}function rt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ao;Jf&&Jf(t,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const o=n(r);o!==r&&(Np(e)||(e[i]=o),r=o)}t[r]=!0}return t}function Xp(t){for(let e=0;e<t.length;e++)mn(t,e)||(t[e]=null);return t}function Dn(t){const e=el(null);for(const[n,i]of Kf(t))mn(t,n)&&(Array.isArray(i)?e[n]=Xp(i):i&&typeof i=="object"&&i.constructor===Object?e[n]=Dn(i):e[n]=i);return e}function dr(t,e){for(;t!==null;){const i=Bp(t,e);if(i){if(i.get)return qt(i.get);if(typeof i.value=="function")return qt(i.value)}t=Gp(t)}function n(){return null}return n}const il=Xt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ga=Xt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ba=Xt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),jp=Xt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ua=Xt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),qp=Xt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),rl=Xt(["#text"]),ol=Xt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Va=Xt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),al=Xt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),so=Xt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yp=an(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Zp=an(/<%[\w\W]*|[\w\W]*%>/gm),Qp=an(/\$\{[\w\W]*/gm),Kp=an(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jp=an(/^aria-[\-\w]+$/),sl=an(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),e0=an(/^(?:\w+script|data):/i),t0=an(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fl=an(/^html$/i),n0=an(/^[a-z][.\w]*(-[.\w]+)+$/i);var ll=Object.freeze({__proto__:null,ARIA_ATTR:Jp,ATTR_WHITESPACE:t0,CUSTOM_ELEMENT:n0,DATA_ATTR:Kp,DOCTYPE_NAME:fl,ERB_EXPR:Zp,IS_ALLOWED_URI:sl,IS_SCRIPT_OR_DATA:e0,MUSTACHE_EXPR:Yp,TMPLIT_EXPR:Qp});const mr={element:1,text:3,progressingInstruction:7,comment:8,document:9},i0=function(){return typeof window>"u"?null:window},r0=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ul=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function cl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:i0();const e=$e=>cl($e);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==mr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:f,Element:l,NodeFilter:u,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:y,DOMParser:S,trustedTypes:D}=t,q=l.prototype,Te=dr(q,"cloneNode"),we=dr(q,"remove"),fe=dr(q,"nextSibling"),Ne=dr(q,"childNodes"),Ve=dr(q,"parentNode");if(typeof s=="function"){const $e=n.createElement("template");$e.content&&$e.content.ownerDocument&&(n=$e.content.ownerDocument)}let V,se="";const{implementation:Le,createNodeIterator:Be,createDocumentFragment:je,getElementsByTagName:nt}=n,{importNode:lt}=i;let Ee=ul();e.isSupported=typeof Kf=="function"&&typeof Ve=="function"&&Le&&Le.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ut,ERB_EXPR:ot,TMPLIT_EXPR:N,DATA_ATTR:Pe,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ke,ATTR_WHITESPACE:He,CUSTOM_ELEMENT:qe}=ll;let{IS_ALLOWED_URI:Qe}=ll,Ze=null;const dt=rt({},[...il,...Ga,...Ba,...Ua,...rl]);let ct=null;const _t=rt({},[...ol,...Va,...al,...so]);let st=Object.seal(el(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$t=null,Ht=null,Kt=!0,Mn=!0,wo=!1,Ao=!0,On=!1,si=!0,Tn=!1,Fi=!1,zi=!1,$n=!1,Mt=!1,fi=!1,li=!0,Eo=!1;const ss="user-content-";let d=!0,ui=!1,Hn={},Wn=null;const Co=rt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let wn=null;const yr=rt({},["audio","video","img","source","image","track"]);let Nn=null;const xr=rt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ri="http://www.w3.org/1998/Math/MathML",Mi="http://www.w3.org/2000/svg",sn="http://www.w3.org/1999/xhtml";let It=sn,ci=!1,Oi=null;const fs=rt({},[Ri,Mi,sn],Na);let Ni=rt({},["mi","mo","mn","ms","mtext"]),Gi=rt({},["annotation-xml"]);const ls=rt({},["title","style","font","a","script"]);let hi=null;const Po=["application/xhtml+xml","text/html"],ko="text/html";let Lt=null,Xn=null;const Yt=n.createElement("form"),Io=function(P){return P instanceof RegExp||P instanceof Function},br=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xn&&Xn===P)){if((!P||typeof P!="object")&&(P={}),P=Dn(P),hi=Po.indexOf(P.PARSER_MEDIA_TYPE)===-1?ko:P.PARSER_MEDIA_TYPE,Lt=hi==="application/xhtml+xml"?Na:ao,Ze=mn(P,"ALLOWED_TAGS")?rt({},P.ALLOWED_TAGS,Lt):dt,ct=mn(P,"ALLOWED_ATTR")?rt({},P.ALLOWED_ATTR,Lt):_t,Oi=mn(P,"ALLOWED_NAMESPACES")?rt({},P.ALLOWED_NAMESPACES,Na):fs,Nn=mn(P,"ADD_URI_SAFE_ATTR")?rt(Dn(xr),P.ADD_URI_SAFE_ATTR,Lt):xr,wn=mn(P,"ADD_DATA_URI_TAGS")?rt(Dn(yr),P.ADD_DATA_URI_TAGS,Lt):yr,Wn=mn(P,"FORBID_CONTENTS")?rt({},P.FORBID_CONTENTS,Lt):Co,$t=mn(P,"FORBID_TAGS")?rt({},P.FORBID_TAGS,Lt):Dn({}),Ht=mn(P,"FORBID_ATTR")?rt({},P.FORBID_ATTR,Lt):Dn({}),Hn=mn(P,"USE_PROFILES")?P.USE_PROFILES:!1,Kt=P.ALLOW_ARIA_ATTR!==!1,Mn=P.ALLOW_DATA_ATTR!==!1,wo=P.ALLOW_UNKNOWN_PROTOCOLS||!1,Ao=P.ALLOW_SELF_CLOSE_IN_ATTR!==!1,On=P.SAFE_FOR_TEMPLATES||!1,si=P.SAFE_FOR_XML!==!1,Tn=P.WHOLE_DOCUMENT||!1,$n=P.RETURN_DOM||!1,Mt=P.RETURN_DOM_FRAGMENT||!1,fi=P.RETURN_TRUSTED_TYPE||!1,zi=P.FORCE_BODY||!1,li=P.SANITIZE_DOM!==!1,Eo=P.SANITIZE_NAMED_PROPS||!1,d=P.KEEP_CONTENT!==!1,ui=P.IN_PLACE||!1,Qe=P.ALLOWED_URI_REGEXP||sl,It=P.NAMESPACE||sn,Ni=P.MATHML_TEXT_INTEGRATION_POINTS||Ni,Gi=P.HTML_INTEGRATION_POINTS||Gi,st=P.CUSTOM_ELEMENT_HANDLING||{},P.CUSTOM_ELEMENT_HANDLING&&Io(P.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(st.tagNameCheck=P.CUSTOM_ELEMENT_HANDLING.tagNameCheck),P.CUSTOM_ELEMENT_HANDLING&&Io(P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(st.attributeNameCheck=P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),P.CUSTOM_ELEMENT_HANDLING&&typeof P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(st.allowCustomizedBuiltInElements=P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),On&&(Mn=!1),Mt&&($n=!0),Hn&&(Ze=rt({},rl),ct=[],Hn.html===!0&&(rt(Ze,il),rt(ct,ol)),Hn.svg===!0&&(rt(Ze,Ga),rt(ct,Va),rt(ct,so)),Hn.svgFilters===!0&&(rt(Ze,Ba),rt(ct,Va),rt(ct,so)),Hn.mathMl===!0&&(rt(Ze,Ua),rt(ct,al),rt(ct,so))),P.ADD_TAGS&&(Ze===dt&&(Ze=Dn(Ze)),rt(Ze,P.ADD_TAGS,Lt)),P.ADD_ATTR&&(ct===_t&&(ct=Dn(ct)),rt(ct,P.ADD_ATTR,Lt)),P.ADD_URI_SAFE_ATTR&&rt(Nn,P.ADD_URI_SAFE_ATTR,Lt),P.FORBID_CONTENTS&&(Wn===Co&&(Wn=Dn(Wn)),rt(Wn,P.FORBID_CONTENTS,Lt)),d&&(Ze["#text"]=!0),Tn&&rt(Ze,["html","head","body"]),Ze.table&&(rt(Ze,["tbody"]),delete $t.tbody),P.TRUSTED_TYPES_POLICY){if(typeof P.TRUSTED_TYPES_POLICY.createHTML!="function")throw hr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof P.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw hr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');V=P.TRUSTED_TYPES_POLICY,se=V.createHTML("")}else V===void 0&&(V=r0(D,r)),V!==null&&typeof se=="string"&&(se=V.createHTML(""));Xt&&Xt(P),Xn=P}},Lo=rt({},[...Ga,...Ba,...jp]),Do=rt({},[...Ua,...qp]),us=function(P){let ve=Ve(P);(!ve||!ve.tagName)&&(ve={namespaceURI:It,tagName:"template"});const ze=ao(P.tagName),mt=ao(ve.tagName);return Oi[P.namespaceURI]?P.namespaceURI===Mi?ve.namespaceURI===sn?ze==="svg":ve.namespaceURI===Ri?ze==="svg"&&(mt==="annotation-xml"||Ni[mt]):!!Lo[ze]:P.namespaceURI===Ri?ve.namespaceURI===sn?ze==="math":ve.namespaceURI===Mi?ze==="math"&&Gi[mt]:!!Do[ze]:P.namespaceURI===sn?ve.namespaceURI===Mi&&!Gi[mt]||ve.namespaceURI===Ri&&!Ni[mt]?!1:!Do[ze]&&(ls[ze]||!Lo[ze]):!!(hi==="application/xhtml+xml"&&Oi[P.namespaceURI]):!1},fn=function(P){ur(e.removed,{element:P});try{Ve(P).removeChild(P)}catch{we(P)}},jn=function(P,ve){try{ur(e.removed,{attribute:ve.getAttributeNode(P),from:ve})}catch{ur(e.removed,{attribute:null,from:ve})}if(ve.removeAttribute(P),P==="is")if($n||Mt)try{fn(ve)}catch{}else try{ve.setAttribute(P,"")}catch{}},Fo=function(P){let ve=null,ze=null;if(zi)P="<remove></remove>"+P;else{const At=nl(P,/^[\r\n\t ]+/);ze=At&&At[0]}hi==="application/xhtml+xml"&&It===sn&&(P='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+P+"</body></html>");const mt=V?V.createHTML(P):P;if(It===sn)try{ve=new S().parseFromString(mt,hi)}catch{}if(!ve||!ve.documentElement){ve=Le.createDocument(It,"template",null);try{ve.documentElement.innerHTML=ci?se:mt}catch{}}const Ot=ve.body||ve.documentElement;return P&&ze&&Ot.insertBefore(n.createTextNode(ze),Ot.childNodes[0]||null),It===sn?nt.call(ve,Tn?"html":"body")[0]:Tn?ve.documentElement:Ot},_r=function(P){return Be.call(P.ownerDocument||P,P,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Bi=function(P){return P instanceof y&&(typeof P.nodeName!="string"||typeof P.textContent!="string"||typeof P.removeChild!="function"||!(P.attributes instanceof m)||typeof P.removeAttribute!="function"||typeof P.setAttribute!="function"||typeof P.namespaceURI!="string"||typeof P.insertBefore!="function"||typeof P.hasChildNodes!="function")},gt=function(P){return typeof f=="function"&&P instanceof f};function vn($e,P,ve){oo($e,ze=>{ze.call(e,P,ve,Xn)})}const zo=function(P){let ve=null;if(vn(Ee.beforeSanitizeElements,P,null),Bi(P))return fn(P),!0;const ze=Lt(P.nodeName);if(vn(Ee.uponSanitizeElement,P,{tagName:ze,allowedTags:Ze}),si&&P.hasChildNodes()&&!gt(P.firstElementChild)&&jt(/<[/\w!]/g,P.innerHTML)&&jt(/<[/\w!]/g,P.textContent)||P.nodeType===mr.progressingInstruction||si&&P.nodeType===mr.comment&&jt(/<[/\w]/g,P.data))return fn(P),!0;if(!Ze[ze]||$t[ze]){if(!$t[ze]&&Mo(ze)&&(st.tagNameCheck instanceof RegExp&&jt(st.tagNameCheck,ze)||st.tagNameCheck instanceof Function&&st.tagNameCheck(ze)))return!1;if(d&&!Wn[ze]){const mt=Ve(P)||P.parentNode,Ot=Ne(P)||P.childNodes;if(Ot&&mt){const At=Ot.length;for(let Wt=At-1;Wt>=0;--Wt){const gn=Te(Ot[Wt],!0);gn.__removalCount=(P.__removalCount||0)+1,mt.insertBefore(gn,fe(P))}}}return fn(P),!0}return P instanceof l&&!us(P)||(ze==="noscript"||ze==="noembed"||ze==="noframes")&&jt(/<\/no(script|embed|frames)/i,P.innerHTML)?(fn(P),!0):(On&&P.nodeType===mr.text&&(ve=P.textContent,oo([ut,ot,N],mt=>{ve=cr(ve,mt," ")}),P.textContent!==ve&&(ur(e.removed,{element:P.cloneNode()}),P.textContent=ve)),vn(Ee.afterSanitizeElements,P,null),!1)},Ro=function(P,ve,ze){if(li&&(ve==="id"||ve==="name")&&(ze in n||ze in Yt))return!1;if(!(Mn&&!Ht[ve]&&jt(Pe,ve))){if(!(Kt&&jt(ie,ve))){if(!ct[ve]||Ht[ve]){if(!(Mo(P)&&(st.tagNameCheck instanceof RegExp&&jt(st.tagNameCheck,P)||st.tagNameCheck instanceof Function&&st.tagNameCheck(P))&&(st.attributeNameCheck instanceof RegExp&&jt(st.attributeNameCheck,ve)||st.attributeNameCheck instanceof Function&&st.attributeNameCheck(ve))||ve==="is"&&st.allowCustomizedBuiltInElements&&(st.tagNameCheck instanceof RegExp&&jt(st.tagNameCheck,ze)||st.tagNameCheck instanceof Function&&st.tagNameCheck(ze))))return!1}else if(!Nn[ve]){if(!jt(Qe,cr(ze,He,""))){if(!((ve==="src"||ve==="xlink:href"||ve==="href")&&P!=="script"&&$p(ze,"data:")===0&&wn[P])){if(!(wo&&!jt(ke,cr(ze,He,"")))){if(ze)return!1}}}}}}return!0},Mo=function(P){return P!=="annotation-xml"&&nl(P,qe)},Oo=function(P){vn(Ee.beforeSanitizeAttributes,P,null);const{attributes:ve}=P;if(!ve||Bi(P))return;const ze={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ct,forceKeepAttr:void 0};let mt=ve.length;for(;mt--;){const Ot=ve[mt],{name:At,namespaceURI:Wt,value:gn}=Ot,di=Lt(At),Sr=gn;let Nt=At==="value"?Sr:Hp(Sr);if(ze.attrName=di,ze.attrValue=Nt,ze.keepAttr=!0,ze.forceKeepAttr=void 0,vn(Ee.uponSanitizeAttribute,P,ze),Nt=ze.attrValue,Eo&&(di==="id"||di==="name")&&(jn(At,P),Nt=ss+Nt),si&&jt(/((--!?|])>)|<\/(style|title)/i,Nt)){jn(At,P);continue}if(ze.forceKeepAttr)continue;if(!ze.keepAttr){jn(At,P);continue}if(!Ao&&jt(/\/>/i,Nt)){jn(At,P);continue}On&&oo([ut,ot,N],Go=>{Nt=cr(Nt,Go," ")});const No=Lt(P.nodeName);if(!Ro(No,di,Nt)){jn(At,P);continue}if(V&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Wt)switch(D.getAttributeType(No,di)){case"TrustedHTML":{Nt=V.createHTML(Nt);break}case"TrustedScriptURL":{Nt=V.createScriptURL(Nt);break}}if(Nt!==Sr)try{Wt?P.setAttributeNS(Wt,At,Nt):P.setAttribute(At,Nt),Bi(P)?fn(P):tl(e.removed)}catch{jn(At,P)}}vn(Ee.afterSanitizeAttributes,P,null)},cs=function $e(P){let ve=null;const ze=_r(P);for(vn(Ee.beforeSanitizeShadowDOM,P,null);ve=ze.nextNode();)vn(Ee.uponSanitizeShadowNode,ve,null),zo(ve),Oo(ve),ve.content instanceof o&&$e(ve.content);vn(Ee.afterSanitizeShadowDOM,P,null)};return e.sanitize=function($e){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=null,ze=null,mt=null,Ot=null;if(ci=!$e,ci&&($e="<!-->"),typeof $e!="string"&&!gt($e))if(typeof $e.toString=="function"){if($e=$e.toString(),typeof $e!="string")throw hr("dirty is not a string, aborting")}else throw hr("toString is not a function");if(!e.isSupported)return $e;if(Fi||br(P),e.removed=[],typeof $e=="string"&&(ui=!1),ui){if($e.nodeName){const gn=Lt($e.nodeName);if(!Ze[gn]||$t[gn])throw hr("root node is forbidden and cannot be sanitized in-place")}}else if($e instanceof f)ve=Fo("<!---->"),ze=ve.ownerDocument.importNode($e,!0),ze.nodeType===mr.element&&ze.nodeName==="BODY"||ze.nodeName==="HTML"?ve=ze:ve.appendChild(ze);else{if(!$n&&!On&&!Tn&&$e.indexOf("<")===-1)return V&&fi?V.createHTML($e):$e;if(ve=Fo($e),!ve)return $n?null:fi?se:""}ve&&zi&&fn(ve.firstChild);const At=_r(ui?$e:ve);for(;mt=At.nextNode();)zo(mt),Oo(mt),mt.content instanceof o&&cs(mt.content);if(ui)return $e;if($n){if(Mt)for(Ot=je.call(ve.ownerDocument);ve.firstChild;)Ot.appendChild(ve.firstChild);else Ot=ve;return(ct.shadowroot||ct.shadowrootmode)&&(Ot=lt.call(i,Ot,!0)),Ot}let Wt=Tn?ve.outerHTML:ve.innerHTML;return Tn&&Ze["!doctype"]&&ve.ownerDocument&&ve.ownerDocument.doctype&&ve.ownerDocument.doctype.name&&jt(fl,ve.ownerDocument.doctype.name)&&(Wt="<!DOCTYPE "+ve.ownerDocument.doctype.name+`>
|
|
9
|
-
`+Wt),On&&oo([
|
|
8
|
+
`),J=Function.apply(null,h.concat(ue));return J.apply(null,_)}return{global:K,link:M,block:W,proc:ie,scope:R,cond:B,compile:oe}}var Zi="xyzw".split(""),cc=5121,Qi=1,Gs=2,Bs=0,Us=1,Vs=2,$s=3,na=4,hc=5,dc=6,mc="dither",pc="blend.enable",vc="blend.color",Hs="blend.equation",Ws="blend.func",gc="depth.enable",yc="depth.func",xc="depth.range",bc="depth.mask",Xs="colorMask",_c="cull.enable",Sc="cull.face",js="frontFace",qs="lineWidth",Tc="polygonOffset.enable",Ys="polygonOffset.offset",wc="sample.alpha",Ac="sample.enable",Zs="sample.coverage",Ec="stencil.enable",Cc="stencil.mask",Qs="stencil.func",Ks="stencil.opFront",kr="stencil.opBack",Pc="scissor.enable",ia="scissor.box",Bn="viewport",Ir="profile",xi="framebuffer",Lr="vert",Dr="frag",bi="elements",_i="primitive",Si="count",ra="offset",oa="instances",Fr="vao",Js="Width",ef="Height",Ki=xi+Js,Ji=xi+ef,Cx=Bn+Js,Px=Bn+ef,kc="drawingBuffer",Ic=kc+Js,Lc=kc+ef,kx=[Ws,Hs,Qs,Ks,kr,Zs,Bn,ia,Ys],er=34962,tf=34963,Ix=35632,Lx=35633,Dc=3553,Dx=34067,Fx=2884,zx=3042,Rx=3024,Mx=2960,Ox=2929,Nx=3089,Gx=32823,Bx=32926,Ux=32928,nf=5126,aa=35664,sa=35665,fa=35666,rf=5124,la=35667,ua=35668,ca=35669,of=35670,ha=35671,da=35672,ma=35673,zr=35674,Rr=35675,Mr=35676,Or=35678,Nr=35680,af=4,Gr=1028,Ti=1029,Fc=2304,sf=2305,Vx=32775,$x=32776,Hx=519,Qn=7680,zc=0,Rc=1,Mc=32774,Wx=513,Oc=36160,Xx=36064,En={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Nc=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],tr={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Kn={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Gc={frag:Ix,vert:Lx},ff={cw:Fc,ccw:sf};function pa(a){return Array.isArray(a)||n(a)||yn(a)}function Bc(a){return a.sort(function(h,_){return h===Bn?-1:_===Bn?1:h<_?-1:1})}function Dt(a,h,_,M){this.thisDep=a,this.contextDep=h,this.propDep=_,this.append=M}function Jn(a){return a&&!(a.thisDep||a.contextDep||a.propDep)}function St(a){return new Dt(!1,!1,!1,a)}function Jt(a,h){var _=a.type;if(_===Bs){var M=a.data.length;return new Dt(!0,M>=1,M>=2,h)}else if(_===na){var W=a.data;return new Dt(W.thisDep,W.contextDep,W.propDep,h)}else{if(_===hc)return new Dt(!1,!1,!1,h);if(_===dc){for(var R=!1,B=!1,K=!1,Q=0;Q<a.data.length;++Q){var ie=a.data[Q];if(ie.type===Us)K=!0;else if(ie.type===Vs)B=!0;else if(ie.type===$s)R=!0;else if(ie.type===Bs){R=!0;var oe=ie.data;oe>=1&&(B=!0),oe>=2&&(K=!0)}else ie.type===na&&(R=R||ie.data.thisDep,B=B||ie.data.contextDep,K=K||ie.data.propDep)}return new Dt(R,B,K,h)}else return new Dt(_===$s,_===Vs,_===Us,h)}}var Uc=new Dt(!1,!1,!1,function(){});function jx(a,h,_,M,W,R,B,K,Q,ie,oe,re,ue,J,ne){var k=ie.Record,N={add:32774,subtract:32778,"reverse subtract":32779};_.ext_blend_minmax&&(N.min=Vx,N.max=$x);var te=_.angle_instanced_arrays,xe=_.webgl_draw_buffers,Z=_.oes_vertex_array_object,ge={dirty:!0,profile:ne.profile},me={},Le=[],X={},H={};function Se(p){return p.replace(".","_")}function ce(p,c,T){var C=Se(p);Le.push(p),me[C]=ge[C]=!!T,X[C]=c}function ee(p,c,T){var C=Se(p);Le.push(p),Array.isArray(T)?(ge[C]=T.slice(),me[C]=T.slice()):ge[C]=me[C]=T,H[C]=c}ce(mc,Rx),ce(pc,zx),ee(vc,"blendColor",[0,0,0,0]),ee(Hs,"blendEquationSeparate",[Mc,Mc]),ee(Ws,"blendFuncSeparate",[Rc,zc,Rc,zc]),ce(gc,Ox,!0),ee(yc,"depthFunc",Wx),ee(xc,"depthRange",[0,1]),ee(bc,"depthMask",!0),ee(Xs,Xs,[!0,!0,!0,!0]),ce(_c,Fx),ee(Sc,"cullFace",Ti),ee(js,js,sf),ee(qs,qs,1),ce(Tc,Gx),ee(Ys,"polygonOffset",[0,0]),ce(wc,Bx),ce(Ac,Ux),ee(Zs,"sampleCoverage",[1,!1]),ce(Ec,Mx),ee(Cc,"stencilMask",-1),ee(Qs,"stencilFunc",[Hx,0,-1]),ee(Ks,"stencilOpSeparate",[Gr,Qn,Qn,Qn]),ee(kr,"stencilOpSeparate",[Ti,Qn,Qn,Qn]),ce(Pc,Nx),ee(ia,"scissor",[0,0,a.drawingBufferWidth,a.drawingBufferHeight]),ee(Bn,Bn,[0,0,a.drawingBufferWidth,a.drawingBufferHeight]);var he={gl:a,context:ue,strings:h,next:me,current:ge,draw:re,elements:R,buffer:W,shader:oe,attributes:ie.state,vao:ie,uniforms:Q,framebuffer:K,extensions:_,timer:J,isBufferArgs:pa},de={primTypes:Yn,compareFuncs:tr,blendFuncs:En,blendEquations:N,stencilOps:Kn,glTypes:mi,orientationType:ff};m.optional(function(){he.isArrayLike=pt}),xe&&(de.backBuffer=[Ti],de.drawBuffer=Yt(M.maxDrawbuffers,function(p){return p===0?[0]:Yt(p,function(c){return Xx+c})}));var He=0;function Ue(){var p=Ex(),c=p.link,T=p.global;p.id=He++,p.batchId="0";var C=c(he),I=p.shared={props:"a0"};Object.keys(he).forEach(function(b){I[b]=T.def(C,".",b)}),m.optional(function(){p.CHECK=c(m),p.commandStr=m.guessCommand(),p.command=c(p.commandStr),p.assert=function(b,g,F){b("if(!(",g,"))",this.CHECK,".commandRaise(",c(F),",",this.command,");")},de.invalidBlendCombinations=Nc});var A=p.next={},w=p.current={};Object.keys(H).forEach(function(b){Array.isArray(ge[b])&&(A[b]=T.def(I.next,".",b),w[b]=T.def(I.current,".",b))});var E=p.constants={};Object.keys(de).forEach(function(b){E[b]=T.def(JSON.stringify(de[b]))}),p.invoke=function(b,g){switch(g.type){case Bs:var F=["this",I.context,I.props,p.batchId];return b.def(c(g.data),".call(",F.slice(0,Math.max(g.data.length+1,4)),")");case Us:return b.def(I.props,g.data);case Vs:return b.def(I.context,g.data);case $s:return b.def("this",g.data);case na:return g.data.append(p,b),g.data.ref;case hc:return g.data.toString();case dc:return g.data.map(function(L){return p.invoke(b,L)})}},p.attribCache={};var v={};return p.scopeAttrib=function(b){var g=h.id(b);if(g in v)return v[g];var F=ie.scope[g];F||(F=ie.scope[g]=new k);var L=v[g]=c(F);return L},p}function pe(p){var c=p.static,T=p.dynamic,C;if(Ir in c){var I=!!c[Ir];C=St(function(w,E){return I}),C.enable=I}else if(Ir in T){var A=T[Ir];C=Jt(A,function(w,E){return w.invoke(E,A)})}return C}function ye(p,c){var T=p.static,C=p.dynamic;if(xi in T){var I=T[xi];return I?(I=K.getFramebuffer(I),m.command(I,"invalid framebuffer object"),St(function(w,E){var v=w.link(I),b=w.shared;E.set(b.framebuffer,".next",v);var g=b.context;return E.set(g,"."+Ki,v+".width"),E.set(g,"."+Ji,v+".height"),v})):St(function(w,E){var v=w.shared;E.set(v.framebuffer,".next","null");var b=v.context;return E.set(b,"."+Ki,b+"."+Ic),E.set(b,"."+Ji,b+"."+Lc),"null"})}else if(xi in C){var A=C[xi];return Jt(A,function(w,E){var v=w.invoke(E,A),b=w.shared,g=b.framebuffer,F=E.def(g,".getFramebuffer(",v,")");m.optional(function(){w.assert(E,"!"+v+"||"+F,"invalid framebuffer object")}),E.set(g,".next",F);var L=b.context;return E.set(L,"."+Ki,F+"?"+F+".width:"+L+"."+Ic),E.set(L,"."+Ji,F+"?"+F+".height:"+L+"."+Lc),F})}else return null}function Re(p,c,T){var C=p.static,I=p.dynamic;function A(v){if(v in C){var b=C[v];m.commandType(b,"object","invalid "+v,T.commandStr);var g=!0,F=b.x|0,L=b.y|0,$,j;return"width"in b?($=b.width|0,m.command($>=0,"invalid "+v,T.commandStr)):g=!1,"height"in b?(j=b.height|0,m.command(j>=0,"invalid "+v,T.commandStr)):g=!1,new Dt(!g&&c&&c.thisDep,!g&&c&&c.contextDep,!g&&c&&c.propDep,function(ke,be){var Y=ke.shared.context,U=$;"width"in b||(U=be.def(Y,".",Ki,"-",F));var Ce=j;return"height"in b||(Ce=be.def(Y,".",Ji,"-",L)),[F,L,U,Ce]})}else if(v in I){var le=I[v],Ge=Jt(le,function(ke,be){var Y=ke.invoke(be,le);m.optional(function(){ke.assert(be,Y+"&&typeof "+Y+'==="object"',"invalid "+v)});var U=ke.shared.context,Ce=be.def(Y,".x|0"),Ae=be.def(Y,".y|0"),Me=be.def('"width" in ',Y,"?",Y,".width|0:","(",U,".",Ki,"-",Ce,")"),st=be.def('"height" in ',Y,"?",Y,".height|0:","(",U,".",Ji,"-",Ae,")");return m.optional(function(){ke.assert(be,Me+">=0&&"+st+">=0","invalid "+v)}),[Ce,Ae,Me,st]});return c&&(Ge.thisDep=Ge.thisDep||c.thisDep,Ge.contextDep=Ge.contextDep||c.contextDep,Ge.propDep=Ge.propDep||c.propDep),Ge}else return c?new Dt(c.thisDep,c.contextDep,c.propDep,function(ke,be){var Y=ke.shared.context;return[0,0,be.def(Y,".",Ki),be.def(Y,".",Ji)]}):null}var w=A(Bn);if(w){var E=w;w=new Dt(w.thisDep,w.contextDep,w.propDep,function(v,b){var g=E.append(v,b),F=v.shared.context;return b.set(F,"."+Cx,g[2]),b.set(F,"."+Px,g[3]),g})}return{viewport:w,scissor_box:A(ia)}}function We(p,c){var T=p.static,C=typeof T[Dr]=="string"&&typeof T[Lr]=="string";if(C){if(Object.keys(c.dynamic).length>0)return null;var I=c.static,A=Object.keys(I);if(A.length>0&&typeof I[A[0]]=="number"){for(var w=[],E=0;E<A.length;++E)m(typeof I[A[E]]=="number","must specify all vertex attribute locations when using vaos"),w.push([I[A[E]]|0,A[E]]);return w}}return null}function Je(p,c,T){var C=p.static,I=p.dynamic;function A(g){if(g in C){var F=h.id(C[g]);m.optional(function(){oe.shader(Gc[g],F,m.guessCommand())});var L=St(function(){return F});return L.id=F,L}else if(g in I){var $=I[g];return Jt($,function(j,le){var Ge=j.invoke(le,$),ke=le.def(j.shared.strings,".id(",Ge,")");return m.optional(function(){le(j.shared.shader,".shader(",Gc[g],",",ke,",",j.command,");")}),ke})}return null}var w=A(Dr),E=A(Lr),v=null,b;return Jn(w)&&Jn(E)?(v=oe.program(E.id,w.id,null,T),b=St(function(g,F){return g.link(v)})):b=new Dt(w&&w.thisDep||E&&E.thisDep,w&&w.contextDep||E&&E.contextDep,w&&w.propDep||E&&E.propDep,function(g,F){var L=g.shared.shader,$;w?$=w.append(g,F):$=F.def(L,".",Dr);var j;E?j=E.append(g,F):j=F.def(L,".",Lr);var le=L+".program("+j+","+$;return m.optional(function(){le+=","+g.command}),F.def(le+")")}),{frag:w,vert:E,progVar:b,program:v}}function vt(p,c){var T=p.static,C=p.dynamic,I={},A=!1;function w(){if(Fr in T){var be=T[Fr];return be!==null&&ie.getVAO(be)===null&&(be=ie.createVAO(be)),A=!0,I.vao=be,St(function(U){var Ce=ie.getVAO(be);return Ce?U.link(Ce):"null"})}else if(Fr in C){A=!0;var Y=C[Fr];return Jt(Y,function(U,Ce){var Ae=U.invoke(Ce,Y);return Ce.def(U.shared.vao+".getVAO("+Ae+")")})}return null}var E=w(),v=!1;function b(){if(bi in T){var be=T[bi];if(I.elements=be,pa(be)){var Y=I.elements=R.create(be,!0);be=R.getElements(Y),v=!0}else be&&(be=R.getElements(be),v=!0,m.command(be,"invalid elements",c.commandStr));var U=St(function(Ae,Me){if(be){var st=Ae.link(be);return Ae.ELEMENTS=st,st}return Ae.ELEMENTS=null,null});return U.value=be,U}else if(bi in C){v=!0;var Ce=C[bi];return Jt(Ce,function(Ae,Me){var st=Ae.shared,Vt=st.isBufferArgs,Ai=st.elements,Un=Ae.invoke(Me,Ce),Pn=Me.def("null"),ei=Me.def(Vt,"(",Un,")"),Ei=Ae.cond(ei).then(Pn,"=",Ai,".createStream(",Un,");").else(Pn,"=",Ai,".getElements(",Un,");");return m.optional(function(){Ae.assert(Ei.else,"!"+Un+"||"+Pn,"invalid elements")}),Me.entry(Ei),Me.exit(Ae.cond(ei).then(Ai,".destroyStream(",Pn,");")),Ae.ELEMENTS=Pn,Pn})}else if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(Ae,Me){return Me.def(Ae.shared.vao+".currentVAO?"+Ae.shared.elements+".getElements("+Ae.shared.vao+".currentVAO.elements):null")});return null}var g=b();function F(){if(_i in T){var be=T[_i];return I.primitive=be,m.commandParameter(be,Yn,"invalid primitve",c.commandStr),St(function(U,Ce){return Yn[be]})}else if(_i in C){var Y=C[_i];return Jt(Y,function(U,Ce){var Ae=U.constants.primTypes,Me=U.invoke(Ce,Y);return m.optional(function(){U.assert(Ce,Me+" in "+Ae,"invalid primitive, must be one of "+Object.keys(Yn))}),Ce.def(Ae,"[",Me,"]")})}else{if(v)return Jn(g)?g.value?St(function(U,Ce){return Ce.def(U.ELEMENTS,".primType")}):St(function(){return af}):new Dt(g.thisDep,g.contextDep,g.propDep,function(U,Ce){var Ae=U.ELEMENTS;return Ce.def(Ae,"?",Ae,".primType:",af)});if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(U,Ce){return Ce.def(U.shared.vao+".currentVAO?"+U.shared.vao+".currentVAO.primitive:"+af)})}return null}function L(be,Y){if(be in T){var U=T[be]|0;return Y?I.offset=U:I.instances=U,m.command(!Y||U>=0,"invalid "+be,c.commandStr),St(function(Ae,Me){return Y&&(Ae.OFFSET=U),U})}else if(be in C){var Ce=C[be];return Jt(Ce,function(Ae,Me){var st=Ae.invoke(Me,Ce);return Y&&(Ae.OFFSET=st,m.optional(function(){Ae.assert(Me,st+">=0","invalid "+be)})),st})}else if(Y){if(v)return St(function(Ae,Me){return Ae.OFFSET=0,0});if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(Ae,Me){return Me.def(Ae.shared.vao+".currentVAO?"+Ae.shared.vao+".currentVAO.offset:0")})}else if(A)return new Dt(E.thisDep,E.contextDep,E.propDep,function(Ae,Me){return Me.def(Ae.shared.vao+".currentVAO?"+Ae.shared.vao+".currentVAO.instances:-1")});return null}var $=L(ra,!0);function j(){if(Si in T){var be=T[Si]|0;return I.count=be,m.command(typeof be=="number"&&be>=0,"invalid vertex count",c.commandStr),St(function(){return be})}else if(Si in C){var Y=C[Si];return Jt(Y,function(Me,st){var Vt=Me.invoke(st,Y);return m.optional(function(){Me.assert(st,"typeof "+Vt+'==="number"&&'+Vt+">=0&&"+Vt+"===("+Vt+"|0)","invalid vertex count")}),Vt})}else if(v)if(Jn(g)){if(g)return $?new Dt($.thisDep,$.contextDep,$.propDep,function(Me,st){var Vt=st.def(Me.ELEMENTS,".vertCount-",Me.OFFSET);return m.optional(function(){Me.assert(st,Vt+">=0","invalid vertex offset/element buffer too small")}),Vt}):St(function(Me,st){return st.def(Me.ELEMENTS,".vertCount")});var U=St(function(){return-1});return m.optional(function(){U.MISSING=!0}),U}else{var Ce=new Dt(g.thisDep||$.thisDep,g.contextDep||$.contextDep,g.propDep||$.propDep,function(Me,st){var Vt=Me.ELEMENTS;return Me.OFFSET?st.def(Vt,"?",Vt,".vertCount-",Me.OFFSET,":-1"):st.def(Vt,"?",Vt,".vertCount:-1")});return m.optional(function(){Ce.DYNAMIC=!0}),Ce}else if(A){var Ae=new Dt(E.thisDep,E.contextDep,E.propDep,function(Me,st){return st.def(Me.shared.vao,".currentVAO?",Me.shared.vao,".currentVAO.count:-1")});return Ae}return null}var le=F(),Ge=j(),ke=L(oa,!1);return{elements:g,primitive:le,count:Ge,instances:ke,offset:$,vao:E,vaoActive:A,elementsActive:v,static:I}}function yt(p,c){var T=p.static,C=p.dynamic,I={};return Le.forEach(function(A){var w=Se(A);function E(v,b){if(A in T){var g=v(T[A]);I[w]=St(function(){return g})}else if(A in C){var F=C[A];I[w]=Jt(F,function(L,$){return b(L,$,L.invoke($,F))})}}switch(A){case _c:case pc:case mc:case Ec:case gc:case Pc:case Tc:case wc:case Ac:case bc:return E(function(v){return m.commandType(v,"boolean",A,c.commandStr),v},function(v,b,g){return m.optional(function(){v.assert(b,"typeof "+g+'==="boolean"',"invalid flag "+A,v.commandStr)}),g});case yc:return E(function(v){return m.commandParameter(v,tr,"invalid "+A,c.commandStr),tr[v]},function(v,b,g){var F=v.constants.compareFuncs;return m.optional(function(){v.assert(b,g+" in "+F,"invalid "+A+", must be one of "+Object.keys(tr))}),b.def(F,"[",g,"]")});case xc:return E(function(v){return m.command(pt(v)&&v.length===2&&typeof v[0]=="number"&&typeof v[1]=="number"&&v[0]<=v[1],"depth range is 2d array",c.commandStr),v},function(v,b,g){m.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===2&&typeof "+g+'[0]==="number"&&typeof '+g+'[1]==="number"&&'+g+"[0]<="+g+"[1]","depth range must be a 2d array")});var F=b.def("+",g,"[0]"),L=b.def("+",g,"[1]");return[F,L]});case Ws:return E(function(v){m.commandType(v,"object","blend.func",c.commandStr);var b="srcRGB"in v?v.srcRGB:v.src,g="srcAlpha"in v?v.srcAlpha:v.src,F="dstRGB"in v?v.dstRGB:v.dst,L="dstAlpha"in v?v.dstAlpha:v.dst;return m.commandParameter(b,En,w+".srcRGB",c.commandStr),m.commandParameter(g,En,w+".srcAlpha",c.commandStr),m.commandParameter(F,En,w+".dstRGB",c.commandStr),m.commandParameter(L,En,w+".dstAlpha",c.commandStr),m.command(Nc.indexOf(b+", "+F)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+b+", "+F+")",c.commandStr),[En[b],En[F],En[g],En[L]]},function(v,b,g){var F=v.constants.blendFuncs;m.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid blend func, must be an object")});function L(Y,U){var Ce=b.def('"',Y,U,'" in ',g,"?",g,".",Y,U,":",g,".",Y);return m.optional(function(){v.assert(b,Ce+" in "+F,"invalid "+A+"."+Y+U+", must be one of "+Object.keys(En))}),Ce}var $=L("src","RGB"),j=L("dst","RGB");m.optional(function(){var Y=v.constants.invalidBlendCombinations;v.assert(b,Y+".indexOf("+$+'+", "+'+j+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var le=b.def(F,"[",$,"]"),Ge=b.def(F,"[",L("src","Alpha"),"]"),ke=b.def(F,"[",j,"]"),be=b.def(F,"[",L("dst","Alpha"),"]");return[le,ke,Ge,be]});case Hs:return E(function(v){if(typeof v=="string")return m.commandParameter(v,N,"invalid "+A,c.commandStr),[N[v],N[v]];if(typeof v=="object")return m.commandParameter(v.rgb,N,A+".rgb",c.commandStr),m.commandParameter(v.alpha,N,A+".alpha",c.commandStr),[N[v.rgb],N[v.alpha]];m.commandRaise("invalid blend.equation",c.commandStr)},function(v,b,g){var F=v.constants.blendEquations,L=b.def(),$=b.def(),j=v.cond("typeof ",g,'==="string"');return m.optional(function(){function le(Ge,ke,be){v.assert(Ge,be+" in "+F,"invalid "+ke+", must be one of "+Object.keys(N))}le(j.then,A,g),v.assert(j.else,g+"&&typeof "+g+'==="object"',"invalid "+A),le(j.else,A+".rgb",g+".rgb"),le(j.else,A+".alpha",g+".alpha")}),j.then(L,"=",$,"=",F,"[",g,"];"),j.else(L,"=",F,"[",g,".rgb];",$,"=",F,"[",g,".alpha];"),b(j),[L,$]});case vc:return E(function(v){return m.command(pt(v)&&v.length===4,"blend.color must be a 4d array",c.commandStr),Yt(4,function(b){return+v[b]})},function(v,b,g){return m.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===4","blend.color must be a 4d array")}),Yt(4,function(F){return b.def("+",g,"[",F,"]")})});case Cc:return E(function(v){return m.commandType(v,"number",w,c.commandStr),v|0},function(v,b,g){return m.optional(function(){v.assert(b,"typeof "+g+'==="number"',"invalid stencil.mask")}),b.def(g,"|0")});case Qs:return E(function(v){m.commandType(v,"object",w,c.commandStr);var b=v.cmp||"keep",g=v.ref||0,F="mask"in v?v.mask:-1;return m.commandParameter(b,tr,A+".cmp",c.commandStr),m.commandType(g,"number",A+".ref",c.commandStr),m.commandType(F,"number",A+".mask",c.commandStr),[tr[b],g,F]},function(v,b,g){var F=v.constants.compareFuncs;m.optional(function(){function le(){v.assert(b,Array.prototype.join.call(arguments,""),"invalid stencil.func")}le(g+"&&typeof ",g,'==="object"'),le('!("cmp" in ',g,")||(",g,".cmp in ",F,")")});var L=b.def('"cmp" in ',g,"?",F,"[",g,".cmp]",":",Qn),$=b.def(g,".ref|0"),j=b.def('"mask" in ',g,"?",g,".mask|0:-1");return[L,$,j]});case Ks:case kr:return E(function(v){m.commandType(v,"object",w,c.commandStr);var b=v.fail||"keep",g=v.zfail||"keep",F=v.zpass||"keep";return m.commandParameter(b,Kn,A+".fail",c.commandStr),m.commandParameter(g,Kn,A+".zfail",c.commandStr),m.commandParameter(F,Kn,A+".zpass",c.commandStr),[A===kr?Ti:Gr,Kn[b],Kn[g],Kn[F]]},function(v,b,g){var F=v.constants.stencilOps;m.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid "+A)});function L($){return m.optional(function(){v.assert(b,'!("'+$+'" in '+g+")||("+g+"."+$+" in "+F+")","invalid "+A+"."+$+", must be one of "+Object.keys(Kn))}),b.def('"',$,'" in ',g,"?",F,"[",g,".",$,"]:",Qn)}return[A===kr?Ti:Gr,L("fail"),L("zfail"),L("zpass")]});case Ys:return E(function(v){m.commandType(v,"object",w,c.commandStr);var b=v.factor|0,g=v.units|0;return m.commandType(b,"number",w+".factor",c.commandStr),m.commandType(g,"number",w+".units",c.commandStr),[b,g]},function(v,b,g){m.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid "+A)});var F=b.def(g,".factor|0"),L=b.def(g,".units|0");return[F,L]});case Sc:return E(function(v){var b=0;return v==="front"?b=Gr:v==="back"&&(b=Ti),m.command(!!b,w,c.commandStr),b},function(v,b,g){return m.optional(function(){v.assert(b,g+'==="front"||'+g+'==="back"',"invalid cull.face")}),b.def(g,'==="front"?',Gr,":",Ti)});case qs:return E(function(v){return m.command(typeof v=="number"&&v>=M.lineWidthDims[0]&&v<=M.lineWidthDims[1],"invalid line width, must be a positive number between "+M.lineWidthDims[0]+" and "+M.lineWidthDims[1],c.commandStr),v},function(v,b,g){return m.optional(function(){v.assert(b,"typeof "+g+'==="number"&&'+g+">="+M.lineWidthDims[0]+"&&"+g+"<="+M.lineWidthDims[1],"invalid line width")}),g});case js:return E(function(v){return m.commandParameter(v,ff,w,c.commandStr),ff[v]},function(v,b,g){return m.optional(function(){v.assert(b,g+'==="cw"||'+g+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),b.def(g+'==="cw"?'+Fc+":"+sf)});case Xs:return E(function(v){return m.command(pt(v)&&v.length===4,"color.mask must be length 4 array",c.commandStr),v.map(function(b){return!!b})},function(v,b,g){return m.optional(function(){v.assert(b,v.shared.isArrayLike+"("+g+")&&"+g+".length===4","invalid color.mask")}),Yt(4,function(F){return"!!"+g+"["+F+"]"})});case Zs:return E(function(v){m.command(typeof v=="object"&&v,w,c.commandStr);var b="value"in v?v.value:1,g=!!v.invert;return m.command(typeof b=="number"&&b>=0&&b<=1,"sample.coverage.value must be a number between 0 and 1",c.commandStr),[b,g]},function(v,b,g){m.optional(function(){v.assert(b,g+"&&typeof "+g+'==="object"',"invalid sample.coverage")});var F=b.def('"value" in ',g,"?+",g,".value:1"),L=b.def("!!",g,".invert");return[F,L]})}}),I}function tt(p,c){var T=p.static,C=p.dynamic,I={};return Object.keys(T).forEach(function(A){var w=T[A],E;if(typeof w=="number"||typeof w=="boolean")E=St(function(){return w});else if(typeof w=="function"){var v=w._reglType;v==="texture2d"||v==="textureCube"?E=St(function(b){return b.link(w)}):v==="framebuffer"||v==="framebufferCube"?(m.command(w.color.length>0,'missing color attachment for framebuffer sent to uniform "'+A+'"',c.commandStr),E=St(function(b){return b.link(w.color[0])})):m.commandRaise('invalid data for uniform "'+A+'"',c.commandStr)}else pt(w)?E=St(function(b){var g=b.global.def("[",Yt(w.length,function(F){return m.command(typeof w[F]=="number"||typeof w[F]=="boolean","invalid uniform "+A,b.commandStr),w[F]}),"]");return g}):m.commandRaise('invalid or missing data for uniform "'+A+'"',c.commandStr);E.value=w,I[A]=E}),Object.keys(C).forEach(function(A){var w=C[A];I[A]=Jt(w,function(E,v){return E.invoke(v,w)})}),I}function Et(p,c){var T=p.static,C=p.dynamic,I={};return Object.keys(T).forEach(function(A){var w=T[A],E=h.id(A),v=new k;if(pa(w))v.state=Qi,v.buffer=W.getBuffer(W.create(w,er,!1,!0)),v.type=0;else{var b=W.getBuffer(w);if(b)v.state=Qi,v.buffer=b,v.type=0;else if(m.command(typeof w=="object"&&w,"invalid data for attribute "+A,c.commandStr),"constant"in w){var g=w.constant;v.buffer="null",v.state=Gs,typeof g=="number"?v.x=g:(m.command(pt(g)&&g.length>0&&g.length<=4,"invalid constant for attribute "+A,c.commandStr),Zi.forEach(function(ke,be){be<g.length&&(v[ke]=g[be])}))}else{pa(w.buffer)?b=W.getBuffer(W.create(w.buffer,er,!1,!0)):b=W.getBuffer(w.buffer),m.command(!!b,'missing buffer for attribute "'+A+'"',c.commandStr);var F=w.offset|0;m.command(F>=0,'invalid offset for attribute "'+A+'"',c.commandStr);var L=w.stride|0;m.command(L>=0&&L<256,'invalid stride for attribute "'+A+'", must be integer betweeen [0, 255]',c.commandStr);var $=w.size|0;m.command(!("size"in w)||$>0&&$<=4,'invalid size for attribute "'+A+'", must be 1,2,3,4',c.commandStr);var j=!!w.normalized,le=0;"type"in w&&(m.commandParameter(w.type,mi,"invalid type for attribute "+A,c.commandStr),le=mi[w.type]);var Ge=w.divisor|0;m.optional(function(){"divisor"in w&&(m.command(Ge===0||te,'cannot specify divisor for attribute "'+A+'", instancing not supported',c.commandStr),m.command(Ge>=0,'invalid divisor for attribute "'+A+'"',c.commandStr));var ke=c.commandStr,be=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(w).forEach(function(Y){m.command(be.indexOf(Y)>=0,'unknown parameter "'+Y+'" for attribute pointer "'+A+'" (valid parameters are '+be+")",ke)})}),v.buffer=b,v.state=Qi,v.size=$,v.normalized=j,v.type=le||b.dtype,v.offset=F,v.stride=L,v.divisor=Ge}}I[A]=St(function(ke,be){var Y=ke.attribCache;if(E in Y)return Y[E];var U={isStream:!1};return Object.keys(v).forEach(function(Ce){U[Ce]=v[Ce]}),v.buffer&&(U.buffer=ke.link(v.buffer),U.type=U.type||U.buffer+".dtype"),Y[E]=U,U})}),Object.keys(C).forEach(function(A){var w=C[A];function E(v,b){var g=v.invoke(b,w),F=v.shared,L=v.constants,$=F.isBufferArgs,j=F.buffer;m.optional(function(){v.assert(b,g+"&&(typeof "+g+'==="object"||typeof '+g+'==="function")&&('+$+"("+g+")||"+j+".getBuffer("+g+")||"+j+".getBuffer("+g+".buffer)||"+$+"("+g+'.buffer)||("constant" in '+g+"&&(typeof "+g+'.constant==="number"||'+F.isArrayLike+"("+g+".constant))))",'invalid dynamic attribute "'+A+'"')});var le={isStream:b.def(!1)},Ge=new k;Ge.state=Qi,Object.keys(Ge).forEach(function(U){le[U]=b.def(""+Ge[U])});var ke=le.buffer,be=le.type;b("if(",$,"(",g,")){",le.isStream,"=true;",ke,"=",j,".createStream(",er,",",g,");",be,"=",ke,".dtype;","}else{",ke,"=",j,".getBuffer(",g,");","if(",ke,"){",be,"=",ke,".dtype;",'}else if("constant" in ',g,"){",le.state,"=",Gs,";","if(typeof "+g+'.constant === "number"){',le[Zi[0]],"=",g,".constant;",Zi.slice(1).map(function(U){return le[U]}).join("="),"=0;","}else{",Zi.map(function(U,Ce){return le[U]+"="+g+".constant.length>"+Ce+"?"+g+".constant["+Ce+"]:0;"}).join(""),"}}else{","if(",$,"(",g,".buffer)){",ke,"=",j,".createStream(",er,",",g,".buffer);","}else{",ke,"=",j,".getBuffer(",g,".buffer);","}",be,'="type" in ',g,"?",L.glTypes,"[",g,".type]:",ke,".dtype;",le.normalized,"=!!",g,".normalized;");function Y(U){b(le[U],"=",g,".",U,"|0;")}return Y("size"),Y("offset"),Y("stride"),Y("divisor"),b("}}"),b.exit("if(",le.isStream,"){",j,".destroyStream(",ke,");","}"),le}I[A]=Jt(w,E)}),I}function ht(p){var c=p.static,T=p.dynamic,C={};return Object.keys(c).forEach(function(I){var A=c[I];C[I]=St(function(w,E){return typeof A=="number"||typeof A=="boolean"?""+A:w.link(A)})}),Object.keys(T).forEach(function(I){var A=T[I];C[I]=Jt(A,function(w,E){return w.invoke(E,A)})}),C}function Tt(p,c,T,C,I){var A=p.static,w=p.dynamic;m.optional(function(){var Y=[xi,Lr,Dr,bi,_i,ra,Si,oa,Ir,Fr].concat(Le);function U(Ce){Object.keys(Ce).forEach(function(Ae){m.command(Y.indexOf(Ae)>=0,'unknown parameter "'+Ae+'"',I.commandStr)})}U(A),U(w)});var E=We(p,c),v=ye(p),b=Re(p,v,I),g=vt(p,I),F=yt(p,I),L=Je(p,I,E);function $(Y){var U=b[Y];U&&(F[Y]=U)}$(Bn),$(Se(ia));var j=Object.keys(F).length>0,le={framebuffer:v,draw:g,shader:L,state:F,dirty:j,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(le.profile=pe(p),le.uniforms=tt(T,I),le.drawVAO=le.scopeVAO=g.vao,!le.drawVAO&&L.program&&!E&&_.angle_instanced_arrays&&g.static.elements){var Ge=!0,ke=L.program.attributes.map(function(Y){var U=c.static[Y];return Ge=Ge&&!!U,U});if(Ge&&ke.length>0){var be=ie.getVAO(ie.createVAO({attributes:ke,elements:g.static.elements}));le.drawVAO=new Dt(null,null,null,function(Y,U){return Y.link(be)}),le.useVAO=!0}}return E?le.useVAO=!0:le.attributes=Et(c,I),le.context=ht(C),le}function Ct(p,c,T){var C=p.shared,I=C.context,A=p.scope();Object.keys(T).forEach(function(w){c.save(I,"."+w);var E=T[w],v=E.append(p,c);Array.isArray(v)?A(I,".",w,"=[",v.join(),"];"):A(I,".",w,"=",v,";")}),c(A)}function Pt(p,c,T,C){var I=p.shared,A=I.gl,w=I.framebuffer,E;xe&&(E=c.def(I.extensions,".webgl_draw_buffers"));var v=p.constants,b=v.drawBuffer,g=v.backBuffer,F;T?F=T.append(p,c):F=c.def(w,".next"),C||c("if(",F,"!==",w,".cur){"),c("if(",F,"){",A,".bindFramebuffer(",Oc,",",F,".framebuffer);"),xe&&c(E,".drawBuffersWEBGL(",b,"[",F,".colorAttachments.length]);"),c("}else{",A,".bindFramebuffer(",Oc,",null);"),xe&&c(E,".drawBuffersWEBGL(",g,");"),c("}",w,".cur=",F,";"),C||c("}")}function zt(p,c,T){var C=p.shared,I=C.gl,A=p.current,w=p.next,E=C.current,v=C.next,b=p.cond(E,".dirty");Le.forEach(function(g){var F=Se(g);if(!(F in T.state)){var L,$;if(F in w){L=w[F],$=A[F];var j=Yt(ge[F].length,function(Ge){return b.def(L,"[",Ge,"]")});b(p.cond(j.map(function(Ge,ke){return Ge+"!=="+$+"["+ke+"]"}).join("||")).then(I,".",H[F],"(",j,");",j.map(function(Ge,ke){return $+"["+ke+"]="+Ge}).join(";"),";"))}else{L=b.def(v,".",F);var le=p.cond(L,"!==",E,".",F);b(le),F in X?le(p.cond(L).then(I,".enable(",X[F],");").else(I,".disable(",X[F],");"),E,".",F,"=",L,";"):le(I,".",H[F],"(",L,");",E,".",F,"=",L,";")}}}),Object.keys(T.state).length===0&&b(E,".dirty=false;"),c(b)}function Bt(p,c,T,C){var I=p.shared,A=p.current,w=I.current,E=I.gl;Bc(Object.keys(T)).forEach(function(v){var b=T[v];if(!(C&&!C(b))){var g=b.append(p,c);if(X[v]){var F=X[v];Jn(b)?g?c(E,".enable(",F,");"):c(E,".disable(",F,");"):c(p.cond(g).then(E,".enable(",F,");").else(E,".disable(",F,");")),c(w,".",v,"=",g,";")}else if(pt(g)){var L=A[v];c(E,".",H[v],"(",g,");",g.map(function($,j){return L+"["+j+"]="+$}).join(";"),";")}else c(E,".",H[v],"(",g,");",w,".",v,"=",g,";")}})}function xt(p,c){te&&(p.instancing=c.def(p.shared.extensions,".angle_instanced_arrays"))}function Ye(p,c,T,C,I){var A=p.shared,w=p.stats,E=A.current,v=A.timer,b=T.profile;function g(){return typeof performance>"u"?"Date.now()":"performance.now()"}var F,L;function $(Y){F=c.def(),Y(F,"=",g(),";"),typeof I=="string"?Y(w,".count+=",I,";"):Y(w,".count++;"),J&&(C?(L=c.def(),Y(L,"=",v,".getNumPendingQueries();")):Y(v,".beginQuery(",w,");"))}function j(Y){Y(w,".cpuTime+=",g(),"-",F,";"),J&&(C?Y(v,".pushScopeStats(",L,",",v,".getNumPendingQueries(),",w,");"):Y(v,".endQuery();"))}function le(Y){var U=c.def(E,".profile");c(E,".profile=",Y,";"),c.exit(E,".profile=",U,";")}var Ge;if(b){if(Jn(b)){b.enable?($(c),j(c.exit),le("true")):le("false");return}Ge=b.append(p,c),le(Ge)}else Ge=c.def(E,".profile");var ke=p.block();$(ke),c("if(",Ge,"){",ke,"}");var be=p.block();j(be),c.exit("if(",Ge,"){",be,"}")}function Ut(p,c,T,C,I){var A=p.shared;function w(v){switch(v){case aa:case la:case ha:return 2;case sa:case ua:case da:return 3;case fa:case ca:case ma:return 4;default:return 1}}function E(v,b,g){var F=A.gl,L=c.def(v,".location"),$=c.def(A.attributes,"[",L,"]"),j=g.state,le=g.buffer,Ge=[g.x,g.y,g.z,g.w],ke=["buffer","normalized","offset","stride"];function be(){c("if(!",$,".buffer){",F,".enableVertexAttribArray(",L,");}");var U=g.type,Ce;if(g.size?Ce=c.def(g.size,"||",b):Ce=b,c("if(",$,".type!==",U,"||",$,".size!==",Ce,"||",ke.map(function(Me){return $+"."+Me+"!=="+g[Me]}).join("||"),"){",F,".bindBuffer(",er,",",le,".buffer);",F,".vertexAttribPointer(",[L,Ce,U,g.normalized,g.stride,g.offset],");",$,".type=",U,";",$,".size=",Ce,";",ke.map(function(Me){return $+"."+Me+"="+g[Me]+";"}).join(""),"}"),te){var Ae=g.divisor;c("if(",$,".divisor!==",Ae,"){",p.instancing,".vertexAttribDivisorANGLE(",[L,Ae],");",$,".divisor=",Ae,";}")}}function Y(){c("if(",$,".buffer){",F,".disableVertexAttribArray(",L,");",$,".buffer=null;","}if(",Zi.map(function(U,Ce){return $+"."+U+"!=="+Ge[Ce]}).join("||"),"){",F,".vertexAttrib4f(",L,",",Ge,");",Zi.map(function(U,Ce){return $+"."+U+"="+Ge[Ce]+";"}).join(""),"}")}j===Qi?be():j===Gs?Y():(c("if(",j,"===",Qi,"){"),be(),c("}else{"),Y(),c("}"))}C.forEach(function(v){var b=v.name,g=T.attributes[b],F;if(g){if(!I(g))return;F=g.append(p,c)}else{if(!I(Uc))return;var L=p.scopeAttrib(b);m.optional(function(){p.assert(c,L+".state","missing attribute "+b)}),F={},Object.keys(new k).forEach(function($){F[$]=c.def(L,".",$)})}E(p.link(v),w(v.info.type),F)})}function ot(p,c,T,C,I,A){for(var w=p.shared,E=w.gl,v={},b,g=0;g<C.length;++g){var F=C[g],L=F.name,$=F.info.type,j=F.info.size,le=T.uniforms[L];if(j>1){if(!le)continue;var Ge=L.replace("[0]","");if(v[Ge])continue;v[Ge]=1}var ke=p.link(F),be=ke+".location",Y;if(le){if(!I(le))continue;if(Jn(le)){var U=le.value;if(m.command(U!==null&&typeof U<"u",'missing uniform "'+L+'"',p.commandStr),$===Or||$===Nr){m.command(typeof U=="function"&&($===Or&&(U._reglType==="texture2d"||U._reglType==="framebuffer")||$===Nr&&(U._reglType==="textureCube"||U._reglType==="framebufferCube")),"invalid texture for uniform "+L,p.commandStr);var Ce=p.link(U._texture||U.color[0]._texture);c(E,".uniform1i(",be,",",Ce+".bind());"),c.exit(Ce,".unbind();")}else if($===zr||$===Rr||$===Mr){m.optional(function(){m.command(pt(U),"invalid matrix for uniform "+L,p.commandStr),m.command($===zr&&U.length===4||$===Rr&&U.length===9||$===Mr&&U.length===16,"invalid length for matrix uniform "+L,p.commandStr)});var Ae=p.global.def("new Float32Array(["+Array.prototype.slice.call(U)+"])"),Me=2;$===Rr?Me=3:$===Mr&&(Me=4),c(E,".uniformMatrix",Me,"fv(",be,",false,",Ae,");")}else{switch($){case nf:j===1?m.commandType(U,"number","uniform "+L,p.commandStr):m.command(pt(U)&&U.length===j,"uniform "+L,p.commandStr),b="1f";break;case aa:m.command(pt(U)&&U.length&&U.length%2===0&&U.length<=j*2,"uniform "+L,p.commandStr),b="2f";break;case sa:m.command(pt(U)&&U.length&&U.length%3===0&&U.length<=j*3,"uniform "+L,p.commandStr),b="3f";break;case fa:m.command(pt(U)&&U.length&&U.length%4===0&&U.length<=j*4,"uniform "+L,p.commandStr),b="4f";break;case of:j===1?m.commandType(U,"boolean","uniform "+L,p.commandStr):m.command(pt(U)&&U.length===j,"uniform "+L,p.commandStr),b="1i";break;case rf:j===1?m.commandType(U,"number","uniform "+L,p.commandStr):m.command(pt(U)&&U.length===j,"uniform "+L,p.commandStr),b="1i";break;case ha:m.command(pt(U)&&U.length&&U.length%2===0&&U.length<=j*2,"uniform "+L,p.commandStr),b="2i";break;case la:m.command(pt(U)&&U.length&&U.length%2===0&&U.length<=j*2,"uniform "+L,p.commandStr),b="2i";break;case da:m.command(pt(U)&&U.length&&U.length%3===0&&U.length<=j*3,"uniform "+L,p.commandStr),b="3i";break;case ua:m.command(pt(U)&&U.length&&U.length%3===0&&U.length<=j*3,"uniform "+L,p.commandStr),b="3i";break;case ma:m.command(pt(U)&&U.length&&U.length%4===0&&U.length<=j*4,"uniform "+L,p.commandStr),b="4i";break;case ca:m.command(pt(U)&&U.length&&U.length%4===0&&U.length<=j*4,"uniform "+L,p.commandStr),b="4i";break}j>1?(b+="v",U=p.global.def("["+Array.prototype.slice.call(U)+"]")):U=pt(U)?Array.prototype.slice.call(U):U,c(E,".uniform",b,"(",be,",",U,");")}continue}else Y=le.append(p,c)}else{if(!I(Uc))continue;Y=c.def(w.uniforms,"[",h.id(L),"]")}$===Or?(m(!Array.isArray(Y),"must specify a scalar prop for textures"),c("if(",Y,"&&",Y,'._reglType==="framebuffer"){',Y,"=",Y,".color[0];","}")):$===Nr&&(m(!Array.isArray(Y),"must specify a scalar prop for cube maps"),c("if(",Y,"&&",Y,'._reglType==="framebufferCube"){',Y,"=",Y,".color[0];","}")),m.optional(function(){function on(en,va){p.assert(c,en,'bad data or missing for uniform "'+L+'". '+va)}function Ci(en,va){va===1&&m(!Array.isArray(Y),"must not specify an array type for uniform"),on("Array.isArray("+Y+") && typeof "+Y+'[0]===" '+en+'" || typeof '+Y+'==="'+en+'"',"invalid type, expected "+en)}function un(en,va,ga){Array.isArray(Y)?m(Y.length&&Y.length%en===0&&Y.length<=en*ga,"must have length of "+(ga===1?"":"n * ")+en):on(w.isArrayLike+"("+Y+")&&"+Y+".length && "+Y+".length % "+en+" === 0 && "+Y+".length<="+en*ga,"invalid vector, should have length of "+(ga===1?"":"n * ")+en,p.commandStr)}function qc(en){m(!Array.isArray(Y),"must not specify a value type"),on("typeof "+Y+'==="function"&&'+Y+'._reglType==="texture'+(en===Dc?"2d":"Cube")+'"',"invalid texture type",p.commandStr)}switch($){case rf:Ci("number",j);break;case la:un(2,"number",j);break;case ua:un(3,"number",j);break;case ca:un(4,"number",j);break;case nf:Ci("number",j);break;case aa:un(2,"number",j);break;case sa:un(3,"number",j);break;case fa:un(4,"number",j);break;case of:Ci("boolean",j);break;case ha:un(2,"boolean",j);break;case da:un(3,"boolean",j);break;case ma:un(4,"boolean",j);break;case zr:un(4,"number",j);break;case Rr:un(9,"number",j);break;case Mr:un(16,"number",j);break;case Or:qc(Dc);break;case Nr:qc(Dx);break}});var st=1;switch($){case Or:case Nr:var Vt=c.def(Y,"._texture");c(E,".uniform1i(",be,",",Vt,".bind());"),c.exit(Vt,".unbind();");continue;case rf:case of:b="1i";break;case la:case ha:b="2i",st=2;break;case ua:case da:b="3i",st=3;break;case ca:case ma:b="4i",st=4;break;case nf:b="1f";break;case aa:b="2f",st=2;break;case sa:b="3f",st=3;break;case fa:b="4f",st=4;break;case zr:b="Matrix2fv";break;case Rr:b="Matrix3fv";break;case Mr:b="Matrix4fv";break}if(b.indexOf("Matrix")===-1&&j>1&&(b+="v",st=1),b.charAt(0)==="M"){c(E,".uniform",b,"(",be,",");var Ai=Math.pow($-zr+2,2),Un=p.global.def("new Float32Array(",Ai,")");Array.isArray(Y)?c("false,(",Yt(Ai,function(on){return Un+"["+on+"]="+Y[on]}),",",Un,")"):c("false,(Array.isArray(",Y,")||",Y," instanceof Float32Array)?",Y,":(",Yt(Ai,function(on){return Un+"["+on+"]="+Y+"["+on+"]"}),",",Un,")"),c(");")}else if(st>1){for(var Pn=[],ei=[],Ei=0;Ei<st;++Ei)Array.isArray(Y)?ei.push(Y[Ei]):ei.push(c.def(Y+"["+Ei+"]")),A&&Pn.push(c.def());A&&c("if(!",p.batchId,"||",Pn.map(function(on,Ci){return on+"!=="+ei[Ci]}).join("||"),"){",Pn.map(function(on,Ci){return on+"="+ei[Ci]+";"}).join("")),c(E,".uniform",b,"(",be,",",ei.join(","),");"),A&&c("}")}else{if(m(!Array.isArray(Y),"uniform value must not be an array"),A){var jc=c.def();c("if(!",p.batchId,"||",jc,"!==",Y,"){",jc,"=",Y,";")}c(E,".uniform",b,"(",be,",",Y,");"),A&&c("}")}}}function Fe(p,c,T,C){var I=p.shared,A=I.gl,w=I.draw,E=C.draw;function v(){var Ce=E.elements,Ae,Me=c;return Ce?((Ce.contextDep&&C.contextDynamic||Ce.propDep)&&(Me=T),Ae=Ce.append(p,Me),E.elementsActive&&Me("if("+Ae+")"+A+".bindBuffer("+tf+","+Ae+".buffer.buffer);")):(Ae=Me.def(),Me(Ae,"=",w,".",bi,";","if(",Ae,"){",A,".bindBuffer(",tf,",",Ae,".buffer.buffer);}","else if(",I.vao,".currentVAO){",Ae,"=",p.shared.elements+".getElements("+I.vao,".currentVAO.elements);",Z?"":"if("+Ae+")"+A+".bindBuffer("+tf+","+Ae+".buffer.buffer);","}")),Ae}function b(){var Ce=E.count,Ae,Me=c;return Ce?((Ce.contextDep&&C.contextDynamic||Ce.propDep)&&(Me=T),Ae=Ce.append(p,Me),m.optional(function(){Ce.MISSING&&p.assert(c,"false","missing vertex count"),Ce.DYNAMIC&&p.assert(Me,Ae+">=0","missing vertex count")})):(Ae=Me.def(w,".",Si),m.optional(function(){p.assert(Me,Ae+">=0","missing vertex count")})),Ae}var g=v();function F(Ce){var Ae=E[Ce];return Ae?Ae.contextDep&&C.contextDynamic||Ae.propDep?Ae.append(p,T):Ae.append(p,c):c.def(w,".",Ce)}var L=F(_i),$=F(ra),j=b();if(typeof j=="number"){if(j===0)return}else T("if(",j,"){"),T.exit("}");var le,Ge;te&&(le=F(oa),Ge=p.instancing);var ke=g+".type",be=E.elements&&Jn(E.elements)&&!E.vaoActive;function Y(){function Ce(){T(Ge,".drawElementsInstancedANGLE(",[L,j,ke,$+"<<(("+ke+"-"+cc+")>>1)",le],");")}function Ae(){T(Ge,".drawArraysInstancedANGLE(",[L,$,j,le],");")}g&&g!=="null"?be?Ce():(T("if(",g,"){"),Ce(),T("}else{"),Ae(),T("}")):Ae()}function U(){function Ce(){T(A+".drawElements("+[L,j,ke,$+"<<(("+ke+"-"+cc+")>>1)"]+");")}function Ae(){T(A+".drawArrays("+[L,$,j]+");")}g&&g!=="null"?be?Ce():(T("if(",g,"){"),Ce(),T("}else{"),Ae(),T("}")):Ae()}te&&(typeof le!="number"||le>=0)?typeof le=="string"?(T("if(",le,">0){"),Y(),T("}else if(",le,"<0){"),U(),T("}")):Y():U()}function et(p,c,T,C,I){var A=Ue(),w=A.proc("body",I);return m.optional(function(){A.commandStr=c.commandStr,A.command=A.link(c.commandStr)}),te&&(A.instancing=w.def(A.shared.extensions,".angle_instanced_arrays")),p(A,w,T,C),A.compile().body}function it(p,c,T,C){xt(p,c),T.useVAO?T.drawVAO?c(p.shared.vao,".setVAO(",T.drawVAO.append(p,c),");"):c(p.shared.vao,".setVAO(",p.shared.vao,".targetVAO);"):(c(p.shared.vao,".setVAO(null);"),Ut(p,c,T,C.attributes,function(){return!0})),ot(p,c,T,C.uniforms,function(){return!0},!1),Fe(p,c,c,T)}function bt(p,c){var T=p.proc("draw",1);xt(p,T),Ct(p,T,c.context),Pt(p,T,c.framebuffer),zt(p,T,c),Bt(p,T,c.state),Ye(p,T,c,!1,!0);var C=c.shader.progVar.append(p,T);if(T(p.shared.gl,".useProgram(",C,".program);"),c.shader.program)it(p,T,c,c.shader.program);else{T(p.shared.vao,".setVAO(null);");var I=p.global.def("{}"),A=T.def(C,".id"),w=T.def(I,"[",A,"]");T(p.cond(w).then(w,".call(this,a0);").else(w,"=",I,"[",A,"]=",p.link(function(E){return et(it,p,c,E,1)}),"(",C,");",w,".call(this,a0);"))}Object.keys(c.state).length>0&&T(p.shared.current,".dirty=true;"),p.shared.vao&&T(p.shared.vao,".setVAO(null);")}function Cn(p,c,T,C){p.batchId="a1",xt(p,c);function I(){return!0}Ut(p,c,T,C.attributes,I),ot(p,c,T,C.uniforms,I,!1),Fe(p,c,c,T)}function wi(p,c,T,C){xt(p,c);var I=T.contextDep,A=c.def(),w="a0",E="a1",v=c.def();p.shared.props=v,p.batchId=A;var b=p.scope(),g=p.scope();c(b.entry,"for(",A,"=0;",A,"<",E,";++",A,"){",v,"=",w,"[",A,"];",g,"}",b.exit);function F(ke){return ke.contextDep&&I||ke.propDep}function L(ke){return!F(ke)}if(T.needsContext&&Ct(p,g,T.context),T.needsFramebuffer&&Pt(p,g,T.framebuffer),Bt(p,g,T.state,F),T.profile&&F(T.profile)&&Ye(p,g,T,!1,!0),C)T.useVAO?T.drawVAO?F(T.drawVAO)?g(p.shared.vao,".setVAO(",T.drawVAO.append(p,g),");"):b(p.shared.vao,".setVAO(",T.drawVAO.append(p,b),");"):b(p.shared.vao,".setVAO(",p.shared.vao,".targetVAO);"):(b(p.shared.vao,".setVAO(null);"),Ut(p,b,T,C.attributes,L),Ut(p,g,T,C.attributes,F)),ot(p,b,T,C.uniforms,L,!1),ot(p,g,T,C.uniforms,F,!0),Fe(p,b,g,T);else{var $=p.global.def("{}"),j=T.shader.progVar.append(p,g),le=g.def(j,".id"),Ge=g.def($,"[",le,"]");g(p.shared.gl,".useProgram(",j,".program);","if(!",Ge,"){",Ge,"=",$,"[",le,"]=",p.link(function(ke){return et(Cn,p,T,ke,2)}),"(",j,");}",Ge,".call(this,a0[",A,"],",A,");")}}function x(p,c){var T=p.proc("batch",2);p.batchId="0",xt(p,T);var C=!1,I=!0;Object.keys(c.context).forEach(function($){C=C||c.context[$].propDep}),C||(Ct(p,T,c.context),I=!1);var A=c.framebuffer,w=!1;A?(A.propDep?C=w=!0:A.contextDep&&C&&(w=!0),w||Pt(p,T,A)):Pt(p,T,null),c.state.viewport&&c.state.viewport.propDep&&(C=!0);function E($){return $.contextDep&&C||$.propDep}zt(p,T,c),Bt(p,T,c.state,function($){return!E($)}),(!c.profile||!E(c.profile))&&Ye(p,T,c,!1,"a1"),c.contextDep=C,c.needsContext=I,c.needsFramebuffer=w;var v=c.shader.progVar;if(v.contextDep&&C||v.propDep)wi(p,T,c,null);else{var b=v.append(p,T);if(T(p.shared.gl,".useProgram(",b,".program);"),c.shader.program)wi(p,T,c,c.shader.program);else{T(p.shared.vao,".setVAO(null);");var g=p.global.def("{}"),F=T.def(b,".id"),L=T.def(g,"[",F,"]");T(p.cond(L).then(L,".call(this,a0,a1);").else(L,"=",g,"[",F,"]=",p.link(function($){return et(wi,p,c,$,2)}),"(",b,");",L,".call(this,a0,a1);"))}}Object.keys(c.state).length>0&&T(p.shared.current,".dirty=true;"),p.shared.vao&&T(p.shared.vao,".setVAO(null);")}function O(p,c){var T=p.proc("scope",3);p.batchId="a2";var C=p.shared,I=C.current;Ct(p,T,c.context),c.framebuffer&&c.framebuffer.append(p,T),Bc(Object.keys(c.state)).forEach(function(w){var E=c.state[w],v=E.append(p,T);pt(v)?v.forEach(function(b,g){T.set(p.next[w],"["+g+"]",b)}):T.set(C.next,"."+w,v)}),Ye(p,T,c,!0,!0),[bi,ra,Si,oa,_i].forEach(function(w){var E=c.draw[w];E&&T.set(C.draw,"."+w,""+E.append(p,T))}),Object.keys(c.uniforms).forEach(function(w){var E=c.uniforms[w].append(p,T);Array.isArray(E)&&(E="["+E.join()+"]"),T.set(C.uniforms,"["+h.id(w)+"]",E)}),Object.keys(c.attributes).forEach(function(w){var E=c.attributes[w].append(p,T),v=p.scopeAttrib(w);Object.keys(new k).forEach(function(b){T.set(v,"."+b,E[b])})}),c.scopeVAO&&T.set(C.vao,".targetVAO",c.scopeVAO.append(p,T));function A(w){var E=c.shader[w];E&&T.set(C.shader,"."+w,E.append(p,T))}A(Lr),A(Dr),Object.keys(c.state).length>0&&(T(I,".dirty=true;"),T.exit(I,".dirty=true;")),T("a1(",p.shared.context,",a0,",p.batchId,");")}function z(p){if(!(typeof p!="object"||pt(p))){for(var c=Object.keys(p),T=0;T<c.length;++T)if(It.isDynamic(p[c[T]]))return!0;return!1}}function _e(p,c,T){var C=c.static[T];if(!C||!z(C))return;var I=p.global,A=Object.keys(C),w=!1,E=!1,v=!1,b=p.global.def("{}");A.forEach(function(F){var L=C[F];if(It.isDynamic(L)){typeof L=="function"&&(L=C[F]=It.unbox(L));var $=Jt(L,null);w=w||$.thisDep,v=v||$.propDep,E=E||$.contextDep}else{switch(I(b,".",F,"="),typeof L){case"number":I(L);break;case"string":I('"',L,'"');break;case"object":Array.isArray(L)&&I("[",L.join(),"]");break;default:I(p.link(L));break}I(";")}});function g(F,L){A.forEach(function($){var j=C[$];if(It.isDynamic(j)){var le=F.invoke(L,j);L(b,".",$,"=",le,";")}})}c.dynamic[T]=new It.DynamicVariable(na,{thisDep:w,contextDep:E,propDep:v,ref:b,append:g}),delete c.static[T]}function Ke(p,c,T,C,I){var A=Ue();A.stats=A.link(I),Object.keys(c.static).forEach(function(E){_e(A,c,E)}),kx.forEach(function(E){_e(A,p,E)});var w=Tt(p,c,T,C,A);return bt(A,w),O(A,w),x(A,w),i(A.compile(),{destroy:function(){w.shader.program.destroy()}})}return{next:me,current:ge,procs:function(){var p=Ue(),c=p.proc("poll"),T=p.proc("refresh"),C=p.block();c(C),T(C);var I=p.shared,A=I.gl,w=I.next,E=I.current;C(E,".dirty=false;"),Pt(p,c),Pt(p,T,null,!0);var v;te&&(v=p.link(te)),_.oes_vertex_array_object&&T(p.link(_.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var b=0;b<M.maxAttributes;++b){var g=T.def(I.attributes,"[",b,"]"),F=p.cond(g,".buffer");F.then(A,".enableVertexAttribArray(",b,");",A,".bindBuffer(",er,",",g,".buffer.buffer);",A,".vertexAttribPointer(",b,",",g,".size,",g,".type,",g,".normalized,",g,".stride,",g,".offset);").else(A,".disableVertexAttribArray(",b,");",A,".vertexAttrib4f(",b,",",g,".x,",g,".y,",g,".z,",g,".w);",g,".buffer=null;"),T(F),te&&T(v,".vertexAttribDivisorANGLE(",b,",",g,".divisor);")}return T(p.shared.vao,".currentVAO=null;",p.shared.vao,".setVAO(",p.shared.vao,".targetVAO);"),Object.keys(X).forEach(function(L){var $=X[L],j=C.def(w,".",L),le=p.block();le("if(",j,"){",A,".enable(",$,")}else{",A,".disable(",$,")}",E,".",L,"=",j,";"),T(le),c("if(",j,"!==",E,".",L,"){",le,"}")}),Object.keys(H).forEach(function(L){var $=H[L],j=ge[L],le,Ge,ke=p.block();if(ke(A,".",$,"("),pt(j)){var be=j.length;le=p.global.def(w,".",L),Ge=p.global.def(E,".",L),ke(Yt(be,function(Y){return le+"["+Y+"]"}),");",Yt(be,function(Y){return Ge+"["+Y+"]="+le+"["+Y+"];"}).join("")),c("if(",Yt(be,function(Y){return le+"["+Y+"]!=="+Ge+"["+Y+"]"}).join("||"),"){",ke,"}")}else le=C.def(w,".",L),Ge=C.def(E,".",L),ke(le,");",E,".",L,"=",le,";"),c("if(",le,"!==",Ge,"){",ke,"}");T(ke)}),p.compile()}(),compile:Ke}}function qx(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var Yx=34918,Zx=34919,Vc=35007,Qx=function(a,h){if(!h.ext_disjoint_timer_query)return null;var _=[];function M(){return _.pop()||h.ext_disjoint_timer_query.createQueryEXT()}function W(te){_.push(te)}var R=[];function B(te){var xe=M();h.ext_disjoint_timer_query.beginQueryEXT(Vc,xe),R.push(xe),J(R.length-1,R.length,te)}function K(){h.ext_disjoint_timer_query.endQueryEXT(Vc)}function Q(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var ie=[];function oe(){return ie.pop()||new Q}function re(te){ie.push(te)}var ue=[];function J(te,xe,Z){var ge=oe();ge.startQueryIndex=te,ge.endQueryIndex=xe,ge.sum=0,ge.stats=Z,ue.push(ge)}var ne=[],k=[];function N(){var te,xe,Z=R.length;if(Z!==0){k.length=Math.max(k.length,Z+1),ne.length=Math.max(ne.length,Z+1),ne[0]=0,k[0]=0;var ge=0;for(te=0,xe=0;xe<R.length;++xe){var me=R[xe];h.ext_disjoint_timer_query.getQueryObjectEXT(me,Zx)?(ge+=h.ext_disjoint_timer_query.getQueryObjectEXT(me,Yx),W(me)):R[te++]=me,ne[xe+1]=ge,k[xe+1]=te}for(R.length=te,te=0,xe=0;xe<ue.length;++xe){var Le=ue[xe],X=Le.startQueryIndex,H=Le.endQueryIndex;Le.sum+=ne[H]-ne[X];var Se=k[X],ce=k[H];ce===Se?(Le.stats.gpuTime+=Le.sum/1e6,re(Le)):(Le.startQueryIndex=Se,Le.endQueryIndex=ce,ue[te++]=Le)}ue.length=te}}return{beginQuery:B,endQuery:K,pushScopeStats:J,update:N,getNumPendingQueries:function(){return R.length},clear:function(){_.push.apply(_,R);for(var te=0;te<_.length;te++)h.ext_disjoint_timer_query.deleteQueryEXT(_[te]);R.length=0,_.length=0},restore:function(){R.length=0,_.length=0}}},Kx=16384,Jx=256,eb=1024,tb=34962,$c="webglcontextlost",Hc="webglcontextrestored",Wc=1,nb=2,ib=3;function Xc(a,h){for(var _=0;_<a.length;++_)if(a[_]===h)return _;return-1}function rb(a){var h=Lt(a);if(!h)return null;var _=h.gl,M=_.getContextAttributes(),W=_.isContextLost(),R=Xn(_,h);if(!R)return null;var B=fs(),K=qx(),Q=R.extensions,ie=Qx(_,Q),oe=Oi(),re=_.drawingBufferWidth,ue=_.drawingBufferHeight,J={tick:0,time:0,viewportWidth:re,viewportHeight:ue,framebufferWidth:re,framebufferHeight:ue,drawingBufferWidth:re,drawingBufferHeight:ue,pixelRatio:h.pixelRatio},ne={},k={elements:null,primitive:4,count:-1,offset:0,instances:-1},N=Hg(_,Q),te=ay(_,K,h,ge),xe=yy(_,Q,te,K),Z=yx(_,Q,N,K,te,xe,k);function ge(Fe){return Z.destroyBuffer(Fe)}var me=Sx(_,B,K,h),Le=Yy(_,Q,N,function(){Se.procs.poll()},J,K,h),X=Zy(_,Q,N,K,h),H=vx(_,Q,N,Le,X,K),Se=jx(_,B,Q,N,te,xe,Le,H,ne,Z,me,k,J,ie,h),ce=Ax(_,H,Se.procs.poll,J,M,Q,N),ee=Se.next,he=_.canvas,de=[],He=[],Ue=[],pe=[h.onDestroy],ye=null;function Re(){if(de.length===0){ie&&ie.update(),ye=null;return}ye=ci.next(Re),Bt();for(var Fe=de.length-1;Fe>=0;--Fe){var et=de[Fe];et&&et(J,null,0)}_.flush(),ie&&ie.update()}function We(){!ye&&de.length>0&&(ye=ci.next(Re))}function Je(){ye&&(ci.cancel(Re),ye=null)}function vt(Fe){Fe.preventDefault(),W=!0,Je(),He.forEach(function(et){et()})}function yt(Fe){_.getError(),W=!1,R.restore(),me.restore(),te.restore(),Le.restore(),X.restore(),H.restore(),Z.restore(),ie&&ie.restore(),Se.procs.refresh(),We(),Ue.forEach(function(et){et()})}he&&(he.addEventListener($c,vt,!1),he.addEventListener(Hc,yt,!1));function tt(){de.length=0,Je(),he&&(he.removeEventListener($c,vt),he.removeEventListener(Hc,yt)),me.clear(),H.clear(),X.clear(),Z.clear(),Le.clear(),xe.clear(),te.clear(),ie&&ie.clear(),pe.forEach(function(Fe){Fe()})}function Et(Fe){m(!!Fe,"invalid args to regl({...})"),m.type(Fe,"object","invalid args to regl({...})");function et(I){var A=i({},I);delete A.uniforms,delete A.attributes,delete A.context,delete A.vao,"stencil"in A&&A.stencil.op&&(A.stencil.opBack=A.stencil.opFront=A.stencil.op,delete A.stencil.op);function w(E){if(E in A){var v=A[E];delete A[E],Object.keys(v).forEach(function(b){A[E+"."+b]=v[b]})}}return w("blend"),w("depth"),w("cull"),w("stencil"),w("polygonOffset"),w("scissor"),w("sample"),"vao"in I&&(A.vao=I.vao),A}function it(I,A){var w={},E={};return Object.keys(I).forEach(function(v){var b=I[v];if(It.isDynamic(b)){E[v]=It.unbox(b,v);return}else if(A&&Array.isArray(b)){for(var g=0;g<b.length;++g)if(It.isDynamic(b[g])){E[v]=It.unbox(b,v);return}}w[v]=b}),{dynamic:E,static:w}}var bt=it(Fe.context||{},!0),Cn=it(Fe.uniforms||{},!0),wi=it(Fe.attributes||{},!1),x=it(et(Fe),!1),O={gpuTime:0,cpuTime:0,count:0},z=Se.compile(x,wi,Cn,bt,O),_e=z.draw,Ke=z.batch,p=z.scope,c=[];function T(I){for(;c.length<I;)c.push(null);return c}function C(I,A){var w;if(W&&m.raise("context lost"),typeof I=="function")return p.call(this,null,I,0);if(typeof A=="function")if(typeof I=="number")for(w=0;w<I;++w)p.call(this,null,A,w);else if(Array.isArray(I))for(w=0;w<I.length;++w)p.call(this,I[w],A,w);else return p.call(this,I,A,0);else if(typeof I=="number"){if(I>0)return Ke.call(this,T(I|0),I|0)}else if(Array.isArray(I)){if(I.length)return Ke.call(this,I,I.length)}else return _e.call(this,I)}return i(C,{stats:O,destroy:function(){z.destroy()}})}var ht=H.setFBO=Et({framebuffer:It.define.call(null,Wc,"framebuffer")});function Tt(Fe,et){var it=0;Se.procs.poll();var bt=et.color;bt&&(_.clearColor(+bt[0]||0,+bt[1]||0,+bt[2]||0,+bt[3]||0),it|=Kx),"depth"in et&&(_.clearDepth(+et.depth),it|=Jx),"stencil"in et&&(_.clearStencil(et.stencil|0),it|=eb),m(!!it,"called regl.clear with no buffer specified"),_.clear(it)}function Ct(Fe){if(m(typeof Fe=="object"&&Fe,"regl.clear() takes an object as input"),"framebuffer"in Fe)if(Fe.framebuffer&&Fe.framebuffer_reglType==="framebufferCube")for(var et=0;et<6;++et)ht(i({framebuffer:Fe.framebuffer.faces[et]},Fe),Tt);else ht(Fe,Tt);else Tt(null,Fe)}function Pt(Fe){m.type(Fe,"function","regl.frame() callback must be a function"),de.push(Fe);function et(){var it=Xc(de,Fe);m(it>=0,"cannot cancel a frame twice");function bt(){var Cn=Xc(de,bt);de[Cn]=de[de.length-1],de.length-=1,de.length<=0&&Je()}de[it]=bt}return We(),{cancel:et}}function zt(){var Fe=ee.viewport,et=ee.scissor_box;Fe[0]=Fe[1]=et[0]=et[1]=0,J.viewportWidth=J.framebufferWidth=J.drawingBufferWidth=Fe[2]=et[2]=_.drawingBufferWidth,J.viewportHeight=J.framebufferHeight=J.drawingBufferHeight=Fe[3]=et[3]=_.drawingBufferHeight}function Bt(){J.tick+=1,J.time=Ye(),zt(),Se.procs.poll()}function xt(){Le.refresh(),zt(),Se.procs.refresh(),ie&&ie.update()}function Ye(){return(Oi()-oe)/1e3}xt();function Ut(Fe,et){m.type(et,"function","listener callback must be a function");var it;switch(Fe){case"frame":return Pt(et);case"lost":it=He;break;case"restore":it=Ue;break;case"destroy":it=pe;break;default:m.raise("invalid event, must be one of frame,lost,restore,destroy")}return it.push(et),{cancel:function(){for(var bt=0;bt<it.length;++bt)if(it[bt]===et){it[bt]=it[it.length-1],it.pop();return}}}}var ot=i(Et,{clear:Ct,prop:It.define.bind(null,Wc),context:It.define.bind(null,nb),this:It.define.bind(null,ib),draw:Et({}),buffer:function(Fe){return te.create(Fe,tb,!1,!1)},elements:function(Fe){return xe.create(Fe,!1)},texture:Le.create2D,cube:Le.createCube,renderbuffer:X.create,framebuffer:H.create,framebufferCube:H.createCube,vao:Z.createVAO,attributes:M,frame:Pt,on:Ut,limits:N,hasExtension:function(Fe){return N.extensions.indexOf(Fe.toLowerCase())>=0},read:ce,destroy:tt,_gl:_,_refresh:xt,poll:function(){Bt(),ie&&ie.update()},now:Ye,stats:K});return h.onDone(null,ot),ot}return rb})}(ro)),ro.exports}var Ap=wp();const Ep=za(Ap),Cp="#b3b3b3",Pp=void 0,Ra=void 0,kp=1,Ip=4,Lp="#666666",Dp=.1,Fp=1,zp=1,Qf="#222222",Oe={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,linkArrowsSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,linkArrows:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",hoveredLinkCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",hoveredLinkColor:void 0,hoveredLinkWidthIncrease:5,focusedPointRingColor:"white",focusedPointIndex:void 0,useClassicQuadtree:!1,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,repulsionQuadtreeLevels:12,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},Rp=.7,Mp=.95,Op=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Kf,setPrototypeOf:Jf,isFrozen:Np,getPrototypeOf:Gp,getOwnPropertyDescriptor:Bp}=Object;let{freeze:Xt,seal:an,create:el}=Object,{apply:Ma,construct:Oa}=typeof Reflect<"u"&&Reflect;Xt||(Xt=function(e){return e}),an||(an=function(e){return e}),Ma||(Ma=function(e,n,i){return e.apply(n,i)}),Oa||(Oa=function(e,n){return new e(...n)});const oo=qt(Array.prototype.forEach),Up=qt(Array.prototype.lastIndexOf),tl=qt(Array.prototype.pop),ur=qt(Array.prototype.push),Vp=qt(Array.prototype.splice),ao=qt(String.prototype.toLowerCase),Na=qt(String.prototype.toString),nl=qt(String.prototype.match),cr=qt(String.prototype.replace),$p=qt(String.prototype.indexOf),Hp=qt(String.prototype.trim),mn=qt(Object.prototype.hasOwnProperty),jt=qt(RegExp.prototype.test),hr=Wp(TypeError);function qt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Ma(t,e,i)}}function Wp(t){return function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return Oa(t,n)}}function rt(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ao;Jf&&Jf(t,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const o=n(r);o!==r&&(Np(e)||(e[i]=o),r=o)}t[r]=!0}return t}function Xp(t){for(let e=0;e<t.length;e++)mn(t,e)||(t[e]=null);return t}function Dn(t){const e=el(null);for(const[n,i]of Kf(t))mn(t,n)&&(Array.isArray(i)?e[n]=Xp(i):i&&typeof i=="object"&&i.constructor===Object?e[n]=Dn(i):e[n]=i);return e}function dr(t,e){for(;t!==null;){const i=Bp(t,e);if(i){if(i.get)return qt(i.get);if(typeof i.value=="function")return qt(i.value)}t=Gp(t)}function n(){return null}return n}const il=Xt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ga=Xt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ba=Xt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),jp=Xt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ua=Xt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),qp=Xt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),rl=Xt(["#text"]),ol=Xt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Va=Xt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),al=Xt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),so=Xt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yp=an(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Zp=an(/<%[\w\W]*|[\w\W]*%>/gm),Qp=an(/\$\{[\w\W]*/gm),Kp=an(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jp=an(/^aria-[\-\w]+$/),sl=an(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),e0=an(/^(?:\w+script|data):/i),t0=an(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fl=an(/^html$/i),n0=an(/^[a-z][.\w]*(-[.\w]+)+$/i);var ll=Object.freeze({__proto__:null,ARIA_ATTR:Jp,ATTR_WHITESPACE:t0,CUSTOM_ELEMENT:n0,DATA_ATTR:Kp,DOCTYPE_NAME:fl,ERB_EXPR:Zp,IS_ALLOWED_URI:sl,IS_SCRIPT_OR_DATA:e0,MUSTACHE_EXPR:Yp,TMPLIT_EXPR:Qp});const mr={element:1,text:3,progressingInstruction:7,comment:8,document:9},i0=function(){return typeof window>"u"?null:window},r0=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},ul=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function cl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:i0();const e=$e=>cl($e);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==mr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:f,Element:l,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:y,DOMParser:S,trustedTypes:D}=t,q=l.prototype,Te=dr(q,"cloneNode"),we=dr(q,"remove"),fe=dr(q,"nextSibling"),Ne=dr(q,"childNodes"),Ve=dr(q,"parentNode");if(typeof s=="function"){const $e=n.createElement("template");$e.content&&$e.content.ownerDocument&&(n=$e.content.ownerDocument)}let V,ae="";const{implementation:Ie,createNodeIterator:Be,createDocumentFragment:Xe,getElementsByTagName:nt}=n,{importNode:lt}=i;let Ee=ul();e.isSupported=typeof Kf=="function"&&typeof Ve=="function"&&Ie&&Ie.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ct,ERB_EXPR:ft,TMPLIT_EXPR:G,DATA_ATTR:Pe,ARIA_ATTR:se,IS_SCRIPT_OR_DATA:De,ATTR_WHITESPACE:qe,CUSTOM_ELEMENT:je}=ll;let{IS_ALLOWED_URI:Qe}=ll,Ze=null;const dt=rt({},[...il,...Ga,...Ba,...Ua,...rl]);let ut=null;const _t=rt({},[...ol,...Va,...al,...so]);let at=Object.seal(el(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$t=null,Ht=null,Kt=!0,Mn=!0,wo=!1,Ao=!0,On=!1,si=!0,Tn=!1,Fi=!1,zi=!1,$n=!1,Mt=!1,fi=!1,li=!0,Eo=!1;const ss="user-content-";let m=!0,ui=!1,Hn={},Wn=null;const Co=rt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let wn=null;const yr=rt({},["audio","video","img","source","image","track"]);let Nn=null;const xr=rt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ri="http://www.w3.org/1998/Math/MathML",Mi="http://www.w3.org/2000/svg",sn="http://www.w3.org/1999/xhtml";let It=sn,ci=!1,Oi=null;const fs=rt({},[Ri,Mi,sn],Na);let Ni=rt({},["mi","mo","mn","ms","mtext"]),Gi=rt({},["annotation-xml"]);const ls=rt({},["title","style","font","a","script"]);let hi=null;const Po=["application/xhtml+xml","text/html"],ko="text/html";let Lt=null,Xn=null;const Yt=n.createElement("form"),Io=function(P){return P instanceof RegExp||P instanceof Function},br=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xn&&Xn===P)){if((!P||typeof P!="object")&&(P={}),P=Dn(P),hi=Po.indexOf(P.PARSER_MEDIA_TYPE)===-1?ko:P.PARSER_MEDIA_TYPE,Lt=hi==="application/xhtml+xml"?Na:ao,Ze=mn(P,"ALLOWED_TAGS")?rt({},P.ALLOWED_TAGS,Lt):dt,ut=mn(P,"ALLOWED_ATTR")?rt({},P.ALLOWED_ATTR,Lt):_t,Oi=mn(P,"ALLOWED_NAMESPACES")?rt({},P.ALLOWED_NAMESPACES,Na):fs,Nn=mn(P,"ADD_URI_SAFE_ATTR")?rt(Dn(xr),P.ADD_URI_SAFE_ATTR,Lt):xr,wn=mn(P,"ADD_DATA_URI_TAGS")?rt(Dn(yr),P.ADD_DATA_URI_TAGS,Lt):yr,Wn=mn(P,"FORBID_CONTENTS")?rt({},P.FORBID_CONTENTS,Lt):Co,$t=mn(P,"FORBID_TAGS")?rt({},P.FORBID_TAGS,Lt):Dn({}),Ht=mn(P,"FORBID_ATTR")?rt({},P.FORBID_ATTR,Lt):Dn({}),Hn=mn(P,"USE_PROFILES")?P.USE_PROFILES:!1,Kt=P.ALLOW_ARIA_ATTR!==!1,Mn=P.ALLOW_DATA_ATTR!==!1,wo=P.ALLOW_UNKNOWN_PROTOCOLS||!1,Ao=P.ALLOW_SELF_CLOSE_IN_ATTR!==!1,On=P.SAFE_FOR_TEMPLATES||!1,si=P.SAFE_FOR_XML!==!1,Tn=P.WHOLE_DOCUMENT||!1,$n=P.RETURN_DOM||!1,Mt=P.RETURN_DOM_FRAGMENT||!1,fi=P.RETURN_TRUSTED_TYPE||!1,zi=P.FORCE_BODY||!1,li=P.SANITIZE_DOM!==!1,Eo=P.SANITIZE_NAMED_PROPS||!1,m=P.KEEP_CONTENT!==!1,ui=P.IN_PLACE||!1,Qe=P.ALLOWED_URI_REGEXP||sl,It=P.NAMESPACE||sn,Ni=P.MATHML_TEXT_INTEGRATION_POINTS||Ni,Gi=P.HTML_INTEGRATION_POINTS||Gi,at=P.CUSTOM_ELEMENT_HANDLING||{},P.CUSTOM_ELEMENT_HANDLING&&Io(P.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(at.tagNameCheck=P.CUSTOM_ELEMENT_HANDLING.tagNameCheck),P.CUSTOM_ELEMENT_HANDLING&&Io(P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(at.attributeNameCheck=P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),P.CUSTOM_ELEMENT_HANDLING&&typeof P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(at.allowCustomizedBuiltInElements=P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),On&&(Mn=!1),Mt&&($n=!0),Hn&&(Ze=rt({},rl),ut=[],Hn.html===!0&&(rt(Ze,il),rt(ut,ol)),Hn.svg===!0&&(rt(Ze,Ga),rt(ut,Va),rt(ut,so)),Hn.svgFilters===!0&&(rt(Ze,Ba),rt(ut,Va),rt(ut,so)),Hn.mathMl===!0&&(rt(Ze,Ua),rt(ut,al),rt(ut,so))),P.ADD_TAGS&&(Ze===dt&&(Ze=Dn(Ze)),rt(Ze,P.ADD_TAGS,Lt)),P.ADD_ATTR&&(ut===_t&&(ut=Dn(ut)),rt(ut,P.ADD_ATTR,Lt)),P.ADD_URI_SAFE_ATTR&&rt(Nn,P.ADD_URI_SAFE_ATTR,Lt),P.FORBID_CONTENTS&&(Wn===Co&&(Wn=Dn(Wn)),rt(Wn,P.FORBID_CONTENTS,Lt)),m&&(Ze["#text"]=!0),Tn&&rt(Ze,["html","head","body"]),Ze.table&&(rt(Ze,["tbody"]),delete $t.tbody),P.TRUSTED_TYPES_POLICY){if(typeof P.TRUSTED_TYPES_POLICY.createHTML!="function")throw hr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof P.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw hr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');V=P.TRUSTED_TYPES_POLICY,ae=V.createHTML("")}else V===void 0&&(V=r0(D,r)),V!==null&&typeof ae=="string"&&(ae=V.createHTML(""));Xt&&Xt(P),Xn=P}},Lo=rt({},[...Ga,...Ba,...jp]),Do=rt({},[...Ua,...qp]),us=function(P){let ve=Ve(P);(!ve||!ve.tagName)&&(ve={namespaceURI:It,tagName:"template"});const ze=ao(P.tagName),mt=ao(ve.tagName);return Oi[P.namespaceURI]?P.namespaceURI===Mi?ve.namespaceURI===sn?ze==="svg":ve.namespaceURI===Ri?ze==="svg"&&(mt==="annotation-xml"||Ni[mt]):!!Lo[ze]:P.namespaceURI===Ri?ve.namespaceURI===sn?ze==="math":ve.namespaceURI===Mi?ze==="math"&&Gi[mt]:!!Do[ze]:P.namespaceURI===sn?ve.namespaceURI===Mi&&!Gi[mt]||ve.namespaceURI===Ri&&!Ni[mt]?!1:!Do[ze]&&(ls[ze]||!Lo[ze]):!!(hi==="application/xhtml+xml"&&Oi[P.namespaceURI]):!1},fn=function(P){ur(e.removed,{element:P});try{Ve(P).removeChild(P)}catch{we(P)}},jn=function(P,ve){try{ur(e.removed,{attribute:ve.getAttributeNode(P),from:ve})}catch{ur(e.removed,{attribute:null,from:ve})}if(ve.removeAttribute(P),P==="is")if($n||Mt)try{fn(ve)}catch{}else try{ve.setAttribute(P,"")}catch{}},Fo=function(P){let ve=null,ze=null;if(zi)P="<remove></remove>"+P;else{const At=nl(P,/^[\r\n\t ]+/);ze=At&&At[0]}hi==="application/xhtml+xml"&&It===sn&&(P='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+P+"</body></html>");const mt=V?V.createHTML(P):P;if(It===sn)try{ve=new S().parseFromString(mt,hi)}catch{}if(!ve||!ve.documentElement){ve=Ie.createDocument(It,"template",null);try{ve.documentElement.innerHTML=ci?ae:mt}catch{}}const Ot=ve.body||ve.documentElement;return P&&ze&&Ot.insertBefore(n.createTextNode(ze),Ot.childNodes[0]||null),It===sn?nt.call(ve,Tn?"html":"body")[0]:Tn?ve.documentElement:Ot},_r=function(P){return Be.call(P.ownerDocument||P,P,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Bi=function(P){return P instanceof y&&(typeof P.nodeName!="string"||typeof P.textContent!="string"||typeof P.removeChild!="function"||!(P.attributes instanceof d)||typeof P.removeAttribute!="function"||typeof P.setAttribute!="function"||typeof P.namespaceURI!="string"||typeof P.insertBefore!="function"||typeof P.hasChildNodes!="function")},gt=function(P){return typeof f=="function"&&P instanceof f};function vn($e,P,ve){oo($e,ze=>{ze.call(e,P,ve,Xn)})}const zo=function(P){let ve=null;if(vn(Ee.beforeSanitizeElements,P,null),Bi(P))return fn(P),!0;const ze=Lt(P.nodeName);if(vn(Ee.uponSanitizeElement,P,{tagName:ze,allowedTags:Ze}),si&&P.hasChildNodes()&&!gt(P.firstElementChild)&&jt(/<[/\w!]/g,P.innerHTML)&&jt(/<[/\w!]/g,P.textContent)||P.nodeType===mr.progressingInstruction||si&&P.nodeType===mr.comment&&jt(/<[/\w]/g,P.data))return fn(P),!0;if(!Ze[ze]||$t[ze]){if(!$t[ze]&&Mo(ze)&&(at.tagNameCheck instanceof RegExp&&jt(at.tagNameCheck,ze)||at.tagNameCheck instanceof Function&&at.tagNameCheck(ze)))return!1;if(m&&!Wn[ze]){const mt=Ve(P)||P.parentNode,Ot=Ne(P)||P.childNodes;if(Ot&&mt){const At=Ot.length;for(let Wt=At-1;Wt>=0;--Wt){const gn=Te(Ot[Wt],!0);gn.__removalCount=(P.__removalCount||0)+1,mt.insertBefore(gn,fe(P))}}}return fn(P),!0}return P instanceof l&&!us(P)||(ze==="noscript"||ze==="noembed"||ze==="noframes")&&jt(/<\/no(script|embed|frames)/i,P.innerHTML)?(fn(P),!0):(On&&P.nodeType===mr.text&&(ve=P.textContent,oo([ct,ft,G],mt=>{ve=cr(ve,mt," ")}),P.textContent!==ve&&(ur(e.removed,{element:P.cloneNode()}),P.textContent=ve)),vn(Ee.afterSanitizeElements,P,null),!1)},Ro=function(P,ve,ze){if(li&&(ve==="id"||ve==="name")&&(ze in n||ze in Yt))return!1;if(!(Mn&&!Ht[ve]&&jt(Pe,ve))){if(!(Kt&&jt(se,ve))){if(!ut[ve]||Ht[ve]){if(!(Mo(P)&&(at.tagNameCheck instanceof RegExp&&jt(at.tagNameCheck,P)||at.tagNameCheck instanceof Function&&at.tagNameCheck(P))&&(at.attributeNameCheck instanceof RegExp&&jt(at.attributeNameCheck,ve)||at.attributeNameCheck instanceof Function&&at.attributeNameCheck(ve))||ve==="is"&&at.allowCustomizedBuiltInElements&&(at.tagNameCheck instanceof RegExp&&jt(at.tagNameCheck,ze)||at.tagNameCheck instanceof Function&&at.tagNameCheck(ze))))return!1}else if(!Nn[ve]){if(!jt(Qe,cr(ze,qe,""))){if(!((ve==="src"||ve==="xlink:href"||ve==="href")&&P!=="script"&&$p(ze,"data:")===0&&wn[P])){if(!(wo&&!jt(De,cr(ze,qe,"")))){if(ze)return!1}}}}}}return!0},Mo=function(P){return P!=="annotation-xml"&&nl(P,je)},Oo=function(P){vn(Ee.beforeSanitizeAttributes,P,null);const{attributes:ve}=P;if(!ve||Bi(P))return;const ze={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ut,forceKeepAttr:void 0};let mt=ve.length;for(;mt--;){const Ot=ve[mt],{name:At,namespaceURI:Wt,value:gn}=Ot,di=Lt(At),Sr=gn;let Nt=At==="value"?Sr:Hp(Sr);if(ze.attrName=di,ze.attrValue=Nt,ze.keepAttr=!0,ze.forceKeepAttr=void 0,vn(Ee.uponSanitizeAttribute,P,ze),Nt=ze.attrValue,Eo&&(di==="id"||di==="name")&&(jn(At,P),Nt=ss+Nt),si&&jt(/((--!?|])>)|<\/(style|title)/i,Nt)){jn(At,P);continue}if(ze.forceKeepAttr)continue;if(!ze.keepAttr){jn(At,P);continue}if(!Ao&&jt(/\/>/i,Nt)){jn(At,P);continue}On&&oo([ct,ft,G],Go=>{Nt=cr(Nt,Go," ")});const No=Lt(P.nodeName);if(!Ro(No,di,Nt)){jn(At,P);continue}if(V&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Wt)switch(D.getAttributeType(No,di)){case"TrustedHTML":{Nt=V.createHTML(Nt);break}case"TrustedScriptURL":{Nt=V.createScriptURL(Nt);break}}if(Nt!==Sr)try{Wt?P.setAttributeNS(Wt,At,Nt):P.setAttribute(At,Nt),Bi(P)?fn(P):tl(e.removed)}catch{jn(At,P)}}vn(Ee.afterSanitizeAttributes,P,null)},cs=function $e(P){let ve=null;const ze=_r(P);for(vn(Ee.beforeSanitizeShadowDOM,P,null);ve=ze.nextNode();)vn(Ee.uponSanitizeShadowNode,ve,null),zo(ve),Oo(ve),ve.content instanceof o&&$e(ve.content);vn(Ee.afterSanitizeShadowDOM,P,null)};return e.sanitize=function($e){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=null,ze=null,mt=null,Ot=null;if(ci=!$e,ci&&($e="<!-->"),typeof $e!="string"&&!gt($e))if(typeof $e.toString=="function"){if($e=$e.toString(),typeof $e!="string")throw hr("dirty is not a string, aborting")}else throw hr("toString is not a function");if(!e.isSupported)return $e;if(Fi||br(P),e.removed=[],typeof $e=="string"&&(ui=!1),ui){if($e.nodeName){const gn=Lt($e.nodeName);if(!Ze[gn]||$t[gn])throw hr("root node is forbidden and cannot be sanitized in-place")}}else if($e instanceof f)ve=Fo("<!---->"),ze=ve.ownerDocument.importNode($e,!0),ze.nodeType===mr.element&&ze.nodeName==="BODY"||ze.nodeName==="HTML"?ve=ze:ve.appendChild(ze);else{if(!$n&&!On&&!Tn&&$e.indexOf("<")===-1)return V&&fi?V.createHTML($e):$e;if(ve=Fo($e),!ve)return $n?null:fi?ae:""}ve&&zi&&fn(ve.firstChild);const At=_r(ui?$e:ve);for(;mt=At.nextNode();)zo(mt),Oo(mt),mt.content instanceof o&&cs(mt.content);if(ui)return $e;if($n){if(Mt)for(Ot=Xe.call(ve.ownerDocument);ve.firstChild;)Ot.appendChild(ve.firstChild);else Ot=ve;return(ut.shadowroot||ut.shadowrootmode)&&(Ot=lt.call(i,Ot,!0)),Ot}let Wt=Tn?ve.outerHTML:ve.innerHTML;return Tn&&Ze["!doctype"]&&ve.ownerDocument&&ve.ownerDocument.doctype&&ve.ownerDocument.doctype.name&&jt(fl,ve.ownerDocument.doctype.name)&&(Wt="<!DOCTYPE "+ve.ownerDocument.doctype.name+`>
|
|
9
|
+
`+Wt),On&&oo([ct,ft,G],gn=>{Wt=cr(Wt,gn," ")}),V&&fi?V.createHTML(Wt):Wt},e.setConfig=function(){let $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};br($e),Fi=!0},e.clearConfig=function(){Xn=null,Fi=!1},e.isValidAttribute=function($e,P,ve){Xn||br({});const ze=Lt($e),mt=Lt(P);return Ro(ze,mt,ve)},e.addHook=function($e,P){typeof P=="function"&&ur(Ee[$e],P)},e.removeHook=function($e,P){if(P!==void 0){const ve=Up(Ee[$e],P);return ve===-1?void 0:Vp(Ee[$e],ve,1)[0]}return tl(Ee[$e])},e.removeHooks=function($e){Ee[$e]=[]},e.removeAllHooks=function(){Ee=ul()},e}var o0=cl();const hl=t=>typeof t=="function",$a=t=>Array.isArray(t),dl=t=>t instanceof Object,ml=t=>t instanceof Object?t.constructor.name!=="Function"&&t.constructor.name!=="Object":!1,Ha=t=>dl(t)&&!$a(t)&&!hl(t)&&!ml(t);function Fn(t){let e;if($a(t))e=t;else{const n=Vn(t),i=n==null?void 0:n.rgb();e=[(i==null?void 0:i.r)||0,(i==null?void 0:i.g)||0,(i==null?void 0:i.b)||0,(n==null?void 0:n.opacity)??1]}return[e[0]/255,e[1]/255,e[2]/255,e[3]]}function pl(t,e,n){return .2126*t+.7152*e+.0722*n}function Qt(t,e){let n=new Float32Array;return t({framebuffer:e})(()=>{n=t.read()}),n}function vl(t,e,n){return Math.min(Math.max(t,e),n)}function nn(t){return t!=null&&!Number.isNaN(t)}function gl(t,e){return o0.sanitize(t,{ALLOWED_TAGS:["a","b","i","em","strong","span","div","p","br"],ALLOWED_ATTR:["href","target","class","id","style"],ALLOW_DATA_ATTR:!1,...e})}class a0{constructor(){this.enableSimulation=Oe.enableSimulation,this.backgroundColor=Qf,this.spaceSize=Oe.spaceSize,this.pointColor=Cp,this.pointDefaultColor=void 0,this.pointGreyoutOpacity=Pp,this.pointGreyoutColor=Ra,this.pointSize=Ip,this.pointOpacity=kp,this.pointSizeScale=Oe.pointSizeScale,this.hoveredPointCursor=Oe.hoveredPointCursor,this.hoveredLinkCursor=Oe.hoveredLinkCursor,this.renderHoveredPointRing=Oe.renderHoveredPointRing,this.hoveredPointRingColor=Oe.hoveredPointRingColor,this.focusedPointRingColor=Oe.focusedPointRingColor,this.focusedPointIndex=Oe.focusedPointIndex,this.linkColor=Lp,this.linkDefaultColor=void 0,this.linkOpacity=Fp,this.linkGreyoutOpacity=Dp,this.linkWidth=zp,this.linkWidthScale=Oe.linkWidthScale,this.hoveredLinkColor=Oe.hoveredLinkColor,this.hoveredLinkWidthIncrease=Oe.hoveredLinkWidthIncrease,this.renderLinks=Oe.renderLinks,this.curvedLinks=Oe.curvedLinks,this.curvedLinkSegments=Oe.curvedLinkSegments,this.curvedLinkWeight=Oe.curvedLinkWeight,this.curvedLinkControlPointDistance=Oe.curvedLinkControlPointDistance,this.linkArrows=Oe.linkArrows,this.linkArrowsSizeScale=Oe.linkArrowsSizeScale,this.scaleLinksOnZoom=Oe.scaleLinksOnZoom,this.linkVisibilityDistanceRange=Oe.linkVisibilityDistanceRange,this.linkVisibilityMinTransparency=Oe.linkVisibilityMinTransparency,this.useClassicQuadtree=Oe.useClassicQuadtree,this.simulationDecay=Oe.simulation.decay,this.simulationGravity=Oe.simulation.gravity,this.simulationCenter=Oe.simulation.center,this.simulationRepulsion=Oe.simulation.repulsion,this.simulationRepulsionTheta=Oe.simulation.repulsionTheta,this.simulationRepulsionQuadtreeLevels=Oe.simulation.repulsionQuadtreeLevels,this.simulationLinkSpring=Oe.simulation.linkSpring,this.simulationLinkDistance=Oe.simulation.linkDistance,this.simulationLinkDistRandomVariationRange=Oe.simulation.linkDistRandomVariationRange,this.simulationRepulsionFromMouse=Oe.simulation.repulsionFromMouse,this.enableRightClickRepulsion=Oe.enableRightClickRepulsion,this.simulationFriction=Oe.simulation.friction,this.simulationCluster=Oe.simulation.cluster,this.onSimulationStart=void 0,this.onSimulationTick=void 0,this.onSimulationEnd=void 0,this.onSimulationPause=void 0,this.onSimulationRestart=void 0,this.onSimulationUnpause=void 0,this.onClick=void 0,this.onPointClick=void 0,this.onLinkClick=void 0,this.onBackgroundClick=void 0,this.onMouseMove=void 0,this.onPointMouseOver=void 0,this.onPointMouseOut=void 0,this.onLinkMouseOver=void 0,this.onLinkMouseOut=void 0,this.onZoomStart=void 0,this.onZoom=void 0,this.onZoomEnd=void 0,this.onDragStart=void 0,this.onDrag=void 0,this.onDragEnd=void 0,this.showFPSMonitor=Oe.showFPSMonitor,this.pixelRatio=Oe.pixelRatio,this.scalePointsOnZoom=Oe.scalePointsOnZoom,this.initialZoomLevel=void 0,this.enableZoom=Oe.enableZoom,this.enableSimulationDuringZoom=Oe.enableSimulationDuringZoom,this.enableDrag=Oe.enableDrag,this.fitViewOnInit=Oe.fitViewOnInit,this.fitViewDelay=Oe.fitViewDelay,this.fitViewPadding=Oe.fitViewPadding,this.fitViewDuration=Oe.fitViewDuration,this.fitViewByPointsInRect=void 0,this.fitViewByPointIndices=void 0,this.randomSeed=void 0,this.pointSamplingDistance=Oe.pointSamplingDistance,this.attribution=Oe.attribution,this.rescalePositions=Oe.rescalePositions}init(e){Object.keys(e).forEach(n=>{this.deepMergeConfig(this.getConfig(),e,n)})}deepMergeConfig(e,n,i){Ha(e[i])&&Ha(n[i])?Object.keys(n[i]).forEach(r=>{this.deepMergeConfig(e[i],n[i],r)}):e[i]=n[i]}getConfig(){return this}}class zn{constructor(e,n,i,r,o){this._debugRandomNumber=Math.floor(Math.random()*1e3),this.reglInstance=e,this.config=n,this.store=i,this.data=r,o&&(this.points=o)}}var s0=`#ifdef GL_ES
|
|
10
10
|
precision highp float;
|
|
11
11
|
#endif
|
|
12
12
|
|
|
@@ -169,7 +169,7 @@ void main() {
|
|
|
169
169
|
|
|
170
170
|
gl_FragColor = vec4(velocity.rg, 0.0, 0.0);
|
|
171
171
|
}
|
|
172
|
-
`}var Wa=(t=>(t.OUTGOING="outgoing",t.INCOMING="incoming",t))(Wa||{});class yl extends zn{constructor(){super(...arguments),this.linkFirstIndicesAndAmount=new Float32Array,this.indices=new Float32Array,this.maxPointDegree=0}create(e){const{reglInstance:n,store:{pointsTextureSize:i,linksTextureSize:r},data:o}=this;if(!i||!r)return;this.linkFirstIndicesAndAmount=new Float32Array(i*i*4),this.indices=new Float32Array(r*r*4);const s=new Float32Array(r*r*4),f=new Float32Array(r*r*4),l=e==="incoming"?o.sourceIndexToTargetIndices:o.targetIndexToSourceIndices;this.maxPointDegree=0;let u=0;l==null||l.forEach((
|
|
172
|
+
`}var Wa=(t=>(t.OUTGOING="outgoing",t.INCOMING="incoming",t))(Wa||{});class yl extends zn{constructor(){super(...arguments),this.linkFirstIndicesAndAmount=new Float32Array,this.indices=new Float32Array,this.maxPointDegree=0}create(e){const{reglInstance:n,store:{pointsTextureSize:i,linksTextureSize:r},data:o}=this;if(!i||!r)return;this.linkFirstIndicesAndAmount=new Float32Array(i*i*4),this.indices=new Float32Array(r*r*4);const s=new Float32Array(r*r*4),f=new Float32Array(r*r*4),l=e==="incoming"?o.sourceIndexToTargetIndices:o.targetIndexToSourceIndices;this.maxPointDegree=0;let u=0;l==null||l.forEach((d,y)=>{d&&(this.linkFirstIndicesAndAmount[y*4+0]=u%r,this.linkFirstIndicesAndAmount[y*4+1]=Math.floor(u/r),this.linkFirstIndicesAndAmount[y*4+2]=d.length??0,d.forEach(([S,D])=>{var V,ae,Ie;this.indices[u*4+0]=S%i,this.indices[u*4+1]=Math.floor(S/i);const q=((V=o.degree)==null?void 0:V[S])??0,Te=((ae=o.degree)==null?void 0:ae[y])??0,we=q+Te,fe=we!==0?q/we:.5,Ne=Math.min(q,Te);let Ve=((Ie=o.linkStrength)==null?void 0:Ie[D])??1/Math.max(Ne,1);Ve=Math.sqrt(Ve),s[u*4+0]=fe,s[u*4+1]=Ve,f[u*4]=this.store.getRandomFloat(0,1),u+=1}),this.maxPointDegree=Math.max(this.maxPointDegree,d.length??0))}),this.linkFirstIndicesAndAmountTexture||(this.linkFirstIndicesAndAmountTexture=n.texture()),this.linkFirstIndicesAndAmountTexture({data:this.linkFirstIndicesAndAmount,shape:[i,i,4],type:"float"}),this.linkFirstIndicesAndAmountFbo||(this.linkFirstIndicesAndAmountFbo=n.framebuffer()),this.linkFirstIndicesAndAmountFbo({color:this.linkFirstIndicesAndAmountTexture,depth:!1,stencil:!1}),this.indicesTexture||(this.indicesTexture=n.texture()),this.indicesTexture({data:this.indices,shape:[r,r,4],type:"float"}),this.indicesFbo||(this.indicesFbo=n.framebuffer()),this.indicesFbo({color:this.indicesTexture,depth:!1,stencil:!1}),this.biasAndStrengthTexture||(this.biasAndStrengthTexture=n.texture()),this.biasAndStrengthTexture({data:s,shape:[r,r,4],type:"float"}),this.biasAndStrengthFbo||(this.biasAndStrengthFbo=n.framebuffer()),this.biasAndStrengthFbo({color:this.biasAndStrengthTexture,depth:!1,stencil:!1}),this.randomDistanceTexture||(this.randomDistanceTexture=n.texture()),this.randomDistanceTexture({data:f,shape:[r,r,4],type:"float"}),this.randomDistanceFbo||(this.randomDistanceFbo=n.framebuffer()),this.randomDistanceFbo({color:this.randomDistanceTexture,depth:!1,stencil:!1})}initPrograms(){const{reglInstance:e,config:n,store:i,points:r}=this;this.runCommand||(this.runCommand=e({frag:()=>d0(this.maxPointDegree),vert:kt,framebuffer:()=>r==null?void 0:r.velocityFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>r==null?void 0:r.previousPositionFbo,linkSpring:()=>n.simulationLinkSpring,linkDistance:()=>n.simulationLinkDistance,linkDistRandomVariationRange:()=>n.simulationLinkDistRandomVariationRange,linkInfoTexture:()=>this.linkFirstIndicesAndAmountFbo,linkIndicesTexture:()=>this.indicesFbo,linkPropertiesTexture:()=>this.biasAndStrengthFbo,linkRandomDistanceTexture:()=>this.randomDistanceFbo,pointsTextureSize:()=>i.pointsTextureSize,linksTextureSize:()=>i.linksTextureSize,alpha:()=>i.alpha}}))}run(){var e;(e=this.runCommand)==null||e.call(this)}}var xl=`#ifdef GL_ES
|
|
173
173
|
precision highp float;
|
|
174
174
|
#endif
|
|
175
175
|
|
|
@@ -372,7 +372,7 @@ void main() {
|
|
|
372
372
|
addVelocity += calcAdd(vec2(x, y), l, c);
|
|
373
373
|
addVelocity += addVelocity * random.rg;
|
|
374
374
|
}
|
|
375
|
-
`;function r(o){if(o>=e)return i;{const s=Math.pow(2,o+1),f=new Array(o+1-n).fill(0).map((u,
|
|
375
|
+
`;function r(o){if(o>=e)return i;{const s=Math.pow(2,o+1),f=new Array(o+1-n).fill(0).map((u,d)=>`pow(2.0, ${o-(d+n)}.0) * i${d+n}`).join("+"),l=new Array(o+1-n).fill(0).map((u,d)=>`pow(2.0, ${o-(d+n)}.0) * j${d+n}`).join("+");return`
|
|
376
376
|
for (float ij${o} = 0.0; ij${o} < 4.0; ij${o} += 1.0) {
|
|
377
377
|
float i${o} = 0.0;
|
|
378
378
|
float j${o} = 0.0;
|
|
@@ -531,7 +531,7 @@ void main() {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
gl_FragColor = velocity;
|
|
534
|
-
}`;class w0 extends zn{create(){var l;const{reglInstance:e,store:n,data:i}=this,{pointsTextureSize:r}=n;if(i.pointsNumber===void 0||!i.pointClusters&&!i.clusterPositions)return;this.clusterCount=(i.pointClusters??[]).reduce((u,
|
|
534
|
+
}`;class w0 extends zn{create(){var l;const{reglInstance:e,store:n,data:i}=this,{pointsTextureSize:r}=n;if(i.pointsNumber===void 0||!i.pointClusters&&!i.clusterPositions)return;this.clusterCount=(i.pointClusters??[]).reduce((u,d)=>d===void 0||d<0?u:Math.max(u,d),0)+1,this.clustersTextureSize=Math.ceil(Math.sqrt(this.clusterCount));const o=new Float32Array(r*r*4),s=new Float32Array(this.clustersTextureSize*this.clustersTextureSize*4).fill(-1),f=new Float32Array(r*r*4).fill(1);if(i.clusterPositions)for(let u=0;u<this.clusterCount;++u)s[u*4+0]=i.clusterPositions[u*2+0]??-1,s[u*4+1]=i.clusterPositions[u*2+1]??-1;for(let u=0;u<i.pointsNumber;++u){const d=(l=i.pointClusters)==null?void 0:l[u];d===void 0?(o[u*4+0]=-1,o[u*4+1]=-1):(o[u*4+0]=d%this.clustersTextureSize,o[u*4+1]=Math.floor(d/this.clustersTextureSize)),i.clusterStrength&&(f[u*4+0]=i.clusterStrength[u]??1)}this.clusterTexture||(this.clusterTexture=e.texture()),this.clusterTexture({data:o,shape:[r,r,4],type:"float"}),this.clusterFbo||(this.clusterFbo=e.framebuffer()),this.clusterFbo({color:this.clusterTexture,depth:!1,stencil:!1}),this.clusterPositionsTexture||(this.clusterPositionsTexture=e.texture()),this.clusterPositionsTexture({data:s,shape:[this.clustersTextureSize,this.clustersTextureSize,4],type:"float"}),this.clusterPositionsFbo||(this.clusterPositionsFbo=e.framebuffer()),this.clusterPositionsFbo({color:this.clusterPositionsTexture,depth:!1,stencil:!1}),this.clusterForceCoefficientTexture||(this.clusterForceCoefficientTexture=e.texture()),this.clusterForceCoefficientTexture({data:f,shape:[r,r,4],type:"float"}),this.clusterForceCoefficientFbo||(this.clusterForceCoefficientFbo=e.framebuffer()),this.clusterForceCoefficientFbo({color:this.clusterForceCoefficientTexture,depth:!1,stencil:!1}),this.centermassTexture||(this.centermassTexture=e.texture()),this.centermassTexture({data:new Float32Array(this.clustersTextureSize*this.clustersTextureSize*4).fill(0),shape:[this.clustersTextureSize,this.clustersTextureSize,4],type:"float"}),this.centermassFbo||(this.centermassFbo=e.framebuffer()),this.centermassFbo({color:this.centermassTexture,depth:!1,stencil:!1}),this.pointIndices||(this.pointIndices=e.buffer(0)),this.pointIndices(oi(n.pointsTextureSize))}initPrograms(){const{reglInstance:e,store:n,data:i,points:r}=this;i.pointClusters!==void 0&&(this.clearCentermassCommand||(this.clearCentermassCommand=e({frag:ai,vert:kt,framebuffer:()=>this.centermassFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.calculateCentermassCommand||(this.calculateCentermassCommand=e({frag:_0,vert:S0,framebuffer:()=>this.centermassFbo,primitive:"points",count:()=>i.pointsNumber??0,attributes:{pointIndices:{buffer:this.pointIndices,size:2}},uniforms:{positionsTexture:()=>r==null?void 0:r.previousPositionFbo,pointsTextureSize:()=>n.pointsTextureSize,clusterTexture:()=>this.clusterFbo,clustersTextureSize:()=>this.clustersTextureSize},blend:{enable:!0,func:{src:"one",dst:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1},stencil:{enable:!1}})),this.applyForcesCommand||(this.applyForcesCommand=e({frag:T0,vert:kt,framebuffer:()=>r==null?void 0:r.velocityFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>r==null?void 0:r.previousPositionFbo,clusterTexture:()=>this.clusterFbo,centermassTexture:()=>this.centermassFbo,clusterPositionsTexture:()=>this.clusterPositionsFbo,clusterForceCoefficient:()=>this.clusterForceCoefficientFbo,alpha:()=>n.alpha,clustersTextureSize:()=>this.clustersTextureSize,clusterCoefficient:()=>this.config.simulationCluster}})))}calculateCentermass(){var e,n;(e=this.clearCentermassCommand)==null||e.call(this),(n=this.calculateCentermassCommand)==null||n.call(this)}run(){var e;!this.data.pointClusters&&!this.data.clusterPositions||(this.calculateCentermass(),(e=this.applyForcesCommand)==null||e.call(this))}}var fo={exports:{}},A0=fo.exports,_l;function E0(){return _l||(_l=1,function(t,e){(function(n,i){t.exports=i()})(A0,function(){var n=`<div class="gl-box">
|
|
535
535
|
<svg viewBox="0 0 55 60">
|
|
536
536
|
<text x="27" y="56" class="gl-fps">00 FPS</text>
|
|
537
537
|
<text x="28" y="8" class="gl-mem"></text>
|
|
@@ -607,7 +607,7 @@ void main() {
|
|
|
607
607
|
#gl-bench .opacity {
|
|
608
608
|
stroke: #448844;
|
|
609
609
|
}
|
|
610
|
-
`;class r{constructor(s,f={}){this.css=i,this.svg=n,this.paramLogger=()=>{},this.chartLogger=()=>{},this.chartLen=20,this.chartHz=20,this.names=[],this.cpuAccums=[],this.gpuAccums=[],this.activeAccums=[],this.chart=new Array(this.chartLen),this.now=()=>performance&&performance.now?performance.now():Date.now(),this.updateUI=()=>{[].forEach.call(this.nodes["gl-gpu-svg"],S=>{S.style.display=this.trackGPU?"inline":"none"})},Object.assign(this,f),this.detected=0,this.finished=[],this.isFramebuffer=0,this.frameId=0;let l,u=0,
|
|
610
|
+
`;class r{constructor(s,f={}){this.css=i,this.svg=n,this.paramLogger=()=>{},this.chartLogger=()=>{},this.chartLen=20,this.chartHz=20,this.names=[],this.cpuAccums=[],this.gpuAccums=[],this.activeAccums=[],this.chart=new Array(this.chartLen),this.now=()=>performance&&performance.now?performance.now():Date.now(),this.updateUI=()=>{[].forEach.call(this.nodes["gl-gpu-svg"],S=>{S.style.display=this.trackGPU?"inline":"none"})},Object.assign(this,f),this.detected=0,this.finished=[],this.isFramebuffer=0,this.frameId=0;let l,u=0,d,y=S=>{++u<20?l=requestAnimationFrame(y):(this.detected=Math.ceil(1e3*u/(S-d)/70),cancelAnimationFrame(l)),d||(d=S)};if(requestAnimationFrame(y),s){const S=async(q,Te)=>Promise.resolve(setTimeout(()=>{s.getError();const we=this.now()-q;Te.forEach((fe,Ne)=>{fe&&(this.gpuAccums[Ne]+=we)})},0)),D=(q,Te,we)=>function(){const fe=Te.now();q.apply(we,arguments),Te.trackGPU&&Te.finished.push(S(fe,Te.activeAccums.slice(0)))};["drawArrays","drawElements","drawArraysInstanced","drawBuffers","drawElementsInstanced","drawRangeElements"].forEach(q=>{s[q]&&(s[q]=D(s[q],this,s))}),s.getExtension=((q,Te)=>function(){let we=q.apply(s,arguments);return we&&["drawElementsInstancedANGLE","drawBuffersWEBGL"].forEach(fe=>{we[fe]&&(we[fe]=D(we[fe],Te,we))}),we})(s.getExtension,this)}if(!this.withoutUI){this.dom||(this.dom=document.body);let S=document.createElement("div");S.id="gl-bench",this.dom.appendChild(S),this.dom.insertAdjacentHTML("afterbegin",'<style id="gl-bench-style">'+this.css+"</style>"),this.dom=S,this.dom.addEventListener("click",()=>{this.trackGPU=!this.trackGPU,this.updateUI()}),this.paramLogger=((D,q,Te)=>{const we=["gl-cpu","gl-gpu","gl-mem","gl-fps","gl-gpu-svg","gl-chart"],fe=Object.assign({},we);return we.forEach(Ne=>fe[Ne]=q.getElementsByClassName(Ne)),this.nodes=fe,(Ne,Ve,V,ae,Ie,Be,Xe)=>{fe["gl-cpu"][Ne].style.strokeDasharray=(Ve*.27).toFixed(0)+" 100",fe["gl-gpu"][Ne].style.strokeDasharray=(V*.27).toFixed(0)+" 100",fe["gl-mem"][Ne].innerHTML=Te[Ne]?Te[Ne]:ae?"mem: "+ae.toFixed(0)+"mb":"",fe["gl-fps"][Ne].innerHTML=Ie.toFixed(0)+" FPS",D(Te[Ne],Ve,V,ae,Ie,Be,Xe)}})(this.paramLogger,this.dom,this.names),this.chartLogger=((D,q)=>{let Te={"gl-chart":q.getElementsByClassName("gl-chart")};return(we,fe,Ne)=>{let Ve="",V=fe.length;for(let ae=0;ae<V;ae++){let Ie=(Ne+ae+1)%V;fe[Ie]!=null&&(Ve=Ve+" "+(55*ae/(V-1)).toFixed(1)+","+(45-fe[Ie]*22/60/this.detected).toFixed(1))}Te["gl-chart"][we].setAttribute("points",Ve),D(this.names[we],fe,Ne)}})(this.chartLogger,this.dom)}}addUI(s){this.names.indexOf(s)==-1&&(this.names.push(s),this.dom&&(this.dom.insertAdjacentHTML("beforeend",this.svg),this.updateUI()),this.cpuAccums.push(0),this.gpuAccums.push(0),this.activeAccums.push(!1))}nextFrame(s){this.frameId++;const f=s||this.now();if(this.frameId<=1)this.paramFrame=this.frameId,this.paramTime=f;else{let l=f-this.paramTime;if(l>=1e3){const u=this.frameId-this.paramFrame,d=u/l*1e3;for(let y=0;y<this.names.length;y++){const S=this.cpuAccums[y]/l*100,D=this.gpuAccums[y]/l*100,q=performance&&performance.memory?performance.memory.usedJSHeapSize/(1<<20):0;this.paramLogger(y,S,D,q,d,l,u),this.cpuAccums[y]=0,Promise.all(this.finished).then(()=>{this.gpuAccums[y]=0,this.finished=[]})}this.paramFrame=this.frameId,this.paramTime=f}}if(!this.detected||!this.chartFrame)this.chartFrame=this.frameId,this.chartTime=f,this.circularId=0;else{let l=f-this.chartTime,u=this.chartHz*l/1e3;for(;--u>0&&this.detected;){const y=(this.frameId-this.chartFrame)/l*1e3;this.chart[this.circularId%this.chartLen]=y;for(let S=0;S<this.names.length;S++)this.chartLogger(S,this.chart,this.circularId);this.circularId++,this.chartFrame=this.frameId,this.chartTime=f}}}begin(s){this.updateAccums(s)}end(s){this.updateAccums(s)}updateAccums(s){let f=this.names.indexOf(s);f==-1&&(f=this.names.length,this.addUI(s));const l=this.now(),u=l-this.t0;for(let d=0;d<f+1;d++)this.activeAccums[d]&&(this.cpuAccums[d]+=u);this.activeAccums[f]=!this.activeAccums[f],this.t0=l}}return r})}(fo)),fo.exports}var C0=E0();const P0=za(C0),k0=`
|
|
611
611
|
#gl-bench {
|
|
612
612
|
position:absolute;
|
|
613
613
|
right:0;
|
|
@@ -659,7 +659,7 @@ void main() {
|
|
|
659
659
|
#gl-bench .opacity {
|
|
660
660
|
stroke: #8288e4;
|
|
661
661
|
}
|
|
662
|
-
`;class Sl{constructor(e){this.destroy();const n=e.getContext("webgl")||e.getContext("experimental-webgl");this.bench=new P0(n,{css:k0})}begin(){var e;(e=this.bench)==null||e.begin("frame")}end(e){var n,i;(n=this.bench)==null||n.end("frame"),(i=this.bench)==null||i.nextFrame(e)}destroy(){this.bench=void 0,Ft("#gl-bench").remove()}}var Tl=(t=>(t[t.Circle=0]="Circle",t[t.Square=1]="Square",t[t.Triangle=2]="Triangle",t[t.Diamond=3]="Diamond",t[t.Pentagon=4]="Pentagon",t[t.Hexagon=5]="Hexagon",t[t.Star=6]="Star",t[t.Cross=7]="Cross",t[t.None=8]="None",t))(Tl||{});class I0{constructor(e){this._config=e}get pointsNumber(){return this.pointPositions&&this.pointPositions.length/2}get linksNumber(){return this.links&&this.links.length/2}updatePoints(){this.pointPositions=this.inputPointPositions}updatePointColor(){if(this.pointsNumber===void 0){this.pointColors=void 0;return}const e=Fn(this._config.pointDefaultColor??this._config.pointColor);if(this.inputPointColors===void 0||this.inputPointColors.length/4!==this.pointsNumber){this.pointColors=new Float32Array(this.pointsNumber*4);for(let n=0;n<this.pointColors.length/4;n++)this.pointColors[n*4]=e[0],this.pointColors[n*4+1]=e[1],this.pointColors[n*4+2]=e[2],this.pointColors[n*4+3]=e[3]}else{this.pointColors=this.inputPointColors;for(let n=0;n<this.pointColors.length/4;n++)nn(this.pointColors[n*4])||(this.pointColors[n*4]=e[0]),nn(this.pointColors[n*4+1])||(this.pointColors[n*4+1]=e[1]),nn(this.pointColors[n*4+2])||(this.pointColors[n*4+2]=e[2]),nn(this.pointColors[n*4+3])||(this.pointColors[n*4+3]=e[3])}}updatePointSize(){if(this.pointsNumber===void 0){this.pointSizes=void 0;return}if(this.inputPointSizes===void 0||this.inputPointSizes.length!==this.pointsNumber)this.pointSizes=new Float32Array(this.pointsNumber).fill(this._config.pointSize);else{this.pointSizes=this.inputPointSizes;for(let e=0;e<this.pointSizes.length;e++)nn(this.pointSizes[e])||(this.pointSizes[e]=this._config.pointSize)}}updatePointShape(){if(this.pointsNumber===void 0){this.pointShapes=void 0;return}const e=0;if(this.inputPointShapes===void 0||this.inputPointShapes.length!==this.pointsNumber)this.pointShapes=new Float32Array(this.pointsNumber).fill(e);else{this.pointShapes=new Float32Array(this.inputPointShapes);const n=this.pointShapes;for(let i=0;i<n.length;i++){const r=n[i];(r==null||!nn(r)||r<0||r>8)&&(n[i]=e)}}}updatePointImageIndices(){if(this.pointsNumber===void 0){this.pointImageIndices=void 0;return}if(this.inputPointImageIndices===void 0||this.inputPointImageIndices.length!==this.pointsNumber)this.pointImageIndices=new Float32Array(this.pointsNumber).fill(-1);else{const e=new Float32Array(this.inputPointImageIndices);for(let n=0;n<e.length;n++){const i=e[n],r=i===void 0?NaN:i;!Number.isFinite(r)||r<0?e[n]=-1:e[n]=Math.trunc(r)}this.pointImageIndices=e}}updatePointImageSizes(){var e;if(this.pointsNumber===void 0){this.pointImageSizes=void 0;return}if(this.inputPointImageSizes===void 0||this.inputPointImageSizes.length!==this.pointsNumber)this.pointImageSizes=this.pointSizes?new Float32Array(this.pointSizes):new Float32Array(this.pointsNumber).fill(this._config.pointSize);else{this.pointImageSizes=new Float32Array(this.inputPointImageSizes);for(let n=0;n<this.pointImageSizes.length;n++)nn(this.pointImageSizes[n])||(this.pointImageSizes[n]=((e=this.pointSizes)==null?void 0:e[n])??this._config.pointSize)}}updateLinks(){this.links=this.inputLinks}updateLinkColor(){if(this.linksNumber===void 0){this.linkColors=void 0;return}const e=Fn(this._config.linkColor);if(this.inputLinkColors===void 0||this.inputLinkColors.length/4!==this.linksNumber){this.linkColors=new Float32Array(this.linksNumber*4);for(let n=0;n<this.linkColors.length/4;n++)this.linkColors[n*4]=e[0],this.linkColors[n*4+1]=e[1],this.linkColors[n*4+2]=e[2],this.linkColors[n*4+3]=e[3]}else{this.linkColors=this.inputLinkColors;for(let n=0;n<this.linkColors.length/4;n++)nn(this.linkColors[n*4])||(this.linkColors[n*4]=e[0]),nn(this.linkColors[n*4+1])||(this.linkColors[n*4+1]=e[1]),nn(this.linkColors[n*4+2])||(this.linkColors[n*4+2]=e[2]),nn(this.linkColors[n*4+3])||(this.linkColors[n*4+3]=e[3])}}updateLinkWidth(){if(this.linksNumber===void 0){this.linkWidths=void 0;return}if(this.inputLinkWidths===void 0||this.inputLinkWidths.length!==this.linksNumber)this.linkWidths=new Float32Array(this.linksNumber).fill(this._config.linkWidth);else{this.linkWidths=this.inputLinkWidths;for(let e=0;e<this.linkWidths.length;e++)nn(this.linkWidths[e])||(this.linkWidths[e]=this._config.linkWidth)}}updateArrows(){if(this.linksNumber===void 0){this.linkArrows=void 0;return}this.linkArrowsBoolean===void 0||this.linkArrowsBoolean.length!==this.linksNumber?this.linkArrows=new Array(this.linksNumber).fill(+this._config.linkArrows):this.linkArrows=this.linkArrowsBoolean.map(e=>+e)}updateLinkStrength(){this.linksNumber===void 0&&(this.linkStrength=void 0),this.inputLinkStrength===void 0||this.inputLinkStrength.length!==this.linksNumber?this.linkStrength=void 0:this.linkStrength=this.inputLinkStrength}updateClusters(){if(this.pointsNumber===void 0){this.pointClusters=void 0,this.clusterPositions=void 0;return}this.inputPointClusters===void 0||this.inputPointClusters.length!==this.pointsNumber?this.pointClusters=void 0:this.pointClusters=this.inputPointClusters,this.inputClusterPositions===void 0?this.clusterPositions=void 0:this.clusterPositions=this.inputClusterPositions,this.inputClusterStrength===void 0||this.inputClusterStrength.length!==this.pointsNumber?this.clusterStrength=void 0:this.clusterStrength=this.inputClusterStrength}update(){this.updatePoints(),this.updatePointColor(),this.updatePointSize(),this.updatePointShape(),this.updatePointImageIndices(),this.updatePointImageSizes(),this.updateLinks(),this.updateLinkColor(),this.updateLinkWidth(),this.updateArrows(),this.updateLinkStrength(),this.updateClusters(),this._createAdjacencyLists(),this._calculateDegrees()}getAdjacentIndices(e){var n,i,r,o;return[...((i=(n=this.sourceIndexToTargetIndices)==null?void 0:n[e])==null?void 0:i.map(s=>s[0]))||[],...((o=(r=this.targetIndexToSourceIndices)==null?void 0:r[e])==null?void 0:o.map(s=>s[0]))||[]]}_createAdjacencyLists(){var e,n;if(this.linksNumber===void 0||this.links===void 0){this.sourceIndexToTargetIndices=void 0,this.targetIndexToSourceIndices=void 0;return}this.sourceIndexToTargetIndices=new Array(this.pointsNumber).fill(void 0),this.targetIndexToSourceIndices=new Array(this.pointsNumber).fill(void 0);for(let i=0;i<this.linksNumber;i++){const r=this.links[i*2],o=this.links[i*2+1];r!==void 0&&o!==void 0&&(this.sourceIndexToTargetIndices[r]===void 0&&(this.sourceIndexToTargetIndices[r]=[]),(e=this.sourceIndexToTargetIndices[r])==null||e.push([o,i]),this.targetIndexToSourceIndices[o]===void 0&&(this.targetIndexToSourceIndices[o]=[]),(n=this.targetIndexToSourceIndices[o])==null||n.push([r,i]))}}_calculateDegrees(){var e,n,i,r;if(this.pointsNumber===void 0){this.degree=void 0,this.inDegree=void 0,this.outDegree=void 0;return}this.degree=new Array(this.pointsNumber).fill(0),this.inDegree=new Array(this.pointsNumber).fill(0),this.outDegree=new Array(this.pointsNumber).fill(0);for(let o=0;o<this.pointsNumber;o++)this.inDegree[o]=((n=(e=this.targetIndexToSourceIndices)==null?void 0:e[o])==null?void 0:n.length)??0,this.outDegree[o]=((r=(i=this.sourceIndexToTargetIndices)==null?void 0:i[o])==null?void 0:r.length)??0,this.degree[o]=(this.inDegree[o]??0)+(this.outDegree[o]??0)}}var L0=`precision highp float;
|
|
662
|
+
`;class Sl{constructor(e){this.destroy();const n=e.getContext("webgl")||e.getContext("experimental-webgl");this.bench=new P0(n,{css:k0})}begin(){var e;(e=this.bench)==null||e.begin("frame")}end(e){var n,i;(n=this.bench)==null||n.end("frame"),(i=this.bench)==null||i.nextFrame(e)}destroy(){this.bench=void 0,Ft("#gl-bench").remove()}}var Tl=(t=>(t[t.Circle=0]="Circle",t[t.Square=1]="Square",t[t.Triangle=2]="Triangle",t[t.Diamond=3]="Diamond",t[t.Pentagon=4]="Pentagon",t[t.Hexagon=5]="Hexagon",t[t.Star=6]="Star",t[t.Cross=7]="Cross",t[t.None=8]="None",t))(Tl||{});class I0{constructor(e){this._config=e}get pointsNumber(){return this.pointPositions&&this.pointPositions.length/2}get linksNumber(){return this.links&&this.links.length/2}updatePoints(){this.pointPositions=this.inputPointPositions}updatePointColor(){if(this.pointsNumber===void 0){this.pointColors=void 0;return}const e=Fn(this._config.pointDefaultColor??this._config.pointColor);if(this.inputPointColors===void 0||this.inputPointColors.length/4!==this.pointsNumber){this.pointColors=new Float32Array(this.pointsNumber*4);for(let n=0;n<this.pointColors.length/4;n++)this.pointColors[n*4]=e[0],this.pointColors[n*4+1]=e[1],this.pointColors[n*4+2]=e[2],this.pointColors[n*4+3]=e[3]}else{this.pointColors=this.inputPointColors;for(let n=0;n<this.pointColors.length/4;n++)nn(this.pointColors[n*4])||(this.pointColors[n*4]=e[0]),nn(this.pointColors[n*4+1])||(this.pointColors[n*4+1]=e[1]),nn(this.pointColors[n*4+2])||(this.pointColors[n*4+2]=e[2]),nn(this.pointColors[n*4+3])||(this.pointColors[n*4+3]=e[3])}}updatePointSize(){if(this.pointsNumber===void 0){this.pointSizes=void 0;return}if(this.inputPointSizes===void 0||this.inputPointSizes.length!==this.pointsNumber)this.pointSizes=new Float32Array(this.pointsNumber).fill(this._config.pointSize);else{this.pointSizes=this.inputPointSizes;for(let e=0;e<this.pointSizes.length;e++)nn(this.pointSizes[e])||(this.pointSizes[e]=this._config.pointSize)}}updatePointShape(){if(this.pointsNumber===void 0){this.pointShapes=void 0;return}const e=0;if(this.inputPointShapes===void 0||this.inputPointShapes.length!==this.pointsNumber)this.pointShapes=new Float32Array(this.pointsNumber).fill(e);else{this.pointShapes=new Float32Array(this.inputPointShapes);const n=this.pointShapes;for(let i=0;i<n.length;i++){const r=n[i];(r==null||!nn(r)||r<0||r>8)&&(n[i]=e)}}}updatePointImageIndices(){if(this.pointsNumber===void 0){this.pointImageIndices=void 0;return}if(this.inputPointImageIndices===void 0||this.inputPointImageIndices.length!==this.pointsNumber)this.pointImageIndices=new Float32Array(this.pointsNumber).fill(-1);else{const e=new Float32Array(this.inputPointImageIndices);for(let n=0;n<e.length;n++){const i=e[n],r=i===void 0?NaN:i;!Number.isFinite(r)||r<0?e[n]=-1:e[n]=Math.trunc(r)}this.pointImageIndices=e}}updatePointImageSizes(){var e;if(this.pointsNumber===void 0){this.pointImageSizes=void 0;return}if(this.inputPointImageSizes===void 0||this.inputPointImageSizes.length!==this.pointsNumber)this.pointImageSizes=this.pointSizes?new Float32Array(this.pointSizes):new Float32Array(this.pointsNumber).fill(this._config.pointSize);else{this.pointImageSizes=new Float32Array(this.inputPointImageSizes);for(let n=0;n<this.pointImageSizes.length;n++)nn(this.pointImageSizes[n])||(this.pointImageSizes[n]=((e=this.pointSizes)==null?void 0:e[n])??this._config.pointSize)}}updateLinks(){this.links=this.inputLinks}updateLinkColor(){if(this.linksNumber===void 0){this.linkColors=void 0;return}const e=Fn(this._config.linkDefaultColor??this._config.linkColor);if(this.inputLinkColors===void 0||this.inputLinkColors.length/4!==this.linksNumber){this.linkColors=new Float32Array(this.linksNumber*4);for(let n=0;n<this.linkColors.length/4;n++)this.linkColors[n*4]=e[0],this.linkColors[n*4+1]=e[1],this.linkColors[n*4+2]=e[2],this.linkColors[n*4+3]=e[3]}else{this.linkColors=this.inputLinkColors;for(let n=0;n<this.linkColors.length/4;n++)nn(this.linkColors[n*4])||(this.linkColors[n*4]=e[0]),nn(this.linkColors[n*4+1])||(this.linkColors[n*4+1]=e[1]),nn(this.linkColors[n*4+2])||(this.linkColors[n*4+2]=e[2]),nn(this.linkColors[n*4+3])||(this.linkColors[n*4+3]=e[3])}}updateLinkWidth(){if(this.linksNumber===void 0){this.linkWidths=void 0;return}if(this.inputLinkWidths===void 0||this.inputLinkWidths.length!==this.linksNumber)this.linkWidths=new Float32Array(this.linksNumber).fill(this._config.linkWidth);else{this.linkWidths=this.inputLinkWidths;for(let e=0;e<this.linkWidths.length;e++)nn(this.linkWidths[e])||(this.linkWidths[e]=this._config.linkWidth)}}updateArrows(){if(this.linksNumber===void 0){this.linkArrows=void 0;return}this.linkArrowsBoolean===void 0||this.linkArrowsBoolean.length!==this.linksNumber?this.linkArrows=new Array(this.linksNumber).fill(+this._config.linkArrows):this.linkArrows=this.linkArrowsBoolean.map(e=>+e)}updateLinkStrength(){this.linksNumber===void 0&&(this.linkStrength=void 0),this.inputLinkStrength===void 0||this.inputLinkStrength.length!==this.linksNumber?this.linkStrength=void 0:this.linkStrength=this.inputLinkStrength}updateClusters(){if(this.pointsNumber===void 0){this.pointClusters=void 0,this.clusterPositions=void 0;return}this.inputPointClusters===void 0||this.inputPointClusters.length!==this.pointsNumber?this.pointClusters=void 0:this.pointClusters=this.inputPointClusters,this.inputClusterPositions===void 0?this.clusterPositions=void 0:this.clusterPositions=this.inputClusterPositions,this.inputClusterStrength===void 0||this.inputClusterStrength.length!==this.pointsNumber?this.clusterStrength=void 0:this.clusterStrength=this.inputClusterStrength}update(){this.updatePoints(),this.updatePointColor(),this.updatePointSize(),this.updatePointShape(),this.updatePointImageIndices(),this.updatePointImageSizes(),this.updateLinks(),this.updateLinkColor(),this.updateLinkWidth(),this.updateArrows(),this.updateLinkStrength(),this.updateClusters(),this._createAdjacencyLists(),this._calculateDegrees()}getAdjacentIndices(e){var n,i,r,o;return[...((i=(n=this.sourceIndexToTargetIndices)==null?void 0:n[e])==null?void 0:i.map(s=>s[0]))||[],...((o=(r=this.targetIndexToSourceIndices)==null?void 0:r[e])==null?void 0:o.map(s=>s[0]))||[]]}_createAdjacencyLists(){var e,n;if(this.linksNumber===void 0||this.links===void 0){this.sourceIndexToTargetIndices=void 0,this.targetIndexToSourceIndices=void 0;return}this.sourceIndexToTargetIndices=new Array(this.pointsNumber).fill(void 0),this.targetIndexToSourceIndices=new Array(this.pointsNumber).fill(void 0);for(let i=0;i<this.linksNumber;i++){const r=this.links[i*2],o=this.links[i*2+1];r!==void 0&&o!==void 0&&(this.sourceIndexToTargetIndices[r]===void 0&&(this.sourceIndexToTargetIndices[r]=[]),(e=this.sourceIndexToTargetIndices[r])==null||e.push([o,i]),this.targetIndexToSourceIndices[o]===void 0&&(this.targetIndexToSourceIndices[o]=[]),(n=this.targetIndexToSourceIndices[o])==null||n.push([r,i]))}}_calculateDegrees(){var e,n,i,r;if(this.pointsNumber===void 0){this.degree=void 0,this.inDegree=void 0,this.outDegree=void 0;return}this.degree=new Array(this.pointsNumber).fill(0),this.inDegree=new Array(this.pointsNumber).fill(0),this.outDegree=new Array(this.pointsNumber).fill(0);for(let o=0;o<this.pointsNumber;o++)this.inDegree[o]=((n=(e=this.targetIndexToSourceIndices)==null?void 0:e[o])==null?void 0:n.length)??0,this.outDegree[o]=((r=(i=this.sourceIndexToTargetIndices)==null?void 0:i[o])==null?void 0:r.length)??0,this.degree[o]=(this.inDegree[o]??0)+(this.outDegree[o]??0)}}var L0=`precision highp float;
|
|
663
663
|
|
|
664
664
|
varying vec4 rgbaColor;
|
|
665
665
|
varying vec2 pos;
|
|
@@ -927,7 +927,7 @@ varying vec2 vTexCoord;
|
|
|
927
927
|
void main() {
|
|
928
928
|
vTexCoord = position * 0.5 + 0.5;
|
|
929
929
|
gl_Position = vec4(position, 0.0, 1.0);
|
|
930
|
-
}`;function lo(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function R0(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function wl(t){let e,n,i;t.length!==2?(e=lo,n=(f,l)=>lo(t(f),l),i=(f,l)=>t(f)-l):(e=t===lo||t===R0?t:M0,n=t,i=t);function r(f,l,u=0,m=f.length){if(u<m){if(e(l,l)!==0)return m;do{const y=u+m>>>1;n(f[y],l)<0?u=y+1:m=y}while(u<m)}return u}function o(f,l,u=0,m=f.length){if(u<m){if(e(l,l)!==0)return m;do{const y=u+m>>>1;n(f[y],l)<=0?u=y+1:m=y}while(u<m)}return u}function s(f,l,u=0,m=f.length){const y=r(f,l,u,m-1);return y>u&&i(f[y-1],l)>-i(f[y],l)?y-1:y}return{left:r,center:s,right:o}}function M0(){return 0}function O0(t){return t===null?NaN:+t}const N0=wl(lo).right;wl(O0).center;function Al(t,e){let n,i;for(const r of t)r!=null&&(n===void 0?r>=r&&(n=i=r):(n>r&&(n=r),i<r&&(i=r)));return[n,i]}var Xa=Math.sqrt(50),ja=Math.sqrt(10),qa=Math.sqrt(2);function G0(t,e,n){var i,r=-1,o,s,f;if(e=+e,t=+t,n=+n,t===e&&n>0)return[t];if((i=e<t)&&(o=t,t=e,e=o),(f=El(t,e,n))===0||!isFinite(f))return[];if(f>0){let l=Math.round(t/f),u=Math.round(e/f);for(l*f<t&&++l,u*f>e&&--u,s=new Array(o=u-l+1);++r<o;)s[r]=(l+r)*f}else{f=-f;let l=Math.round(t*f),u=Math.round(e*f);for(l/f<t&&++l,u/f>e&&--u,s=new Array(o=u-l+1);++r<o;)s[r]=(l+r)/f}return i&&s.reverse(),s}function El(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),o=i/Math.pow(10,r);return r>=0?(o>=Xa?10:o>=ja?5:o>=qa?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=Xa?10:o>=ja?5:o>=qa?2:1)}function B0(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=Xa?r*=10:o>=ja?r*=5:o>=qa&&(r*=2),e<t?-r:r}function U0(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(r);++i<r;)o[i]=t+i*n;return o}function Cl(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function V0(t){return function(){return t}}function $0(t){return+t}var Pl=[0,1];function Sn(t){return t}function Ya(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:V0(isNaN(e)?NaN:.5)}function H0(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function W0(t,e,n){var i=t[0],r=t[1],o=e[0],s=e[1];return r<i?(i=Ya(r,i),o=n(s,o)):(i=Ya(i,r),o=n(o,s)),function(f){return o(i(f))}}function X0(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),s=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<i;)r[s]=Ya(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(f){var l=N0(t,f,1,i)-1;return o[l](r[l](f))}}function kl(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Il(){var t=Pl,e=Pl,n=La,i,r,o,s=Sn,f,l,u;function m(){var S=Math.min(t.length,e.length);return s!==Sn&&(s=H0(t[0],t[S-1])),f=S>2?X0:W0,l=u=null,y}function y(S){return S==null||isNaN(S=+S)?o:(l||(l=f(t.map(i),e,n)))(i(s(S)))}return y.invert=function(S){return s(r((u||(u=f(e,t.map(i),dn)))(S)))},y.domain=function(S){return arguments.length?(t=Array.from(S,$0),m()):t.slice()},y.range=function(S){return arguments.length?(e=Array.from(S),m()):e.slice()},y.rangeRound=function(S){return e=Array.from(S),n=sm,m()},y.clamp=function(S){return arguments.length?(s=S?!0:Sn,m()):s!==Sn},y.interpolate=function(S){return arguments.length?(n=S,m()):n},y.unknown=function(S){return arguments.length?(o=S,y):o},function(S,D){return i=S,r=D,m()}}function j0(){return Il()(Sn,Sn)}function q0(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function uo(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Li(t){return t=uo(Math.abs(t)),t?t[1]:NaN}function Y0(t,e){return function(n,i){for(var r=n.length,o=[],s=0,f=t[0],l=0;r>0&&f>0&&(l+f+1>i&&(f=Math.max(1,i-l)),o.push(n.substring(r-=f,r+f)),!((l+=f+1)>i));)f=t[s=(s+1)%t.length];return o.reverse().join(e)}}function Z0(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Q0=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function co(t){if(!(e=Q0.exec(t)))throw new Error("invalid format: "+t);var e;return new Za({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}co.prototype=Za.prototype;function Za(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Za.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function K0(t){e:for(var e=t.length,n=1,i=-1,r;n<e;++n)switch(t[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+t[n])break e;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(r+1):t}var Ll;function J0(t,e){var n=uo(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(Ll=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+uo(t,Math.max(0,e+o-1))[0]}function Dl(t,e){var n=uo(t,e);if(!n)return t+"";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")}const Fl={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:q0,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Dl(t*100,e),r:Dl,s:J0,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function zl(t){return t}var Rl=Array.prototype.map,Ml=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ev(t){var e=t.grouping===void 0||t.thousands===void 0?zl:Y0(Rl.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?zl:Z0(Rl.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",f=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(y){y=co(y);var S=y.fill,D=y.align,q=y.sign,Te=y.symbol,we=y.zero,fe=y.width,Ne=y.comma,Ve=y.precision,V=y.trim,se=y.type;se==="n"?(Ne=!0,se="g"):Fl[se]||(Ve===void 0&&(Ve=12),V=!0,se="g"),(we||S==="0"&&D==="=")&&(we=!0,S="0",D="=");var Le=Te==="$"?n:Te==="#"&&/[boxX]/.test(se)?"0"+se.toLowerCase():"",Be=Te==="$"?i:/[%p]/.test(se)?s:"",je=Fl[se],nt=/[defgprs%]/.test(se);Ve=Ve===void 0?6:/[gprs]/.test(se)?Math.max(1,Math.min(21,Ve)):Math.max(0,Math.min(20,Ve));function lt(Ee){var ut=Le,ot=Be,N,Pe,ie;if(se==="c")ot=je(Ee)+ot,Ee="";else{Ee=+Ee;var ke=Ee<0||1/Ee<0;if(Ee=isNaN(Ee)?l:je(Math.abs(Ee),Ve),V&&(Ee=K0(Ee)),ke&&+Ee==0&&q!=="+"&&(ke=!1),ut=(ke?q==="("?q:f:q==="-"||q==="("?"":q)+ut,ot=(se==="s"?Ml[8+Ll/3]:"")+ot+(ke&&q==="("?")":""),nt){for(N=-1,Pe=Ee.length;++N<Pe;)if(ie=Ee.charCodeAt(N),48>ie||ie>57){ot=(ie===46?r+Ee.slice(N+1):Ee.slice(N))+ot,Ee=Ee.slice(0,N);break}}}Ne&&!we&&(Ee=e(Ee,1/0));var He=ut.length+Ee.length+ot.length,qe=He<fe?new Array(fe-He+1).join(S):"";switch(Ne&&we&&(Ee=e(qe+Ee,qe.length?fe-ot.length:1/0),qe=""),D){case"<":Ee=ut+Ee+ot+qe;break;case"=":Ee=ut+qe+Ee+ot;break;case"^":Ee=qe.slice(0,He=qe.length>>1)+ut+Ee+ot+qe.slice(He);break;default:Ee=qe+ut+Ee+ot;break}return o(Ee)}return lt.toString=function(){return y+""},lt}function m(y,S){var D=u((y=co(y),y.type="f",y)),q=Math.max(-8,Math.min(8,Math.floor(Li(S)/3)))*3,Te=Math.pow(10,-q),we=Ml[8+q/3];return function(fe){return D(Te*fe)+we}}return{format:u,formatPrefix:m}}var ho,Ol,Nl;tv({thousands:",",grouping:[3],currency:["$",""]});function tv(t){return ho=ev(t),Ol=ho.format,Nl=ho.formatPrefix,ho}function nv(t){return Math.max(0,-Li(Math.abs(t)))}function iv(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Li(e)/3)))*3-Li(Math.abs(t)))}function rv(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Li(e)-Li(t))+1}function ov(t,e,n,i){var r=B0(t,e,n),o;switch(i=co(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(o=iv(r,s))&&(i.precision=o),Nl(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=rv(r,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=nv(r))&&(i.precision=o-(i.type==="%")*2);break}}return Ol(i)}function Gl(t){var e=t.domain;return t.ticks=function(n){var i=e();return G0(i[0],i[i.length-1],n??10)},t.tickFormat=function(n,i){var r=e();return ov(r[0],r[r.length-1],n??10,i)},t.nice=function(n){n==null&&(n=10);var i=e(),r=0,o=i.length-1,s=i[r],f=i[o],l,u,m=10;for(f<s&&(u=s,s=f,f=u,u=r,r=o,o=u);m-- >0;){if(u=El(s,f,n),u===l)return i[r]=s,i[o]=f,e(i);if(u>0)s=Math.floor(s/u)*u,f=Math.ceil(f/u)*u;else if(u<0)s=Math.ceil(s*u)/u,f=Math.floor(f*u)/u;else break;l=u}return t},t}function Qa(){var t=j0();return t.copy=function(){return kl(t,Qa())},Cl.apply(t,arguments),Gl(t)}function Bl(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function av(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function sv(t){return t<0?-t*t:t*t}function fv(t){var e=t(Sn,Sn),n=1;function i(){return n===1?t(Sn,Sn):n===.5?t(av,sv):t(Bl(n),Bl(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,i()):n},Gl(e)}function Ul(){var t=fv(Il());return t.copy=function(){return kl(t,Ul()).exponent(t.exponent())},Cl.apply(t,arguments),t}const lv=t=>{const e=Ul().exponent(2).range([0,1]).domain([-1,1]),n=U0(0,t).map(r=>-.5+r/t);n.push(.5);const i=new Array(n.length*2);return n.forEach((r,o)=>{i[o*2]=[e(r*2),.5],i[o*2+1]=[e(r*2),-.5]}),i};class uv extends zn{initPrograms(){const{reglInstance:e,config:n,store:i}=this;this.updateLinkIndexFbo(),this.hoveredLineIndexFbo||(this.hoveredLineIndexFbo=e.framebuffer({color:e.texture({width:1,height:1,format:"rgba",type:"float"}),depth:!1,stencil:!1})),this.drawCurveCommand||(this.drawCurveCommand=e({vert:D0,frag:L0,attributes:{position:{buffer:()=>this.curveLineBuffer,divisor:0},pointA:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},pointB:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*2,stride:Float32Array.BYTES_PER_ELEMENT*4},color:{buffer:()=>this.colorBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},width:{buffer:()=>this.widthBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1},arrow:{buffer:()=>this.arrowBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1},linkIndices:{buffer:()=>this.linkIndexBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1}},uniforms:{positionsTexture:()=>{var r;return(r=this.points)==null?void 0:r.currentPositionFbo},pointGreyoutStatus:()=>{var r;return(r=this.points)==null?void 0:r.greyoutStatusFbo},transformationMatrix:()=>i.transform,pointsTextureSize:()=>i.pointsTextureSize,widthScale:()=>n.linkWidthScale,linkArrowsSizeScale:()=>n.linkArrowsSizeScale,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,linkVisibilityDistanceRange:()=>n.linkVisibilityDistanceRange,linkVisibilityMinTransparency:()=>n.linkVisibilityMinTransparency,linkOpacity:()=>n.linkOpacity,greyoutOpacity:()=>n.linkGreyoutOpacity,scaleLinksOnZoom:()=>n.scaleLinksOnZoom,maxPointSize:()=>i.maxPointSize,curvedWeight:()=>n.curvedLinkWeight,curvedLinkControlPointDistance:()=>n.curvedLinkControlPointDistance,curvedLinkSegments:()=>n.curvedLinks?n.curvedLinkSegments??Oe.curvedLinkSegments:1,hoveredLinkIndex:()=>i.hoveredLinkIndex??-1,hoveredLinkColor:()=>i.hoveredLinkColor,hoveredLinkWidthIncrease:()=>n.hoveredLinkWidthIncrease,renderMode:e.prop("renderMode")},cull:{enable:!0,face:"back"},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1},framebuffer:e.prop("framebuffer"),count:()=>{var r;return((r=this.curveLineGeometry)==null?void 0:r.length)??0},instances:()=>this.data.linksNumber??0,primitive:"triangle strip"})),this.hoveredLineIndexCommand||(this.hoveredLineIndexCommand=e({vert:z0,frag:F0,attributes:{position:{buffer:()=>this.quadBuffer}},uniforms:{linkIndexTexture:()=>this.linkIndexFbo,mousePosition:()=>i.screenMousePosition,screenSize:()=>i.screenSize},framebuffer:this.hoveredLineIndexFbo,count:4,primitive:"triangle strip"})),this.quadBuffer||(this.quadBuffer=e.buffer([-1,-1,1,-1,-1,1,1,1]))}draw(){var e;this.pointsBuffer&&(this.colorBuffer||this.updateColor(),this.widthBuffer||this.updateWidth(),this.arrowBuffer||this.updateArrow(),this.curveLineGeometry||this.updateCurveLineGeometry(),(e=this.drawCurveCommand)==null||e.call(this,{framebuffer:null,renderMode:0}))}updateLinkIndexFbo(){const{reglInstance:e,store:n}=this;this.store.isLinkHoveringEnabled&&(this.linkIndexFbo||(this.linkIndexFbo=e.framebuffer()),this.linkIndexFbo({color:e.texture({width:n.screenSize[0],height:n.screenSize[1],format:"rgba",type:"float"}),depth:!1,stencil:!1}))}updatePointsBuffer(){const{reglInstance:e,data:n,store:i}=this;if(n.linksNumber===void 0||n.links===void 0)return;const r=new Float32Array(n.linksNumber*4);for(let s=0;s<n.linksNumber;s++){const f=n.links[s*2],l=n.links[s*2+1],u=f%i.pointsTextureSize,m=Math.floor(f/i.pointsTextureSize),y=l%i.pointsTextureSize,S=Math.floor(l/i.pointsTextureSize),D=s*4;r[D]=u,r[D+1]=m,r[D+2]=y,r[D+3]=S}this.pointsBuffer||(this.pointsBuffer=e.buffer(0)),this.pointsBuffer(r);const o=new Float32Array(n.linksNumber);for(let s=0;s<n.linksNumber;s++)o[s]=s;this.linkIndexBuffer||(this.linkIndexBuffer=e.buffer(0)),this.linkIndexBuffer(o)}updateColor(){const{reglInstance:e,data:n}=this;this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(n.linkColors??new Float32Array)}updateWidth(){const{reglInstance:e,data:n}=this;this.widthBuffer||(this.widthBuffer=e.buffer(0)),this.widthBuffer(n.linkWidths??new Float32Array)}updateArrow(){const{reglInstance:e,data:n}=this;this.arrowBuffer||(this.arrowBuffer=e.buffer(0)),this.arrowBuffer(n.linkArrows??new Float32Array)}updateCurveLineGeometry(){const{reglInstance:e,config:{curvedLinks:n,curvedLinkSegments:i}}=this;this.curveLineGeometry=lv(n?i??Oe.curvedLinkSegments:1),this.curveLineBuffer||(this.curveLineBuffer=e.buffer(0)),this.curveLineBuffer(this.curveLineGeometry)}findHoveredLine(){var e,n;!this.data.linksNumber||!this.store.isLinkHoveringEnabled||(this.linkIndexFbo||this.updateLinkIndexFbo(),this.reglInstance.clear({framebuffer:this.linkIndexFbo,color:[0,0,0,0]}),(e=this.drawCurveCommand)==null||e.call(this,{framebuffer:this.linkIndexFbo,renderMode:1}),(n=this.hoveredLineIndexCommand)==null||n.call(this))}}var cv=`#ifdef GL_ES
|
|
930
|
+
}`;function lo(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function R0(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function wl(t){let e,n,i;t.length!==2?(e=lo,n=(f,l)=>lo(t(f),l),i=(f,l)=>t(f)-l):(e=t===lo||t===R0?t:M0,n=t,i=t);function r(f,l,u=0,d=f.length){if(u<d){if(e(l,l)!==0)return d;do{const y=u+d>>>1;n(f[y],l)<0?u=y+1:d=y}while(u<d)}return u}function o(f,l,u=0,d=f.length){if(u<d){if(e(l,l)!==0)return d;do{const y=u+d>>>1;n(f[y],l)<=0?u=y+1:d=y}while(u<d)}return u}function s(f,l,u=0,d=f.length){const y=r(f,l,u,d-1);return y>u&&i(f[y-1],l)>-i(f[y],l)?y-1:y}return{left:r,center:s,right:o}}function M0(){return 0}function O0(t){return t===null?NaN:+t}const N0=wl(lo).right;wl(O0).center;function Al(t,e){let n,i;for(const r of t)r!=null&&(n===void 0?r>=r&&(n=i=r):(n>r&&(n=r),i<r&&(i=r)));return[n,i]}var Xa=Math.sqrt(50),ja=Math.sqrt(10),qa=Math.sqrt(2);function G0(t,e,n){var i,r=-1,o,s,f;if(e=+e,t=+t,n=+n,t===e&&n>0)return[t];if((i=e<t)&&(o=t,t=e,e=o),(f=El(t,e,n))===0||!isFinite(f))return[];if(f>0){let l=Math.round(t/f),u=Math.round(e/f);for(l*f<t&&++l,u*f>e&&--u,s=new Array(o=u-l+1);++r<o;)s[r]=(l+r)*f}else{f=-f;let l=Math.round(t*f),u=Math.round(e*f);for(l/f<t&&++l,u/f>e&&--u,s=new Array(o=u-l+1);++r<o;)s[r]=(l+r)/f}return i&&s.reverse(),s}function El(t,e,n){var i=(e-t)/Math.max(0,n),r=Math.floor(Math.log(i)/Math.LN10),o=i/Math.pow(10,r);return r>=0?(o>=Xa?10:o>=ja?5:o>=qa?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(o>=Xa?10:o>=ja?5:o>=qa?2:1)}function B0(t,e,n){var i=Math.abs(e-t)/Math.max(0,n),r=Math.pow(10,Math.floor(Math.log(i)/Math.LN10)),o=i/r;return o>=Xa?r*=10:o>=ja?r*=5:o>=qa&&(r*=2),e<t?-r:r}function U0(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(r);++i<r;)o[i]=t+i*n;return o}function Cl(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function V0(t){return function(){return t}}function $0(t){return+t}var Pl=[0,1];function Sn(t){return t}function Ya(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:V0(isNaN(e)?NaN:.5)}function H0(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function W0(t,e,n){var i=t[0],r=t[1],o=e[0],s=e[1];return r<i?(i=Ya(r,i),o=n(s,o)):(i=Ya(i,r),o=n(o,s)),function(f){return o(i(f))}}function X0(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),o=new Array(i),s=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<i;)r[s]=Ya(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(f){var l=N0(t,f,1,i)-1;return o[l](r[l](f))}}function kl(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Il(){var t=Pl,e=Pl,n=La,i,r,o,s=Sn,f,l,u;function d(){var S=Math.min(t.length,e.length);return s!==Sn&&(s=H0(t[0],t[S-1])),f=S>2?X0:W0,l=u=null,y}function y(S){return S==null||isNaN(S=+S)?o:(l||(l=f(t.map(i),e,n)))(i(s(S)))}return y.invert=function(S){return s(r((u||(u=f(e,t.map(i),dn)))(S)))},y.domain=function(S){return arguments.length?(t=Array.from(S,$0),d()):t.slice()},y.range=function(S){return arguments.length?(e=Array.from(S),d()):e.slice()},y.rangeRound=function(S){return e=Array.from(S),n=sm,d()},y.clamp=function(S){return arguments.length?(s=S?!0:Sn,d()):s!==Sn},y.interpolate=function(S){return arguments.length?(n=S,d()):n},y.unknown=function(S){return arguments.length?(o=S,y):o},function(S,D){return i=S,r=D,d()}}function j0(){return Il()(Sn,Sn)}function q0(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function uo(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Li(t){return t=uo(Math.abs(t)),t?t[1]:NaN}function Y0(t,e){return function(n,i){for(var r=n.length,o=[],s=0,f=t[0],l=0;r>0&&f>0&&(l+f+1>i&&(f=Math.max(1,i-l)),o.push(n.substring(r-=f,r+f)),!((l+=f+1)>i));)f=t[s=(s+1)%t.length];return o.reverse().join(e)}}function Z0(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Q0=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function co(t){if(!(e=Q0.exec(t)))throw new Error("invalid format: "+t);var e;return new Za({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}co.prototype=Za.prototype;function Za(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Za.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function K0(t){e:for(var e=t.length,n=1,i=-1,r;n<e;++n)switch(t[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+t[n])break e;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(r+1):t}var Ll;function J0(t,e){var n=uo(t,e);if(!n)return t+"";var i=n[0],r=n[1],o=r-(Ll=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,s=i.length;return o===s?i:o>s?i+new Array(o-s+1).join("0"):o>0?i.slice(0,o)+"."+i.slice(o):"0."+new Array(1-o).join("0")+uo(t,Math.max(0,e+o-1))[0]}function Dl(t,e){var n=uo(t,e);if(!n)return t+"";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")}const Fl={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:q0,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Dl(t*100,e),r:Dl,s:J0,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function zl(t){return t}var Rl=Array.prototype.map,Ml=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ev(t){var e=t.grouping===void 0||t.thousands===void 0?zl:Y0(Rl.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?zl:Z0(Rl.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",f=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(y){y=co(y);var S=y.fill,D=y.align,q=y.sign,Te=y.symbol,we=y.zero,fe=y.width,Ne=y.comma,Ve=y.precision,V=y.trim,ae=y.type;ae==="n"?(Ne=!0,ae="g"):Fl[ae]||(Ve===void 0&&(Ve=12),V=!0,ae="g"),(we||S==="0"&&D==="=")&&(we=!0,S="0",D="=");var Ie=Te==="$"?n:Te==="#"&&/[boxX]/.test(ae)?"0"+ae.toLowerCase():"",Be=Te==="$"?i:/[%p]/.test(ae)?s:"",Xe=Fl[ae],nt=/[defgprs%]/.test(ae);Ve=Ve===void 0?6:/[gprs]/.test(ae)?Math.max(1,Math.min(21,Ve)):Math.max(0,Math.min(20,Ve));function lt(Ee){var ct=Ie,ft=Be,G,Pe,se;if(ae==="c")ft=Xe(Ee)+ft,Ee="";else{Ee=+Ee;var De=Ee<0||1/Ee<0;if(Ee=isNaN(Ee)?l:Xe(Math.abs(Ee),Ve),V&&(Ee=K0(Ee)),De&&+Ee==0&&q!=="+"&&(De=!1),ct=(De?q==="("?q:f:q==="-"||q==="("?"":q)+ct,ft=(ae==="s"?Ml[8+Ll/3]:"")+ft+(De&&q==="("?")":""),nt){for(G=-1,Pe=Ee.length;++G<Pe;)if(se=Ee.charCodeAt(G),48>se||se>57){ft=(se===46?r+Ee.slice(G+1):Ee.slice(G))+ft,Ee=Ee.slice(0,G);break}}}Ne&&!we&&(Ee=e(Ee,1/0));var qe=ct.length+Ee.length+ft.length,je=qe<fe?new Array(fe-qe+1).join(S):"";switch(Ne&&we&&(Ee=e(je+Ee,je.length?fe-ft.length:1/0),je=""),D){case"<":Ee=ct+Ee+ft+je;break;case"=":Ee=ct+je+Ee+ft;break;case"^":Ee=je.slice(0,qe=je.length>>1)+ct+Ee+ft+je.slice(qe);break;default:Ee=je+ct+Ee+ft;break}return o(Ee)}return lt.toString=function(){return y+""},lt}function d(y,S){var D=u((y=co(y),y.type="f",y)),q=Math.max(-8,Math.min(8,Math.floor(Li(S)/3)))*3,Te=Math.pow(10,-q),we=Ml[8+q/3];return function(fe){return D(Te*fe)+we}}return{format:u,formatPrefix:d}}var ho,Ol,Nl;tv({thousands:",",grouping:[3],currency:["$",""]});function tv(t){return ho=ev(t),Ol=ho.format,Nl=ho.formatPrefix,ho}function nv(t){return Math.max(0,-Li(Math.abs(t)))}function iv(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Li(e)/3)))*3-Li(Math.abs(t)))}function rv(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Li(e)-Li(t))+1}function ov(t,e,n,i){var r=B0(t,e,n),o;switch(i=co(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(o=iv(r,s))&&(i.precision=o),Nl(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=rv(r,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=nv(r))&&(i.precision=o-(i.type==="%")*2);break}}return Ol(i)}function Gl(t){var e=t.domain;return t.ticks=function(n){var i=e();return G0(i[0],i[i.length-1],n??10)},t.tickFormat=function(n,i){var r=e();return ov(r[0],r[r.length-1],n??10,i)},t.nice=function(n){n==null&&(n=10);var i=e(),r=0,o=i.length-1,s=i[r],f=i[o],l,u,d=10;for(f<s&&(u=s,s=f,f=u,u=r,r=o,o=u);d-- >0;){if(u=El(s,f,n),u===l)return i[r]=s,i[o]=f,e(i);if(u>0)s=Math.floor(s/u)*u,f=Math.ceil(f/u)*u;else if(u<0)s=Math.ceil(s*u)/u,f=Math.floor(f*u)/u;else break;l=u}return t},t}function Qa(){var t=j0();return t.copy=function(){return kl(t,Qa())},Cl.apply(t,arguments),Gl(t)}function Bl(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function av(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function sv(t){return t<0?-t*t:t*t}function fv(t){var e=t(Sn,Sn),n=1;function i(){return n===1?t(Sn,Sn):n===.5?t(av,sv):t(Bl(n),Bl(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,i()):n},Gl(e)}function Ul(){var t=fv(Il());return t.copy=function(){return kl(t,Ul()).exponent(t.exponent())},Cl.apply(t,arguments),t}const lv=t=>{const e=Ul().exponent(2).range([0,1]).domain([-1,1]),n=U0(0,t).map(r=>-.5+r/t);n.push(.5);const i=new Array(n.length*2);return n.forEach((r,o)=>{i[o*2]=[e(r*2),.5],i[o*2+1]=[e(r*2),-.5]}),i};class uv extends zn{initPrograms(){const{reglInstance:e,config:n,store:i}=this;this.updateLinkIndexFbo(),this.hoveredLineIndexFbo||(this.hoveredLineIndexFbo=e.framebuffer({color:e.texture({width:1,height:1,format:"rgba",type:"float"}),depth:!1,stencil:!1})),this.drawCurveCommand||(this.drawCurveCommand=e({vert:D0,frag:L0,attributes:{position:{buffer:()=>this.curveLineBuffer,divisor:0},pointA:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},pointB:{buffer:()=>this.pointsBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*2,stride:Float32Array.BYTES_PER_ELEMENT*4},color:{buffer:()=>this.colorBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*4},width:{buffer:()=>this.widthBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1},arrow:{buffer:()=>this.arrowBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1},linkIndices:{buffer:()=>this.linkIndexBuffer,divisor:1,offset:Float32Array.BYTES_PER_ELEMENT*0,stride:Float32Array.BYTES_PER_ELEMENT*1}},uniforms:{positionsTexture:()=>{var r;return(r=this.points)==null?void 0:r.currentPositionFbo},pointGreyoutStatus:()=>{var r;return(r=this.points)==null?void 0:r.greyoutStatusFbo},transformationMatrix:()=>i.transform,pointsTextureSize:()=>i.pointsTextureSize,widthScale:()=>n.linkWidthScale,linkArrowsSizeScale:()=>n.linkArrowsSizeScale,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,linkVisibilityDistanceRange:()=>n.linkVisibilityDistanceRange,linkVisibilityMinTransparency:()=>n.linkVisibilityMinTransparency,linkOpacity:()=>n.linkOpacity,greyoutOpacity:()=>n.linkGreyoutOpacity,scaleLinksOnZoom:()=>n.scaleLinksOnZoom,maxPointSize:()=>i.maxPointSize,curvedWeight:()=>n.curvedLinkWeight,curvedLinkControlPointDistance:()=>n.curvedLinkControlPointDistance,curvedLinkSegments:()=>n.curvedLinks?n.curvedLinkSegments??Oe.curvedLinkSegments:1,hoveredLinkIndex:()=>i.hoveredLinkIndex??-1,hoveredLinkColor:()=>i.hoveredLinkColor,hoveredLinkWidthIncrease:()=>n.hoveredLinkWidthIncrease,renderMode:e.prop("renderMode")},cull:{enable:!0,face:"back"},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1},framebuffer:e.prop("framebuffer"),count:()=>{var r;return((r=this.curveLineGeometry)==null?void 0:r.length)??0},instances:()=>this.data.linksNumber??0,primitive:"triangle strip"})),this.hoveredLineIndexCommand||(this.hoveredLineIndexCommand=e({vert:z0,frag:F0,attributes:{position:{buffer:()=>this.quadBuffer}},uniforms:{linkIndexTexture:()=>this.linkIndexFbo,mousePosition:()=>i.screenMousePosition,screenSize:()=>i.screenSize},framebuffer:this.hoveredLineIndexFbo,count:4,primitive:"triangle strip"})),this.quadBuffer||(this.quadBuffer=e.buffer([-1,-1,1,-1,-1,1,1,1]))}draw(){var e;this.pointsBuffer&&(this.colorBuffer||this.updateColor(),this.widthBuffer||this.updateWidth(),this.arrowBuffer||this.updateArrow(),this.curveLineGeometry||this.updateCurveLineGeometry(),(e=this.drawCurveCommand)==null||e.call(this,{framebuffer:null,renderMode:0}))}updateLinkIndexFbo(){const{reglInstance:e,store:n}=this;this.store.isLinkHoveringEnabled&&(this.linkIndexFbo||(this.linkIndexFbo=e.framebuffer()),this.linkIndexFbo({color:e.texture({width:n.screenSize[0],height:n.screenSize[1],format:"rgba",type:"float"}),depth:!1,stencil:!1}))}updatePointsBuffer(){const{reglInstance:e,data:n,store:i}=this;if(n.linksNumber===void 0||n.links===void 0)return;const r=new Float32Array(n.linksNumber*4);for(let s=0;s<n.linksNumber;s++){const f=n.links[s*2],l=n.links[s*2+1],u=f%i.pointsTextureSize,d=Math.floor(f/i.pointsTextureSize),y=l%i.pointsTextureSize,S=Math.floor(l/i.pointsTextureSize),D=s*4;r[D]=u,r[D+1]=d,r[D+2]=y,r[D+3]=S}this.pointsBuffer||(this.pointsBuffer=e.buffer(0)),this.pointsBuffer(r);const o=new Float32Array(n.linksNumber);for(let s=0;s<n.linksNumber;s++)o[s]=s;this.linkIndexBuffer||(this.linkIndexBuffer=e.buffer(0)),this.linkIndexBuffer(o)}updateColor(){const{reglInstance:e,data:n}=this;this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(n.linkColors??new Float32Array)}updateWidth(){const{reglInstance:e,data:n}=this;this.widthBuffer||(this.widthBuffer=e.buffer(0)),this.widthBuffer(n.linkWidths??new Float32Array)}updateArrow(){const{reglInstance:e,data:n}=this;this.arrowBuffer||(this.arrowBuffer=e.buffer(0)),this.arrowBuffer(n.linkArrows??new Float32Array)}updateCurveLineGeometry(){const{reglInstance:e,config:{curvedLinks:n,curvedLinkSegments:i}}=this;this.curveLineGeometry=lv(n?i??Oe.curvedLinkSegments:1),this.curveLineBuffer||(this.curveLineBuffer=e.buffer(0)),this.curveLineBuffer(this.curveLineGeometry)}findHoveredLine(){var e,n;!this.data.linksNumber||!this.store.isLinkHoveringEnabled||(this.linkIndexFbo||this.updateLinkIndexFbo(),this.reglInstance.clear({framebuffer:this.linkIndexFbo,color:[0,0,0,0]}),(e=this.drawCurveCommand)==null||e.call(this,{framebuffer:this.linkIndexFbo,renderMode:1}),(n=this.hoveredLineIndexCommand)==null||n.call(this))}}var cv=`#ifdef GL_ES
|
|
931
931
|
precision highp float;
|
|
932
932
|
#endif
|
|
933
933
|
|
|
@@ -1667,7 +1667,7 @@ void main() {
|
|
|
1667
1667
|
}
|
|
1668
1668
|
|
|
1669
1669
|
gl_FragColor = pointPosition;
|
|
1670
|
-
}`;function wv(t,e=16384){if(!(t!=null&&t.length))return null;let n=0;for(const u of t){const m=Math.max(u.width,u.height);m>n&&(n=m)}if(n===0)return console.warn("Invalid image dimensions: all images have zero width or height"),null;const i=n,r=Math.ceil(Math.sqrt(t.length));let o=r*n,s=1;o>e&&(s=e/o,n=Math.max(1,Math.floor(n*s)),o=Math.max(1,Math.floor(o*s)),console.warn(`🖼️ Atlas scaling required: Original size ${(i*r).toLocaleString()}px exceeds WebGL limit ${e.toLocaleString()}px. Scaling down to ${o.toLocaleString()}px (${Math.round(s*100)}% of original quality)`));const f=new Uint8Array(o*o*4).fill(0),l=new Float32Array(r*r*4).fill(-1);for(const[u,m]of t.entries()){const y=m.width,S=m.height;if(y===0||S===0)continue;const D=Math.min(1,n/Math.max(y,S)),q=Math.floor(y*D),Te=Math.floor(S*D),we=Math.floor(u/r),Ne=u%r*n,Ve=we*n;l[u*4]=Ne/o,l[u*4+1]=Ve/o,l[u*4+2]=(Ne+q)/o,l[u*4+3]=(Ve+Te)/o;for(let V=0;V<Te;V++)for(let se=0;se<q;se++){const Le=Math.floor(se*(y/q)),je=(Math.floor(V*(S/Te))*y+Le)*4,nt=((Ve+V)*o+(Ne+se))*4;f[nt]=m.data[je]??0,f[nt+1]=m.data[je+1]??0,f[nt+2]=m.data[je+2]??0,f[nt+3]=m.data[je+3]??255}}return{atlasData:f,atlasSize:o,atlasCoords:l,atlasCoordsSize:r}}class Av extends zn{constructor(){super(...arguments),this.imageCount=0,this.isPositionsUpToDate=!1,this.polygonPathLength=0}updatePositions(){const{reglInstance:e,store:n,data:i,config:{rescalePositions:r,enableSimulation:o}}=this,{pointsTextureSize:s}=n;if(!s||!i.pointPositions||i.pointsNumber===void 0)return;const f=new Float32Array(s*s*4);let l=r;r===void 0&&!o&&(l=!0),this.shouldSkipRescale&&(l=!1),l?this.rescaleInitialNodePositions():this.shouldSkipRescale||(this.scaleX=void 0,this.scaleY=void 0),this.shouldSkipRescale=void 0;for(let u=0;u<i.pointsNumber;++u)f[u*4+0]=i.pointPositions[u*2+0],f[u*4+1]=i.pointPositions[u*2+1],f[u*4+2]=u;this.currentPositionFbo||(this.currentPositionFbo=e.framebuffer()),this.currentPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.previousPositionFbo||(this.previousPositionFbo=e.framebuffer()),this.previousPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.config.enableSimulation&&(this.velocityFbo||(this.velocityFbo=e.framebuffer()),this.velocityFbo({color:e.texture({data:new Float32Array(s*s*4).fill(0),shape:[s,s,4],type:"float"}),depth:!1,stencil:!1})),this.selectedTexture||(this.selectedTexture=e.texture()),this.selectedTexture({data:f,shape:[s,s,4],type:"float"}),this.selectedFbo||(this.selectedFbo=e.framebuffer()),this.selectedFbo({color:this.selectedTexture,depth:!1,stencil:!1}),this.hoveredFbo||(this.hoveredFbo=e.framebuffer()),this.hoveredFbo({shape:[2,2],colorType:"float",depth:!1,stencil:!1}),this.drawPointIndices||(this.drawPointIndices=e.buffer(0)),this.drawPointIndices(oi(n.pointsTextureSize)),this.hoveredPointIndices||(this.hoveredPointIndices=e.buffer(0)),this.hoveredPointIndices(oi(n.pointsTextureSize)),this.sampledPointIndices||(this.sampledPointIndices=e.buffer(0)),this.sampledPointIndices(oi(n.pointsTextureSize)),this.updateGreyoutStatus(),this.updatePinnedStatus(),this.updateSampledPointsGrid(),this.trackPointsByIndices()}initPrograms(){const{reglInstance:e,config:n,store:i,data:r}=this;n.enableSimulation&&(this.updatePositionCommand||(this.updatePositionCommand=e({frag:_v,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,velocity:()=>this.velocityFbo,friction:()=>n.simulationFriction,spaceSize:()=>i.adjustedSpaceSize,pinnedStatusTexture:()=>this.pinnedStatusFbo}}))),this.dragPointCommand||(this.dragPointCommand=e({frag:Tv,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,mousePos:()=>i.mousePosition,index:()=>{var o;return((o=i.hoveredPoint)==null?void 0:o.index)??-1}}})),this.drawCommand||(this.drawCommand=e({frag:cv,vert:hv,primitive:"points",count:()=>r.pointsNumber??0,attributes:{pointIndices:{buffer:this.drawPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1},color:{buffer:()=>this.colorBuffer,size:4},shape:{buffer:()=>this.shapeBuffer,size:1},imageIndex:{buffer:()=>this.imageIndicesBuffer,size:1},imageSize:{buffer:()=>this.imageSizesBuffer,size:1}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointGreyoutStatus:()=>this.greyoutStatusFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,pointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,greyoutColor:()=>i.greyoutPointColor,backgroundColor:()=>i.backgroundColor,isDarkenGreyout:()=>i.isDarkenGreyout,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>i.maxPointSize,skipSelected:e.prop("skipSelected"),skipUnselected:e.prop("skipUnselected"),imageAtlasTexture:()=>this.imageAtlasTexture,imageAtlasCoords:()=>this.imageAtlasCoordsTexture,hasImages:()=>this.imageCount>0,imageCount:()=>this.imageCount,imageAtlasCoordsTextureSize:()=>this.imageAtlasCoordsTextureSize},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.findPointsOnAreaSelectionCommand||(this.findPointsOnAreaSelectionCommand=e({frag:dv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointSize:()=>this.sizeFbo,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,sizeScale:()=>n.pointSizeScale,transformationMatrix:()=>i.transform,ratio:()=>n.pixelRatio,selection0:()=>i.selectedArea[0],selection1:()=>i.selectedArea[1],scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>i.maxPointSize}})),this.findPointsOnPolygonSelectionCommand||(this.findPointsOnPolygonSelectionCommand=e({frag:mv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,transformationMatrix:()=>i.transform,polygonPathTexture:()=>this.polygonPathTexture,polygonPathLength:()=>this.polygonPathLength}})),this.clearHoveredFboCommand||(this.clearHoveredFboCommand=e({frag:ai,vert:kt,framebuffer:this.hoveredFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.findHoveredPointCommand||(this.findHoveredPointCommand=e({frag:gv,vert:yv,primitive:"points",count:()=>r.pointsNumber??0,framebuffer:()=>this.hoveredFbo,attributes:{pointIndices:{buffer:this.hoveredPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1}},uniforms:{positionsTexture:()=>this.currentPositionFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,mousePosition:()=>i.screenMousePosition,maxPointSize:()=>i.maxPointSize},depth:{enable:!1,mask:!1}})),this.clearSampledPointsFboCommand||(this.clearSampledPointsFboCommand=e({frag:ai,vert:kt,framebuffer:()=>this.sampledPointsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.fillSampledPointsFboCommand||(this.fillSampledPointsFboCommand=e({frag:xv,vert:bv,primitive:"points",count:()=>r.pointsNumber??0,framebuffer:()=>this.sampledPointsFbo,attributes:{pointIndices:{buffer:this.sampledPointIndices,size:2}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize},depth:{enable:!1,mask:!1}})),this.drawHighlightedCommand||(this.drawHighlightedCommand=e({frag:pv,vert:vv,attributes:{vertexCoord:wt(e)},primitive:"triangle strip",count:4,uniforms:{color:e.prop("color"),width:e.prop("width"),pointIndex:e.prop("pointIndex"),size:e.prop("size"),positionsTexture:()=>this.currentPositionFbo,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>i.maxPointSize,pointGreyoutStatusTexture:()=>this.greyoutStatusFbo,universalPointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,isDarkenGreyout:()=>i.isDarkenGreyout,backgroundColor:()=>i.backgroundColor,greyoutColor:()=>i.greyoutPointColor},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.trackPointsCommand||(this.trackPointsCommand=e({frag:Sv,vert:kt,framebuffer:()=>this.trackedPositionsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,trackedIndices:()=>this.trackedIndicesFbo,pointsTextureSize:()=>i.pointsTextureSize}}))}updateColor(){const{reglInstance:e,store:{pointsTextureSize:n},data:i}=this;n&&(this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(i.pointColors))}updateGreyoutStatus(){const{reglInstance:e,store:{selectedIndices:n,pointsTextureSize:i}}=this;if(!i)return;const r=new Float32Array(i*i*4).fill(n?1:0);if(n)for(const o of n)r[o*4]=0;this.greyoutStatusTexture||(this.greyoutStatusTexture=e.texture()),this.greyoutStatusTexture({data:r,width:i,height:i,type:"float"}),this.greyoutStatusFbo||(this.greyoutStatusFbo=e.framebuffer()),this.greyoutStatusFbo({color:this.greyoutStatusTexture,depth:!1,stencil:!1})}updatePinnedStatus(){const{reglInstance:e,store:{pointsTextureSize:n},data:i}=this;if(!n)return;const r=new Float32Array(n*n*4).fill(0);if(i.inputPinnedPoints&&i.pointsNumber!==void 0)for(const o of i.inputPinnedPoints)o>=0&&o<i.pointsNumber&&(r[o*4]=1);this.pinnedStatusTexture||(this.pinnedStatusTexture=e.texture()),this.pinnedStatusTexture({data:r,width:n,height:n,type:"float"}),this.pinnedStatusFbo||(this.pinnedStatusFbo=e.framebuffer()),this.pinnedStatusFbo({color:this.pinnedStatusTexture,depth:!1,stencil:!1})}updateSize(){const{reglInstance:e,store:{pointsTextureSize:n},data:i}=this;if(!n||i.pointsNumber===void 0||i.pointSizes===void 0)return;this.sizeBuffer||(this.sizeBuffer=e.buffer(0)),this.sizeBuffer(i.pointSizes);const r=new Float32Array(n*n*4);for(let o=0;o<i.pointsNumber;o++)r[o*4]=i.pointSizes[o];this.sizeTexture||(this.sizeTexture=e.texture()),this.sizeTexture({data:r,width:n,height:n,type:"float"}),this.sizeFbo||(this.sizeFbo=e.framebuffer()),this.sizeFbo({color:this.sizeTexture,depth:!1,stencil:!1})}updateShape(){const{reglInstance:e,data:n}=this;n.pointsNumber===void 0||n.pointShapes===void 0||(this.shapeBuffer||(this.shapeBuffer=e.buffer(0)),this.shapeBuffer(n.pointShapes))}updateImageIndices(){const{reglInstance:e,data:n}=this;n.pointsNumber===void 0||n.pointImageIndices===void 0||(this.imageIndicesBuffer||(this.imageIndicesBuffer=e.buffer(0)),this.imageIndicesBuffer(n.pointImageIndices))}updateImageSizes(){const{reglInstance:e,data:n}=this;n.pointsNumber===void 0||n.pointImageSizes===void 0||(this.imageSizesBuffer||(this.imageSizesBuffer=e.buffer(0)),this.imageSizesBuffer(n.pointImageSizes))}createAtlas(){var u;const{reglInstance:e,data:n,store:i}=this;if(this.imageAtlasTexture||(this.imageAtlasTexture=e.texture()),this.imageAtlasCoordsTexture||(this.imageAtlasCoordsTexture=e.texture()),!((u=n.inputImageData)!=null&&u.length)){this.imageCount=0,this.imageAtlasCoordsTextureSize=0;return}const r=wv(n.inputImageData,i.webglMaxTextureSize);if(!r){console.warn("Failed to create atlas from image data");return}this.imageCount=n.inputImageData.length;const{atlasData:o,atlasSize:s,atlasCoords:f,atlasCoordsSize:l}=r;this.imageAtlasCoordsTextureSize=l,this.imageAtlasTexture({data:o,shape:[s,s,4],type:"uint8"}),this.imageAtlasCoordsTexture({data:f,shape:[l,l,4],type:"float"})}updateSampledPointsGrid(){const{store:{screenSize:e},config:{pointSamplingDistance:n},reglInstance:i}=this;let r=n??Math.min(...e)/2;r===0&&(r=Oe.pointSamplingDistance);const o=Math.ceil(e[0]/r),s=Math.ceil(e[1]/r);this.sampledPointsFbo||(this.sampledPointsFbo=i.framebuffer()),this.sampledPointsFbo({shape:[o,s],depth:!1,stencil:!1,colorType:"float"})}trackPoints(){var e,n;(e=this.trackedIndices)!=null&&e.length&&((n=this.trackPointsCommand)==null||n.call(this))}draw(){var o,s,f,l,u,m,y;const{config:{renderHoveredPointRing:e,pointSize:n},store:i,data:r}=this;this.colorBuffer||this.updateColor(),this.sizeBuffer||this.updateSize(),this.shapeBuffer||this.updateShape(),this.imageIndicesBuffer||this.updateImageIndices(),this.imageSizesBuffer||this.updateImageSizes(),(!this.imageAtlasCoordsTexture||!this.imageAtlasTexture)&&this.createAtlas(),i.selectedIndices&&i.selectedIndices.length>0?((o=this.drawCommand)==null||o.call(this,{skipSelected:!0,skipUnselected:!1}),(s=this.drawCommand)==null||s.call(this,{skipSelected:!1,skipUnselected:!0})):(f=this.drawCommand)==null||f.call(this,{skipSelected:!1,skipUnselected:!1}),e&&i.hoveredPoint&&((u=this.drawHighlightedCommand)==null||u.call(this,{width:.85,color:i.hoveredPointRingColor,pointIndex:i.hoveredPoint.index,size:((l=r.pointSizes)==null?void 0:l[i.hoveredPoint.index])??n})),i.focusedPoint&&((y=this.drawHighlightedCommand)==null||y.call(this,{width:.75,color:i.focusedPointRingColor,pointIndex:i.focusedPoint.index,size:((m=r.pointSizes)==null?void 0:m[i.focusedPoint.index])??n}))}updatePosition(){var e;(e=this.updatePositionCommand)==null||e.call(this),this.swapFbo(),this.isPositionsUpToDate=!1}drag(){var e;(e=this.dragPointCommand)==null||e.call(this),this.swapFbo(),this.isPositionsUpToDate=!1}findPointsOnAreaSelection(){var e;(e=this.findPointsOnAreaSelectionCommand)==null||e.call(this)}findPointsOnPolygonSelection(){var e;(e=this.findPointsOnPolygonSelectionCommand)==null||e.call(this)}updatePolygonPath(e){const{reglInstance:n}=this;if(this.polygonPathLength=e.length,e.length===0){this.polygonPathTexture=void 0,this.polygonPathFbo=void 0;return}const i=Math.ceil(Math.sqrt(e.length)),r=new Float32Array(i*i*4);for(const[o,s]of e.entries()){const[f,l]=s;r[o*4]=f,r[o*4+1]=l,r[o*4+2]=0,r[o*4+3]=0}this.polygonPathTexture||(this.polygonPathTexture=n.texture()),this.polygonPathTexture({data:r,width:i,height:i,type:"float"}),this.polygonPathFbo||(this.polygonPathFbo=n.framebuffer()),this.polygonPathFbo({color:this.polygonPathTexture,depth:!1,stencil:!1})}findHoveredPoint(){var e,n;(e=this.clearHoveredFboCommand)==null||e.call(this),(n=this.findHoveredPointCommand)==null||n.call(this)}trackPointsByIndices(e){const{store:{pointsTextureSize:n},reglInstance:i}=this;if(this.trackedIndices=e,this.trackedPositions=void 0,this.isPositionsUpToDate=!1,!(e!=null&&e.length)||!n)return;const r=Math.ceil(Math.sqrt(e.length)),o=new Float32Array(r*r*4).fill(-1);for(const[s,f]of e.entries())f!==void 0&&(o[s*4]=f%n,o[s*4+1]=Math.floor(f/n),o[s*4+2]=0,o[s*4+3]=0);this.trackedIndicesTexture||(this.trackedIndicesTexture=i.texture()),this.trackedIndicesTexture({data:o,width:r,height:r,type:"float"}),this.trackedIndicesFbo||(this.trackedIndicesFbo=i.framebuffer()),this.trackedIndicesFbo({color:this.trackedIndicesTexture,depth:!1,stencil:!1}),this.trackedPositionsFbo||(this.trackedPositionsFbo=i.framebuffer()),this.trackedPositionsFbo({shape:[r,r],depth:!1,stencil:!1,colorType:"float"}),this.trackPoints()}getTrackedPositionsMap(){if(!this.trackedIndices)return new Map;const{config:{enableSimulation:e},store:{isSimulationRunning:n}}=this;if((!e||!n)&&this.isPositionsUpToDate&&this.trackedPositions)return this.trackedPositions;const i=Qt(this.reglInstance,this.trackedPositionsFbo),r=new Map;for(let o=0;o<i.length/4;o+=1){const s=i[o*4],f=i[o*4+1],l=this.trackedIndices[o];s!==void 0&&f!==void 0&&l!==void 0&&r.set(l,[s,f])}return(!e||!n)&&(this.trackedPositions=r,this.isPositionsUpToDate=!0),r}getSampledPointPositionsMap(){var i,r;const e=new Map;if(!this.sampledPointsFbo)return e;(i=this.clearSampledPointsFboCommand)==null||i.call(this),(r=this.fillSampledPointsFboCommand)==null||r.call(this);const n=Qt(this.reglInstance,this.sampledPointsFbo);for(let o=0;o<n.length/4;o++){const s=n[o*4],f=!!n[o*4+1],l=n[o*4+2],u=n[o*4+3];f&&s!==void 0&&l!==void 0&&u!==void 0&&e.set(s,[l,u])}return e}getSampledPoints(){var r,o;const e=[],n=[];if(!this.sampledPointsFbo)return{indices:e,positions:n};(r=this.clearSampledPointsFboCommand)==null||r.call(this),(o=this.fillSampledPointsFboCommand)==null||o.call(this);const i=Qt(this.reglInstance,this.sampledPointsFbo);for(let s=0;s<i.length/4;s++){const f=i[s*4],l=!!i[s*4+1],u=i[s*4+2],m=i[s*4+3];l&&f!==void 0&&u!==void 0&&m!==void 0&&(e.push(f),n.push(u,m))}return{indices:e,positions:n}}getTrackedPositionsArray(){const e=[];if(!this.trackedIndices)return e;e.length=this.trackedIndices.length*2;const n=Qt(this.reglInstance,this.trackedPositionsFbo);for(let i=0;i<n.length/4;i+=1){const r=n[i*4],o=n[i*4+1],s=this.trackedIndices[i];r!==void 0&&o!==void 0&&s!==void 0&&(e[i*2]=r,e[i*2+1]=o)}return e}swapFbo(){const e=this.previousPositionFbo;this.previousPositionFbo=this.currentPositionFbo,this.currentPositionFbo=e}rescaleInitialNodePositions(){const{config:{spaceSize:e}}=this;if(!this.data.pointPositions||!e)return;const n=this.data.pointPositions,i=n.length/2;let r=1/0,o=-1/0,s=1/0,f=-1/0;for(let we=0;we<n.length;we+=2){const fe=n[we],Ne=n[we+1];r=Math.min(r,fe),o=Math.max(o,fe),s=Math.min(s,Ne),f=Math.max(f,Ne)}const l=o-r,u=f-s,m=Math.max(l,u);if(m>e){this.scaleX=void 0,this.scaleY=void 0;return}const y=e*e*.001,D=(i>y?e*Math.max(1.2,Math.sqrt(i)/e):e*.1)/m,q=(m-l)/2*D,Te=(m-u)/2*D;this.scaleX=we=>(we-r)*D+q,this.scaleY=we=>(we-s)*D+Te;for(let we=0;we<i;we++)this.data.pointPositions[we*2]=this.scaleX(n[we*2]),this.data.pointPositions[we*2+1]=this.scaleY(n[we*2+1])}}var Vl=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Ev(){var t=new Vl(9);return Vl!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function $l(t,e,n){var i=e[0],r=e[1],o=e[2],s=e[3],f=e[4],l=e[5],u=e[6],m=e[7],y=e[8],S=n[0],D=n[1];return t[0]=i,t[1]=r,t[2]=o,t[3]=s,t[4]=f,t[5]=l,t[6]=S*i+D*s+u,t[7]=S*r+D*f+m,t[8]=S*o+D*l+y,t}function Ka(t,e,n){var i=n[0],r=n[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=r*e[3],t[4]=r*e[4],t[5]=r*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Cv(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var mo={exports:{}},Pv=mo.exports,Hl;function kv(){return Hl||(Hl=1,function(t){(function(e,n,i){function r(l){var u=this,m=f();u.next=function(){var y=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=y-(u.c=y|0)},u.c=1,u.s0=m(" "),u.s1=m(" "),u.s2=m(" "),u.s0-=m(l),u.s0<0&&(u.s0+=1),u.s1-=m(l),u.s1<0&&(u.s1+=1),u.s2-=m(l),u.s2<0&&(u.s2+=1),m=null}function o(l,u){return u.c=l.c,u.s0=l.s0,u.s1=l.s1,u.s2=l.s2,u}function s(l,u){var m=new r(l),y=u&&u.state,S=m.next;return S.int32=function(){return m.next()*4294967296|0},S.double=function(){return S()+(S()*2097152|0)*11102230246251565e-32},S.quick=S,y&&(typeof y=="object"&&o(y,m),S.state=function(){return o(m,{})}),S}function f(){var l=4022871197,u=function(m){m=String(m);for(var y=0;y<m.length;y++){l+=m.charCodeAt(y);var S=.02519603282416938*l;l=S>>>0,S-=l,S*=l,l=S>>>0,S-=l,l+=S*4294967296}return(l>>>0)*23283064365386963e-26};return u}n&&n.exports?n.exports=s:this.alea=s})(Pv,t)}(mo)),mo.exports}var po={exports:{}},Iv=po.exports,Wl;function Lv(){return Wl||(Wl=1,function(t){(function(e,n,i){function r(f){var l=this,u="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var y=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^y^y>>>8},f===(f|0)?l.x=f:u+=f;for(var m=0;m<u.length+64;m++)l.x^=u.charCodeAt(m)|0,l.next()}function o(f,l){return l.x=f.x,l.y=f.y,l.z=f.z,l.w=f.w,l}function s(f,l){var u=new r(f),m=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,m&&(typeof m=="object"&&o(m,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xor128=s})(Iv,t)}(po)),po.exports}var vo={exports:{}},Dv=vo.exports,Xl;function Fv(){return Xl||(Xl=1,function(t){(function(e,n,i){function r(f){var l=this,u="";l.next=function(){var y=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(y^y<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,f===(f|0)?l.x=f:u+=f;for(var m=0;m<u.length+64;m++)l.x^=u.charCodeAt(m)|0,m==u.length&&(l.d=l.x<<10^l.x>>>4),l.next()}function o(f,l){return l.x=f.x,l.y=f.y,l.z=f.z,l.w=f.w,l.v=f.v,l.d=f.d,l}function s(f,l){var u=new r(f),m=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,m&&(typeof m=="object"&&o(m,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xorwow=s})(Dv,t)}(vo)),vo.exports}var go={exports:{}},zv=go.exports,jl;function Rv(){return jl||(jl=1,function(t){(function(e,n,i){function r(f){var l=this;l.next=function(){var m=l.x,y=l.i,S,D;return S=m[y],S^=S>>>7,D=S^S<<24,S=m[y+1&7],D^=S^S>>>10,S=m[y+3&7],D^=S^S>>>3,S=m[y+4&7],D^=S^S<<7,S=m[y+7&7],S=S^S<<13,D^=S^S<<9,m[y]=D,l.i=y+1&7,D};function u(m,y){var S,D=[];if(y===(y|0))D[0]=y;else for(y=""+y,S=0;S<y.length;++S)D[S&7]=D[S&7]<<15^y.charCodeAt(S)+D[S+1&7]<<13;for(;D.length<8;)D.push(0);for(S=0;S<8&&D[S]===0;++S);for(S==8?D[7]=-1:D[S],m.x=D,m.i=0,S=256;S>0;--S)m.next()}u(l,f)}function o(f,l){return l.x=f.x.slice(),l.i=f.i,l}function s(f,l){f==null&&(f=+new Date);var u=new r(f),m=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,m&&(m.x&&o(m,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xorshift7=s})(zv,t)}(go)),go.exports}var yo={exports:{}},Mv=yo.exports,ql;function Ov(){return ql||(ql=1,function(t){(function(e,n,i){function r(f){var l=this;l.next=function(){var m=l.w,y=l.X,S=l.i,D,q;return l.w=m=m+1640531527|0,q=y[S+34&127],D=y[S=S+1&127],q^=q<<13,D^=D<<17,q^=q>>>15,D^=D>>>12,q=y[S]=q^D,l.i=S,q+(m^m>>>16)|0};function u(m,y){var S,D,q,Te,we,fe=[],Ne=128;for(y===(y|0)?(D=y,y=null):(y=y+"\0",D=0,Ne=Math.max(Ne,y.length)),q=0,Te=-32;Te<Ne;++Te)y&&(D^=y.charCodeAt((Te+32)%y.length)),Te===0&&(we=D),D^=D<<10,D^=D>>>15,D^=D<<4,D^=D>>>13,Te>=0&&(we=we+1640531527|0,S=fe[Te&127]^=D+we,q=S==0?q+1:0);for(q>=128&&(fe[(y&&y.length||0)&127]=-1),q=127,Te=4*128;Te>0;--Te)D=fe[q+34&127],S=fe[q=q+1&127],D^=D<<13,S^=S<<17,D^=D>>>15,S^=S>>>12,fe[q]=D^S;m.w=we,m.X=fe,m.i=q}u(l,f)}function o(f,l){return l.i=f.i,l.w=f.w,l.X=f.X.slice(),l}function s(f,l){f==null&&(f=+new Date);var u=new r(f),m=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,m&&(m.X&&o(m,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xor4096=s})(Mv,t)}(yo)),yo.exports}var xo={exports:{}},Nv=xo.exports,Yl;function Gv(){return Yl||(Yl=1,function(t){(function(e,n,i){function r(f){var l=this,u="";l.next=function(){var y=l.b,S=l.c,D=l.d,q=l.a;return y=y<<25^y>>>7^S,S=S-D|0,D=D<<24^D>>>8^q,q=q-y|0,l.b=y=y<<20^y>>>12^S,l.c=S=S-D|0,l.d=D<<16^S>>>16^q,l.a=q-y|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,f===Math.floor(f)?(l.a=f/4294967296|0,l.b=f|0):u+=f;for(var m=0;m<u.length+20;m++)l.b^=u.charCodeAt(m)|0,l.next()}function o(f,l){return l.a=f.a,l.b=f.b,l.c=f.c,l.d=f.d,l}function s(f,l){var u=new r(f),m=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,m&&(typeof m=="object"&&o(m,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.tychei=s})(Nv,t)}(xo)),xo.exports}var bo={exports:{}};const Bv=Sp(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Uv=bo.exports,Zl;function Vv(){return Zl||(Zl=1,function(t){(function(e,n,i){var r=256,o=6,s=52,f="random",l=i.pow(r,o),u=i.pow(2,s),m=u*2,y=r-1,S;function D(V,se,Le){var Be=[];se=se==!0?{entropy:!0}:se||{};var je=fe(we(se.entropy?[V,Ve(n)]:V??Ne(),3),Be),nt=new q(Be),lt=function(){for(var Ee=nt.g(o),ut=l,ot=0;Ee<u;)Ee=(Ee+ot)*r,ut*=r,ot=nt.g(1);for(;Ee>=m;)Ee/=2,ut/=2,ot>>>=1;return(Ee+ot)/ut};return lt.int32=function(){return nt.g(4)|0},lt.quick=function(){return nt.g(4)/4294967296},lt.double=lt,fe(Ve(nt.S),n),(se.pass||Le||function(Ee,ut,ot,N){return N&&(N.S&&Te(N,nt),Ee.state=function(){return Te(nt,{})}),ot?(i[f]=Ee,ut):Ee})(lt,je,"global"in se?se.global:this==i,se.state)}function q(V){var se,Le=V.length,Be=this,je=0,nt=Be.i=Be.j=0,lt=Be.S=[];for(Le||(V=[Le++]);je<r;)lt[je]=je++;for(je=0;je<r;je++)lt[je]=lt[nt=y&nt+V[je%Le]+(se=lt[je])],lt[nt]=se;(Be.g=function(Ee){for(var ut,ot=0,N=Be.i,Pe=Be.j,ie=Be.S;Ee--;)ut=ie[N=y&N+1],ot=ot*r+ie[y&(ie[N]=ie[Pe=y&Pe+ut])+(ie[Pe]=ut)];return Be.i=N,Be.j=Pe,ot})(r)}function Te(V,se){return se.i=V.i,se.j=V.j,se.S=V.S.slice(),se}function we(V,se){var Le=[],Be=typeof V,je;if(se&&Be=="object")for(je in V)try{Le.push(we(V[je],se-1))}catch{}return Le.length?Le:Be=="string"?V:V+"\0"}function fe(V,se){for(var Le=V+"",Be,je=0;je<Le.length;)se[y&je]=y&(Be^=se[y&je]*19)+Le.charCodeAt(je++);return Ve(se)}function Ne(){try{var V;return S&&(V=S.randomBytes)?V=V(r):(V=new Uint8Array(r),(e.crypto||e.msCrypto).getRandomValues(V)),Ve(V)}catch{var se=e.navigator,Le=se&&se.plugins;return[+new Date,e,Le,e.screen,Ve(n)]}}function Ve(V){return String.fromCharCode.apply(0,V)}if(fe(i.random(),n),t.exports){t.exports=D;try{S=Bv}catch{}}else i["seed"+f]=D})(typeof self<"u"?self:Uv,[],Math)}(bo)),bo.exports}var Ja,Ql;function $v(){if(Ql)return Ja;Ql=1;var t=kv(),e=Lv(),n=Fv(),i=Rv(),r=Ov(),o=Gv(),s=Vv();return s.alea=t,s.xor128=e,s.xorwow=n,s.xorshift7=i,s.xor4096=r,s.tychei=o,Ja=s,Ja}var Hv=$v();const Wv=za(Hv);function Xv(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,qv(i.key),i)}}function es(t,e,n){return e&&Xv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Kl(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,ts(t,e)}function ts(t,e){return ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},ts(t,e)}function jv(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function qv(t){var e=jv(t,"string");return typeof e=="symbol"?e:String(e)}var _o=function(){function t(){}var e=t.prototype;return e._seed=function(i,r){if(i===(i||0))return i;for(var o=""+i,s=0,f=0;f<o.length;++f)s^=o.charCodeAt(f)|0;return s},t}(),Jl=function(t){Kl(e,t);function e(i,r){var o;return o=t.call(this)||this,o._rng=void 0,o.seed(i,r),o}var n=e.prototype;return n.next=function(){return this._rng()},n.seed=function(r,o){this._rng=r},n.clone=function(r,o){return new e(this._rng,o)},es(e,[{key:"name",get:function(){return"function"}}]),e}(_o),eu=function(){var t=[].slice.call(arguments),e=t,n=e[0],i=n===void 0?"default":n;switch(typeof i){case"object":if(i instanceof _o)return i;break;case"function":return new Jl(i);case"number":case"string":default:return new Jl(Wv.apply(void 0,t))}throw new Error('invalid RNG "'+i+'"')},Yv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){return t.next()*(n-e)+e}};function pn(t){return new Zv(t)}var Zv=function(e){var n=this;this.n=void 0,this.isInt=function(){if(Number.isInteger(n.n))return n;throw new Error("Expected number to be an integer, got "+n.n)},this.isPositive=function(){if(n.n>0)return n;throw new Error("Expected number to be positive, got "+n.n)},this.lessThan=function(i){if(n.n<i)return n;throw new Error("Expected number to be less than "+i+", got "+n.n)},this.greaterThanOrEqual=function(i){if(n.n>=i)return n;throw new Error("Expected number to be greater than or equal to "+i+", got "+n.n)},this.greaterThan=function(i){if(n.n>i)return n;throw new Error("Expected number to be greater than "+i+", got "+n.n)},this.n=e},Qv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),n===void 0&&(n=e===void 0?1:e,e=0),pn(e).isInt(),pn(n).isInt(),function(){return Math.floor(t.next()*(n-e+1)+e)}},Kv=function(t){return function(){return t.next()>=.5}},Jv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){var i,r,o;do i=t.next()*2-1,r=t.next()*2-1,o=i*i+r*r;while(!o||o>1);return e+n*r*Math.sqrt(-2*Math.log(o)/o)}},eg=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=1);var i=t.normal(e,n);return function(){return Math.exp(i())}},tg=function(t,e){return e===void 0&&(e=.5),pn(e).greaterThanOrEqual(0).lessThan(1),function(){return Math.floor(t.next()+e)}},ng=function(t,e,n){return e===void 0&&(e=1),n===void 0&&(n=.5),pn(e).isInt().isPositive(),pn(n).greaterThanOrEqual(0).lessThan(1),function(){for(var i=0,r=0;i++<e;)t.next()<n&&r++;return r}},ig=function(t,e){e===void 0&&(e=.5),pn(e).greaterThan(0).lessThan(1);var n=1/Math.log(1-e);return function(){return Math.floor(1+Math.log(t.next())*n)}},rg=[0,0,.6931471805599453,1.791759469228055,3.1780538303479458,4.787491742782046,6.579251212010101,8.525161361065415,10.60460290274525,12.801827480081469],og=function(e){return rg[e]},ag=.9189385332046727,sg=function(t,e){if(e===void 0&&(e=1),pn(e).isPositive(),e<10){var n=Math.exp(-e);return function(){for(var l=n,u=0,m=t.next();m>l;)m=m-l,l=e*l/++u;return u}}else{var i=Math.sqrt(e),r=.931+2.53*i,o=-.059+.02483*r,s=1.1239+1.1328/(r-3.4),f=.9277-3.6224/(r-2);return function(){for(;;){var l=void 0,u=t.next();if(u<=.86*f)return l=u/f-.43,Math.floor((2*o/(.5-Math.abs(l))+r)*l+e+.445);u>=f?l=t.next()-.5:(l=u/f-.93,l=(l<0?-.5:.5)-l,u=t.next()*f);var m=.5-Math.abs(l);if(!(m<.013&&u>m)){var y=Math.floor((2*o/m+r)*l+e+.445);if(u=u*s/(o/(m*m)+r),y>=10){var S=(y+.5)*Math.log(e/y)-e-ag+y-(.08333333333333333-(.002777777777777778-1/(1260*y*y))/(y*y))/y;if(Math.log(u*i)<=S)return y}else if(y>=0){var D,q=(D=og(y))!=null?D:0;if(Math.log(u)<=y*Math.log(e)-e-q)return y}}}}}},fg=function(t,e){return e===void 0&&(e=1),pn(e).isPositive(),function(){return-Math.log(1-t.next())/e}},lg=function(t,e){return e===void 0&&(e=1),pn(e).isInt().greaterThanOrEqual(0),function(){for(var n=0,i=0;i<e;++i)n+=t.next();return n}},ug=function(t,e){e===void 0&&(e=1),pn(e).isInt().isPositive();var n=t.irwinHall(e);return function(){return n()/e}},cg=function(t,e){e===void 0&&(e=1),pn(e).greaterThanOrEqual(0);var n=1/e;return function(){return 1/Math.pow(1-t.next(),n)}},hg=function(t){Kl(e,t);function e(){return t.apply(this,arguments)||this}var n=e.prototype;return n.next=function(){return Math.random()},n.seed=function(r,o){},n.clone=function(){return new e},es(e,[{key:"name",get:function(){return"default"}}]),e}(_o),tu=function(){function t(n){var i=this;this._rng=void 0,this._patch=void 0,this._cache={},this.next=function(){return i._rng.next()},this.float=function(r,o){return i.uniform(r,o)()},this.int=function(r,o){return i.uniformInt(r,o)()},this.integer=function(r,o){return i.uniformInt(r,o)()},this.bool=function(){return i.uniformBoolean()()},this.boolean=function(){return i.uniformBoolean()()},this.uniform=function(r,o){return i._memoize("uniform",Yv,r,o)},this.uniformInt=function(r,o){return i._memoize("uniformInt",Qv,r,o)},this.uniformBoolean=function(){return i._memoize("uniformBoolean",Kv)},this.normal=function(r,o){return Jv(i,r,o)},this.logNormal=function(r,o){return eg(i,r,o)},this.bernoulli=function(r){return tg(i,r)},this.binomial=function(r,o){return ng(i,r,o)},this.geometric=function(r){return ig(i,r)},this.poisson=function(r){return sg(i,r)},this.exponential=function(r){return fg(i,r)},this.irwinHall=function(r){return lg(i,r)},this.bates=function(r){return ug(i,r)},this.pareto=function(r){return cg(i,r)},n&&n instanceof _o?this.use(n):this.use(new hg),this._cache={}}var e=t.prototype;return e.clone=function(){var i=[].slice.call(arguments);return i.length?new t(eu.apply(void 0,i)):new t(this.rng.clone())},e.use=function(){this._rng=eu.apply(void 0,[].slice.call(arguments))},e.patch=function(){if(this._patch)throw new Error("Math.random already patched");this._patch=Math.random,Math.random=this.uniform()},e.unpatch=function(){this._patch&&(Math.random=this._patch,delete this._patch)},e.choice=function(i){if(!Array.isArray(i))throw new Error("Random.choice expected input to be an array, got "+typeof i);var r=i==null?void 0:i.length;if(r>0){var o=this.uniformInt(0,r-1)();return i[o]}else return},e._memoize=function(i,r){var o=[].slice.call(arguments,2),s=""+o.join(";"),f=this._cache[i];return(f===void 0||f.key!==s)&&(f={key:s,distribution:r.apply(void 0,[this].concat(o))},this._cache[i]=f),f.distribution},es(t,[{key:"rng",get:function(){return this._rng}}]),t}();new tu;const ns=.001,is=64,dg=4;class mg{constructor(){this.pointsTextureSize=0,this.linksTextureSize=0,this.alpha=1,this.transform=Ev(),this.screenSize=[0,0],this.mousePosition=[0,0],this.screenMousePosition=[0,0],this.selectedArea=[[0,0],[0,0]],this.isSimulationRunning=!1,this.simulationProgress=0,this.selectedIndices=null,this.maxPointSize=is,this.hoveredPoint=void 0,this.focusedPoint=void 0,this.draggingPointIndex=void 0,this.hoveredLinkIndex=void 0,this.adjustedSpaceSize=Oe.spaceSize,this.isSpaceKeyPressed=!1,this.webglMaxTextureSize=16384,this.hoveredPointRingColor=[1,1,1,Rp],this.focusedPointRingColor=[1,1,1,Mp],this.hoveredLinkColor=[-1,-1,-1,-1],this.greyoutPointColor=[-1,-1,-1,-1],this.isDarkenGreyout=!1,this.isLinkHoveringEnabled=!1,this.alphaTarget=0,this.scalePointX=Qa(),this.scalePointY=Qa(),this.random=new tu,this._backgroundColor=[0,0,0,0],this.alphaDecay=e=>1-Math.pow(ns,1/e)}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e;const n=pl(e[0],e[1],e[2]);document.documentElement.style.setProperty("--cosmosgl-attribution-color",n>.65?"black":"white"),document.documentElement.style.setProperty("--cosmosgl-error-message-color",n>.65?"black":"white"),this.div&&(this.div.style.backgroundColor=`rgba(${e[0]*255}, ${e[1]*255}, ${e[2]*255}, ${e[3]})`),this.isDarkenGreyout=n<.65}addRandomSeed(e){this.random=this.random.clone(e)}getRandomFloat(e,n){return this.random.float(e,n)}adjustSpaceSize(e,n){e>=n?(this.adjustedSpaceSize=n/2,console.warn(`The \`spaceSize\` has been reduced to ${this.adjustedSpaceSize} due to WebGL limits`)):this.adjustedSpaceSize=e}setWebGLMaxTextureSize(e){this.webglMaxTextureSize=e}updateScreenSize(e,n){const{adjustedSpaceSize:i}=this;this.screenSize=[e,n],this.scalePointX.domain([0,i]).range([(e-i)/2,(e+i)/2]),this.scalePointY.domain([i,0]).range([(n-i)/2,(n+i)/2])}scaleX(e){return this.scalePointX(e)}scaleY(e){return this.scalePointY(e)}setHoveredPointRingColor(e){const n=Fn(e);this.hoveredPointRingColor[0]=n[0],this.hoveredPointRingColor[1]=n[1],this.hoveredPointRingColor[2]=n[2]}setFocusedPointRingColor(e){const n=Fn(e);this.focusedPointRingColor[0]=n[0],this.focusedPointRingColor[1]=n[1],this.focusedPointRingColor[2]=n[2]}setGreyoutPointColor(e){if(e===void 0){this.greyoutPointColor=[-1,-1,-1,-1];return}const n=Fn(e);this.greyoutPointColor[0]=n[0],this.greyoutPointColor[1]=n[1],this.greyoutPointColor[2]=n[2],this.greyoutPointColor[3]=n[3]}updateLinkHoveringEnabled(e){this.isLinkHoveringEnabled=!!(e.onLinkClick||e.onLinkMouseOver||e.onLinkMouseOut),this.isLinkHoveringEnabled||(this.hoveredLinkIndex=void 0)}setHoveredLinkColor(e){if(e===void 0){this.hoveredLinkColor=[-1,-1,-1,-1];return}const n=Fn(e);this.hoveredLinkColor[0]=n[0],this.hoveredLinkColor[1]=n[1],this.hoveredLinkColor[2]=n[2],this.hoveredLinkColor[3]=n[3]}setFocusedPoint(e){e!==void 0?this.focusedPoint={index:e}:this.focusedPoint=void 0}addAlpha(e){return(this.alphaTarget-this.alpha)*this.alphaDecay(e)}}const pg={passive:!1},pr={capture:!0,passive:!1};function rs(t){t.stopImmediatePropagation()}function Di(t){t.preventDefault(),t.stopImmediatePropagation()}function nu(t){var e=t.document.documentElement,n=Ft(t).on("dragstart.drag",Di,pr);"onselectstart"in e?n.on("selectstart.drag",Di,pr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function iu(t,e){var n=t.document.documentElement,i=Ft(t).on("dragstart.drag",null);e&&(i.on("click.drag",Di,pr),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const So=t=>()=>t;function os(t,{sourceEvent:e,subject:n,target:i,identifier:r,active:o,x:s,y:f,dx:l,dy:u,dispatch:m}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:m}})}os.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function vg(t){return!t.ctrlKey&&!t.button}function gg(){return this.parentNode}function yg(t,e){return e??{x:t.x,y:t.y}}function xg(){return navigator.maxTouchPoints||"ontouchstart"in this}function bg(){var t=vg,e=gg,n=yg,i=xg,r={},o=Vr("start","drag","end"),s=0,f,l,u,m,y=0;function S(V){V.on("mousedown.drag",D).filter(i).on("touchstart.drag",we).on("touchmove.drag",fe,pg).on("touchend.drag touchcancel.drag",Ne).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function D(V,se){if(!(m||!t.call(this,V,se))){var Le=Ve(this,e.call(this,V,se),V,se,"mouse");Le&&(Ft(V.view).on("mousemove.drag",q,pr).on("mouseup.drag",Te,pr),nu(V.view),rs(V),u=!1,f=V.clientX,l=V.clientY,Le("start",V))}}function q(V){if(Di(V),!u){var se=V.clientX-f,Le=V.clientY-l;u=se*se+Le*Le>y}r.mouse("drag",V)}function Te(V){Ft(V.view).on("mousemove.drag mouseup.drag",null),iu(V.view,u),Di(V),r.mouse("end",V)}function we(V,se){if(t.call(this,V,se)){var Le=V.changedTouches,Be=e.call(this,V,se),je=Le.length,nt,lt;for(nt=0;nt<je;++nt)(lt=Ve(this,Be,V,se,Le[nt].identifier,Le[nt]))&&(rs(V),lt("start",V,Le[nt]))}}function fe(V){var se=V.changedTouches,Le=se.length,Be,je;for(Be=0;Be<Le;++Be)(je=r[se[Be].identifier])&&(Di(V),je("drag",V,se[Be]))}function Ne(V){var se=V.changedTouches,Le=se.length,Be,je;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),Be=0;Be<Le;++Be)(je=r[se[Be].identifier])&&(rs(V),je("end",V,se[Be]))}function Ve(V,se,Le,Be,je,nt){var lt=o.copy(),Ee=kn(nt||Le,se),ut,ot,N;if((N=n.call(V,new os("beforestart",{sourceEvent:Le,target:S,identifier:je,active:s,x:Ee[0],y:Ee[1],dx:0,dy:0,dispatch:lt}),Be))!=null)return ut=N.x-Ee[0]||0,ot=N.y-Ee[1]||0,function Pe(ie,ke,He){var qe=Ee,Qe;switch(ie){case"start":r[je]=Pe,Qe=s++;break;case"end":delete r[je],--s;case"drag":Ee=kn(He||ke,se),Qe=s;break}lt.call(ie,V,new os(ie,{sourceEvent:ke,subject:N,target:S,identifier:je,active:Qe,x:Ee[0]+ut,y:Ee[1]+ot,dx:Ee[0]-qe[0],dy:Ee[1]-qe[1],dispatch:lt}),Be)}}return S.filter=function(V){return arguments.length?(t=typeof V=="function"?V:So(!!V),S):t},S.container=function(V){return arguments.length?(e=typeof V=="function"?V:So(V),S):e},S.subject=function(V){return arguments.length?(n=typeof V=="function"?V:So(V),S):n},S.touchable=function(V){return arguments.length?(i=typeof V=="function"?V:So(!!V),S):i},S.on=function(){var V=o.on.apply(o,arguments);return V===o?S:V},S.clickDistance=function(V){return arguments.length?(y=(V=+V)*V,S):Math.sqrt(y)},S}const To=t=>()=>t;function _g(t,{sourceEvent:e,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function Rn(t,e,n){this.k=t,this.x=e,this.y=n}Rn.prototype={constructor:Rn,scale:function(t){return t===1?this:new Rn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Rn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vr=new Rn(1,0,0);Rn.prototype;function as(t){t.stopImmediatePropagation()}function gr(t){t.preventDefault(),t.stopImmediatePropagation()}function Sg(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Tg(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function ru(){return this.__zoom||vr}function wg(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ag(){return navigator.maxTouchPoints||"ontouchstart"in this}function Eg(t,e,n){var i=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Cg(){var t=Sg,e=Tg,n=Eg,i=wg,r=Ag,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],f=250,l=pm,u=Vr("start","zoom","end"),m,y,S,D=500,q=150,Te=0,we=10;function fe(N){N.property("__zoom",ru).on("wheel.zoom",je,{passive:!1}).on("mousedown.zoom",nt).on("dblclick.zoom",lt).filter(r).on("touchstart.zoom",Ee).on("touchmove.zoom",ut).on("touchend.zoom touchcancel.zoom",ot).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}fe.transform=function(N,Pe,ie,ke){var He=N.selection?N.selection():N;He.property("__zoom",ru),N!==He?se(N,Pe,ie,ke):He.interrupt().each(function(){Le(this,arguments).event(ke).start().zoom(null,typeof Pe=="function"?Pe.apply(this,arguments):Pe).end()})},fe.scaleBy=function(N,Pe,ie,ke){fe.scaleTo(N,function(){var He=this.__zoom.k,qe=typeof Pe=="function"?Pe.apply(this,arguments):Pe;return He*qe},ie,ke)},fe.scaleTo=function(N,Pe,ie,ke){fe.transform(N,function(){var He=e.apply(this,arguments),qe=this.__zoom,Qe=ie==null?V(He):typeof ie=="function"?ie.apply(this,arguments):ie,Ze=qe.invert(Qe),dt=typeof Pe=="function"?Pe.apply(this,arguments):Pe;return n(Ve(Ne(qe,dt),Qe,Ze),He,s)},ie,ke)},fe.translateBy=function(N,Pe,ie,ke){fe.transform(N,function(){return n(this.__zoom.translate(typeof Pe=="function"?Pe.apply(this,arguments):Pe,typeof ie=="function"?ie.apply(this,arguments):ie),e.apply(this,arguments),s)},null,ke)},fe.translateTo=function(N,Pe,ie,ke,He){fe.transform(N,function(){var qe=e.apply(this,arguments),Qe=this.__zoom,Ze=ke==null?V(qe):typeof ke=="function"?ke.apply(this,arguments):ke;return n(vr.translate(Ze[0],Ze[1]).scale(Qe.k).translate(typeof Pe=="function"?-Pe.apply(this,arguments):-Pe,typeof ie=="function"?-ie.apply(this,arguments):-ie),qe,s)},ke,He)};function Ne(N,Pe){return Pe=Math.max(o[0],Math.min(o[1],Pe)),Pe===N.k?N:new Rn(Pe,N.x,N.y)}function Ve(N,Pe,ie){var ke=Pe[0]-ie[0]*N.k,He=Pe[1]-ie[1]*N.k;return ke===N.x&&He===N.y?N:new Rn(N.k,ke,He)}function V(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function se(N,Pe,ie,ke){N.on("start.zoom",function(){Le(this,arguments).event(ke).start()}).on("interrupt.zoom end.zoom",function(){Le(this,arguments).event(ke).end()}).tween("zoom",function(){var He=this,qe=arguments,Qe=Le(He,qe).event(ke),Ze=e.apply(He,qe),dt=ie==null?V(Ze):typeof ie=="function"?ie.apply(He,qe):ie,ct=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),_t=He.__zoom,st=typeof Pe=="function"?Pe.apply(He,qe):Pe,$t=l(_t.invert(dt).concat(ct/_t.k),st.invert(dt).concat(ct/st.k));return function(Ht){if(Ht===1)Ht=st;else{var Kt=$t(Ht),Mn=ct/Kt[2];Ht=new Rn(Mn,dt[0]-Kt[0]*Mn,dt[1]-Kt[1]*Mn)}Qe.zoom(null,Ht)}})}function Le(N,Pe,ie){return!ie&&N.__zooming||new Be(N,Pe)}function Be(N,Pe){this.that=N,this.args=Pe,this.active=0,this.sourceEvent=null,this.extent=e.apply(N,Pe),this.taps=0}Be.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,Pe){return this.mouse&&N!=="mouse"&&(this.mouse[1]=Pe.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=Pe.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=Pe.invert(this.touch1[0])),this.that.__zoom=Pe,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var Pe=Ft(this.that).datum();u.call(N,this.that,new _g(N,{sourceEvent:this.sourceEvent,target:fe,transform:this.that.__zoom,dispatch:u}),Pe)}};function je(N,...Pe){if(!t.apply(this,arguments))return;var ie=Le(this,Pe).event(N),ke=this.__zoom,He=Math.max(o[0],Math.min(o[1],ke.k*Math.pow(2,i.apply(this,arguments)))),qe=kn(N);if(ie.wheel)(ie.mouse[0][0]!==qe[0]||ie.mouse[0][1]!==qe[1])&&(ie.mouse[1]=ke.invert(ie.mouse[0]=qe)),clearTimeout(ie.wheel);else{if(ke.k===He)return;ie.mouse=[qe,ke.invert(qe)],Qr(this),ie.start()}gr(N),ie.wheel=setTimeout(Qe,q),ie.zoom("mouse",n(Ve(Ne(ke,He),ie.mouse[0],ie.mouse[1]),ie.extent,s));function Qe(){ie.wheel=null,ie.end()}}function nt(N,...Pe){if(S||!t.apply(this,arguments))return;var ie=N.currentTarget,ke=Le(this,Pe,!0).event(N),He=Ft(N.view).on("mousemove.zoom",dt,!0).on("mouseup.zoom",ct,!0),qe=kn(N,ie),Qe=N.clientX,Ze=N.clientY;nu(N.view),as(N),ke.mouse=[qe,this.__zoom.invert(qe)],Qr(this),ke.start();function dt(_t){if(gr(_t),!ke.moved){var st=_t.clientX-Qe,$t=_t.clientY-Ze;ke.moved=st*st+$t*$t>Te}ke.event(_t).zoom("mouse",n(Ve(ke.that.__zoom,ke.mouse[0]=kn(_t,ie),ke.mouse[1]),ke.extent,s))}function ct(_t){He.on("mousemove.zoom mouseup.zoom",null),iu(_t.view,ke.moved),gr(_t),ke.event(_t).end()}}function lt(N,...Pe){if(t.apply(this,arguments)){var ie=this.__zoom,ke=kn(N.changedTouches?N.changedTouches[0]:N,this),He=ie.invert(ke),qe=ie.k*(N.shiftKey?.5:2),Qe=n(Ve(Ne(ie,qe),ke,He),e.apply(this,Pe),s);gr(N),f>0?Ft(this).transition().duration(f).call(se,Qe,ke,N):Ft(this).call(fe.transform,Qe,ke,N)}}function Ee(N,...Pe){if(t.apply(this,arguments)){var ie=N.touches,ke=ie.length,He=Le(this,Pe,N.changedTouches.length===ke).event(N),qe,Qe,Ze,dt;for(as(N),Qe=0;Qe<ke;++Qe)Ze=ie[Qe],dt=kn(Ze,this),dt=[dt,this.__zoom.invert(dt),Ze.identifier],He.touch0?!He.touch1&&He.touch0[2]!==dt[2]&&(He.touch1=dt,He.taps=0):(He.touch0=dt,qe=!0,He.taps=1+!!m);m&&(m=clearTimeout(m)),qe&&(He.taps<2&&(y=dt[0],m=setTimeout(function(){m=null},D)),Qr(this),He.start())}}function ut(N,...Pe){if(this.__zooming){var ie=Le(this,Pe).event(N),ke=N.changedTouches,He=ke.length,qe,Qe,Ze,dt;for(gr(N),qe=0;qe<He;++qe)Qe=ke[qe],Ze=kn(Qe,this),ie.touch0&&ie.touch0[2]===Qe.identifier?ie.touch0[0]=Ze:ie.touch1&&ie.touch1[2]===Qe.identifier&&(ie.touch1[0]=Ze);if(Qe=ie.that.__zoom,ie.touch1){var ct=ie.touch0[0],_t=ie.touch0[1],st=ie.touch1[0],$t=ie.touch1[1],Ht=(Ht=st[0]-ct[0])*Ht+(Ht=st[1]-ct[1])*Ht,Kt=(Kt=$t[0]-_t[0])*Kt+(Kt=$t[1]-_t[1])*Kt;Qe=Ne(Qe,Math.sqrt(Ht/Kt)),Ze=[(ct[0]+st[0])/2,(ct[1]+st[1])/2],dt=[(_t[0]+$t[0])/2,(_t[1]+$t[1])/2]}else if(ie.touch0)Ze=ie.touch0[0],dt=ie.touch0[1];else return;ie.zoom("touch",n(Ve(Qe,Ze,dt),ie.extent,s))}}function ot(N,...Pe){if(this.__zooming){var ie=Le(this,Pe).event(N),ke=N.changedTouches,He=ke.length,qe,Qe;for(as(N),S&&clearTimeout(S),S=setTimeout(function(){S=null},D),qe=0;qe<He;++qe)Qe=ke[qe],ie.touch0&&ie.touch0[2]===Qe.identifier?delete ie.touch0:ie.touch1&&ie.touch1[2]===Qe.identifier&&delete ie.touch1;if(ie.touch1&&!ie.touch0&&(ie.touch0=ie.touch1,delete ie.touch1),ie.touch0)ie.touch0[1]=this.__zoom.invert(ie.touch0[0]);else if(ie.end(),ie.taps===2&&(Qe=kn(Qe,this),Math.hypot(y[0]-Qe[0],y[1]-Qe[1])<we)){var Ze=Ft(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return fe.wheelDelta=function(N){return arguments.length?(i=typeof N=="function"?N:To(+N),fe):i},fe.filter=function(N){return arguments.length?(t=typeof N=="function"?N:To(!!N),fe):t},fe.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:To(!!N),fe):r},fe.extent=function(N){return arguments.length?(e=typeof N=="function"?N:To([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),fe):e},fe.scaleExtent=function(N){return arguments.length?(o[0]=+N[0],o[1]=+N[1],fe):[o[0],o[1]]},fe.translateExtent=function(N){return arguments.length?(s[0][0]=+N[0][0],s[1][0]=+N[1][0],s[0][1]=+N[0][1],s[1][1]=+N[1][1],fe):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},fe.constrain=function(N){return arguments.length?(n=N,fe):n},fe.duration=function(N){return arguments.length?(f=+N,fe):f},fe.interpolate=function(N){return arguments.length?(l=N,fe):l},fe.on=function(){var N=u.on.apply(u,arguments);return N===u?fe:N},fe.clickDistance=function(N){return arguments.length?(Te=(N=+N)*N,fe):Math.sqrt(Te)},fe.tapDistance=function(N){return arguments.length?(we=+N,fe):we},fe}class Pg{constructor(e,n){this.eventTransform=vr,this.behavior=Cg().scaleExtent([.001,1/0]).on("start",i=>{var o,s;this.isRunning=!0;const r=!!i.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomStart)==null||s.call(o,i,r)}).on("zoom",i=>{var S,D;this.eventTransform=i.transform;const{eventTransform:{x:r,y:o,k:s},store:{transform:f,screenSize:l}}=this,u=l[0],m=l[1];if(!u||!m)return;Cv(f,u,m),$l(f,f,[r,o]),Ka(f,f,[s,s]),$l(f,f,[u/2,m/2]),Ka(f,f,[u/2,m/2]),Ka(f,f,[1,-1]);const y=!!i.sourceEvent;(D=(S=this.config)==null?void 0:S.onZoom)==null||D.call(S,i,y)}).on("end",i=>{var o,s;this.isRunning=!1;const r=!!i.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomEnd)==null||s.call(o,i,r)}),this.isRunning=!1,this.store=e,this.config=n}getTransform(e,n,i=.1){if(e.length===0)return this.eventTransform;const{store:{screenSize:r}}=this,o=r[0],s=r[1],f=Al(e.map(fe=>fe[0])),l=Al(e.map(fe=>fe[1]));f[0]=this.store.scaleX(f[0]),f[1]=this.store.scaleX(f[1]),l[0]=this.store.scaleY(l[0]),l[1]=this.store.scaleY(l[1]),f[0]===f[1]&&(f[0]-=.5,f[1]+=.5),l[0]===l[1]&&(l[0]+=.5,l[1]-=.5);const u=o*(1-i*2)/(f[1]-f[0]),m=s*(1-i*2)/(l[0]-l[1]),y=vl(n??Math.min(u,m),...this.behavior.scaleExtent()),S=(f[1]+f[0])/2,D=(l[1]+l[0])/2,q=o/2-S*y,Te=s/2-D*y;return vr.translate(q,Te).scale(y)}getDistanceToPoint(e){const{x:n,y:i,k:r}=this.eventTransform,o=this.getTransform([e],r),s=n-o.x,f=i-o.y;return Math.sqrt(s*s+f*f)}getMiddlePointTransform(e){const{store:{screenSize:n},eventTransform:{x:i,y:r,k:o}}=this,s=n[0],f=n[1],l=(s/2-i)/o,u=(f/2-r)/o,m=this.store.scaleX(e[0]),y=this.store.scaleY(e[1]),S=(l+m)/2,D=(u+y)/2,q=1,Te=s/2-S*q,we=f/2-D*q;return vr.translate(Te,we).scale(q)}convertScreenToSpacePosition(e){const{eventTransform:{x:n,y:i,k:r},store:{screenSize:o}}=this,s=o[0],f=o[1],l=(e[0]-n)/r,u=(e[1]-i)/r,m=[l,f-u];return m[0]-=(s-this.store.adjustedSpaceSize)/2,m[1]-=(f-this.store.adjustedSpaceSize)/2,m}convertSpaceToScreenPosition(e){const n=this.eventTransform.applyX(this.store.scaleX(e[0])),i=this.eventTransform.applyY(this.store.scaleY(e[1]));return[n,i]}convertSpaceToScreenRadius(e){const{config:{scalePointsOnZoom:n},store:{maxPointSize:i},eventTransform:{k:r}}=this;let o=e*2;return n?o*=r:o*=Math.min(5,Math.max(1,r*.01)),Math.min(o,i)/2}}class kg{constructor(e,n){this.isActive=!1,this.behavior=bg().subject(i=>this.store.hoveredPoint&&!this.store.isSpaceKeyPressed?{x:i.x,y:i.y}:void 0).on("start",i=>{var r,o;this.store.hoveredPoint&&(this.store.draggingPointIndex=this.store.hoveredPoint.index,this.isActive=!0,(o=(r=this.config)==null?void 0:r.onDragStart)==null||o.call(r,i))}).on("drag",i=>{var r,o;(o=(r=this.config)==null?void 0:r.onDrag)==null||o.call(r,i)}).on("end",i=>{var r,o;this.isActive=!1,this.store.draggingPointIndex=void 0,(o=(r=this.config)==null?void 0:r.onDragEnd)==null||o.call(r,i)}),this.store=e,this.config=n}}function Ig(t){const e=document.createElement("div");return e.style.cssText=`
|
|
1670
|
+
}`;function wv(t,e=16384){if(!(t!=null&&t.length))return null;let n=0;for(const u of t){const d=Math.max(u.width,u.height);d>n&&(n=d)}if(n===0)return console.warn("Invalid image dimensions: all images have zero width or height"),null;const i=n,r=Math.ceil(Math.sqrt(t.length));let o=r*n,s=1;o>e&&(s=e/o,n=Math.max(1,Math.floor(n*s)),o=Math.max(1,Math.floor(o*s)),console.warn(`🖼️ Atlas scaling required: Original size ${(i*r).toLocaleString()}px exceeds WebGL limit ${e.toLocaleString()}px. Scaling down to ${o.toLocaleString()}px (${Math.round(s*100)}% of original quality)`));const f=new Uint8Array(o*o*4).fill(0),l=new Float32Array(r*r*4).fill(-1);for(const[u,d]of t.entries()){const y=d.width,S=d.height;if(y===0||S===0)continue;const D=Math.min(1,n/Math.max(y,S)),q=Math.floor(y*D),Te=Math.floor(S*D),we=Math.floor(u/r),Ne=u%r*n,Ve=we*n;l[u*4]=Ne/o,l[u*4+1]=Ve/o,l[u*4+2]=(Ne+q)/o,l[u*4+3]=(Ve+Te)/o;for(let V=0;V<Te;V++)for(let ae=0;ae<q;ae++){const Ie=Math.floor(ae*(y/q)),Xe=(Math.floor(V*(S/Te))*y+Ie)*4,nt=((Ve+V)*o+(Ne+ae))*4;f[nt]=d.data[Xe]??0,f[nt+1]=d.data[Xe+1]??0,f[nt+2]=d.data[Xe+2]??0,f[nt+3]=d.data[Xe+3]??255}}return{atlasData:f,atlasSize:o,atlasCoords:l,atlasCoordsSize:r}}class Av extends zn{constructor(){super(...arguments),this.imageCount=0,this.isPositionsUpToDate=!1,this.polygonPathLength=0}updatePositions(){const{reglInstance:e,store:n,data:i,config:{rescalePositions:r,enableSimulation:o}}=this,{pointsTextureSize:s}=n;if(!s||!i.pointPositions||i.pointsNumber===void 0)return;const f=new Float32Array(s*s*4);let l=r;r===void 0&&!o&&(l=!0),this.shouldSkipRescale&&(l=!1),l?this.rescaleInitialNodePositions():this.shouldSkipRescale||(this.scaleX=void 0,this.scaleY=void 0),this.shouldSkipRescale=void 0;for(let u=0;u<i.pointsNumber;++u)f[u*4+0]=i.pointPositions[u*2+0],f[u*4+1]=i.pointPositions[u*2+1],f[u*4+2]=u;this.currentPositionFbo||(this.currentPositionFbo=e.framebuffer()),this.currentPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.previousPositionFbo||(this.previousPositionFbo=e.framebuffer()),this.previousPositionFbo({color:e.texture({data:f,shape:[s,s,4],type:"float"}),depth:!1,stencil:!1}),this.config.enableSimulation&&(this.velocityFbo||(this.velocityFbo=e.framebuffer()),this.velocityFbo({color:e.texture({data:new Float32Array(s*s*4).fill(0),shape:[s,s,4],type:"float"}),depth:!1,stencil:!1})),this.selectedTexture||(this.selectedTexture=e.texture()),this.selectedTexture({data:f,shape:[s,s,4],type:"float"}),this.selectedFbo||(this.selectedFbo=e.framebuffer()),this.selectedFbo({color:this.selectedTexture,depth:!1,stencil:!1}),this.hoveredFbo||(this.hoveredFbo=e.framebuffer()),this.hoveredFbo({shape:[2,2],colorType:"float",depth:!1,stencil:!1}),this.drawPointIndices||(this.drawPointIndices=e.buffer(0)),this.drawPointIndices(oi(n.pointsTextureSize)),this.hoveredPointIndices||(this.hoveredPointIndices=e.buffer(0)),this.hoveredPointIndices(oi(n.pointsTextureSize)),this.sampledPointIndices||(this.sampledPointIndices=e.buffer(0)),this.sampledPointIndices(oi(n.pointsTextureSize)),this.updateGreyoutStatus(),this.updatePinnedStatus(),this.updateSampledPointsGrid(),this.trackPointsByIndices()}initPrograms(){const{reglInstance:e,config:n,store:i,data:r}=this;n.enableSimulation&&(this.updatePositionCommand||(this.updatePositionCommand=e({frag:_v,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,velocity:()=>this.velocityFbo,friction:()=>n.simulationFriction,spaceSize:()=>i.adjustedSpaceSize,pinnedStatusTexture:()=>this.pinnedStatusFbo}}))),this.dragPointCommand||(this.dragPointCommand=e({frag:Tv,vert:kt,framebuffer:()=>this.currentPositionFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.previousPositionFbo,mousePos:()=>i.mousePosition,index:()=>{var o;return((o=i.hoveredPoint)==null?void 0:o.index)??-1}}})),this.drawCommand||(this.drawCommand=e({frag:cv,vert:hv,primitive:"points",count:()=>r.pointsNumber??0,attributes:{pointIndices:{buffer:this.drawPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1},color:{buffer:()=>this.colorBuffer,size:4},shape:{buffer:()=>this.shapeBuffer,size:1},imageIndex:{buffer:()=>this.imageIndicesBuffer,size:1},imageSize:{buffer:()=>this.imageSizesBuffer,size:1}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointGreyoutStatus:()=>this.greyoutStatusFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,pointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,greyoutColor:()=>i.greyoutPointColor,backgroundColor:()=>i.backgroundColor,isDarkenGreyout:()=>i.isDarkenGreyout,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>i.maxPointSize,skipSelected:e.prop("skipSelected"),skipUnselected:e.prop("skipUnselected"),imageAtlasTexture:()=>this.imageAtlasTexture,imageAtlasCoords:()=>this.imageAtlasCoordsTexture,hasImages:()=>this.imageCount>0,imageCount:()=>this.imageCount,imageAtlasCoordsTextureSize:()=>this.imageAtlasCoordsTextureSize},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.findPointsOnAreaSelectionCommand||(this.findPointsOnAreaSelectionCommand=e({frag:dv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointSize:()=>this.sizeFbo,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,sizeScale:()=>n.pointSizeScale,transformationMatrix:()=>i.transform,ratio:()=>n.pixelRatio,selection0:()=>i.selectedArea[0],selection1:()=>i.selectedArea[1],scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>i.maxPointSize}})),this.findPointsOnPolygonSelectionCommand||(this.findPointsOnPolygonSelectionCommand=e({frag:mv,vert:kt,framebuffer:()=>this.selectedFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,transformationMatrix:()=>i.transform,polygonPathTexture:()=>this.polygonPathTexture,polygonPathLength:()=>this.polygonPathLength}})),this.clearHoveredFboCommand||(this.clearHoveredFboCommand=e({frag:ai,vert:kt,framebuffer:this.hoveredFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.findHoveredPointCommand||(this.findHoveredPointCommand=e({frag:gv,vert:yv,primitive:"points",count:()=>r.pointsNumber??0,framebuffer:()=>this.hoveredFbo,attributes:{pointIndices:{buffer:this.hoveredPointIndices,size:2},size:{buffer:()=>this.sizeBuffer,size:1}},uniforms:{positionsTexture:()=>this.currentPositionFbo,ratio:()=>n.pixelRatio,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,mousePosition:()=>i.screenMousePosition,maxPointSize:()=>i.maxPointSize},depth:{enable:!1,mask:!1}})),this.clearSampledPointsFboCommand||(this.clearSampledPointsFboCommand=e({frag:ai,vert:kt,framebuffer:()=>this.sampledPointsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)}})),this.fillSampledPointsFboCommand||(this.fillSampledPointsFboCommand=e({frag:xv,vert:bv,primitive:"points",count:()=>r.pointsNumber??0,framebuffer:()=>this.sampledPointsFbo,attributes:{pointIndices:{buffer:this.sampledPointIndices,size:2}},uniforms:{positionsTexture:()=>this.currentPositionFbo,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize},depth:{enable:!1,mask:!1}})),this.drawHighlightedCommand||(this.drawHighlightedCommand=e({frag:pv,vert:vv,attributes:{vertexCoord:wt(e)},primitive:"triangle strip",count:4,uniforms:{color:e.prop("color"),width:e.prop("width"),pointIndex:e.prop("pointIndex"),size:e.prop("size"),positionsTexture:()=>this.currentPositionFbo,sizeScale:()=>n.pointSizeScale,pointsTextureSize:()=>i.pointsTextureSize,transformationMatrix:()=>i.transform,spaceSize:()=>i.adjustedSpaceSize,screenSize:()=>i.screenSize,scalePointsOnZoom:()=>n.scalePointsOnZoom,maxPointSize:()=>i.maxPointSize,pointGreyoutStatusTexture:()=>this.greyoutStatusFbo,universalPointOpacity:()=>n.pointOpacity,greyoutOpacity:()=>n.pointGreyoutOpacity??-1,isDarkenGreyout:()=>i.isDarkenGreyout,backgroundColor:()=>i.backgroundColor,greyoutColor:()=>i.greyoutPointColor},blend:{enable:!0,func:{dstRGB:"one minus src alpha",srcRGB:"src alpha",dstAlpha:"one minus src alpha",srcAlpha:"one"},equation:{rgb:"add",alpha:"add"}},depth:{enable:!1,mask:!1}})),this.trackPointsCommand||(this.trackPointsCommand=e({frag:Sv,vert:kt,framebuffer:()=>this.trackedPositionsFbo,primitive:"triangle strip",count:4,attributes:{vertexCoord:wt(e)},uniforms:{positionsTexture:()=>this.currentPositionFbo,trackedIndices:()=>this.trackedIndicesFbo,pointsTextureSize:()=>i.pointsTextureSize}}))}updateColor(){const{reglInstance:e,store:{pointsTextureSize:n},data:i}=this;n&&(this.colorBuffer||(this.colorBuffer=e.buffer(0)),this.colorBuffer(i.pointColors))}updateGreyoutStatus(){const{reglInstance:e,store:{selectedIndices:n,pointsTextureSize:i}}=this;if(!i)return;const r=new Float32Array(i*i*4).fill(n?1:0);if(n)for(const o of n)r[o*4]=0;this.greyoutStatusTexture||(this.greyoutStatusTexture=e.texture()),this.greyoutStatusTexture({data:r,width:i,height:i,type:"float"}),this.greyoutStatusFbo||(this.greyoutStatusFbo=e.framebuffer()),this.greyoutStatusFbo({color:this.greyoutStatusTexture,depth:!1,stencil:!1})}updatePinnedStatus(){const{reglInstance:e,store:{pointsTextureSize:n},data:i}=this;if(!n)return;const r=new Float32Array(n*n*4).fill(0);if(i.inputPinnedPoints&&i.pointsNumber!==void 0)for(const o of i.inputPinnedPoints)o>=0&&o<i.pointsNumber&&(r[o*4]=1);this.pinnedStatusTexture||(this.pinnedStatusTexture=e.texture()),this.pinnedStatusTexture({data:r,width:n,height:n,type:"float"}),this.pinnedStatusFbo||(this.pinnedStatusFbo=e.framebuffer()),this.pinnedStatusFbo({color:this.pinnedStatusTexture,depth:!1,stencil:!1})}updateSize(){const{reglInstance:e,store:{pointsTextureSize:n},data:i}=this;if(!n||i.pointsNumber===void 0||i.pointSizes===void 0)return;this.sizeBuffer||(this.sizeBuffer=e.buffer(0)),this.sizeBuffer(i.pointSizes);const r=new Float32Array(n*n*4);for(let o=0;o<i.pointsNumber;o++)r[o*4]=i.pointSizes[o];this.sizeTexture||(this.sizeTexture=e.texture()),this.sizeTexture({data:r,width:n,height:n,type:"float"}),this.sizeFbo||(this.sizeFbo=e.framebuffer()),this.sizeFbo({color:this.sizeTexture,depth:!1,stencil:!1})}updateShape(){const{reglInstance:e,data:n}=this;n.pointsNumber===void 0||n.pointShapes===void 0||(this.shapeBuffer||(this.shapeBuffer=e.buffer(0)),this.shapeBuffer(n.pointShapes))}updateImageIndices(){const{reglInstance:e,data:n}=this;n.pointsNumber===void 0||n.pointImageIndices===void 0||(this.imageIndicesBuffer||(this.imageIndicesBuffer=e.buffer(0)),this.imageIndicesBuffer(n.pointImageIndices))}updateImageSizes(){const{reglInstance:e,data:n}=this;n.pointsNumber===void 0||n.pointImageSizes===void 0||(this.imageSizesBuffer||(this.imageSizesBuffer=e.buffer(0)),this.imageSizesBuffer(n.pointImageSizes))}createAtlas(){var u;const{reglInstance:e,data:n,store:i}=this;if(this.imageAtlasTexture||(this.imageAtlasTexture=e.texture()),this.imageAtlasCoordsTexture||(this.imageAtlasCoordsTexture=e.texture()),!((u=n.inputImageData)!=null&&u.length)){this.imageCount=0,this.imageAtlasCoordsTextureSize=0;return}const r=wv(n.inputImageData,i.webglMaxTextureSize);if(!r){console.warn("Failed to create atlas from image data");return}this.imageCount=n.inputImageData.length;const{atlasData:o,atlasSize:s,atlasCoords:f,atlasCoordsSize:l}=r;this.imageAtlasCoordsTextureSize=l,this.imageAtlasTexture({data:o,shape:[s,s,4],type:"uint8"}),this.imageAtlasCoordsTexture({data:f,shape:[l,l,4],type:"float"})}updateSampledPointsGrid(){const{store:{screenSize:e},config:{pointSamplingDistance:n},reglInstance:i}=this;let r=n??Math.min(...e)/2;r===0&&(r=Oe.pointSamplingDistance);const o=Math.ceil(e[0]/r),s=Math.ceil(e[1]/r);this.sampledPointsFbo||(this.sampledPointsFbo=i.framebuffer()),this.sampledPointsFbo({shape:[o,s],depth:!1,stencil:!1,colorType:"float"})}trackPoints(){var e,n;(e=this.trackedIndices)!=null&&e.length&&((n=this.trackPointsCommand)==null||n.call(this))}draw(){var o,s,f,l,u,d,y;const{config:{renderHoveredPointRing:e,pointSize:n},store:i,data:r}=this;this.colorBuffer||this.updateColor(),this.sizeBuffer||this.updateSize(),this.shapeBuffer||this.updateShape(),this.imageIndicesBuffer||this.updateImageIndices(),this.imageSizesBuffer||this.updateImageSizes(),(!this.imageAtlasCoordsTexture||!this.imageAtlasTexture)&&this.createAtlas(),i.selectedIndices&&i.selectedIndices.length>0?((o=this.drawCommand)==null||o.call(this,{skipSelected:!0,skipUnselected:!1}),(s=this.drawCommand)==null||s.call(this,{skipSelected:!1,skipUnselected:!0})):(f=this.drawCommand)==null||f.call(this,{skipSelected:!1,skipUnselected:!1}),e&&i.hoveredPoint&&((u=this.drawHighlightedCommand)==null||u.call(this,{width:.85,color:i.hoveredPointRingColor,pointIndex:i.hoveredPoint.index,size:((l=r.pointSizes)==null?void 0:l[i.hoveredPoint.index])??n})),i.focusedPoint&&((y=this.drawHighlightedCommand)==null||y.call(this,{width:.75,color:i.focusedPointRingColor,pointIndex:i.focusedPoint.index,size:((d=r.pointSizes)==null?void 0:d[i.focusedPoint.index])??n}))}updatePosition(){var e;(e=this.updatePositionCommand)==null||e.call(this),this.swapFbo(),this.isPositionsUpToDate=!1}drag(){var e;(e=this.dragPointCommand)==null||e.call(this),this.swapFbo(),this.isPositionsUpToDate=!1}findPointsOnAreaSelection(){var e;(e=this.findPointsOnAreaSelectionCommand)==null||e.call(this)}findPointsOnPolygonSelection(){var e;(e=this.findPointsOnPolygonSelectionCommand)==null||e.call(this)}updatePolygonPath(e){const{reglInstance:n}=this;if(this.polygonPathLength=e.length,e.length===0){this.polygonPathTexture=void 0,this.polygonPathFbo=void 0;return}const i=Math.ceil(Math.sqrt(e.length)),r=new Float32Array(i*i*4);for(const[o,s]of e.entries()){const[f,l]=s;r[o*4]=f,r[o*4+1]=l,r[o*4+2]=0,r[o*4+3]=0}this.polygonPathTexture||(this.polygonPathTexture=n.texture()),this.polygonPathTexture({data:r,width:i,height:i,type:"float"}),this.polygonPathFbo||(this.polygonPathFbo=n.framebuffer()),this.polygonPathFbo({color:this.polygonPathTexture,depth:!1,stencil:!1})}findHoveredPoint(){var e,n;(e=this.clearHoveredFboCommand)==null||e.call(this),(n=this.findHoveredPointCommand)==null||n.call(this)}trackPointsByIndices(e){const{store:{pointsTextureSize:n},reglInstance:i}=this;if(this.trackedIndices=e,this.trackedPositions=void 0,this.isPositionsUpToDate=!1,!(e!=null&&e.length)||!n)return;const r=Math.ceil(Math.sqrt(e.length)),o=new Float32Array(r*r*4).fill(-1);for(const[s,f]of e.entries())f!==void 0&&(o[s*4]=f%n,o[s*4+1]=Math.floor(f/n),o[s*4+2]=0,o[s*4+3]=0);this.trackedIndicesTexture||(this.trackedIndicesTexture=i.texture()),this.trackedIndicesTexture({data:o,width:r,height:r,type:"float"}),this.trackedIndicesFbo||(this.trackedIndicesFbo=i.framebuffer()),this.trackedIndicesFbo({color:this.trackedIndicesTexture,depth:!1,stencil:!1}),this.trackedPositionsFbo||(this.trackedPositionsFbo=i.framebuffer()),this.trackedPositionsFbo({shape:[r,r],depth:!1,stencil:!1,colorType:"float"}),this.trackPoints()}getTrackedPositionsMap(){if(!this.trackedIndices)return new Map;const{config:{enableSimulation:e},store:{isSimulationRunning:n}}=this;if((!e||!n)&&this.isPositionsUpToDate&&this.trackedPositions)return this.trackedPositions;const i=Qt(this.reglInstance,this.trackedPositionsFbo),r=new Map;for(let o=0;o<i.length/4;o+=1){const s=i[o*4],f=i[o*4+1],l=this.trackedIndices[o];s!==void 0&&f!==void 0&&l!==void 0&&r.set(l,[s,f])}return(!e||!n)&&(this.trackedPositions=r,this.isPositionsUpToDate=!0),r}getSampledPointPositionsMap(){var i,r;const e=new Map;if(!this.sampledPointsFbo)return e;(i=this.clearSampledPointsFboCommand)==null||i.call(this),(r=this.fillSampledPointsFboCommand)==null||r.call(this);const n=Qt(this.reglInstance,this.sampledPointsFbo);for(let o=0;o<n.length/4;o++){const s=n[o*4],f=!!n[o*4+1],l=n[o*4+2],u=n[o*4+3];f&&s!==void 0&&l!==void 0&&u!==void 0&&e.set(s,[l,u])}return e}getSampledPoints(){var r,o;const e=[],n=[];if(!this.sampledPointsFbo)return{indices:e,positions:n};(r=this.clearSampledPointsFboCommand)==null||r.call(this),(o=this.fillSampledPointsFboCommand)==null||o.call(this);const i=Qt(this.reglInstance,this.sampledPointsFbo);for(let s=0;s<i.length/4;s++){const f=i[s*4],l=!!i[s*4+1],u=i[s*4+2],d=i[s*4+3];l&&f!==void 0&&u!==void 0&&d!==void 0&&(e.push(f),n.push(u,d))}return{indices:e,positions:n}}getTrackedPositionsArray(){const e=[];if(!this.trackedIndices)return e;e.length=this.trackedIndices.length*2;const n=Qt(this.reglInstance,this.trackedPositionsFbo);for(let i=0;i<n.length/4;i+=1){const r=n[i*4],o=n[i*4+1],s=this.trackedIndices[i];r!==void 0&&o!==void 0&&s!==void 0&&(e[i*2]=r,e[i*2+1]=o)}return e}swapFbo(){const e=this.previousPositionFbo;this.previousPositionFbo=this.currentPositionFbo,this.currentPositionFbo=e}rescaleInitialNodePositions(){const{config:{spaceSize:e}}=this;if(!this.data.pointPositions||!e)return;const n=this.data.pointPositions,i=n.length/2;let r=1/0,o=-1/0,s=1/0,f=-1/0;for(let we=0;we<n.length;we+=2){const fe=n[we],Ne=n[we+1];r=Math.min(r,fe),o=Math.max(o,fe),s=Math.min(s,Ne),f=Math.max(f,Ne)}const l=o-r,u=f-s,d=Math.max(l,u);if(d>e){this.scaleX=void 0,this.scaleY=void 0;return}const y=e*e*.001,D=(i>y?e*Math.max(1.2,Math.sqrt(i)/e):e*.1)/d,q=(d-l)/2*D,Te=(d-u)/2*D;this.scaleX=we=>(we-r)*D+q,this.scaleY=we=>(we-s)*D+Te;for(let we=0;we<i;we++)this.data.pointPositions[we*2]=this.scaleX(n[we*2]),this.data.pointPositions[we*2+1]=this.scaleY(n[we*2+1])}}var Vl=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Ev(){var t=new Vl(9);return Vl!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function $l(t,e,n){var i=e[0],r=e[1],o=e[2],s=e[3],f=e[4],l=e[5],u=e[6],d=e[7],y=e[8],S=n[0],D=n[1];return t[0]=i,t[1]=r,t[2]=o,t[3]=s,t[4]=f,t[5]=l,t[6]=S*i+D*s+u,t[7]=S*r+D*f+d,t[8]=S*o+D*l+y,t}function Ka(t,e,n){var i=n[0],r=n[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=r*e[3],t[4]=r*e[4],t[5]=r*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Cv(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var mo={exports:{}},Pv=mo.exports,Hl;function kv(){return Hl||(Hl=1,function(t){(function(e,n,i){function r(l){var u=this,d=f();u.next=function(){var y=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=y-(u.c=y|0)},u.c=1,u.s0=d(" "),u.s1=d(" "),u.s2=d(" "),u.s0-=d(l),u.s0<0&&(u.s0+=1),u.s1-=d(l),u.s1<0&&(u.s1+=1),u.s2-=d(l),u.s2<0&&(u.s2+=1),d=null}function o(l,u){return u.c=l.c,u.s0=l.s0,u.s1=l.s1,u.s2=l.s2,u}function s(l,u){var d=new r(l),y=u&&u.state,S=d.next;return S.int32=function(){return d.next()*4294967296|0},S.double=function(){return S()+(S()*2097152|0)*11102230246251565e-32},S.quick=S,y&&(typeof y=="object"&&o(y,d),S.state=function(){return o(d,{})}),S}function f(){var l=4022871197,u=function(d){d=String(d);for(var y=0;y<d.length;y++){l+=d.charCodeAt(y);var S=.02519603282416938*l;l=S>>>0,S-=l,S*=l,l=S>>>0,S-=l,l+=S*4294967296}return(l>>>0)*23283064365386963e-26};return u}n&&n.exports?n.exports=s:this.alea=s})(Pv,t)}(mo)),mo.exports}var po={exports:{}},Iv=po.exports,Wl;function Lv(){return Wl||(Wl=1,function(t){(function(e,n,i){function r(f){var l=this,u="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var y=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^y^y>>>8},f===(f|0)?l.x=f:u+=f;for(var d=0;d<u.length+64;d++)l.x^=u.charCodeAt(d)|0,l.next()}function o(f,l){return l.x=f.x,l.y=f.y,l.z=f.z,l.w=f.w,l}function s(f,l){var u=new r(f),d=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,d&&(typeof d=="object"&&o(d,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xor128=s})(Iv,t)}(po)),po.exports}var vo={exports:{}},Dv=vo.exports,Xl;function Fv(){return Xl||(Xl=1,function(t){(function(e,n,i){function r(f){var l=this,u="";l.next=function(){var y=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(y^y<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,f===(f|0)?l.x=f:u+=f;for(var d=0;d<u.length+64;d++)l.x^=u.charCodeAt(d)|0,d==u.length&&(l.d=l.x<<10^l.x>>>4),l.next()}function o(f,l){return l.x=f.x,l.y=f.y,l.z=f.z,l.w=f.w,l.v=f.v,l.d=f.d,l}function s(f,l){var u=new r(f),d=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,d&&(typeof d=="object"&&o(d,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xorwow=s})(Dv,t)}(vo)),vo.exports}var go={exports:{}},zv=go.exports,jl;function Rv(){return jl||(jl=1,function(t){(function(e,n,i){function r(f){var l=this;l.next=function(){var d=l.x,y=l.i,S,D;return S=d[y],S^=S>>>7,D=S^S<<24,S=d[y+1&7],D^=S^S>>>10,S=d[y+3&7],D^=S^S>>>3,S=d[y+4&7],D^=S^S<<7,S=d[y+7&7],S=S^S<<13,D^=S^S<<9,d[y]=D,l.i=y+1&7,D};function u(d,y){var S,D=[];if(y===(y|0))D[0]=y;else for(y=""+y,S=0;S<y.length;++S)D[S&7]=D[S&7]<<15^y.charCodeAt(S)+D[S+1&7]<<13;for(;D.length<8;)D.push(0);for(S=0;S<8&&D[S]===0;++S);for(S==8?D[7]=-1:D[S],d.x=D,d.i=0,S=256;S>0;--S)d.next()}u(l,f)}function o(f,l){return l.x=f.x.slice(),l.i=f.i,l}function s(f,l){f==null&&(f=+new Date);var u=new r(f),d=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,d&&(d.x&&o(d,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xorshift7=s})(zv,t)}(go)),go.exports}var yo={exports:{}},Mv=yo.exports,ql;function Ov(){return ql||(ql=1,function(t){(function(e,n,i){function r(f){var l=this;l.next=function(){var d=l.w,y=l.X,S=l.i,D,q;return l.w=d=d+1640531527|0,q=y[S+34&127],D=y[S=S+1&127],q^=q<<13,D^=D<<17,q^=q>>>15,D^=D>>>12,q=y[S]=q^D,l.i=S,q+(d^d>>>16)|0};function u(d,y){var S,D,q,Te,we,fe=[],Ne=128;for(y===(y|0)?(D=y,y=null):(y=y+"\0",D=0,Ne=Math.max(Ne,y.length)),q=0,Te=-32;Te<Ne;++Te)y&&(D^=y.charCodeAt((Te+32)%y.length)),Te===0&&(we=D),D^=D<<10,D^=D>>>15,D^=D<<4,D^=D>>>13,Te>=0&&(we=we+1640531527|0,S=fe[Te&127]^=D+we,q=S==0?q+1:0);for(q>=128&&(fe[(y&&y.length||0)&127]=-1),q=127,Te=4*128;Te>0;--Te)D=fe[q+34&127],S=fe[q=q+1&127],D^=D<<13,S^=S<<17,D^=D>>>15,S^=S>>>12,fe[q]=D^S;d.w=we,d.X=fe,d.i=q}u(l,f)}function o(f,l){return l.i=f.i,l.w=f.w,l.X=f.X.slice(),l}function s(f,l){f==null&&(f=+new Date);var u=new r(f),d=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,d&&(d.X&&o(d,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.xor4096=s})(Mv,t)}(yo)),yo.exports}var xo={exports:{}},Nv=xo.exports,Yl;function Gv(){return Yl||(Yl=1,function(t){(function(e,n,i){function r(f){var l=this,u="";l.next=function(){var y=l.b,S=l.c,D=l.d,q=l.a;return y=y<<25^y>>>7^S,S=S-D|0,D=D<<24^D>>>8^q,q=q-y|0,l.b=y=y<<20^y>>>12^S,l.c=S=S-D|0,l.d=D<<16^S>>>16^q,l.a=q-y|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,f===Math.floor(f)?(l.a=f/4294967296|0,l.b=f|0):u+=f;for(var d=0;d<u.length+20;d++)l.b^=u.charCodeAt(d)|0,l.next()}function o(f,l){return l.a=f.a,l.b=f.b,l.c=f.c,l.d=f.d,l}function s(f,l){var u=new r(f),d=l&&l.state,y=function(){return(u.next()>>>0)/4294967296};return y.double=function(){do var S=u.next()>>>11,D=(u.next()>>>0)/4294967296,q=(S+D)/(1<<21);while(q===0);return q},y.int32=u.next,y.quick=y,d&&(typeof d=="object"&&o(d,u),y.state=function(){return o(u,{})}),y}n&&n.exports?n.exports=s:this.tychei=s})(Nv,t)}(xo)),xo.exports}var bo={exports:{}};const Bv=Sp(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Uv=bo.exports,Zl;function Vv(){return Zl||(Zl=1,function(t){(function(e,n,i){var r=256,o=6,s=52,f="random",l=i.pow(r,o),u=i.pow(2,s),d=u*2,y=r-1,S;function D(V,ae,Ie){var Be=[];ae=ae==!0?{entropy:!0}:ae||{};var Xe=fe(we(ae.entropy?[V,Ve(n)]:V??Ne(),3),Be),nt=new q(Be),lt=function(){for(var Ee=nt.g(o),ct=l,ft=0;Ee<u;)Ee=(Ee+ft)*r,ct*=r,ft=nt.g(1);for(;Ee>=d;)Ee/=2,ct/=2,ft>>>=1;return(Ee+ft)/ct};return lt.int32=function(){return nt.g(4)|0},lt.quick=function(){return nt.g(4)/4294967296},lt.double=lt,fe(Ve(nt.S),n),(ae.pass||Ie||function(Ee,ct,ft,G){return G&&(G.S&&Te(G,nt),Ee.state=function(){return Te(nt,{})}),ft?(i[f]=Ee,ct):Ee})(lt,Xe,"global"in ae?ae.global:this==i,ae.state)}function q(V){var ae,Ie=V.length,Be=this,Xe=0,nt=Be.i=Be.j=0,lt=Be.S=[];for(Ie||(V=[Ie++]);Xe<r;)lt[Xe]=Xe++;for(Xe=0;Xe<r;Xe++)lt[Xe]=lt[nt=y&nt+V[Xe%Ie]+(ae=lt[Xe])],lt[nt]=ae;(Be.g=function(Ee){for(var ct,ft=0,G=Be.i,Pe=Be.j,se=Be.S;Ee--;)ct=se[G=y&G+1],ft=ft*r+se[y&(se[G]=se[Pe=y&Pe+ct])+(se[Pe]=ct)];return Be.i=G,Be.j=Pe,ft})(r)}function Te(V,ae){return ae.i=V.i,ae.j=V.j,ae.S=V.S.slice(),ae}function we(V,ae){var Ie=[],Be=typeof V,Xe;if(ae&&Be=="object")for(Xe in V)try{Ie.push(we(V[Xe],ae-1))}catch{}return Ie.length?Ie:Be=="string"?V:V+"\0"}function fe(V,ae){for(var Ie=V+"",Be,Xe=0;Xe<Ie.length;)ae[y&Xe]=y&(Be^=ae[y&Xe]*19)+Ie.charCodeAt(Xe++);return Ve(ae)}function Ne(){try{var V;return S&&(V=S.randomBytes)?V=V(r):(V=new Uint8Array(r),(e.crypto||e.msCrypto).getRandomValues(V)),Ve(V)}catch{var ae=e.navigator,Ie=ae&&ae.plugins;return[+new Date,e,Ie,e.screen,Ve(n)]}}function Ve(V){return String.fromCharCode.apply(0,V)}if(fe(i.random(),n),t.exports){t.exports=D;try{S=Bv}catch{}}else i["seed"+f]=D})(typeof self<"u"?self:Uv,[],Math)}(bo)),bo.exports}var Ja,Ql;function $v(){if(Ql)return Ja;Ql=1;var t=kv(),e=Lv(),n=Fv(),i=Rv(),r=Ov(),o=Gv(),s=Vv();return s.alea=t,s.xor128=e,s.xorwow=n,s.xorshift7=i,s.xor4096=r,s.tychei=o,Ja=s,Ja}var Hv=$v();const Wv=za(Hv);function Xv(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,qv(i.key),i)}}function es(t,e,n){return e&&Xv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Kl(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,ts(t,e)}function ts(t,e){return ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},ts(t,e)}function jv(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function qv(t){var e=jv(t,"string");return typeof e=="symbol"?e:String(e)}var _o=function(){function t(){}var e=t.prototype;return e._seed=function(i,r){if(i===(i||0))return i;for(var o=""+i,s=0,f=0;f<o.length;++f)s^=o.charCodeAt(f)|0;return s},t}(),Jl=function(t){Kl(e,t);function e(i,r){var o;return o=t.call(this)||this,o._rng=void 0,o.seed(i,r),o}var n=e.prototype;return n.next=function(){return this._rng()},n.seed=function(r,o){this._rng=r},n.clone=function(r,o){return new e(this._rng,o)},es(e,[{key:"name",get:function(){return"function"}}]),e}(_o),eu=function(){var t=[].slice.call(arguments),e=t,n=e[0],i=n===void 0?"default":n;switch(typeof i){case"object":if(i instanceof _o)return i;break;case"function":return new Jl(i);case"number":case"string":default:return new Jl(Wv.apply(void 0,t))}throw new Error('invalid RNG "'+i+'"')},Yv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){return t.next()*(n-e)+e}};function pn(t){return new Zv(t)}var Zv=function(e){var n=this;this.n=void 0,this.isInt=function(){if(Number.isInteger(n.n))return n;throw new Error("Expected number to be an integer, got "+n.n)},this.isPositive=function(){if(n.n>0)return n;throw new Error("Expected number to be positive, got "+n.n)},this.lessThan=function(i){if(n.n<i)return n;throw new Error("Expected number to be less than "+i+", got "+n.n)},this.greaterThanOrEqual=function(i){if(n.n>=i)return n;throw new Error("Expected number to be greater than or equal to "+i+", got "+n.n)},this.greaterThan=function(i){if(n.n>i)return n;throw new Error("Expected number to be greater than "+i+", got "+n.n)},this.n=e},Qv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),n===void 0&&(n=e===void 0?1:e,e=0),pn(e).isInt(),pn(n).isInt(),function(){return Math.floor(t.next()*(n-e+1)+e)}},Kv=function(t){return function(){return t.next()>=.5}},Jv=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),function(){var i,r,o;do i=t.next()*2-1,r=t.next()*2-1,o=i*i+r*r;while(!o||o>1);return e+n*r*Math.sqrt(-2*Math.log(o)/o)}},eg=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=1);var i=t.normal(e,n);return function(){return Math.exp(i())}},tg=function(t,e){return e===void 0&&(e=.5),pn(e).greaterThanOrEqual(0).lessThan(1),function(){return Math.floor(t.next()+e)}},ng=function(t,e,n){return e===void 0&&(e=1),n===void 0&&(n=.5),pn(e).isInt().isPositive(),pn(n).greaterThanOrEqual(0).lessThan(1),function(){for(var i=0,r=0;i++<e;)t.next()<n&&r++;return r}},ig=function(t,e){e===void 0&&(e=.5),pn(e).greaterThan(0).lessThan(1);var n=1/Math.log(1-e);return function(){return Math.floor(1+Math.log(t.next())*n)}},rg=[0,0,.6931471805599453,1.791759469228055,3.1780538303479458,4.787491742782046,6.579251212010101,8.525161361065415,10.60460290274525,12.801827480081469],og=function(e){return rg[e]},ag=.9189385332046727,sg=function(t,e){if(e===void 0&&(e=1),pn(e).isPositive(),e<10){var n=Math.exp(-e);return function(){for(var l=n,u=0,d=t.next();d>l;)d=d-l,l=e*l/++u;return u}}else{var i=Math.sqrt(e),r=.931+2.53*i,o=-.059+.02483*r,s=1.1239+1.1328/(r-3.4),f=.9277-3.6224/(r-2);return function(){for(;;){var l=void 0,u=t.next();if(u<=.86*f)return l=u/f-.43,Math.floor((2*o/(.5-Math.abs(l))+r)*l+e+.445);u>=f?l=t.next()-.5:(l=u/f-.93,l=(l<0?-.5:.5)-l,u=t.next()*f);var d=.5-Math.abs(l);if(!(d<.013&&u>d)){var y=Math.floor((2*o/d+r)*l+e+.445);if(u=u*s/(o/(d*d)+r),y>=10){var S=(y+.5)*Math.log(e/y)-e-ag+y-(.08333333333333333-(.002777777777777778-1/(1260*y*y))/(y*y))/y;if(Math.log(u*i)<=S)return y}else if(y>=0){var D,q=(D=og(y))!=null?D:0;if(Math.log(u)<=y*Math.log(e)-e-q)return y}}}}}},fg=function(t,e){return e===void 0&&(e=1),pn(e).isPositive(),function(){return-Math.log(1-t.next())/e}},lg=function(t,e){return e===void 0&&(e=1),pn(e).isInt().greaterThanOrEqual(0),function(){for(var n=0,i=0;i<e;++i)n+=t.next();return n}},ug=function(t,e){e===void 0&&(e=1),pn(e).isInt().isPositive();var n=t.irwinHall(e);return function(){return n()/e}},cg=function(t,e){e===void 0&&(e=1),pn(e).greaterThanOrEqual(0);var n=1/e;return function(){return 1/Math.pow(1-t.next(),n)}},hg=function(t){Kl(e,t);function e(){return t.apply(this,arguments)||this}var n=e.prototype;return n.next=function(){return Math.random()},n.seed=function(r,o){},n.clone=function(){return new e},es(e,[{key:"name",get:function(){return"default"}}]),e}(_o),tu=function(){function t(n){var i=this;this._rng=void 0,this._patch=void 0,this._cache={},this.next=function(){return i._rng.next()},this.float=function(r,o){return i.uniform(r,o)()},this.int=function(r,o){return i.uniformInt(r,o)()},this.integer=function(r,o){return i.uniformInt(r,o)()},this.bool=function(){return i.uniformBoolean()()},this.boolean=function(){return i.uniformBoolean()()},this.uniform=function(r,o){return i._memoize("uniform",Yv,r,o)},this.uniformInt=function(r,o){return i._memoize("uniformInt",Qv,r,o)},this.uniformBoolean=function(){return i._memoize("uniformBoolean",Kv)},this.normal=function(r,o){return Jv(i,r,o)},this.logNormal=function(r,o){return eg(i,r,o)},this.bernoulli=function(r){return tg(i,r)},this.binomial=function(r,o){return ng(i,r,o)},this.geometric=function(r){return ig(i,r)},this.poisson=function(r){return sg(i,r)},this.exponential=function(r){return fg(i,r)},this.irwinHall=function(r){return lg(i,r)},this.bates=function(r){return ug(i,r)},this.pareto=function(r){return cg(i,r)},n&&n instanceof _o?this.use(n):this.use(new hg),this._cache={}}var e=t.prototype;return e.clone=function(){var i=[].slice.call(arguments);return i.length?new t(eu.apply(void 0,i)):new t(this.rng.clone())},e.use=function(){this._rng=eu.apply(void 0,[].slice.call(arguments))},e.patch=function(){if(this._patch)throw new Error("Math.random already patched");this._patch=Math.random,Math.random=this.uniform()},e.unpatch=function(){this._patch&&(Math.random=this._patch,delete this._patch)},e.choice=function(i){if(!Array.isArray(i))throw new Error("Random.choice expected input to be an array, got "+typeof i);var r=i==null?void 0:i.length;if(r>0){var o=this.uniformInt(0,r-1)();return i[o]}else return},e._memoize=function(i,r){var o=[].slice.call(arguments,2),s=""+o.join(";"),f=this._cache[i];return(f===void 0||f.key!==s)&&(f={key:s,distribution:r.apply(void 0,[this].concat(o))},this._cache[i]=f),f.distribution},es(t,[{key:"rng",get:function(){return this._rng}}]),t}();new tu;const ns=.001,is=64,dg=4;class mg{constructor(){this.pointsTextureSize=0,this.linksTextureSize=0,this.alpha=1,this.transform=Ev(),this.screenSize=[0,0],this.mousePosition=[0,0],this.screenMousePosition=[0,0],this.selectedArea=[[0,0],[0,0]],this.isSimulationRunning=!1,this.simulationProgress=0,this.selectedIndices=null,this.maxPointSize=is,this.hoveredPoint=void 0,this.focusedPoint=void 0,this.draggingPointIndex=void 0,this.hoveredLinkIndex=void 0,this.adjustedSpaceSize=Oe.spaceSize,this.isSpaceKeyPressed=!1,this.webglMaxTextureSize=16384,this.hoveredPointRingColor=[1,1,1,Rp],this.focusedPointRingColor=[1,1,1,Mp],this.hoveredLinkColor=[-1,-1,-1,-1],this.greyoutPointColor=[-1,-1,-1,-1],this.isDarkenGreyout=!1,this.isLinkHoveringEnabled=!1,this.alphaTarget=0,this.scalePointX=Qa(),this.scalePointY=Qa(),this.random=new tu,this._backgroundColor=[0,0,0,0],this.alphaDecay=e=>1-Math.pow(ns,1/e)}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=e;const n=pl(e[0],e[1],e[2]);document.documentElement.style.setProperty("--cosmosgl-attribution-color",n>.65?"black":"white"),document.documentElement.style.setProperty("--cosmosgl-error-message-color",n>.65?"black":"white"),this.div&&(this.div.style.backgroundColor=`rgba(${e[0]*255}, ${e[1]*255}, ${e[2]*255}, ${e[3]})`),this.isDarkenGreyout=n<.65}addRandomSeed(e){this.random=this.random.clone(e)}getRandomFloat(e,n){return this.random.float(e,n)}adjustSpaceSize(e,n){e>=n?(this.adjustedSpaceSize=n/2,console.warn(`The \`spaceSize\` has been reduced to ${this.adjustedSpaceSize} due to WebGL limits`)):this.adjustedSpaceSize=e}setWebGLMaxTextureSize(e){this.webglMaxTextureSize=e}updateScreenSize(e,n){const{adjustedSpaceSize:i}=this;this.screenSize=[e,n],this.scalePointX.domain([0,i]).range([(e-i)/2,(e+i)/2]),this.scalePointY.domain([i,0]).range([(n-i)/2,(n+i)/2])}scaleX(e){return this.scalePointX(e)}scaleY(e){return this.scalePointY(e)}setHoveredPointRingColor(e){const n=Fn(e);this.hoveredPointRingColor[0]=n[0],this.hoveredPointRingColor[1]=n[1],this.hoveredPointRingColor[2]=n[2]}setFocusedPointRingColor(e){const n=Fn(e);this.focusedPointRingColor[0]=n[0],this.focusedPointRingColor[1]=n[1],this.focusedPointRingColor[2]=n[2]}setGreyoutPointColor(e){if(e===void 0){this.greyoutPointColor=[-1,-1,-1,-1];return}const n=Fn(e);this.greyoutPointColor[0]=n[0],this.greyoutPointColor[1]=n[1],this.greyoutPointColor[2]=n[2],this.greyoutPointColor[3]=n[3]}updateLinkHoveringEnabled(e){this.isLinkHoveringEnabled=!!(e.onLinkClick||e.onLinkMouseOver||e.onLinkMouseOut),this.isLinkHoveringEnabled||(this.hoveredLinkIndex=void 0)}setHoveredLinkColor(e){if(e===void 0){this.hoveredLinkColor=[-1,-1,-1,-1];return}const n=Fn(e);this.hoveredLinkColor[0]=n[0],this.hoveredLinkColor[1]=n[1],this.hoveredLinkColor[2]=n[2],this.hoveredLinkColor[3]=n[3]}setFocusedPoint(e){e!==void 0?this.focusedPoint={index:e}:this.focusedPoint=void 0}addAlpha(e){return(this.alphaTarget-this.alpha)*this.alphaDecay(e)}}const pg={passive:!1},pr={capture:!0,passive:!1};function rs(t){t.stopImmediatePropagation()}function Di(t){t.preventDefault(),t.stopImmediatePropagation()}function nu(t){var e=t.document.documentElement,n=Ft(t).on("dragstart.drag",Di,pr);"onselectstart"in e?n.on("selectstart.drag",Di,pr):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function iu(t,e){var n=t.document.documentElement,i=Ft(t).on("dragstart.drag",null);e&&(i.on("click.drag",Di,pr),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const So=t=>()=>t;function os(t,{sourceEvent:e,subject:n,target:i,identifier:r,active:o,x:s,y:f,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}os.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function vg(t){return!t.ctrlKey&&!t.button}function gg(){return this.parentNode}function yg(t,e){return e??{x:t.x,y:t.y}}function xg(){return navigator.maxTouchPoints||"ontouchstart"in this}function bg(){var t=vg,e=gg,n=yg,i=xg,r={},o=Vr("start","drag","end"),s=0,f,l,u,d,y=0;function S(V){V.on("mousedown.drag",D).filter(i).on("touchstart.drag",we).on("touchmove.drag",fe,pg).on("touchend.drag touchcancel.drag",Ne).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function D(V,ae){if(!(d||!t.call(this,V,ae))){var Ie=Ve(this,e.call(this,V,ae),V,ae,"mouse");Ie&&(Ft(V.view).on("mousemove.drag",q,pr).on("mouseup.drag",Te,pr),nu(V.view),rs(V),u=!1,f=V.clientX,l=V.clientY,Ie("start",V))}}function q(V){if(Di(V),!u){var ae=V.clientX-f,Ie=V.clientY-l;u=ae*ae+Ie*Ie>y}r.mouse("drag",V)}function Te(V){Ft(V.view).on("mousemove.drag mouseup.drag",null),iu(V.view,u),Di(V),r.mouse("end",V)}function we(V,ae){if(t.call(this,V,ae)){var Ie=V.changedTouches,Be=e.call(this,V,ae),Xe=Ie.length,nt,lt;for(nt=0;nt<Xe;++nt)(lt=Ve(this,Be,V,ae,Ie[nt].identifier,Ie[nt]))&&(rs(V),lt("start",V,Ie[nt]))}}function fe(V){var ae=V.changedTouches,Ie=ae.length,Be,Xe;for(Be=0;Be<Ie;++Be)(Xe=r[ae[Be].identifier])&&(Di(V),Xe("drag",V,ae[Be]))}function Ne(V){var ae=V.changedTouches,Ie=ae.length,Be,Xe;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),Be=0;Be<Ie;++Be)(Xe=r[ae[Be].identifier])&&(rs(V),Xe("end",V,ae[Be]))}function Ve(V,ae,Ie,Be,Xe,nt){var lt=o.copy(),Ee=kn(nt||Ie,ae),ct,ft,G;if((G=n.call(V,new os("beforestart",{sourceEvent:Ie,target:S,identifier:Xe,active:s,x:Ee[0],y:Ee[1],dx:0,dy:0,dispatch:lt}),Be))!=null)return ct=G.x-Ee[0]||0,ft=G.y-Ee[1]||0,function Pe(se,De,qe){var je=Ee,Qe;switch(se){case"start":r[Xe]=Pe,Qe=s++;break;case"end":delete r[Xe],--s;case"drag":Ee=kn(qe||De,ae),Qe=s;break}lt.call(se,V,new os(se,{sourceEvent:De,subject:G,target:S,identifier:Xe,active:Qe,x:Ee[0]+ct,y:Ee[1]+ft,dx:Ee[0]-je[0],dy:Ee[1]-je[1],dispatch:lt}),Be)}}return S.filter=function(V){return arguments.length?(t=typeof V=="function"?V:So(!!V),S):t},S.container=function(V){return arguments.length?(e=typeof V=="function"?V:So(V),S):e},S.subject=function(V){return arguments.length?(n=typeof V=="function"?V:So(V),S):n},S.touchable=function(V){return arguments.length?(i=typeof V=="function"?V:So(!!V),S):i},S.on=function(){var V=o.on.apply(o,arguments);return V===o?S:V},S.clickDistance=function(V){return arguments.length?(y=(V=+V)*V,S):Math.sqrt(y)},S}const To=t=>()=>t;function _g(t,{sourceEvent:e,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function Rn(t,e,n){this.k=t,this.x=e,this.y=n}Rn.prototype={constructor:Rn,scale:function(t){return t===1?this:new Rn(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Rn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vr=new Rn(1,0,0);Rn.prototype;function as(t){t.stopImmediatePropagation()}function gr(t){t.preventDefault(),t.stopImmediatePropagation()}function Sg(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Tg(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function ru(){return this.__zoom||vr}function wg(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ag(){return navigator.maxTouchPoints||"ontouchstart"in this}function Eg(t,e,n){var i=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Cg(){var t=Sg,e=Tg,n=Eg,i=wg,r=Ag,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],f=250,l=pm,u=Vr("start","zoom","end"),d,y,S,D=500,q=150,Te=0,we=10;function fe(G){G.property("__zoom",ru).on("wheel.zoom",Xe,{passive:!1}).on("mousedown.zoom",nt).on("dblclick.zoom",lt).filter(r).on("touchstart.zoom",Ee).on("touchmove.zoom",ct).on("touchend.zoom touchcancel.zoom",ft).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}fe.transform=function(G,Pe,se,De){var qe=G.selection?G.selection():G;qe.property("__zoom",ru),G!==qe?ae(G,Pe,se,De):qe.interrupt().each(function(){Ie(this,arguments).event(De).start().zoom(null,typeof Pe=="function"?Pe.apply(this,arguments):Pe).end()})},fe.scaleBy=function(G,Pe,se,De){fe.scaleTo(G,function(){var qe=this.__zoom.k,je=typeof Pe=="function"?Pe.apply(this,arguments):Pe;return qe*je},se,De)},fe.scaleTo=function(G,Pe,se,De){fe.transform(G,function(){var qe=e.apply(this,arguments),je=this.__zoom,Qe=se==null?V(qe):typeof se=="function"?se.apply(this,arguments):se,Ze=je.invert(Qe),dt=typeof Pe=="function"?Pe.apply(this,arguments):Pe;return n(Ve(Ne(je,dt),Qe,Ze),qe,s)},se,De)},fe.translateBy=function(G,Pe,se,De){fe.transform(G,function(){return n(this.__zoom.translate(typeof Pe=="function"?Pe.apply(this,arguments):Pe,typeof se=="function"?se.apply(this,arguments):se),e.apply(this,arguments),s)},null,De)},fe.translateTo=function(G,Pe,se,De,qe){fe.transform(G,function(){var je=e.apply(this,arguments),Qe=this.__zoom,Ze=De==null?V(je):typeof De=="function"?De.apply(this,arguments):De;return n(vr.translate(Ze[0],Ze[1]).scale(Qe.k).translate(typeof Pe=="function"?-Pe.apply(this,arguments):-Pe,typeof se=="function"?-se.apply(this,arguments):-se),je,s)},De,qe)};function Ne(G,Pe){return Pe=Math.max(o[0],Math.min(o[1],Pe)),Pe===G.k?G:new Rn(Pe,G.x,G.y)}function Ve(G,Pe,se){var De=Pe[0]-se[0]*G.k,qe=Pe[1]-se[1]*G.k;return De===G.x&&qe===G.y?G:new Rn(G.k,De,qe)}function V(G){return[(+G[0][0]+ +G[1][0])/2,(+G[0][1]+ +G[1][1])/2]}function ae(G,Pe,se,De){G.on("start.zoom",function(){Ie(this,arguments).event(De).start()}).on("interrupt.zoom end.zoom",function(){Ie(this,arguments).event(De).end()}).tween("zoom",function(){var qe=this,je=arguments,Qe=Ie(qe,je).event(De),Ze=e.apply(qe,je),dt=se==null?V(Ze):typeof se=="function"?se.apply(qe,je):se,ut=Math.max(Ze[1][0]-Ze[0][0],Ze[1][1]-Ze[0][1]),_t=qe.__zoom,at=typeof Pe=="function"?Pe.apply(qe,je):Pe,$t=l(_t.invert(dt).concat(ut/_t.k),at.invert(dt).concat(ut/at.k));return function(Ht){if(Ht===1)Ht=at;else{var Kt=$t(Ht),Mn=ut/Kt[2];Ht=new Rn(Mn,dt[0]-Kt[0]*Mn,dt[1]-Kt[1]*Mn)}Qe.zoom(null,Ht)}})}function Ie(G,Pe,se){return!se&&G.__zooming||new Be(G,Pe)}function Be(G,Pe){this.that=G,this.args=Pe,this.active=0,this.sourceEvent=null,this.extent=e.apply(G,Pe),this.taps=0}Be.prototype={event:function(G){return G&&(this.sourceEvent=G),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(G,Pe){return this.mouse&&G!=="mouse"&&(this.mouse[1]=Pe.invert(this.mouse[0])),this.touch0&&G!=="touch"&&(this.touch0[1]=Pe.invert(this.touch0[0])),this.touch1&&G!=="touch"&&(this.touch1[1]=Pe.invert(this.touch1[0])),this.that.__zoom=Pe,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(G){var Pe=Ft(this.that).datum();u.call(G,this.that,new _g(G,{sourceEvent:this.sourceEvent,target:fe,transform:this.that.__zoom,dispatch:u}),Pe)}};function Xe(G,...Pe){if(!t.apply(this,arguments))return;var se=Ie(this,Pe).event(G),De=this.__zoom,qe=Math.max(o[0],Math.min(o[1],De.k*Math.pow(2,i.apply(this,arguments)))),je=kn(G);if(se.wheel)(se.mouse[0][0]!==je[0]||se.mouse[0][1]!==je[1])&&(se.mouse[1]=De.invert(se.mouse[0]=je)),clearTimeout(se.wheel);else{if(De.k===qe)return;se.mouse=[je,De.invert(je)],Qr(this),se.start()}gr(G),se.wheel=setTimeout(Qe,q),se.zoom("mouse",n(Ve(Ne(De,qe),se.mouse[0],se.mouse[1]),se.extent,s));function Qe(){se.wheel=null,se.end()}}function nt(G,...Pe){if(S||!t.apply(this,arguments))return;var se=G.currentTarget,De=Ie(this,Pe,!0).event(G),qe=Ft(G.view).on("mousemove.zoom",dt,!0).on("mouseup.zoom",ut,!0),je=kn(G,se),Qe=G.clientX,Ze=G.clientY;nu(G.view),as(G),De.mouse=[je,this.__zoom.invert(je)],Qr(this),De.start();function dt(_t){if(gr(_t),!De.moved){var at=_t.clientX-Qe,$t=_t.clientY-Ze;De.moved=at*at+$t*$t>Te}De.event(_t).zoom("mouse",n(Ve(De.that.__zoom,De.mouse[0]=kn(_t,se),De.mouse[1]),De.extent,s))}function ut(_t){qe.on("mousemove.zoom mouseup.zoom",null),iu(_t.view,De.moved),gr(_t),De.event(_t).end()}}function lt(G,...Pe){if(t.apply(this,arguments)){var se=this.__zoom,De=kn(G.changedTouches?G.changedTouches[0]:G,this),qe=se.invert(De),je=se.k*(G.shiftKey?.5:2),Qe=n(Ve(Ne(se,je),De,qe),e.apply(this,Pe),s);gr(G),f>0?Ft(this).transition().duration(f).call(ae,Qe,De,G):Ft(this).call(fe.transform,Qe,De,G)}}function Ee(G,...Pe){if(t.apply(this,arguments)){var se=G.touches,De=se.length,qe=Ie(this,Pe,G.changedTouches.length===De).event(G),je,Qe,Ze,dt;for(as(G),Qe=0;Qe<De;++Qe)Ze=se[Qe],dt=kn(Ze,this),dt=[dt,this.__zoom.invert(dt),Ze.identifier],qe.touch0?!qe.touch1&&qe.touch0[2]!==dt[2]&&(qe.touch1=dt,qe.taps=0):(qe.touch0=dt,je=!0,qe.taps=1+!!d);d&&(d=clearTimeout(d)),je&&(qe.taps<2&&(y=dt[0],d=setTimeout(function(){d=null},D)),Qr(this),qe.start())}}function ct(G,...Pe){if(this.__zooming){var se=Ie(this,Pe).event(G),De=G.changedTouches,qe=De.length,je,Qe,Ze,dt;for(gr(G),je=0;je<qe;++je)Qe=De[je],Ze=kn(Qe,this),se.touch0&&se.touch0[2]===Qe.identifier?se.touch0[0]=Ze:se.touch1&&se.touch1[2]===Qe.identifier&&(se.touch1[0]=Ze);if(Qe=se.that.__zoom,se.touch1){var ut=se.touch0[0],_t=se.touch0[1],at=se.touch1[0],$t=se.touch1[1],Ht=(Ht=at[0]-ut[0])*Ht+(Ht=at[1]-ut[1])*Ht,Kt=(Kt=$t[0]-_t[0])*Kt+(Kt=$t[1]-_t[1])*Kt;Qe=Ne(Qe,Math.sqrt(Ht/Kt)),Ze=[(ut[0]+at[0])/2,(ut[1]+at[1])/2],dt=[(_t[0]+$t[0])/2,(_t[1]+$t[1])/2]}else if(se.touch0)Ze=se.touch0[0],dt=se.touch0[1];else return;se.zoom("touch",n(Ve(Qe,Ze,dt),se.extent,s))}}function ft(G,...Pe){if(this.__zooming){var se=Ie(this,Pe).event(G),De=G.changedTouches,qe=De.length,je,Qe;for(as(G),S&&clearTimeout(S),S=setTimeout(function(){S=null},D),je=0;je<qe;++je)Qe=De[je],se.touch0&&se.touch0[2]===Qe.identifier?delete se.touch0:se.touch1&&se.touch1[2]===Qe.identifier&&delete se.touch1;if(se.touch1&&!se.touch0&&(se.touch0=se.touch1,delete se.touch1),se.touch0)se.touch0[1]=this.__zoom.invert(se.touch0[0]);else if(se.end(),se.taps===2&&(Qe=kn(Qe,this),Math.hypot(y[0]-Qe[0],y[1]-Qe[1])<we)){var Ze=Ft(this).on("dblclick.zoom");Ze&&Ze.apply(this,arguments)}}}return fe.wheelDelta=function(G){return arguments.length?(i=typeof G=="function"?G:To(+G),fe):i},fe.filter=function(G){return arguments.length?(t=typeof G=="function"?G:To(!!G),fe):t},fe.touchable=function(G){return arguments.length?(r=typeof G=="function"?G:To(!!G),fe):r},fe.extent=function(G){return arguments.length?(e=typeof G=="function"?G:To([[+G[0][0],+G[0][1]],[+G[1][0],+G[1][1]]]),fe):e},fe.scaleExtent=function(G){return arguments.length?(o[0]=+G[0],o[1]=+G[1],fe):[o[0],o[1]]},fe.translateExtent=function(G){return arguments.length?(s[0][0]=+G[0][0],s[1][0]=+G[1][0],s[0][1]=+G[0][1],s[1][1]=+G[1][1],fe):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},fe.constrain=function(G){return arguments.length?(n=G,fe):n},fe.duration=function(G){return arguments.length?(f=+G,fe):f},fe.interpolate=function(G){return arguments.length?(l=G,fe):l},fe.on=function(){var G=u.on.apply(u,arguments);return G===u?fe:G},fe.clickDistance=function(G){return arguments.length?(Te=(G=+G)*G,fe):Math.sqrt(Te)},fe.tapDistance=function(G){return arguments.length?(we=+G,fe):we},fe}class Pg{constructor(e,n){this.eventTransform=vr,this.behavior=Cg().scaleExtent([.001,1/0]).on("start",i=>{var o,s;this.isRunning=!0;const r=!!i.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomStart)==null||s.call(o,i,r)}).on("zoom",i=>{var S,D;this.eventTransform=i.transform;const{eventTransform:{x:r,y:o,k:s},store:{transform:f,screenSize:l}}=this,u=l[0],d=l[1];if(!u||!d)return;Cv(f,u,d),$l(f,f,[r,o]),Ka(f,f,[s,s]),$l(f,f,[u/2,d/2]),Ka(f,f,[u/2,d/2]),Ka(f,f,[1,-1]);const y=!!i.sourceEvent;(D=(S=this.config)==null?void 0:S.onZoom)==null||D.call(S,i,y)}).on("end",i=>{var o,s;this.isRunning=!1;const r=!!i.sourceEvent;(s=(o=this.config)==null?void 0:o.onZoomEnd)==null||s.call(o,i,r)}),this.isRunning=!1,this.store=e,this.config=n}getTransform(e,n,i=.1){if(e.length===0)return this.eventTransform;const{store:{screenSize:r}}=this,o=r[0],s=r[1],f=Al(e.map(fe=>fe[0])),l=Al(e.map(fe=>fe[1]));f[0]=this.store.scaleX(f[0]),f[1]=this.store.scaleX(f[1]),l[0]=this.store.scaleY(l[0]),l[1]=this.store.scaleY(l[1]),f[0]===f[1]&&(f[0]-=.5,f[1]+=.5),l[0]===l[1]&&(l[0]+=.5,l[1]-=.5);const u=o*(1-i*2)/(f[1]-f[0]),d=s*(1-i*2)/(l[0]-l[1]),y=vl(n??Math.min(u,d),...this.behavior.scaleExtent()),S=(f[1]+f[0])/2,D=(l[1]+l[0])/2,q=o/2-S*y,Te=s/2-D*y;return vr.translate(q,Te).scale(y)}getDistanceToPoint(e){const{x:n,y:i,k:r}=this.eventTransform,o=this.getTransform([e],r),s=n-o.x,f=i-o.y;return Math.sqrt(s*s+f*f)}getMiddlePointTransform(e){const{store:{screenSize:n},eventTransform:{x:i,y:r,k:o}}=this,s=n[0],f=n[1],l=(s/2-i)/o,u=(f/2-r)/o,d=this.store.scaleX(e[0]),y=this.store.scaleY(e[1]),S=(l+d)/2,D=(u+y)/2,q=1,Te=s/2-S*q,we=f/2-D*q;return vr.translate(Te,we).scale(q)}convertScreenToSpacePosition(e){const{eventTransform:{x:n,y:i,k:r},store:{screenSize:o}}=this,s=o[0],f=o[1],l=(e[0]-n)/r,u=(e[1]-i)/r,d=[l,f-u];return d[0]-=(s-this.store.adjustedSpaceSize)/2,d[1]-=(f-this.store.adjustedSpaceSize)/2,d}convertSpaceToScreenPosition(e){const n=this.eventTransform.applyX(this.store.scaleX(e[0])),i=this.eventTransform.applyY(this.store.scaleY(e[1]));return[n,i]}convertSpaceToScreenRadius(e){const{config:{scalePointsOnZoom:n},store:{maxPointSize:i},eventTransform:{k:r}}=this;let o=e*2;return n?o*=r:o*=Math.min(5,Math.max(1,r*.01)),Math.min(o,i)/2}}class kg{constructor(e,n){this.isActive=!1,this.behavior=bg().subject(i=>this.store.hoveredPoint&&!this.store.isSpaceKeyPressed?{x:i.x,y:i.y}:void 0).on("start",i=>{var r,o;this.store.hoveredPoint&&(this.store.draggingPointIndex=this.store.hoveredPoint.index,this.isActive=!0,(o=(r=this.config)==null?void 0:r.onDragStart)==null||o.call(r,i))}).on("drag",i=>{var r,o;(o=(r=this.config)==null?void 0:r.onDrag)==null||o.call(r,i)}).on("end",i=>{var r,o;this.isActive=!1,this.store.draggingPointIndex=void 0,(o=(r=this.config)==null?void 0:r.onDragEnd)==null||o.call(r,i)}),this.store=e,this.config=n}}function Ig(t){const e=document.createElement("div");return e.style.cssText=`
|
|
1671
1671
|
color: var(--cosmosgl-error-message-color);
|
|
1672
1672
|
padding: 0em 2em;
|
|
1673
1673
|
position: absolute;
|
|
@@ -1678,7 +1678,7 @@ void main() {
|
|
|
1678
1678
|
font-size: 1rem;
|
|
1679
1679
|
text-align: center;
|
|
1680
1680
|
user-select: none;
|
|
1681
|
-
`,e.textContent="Sorry, your device or browser does not support the required WebGL features for this visualization",t.appendChild(e),e}class Lg{constructor(e,n){this.config=new a0,this.graph=new I0(this.config),this.requestAnimationFrameId=0,this.isRightClickMouse=!1,this.store=new mg,this.zoomInstance=new Pg(this.store,this.config),this.dragInstance=new kg(this.store,this.config),this._findHoveredItemExecutionCount=0,this._isMouseOnCanvas=!1,this._isFirstRenderAfterInit=!0,this.isPointPositionsUpdateNeeded=!1,this.isPointColorUpdateNeeded=!1,this.isPointSizeUpdateNeeded=!1,this.isPointShapeUpdateNeeded=!1,this.isPointImageIndicesUpdateNeeded=!1,this.isLinksUpdateNeeded=!1,this.isLinkColorUpdateNeeded=!1,this.isLinkWidthUpdateNeeded=!1,this.isLinkArrowUpdateNeeded=!1,this.isPointClusterUpdateNeeded=!1,this.isForceManyBodyUpdateNeeded=!1,this.isForceLinkUpdateNeeded=!1,this.isForceCenterUpdateNeeded=!1,this.isPointImageSizesUpdateNeeded=!1,this._isDestroyed=!1,n&&this.config.init(n),this.store.div=e;const i=document.createElement("canvas");i.style.width="100%",i.style.height="100%",this.store.div.appendChild(i),this.addAttribution();const r=i.clientWidth,o=i.clientHeight;i.width=r*this.config.pixelRatio,i.height=o*this.config.pixelRatio,this.canvas=i;let s;try{s=Ep({canvas:this.canvas,attributes:{antialias:!1,preserveDrawingBuffer:!0},extensions:["OES_texture_float","ANGLE_instanced_arrays"]})}catch{Ig(this.store.div),this._isDestroyed=!0;return}this.reglInstance=s,this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.store.setWebGLMaxTextureSize(this.reglInstance.limits.maxTextureSize),this.store.updateScreenSize(r,o),this.canvasD3Selection=Ft(this.canvas),this.canvasD3Selection.on("mouseenter.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mousemove.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mouseleave.cosmos",f=>{this._isMouseOnCanvas=!1,this.currentEvent=f,this.store.hoveredPoint!==void 0&&this.config.onPointMouseOut&&this.config.onPointMouseOut(f),this.store.hoveredLinkIndex!==void 0&&this.config.onLinkMouseOut&&this.config.onLinkMouseOut(f),this.isRightClickMouse=!1,this.store.hoveredPoint=void 0,this.store.hoveredLinkIndex=void 0,this.updateCanvasCursor()}),Ft(document).on("keydown.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!0)}).on("keyup.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!1)}),this.zoomInstance.behavior.on("start.detect",f=>{this.currentEvent=f}).on("zoom.detect",f=>{!!f.sourceEvent&&this.updateMousePosition(f.sourceEvent),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f}),this.dragInstance.behavior.on("start.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}).on("drag.detect",f=>{this.dragInstance.isActive&&this.updateMousePosition(f),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}),this.canvasD3Selection.call(this.dragInstance.behavior).call(this.zoomInstance.behavior).on("click",this.onClick.bind(this)).on("mousemove",this.onMouseMove.bind(this)).on("contextmenu",this.onRightClickMouse.bind(this)),(!this.config.enableZoom||!this.config.enableDrag)&&this.updateZoomDragBehaviors(),this.setZoomLevel(this.config.initialZoomLevel??1),this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??is)/this.config.pixelRatio,this.points=new Av(this.reglInstance,this.config,this.store,this.graph),this.lines=new uv(this.reglInstance,this.config,this.store,this.graph,this.points),this.config.enableSimulation&&(this.forceGravity=new h0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceCenter=new u0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceManyBody=this.config.useClassicQuadtree?new y0(this.reglInstance,this.config,this.store,this.graph,this.points):new v0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkIncoming=new yl(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkOutgoing=new yl(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceMouse=new b0(this.reglInstance,this.config,this.store,this.graph,this.points)),this.clusters=new w0(this.reglInstance,this.config,this.store,this.graph,this.points),this.store.backgroundColor=Fn(this.config.backgroundColor),this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor??Oe.hoveredPointRingColor),this.store.setFocusedPointRingColor(this.config.focusedPointRingColor??Oe.focusedPointRingColor),this.config.focusedPointIndex!==void 0&&this.store.setFocusedPoint(this.config.focusedPointIndex),this.store.setGreyoutPointColor(this.config.pointGreyoutColor??Ra),this.store.setHoveredLinkColor(this.config.hoveredLinkColor??Oe.hoveredLinkColor),this.store.updateLinkHoveringEnabled(this.config),this.config.showFPSMonitor&&(this.fpsMonitor=new Sl(this.canvas)),this.config.randomSeed!==void 0&&this.store.addRandomSeed(this.config.randomSeed)}get progress(){return this._isDestroyed?0:this.store.simulationProgress}get isSimulationRunning(){return this._isDestroyed?!1:this.store.isSimulationRunning}get maxPointSize(){return this._isDestroyed?0:this.store.maxPointSize}setConfig(e){var i;if(this._isDestroyed||!this.reglInstance||!this.points||!this.lines||!this.clusters)return;const n={...this.config};this.config.init(e),(n.pointDefaultColor!==this.config.pointDefaultColor||n.pointColor!==this.config.pointColor)&&(this.graph.updatePointColor(),this.points.updateColor()),n.pointSize!==this.config.pointSize&&(this.graph.updatePointSize(),this.points.updateSize()),n.linkColor!==this.config.linkColor&&(this.graph.updateLinkColor(),this.lines.updateColor()),n.linkWidth!==this.config.linkWidth&&(this.graph.updateLinkWidth(),this.lines.updateWidth()),n.linkArrows!==this.config.linkArrows&&(this.graph.updateArrows(),this.lines.updateArrow()),(n.curvedLinkSegments!==this.config.curvedLinkSegments||n.curvedLinks!==this.config.curvedLinks)&&this.lines.updateCurveLineGeometry(),n.backgroundColor!==this.config.backgroundColor&&(this.store.backgroundColor=Fn(this.config.backgroundColor??Qf)),n.hoveredPointRingColor!==this.config.hoveredPointRingColor&&this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor??Oe.hoveredPointRingColor),n.focusedPointRingColor!==this.config.focusedPointRingColor&&this.store.setFocusedPointRingColor(this.config.focusedPointRingColor??Oe.focusedPointRingColor),n.pointGreyoutColor!==this.config.pointGreyoutColor&&this.store.setGreyoutPointColor(this.config.pointGreyoutColor??Ra),n.hoveredLinkColor!==this.config.hoveredLinkColor&&this.store.setHoveredLinkColor(this.config.hoveredLinkColor??Oe.hoveredLinkColor),n.focusedPointIndex!==this.config.focusedPointIndex&&this.store.setFocusedPoint(this.config.focusedPointIndex),(n.spaceSize!==this.config.spaceSize||n.simulationRepulsionQuadtreeLevels!==this.config.simulationRepulsionQuadtreeLevels)&&(this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.resizeCanvas(!0),this.update(this.store.isSimulationRunning?this.store.alpha:0)),n.showFPSMonitor!==this.config.showFPSMonitor&&(this.config.showFPSMonitor?this.fpsMonitor=new Sl(this.canvas):((i=this.fpsMonitor)==null||i.destroy(),this.fpsMonitor=void 0)),n.pixelRatio!==this.config.pixelRatio&&(this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??is)/this.config.pixelRatio),(n.enableZoom!==this.config.enableZoom||n.enableDrag!==this.config.enableDrag)&&this.updateZoomDragBehaviors(),(n.onLinkClick!==this.config.onLinkClick||n.onLinkMouseOver!==this.config.onLinkMouseOver||n.onLinkMouseOut!==this.config.onLinkMouseOut)&&this.store.updateLinkHoveringEnabled(this.config)}setPointPositions(e,n){this._isDestroyed||!this.points||(this.graph.inputPointPositions=e,this.points.shouldSkipRescale=n,this.isPointPositionsUpdateNeeded=!0,this.isLinksUpdateNeeded=!0,this.isPointColorUpdateNeeded=!0,this.isPointSizeUpdateNeeded=!0,this.isPointShapeUpdateNeeded=!0,this.isPointImageIndicesUpdateNeeded=!0,this.isPointImageSizesUpdateNeeded=!0,this.isPointClusterUpdateNeeded=!0,this.isForceManyBodyUpdateNeeded=!0,this.isForceLinkUpdateNeeded=!0,this.isForceCenterUpdateNeeded=!0)}setPointColors(e){this._isDestroyed||(this.graph.inputPointColors=e,this.isPointColorUpdateNeeded=!0)}getPointColors(){return this._isDestroyed?new Float32Array:this.graph.pointColors??new Float32Array}setPointSizes(e){this._isDestroyed||(this.graph.inputPointSizes=e,this.isPointSizeUpdateNeeded=!0)}setPointShapes(e){this._isDestroyed||(this.graph.inputPointShapes=e,this.isPointShapeUpdateNeeded=!0)}setImageData(e){this._isDestroyed||!this.points||(this.graph.inputImageData=e,this.points.createAtlas())}setPointImageIndices(e){this._isDestroyed||(this.graph.inputPointImageIndices=e,this.isPointImageIndicesUpdateNeeded=!0)}setPointImageSizes(e){this._isDestroyed||(this.graph.inputPointImageSizes=e,this.isPointImageSizesUpdateNeeded=!0)}getPointSizes(){return this._isDestroyed?new Float32Array:this.graph.pointSizes??new Float32Array}setLinks(e){this._isDestroyed||(this.graph.inputLinks=e,this.isLinksUpdateNeeded=!0,this.isLinkColorUpdateNeeded=!0,this.isLinkWidthUpdateNeeded=!0,this.isLinkArrowUpdateNeeded=!0,this.isForceLinkUpdateNeeded=!0)}setLinkColors(e){this._isDestroyed||(this.graph.inputLinkColors=e,this.isLinkColorUpdateNeeded=!0)}getLinkColors(){return this._isDestroyed?new Float32Array:this.graph.linkColors??new Float32Array}setLinkWidths(e){this._isDestroyed||(this.graph.inputLinkWidths=e,this.isLinkWidthUpdateNeeded=!0)}getLinkWidths(){return this._isDestroyed?new Float32Array:this.graph.linkWidths??new Float32Array}setLinkArrows(e){this._isDestroyed||(this.graph.linkArrowsBoolean=e,this.isLinkArrowUpdateNeeded=!0)}setLinkStrength(e){this._isDestroyed||(this.graph.inputLinkStrength=e,this.isForceLinkUpdateNeeded=!0)}setPointClusters(e){this._isDestroyed||(this.graph.inputPointClusters=e,this.isPointClusterUpdateNeeded=!0)}setClusterPositions(e){this._isDestroyed||(this.graph.inputClusterPositions=e,this.isPointClusterUpdateNeeded=!0)}setPointClusterStrength(e){this._isDestroyed||(this.graph.inputClusterStrength=e,this.isPointClusterUpdateNeeded=!0)}setPinnedPoints(e){this._isDestroyed||!this.points||(this.graph.inputPinnedPoints=e&&e.length>0?e:void 0,this.points.updatePinnedStatus())}render(e){if(this._isDestroyed||!this.reglInstance)return;this.graph.update();const{fitViewOnInit:n,fitViewDelay:i,fitViewPadding:r,fitViewDuration:o,fitViewByPointsInRect:s,fitViewByPointIndices:f,initialZoomLevel:l}=this.config;if(!this.graph.pointsNumber&&!this.graph.linksNumber){this.stopFrames(),Ft(this.canvas).style("cursor",null),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0});return}this._isFirstRenderAfterInit&&n&&l===void 0&&(this._fitViewOnInitTimeoutID=window.setTimeout(()=>{f?this.fitViewByPointIndices(f,o,r):s?this.setZoomTransformByPointPositions(s,o,void 0,r):this.fitView(o,r)},i)),this._isFirstRenderAfterInit=!1,this.update(e)}zoomToPointByIndex(e,n=700,i=Op,r=!0){if(this._isDestroyed||!this.reglInstance||!this.points||!this.canvasD3Selection)return;const{store:{screenSize:o}}=this,s=Qt(this.reglInstance,this.points.currentPositionFbo);if(e===void 0)return;const f=s[e*4+0],l=s[e*4+1];if(f===void 0||l===void 0)return;const u=this.zoomInstance.getDistanceToPoint([f,l]),m=r?i:Math.max(this.getZoomLevel(),i);if(u<Math.min(o[0],o[1]))this.setZoomTransformByPointPositions([f,l],n,m);else{const y=this.zoomInstance.getTransform([[f,l]],m),S=this.zoomInstance.getMiddlePointTransform([f,l]);this.canvasD3Selection.transition().ease(pp).duration(n/2).call(this.zoomInstance.behavior.transform,S).transition().ease(vp).duration(n/2).call(this.zoomInstance.behavior.transform,y)}}zoom(e,n=0){this._isDestroyed||this.setZoomLevel(e,n)}setZoomLevel(e,n=0){this._isDestroyed||!this.canvasD3Selection||(n===0?this.canvasD3Selection.call(this.zoomInstance.behavior.scaleTo,e):this.canvasD3Selection.transition().duration(n).call(this.zoomInstance.behavior.scaleTo,e))}getZoomLevel(){return this._isDestroyed?0:this.zoomInstance.eventTransform.k}getPointPositions(){if(this._isDestroyed||!this.reglInstance||!this.points)return[];if(this.graph.pointsNumber===void 0)return[];const e=[],n=Qt(this.reglInstance,this.points.currentPositionFbo);e.length=this.graph.pointsNumber*2;for(let i=0;i<this.graph.pointsNumber;i+=1){const r=n[i*4+0],o=n[i*4+1];r!==void 0&&o!==void 0&&(e[i*2]=r,e[i*2+1]=o)}return e}getClusterPositions(){if(this._isDestroyed||!this.reglInstance||!this.clusters)return[];if(this.graph.pointClusters===void 0||this.clusters.clusterCount===void 0)return[];this.clusters.calculateCentermass();const e=[],n=Qt(this.reglInstance,this.clusters.centermassFbo);e.length=this.clusters.clusterCount*2;for(let i=0;i<e.length/2;i+=1){const r=n[i*4+0],o=n[i*4+1],s=n[i*4+2];r!==void 0&&o!==void 0&&s!==void 0&&(e[i*2]=r/s,e[i*2+1]=o/s)}return e}fitView(e=250,n=.1){this._isDestroyed||this.setZoomTransformByPointPositions(this.getPointPositions(),e,void 0,n)}fitViewByPointIndices(e,n=250,i=.1){if(this._isDestroyed)return;const r=this.getPointPositions(),o=new Array(e.length*2);for(const[s,f]of e.entries())o[s*2]=r[f*2],o[s*2+1]=r[f*2+1];this.setZoomTransformByPointPositions(o,n,void 0,i)}fitViewByPointPositions(e,n=250,i=.1){this._isDestroyed||this.setZoomTransformByPointPositions(e,n,void 0,i)}getPointsInRect(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;const n=this.store.screenSize[1];return this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection(),Qt(this.reglInstance,this.points.selectedFbo).map((r,o)=>o%4===0&&r!==0?o/4:-1).filter(r=>r!==-1)}getPointsInRange(e){return this.getPointsInRect(e)}getPointsInPolygon(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;if(e.length<3)return new Float32Array;const n=this.store.screenSize[1],i=e.map(([o,s])=>[o,n-s]);return this.points.updatePolygonPath(i),this.points.findPointsOnPolygonSelection(),Qt(this.reglInstance,this.points.selectedFbo).map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}selectPointsInRect(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){const n=this.store.screenSize[1];this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection();const i=Qt(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=i.map((r,o)=>o%4===0&&r!==0?o/4:-1).filter(r=>r!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointsInRange(e){return this.selectPointsInRect(e)}selectPointsInPolygon(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){if(e.length<3){console.warn("Polygon path requires at least 3 points to form a polygon.");return}const n=this.store.screenSize[1],i=e.map(([o,s])=>[o,n-s]);this.points.updatePolygonPath(i),this.points.findPointsOnPolygonSelection();const r=Qt(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=r.map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointByIndex(e,n=!1){if(!this._isDestroyed)if(n){const i=this.graph.getAdjacentIndices(e)??[];this.selectPointsByIndices([e,...i])}else this.selectPointsByIndices([e])}selectPointsByIndices(e){this._isDestroyed||!this.points||(e?e.length===0?this.store.selectedIndices=new Float32Array:this.store.selectedIndices=new Float32Array(e.filter(n=>n!==void 0)):this.store.selectedIndices=null,this.points.updateGreyoutStatus())}unselectPoints(){this._isDestroyed||!this.points||(this.store.selectedIndices=null,this.points.updateGreyoutStatus())}getSelectedIndices(){if(this._isDestroyed)return null;const{selectedIndices:e}=this.store;return e?Array.from(e):null}getAdjacentIndices(e){if(!this._isDestroyed)return this.graph.getAdjacentIndices(e)}spaceToScreenPosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertSpaceToScreenPosition(e)}screenToSpacePosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertScreenToSpacePosition(e)}spaceToScreenRadius(e){return this._isDestroyed?0:this.zoomInstance.convertSpaceToScreenRadius(e)}getPointRadiusByIndex(e){var n;if(!this._isDestroyed)return(n=this.graph.pointSizes)==null?void 0:n[e]}trackPointPositionsByIndices(e){this._isDestroyed||!this.points||this.points.trackPointsByIndices(e)}getTrackedPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getTrackedPositionsMap()}getTrackedPointPositionsArray(){return this._isDestroyed||!this.points?[]:this.points.getTrackedPositionsArray()}getSampledPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getSampledPointPositionsMap()}getSampledPoints(){return this._isDestroyed||!this.points?{indices:[],positions:[]}:this.points.getSampledPoints()}getScaleX(){if(!(this._isDestroyed||!this.points))return this.points.scaleX}getScaleY(){if(!(this._isDestroyed||!this.points))return this.points.scaleY}start(e=1){var n,i;this._isDestroyed||this.graph.pointsNumber&&(e>0&&(this.store.isSimulationRunning=!0,this.store.simulationProgress=0,(i=(n=this.config).onSimulationStart)==null||i.call(n)),this.store.alpha=e,this.stopFrames(),this.frame())}pause(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!1,(n=(e=this.config).onSimulationPause)==null||n.call(e))}unpause(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!0,(n=(e=this.config).onSimulationUnpause)==null||n.call(e))}restart(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!0,(n=(e=this.config).onSimulationRestart)==null||n.call(e))}step(){this._isDestroyed||(this.store.isSimulationRunning=!1,this.stopFrames(),this.frame())}destroy(){var e,n,i,r;this._isDestroyed||!this.reglInstance||(window.clearTimeout(this._fitViewOnInitTimeoutID),this.stopFrames(),this.canvasD3Selection&&this.canvasD3Selection.on("mouseenter.cosmos",null).on("mousemove.cosmos",null).on("mouseleave.cosmos",null).on("click",null).on("mousemove",null).on("contextmenu",null).on(".drag",null).on(".zoom",null),Ft(document).on("keydown.cosmos",null).on("keyup.cosmos",null),(e=this.zoomInstance)!=null&&e.behavior&&this.zoomInstance.behavior.on("start.detect",null).on("zoom.detect",null).on("end.detect",null),(n=this.dragInstance)!=null&&n.behavior&&this.dragInstance.behavior.on("start.detect",null).on("drag.detect",null).on("end.detect",null),(i=this.fpsMonitor)==null||i.destroy(),this.reglInstance.destroy(),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0}),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.attributionDivElement&&this.attributionDivElement.parentNode&&this.attributionDivElement.parentNode.removeChild(this.attributionDivElement),(r=document.getElementById("gl-bench-style"))==null||r.remove(),this.canvasD3Selection=void 0,this.reglInstance=void 0,this.attributionDivElement=void 0,this._isDestroyed=!0)}create(){var e,n,i,r,o;this._isDestroyed||!this.points||!this.lines||(this.isPointPositionsUpdateNeeded&&this.points.updatePositions(),this.isPointColorUpdateNeeded&&this.points.updateColor(),this.isPointSizeUpdateNeeded&&this.points.updateSize(),this.isPointShapeUpdateNeeded&&this.points.updateShape(),this.isPointImageIndicesUpdateNeeded&&this.points.updateImageIndices(),this.isPointImageSizesUpdateNeeded&&this.points.updateImageSizes(),this.isLinksUpdateNeeded&&this.lines.updatePointsBuffer(),this.isLinkColorUpdateNeeded&&this.lines.updateColor(),this.isLinkWidthUpdateNeeded&&this.lines.updateWidth(),this.isLinkArrowUpdateNeeded&&this.lines.updateArrow(),this.isForceManyBodyUpdateNeeded&&((e=this.forceManyBody)==null||e.create()),this.isForceLinkUpdateNeeded&&((n=this.forceLinkIncoming)==null||n.create(Wa.INCOMING),(i=this.forceLinkOutgoing)==null||i.create(Wa.OUTGOING)),this.isForceCenterUpdateNeeded&&((r=this.forceCenter)==null||r.create()),this.isPointClusterUpdateNeeded&&((o=this.clusters)==null||o.create()),this.isPointPositionsUpdateNeeded=!1,this.isPointColorUpdateNeeded=!1,this.isPointSizeUpdateNeeded=!1,this.isPointShapeUpdateNeeded=!1,this.isPointImageIndicesUpdateNeeded=!1,this.isPointImageSizesUpdateNeeded=!1,this.isLinksUpdateNeeded=!1,this.isLinkColorUpdateNeeded=!1,this.isLinkWidthUpdateNeeded=!1,this.isLinkArrowUpdateNeeded=!1,this.isPointClusterUpdateNeeded=!1,this.isForceManyBodyUpdateNeeded=!1,this.isForceLinkUpdateNeeded=!1,this.isForceCenterUpdateNeeded=!1)}flatten(e){return e.flat()}pair(e){const n=new Array(e.length/2);for(let i=0;i<e.length/2;i++)n[i]=[e[i*2],e[i*2+1]];return n}update(e=this.store.alpha){const{graph:n}=this;this.store.pointsTextureSize=Math.ceil(Math.sqrt(n.pointsNumber??0)),this.store.linksTextureSize=Math.ceil(Math.sqrt((n.linksNumber??0)*2)),this.create(),this.initPrograms(),this.store.hoveredPoint=void 0,this.start(e)}initPrograms(){var e,n,i,r,o,s;this._isDestroyed||!this.points||!this.lines||!this.clusters||(this.points.initPrograms(),this.lines.initPrograms(),(e=this.forceGravity)==null||e.initPrograms(),(n=this.forceLinkIncoming)==null||n.initPrograms(),(i=this.forceLinkOutgoing)==null||i.initPrograms(),(r=this.forceMouse)==null||r.initPrograms(),(o=this.forceManyBody)==null||o.initPrograms(),(s=this.forceCenter)==null||s.initPrograms(),this.clusters.initPrograms())}frame(){if(this._isDestroyed)return;const{config:{simulationGravity:e,simulationCenter:n,renderLinks:i,enableSimulation:r},store:{alpha:o,isSimulationRunning:s}}=this;o<ns&&s&&this.end(),this.store.pointsTextureSize&&(this.requestAnimationFrameId=window.requestAnimationFrame(f=>{var l,u,m,y,S,D,q,Te,we,fe,Ne,Ve,V,se,Le,Be,je,nt,lt,Ee,ut,ot,N,Pe,ie,ke,He;(l=this.fpsMonitor)==null||l.begin(),this.resizeCanvas(),this.dragInstance.isActive||this.findHoveredItem(),r&&(this.isRightClickMouse&&this.config.enableRightClickRepulsion&&((u=this.forceMouse)==null||u.run(),(m=this.points)==null||m.updatePosition()),s&&!(this.zoomInstance.isRunning&&!this.config.enableSimulationDuringZoom)&&(e&&((y=this.forceGravity)==null||y.run(),(S=this.points)==null||S.updatePosition()),n&&((D=this.forceCenter)==null||D.run(),(q=this.points)==null||q.updatePosition()),(Te=this.forceManyBody)==null||Te.run(),(we=this.points)==null||we.updatePosition(),this.store.linksTextureSize&&((fe=this.forceLinkIncoming)==null||fe.run(),(Ne=this.points)==null||Ne.updatePosition(),(Ve=this.forceLinkOutgoing)==null||Ve.run(),(V=this.points)==null||V.updatePosition()),(this.graph.pointClusters||this.graph.clusterPositions)&&((se=this.clusters)==null||se.run(),(Le=this.points)==null||Le.updatePosition()),this.store.alpha+=this.store.addAlpha(this.config.simulationDecay??Oe.simulation.decay),this.isRightClickMouse&&this.config.enableRightClickRepulsion&&(this.store.alpha=Math.max(this.store.alpha,.1)),this.store.simulationProgress=Math.sqrt(Math.min(1,ns/this.store.alpha)),(lt=(nt=this.config).onSimulationTick)==null||lt.call(nt,this.store.alpha,(Be=this.store.hoveredPoint)==null?void 0:Be.index,(je=this.store.hoveredPoint)==null?void 0:je.position)),(Ee=this.points)==null||Ee.trackPoints()),(ut=this.reglInstance)==null||ut.clear({color:this.store.backgroundColor,depth:1,stencil:0}),i&&this.store.linksTextureSize&&((ot=this.lines)==null||ot.draw()),(N=this.points)==null||N.draw(),this.dragInstance.isActive&&((Pe=this.points)==null||Pe.drag(),(ie=this.points)==null||ie.drag(),(ke=this.points)==null||ke.trackPoints()),(He=this.fpsMonitor)==null||He.end(f),this.currentEvent=void 0,this._isDestroyed||this.frame()}))}stopFrames(){this.requestAnimationFrameId&&window.cancelAnimationFrame(this.requestAnimationFrameId)}end(){var e,n;this.store.isSimulationRunning=!1,this.store.simulationProgress=1,(n=(e=this.config).onSimulationEnd)==null||n.call(e)}onClick(e){var n,i,r,o,s,f,l,u,m,y;(o=(r=this.config).onClick)==null||o.call(r,(n=this.store.hoveredPoint)==null?void 0:n.index,(i=this.store.hoveredPoint)==null?void 0:i.position,e),this.store.hoveredPoint?(f=(s=this.config).onPointClick)==null||f.call(s,this.store.hoveredPoint.index,this.store.hoveredPoint.position,e):this.store.hoveredLinkIndex!==void 0?(u=(l=this.config).onLinkClick)==null||u.call(l,this.store.hoveredLinkIndex,e):(y=(m=this.config).onBackgroundClick)==null||y.call(m,e)}updateMousePosition(e){if(!e)return;const n=e.offsetX??e.x,i=e.offsetY??e.y;n===void 0||i===void 0||(this.store.mousePosition=this.zoomInstance.convertScreenToSpacePosition([n,i]),this.store.screenMousePosition=[n,this.store.screenSize[1]-i])}onMouseMove(e){var n,i,r,o;this.currentEvent=e,this.updateMousePosition(e),this.isRightClickMouse=e.which===3,(o=(r=this.config).onMouseMove)==null||o.call(r,(n=this.store.hoveredPoint)==null?void 0:n.index,(i=this.store.hoveredPoint)==null?void 0:i.position,this.currentEvent)}onRightClickMouse(e){e.preventDefault()}resizeCanvas(e=!1){var s,f,l,u;if(this._isDestroyed)return;const n=this.canvas.width,i=this.canvas.height,r=this.canvas.clientWidth,o=this.canvas.clientHeight;if(e||n!==r*this.config.pixelRatio||i!==o*this.config.pixelRatio){const[m,y]=this.store.screenSize,{k:S}=this.zoomInstance.eventTransform,D=this.zoomInstance.convertScreenToSpacePosition([m/2,y/2]);this.store.updateScreenSize(r,o),this.canvas.width=r*this.config.pixelRatio,this.canvas.height=o*this.config.pixelRatio,(s=this.reglInstance)==null||s.poll(),(f=this.canvasD3Selection)==null||f.call(this.zoomInstance.behavior.transform,this.zoomInstance.getTransform([D],S)),(l=this.points)==null||l.updateSampledPointsGrid(),this.store.isLinkHoveringEnabled&&((u=this.lines)==null||u.updateLinkIndexFbo())}}setZoomTransformByPointPositions(e,n=250,i,r){var s;this.resizeCanvas();const o=this.zoomInstance.getTransform(this.pair(e),i,r);(s=this.canvasD3Selection)==null||s.transition().ease(gp).duration(n).call(this.zoomInstance.behavior.transform,o)}updateZoomDragBehaviors(){var e,n,i,r;this.config.enableDrag?(e=this.canvasD3Selection)==null||e.call(this.dragInstance.behavior):(n=this.canvasD3Selection)==null||n.call(this.dragInstance.behavior).on(".drag",null),this.config.enableZoom?(i=this.canvasD3Selection)==null||i.call(this.zoomInstance.behavior):(r=this.canvasD3Selection)==null||r.call(this.zoomInstance.behavior).on("wheel.zoom",null)}findHoveredItem(){if(!(this._isDestroyed||!this._isMouseOnCanvas||!this.reglInstance)){if(this._findHoveredItemExecutionCount<dg){this._findHoveredItemExecutionCount+=1;return}if(this._findHoveredItemExecutionCount=0,this.findHoveredPoint(),this.graph.linksNumber&&this.store.isLinkHoveringEnabled)this.findHoveredLine();else if(this.store.hoveredLinkIndex!==void 0){const e=this.store.hoveredLinkIndex!==void 0;this.store.hoveredLinkIndex=void 0,e&&this.config.onLinkMouseOut&&this.config.onLinkMouseOut(this.currentEvent)}this.updateCanvasCursor()}}findHoveredPoint(){var o,s,f,l,u;if(this._isDestroyed||!this.reglInstance||!this.points)return;this.points.findHoveredPoint();let e=!1,n=!1;const i=Qt(this.reglInstance,this.points.hoveredFbo);if(i[1]){const m=i[0];((o=this.store.hoveredPoint)==null?void 0:o.index)!==m&&(e=!0);const y=i[2],S=i[3];this.store.hoveredPoint={index:m,position:[y,S]}}else this.store.hoveredPoint&&(n=!0),this.store.hoveredPoint=void 0;e&&this.store.hoveredPoint&&((f=(s=this.config).onPointMouseOver)==null||f.call(s,this.store.hoveredPoint.index,this.store.hoveredPoint.position,this.currentEvent)),n&&((u=(l=this.config).onPointMouseOut)==null||u.call(l,this.currentEvent))}findHoveredLine(){var o,s,f,l,u,m;if(this._isDestroyed||!this.reglInstance||!this.lines)return;if(this.store.hoveredPoint){this.store.hoveredLinkIndex!==void 0&&(this.store.hoveredLinkIndex=void 0,(s=(o=this.config).onLinkMouseOut)==null||s.call(o,this.currentEvent));return}this.lines.findHoveredLine();let e=!1,n=!1;const r=Qt(this.reglInstance,this.lines.hoveredLineIndexFbo)[0];r>=0?(this.store.hoveredLinkIndex!==r&&(e=!0),this.store.hoveredLinkIndex=r):(this.store.hoveredLinkIndex!==void 0&&(n=!0),this.store.hoveredLinkIndex=void 0),e&&this.store.hoveredLinkIndex!==void 0&&((l=(f=this.config).onLinkMouseOver)==null||l.call(f,this.store.hoveredLinkIndex)),n&&((m=(u=this.config).onLinkMouseOut)==null||m.call(u,this.currentEvent))}updateCanvasCursor(){const{hoveredPointCursor:e,hoveredLinkCursor:n}=this.config;this.dragInstance.isActive?Ft(this.canvas).style("cursor","grabbing"):this.store.hoveredPoint?!this.config.enableDrag||this.store.isSpaceKeyPressed?Ft(this.canvas).style("cursor",e):Ft(this.canvas).style("cursor","grab"):this.store.isLinkHoveringEnabled&&this.store.hoveredLinkIndex!==void 0?Ft(this.canvas).style("cursor",n):Ft(this.canvas).style("cursor",null)}addAttribution(){var e;this.config.attribution&&(this.attributionDivElement=document.createElement("div"),this.attributionDivElement.style.cssText=`
|
|
1681
|
+
`,e.textContent="Sorry, your device or browser does not support the required WebGL features for this visualization",t.appendChild(e),e}class Lg{constructor(e,n){this.config=new a0,this.graph=new I0(this.config),this.requestAnimationFrameId=0,this.isRightClickMouse=!1,this.store=new mg,this.zoomInstance=new Pg(this.store,this.config),this.dragInstance=new kg(this.store,this.config),this._findHoveredItemExecutionCount=0,this._isMouseOnCanvas=!1,this._isFirstRenderAfterInit=!0,this.isPointPositionsUpdateNeeded=!1,this.isPointColorUpdateNeeded=!1,this.isPointSizeUpdateNeeded=!1,this.isPointShapeUpdateNeeded=!1,this.isPointImageIndicesUpdateNeeded=!1,this.isLinksUpdateNeeded=!1,this.isLinkColorUpdateNeeded=!1,this.isLinkWidthUpdateNeeded=!1,this.isLinkArrowUpdateNeeded=!1,this.isPointClusterUpdateNeeded=!1,this.isForceManyBodyUpdateNeeded=!1,this.isForceLinkUpdateNeeded=!1,this.isForceCenterUpdateNeeded=!1,this.isPointImageSizesUpdateNeeded=!1,this._isDestroyed=!1,n&&this.config.init(n),this.store.div=e;const i=document.createElement("canvas");i.style.width="100%",i.style.height="100%",this.store.div.appendChild(i),this.addAttribution();const r=i.clientWidth,o=i.clientHeight;i.width=r*this.config.pixelRatio,i.height=o*this.config.pixelRatio,this.canvas=i;let s;try{s=Ep({canvas:this.canvas,attributes:{antialias:!1,preserveDrawingBuffer:!0},extensions:["OES_texture_float","ANGLE_instanced_arrays"]})}catch{Ig(this.store.div),this._isDestroyed=!0;return}this.reglInstance=s,this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.store.setWebGLMaxTextureSize(this.reglInstance.limits.maxTextureSize),this.store.updateScreenSize(r,o),this.canvasD3Selection=Ft(this.canvas),this.canvasD3Selection.on("mouseenter.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mousemove.cosmos",()=>{this._isMouseOnCanvas=!0}).on("mouseleave.cosmos",f=>{this._isMouseOnCanvas=!1,this.currentEvent=f,this.store.hoveredPoint!==void 0&&this.config.onPointMouseOut&&this.config.onPointMouseOut(f),this.store.hoveredLinkIndex!==void 0&&this.config.onLinkMouseOut&&this.config.onLinkMouseOut(f),this.isRightClickMouse=!1,this.store.hoveredPoint=void 0,this.store.hoveredLinkIndex=void 0,this.updateCanvasCursor()}),Ft(document).on("keydown.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!0)}).on("keyup.cosmos",f=>{f.code==="Space"&&(this.store.isSpaceKeyPressed=!1)}),this.zoomInstance.behavior.on("start.detect",f=>{this.currentEvent=f}).on("zoom.detect",f=>{!!f.sourceEvent&&this.updateMousePosition(f.sourceEvent),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f}),this.dragInstance.behavior.on("start.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}).on("drag.detect",f=>{this.dragInstance.isActive&&this.updateMousePosition(f),this.currentEvent=f}).on("end.detect",f=>{this.currentEvent=f,this.updateCanvasCursor()}),this.canvasD3Selection.call(this.dragInstance.behavior).call(this.zoomInstance.behavior).on("click",this.onClick.bind(this)).on("mousemove",this.onMouseMove.bind(this)).on("contextmenu",this.onRightClickMouse.bind(this)),(!this.config.enableZoom||!this.config.enableDrag)&&this.updateZoomDragBehaviors(),this.setZoomLevel(this.config.initialZoomLevel??1),this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??is)/this.config.pixelRatio,this.store.isSimulationRunning=this.config.enableSimulation,this.points=new Av(this.reglInstance,this.config,this.store,this.graph),this.lines=new uv(this.reglInstance,this.config,this.store,this.graph,this.points),this.config.enableSimulation&&(this.forceGravity=new h0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceCenter=new u0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceManyBody=this.config.useClassicQuadtree?new y0(this.reglInstance,this.config,this.store,this.graph,this.points):new v0(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkIncoming=new yl(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceLinkOutgoing=new yl(this.reglInstance,this.config,this.store,this.graph,this.points),this.forceMouse=new b0(this.reglInstance,this.config,this.store,this.graph,this.points)),this.clusters=new w0(this.reglInstance,this.config,this.store,this.graph,this.points),this.store.backgroundColor=Fn(this.config.backgroundColor),this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor??Oe.hoveredPointRingColor),this.store.setFocusedPointRingColor(this.config.focusedPointRingColor??Oe.focusedPointRingColor),this.config.focusedPointIndex!==void 0&&this.store.setFocusedPoint(this.config.focusedPointIndex),this.store.setGreyoutPointColor(this.config.pointGreyoutColor??Ra),this.store.setHoveredLinkColor(this.config.hoveredLinkColor??Oe.hoveredLinkColor),this.store.updateLinkHoveringEnabled(this.config),this.config.showFPSMonitor&&(this.fpsMonitor=new Sl(this.canvas)),this.config.randomSeed!==void 0&&this.store.addRandomSeed(this.config.randomSeed)}get progress(){return this._isDestroyed?0:this.store.simulationProgress}get isSimulationRunning(){return this._isDestroyed?!1:this.store.isSimulationRunning}get maxPointSize(){return this._isDestroyed?0:this.store.maxPointSize}setConfig(e){var i;if(this._isDestroyed||!this.reglInstance||!this.points||!this.lines||!this.clusters)return;const n={...this.config};this.config.init(e),(n.pointDefaultColor!==this.config.pointDefaultColor||n.pointColor!==this.config.pointColor)&&(this.graph.updatePointColor(),this.points.updateColor()),n.pointSize!==this.config.pointSize&&(this.graph.updatePointSize(),this.points.updateSize()),(n.linkDefaultColor!==this.config.linkDefaultColor||n.linkColor!==this.config.linkColor)&&(this.graph.updateLinkColor(),this.lines.updateColor()),n.linkWidth!==this.config.linkWidth&&(this.graph.updateLinkWidth(),this.lines.updateWidth()),n.linkArrows!==this.config.linkArrows&&(this.graph.updateArrows(),this.lines.updateArrow()),(n.curvedLinkSegments!==this.config.curvedLinkSegments||n.curvedLinks!==this.config.curvedLinks)&&this.lines.updateCurveLineGeometry(),n.backgroundColor!==this.config.backgroundColor&&(this.store.backgroundColor=Fn(this.config.backgroundColor??Qf)),n.hoveredPointRingColor!==this.config.hoveredPointRingColor&&this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor??Oe.hoveredPointRingColor),n.focusedPointRingColor!==this.config.focusedPointRingColor&&this.store.setFocusedPointRingColor(this.config.focusedPointRingColor??Oe.focusedPointRingColor),n.pointGreyoutColor!==this.config.pointGreyoutColor&&this.store.setGreyoutPointColor(this.config.pointGreyoutColor??Ra),n.hoveredLinkColor!==this.config.hoveredLinkColor&&this.store.setHoveredLinkColor(this.config.hoveredLinkColor??Oe.hoveredLinkColor),n.focusedPointIndex!==this.config.focusedPointIndex&&this.store.setFocusedPoint(this.config.focusedPointIndex),(n.spaceSize!==this.config.spaceSize||n.simulationRepulsionQuadtreeLevels!==this.config.simulationRepulsionQuadtreeLevels)&&(this.store.adjustSpaceSize(this.config.spaceSize,this.reglInstance.limits.maxTextureSize),this.resizeCanvas(!0),this.update(this.store.isSimulationRunning?this.store.alpha:0)),n.showFPSMonitor!==this.config.showFPSMonitor&&(this.config.showFPSMonitor?this.fpsMonitor=new Sl(this.canvas):((i=this.fpsMonitor)==null||i.destroy(),this.fpsMonitor=void 0)),n.pixelRatio!==this.config.pixelRatio&&(this.store.maxPointSize=(this.reglInstance.limits.pointSizeDims[1]??is)/this.config.pixelRatio),(n.enableZoom!==this.config.enableZoom||n.enableDrag!==this.config.enableDrag)&&this.updateZoomDragBehaviors(),(n.onLinkClick!==this.config.onLinkClick||n.onLinkMouseOver!==this.config.onLinkMouseOver||n.onLinkMouseOut!==this.config.onLinkMouseOut)&&this.store.updateLinkHoveringEnabled(this.config)}setPointPositions(e,n){this._isDestroyed||!this.points||(this.graph.inputPointPositions=e,this.points.shouldSkipRescale=n,this.isPointPositionsUpdateNeeded=!0,this.isLinksUpdateNeeded=!0,this.isPointColorUpdateNeeded=!0,this.isPointSizeUpdateNeeded=!0,this.isPointShapeUpdateNeeded=!0,this.isPointImageIndicesUpdateNeeded=!0,this.isPointImageSizesUpdateNeeded=!0,this.isPointClusterUpdateNeeded=!0,this.isForceManyBodyUpdateNeeded=!0,this.isForceLinkUpdateNeeded=!0,this.isForceCenterUpdateNeeded=!0)}setPointColors(e){this._isDestroyed||(this.graph.inputPointColors=e,this.isPointColorUpdateNeeded=!0)}getPointColors(){return this._isDestroyed?new Float32Array:this.graph.pointColors??new Float32Array}setPointSizes(e){this._isDestroyed||(this.graph.inputPointSizes=e,this.isPointSizeUpdateNeeded=!0)}setPointShapes(e){this._isDestroyed||(this.graph.inputPointShapes=e,this.isPointShapeUpdateNeeded=!0)}setImageData(e){this._isDestroyed||!this.points||(this.graph.inputImageData=e,this.points.createAtlas())}setPointImageIndices(e){this._isDestroyed||(this.graph.inputPointImageIndices=e,this.isPointImageIndicesUpdateNeeded=!0)}setPointImageSizes(e){this._isDestroyed||(this.graph.inputPointImageSizes=e,this.isPointImageSizesUpdateNeeded=!0)}getPointSizes(){return this._isDestroyed?new Float32Array:this.graph.pointSizes??new Float32Array}setLinks(e){this._isDestroyed||(this.graph.inputLinks=e,this.isLinksUpdateNeeded=!0,this.isLinkColorUpdateNeeded=!0,this.isLinkWidthUpdateNeeded=!0,this.isLinkArrowUpdateNeeded=!0,this.isForceLinkUpdateNeeded=!0)}setLinkColors(e){this._isDestroyed||(this.graph.inputLinkColors=e,this.isLinkColorUpdateNeeded=!0)}getLinkColors(){return this._isDestroyed?new Float32Array:this.graph.linkColors??new Float32Array}setLinkWidths(e){this._isDestroyed||(this.graph.inputLinkWidths=e,this.isLinkWidthUpdateNeeded=!0)}getLinkWidths(){return this._isDestroyed?new Float32Array:this.graph.linkWidths??new Float32Array}setLinkArrows(e){this._isDestroyed||(this.graph.linkArrowsBoolean=e,this.isLinkArrowUpdateNeeded=!0)}setLinkStrength(e){this._isDestroyed||(this.graph.inputLinkStrength=e,this.isForceLinkUpdateNeeded=!0)}setPointClusters(e){this._isDestroyed||(this.graph.inputPointClusters=e,this.isPointClusterUpdateNeeded=!0)}setClusterPositions(e){this._isDestroyed||(this.graph.inputClusterPositions=e,this.isPointClusterUpdateNeeded=!0)}setPointClusterStrength(e){this._isDestroyed||(this.graph.inputClusterStrength=e,this.isPointClusterUpdateNeeded=!0)}setPinnedPoints(e){this._isDestroyed||!this.points||(this.graph.inputPinnedPoints=e&&e.length>0?e:void 0,this.points.updatePinnedStatus())}render(e){if(this._isDestroyed||!this.reglInstance)return;this.graph.update();const{fitViewOnInit:n,fitViewDelay:i,fitViewPadding:r,fitViewDuration:o,fitViewByPointsInRect:s,fitViewByPointIndices:f,initialZoomLevel:l}=this.config;if(!this.graph.pointsNumber&&!this.graph.linksNumber){this.stopFrames(),Ft(this.canvas).style("cursor",null),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0});return}this._isFirstRenderAfterInit&&n&&l===void 0&&(this._fitViewOnInitTimeoutID=window.setTimeout(()=>{f?this.fitViewByPointIndices(f,o,r):s?this.setZoomTransformByPointPositions(s,o,void 0,r):this.fitView(o,r)},i)),this.update(e),this.startFrames(),this._isFirstRenderAfterInit=!1}zoomToPointByIndex(e,n=700,i=Op,r=!0){if(this._isDestroyed||!this.reglInstance||!this.points||!this.canvasD3Selection)return;const{store:{screenSize:o}}=this,s=Qt(this.reglInstance,this.points.currentPositionFbo);if(e===void 0)return;const f=s[e*4+0],l=s[e*4+1];if(f===void 0||l===void 0)return;const u=this.zoomInstance.getDistanceToPoint([f,l]),d=r?i:Math.max(this.getZoomLevel(),i);if(u<Math.min(o[0],o[1]))this.setZoomTransformByPointPositions([f,l],n,d);else{const y=this.zoomInstance.getTransform([[f,l]],d),S=this.zoomInstance.getMiddlePointTransform([f,l]);this.canvasD3Selection.transition().ease(pp).duration(n/2).call(this.zoomInstance.behavior.transform,S).transition().ease(vp).duration(n/2).call(this.zoomInstance.behavior.transform,y)}}zoom(e,n=0){this._isDestroyed||this.setZoomLevel(e,n)}setZoomLevel(e,n=0){this._isDestroyed||!this.canvasD3Selection||(n===0?this.canvasD3Selection.call(this.zoomInstance.behavior.scaleTo,e):this.canvasD3Selection.transition().duration(n).call(this.zoomInstance.behavior.scaleTo,e))}getZoomLevel(){return this._isDestroyed?0:this.zoomInstance.eventTransform.k}getPointPositions(){if(this._isDestroyed||!this.reglInstance||!this.points)return[];if(this.graph.pointsNumber===void 0)return[];const e=[],n=Qt(this.reglInstance,this.points.currentPositionFbo);e.length=this.graph.pointsNumber*2;for(let i=0;i<this.graph.pointsNumber;i+=1){const r=n[i*4+0],o=n[i*4+1];r!==void 0&&o!==void 0&&(e[i*2]=r,e[i*2+1]=o)}return e}getClusterPositions(){if(this._isDestroyed||!this.reglInstance||!this.clusters)return[];if(this.graph.pointClusters===void 0||this.clusters.clusterCount===void 0)return[];this.clusters.calculateCentermass();const e=[],n=Qt(this.reglInstance,this.clusters.centermassFbo);e.length=this.clusters.clusterCount*2;for(let i=0;i<e.length/2;i+=1){const r=n[i*4+0],o=n[i*4+1],s=n[i*4+2];r!==void 0&&o!==void 0&&s!==void 0&&(e[i*2]=r/s,e[i*2+1]=o/s)}return e}fitView(e=250,n=.1){this._isDestroyed||this.setZoomTransformByPointPositions(this.getPointPositions(),e,void 0,n)}fitViewByPointIndices(e,n=250,i=.1){if(this._isDestroyed)return;const r=this.getPointPositions(),o=new Array(e.length*2);for(const[s,f]of e.entries())o[s*2]=r[f*2],o[s*2+1]=r[f*2+1];this.setZoomTransformByPointPositions(o,n,void 0,i)}fitViewByPointPositions(e,n=250,i=.1){this._isDestroyed||this.setZoomTransformByPointPositions(e,n,void 0,i)}getPointsInRect(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;const n=this.store.screenSize[1];return this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection(),Qt(this.reglInstance,this.points.selectedFbo).map((r,o)=>o%4===0&&r!==0?o/4:-1).filter(r=>r!==-1)}getPointsInRange(e){return this.getPointsInRect(e)}getPointsInPolygon(e){if(this._isDestroyed||!this.reglInstance||!this.points)return new Float32Array;if(e.length<3)return new Float32Array;const n=this.store.screenSize[1],i=e.map(([o,s])=>[o,n-s]);return this.points.updatePolygonPath(i),this.points.findPointsOnPolygonSelection(),Qt(this.reglInstance,this.points.selectedFbo).map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}selectPointsInRect(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){const n=this.store.screenSize[1];this.store.selectedArea=[[e[0][0],n-e[1][1]],[e[1][0],n-e[0][1]]],this.points.findPointsOnAreaSelection();const i=Qt(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=i.map((r,o)=>o%4===0&&r!==0?o/4:-1).filter(r=>r!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointsInRange(e){return this.selectPointsInRect(e)}selectPointsInPolygon(e){if(!(this._isDestroyed||!this.reglInstance||!this.points)){if(e){if(e.length<3){console.warn("Polygon path requires at least 3 points to form a polygon.");return}const n=this.store.screenSize[1],i=e.map(([o,s])=>[o,n-s]);this.points.updatePolygonPath(i),this.points.findPointsOnPolygonSelection();const r=Qt(this.reglInstance,this.points.selectedFbo);this.store.selectedIndices=r.map((o,s)=>s%4===0&&o!==0?s/4:-1).filter(o=>o!==-1)}else this.store.selectedIndices=null;this.points.updateGreyoutStatus()}}selectPointByIndex(e,n=!1){if(!this._isDestroyed)if(n){const i=this.graph.getAdjacentIndices(e)??[];this.selectPointsByIndices([e,...i])}else this.selectPointsByIndices([e])}selectPointsByIndices(e){this._isDestroyed||!this.points||(e?e.length===0?this.store.selectedIndices=new Float32Array:this.store.selectedIndices=new Float32Array(e.filter(n=>n!==void 0)):this.store.selectedIndices=null,this.points.updateGreyoutStatus())}unselectPoints(){this._isDestroyed||!this.points||(this.store.selectedIndices=null,this.points.updateGreyoutStatus())}getSelectedIndices(){if(this._isDestroyed)return null;const{selectedIndices:e}=this.store;return e?Array.from(e):null}getAdjacentIndices(e){if(!this._isDestroyed)return this.graph.getAdjacentIndices(e)}spaceToScreenPosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertSpaceToScreenPosition(e)}screenToSpacePosition(e){return this._isDestroyed?[0,0]:this.zoomInstance.convertScreenToSpacePosition(e)}spaceToScreenRadius(e){return this._isDestroyed?0:this.zoomInstance.convertSpaceToScreenRadius(e)}getPointRadiusByIndex(e){var n;if(!this._isDestroyed)return(n=this.graph.pointSizes)==null?void 0:n[e]}trackPointPositionsByIndices(e){this._isDestroyed||!this.points||this.points.trackPointsByIndices(e)}getTrackedPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getTrackedPositionsMap()}getTrackedPointPositionsArray(){return this._isDestroyed||!this.points?[]:this.points.getTrackedPositionsArray()}getSampledPointPositionsMap(){return this._isDestroyed||!this.points?new Map:this.points.getSampledPointPositionsMap()}getSampledPoints(){return this._isDestroyed||!this.points?{indices:[],positions:[]}:this.points.getSampledPoints()}getScaleX(){if(!(this._isDestroyed||!this.points))return this.points.scaleX}getScaleY(){if(!(this._isDestroyed||!this.points))return this.points.scaleY}start(e=1){var n,i;this._isDestroyed||this.graph.pointsNumber&&(this.store.isSimulationRunning=!0,this.store.simulationProgress=0,this.store.alpha=e,(i=(n=this.config).onSimulationStart)==null||i.call(n))}stop(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!1,this.store.simulationProgress=0,this.store.alpha=0,(n=(e=this.config).onSimulationEnd)==null||n.call(e))}pause(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!1,(n=(e=this.config).onSimulationPause)==null||n.call(e))}unpause(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!0,(n=(e=this.config).onSimulationUnpause)==null||n.call(e))}restart(){var e,n;this._isDestroyed||(this.store.isSimulationRunning=!0,(n=(e=this.config).onSimulationRestart)==null||n.call(e))}step(){this._isDestroyed||this.config.enableSimulation&&this.store.pointsTextureSize&&this.runSimulationStep(!0)}destroy(){var e,n,i,r;this._isDestroyed||!this.reglInstance||(window.clearTimeout(this._fitViewOnInitTimeoutID),this.stopFrames(),this.canvasD3Selection&&this.canvasD3Selection.on("mouseenter.cosmos",null).on("mousemove.cosmos",null).on("mouseleave.cosmos",null).on("click",null).on("mousemove",null).on("contextmenu",null).on(".drag",null).on(".zoom",null),Ft(document).on("keydown.cosmos",null).on("keyup.cosmos",null),(e=this.zoomInstance)!=null&&e.behavior&&this.zoomInstance.behavior.on("start.detect",null).on("zoom.detect",null).on("end.detect",null),(n=this.dragInstance)!=null&&n.behavior&&this.dragInstance.behavior.on("start.detect",null).on("drag.detect",null).on("end.detect",null),(i=this.fpsMonitor)==null||i.destroy(),this.reglInstance.destroy(),this.reglInstance.clear({color:this.store.backgroundColor,depth:1,stencil:0}),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.attributionDivElement&&this.attributionDivElement.parentNode&&this.attributionDivElement.parentNode.removeChild(this.attributionDivElement),(r=document.getElementById("gl-bench-style"))==null||r.remove(),this.canvasD3Selection=void 0,this.reglInstance=void 0,this.attributionDivElement=void 0,this._isDestroyed=!0)}create(){var e,n,i,r,o;this._isDestroyed||!this.points||!this.lines||(this.isPointPositionsUpdateNeeded&&this.points.updatePositions(),this.isPointColorUpdateNeeded&&this.points.updateColor(),this.isPointSizeUpdateNeeded&&this.points.updateSize(),this.isPointShapeUpdateNeeded&&this.points.updateShape(),this.isPointImageIndicesUpdateNeeded&&this.points.updateImageIndices(),this.isPointImageSizesUpdateNeeded&&this.points.updateImageSizes(),this.isLinksUpdateNeeded&&this.lines.updatePointsBuffer(),this.isLinkColorUpdateNeeded&&this.lines.updateColor(),this.isLinkWidthUpdateNeeded&&this.lines.updateWidth(),this.isLinkArrowUpdateNeeded&&this.lines.updateArrow(),this.isForceManyBodyUpdateNeeded&&((e=this.forceManyBody)==null||e.create()),this.isForceLinkUpdateNeeded&&((n=this.forceLinkIncoming)==null||n.create(Wa.INCOMING),(i=this.forceLinkOutgoing)==null||i.create(Wa.OUTGOING)),this.isForceCenterUpdateNeeded&&((r=this.forceCenter)==null||r.create()),this.isPointClusterUpdateNeeded&&((o=this.clusters)==null||o.create()),this.isPointPositionsUpdateNeeded=!1,this.isPointColorUpdateNeeded=!1,this.isPointSizeUpdateNeeded=!1,this.isPointShapeUpdateNeeded=!1,this.isPointImageIndicesUpdateNeeded=!1,this.isPointImageSizesUpdateNeeded=!1,this.isLinksUpdateNeeded=!1,this.isLinkColorUpdateNeeded=!1,this.isLinkWidthUpdateNeeded=!1,this.isLinkArrowUpdateNeeded=!1,this.isPointClusterUpdateNeeded=!1,this.isForceManyBodyUpdateNeeded=!1,this.isForceLinkUpdateNeeded=!1,this.isForceCenterUpdateNeeded=!1)}flatten(e){return e.flat()}pair(e){const n=new Array(e.length/2);for(let i=0;i<e.length/2;i++)n[i]=[e[i*2],e[i*2+1]];return n}update(e=this.store.alpha){const{graph:n}=this;this.store.pointsTextureSize=Math.ceil(Math.sqrt(n.pointsNumber??0)),this.store.linksTextureSize=Math.ceil(Math.sqrt((n.linksNumber??0)*2)),this.create(),this.initPrograms(),this.store.hoveredPoint=void 0,this.store.alpha=e}runSimulationStep(e=!1){var f,l,u,d,y,S,D,q,Te,we,fe,Ne,Ve,V,ae,Ie,Be,Xe,nt;const{config:{simulationGravity:n,simulationCenter:i,enableSimulation:r},store:{isSimulationRunning:o}}=this;if(!r)return;this.isRightClickMouse&&this.config.enableRightClickRepulsion&&((f=this.forceMouse)==null||f.run(),(l=this.points)==null||l.updatePosition()),(e||o&&!(this.zoomInstance.isRunning&&!this.config.enableSimulationDuringZoom))&&(n&&((u=this.forceGravity)==null||u.run(),(d=this.points)==null||d.updatePosition()),i&&((y=this.forceCenter)==null||y.run(),(S=this.points)==null||S.updatePosition()),(D=this.forceManyBody)==null||D.run(),(q=this.points)==null||q.updatePosition(),this.store.linksTextureSize&&((Te=this.forceLinkIncoming)==null||Te.run(),(we=this.points)==null||we.updatePosition(),(fe=this.forceLinkOutgoing)==null||fe.run(),(Ne=this.points)==null||Ne.updatePosition()),(this.graph.pointClusters||this.graph.clusterPositions)&&((Ve=this.clusters)==null||Ve.run(),(V=this.points)==null||V.updatePosition()),this.store.alpha+=this.store.addAlpha(this.config.simulationDecay??Oe.simulation.decay),this.isRightClickMouse&&this.config.enableRightClickRepulsion&&(this.store.alpha=Math.max(this.store.alpha,.1)),this.store.simulationProgress=Math.sqrt(Math.min(1,ns/this.store.alpha)),(Xe=(Be=this.config).onSimulationTick)==null||Xe.call(Be,this.store.alpha,(ae=this.store.hoveredPoint)==null?void 0:ae.index,(Ie=this.store.hoveredPoint)==null?void 0:Ie.position)),(nt=this.points)==null||nt.trackPoints()}initPrograms(){var e,n,i,r,o,s;this._isDestroyed||!this.points||!this.lines||!this.clusters||(this.points.initPrograms(),this.lines.initPrograms(),(e=this.forceGravity)==null||e.initPrograms(),(n=this.forceLinkIncoming)==null||n.initPrograms(),(i=this.forceLinkOutgoing)==null||i.initPrograms(),(r=this.forceMouse)==null||r.initPrograms(),(o=this.forceManyBody)==null||o.initPrograms(),(s=this.forceCenter)==null||s.initPrograms(),this.clusters.initPrograms())}frame(){if(this._isDestroyed)return;const{store:{alpha:e,isSimulationRunning:n}}=this;e<ns&&n&&this.end(),this.requestAnimationFrameId=window.requestAnimationFrame(i=>{this.renderFrame(i),this._isDestroyed||this.frame()})}renderFrame(e){var i,r,o,s,f,l,u,d;if(this._isDestroyed||!this.store.pointsTextureSize)return;(i=this.fpsMonitor)==null||i.begin(),this.resizeCanvas(),this.dragInstance.isActive||this.findHoveredItem(),this.runSimulationStep(!1),(r=this.reglInstance)==null||r.clear({color:this.store.backgroundColor,depth:1,stencil:0});const{config:{renderLinks:n}}=this;n&&this.store.linksTextureSize&&((o=this.lines)==null||o.draw()),(s=this.points)==null||s.draw(),this.dragInstance.isActive&&((f=this.points)==null||f.drag(),(l=this.points)==null||l.drag(),(u=this.points)==null||u.trackPoints()),(d=this.fpsMonitor)==null||d.end(e??performance.now()),this.currentEvent=void 0}stopFrames(){this.requestAnimationFrameId&&(window.cancelAnimationFrame(this.requestAnimationFrameId),this.requestAnimationFrameId=0)}startFrames(){this._isDestroyed||(this.stopFrames(),this.frame())}end(){var e,n;this.store.isSimulationRunning=!1,this.store.simulationProgress=1,(n=(e=this.config).onSimulationEnd)==null||n.call(e)}onClick(e){var n,i,r,o,s,f,l,u,d,y;(o=(r=this.config).onClick)==null||o.call(r,(n=this.store.hoveredPoint)==null?void 0:n.index,(i=this.store.hoveredPoint)==null?void 0:i.position,e),this.store.hoveredPoint?(f=(s=this.config).onPointClick)==null||f.call(s,this.store.hoveredPoint.index,this.store.hoveredPoint.position,e):this.store.hoveredLinkIndex!==void 0?(u=(l=this.config).onLinkClick)==null||u.call(l,this.store.hoveredLinkIndex,e):(y=(d=this.config).onBackgroundClick)==null||y.call(d,e)}updateMousePosition(e){if(!e)return;const n=e.offsetX??e.x,i=e.offsetY??e.y;n===void 0||i===void 0||(this.store.mousePosition=this.zoomInstance.convertScreenToSpacePosition([n,i]),this.store.screenMousePosition=[n,this.store.screenSize[1]-i])}onMouseMove(e){var n,i,r,o;this.currentEvent=e,this.updateMousePosition(e),this.isRightClickMouse=e.which===3,(o=(r=this.config).onMouseMove)==null||o.call(r,(n=this.store.hoveredPoint)==null?void 0:n.index,(i=this.store.hoveredPoint)==null?void 0:i.position,this.currentEvent)}onRightClickMouse(e){e.preventDefault()}resizeCanvas(e=!1){var s,f,l,u;if(this._isDestroyed)return;const n=this.canvas.width,i=this.canvas.height,r=this.canvas.clientWidth,o=this.canvas.clientHeight;if(e||n!==r*this.config.pixelRatio||i!==o*this.config.pixelRatio){const[d,y]=this.store.screenSize,{k:S}=this.zoomInstance.eventTransform,D=this.zoomInstance.convertScreenToSpacePosition([d/2,y/2]);this.store.updateScreenSize(r,o),this.canvas.width=r*this.config.pixelRatio,this.canvas.height=o*this.config.pixelRatio,(s=this.reglInstance)==null||s.poll(),(f=this.canvasD3Selection)==null||f.call(this.zoomInstance.behavior.transform,this.zoomInstance.getTransform([D],S)),(l=this.points)==null||l.updateSampledPointsGrid(),this.store.isLinkHoveringEnabled&&((u=this.lines)==null||u.updateLinkIndexFbo())}}setZoomTransformByPointPositions(e,n=250,i,r){var s;this.resizeCanvas();const o=this.zoomInstance.getTransform(this.pair(e),i,r);(s=this.canvasD3Selection)==null||s.transition().ease(gp).duration(n).call(this.zoomInstance.behavior.transform,o)}updateZoomDragBehaviors(){var e,n,i,r;this.config.enableDrag?(e=this.canvasD3Selection)==null||e.call(this.dragInstance.behavior):(n=this.canvasD3Selection)==null||n.call(this.dragInstance.behavior).on(".drag",null),this.config.enableZoom?(i=this.canvasD3Selection)==null||i.call(this.zoomInstance.behavior):(r=this.canvasD3Selection)==null||r.call(this.zoomInstance.behavior).on("wheel.zoom",null)}findHoveredItem(){if(!(this._isDestroyed||!this._isMouseOnCanvas||!this.reglInstance)){if(this._findHoveredItemExecutionCount<dg){this._findHoveredItemExecutionCount+=1;return}if(this._findHoveredItemExecutionCount=0,this.findHoveredPoint(),this.graph.linksNumber&&this.store.isLinkHoveringEnabled)this.findHoveredLine();else if(this.store.hoveredLinkIndex!==void 0){const e=this.store.hoveredLinkIndex!==void 0;this.store.hoveredLinkIndex=void 0,e&&this.config.onLinkMouseOut&&this.config.onLinkMouseOut(this.currentEvent)}this.updateCanvasCursor()}}findHoveredPoint(){var o,s,f,l,u;if(this._isDestroyed||!this.reglInstance||!this.points)return;this.points.findHoveredPoint();let e=!1,n=!1;const i=Qt(this.reglInstance,this.points.hoveredFbo);if(i[1]){const d=i[0];((o=this.store.hoveredPoint)==null?void 0:o.index)!==d&&(e=!0);const y=i[2],S=i[3];this.store.hoveredPoint={index:d,position:[y,S]}}else this.store.hoveredPoint&&(n=!0),this.store.hoveredPoint=void 0;e&&this.store.hoveredPoint&&((f=(s=this.config).onPointMouseOver)==null||f.call(s,this.store.hoveredPoint.index,this.store.hoveredPoint.position,this.currentEvent)),n&&((u=(l=this.config).onPointMouseOut)==null||u.call(l,this.currentEvent))}findHoveredLine(){var o,s,f,l,u,d;if(this._isDestroyed||!this.reglInstance||!this.lines)return;if(this.store.hoveredPoint){this.store.hoveredLinkIndex!==void 0&&(this.store.hoveredLinkIndex=void 0,(s=(o=this.config).onLinkMouseOut)==null||s.call(o,this.currentEvent));return}this.lines.findHoveredLine();let e=!1,n=!1;const r=Qt(this.reglInstance,this.lines.hoveredLineIndexFbo)[0];r>=0?(this.store.hoveredLinkIndex!==r&&(e=!0),this.store.hoveredLinkIndex=r):(this.store.hoveredLinkIndex!==void 0&&(n=!0),this.store.hoveredLinkIndex=void 0),e&&this.store.hoveredLinkIndex!==void 0&&((l=(f=this.config).onLinkMouseOver)==null||l.call(f,this.store.hoveredLinkIndex)),n&&((d=(u=this.config).onLinkMouseOut)==null||d.call(u,this.currentEvent))}updateCanvasCursor(){const{hoveredPointCursor:e,hoveredLinkCursor:n}=this.config;this.dragInstance.isActive?Ft(this.canvas).style("cursor","grabbing"):this.store.hoveredPoint?!this.config.enableDrag||this.store.isSpaceKeyPressed?Ft(this.canvas).style("cursor",e):Ft(this.canvas).style("cursor","grab"):this.store.isLinkHoveringEnabled&&this.store.hoveredLinkIndex!==void 0?Ft(this.canvas).style("cursor",n):Ft(this.canvas).style("cursor",null)}addAttribution(){var e;this.config.attribution&&(this.attributionDivElement=document.createElement("div"),this.attributionDivElement.style.cssText=`
|
|
1682
1682
|
user-select: none;
|
|
1683
1683
|
position: absolute;
|
|
1684
1684
|
bottom: 0;
|